openclaw-multi-auto 1.5.2 → 1.5.4

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.
Files changed (185) hide show
  1. package/dist/{audio-preflight-5FEeDooz.js → audio-preflight-DDBLZBdb.js} +4 -4
  2. package/dist/{audio-transcription-runner-B-UvoDjZ.js → audio-transcription-runner-DZbSWT9E.js} +1 -1
  3. package/dist/build-info.json +3 -3
  4. package/dist/canvas-host/a2ui/.bundle.hash +1 -1
  5. package/dist/{chrome-D45SyhQL.js → chrome-CMU2WVFh.js} +8 -8
  6. package/dist/{deliver-B9cys0EZ.js → deliver-BXVcFIHL.js} +1 -1
  7. package/dist/{deliver-runtime-DhaQJ0pI.js → deliver-runtime-DTaIS-1i.js} +3 -3
  8. package/dist/{deps-send-whatsapp.runtime-DvTL2tzN.js → deps-send-whatsapp.runtime-CIZqFAqb.js} +7 -7
  9. package/dist/extensionAPI.js +6 -6
  10. package/dist/{image-DAOPwVXi.js → image-BCVLo0qw.js} +1 -1
  11. package/dist/{image-runtime-wlCLVvVv.js → image-runtime-DtCKpMPZ.js} +3 -3
  12. package/dist/{pi-embedded-DYU79yGe.js → pi-embedded-CgQ_W6Xs.js} +24 -24
  13. package/dist/{pi-embedded-helpers-uTRAmQ4n.js → pi-embedded-helpers-CwuBTKza.js} +3 -3
  14. package/dist/plugin-sdk/accounts-CJWOBzwB.js +35 -0
  15. package/dist/plugin-sdk/accounts-DP1-L-QS.js +288 -0
  16. package/dist/plugin-sdk/accounts-DZhWlEg3.js +46 -0
  17. package/dist/plugin-sdk/active-listener-B_sLJTXM.js +50 -0
  18. package/dist/plugin-sdk/api-key-rotation-BRE4X2tf.js +181 -0
  19. package/dist/plugin-sdk/audio-preflight-DGEUDxxR.js +69 -0
  20. package/dist/plugin-sdk/audio-transcription-runner-DkoPNPYt.js +2176 -0
  21. package/dist/plugin-sdk/audit-membership-runtime-DSBHHw7o.js +58 -0
  22. package/dist/plugin-sdk/bluebubbles.js +2 -2
  23. package/dist/plugin-sdk/channel-activity-F3d0yUwy.js +94 -0
  24. package/dist/plugin-sdk/channel-web-QF7EpjeP.js +2256 -0
  25. package/dist/plugin-sdk/chrome-BXoCyCkY.js +2415 -0
  26. package/dist/plugin-sdk/commands-registry-t7cXBTfN.js +1125 -0
  27. package/dist/plugin-sdk/config-BkEnz2Po.js +17913 -0
  28. package/dist/plugin-sdk/deliver-B6AG_l67.js +1694 -0
  29. package/dist/plugin-sdk/deliver-runtime-D585kJZc.js +32 -0
  30. package/dist/plugin-sdk/deps-send-discord.runtime-a_OKY2js.js +23 -0
  31. package/dist/plugin-sdk/deps-send-imessage.runtime-Baxy9TD4.js +22 -0
  32. package/dist/plugin-sdk/deps-send-signal.runtime-BwXoCrFl.js +21 -0
  33. package/dist/plugin-sdk/deps-send-slack.runtime-CLmKjgso.js +19 -0
  34. package/dist/plugin-sdk/deps-send-telegram.runtime-BKfdBKnZ.js +24 -0
  35. package/dist/plugin-sdk/deps-send-whatsapp.runtime-BOTwkbx_.js +57 -0
  36. package/dist/plugin-sdk/diagnostic-CsP-lEkI.js +319 -0
  37. package/dist/plugin-sdk/errors-DaiAM-yU.js +54 -0
  38. package/dist/plugin-sdk/fetch-guard-DETCcJzQ.js +156 -0
  39. package/dist/plugin-sdk/fs-safe-B8y811FR.js +352 -0
  40. package/dist/plugin-sdk/image-DjTEkYZE.js +2310 -0
  41. package/dist/plugin-sdk/image-ops-BSiMpAw4.js +584 -0
  42. package/dist/plugin-sdk/image-runtime-6xPp8m5a.js +25 -0
  43. package/dist/plugin-sdk/index.js +50 -50
  44. package/dist/plugin-sdk/ir-DQ7_HbvK.js +1296 -0
  45. package/dist/plugin-sdk/irc.js +2 -2
  46. package/dist/plugin-sdk/local-roots-BUP4YBmR.js +186 -0
  47. package/dist/plugin-sdk/logger-CZY9KIoY.js +1163 -0
  48. package/dist/plugin-sdk/login-BxEKLlCo.js +57 -0
  49. package/dist/plugin-sdk/login-qr-BQIpMPr9.js +320 -0
  50. package/dist/plugin-sdk/manager-I6KbPihW.js +3917 -0
  51. package/dist/plugin-sdk/manager-runtime-CFfYYWIQ.js +15 -0
  52. package/dist/plugin-sdk/outbound-NS6UHnB6.js +212 -0
  53. package/dist/plugin-sdk/outbound-attachment-Dy6fyf6H.js +19 -0
  54. package/dist/plugin-sdk/path-alias-guards-DBjLbIX_.js +43 -0
  55. package/dist/plugin-sdk/paths-vTM3Lh3X.js +166 -0
  56. package/dist/plugin-sdk/pi-embedded-helpers-1R1gu7eX.js +9627 -0
  57. package/dist/plugin-sdk/pi-model-discovery-runtime-Do9o-dUd.js +8 -0
  58. package/dist/plugin-sdk/pi-model-discovery-v-XPUOOf.js +134 -0
  59. package/dist/plugin-sdk/pi-tools.before-tool-call.runtime-D4sFsIks.js +354 -0
  60. package/dist/plugin-sdk/plugins-DeBZB9l_.js +864 -0
  61. package/dist/plugin-sdk/proxy-fetch-ChxOhWF4.js +38 -0
  62. package/dist/plugin-sdk/pw-ai-DEOmCSSC.js +1938 -0
  63. package/dist/plugin-sdk/qmd-manager-HyYKoEch.js +1448 -0
  64. package/dist/plugin-sdk/query-expansion-CeyKUeDW.js +1011 -0
  65. package/dist/plugin-sdk/redact-DjVX-1N3.js +319 -0
  66. package/dist/plugin-sdk/reply-DAo_Jt8K.js +97916 -0
  67. package/dist/plugin-sdk/resolve-outbound-target-B42qgQS9.js +40 -0
  68. package/dist/plugin-sdk/run-with-concurrency-Bt_ks0Qa.js +1994 -0
  69. package/dist/plugin-sdk/runtime-whatsapp-login.runtime-B6W989eF.js +10 -0
  70. package/dist/plugin-sdk/runtime-whatsapp-outbound.runtime-c_GDFy37.js +19 -0
  71. package/dist/plugin-sdk/send-CQpMudwO.js +2587 -0
  72. package/dist/plugin-sdk/send-DQHLzVyO.js +414 -0
  73. package/dist/plugin-sdk/send-DTB24bEF.js +3135 -0
  74. package/dist/plugin-sdk/send-DfHadjZ_.js +503 -0
  75. package/dist/plugin-sdk/send-XXlW2iny.js +540 -0
  76. package/dist/plugin-sdk/session-6TF6MyaC.js +169 -0
  77. package/dist/plugin-sdk/skill-commands-CkGeFUMl.js +342 -0
  78. package/dist/plugin-sdk/skills-CBkHBYPq.js +1428 -0
  79. package/dist/plugin-sdk/slash-commands.runtime-CxliuGaP.js +13 -0
  80. package/dist/plugin-sdk/slash-dispatch.runtime-DFaeYlJQ.js +52 -0
  81. package/dist/plugin-sdk/slash-skill-commands.runtime-0M0OLCxq.js +16 -0
  82. package/dist/plugin-sdk/ssrf-cFtplYtS.js +202 -0
  83. package/dist/plugin-sdk/store-5nyxY3WU.js +81 -0
  84. package/dist/plugin-sdk/subagent-registry-runtime-DCtmDwna.js +52 -0
  85. package/dist/plugin-sdk/tables-C47P4GTN.js +55 -0
  86. package/dist/plugin-sdk/target-errors-Blia4S69.js +195 -0
  87. package/dist/plugin-sdk/thinking-Bo2eosVa.js +1206 -0
  88. package/dist/plugin-sdk/tokens-DgNRBwIg.js +52 -0
  89. package/dist/plugin-sdk/tool-images-Gk_-0y2N.js +274 -0
  90. package/dist/plugin-sdk/web-CVxZbXyH.js +56 -0
  91. package/dist/plugin-sdk/whatsapp-actions-Bw0H9g-n.js +80 -0
  92. package/dist/{pw-ai-GcYO6HPE.js → pw-ai-CmphSzHx.js} +1 -1
  93. package/dist/{slash-dispatch.runtime-Dh053pQK.js → slash-dispatch.runtime-131yup2e.js} +6 -6
  94. package/dist/{subagent-registry-runtime-DSi5mnCQ.js → subagent-registry-runtime-DbSf_Je6.js} +6 -6
  95. package/dist/{web-1hWJDzNA.js → web-MR9d7KyB.js} +6 -6
  96. package/package.json +1 -1
  97. package/scripts/create-instance.sh +1 -37
  98. package/scripts/npm_publish.sh +0 -65
  99. package/scripts/npm_publish_backup.sh +185 -0
  100. package/extensions/page-action-cache/dist/actions-executor.d.ts +0 -62
  101. package/extensions/page-action-cache/dist/actions-executor.d.ts.map +0 -1
  102. package/extensions/page-action-cache/dist/actions-executor.js +0 -339
  103. package/extensions/page-action-cache/dist/actions-executor.js.map +0 -1
  104. package/extensions/page-action-cache/dist/cache-invalidator.d.ts +0 -70
  105. package/extensions/page-action-cache/dist/cache-invalidator.d.ts.map +0 -1
  106. package/extensions/page-action-cache/dist/cache-invalidator.js +0 -212
  107. package/extensions/page-action-cache/dist/cache-invalidator.js.map +0 -1
  108. package/extensions/page-action-cache/dist/cache-store.d.ts +0 -80
  109. package/extensions/page-action-cache/dist/cache-store.d.ts.map +0 -1
  110. package/extensions/page-action-cache/dist/cache-store.js +0 -361
  111. package/extensions/page-action-cache/dist/cache-store.js.map +0 -1
  112. package/extensions/page-action-cache/dist/cache-strategy.d.ts +0 -65
  113. package/extensions/page-action-cache/dist/cache-strategy.d.ts.map +0 -1
  114. package/extensions/page-action-cache/dist/cache-strategy.js +0 -237
  115. package/extensions/page-action-cache/dist/cache-strategy.js.map +0 -1
  116. package/extensions/page-action-cache/dist/hooks-entry.d.ts +0 -29
  117. package/extensions/page-action-cache/dist/hooks-entry.d.ts.map +0 -1
  118. package/extensions/page-action-cache/dist/hooks-entry.js +0 -83
  119. package/extensions/page-action-cache/dist/hooks-entry.js.map +0 -1
  120. package/extensions/page-action-cache/dist/hooks.d.ts +0 -10
  121. package/extensions/page-action-cache/dist/hooks.d.ts.map +0 -1
  122. package/extensions/page-action-cache/dist/hooks.js +0 -277
  123. package/extensions/page-action-cache/dist/hooks.js.map +0 -1
  124. package/extensions/page-action-cache/dist/index.d.ts +0 -24
  125. package/extensions/page-action-cache/dist/index.d.ts.map +0 -1
  126. package/extensions/page-action-cache/dist/index.js +0 -34
  127. package/extensions/page-action-cache/dist/index.js.map +0 -1
  128. package/extensions/page-action-cache/dist/scenario-recognizer.d.ts +0 -45
  129. package/extensions/page-action-cache/dist/scenario-recognizer.d.ts.map +0 -1
  130. package/extensions/page-action-cache/dist/scenario-recognizer.js +0 -213
  131. package/extensions/page-action-cache/dist/scenario-recognizer.js.map +0 -1
  132. package/extensions/page-action-cache/dist/security-policy.d.ts +0 -62
  133. package/extensions/page-action-cache/dist/security-policy.d.ts.map +0 -1
  134. package/extensions/page-action-cache/dist/security-policy.js +0 -219
  135. package/extensions/page-action-cache/dist/security-policy.js.map +0 -1
  136. package/extensions/page-action-cache/dist/tools.d.ts +0 -209
  137. package/extensions/page-action-cache/dist/tools.d.ts.map +0 -1
  138. package/extensions/page-action-cache/dist/tools.js +0 -383
  139. package/extensions/page-action-cache/dist/tools.js.map +0 -1
  140. package/extensions/page-action-cache/dist/types.d.ts +0 -336
  141. package/extensions/page-action-cache/dist/types.d.ts.map +0 -1
  142. package/extensions/page-action-cache/dist/types.js +0 -8
  143. package/extensions/page-action-cache/dist/types.js.map +0 -1
  144. package/extensions/page-action-cache/dist/ux-enhancer.d.ts +0 -60
  145. package/extensions/page-action-cache/dist/ux-enhancer.d.ts.map +0 -1
  146. package/extensions/page-action-cache/dist/ux-enhancer.js +0 -218
  147. package/extensions/page-action-cache/dist/ux-enhancer.js.map +0 -1
  148. package/extensions/page-action-cache/dist/variable-resolver.d.ts +0 -28
  149. package/extensions/page-action-cache/dist/variable-resolver.d.ts.map +0 -1
  150. package/extensions/page-action-cache/dist/variable-resolver.js +0 -201
  151. package/extensions/page-action-cache/dist/variable-resolver.js.map +0 -1
  152. package/extensions/page-action-cache/docs/API.md +0 -555
  153. package/extensions/page-action-cache/docs/IMPLEMENTATION.md +0 -1792
  154. package/extensions/page-action-cache/docs/INTEGRATION.md +0 -387
  155. package/extensions/page-action-cache/docs/README.md +0 -183
  156. package/extensions/page-action-cache/index.ts +0 -118
  157. package/extensions/page-action-cache/node_modules/.bin/nlc +0 -21
  158. package/extensions/page-action-cache/node_modules/.bin/node-llama-cpp +0 -21
  159. package/extensions/page-action-cache/node_modules/.bin/openclaw +0 -21
  160. package/extensions/page-action-cache/node_modules/.bin/tsc +0 -21
  161. package/extensions/page-action-cache/node_modules/.bin/tsserver +0 -21
  162. package/extensions/page-action-cache/node_modules/.bin/vitest +0 -21
  163. package/extensions/page-action-cache/openclaw.plugin.json +0 -208
  164. package/extensions/page-action-cache/package.json +0 -74
  165. package/extensions/page-action-cache/scripts/npm_publish.sh +0 -80
  166. package/extensions/page-action-cache/skills/page-action-cache/SKILL.md +0 -216
  167. package/extensions/page-action-cache/src/actions-executor.ts +0 -441
  168. package/extensions/page-action-cache/src/cache-invalidator.ts +0 -271
  169. package/extensions/page-action-cache/src/cache-store.ts +0 -457
  170. package/extensions/page-action-cache/src/cache-strategy.ts +0 -327
  171. package/extensions/page-action-cache/src/hooks-entry.ts +0 -114
  172. package/extensions/page-action-cache/src/hooks.ts +0 -332
  173. package/extensions/page-action-cache/src/index.ts +0 -89
  174. package/extensions/page-action-cache/src/scenario-recognizer.ts +0 -259
  175. package/extensions/page-action-cache/src/security-policy.ts +0 -268
  176. package/extensions/page-action-cache/src/tools.ts +0 -437
  177. package/extensions/page-action-cache/src/types.ts +0 -482
  178. package/extensions/page-action-cache/src/ux-enhancer.ts +0 -266
  179. package/extensions/page-action-cache/src/variable-resolver.ts +0 -258
  180. package/extensions/page-action-cache/tests/actions-executor.test.ts +0 -424
  181. package/extensions/page-action-cache/tests/cache-store.test.ts +0 -267
  182. package/extensions/page-action-cache/tests/integration-test.ts +0 -62
  183. package/extensions/page-action-cache/tests/scenario-recognizer.test.ts +0 -140
  184. package/extensions/page-action-cache/tests/variable-resolver.test.ts +0 -187
  185. package/extensions/page-action-cache/tsconfig.json +0 -39
