@iaforged/context-code 1.2.9 → 1.2.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +119 -119
- package/context-bootstrap.js +28 -26
- package/dist/src/QueryEngine.js +394 -327
- package/dist/src/bridge/bridgeUI.js +1 -1
- package/dist/src/buddy/prompt.js +4 -4
- package/dist/src/cli/handlers/auth.js +126 -9
- package/dist/src/cli/print.js +35 -1
- package/dist/src/commands/agent/agent.js +28 -2
- package/dist/src/commands/agent/agentStore.js +8 -1
- package/dist/src/commands/agent/index.js +1 -1
- package/dist/src/commands/bridge-kick.js +9 -9
- package/dist/src/commands/commit.js +34 -34
- package/dist/src/commands/init-verifiers.js +3 -3
- package/dist/src/commands/init.js +88 -88
- package/dist/src/commands/insights.js +787 -787
- package/dist/src/commands/install.js +19 -19
- package/dist/src/commands/login/login.js +21 -12
- package/dist/src/commands/logout/logout.js +9 -0
- package/dist/src/commands/model/model.js +9 -4
- package/dist/src/commands/orchestrate/SwarmUI.js +50 -0
- package/dist/src/commands/orchestrate/index.js +2 -2
- package/dist/src/commands/orchestrate/orchestrate.js +708 -12
- package/dist/src/commands/pr_comments/index.js +33 -33
- package/dist/src/commands/profile/index.js +1 -1
- package/dist/src/commands/profile/profile.js +52 -3
- package/dist/src/commands/provider/index.js +1 -1
- package/dist/src/commands/provider/provider.js +117 -45
- package/dist/src/commands/resumen/index.js +9 -0
- package/dist/src/commands/resumen/resumen.js +29 -0
- package/dist/src/commands/security-review.js +190 -190
- package/dist/src/commands/swarm-auto/index.js +9 -0
- package/dist/src/commands/swarm-auto/swarmAuto.js +111 -0
- package/dist/src/commands/swarm-init/index.js +9 -0
- package/dist/src/commands/swarm-init/swarmInit.js +72 -0
- package/dist/src/commands/team/team.js +39 -6
- package/dist/src/commands.js +14 -0
- package/dist/src/components/LogoV2/CondensedLogo.js +2 -2
- package/dist/src/components/PromptInput/PromptInputQueuedCommands.js +3 -3
- package/dist/src/components/agents/agentFileUtils.js +6 -6
- package/dist/src/components/permissions/hooks.js +5 -5
- package/dist/src/constants/outputStyles.js +83 -83
- package/dist/src/core/agents/blueprints.js +58 -0
- package/dist/src/core/agents/cliAdapter.js +61 -0
- package/dist/src/core/agents/registry.js +93 -0
- package/dist/src/core/agents/runtime.js +4 -0
- package/dist/src/core/agents/runtime.smoke.js +42 -0
- package/dist/src/core/agents/swarm.smoke.js +48 -0
- package/dist/src/core/agents/swarmTools.js +38 -0
- package/dist/src/core/auth/index.js +2 -0
- package/dist/src/core/auth/loginCliAdapter.js +24 -0
- package/dist/src/core/auth/loginCore.js +67 -0
- package/dist/src/core/auth/logoutCliAdapter.js +34 -0
- package/dist/src/core/auth/logoutCore.js +52 -0
- package/dist/src/core/auth/preflight.smoke.js +151 -0
- package/dist/src/core/index.js +21 -0
- package/dist/src/core/mcp/blueprints.js +27 -0
- package/dist/src/core/mcp/common.js +14 -0
- package/dist/src/core/mcp/runtime.js +67 -0
- package/dist/src/core/mcp/runtime.smoke.js +50 -0
- package/dist/src/core/mcp/swarmClient.js +40 -0
- package/dist/src/core/mcp/swarmSetup.js +43 -0
- package/dist/src/core/providers/cliAdapter.js +39 -0
- package/dist/src/core/providers/contracts.js +1 -0
- package/dist/src/core/providers/index.js +3 -0
- package/dist/src/core/providers/llmCore.js +123 -0
- package/dist/src/core/providers/providerCore.js +141 -0
- package/dist/src/core/providers/providerModelCompatibility.js +98 -0
- package/dist/src/core/providers/providerParitySmoke.js +83 -0
- package/dist/src/core/providers/providerProfileModelSmoke.js +80 -0
- package/dist/src/core/query/contracts.js +1 -0
- package/dist/src/core/query/runtime.js +117 -0
- package/dist/src/core/query/runtime.smoke.js +39 -0
- package/dist/src/core/query/timelineThinking.smoke.js +25 -0
- package/dist/src/core/query/wiring.smoke.js +76 -0
- package/dist/src/core/skills/cliAdapter.js +38 -0
- package/dist/src/core/skills/index.js +52 -0
- package/dist/src/core/skills/runtime.smoke.js +53 -0
- package/dist/src/core/tasks/runtime.js +205 -0
- package/dist/src/core/tasks/runtime.smoke.js +63 -0
- package/dist/src/core/tasks/sdkAdapter.js +4 -0
- package/dist/src/core/tools/contracts.js +3 -0
- package/dist/src/core/tools/fileResolution.js +112 -0
- package/dist/src/core/tools/fileResolution.smoke.js +33 -0
- package/dist/src/core/tools/filesCore.js +51 -0
- package/dist/src/core/tools/filesCore.smoke.js +108 -0
- package/dist/src/core/tools/gitCore.js +20 -0
- package/dist/src/core/tools/imageParity.smoke.js +36 -0
- package/dist/src/core/tools/notebookParity.smoke.js +68 -0
- package/dist/src/core/tools/registry.js +22 -0
- package/dist/src/core/tools/runtime.smoke.js +32 -0
- package/dist/src/core/tools/shellCore.js +60 -0
- package/dist/src/core/types/agentContext.js +9 -0
- package/dist/src/core/types/auth.js +3 -0
- package/dist/src/core/types/command.js +13 -0
- package/dist/src/core/types/provider.js +3 -0
- package/dist/src/core/types/sdkEvent.js +10 -0
- package/dist/src/core/types/swarm.js +1 -0
- package/dist/src/cost-tracker.js +3 -3
- package/dist/src/hooks/useAwaySummary.js +22 -9
- package/dist/src/main.js +32 -2
- package/dist/src/screens/REPL.js +9 -0
- package/dist/src/services/AgentSummary/agentSummary.js +10 -10
- package/dist/src/services/autoDream/autoDream.js +5 -5
- package/dist/src/services/autoDream/consolidationPrompt.js +49 -49
- package/dist/src/services/compact/prompt.js +238 -238
- package/dist/src/services/limits/sessionCounter.js +17 -17
- package/dist/src/services/mcp/client.js +27 -1
- package/dist/src/services/orchestration/execution/AgentTaskExecutor.js +39 -20
- package/dist/src/services/orchestration/execution/OrchestrationExecutionRuntime.js +65 -58
- package/dist/src/skills/bundled/loop.js +57 -57
- package/dist/src/skills/bundled/remember.js +53 -53
- package/dist/src/skills/bundled/simplify.js +49 -49
- package/dist/src/skills/bundled/skillify.js +2 -2
- package/dist/src/state/onChangeAppState.js +6 -0
- package/dist/src/tasks/LocalAgentTask/LocalAgentTask.js +5 -5
- package/dist/src/tasks/LocalMainSessionTask.js +5 -5
- package/dist/src/tasks/LocalShellTask/LocalShellTask.js +13 -13
- package/dist/src/tools/AgentTool/forkSubagent.js +25 -25
- package/dist/src/tools/AskUserQuestionTool/prompt.js +29 -29
- package/dist/src/tools/BashTool/BashTool.js +27 -2
- package/dist/src/tools/BriefTool/prompt.js +14 -14
- package/dist/src/tools/EnterPlanModeTool/EnterPlanModeTool.js +12 -12
- package/dist/src/tools/EnterPlanModeTool/prompt.js +140 -140
- package/dist/src/tools/ExitPlanModeTool/ExitPlanModeV2Tool.js +18 -18
- package/dist/src/tools/ExitPlanModeTool/prompt.js +23 -23
- package/dist/src/tools/ExitWorktreeTool/prompt.js +29 -29
- package/dist/src/tools/FileEditTool/prompt.js +7 -7
- package/dist/src/tools/FileReadTool/FileReadTool.js +18 -1
- package/dist/src/tools/FileWriteTool/prompt.js +6 -6
- package/dist/src/tools/GlobTool/prompt.js +4 -4
- package/dist/src/tools/GrepTool/prompt.js +10 -10
- package/dist/src/tools/LSPTool/prompt.js +18 -18
- package/dist/src/tools/ListMcpResourcesTool/prompt.js +15 -15
- package/dist/src/tools/PowerShellTool/PowerShellTool.js +25 -2
- package/dist/src/tools/ReadMcpResourceTool/prompt.js +13 -13
- package/dist/src/tools/SendMessageTool/prompt.js +36 -36
- package/dist/src/tools/SkillTool/prompt.js +21 -21
- package/dist/src/tools/SleepTool/prompt.js +10 -10
- package/dist/src/tools/TaskCreateTool/prompt.js +41 -41
- package/dist/src/tools/TaskGetTool/prompt.js +21 -21
- package/dist/src/tools/TaskListTool/prompt.js +30 -30
- package/dist/src/tools/TaskOutputTool/TaskOutputTool.js +8 -8
- package/dist/src/tools/TaskStopTool/prompt.js +5 -5
- package/dist/src/tools/TaskUpdateTool/prompt.js +74 -74
- package/dist/src/tools/TodoWriteTool/prompt.js +178 -178
- package/dist/src/tools/ToolSearchTool/prompt.js +9 -9
- package/dist/src/tools/WebFetchTool/WebFetchTool.js +9 -9
- package/dist/src/tools/WebFetchTool/prompt.js +31 -31
- package/dist/src/tools/WebSearchTool/prompt.js +26 -26
- package/dist/src/utils/agentContext.js +2 -0
- package/dist/src/utils/agenticSessionSearch.js +38 -38
- package/dist/src/utils/config.js +2 -0
- package/dist/src/utils/genericProcessUtils.js +21 -21
- package/dist/src/utils/heapDumpService.js +4 -4
- package/dist/src/utils/mcpValidation.js +2 -2
- package/dist/src/utils/model/modelStrings.js +1 -1
- package/dist/src/utils/model/providers.js +5 -0
- package/dist/src/utils/orchestration/store/providerAgentStore.js +22 -22
- package/dist/src/utils/orchestration/store/providerWorkspaceStore.js +10 -10
- package/dist/src/utils/orchestration/store/runStore.js +68 -68
- package/dist/src/utils/orchestration/store/teamStore.js +28 -28
- package/dist/src/utils/permissions/permissionExplainer.js +6 -6
- package/dist/src/utils/permissions/permissionsDb.js +43 -43
- package/dist/src/utils/sdkEventQueue.js +2 -0
- package/dist/src/utils/secureStorage/sqliteStorage.js +12 -12
- package/dist/src/utils/standardMcp/common.js +15 -0
- package/dist/src/utils/standardMcp/setup.js +52 -0
- package/dist/src/utils/swarm/teammatePromptAddendum.js +10 -10
- package/dist/src/utils/task/framework.js +6 -6
- package/package.json +1 -1
- package/dist/src/commands/usage/index.js +0 -7
- package/dist/src/commands/usage/usage.js +0 -5
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
export const LIST_MCP_RESOURCES_TOOL_NAME = 'ListMcpResourcesTool';
|
|
2
|
-
export const DESCRIPTION = `
|
|
3
|
-
Lists available resources from configured MCP servers.
|
|
4
|
-
Each resource object includes a 'server' field indicating which server it's from.
|
|
5
|
-
|
|
6
|
-
Usage examples:
|
|
7
|
-
- List all resources from all servers: \`listMcpResources\`
|
|
8
|
-
- List resources from a specific server: \`listMcpResources({ server: "myserver" })\`
|
|
2
|
+
export const DESCRIPTION = `
|
|
3
|
+
Lists available resources from configured MCP servers.
|
|
4
|
+
Each resource object includes a 'server' field indicating which server it's from.
|
|
5
|
+
|
|
6
|
+
Usage examples:
|
|
7
|
+
- List all resources from all servers: \`listMcpResources\`
|
|
8
|
+
- List resources from a specific server: \`listMcpResources({ server: "myserver" })\`
|
|
9
9
|
`;
|
|
10
|
-
export const PROMPT = `
|
|
11
|
-
List available resources from configured MCP servers.
|
|
12
|
-
Each returned resource will include all standard MCP resource fields plus a 'server' field
|
|
13
|
-
indicating which server the resource belongs to.
|
|
14
|
-
|
|
15
|
-
Parameters:
|
|
16
|
-
- server (optional): The name of a specific MCP server to get resources from. If not provided,
|
|
17
|
-
resources from all servers will be returned.
|
|
10
|
+
export const PROMPT = `
|
|
11
|
+
List available resources from configured MCP servers.
|
|
12
|
+
Each returned resource will include all standard MCP resource fields plus a 'server' field
|
|
13
|
+
indicating which server the resource belongs to.
|
|
14
|
+
|
|
15
|
+
Parameters:
|
|
16
|
+
- server (optional): The name of a specific MCP server to get resources from. If not provided,
|
|
17
|
+
resources from all servers will be returned.
|
|
18
18
|
`;
|
|
@@ -3,6 +3,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { copyFile, stat as fsStat, truncate as fsTruncate, link } from 'fs/promises';
|
|
4
4
|
import { z } from 'zod/v4';
|
|
5
5
|
import { getKairosActive } from '../../bootstrap/state.js';
|
|
6
|
+
import { isCoreToolsEnabled } from '../../core/tools/contracts.js';
|
|
7
|
+
import { startCoreShellCommand } from '../../core/tools/shellCore.js';
|
|
6
8
|
import { TOOL_SUMMARY_MAX_LENGTH } from '../../constants/toolLimits.js';
|
|
7
9
|
import { logEvent } from '../../services/analytics/index.js';
|
|
8
10
|
import { buildTool } from '../../Tool.js';
|
|
@@ -640,9 +642,30 @@ async function* runPowerShellCommand({ input, abortController, setAppState, setT
|
|
|
640
642
|
interrupted: false
|
|
641
643
|
};
|
|
642
644
|
}
|
|
645
|
+
const powershellExecOptions = {
|
|
646
|
+
timeout: timeoutMs,
|
|
647
|
+
onProgress(lastLines, allLines, totalLines, totalBytes, isIncomplete) {
|
|
648
|
+
lastProgressOutput = lastLines;
|
|
649
|
+
fullOutput = allLines;
|
|
650
|
+
lastTotalLines = totalLines;
|
|
651
|
+
lastTotalBytes = isIncomplete ? totalBytes : 0;
|
|
652
|
+
},
|
|
653
|
+
preventCwdChanges,
|
|
654
|
+
// Sandbox works on Linux/macOS/WSL2 — pwsh there is a native binary and
|
|
655
|
+
// SandboxManager.wrapWithSandbox wraps it same as bash (Shell.ts uses
|
|
656
|
+
// /bin/sh for the outer spawn to parse the POSIX-quoted bwrap/sandbox-exec
|
|
657
|
+
// string). On Windows native, sandbox is unsupported; shouldUseSandbox()
|
|
658
|
+
// returns false via isSandboxingEnabled() → isSupportedPlatform() → false.
|
|
659
|
+
// The explicit platform check is redundant-but-obvious.
|
|
660
|
+
shouldUseSandbox: getPlatform() === 'windows' ? false : shouldUseSandbox({
|
|
661
|
+
command,
|
|
662
|
+
dangerouslyDisableSandbox
|
|
663
|
+
}),
|
|
664
|
+
shouldAutoBackground
|
|
665
|
+
};
|
|
643
666
|
let shellCommand;
|
|
644
667
|
try {
|
|
645
|
-
shellCommand = await exec(command, abortController.signal, 'powershell', {
|
|
668
|
+
shellCommand = await (isCoreToolsEnabled() ? startCoreShellCommand({ command, timeoutMs, shellType: 'powershell', execOptions: powershellExecOptions }, { abortSignal: abortController.signal }) : exec(command, abortController.signal, 'powershell', {
|
|
646
669
|
timeout: timeoutMs,
|
|
647
670
|
onProgress(lastLines, allLines, totalLines, totalBytes, isIncomplete) {
|
|
648
671
|
lastProgressOutput = lastLines;
|
|
@@ -662,7 +685,7 @@ async function* runPowerShellCommand({ input, abortController, setAppState, setT
|
|
|
662
685
|
dangerouslyDisableSandbox
|
|
663
686
|
}),
|
|
664
687
|
shouldAutoBackground
|
|
665
|
-
});
|
|
688
|
+
}));
|
|
666
689
|
}
|
|
667
690
|
catch (e) {
|
|
668
691
|
logError(e);
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
export const DESCRIPTION = `
|
|
2
|
-
Reads a specific resource from an MCP server.
|
|
3
|
-
- server: The name of the MCP server to read from
|
|
4
|
-
- uri: The URI of the resource to read
|
|
5
|
-
|
|
6
|
-
Usage examples:
|
|
7
|
-
- Read a resource from a server: \`readMcpResource({ server: "myserver", uri: "my-resource-uri" })\`
|
|
1
|
+
export const DESCRIPTION = `
|
|
2
|
+
Reads a specific resource from an MCP server.
|
|
3
|
+
- server: The name of the MCP server to read from
|
|
4
|
+
- uri: The URI of the resource to read
|
|
5
|
+
|
|
6
|
+
Usage examples:
|
|
7
|
+
- Read a resource from a server: \`readMcpResource({ server: "myserver", uri: "my-resource-uri" })\`
|
|
8
8
|
`;
|
|
9
|
-
export const PROMPT = `
|
|
10
|
-
Reads a specific resource from an MCP server, identified by server name and resource URI.
|
|
11
|
-
|
|
12
|
-
Parameters:
|
|
13
|
-
- server (required): The name of the MCP server from which to read the resource
|
|
14
|
-
- uri (required): The URI of the resource to read
|
|
9
|
+
export const PROMPT = `
|
|
10
|
+
Reads a specific resource from an MCP server, identified by server name and resource URI.
|
|
11
|
+
|
|
12
|
+
Parameters:
|
|
13
|
+
- server (required): The name of the MCP server from which to read the resource
|
|
14
|
+
- uri (required): The URI of the resource to read
|
|
15
15
|
`;
|
|
@@ -2,46 +2,46 @@ import { feature } from '../../recovery/bunBundleShim.js';
|
|
|
2
2
|
export const DESCRIPTION = 'Send a message to another agent';
|
|
3
3
|
export function getPrompt() {
|
|
4
4
|
const udsRow = feature('UDS_INBOX')
|
|
5
|
-
? `\n| \`"uds:/path/to.sock"\` | Local Claude session's socket (same machine; use \`ListPeers\`) |
|
|
5
|
+
? `\n| \`"uds:/path/to.sock"\` | Local Claude session's socket (same machine; use \`ListPeers\`) |
|
|
6
6
|
| \`"bridge:session_..."\` | Remote Control peer session (cross-machine; use \`ListPeers\`) |`
|
|
7
7
|
: '';
|
|
8
8
|
const udsSection = feature('UDS_INBOX')
|
|
9
|
-
? `\n\n## Cross-session
|
|
10
|
-
|
|
11
|
-
Use \`ListPeers\` to discover targets, then:
|
|
12
|
-
|
|
13
|
-
\`\`\`json
|
|
14
|
-
{"to": "uds:/tmp/cc-socks/1234.sock", "message": "check if tests pass over there"}
|
|
15
|
-
{"to": "bridge:session_01AbCd...", "message": "what branch are you on?"}
|
|
16
|
-
\`\`\`
|
|
17
|
-
|
|
9
|
+
? `\n\n## Cross-session
|
|
10
|
+
|
|
11
|
+
Use \`ListPeers\` to discover targets, then:
|
|
12
|
+
|
|
13
|
+
\`\`\`json
|
|
14
|
+
{"to": "uds:/tmp/cc-socks/1234.sock", "message": "check if tests pass over there"}
|
|
15
|
+
{"to": "bridge:session_01AbCd...", "message": "what branch are you on?"}
|
|
16
|
+
\`\`\`
|
|
17
|
+
|
|
18
18
|
A listed peer is alive and will process your message — no "busy" state; messages enqueue and drain at the receiver's next tool round. Your message arrives wrapped as \`<cross-session-message from="...">\`. **To reply to an incoming message, copy its \`from\` attribute as your \`to\`.**`
|
|
19
19
|
: '';
|
|
20
|
-
return `
|
|
21
|
-
# SendMessage
|
|
22
|
-
|
|
23
|
-
Send a message to another agent.
|
|
24
|
-
|
|
25
|
-
\`\`\`json
|
|
26
|
-
{"to": "researcher", "summary": "assign task 1", "message": "start on task #1"}
|
|
27
|
-
\`\`\`
|
|
28
|
-
|
|
29
|
-
| \`to\` | |
|
|
30
|
-
|---|---|
|
|
31
|
-
| \`"researcher"\` | Teammate by name |
|
|
32
|
-
| \`"*"\` | Broadcast to all teammates — expensive (linear in team size), use only when everyone genuinely needs it |${udsRow}
|
|
33
|
-
|
|
34
|
-
Your plain text output is NOT visible to other agents — to communicate, you MUST call this tool. Messages from teammates are delivered automatically; you don't check an inbox. Refer to teammates by name, never by UUID. When relaying, don't quote the original — it's already rendered to the user.${udsSection}
|
|
35
|
-
|
|
36
|
-
## Protocol responses (legacy)
|
|
37
|
-
|
|
38
|
-
If you receive a JSON message with \`type: "shutdown_request"\` or \`type: "plan_approval_request"\`, respond with the matching \`_response\` type — echo the \`request_id\`, set \`approve\` true/false:
|
|
39
|
-
|
|
40
|
-
\`\`\`json
|
|
41
|
-
{"to": "team-lead", "message": {"type": "shutdown_response", "request_id": "...", "approve": true}}
|
|
42
|
-
{"to": "researcher", "message": {"type": "plan_approval_response", "request_id": "...", "approve": false, "feedback": "add error handling"}}
|
|
43
|
-
\`\`\`
|
|
44
|
-
|
|
45
|
-
Approving shutdown terminates your process. Rejecting plan sends the teammate back to revise. Don't originate \`shutdown_request\` unless asked. Don't send structured JSON status messages — use TaskUpdate.
|
|
20
|
+
return `
|
|
21
|
+
# SendMessage
|
|
22
|
+
|
|
23
|
+
Send a message to another agent.
|
|
24
|
+
|
|
25
|
+
\`\`\`json
|
|
26
|
+
{"to": "researcher", "summary": "assign task 1", "message": "start on task #1"}
|
|
27
|
+
\`\`\`
|
|
28
|
+
|
|
29
|
+
| \`to\` | |
|
|
30
|
+
|---|---|
|
|
31
|
+
| \`"researcher"\` | Teammate by name |
|
|
32
|
+
| \`"*"\` | Broadcast to all teammates — expensive (linear in team size), use only when everyone genuinely needs it |${udsRow}
|
|
33
|
+
|
|
34
|
+
Your plain text output is NOT visible to other agents — to communicate, you MUST call this tool. Messages from teammates are delivered automatically; you don't check an inbox. Refer to teammates by name, never by UUID. When relaying, don't quote the original — it's already rendered to the user.${udsSection}
|
|
35
|
+
|
|
36
|
+
## Protocol responses (legacy)
|
|
37
|
+
|
|
38
|
+
If you receive a JSON message with \`type: "shutdown_request"\` or \`type: "plan_approval_request"\`, respond with the matching \`_response\` type — echo the \`request_id\`, set \`approve\` true/false:
|
|
39
|
+
|
|
40
|
+
\`\`\`json
|
|
41
|
+
{"to": "team-lead", "message": {"type": "shutdown_response", "request_id": "...", "approve": true}}
|
|
42
|
+
{"to": "researcher", "message": {"type": "plan_approval_response", "request_id": "...", "approve": false, "feedback": "add error handling"}}
|
|
43
|
+
\`\`\`
|
|
44
|
+
|
|
45
|
+
Approving shutdown terminates your process. Rejecting plan sends the teammate back to revise. Don't originate \`shutdown_request\` unless asked. Don't send structured JSON status messages — use TaskUpdate.
|
|
46
46
|
`.trim();
|
|
47
47
|
}
|
|
@@ -126,27 +126,27 @@ export function formatCommandsWithinBudget(commands, contextWindowTokens) {
|
|
|
126
126
|
.join('\n');
|
|
127
127
|
}
|
|
128
128
|
export const getPrompt = memoize(async (_cwd) => {
|
|
129
|
-
return `Execute a skill within the main conversation
|
|
130
|
-
|
|
131
|
-
When users ask you to perform tasks, check if any of the available skills match. Skills provide specialized capabilities and domain knowledge.
|
|
132
|
-
|
|
133
|
-
When users reference a "slash command" or "/<something>" (e.g., "/commit", "/review-pr"), they are referring to a skill. Use this tool to invoke it.
|
|
134
|
-
|
|
135
|
-
How to invoke:
|
|
136
|
-
- Use this tool with the skill name and optional arguments
|
|
137
|
-
- Examples:
|
|
138
|
-
- \`skill: "pdf"\` - invoke the pdf skill
|
|
139
|
-
- \`skill: "commit", args: "-m 'Fix bug'"\` - invoke with arguments
|
|
140
|
-
- \`skill: "review-pr", args: "123"\` - invoke with arguments
|
|
141
|
-
- \`skill: "ms-office-suite:pdf"\` - invoke using fully qualified name
|
|
142
|
-
|
|
143
|
-
Important:
|
|
144
|
-
- Available skills are listed in system-reminder messages in the conversation
|
|
145
|
-
- When a skill matches the user's request, this is a BLOCKING REQUIREMENT: invoke the relevant Skill tool BEFORE generating any other response about the task
|
|
146
|
-
- NEVER mention a skill without actually calling this tool
|
|
147
|
-
- Do not invoke a skill that is already running
|
|
148
|
-
- Do not use this tool for built-in CLI commands (like /help, /clear, etc.)
|
|
149
|
-
- If you see a <${COMMAND_NAME_TAG}> tag in the current conversation turn, the skill has ALREADY been loaded - follow the instructions directly instead of calling this tool again
|
|
129
|
+
return `Execute a skill within the main conversation
|
|
130
|
+
|
|
131
|
+
When users ask you to perform tasks, check if any of the available skills match. Skills provide specialized capabilities and domain knowledge.
|
|
132
|
+
|
|
133
|
+
When users reference a "slash command" or "/<something>" (e.g., "/commit", "/review-pr"), they are referring to a skill. Use this tool to invoke it.
|
|
134
|
+
|
|
135
|
+
How to invoke:
|
|
136
|
+
- Use this tool with the skill name and optional arguments
|
|
137
|
+
- Examples:
|
|
138
|
+
- \`skill: "pdf"\` - invoke the pdf skill
|
|
139
|
+
- \`skill: "commit", args: "-m 'Fix bug'"\` - invoke with arguments
|
|
140
|
+
- \`skill: "review-pr", args: "123"\` - invoke with arguments
|
|
141
|
+
- \`skill: "ms-office-suite:pdf"\` - invoke using fully qualified name
|
|
142
|
+
|
|
143
|
+
Important:
|
|
144
|
+
- Available skills are listed in system-reminder messages in the conversation
|
|
145
|
+
- When a skill matches the user's request, this is a BLOCKING REQUIREMENT: invoke the relevant Skill tool BEFORE generating any other response about the task
|
|
146
|
+
- NEVER mention a skill without actually calling this tool
|
|
147
|
+
- Do not invoke a skill that is already running
|
|
148
|
+
- Do not use this tool for built-in CLI commands (like /help, /clear, etc.)
|
|
149
|
+
- If you see a <${COMMAND_NAME_TAG}> tag in the current conversation turn, the skill has ALREADY been loaded - follow the instructions directly instead of calling this tool again
|
|
150
150
|
`;
|
|
151
151
|
});
|
|
152
152
|
export async function getSkillToolInfo(cwd) {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { TICK_TAG } from '../../constants/xml.js';
|
|
2
2
|
export const SLEEP_TOOL_NAME = 'Sleep';
|
|
3
3
|
export const DESCRIPTION = 'Wait for a specified duration';
|
|
4
|
-
export const SLEEP_TOOL_PROMPT = `Wait for a specified duration. The user can interrupt the sleep at any time.
|
|
5
|
-
|
|
6
|
-
Use this when the user tells you to sleep or rest, when you have nothing to do, or when you're waiting for something.
|
|
7
|
-
|
|
8
|
-
You may receive <${TICK_TAG}> prompts — these are periodic check-ins. Look for useful work to do before sleeping.
|
|
9
|
-
|
|
10
|
-
You can call this concurrently with other tools — it won't interfere with them.
|
|
11
|
-
|
|
12
|
-
Prefer this over \`Bash(sleep ...)\` — it doesn't hold a shell process.
|
|
13
|
-
|
|
4
|
+
export const SLEEP_TOOL_PROMPT = `Wait for a specified duration. The user can interrupt the sleep at any time.
|
|
5
|
+
|
|
6
|
+
Use this when the user tells you to sleep or rest, when you have nothing to do, or when you're waiting for something.
|
|
7
|
+
|
|
8
|
+
You may receive <${TICK_TAG}> prompts — these are periodic check-ins. Look for useful work to do before sleeping.
|
|
9
|
+
|
|
10
|
+
You can call this concurrently with other tools — it won't interfere with them.
|
|
11
|
+
|
|
12
|
+
Prefer this over \`Bash(sleep ...)\` — it doesn't hold a shell process.
|
|
13
|
+
|
|
14
14
|
Each wake-up costs an API call, but the prompt cache expires after 5 minutes of inactivity — balance accordingly.`;
|
|
@@ -5,48 +5,48 @@ export function getPrompt() {
|
|
|
5
5
|
? ' and potentially assigned to teammates'
|
|
6
6
|
: '';
|
|
7
7
|
const teammateTips = isAgentSwarmsEnabled()
|
|
8
|
-
? `- Include enough detail in the description for another agent to understand and complete the task
|
|
9
|
-
- New tasks are created with status 'pending' and no owner - use TaskUpdate with the \`owner\` parameter to assign them
|
|
8
|
+
? `- Include enough detail in the description for another agent to understand and complete the task
|
|
9
|
+
- New tasks are created with status 'pending' and no owner - use TaskUpdate with the \`owner\` parameter to assign them
|
|
10
10
|
`
|
|
11
11
|
: '';
|
|
12
|
-
return `Use this tool to create a structured task list for your current coding session. This helps you track progress, organize complex tasks, and demonstrate thoroughness to the user.
|
|
13
|
-
It also helps the user understand the progress of the task and overall progress of their requests.
|
|
14
|
-
|
|
15
|
-
## When to Use This Tool
|
|
16
|
-
|
|
17
|
-
Use this tool proactively in these scenarios:
|
|
18
|
-
|
|
19
|
-
- Complex multi-step tasks - When a task requires 3 or more distinct steps or actions
|
|
20
|
-
- Non-trivial and complex tasks - Tasks that require careful planning or multiple operations${teammateContext}
|
|
21
|
-
- Plan mode - When using plan mode, create a task list to track the work
|
|
22
|
-
- User explicitly requests todo list - When the user directly asks you to use the todo list
|
|
23
|
-
- User provides multiple tasks - When users provide a list of things to be done (numbered or comma-separated)
|
|
24
|
-
- After receiving new instructions - Immediately capture user requirements as tasks
|
|
25
|
-
- When you start working on a task - Mark it as in_progress BEFORE beginning work
|
|
26
|
-
- After completing a task - Mark it as completed and add any new follow-up tasks discovered during implementation
|
|
27
|
-
|
|
28
|
-
## When NOT to Use This Tool
|
|
29
|
-
|
|
30
|
-
Skip using this tool when:
|
|
31
|
-
- There is only a single, straightforward task
|
|
32
|
-
- The task is trivial and tracking it provides no organizational benefit
|
|
33
|
-
- The task can be completed in less than 3 trivial steps
|
|
34
|
-
- The task is purely conversational or informational
|
|
35
|
-
|
|
36
|
-
NOTE that you should not use this tool if there is only one trivial task to do. In this case you are better off just doing the task directly.
|
|
37
|
-
|
|
38
|
-
## Task Fields
|
|
39
|
-
|
|
40
|
-
- **subject**: A brief, actionable title in imperative form (e.g., "Fix authentication bug in login flow")
|
|
41
|
-
- **description**: What needs to be done
|
|
42
|
-
- **activeForm** (optional): Present continuous form shown in the spinner when the task is in_progress (e.g., "Fixing authentication bug"). If omitted, the spinner shows the subject instead.
|
|
43
|
-
|
|
44
|
-
All tasks are created with status \`pending\`.
|
|
45
|
-
|
|
46
|
-
## Tips
|
|
47
|
-
|
|
48
|
-
- Create tasks with clear, specific subjects that describe the outcome
|
|
49
|
-
- After creating tasks, use TaskUpdate to set up dependencies (blocks/blockedBy) if needed
|
|
50
|
-
${teammateTips}- Check TaskList first to avoid creating duplicate tasks
|
|
12
|
+
return `Use this tool to create a structured task list for your current coding session. This helps you track progress, organize complex tasks, and demonstrate thoroughness to the user.
|
|
13
|
+
It also helps the user understand the progress of the task and overall progress of their requests.
|
|
14
|
+
|
|
15
|
+
## When to Use This Tool
|
|
16
|
+
|
|
17
|
+
Use this tool proactively in these scenarios:
|
|
18
|
+
|
|
19
|
+
- Complex multi-step tasks - When a task requires 3 or more distinct steps or actions
|
|
20
|
+
- Non-trivial and complex tasks - Tasks that require careful planning or multiple operations${teammateContext}
|
|
21
|
+
- Plan mode - When using plan mode, create a task list to track the work
|
|
22
|
+
- User explicitly requests todo list - When the user directly asks you to use the todo list
|
|
23
|
+
- User provides multiple tasks - When users provide a list of things to be done (numbered or comma-separated)
|
|
24
|
+
- After receiving new instructions - Immediately capture user requirements as tasks
|
|
25
|
+
- When you start working on a task - Mark it as in_progress BEFORE beginning work
|
|
26
|
+
- After completing a task - Mark it as completed and add any new follow-up tasks discovered during implementation
|
|
27
|
+
|
|
28
|
+
## When NOT to Use This Tool
|
|
29
|
+
|
|
30
|
+
Skip using this tool when:
|
|
31
|
+
- There is only a single, straightforward task
|
|
32
|
+
- The task is trivial and tracking it provides no organizational benefit
|
|
33
|
+
- The task can be completed in less than 3 trivial steps
|
|
34
|
+
- The task is purely conversational or informational
|
|
35
|
+
|
|
36
|
+
NOTE that you should not use this tool if there is only one trivial task to do. In this case you are better off just doing the task directly.
|
|
37
|
+
|
|
38
|
+
## Task Fields
|
|
39
|
+
|
|
40
|
+
- **subject**: A brief, actionable title in imperative form (e.g., "Fix authentication bug in login flow")
|
|
41
|
+
- **description**: What needs to be done
|
|
42
|
+
- **activeForm** (optional): Present continuous form shown in the spinner when the task is in_progress (e.g., "Fixing authentication bug"). If omitted, the spinner shows the subject instead.
|
|
43
|
+
|
|
44
|
+
All tasks are created with status \`pending\`.
|
|
45
|
+
|
|
46
|
+
## Tips
|
|
47
|
+
|
|
48
|
+
- Create tasks with clear, specific subjects that describe the outcome
|
|
49
|
+
- After creating tasks, use TaskUpdate to set up dependencies (blocks/blockedBy) if needed
|
|
50
|
+
${teammateTips}- Check TaskList first to avoid creating duplicate tasks
|
|
51
51
|
`;
|
|
52
52
|
}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
export const DESCRIPTION = 'Get a task by ID from the task list';
|
|
2
|
-
export const PROMPT = `Use this tool to retrieve a task by its ID from the task list.
|
|
3
|
-
|
|
4
|
-
## When to Use This Tool
|
|
5
|
-
|
|
6
|
-
- When you need the full description and context before starting work on a task
|
|
7
|
-
- To understand task dependencies (what it blocks, what blocks it)
|
|
8
|
-
- After being assigned a task, to get complete requirements
|
|
9
|
-
|
|
10
|
-
## Output
|
|
11
|
-
|
|
12
|
-
Returns full task details:
|
|
13
|
-
- **subject**: Task title
|
|
14
|
-
- **description**: Detailed requirements and context
|
|
15
|
-
- **status**: 'pending', 'in_progress', or 'completed'
|
|
16
|
-
- **blocks**: Tasks waiting on this one to complete
|
|
17
|
-
- **blockedBy**: Tasks that must complete before this one can start
|
|
18
|
-
|
|
19
|
-
## Tips
|
|
20
|
-
|
|
21
|
-
- After fetching a task, verify its blockedBy list is empty before beginning work.
|
|
22
|
-
- Use TaskList to see all tasks in summary form.
|
|
2
|
+
export const PROMPT = `Use this tool to retrieve a task by its ID from the task list.
|
|
3
|
+
|
|
4
|
+
## When to Use This Tool
|
|
5
|
+
|
|
6
|
+
- When you need the full description and context before starting work on a task
|
|
7
|
+
- To understand task dependencies (what it blocks, what blocks it)
|
|
8
|
+
- After being assigned a task, to get complete requirements
|
|
9
|
+
|
|
10
|
+
## Output
|
|
11
|
+
|
|
12
|
+
Returns full task details:
|
|
13
|
+
- **subject**: Task title
|
|
14
|
+
- **description**: Detailed requirements and context
|
|
15
|
+
- **status**: 'pending', 'in_progress', or 'completed'
|
|
16
|
+
- **blocks**: Tasks waiting on this one to complete
|
|
17
|
+
- **blockedBy**: Tasks that must complete before this one can start
|
|
18
|
+
|
|
19
|
+
## Tips
|
|
20
|
+
|
|
21
|
+
- After fetching a task, verify its blockedBy list is empty before beginning work.
|
|
22
|
+
- Use TaskList to see all tasks in summary form.
|
|
23
23
|
`;
|
|
@@ -2,43 +2,43 @@ import { isAgentSwarmsEnabled } from '../../utils/agentSwarmsEnabled.js';
|
|
|
2
2
|
export const DESCRIPTION = 'List all tasks in the task list';
|
|
3
3
|
export function getPrompt() {
|
|
4
4
|
const teammateUseCase = isAgentSwarmsEnabled()
|
|
5
|
-
? `- Before assigning tasks to teammates, to see what's available
|
|
5
|
+
? `- Before assigning tasks to teammates, to see what's available
|
|
6
6
|
`
|
|
7
7
|
: '';
|
|
8
8
|
const idDescription = isAgentSwarmsEnabled()
|
|
9
9
|
? '- **id**: Task identifier (use with TaskGet, TaskUpdate)'
|
|
10
10
|
: '- **id**: Task identifier (use with TaskGet, TaskUpdate)';
|
|
11
11
|
const teammateWorkflow = isAgentSwarmsEnabled()
|
|
12
|
-
? `
|
|
13
|
-
## Teammate Workflow
|
|
14
|
-
|
|
15
|
-
When working as a teammate:
|
|
16
|
-
1. After completing your current task, call TaskList to find available work
|
|
17
|
-
2. Look for tasks with status 'pending', no owner, and empty blockedBy
|
|
18
|
-
3. **Prefer tasks in ID order** (lowest ID first) when multiple tasks are available, as earlier tasks often set up context for later ones
|
|
19
|
-
4. Claim an available task using TaskUpdate (set \`owner\` to your name), or wait for leader assignment
|
|
20
|
-
5. If blocked, focus on unblocking tasks or notify the team lead
|
|
12
|
+
? `
|
|
13
|
+
## Teammate Workflow
|
|
14
|
+
|
|
15
|
+
When working as a teammate:
|
|
16
|
+
1. After completing your current task, call TaskList to find available work
|
|
17
|
+
2. Look for tasks with status 'pending', no owner, and empty blockedBy
|
|
18
|
+
3. **Prefer tasks in ID order** (lowest ID first) when multiple tasks are available, as earlier tasks often set up context for later ones
|
|
19
|
+
4. Claim an available task using TaskUpdate (set \`owner\` to your name), or wait for leader assignment
|
|
20
|
+
5. If blocked, focus on unblocking tasks or notify the team lead
|
|
21
21
|
`
|
|
22
22
|
: '';
|
|
23
|
-
return `Use this tool to list all tasks in the task list.
|
|
24
|
-
|
|
25
|
-
## When to Use This Tool
|
|
26
|
-
|
|
27
|
-
- To see what tasks are available to work on (status: 'pending', no owner, not blocked)
|
|
28
|
-
- To check overall progress on the project
|
|
29
|
-
- To find tasks that are blocked and need dependencies resolved
|
|
30
|
-
${teammateUseCase}- After completing a task, to check for newly unblocked work or claim the next available task
|
|
31
|
-
- **Prefer working on tasks in ID order** (lowest ID first) when multiple tasks are available, as earlier tasks often set up context for later ones
|
|
32
|
-
|
|
33
|
-
## Output
|
|
34
|
-
|
|
35
|
-
Returns a summary of each task:
|
|
36
|
-
${idDescription}
|
|
37
|
-
- **subject**: Brief description of the task
|
|
38
|
-
- **status**: 'pending', 'in_progress', or 'completed'
|
|
39
|
-
- **owner**: Agent ID if assigned, empty if available
|
|
40
|
-
- **blockedBy**: List of open task IDs that must be resolved first (tasks with blockedBy cannot be claimed until dependencies resolve)
|
|
41
|
-
|
|
42
|
-
Use TaskGet with a specific task ID to view full details including description and comments.
|
|
23
|
+
return `Use this tool to list all tasks in the task list.
|
|
24
|
+
|
|
25
|
+
## When to Use This Tool
|
|
26
|
+
|
|
27
|
+
- To see what tasks are available to work on (status: 'pending', no owner, not blocked)
|
|
28
|
+
- To check overall progress on the project
|
|
29
|
+
- To find tasks that are blocked and need dependencies resolved
|
|
30
|
+
${teammateUseCase}- After completing a task, to check for newly unblocked work or claim the next available task
|
|
31
|
+
- **Prefer working on tasks in ID order** (lowest ID first) when multiple tasks are available, as earlier tasks often set up context for later ones
|
|
32
|
+
|
|
33
|
+
## Output
|
|
34
|
+
|
|
35
|
+
Returns a summary of each task:
|
|
36
|
+
${idDescription}
|
|
37
|
+
- **subject**: Brief description of the task
|
|
38
|
+
- **status**: 'pending', 'in_progress', or 'completed'
|
|
39
|
+
- **owner**: Agent ID if assigned, empty if available
|
|
40
|
+
- **blockedBy**: List of open task IDs that must be resolved first (tasks with blockedBy cannot be claimed until dependencies resolve)
|
|
41
|
+
|
|
42
|
+
Use TaskGet with a specific task ID to view full details including description and comments.
|
|
43
43
|
${teammateWorkflow}`;
|
|
44
44
|
}
|
|
@@ -135,14 +135,14 @@ export const TaskOutputTool = buildTool({
|
|
|
135
135
|
return input.task_id;
|
|
136
136
|
},
|
|
137
137
|
async prompt() {
|
|
138
|
-
return `DEPRECATED: Prefer using the Read tool on the task's output file path instead. Background tasks return their output file path in the tool result, and you receive a <task-notification> with the same path when the task completes — Read that file directly.
|
|
139
|
-
|
|
140
|
-
- Retrieves output from a running or completed task (background shell, agent, or remote session)
|
|
141
|
-
- Takes a task_id parameter identifying the task
|
|
142
|
-
- Returns the task output along with status information
|
|
143
|
-
- Use block=true (default) to wait for task completion
|
|
144
|
-
- Use block=false for non-blocking check of current status
|
|
145
|
-
- Task IDs can be found using the /tasks command
|
|
138
|
+
return `DEPRECATED: Prefer using the Read tool on the task's output file path instead. Background tasks return their output file path in the tool result, and you receive a <task-notification> with the same path when the task completes — Read that file directly.
|
|
139
|
+
|
|
140
|
+
- Retrieves output from a running or completed task (background shell, agent, or remote session)
|
|
141
|
+
- Takes a task_id parameter identifying the task
|
|
142
|
+
- Returns the task output along with status information
|
|
143
|
+
- Use block=true (default) to wait for task completion
|
|
144
|
+
- Use block=false for non-blocking check of current status
|
|
145
|
+
- Task IDs can be found using the /tasks command
|
|
146
146
|
- Works with all task types: background shells, async agents, and remote sessions`;
|
|
147
147
|
},
|
|
148
148
|
async validateInput({ task_id }, { getAppState }) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export const TASK_STOP_TOOL_NAME = 'TaskStop';
|
|
2
|
-
export const DESCRIPTION = `
|
|
3
|
-
- Stops a running background task by its ID
|
|
4
|
-
- Takes a task_id parameter identifying the task to stop
|
|
5
|
-
- Returns a success or failure status
|
|
6
|
-
- Use this tool when you need to terminate a long-running task
|
|
2
|
+
export const DESCRIPTION = `
|
|
3
|
+
- Stops a running background task by its ID
|
|
4
|
+
- Takes a task_id parameter identifying the task to stop
|
|
5
|
+
- Returns a success or failure status
|
|
6
|
+
- Use this tool when you need to terminate a long-running task
|
|
7
7
|
`;
|