Update auf Skills

This commit is contained in:
2026-08-29 17:02:35 +02:00
parent d6a50d8a0d
commit 7aec6c39a1
60 changed files with 9937 additions and 50 deletions
+24
View File
@@ -0,0 +1,24 @@
import json, os, ssl, sys
from urllib.request import Request, urlopen
from urllib.error import HTTPError, URLError
PROTO='jarvis.skill.invoke.v1'
def truthy(v): return str(v or '').strip().lower() in ('1','true','yes','on')
def fail(c,m): return {'protocol':PROTO,'success':False,'error':{'code':c,'message':m}}
def ok(d,m='OK',mut=False): return {'protocol':PROTO,'success':True,'data':d,'message':m,'mutated':mut}
def main(inv):
x=inv.get('input') or {}; base=os.getenv('NTFY_BASE_URL','https://ntfy.sh').strip().rstrip('/'); topic=(x.get('topic') or os.getenv('NTFY_DEFAULT_TOPIC','')).strip()
if not topic: return fail('CONFIG_MISSING','NTFY_DEFAULT_TOPIC oder input.topic fehlt')
h={'Content-Type':'text/plain; charset=utf-8'}; token=os.getenv('NTFY_TOKEN','').strip()
if token: h['Authorization']='Bearer '+token
if x.get('title'): h['Title']=x['title']
if x.get('priority'): h['Priority']=x['priority']
if x.get('tags'): h['Tags']=x['tags']
ctx=ssl._create_unverified_context() if base.startswith('https://') and not truthy(os.getenv('NTFY_VERIFY_TLS','true')) else None
try:
with urlopen(Request(base+'/'+topic,data=x['message'].encode(),headers=h,method='POST'),timeout=6,context=ctx) as r: r.read()
except HTTPError as e: raise RuntimeError(f'ntfy HTTP {e.code}: {e.read().decode(errors="replace")[:500]}')
except URLError as e: raise RuntimeError(f'ntfy nicht erreichbar: {e.reason}')
return ok({'sent':True,'topic':topic},'Benachrichtigung gesendet.',True)
try: res=main(json.load(sys.stdin))
except Exception as e: res=fail('NTFY_ERROR',str(e))
json.dump(res,sys.stdout,ensure_ascii=False)
+72
View File
@@ -0,0 +1,72 @@
{
"protocol": "jarvis.skill.v1",
"id": "notify.ntfy",
"name": "ntfy Notifications",
"version": "1.0.0",
"description": "Sendet Benachrichtigungen an einen selbstgehosteten oder öffentlichen ntfy-Server.",
"runtime": {
"type": "process",
"command": "python3",
"args": [
"main.py"
],
"timeout_ms": 8000,
"env_from": [
"NTFY_BASE_URL",
"NTFY_TOKEN",
"NTFY_DEFAULT_TOPIC",
"NTFY_VERIFY_TLS"
]
},
"permissions": {
"network": true,
"system_exec": true
},
"actions": [
{
"name": "send",
"description": "Sendet eine ntfy-Benachrichtigung.",
"mutates": true,
"input_schema": {
"type": "object",
"properties": {
"message": {
"type": "string"
},
"title": {
"type": "string"
},
"topic": {
"type": "string"
},
"priority": {
"type": "string"
},
"tags": {
"type": "string"
}
},
"required": [
"message"
],
"additionalProperties": false
},
"output_schema": {
"type": "object",
"properties": {
"sent": {
"type": "boolean"
},
"topic": {
"type": "string"
}
},
"required": [
"sent",
"topic"
],
"additionalProperties": false
}
}
]
}