@@ -0,0 +1,342 @@
1
+ import { c as resolveAgentWorkspaceDir, r as listAgentIds, s as resolveAgentSkillsFilter } from "./run-with-concurrency-Bt_ks0Qa.js";
2
+ import { c as resolveStateDir } from "./paths-MKyEVmEb.js";
3
+ import { E as resolveUserPath, L as logVerbose, a as createSubsystemLogger, f as CONFIG_DIR } from "./logger-CZY9KIoY.js";
4
+ import { t as createAsyncLock } from "./json-files-DJe5SBCd.js";
5
+ import { o as resolvePluginSkillDirs, t as buildWorkspaceSkillCommandSpecs } from "./skills-CBkHBYPq.js";
6
+ import { i as listChatCommands } from "./commands-registry-t7cXBTfN.js";
7
+ import fs from "node:fs";
8
+ import path from "node:path";
9
+ import os from "node:os";
10
+ import { randomBytes, randomUUID } from "node:crypto";
11
+ import chokidar from "chokidar";
12
+
13
+ //#region src/infra/pairing-files.ts
14
+ function resolvePairingPaths(baseDir, subdir) {
15
+ const root = baseDir ?? resolveStateDir();
16
+ const dir = path.join(root, subdir);
17
+ return {
18
+ dir,
19
+ pendingPath: path.join(dir, "pending.json"),
20
+ pairedPath: path.join(dir, "paired.json")
21
+ };
22
+ }
23
+ function pruneExpiredPending(pendingById, nowMs, ttlMs) {
24
+ for (const [id, req] of Object.entries(pendingById)) if (nowMs - req.ts > ttlMs) delete pendingById[id];
25
+ }
26
+
27
+ //#endregion
28
+ //#region src/infra/pairing-pending.ts
29
+ async function rejectPendingPairingRequest(params) {
30
+ const state = await params.loadState();
31
+ const pending = state.pendingById[params.requestId];
32
+ if (!pending) return null;
33
+ delete state.pendingById[params.requestId];
34
+ await params.persistState(state);
35
+ return {
36
+ requestId: params.requestId,
37
+ [params.idKey]: params.getId(pending)
38
+ };
39
+ }
40
+
41
+ //#endregion
42
+ //#region src/infra/pairing-token.ts
43
+ const PAIRING_TOKEN_BYTES = 32;
44
+ function generatePairingToken() {
45
+ return randomBytes(PAIRING_TOKEN_BYTES).toString("base64url");
46
+ }
47
+
48
+ //#endregion
49
+ //#region src/agents/skills/refresh.ts
50
+ const log$1 = createSubsystemLogger("gateway/skills");
51
+ const listeners = /* @__PURE__ */ new Set();
52
+ const workspaceVersions = /* @__PURE__ */ new Map();
53
+ const watchers = /* @__PURE__ */ new Map();
54
+ let globalVersion = 0;
55
+ const DEFAULT_SKILLS_WATCH_IGNORED = [
56
+ /(^|[\\/])\.git([\\/]|$)/,
57
+ /(^|[\\/])node_modules([\\/]|$)/,
58
+ /(^|[\\/])dist([\\/]|$)/,
59
+ /(^|[\\/])\.venv([\\/]|$)/,
60
+ /(^|[\\/])venv([\\/]|$)/,
61
+ /(^|[\\/])__pycache__([\\/]|$)/,
62
+ /(^|[\\/])\.mypy_cache([\\/]|$)/,
63
+ /(^|[\\/])\.pytest_cache([\\/]|$)/,
64
+ /(^|[\\/])build([\\/]|$)/,
65
+ /(^|[\\/])\.cache([\\/]|$)/
66
+ ];
67
+ function bumpVersion(current) {
68
+ const now = Date.now();
69
+ return now <= current ? current + 1 : now;
70
+ }
71
+ function emit(event) {
72
+ for (const listener of listeners) try {
73
+ listener(event);
74
+ } catch (err) {
75
+ log$1.warn(`skills change listener failed: ${String(err)}`);
76
+ }
77
+ }
78
+ function resolveWatchPaths(workspaceDir, config) {
79
+ const paths = [];
80
+ if (workspaceDir.trim()) {
81
+ paths.push(path.join(workspaceDir, "skills"));
82
+ paths.push(path.join(workspaceDir, ".agents", "skills"));
83
+ }
84
+ paths.push(path.join(CONFIG_DIR, "skills"));
85
+ paths.push(path.join(os.homedir(), ".agents", "skills"));
86
+ const extraDirs = (config?.skills?.load?.extraDirs ?? []).map((d) => typeof d === "string" ? d.trim() : "").filter(Boolean).map((dir) => resolveUserPath(dir));
87
+ paths.push(...extraDirs);
88
+ const pluginSkillDirs = resolvePluginSkillDirs({
89
+ workspaceDir,
90
+ config
91
+ });
92
+ paths.push(...pluginSkillDirs);
93
+ return paths;
94
+ }
95
+ function toWatchGlobRoot(raw) {
96
+ return raw.replaceAll("\\", "/").replace(/\/+$/, "");
97
+ }
98
+ function resolveWatchTargets(workspaceDir, config) {
99
+ const targets = /* @__PURE__ */ new Set();
100
+ for (const root of resolveWatchPaths(workspaceDir, config)) {
101
+ const globRoot = toWatchGlobRoot(root);
102
+ targets.add(`${globRoot}/SKILL.md`);
103
+ targets.add(`${globRoot}/*/SKILL.md`);
104
+ }
105
+ return Array.from(targets).toSorted();
106
+ }
107
+ function bumpSkillsSnapshotVersion(params) {
108
+ const reason = params?.reason ?? "manual";
109
+ const changedPath = params?.changedPath;
110
+ if (params?.workspaceDir) {
111
+ const next = bumpVersion(workspaceVersions.get(params.workspaceDir) ?? 0);
112
+ workspaceVersions.set(params.workspaceDir, next);
113
+ emit({
114
+ workspaceDir: params.workspaceDir,
115
+ reason,
116
+ changedPath
117
+ });
118
+ return next;
119
+ }
120
+ globalVersion = bumpVersion(globalVersion);
121
+ emit({
122
+ reason,
123
+ changedPath
124
+ });
125
+ return globalVersion;
126
+ }
127
+ function getSkillsSnapshotVersion(workspaceDir) {
128
+ if (!workspaceDir) return globalVersion;
129
+ const local = workspaceVersions.get(workspaceDir) ?? 0;
130
+ return Math.max(globalVersion, local);
131
+ }
132
+ function ensureSkillsWatcher(params) {
133
+ const workspaceDir = params.workspaceDir.trim();
134
+ if (!workspaceDir) return;
135
+ const watchEnabled = params.config?.skills?.load?.watch !== false;
136
+ const debounceMsRaw = params.config?.skills?.load?.watchDebounceMs;
137
+ const debounceMs = typeof debounceMsRaw === "number" && Number.isFinite(debounceMsRaw) ? Math.max(0, debounceMsRaw) : 250;
138
+ const existing = watchers.get(workspaceDir);
139
+ if (!watchEnabled) {
140
+ if (existing) {
141
+ watchers.delete(workspaceDir);
142
+ if (existing.timer) clearTimeout(existing.timer);
143
+ existing.watcher.close().catch(() => {});
144
+ }
145
+ return;
146
+ }
147
+ const watchTargets = resolveWatchTargets(workspaceDir, params.config);
148
+ const pathsKey = watchTargets.join("|");
149
+ if (existing && existing.pathsKey === pathsKey && existing.debounceMs === debounceMs) return;
150
+ if (existing) {
151
+ watchers.delete(workspaceDir);
152
+ if (existing.timer) clearTimeout(existing.timer);
153
+ existing.watcher.close().catch(() => {});
154
+ }
155
+ const watcher = chokidar.watch(watchTargets, {
156
+ ignoreInitial: true,
157
+ awaitWriteFinish: {
158
+ stabilityThreshold: debounceMs,
159
+ pollInterval: 100
160
+ },
161
+ ignored: DEFAULT_SKILLS_WATCH_IGNORED
162
+ });
163
+ const state = {
164
+ watcher,
165
+ pathsKey,
166
+ debounceMs
167
+ };
168
+ const schedule = (changedPath) => {
169
+ state.pendingPath = changedPath ?? state.pendingPath;
170
+ if (state.timer) clearTimeout(state.timer);
171
+ state.timer = setTimeout(() => {
172
+ const pendingPath = state.pendingPath;
173
+ state.pendingPath = void 0;
174
+ state.timer = void 0;
175
+ bumpSkillsSnapshotVersion({
176
+ workspaceDir,
177
+ reason: "watch",
178
+ changedPath: pendingPath
179
+ });
180
+ }, debounceMs);
181
+ };
182
+ watcher.on("add", (p) => schedule(p));
183
+ watcher.on("change", (p) => schedule(p));
184
+ watcher.on("unlink", (p) => schedule(p));
185
+ watcher.on("error", (err) => {
186
+ log$1.warn(`skills watcher error (${workspaceDir}): ${String(err)}`);
187
+ });
188
+ watchers.set(workspaceDir, state);
189
+ }
190
+
191
+ //#endregion
192
+ //#region src/infra/node-pairing.ts
193
+ const PENDING_TTL_MS = 300 * 1e3;
194
+ const withLock = createAsyncLock();
195
+
196
+ //#endregion
197
+ //#region src/infra/skills-remote.ts
198
+ const log = createSubsystemLogger("gateway/skills-remote");
199
+ const remoteNodes = /* @__PURE__ */ new Map();
200
+ function isMacPlatform(platform, deviceFamily) {
201
+ const platformNorm = String(platform ?? "").trim().toLowerCase();
202
+ const familyNorm = String(deviceFamily ?? "").trim().toLowerCase();
203
+ if (platformNorm.includes("mac")) return true;
204
+ if (platformNorm.includes("darwin")) return true;
205
+ if (familyNorm === "mac") return true;
206
+ return false;
207
+ }
208
+ function supportsSystemRun(commands) {
209
+ return Array.isArray(commands) && commands.includes("system.run");
210
+ }
211
+ function getRemoteSkillEligibility() {
212
+ const macNodes = [...remoteNodes.values()].filter((node) => isMacPlatform(node.platform, node.deviceFamily) && supportsSystemRun(node.commands));
213
+ if (macNodes.length === 0) return;
214
+ const bins = /* @__PURE__ */ new Set();
215
+ for (const node of macNodes) for (const bin of node.bins) bins.add(bin);
216
+ const labels = macNodes.map((node) => node.displayName ?? node.nodeId).filter(Boolean);
217
+ return {
218
+ platforms: ["darwin"],
219
+ hasBin: (bin) => bins.has(bin),
220
+ hasAnyBin: (required) => required.some((bin) => bins.has(bin)),
221
+ note: labels.length > 0 ? `Remote macOS node available (${labels.join(", ")}). Run macOS-only skills via nodes.run on that node.` : "Remote macOS node available. Run macOS-only skills via nodes.run on that node."
222
+ };
223
+ }
224
+
225
+ //#endregion
226
+ //#region src/auto-reply/skill-commands.ts
227
+ function listReservedChatSlashCommandNames(extraNames = []) {
228
+ const reserved = /* @__PURE__ */ new Set();
229
+ for (const command of listChatCommands()) {
230
+ if (command.nativeName) reserved.add(command.nativeName.toLowerCase());
231
+ for (const alias of command.textAliases) {
232
+ const trimmed = alias.trim();
233
+ if (!trimmed.startsWith("/")) continue;
234
+ reserved.add(trimmed.slice(1).toLowerCase());
235
+ }
236
+ }
237
+ for (const name of extraNames) {
238
+ const trimmed = name.trim().toLowerCase();
239
+ if (trimmed) reserved.add(trimmed);
240
+ }
241
+ return reserved;
242
+ }
243
+ function listSkillCommandsForWorkspace(params) {
244
+ return buildWorkspaceSkillCommandSpecs(params.workspaceDir, {
245
+ config: params.cfg,
246
+ skillFilter: params.skillFilter,
247
+ eligibility: { remote: getRemoteSkillEligibility() },
248
+ reservedNames: listReservedChatSlashCommandNames()
249
+ });
250
+ }
251
+ function listSkillCommandsForAgents(params) {
252
+ const mergeSkillFilters = (existing, incoming) => {
253
+ if (existing === void 0 || incoming === void 0) return;
254
+ if (existing.length === 0) return Array.from(new Set(incoming));
255
+ if (incoming.length === 0) return Array.from(new Set(existing));
256
+ return Array.from(new Set([...existing, ...incoming]));
257
+ };
258
+ const agentIds = params.agentIds ?? listAgentIds(params.cfg);
259
+ const used = listReservedChatSlashCommandNames();
260
+ const entries = [];
261
+ const workspaceFilters = /* @__PURE__ */ new Map();
262
+ for (const agentId of agentIds) {
263
+ const workspaceDir = resolveAgentWorkspaceDir(params.cfg, agentId);
264
+ if (!fs.existsSync(workspaceDir)) {
265
+ logVerbose(`Skipping agent "${agentId}": workspace does not exist: ${workspaceDir}`);
266
+ continue;
267
+ }
268
+ let canonicalDir;
269
+ try {
270
+ canonicalDir = fs.realpathSync(workspaceDir);
271
+ } catch {
272
+ logVerbose(`Skipping agent "${agentId}": cannot resolve workspace: ${workspaceDir}`);
273
+ continue;
274
+ }
275
+ const skillFilter = resolveAgentSkillsFilter(params.cfg, agentId);
276
+ const existing = workspaceFilters.get(canonicalDir);
277
+ if (existing) {
278
+ existing.skillFilter = mergeSkillFilters(existing.skillFilter, skillFilter);
279
+ continue;
280
+ }
281
+ workspaceFilters.set(canonicalDir, {
282
+ workspaceDir,
283
+ skillFilter
284
+ });
285
+ }
286
+ for (const { workspaceDir, skillFilter } of workspaceFilters.values()) {
287
+ const commands = buildWorkspaceSkillCommandSpecs(workspaceDir, {
288
+ config: params.cfg,
289
+ skillFilter,
290
+ eligibility: { remote: getRemoteSkillEligibility() },
291
+ reservedNames: used
292
+ });
293
+ for (const command of commands) {
294
+ used.add(command.name.toLowerCase());
295
+ entries.push(command);
296
+ }
297
+ }
298
+ return entries;
299
+ }
300
+ function normalizeSkillCommandLookup(value) {
301
+ return value.trim().toLowerCase().replace(/[\s_]+/g, "-");
302
+ }
303
+ function findSkillCommand(skillCommands, rawName) {
304
+ const trimmed = rawName.trim();
305
+ if (!trimmed) return;
306
+ const lowered = trimmed.toLowerCase();
307
+ const normalized = normalizeSkillCommandLookup(trimmed);
308
+ return skillCommands.find((entry) => {
309
+ if (entry.name.toLowerCase() === lowered) return true;
310
+ if (entry.skillName.toLowerCase() === lowered) return true;
311
+ return normalizeSkillCommandLookup(entry.name) === normalized || normalizeSkillCommandLookup(entry.skillName) === normalized;
312
+ });
313
+ }
314
+ function resolveSkillCommandInvocation(params) {
315
+ const trimmed = params.commandBodyNormalized.trim();
316
+ if (!trimmed.startsWith("/")) return null;
317
+ const match = trimmed.match(/^\/([^\s]+)(?:\s+([\s\S]+))?$/);
318
+ if (!match) return null;
319
+ const commandName = match[1]?.trim().toLowerCase();
320
+ if (!commandName) return null;
321
+ if (commandName === "skill") {
322
+ const remainder = match[2]?.trim();
323
+ if (!remainder) return null;
324
+ const skillMatch = remainder.match(/^([^\s]+)(?:\s+([\s\S]+))?$/);
325
+ if (!skillMatch) return null;
326
+ const skillCommand = findSkillCommand(params.skillCommands, skillMatch[1] ?? "");
327
+ if (!skillCommand) return null;
328
+ return {
329
+ command: skillCommand,
330
+ args: skillMatch[2]?.trim() || void 0
331
+ };
332
+ }
333
+ const command = params.skillCommands.find((entry) => entry.name.toLowerCase() === commandName);
334
+ if (!command) return null;
335
+ return {
336
+ command,
337
+ args: match[2]?.trim() || void 0
338
+ };
339
+ }
340
+
341
+ //#endregion
342
+ export { getRemoteSkillEligibility as a, generatePairingToken as c, resolvePairingPaths as d, resolveSkillCommandInvocation as i, rejectPendingPairingRequest as l, listSkillCommandsForAgents as n, ensureSkillsWatcher as o, listSkillCommandsForWorkspace as r, getSkillsSnapshotVersion as s, listReservedChatSlashCommandNames as t, pruneExpiredPending as u };