@gajae-code/coding-agent 0.11.11 → 0.12.1
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 +131 -4
- package/dist/types/async/job-manager.d.ts +17 -3
- package/dist/types/cli/read-cli.d.ts +1 -0
- package/dist/types/commands/deep-interview.d.ts +9 -0
- package/dist/types/commands/harness.d.ts +22 -0
- package/dist/types/commands/read.d.ts +6 -0
- package/dist/types/config/model-registry.d.ts +4 -0
- package/dist/types/config/provider-auth-health.d.ts +14 -0
- package/dist/types/config/provider-ranking.d.ts +59 -0
- package/dist/types/config/settings-schema.d.ts +83 -1
- package/dist/types/config/settings.d.ts +2 -0
- package/dist/types/exa/mcp-client.d.ts +10 -1
- package/dist/types/exec/bash-executor.d.ts +45 -12
- package/dist/types/extensibility/extensions/types.d.ts +38 -4
- package/dist/types/extensibility/gjc-plugins/index.d.ts +12 -2
- package/dist/types/extensibility/gjc-plugins/installer.d.ts +63 -7
- package/dist/types/extensibility/gjc-plugins/lifecycle-reconciliation.d.ts +55 -0
- package/dist/types/extensibility/gjc-plugins/lifecycle.d.ts +64 -0
- package/dist/types/extensibility/gjc-plugins/runtime-quarantine.d.ts +67 -0
- package/dist/types/extensibility/gjc-plugins/session-validation.d.ts +3 -1
- package/dist/types/extensibility/gjc-plugins/types.d.ts +124 -0
- package/dist/types/extensibility/shared-events.d.ts +6 -0
- package/dist/types/gjc-runtime/deep-interview-ambiguity.d.ts +5 -12
- package/dist/types/gjc-runtime/deep-interview-recorder.d.ts +17 -32
- package/dist/types/gjc-runtime/deep-interview-stage.d.ts +37 -0
- package/dist/types/gjc-runtime/deep-interview-state.d.ts +4 -135
- package/dist/types/gjc-runtime/gc-runtime.d.ts +1 -1
- package/dist/types/gjc-runtime/launch-tmux.d.ts +1 -0
- package/dist/types/gjc-runtime/memory-guard-owner-claims.d.ts +47 -0
- package/dist/types/gjc-runtime/ralplan-runtime.d.ts +70 -1
- package/dist/types/gjc-runtime/state-writer.d.ts +5 -46
- package/dist/types/gjc-runtime/team-launch.d.ts +1 -1
- package/dist/types/gjc-runtime/team-runtime.d.ts +27 -1
- package/dist/types/gjc-runtime/team-store.d.ts +12 -0
- package/dist/types/gjc-runtime/team-worker-heartbeat.d.ts +43 -0
- package/dist/types/gjc-runtime/team-worker-memory-guard.d.ts +92 -0
- package/dist/types/gjc-runtime/tmux-owner-isolation.d.ts +17 -0
- package/dist/types/gjc-runtime/ultragoal-receipt-freshness.d.ts +8 -0
- package/dist/types/gjc-runtime/ultragoal-runtime.d.ts +31 -80
- package/dist/types/gjc-runtime/workflow-manifest.d.ts +3 -5
- package/dist/types/internal-urls/local-root-gc.d.ts +2 -0
- package/dist/types/main.d.ts +1 -1
- package/dist/types/memories/index.d.ts +2 -0
- package/dist/types/modes/acp/acp-agent.d.ts +10 -19
- package/dist/types/modes/components/assistant-message.d.ts +3 -1
- package/dist/types/modes/components/gjc-bundle-settings.d.ts +34 -0
- package/dist/types/modes/components/irc-sidebar.d.ts +41 -0
- package/dist/types/modes/components/notifications-settings-editor.d.ts +1 -0
- package/dist/types/modes/components/read-tool-group.d.ts +4 -4
- package/dist/types/modes/components/session-observer-overlay.d.ts +22 -0
- package/dist/types/modes/components/settings-selector.d.ts +11 -0
- package/dist/types/modes/components/status-line/gh.d.ts +5 -0
- package/dist/types/modes/components/tool-execution.d.ts +8 -0
- package/dist/types/modes/components/transcript-viewer-overlay.d.ts +18 -1
- package/dist/types/modes/controllers/event-controller.d.ts +3 -0
- package/dist/types/modes/interactive-mode.d.ts +2 -0
- package/dist/types/modes/irc-observation-ledger.d.ts +17 -1
- package/dist/types/modes/types.d.ts +2 -0
- package/dist/types/modes/utils/ui-helpers.d.ts +16 -0
- package/dist/types/reminders/star-reminder.d.ts +3 -13
- package/dist/types/runtime-mcp/manager.d.ts +1 -0
- package/dist/types/runtime-mcp/smithery-auth.d.ts +5 -0
- package/dist/types/sdk/acp/adapter.d.ts +3 -1
- package/dist/types/sdk/broker/lifecycle.d.ts +5 -0
- package/dist/types/sdk/broker/transport.d.ts +2 -0
- package/dist/types/sdk/bus/attachment-registry.d.ts +1 -0
- package/dist/types/sdk/bus/chat-daemon-control.d.ts +4 -1
- package/dist/types/sdk/bus/config.d.ts +6 -2
- package/dist/types/sdk/bus/control-drain-lease.d.ts +52 -0
- package/dist/types/sdk/bus/index.d.ts +44 -1
- package/dist/types/sdk/bus/kind-aware-reconciliation.d.ts +44 -0
- package/dist/types/sdk/bus/lifecycle-control-runtime.d.ts +4 -0
- package/dist/types/sdk/bus/prompt-reconciliation.d.ts +2 -1
- package/dist/types/sdk/bus/reconciliation-store.d.ts +69 -0
- package/dist/types/sdk/bus/rich-draft.d.ts +1 -0
- package/dist/types/sdk/bus/rich-render.d.ts +2 -0
- package/dist/types/sdk/bus/telegram-adoption-intent.d.ts +165 -0
- package/dist/types/sdk/bus/telegram-cli.d.ts +12 -0
- package/dist/types/sdk/bus/telegram-daemon-contract.d.ts +11 -4
- package/dist/types/sdk/bus/telegram-daemon.d.ts +25 -1
- package/dist/types/sdk/bus/telegram-reference.d.ts +11 -1
- package/dist/types/sdk/bus/threaded-render.d.ts +3 -2
- package/dist/types/sdk/bus/topic-registry.d.ts +11 -1
- package/dist/types/sdk/host/control/operations.d.ts +1 -1
- package/dist/types/sdk/host/host.d.ts +2 -0
- package/dist/types/sdk/host/query/handlers.d.ts +5 -0
- package/dist/types/sdk/host/query/revision-store.d.ts +2 -0
- package/dist/types/sdk/host/reverse-leases.d.ts +1 -1
- package/dist/types/sdk/prompt-status.d.ts +23 -3
- package/dist/types/sdk/session.d.ts +6 -0
- package/dist/types/session/agent-session.d.ts +82 -12
- package/dist/types/session/artifacts.d.ts +8 -0
- package/dist/types/session/blob-store.d.ts +57 -4
- package/dist/types/session/internal/managed-session-storage.d.ts +8 -1
- package/dist/types/session/memory-guard-checkpoint-participant.d.ts +69 -0
- package/dist/types/session/session-manager.d.ts +48 -19
- package/dist/types/session/session-storage.d.ts +4 -0
- package/dist/types/session/streaming-output.d.ts +96 -12
- package/dist/types/setup/credential-import.d.ts +12 -0
- package/dist/types/skill-state/active-state.d.ts +12 -4
- package/dist/types/skill-state/workflow-hud.d.ts +9 -0
- package/dist/types/task/executor.d.ts +3 -2
- package/dist/types/task/index.d.ts +3 -1
- package/dist/types/task/provider-retry-status.d.ts +8 -0
- package/dist/types/task/receipt.d.ts +7 -1
- package/dist/types/task/types.d.ts +23 -0
- package/dist/types/tools/ask-answer-registry.d.ts +2 -2
- package/dist/types/tools/bash-interactive.d.ts +4 -1
- package/dist/types/tools/bash.d.ts +3 -1
- package/dist/types/tools/browser/launch.d.ts +7 -0
- package/dist/types/tools/fetch.d.ts +17 -1
- package/dist/types/tools/image-gen.d.ts +4 -0
- package/dist/types/tools/index.d.ts +4 -0
- package/dist/types/tools/output-meta.d.ts +44 -3
- package/dist/types/tools/path-utils.d.ts +1 -0
- package/dist/types/tools/read-internals.d.ts +12 -0
- package/dist/types/tools/read.d.ts +45 -7
- package/dist/types/tools/resource-gc.d.ts +4 -0
- package/dist/types/tools/review.d.ts +5 -7
- package/dist/types/tools/subagent.d.ts +2 -0
- package/dist/types/tools/tool-result.d.ts +7 -1
- package/dist/types/utils/gh.d.ts +13 -0
- package/dist/types/utils/image-resize.d.ts +1 -0
- package/dist/types/web/search/providers/kimi.d.ts +2 -0
- package/dist/types/web/search/providers/searxng.d.ts +7 -0
- package/dist/types/web/search/providers/xai.d.ts +2 -0
- package/package.json +11 -13
- package/scripts/acp-conformance-agent.ts +218 -0
- package/scripts/benchmark-sticky-viewport-pr1.ts +239 -0
- package/scripts/capture-gjc-bundle-settings.ts +306 -0
- package/scripts/capture-sticky-viewport-showcase.ts +292 -0
- package/scripts/generate-sdk-operation-inventory.ts +5 -0
- package/scripts/resident-memory-bench.ts +1341 -0
- package/scripts/run-acp-conformance.ts +285 -0
- package/scripts/verify-gjc-sdk-canonicalization.ts +122 -18
- package/scripts/verify-sticky-viewport-showcase.ts +611 -0
- package/src/async/job-manager.ts +78 -20
- package/src/capability/index.ts +8 -0
- package/src/cli/fast-help.ts +1 -1
- package/src/cli/plugin-cli.ts +176 -18
- package/src/cli/read-cli.ts +2 -1
- package/src/cli.ts +1 -0
- package/src/commands/deep-interview.ts +29 -9
- package/src/commands/harness.ts +35 -12
- package/src/commands/read.ts +11 -2
- package/src/commands/team.ts +20 -2
- package/src/config/file-lock.ts +11 -2
- package/src/config/model-registry.ts +21 -2
- package/src/config/provider-auth-health.ts +42 -0
- package/src/config/provider-ranking.ts +119 -0
- package/src/config/settings-schema.ts +74 -1
- package/src/config/settings.ts +246 -108
- package/src/coordinator-mcp/question-gate-codec.ts +1 -1
- package/src/coordinator-mcp/server.ts +5 -12
- package/src/defaults/gjc/skills/deep-interview/SKILL.md +230 -82
- package/src/defaults/gjc/skills/ralplan/SKILL.md +77 -41
- package/src/defaults/gjc/skills/team/SKILL.md +3 -1
- package/src/defaults/gjc/skills/ultragoal/SKILL.md +62 -39
- package/src/defaults/gjc/skills/ultragoal/validation-batch-contracts.md +12 -0
- package/src/defaults/gjc-defaults.ts +4 -4
- package/src/eval/py/executor.ts +7 -2
- package/src/exa/mcp-client.ts +12 -3
- package/src/exec/bash-executor.ts +144 -27
- package/src/extensibility/extensions/runner.ts +15 -0
- package/src/extensibility/extensions/types.ts +46 -5
- package/src/extensibility/gjc-plugins/constrained-hooks.ts +8 -2
- package/src/extensibility/gjc-plugins/index.ts +19 -2
- package/src/extensibility/gjc-plugins/installer.ts +189 -50
- package/src/extensibility/gjc-plugins/lifecycle-reconciliation.ts +199 -0
- package/src/extensibility/gjc-plugins/lifecycle.ts +626 -0
- package/src/extensibility/gjc-plugins/observability.ts +3 -3
- package/src/extensibility/gjc-plugins/prompt-appendix.ts +5 -1
- package/src/extensibility/gjc-plugins/runtime-adapters.ts +12 -2
- package/src/extensibility/gjc-plugins/runtime-quarantine.ts +121 -0
- package/src/extensibility/gjc-plugins/schema.ts +84 -12
- package/src/extensibility/gjc-plugins/session-validation.ts +9 -3
- package/src/extensibility/gjc-plugins/types.ts +141 -0
- package/src/extensibility/gjc-plugins/validation.ts +9 -0
- package/src/extensibility/shared-events.ts +5 -0
- package/src/gjc-runtime/deep-interview-ambiguity.ts +47 -82
- package/src/gjc-runtime/deep-interview-recorder.ts +227 -310
- package/src/gjc-runtime/deep-interview-runtime.ts +109 -270
- package/src/gjc-runtime/deep-interview-stage.ts +1016 -0
- package/src/gjc-runtime/deep-interview-state.ts +12 -943
- package/src/gjc-runtime/gc-render.ts +1 -0
- package/src/gjc-runtime/gc-runtime.ts +11 -1
- package/src/gjc-runtime/launch-tmux.ts +25 -6
- package/src/gjc-runtime/managed-owner-admission.ts +1 -1
- package/src/gjc-runtime/memory-guard-owner-claims.ts +389 -0
- package/src/gjc-runtime/ralplan-runtime.ts +1149 -98
- package/src/gjc-runtime/state-runtime.ts +2 -1
- package/src/gjc-runtime/state-writer.ts +70 -222
- package/src/gjc-runtime/team-launch.ts +42 -5
- package/src/gjc-runtime/team-runtime.ts +1085 -40
- package/src/gjc-runtime/team-store.ts +32 -0
- package/src/gjc-runtime/team-worker-heartbeat.ts +149 -0
- package/src/gjc-runtime/team-worker-memory-guard.ts +363 -0
- package/src/gjc-runtime/team-workers.ts +1 -0
- package/src/gjc-runtime/tmux-owner-isolation.ts +28 -0
- package/src/gjc-runtime/tmux-sessions.ts +58 -13
- package/src/gjc-runtime/ultragoal-receipt-freshness.ts +20 -0
- package/src/gjc-runtime/ultragoal-runtime.ts +414 -618
- package/src/gjc-runtime/workflow-manifest.generated.json +105 -449
- package/src/gjc-runtime/workflow-manifest.ts +38 -247
- package/src/hooks/native-skill-hook.ts +17 -4
- package/src/hooks/skill-state.ts +1 -23
- package/src/internal-urls/docs-index.generated.ts +21 -22
- package/src/internal-urls/local-root-gc.ts +127 -0
- package/src/main.ts +9 -5
- package/src/memories/index.ts +10 -0
- package/src/modes/DESIGN.md +98 -0
- package/src/modes/acp/acp-agent.ts +339 -191
- package/src/modes/acp/acp-event-mapper.ts +14 -7
- package/src/modes/acp/acp-mode.ts +39 -3
- package/src/modes/components/assistant-message.ts +123 -22
- package/src/modes/components/gjc-bundle-settings.ts +508 -0
- package/src/modes/components/irc-sidebar.ts +176 -62
- package/src/modes/components/model-selector.ts +61 -4
- package/src/modes/components/notifications-settings-editor.ts +12 -1
- package/src/modes/components/oauth-selector.ts +96 -28
- package/src/modes/components/read-tool-group.ts +82 -14
- package/src/modes/components/session-observer-overlay.ts +457 -83
- package/src/modes/components/settings-selector.ts +116 -23
- package/src/modes/components/status-line/gh.ts +16 -0
- package/src/modes/components/tool-execution.ts +138 -27
- package/src/modes/components/tool-status-header.ts +3 -14
- package/src/modes/components/transcript-viewer-overlay.ts +99 -24
- package/src/modes/controllers/command-controller.ts +4 -0
- package/src/modes/controllers/event-controller.ts +109 -27
- package/src/modes/controllers/extension-ui-controller.ts +26 -2
- package/src/modes/controllers/input-controller.ts +18 -3
- package/src/modes/controllers/selector-controller.ts +127 -36
- package/src/modes/interactive-mode.ts +62 -3
- package/src/modes/irc-observation-ledger.ts +71 -15
- package/src/modes/runtime-init.ts +22 -2
- package/src/modes/types.ts +2 -0
- package/src/modes/utils/ui-helpers.ts +94 -1
- package/src/prompts/agent-fragments/ralplan-persistence.md +4 -3
- package/src/prompts/agents/architect.md +9 -1
- package/src/prompts/agents/critic.md +9 -0
- package/src/prompts/system/eager-todo.md +8 -4
- package/src/prompts/system/system-prompt.md +11 -5
- package/src/prompts/tools/bash.md +5 -5
- package/src/prompts/tools/read.md +4 -2
- package/src/prompts/tools/search-tool-bm25.md +5 -0
- package/src/prompts/tools/task.md +1 -1
- package/src/reminders/star-reminder.ts +4 -42
- package/src/runtime-mcp/manager.ts +19 -4
- package/src/runtime-mcp/smithery-auth.ts +17 -2
- package/src/runtime-mcp/smithery-connect.ts +11 -1
- package/src/sdk/acp/adapter.ts +22 -6
- package/src/sdk/broker/lifecycle.ts +25 -6
- package/src/sdk/broker/transport.ts +35 -3
- package/src/sdk/bus/attachment-registry.ts +5 -1
- package/src/sdk/bus/chat-daemon-cli.ts +4 -39
- package/src/sdk/bus/chat-daemon-control.ts +6 -3
- package/src/sdk/bus/config.ts +18 -2
- package/src/sdk/bus/control-drain-lease.ts +104 -0
- package/src/sdk/bus/index.ts +984 -146
- package/src/sdk/bus/kind-aware-reconciliation.ts +317 -0
- package/src/sdk/bus/lifecycle-commands.ts +4 -1
- package/src/sdk/bus/lifecycle-control-runtime.ts +403 -88
- package/src/sdk/bus/prompt-reconciliation.ts +2 -1
- package/src/sdk/bus/reconciliation-store.ts +303 -0
- package/src/sdk/bus/rich-draft.ts +1 -1
- package/src/sdk/bus/rich-render.ts +2 -2
- package/src/sdk/bus/telegram-adoption-intent.ts +574 -0
- package/src/sdk/bus/telegram-cli.ts +33 -8
- package/src/sdk/bus/telegram-daemon-cli.ts +1 -0
- package/src/sdk/bus/telegram-daemon-contract.ts +11 -4
- package/src/sdk/bus/telegram-daemon.ts +916 -23
- package/src/sdk/bus/telegram-reference.ts +40 -3
- package/src/sdk/bus/threaded-render.ts +48 -3
- package/src/sdk/bus/topic-registry.ts +20 -0
- package/src/sdk/host/control/dispatch.ts +5 -1
- package/src/sdk/host/control/operations.ts +1 -1
- package/src/sdk/host/host.ts +23 -1
- package/src/sdk/host/query/handlers.ts +55 -0
- package/src/sdk/host/query/revision-store.ts +36 -2
- package/src/sdk/host/reverse-leases.ts +44 -7
- package/src/sdk/mcp/server.ts +46 -18
- package/src/sdk/prompt-status.ts +16 -3
- package/src/sdk/protocol/operation-inventory.generated.json +51 -0
- package/src/sdk/protocol/operation-registry.ts +7 -2
- package/src/sdk/session.ts +101 -10
- package/src/session/agent-session.ts +1286 -220
- package/src/session/artifacts.ts +22 -0
- package/src/session/auth-broker-config.ts +10 -3
- package/src/session/blob-store.ts +915 -24
- package/src/session/internal/managed-session-scope.ts +44 -6
- package/src/session/internal/managed-session-storage.ts +48 -6
- package/src/session/memory-guard-checkpoint-participant.ts +131 -0
- package/src/session/session-manager.ts +2364 -438
- package/src/session/session-storage.ts +9 -1
- package/src/session/streaming-output.ts +500 -111
- package/src/setup/credential-import.ts +75 -13
- package/src/setup/provider-onboarding.ts +19 -4
- package/src/skill-state/active-state.ts +32 -10
- package/src/skill-state/workflow-hud.ts +42 -2
- package/src/skill-state/workflow-mutation-guard.ts +560 -8
- package/src/task/executor.ts +122 -39
- package/src/task/index.ts +23 -14
- package/src/task/provider-retry-status.ts +16 -0
- package/src/task/receipt.ts +23 -7
- package/src/task/render.ts +6 -2
- package/src/task/types.ts +108 -0
- package/src/tools/ask-answer-registry.ts +12 -6
- package/src/tools/ask.ts +169 -118
- package/src/tools/ast-edit.ts +1 -0
- package/src/tools/ast-grep.ts +1 -0
- package/src/tools/bash-interactive.ts +8 -3
- package/src/tools/bash.ts +503 -60
- package/src/tools/browser/launch.ts +41 -6
- package/src/tools/fetch.ts +114 -23
- package/src/tools/find.ts +1 -0
- package/src/tools/image-gen.ts +29 -5
- package/src/tools/index.ts +4 -0
- package/src/tools/output-meta.ts +281 -20
- package/src/tools/path-utils.ts +8 -3
- package/src/tools/read-internals.ts +44 -0
- package/src/tools/read.ts +1560 -310
- package/src/tools/resource-gc.ts +182 -18
- package/src/tools/review.ts +5 -7
- package/src/tools/search.ts +1 -0
- package/src/tools/subagent-render.ts +6 -2
- package/src/tools/subagent.ts +6 -0
- package/src/tools/telegram-send.ts +6 -3
- package/src/tools/tool-result.ts +14 -1
- package/src/utils/gh.ts +39 -0
- package/src/utils/image-resize.ts +3 -0
- package/src/web/search/providers/anthropic.ts +4 -4
- package/src/web/search/providers/codex.ts +1 -1
- package/src/web/search/providers/kimi.ts +15 -5
- package/src/web/search/providers/searxng.ts +47 -4
- package/src/web/search/providers/xai.ts +7 -2
- package/dist/types/gjc-runtime/deep-interview-draft.d.ts +0 -8
- package/dist/types/gjc-runtime/deep-interview-payload.d.ts +0 -41
- package/dist/types/gjc-runtime/deep-interview-repair.d.ts +0 -17
- package/dist/types/gjc-runtime/ultragoal-pipeline.d.ts +0 -23
- package/src/defaults/gjc/skills/ultragoal/pipeline-validation-contracts.md +0 -30
- package/src/gjc-runtime/deep-interview-draft.ts +0 -843
- package/src/gjc-runtime/deep-interview-payload.ts +0 -262
- package/src/gjc-runtime/deep-interview-repair.ts +0 -1674
- package/src/gjc-runtime/ultragoal-pipeline.ts +0 -306
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
*
|
|
13
13
|
* Modes use this class and add their own I/O layer on top.
|
|
14
14
|
*/
|
|
15
|
-
import { type Agent, type AgentContext, type AgentEvent, type AgentLoopConfig, type AgentMessage, type AgentState, type AgentTool, type MidRunMaintenanceOutcome, type StablePrefixSnapshot, ThinkingLevel } from "@gajae-code/agent-core";
|
|
15
|
+
import { type Agent, type AgentContext, type AgentEvent, type AgentLoopConfig, type AgentMessage, type AgentState, type AgentTool, type MidRunMaintenanceOutcome, type RunSettlementProof, type StablePrefixSnapshot, ThinkingLevel } from "@gajae-code/agent-core";
|
|
16
16
|
import { type CompactionResult, type EmergencyCompactionSample } from "@gajae-code/agent-core/compaction";
|
|
17
17
|
import type { AssistantMessage, Effort, ImageContent, Message, MessageAttribution, Model, ProviderSessionState, ServiceTier, SimpleStreamOptions, TextContent, ToolCall, ToolChoice, Usage, UsageReport } from "@gajae-code/ai";
|
|
18
18
|
import { type BtwTextExchange } from "./btw-contract";
|
|
@@ -75,14 +75,18 @@ import { type PromptTemplate } from "../config/prompt-templates";
|
|
|
75
75
|
import type { Settings, SkillsSettings } from "../config/settings";
|
|
76
76
|
import { RawSseDebugBuffer } from "../debug/raw-sse-buffer";
|
|
77
77
|
import { type PythonResult } from "../eval/py/executor";
|
|
78
|
-
import { type BashResult } from "../exec/bash-executor";
|
|
78
|
+
import { type BashArtifactSaveResult, type BashResult } from "../exec/bash-executor";
|
|
79
79
|
import type { TtsrManager } from "../export/ttsr";
|
|
80
80
|
import type { LoadedCustomCommand } from "../extensibility/custom-commands";
|
|
81
81
|
import type { CustomTool } from "../extensibility/custom-tools/types";
|
|
82
82
|
import type { ExtensionRunner } from "../extensibility/extensions";
|
|
83
83
|
import type { CompactOptions, ContextUsage, ExtensionTranscriptEntry } from "../extensibility/extensions/types";
|
|
84
|
+
import type { GjcRuntimeSnapshotProvider } from "../extensibility/gjc-plugins/runtime-quarantine";
|
|
85
|
+
import type { SessionSwitchEvent } from "../extensibility/shared-events";
|
|
84
86
|
import { type Skill, type SkillWarning } from "../extensibility/skills";
|
|
85
87
|
import { type FileSlashCommand } from "../extensibility/slash-commands";
|
|
88
|
+
import { type MemoryGuardClaimsLease } from "../gjc-runtime/memory-guard-owner-claims";
|
|
89
|
+
import { GjcTeamWorkerHeartbeatReporter } from "../gjc-runtime/team-worker-heartbeat";
|
|
86
90
|
import { GoalRuntime } from "../goals/runtime";
|
|
87
91
|
import type { Goal, GoalModeState } from "../goals/state";
|
|
88
92
|
import type { HindsightSessionState } from "../hindsight/state";
|
|
@@ -101,6 +105,7 @@ import { type DefaultModelSelectionResult } from "./default-model-selection";
|
|
|
101
105
|
export { DefaultModelSelectionRecoveryError } from "./default-model-selection";
|
|
102
106
|
import type { ClientBridge, ClientBridgePermissionOption, ClientBridgePermissionOutcome, ClientBridgePermissionToolCall } from "./client-bridge";
|
|
103
107
|
import { type ContributionPrepOptions, type ContributionPrepResult } from "./contribution-prep";
|
|
108
|
+
import type { MemoryGuardRestoreResult } from "./memory-guard-checkpoint-participant";
|
|
104
109
|
import { type CustomMessage } from "./messages";
|
|
105
110
|
import type { BranchSummaryEntry, CompactionEntry, NewSessionOptions, PreparedNewSession, RecoveryHydrationContext, RecoveryHydrationPromotionFence, SessionContext, SessionManager, SessionManagerCloseOutcome } from "./session-manager";
|
|
106
111
|
import { ToolChoiceQueue } from "./tool-choice-queue";
|
|
@@ -205,6 +210,11 @@ export interface AgentSessionConfig {
|
|
|
205
210
|
workerIntegrationRequest?: (signal: AbortSignal) => Promise<void>;
|
|
206
211
|
/** Bound terminal worker-integration settlement for embedded hosts and deterministic lifecycle tests. */
|
|
207
212
|
workerIntegrationTimeoutMs?: number;
|
|
213
|
+
/**
|
|
214
|
+
* Override the runtime-owned `gjc team` worker heartbeat reporter. Defaults to a
|
|
215
|
+
* reporter derived from the team worker environment, or none outside a worker pane.
|
|
216
|
+
*/
|
|
217
|
+
teamWorkerHeartbeatReporter?: GjcTeamWorkerHeartbeatReporter;
|
|
208
218
|
/** Loaded skills (already discovered by SDK) */
|
|
209
219
|
skills?: Skill[];
|
|
210
220
|
/** Skill loading warnings (already captured by SDK) */
|
|
@@ -314,6 +324,24 @@ export interface AgentSessionConfig {
|
|
|
314
324
|
/** Optional provider-facing cache identity, distinct from logical session identity. */
|
|
315
325
|
providerCacheSessionId?: string;
|
|
316
326
|
}
|
|
327
|
+
export interface AgentSessionMemoryGuardRestoreInput extends Omit<AgentSessionConfig, "sessionManager" | "recoveryHydrationContext"> {
|
|
328
|
+
staged: Extract<MemoryGuardRestoreResult, {
|
|
329
|
+
kind: "staged";
|
|
330
|
+
}>;
|
|
331
|
+
claimsLease: MemoryGuardClaimsLease;
|
|
332
|
+
claimsStateDir: string;
|
|
333
|
+
}
|
|
334
|
+
export interface AgentMemoryGuardPromotionFence extends RecoveryHydrationPromotionFence {
|
|
335
|
+
readonly claimsLease: MemoryGuardClaimsLease;
|
|
336
|
+
}
|
|
337
|
+
export type AgentMemoryGuardRestoreResult = {
|
|
338
|
+
kind: "staged";
|
|
339
|
+
session: AgentSession;
|
|
340
|
+
promotionFence: AgentMemoryGuardPromotionFence;
|
|
341
|
+
} | {
|
|
342
|
+
kind: "blocked";
|
|
343
|
+
reason: "transcript-mismatch" | "hydration-context-mismatch" | "claim-mismatch" | "agent-messages-mismatch";
|
|
344
|
+
};
|
|
317
345
|
type MidRunMaintenanceLifecycle = Parameters<NonNullable<AgentLoopConfig["maintainContext"]>>[1];
|
|
318
346
|
/** Options for AgentSession.prompt() */
|
|
319
347
|
export interface PromptOptions {
|
|
@@ -336,8 +364,21 @@ export interface PromptOptions {
|
|
|
336
364
|
/**
|
|
337
365
|
* Invoked after all prompt preflight checks pass and immediately before agent execution begins.
|
|
338
366
|
* Cancellation before this callback rejects the prompt.
|
|
367
|
+
* Prefer `onPreflightAcceptCommit` for async durable acceptance (#3031/#3032).
|
|
339
368
|
*/
|
|
340
369
|
onPreflightAccepted?: () => void;
|
|
370
|
+
/**
|
|
371
|
+
* Awaitable durable-accept fence. Called after preflight and before queue mutation
|
|
372
|
+
* or `#promptAgentWithIdleRetry`. SDK bus installs a closure that fsyncs acceptance.
|
|
373
|
+
*/
|
|
374
|
+
onPreflightAcceptCommit?: () => void | Promise<void>;
|
|
375
|
+
/** Skill-only: prepared metadata before the durable fence (path/lineCount/cleanedArgs). */
|
|
376
|
+
onSkillPrepared?: (meta: {
|
|
377
|
+
name: string;
|
|
378
|
+
path: string;
|
|
379
|
+
lineCount?: number;
|
|
380
|
+
cleanedArgs?: string;
|
|
381
|
+
}) => void;
|
|
341
382
|
}
|
|
342
383
|
/** Result from a handoff operation. */
|
|
343
384
|
export interface HandoffResult {
|
|
@@ -432,6 +473,11 @@ interface EphemeralTurnResult {
|
|
|
432
473
|
replyText: string;
|
|
433
474
|
assistantMessage: AssistantMessage;
|
|
434
475
|
}
|
|
476
|
+
export interface AgentBashArtifactStore {
|
|
477
|
+
saveArtifact(content: string, toolType: string): Promise<string | undefined>;
|
|
478
|
+
getArtifactPath(id: string): Promise<string | null>;
|
|
479
|
+
}
|
|
480
|
+
export declare function saveAgentBashOriginalArtifact(store: AgentBashArtifactStore, originalText: string): Promise<BashArtifactSaveResult>;
|
|
435
481
|
type IrcRosterClaim = {
|
|
436
482
|
token: symbol;
|
|
437
483
|
signature: string;
|
|
@@ -752,13 +798,16 @@ export declare class AgentSession {
|
|
|
752
798
|
* to avoid racing against the delivery turn.
|
|
753
799
|
*/
|
|
754
800
|
get hasPostPromptWork(): boolean;
|
|
801
|
+
/** Stable resource ownership identifier for the active prompt run. */
|
|
802
|
+
get activePromptHandle(): string | undefined;
|
|
755
803
|
/** All messages including custom types like BashExecutionMessage */
|
|
756
804
|
get messages(): AgentMessage[];
|
|
757
805
|
get transcriptPromptGeneration(): number;
|
|
806
|
+
static restoreFromMemoryGuardCheckpoint(input: AgentSessionMemoryGuardRestoreInput): Promise<AgentMemoryGuardRestoreResult>;
|
|
758
807
|
/** The immutable recovery authority, present only before external ownership promotion. */
|
|
759
808
|
get recoveryHydrationContext(): RecoveryHydrationContext | undefined;
|
|
760
809
|
/** Enables normal session mutations after the owner has published its durable fence and writer lease. */
|
|
761
|
-
promoteRecoveryHydrationAfterOwnershipReadyFence(fence:
|
|
810
|
+
promoteRecoveryHydrationAfterOwnershipReadyFence(fence: AgentMemoryGuardPromotionFence): Promise<void>;
|
|
762
811
|
/** Main startup calls this exactly once, after a strict open returned `kind: "opened"`. */
|
|
763
812
|
continuePersistedHistory(): Promise<void>;
|
|
764
813
|
buildDisplaySessionContext(): SessionContext;
|
|
@@ -787,7 +836,7 @@ export declare class AgentSession {
|
|
|
787
836
|
/** Live SDK configuration values exposed through the session query surface. */
|
|
788
837
|
getSdkConfigItems(): Record<string, string>;
|
|
789
838
|
setPlanModeState(state: PlanModeState | undefined): void;
|
|
790
|
-
invokeSkill(name: string, args?: string, options?: Pick<PromptOptions, "onPreflightAccepted">): Promise<{
|
|
839
|
+
invokeSkill(name: string, args?: string, options?: Pick<PromptOptions, "onPreflightAccepted" | "onPreflightAcceptCommit" | "onSkillPrepared">): Promise<{
|
|
791
840
|
name: string;
|
|
792
841
|
path: string;
|
|
793
842
|
args?: string;
|
|
@@ -842,7 +891,7 @@ export declare class AgentSession {
|
|
|
842
891
|
* @throws Error if no model selected or no API key available (when not streaming)
|
|
843
892
|
*/
|
|
844
893
|
prompt(text: string, options?: PromptOptions): Promise<void>;
|
|
845
|
-
promptCustomMessage<T = unknown>(message: Pick<CustomMessage<T>, "customType" | "content" | "display" | "details" | "attribution">, options?: Pick<PromptOptions, "streamingBehavior" | "toolChoice" | "followUpQueuePolicy" | "onPreflightAccepted">): Promise<void>;
|
|
894
|
+
promptCustomMessage<T = unknown>(message: Pick<CustomMessage<T>, "customType" | "content" | "display" | "details" | "attribution">, options?: Pick<PromptOptions, "streamingBehavior" | "toolChoice" | "followUpQueuePolicy" | "onPreflightAccepted" | "onPreflightAcceptCommit">): Promise<void>;
|
|
846
895
|
/**
|
|
847
896
|
* Queue a steering message to interrupt the agent mid-run.
|
|
848
897
|
*/
|
|
@@ -882,6 +931,7 @@ export declare class AgentSession {
|
|
|
882
931
|
sendUserMessage(content: string | (TextContent | ImageContent)[], options?: {
|
|
883
932
|
deliverAs?: "steer" | "followUp";
|
|
884
933
|
onPreflightAccepted?: () => void;
|
|
934
|
+
onPreflightAcceptCommit?: () => void | Promise<void>;
|
|
885
935
|
}): Promise<void>;
|
|
886
936
|
/**
|
|
887
937
|
* Clear queued messages and return them.
|
|
@@ -944,6 +994,12 @@ export declare class AgentSession {
|
|
|
944
994
|
cause?: "user_interrupt" | "new_session" | "session_switch" | "compaction" | "handoff" | "tool_abort" | "internal";
|
|
945
995
|
silent?: boolean;
|
|
946
996
|
}): Promise<void>;
|
|
997
|
+
/**
|
|
998
|
+
* Abort a specific active prompt and prove whether its tracked resources settled.
|
|
999
|
+
*/
|
|
1000
|
+
abortPromptAndWait(handle: string, options: {
|
|
1001
|
+
graceMs: number;
|
|
1002
|
+
}): Promise<RunSettlementProof>;
|
|
947
1003
|
/** Atomically interrupt the active run and make text the next prompt. */
|
|
948
1004
|
cancelAndSubmit(text: string, options?: {
|
|
949
1005
|
queuedEntryId?: string;
|
|
@@ -1012,6 +1068,13 @@ export declare class AgentSession {
|
|
|
1012
1068
|
* instead of promoting a transient runtime model to the resume default.
|
|
1013
1069
|
*/
|
|
1014
1070
|
getSessionDefaultModelSelector(): string | undefined;
|
|
1071
|
+
/**
|
|
1072
|
+
* Resolve the model that `modelRoles.default` currently points to, independent
|
|
1073
|
+
* of whatever model this session's log last recorded. Used by the TUI resume
|
|
1074
|
+
* flow's `session.resumeModelBehavior: "ask"` prompt to offer the currently
|
|
1075
|
+
* configured default as an alternative to the session's saved model.
|
|
1076
|
+
*/
|
|
1077
|
+
resolveConfiguredDefaultModel(): Model | undefined;
|
|
1015
1078
|
/**
|
|
1016
1079
|
* Re-assert the session resume default ("provider/id") in the session log
|
|
1017
1080
|
* WITHOUT touching the live runtime model. Appends a `model_change` with
|
|
@@ -1065,20 +1128,16 @@ export declare class AgentSession {
|
|
|
1065
1128
|
* Get all available models with valid API keys.
|
|
1066
1129
|
*/
|
|
1067
1130
|
getAvailableModels(): Model[];
|
|
1068
|
-
/**
|
|
1069
|
-
* Set thinking level.
|
|
1070
|
-
* Saves the effective metadata-clamped level to the session, and to settings when requested.
|
|
1071
|
-
*/
|
|
1072
1131
|
setThinkingLevel(level: ThinkingLevel | undefined, persist?: boolean): void;
|
|
1073
1132
|
/**
|
|
1074
|
-
* Set thinking level from a control surface. Global changes
|
|
1133
|
+
* Set thinking level from a control surface. Global changes commit before affecting live state.
|
|
1075
1134
|
*/
|
|
1076
1135
|
setThinkingLevelForControl(level: ThinkingLevel, persist: boolean): Promise<void>;
|
|
1077
1136
|
getThinkingScopeForControl(): "session" | "global config";
|
|
1078
1137
|
getThinkingVisibility(): "visible" | "hidden";
|
|
1079
1138
|
setThinkingVisibility(visibility: "visible" | "hidden", persist?: boolean): void;
|
|
1080
1139
|
/**
|
|
1081
|
-
* Set thinking visibility from a control surface. Global changes
|
|
1140
|
+
* Set thinking visibility from a control surface. Global changes commit before affecting live state.
|
|
1082
1141
|
*/
|
|
1083
1142
|
setThinkingVisibilityForControl(visibility: "visible" | "hidden", persist: boolean): Promise<void>;
|
|
1084
1143
|
/**
|
|
@@ -1125,6 +1184,15 @@ export declare class AgentSession {
|
|
|
1125
1184
|
* Get available thinking levels for current model.
|
|
1126
1185
|
*/
|
|
1127
1186
|
getAvailableThinkingLevels(): ReadonlyArray<Effort>;
|
|
1187
|
+
/**
|
|
1188
|
+
* Runtime evidence published for the current GJC bundle activation
|
|
1189
|
+
* generation, set once by `createAgentSession` after every producer has run.
|
|
1190
|
+
* Undefined until that publication happens, so consumers report runtime
|
|
1191
|
+
* status as unavailable rather than falsely clear.
|
|
1192
|
+
*/
|
|
1193
|
+
gjcRuntimeSnapshot?: GjcRuntimeSnapshotProvider;
|
|
1194
|
+
/** Activation generation a published snapshot must match to be merged. */
|
|
1195
|
+
gjcActivationGeneration?: number;
|
|
1128
1196
|
/**
|
|
1129
1197
|
* Set steering mode.
|
|
1130
1198
|
* Saves to settings.
|
|
@@ -1316,7 +1384,9 @@ export declare class AgentSession {
|
|
|
1316
1384
|
* Listeners are preserved and will continue receiving events.
|
|
1317
1385
|
* @returns true if switch completed, false if cancelled by hook
|
|
1318
1386
|
*/
|
|
1319
|
-
switchSession(sessionPath: string
|
|
1387
|
+
switchSession(sessionPath: string, options?: {
|
|
1388
|
+
transition?: SessionSwitchEvent["transition"];
|
|
1389
|
+
}): Promise<boolean>;
|
|
1320
1390
|
/**
|
|
1321
1391
|
* Create a branch from a specific entry.
|
|
1322
1392
|
* Emits before_branch/branch session events to hooks.
|
|
@@ -45,6 +45,14 @@ export declare class ArtifactManager {
|
|
|
45
45
|
replaceNamedBytes(filename: string, bytes: Uint8Array): Promise<void>;
|
|
46
46
|
publishManagedOutputGeneration(selectorFilename: string, outputFilenamePrefix: string, outputBytes: Uint8Array, metadataBytes: Uint8Array): Promise<void>;
|
|
47
47
|
publishNamedNoReplace(filename: string, bytes: Uint8Array): Promise<void>;
|
|
48
|
+
/**
|
|
49
|
+
* Best-effort removal of a previously published named artifact. Used to roll
|
|
50
|
+
* back staged publications when a transactional operation (e.g. gated
|
|
51
|
+
* maintenance pruning) is rejected after publication succeeded. Returns false
|
|
52
|
+
* when the artifact could not be removed so callers can log the failure
|
|
53
|
+
* instead of silently treating the rollback as complete.
|
|
54
|
+
*/
|
|
55
|
+
removeNamedBestEffort(filename: string): Promise<boolean>;
|
|
48
56
|
/**
|
|
49
57
|
* Atomically allocate next artifact ID.
|
|
50
58
|
* IDs are sequential within the session.
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
declare const TAKE_BLOB_BUFFER_OWNERSHIP: unique symbol;
|
|
2
|
+
/** Limits for a single best-effort resident-cache garbage-collection pass. */
|
|
3
|
+
export interface ResidentCacheGcSweepOptions {
|
|
4
|
+
readonly maxDirectories?: number;
|
|
5
|
+
readonly maxDurationMs?: number;
|
|
6
|
+
}
|
|
1
7
|
export interface BlobPutResult {
|
|
2
8
|
hash: string;
|
|
3
9
|
path: string;
|
|
@@ -11,6 +17,28 @@ export declare class BlobCorruptError extends Error {
|
|
|
11
17
|
readonly path: string;
|
|
12
18
|
constructor(hash: string, path: string);
|
|
13
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* A resident-cache path or blob failed the owner-only verification contract.
|
|
22
|
+
* SessionManager catches this error to demote the entire resident store to
|
|
23
|
+
* memory before retrying the triggering write.
|
|
24
|
+
*/
|
|
25
|
+
export declare class ResidentCacheTrustError extends Error {
|
|
26
|
+
readonly reason: string;
|
|
27
|
+
readonly path: string;
|
|
28
|
+
constructor(reason: string, path: string, options?: ErrorOptions);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Best-effort cleanup of abandoned resident-cache instances. The root is
|
|
32
|
+
* re-verified before scanning, work is bounded, and all failures fail closed.
|
|
33
|
+
*/
|
|
34
|
+
export declare function sweepResidentCacheRoot(root: string, options?: ResidentCacheGcSweepOptions): Promise<void>;
|
|
35
|
+
/**
|
|
36
|
+
* Create a private resident-cache instance directory beneath a trusted profile
|
|
37
|
+
* root. The cache-owned root and nonce instance are both verified owner-only
|
|
38
|
+
* directories; callers must use {@link EphemeralBlobStore.adoptVerifiedDir}
|
|
39
|
+
* rather than the destructive EphemeralBlobStore constructor.
|
|
40
|
+
*/
|
|
41
|
+
export declare function openVerifiedResidentCacheInstanceDir(root: string): string;
|
|
14
42
|
/**
|
|
15
43
|
* Content-addressed blob store for externalizing large binary data (images) from session JSONL files.
|
|
16
44
|
*
|
|
@@ -31,7 +59,13 @@ export declare class BlobStore {
|
|
|
31
59
|
* cannot afford the microtask hops of the async version (e.g. OOM-safe session writes).
|
|
32
60
|
* Returns once the bytes are in the kernel page cache.
|
|
33
61
|
*/
|
|
34
|
-
putSync(data: Buffer): BlobPutResult;
|
|
62
|
+
putSync(data: Buffer, _ownership?: typeof TAKE_BLOB_BUFFER_OWNERSHIP): BlobPutResult;
|
|
63
|
+
/**
|
|
64
|
+
* Store a buffer that the caller will not mutate after this call returns.
|
|
65
|
+
* Resident-cache implementations may retain that private buffer without an
|
|
66
|
+
* additional defensive copy.
|
|
67
|
+
*/
|
|
68
|
+
putOwnedSync(data: Buffer): BlobPutResult;
|
|
35
69
|
/**
|
|
36
70
|
* Durably install binary data as an immutable content-addressed blob.
|
|
37
71
|
*
|
|
@@ -51,19 +85,37 @@ export declare class BlobStore {
|
|
|
51
85
|
/** Check if a blob exists. */
|
|
52
86
|
has(hash: string): Promise<boolean>;
|
|
53
87
|
}
|
|
88
|
+
interface EphemeralBlobStoreOptions {
|
|
89
|
+
readonly adoptVerifiedDir?: boolean;
|
|
90
|
+
}
|
|
91
|
+
/** Resident-cache directories still tracked by this process. Test seam. */
|
|
92
|
+
export declare function trackedResidentCacheDirsForTest(): string[];
|
|
54
93
|
export declare class EphemeralBlobStore extends BlobStore {
|
|
55
94
|
#private;
|
|
56
|
-
constructor(dir: string);
|
|
57
|
-
|
|
95
|
+
constructor(dir: string, options?: EphemeralBlobStoreOptions);
|
|
96
|
+
/**
|
|
97
|
+
* Adopt a directory returned by {@link openVerifiedResidentCacheInstanceDir}
|
|
98
|
+
* without the ordinary constructor's destructive remove-and-recreate path.
|
|
99
|
+
*/
|
|
100
|
+
static adoptVerifiedDir(dir: string): EphemeralBlobStore;
|
|
101
|
+
put(data: Buffer): Promise<BlobPutResult>;
|
|
102
|
+
putSync(data: Buffer, ownership?: typeof TAKE_BLOB_BUFFER_OWNERSHIP): BlobPutResult;
|
|
58
103
|
putImmutableSync(data: Buffer): CheckedBlobPutResult;
|
|
104
|
+
get(hash: string): Promise<Buffer | null>;
|
|
59
105
|
getSync(hash: string): Buffer | null;
|
|
106
|
+
/** Return a trusted in-memory copy without reopening an invalidated cache path. */
|
|
107
|
+
getBufferedSync(hash: string): Buffer | null;
|
|
60
108
|
getCheckedSync(hash: string): Buffer | null;
|
|
61
109
|
clear(): void;
|
|
62
110
|
dispose(): void;
|
|
63
111
|
}
|
|
112
|
+
export interface MemoryBlobStoreOptions {
|
|
113
|
+
/** A canonical store owns every reference in its session's resident entries. */
|
|
114
|
+
readonly ownership?: "cache" | "canonical";
|
|
115
|
+
}
|
|
64
116
|
export declare class MemoryBlobStore extends BlobStore {
|
|
65
117
|
#private;
|
|
66
|
-
constructor();
|
|
118
|
+
constructor(options?: MemoryBlobStoreOptions);
|
|
67
119
|
put(data: Buffer): Promise<BlobPutResult>;
|
|
68
120
|
putSync(data: Buffer): BlobPutResult;
|
|
69
121
|
putImmutableSync(data: Buffer): CheckedBlobPutResult;
|
|
@@ -158,3 +210,4 @@ export declare function resolveResidentImageDataSync(blobStore: BlobStore, data:
|
|
|
158
210
|
sessionId?: string;
|
|
159
211
|
sessionFile?: string;
|
|
160
212
|
}): string;
|
|
213
|
+
export {};
|
|
@@ -51,19 +51,26 @@ export declare function retainManagedDirectoryAuthority(root: ManagedDirectoryRo
|
|
|
51
51
|
ino: bigint;
|
|
52
52
|
}): RecoveryFsRoot | undefined;
|
|
53
53
|
export declare function assertManagedDirectoryRoot(root: ManagedDirectoryRoot): void;
|
|
54
|
+
export declare function managedSecurityFailureClassification(error: unknown): string | undefined;
|
|
54
55
|
/** Internal retained-root capability for one managed descendant subtree. */
|
|
55
56
|
export declare class ManagedSessionDescendantStore {
|
|
56
57
|
#private;
|
|
57
58
|
constructor(root: ManagedDirectoryRoot, baseDir: string, retained?: {
|
|
58
59
|
authority: RecoveryFsRoot;
|
|
59
60
|
authorityBaseDir: string;
|
|
60
|
-
}, policy?: ManagedSessionSecurityPolicy);
|
|
61
|
+
}, policy?: ManagedSessionSecurityPolicy, profileAgentDir?: string);
|
|
61
62
|
get dir(): string;
|
|
62
63
|
get rootAuthority(): ManagedDirectoryRoot;
|
|
63
64
|
get subtreeRootAuthority(): ManagedDirectoryRoot;
|
|
64
65
|
get securityPolicy(): ManagedSessionSecurityPolicy;
|
|
66
|
+
get profileAgentDir(): string;
|
|
65
67
|
deriveSubtree(relativePath: string): ManagedSessionDescendantStore;
|
|
66
68
|
retainAuthority(): RecoveryFsRoot | undefined;
|
|
69
|
+
/**
|
|
70
|
+
* Release an authority this store opened itself. Retained authorities are owned by
|
|
71
|
+
* the security context that supplied them and are never closed here. Idempotent.
|
|
72
|
+
*/
|
|
73
|
+
close(): void;
|
|
67
74
|
assertBound(): void;
|
|
68
75
|
verifyRootSecurity(): void;
|
|
69
76
|
ensureDirectory(relativePath?: string): ManagedDirectoryRoot;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { RecoveryFsRoot } from "@gajae-code/natives";
|
|
2
|
+
import type { RecoveryHydrationContext, ResumeSessionIdentity, SessionDestinationInput, SessionManager, SessionManagerCheckpointRevisionStrings, StrictSessionOpenFailure } from "./session-manager";
|
|
3
|
+
export interface MemoryGuardTranscriptDescriptorV1 {
|
|
4
|
+
bytes: string;
|
|
5
|
+
relative_path: string;
|
|
6
|
+
sha256: string;
|
|
7
|
+
}
|
|
8
|
+
export interface MemoryGuardCheckpointBlobAuthorityV1 {
|
|
9
|
+
kind: "checkpoint_blob_tree_v1";
|
|
10
|
+
manifest_relative_path: string;
|
|
11
|
+
manifest_sha256: string;
|
|
12
|
+
root_relative_path: string;
|
|
13
|
+
}
|
|
14
|
+
export interface MemoryGuardCheckpointBlobManifestEntryV1 {
|
|
15
|
+
bytes: string;
|
|
16
|
+
relative_path: string;
|
|
17
|
+
sha256: string;
|
|
18
|
+
}
|
|
19
|
+
export interface MemoryGuardCheckpointBlobManifestV1 {
|
|
20
|
+
entries: MemoryGuardCheckpointBlobManifestEntryV1[];
|
|
21
|
+
schema_version: 1;
|
|
22
|
+
}
|
|
23
|
+
export interface MemoryGuardSessionManagerCheckpointV1 {
|
|
24
|
+
blob_authority: MemoryGuardCheckpointBlobAuthorityV1;
|
|
25
|
+
revisions: SessionManagerCheckpointRevisionStrings;
|
|
26
|
+
schema_version: 1;
|
|
27
|
+
session_id: string;
|
|
28
|
+
session_name: string | null;
|
|
29
|
+
transcript: MemoryGuardTranscriptDescriptorV1;
|
|
30
|
+
}
|
|
31
|
+
export interface MemoryGuardParticipantDescriptorV1 {
|
|
32
|
+
ordinal: number;
|
|
33
|
+
checkpoint: MemoryGuardCheckpointBlobAuthorityV1;
|
|
34
|
+
revisions: SessionManagerCheckpointRevisionStrings;
|
|
35
|
+
session_id: string;
|
|
36
|
+
session_name: string | null;
|
|
37
|
+
transcript: MemoryGuardTranscriptDescriptorV1;
|
|
38
|
+
}
|
|
39
|
+
export interface MemoryGuardParticipantIngressLease {
|
|
40
|
+
readonly token: symbol;
|
|
41
|
+
release(): void;
|
|
42
|
+
}
|
|
43
|
+
export interface MemoryGuardCreateCheckpointInput {
|
|
44
|
+
ingressLease: MemoryGuardParticipantIngressLease;
|
|
45
|
+
checkpointRoot: string;
|
|
46
|
+
}
|
|
47
|
+
export type MemoryGuardRestoreBlockedReason = StrictSessionOpenFailure["reason"] | "checkpoint-mismatch" | "participant-mismatch" | "transcript-mismatch" | "blob-manifest-mismatch" | "blob-missing" | "blob-hash-mismatch" | "blob-authority-mismatch" | "destination-unavailable";
|
|
48
|
+
export interface MemoryGuardRestoreInput {
|
|
49
|
+
incidentAuthority: RecoveryFsRoot;
|
|
50
|
+
participant: MemoryGuardParticipantDescriptorV1;
|
|
51
|
+
checkpoint: MemoryGuardSessionManagerCheckpointV1;
|
|
52
|
+
destination: SessionDestinationInput;
|
|
53
|
+
}
|
|
54
|
+
export type MemoryGuardRestoreResult = {
|
|
55
|
+
kind: "staged";
|
|
56
|
+
manager: SessionManager;
|
|
57
|
+
hydrationContext: RecoveryHydrationContext;
|
|
58
|
+
transcriptIdentity: ResumeSessionIdentity;
|
|
59
|
+
cleanup: () => Promise<void>;
|
|
60
|
+
} | {
|
|
61
|
+
kind: "blocked";
|
|
62
|
+
reason: MemoryGuardRestoreBlockedReason;
|
|
63
|
+
};
|
|
64
|
+
export declare function memoryGuardCanonicalJson(value: unknown): string;
|
|
65
|
+
export declare function memoryGuardSha256Hex(value: Uint8Array | string): string;
|
|
66
|
+
export declare function isMemoryGuardDecimalString(value: unknown): value is string;
|
|
67
|
+
export declare function isMemoryGuardSha256Hex(value: unknown): value is string;
|
|
68
|
+
export declare function isMemoryGuardRelativePath(value: unknown): value is string;
|
|
69
|
+
export declare function hasOnlyKeys(value: Record<string, unknown>, allowed: readonly string[]): boolean;
|
|
@@ -8,6 +8,7 @@ import { ArtifactManager } from "./artifacts";
|
|
|
8
8
|
import { type BlobPutResult, BlobStore } from "./blob-store";
|
|
9
9
|
import { type ManagedMigrationPolicy } from "./internal/managed-session-scope";
|
|
10
10
|
import { type ManagedDirectoryRoot, ManagedSessionDescendantStore } from "./internal/managed-session-storage";
|
|
11
|
+
import { type MemoryGuardCreateCheckpointInput, type MemoryGuardParticipantIngressLease, type MemoryGuardRestoreInput, type MemoryGuardRestoreResult, type MemoryGuardSessionManagerCheckpointV1 } from "./memory-guard-checkpoint-participant";
|
|
11
12
|
import { type BashExecutionMessage, type CustomMessage, type FileMentionMessage, type HookMessage, type PythonExecutionMessage } from "./messages";
|
|
12
13
|
import { type SessionManagerReadAccess, sessionManagerReadCapability } from "./session-manager-internal";
|
|
13
14
|
import type { ManagedSessionSecurityContext, SessionStorage, SessionStorageStat, VerifiedSessionDeleteResult, VerifiedSessionDeleteTarget } from "./session-storage";
|
|
@@ -71,11 +72,16 @@ export interface SessionManagerObservabilityStats {
|
|
|
71
72
|
coldSpillReadCount: number;
|
|
72
73
|
residentTextReadCount: number;
|
|
73
74
|
residentImageReadCount: number;
|
|
75
|
+
residentCacheAdoptFallbackCount: number;
|
|
76
|
+
residentCacheTrustRejectCount: number;
|
|
77
|
+
residentCacheWin32FallbackCount: number;
|
|
78
|
+
residentCacheDegradedReason?: string;
|
|
74
79
|
publicMaterializerCallCount: number;
|
|
75
80
|
getEntryMaterializerCallCount: number;
|
|
76
81
|
getBranchMaterializerCallCount: number;
|
|
77
82
|
getEntriesMaterializerCallCount: number;
|
|
78
83
|
materializedEntriesCachePopulateCount: number;
|
|
84
|
+
materializedCacheDemotedCount: number;
|
|
79
85
|
pathOnlyContextBuildCount: number;
|
|
80
86
|
}
|
|
81
87
|
export interface SessionMessageEntry extends SessionEntryBase {
|
|
@@ -259,6 +265,21 @@ export type DefaultModelSelectionStage = {
|
|
|
259
265
|
readonly tempPath: string | undefined;
|
|
260
266
|
readonly persistsToExistingFile: boolean;
|
|
261
267
|
};
|
|
268
|
+
export interface SessionManagerRevisionSnapshot {
|
|
269
|
+
entry: number;
|
|
270
|
+
leaf: number;
|
|
271
|
+
headerExport: number;
|
|
272
|
+
label: number;
|
|
273
|
+
replayMetadata: number;
|
|
274
|
+
}
|
|
275
|
+
export interface SessionManagerCheckpointRevisionStrings {
|
|
276
|
+
entry: string;
|
|
277
|
+
leaf: string;
|
|
278
|
+
headerExport: string;
|
|
279
|
+
label: string;
|
|
280
|
+
replayMetadata: string;
|
|
281
|
+
}
|
|
282
|
+
export declare function toSessionManagerCheckpointRevisionStrings(snapshot: SessionManagerRevisionSnapshot): SessionManagerCheckpointRevisionStrings;
|
|
262
283
|
export type DefaultModelSelectionPromotion = {
|
|
263
284
|
readonly kind: "promoted";
|
|
264
285
|
} | {
|
|
@@ -490,12 +511,17 @@ export type SessionDestination = {
|
|
|
490
511
|
readonly directory: string;
|
|
491
512
|
};
|
|
492
513
|
export type SessionDestinationInput = string | SessionDestination | undefined;
|
|
493
|
-
|
|
514
|
+
type ForkArtifactPublication = {
|
|
515
|
+
readonly kind: "managed";
|
|
494
516
|
readonly snapshot: native.NativeDirectoryTreeSnapshot;
|
|
495
517
|
readonly store: ManagedSessionDescendantStore;
|
|
496
518
|
readonly cleanupStore: ManagedSessionDescendantStore;
|
|
497
519
|
readonly cleanupRelativePath: string;
|
|
498
|
-
}
|
|
520
|
+
} | {
|
|
521
|
+
readonly kind: "explicit";
|
|
522
|
+
readonly artifactsDir: string;
|
|
523
|
+
readonly snapshot: native.NativeDirectoryTreeSnapshot;
|
|
524
|
+
};
|
|
499
525
|
/** Exported for testing */
|
|
500
526
|
export declare function loadEntriesFromFile(filePath: string, storage?: SessionStorage): Promise<FileEntry[]>;
|
|
501
527
|
declare class RecentSessionInfo {
|
|
@@ -541,6 +567,10 @@ export declare function residentBlobSentinelForTests(kind: ResidentBlobKind, ref
|
|
|
541
567
|
export declare function materializeResidentEntriesForPersistenceForTests<T>(entries: T[], textStore: BlobStore, imageStore?: BlobStore): T[];
|
|
542
568
|
/** Get recent sessions for display in welcome screen */
|
|
543
569
|
export declare function getRecentSessions(sessionDir: string, limit?: number, storage?: SessionStorage): Promise<RecentSessionInfo[]>;
|
|
570
|
+
export declare function getRecentSessionDisplay(sessions: readonly SessionInfo[], limit?: number): Array<{
|
|
571
|
+
name: string;
|
|
572
|
+
timeAgo: string;
|
|
573
|
+
}>;
|
|
544
574
|
/**
|
|
545
575
|
* Manages conversation sessions as append-only trees stored in JSONL files.
|
|
546
576
|
*
|
|
@@ -576,6 +606,13 @@ interface SessionManagerStateSnapshot {
|
|
|
576
606
|
fileEntries: FileEntry[];
|
|
577
607
|
materializedFileEntries: FileEntry[];
|
|
578
608
|
}
|
|
609
|
+
/** Benchmark-derived cap for strong materialized session snapshots. */
|
|
610
|
+
export declare const MATERIALIZED_CACHE_MAX_BYTES: number;
|
|
611
|
+
/** Test-only cache retention and transition seams; these are intentionally not user settings. */
|
|
612
|
+
export declare const SessionManagerTestHooks: {
|
|
613
|
+
materializedCacheMaxBytesOverride?: number;
|
|
614
|
+
beforeResidentTransitionIndexBuild?: () => void;
|
|
615
|
+
};
|
|
579
616
|
export declare class SessionManager {
|
|
580
617
|
#private;
|
|
581
618
|
private cwd;
|
|
@@ -589,18 +626,12 @@ export declare class SessionManager {
|
|
|
589
626
|
* revision contract). Tests assert the invalidation mapping through this;
|
|
590
627
|
* future export/label-view caches key off their respective domains.
|
|
591
628
|
*/
|
|
592
|
-
revisionSnapshot():
|
|
593
|
-
entry: number;
|
|
594
|
-
leaf: number;
|
|
595
|
-
headerExport: number;
|
|
596
|
-
label: number;
|
|
597
|
-
replayMetadata: number;
|
|
598
|
-
};
|
|
629
|
+
revisionSnapshot(): SessionManagerRevisionSnapshot;
|
|
599
630
|
/** Puts a binary blob into the blob store and returns the blob reference */
|
|
600
631
|
putBlob(data: Buffer): Promise<BlobPutResult>;
|
|
601
632
|
captureState(): SessionManagerStateSnapshot;
|
|
602
633
|
restoreState(snapshot: SessionManagerStateSnapshot): void;
|
|
603
|
-
/** Switch to a different session file (used for resume and branching) */
|
|
634
|
+
/** Switch to a different session file (used for resume and branching). */
|
|
604
635
|
setSessionFile(sessionFile: string): Promise<void>;
|
|
605
636
|
/** Start a new session. Closes any existing writer first. */
|
|
606
637
|
newSession(options?: NewSessionOptions): Promise<string | undefined>;
|
|
@@ -638,9 +669,9 @@ export declare class SessionManager {
|
|
|
638
669
|
* managed logical authorization. This is only for discarding an UNCOMMITTED
|
|
639
670
|
* successor that a transaction (e.g. handoff) created via `newSession()` but
|
|
640
671
|
* never durably authorized — such a session has no managed candidate listing
|
|
641
|
-
* yet, so `dropSession` would refuse it and leak its
|
|
642
|
-
*
|
|
643
|
-
*
|
|
672
|
+
* yet, so `dropSession` would refuse it and leak its artifact root. Bounded to
|
|
673
|
+
* this manager's configured session root and refuses to touch the active session;
|
|
674
|
+
* tolerates missing files.
|
|
644
675
|
*/
|
|
645
676
|
discardUncommittedSession(sessionPath: string): Promise<void>;
|
|
646
677
|
/**
|
|
@@ -691,6 +722,8 @@ export declare class SessionManager {
|
|
|
691
722
|
listForResumePickerReadOnly(): Promise<SessionInfo[]>;
|
|
692
723
|
getSessionId(): string;
|
|
693
724
|
getSessionFile(): string | undefined;
|
|
725
|
+
acquireMemoryGuardParticipantIngressLease(): MemoryGuardParticipantIngressLease;
|
|
726
|
+
createMemoryGuardCheckpoint(input: MemoryGuardCreateCheckpointInput): Promise<MemoryGuardSessionManagerCheckpointV1>;
|
|
694
727
|
/**
|
|
695
728
|
* Returns the session artifacts directory path (session file path without .jsonl).
|
|
696
729
|
* Returns null when the session is not persisted to a file.
|
|
@@ -747,11 +780,6 @@ export declare class SessionManager {
|
|
|
747
780
|
/** The source that set the session name: "user" (manual /rename or RPC) or "auto" (generated title). */
|
|
748
781
|
get titleSource(): "auto" | "user" | undefined;
|
|
749
782
|
getSessionName(): string | undefined;
|
|
750
|
-
/**
|
|
751
|
-
* Set the session display name.
|
|
752
|
-
* @param source - "user" for explicit renames (/rename command, RPC); "auto" for generated titles.
|
|
753
|
-
* Auto-generated titles are silently ignored when the user has already set a name.
|
|
754
|
-
*/
|
|
755
783
|
setSessionName(name: string, source?: "auto" | "user"): Promise<boolean>;
|
|
756
784
|
_persist(entry: SessionEntry): void;
|
|
757
785
|
/** Append a configured fallback chain as child of current leaf, then advance leaf. Returns entry id. */
|
|
@@ -971,7 +999,7 @@ export declare class SessionManager {
|
|
|
971
999
|
* legacy sibling directories.
|
|
972
1000
|
*/
|
|
973
1001
|
static listForResumePickerReadOnly(cwd: string, sessionDir?: string, storage?: SessionStorage): Promise<SessionInfo[]>;
|
|
974
|
-
/**
|
|
1002
|
+
/** Delete an authorized managed or project-local picker candidate. */
|
|
975
1003
|
static deleteManagedCandidate(sessionPath: string): Promise<void>;
|
|
976
1004
|
/** Capture exact source content for a strict fork without granting write ownership. */
|
|
977
1005
|
static captureTranscriptStrict(filePath: string, storage?: SessionStorage): StrictSessionCaptureResult;
|
|
@@ -981,6 +1009,7 @@ export declare class SessionManager {
|
|
|
981
1009
|
* persistence; destination history always comes from the captured bytes.
|
|
982
1010
|
*/
|
|
983
1011
|
static forkFromCaptured(snapshot: CapturedSessionTranscriptSnapshot, cwd: string, destinationInput?: SessionDestinationInput, _migrationPolicy?: SessionDirectoryMigrationPolicy): Promise<StrictSessionForkResult>;
|
|
1012
|
+
static restoreMemoryGuardCheckpoint(input: MemoryGuardRestoreInput): Promise<MemoryGuardRestoreResult>;
|
|
984
1013
|
/** Inspect a selected session without acquiring write-capable ownership. */
|
|
985
1014
|
static inspectSessionTailReadOnly(filePath: string, storage?: SessionStorage): Promise<ResumeTailInspection>;
|
|
986
1015
|
/**
|
|
@@ -61,6 +61,8 @@ export interface SessionStorageWriterOpenOptions {
|
|
|
61
61
|
export interface ManagedSessionSecurityContext {
|
|
62
62
|
readonly kind: "managed";
|
|
63
63
|
readonly agentDir: string;
|
|
64
|
+
/** Logical profile root for process-local caches; distinct from managed pathname authority. */
|
|
65
|
+
readonly profileAgentDir: string;
|
|
64
66
|
readonly sessionsRoot: string;
|
|
65
67
|
readonly sessionDir: string;
|
|
66
68
|
readonly rootAuthority: ManagedDirectoryRoot;
|
|
@@ -69,6 +71,8 @@ export interface ManagedSessionSecurityContext {
|
|
|
69
71
|
/** @internal Create the only accepted managed writer authority object. */
|
|
70
72
|
export declare function createManagedSessionSecurityContext(input: {
|
|
71
73
|
agentDir: string;
|
|
74
|
+
/** Optional for compatibility with existing authority-only callers. */
|
|
75
|
+
profileAgentDir?: string;
|
|
72
76
|
sessionsRoot: string;
|
|
73
77
|
sessionDir: string;
|
|
74
78
|
rootAuthority: ManagedDirectoryRoot;
|