pulseed 0.6.2 → 0.6.4
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/dist/adapters/agents/claude-api.d.ts +2 -2
- package/dist/adapters/agents/claude-api.d.ts.map +1 -1
- package/dist/adapters/agents/claude-api.js +3 -2
- package/dist/adapters/agents/claude-api.js.map +1 -1
- package/dist/adapters/agents/openai-codex.d.ts +3 -0
- package/dist/adapters/agents/openai-codex.d.ts.map +1 -1
- package/dist/adapters/agents/openai-codex.js +5 -0
- package/dist/adapters/agents/openai-codex.js.map +1 -1
- package/dist/adapters/datasources/artifact-metric-datasource.d.ts +13 -0
- package/dist/adapters/datasources/artifact-metric-datasource.d.ts.map +1 -1
- package/dist/adapters/datasources/artifact-metric-datasource.js +257 -8
- package/dist/adapters/datasources/artifact-metric-datasource.js.map +1 -1
- package/dist/base/config/global-config.d.ts +4 -4
- package/dist/base/llm/codex-llm-client.d.ts +3 -0
- package/dist/base/llm/codex-llm-client.d.ts.map +1 -1
- package/dist/base/llm/codex-llm-client.js +71 -7
- package/dist/base/llm/codex-llm-client.js.map +1 -1
- package/dist/base/llm/llm-client.d.ts +2 -0
- package/dist/base/llm/llm-client.d.ts.map +1 -1
- package/dist/base/llm/llm-client.js +2 -2
- package/dist/base/llm/llm-client.js.map +1 -1
- package/dist/base/llm/ollama-client.d.ts.map +1 -1
- package/dist/base/llm/ollama-client.js +12 -0
- package/dist/base/llm/ollama-client.js.map +1 -1
- package/dist/base/llm/openai-client.d.ts +4 -0
- package/dist/base/llm/openai-client.d.ts.map +1 -1
- package/dist/base/llm/openai-client.js +29 -15
- package/dist/base/llm/openai-client.js.map +1 -1
- package/dist/base/llm/provider-config.d.ts +12 -2
- package/dist/base/llm/provider-config.d.ts.map +1 -1
- package/dist/base/llm/provider-config.js +46 -5
- package/dist/base/llm/provider-config.js.map +1 -1
- package/dist/base/llm/provider-factory.d.ts +1 -1
- package/dist/base/llm/provider-factory.d.ts.map +1 -1
- package/dist/base/llm/provider-factory.js +7 -2
- package/dist/base/llm/provider-factory.js.map +1 -1
- package/dist/base/protocol/exact-protocol.d.ts +47 -0
- package/dist/base/protocol/exact-protocol.d.ts.map +1 -0
- package/dist/base/protocol/exact-protocol.js +175 -0
- package/dist/base/protocol/exact-protocol.js.map +1 -0
- package/dist/base/types/core.d.ts +1 -1
- package/dist/base/types/core.d.ts.map +1 -1
- package/dist/base/types/core.js +2 -0
- package/dist/base/types/core.js.map +1 -1
- package/dist/base/utils/execFileNoThrow.d.ts +4 -0
- package/dist/base/utils/execFileNoThrow.d.ts.map +1 -1
- package/dist/base/utils/execFileNoThrow.js +81 -2
- package/dist/base/utils/execFileNoThrow.js.map +1 -1
- package/dist/base/utils/workspace-path.d.ts +6 -0
- package/dist/base/utils/workspace-path.d.ts.map +1 -0
- package/dist/base/utils/workspace-path.js +24 -0
- package/dist/base/utils/workspace-path.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/interface/chat/chat-event-state.d.ts +2 -0
- package/dist/interface/chat/chat-event-state.d.ts.map +1 -1
- package/dist/interface/chat/chat-event-state.js +22 -41
- package/dist/interface/chat/chat-event-state.js.map +1 -1
- package/dist/interface/chat/chat-events.d.ts +15 -1
- package/dist/interface/chat/chat-events.d.ts.map +1 -1
- package/dist/interface/chat/chat-history.d.ts +3816 -192
- package/dist/interface/chat/chat-history.d.ts.map +1 -1
- package/dist/interface/chat/chat-history.js +529 -5
- package/dist/interface/chat/chat-history.js.map +1 -1
- package/dist/interface/chat/chat-runner-command-helpers.d.ts +1 -0
- package/dist/interface/chat/chat-runner-command-helpers.d.ts.map +1 -1
- package/dist/interface/chat/chat-runner-command-helpers.js +1 -0
- package/dist/interface/chat/chat-runner-command-helpers.js.map +1 -1
- package/dist/interface/chat/chat-runner-commands.d.ts +3 -1
- package/dist/interface/chat/chat-runner-commands.d.ts.map +1 -1
- package/dist/interface/chat/chat-runner-commands.js +175 -22
- package/dist/interface/chat/chat-runner-commands.js.map +1 -1
- package/dist/interface/chat/chat-runner-contracts.d.ts +6 -1
- package/dist/interface/chat/chat-runner-contracts.d.ts.map +1 -1
- package/dist/interface/chat/chat-runner-event-bridge.d.ts +13 -1
- package/dist/interface/chat/chat-runner-event-bridge.d.ts.map +1 -1
- package/dist/interface/chat/chat-runner-event-bridge.js +51 -3
- package/dist/interface/chat/chat-runner-event-bridge.js.map +1 -1
- package/dist/interface/chat/chat-runner-routes.d.ts +5 -17
- package/dist/interface/chat/chat-runner-routes.d.ts.map +1 -1
- package/dist/interface/chat/chat-runner-routes.js +80 -51
- package/dist/interface/chat/chat-runner-routes.js.map +1 -1
- package/dist/interface/chat/chat-runner-runtime.d.ts.map +1 -1
- package/dist/interface/chat/chat-runner-runtime.js +4 -0
- package/dist/interface/chat/chat-runner-runtime.js.map +1 -1
- package/dist/interface/chat/chat-runner.d.ts +8 -1
- package/dist/interface/chat/chat-runner.d.ts.map +1 -1
- package/dist/interface/chat/chat-runner.js +172 -49
- package/dist/interface/chat/chat-runner.js.map +1 -1
- package/dist/interface/chat/chat-session-store.d.ts +3 -0
- package/dist/interface/chat/chat-session-store.d.ts.map +1 -1
- package/dist/interface/chat/chat-session-store.js +12 -0
- package/dist/interface/chat/chat-session-store.js.map +1 -1
- package/dist/interface/chat/chat-state-service.d.ts +1 -0
- package/dist/interface/chat/chat-state-service.d.ts.map +1 -1
- package/dist/interface/chat/chat-state-service.js +1 -0
- package/dist/interface/chat/chat-state-service.js.map +1 -1
- package/dist/interface/chat/cross-platform-session.d.ts +15 -0
- package/dist/interface/chat/cross-platform-session.d.ts.map +1 -1
- package/dist/interface/chat/cross-platform-session.js +260 -42
- package/dist/interface/chat/cross-platform-session.js.map +1 -1
- package/dist/interface/chat/failure-recovery.d.ts.map +1 -1
- package/dist/interface/chat/failure-recovery.js +15 -1
- package/dist/interface/chat/failure-recovery.js.map +1 -1
- package/dist/interface/chat/freeform-route-classifier.d.ts +2 -2
- package/dist/interface/chat/ingress-router.d.ts +3 -0
- package/dist/interface/chat/ingress-router.d.ts.map +1 -1
- package/dist/interface/chat/ingress-router.js +3 -0
- package/dist/interface/chat/ingress-router.js.map +1 -1
- package/dist/interface/chat/model-request-builder.d.ts +37 -0
- package/dist/interface/chat/model-request-builder.d.ts.map +1 -0
- package/dist/interface/chat/model-request-builder.js +76 -0
- package/dist/interface/chat/model-request-builder.js.map +1 -0
- package/dist/interface/chat/turn-context.d.ts +200 -0
- package/dist/interface/chat/turn-context.d.ts.map +1 -0
- package/dist/interface/chat/turn-context.js +249 -0
- package/dist/interface/chat/turn-context.js.map +1 -0
- package/dist/interface/chat/turn-protocol.d.ts +35 -0
- package/dist/interface/chat/turn-protocol.d.ts.map +1 -0
- package/dist/interface/chat/turn-protocol.js +27 -0
- package/dist/interface/chat/turn-protocol.js.map +1 -0
- package/dist/interface/chat/user-input.d.ts +55 -0
- package/dist/interface/chat/user-input.d.ts.map +1 -0
- package/dist/interface/chat/user-input.js +52 -0
- package/dist/interface/chat/user-input.js.map +1 -0
- package/dist/interface/cli/cli-command-registry.d.ts +1 -1
- package/dist/interface/cli/cli-command-registry.d.ts.map +1 -1
- package/dist/interface/cli/cli-command-registry.js +12 -16
- package/dist/interface/cli/cli-command-registry.js.map +1 -1
- package/dist/interface/cli/commands/config.d.ts.map +1 -1
- package/dist/interface/cli/commands/config.js +12 -1
- package/dist/interface/cli/commands/config.js.map +1 -1
- package/dist/interface/cli/commands/daemon-shared.d.ts +8 -0
- package/dist/interface/cli/commands/daemon-shared.d.ts.map +1 -1
- package/dist/interface/cli/commands/daemon-shared.js +18 -2
- package/dist/interface/cli/commands/daemon-shared.js.map +1 -1
- package/dist/interface/cli/commands/daemon.d.ts.map +1 -1
- package/dist/interface/cli/commands/daemon.js +64 -2
- package/dist/interface/cli/commands/daemon.js.map +1 -1
- package/dist/interface/cli/commands/doctor.d.ts +1 -0
- package/dist/interface/cli/commands/doctor.d.ts.map +1 -1
- package/dist/interface/cli/commands/doctor.js +83 -1
- package/dist/interface/cli/commands/doctor.js.map +1 -1
- package/dist/interface/cli/commands/goal-dispatch.d.ts.map +1 -1
- package/dist/interface/cli/commands/goal-dispatch.js +19 -7
- package/dist/interface/cli/commands/goal-dispatch.js.map +1 -1
- package/dist/interface/cli/commands/goal-raw.d.ts +1 -0
- package/dist/interface/cli/commands/goal-raw.d.ts.map +1 -1
- package/dist/interface/cli/commands/goal-raw.js +34 -2
- package/dist/interface/cli/commands/goal-raw.js.map +1 -1
- package/dist/interface/cli/commands/goal-utils.d.ts.map +1 -1
- package/dist/interface/cli/commands/goal-utils.js +3 -5
- package/dist/interface/cli/commands/goal-utils.js.map +1 -1
- package/dist/interface/cli/commands/run.d.ts.map +1 -1
- package/dist/interface/cli/commands/run.js +50 -0
- package/dist/interface/cli/commands/run.js.map +1 -1
- package/dist/interface/cli/commands/setup/import/flow.d.ts.map +1 -1
- package/dist/interface/cli/commands/setup/import/flow.js +2 -0
- package/dist/interface/cli/commands/setup/import/flow.js.map +1 -1
- package/dist/interface/cli/commands/setup/import/provider.d.ts.map +1 -1
- package/dist/interface/cli/commands/setup/import/provider.js +5 -1
- package/dist/interface/cli/commands/setup/import/provider.js.map +1 -1
- package/dist/interface/cli/commands/setup/import/types.d.ts +1 -0
- package/dist/interface/cli/commands/setup/import/types.d.ts.map +1 -1
- package/dist/interface/cli/commands/setup-shared.d.ts +2 -0
- package/dist/interface/cli/commands/setup-shared.d.ts.map +1 -1
- package/dist/interface/cli/commands/setup-shared.js +4 -1
- package/dist/interface/cli/commands/setup-shared.js.map +1 -1
- package/dist/interface/cli/commands/setup-wizard.d.ts +2 -0
- package/dist/interface/cli/commands/setup-wizard.d.ts.map +1 -1
- package/dist/interface/cli/commands/setup-wizard.js +36 -4
- package/dist/interface/cli/commands/setup-wizard.js.map +1 -1
- package/dist/interface/cli/commands/setup.d.ts.map +1 -1
- package/dist/interface/cli/commands/setup.js +13 -1
- package/dist/interface/cli/commands/setup.js.map +1 -1
- package/dist/interface/cli/setup.d.ts +1 -1
- package/dist/interface/cli/setup.d.ts.map +1 -1
- package/dist/interface/cli/setup.js +4 -3
- package/dist/interface/cli/setup.js.map +1 -1
- package/dist/interface/cli/utils/loop-runner.d.ts +1 -0
- package/dist/interface/cli/utils/loop-runner.d.ts.map +1 -1
- package/dist/interface/cli/utils/loop-runner.js +12 -3
- package/dist/interface/cli/utils/loop-runner.js.map +1 -1
- package/dist/interface/tui/app.d.ts +6 -1
- package/dist/interface/tui/app.d.ts.map +1 -1
- package/dist/interface/tui/app.js +29 -12
- package/dist/interface/tui/app.js.map +1 -1
- package/dist/interface/tui/bash-mode.d.ts.map +1 -1
- package/dist/interface/tui/bash-mode.js +2 -9
- package/dist/interface/tui/bash-mode.js.map +1 -1
- package/dist/interface/tui/chat/suggestions.js +1 -1
- package/dist/interface/tui/chat/suggestions.js.map +1 -1
- package/dist/interface/tui/chat/viewport.d.ts.map +1 -1
- package/dist/interface/tui/chat/viewport.js +57 -11
- package/dist/interface/tui/chat/viewport.js.map +1 -1
- package/dist/interface/tui/entry-deps.d.ts +6 -1
- package/dist/interface/tui/entry-deps.d.ts.map +1 -1
- package/dist/interface/tui/entry-deps.js +3 -0
- package/dist/interface/tui/entry-deps.js.map +1 -1
- package/dist/interface/tui/entry.d.ts.map +1 -1
- package/dist/interface/tui/entry.js +6 -2
- package/dist/interface/tui/entry.js.map +1 -1
- package/dist/interface/tui/input-action.d.ts.map +1 -1
- package/dist/interface/tui/input-action.js +3 -2
- package/dist/interface/tui/input-action.js.map +1 -1
- package/dist/interface/tui/intent-recognizer.d.ts.map +1 -1
- package/dist/interface/tui/intent-recognizer.js +21 -33
- package/dist/interface/tui/intent-recognizer.js.map +1 -1
- package/dist/orchestrator/execution/adapter-layer.d.ts +6 -1
- package/dist/orchestrator/execution/adapter-layer.d.ts.map +1 -1
- package/dist/orchestrator/execution/adapter-layer.js.map +1 -1
- package/dist/orchestrator/execution/agent-loop/agent-loop-command-classifier.d.ts +12 -1
- package/dist/orchestrator/execution/agent-loop/agent-loop-command-classifier.d.ts.map +1 -1
- package/dist/orchestrator/execution/agent-loop/agent-loop-command-classifier.js +16 -31
- package/dist/orchestrator/execution/agent-loop/agent-loop-command-classifier.js.map +1 -1
- package/dist/orchestrator/execution/agent-loop/agent-loop-compaction-record.d.ts +75 -0
- package/dist/orchestrator/execution/agent-loop/agent-loop-compaction-record.d.ts.map +1 -0
- package/dist/orchestrator/execution/agent-loop/agent-loop-compaction-record.js +10 -0
- package/dist/orchestrator/execution/agent-loop/agent-loop-compaction-record.js.map +1 -0
- package/dist/orchestrator/execution/agent-loop/agent-loop-compactor.d.ts +3 -2
- package/dist/orchestrator/execution/agent-loop/agent-loop-compactor.d.ts.map +1 -1
- package/dist/orchestrator/execution/agent-loop/agent-loop-compactor.js +185 -22
- package/dist/orchestrator/execution/agent-loop/agent-loop-compactor.js.map +1 -1
- package/dist/orchestrator/execution/agent-loop/agent-loop-context-assembler.d.ts.map +1 -1
- package/dist/orchestrator/execution/agent-loop/agent-loop-context-assembler.js +12 -1
- package/dist/orchestrator/execution/agent-loop/agent-loop-context-assembler.js.map +1 -1
- package/dist/orchestrator/execution/agent-loop/agent-loop-default-profile.d.ts +1 -1
- package/dist/orchestrator/execution/agent-loop/agent-loop-default-profile.d.ts.map +1 -1
- package/dist/orchestrator/execution/agent-loop/agent-loop-default-profile.js +11 -2
- package/dist/orchestrator/execution/agent-loop/agent-loop-default-profile.js.map +1 -1
- package/dist/orchestrator/execution/agent-loop/agent-loop-events.d.ts +8 -1
- package/dist/orchestrator/execution/agent-loop/agent-loop-events.d.ts.map +1 -1
- package/dist/orchestrator/execution/agent-loop/agent-loop-events.js.map +1 -1
- package/dist/orchestrator/execution/agent-loop/agent-loop-history.d.ts +3 -1
- package/dist/orchestrator/execution/agent-loop/agent-loop-history.d.ts.map +1 -1
- package/dist/orchestrator/execution/agent-loop/agent-loop-history.js +12 -3
- package/dist/orchestrator/execution/agent-loop/agent-loop-history.js.map +1 -1
- package/dist/orchestrator/execution/agent-loop/agent-loop-model-client.d.ts.map +1 -1
- package/dist/orchestrator/execution/agent-loop/agent-loop-model-client.js +8 -1
- package/dist/orchestrator/execution/agent-loop/agent-loop-model-client.js.map +1 -1
- package/dist/orchestrator/execution/agent-loop/agent-loop-model.d.ts +39 -1
- package/dist/orchestrator/execution/agent-loop/agent-loop-model.d.ts.map +1 -1
- package/dist/orchestrator/execution/agent-loop/agent-loop-model.js +21 -0
- package/dist/orchestrator/execution/agent-loop/agent-loop-model.js.map +1 -1
- package/dist/orchestrator/execution/agent-loop/agent-loop-result.d.ts +17 -11
- package/dist/orchestrator/execution/agent-loop/agent-loop-result.d.ts.map +1 -1
- package/dist/orchestrator/execution/agent-loop/agent-loop-session-state.d.ts +4 -0
- package/dist/orchestrator/execution/agent-loop/agent-loop-session-state.d.ts.map +1 -1
- package/dist/orchestrator/execution/agent-loop/agent-loop-session-state.js +135 -0
- package/dist/orchestrator/execution/agent-loop/agent-loop-session-state.js.map +1 -1
- package/dist/orchestrator/execution/agent-loop/agent-loop-tool-runtime.d.ts +3 -2
- package/dist/orchestrator/execution/agent-loop/agent-loop-tool-runtime.d.ts.map +1 -1
- package/dist/orchestrator/execution/agent-loop/agent-loop-tool-runtime.js +68 -61
- package/dist/orchestrator/execution/agent-loop/agent-loop-tool-runtime.js.map +1 -1
- package/dist/orchestrator/execution/agent-loop/agent-loop-turn-context.d.ts +3 -1
- package/dist/orchestrator/execution/agent-loop/agent-loop-turn-context.d.ts.map +1 -1
- package/dist/orchestrator/execution/agent-loop/agent-loop-turn-context.js.map +1 -1
- package/dist/orchestrator/execution/agent-loop/agent-timeline.d.ts +12 -1
- package/dist/orchestrator/execution/agent-loop/agent-timeline.d.ts.map +1 -1
- package/dist/orchestrator/execution/agent-loop/agent-timeline.js +19 -56
- package/dist/orchestrator/execution/agent-loop/agent-timeline.js.map +1 -1
- package/dist/orchestrator/execution/agent-loop/anthropic-messages-agent-loop-model-client.d.ts.map +1 -1
- package/dist/orchestrator/execution/agent-loop/anthropic-messages-agent-loop-model-client.js +13 -4
- package/dist/orchestrator/execution/agent-loop/anthropic-messages-agent-loop-model-client.js.map +1 -1
- package/dist/orchestrator/execution/agent-loop/bounded-agent-loop-runner.d.ts +12 -0
- package/dist/orchestrator/execution/agent-loop/bounded-agent-loop-runner.d.ts.map +1 -1
- package/dist/orchestrator/execution/agent-loop/bounded-agent-loop-runner.js +404 -79
- package/dist/orchestrator/execution/agent-loop/bounded-agent-loop-runner.js.map +1 -1
- package/dist/orchestrator/execution/agent-loop/chat-agent-loop-runner.d.ts +1 -1
- package/dist/orchestrator/execution/agent-loop/chat-agent-loop-runner.d.ts.map +1 -1
- package/dist/orchestrator/execution/agent-loop/chat-agent-loop-runner.js +80 -12
- package/dist/orchestrator/execution/agent-loop/chat-agent-loop-runner.js.map +1 -1
- package/dist/orchestrator/execution/agent-loop/chat-display-output.d.ts +1 -0
- package/dist/orchestrator/execution/agent-loop/chat-display-output.d.ts.map +1 -1
- package/dist/orchestrator/execution/agent-loop/chat-display-output.js +3 -1
- package/dist/orchestrator/execution/agent-loop/chat-display-output.js.map +1 -1
- package/dist/orchestrator/execution/agent-loop/index.d.ts +3 -0
- package/dist/orchestrator/execution/agent-loop/index.d.ts.map +1 -1
- package/dist/orchestrator/execution/agent-loop/index.js +3 -0
- package/dist/orchestrator/execution/agent-loop/index.js.map +1 -1
- package/dist/orchestrator/execution/agent-loop/openai-responses-agent-loop-model-client.d.ts +1 -0
- package/dist/orchestrator/execution/agent-loop/openai-responses-agent-loop-model-client.d.ts.map +1 -1
- package/dist/orchestrator/execution/agent-loop/openai-responses-agent-loop-model-client.js +56 -11
- package/dist/orchestrator/execution/agent-loop/openai-responses-agent-loop-model-client.js.map +1 -1
- package/dist/orchestrator/execution/agent-loop/response-item-tool-router.d.ts +20 -0
- package/dist/orchestrator/execution/agent-loop/response-item-tool-router.d.ts.map +1 -0
- package/dist/orchestrator/execution/agent-loop/response-item-tool-router.js +180 -0
- package/dist/orchestrator/execution/agent-loop/response-item-tool-router.js.map +1 -0
- package/dist/orchestrator/execution/agent-loop/response-item.d.ts +805 -0
- package/dist/orchestrator/execution/agent-loop/response-item.d.ts.map +1 -0
- package/dist/orchestrator/execution/agent-loop/response-item.js +104 -0
- package/dist/orchestrator/execution/agent-loop/response-item.js.map +1 -0
- package/dist/orchestrator/execution/agent-loop/task-agent-loop-context.d.ts +7 -2
- package/dist/orchestrator/execution/agent-loop/task-agent-loop-context.d.ts.map +1 -1
- package/dist/orchestrator/execution/agent-loop/task-agent-loop-context.js +20 -1
- package/dist/orchestrator/execution/agent-loop/task-agent-loop-context.js.map +1 -1
- package/dist/orchestrator/execution/agent-loop/task-agent-loop-result.d.ts +5 -3
- package/dist/orchestrator/execution/agent-loop/task-agent-loop-result.d.ts.map +1 -1
- package/dist/orchestrator/execution/agent-loop/task-agent-loop-result.js +110 -10
- package/dist/orchestrator/execution/agent-loop/task-agent-loop-result.js.map +1 -1
- package/dist/orchestrator/execution/agent-loop/task-agent-loop-runner.d.ts +2 -0
- package/dist/orchestrator/execution/agent-loop/task-agent-loop-runner.d.ts.map +1 -1
- package/dist/orchestrator/execution/agent-loop/task-agent-loop-runner.js +9 -4
- package/dist/orchestrator/execution/agent-loop/task-agent-loop-runner.js.map +1 -1
- package/dist/orchestrator/execution/agent-loop/task-agent-loop-verification.d.ts +0 -1
- package/dist/orchestrator/execution/agent-loop/task-agent-loop-verification.d.ts.map +1 -1
- package/dist/orchestrator/execution/agent-loop/task-agent-loop-verification.js +7 -87
- package/dist/orchestrator/execution/agent-loop/task-agent-loop-verification.js.map +1 -1
- package/dist/orchestrator/execution/agent-loop/task-agent-loop-worktree.d.ts.map +1 -1
- package/dist/orchestrator/execution/agent-loop/task-agent-loop-worktree.js +25 -0
- package/dist/orchestrator/execution/agent-loop/task-agent-loop-worktree.js.map +1 -1
- package/dist/orchestrator/execution/context/issue-context-fetcher.d.ts +5 -1
- package/dist/orchestrator/execution/context/issue-context-fetcher.d.ts.map +1 -1
- package/dist/orchestrator/execution/context/issue-context-fetcher.js +7 -4
- package/dist/orchestrator/execution/context/issue-context-fetcher.js.map +1 -1
- package/dist/orchestrator/execution/task/task-artifact-contract.d.ts +18 -0
- package/dist/orchestrator/execution/task/task-artifact-contract.d.ts.map +1 -0
- package/dist/orchestrator/execution/task/task-artifact-contract.js +176 -0
- package/dist/orchestrator/execution/task/task-artifact-contract.js.map +1 -0
- package/dist/orchestrator/execution/task/task-diff-capture.d.ts +14 -1
- package/dist/orchestrator/execution/task/task-diff-capture.d.ts.map +1 -1
- package/dist/orchestrator/execution/task/task-diff-capture.js +269 -17
- package/dist/orchestrator/execution/task/task-diff-capture.js.map +1 -1
- package/dist/orchestrator/execution/task/task-execution-helpers.d.ts +1 -0
- package/dist/orchestrator/execution/task/task-execution-helpers.d.ts.map +1 -1
- package/dist/orchestrator/execution/task/task-execution-helpers.js +76 -17
- package/dist/orchestrator/execution/task/task-execution-helpers.js.map +1 -1
- package/dist/orchestrator/execution/task/task-executor.d.ts +16 -1
- package/dist/orchestrator/execution/task/task-executor.d.ts.map +1 -1
- package/dist/orchestrator/execution/task/task-executor.js +55 -50
- package/dist/orchestrator/execution/task/task-executor.js.map +1 -1
- package/dist/orchestrator/execution/task/task-generation.d.ts +54 -1
- package/dist/orchestrator/execution/task/task-generation.d.ts.map +1 -1
- package/dist/orchestrator/execution/task/task-generation.js +19 -3
- package/dist/orchestrator/execution/task/task-generation.js.map +1 -1
- package/dist/orchestrator/execution/task/task-lifecycle-runner.d.ts +4 -3
- package/dist/orchestrator/execution/task/task-lifecycle-runner.d.ts.map +1 -1
- package/dist/orchestrator/execution/task/task-lifecycle-runner.js +32 -5
- package/dist/orchestrator/execution/task/task-lifecycle-runner.js.map +1 -1
- package/dist/orchestrator/execution/task/task-lifecycle.d.ts +5 -4
- package/dist/orchestrator/execution/task/task-lifecycle.d.ts.map +1 -1
- package/dist/orchestrator/execution/task/task-lifecycle.js +61 -11
- package/dist/orchestrator/execution/task/task-lifecycle.js.map +1 -1
- package/dist/orchestrator/execution/task/task-outcome-ledger.d.ts +8 -0
- package/dist/orchestrator/execution/task/task-outcome-ledger.d.ts.map +1 -1
- package/dist/orchestrator/execution/task/task-outcome-ledger.js +59 -3
- package/dist/orchestrator/execution/task/task-outcome-ledger.js.map +1 -1
- package/dist/orchestrator/execution/task/task-prompt-builder.d.ts +3 -1
- package/dist/orchestrator/execution/task/task-prompt-builder.d.ts.map +1 -1
- package/dist/orchestrator/execution/task/task-prompt-builder.js +23 -12
- package/dist/orchestrator/execution/task/task-prompt-builder.js.map +1 -1
- package/dist/orchestrator/execution/task/task-verifier-rules.d.ts +5 -2
- package/dist/orchestrator/execution/task/task-verifier-rules.d.ts.map +1 -1
- package/dist/orchestrator/execution/task/task-verifier-rules.js +346 -104
- package/dist/orchestrator/execution/task/task-verifier-rules.js.map +1 -1
- package/dist/orchestrator/execution/task/task-verifier-types.d.ts +13 -0
- package/dist/orchestrator/execution/task/task-verifier-types.d.ts.map +1 -1
- package/dist/orchestrator/execution/task/task-verifier-types.js.map +1 -1
- package/dist/orchestrator/execution/task/task-verifier.d.ts +5 -4
- package/dist/orchestrator/execution/task/task-verifier.d.ts.map +1 -1
- package/dist/orchestrator/execution/task/task-verifier.js +237 -22
- package/dist/orchestrator/execution/task/task-verifier.js.map +1 -1
- package/dist/orchestrator/execution/task/task-workspace.d.ts +13 -0
- package/dist/orchestrator/execution/task/task-workspace.d.ts.map +1 -0
- package/dist/orchestrator/execution/task/task-workspace.js +32 -0
- package/dist/orchestrator/execution/task/task-workspace.js.map +1 -0
- package/dist/orchestrator/execution/types/task-group.d.ts +76 -5
- package/dist/orchestrator/execution/types/task-group.d.ts.map +1 -1
- package/dist/orchestrator/execution/types/task.d.ts +117 -3
- package/dist/orchestrator/execution/types/task.d.ts.map +1 -1
- package/dist/orchestrator/execution/types/task.js +12 -0
- package/dist/orchestrator/execution/types/task.js.map +1 -1
- package/dist/orchestrator/goal/types/goal.d.ts +6 -6
- package/dist/orchestrator/loop/durable-loop/iteration-kernel.d.ts +1 -0
- package/dist/orchestrator/loop/durable-loop/iteration-kernel.d.ts.map +1 -1
- package/dist/orchestrator/loop/durable-loop/iteration-kernel.js +2 -2
- package/dist/orchestrator/loop/durable-loop/iteration-kernel.js.map +1 -1
- package/dist/orchestrator/loop/durable-loop/preparation.d.ts.map +1 -1
- package/dist/orchestrator/loop/durable-loop/preparation.js +7 -1
- package/dist/orchestrator/loop/durable-loop/preparation.js.map +1 -1
- package/dist/orchestrator/loop/durable-loop/task-cycle.d.ts +2 -1
- package/dist/orchestrator/loop/durable-loop/task-cycle.d.ts.map +1 -1
- package/dist/orchestrator/loop/durable-loop/task-cycle.js +2 -2
- package/dist/orchestrator/loop/durable-loop/task-cycle.js.map +1 -1
- package/dist/orchestrator/loop/durable-loop.d.ts +3 -2
- package/dist/orchestrator/loop/durable-loop.d.ts.map +1 -1
- package/dist/orchestrator/loop/durable-loop.js +26 -6
- package/dist/orchestrator/loop/durable-loop.js.map +1 -1
- package/dist/platform/corrections/memory-correction-ledger.d.ts +30 -30
- package/dist/platform/corrections/memory-governance.d.ts +2 -2
- package/dist/platform/knowledge/memory/memory-selection.d.ts.map +1 -1
- package/dist/platform/knowledge/memory/memory-selection.js +24 -18
- package/dist/platform/knowledge/memory/memory-selection.js.map +1 -1
- package/dist/platform/knowledge/types/agent-memory.d.ts +30 -30
- package/dist/platform/observation/context-provider/collector.d.ts.map +1 -1
- package/dist/platform/observation/context-provider/collector.js +89 -24
- package/dist/platform/observation/context-provider/collector.js.map +1 -1
- package/dist/platform/observation/data-source-adapter.d.ts +2 -0
- package/dist/platform/observation/data-source-adapter.d.ts.map +1 -1
- package/dist/platform/observation/data-source-adapter.js.map +1 -1
- package/dist/platform/observation/observation-apply.d.ts.map +1 -1
- package/dist/platform/observation/observation-apply.js +8 -2
- package/dist/platform/observation/observation-apply.js.map +1 -1
- package/dist/platform/observation/observation-engine.d.ts.map +1 -1
- package/dist/platform/observation/observation-engine.js +154 -67
- package/dist/platform/observation/observation-engine.js.map +1 -1
- package/dist/platform/observation/observation-helpers.d.ts +2 -0
- package/dist/platform/observation/observation-helpers.d.ts.map +1 -1
- package/dist/platform/observation/observation-helpers.js.map +1 -1
- package/dist/platform/observation/types/data-source.d.ts +60 -0
- package/dist/platform/observation/types/data-source.d.ts.map +1 -1
- package/dist/platform/observation/types/data-source.js +5 -0
- package/dist/platform/observation/types/data-source.js.map +1 -1
- package/dist/platform/observation/workspace-context.d.ts.map +1 -1
- package/dist/platform/observation/workspace-context.js +13 -18
- package/dist/platform/observation/workspace-context.js.map +1 -1
- package/dist/platform/soil/contracts.d.ts +74 -74
- package/dist/reporting/types/report.d.ts +7 -0
- package/dist/reporting/types/report.d.ts.map +1 -1
- package/dist/runtime/approval-broker.d.ts +12 -0
- package/dist/runtime/approval-broker.d.ts.map +1 -1
- package/dist/runtime/approval-broker.js +27 -7
- package/dist/runtime/approval-broker.js.map +1 -1
- package/dist/runtime/control/daemon-runtime-control-executor.d.ts.map +1 -1
- package/dist/runtime/control/daemon-runtime-control-executor.js +9 -4
- package/dist/runtime/control/daemon-runtime-control-executor.js.map +1 -1
- package/dist/runtime/control/runtime-control-intent.d.ts.map +1 -1
- package/dist/runtime/control/runtime-control-intent.js +3 -2
- package/dist/runtime/control/runtime-control-intent.js.map +1 -1
- package/dist/runtime/control/runtime-control-service.d.ts +2 -1
- package/dist/runtime/control/runtime-control-service.d.ts.map +1 -1
- package/dist/runtime/control/runtime-control-service.js +9 -2
- package/dist/runtime/control/runtime-control-service.js.map +1 -1
- package/dist/runtime/control/runtime-target-resolver.js +2 -0
- package/dist/runtime/control/runtime-target-resolver.js.map +1 -1
- package/dist/runtime/daemon/runner-goal-cycle.d.ts.map +1 -1
- package/dist/runtime/daemon/runner-goal-cycle.js +1 -2
- package/dist/runtime/daemon/runner-goal-cycle.js.map +1 -1
- package/dist/runtime/daemon/runner-recovery.d.ts +17 -3
- package/dist/runtime/daemon/runner-recovery.d.ts.map +1 -1
- package/dist/runtime/daemon/runner-recovery.js +50 -12
- package/dist/runtime/daemon/runner-recovery.js.map +1 -1
- package/dist/runtime/daemon/runner-startup.d.ts.map +1 -1
- package/dist/runtime/daemon/runner-startup.js +18 -1
- package/dist/runtime/daemon/runner-startup.js.map +1 -1
- package/dist/runtime/daemon/runner.d.ts.map +1 -1
- package/dist/runtime/daemon/runner.js +3 -2
- package/dist/runtime/daemon/runner.js.map +1 -1
- package/dist/runtime/daemon/runtime-ownership.d.ts +0 -1
- package/dist/runtime/daemon/runtime-ownership.d.ts.map +1 -1
- package/dist/runtime/daemon/runtime-ownership.js +18 -18
- package/dist/runtime/daemon/runtime-ownership.js.map +1 -1
- package/dist/runtime/daemon/wait-deadline-resolver.d.ts.map +1 -1
- package/dist/runtime/daemon/wait-deadline-resolver.js +2 -0
- package/dist/runtime/daemon/wait-deadline-resolver.js.map +1 -1
- package/dist/runtime/evidence-answer.d.ts.map +1 -1
- package/dist/runtime/evidence-answer.js +34 -7
- package/dist/runtime/evidence-answer.js.map +1 -1
- package/dist/runtime/executor/goal-worker.d.ts +6 -1
- package/dist/runtime/executor/goal-worker.d.ts.map +1 -1
- package/dist/runtime/executor/goal-worker.js +18 -1
- package/dist/runtime/executor/goal-worker.js.map +1 -1
- package/dist/runtime/executor/loop-supervisor.d.ts +1 -0
- package/dist/runtime/executor/loop-supervisor.d.ts.map +1 -1
- package/dist/runtime/executor/loop-supervisor.js +58 -6
- package/dist/runtime/executor/loop-supervisor.js.map +1 -1
- package/dist/runtime/gateway/channel-adapter.d.ts +3 -0
- package/dist/runtime/gateway/channel-adapter.d.ts.map +1 -1
- package/dist/runtime/gateway/channel-display-policy.d.ts +42 -0
- package/dist/runtime/gateway/channel-display-policy.d.ts.map +1 -0
- package/dist/runtime/gateway/channel-display-policy.js +85 -0
- package/dist/runtime/gateway/channel-display-policy.js.map +1 -0
- package/dist/runtime/gateway/chat-event-rendering.d.ts +2 -1
- package/dist/runtime/gateway/chat-event-rendering.d.ts.map +1 -1
- package/dist/runtime/gateway/chat-event-rendering.js +2 -0
- package/dist/runtime/gateway/chat-event-rendering.js.map +1 -1
- package/dist/runtime/gateway/chat-session-dispatch.d.ts.map +1 -1
- package/dist/runtime/gateway/chat-session-dispatch.js +4 -9
- package/dist/runtime/gateway/chat-session-dispatch.js.map +1 -1
- package/dist/runtime/gateway/chat-session-port.d.ts +2 -0
- package/dist/runtime/gateway/chat-session-port.d.ts.map +1 -1
- package/dist/runtime/gateway/chat-session-port.js.map +1 -1
- package/dist/runtime/gateway/discord-gateway-adapter.d.ts +4 -0
- package/dist/runtime/gateway/discord-gateway-adapter.d.ts.map +1 -1
- package/dist/runtime/gateway/discord-gateway-adapter.js +100 -31
- package/dist/runtime/gateway/discord-gateway-adapter.js.map +1 -1
- package/dist/runtime/gateway/index.d.ts +4 -0
- package/dist/runtime/gateway/index.d.ts.map +1 -1
- package/dist/runtime/gateway/index.js +2 -0
- package/dist/runtime/gateway/index.js.map +1 -1
- package/dist/runtime/gateway/non-tui-display-projector.d.ts +40 -0
- package/dist/runtime/gateway/non-tui-display-projector.d.ts.map +1 -0
- package/dist/runtime/gateway/non-tui-display-projector.js +166 -0
- package/dist/runtime/gateway/non-tui-display-projector.js.map +1 -0
- package/dist/runtime/gateway/signal-gateway-adapter.d.ts +1 -0
- package/dist/runtime/gateway/signal-gateway-adapter.d.ts.map +1 -1
- package/dist/runtime/gateway/signal-gateway-adapter.js +47 -4
- package/dist/runtime/gateway/signal-gateway-adapter.js.map +1 -1
- package/dist/runtime/gateway/slack-channel-adapter.d.ts +1 -0
- package/dist/runtime/gateway/slack-channel-adapter.d.ts.map +1 -1
- package/dist/runtime/gateway/slack-channel-adapter.js +93 -18
- package/dist/runtime/gateway/slack-channel-adapter.js.map +1 -1
- package/dist/runtime/gateway/telegram-gateway-adapter.d.ts +2 -0
- package/dist/runtime/gateway/telegram-gateway-adapter.d.ts.map +1 -1
- package/dist/runtime/gateway/telegram-gateway-adapter.js +61 -113
- package/dist/runtime/gateway/telegram-gateway-adapter.js.map +1 -1
- package/dist/runtime/gateway/whatsapp-gateway-adapter.d.ts +1 -0
- package/dist/runtime/gateway/whatsapp-gateway-adapter.d.ts.map +1 -1
- package/dist/runtime/gateway/whatsapp-gateway-adapter.js +49 -4
- package/dist/runtime/gateway/whatsapp-gateway-adapter.js.map +1 -1
- package/dist/runtime/permission-dialogue.d.ts +113 -0
- package/dist/runtime/permission-dialogue.d.ts.map +1 -0
- package/dist/runtime/permission-dialogue.js +82 -0
- package/dist/runtime/permission-dialogue.js.map +1 -0
- package/dist/runtime/run-spec/derive.d.ts +14 -14
- package/dist/runtime/run-spec/handoff.js +2 -0
- package/dist/runtime/run-spec/handoff.js.map +1 -1
- package/dist/runtime/run-spec/types.d.ts +16 -16
- package/dist/runtime/session-registry/types.d.ts +12 -12
- package/dist/runtime/store/artifact-retention.d.ts +2 -0
- package/dist/runtime/store/artifact-retention.d.ts.map +1 -1
- package/dist/runtime/store/artifact-retention.js +24 -21
- package/dist/runtime/store/artifact-retention.js.map +1 -1
- package/dist/runtime/store/budget-store.d.ts +8 -8
- package/dist/runtime/store/evidence-ledger.d.ts.map +1 -1
- package/dist/runtime/store/evidence-ledger.js +39 -1
- package/dist/runtime/store/evidence-ledger.js.map +1 -1
- package/dist/runtime/store/evidence-types.d.ts +118 -118
- package/dist/runtime/store/experiment-queue-store.d.ts +20 -20
- package/dist/runtime/store/postmortem-report.d.ts +2 -2
- package/dist/runtime/store/reproducibility-manifest.d.ts +20 -20
- package/dist/runtime/store/runtime-operation-schemas.d.ts +18 -18
- package/dist/runtime/store/runtime-operation-schemas.d.ts.map +1 -1
- package/dist/runtime/store/runtime-operation-schemas.js +1 -0
- package/dist/runtime/store/runtime-operation-schemas.js.map +1 -1
- package/dist/runtime/store/runtime-schemas.d.ts +58 -28
- package/dist/runtime/store/runtime-schemas.d.ts.map +1 -1
- package/dist/runtime/store/runtime-schemas.js +1 -0
- package/dist/runtime/store/runtime-schemas.js.map +1 -1
- package/dist/tools/execution/MemorySaveTool/MemorySaveTool.d.ts +8 -8
- package/dist/tools/execution/RunAdapterTool/RunAdapterTool.d.ts +6 -0
- package/dist/tools/execution/RunAdapterTool/RunAdapterTool.d.ts.map +1 -1
- package/dist/tools/execution/RunAdapterTool/RunAdapterTool.js +2 -0
- package/dist/tools/execution/RunAdapterTool/RunAdapterTool.js.map +1 -1
- package/dist/tools/execution-orchestrator.d.ts +29 -0
- package/dist/tools/execution-orchestrator.d.ts.map +1 -0
- package/dist/tools/execution-orchestrator.js +153 -0
- package/dist/tools/execution-orchestrator.js.map +1 -0
- package/dist/tools/executor.d.ts +6 -0
- package/dist/tools/executor.d.ts.map +1 -1
- package/dist/tools/executor.js +48 -11
- package/dist/tools/executor.js.map +1 -1
- package/dist/tools/fs/ApplyPatchTool/ApplyPatchTool.d.ts.map +1 -1
- package/dist/tools/fs/ApplyPatchTool/ApplyPatchTool.js +130 -17
- package/dist/tools/fs/ApplyPatchTool/ApplyPatchTool.js.map +1 -1
- package/dist/tools/mutation/TaskStopTool/TaskStopTool.d.ts.map +1 -1
- package/dist/tools/mutation/TaskStopTool/TaskStopTool.js +8 -0
- package/dist/tools/mutation/TaskStopTool/TaskStopTool.js.map +1 -1
- package/dist/tools/mutation/TaskUpdateTool/TaskUpdateTool.d.ts +6 -6
- package/dist/tools/network/GitHubCliTool/GitHubCliTool.d.ts +4 -4
- package/dist/tools/network/McpStdioTool/McpStdioTool.d.ts +4 -4
- package/dist/tools/permission.d.ts +0 -1
- package/dist/tools/permission.d.ts.map +1 -1
- package/dist/tools/permission.js +9 -33
- package/dist/tools/permission.js.map +1 -1
- package/dist/tools/query/CodeReadContextTool/CodeReadContextTool.d.ts +4 -4
- package/dist/tools/query/CodeSearchRepairTool/CodeSearchRepairTool.d.ts +8 -8
- package/dist/tools/query/CodeSearchTool/CodeSearchTool.d.ts +4 -4
- package/dist/tools/query/ConfigTool/ConfigTool.d.ts.map +1 -1
- package/dist/tools/query/ConfigTool/ConfigTool.js +1 -0
- package/dist/tools/query/ConfigTool/ConfigTool.js.map +1 -1
- package/dist/tools/query/MemoryRecallTool/MemoryRecallTool.d.ts +4 -4
- package/dist/tools/query/runtime-session-tools.d.ts +73 -5
- package/dist/tools/query/runtime-session-tools.d.ts.map +1 -1
- package/dist/tools/query/runtime-session-tools.js +114 -0
- package/dist/tools/query/runtime-session-tools.js.map +1 -1
- package/dist/tools/runtime/LongRunningRuntimeTools.d.ts +60 -42
- package/dist/tools/runtime/LongRunningRuntimeTools.d.ts.map +1 -1
- package/dist/tools/runtime/LongRunningRuntimeTools.js +4 -1
- package/dist/tools/runtime/LongRunningRuntimeTools.js.map +1 -1
- package/dist/tools/runtime/RunSpecHandoffTools.d.ts.map +1 -1
- package/dist/tools/runtime/RunSpecHandoffTools.js +162 -2
- package/dist/tools/runtime/RunSpecHandoffTools.js.map +1 -1
- package/dist/tools/runtime/SetupRuntimeControlTools.d.ts.map +1 -1
- package/dist/tools/runtime/SetupRuntimeControlTools.js +169 -17
- package/dist/tools/runtime/SetupRuntimeControlTools.js.map +1 -1
- package/dist/tools/system/GitDiffTool/GitDiffTool.d.ts +4 -4
- package/dist/tools/system/ShellCommandTool/ShellCommandTool.d.ts.map +1 -1
- package/dist/tools/system/ShellCommandTool/ShellCommandTool.js +7 -1
- package/dist/tools/system/ShellCommandTool/ShellCommandTool.js.map +1 -1
- package/dist/tools/system/ShellTool/ShellTool.d.ts.map +1 -1
- package/dist/tools/system/ShellTool/ShellTool.js +25 -11
- package/dist/tools/system/ShellTool/ShellTool.js.map +1 -1
- package/dist/tools/system/ShellTool/command-policy.d.ts +11 -8
- package/dist/tools/system/ShellTool/command-policy.d.ts.map +1 -1
- package/dist/tools/system/ShellTool/command-policy.js +402 -98
- package/dist/tools/system/ShellTool/command-policy.js.map +1 -1
- package/dist/tools/system/TestRunnerTool/TestRunnerTool.d.ts +1 -1
- package/dist/tools/system/TestRunnerTool/TestRunnerTool.d.ts.map +1 -1
- package/dist/tools/system/TestRunnerTool/TestRunnerTool.js +153 -9
- package/dist/tools/system/TestRunnerTool/TestRunnerTool.js.map +1 -1
- package/dist/tools/system/UpdatePlanTool/UpdatePlanTool.js +1 -1
- package/dist/tools/system/UpdatePlanTool/UpdatePlanTool.js.map +1 -1
- package/dist/tools/types.d.ts +34 -12
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/tools/types.js +26 -3
- package/dist/tools/types.js.map +1 -1
- package/dist/tools/workspace-scope.d.ts +11 -0
- package/dist/tools/workspace-scope.d.ts.map +1 -0
- package/dist/tools/workspace-scope.js +77 -0
- package/dist/tools/workspace-scope.js.map +1 -0
- package/package.json +1 -1
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// Persists via StateManager.writeRaw (persist-before-execute principle).
|
|
5
5
|
import { z } from "zod";
|
|
6
6
|
import { RuntimeReplyTargetSchema } from "../../runtime/session-registry/types.js";
|
|
7
|
-
import { redactSetupSecrets, SetupSecretIntakeItemSchema } from "./setup-secret-intake.js";
|
|
7
|
+
import { redactSetupSecrets, redactSetupSecretsDeep, SetupSecretIntakeItemSchema } from "./setup-secret-intake.js";
|
|
8
8
|
import { SetupDialoguePublicStateSchema } from "./setup-dialogue.js";
|
|
9
9
|
import { RunSpecSchema } from "../../runtime/run-spec/index.js";
|
|
10
10
|
// ─── Schemas ───
|
|
@@ -35,6 +35,77 @@ export const ChatSessionUsageSchema = z.object({
|
|
|
35
35
|
byPhase: z.record(ChatUsageCounterSchema).default({}),
|
|
36
36
|
updatedAt: z.string().optional(),
|
|
37
37
|
}).passthrough();
|
|
38
|
+
export const ChatTurnContextSnapshotSchema = z.object({
|
|
39
|
+
schema_version: z.string(),
|
|
40
|
+
modelVisible: z.unknown(),
|
|
41
|
+
}).passthrough();
|
|
42
|
+
export const ChatRolloutJournalRecordKindSchema = z.enum([
|
|
43
|
+
"user_input",
|
|
44
|
+
"turn_context",
|
|
45
|
+
"model_output",
|
|
46
|
+
"tool_call",
|
|
47
|
+
"tool_result",
|
|
48
|
+
"permission_decision",
|
|
49
|
+
"display_event",
|
|
50
|
+
"completion_state",
|
|
51
|
+
]);
|
|
52
|
+
export const ChatRolloutJournalRecordSchema = z.object({
|
|
53
|
+
schema_version: z.literal("chat-rollout-journal-record-v1"),
|
|
54
|
+
id: z.string(),
|
|
55
|
+
sessionId: z.string(),
|
|
56
|
+
runId: z.string().nullable(),
|
|
57
|
+
turnId: z.string().nullable(),
|
|
58
|
+
sequence: z.number().int().nonnegative(),
|
|
59
|
+
createdAt: z.string(),
|
|
60
|
+
kind: ChatRolloutJournalRecordKindSchema,
|
|
61
|
+
source: z.enum(["chat_history", "chat_event", "agent_timeline", "approval_store"]).default("chat_history"),
|
|
62
|
+
visibility: z.enum(["model_visible", "display", "debug", "host_only"]),
|
|
63
|
+
payload: z.unknown(),
|
|
64
|
+
}).passthrough();
|
|
65
|
+
export const CHAT_COMPACTION_RECORD_SCHEMA_VERSION = "chat-compaction-record-v1";
|
|
66
|
+
export const ChatCompactionRecordSchema = z.object({
|
|
67
|
+
schema_version: z.literal(CHAT_COMPACTION_RECORD_SCHEMA_VERSION),
|
|
68
|
+
id: z.string(),
|
|
69
|
+
sessionId: z.string(),
|
|
70
|
+
sequence: z.number().int().nonnegative(),
|
|
71
|
+
createdAt: z.string(),
|
|
72
|
+
reason: z.enum(["manual_command", "auto_context_limit"]).default("manual_command"),
|
|
73
|
+
inputMessageCount: z.number().int().nonnegative(),
|
|
74
|
+
outputMessageCount: z.number().int().nonnegative(),
|
|
75
|
+
removedMessageCount: z.number().int().nonnegative(),
|
|
76
|
+
retainedMessageCount: z.number().int().nonnegative(),
|
|
77
|
+
summary: z.string(),
|
|
78
|
+
modelVisibleSummary: z.string(),
|
|
79
|
+
archivedUserMessages: z.array(ChatMessageSchema),
|
|
80
|
+
archivedAssistantMessages: z.array(ChatMessageSchema),
|
|
81
|
+
retainedMessages: z.array(ChatMessageSchema),
|
|
82
|
+
pendingPermissions: z.array(z.object({
|
|
83
|
+
sequence: z.number().int().nonnegative(),
|
|
84
|
+
source: z.string(),
|
|
85
|
+
status: z.enum(["requested", "resolved", "unknown"]),
|
|
86
|
+
invalidatedByCompaction: z.boolean(),
|
|
87
|
+
payload: z.unknown(),
|
|
88
|
+
}).passthrough()),
|
|
89
|
+
decisions: z.array(z.object({
|
|
90
|
+
sequence: z.number().int().nonnegative(),
|
|
91
|
+
kind: ChatRolloutJournalRecordKindSchema,
|
|
92
|
+
source: z.string(),
|
|
93
|
+
visibility: z.string(),
|
|
94
|
+
payload: z.unknown(),
|
|
95
|
+
}).passthrough()),
|
|
96
|
+
activeTargets: z.array(z.object({
|
|
97
|
+
source: z.string(),
|
|
98
|
+
state: z.enum(["retained", "session"]),
|
|
99
|
+
payload: z.unknown(),
|
|
100
|
+
}).passthrough()),
|
|
101
|
+
replacementHistory: z.object({
|
|
102
|
+
removedTurnIndexes: z.array(z.number().int().nonnegative()),
|
|
103
|
+
retainedOriginalTurnIndexes: z.array(z.number().int().nonnegative()),
|
|
104
|
+
rewrittenTurnIndexes: z.array(z.number().int().nonnegative()),
|
|
105
|
+
rolloutJournalSequences: z.array(z.number().int().nonnegative()),
|
|
106
|
+
turnContextCount: z.number().int().nonnegative(),
|
|
107
|
+
}).passthrough(),
|
|
108
|
+
}).passthrough();
|
|
38
109
|
export const RunSpecConfirmationStateSchema = z.object({
|
|
39
110
|
state: z.enum(["pending", "confirmed", "cancelled"]),
|
|
40
111
|
spec: RunSpecSchema,
|
|
@@ -73,11 +144,14 @@ export const ChatSessionSchema = z.object({
|
|
|
73
144
|
runSpecConfirmation: RunSpecConfirmationStateSchema.nullable().optional(),
|
|
74
145
|
messages: z.array(ChatMessageSchema),
|
|
75
146
|
compactionSummary: z.string().optional(),
|
|
147
|
+
compactionRecords: z.array(ChatCompactionRecordSchema).optional(),
|
|
76
148
|
agentLoopStatePath: z.string().nullable().optional(),
|
|
77
149
|
agentLoopStatus: z.enum(["running", "completed", "failed"]).nullable().optional(),
|
|
78
150
|
agentLoopResumable: z.boolean().nullable().optional(),
|
|
79
151
|
agentLoopUpdatedAt: z.string().nullable().optional(),
|
|
80
152
|
agentLoop: ChatSessionAgentLoopMetadataSchema.optional(),
|
|
153
|
+
turnContexts: z.array(ChatTurnContextSnapshotSchema).optional(),
|
|
154
|
+
rolloutJournal: z.array(ChatRolloutJournalRecordSchema).optional(),
|
|
81
155
|
usage: ChatSessionUsageSchema.optional(),
|
|
82
156
|
}).passthrough();
|
|
83
157
|
// ─── ChatHistory ───
|
|
@@ -95,6 +169,9 @@ export class ChatHistory {
|
|
|
95
169
|
cwd: existingSession.cwd,
|
|
96
170
|
updatedAt: existingSession.updatedAt ?? existingSession.createdAt,
|
|
97
171
|
messages: [...existingSession.messages],
|
|
172
|
+
...(existingSession.compactionRecords ? { compactionRecords: cloneCompactionRecords(existingSession.compactionRecords) } : {}),
|
|
173
|
+
...(existingSession.turnContexts ? { turnContexts: [...existingSession.turnContexts] } : {}),
|
|
174
|
+
...(existingSession.rolloutJournal ? { rolloutJournal: [...existingSession.rolloutJournal] } : {}),
|
|
98
175
|
...(existingSession.usage ? { usage: cloneUsage(existingSession.usage) } : {}),
|
|
99
176
|
};
|
|
100
177
|
}
|
|
@@ -114,24 +191,53 @@ export class ChatHistory {
|
|
|
114
191
|
}
|
|
115
192
|
/** Append a user message and persist to disk BEFORE adapter execution. */
|
|
116
193
|
async appendUserMessage(content, options = {}) {
|
|
194
|
+
const turnIndex = this.session.messages.length;
|
|
117
195
|
this.session.messages.push({
|
|
118
196
|
role: "user",
|
|
119
197
|
content,
|
|
120
198
|
timestamp: new Date().toISOString(),
|
|
121
|
-
turnIndex
|
|
199
|
+
turnIndex,
|
|
122
200
|
...(options.setupSecretIntake && options.setupSecretIntake.length > 0
|
|
123
201
|
? { setupSecretIntake: options.setupSecretIntake }
|
|
124
202
|
: {}),
|
|
125
203
|
});
|
|
204
|
+
this.pushRolloutRecord({
|
|
205
|
+
kind: "user_input",
|
|
206
|
+
source: "chat_history",
|
|
207
|
+
visibility: "model_visible",
|
|
208
|
+
eventContext: options.eventContext,
|
|
209
|
+
payload: {
|
|
210
|
+
role: "user",
|
|
211
|
+
content,
|
|
212
|
+
turnIndex,
|
|
213
|
+
...(options.userInput ? { userInput: toReplayableUserInput(options.userInput) } : {}),
|
|
214
|
+
...(options.setupSecretIntake && options.setupSecretIntake.length > 0
|
|
215
|
+
? { setupSecretIntake: options.setupSecretIntake }
|
|
216
|
+
: {}),
|
|
217
|
+
},
|
|
218
|
+
});
|
|
126
219
|
await this.persist();
|
|
127
220
|
}
|
|
128
221
|
/** Append an assistant message and persist it as the committed assistant turn. */
|
|
129
|
-
async appendAssistantMessage(content) {
|
|
222
|
+
async appendAssistantMessage(content, options = {}) {
|
|
223
|
+
const safeContent = redactSetupSecrets(content);
|
|
224
|
+
const turnIndex = this.session.messages.length;
|
|
130
225
|
this.session.messages.push({
|
|
131
226
|
role: "assistant",
|
|
132
|
-
content:
|
|
227
|
+
content: safeContent,
|
|
133
228
|
timestamp: new Date().toISOString(),
|
|
134
|
-
turnIndex
|
|
229
|
+
turnIndex,
|
|
230
|
+
});
|
|
231
|
+
this.pushRolloutRecord({
|
|
232
|
+
kind: "model_output",
|
|
233
|
+
source: "chat_history",
|
|
234
|
+
visibility: "model_visible",
|
|
235
|
+
eventContext: options.eventContext,
|
|
236
|
+
payload: {
|
|
237
|
+
role: "assistant",
|
|
238
|
+
content: safeContent,
|
|
239
|
+
turnIndex,
|
|
240
|
+
},
|
|
135
241
|
});
|
|
136
242
|
await this.persist();
|
|
137
243
|
}
|
|
@@ -139,18 +245,28 @@ export class ChatHistory {
|
|
|
139
245
|
async clear() {
|
|
140
246
|
this.session.messages = [];
|
|
141
247
|
delete this.session.compactionSummary;
|
|
248
|
+
delete this.session.compactionRecords;
|
|
249
|
+
this.replaceModelVisibleJournalFromMessages("clear");
|
|
142
250
|
await this.persist();
|
|
143
251
|
}
|
|
144
252
|
/** Persist a compacted summary and keep only the latest turns in message history. */
|
|
145
253
|
async compact(summary, keepMessageCount = 4) {
|
|
146
254
|
const before = this.session.messages.length;
|
|
147
255
|
const keepCount = Math.max(0, keepMessageCount);
|
|
256
|
+
const originalMessages = [...this.session.messages];
|
|
148
257
|
const kept = keepCount === 0 ? [] : this.session.messages.slice(-keepCount);
|
|
258
|
+
const removed = keepCount === 0 ? originalMessages : originalMessages.slice(0, -keepCount);
|
|
259
|
+
const record = this.buildCompactionRecord(summary, originalMessages, removed, kept);
|
|
149
260
|
this.session.messages = kept.map((message, index) => ({
|
|
150
261
|
...message,
|
|
151
262
|
turnIndex: index,
|
|
152
263
|
}));
|
|
153
264
|
this.session.compactionSummary = summary;
|
|
265
|
+
this.session.compactionRecords = [
|
|
266
|
+
...(this.session.compactionRecords ?? []),
|
|
267
|
+
record,
|
|
268
|
+
].slice(-50);
|
|
269
|
+
this.replaceModelVisibleJournalFromMessages("compact");
|
|
154
270
|
await this.persist();
|
|
155
271
|
return { before, after: this.session.messages.length };
|
|
156
272
|
}
|
|
@@ -170,16 +286,23 @@ export class ChatHistory {
|
|
|
170
286
|
...message,
|
|
171
287
|
turnIndex: index,
|
|
172
288
|
}));
|
|
289
|
+
this.replaceModelVisibleJournalFromMessages("remove_last_turn");
|
|
173
290
|
await this.persist();
|
|
174
291
|
return removed;
|
|
175
292
|
}
|
|
176
293
|
getMessages() {
|
|
177
294
|
return [...this.session.messages];
|
|
178
295
|
}
|
|
296
|
+
getModelVisibleMessages() {
|
|
297
|
+
return reconstructModelVisibleMessagesFromRolloutJournal(this.session.rolloutJournal) ?? this.getMessages();
|
|
298
|
+
}
|
|
179
299
|
getSessionData() {
|
|
180
300
|
return {
|
|
181
301
|
...this.session,
|
|
182
302
|
messages: [...this.session.messages],
|
|
303
|
+
...(this.session.compactionRecords ? { compactionRecords: cloneCompactionRecords(this.session.compactionRecords) } : {}),
|
|
304
|
+
...(this.session.turnContexts ? { turnContexts: [...this.session.turnContexts] } : {}),
|
|
305
|
+
...(this.session.rolloutJournal ? { rolloutJournal: [...this.session.rolloutJournal] } : {}),
|
|
183
306
|
...(this.session.usage ? { usage: cloneUsage(this.session.usage) } : {}),
|
|
184
307
|
};
|
|
185
308
|
}
|
|
@@ -232,6 +355,34 @@ export class ChatHistory {
|
|
|
232
355
|
delete this.session.runSpecConfirmation;
|
|
233
356
|
}
|
|
234
357
|
}
|
|
358
|
+
async recordTurnContext(snapshot) {
|
|
359
|
+
this.session.turnContexts = [
|
|
360
|
+
...(this.session.turnContexts ?? []),
|
|
361
|
+
snapshot,
|
|
362
|
+
].slice(-20);
|
|
363
|
+
this.pushRolloutRecord({
|
|
364
|
+
kind: "turn_context",
|
|
365
|
+
source: "chat_history",
|
|
366
|
+
visibility: "model_visible",
|
|
367
|
+
eventContext: extractTurnContextEventContext(snapshot),
|
|
368
|
+
payload: snapshot,
|
|
369
|
+
});
|
|
370
|
+
await this.persist();
|
|
371
|
+
}
|
|
372
|
+
async recordChatEvent(event, options = {}) {
|
|
373
|
+
const projection = rolloutProjectionFromChatEvent(event);
|
|
374
|
+
this.pushRolloutRecord({
|
|
375
|
+
kind: projection.kind,
|
|
376
|
+
source: projection.source,
|
|
377
|
+
visibility: projection.visibility,
|
|
378
|
+
eventContext: event,
|
|
379
|
+
createdAt: event.createdAt,
|
|
380
|
+
payload: projection.payload,
|
|
381
|
+
});
|
|
382
|
+
if (options.persist !== false) {
|
|
383
|
+
await this.persist();
|
|
384
|
+
}
|
|
385
|
+
}
|
|
235
386
|
setSessionLifecycle(input) {
|
|
236
387
|
if (input.status !== undefined) {
|
|
237
388
|
if (input.status)
|
|
@@ -355,6 +506,374 @@ export class ChatHistory {
|
|
|
355
506
|
this.session.updatedAt = new Date().toISOString();
|
|
356
507
|
await this.stateManager.writeRaw(`chat/sessions/${this.sessionId}.json`, this.session);
|
|
357
508
|
}
|
|
509
|
+
pushRolloutRecord(input) {
|
|
510
|
+
const current = this.session.rolloutJournal ?? [];
|
|
511
|
+
const sequence = nextRolloutSequence(current);
|
|
512
|
+
const runId = typeof input.eventContext?.runId === "string" ? input.eventContext.runId : null;
|
|
513
|
+
const turnId = typeof input.eventContext?.turnId === "string" ? input.eventContext.turnId : null;
|
|
514
|
+
const record = ChatRolloutJournalRecordSchema.parse({
|
|
515
|
+
schema_version: "chat-rollout-journal-record-v1",
|
|
516
|
+
id: `${this.sessionId}:${sequence}`,
|
|
517
|
+
sessionId: this.sessionId,
|
|
518
|
+
runId,
|
|
519
|
+
turnId,
|
|
520
|
+
sequence,
|
|
521
|
+
createdAt: input.createdAt ?? new Date().toISOString(),
|
|
522
|
+
kind: input.kind,
|
|
523
|
+
source: input.source,
|
|
524
|
+
visibility: input.visibility,
|
|
525
|
+
payload: redactSetupSecretsDeep(input.payload),
|
|
526
|
+
});
|
|
527
|
+
this.session.rolloutJournal = [...current, record].slice(-500);
|
|
528
|
+
}
|
|
529
|
+
replaceModelVisibleJournalFromMessages(reason) {
|
|
530
|
+
const demoted = (this.session.rolloutJournal ?? []).map((record) => record.source === "chat_history"
|
|
531
|
+
&& record.visibility === "model_visible"
|
|
532
|
+
&& (record.kind === "user_input" || record.kind === "model_output")
|
|
533
|
+
? {
|
|
534
|
+
...record,
|
|
535
|
+
visibility: "debug",
|
|
536
|
+
payload: {
|
|
537
|
+
...(isRecord(record.payload) ? record.payload : {}),
|
|
538
|
+
modelVisibleUntil: reason,
|
|
539
|
+
},
|
|
540
|
+
}
|
|
541
|
+
: record);
|
|
542
|
+
this.session.rolloutJournal = demoted;
|
|
543
|
+
for (const message of this.session.messages) {
|
|
544
|
+
this.pushRolloutRecord({
|
|
545
|
+
kind: message.role === "assistant" ? "model_output" : "user_input",
|
|
546
|
+
source: "chat_history",
|
|
547
|
+
visibility: "model_visible",
|
|
548
|
+
payload: {
|
|
549
|
+
role: message.role,
|
|
550
|
+
content: message.content,
|
|
551
|
+
turnIndex: message.turnIndex,
|
|
552
|
+
historyMutation: reason,
|
|
553
|
+
...(message.setupSecretIntake && message.setupSecretIntake.length > 0
|
|
554
|
+
? { setupSecretIntake: message.setupSecretIntake }
|
|
555
|
+
: {}),
|
|
556
|
+
},
|
|
557
|
+
});
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
buildCompactionRecord(summary, originalMessages, removed, retained) {
|
|
561
|
+
const current = this.session.compactionRecords ?? [];
|
|
562
|
+
const sequence = nextCompactionSequence(current);
|
|
563
|
+
const rewrittenTurnIndexes = retained.map((_message, index) => index);
|
|
564
|
+
const rolloutJournal = this.session.rolloutJournal ?? [];
|
|
565
|
+
const record = ChatCompactionRecordSchema.parse({
|
|
566
|
+
schema_version: CHAT_COMPACTION_RECORD_SCHEMA_VERSION,
|
|
567
|
+
id: `${this.sessionId}:compaction:${sequence}`,
|
|
568
|
+
sessionId: this.sessionId,
|
|
569
|
+
sequence,
|
|
570
|
+
createdAt: new Date().toISOString(),
|
|
571
|
+
reason: "manual_command",
|
|
572
|
+
inputMessageCount: originalMessages.length,
|
|
573
|
+
outputMessageCount: retained.length,
|
|
574
|
+
removedMessageCount: removed.length,
|
|
575
|
+
retainedMessageCount: retained.length,
|
|
576
|
+
summary,
|
|
577
|
+
modelVisibleSummary: summary,
|
|
578
|
+
archivedUserMessages: removed.filter((message) => message.role === "user"),
|
|
579
|
+
archivedAssistantMessages: removed.filter((message) => message.role === "assistant"),
|
|
580
|
+
retainedMessages: retained,
|
|
581
|
+
pendingPermissions: collectPendingPermissionRecords(rolloutJournal),
|
|
582
|
+
decisions: collectDecisionRecords(rolloutJournal),
|
|
583
|
+
activeTargets: collectActiveTargets(this.session, retained),
|
|
584
|
+
replacementHistory: {
|
|
585
|
+
removedTurnIndexes: removed.map((message) => message.turnIndex),
|
|
586
|
+
retainedOriginalTurnIndexes: retained.map((message) => message.turnIndex),
|
|
587
|
+
rewrittenTurnIndexes,
|
|
588
|
+
rolloutJournalSequences: rolloutJournal.map((record) => record.sequence),
|
|
589
|
+
turnContextCount: this.session.turnContexts?.length ?? 0,
|
|
590
|
+
},
|
|
591
|
+
});
|
|
592
|
+
return record;
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
export function reconstructModelVisibleMessagesFromRolloutJournal(records) {
|
|
596
|
+
const modelRecords = (records ?? [])
|
|
597
|
+
.filter((record) => record.source === "chat_history"
|
|
598
|
+
&& record.visibility === "model_visible"
|
|
599
|
+
&& (record.kind === "user_input" || record.kind === "model_output"))
|
|
600
|
+
.sort((left, right) => left.sequence - right.sequence);
|
|
601
|
+
if (modelRecords.length === 0)
|
|
602
|
+
return null;
|
|
603
|
+
return modelRecords.flatMap((record, index) => {
|
|
604
|
+
const payload = isRecord(record.payload) ? record.payload : {};
|
|
605
|
+
const role = payload["role"] === "assistant" ? "assistant" : payload["role"] === "user" ? "user" : null;
|
|
606
|
+
const content = typeof payload["content"] === "string" ? payload["content"] : null;
|
|
607
|
+
if (!role || content === null)
|
|
608
|
+
return [];
|
|
609
|
+
const setupSecretIntake = Array.isArray(payload["setupSecretIntake"])
|
|
610
|
+
? { setupSecretIntake: payload["setupSecretIntake"] }
|
|
611
|
+
: {};
|
|
612
|
+
return [{
|
|
613
|
+
role,
|
|
614
|
+
content,
|
|
615
|
+
timestamp: record.createdAt,
|
|
616
|
+
turnIndex: index,
|
|
617
|
+
...setupSecretIntake,
|
|
618
|
+
}];
|
|
619
|
+
});
|
|
620
|
+
}
|
|
621
|
+
function nextRolloutSequence(records) {
|
|
622
|
+
return records.reduce((max, record) => Math.max(max, record.sequence), -1) + 1;
|
|
623
|
+
}
|
|
624
|
+
function nextCompactionSequence(records) {
|
|
625
|
+
return records.reduce((max, record) => Math.max(max, record.sequence), -1) + 1;
|
|
626
|
+
}
|
|
627
|
+
function cloneCompactionRecords(records) {
|
|
628
|
+
return records.map((record) => ChatCompactionRecordSchema.parse(cloneJson(record)));
|
|
629
|
+
}
|
|
630
|
+
function collectPendingPermissionRecords(records) {
|
|
631
|
+
return records.flatMap((record) => {
|
|
632
|
+
if (record.kind !== "permission_decision")
|
|
633
|
+
return [];
|
|
634
|
+
const payload = isRecord(record.payload) ? record.payload : {};
|
|
635
|
+
const status = permissionStatus(payload);
|
|
636
|
+
return [{
|
|
637
|
+
sequence: record.sequence,
|
|
638
|
+
source: record.source,
|
|
639
|
+
status,
|
|
640
|
+
invalidatedByCompaction: status === "requested",
|
|
641
|
+
payload: cloneJson(record.payload),
|
|
642
|
+
}];
|
|
643
|
+
});
|
|
644
|
+
}
|
|
645
|
+
function collectDecisionRecords(records) {
|
|
646
|
+
return records.flatMap((record) => {
|
|
647
|
+
if (record.kind !== "turn_context"
|
|
648
|
+
&& record.kind !== "permission_decision"
|
|
649
|
+
&& record.kind !== "completion_state") {
|
|
650
|
+
return [];
|
|
651
|
+
}
|
|
652
|
+
return [{
|
|
653
|
+
sequence: record.sequence,
|
|
654
|
+
kind: record.kind,
|
|
655
|
+
source: record.source,
|
|
656
|
+
visibility: record.visibility,
|
|
657
|
+
payload: cloneJson(record.payload),
|
|
658
|
+
}];
|
|
659
|
+
});
|
|
660
|
+
}
|
|
661
|
+
function collectActiveTargets(session, retainedMessages) {
|
|
662
|
+
const targets = [{
|
|
663
|
+
source: "retained_messages",
|
|
664
|
+
state: "retained",
|
|
665
|
+
payload: retainedMessages.map((message) => ({
|
|
666
|
+
role: message.role,
|
|
667
|
+
turnIndex: message.turnIndex,
|
|
668
|
+
timestamp: message.timestamp,
|
|
669
|
+
})),
|
|
670
|
+
}];
|
|
671
|
+
if (session.notificationReplyTarget) {
|
|
672
|
+
targets.push({
|
|
673
|
+
source: "notification_reply_target",
|
|
674
|
+
state: "session",
|
|
675
|
+
payload: cloneJson(session.notificationReplyTarget),
|
|
676
|
+
});
|
|
677
|
+
}
|
|
678
|
+
if (session.agentLoopStatePath || session.agentLoop) {
|
|
679
|
+
targets.push({
|
|
680
|
+
source: "agent_loop",
|
|
681
|
+
state: "session",
|
|
682
|
+
payload: {
|
|
683
|
+
statePath: session.agentLoopStatePath ?? session.agentLoop?.statePath ?? null,
|
|
684
|
+
status: session.agentLoopStatus ?? session.agentLoop?.status ?? null,
|
|
685
|
+
resumable: session.agentLoopResumable ?? session.agentLoop?.resumable ?? null,
|
|
686
|
+
updatedAt: session.agentLoopUpdatedAt ?? session.agentLoop?.updatedAt ?? null,
|
|
687
|
+
},
|
|
688
|
+
});
|
|
689
|
+
}
|
|
690
|
+
if (session.runSpecConfirmation?.state === "pending") {
|
|
691
|
+
targets.push({
|
|
692
|
+
source: "run_spec_confirmation",
|
|
693
|
+
state: "session",
|
|
694
|
+
payload: {
|
|
695
|
+
state: session.runSpecConfirmation.state,
|
|
696
|
+
specId: session.runSpecConfirmation.spec.id,
|
|
697
|
+
createdAt: session.runSpecConfirmation.createdAt,
|
|
698
|
+
updatedAt: session.runSpecConfirmation.updatedAt,
|
|
699
|
+
},
|
|
700
|
+
});
|
|
701
|
+
}
|
|
702
|
+
if (session.setupDialogue) {
|
|
703
|
+
targets.push({
|
|
704
|
+
source: "setup_dialogue",
|
|
705
|
+
state: "session",
|
|
706
|
+
payload: {
|
|
707
|
+
id: session.setupDialogue.id,
|
|
708
|
+
channel: session.setupDialogue.selectedChannel,
|
|
709
|
+
state: session.setupDialogue.state,
|
|
710
|
+
updatedAt: session.setupDialogue.updatedAt,
|
|
711
|
+
},
|
|
712
|
+
});
|
|
713
|
+
}
|
|
714
|
+
return targets;
|
|
715
|
+
}
|
|
716
|
+
function permissionStatus(payload) {
|
|
717
|
+
if (payload["state"] === "requested")
|
|
718
|
+
return "requested";
|
|
719
|
+
if (payload["state"] === "approved" || payload["state"] === "denied" || payload["state"] === "resolved") {
|
|
720
|
+
return "resolved";
|
|
721
|
+
}
|
|
722
|
+
const item = isRecord(payload["item"]) ? payload["item"] : null;
|
|
723
|
+
if (item?.["status"] === "requested" || item?.["status"] === "awaiting_approval")
|
|
724
|
+
return "requested";
|
|
725
|
+
if (item?.["status"] === "approved" || item?.["status"] === "denied")
|
|
726
|
+
return "resolved";
|
|
727
|
+
return "unknown";
|
|
728
|
+
}
|
|
729
|
+
function extractTurnContextEventContext(snapshot) {
|
|
730
|
+
const modelVisible = isRecord(snapshot.modelVisible) ? snapshot.modelVisible : null;
|
|
731
|
+
const turn = modelVisible && isRecord(modelVisible["turn"]) ? modelVisible["turn"] : null;
|
|
732
|
+
const runId = typeof turn?.["runId"] === "string" ? turn["runId"] : undefined;
|
|
733
|
+
const turnId = typeof turn?.["turnId"] === "string" ? turn["turnId"] : undefined;
|
|
734
|
+
return runId && turnId ? { runId, turnId } : undefined;
|
|
735
|
+
}
|
|
736
|
+
function toReplayableUserInput(input) {
|
|
737
|
+
return {
|
|
738
|
+
schema_version: input.schema_version,
|
|
739
|
+
...(input.rawText !== undefined ? { rawText: input.rawText } : {}),
|
|
740
|
+
items: input.items.map((item) => {
|
|
741
|
+
switch (item.kind) {
|
|
742
|
+
case "text":
|
|
743
|
+
return { kind: "text", text: item.text };
|
|
744
|
+
case "image":
|
|
745
|
+
case "local_image":
|
|
746
|
+
return {
|
|
747
|
+
kind: item.kind,
|
|
748
|
+
...(item.name ? { name: item.name } : {}),
|
|
749
|
+
};
|
|
750
|
+
case "mention":
|
|
751
|
+
return {
|
|
752
|
+
kind: "mention",
|
|
753
|
+
...(item.label ? { label: item.label } : {}),
|
|
754
|
+
};
|
|
755
|
+
case "skill":
|
|
756
|
+
case "plugin":
|
|
757
|
+
case "tool":
|
|
758
|
+
return { kind: item.kind, name: item.name };
|
|
759
|
+
case "attachment":
|
|
760
|
+
return {
|
|
761
|
+
kind: "attachment",
|
|
762
|
+
id: item.id,
|
|
763
|
+
...(item.name ? { name: item.name } : {}),
|
|
764
|
+
...(item.mimeType ? { mimeType: item.mimeType } : {}),
|
|
765
|
+
};
|
|
766
|
+
}
|
|
767
|
+
}),
|
|
768
|
+
};
|
|
769
|
+
}
|
|
770
|
+
function rolloutProjectionFromChatEvent(event) {
|
|
771
|
+
if (event.type === "tool_start") {
|
|
772
|
+
return {
|
|
773
|
+
kind: "tool_call",
|
|
774
|
+
source: "chat_event",
|
|
775
|
+
visibility: "debug",
|
|
776
|
+
payload: { event },
|
|
777
|
+
};
|
|
778
|
+
}
|
|
779
|
+
if (event.type === "tool_end") {
|
|
780
|
+
return {
|
|
781
|
+
kind: "tool_result",
|
|
782
|
+
source: "chat_event",
|
|
783
|
+
visibility: "debug",
|
|
784
|
+
payload: { event },
|
|
785
|
+
};
|
|
786
|
+
}
|
|
787
|
+
if (event.type === "tool_update" && event.status === "awaiting_approval") {
|
|
788
|
+
return {
|
|
789
|
+
kind: "permission_decision",
|
|
790
|
+
source: "chat_event",
|
|
791
|
+
visibility: "host_only",
|
|
792
|
+
payload: { state: "requested", event },
|
|
793
|
+
};
|
|
794
|
+
}
|
|
795
|
+
if (event.type === "agent_timeline") {
|
|
796
|
+
return rolloutProjectionFromAgentTimelineEvent(event);
|
|
797
|
+
}
|
|
798
|
+
if (event.type === "assistant_final") {
|
|
799
|
+
return {
|
|
800
|
+
kind: "model_output",
|
|
801
|
+
source: "chat_event",
|
|
802
|
+
visibility: "model_visible",
|
|
803
|
+
payload: {
|
|
804
|
+
role: "assistant",
|
|
805
|
+
content: event.text,
|
|
806
|
+
persisted: event.persisted,
|
|
807
|
+
event,
|
|
808
|
+
},
|
|
809
|
+
};
|
|
810
|
+
}
|
|
811
|
+
if (event.type === "lifecycle_end" || event.type === "lifecycle_error") {
|
|
812
|
+
return {
|
|
813
|
+
kind: "completion_state",
|
|
814
|
+
source: "chat_event",
|
|
815
|
+
visibility: "debug",
|
|
816
|
+
payload: { event },
|
|
817
|
+
};
|
|
818
|
+
}
|
|
819
|
+
return {
|
|
820
|
+
kind: "display_event",
|
|
821
|
+
source: "chat_event",
|
|
822
|
+
visibility: "display",
|
|
823
|
+
payload: { event },
|
|
824
|
+
};
|
|
825
|
+
}
|
|
826
|
+
function rolloutProjectionFromAgentTimelineEvent(event) {
|
|
827
|
+
const item = event.item;
|
|
828
|
+
if (item.kind === "model_request" || item.kind === "assistant_message") {
|
|
829
|
+
return {
|
|
830
|
+
kind: "model_output",
|
|
831
|
+
source: "agent_timeline",
|
|
832
|
+
visibility: item.visibility === "debug" ? "debug" : "model_visible",
|
|
833
|
+
payload: { item },
|
|
834
|
+
};
|
|
835
|
+
}
|
|
836
|
+
if (item.kind === "tool" && item.status === "started") {
|
|
837
|
+
return {
|
|
838
|
+
kind: "tool_call",
|
|
839
|
+
source: "agent_timeline",
|
|
840
|
+
visibility: "debug",
|
|
841
|
+
payload: { item },
|
|
842
|
+
};
|
|
843
|
+
}
|
|
844
|
+
if (item.kind === "tool" || item.kind === "tool_observation") {
|
|
845
|
+
return {
|
|
846
|
+
kind: "tool_result",
|
|
847
|
+
source: "agent_timeline",
|
|
848
|
+
visibility: item.visibility === "debug" ? "debug" : "display",
|
|
849
|
+
payload: { item },
|
|
850
|
+
};
|
|
851
|
+
}
|
|
852
|
+
if (item.kind === "approval") {
|
|
853
|
+
return {
|
|
854
|
+
kind: "permission_decision",
|
|
855
|
+
source: "agent_timeline",
|
|
856
|
+
visibility: "host_only",
|
|
857
|
+
payload: { item },
|
|
858
|
+
};
|
|
859
|
+
}
|
|
860
|
+
if (item.kind === "final" || item.kind === "stopped") {
|
|
861
|
+
return {
|
|
862
|
+
kind: "completion_state",
|
|
863
|
+
source: "agent_timeline",
|
|
864
|
+
visibility: "debug",
|
|
865
|
+
payload: { item },
|
|
866
|
+
};
|
|
867
|
+
}
|
|
868
|
+
return {
|
|
869
|
+
kind: "display_event",
|
|
870
|
+
source: "agent_timeline",
|
|
871
|
+
visibility: item.visibility === "debug" ? "debug" : "display",
|
|
872
|
+
payload: { item },
|
|
873
|
+
};
|
|
874
|
+
}
|
|
875
|
+
function isRecord(value) {
|
|
876
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
358
877
|
}
|
|
359
878
|
function normalizeUsageCounter(usage) {
|
|
360
879
|
const inputTokens = Number.isFinite(usage.inputTokens) ? Math.max(0, Math.floor(usage.inputTokens)) : 0;
|
|
@@ -383,4 +902,9 @@ function cloneUsage(usage) {
|
|
|
383
902
|
...(usage.updatedAt ? { updatedAt: usage.updatedAt } : {}),
|
|
384
903
|
};
|
|
385
904
|
}
|
|
905
|
+
function cloneJson(value) {
|
|
906
|
+
if (value === undefined)
|
|
907
|
+
return value;
|
|
908
|
+
return JSON.parse(JSON.stringify(value));
|
|
909
|
+
}
|
|
386
910
|
//# sourceMappingURL=chat-history.js.map
|