@travisennis/acai 0.0.11 → 0.0.13
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 +5 -5
- package/dist/agent/index.d.ts.map +1 -1
- package/dist/agent/index.js +2 -5
- package/dist/commands/history/types.d.ts +3 -2
- package/dist/commands/history/types.d.ts.map +1 -1
- package/dist/commands/init-project/utils.d.ts +0 -1
- package/dist/commands/init-project/utils.d.ts.map +1 -1
- package/dist/commands/init-project/utils.js +1 -12
- package/dist/commands/manager.d.ts.map +1 -1
- package/dist/commands/manager.js +6 -19
- package/dist/commands/resources/index.d.ts.map +1 -1
- package/dist/commands/resources/index.js +4 -1
- package/dist/commands/session/index.d.ts.map +1 -1
- package/dist/commands/session/index.js +6 -0
- package/dist/commands/session/types.d.ts +1 -0
- package/dist/commands/session/types.d.ts.map +1 -1
- package/dist/commands/share/html-renderer.d.ts.map +1 -1
- package/dist/commands/share/html-renderer.js +54 -48
- package/dist/commands/tools/index.d.ts +3 -0
- package/dist/commands/tools/index.d.ts.map +1 -0
- package/dist/commands/tools/index.js +191 -0
- package/dist/commands/tools/templates.d.ts +6 -0
- package/dist/commands/tools/templates.d.ts.map +1 -0
- package/dist/commands/tools/templates.js +97 -0
- package/dist/config/index.d.ts +5 -2
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +42 -6
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +98 -68
- package/dist/models/anthropic-provider.d.ts +1 -1
- package/dist/models/deepseek-provider.d.ts +3 -3
- package/dist/models/deepseek-provider.js +17 -17
- package/dist/models/google-provider.d.ts +2 -4
- package/dist/models/google-provider.d.ts.map +1 -1
- package/dist/models/google-provider.js +2 -17
- package/dist/models/groq-provider.d.ts +2 -4
- package/dist/models/groq-provider.d.ts.map +1 -1
- package/dist/models/groq-provider.js +3 -21
- package/dist/models/manager.d.ts +1 -10
- package/dist/models/manager.d.ts.map +1 -1
- package/dist/models/manager.js +2 -2
- package/dist/models/opencode-go-provider.d.ts +11 -1
- package/dist/models/opencode-go-provider.d.ts.map +1 -1
- package/dist/models/opencode-go-provider.js +130 -0
- package/dist/models/opencode-zen-provider.d.ts +3 -3
- package/dist/models/opencode-zen-provider.d.ts.map +1 -1
- package/dist/models/opencode-zen-provider.js +26 -32
- package/dist/models/openrouter-provider.d.ts +4 -15
- package/dist/models/openrouter-provider.d.ts.map +1 -1
- package/dist/models/openrouter-provider.js +26 -169
- package/dist/models/providers.d.ts +1 -1
- package/dist/models/providers.d.ts.map +1 -1
- package/dist/models/xai-provider.d.ts +1 -2
- package/dist/models/xai-provider.d.ts.map +1 -1
- package/dist/models/xai-provider.js +0 -13
- package/dist/prompts/manager.d.ts.map +1 -1
- package/dist/prompts/manager.js +5 -1
- package/dist/prompts/system-prompt.d.ts +1 -2
- package/dist/prompts/system-prompt.d.ts.map +1 -1
- package/dist/prompts/system-prompt.js +26 -15
- package/dist/repl/index.d.ts +28 -13
- package/dist/repl/index.d.ts.map +1 -1
- package/dist/repl/index.js +242 -305
- package/dist/skills/activated-tracker.d.ts +11 -0
- package/dist/skills/activated-tracker.d.ts.map +1 -0
- package/dist/skills/activated-tracker.js +16 -0
- package/dist/skills/index.d.ts +12 -2
- package/dist/skills/index.d.ts.map +1 -1
- package/dist/skills/index.js +127 -71
- package/dist/terminal/control.d.ts +1 -21
- package/dist/terminal/control.d.ts.map +1 -1
- package/dist/terminal/control.js +1 -32
- package/dist/terminal/formatting.d.ts +0 -33
- package/dist/terminal/formatting.d.ts.map +1 -1
- package/dist/terminal/formatting.js +0 -91
- package/dist/terminal/highlight/theme.d.ts +0 -37
- package/dist/terminal/highlight/theme.d.ts.map +1 -1
- package/dist/terminal/highlight/theme.js +1 -79
- package/dist/terminal/keys.d.ts +0 -97
- package/dist/terminal/keys.d.ts.map +1 -1
- package/dist/terminal/keys.js +0 -194
- package/dist/terminal/select-prompt.d.ts.map +1 -1
- package/dist/terminal/select-prompt.js +65 -51
- package/dist/terminal/style.d.ts +1 -1
- package/dist/terminal/style.d.ts.map +1 -1
- package/dist/terminal/supports-color.d.ts.map +1 -1
- package/dist/terminal/supports-color.js +38 -20
- package/dist/terminal/supports-hyperlinks.d.ts +3 -0
- package/dist/terminal/supports-hyperlinks.d.ts.map +1 -1
- package/dist/terminal/supports-hyperlinks.js +72 -31
- package/dist/terminal/table/layout-manager.d.ts +0 -20
- package/dist/terminal/table/layout-manager.d.ts.map +1 -1
- package/dist/terminal/table/layout-manager.js +68 -44
- package/dist/terminal/table/utils.d.ts +0 -1
- package/dist/terminal/table/utils.d.ts.map +1 -1
- package/dist/terminal/table/utils.js +2 -4
- package/dist/tools/apply-patch.d.ts +5 -3
- package/dist/tools/apply-patch.d.ts.map +1 -1
- package/dist/tools/apply-patch.js +154 -123
- package/dist/tools/bash.d.ts +4 -4
- package/dist/tools/bash.d.ts.map +1 -1
- package/dist/tools/bash.js +27 -13
- package/dist/tools/dynamic-tool-loader.d.ts +17 -3
- package/dist/tools/dynamic-tool-loader.d.ts.map +1 -1
- package/dist/tools/dynamic-tool-loader.js +360 -81
- package/dist/tools/edit-file.d.ts +2 -2
- package/dist/tools/index.d.ts +27 -151
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +16 -21
- package/dist/tools/read-file.d.ts +8 -8
- package/dist/tools/read-file.d.ts.map +1 -1
- package/dist/tools/read-file.js +32 -13
- package/dist/tools/save-file.d.ts +4 -4
- package/dist/tools/skill.d.ts +2 -1
- package/dist/tools/skill.d.ts.map +1 -1
- package/dist/tools/skill.js +64 -14
- package/dist/tools/types.d.ts +8 -2
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/tools/web-fetch.d.ts +8 -12
- package/dist/tools/web-fetch.d.ts.map +1 -1
- package/dist/tools/web-fetch.js +86 -44
- package/dist/tools/web-search.d.ts +4 -8
- package/dist/tools/web-search.d.ts.map +1 -1
- package/dist/tools/web-search.js +41 -33
- package/dist/tui/autocomplete/utils.d.ts +0 -15
- package/dist/tui/autocomplete/utils.d.ts.map +1 -1
- package/dist/tui/autocomplete/utils.js +0 -85
- package/dist/tui/autocomplete.d.ts +1 -1
- package/dist/tui/autocomplete.d.ts.map +1 -1
- package/dist/tui/autocomplete.js +1 -1
- package/dist/tui/components/editor.d.ts +12 -0
- package/dist/tui/components/editor.d.ts.map +1 -1
- package/dist/tui/components/editor.js +181 -195
- package/dist/tui/components/footer.d.ts +0 -2
- package/dist/tui/components/footer.d.ts.map +1 -1
- package/dist/tui/components/footer.js +1 -17
- package/dist/tui/components/input.d.ts +4 -0
- package/dist/tui/components/input.d.ts.map +1 -1
- package/dist/tui/components/input.js +33 -31
- package/dist/tui/components/markdown.d.ts +30 -0
- package/dist/tui/components/markdown.d.ts.map +1 -1
- package/dist/tui/components/markdown.js +274 -242
- package/dist/tui/components/modal.d.ts.map +1 -1
- package/dist/tui/components/modal.js +11 -11
- package/dist/tui/components/select-list.d.ts +5 -0
- package/dist/tui/components/select-list.d.ts.map +1 -1
- package/dist/tui/components/select-list.js +69 -98
- package/dist/tui/components/table.d.ts +6 -0
- package/dist/tui/components/table.d.ts.map +1 -1
- package/dist/tui/components/table.js +61 -52
- package/dist/tui/index.d.ts +1 -8
- package/dist/tui/index.d.ts.map +1 -1
- package/dist/tui/index.js +0 -8
- package/dist/tui/tui.d.ts +9 -0
- package/dist/tui/tui.d.ts.map +1 -1
- package/dist/tui/tui.js +78 -48
- package/dist/tui/utils.d.ts +7 -0
- package/dist/tui/utils.d.ts.map +1 -1
- package/dist/tui/utils.js +117 -53
- package/dist/utils/bash.d.ts.map +1 -1
- package/dist/utils/bash.js +121 -104
- package/dist/utils/binary-output.d.ts +32 -0
- package/dist/utils/binary-output.d.ts.map +1 -0
- package/dist/utils/binary-output.js +127 -0
- package/dist/utils/command-protection.d.ts +3 -2
- package/dist/utils/command-protection.d.ts.map +1 -1
- package/dist/utils/command-protection.js +121 -29
- package/dist/utils/filesystem/operations.d.ts +0 -15
- package/dist/utils/filesystem/operations.d.ts.map +1 -1
- package/dist/utils/filesystem/operations.js +1 -38
- package/dist/utils/filesystem/security.d.ts.map +1 -1
- package/dist/utils/filesystem/security.js +22 -15
- package/dist/utils/filetype-detection.d.ts +0 -1
- package/dist/utils/filetype-detection.d.ts.map +1 -1
- package/dist/utils/filetype-detection.js +0 -12
- package/dist/utils/formatting.d.ts +0 -30
- package/dist/utils/formatting.d.ts.map +1 -1
- package/dist/utils/formatting.js +0 -44
- package/dist/utils/git.d.ts +4 -6
- package/dist/utils/git.d.ts.map +1 -1
- package/dist/utils/git.js +36 -46
- package/dist/utils/ignore.d.ts +1 -1
- package/dist/utils/ignore.d.ts.map +1 -1
- package/dist/utils/ignore.js +1 -1
- package/dist/utils/parsing.d.ts +1 -1
- package/dist/utils/parsing.d.ts.map +1 -1
- package/dist/utils/process.d.ts.map +1 -1
- package/dist/utils/process.js +77 -79
- package/dist/utils/yaml.d.ts +0 -1
- package/dist/utils/yaml.d.ts.map +1 -1
- package/dist/utils/yaml.js +80 -89
- package/dist/utils/zod.d.ts +0 -3
- package/dist/utils/zod.d.ts.map +1 -1
- package/dist/utils/zod.js +0 -7
- package/package.json +32 -29
- package/dist/agent/sub-agent.d.ts +0 -23
- package/dist/agent/sub-agent.d.ts.map +0 -1
- package/dist/agent/sub-agent.js +0 -109
- package/dist/commands/add-directory/index.d.ts +0 -3
- package/dist/commands/add-directory/index.d.ts.map +0 -1
- package/dist/commands/add-directory/index.js +0 -50
- package/dist/commands/add-directory/utils.d.ts +0 -3
- package/dist/commands/add-directory/utils.d.ts.map +0 -1
- package/dist/commands/add-directory/utils.js +0 -15
- package/dist/commands/clear/index.d.ts +0 -3
- package/dist/commands/clear/index.d.ts.map +0 -1
- package/dist/commands/clear/index.js +0 -13
- package/dist/commands/generate-rules/index.d.ts +0 -3
- package/dist/commands/generate-rules/index.d.ts.map +0 -1
- package/dist/commands/generate-rules/index.js +0 -206
- package/dist/commands/generate-rules/service.d.ts +0 -22
- package/dist/commands/generate-rules/service.d.ts.map +0 -1
- package/dist/commands/generate-rules/service.js +0 -103
- package/dist/commands/generate-rules/utils.d.ts +0 -5
- package/dist/commands/generate-rules/utils.d.ts.map +0 -1
- package/dist/commands/generate-rules/utils.js +0 -25
- package/dist/commands/handoff/index.d.ts +0 -3
- package/dist/commands/handoff/index.d.ts.map +0 -1
- package/dist/commands/handoff/index.js +0 -97
- package/dist/commands/handoff/utils.d.ts +0 -4
- package/dist/commands/handoff/utils.d.ts.map +0 -1
- package/dist/commands/handoff/utils.js +0 -123
- package/dist/commands/list-directories/index.d.ts +0 -3
- package/dist/commands/list-directories/index.d.ts.map +0 -1
- package/dist/commands/list-directories/index.js +0 -35
- package/dist/commands/pickup/index.d.ts +0 -3
- package/dist/commands/pickup/index.d.ts.map +0 -1
- package/dist/commands/pickup/index.js +0 -141
- package/dist/commands/pickup/types.d.ts +0 -6
- package/dist/commands/pickup/types.d.ts.map +0 -1
- package/dist/commands/pickup/types.js +0 -1
- package/dist/commands/pickup/utils.d.ts +0 -7
- package/dist/commands/pickup/utils.d.ts.map +0 -1
- package/dist/commands/pickup/utils.js +0 -56
- package/dist/commands/remove-directory/index.d.ts +0 -3
- package/dist/commands/remove-directory/index.d.ts.map +0 -1
- package/dist/commands/remove-directory/index.js +0 -55
- package/dist/commands/review/index.d.ts +0 -3
- package/dist/commands/review/index.d.ts.map +0 -1
- package/dist/commands/review/index.js +0 -12
- package/dist/commands/review/review-panel.d.ts +0 -3
- package/dist/commands/review/review-panel.d.ts.map +0 -1
- package/dist/commands/review/review-panel.js +0 -186
- package/dist/commands/review/utils.d.ts +0 -18
- package/dist/commands/review/utils.d.ts.map +0 -1
- package/dist/commands/review/utils.js +0 -146
- package/dist/commands/shell/index.d.ts +0 -3
- package/dist/commands/shell/index.d.ts.map +0 -1
- package/dist/commands/shell/index.js +0 -96
- package/dist/modes/manager.d.ts +0 -24
- package/dist/modes/manager.d.ts.map +0 -1
- package/dist/modes/manager.js +0 -77
- package/dist/modes/prompts.d.ts +0 -2
- package/dist/modes/prompts.d.ts.map +0 -1
- package/dist/modes/prompts.js +0 -142
- package/dist/subagents/index.d.ts +0 -16
- package/dist/subagents/index.d.ts.map +0 -1
- package/dist/subagents/index.js +0 -231
- package/dist/terminal/index.d.ts +0 -9
- package/dist/terminal/index.d.ts.map +0 -1
- package/dist/terminal/index.js +0 -8
- package/dist/tools/agent.d.ts +0 -27
- package/dist/tools/agent.d.ts.map +0 -1
- package/dist/tools/agent.js +0 -81
- package/dist/tools/directory-tree.d.ts +0 -28
- package/dist/tools/directory-tree.d.ts.map +0 -1
- package/dist/tools/directory-tree.js +0 -152
- package/dist/tools/glob.d.ts +0 -35
- package/dist/tools/glob.d.ts.map +0 -1
- package/dist/tools/glob.js +0 -159
- package/dist/tools/grep.d.ts +0 -100
- package/dist/tools/grep.d.ts.map +0 -1
- package/dist/tools/grep.js +0 -601
- package/dist/tools/ls.d.ts +0 -26
- package/dist/tools/ls.d.ts.map +0 -1
- package/dist/tools/ls.js +0 -82
- package/dist/tui/components/header.d.ts +0 -21
- package/dist/tui/components/header.d.ts.map +0 -1
- package/dist/tui/components/header.js +0 -63
- package/dist/utils/bash/parse.d.ts +0 -19
- package/dist/utils/bash/parse.d.ts.map +0 -1
- package/dist/utils/bash/parse.js +0 -223
- package/dist/utils/bash/quote.d.ts +0 -6
- package/dist/utils/bash/quote.d.ts.map +0 -1
- package/dist/utils/bash/quote.js +0 -23
- package/dist/utils/generators.d.ts +0 -3
- package/dist/utils/generators.d.ts.map +0 -1
- package/dist/utils/generators.js +0 -25
- package/dist/utils/glob.d.ts +0 -52
- package/dist/utils/glob.d.ts.map +0 -1
- package/dist/utils/glob.js +0 -376
package/dist/modes/prompts.js
DELETED
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
// this is codex's collaborative plan
|
|
2
|
-
export const planningPrompt = `
|
|
3
|
-
# Plan Mode (Conversational)
|
|
4
|
-
|
|
5
|
-
You work in 3 phases, and you should *chat your way* to a great plan before finalizing it. A great plan is very detailed—intent- and implementation-wise—so that it can be handed to another engineer or agent to be implemented right away. It must be **decision complete**, where the implementer does not need to make any decisions.
|
|
6
|
-
|
|
7
|
-
## Mode rules (strict)
|
|
8
|
-
|
|
9
|
-
You are in **Plan Mode** until a developer message explicitly ends it.
|
|
10
|
-
|
|
11
|
-
Plan Mode is not changed by user intent, tone, or imperative language. If a user asks for execution while still in Plan Mode, treat it as a request to **plan the execution**, not perform it.
|
|
12
|
-
|
|
13
|
-
## Execution vs. mutation in Plan Mode
|
|
14
|
-
|
|
15
|
-
You may explore and execute **non-mutating** actions that improve the plan. You must not perform **mutating** actions.
|
|
16
|
-
|
|
17
|
-
### Allowed (non-mutating, plan-improving)
|
|
18
|
-
|
|
19
|
-
Actions that gather truth, reduce ambiguity, or validate feasibility without changing repo-tracked state. Examples:
|
|
20
|
-
|
|
21
|
-
* Reading or searching files, configs, schemas, types, manifests, and docs
|
|
22
|
-
* Static analysis, inspection, and repo exploration
|
|
23
|
-
* Dry-run style commands when they do not edit repo-tracked files
|
|
24
|
-
* Tests, builds, or checks that may write to caches or build artifacts (for example, \`target/\`, \`.cache/\`, or snapshots) so long as they do not edit repo-tracked files
|
|
25
|
-
|
|
26
|
-
### Not allowed (mutating, plan-executing)
|
|
27
|
-
|
|
28
|
-
Actions that implement the plan or change repo-tracked state. Examples:
|
|
29
|
-
|
|
30
|
-
* Editing or writing files
|
|
31
|
-
* Running formatters or linters that rewrite files
|
|
32
|
-
* Applying patches, migrations, or codegen that updates repo-tracked files
|
|
33
|
-
* Side-effectful commands whose purpose is to carry out the plan rather than refine it
|
|
34
|
-
|
|
35
|
-
When in doubt: if the action would reasonably be described as "doing the work" rather than "planning the work," do not do it.
|
|
36
|
-
|
|
37
|
-
## Research tracking
|
|
38
|
-
|
|
39
|
-
Track your discoveries, open questions, and resolved questions as you explore. Note \`file:line\` references for important findings so the final plan can anchor every change to a concrete location in the codebase. This prevents redundant exploration and makes the research trail transparent to the user.
|
|
40
|
-
|
|
41
|
-
## Powerful exploration tools
|
|
42
|
-
|
|
43
|
-
You have access to powerful tools for codebase exploration—use them liberally:
|
|
44
|
-
|
|
45
|
-
* **codebase-researcher subagent**: When you need thorough investigation of a feature, system, or component, launch the codebase-researcher subagent to perform deep exploration. Provide it with a detailed brief and it will comprehensively investigate the codebase, returning findings that you can synthesize into your plan.
|
|
46
|
-
|
|
47
|
-
For complex tasks, consider launching the codebase-researcher in parallel while you explore other areas using Grep and Glob, then synthesizing findings into your plan.
|
|
48
|
-
|
|
49
|
-
## PHASE 1 — Ground in the environment (explore first, ask second)
|
|
50
|
-
|
|
51
|
-
Begin by grounding yourself in the actual environment. Eliminate unknowns in the prompt by discovering facts, not by asking the user. Resolve all questions that can be answered through exploration or inspection. Identify missing or ambiguous details only if they cannot be derived from the environment. Silent exploration between turns is allowed and encouraged.
|
|
52
|
-
|
|
53
|
-
Before asking the user any question, perform at least one targeted non-mutating exploration pass (for example: search relevant files, inspect likely entrypoints/configs, confirm current implementation shape), unless no local environment/repo is available.
|
|
54
|
-
|
|
55
|
-
Exception: you may ask clarifying questions about the user's prompt before exploring, ONLY if there are obvious ambiguities or contradictions in the prompt itself. However, if ambiguity might be resolved by exploring, always prefer exploring first.
|
|
56
|
-
|
|
57
|
-
Do not ask questions that can be answered from the repo or system (for example, "where is this struct?" or "which UI component should we use?" when exploration can make it clear). Only ask once you have exhausted reasonable non-mutating exploration.
|
|
58
|
-
|
|
59
|
-
## PHASE 2 — Intent chat (what they actually want)
|
|
60
|
-
|
|
61
|
-
* Keep asking until you can clearly state: goal + success criteria, audience, in/out of scope, constraints, current state, and the key preferences/tradeoffs.
|
|
62
|
-
* Require an explicit **"Out of Scope"** statement — what we are NOT doing. This prevents scope creep and sets clear expectations.
|
|
63
|
-
* Be skeptical: actively challenge vague requirements, identify issues early, and verify assumptions against code rather than accepting them at face value.
|
|
64
|
-
* Bias toward questions over guessing: if any high-impact ambiguity remains, do NOT plan yet—ask.
|
|
65
|
-
|
|
66
|
-
## PHASE 3 — Implementation chat (what/how we’ll build)
|
|
67
|
-
|
|
68
|
-
* Once intent is stable, keep asking until the spec is decision complete: approach, interfaces (APIs/schemas/I/O), data flow, edge cases/failure modes, testing + acceptance criteria, rollout/monitoring, and any migrations/compat constraints.
|
|
69
|
-
* **Propose a plan outline first**: before writing the full detailed plan, present a high-level outline of implementation phases — each with a name and what it accomplishes. Get user feedback on structure before filling in details.
|
|
70
|
-
* **Migration, rollback, and backwards compatibility**: when applicable, give these dedicated attention. They are often the hardest parts of implementation and must not be an afterthought.
|
|
71
|
-
* **Common implementation sequencing** — use these as reference when ordering phases:
|
|
72
|
-
* Database changes: schema/migration → store methods → business logic → API → clients
|
|
73
|
-
* New features: research existing patterns → data model → backend logic → API endpoints → UI
|
|
74
|
-
* Refactoring: document current behavior → plan incremental changes → maintain backwards compatibility → migration strategy
|
|
75
|
-
|
|
76
|
-
## Asking questions
|
|
77
|
-
|
|
78
|
-
Critical rules:
|
|
79
|
-
|
|
80
|
-
* Offer meaningful multiple‑choice options when possible; don’t include filler choices that are obviously wrong or irrelevant.
|
|
81
|
-
|
|
82
|
-
You SHOULD ask many questions, but each question must:
|
|
83
|
-
|
|
84
|
-
* materially change the spec/plan, OR
|
|
85
|
-
* confirm/lock an assumption, OR
|
|
86
|
-
* choose between meaningful tradeoffs.
|
|
87
|
-
* not be answerable by non-mutating commands.
|
|
88
|
-
|
|
89
|
-
## Two kinds of unknowns (treat differently)
|
|
90
|
-
|
|
91
|
-
1. **Discoverable facts** (repo/system truth): explore first.
|
|
92
|
-
|
|
93
|
-
* Before asking, run targeted searches and check likely sources of truth (configs/manifests/entrypoints/schemas/types/constants).
|
|
94
|
-
* Ask only if: multiple plausible candidates; nothing found but you need a missing identifier/context; or ambiguity is actually product intent.
|
|
95
|
-
* If asking, present concrete candidates (paths/service names) + recommend one.
|
|
96
|
-
* Never ask questions you can answer from your environment (e.g., “where is this struct”).
|
|
97
|
-
|
|
98
|
-
2. **Preferences/tradeoffs** (not discoverable): ask early.
|
|
99
|
-
|
|
100
|
-
* These are intent or implementation preferences that cannot be derived from exploration.
|
|
101
|
-
* Provide 2–4 mutually exclusive options + a recommended default.
|
|
102
|
-
* If unanswered, proceed with the recommended option and record it as an assumption in the final plan.
|
|
103
|
-
|
|
104
|
-
## Finalization rule
|
|
105
|
-
|
|
106
|
-
Only output the final plan when it is decision complete and leaves no decisions to the implementer.
|
|
107
|
-
|
|
108
|
-
When you present the official plan, wrap it in a \`<proposed_plan>\` block so the client can render it specially:
|
|
109
|
-
|
|
110
|
-
1) The opening tag must be on its own line.
|
|
111
|
-
2) Start the plan content on the next line (no text on the same line as the tag).
|
|
112
|
-
3) The closing tag must be on its own line.
|
|
113
|
-
4) Use Markdown inside the block.
|
|
114
|
-
5) Keep the tags exactly as \`<proposed_plan>\` and \`</proposed_plan>\` (do not translate or rename them), even if the plan content is in another language.
|
|
115
|
-
|
|
116
|
-
Example:
|
|
117
|
-
|
|
118
|
-
<proposed_plan>
|
|
119
|
-
plan content
|
|
120
|
-
</proposed_plan>
|
|
121
|
-
|
|
122
|
-
plan content should be human and agent digestible. The final plan must be plan-only and include:
|
|
123
|
-
|
|
124
|
-
* A clear title
|
|
125
|
-
* A brief summary section
|
|
126
|
-
* Important changes or additions to public APIs/interfaces/types
|
|
127
|
-
* Specific \`file:line\` references for all code locations the plan touches
|
|
128
|
-
* An explicit **"Out of Scope"** section
|
|
129
|
-
* **Success criteria** separated into two categories:
|
|
130
|
-
* **Automated verification** — commands that can be run (test, lint, typecheck, build) and specific files/code that should exist or compile
|
|
131
|
-
* **Manual verification** — UI/UX functionality, performance under real conditions, hard-to-automate edge cases, user acceptance criteria
|
|
132
|
-
* Migration/rollback strategy when applicable
|
|
133
|
-
* Explicit assumptions and defaults chosen where needed
|
|
134
|
-
|
|
135
|
-
Do not ask "should I proceed?" in the final output. The user can easily switch out of Plan mode and request implementation if you have included a \`<proposed_plan>\` block in your response. Alternatively, they can decide to stay in Plan mode and continue refining the plan.
|
|
136
|
-
|
|
137
|
-
Only produce at most one \`<proposed_plan>\` block per turn, and only when you are presenting a complete spec.
|
|
138
|
-
|
|
139
|
-
## Plan acceptance
|
|
140
|
-
|
|
141
|
-
After presenting a \`<proposed_plan>\` block, explicitly ask the user if they accept the plan. If they accept (e.g., they say "yes", "accept", "go ahead", or similar confirmation), write the plan content to \`plan.md\` in the current working directory using the Write tool. After writing, acknowledge the plan has been saved and ask if they'd like to proceed with implementation or continue refining.
|
|
142
|
-
`;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
interface Subagent {
|
|
2
|
-
name: string;
|
|
3
|
-
description: string;
|
|
4
|
-
model?: string;
|
|
5
|
-
tools?: string[];
|
|
6
|
-
timeout: number;
|
|
7
|
-
systemPrompt: string;
|
|
8
|
-
filePath: string;
|
|
9
|
-
source: string;
|
|
10
|
-
}
|
|
11
|
-
export declare function loadSubagents(): Promise<Subagent[]>;
|
|
12
|
-
export declare function getSubagent(name: string): Promise<Subagent | undefined>;
|
|
13
|
-
export declare function formatSubagentsForDescription(subagents: Subagent[]): string;
|
|
14
|
-
export declare function formatSubagentsForPrompt(subagents: Subagent[]): string;
|
|
15
|
-
export {};
|
|
16
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/subagents/index.ts"],"names":[],"mappings":"AAeA,UAAU,QAAQ;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB;AAkND,wBAAsB,aAAa,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC,CAgBzD;AAED,wBAAsB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,GAAG,SAAS,CAAC,CAG7E;AAED,wBAAgB,6BAA6B,CAAC,SAAS,EAAE,QAAQ,EAAE,GAAG,MAAM,CAa3E;AAED,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,QAAQ,EAAE,GAAG,MAAM,CA6CtE"}
|
package/dist/subagents/index.js
DELETED
|
@@ -1,231 +0,0 @@
|
|
|
1
|
-
import { readdir, readFile, stat } from "node:fs/promises";
|
|
2
|
-
import { homedir } from "node:os";
|
|
3
|
-
import { join, resolve } from "node:path";
|
|
4
|
-
import { logger } from "../utils/logger.js";
|
|
5
|
-
import { parseFrontMatter } from "../utils/yaml.js";
|
|
6
|
-
const CONFIG_DIR_NAME = ".acai";
|
|
7
|
-
const DEFAULT_TIMEOUT = 900;
|
|
8
|
-
// Validation functions
|
|
9
|
-
function validateSubagentName(name, fileName) {
|
|
10
|
-
// Check required field
|
|
11
|
-
if (!name) {
|
|
12
|
-
return { valid: false, error: "Name field is required" };
|
|
13
|
-
}
|
|
14
|
-
// Check length (1-64 characters)
|
|
15
|
-
if (name.length < 1 || name.length > 64) {
|
|
16
|
-
return { valid: false, error: "Name must be 1-64 characters long" };
|
|
17
|
-
}
|
|
18
|
-
// Check allowed characters (lowercase letters, numbers, hyphens)
|
|
19
|
-
if (!/^[a-z0-9-]+$/.test(name)) {
|
|
20
|
-
return {
|
|
21
|
-
valid: false,
|
|
22
|
-
error: "Name can only contain lowercase letters, numbers, and hyphens",
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
// Check no leading or trailing hyphens
|
|
26
|
-
if (name.startsWith("-") || name.endsWith("-")) {
|
|
27
|
-
return { valid: false, error: "Name cannot start or end with a hyphen" };
|
|
28
|
-
}
|
|
29
|
-
// Check no consecutive hyphens
|
|
30
|
-
if (name.includes("--")) {
|
|
31
|
-
return { valid: false, error: "Name cannot contain consecutive hyphens" };
|
|
32
|
-
}
|
|
33
|
-
// Check matches filename (without .md)
|
|
34
|
-
const expectedName = fileName.replace(/\.md$/, "");
|
|
35
|
-
if (name !== expectedName) {
|
|
36
|
-
return {
|
|
37
|
-
valid: false,
|
|
38
|
-
error: `Name "${name}" must match filename "${fileName}" (without .md)`,
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
return { valid: true };
|
|
42
|
-
}
|
|
43
|
-
function validateSubagentDescription(description) {
|
|
44
|
-
// Check required field
|
|
45
|
-
if (!description) {
|
|
46
|
-
return { valid: false, error: "Description field is required" };
|
|
47
|
-
}
|
|
48
|
-
// Check length (1-1024 characters)
|
|
49
|
-
if (description.length < 1 || description.length > 1024) {
|
|
50
|
-
return {
|
|
51
|
-
valid: false,
|
|
52
|
-
error: "Description must be 1-1024 characters long",
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
return { valid: true };
|
|
56
|
-
}
|
|
57
|
-
function validateSubagentTimeout(timeout) {
|
|
58
|
-
if (timeout === undefined) {
|
|
59
|
-
return { valid: true };
|
|
60
|
-
}
|
|
61
|
-
if (typeof timeout !== "number" || timeout < 1 || timeout > 3600) {
|
|
62
|
-
return {
|
|
63
|
-
valid: false,
|
|
64
|
-
error: "Timeout must be a number between 1 and 3600 seconds",
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
return { valid: true };
|
|
68
|
-
}
|
|
69
|
-
function parseFrontmatter(content) {
|
|
70
|
-
const { data, content: body } = parseFrontMatter(content);
|
|
71
|
-
// Type cast and validate required fields
|
|
72
|
-
const name = data["name"];
|
|
73
|
-
const description = data["description"];
|
|
74
|
-
// Set default empty values for optional fields
|
|
75
|
-
const frontmatter = {
|
|
76
|
-
name: name || "",
|
|
77
|
-
description: description || "",
|
|
78
|
-
model: data["model"] || undefined,
|
|
79
|
-
tools: data["tools"] || undefined,
|
|
80
|
-
timeout: data["timeout"] || undefined,
|
|
81
|
-
};
|
|
82
|
-
return { frontmatter, body };
|
|
83
|
-
}
|
|
84
|
-
async function loadSubagentsFromDir(dir, source) {
|
|
85
|
-
const subagents = [];
|
|
86
|
-
try {
|
|
87
|
-
const entries = await readdir(dir, { withFileTypes: true });
|
|
88
|
-
for (const entry of entries) {
|
|
89
|
-
// Skip hidden files and directories
|
|
90
|
-
if (entry.name.startsWith(".")) {
|
|
91
|
-
continue;
|
|
92
|
-
}
|
|
93
|
-
// Only process .md files
|
|
94
|
-
if (!entry.isFile() || !entry.name.endsWith(".md")) {
|
|
95
|
-
continue;
|
|
96
|
-
}
|
|
97
|
-
const entryPath = join(dir, entry.name);
|
|
98
|
-
// Skip symbolic links to avoid infinite recursion
|
|
99
|
-
try {
|
|
100
|
-
const stats = await stat(entryPath);
|
|
101
|
-
if (stats.isSymbolicLink()) {
|
|
102
|
-
continue;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
catch {
|
|
106
|
-
// If we can't stat, skip it
|
|
107
|
-
continue;
|
|
108
|
-
}
|
|
109
|
-
try {
|
|
110
|
-
const content = await readFile(entryPath, "utf8");
|
|
111
|
-
const { frontmatter, body } = parseFrontmatter(content);
|
|
112
|
-
// Validate required fields
|
|
113
|
-
const nameValidation = validateSubagentName(frontmatter.name, entry.name);
|
|
114
|
-
if (!nameValidation.valid) {
|
|
115
|
-
logger.warn(`Invalid subagent name in ${entryPath}: ${nameValidation.error}`);
|
|
116
|
-
continue;
|
|
117
|
-
}
|
|
118
|
-
const descriptionValidation = validateSubagentDescription(frontmatter.description);
|
|
119
|
-
if (!descriptionValidation.valid) {
|
|
120
|
-
logger.warn(`Invalid subagent description in ${entryPath}: ${descriptionValidation.error}`);
|
|
121
|
-
continue;
|
|
122
|
-
}
|
|
123
|
-
const timeoutValidation = validateSubagentTimeout(frontmatter.timeout);
|
|
124
|
-
if (!timeoutValidation.valid) {
|
|
125
|
-
logger.warn(`Invalid subagent timeout in ${entryPath}: ${timeoutValidation.error}`);
|
|
126
|
-
continue;
|
|
127
|
-
}
|
|
128
|
-
// Parse tools if provided
|
|
129
|
-
let tools;
|
|
130
|
-
if (frontmatter.tools) {
|
|
131
|
-
tools = frontmatter.tools
|
|
132
|
-
.split(",")
|
|
133
|
-
.map((t) => t.trim())
|
|
134
|
-
.filter((t) => t.length > 0);
|
|
135
|
-
}
|
|
136
|
-
subagents.push({
|
|
137
|
-
name: frontmatter.name,
|
|
138
|
-
description: frontmatter.description,
|
|
139
|
-
model: frontmatter.model,
|
|
140
|
-
tools,
|
|
141
|
-
timeout: frontmatter.timeout ?? DEFAULT_TIMEOUT,
|
|
142
|
-
systemPrompt: body,
|
|
143
|
-
filePath: entryPath,
|
|
144
|
-
source,
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
catch (error) {
|
|
148
|
-
logger.warn(error, `Failed to load subagent from ${entryPath}:`);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
catch (error) {
|
|
153
|
-
// Directory doesn't exist or can't be read
|
|
154
|
-
if (error.code !== "ENOENT") {
|
|
155
|
-
logger.error(error, `Error reading subagents directory ${dir}:`);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
return subagents;
|
|
159
|
-
}
|
|
160
|
-
export async function loadSubagents() {
|
|
161
|
-
const subagentMap = new Map();
|
|
162
|
-
// Load from user directory (~/.acai/subagents)
|
|
163
|
-
const userDir = join(homedir(), CONFIG_DIR_NAME, "subagents");
|
|
164
|
-
for (const subagent of await loadSubagentsFromDir(userDir, "user")) {
|
|
165
|
-
subagentMap.set(subagent.name, subagent);
|
|
166
|
-
}
|
|
167
|
-
// Load from project directory (.acai/subagents) - overrides user
|
|
168
|
-
const projectDir = resolve(process.cwd(), CONFIG_DIR_NAME, "subagents");
|
|
169
|
-
for (const subagent of await loadSubagentsFromDir(projectDir, "project")) {
|
|
170
|
-
subagentMap.set(subagent.name, subagent);
|
|
171
|
-
}
|
|
172
|
-
return Array.from(subagentMap.values());
|
|
173
|
-
}
|
|
174
|
-
export async function getSubagent(name) {
|
|
175
|
-
const subagents = await loadSubagents();
|
|
176
|
-
return subagents.find((s) => s.name === name);
|
|
177
|
-
}
|
|
178
|
-
export function formatSubagentsForDescription(subagents) {
|
|
179
|
-
if (subagents.length === 0) {
|
|
180
|
-
return " No subagents available";
|
|
181
|
-
}
|
|
182
|
-
const lines = subagents.map((subagent) => {
|
|
183
|
-
const toolsStr = subagent.tools
|
|
184
|
-
? ` (tools: ${subagent.tools.join(", ")})`
|
|
185
|
-
: "";
|
|
186
|
-
return ` - ${subagent.name}: ${subagent.description}${toolsStr}`;
|
|
187
|
-
});
|
|
188
|
-
return lines.join("\n");
|
|
189
|
-
}
|
|
190
|
-
export function formatSubagentsForPrompt(subagents) {
|
|
191
|
-
if (subagents.length === 0) {
|
|
192
|
-
return "";
|
|
193
|
-
}
|
|
194
|
-
const lines = [
|
|
195
|
-
"## Subagents (Agent Tool)",
|
|
196
|
-
"",
|
|
197
|
-
"Use the Agent tool to delegate complex, multi-step tasks to specialized subagents. Subagents operate autonomously and return a single result.",
|
|
198
|
-
"",
|
|
199
|
-
"**When to use subagents:**",
|
|
200
|
-
"- Deep codebase research or architecture exploration",
|
|
201
|
-
"- Complex multi-file refactoring or implementation tasks",
|
|
202
|
-
"- Writing comprehensive tests across multiple files",
|
|
203
|
-
"- Creating detailed implementation plans",
|
|
204
|
-
"- Tasks requiring investigation across many files",
|
|
205
|
-
"",
|
|
206
|
-
"<available_subagents>",
|
|
207
|
-
];
|
|
208
|
-
for (const subagent of subagents) {
|
|
209
|
-
lines.push("<subagent>");
|
|
210
|
-
lines.push("<name>");
|
|
211
|
-
lines.push(subagent.name);
|
|
212
|
-
lines.push("</name>");
|
|
213
|
-
lines.push("<description>");
|
|
214
|
-
lines.push(subagent.description);
|
|
215
|
-
lines.push("</description>");
|
|
216
|
-
if (subagent.tools && subagent.tools.length > 0) {
|
|
217
|
-
lines.push("<tools>");
|
|
218
|
-
lines.push(subagent.tools.join(", "));
|
|
219
|
-
lines.push("</tools>");
|
|
220
|
-
}
|
|
221
|
-
lines.push("</subagent>");
|
|
222
|
-
}
|
|
223
|
-
lines.push("</available_subagents>");
|
|
224
|
-
lines.push("");
|
|
225
|
-
lines.push("**Usage notes:**");
|
|
226
|
-
lines.push("- Subagents are stateless - provide all context in your prompt");
|
|
227
|
-
lines.push("- Be specific about what information you need returned");
|
|
228
|
-
lines.push("- Use longer timeouts for complex tasks (1800-3600 seconds)");
|
|
229
|
-
lines.push("- Launch multiple subagents concurrently for independent tasks");
|
|
230
|
-
return lines.join("\n");
|
|
231
|
-
}
|
package/dist/terminal/index.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Terminal Interface Module
|
|
3
|
-
*
|
|
4
|
-
* Provides a user interface for interacting with Claude Code in the terminal.
|
|
5
|
-
* Handles input/output, formatting, and display.
|
|
6
|
-
*/
|
|
7
|
-
export { alert, getShell, isInteractive } from "./control.ts";
|
|
8
|
-
export { emphasize, error, hr, info, success, warn } from "./formatting.ts";
|
|
9
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/terminal/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC"}
|
package/dist/terminal/index.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Terminal Interface Module
|
|
3
|
-
*
|
|
4
|
-
* Provides a user interface for interacting with Claude Code in the terminal.
|
|
5
|
-
* Handles input/output, formatting, and display.
|
|
6
|
-
*/
|
|
7
|
-
export { alert, getShell, isInteractive } from "./control.js";
|
|
8
|
-
export { emphasize, error, hr, info, success, warn } from "./formatting.js";
|
package/dist/tools/agent.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import type { WorkspaceContext } from "../index.ts";
|
|
3
|
-
import type { ToolExecutionOptions } from "./types.ts";
|
|
4
|
-
export declare const AgentTool: {
|
|
5
|
-
name: "Agent";
|
|
6
|
-
};
|
|
7
|
-
declare const inputSchema: z.ZodObject<{
|
|
8
|
-
prompt: z.ZodString;
|
|
9
|
-
type: z.ZodString;
|
|
10
|
-
timeout: z.ZodOptional<z.ZodNumber>;
|
|
11
|
-
}, z.core.$strip>;
|
|
12
|
-
export declare const createAgentTools: (options: {
|
|
13
|
-
workspace: WorkspaceContext;
|
|
14
|
-
}) => Promise<{
|
|
15
|
-
toolDef: {
|
|
16
|
-
description: string;
|
|
17
|
-
inputSchema: z.ZodObject<{
|
|
18
|
-
prompt: z.ZodString;
|
|
19
|
-
type: z.ZodString;
|
|
20
|
-
timeout: z.ZodOptional<z.ZodNumber>;
|
|
21
|
-
}, z.core.$strip>;
|
|
22
|
-
};
|
|
23
|
-
display: ({ prompt, type }: z.infer<typeof inputSchema>) => string;
|
|
24
|
-
execute: ({ prompt, type, timeout }: z.infer<typeof inputSchema>, { abortSignal }: ToolExecutionOptions) => Promise<string>;
|
|
25
|
-
}>;
|
|
26
|
-
export {};
|
|
27
|
-
//# sourceMappingURL=agent.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../source/tools/agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAKpD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAEvD,eAAO,MAAM,SAAS;;CAErB,CAAC;AAMF,QAAA,MAAM,WAAW;;;;iBAOf,CAAC;AAsBH,eAAO,MAAM,gBAAgB,GAAU,SAAS;IAC9C,SAAS,EAAE,gBAAgB,CAAC;CAC7B;;;;;;;;;gCAQoC,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC;yCAIjC,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,mBACrC,oBAAoB,KACpC,OAAO,CAAC,MAAM,CAAC;EAkDnB,CAAC"}
|
package/dist/tools/agent.js
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { SubAgent } from "../agent/sub-agent.js";
|
|
3
|
-
import { isSupportedModel } from "../models/providers.js";
|
|
4
|
-
import { environmentInfo } from "../prompts/system-prompt.js";
|
|
5
|
-
import { getSubagent, loadSubagents } from "../subagents/index.js";
|
|
6
|
-
import style from "../terminal/style.js";
|
|
7
|
-
export const AgentTool = {
|
|
8
|
-
name: "Agent",
|
|
9
|
-
};
|
|
10
|
-
async function getToolDescription() {
|
|
11
|
-
return "Delegate a task to a specialized subagent.";
|
|
12
|
-
}
|
|
13
|
-
const inputSchema = z.object({
|
|
14
|
-
prompt: z.string().describe("The task for the agent to perform"),
|
|
15
|
-
type: z.string().describe("The subagent type to use (matches subagent name)"),
|
|
16
|
-
timeout: z
|
|
17
|
-
.number()
|
|
18
|
-
.optional()
|
|
19
|
-
.describe("Override default timeout in seconds"),
|
|
20
|
-
});
|
|
21
|
-
async function loadSubAgentDefinition(type) {
|
|
22
|
-
const subagent = await getSubagent(type);
|
|
23
|
-
if (!subagent) {
|
|
24
|
-
const available = await loadSubagents();
|
|
25
|
-
const names = available.map((s) => s.name).join(", ");
|
|
26
|
-
throw new Error(`Unknown subagent type: "${type}". Available: ${names}`);
|
|
27
|
-
}
|
|
28
|
-
return {
|
|
29
|
-
model: subagent.model ?? "",
|
|
30
|
-
system: subagent.systemPrompt,
|
|
31
|
-
tools: subagent.tools,
|
|
32
|
-
timeout: subagent.timeout,
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
export const createAgentTools = async (options) => {
|
|
36
|
-
const description = await getToolDescription();
|
|
37
|
-
const toolDef = {
|
|
38
|
-
description,
|
|
39
|
-
inputSchema,
|
|
40
|
-
};
|
|
41
|
-
function display({ prompt, type }) {
|
|
42
|
-
return `${style.cyan(type)} - ${style.dim(prompt.substring(0, 25))}`;
|
|
43
|
-
}
|
|
44
|
-
async function execute({ prompt, type, timeout }, { abortSignal }) {
|
|
45
|
-
if (abortSignal?.aborted) {
|
|
46
|
-
throw new Error("Agent execution aborted");
|
|
47
|
-
}
|
|
48
|
-
const { model, system, tools, timeout: defaultTimeout, } = await loadSubAgentDefinition(type);
|
|
49
|
-
const systemPrompt = `${system}
|
|
50
|
-
|
|
51
|
-
${await environmentInfo(options.workspace.primaryDir, options.workspace.allowedDirs)}`;
|
|
52
|
-
const subagent = new SubAgent({ workspace: options.workspace });
|
|
53
|
-
const effectiveTimeout = timeout ?? defaultTimeout;
|
|
54
|
-
try {
|
|
55
|
-
const result = await subagent.execute({
|
|
56
|
-
model: isSupportedModel(model) ? model : "opencode:minimax-m2.5",
|
|
57
|
-
system: systemPrompt,
|
|
58
|
-
prompt,
|
|
59
|
-
abortSignal,
|
|
60
|
-
allowedTools: tools,
|
|
61
|
-
timeout: effectiveTimeout,
|
|
62
|
-
});
|
|
63
|
-
return result;
|
|
64
|
-
}
|
|
65
|
-
catch (error) {
|
|
66
|
-
const err = error;
|
|
67
|
-
const message = err.message || "Unknown error";
|
|
68
|
-
if (message.includes("timed out") ||
|
|
69
|
-
err.name === "AbortError" ||
|
|
70
|
-
err.name === "TimeoutError") {
|
|
71
|
-
return `Agent failed: ${message}. The timeout was ${effectiveTimeout} seconds. Consider increasing the timeout or breaking the task into smaller subtasks.`;
|
|
72
|
-
}
|
|
73
|
-
return `Agent failed: ${message}`;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
return {
|
|
77
|
-
toolDef,
|
|
78
|
-
display,
|
|
79
|
-
execute,
|
|
80
|
-
};
|
|
81
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import type { WorkspaceContext } from "../index.ts";
|
|
3
|
-
import type { ToolExecutionOptions } from "./types.ts";
|
|
4
|
-
export declare const DirectoryTreeTool: {
|
|
5
|
-
name: "DirectoryTree";
|
|
6
|
-
};
|
|
7
|
-
declare const inputSchema: z.ZodObject<{
|
|
8
|
-
path: z.ZodString;
|
|
9
|
-
maxResults: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
10
|
-
maxDepth: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
11
|
-
}, z.core.$strip>;
|
|
12
|
-
type DirectoryTreeInputSchema = z.infer<typeof inputSchema>;
|
|
13
|
-
export declare const createDirectoryTreeTool: (options: {
|
|
14
|
-
workspace: WorkspaceContext;
|
|
15
|
-
}) => Promise<{
|
|
16
|
-
toolDef: {
|
|
17
|
-
description: string;
|
|
18
|
-
inputSchema: z.ZodObject<{
|
|
19
|
-
path: z.ZodString;
|
|
20
|
-
maxResults: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
21
|
-
maxDepth: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
22
|
-
}, z.core.$strip>;
|
|
23
|
-
};
|
|
24
|
-
display({ path, maxDepth, maxResults }: DirectoryTreeInputSchema): string;
|
|
25
|
-
execute({ path, maxResults, maxDepth }: DirectoryTreeInputSchema, { abortSignal }: ToolExecutionOptions): Promise<string>;
|
|
26
|
-
}>;
|
|
27
|
-
export {};
|
|
28
|
-
//# sourceMappingURL=directory-tree.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"directory-tree.d.ts","sourceRoot":"","sources":["../../source/tools/directory-tree.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAMpD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAKvD,eAAO,MAAM,iBAAiB;;CAE7B,CAAC;AAEF,QAAA,MAAM,WAAW;;;;iBAYf,CAAC;AAEH,KAAK,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAE5D,eAAO,MAAM,uBAAuB,GAAU,SAAS;IACrD,SAAS,EAAE,gBAAgB,CAAC;CAC7B;;;;;;;;;4CAS2C,wBAAwB;4CAY9B,wBAAwB,mBACvC,oBAAoB,GACpC,OAAO,CAAC,MAAM,CAAC;EAyBrB,CAAC"}
|