strands-darwin 0.0.34 → 0.0.36
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 +22 -3
- package/README.zh-CN.md +22 -3
- package/dist/patches/@strands-agents+sdk+1.16.0.patch +29 -15
- package/dist/patches/ink+7.1.1.patch +58 -0
- package/dist/src/agent/background-delegation.d.ts +3 -3
- package/dist/src/agent/background-delegation.js +2 -2
- package/dist/src/agent/background-delegation.js.map +1 -1
- package/dist/src/agent/context-breakdown.d.ts +2 -1
- package/dist/src/agent/context-breakdown.js +2 -1
- package/dist/src/agent/context-breakdown.js.map +1 -1
- package/dist/src/agent/instructions.d.ts +22 -3
- package/dist/src/agent/instructions.js +67 -34
- package/dist/src/agent/instructions.js.map +1 -1
- package/dist/src/agent/prompt-cache.js +15 -2
- package/dist/src/agent/prompt-cache.js.map +1 -1
- package/dist/src/agent/refusal.d.ts +44 -7
- package/dist/src/agent/refusal.js +54 -8
- package/dist/src/agent/refusal.js.map +1 -1
- package/dist/src/agent/rewind.d.ts +2 -0
- package/dist/src/agent/rewind.js +4 -1
- package/dist/src/agent/rewind.js.map +1 -1
- package/dist/src/agent/runtime.d.ts +86 -13
- package/dist/src/agent/runtime.js +250 -43
- package/dist/src/agent/runtime.js.map +1 -1
- package/dist/src/agent/session.d.ts +96 -4
- package/dist/src/agent/session.js +249 -9
- package/dist/src/agent/session.js.map +1 -1
- package/dist/src/agent/stream-idle.d.ts +16 -0
- package/dist/src/agent/stream-idle.js +127 -0
- package/dist/src/agent/stream-idle.js.map +1 -0
- package/dist/src/agent/stream-resumption.d.ts +5 -2
- package/dist/src/agent/stream-resumption.js +5 -2
- package/dist/src/agent/stream-resumption.js.map +1 -1
- package/dist/src/agent/system-prompt.d.ts +1 -1
- package/dist/src/agent/system-prompt.js +4 -1
- package/dist/src/agent/system-prompt.js.map +1 -1
- package/dist/src/agent/thinking.js +4 -2
- package/dist/src/agent/thinking.js.map +1 -1
- package/dist/src/agent/working-context.d.ts +21 -1
- package/dist/src/agent/working-context.js +28 -1
- package/dist/src/agent/working-context.js.map +1 -1
- package/dist/src/agent/workspace-trust.d.ts +112 -0
- package/dist/src/agent/workspace-trust.js +207 -0
- package/dist/src/agent/workspace-trust.js.map +1 -0
- package/dist/src/agentcore/auto-policy.d.ts +7 -0
- package/dist/src/agentcore/auto-policy.js +50 -0
- package/dist/src/agentcore/auto-policy.js.map +1 -0
- package/dist/src/agentcore/auto-state.d.ts +43 -0
- package/dist/src/agentcore/auto-state.js +73 -0
- package/dist/src/agentcore/auto-state.js.map +1 -0
- package/dist/src/agentcore/cli.d.ts +2 -0
- package/dist/src/agentcore/cli.js +38 -0
- package/dist/src/agentcore/cli.js.map +1 -0
- package/dist/src/agentcore/config.d.ts +48 -0
- package/dist/src/agentcore/config.js +44 -0
- package/dist/src/agentcore/config.js.map +1 -0
- package/dist/src/agentcore/controller.d.ts +105 -0
- package/dist/src/agentcore/controller.js +979 -0
- package/dist/src/agentcore/controller.js.map +1 -0
- package/dist/src/agentcore/projection.d.ts +2 -0
- package/dist/src/agentcore/projection.js +8 -0
- package/dist/src/agentcore/projection.js.map +1 -0
- package/dist/src/agentcore/records.d.ts +41 -0
- package/dist/src/agentcore/records.js +149 -0
- package/dist/src/agentcore/records.js.map +1 -0
- package/dist/src/agentcore/state.d.ts +16 -0
- package/dist/src/agentcore/state.js +149 -0
- package/dist/src/agentcore/state.js.map +1 -0
- package/dist/src/agentcore/tools.d.ts +3 -0
- package/dist/src/agentcore/tools.js +11 -0
- package/dist/src/agentcore/tools.js.map +1 -0
- package/dist/src/agentcore/transport.d.ts +37 -0
- package/dist/src/agentcore/transport.js +242 -0
- package/dist/src/agentcore/transport.js.map +1 -0
- package/dist/src/agentcore/upload-projection.d.ts +208 -0
- package/dist/src/agentcore/upload-projection.js +823 -0
- package/dist/src/agentcore/upload-projection.js.map +1 -0
- package/dist/src/agents/child-recipe.js +4 -1
- package/dist/src/agents/child-recipe.js.map +1 -1
- package/dist/src/agents/loader.d.ts +12 -0
- package/dist/src/agents/loader.js +15 -1
- package/dist/src/agents/loader.js.map +1 -1
- package/dist/src/agents/subagent-tool.js +6 -7
- package/dist/src/agents/subagent-tool.js.map +1 -1
- package/dist/src/agents/workflow-tool.js +4 -6
- package/dist/src/agents/workflow-tool.js.map +1 -1
- package/dist/src/cli-doctor.js +14 -5
- package/dist/src/cli-doctor.js.map +1 -1
- package/dist/src/cli-import.d.ts +1 -0
- package/dist/src/cli-import.js +26 -0
- package/dist/src/cli-import.js.map +1 -0
- package/dist/src/cli-main.js +60 -10
- package/dist/src/cli-main.js.map +1 -1
- package/dist/src/cli-permissions.d.ts +2 -0
- package/dist/src/cli-permissions.js +20 -0
- package/dist/src/cli-permissions.js.map +1 -0
- package/dist/src/cli-sessions.js +6 -2
- package/dist/src/cli-sessions.js.map +1 -1
- package/dist/src/cli-usage.d.ts +9 -1
- package/dist/src/cli-usage.js +13 -0
- package/dist/src/cli-usage.js.map +1 -1
- package/dist/src/cli.js +19 -2
- package/dist/src/cli.js.map +1 -1
- package/dist/src/commands/custom-commands.d.ts +1 -1
- package/dist/src/commands/custom-commands.js +20 -6
- package/dist/src/commands/custom-commands.js.map +1 -1
- package/dist/src/commands/init-command.d.ts +47 -0
- package/dist/src/commands/init-command.js +110 -0
- package/dist/src/commands/init-command.js.map +1 -0
- package/dist/src/commands/review-command.d.ts +10 -0
- package/dist/src/commands/review-command.js +28 -0
- package/dist/src/commands/review-command.js.map +1 -0
- package/dist/src/config-file.d.ts +9 -0
- package/dist/src/config-file.js +82 -0
- package/dist/src/config-file.js.map +1 -0
- package/dist/src/config.d.ts +100 -7
- package/dist/src/config.js +253 -46
- package/dist/src/config.js.map +1 -1
- package/dist/src/dev-repl.js +33 -2
- package/dist/src/dev-repl.js.map +1 -1
- package/dist/src/headless-protocol.d.ts +24 -1
- package/dist/src/headless-protocol.js +24 -5
- package/dist/src/headless-protocol.js.map +1 -1
- package/dist/src/headless-runner.d.ts +8 -0
- package/dist/src/headless-runner.js +42 -2
- package/dist/src/headless-runner.js.map +1 -1
- package/dist/src/headless.d.ts +11 -0
- package/dist/src/headless.js +33 -7
- package/dist/src/headless.js.map +1 -1
- package/dist/src/hooks/hook-process.js +7 -2
- package/dist/src/hooks/hook-process.js.map +1 -1
- package/dist/src/hooks/lifecycle-hooks.js +3 -1
- package/dist/src/hooks/lifecycle-hooks.js.map +1 -1
- package/dist/src/hooks/tool-hooks.js +3 -1
- package/dist/src/hooks/tool-hooks.js.map +1 -1
- package/dist/src/import-claude-files.d.ts +28 -0
- package/dist/src/import-claude-files.js +227 -0
- package/dist/src/import-claude-files.js.map +1 -0
- package/dist/src/import-claude-snippets.d.ts +2 -0
- package/dist/src/import-claude-snippets.js +105 -0
- package/dist/src/import-claude-snippets.js.map +1 -0
- package/dist/src/import-claude.d.ts +13 -0
- package/dist/src/import-claude.js +287 -0
- package/dist/src/import-claude.js.map +1 -0
- package/dist/src/mcp/registry.d.ts +57 -1
- package/dist/src/mcp/registry.js +78 -6
- package/dist/src/mcp/registry.js.map +1 -1
- package/dist/src/memory/command.d.ts +1 -1
- package/dist/src/memory/command.js +89 -4
- package/dist/src/memory/command.js.map +1 -1
- package/dist/src/memory/controller.d.ts +32 -0
- package/dist/src/memory/controller.js +39 -3
- package/dist/src/memory/controller.js.map +1 -1
- package/dist/src/memory/state.d.ts +6 -0
- package/dist/src/memory/state.js +6 -1
- package/dist/src/memory/state.js.map +1 -1
- package/dist/src/memory/store.d.ts +13 -0
- package/dist/src/memory/store.js +38 -2
- package/dist/src/memory/store.js.map +1 -1
- package/dist/src/memory/tools.d.ts +7 -0
- package/dist/src/memory/tools.js +12 -1
- package/dist/src/memory/tools.js.map +1 -1
- package/dist/src/paths.js +3 -0
- package/dist/src/paths.js.map +1 -1
- package/dist/src/permissions-test.d.ts +18 -0
- package/dist/src/permissions-test.js +207 -0
- package/dist/src/permissions-test.js.map +1 -0
- package/dist/src/pricing/model-prices.d.ts +11 -6
- package/dist/src/pricing/model-prices.js +37 -16
- package/dist/src/pricing/model-prices.js.map +1 -1
- package/dist/src/project-identity.d.ts +3 -0
- package/dist/src/project-identity.js +8 -0
- package/dist/src/project-identity.js.map +1 -0
- package/dist/src/project-overrides.d.ts +57 -0
- package/dist/src/project-overrides.js +79 -0
- package/dist/src/project-overrides.js.map +1 -0
- package/dist/src/skills/builtin/setup-agentcore-memory/SKILL.md +158 -0
- package/dist/src/skills/loader.d.ts +1 -1
- package/dist/src/skills/loader.js +4 -1
- package/dist/src/skills/loader.js.map +1 -1
- package/dist/src/tools/background-bash.d.ts +21 -3
- package/dist/src/tools/background-bash.js +44 -8
- package/dist/src/tools/background-bash.js.map +1 -1
- package/dist/src/tools/file-editor-serial.d.ts +14 -0
- package/dist/src/tools/file-editor-serial.js +15 -0
- package/dist/src/tools/file-editor-serial.js.map +1 -1
- package/dist/src/tools/shell-env.d.ts +101 -0
- package/dist/src/tools/shell-env.js +173 -0
- package/dist/src/tools/shell-env.js.map +1 -0
- package/dist/src/trajectory/reader.d.ts +1 -1
- package/dist/src/trajectory/reader.js +23 -3
- package/dist/src/trajectory/reader.js.map +1 -1
- package/dist/src/trajectory/replay.js +23 -0
- package/dist/src/trajectory/replay.js.map +1 -1
- package/dist/src/trajectory/resume-recap.d.ts +11 -1
- package/dist/src/trajectory/resume-recap.js +10 -1
- package/dist/src/trajectory/resume-recap.js.map +1 -1
- package/dist/src/trajectory/rewind-history.d.ts +8 -0
- package/dist/src/trajectory/rewind-history.js +81 -0
- package/dist/src/trajectory/rewind-history.js.map +1 -0
- package/dist/src/trajectory/writer.d.ts +44 -3
- package/dist/src/trajectory/writer.js +80 -14
- package/dist/src/trajectory/writer.js.map +1 -1
- package/dist/src/tui/App.d.ts +8 -1
- package/dist/src/tui/App.js +453 -75
- package/dist/src/tui/App.js.map +1 -1
- package/dist/src/tui/InputBox.d.ts +1 -1
- package/dist/src/tui/InputBox.js +1 -1
- package/dist/src/tui/MessageList.js +1 -1
- package/dist/src/tui/MessageList.js.map +1 -1
- package/dist/src/tui/PermissionPrompt.js +5 -3
- package/dist/src/tui/PermissionPrompt.js.map +1 -1
- package/dist/src/tui/QueuedMessages.js +14 -8
- package/dist/src/tui/QueuedMessages.js.map +1 -1
- package/dist/src/tui/ToolCallPanel.js +2 -2
- package/dist/src/tui/ToolCallPanel.js.map +1 -1
- package/dist/src/tui/WorkspaceTrustPrompt.d.ts +8 -0
- package/dist/src/tui/WorkspaceTrustPrompt.js +37 -0
- package/dist/src/tui/WorkspaceTrustPrompt.js.map +1 -0
- package/dist/src/tui/draft-stash.d.ts +25 -0
- package/dist/src/tui/draft-stash.js +49 -0
- package/dist/src/tui/draft-stash.js.map +1 -0
- package/dist/src/tui/frame-budget.d.ts +2 -2
- package/dist/src/tui/frame-budget.js +3 -3
- package/dist/src/tui/frame-budget.js.map +1 -1
- package/dist/src/tui/help-format.d.ts +2 -2
- package/dist/src/tui/help-format.js +3 -3
- package/dist/src/tui/help-format.js.map +1 -1
- package/dist/src/tui/instructions-format.d.ts +14 -0
- package/dist/src/tui/instructions-format.js +24 -0
- package/dist/src/tui/instructions-format.js.map +1 -0
- package/dist/src/tui/mcp-format.d.ts +9 -0
- package/dist/src/tui/mcp-format.js +5 -3
- package/dist/src/tui/mcp-format.js.map +1 -1
- package/dist/src/tui/permission-rule-preview.d.ts +23 -0
- package/dist/src/tui/permission-rule-preview.js +38 -0
- package/dist/src/tui/permission-rule-preview.js.map +1 -0
- package/dist/src/tui/prompt-editor.d.ts +12 -0
- package/dist/src/tui/prompt-editor.js +38 -28
- package/dist/src/tui/prompt-editor.js.map +1 -1
- package/dist/src/tui/prompt-history-search.js +3 -2
- package/dist/src/tui/prompt-history-search.js.map +1 -1
- package/dist/src/tui/prompt-queue.d.ts +4 -2
- package/dist/src/tui/prompt-queue.js +22 -5
- package/dist/src/tui/prompt-queue.js.map +1 -1
- package/dist/src/tui/rewind-search.js +4 -3
- package/dist/src/tui/rewind-search.js.map +1 -1
- package/dist/src/tui/search-preview.d.ts +2 -0
- package/dist/src/tui/search-preview.js +9 -0
- package/dist/src/tui/search-preview.js.map +1 -0
- package/dist/src/tui/shell-command.js +4 -1
- package/dist/src/tui/shell-command.js.map +1 -1
- package/dist/src/tui/spinner.d.ts +1 -0
- package/dist/src/tui/spinner.js +6 -0
- package/dist/src/tui/spinner.js.map +1 -0
- package/dist/src/tui/status-format.d.ts +24 -0
- package/dist/src/tui/status-format.js +62 -2
- package/dist/src/tui/status-format.js.map +1 -1
- package/dist/src/tui/subagent-format.js +6 -0
- package/dist/src/tui/subagent-format.js.map +1 -1
- package/dist/src/tui/tangent.d.ts +122 -0
- package/dist/src/tui/tangent.js +153 -0
- package/dist/src/tui/tangent.js.map +1 -0
- package/dist/src/tui/task-format.d.ts +5 -0
- package/dist/src/tui/task-format.js +15 -0
- package/dist/src/tui/task-format.js.map +1 -1
- package/dist/src/tui/trust-format.d.ts +31 -0
- package/dist/src/tui/trust-format.js +102 -0
- package/dist/src/tui/trust-format.js.map +1 -0
- package/dist/src/tui/turn-state.d.ts +13 -1
- package/dist/src/tui/turn-state.js +13 -0
- package/dist/src/tui/turn-state.js.map +1 -1
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -34,12 +34,16 @@ unfinished backlog, or one weighted research-path draw
|
|
|
34
34
|
|
|
35
35
|
This is a bounded workflow, not autonomous product authority. A dirty or unverifiable starting point, repeated acceptance failure, a falsified premise, or a product/safety decision only a person can make stops the batch and records the reason. See the [dated research reports](docs/research/) and [self-reflections](docs/reflections/) for the evidence trail.
|
|
36
36
|
|
|
37
|
+
## Bringing an existing setup
|
|
38
|
+
|
|
39
|
+
Run `darwin import --from claude-code` inside the target project to preview a bounded, read-only migration plan. On Linux, add `--apply` to copy supported prompt-only skills, agents and marked `CLAUDE.md` sections; existing content is never silently overwritten. Hooks, MCP, permission policy and trust are never enabled or written. Review the [supported mappings and manual steps](docs/user-guide/extensions.md#import-a-claude-code-setup) before applying; this does not import chats or switch providers.
|
|
40
|
+
|
|
37
41
|
## What it gives you
|
|
38
42
|
|
|
39
43
|
- **A readable Ink TUI:** streaming Markdown answers, proposed file-edit diffs, elapsed time and token spend, slash/path completion, prompt recall and queueing, local `!` commands, and bounded reports.
|
|
40
|
-
- **Safe approval modes:** `default`, classifier-assisted `auto`, read-only `plan`, and explicit `yolo`, with
|
|
44
|
+
- **Safe approval modes:** `default`, classifier-assisted `auto`, read-only `plan`, and explicit `yolo`, with project-scoped allow rules reviewed in full before saving and revocable in-session, plus deny rules that hold in every mode, `yolo` included. A checkout's own hook commands, MCP servers and legacy allow rules stay held until you accept one [workspace-trust](docs/user-guide/permissions.md#workspace-trust) modal listing exactly what they would run; the answer lives outside the repository, and headless runs never ask.
|
|
41
45
|
- **Durable work:** resumable project-scoped sessions, append-only trajectories, replay/search/fork/export, cost records, optional diagnostics, background jobs, and parent-managed on-demand project memory with exact evidence and durable-turn commit.
|
|
42
|
-
- **Extension layers:** built-in and project/global skills, custom commands, child agents with workflow-DAG delegation, tool hooks, and stdio/HTTP MCP servers, with portable `.agents/` discovery.
|
|
46
|
+
- **Extension layers:** built-in and project/global skills, custom commands, child agents with workflow-DAG delegation, tool hooks, and stdio/HTTP MCP servers, with portable `.agents/` discovery. Custom commands replace `$ARGUMENTS`; without it, nonempty trimmed arguments follow the untouched template and two newline characters. See [custom commands](docs/user-guide/extensions.md#custom-commands).
|
|
43
47
|
- **Automation:** one-shot text output or versioned JSON/JSONL, strict session selection, bounded model-call and context-offload controls, and nonzero cancellation/failure exits.
|
|
44
48
|
- **Model choice:** Amazon Bedrock, direct Anthropic, direct OpenAI, and OpenAI-compatible models through Bedrock Mantle; live model and thinking-effort switching.
|
|
45
49
|
|
|
@@ -64,6 +68,8 @@ darwin --resume
|
|
|
64
68
|
darwin --resume <id> # ids: darwin sessions
|
|
65
69
|
darwin --session <id>
|
|
66
70
|
darwin doctor # offline read-only diagnostics: config, MCP, skills, hooks; exit 1 on problems
|
|
71
|
+
darwin permissions test 'bash:pnpm *' # recorded project pairs; no policy changes
|
|
72
|
+
# In the TUI: /permissions test bash:pnpm * (current session only, works while busy)
|
|
67
73
|
darwin --help # usage grammar; darwin --version prints the version
|
|
68
74
|
```
|
|
69
75
|
|
|
@@ -107,14 +113,19 @@ For multiple switchable models, provider-specific fields, Bedrock Mantle, cachin
|
|
|
107
113
|
/developer <requirement>
|
|
108
114
|
/self-evolution-research
|
|
109
115
|
/help local command, prompt, and key reference
|
|
116
|
+
/init ask the model to create or improve this project's AGENTS.md
|
|
117
|
+
/review [focus] review current changes for bugs and test gaps
|
|
110
118
|
/copy copy the last completed answer to the clipboard (OSC 52, works over SSH)
|
|
111
119
|
/rewind branch conversation from a completed prompt (workspace unchanged)
|
|
120
|
+
/tangent bookmark the conversation for a side question; /tangent again returns
|
|
112
121
|
```
|
|
113
122
|
|
|
114
|
-
Use `Ctrl+R` to search this project's prompt history (type to filter, `Ctrl+R`/`Up`/`Down` to navigate, `Enter`/`Tab` to accept, `Escape` to cancel), `Ctrl+C` to cancel busy work, `Ctrl+B` to expand or compact tool details, and `/exit` or `Ctrl+D` to quit. In the composer, `Alt/Ctrl+Left/Right` or `Alt+B`/`Alt+F` moves by word, `Alt+Backspace`/`Alt+D` deletes the word before/after the cursor, and `Ctrl+_` (or `Ctrl+-`) undoes the last `Ctrl+K`/`Ctrl+U`, `Ctrl+W` or `Alt` word deletion. On an empty idle composer, `Esc` `Esc` (the second within 500 ms) opens the `/rewind` chooser — the same thing typing `/rewind` does; a single `Esc` there does nothing. Model tool calls still pass through the active permission mode; `!` commands are commands you authorize by typing them yourself.
|
|
123
|
+
Use `Ctrl+R` to search this project's prompt history (type to filter, `Ctrl+R`/`Up`/`Down` to navigate, `Enter`/`Tab` to accept, `Escape` to cancel), `Ctrl+C` to cancel busy work, `Ctrl+B` to expand or compact tool details, and `/exit` or `Ctrl+D` to quit. In the composer, `Alt/Ctrl+Left/Right` or `Alt+B`/`Alt+F` moves by word, `Alt+Backspace`/`Alt+D` deletes the word before/after the cursor, and `Ctrl+_` (or `Ctrl+-`) undoes the last `Ctrl+K`/`Ctrl+U`, `Ctrl+W` or `Alt` word deletion. `Ctrl+Y` inserts the last cut at the current cursor, repeatably within the same draft, without using the clipboard; [cut/yank limits and reset rules](docs/user-guide/using-darwin.md#prompt-editing-and-completion) apply. `Ctrl+S` parks one unsent draft with its exact cursor and optional image; press it on an empty composer to restore. It never overwrites or sends, survives intervening prompts, and is dropped on session replacement or exit ([stash limits](docs/user-guide/using-darwin.md#draft-stash)). On an empty idle composer, `Esc` `Esc` (the second within 500 ms) opens the `/rewind` chooser — the same thing typing `/rewind` does; a single `Esc` there does nothing. Model tool calls still pass through the active permission mode; `!` commands are commands you authorize by typing them yourself. Every process darwin spawns — the model's `bash` shells and background jobs, your `!` commands, hook commands and stdio MCP servers — sees `DARWIN=1` in its environment (a `DARWIN` you already exported is left as is), so scripts and hooks can tell they run under an agent.
|
|
115
124
|
|
|
116
125
|
To be called back when you have switched away, set `"terminalBell": true` (one BEL) and/or `"terminalNotify": true` (one OSC 9 desktop-notification sequence, shown by iTerm2, kitty, Ghostty, WezTerm and foot, silently ignored elsewhere) in `~/.darwin/config.json`; both fire when a permission prompt waits and when a turn completes, and both are off by default. iTerm2 needs "Send escape sequence-generated alerts" enabled; tmux needs `set -g allow-passthrough on`. Details in [Configuration and context](docs/user-guide/configuration.md).
|
|
117
126
|
|
|
127
|
+
`/review` asks for prioritized, evidence-backed bugs and separate test gaps in staged/unstaged changes and relevant untracked files. An optional focus stays literal text. It asks for no edits or commits unless separately requested, but **does not enforce read-only mode** or change permissions. The built-in now owns `/review`; rename a custom command or skill using that slash name (for example, to `audit`). See [reviewing changes](docs/user-guide/using-darwin.md#reviewing-changes).
|
|
128
|
+
|
|
118
129
|
For non-interactive use:
|
|
119
130
|
|
|
120
131
|
```bash
|
|
@@ -125,6 +136,14 @@ darwin -p "inspect this project" --output-format stream-json
|
|
|
125
136
|
|
|
126
137
|
Read [Using darwin](docs/user-guide/using-darwin.md) for TUI, headless, structured-output, queue, shell, and background-job contracts.
|
|
127
138
|
|
|
139
|
+
Silent parent model streams fail visibly after 120 seconds without an event, with no automatic retry; thinking events reset the allowance. Permission, tool and retry waits are excluded. Root config `streamIdleTimeoutSeconds` changes it (`0` disables); see [scope and cancellation](docs/user-guide/configuration.md#stream-idle-watchdog).
|
|
140
|
+
|
|
141
|
+
## Optional cloud memory
|
|
142
|
+
|
|
143
|
+
AgentCore Memory is default-off and independent of the model provider; existing local project memory is unchanged. It adds gated, parent-only episode/reflection recall, user-confirmed cross-project preferences, and separately enabled **manual preview/send or project-authorized auto upload** of bounded original new-turn tool content, including arbitrary tools/MCP, textual arguments and results. This can include secrets and is **not a confidentiality guarantee**. Memory adoption/upload/deletion controls are user-submitted TUI-only; the standalone cloud-memory CLI is read-only. All assistant prose is omitted from uploads. `/cloud-memory auto` persists consent for this project's new turns only; `/cloud-memory manual` stops unsent automatic work. Defaults: 500 attempts/100 MiB per UTC day, seven-day retention for auto-accepted local bodies, permanent bounded-partition receipts. Root `upload: auto` is not authorization. User-only `discard-legacy` previews a local legacy batch and requires its manifest hash; it never deletes cloud records.
|
|
144
|
+
|
|
145
|
+
Run **`/setup-agentcore-memory`** in the TUI for guided setup. Darwin reads its bundled guide and first checks existing `~/.darwin/config.json` through the permission gate, then uses offline `darwin doctor`, local `darwin cloud-memory status`, and a bounded SDK read via `darwin cloud-memory preferences`. Healthy existing memory needs no repeat setup, actor question or restart; empty records count as a successful read, not proof of extraction/write access. Only missing/disabled setup needs actor/default questions; failed or blocked checks need targeted repair confirmation, never an automatic reset. Arguments do not authorize changes. Prefer a compatible existing Memory; no uploads or preference adoption are authorized by setup. Runtime reads/writes use the pinned official `@aws-sdk/client-bedrock-agentcore` client, not an AWS CLI executable. Legacy `cliPath` is validated but ignored with a migration notice. The optional `agentcore` infrastructure CLI is separate; importing the existing resource remains deferred because its schema/import mapping cannot preserve custom namespace keys/templates. See the [English guide](docs/user-guide/agentcore-memory.md) for exact templates, config, IAM, `/cloud-memory` commands, privacy limits and opt-in synthetic verification. No live Memory service test was run for this implementation.
|
|
146
|
+
|
|
128
147
|
## Documentation
|
|
129
148
|
|
|
130
149
|
- **[User guide](docs/user-guide/README.md):** installation, providers, daily use, configuration, state, safety, extensions, command reference, limitations, and development.
|
package/README.zh-CN.md
CHANGED
|
@@ -34,12 +34,16 @@ darwin 是一项自托管 AI 开发实验。[v0.0.1 基线版本](https://github
|
|
|
34
34
|
|
|
35
35
|
这套流程有明确边界,不代表 darwin 拥有产品决策权。工作树不干净、起点无法验证、验收反复失败、前提被证伪,或遇到只能由人决定的产品/安全问题时,整批工作会停止,并把原因写入记录。证据可查阅[按日期归档的研究报告](docs/research/)和[自省报告](docs/reflections/)。
|
|
36
36
|
|
|
37
|
+
## 迁移已有设置
|
|
38
|
+
|
|
39
|
+
在目标项目内运行 `darwin import --from claude-code`,可只读预览有上限的迁移计划。Linux 上加 `--apply` 后,只复制支持的提示词型 skills、agents,以及带来源标记的 `CLAUDE.md` 段落,不会静默覆盖已有内容,也不会写入或启用 hook、MCP、权限策略或信任记录。执行前请查看[支持的映射与手动步骤](docs/user-guide/extensions.zh-CN.md#迁移-claude-code-设置);此命令不导入聊天,也不切换模型供应商。
|
|
40
|
+
|
|
37
41
|
## 主要能力
|
|
38
42
|
|
|
39
43
|
- **清晰的 Ink TUI:**流式 Markdown 回复、文件修改 diff、耗时与 token 消耗、斜杠命令与路径补全、提示词回看和排队、本地 `!` 命令,以及有长度上限的状态报告。
|
|
40
|
-
- **安全审批模式:**`default`、带分类器的 `auto`、只读 `plan` 和显式开启的 `yolo
|
|
44
|
+
- **安全审批模式:**`default`、带分类器的 `auto`、只读 `plan` 和显式开启的 `yolo`;项目级放行规则保存前须完整预览,并可在会话内撤销;拒绝规则在所有模式下生效,包括 `yolo`。checkout 自带的钩子命令、MCP 服务器和旧式放行规则会一直保留不用,直到你在一个列出它们究竟会运行什么的[工作区信任](docs/user-guide/permissions.zh-CN.md#工作区信任)模态框中接受;答案保存在仓库之外,无头运行从不询问。
|
|
41
45
|
- **可持续的工作状态:**按项目保存的可恢复会话、只追加轨迹、回放/搜索/分叉/导出、费用记录、可选诊断日志、后台任务,以及由父 agent 按需管理、带精确证据并在回合持久化后提交的项目记忆。
|
|
42
|
-
- **扩展机制:**内置及项目/全局 skills、自定义命令、子代理与 workflow DAG 委派、工具 hooks、stdio/HTTP MCP 服务器,并兼容 `.agents/`
|
|
46
|
+
- **扩展机制:**内置及项目/全局 skills、自定义命令、子代理与 workflow DAG 委派、工具 hooks、stdio/HTTP MCP 服务器,并兼容 `.agents/` 目录。自定义命令会替换 `$ARGUMENTS`;若模板没有该占位符,且参数去除首尾空白后非空,则在完整模板后追加两个换行符和参数。详见[自定义命令](docs/user-guide/extensions.zh-CN.md#自定义命令)。
|
|
43
47
|
- **自动化接口:**单次文本输出或带版本的 JSON/JSONL;严格选择会话;可限制模型调用次数和上下文卸载;取消或失败时返回非零状态码。
|
|
44
48
|
- **多模型支持:**Amazon Bedrock、Anthropic 直连、OpenAI 直连,以及通过 Bedrock Mantle 使用 OpenAI 兼容模型;会话中可切换模型和思考强度。
|
|
45
49
|
|
|
@@ -64,6 +68,8 @@ darwin --resume
|
|
|
64
68
|
darwin --resume <id> # 查看 id:darwin sessions
|
|
65
69
|
darwin --session <id>
|
|
66
70
|
darwin doctor # 离线只读诊断:配置、MCP、技能、hook;发现问题时退出码 1
|
|
71
|
+
darwin permissions test 'bash:pnpm *' # 检查项目已记录调用,不改权限
|
|
72
|
+
# TUI:/permissions test bash:pnpm *(仅当前会话,忙碌时也可用)
|
|
67
73
|
darwin --help # 用法语法;darwin --version 打印版本
|
|
68
74
|
```
|
|
69
75
|
|
|
@@ -107,14 +113,19 @@ Bedrock 使用标准 AWS 凭证链。模型 ID 必须是 `us.`、`eu.`、`apac.`
|
|
|
107
113
|
/developer <requirement>
|
|
108
114
|
/self-evolution-research
|
|
109
115
|
/help 查看本地命令、输入语法和按键说明
|
|
116
|
+
/init 请模型为当前项目创建或改进 AGENTS.md
|
|
117
|
+
/review [focus] 审查当前改动中的缺陷和测试缺口
|
|
110
118
|
/copy 把最近一条已完成回答复制到剪贴板(OSC 52,SSH 下可用)
|
|
111
119
|
/rewind 从已完成提示词分支对话(工作区不变)
|
|
120
|
+
/tangent 为一次旁支提问给对话加书签;再输入 /tangent 即返回
|
|
112
121
|
```
|
|
113
122
|
|
|
114
|
-
按 `Ctrl+R` 可搜索当前项目的提示历史(输入文字筛选,按 `Ctrl+R`/`Up`/`Down` 切换结果,按 `Enter`/`Tab` 接受,按 `Escape` 取消);忙碌时按 `Ctrl+C` 取消,按 `Ctrl+B` 展开或收起工具详情,使用 `/exit` 或 `Ctrl+D` 退出。编辑输入时,`Alt/Ctrl+Left/Right` 或 `Alt+B`/`Alt+F` 按词移动光标,`Alt+Backspace`/`Alt+D` 删除光标前/后的一个词,`Ctrl+_`(或 `Ctrl+-`)可撤销最近一次 `Ctrl+K`/`Ctrl+U`、`Ctrl+W` 或 `Alt`
|
|
123
|
+
按 `Ctrl+R` 可搜索当前项目的提示历史(输入文字筛选,按 `Ctrl+R`/`Up`/`Down` 切换结果,按 `Enter`/`Tab` 接受,按 `Escape` 取消);忙碌时按 `Ctrl+C` 取消,按 `Ctrl+B` 展开或收起工具详情,使用 `/exit` 或 `Ctrl+D` 退出。编辑输入时,`Alt/Ctrl+Left/Right` 或 `Alt+B`/`Alt+F` 按词移动光标,`Alt+Backspace`/`Alt+D` 删除光标前/后的一个词,`Ctrl+_`(或 `Ctrl+-`)可撤销最近一次 `Ctrl+K`/`Ctrl+U`、`Ctrl+W` 或 `Alt` 系列的删词操作。`Ctrl+Y` 会在当前光标处插入最近剪下的文本,同一草稿内可重复使用,不经过剪贴板;[剪切恢复的上限与清空规则](docs/user-guide/using-darwin.zh-CN.md#输入编辑与补全)见使用指南。`Ctrl+S` 可暂存一份未提交草稿,保留光标位置和附图;输入框为空时再按一次即可取回。不会覆盖或自动发送,期间可以提交其他问题;切换到新会话或退出时丢弃([草稿暂存规则](docs/user-guide/using-darwin.zh-CN.md#草稿暂存))。输入框为空且空闲时,连按两次 `Esc`(第二次在 500 ms 内)会打开 `/rewind` 选择器,效果与输入 `/rewind` 完全相同;此时单按一次 `Esc` 不做任何事。模型发起的工具调用仍会经过当前审批模式;`!` 命令由你亲自输入,因此不走模型工具审批。darwin 启动的每个进程——模型的 `bash` shell 与后台任务、你的 `!` 命令、hook 命令和 stdio MCP 服务器——环境中都带有 `DARWIN=1`(你已导出的 `DARWIN` 原样保留),脚本和 hook 由此可以判断自己运行在代理之下。
|
|
115
124
|
|
|
116
125
|
想在切到别处时被叫回来,可在 `~/.darwin/config.json` 中设置 `"terminalBell": true`(响一次终端铃)和/或 `"terminalNotify": true`(写一条 OSC 9 桌面通知序列,iTerm2、kitty、Ghostty、WezTerm 和 foot 会弹出通知,其他终端静默忽略);二者都在权限提示等待时和回合结束时触发,默认均为关闭。iTerm2 需开启 "Send escape sequence-generated alerts";tmux 需要 `set -g allow-passthrough on`。详见[配置与上下文](docs/user-guide/configuration.zh-CN.md)。
|
|
117
126
|
|
|
127
|
+
`/review` 请模型检查暂存、未暂存的改动及相关未跟踪文件,按优先级报告有证据的缺陷,并单列测试缺口。可选 focus 保持为字面文本。提示要求未经另行请求不要修改文件或提交,但**不会强制只读,也不改变权限模式**。内置命令现在占用 `/review`;原来使用该斜杠名称的自定义命令或 skill 需要改名,例如 `audit`。详见[审查改动](docs/user-guide/using-darwin.zh-CN.md#审查改动)。
|
|
128
|
+
|
|
118
129
|
无交互运行方式如下:
|
|
119
130
|
|
|
120
131
|
```bash
|
|
@@ -125,6 +136,14 @@ darwin -p "inspect this project" --output-format stream-json
|
|
|
125
136
|
|
|
126
137
|
TUI、无头模式、结构化输出、消息队列、shell 命令和后台任务的完整约定,见[使用 darwin](docs/user-guide/using-darwin.zh-CN.md)。
|
|
127
138
|
|
|
139
|
+
主代理模型流连续 120 秒没有事件时会明确报错,不自动重试;思考事件也会重新计时,权限、工具和重试等待不计入。根级 `streamIdleTimeoutSeconds` 可调整秒数(`0` 关闭);详见[范围与取消语义](docs/user-guide/configuration.zh-CN.md#模型流空闲检测)。
|
|
140
|
+
|
|
141
|
+
## 可选云记忆
|
|
142
|
+
|
|
143
|
+
AgentCore Memory 默认关闭,与模型供应商独立,原有本地项目记忆不变。它提供受权限控制、仅主代理可用的 episode/reflection 检索、用户明确确认的跨项目偏好,以及单独启用的**手动预览、发送或项目授权自动上传**新回合的有界原始工具内容,涵盖任意工具/MCP 的文本参数与结果;其中可能含有秘密,**不保证保密**。偏好采纳、上传和删除控制仅限用户亲自提交的 TUI 命令,独立 cloud-memory CLI 只读。上传省略全部助手文本。`/cloud-memory auto` 仅为当前项目的新回合持久化授权;`/cloud-memory manual` 停止尚未发送的自动任务。默认每 UTC 日 500 次尝试/100 MiB,自动接受的本地请求体保留七天,分区幂等回执长期保留。根级 `upload: auto` 不构成授权。用户命令 `discard-legacy` 先预览本地旧格式批次,再以清单哈希确认,不删除云记录。
|
|
144
|
+
|
|
145
|
+
在 TUI 输入 **`/setup-agentcore-memory`** 开始引导配置。Darwin 会先读取完整指南,通过权限检查只读查看现有 `~/.darwin/config.json`,再运行离线 `darwin doctor`、本地 `darwin cloud-memory status` 和通过 SDK 有界只读检索的 `darwin cloud-memory preferences`。已配置且基本检查通过就无需重复设置、询问 actor 或重启;空记录也算读取成功,但不证明提取或写入权限。只有缺失/禁用后的配置分支才询问 actor 和默认值;检查失败或受阻时请求针对性修复确认,不自动重置。参数不代表修改授权。优先复用兼容资源;启动配置不代表授权上传或采纳偏好。运行时通过固定版本的官方 `@aws-sdk/client-bedrock-agentcore` 读写,不再依赖 AWS CLI 可执行文件。旧 `cliPath` 仍校验格式,但会忽略并提示移除。可选的 `agentcore` CLI 只用于独立的基础设施管理;其 schema/import 尚不能完整保留自定义命名空间键和模板,因此暂不导入现有资源。[中文指南](docs/user-guide/agentcore-memory.zh-CN.md)列出了准确模板、配置、IAM、`/cloud-memory` 命令、隐私边界和可选合成数据验证。本次实现未运行真实 Memory 服务测试。
|
|
146
|
+
|
|
128
147
|
## 文档
|
|
129
148
|
|
|
130
149
|
- **[用户指南](docs/user-guide/README.zh-CN.md):**安装、供应商、日常操作、配置、状态、安全、扩展、命令参考、限制和开发说明。
|
|
@@ -528,10 +528,10 @@ index 69b6549df8bf55b39e34aaf2940cac2a7fbf0714..440965bdc2879f7c2755ace3cda9ab70
|
|
|
528
528
|
//# sourceMappingURL=plugin.js.map
|
|
529
529
|
|
|
530
530
|
diff --git a/node_modules/@strands-agents/sdk/dist/src/vended-tools/bash/bash.d.ts b/node_modules/@strands-agents/sdk/dist/src/vended-tools/bash/bash.d.ts
|
|
531
|
-
index a0a5b0e40e22e6108df5d832e9b1ba051e2f99cd..
|
|
531
|
+
index a0a5b0e40e22e6108df5d832e9b1ba051e2f99cd..aeef5bc02bb459333de75e2c93d97a4bf92ebdf7 100644
|
|
532
532
|
--- a/node_modules/@strands-agents/sdk/dist/src/vended-tools/bash/bash.d.ts
|
|
533
533
|
+++ b/node_modules/@strands-agents/sdk/dist/src/vended-tools/bash/bash.d.ts
|
|
534
|
-
@@ -1,12 +1,
|
|
534
|
+
@@ -1,12 +1,25 @@
|
|
535
535
|
-import type { BashOutput } from './types.js';
|
|
536
536
|
+import type { InvokableTool } from '../../index.js';
|
|
537
537
|
+import type { BashInput, BashOutput } from './types.js';
|
|
@@ -540,6 +540,12 @@ index a0a5b0e40e22e6108df5d832e9b1ba051e2f99cd..8907d109ce2866e376df312ebc0bae1a
|
|
|
540
540
|
+ cwd?: string;
|
|
541
541
|
+ /** Session project root used only for conservative wrong-root path preflight. */
|
|
542
542
|
+ projectRoot?: string;
|
|
543
|
+
+ /**
|
|
544
|
+
+ * Environment for every persistent shell this tool starts (replacements after
|
|
545
|
+
+ * restart/exit included); `PS1`/`PS2` are still cleared on top. Absent means
|
|
546
|
+
+ * `process.env`, byte-identical to the behaviour without the option.
|
|
547
|
+
+ */
|
|
548
|
+
+ env?: Record<string, string>;
|
|
543
549
|
+}
|
|
544
550
|
+/**
|
|
545
551
|
+ * Create a host-only bash tool with configured persistent-shell path context.
|
|
@@ -559,7 +565,7 @@ index a0a5b0e40e22e6108df5d832e9b1ba051e2f99cd..8907d109ce2866e376df312ebc0bae1a
|
|
|
559
565
|
//# sourceMappingURL=bash.d.ts.map
|
|
560
566
|
|
|
561
567
|
diff --git a/node_modules/@strands-agents/sdk/dist/src/vended-tools/bash/bash.js b/node_modules/@strands-agents/sdk/dist/src/vended-tools/bash/bash.js
|
|
562
|
-
index 44fb775853169dab0fde7aee5e7cc275a060de9c..
|
|
568
|
+
index 44fb775853169dab0fde7aee5e7cc275a060de9c..7f3389ddd3e39704bb0ba5728dcf2c113b66efdf 100644
|
|
563
569
|
--- a/node_modules/@strands-agents/sdk/dist/src/vended-tools/bash/bash.js
|
|
564
570
|
+++ b/node_modules/@strands-agents/sdk/dist/src/vended-tools/bash/bash.js
|
|
565
571
|
@@ -1,8 +1,64 @@
|
|
@@ -685,7 +691,7 @@ index 44fb775853169dab0fde7aee5e7cc275a060de9c..b8b3a1f3f9541de7d671e0a5df9261fa
|
|
|
685
691
|
/**
|
|
686
692
|
* Internal class for managing a bash session.
|
|
687
693
|
*/
|
|
688
|
-
@@ -18,9 +125,
|
|
694
|
+
@@ -18,9 +125,25 @@ class BashSession {
|
|
689
695
|
_started = false;
|
|
690
696
|
_timeout;
|
|
691
697
|
_sentinel;
|
|
@@ -696,8 +702,12 @@ index 44fb775853169dab0fde7aee5e7cc275a060de9c..b8b3a1f3f9541de7d671e0a5df9261fa
|
|
|
696
702
|
+ _initialCwd;
|
|
697
703
|
+ _projectRoot;
|
|
698
704
|
+ _cwd;
|
|
699
|
-
+
|
|
705
|
+
+ _env;
|
|
706
|
+
+ constructor(timeout = 120, initialCwd = process.cwd(), projectRoot = null, env = null) {
|
|
700
707
|
this._timeout = timeout;
|
|
708
|
+
+ // The environment every shell this session starts inherits; null keeps the
|
|
709
|
+
+ // process's own, exactly as before the option existed.
|
|
710
|
+
+ this._env = env;
|
|
701
711
|
this._sentinel = `__BASH_DONE_${Date.now()}_${Math.random().toString(36).slice(2)}__`;
|
|
702
712
|
+ this._stderrSentinel = `${this._sentinel}_STDERR`;
|
|
703
713
|
+ this._exitCodeSentinel = `${this._sentinel}_EXIT`;
|
|
@@ -708,7 +718,7 @@ index 44fb775853169dab0fde7aee5e7cc275a060de9c..b8b3a1f3f9541de7d671e0a5df9261fa
|
|
|
708
718
|
}
|
|
709
719
|
/**
|
|
710
720
|
* Starts the bash process if not already started.
|
|
711
|
-
@@ -30,17 +
|
|
721
|
+
@@ -30,17 +153,28 @@ class BashSession {
|
|
712
722
|
return;
|
|
713
723
|
}
|
|
714
724
|
try {
|
|
@@ -716,8 +726,9 @@ index 44fb775853169dab0fde7aee5e7cc275a060de9c..b8b3a1f3f9541de7d671e0a5df9261fa
|
|
|
716
726
|
+ // timed-out foreground child down with it instead of orphaning it to pid 1.
|
|
717
727
|
this._process = spawn('bash', [], {
|
|
718
728
|
- cwd: process.cwd(),
|
|
729
|
+
- env: { ...process.env, PS1: '', PS2: '' },
|
|
719
730
|
+ cwd: this._initialCwd,
|
|
720
|
-
|
|
731
|
+
+ env: { ...(this._env ?? process.env), PS1: '', PS2: '' },
|
|
721
732
|
+ detached: true,
|
|
722
733
|
});
|
|
723
734
|
if (!this._process.stdin || !this._process.stdout || !this._process.stderr) {
|
|
@@ -740,7 +751,7 @@ index 44fb775853169dab0fde7aee5e7cc275a060de9c..b8b3a1f3f9541de7d671e0a5df9261fa
|
|
|
740
751
|
this._process = null;
|
|
741
752
|
this._started = false;
|
|
742
753
|
});
|
|
743
|
-
@@ -54,16 +
|
|
754
|
+
@@ -54,16 +188,43 @@ class BashSession {
|
|
744
755
|
*/
|
|
745
756
|
stop() {
|
|
746
757
|
if (this._process) {
|
|
@@ -787,7 +798,7 @@ index 44fb775853169dab0fde7aee5e7cc275a060de9c..b8b3a1f3f9541de7d671e0a5df9261fa
|
|
|
787
798
|
this.start();
|
|
788
799
|
if (!this._process || !this._process.stdin || !this._process.stdout || !this._process.stderr) {
|
|
789
800
|
throw new BashSessionError('Bash session not properly initialized');
|
|
790
|
-
@@ -72,33 +
|
|
801
|
+
@@ -72,33 +233,90 @@ class BashSession {
|
|
791
802
|
let stdoutData = '';
|
|
792
803
|
let stderrData = '';
|
|
793
804
|
let timeoutHandle = null;
|
|
@@ -888,7 +899,7 @@ index 44fb775853169dab0fde7aee5e7cc275a060de9c..b8b3a1f3f9541de7d671e0a5df9261fa
|
|
|
888
899
|
}
|
|
889
900
|
};
|
|
890
901
|
// Handler for process errors
|
|
891
|
-
@@ -107,13 +
|
|
902
|
+
@@ -107,13 +325,14 @@ class BashSession {
|
|
892
903
|
this.stop();
|
|
893
904
|
reject(new BashSessionError(`Bash process error: ${err.message}`));
|
|
894
905
|
};
|
|
@@ -905,7 +916,7 @@ index 44fb775853169dab0fde7aee5e7cc275a060de9c..b8b3a1f3f9541de7d671e0a5df9261fa
|
|
|
905
916
|
stdout.off('data', onStdoutData);
|
|
906
917
|
stderr.off('data', onStderrData);
|
|
907
918
|
// Check if process still exists before removing listeners
|
|
908
|
-
@@ -122,27 +
|
|
919
|
+
@@ -122,27 +341,77 @@ class BashSession {
|
|
909
920
|
this._process.off('error', onError);
|
|
910
921
|
}
|
|
911
922
|
};
|
|
@@ -987,7 +998,7 @@ index 44fb775853169dab0fde7aee5e7cc275a060de9c..b8b3a1f3f9541de7d671e0a5df9261fa
|
|
|
987
998
|
});
|
|
988
999
|
}
|
|
989
1000
|
}
|
|
990
|
-
@@ -151,6 +
|
|
1001
|
+
@@ -151,6 +420,16 @@ class BashSession {
|
|
991
1002
|
*/
|
|
992
1003
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
993
1004
|
const sessions = new WeakMap();
|
|
@@ -1004,7 +1015,7 @@ index 44fb775853169dab0fde7aee5e7cc275a060de9c..b8b3a1f3f9541de7d671e0a5df9261fa
|
|
|
1004
1015
|
/**
|
|
1005
1016
|
* Track all active sessions for cleanup on process exit.
|
|
1006
1017
|
*/
|
|
1007
|
-
@@ -221,42 +
|
|
1018
|
+
@@ -221,42 +500,53 @@ const DEFAULT_DESCRIPTION = 'Executes bash shell commands in a persistent sessio
|
|
1008
1019
|
* State (variables, working directory) persists within the session.
|
|
1009
1020
|
* Node.js only.
|
|
1010
1021
|
*/
|
|
@@ -1031,6 +1042,9 @@ index 44fb775853169dab0fde7aee5e7cc275a060de9c..b8b3a1f3f9541de7d671e0a5df9261fa
|
|
|
1031
1042
|
+ const initialCwd = path.resolve(options.cwd ?? process.cwd());
|
|
1032
1043
|
+ const projectRoot = options.projectRoot === undefined ? null : path.resolve(options.projectRoot);
|
|
1033
1044
|
+ const reportRestartCwd = options.cwd !== undefined || options.projectRoot !== undefined;
|
|
1045
|
+
+ // Copied once: the caller's map is the environment for every shell this tool
|
|
1046
|
+
+ // starts, including replacements after restart/exit; absent means process.env.
|
|
1047
|
+
+ const env = options.env === undefined ? null : { ...options.env };
|
|
1034
1048
|
+ return tool({
|
|
1035
1049
|
+ name: 'bash',
|
|
1036
1050
|
+ description: DEFAULT_DESCRIPTION,
|
|
@@ -1071,7 +1085,7 @@ index 44fb775853169dab0fde7aee5e7cc275a060de9c..b8b3a1f3f9541de7d671e0a5df9261fa
|
|
|
1071
1085
|
+ sessions.delete(agent);
|
|
1072
1086
|
+ }
|
|
1073
1087
|
+ // Create new session (will be added to activeSessions when started)
|
|
1074
|
-
+ const newSession = new BashSession(120, initialCwd, projectRoot);
|
|
1088
|
+
+ const newSession = new BashSession(120, initialCwd, projectRoot, env);
|
|
1075
1089
|
+ sessions.set(agent, newSession);
|
|
1076
1090
|
+ sessionFinalizer.register(agent, newSession);
|
|
1077
1091
|
+ return reportRestartCwd ? `Bash session restarted\ncwd: ${initialCwd}` : 'Bash session restarted';
|
|
@@ -1080,7 +1094,7 @@ index 44fb775853169dab0fde7aee5e7cc275a060de9c..b8b3a1f3f9541de7d671e0a5df9261fa
|
|
|
1080
1094
|
+ // Get or create session
|
|
1081
1095
|
+ let session = sessions.get(agent);
|
|
1082
1096
|
+ if (!session) {
|
|
1083
|
-
+ session = new BashSession(input.timeout ?? 120, initialCwd, projectRoot);
|
|
1097
|
+
+ session = new BashSession(input.timeout ?? 120, initialCwd, projectRoot, env);
|
|
1084
1098
|
+ sessions.set(agent, session);
|
|
1085
1099
|
+ sessionFinalizer.register(agent, session);
|
|
1086
1100
|
+ }
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
diff --git a/node_modules/ink/build/ink.js b/node_modules/ink/build/ink.js
|
|
2
|
+
index 0082666b281ec2db77b875d6b8460bcc19a59ce7..dd772c834f77096cd3621f83bfa7d0fc0137ea47 100644
|
|
3
|
+
--- a/node_modules/ink/build/ink.js
|
|
4
|
+
+++ b/node_modules/ink/build/ink.js
|
|
5
|
+
@@ -155,6 +155,9 @@ export default class Ink {
|
|
6
|
+
lastOutputToRender;
|
|
7
|
+
lastOutputHeight;
|
|
8
|
+
lastTerminalWidth;
|
|
9
|
+
+ // Set by `resized` when the terminal got narrower: the next interactive frame
|
|
10
|
+
+ // redraws from a cleared screen instead of erasing by the stale line count.
|
|
11
|
+
+ redrawAfterNarrowing;
|
|
12
|
+
container;
|
|
13
|
+
rootNode;
|
|
14
|
+
// This variable is used only in debug mode to store full static output
|
|
15
|
+
@@ -279,8 +282,17 @@ export default class Ink {
|
|
16
|
+
resized = () => {
|
|
17
|
+
const currentWidth = getWindowSize(this.options.stdout).columns;
|
|
18
|
+
if (currentWidth < this.lastTerminalWidth) {
|
|
19
|
+
- // We clear the screen when decreasing terminal width to prevent duplicate overlapping re-renders.
|
|
20
|
+
- this.log.clear();
|
|
21
|
+
+ // A narrower terminal reflows the rows of the previous frame that no
|
|
22
|
+
+ // longer fit, so the frame now occupies more rows than the line count
|
|
23
|
+
+ // `log.clear()` would erase, and the top rows survive as stale copies
|
|
24
|
+
+ // (one per resize event). Redraw the next frame from a cleared screen
|
|
25
|
+
+ // with the full static output, the way overflowing frames already do,
|
|
26
|
+
+ // and drop any throttled write of the pre-resize frame that would
|
|
27
|
+
+ // otherwise land after the redraw.
|
|
28
|
+
+ if (typeof this.throttledLog.cancel === 'function') {
|
|
29
|
+
+ this.throttledLog.cancel();
|
|
30
|
+
+ }
|
|
31
|
+
+ this.redrawAfterNarrowing = true;
|
|
32
|
+
this.lastOutput = '';
|
|
33
|
+
this.lastOutputToRender = '';
|
|
34
|
+
}
|
|
35
|
+
@@ -753,13 +765,16 @@ export default class Ink {
|
|
36
|
+
const viewportRows = isTty ? getWindowSize(this.options.stdout).rows : 24;
|
|
37
|
+
const isFullscreen = isTty && outputHeight >= viewportRows;
|
|
38
|
+
const outputToRender = isFullscreen ? output : output + '\n';
|
|
39
|
+
- const shouldClearTerminal = shouldClearTerminalForFrame({
|
|
40
|
+
- isTty,
|
|
41
|
+
- viewportRows,
|
|
42
|
+
- previousOutputHeight: this.lastOutputHeight,
|
|
43
|
+
- nextOutputHeight: outputHeight,
|
|
44
|
+
- isUnmounting: this.isUnmounting,
|
|
45
|
+
- });
|
|
46
|
+
+ const redrawAfterNarrowing = this.redrawAfterNarrowing === true;
|
|
47
|
+
+ this.redrawAfterNarrowing = false;
|
|
48
|
+
+ const shouldClearTerminal = (isTty && redrawAfterNarrowing) ||
|
|
49
|
+
+ shouldClearTerminalForFrame({
|
|
50
|
+
+ isTty,
|
|
51
|
+
+ viewportRows,
|
|
52
|
+
+ previousOutputHeight: this.lastOutputHeight,
|
|
53
|
+
+ nextOutputHeight: outputHeight,
|
|
54
|
+
+ isUnmounting: this.isUnmounting,
|
|
55
|
+
+ });
|
|
56
|
+
if (shouldClearTerminal) {
|
|
57
|
+
const sync = this.shouldSync();
|
|
58
|
+
if (sync) {
|
|
@@ -77,13 +77,13 @@ export type BackgroundDelegationListener = (status: BackgroundDelegationStatus)
|
|
|
77
77
|
/** The first eight characters of an SDK task id (a UUID) — enough to tell tasks apart in a row. */
|
|
78
78
|
export declare function shortBackgroundTaskId(taskId: string): string;
|
|
79
79
|
/**
|
|
80
|
-
* The one refusal `/clear` and `/
|
|
81
|
-
* tracked (SER-070): the live task ids and the two ways out. Never a partial restore,
|
|
80
|
+
* The one refusal `/clear`, `/rewind` and a `/tangent` return give while a background
|
|
81
|
+
* delegation is tracked (SER-070): the live task ids and the two ways out. Never a partial restore,
|
|
82
82
|
* never a silent cancel of minutes of child work — the same rule as the SER-027 busy
|
|
83
83
|
* refusal. Shared by the TUI's local check and the runtime's own guard, so the two
|
|
84
84
|
* cannot word it differently.
|
|
85
85
|
*/
|
|
86
|
-
export declare function liveBackgroundDelegationRefusal(command: '/clear' | '/rewind', tasks: readonly BackgroundDelegationStatus[]): string;
|
|
86
|
+
export declare function liveBackgroundDelegationRefusal(command: '/clear' | '/rewind' | '/tangent', tasks: readonly BackgroundDelegationStatus[]): string;
|
|
87
87
|
/**
|
|
88
88
|
* Forwards background runs' `AfterToolCallEvent`s into the parent's stream and keeps
|
|
89
89
|
* the parent-side ledger of tracked delegations (SER-064, SER-070).
|
|
@@ -127,8 +127,8 @@ export function shortBackgroundTaskId(taskId) {
|
|
|
127
127
|
return taskId.length > 8 ? taskId.slice(0, 8) : taskId;
|
|
128
128
|
}
|
|
129
129
|
/**
|
|
130
|
-
* The one refusal `/clear` and `/
|
|
131
|
-
* tracked (SER-070): the live task ids and the two ways out. Never a partial restore,
|
|
130
|
+
* The one refusal `/clear`, `/rewind` and a `/tangent` return give while a background
|
|
131
|
+
* delegation is tracked (SER-070): the live task ids and the two ways out. Never a partial restore,
|
|
132
132
|
* never a silent cancel of minutes of child work — the same rule as the SER-027 busy
|
|
133
133
|
* refusal. Shared by the TUI's local check and the runtime's own guard, so the two
|
|
134
134
|
* cannot word it differently.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"background-delegation.js","sourceRoot":"","sources":["../../../src/agent/background-delegation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,OAAO,EAAE,kBAAkB,EAA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AK,CAAC;QACd,CAAC;QACD,KAAK,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;IACtB,CAAC;IAEO,CAAC,KAAK;QACZ,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO;QACpC,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC;QAC1B,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;QAChB,KAAK,CAAC,CAAC,MAAM,CAAC;IAChB,CAAC;CACF"}
|
|
@@ -67,7 +67,8 @@ export interface BreakdownInputs {
|
|
|
67
67
|
messages: readonly Message[];
|
|
68
68
|
}
|
|
69
69
|
export declare const BASE_PROMPT_LABEL = "system prompt \u00B7 base";
|
|
70
|
-
|
|
70
|
+
/** The `<project-instructions>` block — AGENTS.md or its CLAUDE.md fallback; the fragment's own `source` names which. */
|
|
71
|
+
export declare const PROJECT_INSTRUCTIONS_LABEL = "system prompt \u00B7 project instructions";
|
|
71
72
|
/** A restored prompt whose base block no longer equals the current composition. */
|
|
72
73
|
export declare const RESTORED_PROMPT_LABEL = "system prompt \u00B7 base + project instructions (restored)";
|
|
73
74
|
/** A prompt array in a shape Darwin does not own: counted whole rather than guessed at. */
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { composeSystemPrompt } from './instructions.js';
|
|
2
2
|
import { knownPromptSections } from '../skills/prompt.js';
|
|
3
3
|
export const BASE_PROMPT_LABEL = 'system prompt · base';
|
|
4
|
-
|
|
4
|
+
/** The `<project-instructions>` block — AGENTS.md or its CLAUDE.md fallback; the fragment's own `source` names which. */
|
|
5
|
+
export const PROJECT_INSTRUCTIONS_LABEL = 'system prompt · project instructions';
|
|
5
6
|
/** A restored prompt whose base block no longer equals the current composition. */
|
|
6
7
|
export const RESTORED_PROMPT_LABEL = 'system prompt · base + project instructions (restored)';
|
|
7
8
|
/** A prompt array in a shape Darwin does not own: counted whole rather than guessed at. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-breakdown.js","sourceRoot":"","sources":["../../../src/agent/context-breakdown.ts"],"names":[],"mappings":"AAyBA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AA2C1D,MAAM,CAAC,MAAM,iBAAiB,GAAG,sBAAsB,CAAC;AACxD,MAAM,CAAC,MAAM,0BAA0B,GAAG,
|
|
1
|
+
{"version":3,"file":"context-breakdown.js","sourceRoot":"","sources":["../../../src/agent/context-breakdown.ts"],"names":[],"mappings":"AAyBA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AA2C1D,MAAM,CAAC,MAAM,iBAAiB,GAAG,sBAAsB,CAAC;AACxD,yHAAyH;AACzH,MAAM,CAAC,MAAM,0BAA0B,GAAG,sCAAsC,CAAC;AACjF,mFAAmF;AACnF,MAAM,CAAC,MAAM,qBAAqB,GAAG,wDAAwD,CAAC;AAC9F,2FAA2F;AAC3F,MAAM,CAAC,MAAM,kBAAkB,GAAG,eAAe,CAAC;AAClD,MAAM,CAAC,MAAM,sBAAsB,GAAG,kCAAkC,CAAC;AACzE,MAAM,CAAC,MAAM,qBAAqB,GAAG,iCAAiC,CAAC;AACvE,MAAM,CAAC,MAAM,sBAAsB,GAAG,sDAAsD,CAAC;AAC7F,MAAM,CAAC,MAAM,mBAAmB,GAAG,0BAA0B,CAAC;AAC9D,MAAM,CAAC,MAAM,wBAAwB,GAAG,2CAA2C,CAAC;AACpF,MAAM,CAAC,MAAM,sBAAsB,GAAG,cAAc,CAAC;AACrD,MAAM,CAAC,MAAM,mBAAmB,GAAG,8CAA8C,CAAC;AAClF,MAAM,CAAC,MAAM,wBAAwB,GAAG,iDAAiD,CAAC;AAE1F;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,MAAuB,EACvB,WAA6B;IAE7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,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACpC,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YACzB,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YAC7B,SAAS;QACX,CAAC;QACD,MAAM,KAAK,GAAG,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QAC1C,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC1B,SAAS,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC/B,CAAC;IACD,OAAO;QACL,YAAY,EAAE,YAAY,CAAC,CAAC,CAAC,wBAAwB,CAAC,CAAC,CAAC,mBAAmB;QAC3E,QAAQ;QACR,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;YAChC,KAAK,EAAE,GAAG,sBAAsB,GAAG,MAAM,CAAC,IAAI,EAAE;YAChD,KAAK,EAAE,MAAM,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE;SACrF,CAAC,CAAC;KACJ,CAAC;AACJ,CAAC"}
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
export declare const AGENTS_FILENAME = "AGENTS.md";
|
|
2
|
+
/** Read only when {@link AGENTS_FILENAME} does not exist. */
|
|
3
|
+
export declare const CLAUDE_FILENAME = "CLAUDE.md";
|
|
4
|
+
export type InstructionsFilename = typeof AGENTS_FILENAME | typeof CLAUDE_FILENAME;
|
|
5
|
+
/**
|
|
6
|
+
* One fixed line for the CLAUDE.md case only. Claude Code expands `@path` lines
|
|
7
|
+
* into the referenced files; darwin does not, so without this the model would
|
|
8
|
+
* take an import line for content it has already been given.
|
|
9
|
+
*/
|
|
10
|
+
export declare const CLAUDE_IMPORT_NOTICE: string;
|
|
2
11
|
/**
|
|
3
12
|
* Instructions past this size are truncated rather than sent whole.
|
|
4
13
|
*
|
|
@@ -8,6 +17,8 @@ export declare const AGENTS_FILENAME = "AGENTS.md";
|
|
|
8
17
|
*/
|
|
9
18
|
export declare const MAX_INSTRUCTIONS_BYTES: number;
|
|
10
19
|
export interface ProjectInstructions {
|
|
20
|
+
/** Which of the two names was actually loaded. */
|
|
21
|
+
filename: InstructionsFilename;
|
|
11
22
|
/** Absolute path of the file that was read. */
|
|
12
23
|
path: string;
|
|
13
24
|
/** Size on disk, in bytes, before any truncation. */
|
|
@@ -23,13 +34,16 @@ export interface ProjectInstructionsLoad {
|
|
|
23
34
|
/** What to inject, or undefined when there is nothing usable to inject. */
|
|
24
35
|
instructions: ProjectInstructions | undefined;
|
|
25
36
|
/**
|
|
26
|
-
* Why
|
|
27
|
-
*
|
|
37
|
+
* Why a file that is present could not be used. Undefined both when a file
|
|
38
|
+
* loaded and when there is no file at all — those two need no reporting.
|
|
28
39
|
*/
|
|
29
40
|
problem: string | undefined;
|
|
41
|
+
/** The file `problem` is about; undefined exactly when `problem` is. */
|
|
42
|
+
problemFile: InstructionsFilename | undefined;
|
|
30
43
|
}
|
|
31
44
|
/**
|
|
32
|
-
* Reads `<projectRoot>/AGENTS.md
|
|
45
|
+
* Reads `<projectRoot>/AGENTS.md`, or `<projectRoot>/CLAUDE.md` when the former
|
|
46
|
+
* does not exist.
|
|
33
47
|
*
|
|
34
48
|
* A broken file never blocks startup — the agent works without project
|
|
35
49
|
* instructions — but the two ways of ending up without them are not the same. No
|
|
@@ -38,6 +52,11 @@ export interface ProjectInstructionsLoad {
|
|
|
38
52
|
* user has rules they believe are in effect and nothing on screen contradicts
|
|
39
53
|
* that. Same isolation rule as a broken skill directory: skip it, say why.
|
|
40
54
|
*
|
|
55
|
+
* Only a truly missing `AGENTS.md` moves on to `CLAUDE.md`: an unreadable one is
|
|
56
|
+
* reported as such and never falls through, because the file the user wrote
|
|
57
|
+
* rules into is the one that must decide. Whichever file is found first is the
|
|
58
|
+
* only one opened.
|
|
59
|
+
*
|
|
41
60
|
* An empty or whitespace-only file is silently skipped: injecting the delimiters
|
|
42
61
|
* with nothing between them would only point the model at emptiness.
|
|
43
62
|
*/
|