@pencil-agent/nano-pencil 1.14.1 → 1.14.3
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/dist/build-meta.json +3 -3
- package/dist/builtin-extensions.d.ts +17 -1
- package/dist/builtin-extensions.js +36 -23
- package/dist/core/config/settings-manager.d.ts +6 -0
- package/dist/core/config/settings-manager.js +21 -0
- package/dist/core/extensions/runner.d.ts +1 -0
- package/dist/core/extensions/runner.js +3 -0
- package/dist/core/extensions/types.d.ts +10 -6
- package/dist/core/i18n/slash-commands.d.ts +11 -0
- package/dist/core/i18n/slash-commands.js +15 -4
- package/dist/core/i18n/slash-commands.zh.d.ts +11 -0
- package/dist/core/i18n/slash-commands.zh.js +15 -4
- package/dist/core/model-registry.d.ts +2 -2
- package/dist/core/model-registry.js +6 -5
- package/dist/core/runtime/agent-session.d.ts +1 -1
- package/dist/core/runtime/extension-core-bindings.js +1 -0
- package/dist/core/runtime/sdk.js +1 -0
- package/dist/core/runtime/slash-command-catalog.d.ts +2 -1
- package/dist/core/runtime/slash-command-catalog.js +9 -1
- package/dist/core/slash-commands.d.ts +9 -1
- package/dist/core/slash-commands.js +77 -32
- package/dist/extensions/defaults/AGENT.md +32 -9
- package/dist/extensions/defaults/browser/index.js +1 -1
- package/dist/extensions/defaults/btw/index.js +8 -1
- package/dist/extensions/defaults/debug/index.js +28 -3
- package/dist/extensions/defaults/discipline/index.d.ts +8 -0
- package/dist/extensions/defaults/discipline/index.js +117 -0
- package/dist/extensions/defaults/discipline/skills/brainstorming/SKILL.md +33 -0
- package/dist/extensions/defaults/discipline/skills/executing-plans/SKILL.md +25 -0
- package/dist/extensions/defaults/discipline/skills/finishing-development-branch/SKILL.md +25 -0
- package/dist/extensions/defaults/discipline/skills/receiving-code-review/SKILL.md +22 -0
- package/dist/extensions/defaults/discipline/skills/requesting-code-review/SKILL.md +31 -0
- package/dist/extensions/defaults/discipline/skills/systematic-debugging/SKILL.md +28 -0
- package/dist/extensions/defaults/discipline/skills/test-driven-development/SKILL.md +32 -0
- package/dist/extensions/defaults/discipline/skills/using-git-worktrees/SKILL.md +25 -0
- package/dist/extensions/defaults/discipline/skills/verification-before-completion/SKILL.md +27 -0
- package/dist/extensions/defaults/discipline/skills/writing-plans/SKILL.md +26 -0
- package/dist/extensions/defaults/grub/README.md +9 -4
- package/dist/extensions/defaults/grub/grub-controller.d.ts +14 -2
- package/dist/extensions/defaults/grub/grub-controller.js +102 -76
- package/dist/extensions/defaults/grub/grub-decision.d.ts +8 -0
- package/dist/extensions/defaults/grub/grub-decision.js +42 -0
- package/dist/extensions/defaults/grub/grub-feature-list.d.ts +1 -0
- package/dist/extensions/defaults/grub/grub-feature-list.js +8 -3
- package/dist/extensions/defaults/grub/grub-format.d.ts +13 -0
- package/dist/extensions/defaults/grub/grub-format.js +87 -0
- package/dist/extensions/defaults/grub/grub-harness.d.ts +9 -0
- package/dist/extensions/defaults/grub/grub-harness.js +71 -0
- package/dist/extensions/defaults/grub/grub-i18n.d.ts +50 -12
- package/dist/extensions/defaults/grub/grub-i18n.js +86 -55
- package/dist/extensions/defaults/grub/grub-parser.js +58 -36
- package/dist/extensions/defaults/grub/grub-persistence.js +75 -10
- package/dist/extensions/defaults/grub/grub-prompts.d.ts +12 -0
- package/dist/extensions/defaults/grub/grub-prompts.js +155 -0
- package/dist/extensions/defaults/grub/grub-turn.d.ts +16 -0
- package/dist/extensions/defaults/grub/grub-turn.js +61 -0
- package/dist/extensions/defaults/grub/grub-types.d.ts +1 -0
- package/dist/extensions/defaults/grub/index.d.ts +1 -1
- package/dist/extensions/defaults/grub/index.js +11 -314
- package/dist/extensions/defaults/idle-think/idle-think-runtime.d.ts +46 -0
- package/dist/extensions/defaults/idle-think/idle-think-runtime.js +148 -0
- package/dist/extensions/defaults/idle-think/index.d.ts +1 -1
- package/dist/extensions/defaults/idle-think/index.js +5 -130
- package/dist/extensions/defaults/idle-think/insights.d.ts +10 -23
- package/dist/extensions/defaults/idle-think/insights.js +52 -44
- package/dist/extensions/defaults/interview/index.d.ts +2 -2
- package/dist/extensions/defaults/interview/index.js +3 -570
- package/dist/extensions/defaults/interview/interview-runtime.d.ts +55 -0
- package/dist/extensions/defaults/interview/interview-runtime.js +551 -0
- package/dist/extensions/defaults/link-world/index.js +1 -1
- package/dist/extensions/defaults/loop/cron/cron-scheduler.js +19 -0
- package/dist/extensions/defaults/presence/index.d.ts +3 -47
- package/dist/extensions/defaults/presence/index.js +27 -179
- package/dist/extensions/defaults/presence/presence-memory.d.ts +46 -0
- package/dist/extensions/defaults/presence/presence-memory.js +167 -0
- package/dist/extensions/defaults/recap/index.js +6 -1
- package/dist/extensions/defaults/sal/index.d.ts +2 -37
- package/dist/extensions/defaults/sal/index.js +9 -371
- package/dist/extensions/defaults/sal/sal-config.d.ts +41 -0
- package/dist/extensions/defaults/sal/sal-config.js +166 -0
- package/dist/extensions/defaults/sal/sal-context.d.ts +11 -0
- package/dist/extensions/defaults/sal/sal-context.js +94 -0
- package/dist/extensions/defaults/sal/sal-runtime.d.ts +70 -0
- package/dist/extensions/defaults/sal/sal-runtime.js +7 -0
- package/dist/extensions/defaults/sal/sal-trace.d.ts +11 -0
- package/dist/extensions/defaults/sal/sal-trace.js +129 -0
- package/dist/extensions/defaults/security-audit/index.d.ts +1 -1
- package/dist/extensions/defaults/security-audit/index.js +19 -91
- package/dist/extensions/defaults/team/AGENT.md +3 -1
- package/dist/extensions/defaults/team/index.js +6 -283
- package/dist/extensions/defaults/team/team-runtime-helpers.d.ts +48 -0
- package/dist/extensions/defaults/team/team-runtime-helpers.js +324 -0
- package/dist/extensions/defaults/team/team-runtime.d.ts +2 -66
- package/dist/extensions/defaults/team/team-runtime.js +39 -391
- package/dist/extensions/defaults/team/team-ui.d.ts +50 -0
- package/dist/extensions/defaults/team/team-ui.js +270 -0
- package/dist/extensions/defaults/token-save/index.js +8 -1
- package/dist/extensions/optional/export-html/index.js +0 -8
- package/dist/extensions/optional/simplify/index.d.ts +21 -0
- package/dist/extensions/optional/simplify/index.js +44 -20
- package/dist/modes/acp/acp-mode.js +4 -4
- package/dist/modes/interactive/components/settings-selector.d.ts +4 -0
- package/dist/modes/interactive/components/settings-selector.js +10 -0
- package/dist/modes/interactive/interactive-mode.js +16 -18
- package/dist/modes/rpc/rpc-client.d.ts +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +1 -1
- package/dist/node_modules/@pencil-agent/agent-core/agent.d.ts +1 -1
- package/dist/node_modules/@pencil-agent/agent-core/agent.js +2 -2
- package/dist/node_modules/@pencil-agent/agent-core/claude-agent-loop.d.ts +15 -0
- package/dist/node_modules/@pencil-agent/agent-core/claude-agent-loop.js +342 -0
- package/dist/node_modules/@pencil-agent/agent-core/claude-tool-orchestration.d.ts +23 -0
- package/dist/node_modules/@pencil-agent/agent-core/claude-tool-orchestration.js +220 -0
- package/dist/node_modules/@pencil-agent/agent-core/types.d.ts +8 -8
- package/dist/node_modules/@pencil-agent/agent-core/types.js +4 -4
- package/dist/node_modules/@pencil-agent/ai/cli.js +0 -0
- package/dist/node_modules/@pencil-agent/ai/models.generated.d.ts +7 -24
- package/dist/node_modules/@pencil-agent/ai/models.generated.js +65 -82
- package/dist/node_modules/@pencil-agent/ai/types.d.ts +3 -3
- package/dist/node_modules/@pencil-agent/tui/autocomplete.js +7 -2
- package/dist/node_modules/@pencil-agent/tui/tui.d.ts +8 -3
- package/dist/node_modules/@pencil-agent/tui/tui.js +67 -33
- package/dist/packages/mem-core/engine-archive.js +19 -17
- package/dist/packages/mem-core/engine.d.ts +0 -2
- package/dist/packages/mem-core/engine.js +2 -117
- package/dist/packages/mem-core/extension.js +150 -83
- package/dist/packages/mem-core/src/store.d.ts +21 -0
- package/dist/packages/mem-core/src/store.js +120 -0
- package/dist/packages/mem-core/src/types.d.ts +329 -0
- package/dist/packages/mem-core/src/types.js +7 -0
- package/dist/packages/mem-core/store.js +15 -1
- package/docs/agent-loop-frameworks.md +14 -14
- package/docs/loop /351/207/215/346/236/204/345/256/214/346/210/220/346/200/273/347/273/223.md" +251 -0
- package/docs/loop /351/207/215/346/236/204/345/256/214/346/210/220/346/212/245/345/221/212.md" +123 -0
- package/docs/loop /351/207/215/346/236/204/346/226/271/346/241/210.md" +1222 -0
- package/docs/loop /351/207/215/346/236/204/346/226/271/346/241/210/345/256/236/347/216/260/346/212/245/345/221/212.md" +158 -0
- package/docs/loop /351/207/215/346/236/204/346/226/271/346/241/210/345/257/271/346/257/224/345/210/206/346/236/220.md" +128 -0
- package/docs/loop /351/207/215/346/236/204/350/256/241/345/210/222.md" +321 -0
- package/docs/loop-usage-examples.md +215 -0
- package/docs/planmode.md +1987 -0
- package/package.json +9 -4
package/dist/build-meta.json
CHANGED
|
@@ -4,6 +4,22 @@
|
|
|
4
4
|
* [TO]: Consumed by main.ts, test files
|
|
5
5
|
* [HERE]: builtin-extensions.ts - built-in extension registry for NanoPencil
|
|
6
6
|
*/
|
|
7
|
+
export type BuiltinExtensionRiskLevel = "passive" | "command" | "tool" | "background" | "write-capable";
|
|
8
|
+
export type BuiltinExtensionTestContract = "lifecycle" | "external-process" | "resource-discovery" | "write-guard";
|
|
9
|
+
export interface BuiltinExtension {
|
|
10
|
+
id: string;
|
|
11
|
+
category: "default" | "optional" | "package";
|
|
12
|
+
defaultEnabled: boolean;
|
|
13
|
+
riskLevel: BuiltinExtensionRiskLevel;
|
|
14
|
+
requiresUI: boolean;
|
|
15
|
+
startsTimers: boolean;
|
|
16
|
+
writesWorkspace: boolean;
|
|
17
|
+
externalProcess: boolean;
|
|
18
|
+
resourceDiscovery?: boolean;
|
|
19
|
+
testContracts?: readonly BuiltinExtensionTestContract[];
|
|
20
|
+
testFiles?: readonly string[];
|
|
21
|
+
}
|
|
22
|
+
export declare const builtInExtensions: readonly BuiltinExtension[];
|
|
7
23
|
/**
|
|
8
24
|
* Get the list of built-in extension paths that NanoPencil loads by default
|
|
9
25
|
*
|
|
@@ -14,7 +30,7 @@
|
|
|
14
30
|
* - SecurityAudit (security audit)
|
|
15
31
|
* - MCP (MCP protocol adapter)
|
|
16
32
|
*
|
|
17
|
-
* Optional extensions need to be enabled via configuration:
|
|
33
|
+
* Optional extensions need to be enabled via configuration or --extension:
|
|
18
34
|
* - Simplify (code simplification) - extensions/optional/simplify/
|
|
19
35
|
* - export-html (HTML export) - extensions/optional/export-html/
|
|
20
36
|
*/
|
|
@@ -12,7 +12,6 @@ const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
|
12
12
|
const require = createRequire(import.meta.url);
|
|
13
13
|
/** Built-in extension paths */
|
|
14
14
|
const BUNDLED_NANOMEM_EXTENSION_PACKAGES = join(__dirname, "packages", "mem-core", "extension.js");
|
|
15
|
-
const BUNDLED_SIMPLIFY_EXTENSION = join(__dirname, "extensions", "optional", "simplify", "index.js");
|
|
16
15
|
const BUNDLED_LINK_WORLD_EXTENSION = join(__dirname, "extensions", "defaults", "link-world", "index.js");
|
|
17
16
|
const BUNDLED_BROWSER_EXTENSION = join(__dirname, "extensions", "defaults", "browser", "index.js");
|
|
18
17
|
const BUNDLED_SECURITY_AUDIT_EXTENSION = join(__dirname, "extensions", "defaults", "security-audit", "index.js");
|
|
@@ -21,6 +20,7 @@ const BUNDLED_PRESENCE_EXTENSION = join(__dirname, "extensions", "defaults", "pr
|
|
|
21
20
|
const BUNDLED_INTERVIEW_EXTENSION = join(__dirname, "extensions", "defaults", "interview", "index.js");
|
|
22
21
|
const BUNDLED_LOOP_EXTENSION = join(__dirname, "extensions", "defaults", "loop", "index.js");
|
|
23
22
|
const BUNDLED_PLAN_EXTENSION = join(__dirname, "extensions", "defaults", "plan", "index.js");
|
|
23
|
+
const BUNDLED_DISCIPLINE_EXTENSION = join(__dirname, "extensions", "defaults", "discipline", "index.js");
|
|
24
24
|
const BUNDLED_DIAGNOSTICS_EXTENSION = join(__dirname, "extensions", "defaults", "diagnostics", "index.js");
|
|
25
25
|
const BUNDLED_SAL_EXTENSION = join(__dirname, "extensions", "defaults", "sal", "index.js");
|
|
26
26
|
const BUNDLED_TOKEN_SAVE_EXTENSION = join(__dirname, "extensions", "defaults", "token-save", "index.js");
|
|
@@ -32,7 +32,31 @@ const BUNDLED_BTW_EXTENSION = join(__dirname, "extensions", "defaults", "btw", "
|
|
|
32
32
|
const BUNDLED_RECAP_EXTENSION = join(__dirname, "extensions", "defaults", "recap", "index.js");
|
|
33
33
|
const BUNDLED_DEBUG_EXTENSION = join(__dirname, "extensions", "defaults", "debug", "index.js");
|
|
34
34
|
const BUNDLED_MCP_EXTENSION = join(__dirname, "extensions", "defaults", "mcp", "index.js");
|
|
35
|
-
const
|
|
35
|
+
export const builtInExtensions = [
|
|
36
|
+
{ id: "diagnostics", category: "default", defaultEnabled: true, riskLevel: "background", requiresUI: false, startsTimers: true, writesWorkspace: false, externalProcess: false, testContracts: ["lifecycle"], testFiles: ["test/diagnostic-buffer-throttle.test.ts", "test/diagnostics-runtime.test.ts"] },
|
|
37
|
+
{ id: "sal", category: "default", defaultEnabled: true, riskLevel: "background", requiresUI: false, startsTimers: false, writesWorkspace: false, externalProcess: false, testContracts: ["lifecycle"], testFiles: ["test/sal-lifecycle.test.ts"] },
|
|
38
|
+
{ id: "token-save", category: "default", defaultEnabled: true, riskLevel: "tool", requiresUI: false, startsTimers: false, writesWorkspace: false, externalProcess: false },
|
|
39
|
+
{ id: "nanomem", category: "package", defaultEnabled: true, riskLevel: "background", requiresUI: false, startsTimers: false, writesWorkspace: false, externalProcess: false, testContracts: ["lifecycle"], testFiles: ["packages/mem-core/test/extension-commands.test.ts"] },
|
|
40
|
+
{ id: "link-world", category: "default", defaultEnabled: true, riskLevel: "tool", requiresUI: false, startsTimers: false, writesWorkspace: false, externalProcess: true, resourceDiscovery: true, testContracts: ["external-process", "resource-discovery"], testFiles: ["test/link-world-extension-registration.test.ts"] },
|
|
41
|
+
{ id: "browser", category: "default", defaultEnabled: true, riskLevel: "tool", requiresUI: false, startsTimers: false, writesWorkspace: false, externalProcess: true, resourceDiscovery: true, testContracts: ["external-process", "resource-discovery"], testFiles: ["test/browser-extension-registration.test.ts"] },
|
|
42
|
+
{ id: "security-audit", category: "default", defaultEnabled: true, riskLevel: "tool", requiresUI: false, startsTimers: false, writesWorkspace: false, externalProcess: false },
|
|
43
|
+
{ id: "soul", category: "default", defaultEnabled: true, riskLevel: "passive", requiresUI: false, startsTimers: false, writesWorkspace: false, externalProcess: false },
|
|
44
|
+
{ id: "presence", category: "default", defaultEnabled: true, riskLevel: "background", requiresUI: true, startsTimers: true, writesWorkspace: false, externalProcess: false, testContracts: ["lifecycle"], testFiles: ["test/presence-opening.test.ts", "test/presence-locale.test.ts"] },
|
|
45
|
+
{ id: "interview", category: "default", defaultEnabled: true, riskLevel: "tool", requiresUI: false, startsTimers: false, writesWorkspace: false, externalProcess: false },
|
|
46
|
+
{ id: "grub", category: "default", defaultEnabled: true, riskLevel: "background", requiresUI: false, startsTimers: false, writesWorkspace: false, externalProcess: true, testContracts: ["lifecycle", "external-process"], testFiles: ["test/grub-controller.test.ts"] },
|
|
47
|
+
{ id: "loop", category: "default", defaultEnabled: true, riskLevel: "background", requiresUI: false, startsTimers: true, writesWorkspace: false, externalProcess: false, testContracts: ["lifecycle"], testFiles: ["test/loop-lifecycle.test.ts"] },
|
|
48
|
+
{ id: "plan", category: "default", defaultEnabled: true, riskLevel: "tool", requiresUI: false, startsTimers: false, writesWorkspace: false, externalProcess: false },
|
|
49
|
+
{ id: "discipline", category: "default", defaultEnabled: true, riskLevel: "tool", requiresUI: false, startsTimers: false, writesWorkspace: false, externalProcess: false, resourceDiscovery: true, testContracts: ["resource-discovery"], testFiles: ["test/discipline-extension.test.ts", "test/extension-smoke.test.ts"] },
|
|
50
|
+
{ id: "subagent", category: "default", defaultEnabled: true, riskLevel: "tool", requiresUI: false, startsTimers: false, writesWorkspace: false, externalProcess: true, testContracts: ["external-process"], testFiles: ["test/subagent-parser.test.ts", "test/worktree-manager.test.ts"] },
|
|
51
|
+
{ id: "team", category: "default", defaultEnabled: true, riskLevel: "background", requiresUI: false, startsTimers: false, writesWorkspace: false, externalProcess: true, testContracts: ["lifecycle", "external-process"], testFiles: ["test/team-runtime.test.ts"] },
|
|
52
|
+
{ id: "idle-think", category: "default", defaultEnabled: true, riskLevel: "background", requiresUI: true, startsTimers: true, writesWorkspace: false, externalProcess: true, testContracts: ["lifecycle", "external-process"], testFiles: ["test/idle-think-runtime.test.ts", "test/extension-smoke.test.ts"] },
|
|
53
|
+
{ id: "btw", category: "default", defaultEnabled: true, riskLevel: "command", requiresUI: false, startsTimers: false, writesWorkspace: false, externalProcess: false },
|
|
54
|
+
{ id: "recap", category: "default", defaultEnabled: true, riskLevel: "command", requiresUI: false, startsTimers: false, writesWorkspace: false, externalProcess: false },
|
|
55
|
+
{ id: "debug", category: "default", defaultEnabled: true, riskLevel: "command", requiresUI: false, startsTimers: false, writesWorkspace: false, externalProcess: false },
|
|
56
|
+
{ id: "mcp", category: "default", defaultEnabled: true, riskLevel: "command", requiresUI: false, startsTimers: false, writesWorkspace: false, externalProcess: true, resourceDiscovery: true, testContracts: ["external-process", "resource-discovery"], testFiles: ["test/resource-discovery-contract.test.ts"] },
|
|
57
|
+
{ id: "simplify", category: "optional", defaultEnabled: false, riskLevel: "write-capable", requiresUI: false, startsTimers: false, writesWorkspace: true, externalProcess: true, testContracts: ["external-process", "write-guard"], testFiles: ["test/simplify-extension.test.ts"] },
|
|
58
|
+
{ id: "export-html", category: "optional", defaultEnabled: false, riskLevel: "write-capable", requiresUI: false, startsTimers: false, writesWorkspace: true, externalProcess: false, testContracts: ["write-guard"], testFiles: ["test/extension-smoke.test.ts", "test/export-html-branch-navigation.test.ts"] },
|
|
59
|
+
];
|
|
36
60
|
/** Find package root from current module location (containing package.json with nano-pencil related name) */
|
|
37
61
|
function findPackageRoot(startDir) {
|
|
38
62
|
let dir = startDir;
|
|
@@ -66,7 +90,7 @@ function findPackageRoot(startDir) {
|
|
|
66
90
|
* - SecurityAudit (security audit)
|
|
67
91
|
* - MCP (MCP protocol adapter)
|
|
68
92
|
*
|
|
69
|
-
* Optional extensions need to be enabled via configuration:
|
|
93
|
+
* Optional extensions need to be enabled via configuration or --extension:
|
|
70
94
|
* - Simplify (code simplification) - extensions/optional/simplify/
|
|
71
95
|
* - export-html (HTML export) - extensions/optional/export-html/
|
|
72
96
|
*/
|
|
@@ -135,16 +159,6 @@ export function getBuiltinExtensionPaths() {
|
|
|
135
159
|
}
|
|
136
160
|
}
|
|
137
161
|
}
|
|
138
|
-
// === Simplify extension (optional source, compiled to dist/extensions/optional/simplify) ===
|
|
139
|
-
if (existsSync(BUNDLED_SIMPLIFY_EXTENSION)) {
|
|
140
|
-
paths.push(BUNDLED_SIMPLIFY_EXTENSION);
|
|
141
|
-
}
|
|
142
|
-
else {
|
|
143
|
-
// Development mode: try .ts source file
|
|
144
|
-
const simplifyTs = join(__dirname, "extensions", "optional", "simplify", "index.ts");
|
|
145
|
-
if (existsSync(simplifyTs))
|
|
146
|
-
paths.push(simplifyTs);
|
|
147
|
-
}
|
|
148
162
|
// === link-world extension (built-in source, compiled to dist/extensions/defaults/link-world) ===
|
|
149
163
|
if (existsSync(BUNDLED_LINK_WORLD_EXTENSION)) {
|
|
150
164
|
paths.push(BUNDLED_LINK_WORLD_EXTENSION);
|
|
@@ -226,7 +240,15 @@ export function getBuiltinExtensionPaths() {
|
|
|
226
240
|
if (existsSync(planTs))
|
|
227
241
|
paths.push(planTs);
|
|
228
242
|
}
|
|
229
|
-
// ===
|
|
243
|
+
// === Discipline extension (default engineering workflow skills and bootstrap) ===
|
|
244
|
+
if (existsSync(BUNDLED_DISCIPLINE_EXTENSION)) {
|
|
245
|
+
paths.push(BUNDLED_DISCIPLINE_EXTENSION);
|
|
246
|
+
}
|
|
247
|
+
else {
|
|
248
|
+
const disciplineTs = join(__dirname, "extensions", "defaults", "discipline", "index.ts");
|
|
249
|
+
if (existsSync(disciplineTs))
|
|
250
|
+
paths.push(disciplineTs);
|
|
251
|
+
}
|
|
230
252
|
// Built-in SubAgent extension
|
|
231
253
|
if (existsSync(BUNDLED_SUBAGENT_EXTENSION)) {
|
|
232
254
|
paths.push(BUNDLED_SUBAGENT_EXTENSION);
|
|
@@ -290,15 +312,6 @@ export function getBuiltinExtensionPaths() {
|
|
|
290
312
|
if (existsSync(mcpTs))
|
|
291
313
|
paths.push(mcpTs);
|
|
292
314
|
}
|
|
293
|
-
// === export-html extension (optional, HTML export functionality) ===
|
|
294
|
-
if (existsSync(BUNDLED_EXPORT_HTML_EXTENSION)) {
|
|
295
|
-
paths.push(BUNDLED_EXPORT_HTML_EXTENSION);
|
|
296
|
-
}
|
|
297
|
-
else {
|
|
298
|
-
const exportHtmlTs = join(__dirname, "extensions", "optional", "export-html", "index.ts");
|
|
299
|
-
if (existsSync(exportHtmlTs))
|
|
300
|
-
paths.push(exportHtmlTs);
|
|
301
|
-
}
|
|
302
315
|
return paths;
|
|
303
316
|
}
|
|
304
317
|
/**
|
|
@@ -43,6 +43,9 @@ export interface MarkdownSettings {
|
|
|
43
43
|
codeBlockIndent?: string;
|
|
44
44
|
}
|
|
45
45
|
export type TransportSetting = Transport;
|
|
46
|
+
export type AgentLoopFrameworkSetting = "standard" | "weak-model-compatible";
|
|
47
|
+
export type AgentLoopFrameworkSettingInput = AgentLoopFrameworkSetting | "high-intelligence" | "low-intelligence" | "structured-adaptive";
|
|
48
|
+
export declare function normalizeAgentLoopFrameworkSetting(value: AgentLoopFrameworkSettingInput | undefined): AgentLoopFrameworkSetting | undefined;
|
|
46
49
|
/**
|
|
47
50
|
* Package source for npm/git packages.
|
|
48
51
|
* - String form: load all resources from the package
|
|
@@ -61,6 +64,7 @@ export interface Settings {
|
|
|
61
64
|
defaultProvider?: string;
|
|
62
65
|
defaultModel?: string;
|
|
63
66
|
defaultThinkingLevel?: "off" | "minimal" | "low" | "medium" | "high" | "xhigh";
|
|
67
|
+
agentLoopFramework?: AgentLoopFrameworkSettingInput;
|
|
64
68
|
transport?: TransportSetting;
|
|
65
69
|
steeringMode?: "all" | "one-at-a-time";
|
|
66
70
|
followUpMode?: "all" | "one-at-a-time";
|
|
@@ -213,6 +217,8 @@ export declare class SettingsManager {
|
|
|
213
217
|
setTheme(theme: string): void;
|
|
214
218
|
getDefaultThinkingLevel(): "off" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
|
|
215
219
|
setDefaultThinkingLevel(level: "off" | "minimal" | "low" | "medium" | "high" | "xhigh"): void;
|
|
220
|
+
getAgentLoopFramework(): AgentLoopFrameworkSetting | undefined;
|
|
221
|
+
setAgentLoopFramework(framework: AgentLoopFrameworkSettingInput | undefined): void;
|
|
216
222
|
getTransport(): TransportSetting;
|
|
217
223
|
setTransport(transport: TransportSetting): void;
|
|
218
224
|
getCompactionEnabled(): boolean;
|
|
@@ -4,6 +4,13 @@ import lockfile from "proper-lockfile";
|
|
|
4
4
|
import { APP_NAME, CONFIG_DIR_NAME } from "../../config.js";
|
|
5
5
|
import { defaultAgentDirContext } from "../agent-dir/agent-dir-context.js";
|
|
6
6
|
import { readFile, writeFile, mkdir } from "node:fs/promises";
|
|
7
|
+
export function normalizeAgentLoopFrameworkSetting(value) {
|
|
8
|
+
if (value === "high-intelligence")
|
|
9
|
+
return "standard";
|
|
10
|
+
if (value === "low-intelligence" || value === "structured-adaptive")
|
|
11
|
+
return "weak-model-compatible";
|
|
12
|
+
return value;
|
|
13
|
+
}
|
|
7
14
|
/** Deep merge settings: project/overrides take precedence, nested objects merge recursively */
|
|
8
15
|
function deepMergeSettings(base, overrides) {
|
|
9
16
|
const result = { ...base };
|
|
@@ -564,6 +571,20 @@ export class SettingsManager {
|
|
|
564
571
|
this.markModified("defaultThinkingLevel");
|
|
565
572
|
this.save();
|
|
566
573
|
}
|
|
574
|
+
getAgentLoopFramework() {
|
|
575
|
+
return normalizeAgentLoopFrameworkSetting(this.settings.agentLoopFramework);
|
|
576
|
+
}
|
|
577
|
+
setAgentLoopFramework(framework) {
|
|
578
|
+
const normalized = normalizeAgentLoopFrameworkSetting(framework);
|
|
579
|
+
if (normalized === undefined) {
|
|
580
|
+
delete this.globalSettings.agentLoopFramework;
|
|
581
|
+
}
|
|
582
|
+
else {
|
|
583
|
+
this.globalSettings.agentLoopFramework = normalized;
|
|
584
|
+
}
|
|
585
|
+
this.markModified("agentLoopFramework");
|
|
586
|
+
this.save();
|
|
587
|
+
}
|
|
567
588
|
getTransport() {
|
|
568
589
|
return this.settings.transport ?? "sse";
|
|
569
590
|
}
|
|
@@ -99,6 +99,7 @@ export class ExtensionRunner {
|
|
|
99
99
|
getSystemPromptFn = () => "";
|
|
100
100
|
getSoulManagerFn = () => undefined;
|
|
101
101
|
getSettingsFn = () => ({});
|
|
102
|
+
getSkillsFn = () => [];
|
|
102
103
|
newSessionHandler = async () => ({ cancelled: false });
|
|
103
104
|
forkHandler = async () => ({ cancelled: false });
|
|
104
105
|
navigateTreeHandler = async () => ({ cancelled: false });
|
|
@@ -175,6 +176,7 @@ export class ExtensionRunner {
|
|
|
175
176
|
this.getSystemPromptFn = contextActions.getSystemPrompt;
|
|
176
177
|
this.getSoulManagerFn = contextActions.getSoulManager;
|
|
177
178
|
this.getSettingsFn = contextActions.getSettings;
|
|
179
|
+
this.getSkillsFn = contextActions.getSkills;
|
|
178
180
|
// Process provider registrations queued during extension loading
|
|
179
181
|
for (const { name, config } of this.runtime.pendingProviderRegistrations) {
|
|
180
182
|
this.modelRegistry.registerProvider(name, config);
|
|
@@ -413,6 +415,7 @@ export class ExtensionRunner {
|
|
|
413
415
|
getSystemPrompt: () => this.getSystemPromptFn(),
|
|
414
416
|
getSoulManager: () => this.getSoulManagerFn(),
|
|
415
417
|
getSettings: () => this.getSettingsFn(),
|
|
418
|
+
getSkills: () => this.getSkillsFn(),
|
|
416
419
|
};
|
|
417
420
|
}
|
|
418
421
|
createCommandContext() {
|
|
@@ -18,6 +18,7 @@ import type { KeybindingsManager } from "../keybindings.js";
|
|
|
18
18
|
import type { CustomMessage } from "../messages.js";
|
|
19
19
|
import type { ModelRegistry } from "../model-registry.js";
|
|
20
20
|
import type { BranchSummaryEntry, CompactionEntry, ReadonlySessionManager, SessionEntry, SessionManager } from "../session/session-manager.js";
|
|
21
|
+
import type { Skill } from "../skills.js";
|
|
21
22
|
import type { SlashCommandInfo } from "../slash-commands.js";
|
|
22
23
|
import type { BashOperations } from "../tools/bash.js";
|
|
23
24
|
import type { EditToolDetails } from "../tools/edit.js";
|
|
@@ -232,6 +233,8 @@ export interface ExtensionContext {
|
|
|
232
233
|
getSoulManager(): unknown | undefined;
|
|
233
234
|
/** Get current merged settings (project overrides global). */
|
|
234
235
|
getSettings(): import("../config/settings-manager.js").Settings;
|
|
236
|
+
/** Get currently loaded skills after user/project/default resource precedence is applied. */
|
|
237
|
+
getSkills(): readonly Skill[];
|
|
235
238
|
}
|
|
236
239
|
/**
|
|
237
240
|
* Extended context for command handlers.
|
|
@@ -294,7 +297,7 @@ export interface ToolDefinition<TParams extends TSchema = TSchema, TDetails = un
|
|
|
294
297
|
interruptBehavior?: "cancel" | "block";
|
|
295
298
|
/** Optional semantic validation after schema validation and before execute. */
|
|
296
299
|
validateInput?: (params: Static<TParams>) => void | string | Promise<void | string>;
|
|
297
|
-
/** Optional maximum text result size enforced by
|
|
300
|
+
/** Optional maximum text result size enforced by weak-model-compatible tool orchestration. */
|
|
298
301
|
maxResultSizeChars?: number;
|
|
299
302
|
/** Usage guidance for system prompt (optional) */
|
|
300
303
|
guidance?: string;
|
|
@@ -802,14 +805,14 @@ export interface ExtensionAPI {
|
|
|
802
805
|
* api: "anthropic-messages",
|
|
803
806
|
* models: [
|
|
804
807
|
* {
|
|
805
|
-
* id: "
|
|
806
|
-
* name: "
|
|
808
|
+
* id: "example-model",
|
|
809
|
+
* name: "Example Model (proxy)",
|
|
807
810
|
* reasoning: false,
|
|
808
811
|
* input: ["text", "image"],
|
|
809
812
|
* cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
|
810
813
|
* contextWindow: 200000,
|
|
811
814
|
* maxTokens: 16384,
|
|
812
|
-
* agentLoopFramework: "
|
|
815
|
+
* agentLoopFramework: "weak-model-compatible"
|
|
813
816
|
* }
|
|
814
817
|
* ]
|
|
815
818
|
* });
|
|
@@ -870,9 +873,9 @@ export interface ProviderConfig {
|
|
|
870
873
|
}
|
|
871
874
|
/** Configuration for a model within a provider. */
|
|
872
875
|
export interface ProviderModelConfig {
|
|
873
|
-
/** Model ID (e.g., "
|
|
876
|
+
/** Model ID (e.g., "example-model"). */
|
|
874
877
|
id: string;
|
|
875
|
-
/** Display name (e.g., "
|
|
878
|
+
/** Display name (e.g., "Example Model"). */
|
|
876
879
|
name: string;
|
|
877
880
|
/** API type override for this model. */
|
|
878
881
|
api?: Api;
|
|
@@ -994,6 +997,7 @@ export interface ExtensionContextActions {
|
|
|
994
997
|
getSystemPrompt: () => string;
|
|
995
998
|
getSoulManager: () => unknown | undefined;
|
|
996
999
|
getSettings: () => import("../config/settings-manager.js").Settings;
|
|
1000
|
+
getSkills: () => readonly Skill[];
|
|
997
1001
|
}
|
|
998
1002
|
/**
|
|
999
1003
|
* Actions for ExtensionCommandContext (ctx.* in command handlers).
|
|
@@ -5,6 +5,16 @@
|
|
|
5
5
|
* [HERE]: core/i18n/slash-commands.ts - English slash command translations
|
|
6
6
|
*/
|
|
7
7
|
export declare const slashCommands: {
|
|
8
|
+
categories: {
|
|
9
|
+
core: string;
|
|
10
|
+
model: string;
|
|
11
|
+
memory: string;
|
|
12
|
+
session: string;
|
|
13
|
+
workflow: string;
|
|
14
|
+
agents: string;
|
|
15
|
+
tools: string;
|
|
16
|
+
admin: string;
|
|
17
|
+
};
|
|
8
18
|
settings: string;
|
|
9
19
|
model: string;
|
|
10
20
|
"agent-loop": string;
|
|
@@ -24,6 +34,7 @@ export declare const slashCommands: {
|
|
|
24
34
|
usage: string;
|
|
25
35
|
changelog: string;
|
|
26
36
|
hotkeys: string;
|
|
37
|
+
resources: string;
|
|
27
38
|
fork: string;
|
|
28
39
|
tree: string;
|
|
29
40
|
login: string;
|
|
@@ -5,16 +5,26 @@
|
|
|
5
5
|
* [HERE]: core/i18n/slash-commands.ts - English slash command translations
|
|
6
6
|
*/
|
|
7
7
|
export const slashCommands = {
|
|
8
|
+
categories: {
|
|
9
|
+
core: "Core",
|
|
10
|
+
model: "Models",
|
|
11
|
+
memory: "Memory",
|
|
12
|
+
session: "Sessions",
|
|
13
|
+
workflow: "Workflows",
|
|
14
|
+
agents: "Agents",
|
|
15
|
+
tools: "Tools",
|
|
16
|
+
admin: "Admin",
|
|
17
|
+
},
|
|
8
18
|
settings: "Open settings menu",
|
|
9
19
|
model: "Select model (opens selector UI)",
|
|
10
|
-
"agent-loop": "
|
|
11
|
-
"scoped-models": "
|
|
20
|
+
"agent-loop": "Choose how the agent keeps working through a task",
|
|
21
|
+
"scoped-models": "Choose which models appear in quick switching",
|
|
12
22
|
apikey: "Update API key for current provider",
|
|
13
23
|
mcp: "Manage MCP servers (list, enable, disable)",
|
|
14
24
|
soul: "Show AI personality and stats (Soul)",
|
|
15
25
|
persona: "Switch AI persona/personality pack",
|
|
16
26
|
memory: "Show project memory and knowledge (NanoMem)",
|
|
17
|
-
dream: "
|
|
27
|
+
dream: "Refresh long-term project memory (NanoMem)",
|
|
18
28
|
export: "Export session to HTML file",
|
|
19
29
|
share: "Share session as a secret GitHub gist",
|
|
20
30
|
copy: "Copy last agent message to clipboard",
|
|
@@ -24,6 +34,7 @@ export const slashCommands = {
|
|
|
24
34
|
usage: "Show token usage and cost stats",
|
|
25
35
|
changelog: "Show changelog entries",
|
|
26
36
|
hotkeys: "Show all keyboard shortcuts",
|
|
37
|
+
resources: "Show loaded extensions, prompts, skills, and themes",
|
|
27
38
|
fork: "Create a new fork from a previous message",
|
|
28
39
|
tree: "Navigate session tree (switch branches)",
|
|
29
40
|
login: "Login with OAuth provider",
|
|
@@ -34,7 +45,7 @@ export const slashCommands = {
|
|
|
34
45
|
compact: "Manually compact the session context",
|
|
35
46
|
resume: "Resume a different session",
|
|
36
47
|
reload: "Reload extensions, skills, prompts, and themes",
|
|
37
|
-
"link-world": "
|
|
48
|
+
"link-world": "Set up internet access tools",
|
|
38
49
|
quit: "Quit NanoPencil",
|
|
39
50
|
language: "Switch language (English/Chinese)",
|
|
40
51
|
};
|
|
@@ -5,6 +5,16 @@
|
|
|
5
5
|
* [HERE]: core/i18n/slash-commands.zh.ts - Chinese slash command translations
|
|
6
6
|
*/
|
|
7
7
|
export declare const slashCommands: {
|
|
8
|
+
categories: {
|
|
9
|
+
core: string;
|
|
10
|
+
model: string;
|
|
11
|
+
memory: string;
|
|
12
|
+
session: string;
|
|
13
|
+
workflow: string;
|
|
14
|
+
agents: string;
|
|
15
|
+
tools: string;
|
|
16
|
+
admin: string;
|
|
17
|
+
};
|
|
8
18
|
settings: string;
|
|
9
19
|
model: string;
|
|
10
20
|
"agent-loop": string;
|
|
@@ -24,6 +34,7 @@ export declare const slashCommands: {
|
|
|
24
34
|
usage: string;
|
|
25
35
|
changelog: string;
|
|
26
36
|
hotkeys: string;
|
|
37
|
+
resources: string;
|
|
27
38
|
fork: string;
|
|
28
39
|
tree: string;
|
|
29
40
|
login: string;
|
|
@@ -5,16 +5,26 @@
|
|
|
5
5
|
* [HERE]: core/i18n/slash-commands.zh.ts - Chinese slash command translations
|
|
6
6
|
*/
|
|
7
7
|
export const slashCommands = {
|
|
8
|
+
categories: {
|
|
9
|
+
core: "核心",
|
|
10
|
+
model: "模型",
|
|
11
|
+
memory: "记忆",
|
|
12
|
+
session: "会话",
|
|
13
|
+
workflow: "工作流",
|
|
14
|
+
agents: "Agent",
|
|
15
|
+
tools: "工具",
|
|
16
|
+
admin: "管理",
|
|
17
|
+
},
|
|
8
18
|
settings: "打开设置菜单",
|
|
9
19
|
model: "选择模型(打开选择器界面)",
|
|
10
|
-
"agent-loop": "
|
|
11
|
-
"scoped-models": "
|
|
20
|
+
"agent-loop": "选择 agent 推进任务的方式",
|
|
21
|
+
"scoped-models": "选择快速切换里出现的模型",
|
|
12
22
|
apikey: "更新当前提供商的 API 密钥",
|
|
13
23
|
mcp: "管理 MCP 服务器(列出、启用、禁用)",
|
|
14
24
|
soul: "显示 AI 人格和统计(灵魂)",
|
|
15
25
|
persona: "切换 AI 人格/个性包",
|
|
16
26
|
memory: "显示项目记忆和知识(纳米记忆)",
|
|
17
|
-
dream: "
|
|
27
|
+
dream: "刷新长期项目记忆(纳米记忆)",
|
|
18
28
|
export: "将会话导出为 HTML 文件",
|
|
19
29
|
share: "将会话分享为保密的 GitHub gist",
|
|
20
30
|
copy: "复制上一条 AI 消息到剪贴板",
|
|
@@ -24,6 +34,7 @@ export const slashCommands = {
|
|
|
24
34
|
usage: "显示 token 使用量和费用统计",
|
|
25
35
|
changelog: "显示更新日志条目",
|
|
26
36
|
hotkeys: "显示所有键盘快捷键",
|
|
37
|
+
resources: "显示已加载的扩展、提示、技能和主题",
|
|
27
38
|
fork: "从上一条消息创建新分支",
|
|
28
39
|
tree: "导航会话树(切换分支)",
|
|
29
40
|
login: "通过 OAuth 提供商登录",
|
|
@@ -34,7 +45,7 @@ export const slashCommands = {
|
|
|
34
45
|
compact: "手动压缩会话上下文",
|
|
35
46
|
resume: "恢复其他会话",
|
|
36
47
|
reload: "重新加载扩展、技能、提示和主题",
|
|
37
|
-
"link-world": "
|
|
48
|
+
"link-world": "设置联网访问工具",
|
|
38
49
|
quit: "退出 NanoPencil",
|
|
39
50
|
language: "切换语言(English/中文)",
|
|
40
51
|
};
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
import { type Api, type AssistantMessageEventStream, type Context, type Model, type OAuthProviderInterface, type SimpleStreamOptions } from "@pencil-agent/ai";
|
|
8
8
|
import type { AuthStorage } from "./config/auth-storage.js";
|
|
9
9
|
import { clearConfigValueCache } from "./config/resolve-config-value.js";
|
|
10
|
-
type AgentLoopFramework = "
|
|
11
|
-
type AgentLoopFrameworkInput = AgentLoopFramework | "
|
|
10
|
+
type AgentLoopFramework = "standard" | "weak-model-compatible";
|
|
11
|
+
type AgentLoopFrameworkInput = AgentLoopFramework | "high-intelligence" | "low-intelligence" | "structured-adaptive";
|
|
12
12
|
/** Clear the config value command cache. Exported for testing. */
|
|
13
13
|
export declare const clearApiKeyCache: typeof clearConfigValueCache;
|
|
14
14
|
/**
|
|
@@ -42,9 +42,10 @@ const OpenAIResponsesCompatSchema = Type.Object({
|
|
|
42
42
|
});
|
|
43
43
|
const OpenAICompatSchema = Type.Union([OpenAICompletionsCompatSchema, OpenAIResponsesCompatSchema]);
|
|
44
44
|
const AgentLoopFrameworkSchema = Type.Union([
|
|
45
|
+
Type.Literal("standard"),
|
|
46
|
+
Type.Literal("weak-model-compatible"),
|
|
45
47
|
Type.Literal("high-intelligence"),
|
|
46
48
|
Type.Literal("low-intelligence"),
|
|
47
|
-
Type.Literal("standard"),
|
|
48
49
|
Type.Literal("structured-adaptive"),
|
|
49
50
|
]);
|
|
50
51
|
// Schema for custom model definition
|
|
@@ -85,10 +86,10 @@ const ModelOverrideSchema = Type.Object({
|
|
|
85
86
|
compat: Type.Optional(OpenAICompatSchema),
|
|
86
87
|
});
|
|
87
88
|
function normalizeAgentLoopFramework(value) {
|
|
88
|
-
if (value === "
|
|
89
|
-
return "
|
|
90
|
-
if (value === "structured-adaptive")
|
|
91
|
-
return "
|
|
89
|
+
if (value === "high-intelligence")
|
|
90
|
+
return "standard";
|
|
91
|
+
if (value === "low-intelligence" || value === "structured-adaptive")
|
|
92
|
+
return "weak-model-compatible";
|
|
92
93
|
return value;
|
|
93
94
|
}
|
|
94
95
|
const ProviderConfigSchema = Type.Object({
|
|
@@ -24,7 +24,7 @@ import { AgentDirContext } from "../agent-dir/agent-dir-context.js";
|
|
|
24
24
|
import type { BashOperations } from "../tools/bash.js";
|
|
25
25
|
import { type SessionSlashCommandDescriptor } from "./slash-command-catalog.js";
|
|
26
26
|
export type { SessionSlashCommandDescriptor } from "./slash-command-catalog.js";
|
|
27
|
-
type AgentLoopFrameworkInput = AgentLoopFramework | "
|
|
27
|
+
type AgentLoopFrameworkInput = AgentLoopFramework | "high-intelligence" | "low-intelligence" | "structured-adaptive";
|
|
28
28
|
/** Parsed skill block from a user message */
|
|
29
29
|
export interface ParsedSkillBlock {
|
|
30
30
|
name: string;
|
package/dist/core/runtime/sdk.js
CHANGED
|
@@ -247,6 +247,7 @@ export async function createAgentSession(options = {}) {
|
|
|
247
247
|
steeringMode: settingsManager.getSteeringMode(),
|
|
248
248
|
followUpMode: settingsManager.getFollowUpMode(),
|
|
249
249
|
transport: settingsManager.getTransport(),
|
|
250
|
+
agentLoopFramework: settingsManager.getAgentLoopFramework(),
|
|
250
251
|
thinkingBudgets: settingsManager.getThinkingBudgets(),
|
|
251
252
|
maxRetryDelayMs: settingsManager.getRetrySettings().maxDelayMs,
|
|
252
253
|
getApiKey: async (provider) => {
|
|
@@ -7,11 +7,12 @@
|
|
|
7
7
|
import type { ResourceLoader } from "../config/resource-loader.js";
|
|
8
8
|
import type { ExtensionRunner } from "../extensions/index.js";
|
|
9
9
|
import type { PromptTemplate } from "../prompt/prompt-templates.js";
|
|
10
|
-
import { getLocalizedCommands, type SlashCommandInfo } from "../slash-commands.js";
|
|
10
|
+
import { getLocalizedCommands, type SlashCommandInfo, type SlashCommandCategory } from "../slash-commands.js";
|
|
11
11
|
export interface SessionSlashCommandDescriptor {
|
|
12
12
|
name: string;
|
|
13
13
|
description?: string;
|
|
14
14
|
source: "builtin" | SlashCommandInfo["source"];
|
|
15
|
+
category?: SlashCommandCategory;
|
|
15
16
|
}
|
|
16
17
|
type Translate = Parameters<typeof getLocalizedCommands>[0];
|
|
17
18
|
export interface SlashCommandCatalogSource {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BUILTIN_SLASH_COMMANDS, getLocalizedCommands, } from "../slash-commands.js";
|
|
1
|
+
import { BUILTIN_SLASH_COMMANDS, getLocalizedCommands, inferSlashCommandCategory, } from "../slash-commands.js";
|
|
2
2
|
function normalizeLocation(source) {
|
|
3
3
|
if (source === "user" || source === "project" || source === "path") {
|
|
4
4
|
return source;
|
|
@@ -16,6 +16,7 @@ function getExtensionCommands(runner, reservedBuiltins) {
|
|
|
16
16
|
name: command.name,
|
|
17
17
|
description: command.description,
|
|
18
18
|
path: extensionPath,
|
|
19
|
+
category: inferSlashCommandCategory(command.name, "extension"),
|
|
19
20
|
})) ?? []);
|
|
20
21
|
}
|
|
21
22
|
export function buildSessionSlashCommands(source, translate) {
|
|
@@ -23,22 +24,26 @@ export function buildSessionSlashCommands(source, translate) {
|
|
|
23
24
|
name: command.name,
|
|
24
25
|
description: command.description,
|
|
25
26
|
source: "builtin",
|
|
27
|
+
category: command.category,
|
|
26
28
|
}));
|
|
27
29
|
const reservedBuiltins = getReservedBuiltinNames();
|
|
28
30
|
const extensionCommands = getExtensionCommands(source.extensionRunner, reservedBuiltins).map((command) => ({
|
|
29
31
|
name: command.name,
|
|
30
32
|
description: command.description,
|
|
31
33
|
source: "extension",
|
|
34
|
+
category: command.category,
|
|
32
35
|
}));
|
|
33
36
|
const promptCommands = source.promptTemplates.map((template) => ({
|
|
34
37
|
name: template.name,
|
|
35
38
|
description: template.description,
|
|
36
39
|
source: "prompt",
|
|
40
|
+
category: inferSlashCommandCategory(template.name, "prompt"),
|
|
37
41
|
}));
|
|
38
42
|
const skillCommands = source.resourceLoader.getSkills().skills.map((skill) => ({
|
|
39
43
|
name: `skill:${skill.name}`,
|
|
40
44
|
description: skill.description,
|
|
41
45
|
source: "skill",
|
|
46
|
+
category: inferSlashCommandCategory(skill.name, "skill"),
|
|
42
47
|
}));
|
|
43
48
|
return [
|
|
44
49
|
...builtins,
|
|
@@ -53,12 +58,14 @@ export function buildExtensionSlashCommands(source) {
|
|
|
53
58
|
name: command.name,
|
|
54
59
|
description: command.description,
|
|
55
60
|
source: "extension",
|
|
61
|
+
category: command.category,
|
|
56
62
|
path: command.path,
|
|
57
63
|
}));
|
|
58
64
|
const templates = source.promptTemplates.map((template) => ({
|
|
59
65
|
name: template.name,
|
|
60
66
|
description: template.description,
|
|
61
67
|
source: "prompt",
|
|
68
|
+
category: inferSlashCommandCategory(template.name, "prompt"),
|
|
62
69
|
location: normalizeLocation(template.source),
|
|
63
70
|
path: template.filePath,
|
|
64
71
|
}));
|
|
@@ -68,6 +75,7 @@ export function buildExtensionSlashCommands(source) {
|
|
|
68
75
|
name: `skill:${skill.name}`,
|
|
69
76
|
description: skill.description,
|
|
70
77
|
source: "skill",
|
|
78
|
+
category: inferSlashCommandCategory(skill.name, "skill"),
|
|
71
79
|
location: normalizeLocation(skill.source),
|
|
72
80
|
path: skill.filePath,
|
|
73
81
|
}));
|
|
@@ -1,25 +1,33 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* [WHO]: SlashCommandInfo, BuiltinSlashCommand, slashCommand definitions, getLocalizedCommands()
|
|
2
|
+
* [WHO]: SlashCommandInfo, BuiltinSlashCommand, slashCommand definitions, category helpers, getLocalizedCommands()
|
|
3
3
|
* [FROM]: No external dependencies
|
|
4
4
|
* [TO]: Consumed by modes/interactive/interactive-mode.ts, modes/acp/acp-mode.ts
|
|
5
5
|
* [HERE]: core/slash-commands.ts - slash command types and registry
|
|
6
6
|
*/
|
|
7
7
|
export type SlashCommandSource = "extension" | "prompt" | "skill";
|
|
8
8
|
export type SlashCommandLocation = "user" | "project" | "path";
|
|
9
|
+
export type SlashCommandCategory = "core" | "model" | "memory" | "session" | "workflow" | "agents" | "tools" | "admin";
|
|
9
10
|
export interface SlashCommandInfo {
|
|
10
11
|
name: string;
|
|
11
12
|
description?: string;
|
|
12
13
|
source: SlashCommandSource;
|
|
14
|
+
category?: SlashCommandCategory;
|
|
13
15
|
location?: SlashCommandLocation;
|
|
14
16
|
path?: string;
|
|
15
17
|
}
|
|
16
18
|
export interface BuiltinSlashCommand {
|
|
17
19
|
name: string;
|
|
18
20
|
descriptionKey: string;
|
|
21
|
+
category: SlashCommandCategory;
|
|
19
22
|
}
|
|
20
23
|
export declare const BUILTIN_SLASH_COMMANDS: ReadonlyArray<BuiltinSlashCommand>;
|
|
24
|
+
export declare function inferSlashCommandCategory(name: string, source?: SlashCommandSource): SlashCommandCategory;
|
|
25
|
+
export declare function getSlashCommandCategoryLabel(category: SlashCommandCategory, t: (key: string) => string): string;
|
|
26
|
+
export declare function formatSlashCommandDescription(description: string | undefined, category: SlashCommandCategory | undefined, t: (key: string) => string): string | undefined;
|
|
21
27
|
export interface LocalizedSlashCommand {
|
|
22
28
|
name: string;
|
|
23
29
|
description: string;
|
|
30
|
+
category: SlashCommandCategory;
|
|
31
|
+
categoryLabel: string;
|
|
24
32
|
}
|
|
25
33
|
export declare function getLocalizedCommands(t: (key: string) => string): LocalizedSlashCommand[];
|