@xdxer/dingtalk-agent 0.1.4-beta.11 → 0.1.4-beta.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/README.md +1 -1
- package/dist/bin/dingtalk-agent.js +16 -4
- package/dist/bin/dingtalk-agent.js.map +1 -1
- package/dist/src/agent-platform.js +47 -3
- package/dist/src/agent-platform.js.map +1 -1
- package/dist/src/skill-manager.js +2 -1
- package/dist/src/skill-manager.js.map +1 -1
- package/package.json +2 -1
- package/skills/dingtalk-agent-compose/SKILL.md +17 -7
- package/skills/multica-fde-external/SKILL.md +280 -0
- package/skills/multica-fde-external/scripts/bootstrap.sh +78 -0
- package/skills/multica-fde-external/scripts/multica_ext.py +1178 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
# Bootstrap: fetch the multica-fde-external skill from a Multica workspace
|
|
3
|
+
# onto this machine. Solves the chicken-and-egg problem (skill-pull lives
|
|
4
|
+
# inside the skill) using only tools already present: the multica CLI, or
|
|
5
|
+
# curl with endpoint+token. python3 is required either way (the skill's
|
|
6
|
+
# script needs it too).
|
|
7
|
+
#
|
|
8
|
+
# Path A (default) — authenticated multica CLI:
|
|
9
|
+
# sh bootstrap.sh [--profile <name>] [--workspace-id <uuid>] [--dest <dir>]
|
|
10
|
+
# Path B — no CLI, just endpoint + token:
|
|
11
|
+
# MULTICA_SERVER_URL=... MULTICA_TOKEN=... MULTICA_WORKSPACE_ID=... \
|
|
12
|
+
# sh bootstrap.sh --curl [--dest <dir>]
|
|
13
|
+
#
|
|
14
|
+
# curl runs with --noproxy '*' so an exported shell proxy cannot break
|
|
15
|
+
# intranet/pre endpoints (the Go CLI needs proxies unset by the caller).
|
|
16
|
+
set -eu
|
|
17
|
+
|
|
18
|
+
SKILL_NAME="multica-fde-external"
|
|
19
|
+
DEST=""
|
|
20
|
+
PROFILE=""
|
|
21
|
+
WS_ID=""
|
|
22
|
+
MODE="cli"
|
|
23
|
+
|
|
24
|
+
while [ $# -gt 0 ]; do
|
|
25
|
+
case "$1" in
|
|
26
|
+
--profile) PROFILE="$2"; shift 2 ;;
|
|
27
|
+
--workspace-id) WS_ID="$2"; shift 2 ;;
|
|
28
|
+
--dest) DEST="$2"; shift 2 ;;
|
|
29
|
+
--name) SKILL_NAME="$2"; shift 2 ;;
|
|
30
|
+
--curl) MODE="curl"; shift ;;
|
|
31
|
+
*) echo "unknown argument: $1" >&2; exit 1 ;;
|
|
32
|
+
esac
|
|
33
|
+
done
|
|
34
|
+
|
|
35
|
+
RESOLVE='
|
|
36
|
+
import json, sys
|
|
37
|
+
name = sys.argv[1]
|
|
38
|
+
ids = [s.get("id") for s in json.load(sys.stdin) if isinstance(s, dict) and s.get("name") == name]
|
|
39
|
+
print(ids[0] if ids else "", end="")
|
|
40
|
+
'
|
|
41
|
+
|
|
42
|
+
UNPACK='
|
|
43
|
+
import json, sys, pathlib
|
|
44
|
+
sk = json.load(sys.stdin)
|
|
45
|
+
dest = sys.argv[1] if len(sys.argv) > 1 and sys.argv[1] else sk["name"]
|
|
46
|
+
d = pathlib.Path(dest)
|
|
47
|
+
d.mkdir(parents=True, exist_ok=True)
|
|
48
|
+
(d / "SKILL.md").write_text(sk.get("content") or "", encoding="utf-8")
|
|
49
|
+
count = 1
|
|
50
|
+
for f in sk.get("files") or []:
|
|
51
|
+
rel = f.get("path") or ""
|
|
52
|
+
parts = pathlib.Path(rel).parts
|
|
53
|
+
if not parts or pathlib.Path(rel).is_absolute() or ".." in parts or rel == "SKILL.md":
|
|
54
|
+
continue
|
|
55
|
+
p = d / rel
|
|
56
|
+
p.parent.mkdir(parents=True, exist_ok=True)
|
|
57
|
+
p.write_text(f.get("content") or "", encoding="utf-8")
|
|
58
|
+
count += 1
|
|
59
|
+
print("pulled %d file(s) -> %s" % (count, d.resolve()))
|
|
60
|
+
'
|
|
61
|
+
|
|
62
|
+
if [ "$MODE" = "cli" ]; then
|
|
63
|
+
CLI="multica"
|
|
64
|
+
[ -n "$PROFILE" ] && CLI="$CLI --profile $PROFILE"
|
|
65
|
+
[ -n "$WS_ID" ] && CLI="$CLI --workspace-id $WS_ID"
|
|
66
|
+
SID=$($CLI skill list --output json | python3 -c "$RESOLVE" "$SKILL_NAME")
|
|
67
|
+
[ -n "$SID" ] || { echo "skill \"$SKILL_NAME\" not found in the workspace" >&2; exit 1; }
|
|
68
|
+
$CLI skill get "$SID" --output json | python3 -c "$UNPACK" "$DEST"
|
|
69
|
+
else
|
|
70
|
+
: "${MULTICA_SERVER_URL:?set MULTICA_SERVER_URL}"
|
|
71
|
+
: "${MULTICA_TOKEN:?set MULTICA_TOKEN}"
|
|
72
|
+
: "${MULTICA_WORKSPACE_ID:?set MULTICA_WORKSPACE_ID}"
|
|
73
|
+
AUTH="Authorization: Bearer $MULTICA_TOKEN"
|
|
74
|
+
WS="X-Workspace-ID: $MULTICA_WORKSPACE_ID"
|
|
75
|
+
SID=$(curl -fsS --noproxy '*' -H "$AUTH" -H "$WS" "$MULTICA_SERVER_URL/api/skills" | python3 -c "$RESOLVE" "$SKILL_NAME")
|
|
76
|
+
[ -n "$SID" ] || { echo "skill \"$SKILL_NAME\" not found in the workspace" >&2; exit 1; }
|
|
77
|
+
curl -fsS --noproxy '*' -H "$AUTH" -H "$WS" "$MULTICA_SERVER_URL/api/skills/$SID" | python3 -c "$UNPACK" "$DEST"
|
|
78
|
+
fi
|