@namzu/cli 26.3.0 → 27.0.0
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/CHANGELOG.md +214 -0
- package/README.md +49 -34
- package/dist/bin.js +7 -0
- package/dist/bin.js.map +1 -1
- package/dist/checkpoints/store.d.ts +17 -4
- package/dist/checkpoints/store.d.ts.map +1 -1
- package/dist/checkpoints/store.js +20 -5
- package/dist/checkpoints/store.js.map +1 -1
- package/dist/cli.js +2 -2
- package/dist/cli.js.map +1 -1
- package/dist/commands/acp.d.ts +23 -1
- package/dist/commands/acp.d.ts.map +1 -1
- package/dist/commands/acp.js +41 -2
- package/dist/commands/acp.js.map +1 -1
- package/dist/commands/drain.d.ts +69 -2
- package/dist/commands/drain.d.ts.map +1 -1
- package/dist/commands/drain.js +214 -134
- package/dist/commands/drain.js.map +1 -1
- package/dist/commands/eval.js +1 -1
- package/dist/commands/eval.js.map +1 -1
- package/dist/commands/provider-wait.d.ts +5 -5
- package/dist/commands/provider-wait.d.ts.map +1 -1
- package/dist/commands/provider-wait.js +2 -2
- package/dist/commands/resident.d.ts.map +1 -1
- package/dist/commands/resident.js +2 -1
- package/dist/commands/resident.js.map +1 -1
- package/dist/commands/run-flags.d.ts +7 -7
- package/dist/commands/run-flags.js +4 -4
- package/dist/commands/run-stream.d.ts +16 -12
- package/dist/commands/run-stream.d.ts.map +1 -1
- package/dist/commands/run-stream.js +142 -98
- package/dist/commands/run-stream.js.map +1 -1
- package/dist/commands/run.d.ts +6 -4
- package/dist/commands/run.d.ts.map +1 -1
- package/dist/commands/run.js +129 -45
- package/dist/commands/run.js.map +1 -1
- package/dist/commands/serve.js +2 -2
- package/dist/commands/serve.js.map +1 -1
- package/dist/commands/state.js +8 -8
- package/dist/commands/state.js.map +1 -1
- package/dist/config/load.d.ts +1 -1
- package/dist/config/load.d.ts.map +1 -1
- package/dist/config/load.js +17 -5
- package/dist/config/load.js.map +1 -1
- package/dist/config/run-limits.d.ts +20 -8
- package/dist/config/run-limits.d.ts.map +1 -1
- package/dist/config/run-limits.js +28 -46
- package/dist/config/run-limits.js.map +1 -1
- package/dist/config/schema.d.ts +44 -19
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/schema.js.map +1 -1
- package/dist/config/tool-result-screens.js +1 -1
- package/dist/context/directories.d.ts +37 -0
- package/dist/context/directories.d.ts.map +1 -0
- package/dist/context/directories.js +69 -0
- package/dist/context/directories.js.map +1 -0
- package/dist/context/environment.d.ts +55 -0
- package/dist/context/environment.d.ts.map +1 -1
- package/dist/context/environment.js +96 -0
- package/dist/context/environment.js.map +1 -1
- package/dist/context/project-tracker.d.ts +3 -3
- package/dist/context/project-tracker.d.ts.map +1 -1
- package/dist/context/project-tracker.js +3 -3
- package/dist/context/project-tracker.js.map +1 -1
- package/dist/context/project.d.ts +1 -1
- package/dist/context/project.js +1 -1
- package/dist/context/sandbox.d.ts +22 -3
- package/dist/context/sandbox.d.ts.map +1 -1
- package/dist/context/sandbox.js +42 -4
- package/dist/context/sandbox.js.map +1 -1
- package/dist/doctor/checks/chain.d.ts +1 -1
- package/dist/doctor/checks/chain.js +5 -5
- package/dist/doctor/checks/chain.js.map +1 -1
- package/dist/doctor/checks/invariants.d.ts +2 -2
- package/dist/doctor/checks/invariants.js +5 -5
- package/dist/doctor/checks/invariants.js.map +1 -1
- package/dist/doctor/checks/logging.js +1 -1
- package/dist/doctor/checks/logging.js.map +1 -1
- package/dist/doctor/checks/sandbox.js +1 -1
- package/dist/doctor/checks/sandbox.js.map +1 -1
- package/dist/doctor/checks/session-export.d.ts +1 -1
- package/dist/doctor/checks/session-export.js +2 -2
- package/dist/doctor/checks/session-export.js.map +1 -1
- package/dist/doctor/checks/telemetry.d.ts +1 -1
- package/dist/doctor/checks/telemetry.js +1 -1
- package/dist/doctor/registry.js +2 -2
- package/dist/doctor/registry.js.map +1 -1
- package/dist/exit-codes.d.ts +2 -2
- package/dist/exit-codes.js +2 -2
- package/dist/integrations/mcp/servers.d.ts +1 -1
- package/dist/integrations/providers/chain-capabilities.d.ts +6 -6
- package/dist/integrations/providers/chain-capabilities.js +8 -8
- package/dist/integrations/providers/chain-capabilities.js.map +1 -1
- package/dist/integrations/providers/register.d.ts +1 -1
- package/dist/integrations/providers/register.js +1 -1
- package/dist/integrations/providers/registry.d.ts +1 -1
- package/dist/integrations/resident/inspection.d.ts +4 -1
- package/dist/integrations/resident/inspection.d.ts.map +1 -1
- package/dist/integrations/resident/inspection.js +53 -34
- package/dist/integrations/resident/inspection.js.map +1 -1
- package/dist/integrations/resident/learning-storage.d.ts +7 -2
- package/dist/integrations/resident/learning-storage.d.ts.map +1 -1
- package/dist/integrations/resident/learning-storage.js +12 -8
- package/dist/integrations/resident/learning-storage.js.map +1 -1
- package/dist/integrations/resident/runner-store.d.ts +1 -1
- package/dist/integrations/resident/runner-store.d.ts.map +1 -1
- package/dist/integrations/resident/runner-store.js +5 -2
- package/dist/integrations/resident/runner-store.js.map +1 -1
- package/dist/integrations/resident/runner-worker.js +1 -0
- package/dist/integrations/resident/runner-worker.js.map +1 -1
- package/dist/integrations/resident/session-log-reads.d.ts +37 -0
- package/dist/integrations/resident/session-log-reads.d.ts.map +1 -0
- package/dist/integrations/resident/session-log-reads.js +125 -0
- package/dist/integrations/resident/session-log-reads.js.map +1 -0
- package/dist/integrations/resident/session-step.d.ts +2 -0
- package/dist/integrations/resident/session-step.d.ts.map +1 -1
- package/dist/integrations/resident/session-step.js +15 -13
- package/dist/integrations/resident/session-step.js.map +1 -1
- package/dist/integrations/resident/storage.d.ts +23 -1
- package/dist/integrations/resident/storage.d.ts.map +1 -1
- package/dist/integrations/resident/storage.js +60 -17
- package/dist/integrations/resident/storage.js.map +1 -1
- package/dist/integrations/resident/tool-evidence.d.ts +4 -2
- package/dist/integrations/resident/tool-evidence.d.ts.map +1 -1
- package/dist/integrations/resident/tool-evidence.js +36 -30
- package/dist/integrations/resident/tool-evidence.js.map +1 -1
- package/dist/integrations/resident/verification.d.ts +2 -2
- package/dist/integrations/resident/verification.d.ts.map +1 -1
- package/dist/integrations/resident/verification.js +4 -4
- package/dist/integrations/resident/verification.js.map +1 -1
- package/dist/integrations/sessions/checkpoint-view.d.ts +13 -0
- package/dist/integrations/sessions/checkpoint-view.d.ts.map +1 -0
- package/dist/integrations/sessions/checkpoint-view.js +48 -0
- package/dist/integrations/sessions/checkpoint-view.js.map +1 -0
- package/dist/integrations/sessions/context-inventory.js +1 -1
- package/dist/integrations/sessions/context-inventory.js.map +1 -1
- package/dist/integrations/sessions/conversation-search.d.ts +16 -20
- package/dist/integrations/sessions/conversation-search.d.ts.map +1 -1
- package/dist/integrations/sessions/conversation-search.js +305 -731
- package/dist/integrations/sessions/conversation-search.js.map +1 -1
- package/dist/integrations/sessions/evidence-page-validation.d.ts +4 -4
- package/dist/integrations/sessions/evidence-page-validation.d.ts.map +1 -1
- package/dist/integrations/sessions/evidence-page-validation.js +1 -1
- package/dist/integrations/sessions/evidence-page-validation.js.map +1 -1
- package/dist/integrations/sessions/evidence-recall.d.ts +40 -2
- package/dist/integrations/sessions/evidence-recall.d.ts.map +1 -1
- package/dist/integrations/sessions/evidence-recall.js +41 -97
- package/dist/integrations/sessions/evidence-recall.js.map +1 -1
- package/dist/integrations/sessions/store.d.ts +153 -85
- package/dist/integrations/sessions/store.d.ts.map +1 -1
- package/dist/integrations/sessions/store.js +414 -484
- package/dist/integrations/sessions/store.js.map +1 -1
- package/dist/integrations/sessions/task-context.d.ts +15 -2
- package/dist/integrations/sessions/task-context.d.ts.map +1 -1
- package/dist/integrations/sessions/task-context.js +34 -11
- package/dist/integrations/sessions/task-context.js.map +1 -1
- package/dist/integrations/sessions/transcript-export.d.ts +13 -6
- package/dist/integrations/sessions/transcript-export.d.ts.map +1 -1
- package/dist/integrations/sessions/transcript-export.js +148 -263
- package/dist/integrations/sessions/transcript-export.js.map +1 -1
- package/dist/integrations/state/home.d.ts +4 -16
- package/dist/integrations/state/home.d.ts.map +1 -1
- package/dist/integrations/state/home.js +6 -42
- package/dist/integrations/state/home.js.map +1 -1
- package/dist/integrations/state/project.d.ts +6 -7
- package/dist/integrations/state/project.d.ts.map +1 -1
- package/dist/integrations/state/project.js +7 -9
- package/dist/integrations/state/project.js.map +1 -1
- package/dist/integrations/state/report.d.ts +27 -41
- package/dist/integrations/state/report.d.ts.map +1 -1
- package/dist/integrations/state/report.js +172 -464
- package/dist/integrations/state/report.js.map +1 -1
- package/dist/integrations/state/retention.d.ts +18 -0
- package/dist/integrations/state/retention.d.ts.map +1 -0
- package/dist/integrations/state/retention.js +18 -0
- package/dist/integrations/state/retention.js.map +1 -0
- package/dist/integrations/subagents/activity.d.ts +36 -31
- package/dist/integrations/subagents/activity.d.ts.map +1 -1
- package/dist/integrations/subagents/activity.js +27 -23
- package/dist/integrations/subagents/activity.js.map +1 -1
- package/dist/integrations/subagents/batches.d.ts +91 -0
- package/dist/integrations/subagents/batches.d.ts.map +1 -0
- package/dist/integrations/subagents/batches.js +172 -0
- package/dist/integrations/subagents/batches.js.map +1 -0
- package/dist/integrations/subagents/parent.d.ts +26 -11
- package/dist/integrations/subagents/parent.d.ts.map +1 -1
- package/dist/integrations/subagents/parent.js +13 -28
- package/dist/integrations/subagents/parent.js.map +1 -1
- package/dist/integrations/subagents/policy.d.ts +2 -2
- package/dist/integrations/subagents/policy.d.ts.map +1 -1
- package/dist/integrations/subagents/policy.js +2 -2
- package/dist/integrations/subagents/policy.js.map +1 -1
- package/dist/integrations/subagents/replay.d.ts +91 -26
- package/dist/integrations/subagents/replay.d.ts.map +1 -1
- package/dist/integrations/subagents/replay.js +216 -114
- package/dist/integrations/subagents/replay.js.map +1 -1
- package/dist/integrations/subagents/runtime.d.ts +50 -26
- package/dist/integrations/subagents/runtime.d.ts.map +1 -1
- package/dist/integrations/subagents/runtime.js +132 -126
- package/dist/integrations/subagents/runtime.js.map +1 -1
- package/dist/integrations/subagents/saved-agents.d.ts +57 -0
- package/dist/integrations/subagents/saved-agents.d.ts.map +1 -0
- package/dist/integrations/subagents/saved-agents.js +102 -0
- package/dist/integrations/subagents/saved-agents.js.map +1 -0
- package/dist/integrations/subagents/slash.d.ts +55 -0
- package/dist/integrations/subagents/slash.d.ts.map +1 -0
- package/dist/integrations/subagents/slash.js +45 -0
- package/dist/integrations/subagents/slash.js.map +1 -0
- package/dist/integrations/telemetry/session-export.d.ts +6 -6
- package/dist/integrations/telemetry/session-export.d.ts.map +1 -1
- package/dist/integrations/telemetry/session-export.js +2 -2
- package/dist/memory/presentation.d.ts +11 -0
- package/dist/memory/presentation.d.ts.map +1 -1
- package/dist/memory/presentation.js +25 -0
- package/dist/memory/presentation.js.map +1 -1
- package/dist/memory/store.d.ts +13 -7
- package/dist/memory/store.d.ts.map +1 -1
- package/dist/memory/store.js +37 -11
- package/dist/memory/store.js.map +1 -1
- package/dist/memory/typed.d.ts +116 -0
- package/dist/memory/typed.d.ts.map +1 -0
- package/dist/memory/typed.js +336 -0
- package/dist/memory/typed.js.map +1 -0
- package/dist/permissions/checks.d.ts +1 -1
- package/dist/permissions/checks.js +1 -1
- package/dist/permissions/headless-trust.d.ts +2 -2
- package/dist/permissions/headless-trust.d.ts.map +1 -1
- package/dist/permissions/headless-trust.js +3 -3
- package/dist/permissions/headless-trust.js.map +1 -1
- package/dist/permissions/mode.d.ts +4 -4
- package/dist/permissions/mode.js +1 -1
- package/dist/permissions/rules.d.ts +1 -1
- package/dist/permissions/rules.js +1 -1
- package/dist/termination.d.ts +75 -0
- package/dist/termination.d.ts.map +1 -0
- package/dist/termination.js +143 -0
- package/dist/termination.js.map +1 -0
- package/dist/tui/AgentExplorer.d.ts +2 -2
- package/dist/tui/AgentExplorer.js +4 -4
- package/dist/tui/AgentExplorer.js.map +1 -1
- package/dist/tui/App.d.ts +9 -1
- package/dist/tui/App.d.ts.map +1 -1
- package/dist/tui/App.js +452 -303
- package/dist/tui/App.js.map +1 -1
- package/dist/tui/LiveActivity.d.ts +1 -1
- package/dist/tui/LiveActivity.d.ts.map +1 -1
- package/dist/tui/PermissionOverlay.d.ts +8 -0
- package/dist/tui/PermissionOverlay.d.ts.map +1 -1
- package/dist/tui/PermissionOverlay.js +25 -2
- package/dist/tui/PermissionOverlay.js.map +1 -1
- package/dist/tui/Picker.js +1 -1
- package/dist/tui/agent.d.ts +208 -132
- package/dist/tui/agent.d.ts.map +1 -1
- package/dist/tui/agent.js +523 -313
- package/dist/tui/agent.js.map +1 -1
- package/dist/tui/conversation-evidence-view.js +3 -3
- package/dist/tui/conversation-evidence-view.js.map +1 -1
- package/dist/tui/conversation-history.d.ts +4 -21
- package/dist/tui/conversation-history.d.ts.map +1 -1
- package/dist/tui/conversation-history.js +4 -28
- package/dist/tui/conversation-history.js.map +1 -1
- package/dist/tui/index.d.ts.map +1 -1
- package/dist/tui/index.js +27 -1
- package/dist/tui/index.js.map +1 -1
- package/dist/tui/log-pane.js +1 -1
- package/dist/tui/markdownParser.d.ts +1 -1
- package/dist/tui/markdownParser.js +1 -1
- package/dist/tui/permission-review.d.ts +16 -0
- package/dist/tui/permission-review.d.ts.map +1 -1
- package/dist/tui/permission-review.js +25 -2
- package/dist/tui/permission-review.js.map +1 -1
- package/dist/tui/slashCommands.d.ts +29 -40
- package/dist/tui/slashCommands.d.ts.map +1 -1
- package/dist/tui/slashCommands.js +70 -61
- package/dist/tui/slashCommands.js.map +1 -1
- package/dist/tui/{run-interruption.d.ts → turn-interruption.d.ts} +4 -4
- package/dist/tui/turn-interruption.d.ts.map +1 -0
- package/dist/tui/{run-interruption.js → turn-interruption.js} +20 -20
- package/dist/tui/turn-interruption.js.map +1 -0
- package/dist/tui/turn-limits-settings.d.ts +39 -0
- package/dist/tui/turn-limits-settings.d.ts.map +1 -0
- package/dist/tui/{run-limits-settings.js → turn-limits-settings.js} +18 -18
- package/dist/tui/turn-limits-settings.js.map +1 -0
- package/dist/tui/types.d.ts +3 -3
- package/dist/tui/types.d.ts.map +1 -1
- package/dist/user-commands/store.d.ts +1 -1
- package/dist/user-commands/store.js +1 -1
- package/package.json +7 -7
- package/dist/integrations/sessions/compaction-evidence.d.ts +0 -5
- package/dist/integrations/sessions/compaction-evidence.d.ts.map +0 -1
- package/dist/integrations/sessions/compaction-evidence.js +0 -59
- package/dist/integrations/sessions/compaction-evidence.js.map +0 -1
- package/dist/integrations/sessions/database.d.ts +0 -5
- package/dist/integrations/sessions/database.d.ts.map +0 -1
- package/dist/integrations/sessions/database.js +0 -34
- package/dist/integrations/sessions/database.js.map +0 -1
- package/dist/integrations/sessions/paths.d.ts +0 -7
- package/dist/integrations/sessions/paths.d.ts.map +0 -1
- package/dist/integrations/sessions/paths.js +0 -14
- package/dist/integrations/sessions/paths.js.map +0 -1
- package/dist/integrations/sessions/run-discovery.d.ts +0 -24
- package/dist/integrations/sessions/run-discovery.d.ts.map +0 -1
- package/dist/integrations/sessions/run-discovery.js +0 -142
- package/dist/integrations/sessions/run-discovery.js.map +0 -1
- package/dist/integrations/sessions/turn-evidence.d.ts +0 -129
- package/dist/integrations/sessions/turn-evidence.d.ts.map +0 -1
- package/dist/integrations/sessions/turn-evidence.js +0 -517
- package/dist/integrations/sessions/turn-evidence.js.map +0 -1
- package/dist/integrations/subagents/history.d.ts +0 -26
- package/dist/integrations/subagents/history.d.ts.map +0 -1
- package/dist/integrations/subagents/history.js +0 -76
- package/dist/integrations/subagents/history.js.map +0 -1
- package/dist/integrations/subagents/runs.d.ts +0 -72
- package/dist/integrations/subagents/runs.d.ts.map +0 -1
- package/dist/integrations/subagents/runs.js +0 -155
- package/dist/integrations/subagents/runs.js.map +0 -1
- package/dist/tui/run-interruption.d.ts.map +0 -1
- package/dist/tui/run-interruption.js.map +0 -1
- package/dist/tui/run-limits-settings.d.ts +0 -39
- package/dist/tui/run-limits-settings.d.ts.map +0 -1
- package/dist/tui/run-limits-settings.js.map +0 -1
package/dist/tui/agent.d.ts
CHANGED
|
@@ -11,26 +11,29 @@
|
|
|
11
11
|
* Unlike the earlier `chatStream()`-only adapter, this drives the full
|
|
12
12
|
* tool-execution loop: the model can call tools, their results are fed
|
|
13
13
|
* back, and the loop iterates until the turn settles. We translate the
|
|
14
|
-
* SDK's `
|
|
14
|
+
* SDK's `SessionEvent` stream into the TUI's smaller `AgentEvent` vocabulary
|
|
15
15
|
* (text deltas + tool start/end + done/error).
|
|
16
16
|
*
|
|
17
|
-
* The TUI
|
|
18
|
-
* every turn
|
|
17
|
+
* The TUI holds the conversation it renders and passes the full `Message[]`
|
|
18
|
+
* on every turn; the session's log, which the kernel appends to while the
|
|
19
|
+
* turn runs, is what a later resume folds back. Empty / partial states (no
|
|
19
20
|
* credentials, no preferences, no matching detected provider) return an
|
|
20
21
|
* `emptySession()` whose `send()` yields a single error event so the UI
|
|
21
22
|
* renders an actionable hint rather than crashing.
|
|
22
23
|
*/
|
|
23
|
-
import { type AuthorizationRule, type BackgroundJob, type
|
|
24
|
+
import { type AuthorizationRule, type BackgroundJob, type CompactionResult, type CostInfo, type GoalRoundAuthority, type LLMProvider, type MemoryType, type Message, type ModelInfo, type Origin, type PrepareStep, type ProjectId, type ReasoningEffort, type RenderedMemoryIndex, type ResidentHistorySource, type ResidentStepPromptOptions, type ResidentToolEvidenceSource, type ResumeHandler, type ResumeOutcome, type ReviewAnswer, type SessionCheckpointStore, type SessionEvent, type SessionGoalStore, type SessionId, type SessionLease, type SessionLog, type SessionStartedRecord, type SessionTokenBudgetSummary, type StopReason, type StructuredOutputConfig, type TaskStore, type TenantId, type ToolCallEscalation, type ToolCallView, type ToolPresenter, ToolRegistry, type ToolResultView, type ToolReviewAnswer, type ToolReviewPrompt, type ToolReviewRequest, type TopicId, type TurnId, batchNeedsReview } from '@namzu/sdk';
|
|
24
25
|
import { FileCheckpointStore } from '../checkpoints/store.js';
|
|
25
|
-
import type { CompactionCliConfig, HooksConfig, MemoryCliConfig, PluginConfig,
|
|
26
|
+
import type { CompactionCliConfig, HooksConfig, MemoryCliConfig, PluginConfig, SandboxConfig, TurnLimitsConfig, WebConfig } from '../config/schema.js';
|
|
26
27
|
import { type ToolResultScreenConfig } from '../config/tool-result-screens.js';
|
|
28
|
+
import { type SessionDirectories } from '../context/directories.js';
|
|
27
29
|
import { type SandboxSummary } from '../context/sandbox.js';
|
|
28
30
|
import { type ConnectedMcpServer, type FailedMcpServer, type McpServersConfig } from '../integrations/mcp/servers.js';
|
|
29
31
|
import { type CliPluginRuntime } from '../integrations/plugins/runtime.js';
|
|
30
32
|
import { type DetectedProvider, type Preferences, type ProviderId } from '../integrations/providers/index.js';
|
|
31
|
-
import type
|
|
33
|
+
import { type ConversationContext } from '../integrations/sessions/store.js';
|
|
32
34
|
import type { SubagentActivity, SubagentActivitySource } from '../integrations/subagents/activity.js';
|
|
33
|
-
import { type
|
|
35
|
+
import { type Batch } from '../integrations/subagents/batches.js';
|
|
36
|
+
import { type TypedNoteResult } from '../memory/typed.js';
|
|
34
37
|
import type { PermissionMode } from '../permissions/mode.js';
|
|
35
38
|
import { type ModelSwitchOutcome } from './model-switch-tool.js';
|
|
36
39
|
import { type ModelSwitchRequest } from './model-switch.js';
|
|
@@ -48,15 +51,15 @@ export type AgentEvent = {
|
|
|
48
51
|
* way to name the answer it was looking at.
|
|
49
52
|
*/
|
|
50
53
|
readonly messageId?: string;
|
|
51
|
-
/** The
|
|
52
|
-
readonly
|
|
54
|
+
/** The turn that produced it — a rating names both. */
|
|
55
|
+
readonly turnId?: string;
|
|
53
56
|
} | {
|
|
54
57
|
readonly kind: 'tool-start';
|
|
55
58
|
readonly activity?: 'exploration';
|
|
56
59
|
/** Exact task identity for host-owned wait presentation. */
|
|
57
60
|
readonly taskId?: string;
|
|
58
|
-
/**
|
|
59
|
-
readonly
|
|
61
|
+
/** Turn-scopes provider tool ids, which are not globally unique. */
|
|
62
|
+
readonly turnId?: string;
|
|
60
63
|
/** SDK tool-use id — stable across this call's start/end (for tracking). */
|
|
61
64
|
readonly toolUseId: string;
|
|
62
65
|
readonly toolName: string;
|
|
@@ -67,7 +70,7 @@ export type AgentEvent = {
|
|
|
67
70
|
readonly detail?: readonly string[];
|
|
68
71
|
} | {
|
|
69
72
|
readonly kind: 'tool-progress';
|
|
70
|
-
readonly
|
|
73
|
+
readonly turnId?: string;
|
|
71
74
|
readonly toolUseId: string;
|
|
72
75
|
readonly toolName: string;
|
|
73
76
|
/** Bounded latest-state text from the executing tool. */
|
|
@@ -77,7 +80,7 @@ export type AgentEvent = {
|
|
|
77
80
|
readonly kind: 'tool-end';
|
|
78
81
|
/** Verbatim retained output, before terminal preview projection. */
|
|
79
82
|
readonly output?: string;
|
|
80
|
-
readonly
|
|
83
|
+
readonly turnId?: string;
|
|
81
84
|
readonly toolUseId: string;
|
|
82
85
|
readonly toolName: string;
|
|
83
86
|
readonly isError: boolean;
|
|
@@ -101,9 +104,12 @@ export type AgentEvent = {
|
|
|
101
104
|
readonly done?: boolean;
|
|
102
105
|
} | {
|
|
103
106
|
readonly kind: 'usage';
|
|
107
|
+
/** The session and turn this spend belongs to. */
|
|
108
|
+
readonly sessionId?: string;
|
|
109
|
+
readonly turnId?: string;
|
|
104
110
|
/** Parent and all descendants, reported separately from own usage. */
|
|
105
|
-
readonly budget?:
|
|
106
|
-
/** CUMULATIVE
|
|
111
|
+
readonly budget?: SessionTokenBudgetSummary;
|
|
112
|
+
/** CUMULATIVE turn spend. Never a context size. */
|
|
107
113
|
readonly totalTokens: number;
|
|
108
114
|
/**
|
|
109
115
|
* The kernel's cost record, carried whole.
|
|
@@ -111,7 +117,7 @@ export type AgentEvent = {
|
|
|
111
117
|
* This was `costUsd: number`, narrowed from the same object at the
|
|
112
118
|
* mapping site, and the number on its own cannot answer the
|
|
113
119
|
* question the screen asks. A total of zero means two different
|
|
114
|
-
* things — the
|
|
120
|
+
* things — the turn cost nothing, or nobody could price it — and
|
|
115
121
|
* `unpricedTokens` is what separates them. Passing only the total
|
|
116
122
|
* left every surface downstream to guess, and both of them guessed
|
|
117
123
|
* "free".
|
|
@@ -131,7 +137,7 @@ export type AgentEvent = {
|
|
|
131
137
|
* cannot mark an estimated numerator honestly while silently
|
|
132
138
|
* treating an assumed window as measured.
|
|
133
139
|
*
|
|
134
|
-
* All four absent when the
|
|
140
|
+
* All four absent when the turn resolved no window — then there is
|
|
135
141
|
* no proportion to show, only the spend.
|
|
136
142
|
*/
|
|
137
143
|
readonly contextTokens?: number;
|
|
@@ -142,8 +148,8 @@ export type AgentEvent = {
|
|
|
142
148
|
/**
|
|
143
149
|
* Context was discarded, or an attempt to discard it declined.
|
|
144
150
|
*
|
|
145
|
-
* Everything else this session fixed was the
|
|
146
|
-
* operator asked. This is the same class with the opposite sign: the
|
|
151
|
+
* Everything else this session fixed was the turn quietly not doing what the
|
|
152
|
+
* operator asked. This is the same class with the opposite sign: the turn
|
|
147
153
|
* quietly doing something they did not ask for. Compaction deletes messages
|
|
148
154
|
* irrecoverably, and the first time a user learned it existed was when the
|
|
149
155
|
* agent had forgotten something they were relying on — which reads as the
|
|
@@ -185,16 +191,16 @@ export type AgentEvent = {
|
|
|
185
191
|
readonly text: string;
|
|
186
192
|
} | {
|
|
187
193
|
readonly kind: 'capability-warning';
|
|
188
|
-
readonly capability: Extract<
|
|
194
|
+
readonly capability: Extract<SessionEvent, {
|
|
189
195
|
type: 'capability_warning';
|
|
190
196
|
}>['capability'];
|
|
191
|
-
readonly contentSource?: Extract<
|
|
197
|
+
readonly contentSource?: Extract<SessionEvent, {
|
|
192
198
|
type: 'capability_warning';
|
|
193
199
|
}>['contentSource'];
|
|
194
200
|
readonly text: string;
|
|
195
201
|
} | {
|
|
196
202
|
readonly kind: 'history-repair';
|
|
197
|
-
readonly source: Extract<
|
|
203
|
+
readonly source: Extract<SessionEvent, {
|
|
198
204
|
type: 'message_history_repaired';
|
|
199
205
|
}>['source'];
|
|
200
206
|
readonly text: string;
|
|
@@ -218,45 +224,58 @@ export type AgentEvent = {
|
|
|
218
224
|
* no reader anywhere in this package. The name was also wrong for what is
|
|
219
225
|
* needed here: a "finish reason" in this codebase is `MessageStopReason`,
|
|
220
226
|
* reported per model message, while the question a caller has at the end of
|
|
221
|
-
* a turn is the
|
|
227
|
+
* a turn is the turn-level `StopReason` — did it answer, or did it run out
|
|
222
228
|
* of budget, iterations, time, or permission to say what it produced.
|
|
223
229
|
*/
|
|
224
230
|
| {
|
|
225
231
|
readonly kind: 'done';
|
|
232
|
+
/** The session and turn that settled. */
|
|
233
|
+
readonly sessionId?: string;
|
|
234
|
+
readonly turnId?: string;
|
|
226
235
|
/** Settled kernel result, including an intentionally empty guarded result. */
|
|
227
236
|
readonly text?: string;
|
|
228
237
|
readonly stopReason?: StopReason;
|
|
229
|
-
readonly budget?:
|
|
238
|
+
readonly budget?: SessionTokenBudgetSummary;
|
|
230
239
|
} | {
|
|
231
|
-
/** A recoverable
|
|
240
|
+
/** A recoverable turn stopped with an addressable checkpoint. */
|
|
232
241
|
readonly kind: 'paused';
|
|
233
|
-
readonly budget?:
|
|
234
|
-
/** The
|
|
235
|
-
readonly
|
|
242
|
+
readonly budget?: SessionTokenBudgetSummary;
|
|
243
|
+
/** The turn that paused: with the checkpoint, what `resumePaused` needs. */
|
|
244
|
+
readonly turnId: string;
|
|
236
245
|
readonly checkpointId: string;
|
|
237
246
|
readonly reason: string;
|
|
238
|
-
readonly failure?: Extract<
|
|
239
|
-
type: '
|
|
247
|
+
readonly failure?: Extract<SessionEvent, {
|
|
248
|
+
type: 'turn_paused';
|
|
240
249
|
}>['failure'];
|
|
241
|
-
readonly providerError?: Extract<
|
|
242
|
-
type: '
|
|
250
|
+
readonly providerError?: Extract<SessionEvent, {
|
|
251
|
+
type: 'turn_paused';
|
|
243
252
|
}>['providerError'];
|
|
244
|
-
readonly explanation?: Extract<
|
|
245
|
-
type: '
|
|
253
|
+
readonly explanation?: Extract<SessionEvent, {
|
|
254
|
+
type: 'turn_paused';
|
|
246
255
|
}>['explanation'];
|
|
247
256
|
} | {
|
|
248
257
|
readonly kind: 'error';
|
|
249
|
-
readonly budget?:
|
|
258
|
+
readonly budget?: SessionTokenBudgetSummary;
|
|
250
259
|
readonly message: string;
|
|
251
|
-
readonly failure?: Extract<
|
|
252
|
-
type: '
|
|
260
|
+
readonly failure?: Extract<SessionEvent, {
|
|
261
|
+
type: 'turn_failed';
|
|
253
262
|
}>['failure'];
|
|
254
|
-
readonly providerError?: Extract<
|
|
255
|
-
type: '
|
|
263
|
+
readonly providerError?: Extract<SessionEvent, {
|
|
264
|
+
type: 'turn_failed';
|
|
256
265
|
}>['providerError'];
|
|
257
|
-
readonly explanation?: Extract<
|
|
258
|
-
type: '
|
|
266
|
+
readonly explanation?: Extract<SessionEvent, {
|
|
267
|
+
type: 'turn_failed';
|
|
259
268
|
}>['explanation'];
|
|
269
|
+
/**
|
|
270
|
+
* The conversation already has an active turn, so this one was not
|
|
271
|
+
* started (`TurnInProgressError`). A paused turn is left to
|
|
272
|
+
* `resumePaused` or `abandonTurn`; nothing is closed implicitly.
|
|
273
|
+
*/
|
|
274
|
+
readonly turnInProgress?: {
|
|
275
|
+
readonly sessionId: string;
|
|
276
|
+
readonly activeTurnId: string;
|
|
277
|
+
readonly state: 'running' | 'paused' | 'interrupted';
|
|
278
|
+
};
|
|
260
279
|
};
|
|
261
280
|
/** A single tool the model wants to run, surfaced to the user for approval. */
|
|
262
281
|
export interface PermissionToolCall {
|
|
@@ -265,6 +284,8 @@ export interface PermissionToolCall {
|
|
|
265
284
|
/** Exact detached input the kernel prepared and the approval covers. */
|
|
266
285
|
readonly input: unknown;
|
|
267
286
|
readonly isDestructive: boolean;
|
|
287
|
+
/** What the call reaches past the turn's boundary; see `ToolCallSummary.escalation`. */
|
|
288
|
+
readonly escalation?: ToolCallEscalation;
|
|
268
289
|
}
|
|
269
290
|
/** The batch a person is asked about — the kernel's `ToolReviewRequest`. */
|
|
270
291
|
export type PermissionRequest = ToolReviewRequest;
|
|
@@ -290,8 +311,8 @@ export type QuestionAnswer = {
|
|
|
290
311
|
};
|
|
291
312
|
export type QuestionFn = (question: UserQuestion) => Promise<QuestionAnswer>;
|
|
292
313
|
export interface SendOptions {
|
|
293
|
-
/** Overrides for this new
|
|
294
|
-
readonly limits?:
|
|
314
|
+
/** Overrides for this new turn and its built-in children; does not change a parked turn. */
|
|
315
|
+
readonly limits?: TurnLimitsConfig;
|
|
295
316
|
readonly signal?: AbortSignal;
|
|
296
317
|
/**
|
|
297
318
|
* Who answers `ask_user_question` this turn. Absent means nobody: the
|
|
@@ -326,10 +347,22 @@ export interface SendOptions {
|
|
|
326
347
|
* Overrides the session default for this turn only.
|
|
327
348
|
*/
|
|
328
349
|
readonly permissionMode?: PermissionMode;
|
|
329
|
-
/**
|
|
330
|
-
|
|
331
|
-
|
|
350
|
+
/**
|
|
351
|
+
* Caller-reserved identity for this new turn, for a host that has to name
|
|
352
|
+
* the turn before it starts (a resident step's verifier). Absent: the
|
|
353
|
+
* kernel mints one, and the session learns it from the turn's first event.
|
|
354
|
+
*/
|
|
355
|
+
readonly turnId?: TurnId;
|
|
356
|
+
/** Why this turn exists (a prompt, a goal round, a resident step), recorded on `turn_started`. */
|
|
357
|
+
readonly origin?: Origin;
|
|
358
|
+
/** Exact durable admission that makes goal tools visible for this one turn. */
|
|
332
359
|
readonly goalRound?: GoalRoundAuthority;
|
|
360
|
+
/**
|
|
361
|
+
* Close an `interrupted` active turn (its process is gone) before this one
|
|
362
|
+
* begins, as `turn_failed{ interrupted }`. The interactive TUI passes it: it
|
|
363
|
+
* never resumed an interrupted turn. A paused turn is never closed this way.
|
|
364
|
+
*/
|
|
365
|
+
readonly abandonInterrupted?: boolean;
|
|
333
366
|
/**
|
|
334
367
|
* Called before a batch of non-read-only tools runs. Resolves with the
|
|
335
368
|
* user's decision. When omitted, prompt mode auto-approves because nobody
|
|
@@ -356,31 +389,33 @@ export interface SendOptions {
|
|
|
356
389
|
}
|
|
357
390
|
/** What {@link AgentSession.resumeDurable} needs that the session does not hold. */
|
|
358
391
|
export interface ResumeDurableParams {
|
|
392
|
+
/** The paused or interrupted turn to continue, and the session it belongs to. */
|
|
393
|
+
readonly entry: {
|
|
394
|
+
readonly tenantId: TenantId;
|
|
395
|
+
readonly projectId: ProjectId;
|
|
396
|
+
readonly sessionId: SessionId;
|
|
397
|
+
readonly turnId: TurnId;
|
|
398
|
+
};
|
|
399
|
+
/** The session's log; the resumed turn appends to it. */
|
|
400
|
+
readonly sessionLog: SessionLog;
|
|
401
|
+
/** Where the turn's checkpoints are. Absent: `<session-id>/checkpoints/` beside the log. */
|
|
402
|
+
readonly checkpointStore?: SessionCheckpointStore;
|
|
359
403
|
/**
|
|
360
|
-
* The
|
|
361
|
-
*
|
|
362
|
-
*
|
|
363
|
-
* passed here unreassembled — and why there is no chance of assembling it
|
|
364
|
-
* wrong.
|
|
365
|
-
*/
|
|
366
|
-
readonly entry: DurableRunEntry;
|
|
367
|
-
/** The backend the entry came from. */
|
|
368
|
-
readonly checkpointStore: CheckpointStore;
|
|
369
|
-
/**
|
|
370
|
-
* The fence of the claim this process holds on the run.
|
|
371
|
-
*
|
|
372
|
-
* Omit it only for a single-writer host. Present, it rides every durable
|
|
373
|
-
* write the resumed run makes, so a worker that stalled past its lease
|
|
374
|
-
* cannot overwrite the record of whoever took the run over.
|
|
404
|
+
* The lease this process holds on the session (`claimSession`). Present,
|
|
405
|
+
* every record the resumed turn appends carries its fence, so a worker that
|
|
406
|
+
* stalled past its lease cannot write over whoever took the session over.
|
|
375
407
|
*/
|
|
376
|
-
readonly
|
|
408
|
+
readonly lease?: SessionLease;
|
|
377
409
|
readonly signal?: AbortSignal;
|
|
378
410
|
}
|
|
379
411
|
export interface ResumePausedParams {
|
|
380
|
-
/** The
|
|
381
|
-
readonly
|
|
382
|
-
/**
|
|
383
|
-
|
|
412
|
+
/** The turn the `paused` event named. */
|
|
413
|
+
readonly turnId: string;
|
|
414
|
+
/**
|
|
415
|
+
* The checkpoint the `paused` event named. Absent: the one an open
|
|
416
|
+
* decision references, else the newest.
|
|
417
|
+
*/
|
|
418
|
+
readonly checkpointId?: string;
|
|
384
419
|
readonly signal?: AbortSignal;
|
|
385
420
|
}
|
|
386
421
|
export interface AgentSession {
|
|
@@ -393,7 +428,7 @@ export interface AgentSession {
|
|
|
393
428
|
*
|
|
394
429
|
* Carried on the session rather than re-resolved by whoever asks, because
|
|
395
430
|
* resolving builds a provider — and a second one would answer about a
|
|
396
|
-
* different sandbox than the one the
|
|
431
|
+
* different sandbox than the one the turn is using.
|
|
397
432
|
*/
|
|
398
433
|
readonly sandbox: SandboxSummary;
|
|
399
434
|
readonly providerSummary: string | null;
|
|
@@ -526,15 +561,15 @@ export interface AgentSession {
|
|
|
526
561
|
* the runtime to find out.
|
|
527
562
|
*/
|
|
528
563
|
readonly agentIds: readonly string[];
|
|
529
|
-
/**
|
|
564
|
+
/** Task store of this conversation (`<session-id>/tasks/`); absent before a turn starts. */
|
|
530
565
|
readonly currentTaskStore?: () => TaskStore | undefined;
|
|
531
|
-
/** Forget the selected
|
|
566
|
+
/** Forget the selected store when the operator leaves its conversation. Does not delete tasks. */
|
|
532
567
|
readonly resetTaskStore?: () => void;
|
|
533
568
|
/** Children created in this process, available for the TUI's observational view. */
|
|
534
569
|
readonly subagents?: SubagentActivitySource;
|
|
535
570
|
/**
|
|
536
|
-
* Children of this conversation's earlier
|
|
537
|
-
*
|
|
571
|
+
* Children of this conversation's earlier turns, rebuilt from their own
|
|
572
|
+
* session logs.
|
|
538
573
|
*
|
|
539
574
|
* The counterpart of {@link subagents}, which only ever holds what THIS
|
|
540
575
|
* process launched and only until its eighty-agent bound evicts it. Both
|
|
@@ -549,17 +584,13 @@ export interface AgentSession {
|
|
|
549
584
|
*/
|
|
550
585
|
readonly savedChildren?: () => Promise<readonly SubagentActivity[]>;
|
|
551
586
|
/**
|
|
552
|
-
*
|
|
553
|
-
*
|
|
554
|
-
* grouped by parent
|
|
555
|
-
*
|
|
556
|
-
*
|
|
557
|
-
* `liveOrchestrationRuns` over the live monitor's own snapshot instead, the
|
|
558
|
-
* same split {@link savedChildren} draws against `subagents`. Optional for
|
|
559
|
-
* the same reason that one is — an embedded session with no evidence on
|
|
560
|
-
* disk has none to offer.
|
|
587
|
+
* Batches of delegated work this conversation's turns launched, read from
|
|
588
|
+
* the session index — the counterpart of {@link savedChildren} for
|
|
589
|
+
* `/agents batches`, grouped by parent turn rather than flattened to one row
|
|
590
|
+
* per child. The live half comes from the monitor; `agentsSlashCommand`
|
|
591
|
+
* merges the two. Optional because a session with no durable log has none.
|
|
561
592
|
*/
|
|
562
|
-
readonly
|
|
593
|
+
readonly listSavedBatches?: () => Promise<readonly Batch[]>;
|
|
563
594
|
/**
|
|
564
595
|
* Things about this session's configuration the operator must be told, every
|
|
565
596
|
* launch — today, an accepted capability disagreement in the provider chain,
|
|
@@ -572,6 +603,29 @@ export interface AgentSession {
|
|
|
572
603
|
* shown.
|
|
573
604
|
*/
|
|
574
605
|
readonly configNotices: readonly string[];
|
|
606
|
+
/**
|
|
607
|
+
* Save an operator note (`#note`, `/memory add`) as a typed memory file in
|
|
608
|
+
* this session's stored memory, default type `project`. Absent on a session
|
|
609
|
+
* with no store, where notes go to the curated project file as before.
|
|
610
|
+
*/
|
|
611
|
+
readonly rememberNote?: (text: string, type?: MemoryType) => Promise<TypedNoteResult>;
|
|
612
|
+
/**
|
|
613
|
+
* Copy the project's curated bullets into stored memory
|
|
614
|
+
* (`/memory import-notes`), returning the operator's report. The curated
|
|
615
|
+
* file is never changed.
|
|
616
|
+
*/
|
|
617
|
+
readonly importCuratedNotes?: () => Promise<string>;
|
|
618
|
+
/**
|
|
619
|
+
* What `/memory` shows of stored memory, and where the files are: `index`,
|
|
620
|
+
* the always-loaded index uncapped — every active memory someone chose to
|
|
621
|
+
* keep — and `derived`, the active records runs recorded on their own (the
|
|
622
|
+
* run promoter, consolidation), which the prompt's index leaves out.
|
|
623
|
+
*/
|
|
624
|
+
readonly storedMemoryIndex?: () => Promise<{
|
|
625
|
+
readonly directory: string;
|
|
626
|
+
readonly index: RenderedMemoryIndex;
|
|
627
|
+
readonly derived: RenderedMemoryIndex;
|
|
628
|
+
}>;
|
|
575
629
|
/**
|
|
576
630
|
* Whether "approve all" has been chosen at a prompt during this session.
|
|
577
631
|
*
|
|
@@ -605,41 +659,42 @@ export interface AgentSession {
|
|
|
605
659
|
readonly promptExemptTools: () => readonly string[];
|
|
606
660
|
send(messages: readonly Message[], opts?: SendOptions): AsyncIterable<AgentEvent>;
|
|
607
661
|
/**
|
|
608
|
-
* Continue a
|
|
662
|
+
* Continue a turn some OTHER process started, from its session log.
|
|
609
663
|
*
|
|
610
|
-
* The
|
|
611
|
-
*
|
|
612
|
-
* the
|
|
613
|
-
*
|
|
614
|
-
* way out. So `namzu` could produce durable runs and never pick one up.
|
|
664
|
+
* The half a checkpoint cannot carry (the provider client, the tool
|
|
665
|
+
* registry, the working directory) lives inside this session, so this is
|
|
666
|
+
* the way a drainer continues a parked turn: the SAME session and the SAME
|
|
667
|
+
* `turnId`, through the kernel's `resumeSession`.
|
|
615
668
|
*
|
|
616
|
-
* Returns the outcome rather than a stream:
|
|
617
|
-
*
|
|
618
|
-
*
|
|
619
|
-
*
|
|
669
|
+
* Returns the outcome rather than a stream: the resumed turn is drained to
|
|
670
|
+
* settlement. A turn parked on a decision comes back as
|
|
671
|
+
* `awaiting-decision` and is NOT resumed past — the answer is a human's,
|
|
672
|
+
* not a drainer's.
|
|
620
673
|
*/
|
|
621
674
|
resumeDurable(params: ResumeDurableParams): Promise<ResumeOutcome>;
|
|
622
675
|
/**
|
|
623
|
-
* Continue THIS session's own
|
|
624
|
-
* checkpoint the pause named, streaming events as the resumed
|
|
625
|
-
* them.
|
|
676
|
+
* Continue THIS session's own turn after the provider paused it, from the
|
|
677
|
+
* checkpoint the pause named, streaming events as the resumed turn makes
|
|
678
|
+
* them — the same turn id, the same session log.
|
|
626
679
|
*
|
|
627
|
-
*
|
|
628
|
-
*
|
|
629
|
-
*
|
|
630
|
-
*
|
|
631
|
-
*
|
|
632
|
-
* re-prompted from whatever notes the run left behind, losing the run's
|
|
633
|
-
* own context. A run parked on a human decision is not resumed past: it
|
|
634
|
-
* comes back as an error naming the fact, because the answer is a
|
|
635
|
-
* person's.
|
|
680
|
+
* What a headless caller lacked was a way to say "wait, then go on" — it
|
|
681
|
+
* could only exit and be re-prompted from whatever notes the turn left
|
|
682
|
+
* behind, losing its own context. A turn parked on a human decision is not
|
|
683
|
+
* resumed past: it comes back as an error naming the fact, because the
|
|
684
|
+
* answer is a person's.
|
|
636
685
|
*/
|
|
637
686
|
resumePaused(params: ResumePausedParams): AsyncIterable<AgentEvent>;
|
|
687
|
+
/**
|
|
688
|
+
* Close this conversation's paused or interrupted turn without resuming it
|
|
689
|
+
* (`turn_failed{ error.code: 'abandoned' }`), so the next prompt can begin a
|
|
690
|
+
* turn. What `/abandon` does. A running turn is refused by the kernel.
|
|
691
|
+
*/
|
|
692
|
+
abandonTurn?(turnId: TurnId, reason: string): Promise<void>;
|
|
638
693
|
/**
|
|
639
694
|
* Cancel and settle live sends, compactions and durable resumes, then release
|
|
640
695
|
* what the session holds — today, the external tool servers.
|
|
641
696
|
*
|
|
642
|
-
* A stdio server is a CHILD PROCESS, and closing it while a live
|
|
697
|
+
* A stdio server is a CHILD PROCESS, and closing it while a live turn still
|
|
643
698
|
* owns one of its tools is a use-after-close race. Idempotent, waits for the
|
|
644
699
|
* operations it cancelled, and safe to call on a session that connected
|
|
645
700
|
* nothing. Calls made after close refuse before provider work starts.
|
|
@@ -717,8 +772,25 @@ export interface AgentSessionOptions {
|
|
|
717
772
|
* registry and does not restore this fork's activation snapshot.
|
|
718
773
|
*/
|
|
719
774
|
readonly toolLoading?: 'eager' | 'deferred';
|
|
720
|
-
/**
|
|
721
|
-
|
|
775
|
+
/**
|
|
776
|
+
* Session/topic/project/tenant identity for this session's turns. Minted
|
|
777
|
+
* when absent, with the project the working directory's checkout stands
|
|
778
|
+
* for (`projects/<slug>/project.json`), so the same directory keeps the
|
|
779
|
+
* same project across sessions.
|
|
780
|
+
*/
|
|
781
|
+
readonly scope?: SessionScope;
|
|
782
|
+
/**
|
|
783
|
+
* The session this agent's turns are recorded into when {@link scope} is
|
|
784
|
+
* absent: a protocol gateway (ACP) resolves its client's id to a session
|
|
785
|
+
* first and hands the result here. Ignored when `scope` is given.
|
|
786
|
+
*/
|
|
787
|
+
readonly sessionId?: SessionId;
|
|
788
|
+
/**
|
|
789
|
+
* Who started the session, written into its `session_started` record the
|
|
790
|
+
* first time a turn runs in it: the protocol and, for a gateway, the
|
|
791
|
+
* client's own id for it. Absent: `{ protocol: 'cli' }`.
|
|
792
|
+
*/
|
|
793
|
+
readonly origin?: SessionStartedRecord['origin'];
|
|
722
794
|
/**
|
|
723
795
|
* The directory the agent works in: what every filesystem tool resolves a
|
|
724
796
|
* relative path against and where sub-agents run. Generated task and memory
|
|
@@ -727,25 +799,34 @@ export interface AgentSessionOptions {
|
|
|
727
799
|
* Taken as an argument rather than read from `process.cwd()` at each of
|
|
728
800
|
* those four points, which is what let `--cwd` reach the session store and
|
|
729
801
|
* the skill search and stop there: the caller parsed a directory, the agent
|
|
730
|
-
* globbed a different one, and the
|
|
802
|
+
* globbed a different one, and the turn reported finding nothing rather than
|
|
731
803
|
* having looked in the wrong place.
|
|
732
804
|
*/
|
|
733
805
|
readonly cwd?: string;
|
|
734
806
|
/**
|
|
735
|
-
*
|
|
736
|
-
*
|
|
737
|
-
*
|
|
807
|
+
* The application home (`NAMZU_HOME`) this session files its state under:
|
|
808
|
+
* `projects/<slug>/` for the working directory's checkout. Absent means
|
|
809
|
+
* `resolveNamzuHome()`. Never the working directory.
|
|
738
810
|
*/
|
|
739
811
|
readonly stateRoot?: string;
|
|
740
|
-
/**
|
|
812
|
+
/**
|
|
813
|
+
* Host-owned durable conversations: the layout and index the session's
|
|
814
|
+
* logs live in, for turn-scoped original evidence retrieval and the
|
|
815
|
+
* delegation views. Absent: the layout of the working directory's project
|
|
816
|
+
* under {@link stateRoot}.
|
|
817
|
+
*/
|
|
741
818
|
readonly conversationSessions?: ConversationContext;
|
|
819
|
+
/**
|
|
820
|
+
* Keep every turn in memory: an in-memory session log per send, nothing
|
|
821
|
+
* written under `NAMZU_HOME`. For a stateless host (`run-stream` without
|
|
822
|
+
* `--session`), whose history arrives with each call.
|
|
823
|
+
*/
|
|
824
|
+
readonly ephemeral?: boolean;
|
|
742
825
|
/** Earlier settled steps of one resident pursuit, bound before this session starts. */
|
|
743
826
|
readonly residentHistory?: ResidentHistorySource;
|
|
744
827
|
readonly residentToolEvidence?: ResidentToolEvidenceSource;
|
|
745
828
|
/** Host-bound to this resident admission; fresh sends only, never checkpoint resume. */
|
|
746
829
|
readonly residentEvidenceRecall?: PrepareStep;
|
|
747
|
-
/** False when an enclosing host owns signals and must drain before exiting. */
|
|
748
|
-
readonly emergencySave?: boolean;
|
|
749
830
|
/**
|
|
750
831
|
* Operator-authored tool rules, already compiled to the kernel's vocabulary.
|
|
751
832
|
*
|
|
@@ -768,12 +849,12 @@ export interface AgentSessionOptions {
|
|
|
768
849
|
* feedback when it is not good enough.
|
|
769
850
|
*
|
|
770
851
|
* A SESSION option rather than a `SendOptions` one, because a gate is a
|
|
771
|
-
* standing condition on the
|
|
852
|
+
* standing condition on the turn — "don't finish until the build passes" —
|
|
772
853
|
* not a property of one message. Absent leaves the loop byte-identical.
|
|
773
854
|
*/
|
|
774
855
|
readonly reviewAnswer?: ReviewAnswer;
|
|
775
856
|
/**
|
|
776
|
-
* Rejections the reviewer is allowed before the
|
|
857
|
+
* Rejections the reviewer is allowed before the turn stops with
|
|
777
858
|
* `answer_rejected`. Absent uses the kernel's default.
|
|
778
859
|
*/
|
|
779
860
|
readonly maxAnswerReviews?: number;
|
|
@@ -811,17 +892,17 @@ export interface AgentSessionOptions {
|
|
|
811
892
|
/** See `NamzuCliConfig.compaction`. Absent means the kernel's structured strategy. */
|
|
812
893
|
readonly compaction?: CompactionCliConfig;
|
|
813
894
|
readonly memory?: MemoryCliConfig;
|
|
814
|
-
/** See `NamzuCliConfig.limits`: how many model calls and tokens one
|
|
815
|
-
readonly limits?:
|
|
895
|
+
/** See `NamzuCliConfig.limits`: how many model calls and tokens one turn may spend. */
|
|
896
|
+
readonly limits?: TurnLimitsConfig;
|
|
816
897
|
/**
|
|
817
|
-
* Where this session's
|
|
898
|
+
* Where this session's events are recorded, if anywhere.
|
|
818
899
|
*
|
|
819
900
|
* A listener rather than a config: the CLI resolves `@namzu/telemetry`,
|
|
820
901
|
* builds the sink and the redaction chain, and hands the result here
|
|
821
902
|
* already assembled — so this file has no opinion about optional
|
|
822
903
|
* packages, redactors, or what a destination is.
|
|
823
904
|
*/
|
|
824
|
-
readonly
|
|
905
|
+
readonly onSessionEvent?: (event: SessionEvent) => void;
|
|
825
906
|
/** Durable goal authority for the main TUI session; omitted on headless surfaces. */
|
|
826
907
|
readonly sessionGoals?: SessionGoalStore;
|
|
827
908
|
/**
|
|
@@ -921,7 +1002,7 @@ export declare function listProviderModels(id: ProviderId, det: DetectedProvider
|
|
|
921
1002
|
id: string;
|
|
922
1003
|
name: string;
|
|
923
1004
|
}>>;
|
|
924
|
-
export interface
|
|
1005
|
+
export interface SessionScope {
|
|
925
1006
|
/**
|
|
926
1007
|
* The active conversation. Chosen before the conversation is written
|
|
927
1008
|
* and never replaced by a provisional value; it changes only when the
|
|
@@ -934,14 +1015,7 @@ export interface RunScope {
|
|
|
934
1015
|
readonly tenantId: TenantId;
|
|
935
1016
|
}
|
|
936
1017
|
/** What `/add-dir` talks to. */
|
|
937
|
-
export
|
|
938
|
-
list(): readonly string[];
|
|
939
|
-
add(path: string): Promise<{
|
|
940
|
-
readonly added: boolean;
|
|
941
|
-
readonly path: string;
|
|
942
|
-
readonly reason?: string;
|
|
943
|
-
}>;
|
|
944
|
-
}
|
|
1018
|
+
export type { SessionDirectories } from '../context/directories.js';
|
|
945
1019
|
/**
|
|
946
1020
|
* The kernel's review policy with the TUI's prompt behind it.
|
|
947
1021
|
*
|
|
@@ -951,7 +1025,9 @@ export interface SessionDirectories {
|
|
|
951
1025
|
*/
|
|
952
1026
|
export declare function makeResumeHandler(approval: {
|
|
953
1027
|
all: boolean;
|
|
954
|
-
}, onPermission: PermissionFn | undefined, mode?: PermissionMode, exempt?: (name: string, input: unknown) => boolean
|
|
1028
|
+
}, onPermission: PermissionFn | undefined, mode?: PermissionMode, exempt?: (name: string, input: unknown) => boolean, escapePolicy?: {
|
|
1029
|
+
readonly unattendedSandboxEscape?: 'refuse' | 'allow';
|
|
1030
|
+
}): ResumeHandler;
|
|
955
1031
|
/**
|
|
956
1032
|
* Whether a call runs without asking. The kernel's rule: a trusted read-only
|
|
957
1033
|
* declaration or a named bookkeeping write, never a fetch, never a tool the
|
|
@@ -963,11 +1039,11 @@ export declare function promptExemptToolNames(registry: ToolRegistry): readonly
|
|
|
963
1039
|
/** A batch needs explicit approval when any call mutates state. */
|
|
964
1040
|
export declare const batchNeedsPrompt: typeof batchNeedsReview;
|
|
965
1041
|
/**
|
|
966
|
-
* Translate one SDK `
|
|
1042
|
+
* Translate one SDK `SessionEvent` into the TUI's `AgentEvent` vocabulary, or
|
|
967
1043
|
* `null` for events the chat surface doesn't render (iteration markers,
|
|
968
|
-
*
|
|
1044
|
+
* checkpoints, plan lifecycle, …). Pure — unit-tested.
|
|
969
1045
|
*/
|
|
970
|
-
export declare function toAgentEvent(event:
|
|
1046
|
+
export declare function toAgentEvent(event: SessionEvent, presenter: ToolPresenter): AgentEvent | null;
|
|
971
1047
|
/**
|
|
972
1048
|
* The one presentation function this host keeps.
|
|
973
1049
|
*
|