@oyasmi/pipiclaw 0.9.1-beta.2 → 0.9.1
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/agent/channel-runner.d.ts +7 -0
- package/dist/agent/channel-runner.js +42 -13
- package/dist/agent/command-extension.js +24 -27
- package/dist/agent/commands.d.ts +51 -7
- package/dist/agent/commands.js +199 -59
- package/dist/agent/prompt/manifest.js +5 -6
- package/dist/agent/prompt/sections.js +1 -0
- package/dist/agent/reply-limits.d.ts +16 -0
- package/dist/agent/reply-limits.js +17 -0
- package/dist/agent/session-events.js +2 -2
- package/dist/agent/status-render.js +12 -12
- package/dist/executor.d.ts +14 -0
- package/dist/executor.js +36 -6
- package/dist/main.js +3 -4
- package/dist/memory/commands.js +79 -38
- package/dist/memory/consolidation.d.ts +5 -1
- package/dist/memory/consolidation.js +33 -12
- package/dist/memory/extraction.d.ts +8 -1
- package/dist/memory/extraction.js +47 -4
- package/dist/memory/files.d.ts +0 -1
- package/dist/memory/files.js +24 -5
- package/dist/memory/lifecycle.js +9 -2
- package/dist/memory/maintenance-jobs.js +14 -4
- package/dist/memory/metadata.d.ts +3 -0
- package/dist/memory/metadata.js +7 -0
- package/dist/memory/recall.d.ts +9 -0
- package/dist/memory/recall.js +101 -17
- package/dist/memory/review-log.d.ts +0 -2
- package/dist/memory/review-log.js +0 -0
- package/dist/memory/session-corpus.js +5 -0
- package/dist/memory/session-search.js +9 -0
- package/dist/memory/sidecar-worker.js +4 -0
- package/dist/memory/source-window.d.ts +0 -1
- package/dist/memory/source-window.js +0 -5
- package/dist/playbooks/agent-delegation.md +32 -25
- package/dist/playbooks/background-jobs.md +8 -16
- package/dist/playbooks/event-scheduling.md +13 -15
- package/dist/playbooks/memory-and-learning.md +29 -22
- package/dist/playbooks/outbound-media.md +15 -8
- package/dist/playbooks/runtime-orientation.md +40 -37
- package/dist/playbooks/task-driving.md +34 -36
- package/dist/playbooks/task-planning.md +18 -18
- package/dist/runtime/app-home.d.ts +6 -0
- package/dist/runtime/app-home.js +15 -6
- package/dist/runtime/bootstrap.js +44 -13
- package/dist/runtime/channel-context.d.ts +2 -1
- package/dist/runtime/delivery.js +3 -3
- package/dist/runtime/dingtalk.d.ts +9 -1
- package/dist/runtime/dingtalk.js +27 -13
- package/dist/runtime/event-commands.d.ts +15 -0
- package/dist/runtime/event-commands.js +48 -40
- package/dist/runtime/project-commands.d.ts +16 -0
- package/dist/runtime/project-commands.js +13 -17
- package/dist/runtime/subagent-commands.d.ts +20 -0
- package/dist/runtime/subagent-commands.js +61 -58
- package/dist/runtime/task-commands.d.ts +37 -0
- package/dist/runtime/task-commands.js +106 -64
- package/dist/security/path-guard.js +33 -2
- package/dist/security/types.d.ts +9 -0
- package/dist/subagents/discovery.d.ts +7 -2
- package/dist/subagents/discovery.js +31 -7
- package/dist/subagents/external/claude-code.js +42 -2
- package/dist/subagents/external/run.js +61 -8
- package/dist/subagents/runs.js +6 -0
- package/dist/subagents/tool.d.ts +1 -0
- package/dist/subagents/tool.js +62 -53
- package/dist/tasks/verification.d.ts +7 -5
- package/dist/tools/bash.d.ts +1 -1
- package/dist/tools/bash.js +77 -59
- package/dist/tools/edit.js +17 -4
- package/dist/tools/grep.js +3 -2
- package/dist/tools/index.js +4 -0
- package/dist/tools/job.js +2 -1
- package/dist/tools/memory-manage.d.ts +1 -0
- package/dist/tools/memory-manage.js +54 -16
- package/dist/tools/read.js +21 -5
- package/dist/tools/send-media.js +17 -6
- package/dist/tools/skill-manage.js +12 -11
- package/dist/tools/skill-security.js +1 -1
- package/dist/tools/task-manage.js +1 -1
- package/dist/tools/truncate.d.ts +8 -0
- package/dist/tools/truncate.js +8 -0
- package/dist/tools/web-fetch.js +9 -1
- package/dist/tools/write-content.js +11 -1
- package/dist/tui/app.js +1 -1
- package/dist/tui/commands.d.ts +1 -1
- package/dist/tui/commands.js +1 -1
- package/dist/tui/turn-controller.d.ts +1 -1
- package/dist/tui/turn-controller.js +14 -4
- package/dist/usage/render.js +10 -8
- package/examples/sub-agents/README.md +2 -0
- package/package.json +3 -2
|
@@ -113,6 +113,13 @@ export declare class ChannelRunner implements AgentRunner {
|
|
|
113
113
|
* often the larger half), and the last turn's dynamic context.
|
|
114
114
|
*/
|
|
115
115
|
renderContextReport(args?: string): string;
|
|
116
|
+
/**
|
|
117
|
+
* `/help` — the static per-command listing from `commands.ts`, plus (top-level only) the
|
|
118
|
+
* workspace skills and prompt templates this session can actually invoke via `/skill:name` and
|
|
119
|
+
* `/<template-name>`. Neither list is knowable to `renderBuiltInHelp` itself (it is a pure
|
|
120
|
+
* function with no session state), so the runner appends it here (review 2026-08-24 §1.9).
|
|
121
|
+
*/
|
|
122
|
+
private renderHelpWithDiscovery;
|
|
116
123
|
/** `/subagents list`'s role-directory health tail — whatever this runner already discovered. */
|
|
117
124
|
getSubAgentDiscoverySnapshot(): SubAgentDiscoveryResult;
|
|
118
125
|
/**
|
|
@@ -11,7 +11,7 @@ import { handleMemoryCommand } from "../memory/commands.js";
|
|
|
11
11
|
import { getChannelMemoryPath } from "../memory/files.js";
|
|
12
12
|
import { MemoryLifecycle } from "../memory/lifecycle.js";
|
|
13
13
|
import { createMemoryActivityRecorder, } from "../memory/maintenance-state.js";
|
|
14
|
-
import { MEMORY_RECALL_MAX_UNITS, recallRelevantMemory } from "../memory/recall.js";
|
|
14
|
+
import { findPreviousUserText, MEMORY_RECALL_MAX_UNITS, recallRelevantMemory } from "../memory/recall.js";
|
|
15
15
|
import { buildTaskDigest, TASK_AGENDA_MAX_UNITS } from "../memory/task-digest.js";
|
|
16
16
|
import { getApiKeyForModel } from "../models/api-keys.js";
|
|
17
17
|
import { createModelRuntime, defaultModel, findExactModelReferenceMatch, formatModelReference, hasKnownModelPricing, resolveInitialModel, wrapModelRegistry, } from "../models/utils.js";
|
|
@@ -298,6 +298,7 @@ export class ChannelRunner {
|
|
|
298
298
|
if (recallSettings.enabled) {
|
|
299
299
|
const recall = await recallRelevantMemory({
|
|
300
300
|
query: clippedInput,
|
|
301
|
+
contextQuery: findPreviousUserText(this.session.messages),
|
|
301
302
|
channelId: this.channelId,
|
|
302
303
|
workspaceDir: this.workspaceDir,
|
|
303
304
|
channelDir: this.channelDir,
|
|
@@ -588,26 +589,27 @@ export class ChannelRunner {
|
|
|
588
589
|
try {
|
|
589
590
|
switch (command.name) {
|
|
590
591
|
case "help":
|
|
591
|
-
await this.sendCommandReply(ctx,
|
|
592
|
+
await this.sendCommandReply(ctx, this.renderHelpWithDiscovery(command.args), "help");
|
|
592
593
|
return;
|
|
593
594
|
case "context":
|
|
594
|
-
await this.sendCommandReply(ctx, this.renderContextReport(command.args));
|
|
595
|
+
await this.sendCommandReply(ctx, this.renderContextReport(command.args), "context");
|
|
595
596
|
return;
|
|
596
597
|
case "stop":
|
|
597
|
-
await this.sendCommandReply(ctx, "当前没有运行中的回合,`/stop` 只在回合进行中有意义。");
|
|
598
|
+
await this.sendCommandReply(ctx, "当前没有运行中的回合,`/stop` 只在回合进行中有意义。", "stop");
|
|
598
599
|
return;
|
|
599
600
|
case "steer":
|
|
600
601
|
this.requireQueuedMessage(command.args, "steer");
|
|
601
|
-
await this.sendCommandReply(ctx, "当前没有运行中的回合,直接发消息即可,不用 `/steer`。");
|
|
602
|
+
await this.sendCommandReply(ctx, "当前没有运行中的回合,直接发消息即可,不用 `/steer`。", "steer");
|
|
602
603
|
return;
|
|
603
604
|
case "followup":
|
|
604
605
|
this.requireQueuedMessage(command.args, "followup");
|
|
605
|
-
await this.sendCommandReply(ctx, "当前没有运行中的回合,直接发消息即可;`/followup` 用于回合进行中排队。");
|
|
606
|
+
await this.sendCommandReply(ctx, "当前没有运行中的回合,直接发消息即可;`/followup` 用于回合进行中排队。", "followup");
|
|
606
607
|
return;
|
|
607
608
|
default: {
|
|
608
|
-
// The
|
|
609
|
-
//
|
|
610
|
-
// narrowed parameter type makes that a
|
|
609
|
+
// The stateless report commands (events/tasks/status/usage/subagents/project — see
|
|
610
|
+
// `BUILT_IN_COMMANDS`'s `runnerHandled: false` entries) are routed to their own
|
|
611
|
+
// handlers upstream and never reach here; the narrowed parameter type makes that a
|
|
612
|
+
// compile-time guarantee.
|
|
611
613
|
const _exhaustive = command.name;
|
|
612
614
|
throw new Error(`Unhandled built-in command: ${String(_exhaustive)}`);
|
|
613
615
|
}
|
|
@@ -616,7 +618,7 @@ export class ChannelRunner {
|
|
|
616
618
|
catch (err) {
|
|
617
619
|
const errMsg = errorMessage(err);
|
|
618
620
|
log.logWarning(`[${this.channelId}] Built-in command failed`, errMsg);
|
|
619
|
-
await this.sendCommandReply(ctx, `命令执行失败:${errMsg}
|
|
621
|
+
await this.sendCommandReply(ctx, `命令执行失败:${errMsg}`, command.name);
|
|
620
622
|
}
|
|
621
623
|
}
|
|
622
624
|
/**
|
|
@@ -631,7 +633,7 @@ export class ChannelRunner {
|
|
|
631
633
|
if (!name) {
|
|
632
634
|
return false;
|
|
633
635
|
}
|
|
634
|
-
if (isKnownCommandName(name)) {
|
|
636
|
+
if (isKnownCommandName(name, this.currentSkills.skills.map((skill) => skill.name.toLowerCase()))) {
|
|
635
637
|
return true;
|
|
636
638
|
}
|
|
637
639
|
return this.session.promptTemplates.some((template) => template.name.toLowerCase() === name);
|
|
@@ -754,6 +756,30 @@ export class ChannelRunner {
|
|
|
754
756
|
detail: args.trim().toLowerCase() === "detail",
|
|
755
757
|
});
|
|
756
758
|
}
|
|
759
|
+
/**
|
|
760
|
+
* `/help` — the static per-command listing from `commands.ts`, plus (top-level only) the
|
|
761
|
+
* workspace skills and prompt templates this session can actually invoke via `/skill:name` and
|
|
762
|
+
* `/<template-name>`. Neither list is knowable to `renderBuiltInHelp` itself (it is a pure
|
|
763
|
+
* function with no session state), so the runner appends it here (review 2026-08-24 §1.9).
|
|
764
|
+
*/
|
|
765
|
+
renderHelpWithDiscovery(args) {
|
|
766
|
+
const help = renderBuiltInHelp(args);
|
|
767
|
+
if (args.trim()) {
|
|
768
|
+
return help;
|
|
769
|
+
}
|
|
770
|
+
const sections = [help];
|
|
771
|
+
if (this.currentSkills.skills.length > 0) {
|
|
772
|
+
sections.push(`**Workspace skills** · 用 \`/skill:<名称>\` 调用\n\n${this.currentSkills.skills
|
|
773
|
+
.map((skill) => `- \`/skill:${skill.name}\` — ${skill.description}`)
|
|
774
|
+
.join("\n")}`);
|
|
775
|
+
}
|
|
776
|
+
if (this.session.promptTemplates.length > 0) {
|
|
777
|
+
sections.push(`**Prompt templates**\n\n${this.session.promptTemplates
|
|
778
|
+
.map((template) => `- \`/${template.name}\``)
|
|
779
|
+
.join("\n")}`);
|
|
780
|
+
}
|
|
781
|
+
return sections.join("\n\n");
|
|
782
|
+
}
|
|
757
783
|
/** `/subagents list`'s role-directory health tail — whatever this runner already discovered. */
|
|
758
784
|
getSubAgentDiscoverySnapshot() {
|
|
759
785
|
return this.subAgentDiscovery;
|
|
@@ -772,8 +798,11 @@ export class ChannelRunner {
|
|
|
772
798
|
"</runtime_turn_context>",
|
|
773
799
|
].join("\n");
|
|
774
800
|
}
|
|
775
|
-
async sendCommandReply(ctx, text) {
|
|
776
|
-
|
|
801
|
+
async sendCommandReply(ctx, text, commandName) {
|
|
802
|
+
// Command echoes are ephemeral control-plane traffic, not conversation: keep them out of
|
|
803
|
+
// log.jsonl so they are never re-consumed as memory-extraction input (review 2026-08-24 §1.2).
|
|
804
|
+
const title = commandName ? `/${commandName}` : undefined;
|
|
805
|
+
const delivered = await ctx.respondPlain(text, false, title);
|
|
777
806
|
if (!delivered) {
|
|
778
807
|
await ctx.replaceMessage(text);
|
|
779
808
|
await ctx.flush();
|
|
@@ -9,19 +9,16 @@ function buildSessionText(stats, currentModel, thinkingLevel, lastResponseModel)
|
|
|
9
9
|
? ` (actual: \`${lastResponseModel}\`)`
|
|
10
10
|
: "";
|
|
11
11
|
const sessionFile = stats.sessionFile ? `\`${basename(stats.sessionFile)}\`` : "(none)";
|
|
12
|
-
return
|
|
12
|
+
return `**会话**
|
|
13
13
|
|
|
14
|
-
- Session ID
|
|
15
|
-
- Session file
|
|
16
|
-
-
|
|
17
|
-
- Thinking level
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
- Total messages: \`${stats.totalMessages}\`
|
|
23
|
-
- Tokens: \`${stats.tokens.total}\` (input \`${stats.tokens.input}\`, output \`${stats.tokens.output}\`, cache read \`${stats.tokens.cacheRead}\`, cache write \`${stats.tokens.cacheWrite}\`)
|
|
24
|
-
- Cost: \`$${stats.cost.toFixed(4)}\``;
|
|
14
|
+
- Session ID:\`${stats.sessionId}\`
|
|
15
|
+
- Session file:${sessionFile}
|
|
16
|
+
- 模型:${modelText}${actualText}
|
|
17
|
+
- Thinking level:\`${thinkingLevel}\`
|
|
18
|
+
- 消息:用户 \`${stats.userMessages}\` · 助手 \`${stats.assistantMessages}\` · 共 \`${stats.totalMessages}\`
|
|
19
|
+
- 工具调用:\`${stats.toolCalls}\` · 工具结果:\`${stats.toolResults}\`
|
|
20
|
+
- Tokens:\`${stats.tokens.total}\`(input \`${stats.tokens.input}\`,output \`${stats.tokens.output}\`,cache read \`${stats.tokens.cacheRead}\`,cache write \`${stats.tokens.cacheWrite}\`)
|
|
21
|
+
- Cost:\`$${stats.cost.toFixed(4)}\``;
|
|
25
22
|
}
|
|
26
23
|
async function runCompact(ctx, customInstructions) {
|
|
27
24
|
return await new Promise((resolve, reject) => {
|
|
@@ -40,12 +37,12 @@ function sendCommandResult(sender, text) {
|
|
|
40
37
|
});
|
|
41
38
|
}
|
|
42
39
|
function buildThinkingText(current, available) {
|
|
43
|
-
return
|
|
40
|
+
return `**Thinking**
|
|
44
41
|
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
- 当前档位:\`${current}\`
|
|
43
|
+
- 可用档位:${available.map((level) => `\`${level}\``).join(", ")}
|
|
47
44
|
|
|
48
|
-
|
|
45
|
+
用 \`/thinking <level>\` 设置档位,或 \`/thinking cycle\` 切到下一个支持的档位。`;
|
|
49
46
|
}
|
|
50
47
|
export function createCommandExtension(options) {
|
|
51
48
|
return (pi) => {
|
|
@@ -98,13 +95,13 @@ export function createCommandExtension(options) {
|
|
|
98
95
|
if (!args.trim()) {
|
|
99
96
|
const current = currentModel ? `\`${formatModelReference(currentModel)}\`` : "(none)";
|
|
100
97
|
const available = availableModels.length > 0 ? formatModelList(availableModels, currentModel) : "- (none)";
|
|
101
|
-
sendCommandResult(pi,
|
|
98
|
+
sendCommandResult(pi, `**模型**
|
|
102
99
|
|
|
103
|
-
|
|
100
|
+
当前模型:${current}
|
|
104
101
|
|
|
105
|
-
|
|
102
|
+
用 \`/model <provider/modelId>\`、\`/model <modelId>\` 或任意能唯一匹配的子串切换。
|
|
106
103
|
|
|
107
|
-
|
|
104
|
+
可用模型:
|
|
108
105
|
${available}`);
|
|
109
106
|
return;
|
|
110
107
|
}
|
|
@@ -112,19 +109,19 @@ ${available}`);
|
|
|
112
109
|
const available = availableModels.length > 0 ? formatModelList(availableModels, currentModel, 10) : "- (none)";
|
|
113
110
|
if (match.match) {
|
|
114
111
|
await options.switchModel(match.match);
|
|
115
|
-
sendCommandResult(pi, `已切换模型到 \`${formatModelReference(match.match)}
|
|
112
|
+
sendCommandResult(pi, `已切换模型到 \`${formatModelReference(match.match)}\``);
|
|
116
113
|
return;
|
|
117
114
|
}
|
|
118
115
|
if (match.ambiguous) {
|
|
119
116
|
sendCommandResult(pi, `未切换模型:\`${args.trim()}\` 匹配到多个模型。请提供更精确的 \`provider/modelId\`、\`modelId\` 或更长的片段。
|
|
120
117
|
|
|
121
|
-
|
|
118
|
+
可用模型:
|
|
122
119
|
${available}`);
|
|
123
120
|
return;
|
|
124
121
|
}
|
|
125
122
|
sendCommandResult(pi, `未找到模型 \`${args.trim()}\`。请使用精确的 \`provider/modelId\`、唯一的 \`modelId\`,或能唯一命中的片段字符串。
|
|
126
123
|
|
|
127
|
-
|
|
124
|
+
可用模型:
|
|
128
125
|
${available}`);
|
|
129
126
|
},
|
|
130
127
|
});
|
|
@@ -136,7 +133,7 @@ ${available}`);
|
|
|
136
133
|
withSession: async (nextCtx) => {
|
|
137
134
|
sentFromReplacement = true;
|
|
138
135
|
await options.refreshSessionResources();
|
|
139
|
-
await sendCommandResult(nextCtx, `已开启新会话。\n\nSession ID
|
|
136
|
+
await sendCommandResult(nextCtx, `已开启新会话。\n\nSession ID:\`${nextCtx.sessionManager.getSessionId()}\``);
|
|
140
137
|
},
|
|
141
138
|
});
|
|
142
139
|
if (result.cancelled) {
|
|
@@ -144,7 +141,7 @@ ${available}`);
|
|
|
144
141
|
}
|
|
145
142
|
else if (!sentFromReplacement) {
|
|
146
143
|
await options.refreshSessionResources();
|
|
147
|
-
sendCommandResult(pi, `已开启新会话。\n\nSession ID
|
|
144
|
+
sendCommandResult(pi, `已开启新会话。\n\nSession ID:\`${ctx.sessionManager.getSessionId()}\``);
|
|
148
145
|
}
|
|
149
146
|
},
|
|
150
147
|
});
|
|
@@ -155,8 +152,8 @@ ${available}`);
|
|
|
155
152
|
const result = await runCompact(ctx, customInstructions);
|
|
156
153
|
sendCommandResult(pi, `已压缩当前会话上下文。
|
|
157
154
|
|
|
158
|
-
-
|
|
159
|
-
-
|
|
155
|
+
- 压缩前 tokens:\`${result.tokensBefore}\`
|
|
156
|
+
- 摘要:
|
|
160
157
|
|
|
161
158
|
\`\`\`text
|
|
162
159
|
${result.summary}
|
package/dist/agent/commands.d.ts
CHANGED
|
@@ -16,10 +16,25 @@ export interface BuiltInCommand {
|
|
|
16
16
|
export type RunnerBuiltInCommand = BuiltInCommand & {
|
|
17
17
|
name: RunnerBuiltInCommandName;
|
|
18
18
|
};
|
|
19
|
+
/** One subcommand entry, as broadcast by `/help <name>` and consumed by `renderSubcommandUsage`. */
|
|
20
|
+
export interface CommandSubSpec {
|
|
21
|
+
name: string;
|
|
22
|
+
/** Argument syntax after the subcommand name, e.g. `<id>` or `<id> <wake|next|deadline> <值>`. */
|
|
23
|
+
args?: string;
|
|
24
|
+
description: string;
|
|
25
|
+
/** A concrete invocation; omitted only for the bare "no args" form. */
|
|
26
|
+
example?: string;
|
|
27
|
+
}
|
|
19
28
|
/**
|
|
20
29
|
* Single source of truth for a slash command's metadata. `HELP_TEXT`, the TUI
|
|
21
30
|
* autocomplete list, the busy-time hint, and the known-command set are all
|
|
22
31
|
* derived from these tables — do not hand-maintain those in parallel.
|
|
32
|
+
*
|
|
33
|
+
* `subcommands`, where present, is *also* the single source for that command's own `usage()`
|
|
34
|
+
* text (via `renderSubcommandUsage`) and for `/help <name>`'s detail view — see
|
|
35
|
+
* `test/commands-subcommands.test.ts`, which feeds every `subcommands[].example` back into the
|
|
36
|
+
* matching parser so the broadcast list and the parser can never drift apart again (review
|
|
37
|
+
* 2026-08-24 §1.1).
|
|
23
38
|
*/
|
|
24
39
|
export interface CommandSpec {
|
|
25
40
|
name: string;
|
|
@@ -27,10 +42,19 @@ export interface CommandSpec {
|
|
|
27
42
|
argumentHint?: string;
|
|
28
43
|
/** One-line description; used for `/help` and for editor autocomplete. */
|
|
29
44
|
description: string;
|
|
30
|
-
/** Concrete invocations shown under the command in `/help
|
|
45
|
+
/** Concrete invocations shown under the command in `/help`; only used when `subcommands` is absent. */
|
|
31
46
|
examples?: string[];
|
|
32
47
|
/** Whether the command is accepted while a task is streaming. */
|
|
33
48
|
availableWhileBusy?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* True for the built-ins `ChannelRunner.handleBuiltinCommand` handles directly (help/stop/
|
|
51
|
+
* steer/followup/context); false for the stateless runtime reports (events/tasks/status/
|
|
52
|
+
* usage/subagents/project) dispatched through `runRuntimeCommand`. Meaningful only within
|
|
53
|
+
* `BUILT_IN_COMMANDS`.
|
|
54
|
+
*/
|
|
55
|
+
runnerHandled?: boolean;
|
|
56
|
+
/** Broadcast list of this command's subcommands, for commands with a `/<name> <action> ...` shape. */
|
|
57
|
+
subcommands?: CommandSubSpec[];
|
|
34
58
|
}
|
|
35
59
|
/**
|
|
36
60
|
* Transport commands: handled directly by the runtime layer (never sent to the
|
|
@@ -46,19 +70,39 @@ export declare const SESSION_COMMANDS: readonly CommandSpec[];
|
|
|
46
70
|
/** Look up the shared description for a session command (used by the SDK extension). */
|
|
47
71
|
export declare function sessionCommandDescription(name: string): string;
|
|
48
72
|
export declare function isBuiltInCommandName(name: string): name is BuiltInCommandName;
|
|
73
|
+
/** True for a session-layer command name (`/model`, `/compact`, …) — needs the idle session layer. */
|
|
74
|
+
export declare function isSessionCommandName(name: string): boolean;
|
|
49
75
|
/** Narrow a parsed built-in to one `ChannelRunner.handleBuiltinCommand` accepts. */
|
|
50
76
|
export declare function isRunnerBuiltInCommand(command: BuiltInCommand): command is RunnerBuiltInCommand;
|
|
51
77
|
/** Comma-separated list of commands usable while a task is streaming (names only). */
|
|
52
78
|
export declare function formatBusyCommandList(): string;
|
|
79
|
+
/**
|
|
80
|
+
* Renders a command's subcommand table as its `usage()` text — the single source `task-commands.ts`,
|
|
81
|
+
* `event-commands.ts`, `subagent-commands.ts`, `project-commands.ts`, and `memory/commands.ts` call
|
|
82
|
+
* on a parse error, replacing five hand-written `usage()` bodies (review 2026-08-24 §3.1).
|
|
83
|
+
*/
|
|
84
|
+
export declare function renderSubcommandUsage(name: string): string;
|
|
85
|
+
/** `/help <name>`'s content, or `undefined` for an unknown command name. */
|
|
86
|
+
export declare function renderCommandHelp(name: string): string | undefined;
|
|
53
87
|
/** Extract the lower-cased command name from a slash input, or `null` if not a slash command. */
|
|
54
88
|
export declare function slashCommandName(text: string): string | null;
|
|
55
89
|
/**
|
|
56
|
-
* True if `text` is a slash command the runtime or session layer knows how to
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
90
|
+
* True if `text` is a slash command the runtime or session layer knows how to handle: a built-in
|
|
91
|
+
* transport command, a session command, or a skill invocation (`/skill:name`) naming a skill
|
|
92
|
+
* actually present in `knownSkillNames`. Prompt-template names are resolved separately by the
|
|
93
|
+
* runner, which has the session's live template list.
|
|
94
|
+
*
|
|
95
|
+
* `knownSkillNames` used to be unchecked — any `/skill:<anything>` counted as known and got a full
|
|
96
|
+
* LLM turn, bypassing the "unknown command never reaches the model" guarantee this function exists
|
|
97
|
+
* to provide (review 2026-08-24 §1.9). Omitting `knownSkillNames` (no roster available) rejects
|
|
98
|
+
* every `skill:` name rather than trusting it.
|
|
60
99
|
*/
|
|
61
|
-
export declare function isKnownCommandName(name: string): boolean;
|
|
100
|
+
export declare function isKnownCommandName(name: string, knownSkillNames?: Iterable<string>): boolean;
|
|
62
101
|
export declare function formatUnknownCommandMessage(name: string): string;
|
|
63
102
|
export declare function parseBuiltInCommand(text: string): BuiltInCommand | null;
|
|
64
|
-
|
|
103
|
+
/**
|
|
104
|
+
* `/help` (top-level command listing) or `/help <name>` (that command's subcommands/examples) —
|
|
105
|
+
* two-level help so the top level stays scannable instead of the ~40-line wall of every example
|
|
106
|
+
* (review 2026-08-24 §2.2.1). `args` is the raw text after `/help`.
|
|
107
|
+
*/
|
|
108
|
+
export declare function renderBuiltInHelp(args?: string): string;
|