strands-darwin 0.0.35 → 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 +20 -3
- package/README.zh-CN.md +20 -3
- package/dist/src/agent/prompt-cache.js +15 -2
- package/dist/src/agent/prompt-cache.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 +64 -10
- package/dist/src/agent/runtime.js +192 -33
- 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/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 +2 -4
- package/dist/src/agents/subagent-tool.js.map +1 -1
- package/dist/src/agents/workflow-tool.js +2 -4
- package/dist/src/agents/workflow-tool.js.map +1 -1
- package/dist/src/cli-doctor.js +7 -0
- 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 +14 -6
- package/dist/src/commands/custom-commands.js.map +1 -1
- 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 +66 -5
- package/dist/src/config.js +126 -42
- package/dist/src/config.js.map +1 -1
- package/dist/src/dev-repl.js +17 -1
- package/dist/src/dev-repl.js.map +1 -1
- package/dist/src/headless-protocol.d.ts +24 -1
- package/dist/src/headless-protocol.js +18 -0
- package/dist/src/headless-protocol.js.map +1 -1
- package/dist/src/headless-runner.d.ts +8 -0
- package/dist/src/headless-runner.js +37 -1
- package/dist/src/headless-runner.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 +8 -5
- package/dist/src/pricing/model-prices.js +30 -15
- 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 +6 -0
- package/dist/src/tools/background-bash.js +26 -0
- package/dist/src/tools/background-bash.js.map +1 -1
- package/dist/src/tools/shell-env.d.ts +24 -0
- package/dist/src/tools/shell-env.js +34 -0
- package/dist/src/tools/shell-env.js.map +1 -1
- 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/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/tui/App.d.ts +5 -1
- package/dist/src/tui/App.js +284 -51
- 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/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 +18 -3
- 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 +9 -0
- package/dist/src/tui/status-format.js +37 -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/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 +1 -0
- package/dist/src/tui/turn-state.js +2 -0
- package/dist/src/tui/turn-state.js.map +1 -1
- package/package.json +2 -1
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
|
|
|
@@ -108,15 +114,18 @@ For multiple switchable models, provider-specific fields, Bedrock Mantle, cachin
|
|
|
108
114
|
/self-evolution-research
|
|
109
115
|
/help local command, prompt, and key reference
|
|
110
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
|
|
111
118
|
/copy copy the last completed answer to the clipboard (OSC 52, works over SSH)
|
|
112
119
|
/rewind branch conversation from a completed prompt (workspace unchanged)
|
|
113
120
|
/tangent bookmark the conversation for a side question; /tangent again returns
|
|
114
121
|
```
|
|
115
122
|
|
|
116
|
-
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.
|
|
117
124
|
|
|
118
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).
|
|
119
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
|
+
|
|
120
129
|
For non-interactive use:
|
|
121
130
|
|
|
122
131
|
```bash
|
|
@@ -127,6 +136,14 @@ darwin -p "inspect this project" --output-format stream-json
|
|
|
127
136
|
|
|
128
137
|
Read [Using darwin](docs/user-guide/using-darwin.md) for TUI, headless, structured-output, queue, shell, and background-job contracts.
|
|
129
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
|
+
|
|
130
147
|
## Documentation
|
|
131
148
|
|
|
132
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
|
|
|
@@ -108,15 +114,18 @@ Bedrock 使用标准 AWS 凭证链。模型 ID 必须是 `us.`、`eu.`、`apac.`
|
|
|
108
114
|
/self-evolution-research
|
|
109
115
|
/help 查看本地命令、输入语法和按键说明
|
|
110
116
|
/init 请模型为当前项目创建或改进 AGENTS.md
|
|
117
|
+
/review [focus] 审查当前改动中的缺陷和测试缺口
|
|
111
118
|
/copy 把最近一条已完成回答复制到剪贴板(OSC 52,SSH 下可用)
|
|
112
119
|
/rewind 从已完成提示词分支对话(工作区不变)
|
|
113
120
|
/tangent 为一次旁支提问给对话加书签;再输入 /tangent 即返回
|
|
114
121
|
```
|
|
115
122
|
|
|
116
|
-
按 `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 由此可以判断自己运行在代理之下。
|
|
117
124
|
|
|
118
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)。
|
|
119
126
|
|
|
127
|
+
`/review` 请模型检查暂存、未暂存的改动及相关未跟踪文件,按优先级报告有证据的缺陷,并单列测试缺口。可选 focus 保持为字面文本。提示要求未经另行请求不要修改文件或提交,但**不会强制只读,也不改变权限模式**。内置命令现在占用 `/review`;原来使用该斜杠名称的自定义命令或 skill 需要改名,例如 `audit`。详见[审查改动](docs/user-guide/using-darwin.zh-CN.md#审查改动)。
|
|
128
|
+
|
|
120
129
|
无交互运行方式如下:
|
|
121
130
|
|
|
122
131
|
```bash
|
|
@@ -127,6 +136,14 @@ darwin -p "inspect this project" --output-format stream-json
|
|
|
127
136
|
|
|
128
137
|
TUI、无头模式、结构化输出、消息队列、shell 命令和后台任务的完整约定,见[使用 darwin](docs/user-guide/using-darwin.zh-CN.md)。
|
|
129
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
|
+
|
|
130
147
|
## 文档
|
|
131
148
|
|
|
132
149
|
- **[用户指南](docs/user-guide/README.zh-CN.md):**安装、供应商、日常操作、配置、状态、安全、扩展、命令参考、限制和开发说明。
|
|
@@ -107,8 +107,21 @@ export function bedrockCacheConfig(plan) {
|
|
|
107
107
|
return {
|
|
108
108
|
strategy: 'auto',
|
|
109
109
|
// One TTL everywhere: Bedrock requires TTLs to be non-increasing across
|
|
110
|
-
// tools → system → messages, and equal values satisfy that trivially.
|
|
111
|
-
|
|
110
|
+
// tools → system → messages, and equal values satisfy that trivially. The
|
|
111
|
+
// shared `ttl` matters as much as the per-section values: whenever a request
|
|
112
|
+
// carries a *string* system prompt — the SDK summarizer behind `/compact`,
|
|
113
|
+
// recipe children — the SDK auto-injects a system cache point of its own and
|
|
114
|
+
// fills its TTL from `systemPromptTTL`/`ttl`. Without these, that point stays
|
|
115
|
+
// at Bedrock's `5m` default between a `1h` tools point and a `1h` messages
|
|
116
|
+
// point, and Bedrock rejects the request (`a ttl='1h' cache_control block
|
|
117
|
+
// must not come after a ttl='5m' cache_control block`). Darwin's hand-placed
|
|
118
|
+
// system point already carries the TTL, so it is left as written.
|
|
119
|
+
...(plan.ttl !== undefined && {
|
|
120
|
+
ttl: plan.ttl,
|
|
121
|
+
toolsTTL: plan.ttl,
|
|
122
|
+
systemPromptTTL: plan.ttl,
|
|
123
|
+
messagesTTL: plan.ttl,
|
|
124
|
+
}),
|
|
112
125
|
};
|
|
113
126
|
}
|
|
114
127
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompt-cache.js","sourceRoot":"","sources":["../../../src/agent/prompt-cache.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAMjE;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,IAAI,EAAE,IAAI,CAAU,CAAC;AAGvD;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAmB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
7
7
|
readonly prompt: string;
|
|
8
8
|
readonly completedAt: string;
|
|
9
|
+
/** Optional display-only trajectory boundary; the SDK snapshot remains authoritative. */
|
|
10
|
+
readonly trajectoryTurn?: number;
|
|
9
11
|
}
|
|
10
12
|
export interface RewindCatalogue {
|
|
11
13
|
readonly checkpoints: readonly RewindCheckpoint[];
|
package/dist/src/agent/rewind.js
CHANGED
|
@@ -53,7 +53,9 @@ export async function readRewindCatalogue(projectRoot, sessionId) {
|
|
|
53
53
|
if (!isRecord(value) || typeof value.snapshotId !== 'string' || typeof value.prompt !== 'string' ||
|
|
54
54
|
typeof value.completedAt !== 'string' || [...value.snapshotId].length === 0 ||
|
|
55
55
|
[...value.snapshotId].length > MAX_SNAPSHOT_ID_CODE_POINTS || !rewindPromptEligible(value.prompt) ||
|
|
56
|
-
!Number.isFinite(Date.parse(value.completedAt)) || ids.has(value.snapshotId)
|
|
56
|
+
!Number.isFinite(Date.parse(value.completedAt)) || ids.has(value.snapshotId) ||
|
|
57
|
+
(value.trajectoryTurn !== undefined &&
|
|
58
|
+
(!Number.isSafeInteger(value.trajectoryTurn) || value.trajectoryTurn < 1))) {
|
|
57
59
|
return { checkpoints: [], capped: false, problem: 'rewind checkpoint catalogue has an invalid entry' };
|
|
58
60
|
}
|
|
59
61
|
ids.add(value.snapshotId);
|
|
@@ -61,6 +63,7 @@ export async function readRewindCatalogue(projectRoot, sessionId) {
|
|
|
61
63
|
snapshotId: value.snapshotId,
|
|
62
64
|
prompt: value.prompt,
|
|
63
65
|
completedAt: value.completedAt,
|
|
66
|
+
...(value.trajectoryTurn === undefined ? {} : { trajectoryTurn: value.trajectoryTurn }),
|
|
64
67
|
});
|
|
65
68
|
}
|
|
66
69
|
return { checkpoints, capped: checkpoints.length >= MAX_REWIND_CHECKPOINTS };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rewind.js","sourceRoot":"","sources":["../../../src/agent/rewind.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;A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AC,WAAW,CAAC,CAAC,OAAO,EAAE,CAAC;AAC9C,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED,SAAS,SAAS,CAAC,KAAc;IAC/B,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAC;AACpD,CAAC;AAED,SAAS,OAAO,CAAC,KAAc;IAC7B,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAChE,CAAC"}
|
|
@@ -13,6 +13,7 @@ import { type McpLoadResult, type McpServerStatus } from '../mcp/registry.js';
|
|
|
13
13
|
import { type ExpandedSkillCommand } from '../skills/plugin.js';
|
|
14
14
|
import { type MemoryCommandResult } from '../memory/command.js';
|
|
15
15
|
import { MemoryToolController } from '../memory/controller.js';
|
|
16
|
+
import { CloudMemory } from '../agentcore/controller.js';
|
|
16
17
|
import type { MemoryStatus } from '../memory/store.js';
|
|
17
18
|
import type { ContextCompactedEntry, TaskNotificationFields } from '../trajectory/record.js';
|
|
18
19
|
import { type RecorderOptions, type TrajectoryStatus } from '../trajectory/writer.js';
|
|
@@ -23,6 +24,7 @@ import { type PromptCachePlan } from './prompt-cache.js';
|
|
|
23
24
|
import { type SessionSelector } from './session.js';
|
|
24
25
|
import { type SystemPromptSource } from './system-prompt.js';
|
|
25
26
|
import { type ThinkingEffort, type ThinkingPlan } from './thinking.js';
|
|
27
|
+
import { type WorkspaceTrust, type WorkspaceTrustReport } from './workspace-trust.js';
|
|
26
28
|
import { type RewindCatalogue, type RewindCheckpoint } from './rewind.js';
|
|
27
29
|
import { type UsageTotals } from './usage.js';
|
|
28
30
|
import { type SessionCallStats } from './call-stats.js';
|
|
@@ -62,6 +64,18 @@ export interface RuntimeOptions {
|
|
|
62
64
|
backgroundCompletionWakes?: boolean;
|
|
63
65
|
/** Refuses the next parent-Agent SDK model call after this many in the process. */
|
|
64
66
|
maxModelCalls?: number;
|
|
67
|
+
/**
|
|
68
|
+
* The workspace-trust decision the driver resolved *before* asking for a runtime
|
|
69
|
+
* (SER-090, `workspace-trust.ts`). Anything but `trusted` holds the repository-
|
|
70
|
+
* supplied layers back: `loadProjectPolicy` skips the project hook roots and the
|
|
71
|
+
* legacy `.darwin/config.json` rule fallback, `loadMcpClients` leaves the project MCP
|
|
72
|
+
* file unread — skipped, never an error — and the held items are reported on
|
|
73
|
+
* `info.workspaceTrust`. Absent means the caller vouches for the checkout (the
|
|
74
|
+
* pre-trust behaviour; programmatic embedding and the spike fixtures). The three
|
|
75
|
+
* drivers always pass it, and a `/clear` or `/rewind` successor inherits it with the
|
|
76
|
+
* rest of these options.
|
|
77
|
+
*/
|
|
78
|
+
workspaceTrust?: WorkspaceTrust;
|
|
65
79
|
/**
|
|
66
80
|
* One driver-owned section appended to the base prompt, before project instructions.
|
|
67
81
|
* Headless runs pass `HEADLESS_AUTONOMY_SECTION` (system-prompt.ts); the interactive TUI passes
|
|
@@ -150,6 +164,9 @@ export type ExpandedSlashCommand = ({
|
|
|
150
164
|
} | {
|
|
151
165
|
kind: 'init';
|
|
152
166
|
message: string;
|
|
167
|
+
} | {
|
|
168
|
+
kind: 'review';
|
|
169
|
+
message: string;
|
|
153
170
|
};
|
|
154
171
|
/** Estimated size of the next request's context, plus the model's window. */
|
|
155
172
|
export interface ContextEstimate {
|
|
@@ -184,6 +201,14 @@ export interface RuntimeInfo {
|
|
|
184
201
|
permissionMode: ApprovalMode;
|
|
185
202
|
sessionId: string;
|
|
186
203
|
resumed: boolean;
|
|
204
|
+
/**
|
|
205
|
+
* SER-091: one bounded sentence about this session's lease when the acquisition was
|
|
206
|
+
* not the ordinary uncontested one — a stale lease taken over, or a bare `--resume`
|
|
207
|
+
* that found its session open in another live process and started fresh. Absent
|
|
208
|
+
* otherwise; the drivers state it once in the transcript/stderr and nothing else
|
|
209
|
+
* reads it.
|
|
210
|
+
*/
|
|
211
|
+
leaseNotice?: string;
|
|
187
212
|
/** Names of skills discovered under `.darwin/skills/`. */
|
|
188
213
|
skillNames: string[];
|
|
189
214
|
/** Skill directories that were skipped, with the reason. */
|
|
@@ -268,6 +293,14 @@ export interface RuntimeInfo {
|
|
|
268
293
|
withheld: string[];
|
|
269
294
|
passthrough: string[];
|
|
270
295
|
};
|
|
296
|
+
/**
|
|
297
|
+
* The workspace-trust decision this runtime applied (SER-090) and exactly what it
|
|
298
|
+
* held back when the project is not trusted: hook files never loaded, MCP servers
|
|
299
|
+
* never spawned, the legacy rule fallback never granted. Empty held lists for a
|
|
300
|
+
* trusted project or an empty inventory. Read by the transcript notice, `/status`,
|
|
301
|
+
* `/mcp` and the headless `trust:` line / `run.started.trust`.
|
|
302
|
+
*/
|
|
303
|
+
workspaceTrust: WorkspaceTrustReport;
|
|
271
304
|
mcpIgnoredConfigPath: string | undefined;
|
|
272
305
|
/** Number of MCP servers configured (some may have failed to connect). */
|
|
273
306
|
mcpServerCount: number;
|
|
@@ -318,6 +351,13 @@ export declare class AgentRuntime {
|
|
|
318
351
|
private readonly diagnosticsLog;
|
|
319
352
|
/** Undefined only when effective config disables derived project context. */
|
|
320
353
|
private readonly memoryController;
|
|
354
|
+
private readonly cloudMemory;
|
|
355
|
+
/**
|
|
356
|
+
* This process's hold on `info.sessionId` (SER-091). Released by {@link shutdown}
|
|
357
|
+
* and by {@link retire} — the `/clear` and `/rewind` successor takes its own lease
|
|
358
|
+
* on its own id through `create()` — and only while the file still names this pid.
|
|
359
|
+
*/
|
|
360
|
+
private readonly lease;
|
|
321
361
|
readonly info: RuntimeInfo;
|
|
322
362
|
/**
|
|
323
363
|
* What this runtime was created with, so {@link startNewSession} can assemble its
|
|
@@ -406,7 +446,7 @@ export declare class AgentRuntime {
|
|
|
406
446
|
* Releases startup-owned observers and external clients when construction fails.
|
|
407
447
|
* Successful creation transfers the same resources to `shutdown()` instead.
|
|
408
448
|
*/
|
|
409
|
-
static unwindCreate(diagnosticsLog: DiagnosticsLog | undefined, mcpClients?: readonly McpClient[], backgroundBash?: BackgroundBashManager, memoryController?: MemoryToolController, lifecycleHooks?: LifecycleHookRunner, codexHooks?: CodexHookRunner): Promise<void>;
|
|
449
|
+
static unwindCreate(diagnosticsLog: DiagnosticsLog | undefined, mcpClients?: readonly McpClient[], backgroundBash?: BackgroundBashManager, memoryController?: MemoryToolController, lifecycleHooks?: LifecycleHookRunner, codexHooks?: CodexHookRunner, cloudMemory?: CloudMemory): Promise<void>;
|
|
410
450
|
static create(options: RuntimeOptions): Promise<AgentRuntime>;
|
|
411
451
|
/**
|
|
412
452
|
* Runs one turn, yielding SDK stream events untouched so callers can render
|
|
@@ -501,10 +541,13 @@ export declare class AgentRuntime {
|
|
|
501
541
|
get diagnosticsStatus(): DiagnosticsStatus | undefined;
|
|
502
542
|
/** Best-effort status of enabled derived project memory. */
|
|
503
543
|
get memoryStatus(): MemoryStatus | undefined;
|
|
504
|
-
/**
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
544
|
+
/** Cloud status is a projection, never an implicit retrieval. */
|
|
545
|
+
get cloudMemoryStatus(): string;
|
|
546
|
+
private checkCloudPreparation;
|
|
547
|
+
refreshCloudPolicy(): Promise<void>;
|
|
548
|
+
private prepareCloudPreferences;
|
|
549
|
+
manageCloudMemory(input: string): Promise<string>;
|
|
550
|
+
private applyCloudPreferences;
|
|
508
551
|
manageMemory(input: string): Promise<MemoryCommandResult>;
|
|
509
552
|
/**
|
|
510
553
|
* Replaces old conversation history with rolling summaries, keeping the recent
|
|
@@ -569,6 +612,13 @@ export declare class AgentRuntime {
|
|
|
569
612
|
* of swallowing: the caller reports it to the user.
|
|
570
613
|
*/
|
|
571
614
|
saveAllowRule(rule: string): Promise<void>;
|
|
615
|
+
/**
|
|
616
|
+
* The `loadProjectPolicy` layer option this runtime was created with (SER-090), so
|
|
617
|
+
* the two rule writers below promote legacy rules only from a layer that was in
|
|
618
|
+
* force — an untrusted project's committed `.darwin/config.json` never reaches the
|
|
619
|
+
* user-owned file through an "always allow" answer.
|
|
620
|
+
*/
|
|
621
|
+
private projectLayerOptions;
|
|
572
622
|
/**
|
|
573
623
|
* The live allow-rules with their provenance — config-loaded vs granted this
|
|
574
624
|
* session — for the `/permissions` report. Read live from the gate, like
|
|
@@ -802,6 +852,9 @@ export declare class AgentRuntime {
|
|
|
802
852
|
get sessionUsage(): UsageTotals;
|
|
803
853
|
/** Current-process background tasks, without creating an agent tool call. */
|
|
804
854
|
listBackgroundTasks(): Promise<BackgroundTaskStatus[]>;
|
|
855
|
+
/** Live in-memory activity for the TUI; no log reads or tool invocation. */
|
|
856
|
+
get runningBackgroundTaskCount(): number;
|
|
857
|
+
subscribeToBackgroundTaskActivity(listener: () => void): () => void;
|
|
805
858
|
/** Publishes future terminal task snapshots until the returned closure is called. */
|
|
806
859
|
subscribeToBackgroundTasks(listener: BackgroundTaskListener): () => void;
|
|
807
860
|
/**
|
|
@@ -899,8 +952,8 @@ export declare class AgentRuntime {
|
|
|
899
952
|
* the user the conversation they just set aside. The successor claims the pointer on
|
|
900
953
|
* its first finished turn, through the ordinary path.
|
|
901
954
|
*
|
|
902
|
-
* If assembling the successor fails,
|
|
903
|
-
*
|
|
955
|
+
* If assembling the successor fails, conversation/tools stay usable; predecessor auto
|
|
956
|
+
* uploads remain conservatively stopped (cloud status states it). The diagnostics tap is put back
|
|
904
957
|
* (the failed successor's unwind clears the process-global sink).
|
|
905
958
|
*
|
|
906
959
|
* Refused while a background delegation is tracked (SER-070): `retire()` would cancel
|
|
@@ -934,13 +987,14 @@ export declare class AgentRuntime {
|
|
|
934
987
|
private captureRewindCheckpoint;
|
|
935
988
|
/**
|
|
936
989
|
* Expands a built-in prompt command, a skill, or a project command into the
|
|
937
|
-
* prompt sent to the model. `/workflow` and `/
|
|
990
|
+
* prompt sent to the model. `/workflow`, `/init` and `/review` come first: built-in
|
|
938
991
|
* reservation precedes skills and custom commands, so no extension can
|
|
939
992
|
* shadow them. Bare `/workflow` returns null — the drivers own that local usage
|
|
940
993
|
* notice, and the runtime never fabricates a turn — while bare `/init` is the
|
|
941
|
-
* trigger itself
|
|
994
|
+
* trigger itself, as is bare `/review`. `/review` is guidance only, with no mode
|
|
995
|
+
* change or executor. `/init` decides create-versus-improve from the instructions
|
|
942
996
|
* summary this runtime captured at startup (the header's own data), never from
|
|
943
|
-
* a fresh filesystem read, so
|
|
997
|
+
* a fresh filesystem read, so TUI, dev-repl and both headless drivers get the
|
|
944
998
|
* same branch through this one seam. Skills are checked before
|
|
945
999
|
* custom commands as a defensive backstop to the loader's collision
|
|
946
1000
|
* filtering. Unknown slash input remains ordinary user input.
|