botmux 2.84.0 → 2.85.0
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/README.md +4 -0
- package/dist/adapters/backend/sandbox.d.ts +4 -0
- package/dist/adapters/backend/sandbox.d.ts.map +1 -1
- package/dist/adapters/backend/sandbox.js +14 -0
- package/dist/adapters/backend/sandbox.js.map +1 -1
- package/dist/adapters/cli/claude-code.d.ts.map +1 -1
- package/dist/adapters/cli/claude-code.js +4 -1
- package/dist/adapters/cli/claude-code.js.map +1 -1
- package/dist/adapters/cli/types.d.ts +11 -0
- package/dist/adapters/cli/types.d.ts.map +1 -1
- package/dist/bot-registry.d.ts +18 -0
- package/dist/bot-registry.d.ts.map +1 -1
- package/dist/bot-registry.js +34 -0
- package/dist/bot-registry.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +30 -65
- package/dist/cli.js.map +1 -1
- package/dist/core/command-handler.d.ts.map +1 -1
- package/dist/core/command-handler.js +42 -1
- package/dist/core/command-handler.js.map +1 -1
- package/dist/core/dashboard-ipc-server.d.ts.map +1 -1
- package/dist/core/dashboard-ipc-server.js +100 -1
- package/dist/core/dashboard-ipc-server.js.map +1 -1
- package/dist/core/passthrough-commands.d.ts.map +1 -1
- package/dist/core/passthrough-commands.js +1 -1
- package/dist/core/passthrough-commands.js.map +1 -1
- package/dist/core/pending-response.d.ts +2 -39
- package/dist/core/pending-response.d.ts.map +1 -1
- package/dist/core/pending-response.js +5 -99
- package/dist/core/pending-response.js.map +1 -1
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +4 -16
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/skills/claude-plugin-delivery.d.ts +6 -0
- package/dist/core/skills/claude-plugin-delivery.d.ts.map +1 -0
- package/dist/core/skills/claude-plugin-delivery.js +21 -0
- package/dist/core/skills/claude-plugin-delivery.js.map +1 -0
- package/dist/core/skills/cli-admin-command.d.ts +7 -0
- package/dist/core/skills/cli-admin-command.d.ts.map +1 -0
- package/dist/core/skills/cli-admin-command.js +243 -0
- package/dist/core/skills/cli-admin-command.js.map +1 -0
- package/dist/core/skills/cli-session-command.d.ts +7 -0
- package/dist/core/skills/cli-session-command.d.ts.map +1 -0
- package/dist/core/skills/cli-session-command.js +45 -0
- package/dist/core/skills/cli-session-command.js.map +1 -0
- package/dist/core/skills/delivery.d.ts +11 -0
- package/dist/core/skills/delivery.d.ts.map +1 -0
- package/dist/core/skills/delivery.js +22 -0
- package/dist/core/skills/delivery.js.map +1 -0
- package/dist/core/skills/discovery.d.ts +3 -0
- package/dist/core/skills/discovery.d.ts.map +1 -0
- package/dist/core/skills/discovery.js +34 -0
- package/dist/core/skills/discovery.js.map +1 -0
- package/dist/core/skills/frontmatter.d.ts +9 -0
- package/dist/core/skills/frontmatter.d.ts.map +1 -0
- package/dist/core/skills/frontmatter.js +42 -0
- package/dist/core/skills/frontmatter.js.map +1 -0
- package/dist/core/skills/im-command.d.ts +9 -0
- package/dist/core/skills/im-command.d.ts.map +1 -0
- package/dist/core/skills/im-command.js +107 -0
- package/dist/core/skills/im-command.js.map +1 -0
- package/dist/core/skills/manifest-store.d.ts +4 -0
- package/dist/core/skills/manifest-store.d.ts.map +1 -0
- package/dist/core/skills/manifest-store.js +26 -0
- package/dist/core/skills/manifest-store.js.map +1 -0
- package/dist/core/skills/package.d.ts +13 -0
- package/dist/core/skills/package.d.ts.map +1 -0
- package/dist/core/skills/package.js +35 -0
- package/dist/core/skills/package.js.map +1 -0
- package/dist/core/skills/policy.d.ts +18 -0
- package/dist/core/skills/policy.d.ts.map +1 -0
- package/dist/core/skills/policy.js +69 -0
- package/dist/core/skills/policy.js.map +1 -0
- package/dist/core/skills/prompt.d.ts +3 -0
- package/dist/core/skills/prompt.d.ts.map +1 -0
- package/dist/core/skills/prompt.js +25 -0
- package/dist/core/skills/prompt.js.map +1 -0
- package/dist/core/skills/references.d.ts +21 -0
- package/dist/core/skills/references.d.ts.map +1 -0
- package/dist/core/skills/references.js +27 -0
- package/dist/core/skills/references.js.map +1 -0
- package/dist/core/skills/registry-paths.d.ts +5 -0
- package/dist/core/skills/registry-paths.d.ts.map +1 -0
- package/dist/core/skills/registry-paths.js +15 -0
- package/dist/core/skills/registry-paths.js.map +1 -0
- package/dist/core/skills/resource-reader.d.ts +9 -0
- package/dist/core/skills/resource-reader.d.ts.map +1 -0
- package/dist/core/skills/resource-reader.js +97 -0
- package/dist/core/skills/resource-reader.js.map +1 -0
- package/dist/core/skills/session-resolver.d.ts +14 -0
- package/dist/core/skills/session-resolver.d.ts.map +1 -0
- package/dist/core/skills/session-resolver.js +24 -0
- package/dist/core/skills/session-resolver.js.map +1 -0
- package/dist/core/skills/session-runtime.d.ts +14 -0
- package/dist/core/skills/session-runtime.d.ts.map +1 -0
- package/dist/core/skills/session-runtime.js +32 -0
- package/dist/core/skills/session-runtime.js.map +1 -0
- package/dist/core/skills/sources.d.ts +21 -0
- package/dist/core/skills/sources.d.ts.map +1 -0
- package/dist/core/skills/sources.js +155 -0
- package/dist/core/skills/sources.js.map +1 -0
- package/dist/core/skills/types.d.ts +71 -0
- package/dist/core/skills/types.d.ts.map +1 -0
- package/dist/core/skills/types.js +2 -0
- package/dist/core/skills/types.js.map +1 -0
- package/dist/core/startup-commands.d.ts +57 -0
- package/dist/core/startup-commands.d.ts.map +1 -0
- package/dist/core/startup-commands.js +85 -0
- package/dist/core/startup-commands.js.map +1 -0
- package/dist/core/types.d.ts +10 -3
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/types.js.map +1 -1
- package/dist/core/worker-pool.d.ts +14 -1
- package/dist/core/worker-pool.d.ts.map +1 -1
- package/dist/core/worker-pool.js +93 -62
- package/dist/core/worker-pool.js.map +1 -1
- package/dist/daemon.d.ts +2 -2
- package/dist/daemon.d.ts.map +1 -1
- package/dist/daemon.js +49 -52
- package/dist/daemon.js.map +1 -1
- package/dist/dashboard/skill-install-request.d.ts +21 -0
- package/dist/dashboard/skill-install-request.d.ts.map +1 -0
- package/dist/dashboard/skill-install-request.js +62 -0
- package/dist/dashboard/skill-install-request.js.map +1 -0
- package/dist/dashboard/web/app.d.ts.map +1 -1
- package/dist/dashboard/web/app.js +4 -1
- package/dist/dashboard/web/app.js.map +1 -1
- package/dist/dashboard/web/bot-defaults.d.ts.map +1 -1
- package/dist/dashboard/web/bot-defaults.js +61 -1
- package/dist/dashboard/web/bot-defaults.js.map +1 -1
- package/dist/dashboard/web/i18n.d.ts.map +1 -1
- package/dist/dashboard/web/i18n.js +146 -0
- package/dist/dashboard/web/i18n.js.map +1 -1
- package/dist/dashboard/web/skills.d.ts +2 -0
- package/dist/dashboard/web/skills.d.ts.map +1 -0
- package/dist/dashboard/web/skills.js +539 -0
- package/dist/dashboard/web/skills.js.map +1 -0
- package/dist/dashboard-web/app.js +599 -446
- package/dist/dashboard-web/index.html +1 -0
- package/dist/dashboard-web/style.css +793 -0
- package/dist/dashboard.js +250 -0
- package/dist/dashboard.js.map +1 -1
- package/dist/global-config.d.ts +7 -0
- package/dist/global-config.d.ts.map +1 -1
- package/dist/global-config.js +16 -0
- package/dist/global-config.js.map +1 -1
- package/dist/i18n/en.d.ts.map +1 -1
- package/dist/i18n/en.js +3 -5
- package/dist/i18n/en.js.map +1 -1
- package/dist/i18n/zh.d.ts.map +1 -1
- package/dist/i18n/zh.js +3 -5
- package/dist/i18n/zh.js.map +1 -1
- package/dist/im/lark/card-builder.d.ts +0 -3
- package/dist/im/lark/card-builder.d.ts.map +1 -1
- package/dist/im/lark/card-builder.js +2 -33
- package/dist/im/lark/card-builder.js.map +1 -1
- package/dist/services/bot-config-store.d.ts +10 -4
- package/dist/services/bot-config-store.d.ts.map +1 -1
- package/dist/services/bot-config-store.js +29 -2
- package/dist/services/bot-config-store.js.map +1 -1
- package/dist/services/session-store.d.ts +1 -0
- package/dist/services/session-store.d.ts.map +1 -1
- package/dist/services/session-store.js +12 -5
- package/dist/services/session-store.js.map +1 -1
- package/dist/services/skill-registry-store.d.ts +42 -0
- package/dist/services/skill-registry-store.d.ts.map +1 -0
- package/dist/services/skill-registry-store.js +343 -0
- package/dist/services/skill-registry-store.js.map +1 -0
- package/dist/skills/installer.d.ts.map +1 -1
- package/dist/skills/installer.js +3 -0
- package/dist/skills/installer.js.map +1 -1
- package/dist/types.d.ts +3 -5
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/file-lock.d.ts +1 -0
- package/dist/utils/file-lock.d.ts.map +1 -1
- package/dist/utils/file-lock.js +87 -1
- package/dist/utils/file-lock.js.map +1 -1
- package/dist/worker.js +127 -20
- package/dist/worker.js.map +1 -1
- package/dist/workflows/definition.d.ts +16 -16
- package/dist/workflows/events/schema.d.ts +280 -280
- package/package.json +1 -1
- package/dist/services/pending-response-transaction-store.d.ts +0 -12
- package/dist/services/pending-response-transaction-store.d.ts.map +0 -1
- package/dist/services/pending-response-transaction-store.js +0 -52
- package/dist/services/pending-response-transaction-store.js.map +0 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { SessionSkillManifest } from './types.js';
|
|
2
|
+
export interface SkillResourceReadResult {
|
|
3
|
+
path: string;
|
|
4
|
+
content: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function readSkillResource(manifest: SessionSkillManifest, skillName: string, relativePath: string): SkillResourceReadResult;
|
|
7
|
+
export declare function readSkillEntrypoint(manifest: SessionSkillManifest, skillName: string): SkillResourceReadResult;
|
|
8
|
+
export declare function listSkillResources(manifest: SessionSkillManifest, skillName: string): string[];
|
|
9
|
+
//# sourceMappingURL=resource-reader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource-reader.d.ts","sourceRoot":"","sources":["../../../src/core/skills/resource-reader.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAIvD,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAOD,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,oBAAoB,EAC9B,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM,GACnB,uBAAuB,CAgBzB;AAED,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,GAAG,uBAAuB,CAI9G;AAED,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,CAkD9F"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { lstatSync, readFileSync, readdirSync, realpathSync } from 'node:fs';
|
|
2
|
+
import { join, relative, resolve } from 'node:path';
|
|
3
|
+
const MAX_RESOURCE_BYTES = 256 * 1024;
|
|
4
|
+
function assertRelativePath(path) {
|
|
5
|
+
if (path.startsWith('/') || path.includes('\0'))
|
|
6
|
+
throw new Error('invalid_skill_resource_path');
|
|
7
|
+
if (path.split(/[\\/]/).includes('..'))
|
|
8
|
+
throw new Error('path_outside_skill_root');
|
|
9
|
+
}
|
|
10
|
+
export function readSkillResource(manifest, skillName, relativePath) {
|
|
11
|
+
assertRelativePath(relativePath);
|
|
12
|
+
const skill = manifest.prioritySkills.find((s) => s.name === skillName);
|
|
13
|
+
if (!skill)
|
|
14
|
+
throw new Error('skill_not_in_session_manifest');
|
|
15
|
+
const root = realpathSync(skill.rootDir);
|
|
16
|
+
let target;
|
|
17
|
+
try {
|
|
18
|
+
target = realpathSync(resolve(join(root, relativePath)));
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
throw new Error('skill_resource_not_found');
|
|
22
|
+
}
|
|
23
|
+
if (!(target === root || target.startsWith(root + '/')))
|
|
24
|
+
throw new Error('path_outside_skill_root');
|
|
25
|
+
const stat = lstatSync(target);
|
|
26
|
+
if (!stat.isFile())
|
|
27
|
+
throw new Error('skill_resource_not_file');
|
|
28
|
+
if (stat.size > MAX_RESOURCE_BYTES)
|
|
29
|
+
throw new Error('skill_resource_too_large');
|
|
30
|
+
return { path: relativePath, content: readFileSync(target, 'utf-8') };
|
|
31
|
+
}
|
|
32
|
+
export function readSkillEntrypoint(manifest, skillName) {
|
|
33
|
+
const skill = manifest.prioritySkills.find((s) => s.name === skillName);
|
|
34
|
+
if (!skill)
|
|
35
|
+
throw new Error('skill_not_in_session_manifest');
|
|
36
|
+
return readSkillResource(manifest, skillName, skill.entrypoint);
|
|
37
|
+
}
|
|
38
|
+
export function listSkillResources(manifest, skillName) {
|
|
39
|
+
const skill = manifest.prioritySkills.find((s) => s.name === skillName);
|
|
40
|
+
if (!skill)
|
|
41
|
+
throw new Error('skill_not_in_session_manifest');
|
|
42
|
+
const root = realpathSync(skill.rootDir);
|
|
43
|
+
const out = [];
|
|
44
|
+
function withinRoot(path) {
|
|
45
|
+
return path === root || path.startsWith(root + '/');
|
|
46
|
+
}
|
|
47
|
+
function walk(dir, depth) {
|
|
48
|
+
if (depth > 4 || out.length >= 200)
|
|
49
|
+
return;
|
|
50
|
+
let entries;
|
|
51
|
+
try {
|
|
52
|
+
entries = readdirSync(dir);
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
for (const name of entries) {
|
|
58
|
+
if (out.length >= 200)
|
|
59
|
+
return;
|
|
60
|
+
const path = join(dir, name);
|
|
61
|
+
let stat;
|
|
62
|
+
try {
|
|
63
|
+
stat = lstatSync(path);
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
if (stat.isSymbolicLink())
|
|
69
|
+
continue;
|
|
70
|
+
if (stat.isDirectory()) {
|
|
71
|
+
let realDir;
|
|
72
|
+
try {
|
|
73
|
+
realDir = realpathSync(path);
|
|
74
|
+
}
|
|
75
|
+
catch {
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
if (withinRoot(realDir))
|
|
79
|
+
walk(path, depth + 1);
|
|
80
|
+
}
|
|
81
|
+
else if (stat.isFile()) {
|
|
82
|
+
let realFile;
|
|
83
|
+
try {
|
|
84
|
+
realFile = realpathSync(path);
|
|
85
|
+
}
|
|
86
|
+
catch {
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
if (withinRoot(realFile))
|
|
90
|
+
out.push(relative(root, path));
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
walk(root, 0);
|
|
95
|
+
return out.sort();
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=resource-reader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource-reader.js","sourceRoot":"","sources":["../../../src/core/skills/resource-reader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpD,MAAM,kBAAkB,GAAG,GAAG,GAAG,IAAI,CAAC;AAOtC,SAAS,kBAAkB,CAAC,IAAY;IACtC,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;IAChG,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;AACrF,CAAC;AAED,MAAM,UAAU,iBAAiB,CAC/B,QAA8B,EAC9B,SAAiB,EACjB,YAAoB;IAEpB,kBAAkB,CAAC,YAAY,CAAC,CAAC;IACjC,MAAM,KAAK,GAAG,QAAQ,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC;IACxE,IAAI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AY,CAAC,IAAI,CAAC,CAAC;gBAC/B,CAAC;gBAAC,MAAM,CAAC;oBACP,SAAS;gBACX,CAAC;gBACD,IAAI,UAAU,CAAC,OAAO,CAAC;oBAAE,IAAI,CAAC,IAAI,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;YACjD,CAAC;iBAAM,IAAI,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC;gBACzB,IAAI,QAAgB,CAAC;gBACrB,IAAI,CAAC;oBACH,QAAQ,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;gBAChC,CAAC;gBAAC,MAAM,CAAC;oBACP,SAAS;gBACX,CAAC;gBACD,IAAI,UAAU,CAAC,QAAQ,CAAC;oBAAE,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;YAC3D,CAAC;QACH,CAAC;IACH,CAAC;IAED,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IACd,OAAO,GAAG,CAAC,IAAI,EAAE,CAAC;AACpB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { CliId } from '../../adapters/cli/types.js';
|
|
2
|
+
import type { BotSkillPolicy, SessionSkillManifest, SkillPackage } from './types.js';
|
|
3
|
+
export declare function resolveSessionSkillManifest(opts: {
|
|
4
|
+
sessionId: string;
|
|
5
|
+
cliId: CliId;
|
|
6
|
+
workingDir: string;
|
|
7
|
+
botPolicy: BotSkillPolicy | undefined;
|
|
8
|
+
globalProjectSkills?: 'off' | 'trusted' | 'all';
|
|
9
|
+
globalDelivery?: 'auto' | 'prompt' | 'native';
|
|
10
|
+
registrySkills: SkillPackage[];
|
|
11
|
+
projectSkills: SkillPackage[];
|
|
12
|
+
now?: () => string;
|
|
13
|
+
}): SessionSkillManifest | null;
|
|
14
|
+
//# sourceMappingURL=session-resolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-resolver.d.ts","sourceRoot":"","sources":["../../../src/core/skills/session-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAGrF,wBAAgB,2BAA2B,CAAC,IAAI,EAAE;IAChD,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,KAAK,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,cAAc,GAAG,SAAS,CAAC;IACtC,mBAAmB,CAAC,EAAE,KAAK,GAAG,SAAS,GAAG,KAAK,CAAC;IAChD,cAAc,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,QAAQ,CAAC;IAC9C,cAAc,EAAE,YAAY,EAAE,CAAC;IAC/B,aAAa,EAAE,YAAY,EAAE,CAAC;IAC9B,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CACpB,GAAG,oBAAoB,GAAG,IAAI,CAoB9B"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { resolveSkillPolicy } from './policy.js';
|
|
2
|
+
export function resolveSessionSkillManifest(opts) {
|
|
3
|
+
const resolved = resolveSkillPolicy({
|
|
4
|
+
registrySkills: opts.registrySkills,
|
|
5
|
+
projectSkills: opts.projectSkills,
|
|
6
|
+
globalProjectSkills: opts.globalProjectSkills,
|
|
7
|
+
globalDelivery: opts.globalDelivery,
|
|
8
|
+
botPolicy: opts.botPolicy,
|
|
9
|
+
workingDir: opts.workingDir,
|
|
10
|
+
});
|
|
11
|
+
if (!resolved.enabled)
|
|
12
|
+
return null;
|
|
13
|
+
return {
|
|
14
|
+
sessionId: opts.sessionId,
|
|
15
|
+
cliId: opts.cliId,
|
|
16
|
+
workingDir: opts.workingDir,
|
|
17
|
+
policyMode: resolved.mode,
|
|
18
|
+
delivery: resolved.delivery,
|
|
19
|
+
prioritySkills: resolved.prioritySkills,
|
|
20
|
+
diagnostics: resolved.diagnostics,
|
|
21
|
+
generatedAt: opts.now ? opts.now() : new Date().toISOString(),
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=session-resolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-resolver.js","sourceRoot":"","sources":["../../../src/core/skills/session-resolver.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD,MAAM,UAAU,2BAA2B,CAAC,IAU3C;IACC,MAAM,QAAQ,GAAG,kBAAkB,CAAC;QAClC,cAAc,EAAE,IAAI,CAAC,cAAc;QACnC,aAAa,EAAE,IAAI,CAAC,aAAa;QACjC,mBAAmB,EAAE,IAAI,CAAC,mBAAmB;QAC7C,cAAc,EAAE,IAAI,CAAC,cAAc;QACnC,SAAS,EAAE,IAAI,CAAC,SAAS;QACzB,UAAU,EAAE,IAAI,CAAC,UAAU;KAC5B,CAAC,CAAC;IACH,IAAI,CAAC,QAAQ,CAAC,OAAO;QAAE,OAAO,IAAI,CAAC;IACnC,OAAO;QACL,SAAS,EAAE,IAAI,CAAC,SAAS;QACzB,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,UAAU,EAAE,IAAI,CAAC,UAAU;QAC3B,UAAU,EAAE,QAAQ,CAAC,IAAI;QACzB,QAAQ,EAAE,QAAQ,CAAC,QAAQ;QAC3B,cAAc,EAAE,QAAQ,CAAC,cAAc;QACvC,WAAW,EAAE,QAAQ,CAAC,WAAW;QACjC,WAAW,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;KAC9D,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { CliId } from '../../adapters/cli/types.js';
|
|
2
|
+
import type { BotSkillPolicy, SessionSkillManifest } from './types.js';
|
|
3
|
+
export interface PreparedSessionSkillPrompt {
|
|
4
|
+
prompt: string;
|
|
5
|
+
manifest: SessionSkillManifest | null;
|
|
6
|
+
}
|
|
7
|
+
export declare function prepareSessionSkillPrompt(opts: {
|
|
8
|
+
sessionId: string;
|
|
9
|
+
cliId: CliId;
|
|
10
|
+
workingDir: string;
|
|
11
|
+
prompt: string;
|
|
12
|
+
botPolicy: BotSkillPolicy | undefined;
|
|
13
|
+
}): PreparedSessionSkillPrompt;
|
|
14
|
+
//# sourceMappingURL=session-runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-runtime.d.ts","sourceRoot":"","sources":["../../../src/core/skills/session-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAGzD,OAAO,KAAK,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAMvE,MAAM,WAAW,0BAA0B;IACzC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,oBAAoB,GAAG,IAAI,CAAC;CACvC;AAED,wBAAgB,yBAAyB,CAAC,IAAI,EAAE;IAC9C,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,KAAK,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,cAAc,GAAG,SAAS,CAAC;CACvC,GAAG,0BAA0B,CAsB7B"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { readGlobalConfig } from '../../global-config.js';
|
|
2
|
+
import { readSkillRegistry } from '../../services/skill-registry-store.js';
|
|
3
|
+
import { discoverProjectSkills } from './discovery.js';
|
|
4
|
+
import { writeSessionSkillManifest } from './manifest-store.js';
|
|
5
|
+
import { renderSkillCatalogBlock } from './prompt.js';
|
|
6
|
+
import { resolveSessionSkillManifest } from './session-resolver.js';
|
|
7
|
+
export function prepareSessionSkillPrompt(opts) {
|
|
8
|
+
if (!opts.botPolicy || opts.prompt.trim().length === 0) {
|
|
9
|
+
return { prompt: opts.prompt, manifest: null };
|
|
10
|
+
}
|
|
11
|
+
const globalSkills = readGlobalConfig().skills;
|
|
12
|
+
const manifest = resolveSessionSkillManifest({
|
|
13
|
+
sessionId: opts.sessionId,
|
|
14
|
+
cliId: opts.cliId,
|
|
15
|
+
workingDir: opts.workingDir,
|
|
16
|
+
botPolicy: opts.botPolicy,
|
|
17
|
+
globalProjectSkills: globalSkills?.trustProjectSkills,
|
|
18
|
+
globalDelivery: globalSkills?.delivery,
|
|
19
|
+
registrySkills: Object.values(readSkillRegistry().skills),
|
|
20
|
+
projectSkills: discoverProjectSkills(opts.workingDir),
|
|
21
|
+
});
|
|
22
|
+
if (!manifest || manifest.prioritySkills.length === 0)
|
|
23
|
+
return { prompt: opts.prompt, manifest };
|
|
24
|
+
writeSessionSkillManifest(manifest);
|
|
25
|
+
if (opts.prompt.includes('<botmux_skills'))
|
|
26
|
+
return { prompt: opts.prompt, manifest };
|
|
27
|
+
return {
|
|
28
|
+
prompt: `${opts.prompt}\n\n${renderSkillCatalogBlock(manifest)}`,
|
|
29
|
+
manifest,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=session-runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-runtime.js","sourceRoot":"","sources":["../../../src/core/skills/session-runtime.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAE3E,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AAOpE,MAAM,UAAU,yBAA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| 'git' | 'github';
|
|
3
|
+
value: string;
|
|
4
|
+
github?: {
|
|
5
|
+
owner: string;
|
|
6
|
+
repo: string;
|
|
7
|
+
path?: string;
|
|
8
|
+
ref?: string;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export declare function redactGitUrlCredentials(raw: string): string;
|
|
12
|
+
export declare function assertNoGitUrlCredentials(raw: string): void;
|
|
13
|
+
export declare function assertAllowedGitProtocol(raw: string): void;
|
|
14
|
+
/** Refuse refs that could be mistaken for a `git checkout` option (leading `-`)
|
|
15
|
+
* or carry control characters. Real branch/tag/commit refs never start with a
|
|
16
|
+
* dash, so this is safe to reject outright. */
|
|
17
|
+
export declare function assertSafeGitRef(ref: string | undefined): void;
|
|
18
|
+
export declare function assertSafeGitSkillPath(path: string): void;
|
|
19
|
+
export declare function parseSkillInstallSource(raw: string): ParsedSkillInstallSource;
|
|
20
|
+
export declare function githubToGitUrl(owner: string, repo: string): string;
|
|
21
|
+
//# sourceMappingURL=sources.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sources.d.ts","sourceRoot":"","sources":["../../../src/core/skills/sources.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,OAAO,GAAG,KAAK,GAAG,QAAQ,CAAC;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACvE;AAUD,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAQ3D;AAED,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAM3D;AAeD,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAU1D;AAED;;gDAEgD;AAChD,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAG9D;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAIzD;AAmDD,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,MAAM,GAAG,wBAAwB,CAsB7E;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAElE"}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { isAbsolute } from 'node:path';
|
|
2
|
+
function parseMaybeUrl(raw) {
|
|
3
|
+
try {
|
|
4
|
+
return new URL(raw.replace(/^git\+/, ''));
|
|
5
|
+
}
|
|
6
|
+
catch {
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export function redactGitUrlCredentials(raw) {
|
|
11
|
+
const url = parseMaybeUrl(raw);
|
|
12
|
+
if (!url)
|
|
13
|
+
return raw;
|
|
14
|
+
if (!url.username && !url.password)
|
|
15
|
+
return raw;
|
|
16
|
+
url.username = url.username ? '***' : '';
|
|
17
|
+
url.password = url.password ? '***' : '';
|
|
18
|
+
const redacted = url.toString();
|
|
19
|
+
return raw.startsWith('git+') ? `git+${redacted}` : redacted;
|
|
20
|
+
}
|
|
21
|
+
export function assertNoGitUrlCredentials(raw) {
|
|
22
|
+
const url = parseMaybeUrl(raw);
|
|
23
|
+
if (!url)
|
|
24
|
+
return;
|
|
25
|
+
if ((url.protocol === 'http:' || url.protocol === 'https:') && (url.username || url.password)) {
|
|
26
|
+
throw new Error('git_url_credentials_not_allowed');
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/** Refuse git transports that execute commands. git's `ext::` (and other
|
|
30
|
+
* remote-helper) transports run an arbitrary shell command on clone, turning
|
|
31
|
+
* "install a skill" into RCE on the daemon host. Only the standard fetch
|
|
32
|
+
* transports are allowed; `file:`/bare local paths are permitted because they
|
|
33
|
+
* are equivalent to the already-supported local-directory install. `git` is
|
|
34
|
+
* also invoked with a matching `GIT_ALLOW_PROTOCOL` allowlist as
|
|
35
|
+
* defense-in-depth. scp-like `user@host:path` carries no URL scheme and is SSH. */
|
|
36
|
+
const ALLOWED_GIT_PROTOCOLS = new Set(['https:', 'http:', 'ssh:', 'git:', 'file:']);
|
|
37
|
+
function isScpLikeGitUrl(raw) {
|
|
38
|
+
return !raw.includes('://') && /^[A-Za-z0-9._-]+@[^/]+:/.test(raw);
|
|
39
|
+
}
|
|
40
|
+
export function assertAllowedGitProtocol(raw) {
|
|
41
|
+
if (isScpLikeGitUrl(raw))
|
|
42
|
+
return; // scp short form → SSH
|
|
43
|
+
const url = parseMaybeUrl(raw);
|
|
44
|
+
// No parseable scheme → git treats it as a local path (same trust as a local
|
|
45
|
+
// directory install). A parseable scheme must be on the allowlist; `ext:` and
|
|
46
|
+
// friends fall through to the throw.
|
|
47
|
+
if (!url)
|
|
48
|
+
return;
|
|
49
|
+
if (!ALLOWED_GIT_PROTOCOLS.has(url.protocol)) {
|
|
50
|
+
throw new Error('git_url_protocol_not_allowed');
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/** Refuse refs that could be mistaken for a `git checkout` option (leading `-`)
|
|
54
|
+
* or carry control characters. Real branch/tag/commit refs never start with a
|
|
55
|
+
* dash, so this is safe to reject outright. */
|
|
56
|
+
export function assertSafeGitRef(ref) {
|
|
57
|
+
if (ref === undefined)
|
|
58
|
+
return;
|
|
59
|
+
if (!ref || ref.startsWith('-') || /[\0\s]/.test(ref))
|
|
60
|
+
throw new Error('invalid_git_ref');
|
|
61
|
+
}
|
|
62
|
+
export function assertSafeGitSkillPath(path) {
|
|
63
|
+
if (!path || path.includes('\0'))
|
|
64
|
+
throw new Error('invalid_git_skill_path');
|
|
65
|
+
if (isAbsolute(path) || /^[A-Za-z]:[\\/]/.test(path))
|
|
66
|
+
throw new Error('invalid_git_skill_path');
|
|
67
|
+
if (path.split(/[\\/]+/).filter(Boolean).includes('..'))
|
|
68
|
+
throw new Error('invalid_git_skill_path');
|
|
69
|
+
}
|
|
70
|
+
function decodeUrlPart(part) {
|
|
71
|
+
try {
|
|
72
|
+
return decodeURIComponent(part);
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
throw new Error('invalid_github_skill_source');
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
function hasRawPathTraversal(raw) {
|
|
79
|
+
return /(?:^|[\\/])(?:\.\.|%2e%2e)(?=$|[\\/#?])/i.test(raw);
|
|
80
|
+
}
|
|
81
|
+
function parseGitHubBrowserUrl(raw) {
|
|
82
|
+
const url = parseMaybeUrl(raw);
|
|
83
|
+
if (!url)
|
|
84
|
+
return null;
|
|
85
|
+
if (url.protocol !== 'https:' && url.protocol !== 'http:')
|
|
86
|
+
return null;
|
|
87
|
+
if (url.hostname !== 'github.com' && url.hostname !== 'www.github.com')
|
|
88
|
+
return null;
|
|
89
|
+
if (hasRawPathTraversal(raw))
|
|
90
|
+
throw new Error('invalid_git_skill_path');
|
|
91
|
+
const parts = url.pathname.split('/').filter(Boolean).map(decodeUrlPart);
|
|
92
|
+
if (parts.length < 2)
|
|
93
|
+
throw new Error('invalid_github_skill_source');
|
|
94
|
+
const [owner, repoWithSuffix] = parts;
|
|
95
|
+
const repo = repoWithSuffix.endsWith('.git') ? repoWithSuffix.slice(0, -'.git'.length) : repoWithSuffix;
|
|
96
|
+
if (!owner || !repo)
|
|
97
|
+
throw new Error('invalid_github_skill_source');
|
|
98
|
+
let ref;
|
|
99
|
+
let path;
|
|
100
|
+
if (parts[2] === 'tree' || parts[2] === 'blob') {
|
|
101
|
+
const rest = parts.slice(3);
|
|
102
|
+
if (rest.length === 0)
|
|
103
|
+
throw new Error('invalid_github_skill_source');
|
|
104
|
+
const skillsIndex = rest.indexOf('skills');
|
|
105
|
+
if (skillsIndex > 0) {
|
|
106
|
+
ref = rest.slice(0, skillsIndex).join('/');
|
|
107
|
+
path = rest.slice(skillsIndex).join('/');
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
ref = rest[0];
|
|
111
|
+
path = rest.slice(1).join('/') || undefined;
|
|
112
|
+
}
|
|
113
|
+
const pathParts = path?.split('/');
|
|
114
|
+
if (parts[2] === 'blob' && pathParts?.[pathParts.length - 1]?.toLowerCase() === 'skill.md') {
|
|
115
|
+
path = pathParts.slice(0, -1).join('/') || undefined;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
if (path)
|
|
119
|
+
assertSafeGitSkillPath(path);
|
|
120
|
+
return {
|
|
121
|
+
kind: 'github',
|
|
122
|
+
value: raw,
|
|
123
|
+
github: { owner, repo, ...(path ? { path } : {}), ...(ref ? { ref } : {}) },
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
export function parseSkillInstallSource(raw) {
|
|
127
|
+
if (raw.startsWith('github:')) {
|
|
128
|
+
const rest = raw.slice('github:'.length);
|
|
129
|
+
const parts = rest.split('/').filter(Boolean);
|
|
130
|
+
if (parts.length < 2)
|
|
131
|
+
throw new Error('invalid_github_skill_source');
|
|
132
|
+
const path = parts.slice(2).join('/') || undefined;
|
|
133
|
+
if (path)
|
|
134
|
+
assertSafeGitSkillPath(path);
|
|
135
|
+
return {
|
|
136
|
+
kind: 'github',
|
|
137
|
+
value: raw,
|
|
138
|
+
github: { owner: parts[0], repo: parts[1], path },
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
assertNoGitUrlCredentials(raw);
|
|
142
|
+
const githubSource = parseGitHubBrowserUrl(raw);
|
|
143
|
+
if (githubSource)
|
|
144
|
+
return githubSource;
|
|
145
|
+
if (raw.startsWith('git+') || raw.endsWith('.git') || raw.startsWith('git@')) {
|
|
146
|
+
const value = raw.replace(/^git\+/, '');
|
|
147
|
+
assertAllowedGitProtocol(value);
|
|
148
|
+
return { kind: 'git', value };
|
|
149
|
+
}
|
|
150
|
+
return { kind: 'local', value: raw };
|
|
151
|
+
}
|
|
152
|
+
export function githubToGitUrl(owner, repo) {
|
|
153
|
+
return `https://github.com/${owner}/${repo}.git`;
|
|
154
|
+
}
|
|
155
|
+
//# sourceMappingURL=sources.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sources.js","sourceRoot":"","sources":["../../../src/core/skills/sources.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAQvC,SAAS,aAAa,CAAC,GAAW;IAChC,IAAI,CAAC;QACH,OAAO,IAAI,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC;IAC5C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,GAAW;IACjD,MAAM,GAAG,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC;IAC/B,IAAI,CAAC,GAAG;QAAE,OAAO,GAAG,CAAC;IACrB,IAAI,CAAC,GAAG,CAAC,QAAQ,IAAI,CAAC,GAAG,CAAC,QAAQ;QAAE,OAAO,GAAG,CAAC;IAC/C,GAAG,CAAC,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;IACzC,GAAG,CAAC,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;IACzC,MAAM,QAAQ,GAAG,GAAG,CAAC,QAAQ,EAAE,CAAC;IAChC,OAAO,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,QAAQ,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC;AAC/D,CAAC;AAED,MAAM,UAAU,yBAAyB,CAAC,GAAW;IACnD,MAAM,GAAG,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC;IAC/B,IAAI,CAAC,GAAG;QAAE,OAAO;IACj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AAG,CAAC,IAAI,SAAS,CAAC;QACnD,IAAI,IAAI;YAAE,sBAAsB,CAAC,IAAI,CAAC,CAAC;QACvC,OAAO;YACL,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,GAAG;YACV,MAAM,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE;SAClD,CAAC;IACJ,CAAC;IACD,yBAAyB,CAAC,GAAG,CAAC,CAAC;IAC/B,MAAM,YAAY,GAAG,qBAAqB,CAAC,GAAG,CAAC,CAAC;IAChD,IAAI,YAAY;QAAE,OAAO,YAAY,CAAC;IACtC,IAAI,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;QAC7E,MAAM,KAAK,GAAG,GAAG,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QACxC,wBAAwB,CAAC,KAAK,CAAC,CAAC;QAChC,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;IAChC,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC;AACvC,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,KAAa,EAAE,IAAY;IACxD,OAAO,sBAAsB,KAAK,IAAI,IAAI,MAAM,CAAC;AACnD,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { CliId } from '../../adapters/cli/types.js';
|
|
2
|
+
export type SkillSource = {
|
|
3
|
+
type: 'bundled';
|
|
4
|
+
packageName: string;
|
|
5
|
+
} | {
|
|
6
|
+
type: 'user';
|
|
7
|
+
root: string;
|
|
8
|
+
} | {
|
|
9
|
+
type: 'project';
|
|
10
|
+
root: string;
|
|
11
|
+
} | {
|
|
12
|
+
type: 'admin';
|
|
13
|
+
root: string;
|
|
14
|
+
} | {
|
|
15
|
+
type: 'local-copy';
|
|
16
|
+
originalPath: string;
|
|
17
|
+
} | {
|
|
18
|
+
type: 'local-link';
|
|
19
|
+
path: string;
|
|
20
|
+
} | {
|
|
21
|
+
type: 'git';
|
|
22
|
+
url: string;
|
|
23
|
+
path: string;
|
|
24
|
+
ref?: string;
|
|
25
|
+
commit?: string;
|
|
26
|
+
} | {
|
|
27
|
+
type: 'github';
|
|
28
|
+
owner: string;
|
|
29
|
+
repo: string;
|
|
30
|
+
path: string;
|
|
31
|
+
ref?: string;
|
|
32
|
+
commit?: string;
|
|
33
|
+
};
|
|
34
|
+
export interface SkillPackage {
|
|
35
|
+
id: string;
|
|
36
|
+
name: string;
|
|
37
|
+
displayName?: string;
|
|
38
|
+
description?: string;
|
|
39
|
+
version?: string;
|
|
40
|
+
tags: string[];
|
|
41
|
+
rootDir: string;
|
|
42
|
+
entrypoint: string;
|
|
43
|
+
source: SkillSource;
|
|
44
|
+
checksum?: string;
|
|
45
|
+
installedAt?: string;
|
|
46
|
+
updatedAt?: string;
|
|
47
|
+
}
|
|
48
|
+
export type SkillSelector = `skill:${string}`;
|
|
49
|
+
export interface BotSkillPolicy {
|
|
50
|
+
include?: SkillSelector[];
|
|
51
|
+
}
|
|
52
|
+
export interface ResolvedSkill extends SkillPackage {
|
|
53
|
+
priorityReason: string;
|
|
54
|
+
}
|
|
55
|
+
export interface SkillDiagnostic {
|
|
56
|
+
level: 'info' | 'warn' | 'error';
|
|
57
|
+
code: string;
|
|
58
|
+
message: string;
|
|
59
|
+
skillName?: string;
|
|
60
|
+
}
|
|
61
|
+
export interface SessionSkillManifest {
|
|
62
|
+
sessionId: string;
|
|
63
|
+
cliId: CliId;
|
|
64
|
+
workingDir: string;
|
|
65
|
+
policyMode: 'priority';
|
|
66
|
+
delivery?: 'auto' | 'prompt' | 'native';
|
|
67
|
+
prioritySkills: ResolvedSkill[];
|
|
68
|
+
diagnostics: SkillDiagnostic[];
|
|
69
|
+
generatedAt: string;
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/core/skills/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAEzD,MAAM,MAAM,WAAW,GACnB;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,GACxC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC9B;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACjC;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC/B;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,GAC5C;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACpC;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GACzE;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEjG,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,WAAW,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,aAAa,GAAG,SAAS,MAAM,EAAE,CAAC;AAE9C,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,EAAE,aAAa,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,aAAc,SAAQ,YAAY;IACjD,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,KAAK,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,UAAU,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,QAAQ,CAAC;IACxC,cAAc,EAAE,aAAa,EAAE,CAAC;IAChC,WAAW,EAAE,eAAe,EAAE,CAAC;IAC/B,WAAW,EAAE,MAAM,CAAC;CACrB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/core/skills/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Startup commands — per-bot slash commands the worker types into a freshly
|
|
3
|
+
* spawned CLI right after it's ready, BEFORE the user's first prompt (e.g.
|
|
4
|
+
* `/effort ultracode`, `/model opus`). Extracted into a leaf module so both
|
|
5
|
+
* bots.json parsing ({@link ../bot-registry.js}) and the `/botconfig` config
|
|
6
|
+
* store ({@link ../services/bot-config-store.js}) share one normalization
|
|
7
|
+
* without a circular import.
|
|
8
|
+
*
|
|
9
|
+
* Unlike {@link ./passthrough-commands.js}'s customPassthroughCommands — which
|
|
10
|
+
* are single-token slash commands routed through the daemon — a startup command
|
|
11
|
+
* is a whole input LINE typed verbatim into the CLI's TUI, so it MAY carry
|
|
12
|
+
* space-delimited arguments (`/effort ultracode`). That's why the free-text
|
|
13
|
+
* parser splits on comma/newline only (never whitespace) and the per-entry
|
|
14
|
+
* normalizer keeps internal spaces intact.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Normalize a single startup command: collapse embedded newlines (each command
|
|
18
|
+
* must submit as one line), trim, and ensure a leading `/` (so users can type
|
|
19
|
+
* `effort ultracode` or `/effort ultracode`). Returns null for empty / too-long
|
|
20
|
+
* input. Internal spaces (arguments) are preserved.
|
|
21
|
+
*/
|
|
22
|
+
export declare function normalizeStartupCommand(cmd: unknown): string | null;
|
|
23
|
+
/**
|
|
24
|
+
* Parse free-text dashboard / `/botconfig` input into a normalized, order-
|
|
25
|
+
* preserving, deduped startup-command list. Commands are separated by comma OR
|
|
26
|
+
* newline (NOT whitespace, since a command's arguments are space-delimited).
|
|
27
|
+
* Mirrors the normalization {@link ../bot-registry.js}'s parseBotConfigsFromText
|
|
28
|
+
* applies when loading bots.json, so a round-trip through the card is stable.
|
|
29
|
+
*/
|
|
30
|
+
export declare function parseStartupCommandsInput(raw: string): string[];
|
|
31
|
+
/** Normalize an array (bots.json form) of startup commands. */
|
|
32
|
+
export declare function normalizeStartupCommandList(arr: unknown): string[];
|
|
33
|
+
/**
|
|
34
|
+
* Whether a spawn should (re-)run startupCommands. They run on a genuinely fresh
|
|
35
|
+
* CLI process; a reattach to a LIVE persistent (tmux/zellij/herdr) pane — e.g. a
|
|
36
|
+
* daemon restart recovering an existing session — is the SAME CLI with its
|
|
37
|
+
* effort/model/context already established, so re-typing `/effort` (idempotent)
|
|
38
|
+
* or `/clear`,`/compact` (NOT idempotent) would corrupt it. Skip on reattach.
|
|
39
|
+
*/
|
|
40
|
+
export declare function shouldRunStartupCommandsOnSpawn(opts: {
|
|
41
|
+
willReattachPersistent: boolean;
|
|
42
|
+
}): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Whether to defer the initial prompt from launch-args to the normal input queue
|
|
45
|
+
* so startupCommands precede it. Only when commands exist AND the CLI bakes the
|
|
46
|
+
* first prompt into launch args (passesInitialPromptViaArgs, e.g. Gemini `-i`):
|
|
47
|
+
* an args-baked prompt would execute BEFORE flushPending's startup-command hook,
|
|
48
|
+
* breaking the "before the first message" contract. Adopt never spawns fresh.
|
|
49
|
+
* Default path (no startupCommands) is untouched, so args-CLIs keep their robust
|
|
50
|
+
* `-i` delivery unless a bot opts in.
|
|
51
|
+
*/
|
|
52
|
+
export declare function shouldDeferInitialPromptForStartup(opts: {
|
|
53
|
+
hasStartupCommands: boolean;
|
|
54
|
+
adoptMode: boolean;
|
|
55
|
+
passesInitialPromptViaArgs: boolean;
|
|
56
|
+
}): boolean;
|
|
57
|
+
//# sourceMappingURL=startup-commands.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"startup-commands.d.ts","sourceRoot":"","sources":["../../src/core/startup-commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAKH;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAOnE;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAO/D;AAED,+DAA+D;AAC/D,wBAAgB,2BAA2B,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,EAAE,CAQlE;AAED;;;;;;GAMG;AACH,wBAAgB,+BAA+B,CAAC,IAAI,EAAE;IAAE,sBAAsB,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAElG;AAED;;;;;;;;GAQG;AACH,wBAAgB,kCAAkC,CAAC,IAAI,EAAE;IACvD,kBAAkB,EAAE,OAAO,CAAC;IAC5B,SAAS,EAAE,OAAO,CAAC;IACnB,0BAA0B,EAAE,OAAO,CAAC;CACrC,GAAG,OAAO,CAEV"}
|