@gajae-code/coding-agent 0.13.3 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +184 -2
- package/README.md +2 -0
- package/bin/gajaessi.js +4 -0
- package/dist/types/async/job-manager.d.ts +55 -2
- package/dist/types/async/support.d.ts +14 -0
- package/dist/types/capability/mcp.d.ts +6 -0
- package/dist/types/capability/types.d.ts +6 -0
- package/dist/types/cli/accounts-cli.d.ts +19 -0
- package/dist/types/cli/args.d.ts +3 -0
- package/dist/types/cli/config-cli.d.ts +6 -0
- package/dist/types/cli/crash-cli.d.ts +10 -0
- package/dist/types/cli/customize-doctor.d.ts +145 -0
- package/dist/types/cli/daemon-cli.d.ts +3 -1
- package/dist/types/cli/mcp-cli.d.ts +11 -0
- package/dist/types/cli/notify-cli.d.ts +1 -1
- package/dist/types/cli/root-flags.d.ts +12 -0
- package/dist/types/cli/setup-cli.d.ts +3 -1
- package/dist/types/cli/skills-cli.d.ts +2 -1
- package/dist/types/cli/update-cli.d.ts +19 -1
- package/dist/types/cli.d.ts +6 -0
- package/dist/types/commands/accounts.d.ts +40 -0
- package/dist/types/commands/crash.d.ts +24 -0
- package/dist/types/commands/customize.d.ts +22 -0
- package/dist/types/commands/daemon.d.ts +1 -1
- package/dist/types/commands/launch.d.ts +6 -0
- package/dist/types/commands/setup.d.ts +6 -0
- package/dist/types/commands/skills.d.ts +6 -1
- package/dist/types/commands/update.d.ts +7 -0
- package/dist/types/config/atomic-yaml-patch-worker.d.ts +25 -0
- package/dist/types/config/atomic-yaml-patch.d.ts +62 -2
- package/dist/types/config/config-schema-version.d.ts +10 -0
- package/dist/types/config/file-lock.d.ts +18 -0
- package/dist/types/config/model-profile-activation.d.ts +3 -1
- package/dist/types/config/model-registry.d.ts +9 -1
- package/dist/types/config/models-config-schema.d.ts +2 -0
- package/dist/types/config/settings-schema.d.ts +70 -6
- package/dist/types/config/settings.d.ts +63 -0
- package/dist/types/config/skill-settings-defaults.d.ts +26 -0
- package/dist/types/config/task-delegation.d.ts +39 -0
- package/dist/types/config/update-channel.d.ts +10 -0
- package/dist/types/coordinator-mcp/server.d.ts +5 -1
- package/dist/types/crash/index-store.d.ts +87 -0
- package/dist/types/crash/nudge.d.ts +50 -0
- package/dist/types/crash/record-loader.d.ts +17 -0
- package/dist/types/crash/report.d.ts +134 -0
- package/dist/types/crash/sanitize.d.ts +25 -0
- package/dist/types/cursor.d.ts +13 -2
- package/dist/types/customization/import.d.ts +37 -0
- package/dist/types/customization/index.d.ts +4 -0
- package/dist/types/customization/inventory.d.ts +25 -0
- package/dist/types/customization/mutations.d.ts +32 -0
- package/dist/types/customization/types.d.ts +115 -0
- package/dist/types/daemon/control-types.d.ts +8 -1
- package/dist/types/daemon/operator-contract.d.ts +4 -4
- package/dist/types/discovery/claude.d.ts +39 -1
- package/dist/types/discovery/codex.d.ts +39 -1
- package/dist/types/discovery/index.d.ts +2 -0
- package/dist/types/discovery/mcp-compat.d.ts +30 -0
- package/dist/types/edit/renderer.d.ts +23 -0
- package/dist/types/extensibility/extensions/runner.d.ts +3 -0
- package/dist/types/extensibility/extensions/types.d.ts +21 -4
- package/dist/types/extensibility/gjc-plugins/observability.d.ts +6 -1
- package/dist/types/extensibility/gjc-plugins/registry.d.ts +8 -1
- package/dist/types/extensibility/hooks/loader.d.ts +19 -5
- package/dist/types/extensibility/runtime-skill-discovery.d.ts +22 -1
- package/dist/types/extensibility/skill-management.d.ts +107 -0
- package/dist/types/gjc-runtime/deep-interview-runtime.d.ts +3 -1
- package/dist/types/gjc-runtime/launch-worktree.d.ts +8 -0
- package/dist/types/gjc-runtime/linux-proc.d.ts +3 -0
- package/dist/types/gjc-runtime/ralplan-runtime.d.ts +10 -6
- package/dist/types/gjc-runtime/session-state-lock.d.ts +104 -0
- package/dist/types/gjc-runtime/session-state-sidecar.d.ts +120 -2
- package/dist/types/gjc-runtime/state-writer.d.ts +10 -1
- package/dist/types/gjc-runtime/ultragoal-guard.d.ts +4 -2
- package/dist/types/gjc-runtime/ultragoal-runtime.d.ts +8 -6
- package/dist/types/gjc-runtime/workflow-settings.d.ts +109 -0
- package/dist/types/hooks/events.d.ts +60 -0
- package/dist/types/hooks/normalize.d.ts +83 -0
- package/dist/types/hooks/skill-state.d.ts +9 -2
- package/dist/types/main.d.ts +1 -1
- package/dist/types/modes/acp/abort-scope.d.ts +13 -0
- package/dist/types/modes/acp/acp-agent.d.ts +7 -4
- package/dist/types/modes/components/customization/customization-dashboard.d.ts +44 -0
- package/dist/types/modes/components/customization/import-wizard.d.ts +21 -0
- package/dist/types/modes/components/customization/index.d.ts +1 -0
- package/dist/types/modes/components/gajae-pet-widget.d.ts +8 -30
- package/dist/types/modes/components/irc-sidebar.d.ts +1 -0
- package/dist/types/modes/components/iterm-pet-transport.d.ts +122 -0
- package/dist/types/modes/components/oauth-selector.d.ts +10 -4
- package/dist/types/modes/components/pet-capability.d.ts +11 -25
- package/dist/types/modes/components/status-line/gh.d.ts +6 -2
- package/dist/types/modes/controllers/extension-ui-controller.d.ts +1 -1
- package/dist/types/modes/controllers/selector-controller.d.ts +7 -8
- package/dist/types/modes/controllers/stt-controller.d.ts +1 -1
- package/dist/types/modes/interactive-mode.d.ts +1 -0
- package/dist/types/modes/types.d.ts +1 -0
- package/dist/types/modes/utils/injected-user-submission.d.ts +10 -0
- package/dist/types/runtime-mcp/config.d.ts +9 -0
- package/dist/types/runtime-mcp/manager.d.ts +26 -1
- package/dist/types/runtime-mcp/oauth-discovery.d.ts +4 -0
- package/dist/types/runtime-mcp/oauth-flow.d.ts +24 -1
- package/dist/types/runtime-mcp/pool-key.d.ts +2 -0
- package/dist/types/runtime-mcp/protocol.d.ts +278 -0
- package/dist/types/runtime-mcp/scope-config.d.ts +29 -0
- package/dist/types/runtime-mcp/tool-bridge.d.ts +15 -13
- package/dist/types/runtime-mcp/transports/http.d.ts +9 -0
- package/dist/types/runtime-mcp/types.d.ts +102 -10
- package/dist/types/sdk/acp/adapter.d.ts +26 -5
- package/dist/types/sdk/broker/broker.d.ts +3 -55
- package/dist/types/sdk/broker/lifecycle.d.ts +18 -12
- package/dist/types/sdk/broker/session-index.d.ts +14 -5
- package/dist/types/sdk/broker/startup-failure.d.ts +16 -1
- package/dist/types/sdk/bus/chat-daemon-control.d.ts +51 -1
- package/dist/types/sdk/bus/chat-daemon-runtime.d.ts +4 -41
- package/dist/types/sdk/bus/config.d.ts +11 -0
- package/dist/types/sdk/bus/conversation-store.d.ts +0 -1
- package/dist/types/sdk/bus/daemon-paths.d.ts +6 -0
- package/dist/types/sdk/bus/discord-conversation.d.ts +2 -0
- package/dist/types/sdk/bus/discord-daemon.d.ts +17 -12
- package/dist/types/sdk/bus/existing-thread-readiness.d.ts +4 -34
- package/dist/types/sdk/bus/inbound-reaction-ordering.d.ts +61 -0
- package/dist/types/sdk/bus/index.d.ts +85 -99
- package/dist/types/sdk/bus/kind-aware-reconciliation.d.ts +29 -7
- package/dist/types/sdk/bus/managed-daemon.d.ts +2 -32
- package/dist/types/sdk/bus/notification-service.d.ts +52 -0
- package/dist/types/sdk/bus/operator-runtime.d.ts +1 -1
- package/dist/types/sdk/bus/prompt-reconciliation.d.ts +16 -5
- package/dist/types/sdk/bus/reconciliation-store.d.ts +113 -5
- package/dist/types/sdk/bus/session-control.d.ts +25 -1
- package/dist/types/sdk/bus/slack-conversation.d.ts +4 -0
- package/dist/types/sdk/bus/slack-daemon.d.ts +9 -17
- package/dist/types/sdk/bus/slack-live-provider.d.ts +3 -1
- package/dist/types/sdk/bus/slack-provider.d.ts +4 -0
- package/dist/types/sdk/bus/slack-thread-binding.d.ts +6 -40
- package/dist/types/sdk/bus/telegram-adoption-intent.d.ts +30 -104
- package/dist/types/sdk/bus/telegram-daemon-cli.d.ts +10 -0
- package/dist/types/sdk/bus/telegram-daemon-contract.d.ts +262 -19
- package/dist/types/sdk/bus/telegram-daemon-orphan-reap.d.ts +125 -0
- package/dist/types/sdk/bus/telegram-daemon-owner-registry.d.ts +22 -0
- package/dist/types/sdk/bus/telegram-daemon.d.ts +119 -310
- package/dist/types/sdk/bus/telegram-reference.d.ts +1 -47
- package/dist/types/sdk/bus/threaded-render.d.ts +1 -0
- package/dist/types/sdk/bus/topic-registry.d.ts +33 -17
- package/dist/types/sdk/cli/rows.d.ts +2 -11
- package/dist/types/sdk/cli/session-cli.d.ts +15 -25
- package/dist/types/sdk/client/client.d.ts +97 -1
- package/dist/types/sdk/host/control/dispatch.d.ts +0 -7
- package/dist/types/sdk/host/control/index.d.ts +1 -1
- package/dist/types/sdk/host/control/operations.d.ts +18 -5
- package/dist/types/sdk/host/control/runtime-gate.d.ts +19 -0
- package/dist/types/sdk/host/host.d.ts +15 -1
- package/dist/types/sdk/host/query/handlers.d.ts +5 -0
- package/dist/types/sdk/host/reverse-leases.d.ts +1 -1
- package/dist/types/sdk/host/session-runtime.d.ts +127 -7
- package/dist/types/sdk/host/types.d.ts +1 -1
- package/dist/types/sdk/host/websocket-transport.d.ts +1 -1
- package/dist/types/sdk/index.d.ts +2 -1
- package/dist/types/sdk/lifecycle/broker-client.d.ts +8 -0
- package/dist/types/sdk/lifecycle/client.d.ts +59 -0
- package/dist/types/sdk/lifecycle/index.d.ts +3 -0
- package/dist/types/sdk/lifecycle/service.d.ts +232 -0
- package/dist/types/sdk/mcp/server.d.ts +9 -6
- package/dist/types/sdk/prompt-deadline-lease.d.ts +43 -0
- package/dist/types/sdk/prompt-deadline-manager.d.ts +28 -0
- package/dist/types/sdk/prompt-status.d.ts +10 -3
- package/dist/types/sdk/protocol/operation-registry.d.ts +5 -0
- package/dist/types/sdk/receipt-state.d.ts +17 -0
- package/dist/types/sdk/reconciliation-extensions.d.ts +2 -0
- package/dist/types/sdk/router/index.d.ts +1 -0
- package/dist/types/sdk/router/session-router.d.ts +152 -0
- package/dist/types/sdk/session-list.d.ts +22 -0
- package/dist/types/sdk/session-reconnect.d.ts +43 -1
- package/dist/types/sdk/session.d.ts +34 -1
- package/dist/types/sdk/transport/serve-cli.d.ts +1 -4
- package/dist/types/session/account-inventory.d.ts +86 -0
- package/dist/types/session/agent-session.d.ts +145 -6
- package/dist/types/session/agent-storage.d.ts +10 -0
- package/dist/types/session/coordinator-tool-label.d.ts +28 -0
- package/dist/types/session/internal/managed-session-storage.d.ts +23 -4
- package/dist/types/session/messages.d.ts +1 -1
- package/dist/types/session/secure-token-file.d.ts +3 -0
- package/dist/types/session/session-manager.d.ts +40 -1
- package/dist/types/session/startup-auth-config.d.ts +44 -0
- package/dist/types/session/terminal-abort.d.ts +378 -0
- package/dist/types/session/yield-queue.d.ts +7 -0
- package/dist/types/session-import/claude.d.ts +26 -0
- package/dist/types/session-import/codex.d.ts +88 -0
- package/dist/types/session-import/command.d.ts +35 -0
- package/dist/types/session-import/detect.d.ts +22 -0
- package/dist/types/session-import/index.d.ts +7 -0
- package/dist/types/session-import/provider-codex.d.ts +22 -0
- package/dist/types/session-import/provider-service.d.ts +38 -0
- package/dist/types/session-import/redact.d.ts +23 -0
- package/dist/types/session-import/service.d.ts +47 -0
- package/dist/types/session-import/types.d.ts +120 -0
- package/dist/types/setup/paseo/check.d.ts +16 -0
- package/dist/types/setup/paseo/install-saga.d.ts +115 -0
- package/dist/types/setup/paseo/json-publisher.d.ts +76 -0
- package/dist/types/setup/paseo/orchestration-preferences.d.ts +24 -0
- package/dist/types/setup/paseo/paseo-ownership.d.ts +87 -0
- package/dist/types/setup/paseo/paseo-setup.d.ts +29 -0
- package/dist/types/setup/paseo/provider-config.d.ts +35 -0
- package/dist/types/setup/paseo/remove.d.ts +14 -0
- package/dist/types/setup/paseo/result-types.d.ts +59 -0
- package/dist/types/setup/paseo/setup-deps.d.ts +73 -0
- package/dist/types/setup/paseo/skills-bridge.d.ts +44 -0
- package/dist/types/skill-state/active-state.d.ts +5 -1
- package/dist/types/slash-commands/acp-builtins.d.ts +5 -1
- package/dist/types/slash-commands/builtin-registry.d.ts +2 -0
- package/dist/types/slash-commands/helpers/credential-switch.d.ts +12 -0
- package/dist/types/slash-commands/helpers/usage-report.d.ts +5 -6
- package/dist/types/slash-commands/types.d.ts +7 -1
- package/dist/types/task/executor.d.ts +10 -0
- package/dist/types/task/index.d.ts +3 -1
- package/dist/types/tools/ask-answer-registry.d.ts +6 -3
- package/dist/types/tools/bash-sleep-advisory.d.ts +14 -0
- package/dist/types/tools/bash.d.ts +2 -6
- package/dist/types/tools/browser/attach.d.ts +11 -0
- package/dist/types/tools/browser/launch.d.ts +20 -0
- package/dist/types/tools/browser/profile-discovery.d.ts +6 -0
- package/dist/types/tools/browser/render.d.ts +1 -0
- package/dist/types/tools/browser.d.ts +3 -1
- package/dist/types/tools/image-gen.d.ts +9 -2
- package/dist/types/tools/index.d.ts +8 -0
- package/dist/types/tools/monitor.d.ts +1 -1
- package/dist/types/tools/skill-discovery.d.ts +8 -1
- package/dist/types/tools/subagent.d.ts +2 -0
- package/dist/types/tools/ultragoal-ask-guard.d.ts +2 -2
- package/dist/types/utils/herdr-pane.d.ts +76 -0
- package/package.json +19 -9
- package/scripts/build-binary.ts +2 -1
- package/scripts/build-sdk-package-smoke.ts +2 -13
- package/scripts/capture-sticky-viewport-showcase.ts +0 -1
- package/scripts/compile-args.ts +2 -0
- package/scripts/generate-sdk-adapter-parity-manifest.ts +31 -16
- package/scripts/generate-sdk-operation-inventory.ts +28 -0
- package/scripts/generate-telegram-baseline-manifest.ts +1 -0
- package/scripts/generate-tool-catalog.ts +6 -4
- package/scripts/verify-gjc-sdk-canonicalization.ts +5 -39
- package/src/async/job-manager.ts +352 -17
- package/src/async/support.ts +25 -0
- package/src/autoresearch/dashboard.ts +28 -13
- package/src/capability/index.ts +3 -1
- package/src/capability/mcp.ts +6 -0
- package/src/capability/types.ts +6 -0
- package/src/cli/accounts-cli.ts +395 -0
- package/src/cli/args.ts +23 -0
- package/src/cli/auth-broker-cli.ts +136 -66
- package/src/cli/auth-gateway-cli.ts +94 -70
- package/src/cli/config-cli.ts +27 -2
- package/src/cli/crash-cli.ts +78 -0
- package/src/cli/customize-doctor.ts +1605 -0
- package/src/cli/daemon-cli.ts +12 -3
- package/src/cli/fast-help.ts +1 -0
- package/src/cli/mcp-cli.ts +128 -60
- package/src/cli/notify-cli.ts +8 -14
- package/src/cli/root-flags.ts +8 -0
- package/src/cli/setup-cli.ts +145 -0
- package/src/cli/skills-cli.ts +38 -2
- package/src/cli/update-cli.ts +167 -12
- package/src/cli.ts +4 -0
- package/src/commands/accounts.ts +71 -0
- package/src/commands/crash.ts +35 -0
- package/src/commands/customize.ts +84 -0
- package/src/commands/daemon.ts +2 -2
- package/src/commands/deep-interview.ts +2 -0
- package/src/commands/launch.ts +1 -0
- package/src/commands/mcp.ts +12 -7
- package/src/commands/ralplan.ts +2 -0
- package/src/commands/sdk.ts +65 -32
- package/src/commands/setup.ts +5 -0
- package/src/commands/skills.ts +14 -4
- package/src/commands/ultragoal.ts +10 -1
- package/src/commands/update.ts +26 -15
- package/src/config/atomic-yaml-patch-worker.ts +57 -0
- package/src/config/atomic-yaml-patch.ts +769 -29
- package/src/config/config-schema-version.ts +10 -0
- package/src/config/file-lock.ts +70 -1
- package/src/config/mcp-schema.json +52 -14
- package/src/config/model-profile-activation.ts +20 -1
- package/src/config/model-profiles.ts +29 -19
- package/src/config/model-registry.ts +132 -21
- package/src/config/models-config-schema.ts +1 -1
- package/src/config/settings-schema.ts +76 -6
- package/src/config/settings.ts +4038 -199
- package/src/config/skill-settings-defaults.ts +41 -3
- package/src/config/task-delegation.ts +87 -0
- package/src/config/update-channel.ts +23 -0
- package/src/coordinator-mcp/server.ts +377 -308
- package/src/crash/index-store.ts +723 -0
- package/src/crash/nudge.ts +89 -0
- package/src/crash/record-loader.ts +149 -0
- package/src/crash/report.ts +551 -0
- package/src/crash/sanitize.ts +129 -0
- package/src/cursor.ts +36 -10
- package/src/customization/import.ts +946 -0
- package/src/customization/index.ts +4 -0
- package/src/customization/inventory.ts +335 -0
- package/src/customization/mutations.ts +141 -0
- package/src/customization/types.ts +223 -0
- package/src/daemon/control-types.ts +8 -1
- package/src/daemon/operator-contract.ts +6 -6
- package/src/defaults/gjc/skills/deep-interview/SKILL.md +11 -22
- package/src/defaults/gjc/skills/ralplan/SKILL.md +36 -23
- package/src/defaults/gjc/skills/ultragoal/SKILL.md +16 -0
- package/src/discovery/claude-hooks.ts +38 -0
- package/src/discovery/claude.ts +142 -209
- package/src/discovery/codex-hooks.ts +38 -0
- package/src/discovery/codex.ts +132 -198
- package/src/discovery/helpers.ts +8 -1
- package/src/discovery/index.ts +2 -0
- package/src/discovery/mcp-compat.ts +234 -0
- package/src/discovery/mcp-json.ts +6 -0
- package/src/edit/renderer.ts +40 -0
- package/src/edit/streaming.ts +4 -2
- package/src/exec/bash-executor.ts +24 -20
- package/src/export/html/index.ts +51 -2
- package/src/extensibility/extensions/loader.ts +9 -1
- package/src/extensibility/extensions/runner.ts +17 -4
- package/src/extensibility/extensions/types.ts +31 -6
- package/src/extensibility/gjc-plugins/constrained-hooks.ts +33 -0
- package/src/extensibility/gjc-plugins/installer.ts +9 -5
- package/src/extensibility/gjc-plugins/observability.ts +8 -2
- package/src/extensibility/gjc-plugins/registry.ts +13 -2
- package/src/extensibility/gjc-plugins/runtime-adapters.ts +3 -1
- package/src/extensibility/gjc-plugins/schema.ts +222 -39
- package/src/extensibility/hooks/loader.ts +154 -10
- package/src/extensibility/runtime-skill-discovery.ts +257 -60
- package/src/extensibility/skill-management.ts +368 -0
- package/src/extensibility/skills.ts +52 -16
- package/src/gjc-runtime/deep-interview-runtime.ts +45 -61
- package/src/gjc-runtime/launch-worktree.ts +56 -2
- package/src/gjc-runtime/linux-proc.ts +7 -1
- package/src/gjc-runtime/ralplan-runtime.ts +100 -164
- package/src/gjc-runtime/session-state-lock.ts +992 -0
- package/src/gjc-runtime/session-state-sidecar.ts +644 -142
- package/src/gjc-runtime/state-writer.ts +39 -14
- package/src/gjc-runtime/tmux-owner-isolation.ts +5 -4
- package/src/gjc-runtime/ultragoal-guard.ts +11 -4
- package/src/gjc-runtime/ultragoal-runtime.ts +44 -41
- package/src/gjc-runtime/workflow-settings.ts +596 -0
- package/src/goals/tools/goal-tool.ts +6 -1
- package/src/hooks/events.ts +291 -0
- package/src/hooks/native-skill-hook.ts +4 -0
- package/src/hooks/normalize.ts +369 -0
- package/src/hooks/skill-state.ts +165 -46
- package/src/internal-urls/docs-index.generated.ts +40 -32
- package/src/main.ts +32 -5
- package/src/migrate/mcp-mapper.ts +25 -2
- package/src/modes/acp/abort-scope.ts +29 -0
- package/src/modes/acp/acp-agent.ts +423 -98
- package/src/modes/components/assistant-message.ts +6 -1
- package/src/modes/components/customization/customization-dashboard.ts +443 -0
- package/src/modes/components/customization/import-wizard.ts +372 -0
- package/src/modes/components/customization/index.ts +1 -0
- package/src/modes/components/gajae-pet-widget.ts +539 -213
- package/src/modes/components/irc-sidebar.ts +11 -0
- package/src/modes/components/iterm-pet-transport.ts +585 -0
- package/src/modes/components/oauth-selector.ts +277 -86
- package/src/modes/components/pet-capability.ts +39 -40
- package/src/modes/components/settings-selector.ts +9 -0
- package/src/modes/components/status-line/gh.ts +45 -1
- package/src/modes/components/status-line/segments.ts +16 -1
- package/src/modes/components/tool-status-header.ts +13 -3
- package/src/modes/controllers/command-controller.ts +20 -8
- package/src/modes/controllers/extension-ui-controller.ts +56 -257
- package/src/modes/controllers/input-controller.ts +10 -0
- package/src/modes/controllers/runtime-mcp-command-controller.ts +16 -3
- package/src/modes/controllers/selector-controller.ts +177 -72
- package/src/modes/controllers/stt-controller.ts +3 -3
- package/src/modes/interactive-mode.ts +88 -16
- package/src/modes/print-mode.ts +35 -6
- package/src/modes/runtime-init.ts +21 -68
- package/src/modes/types.ts +1 -0
- package/src/modes/utils/injected-user-submission.ts +25 -0
- package/src/modes/utils/terminal-bell.ts +15 -1
- package/src/prompts/agent-fragments/ralplan-persistence.md +1 -1
- package/src/prompts/agent-fragments/restricted-bash.md +1 -1
- package/src/prompts/agents/critic.md +1 -1
- package/src/prompts/system/rlm-research.md +1 -1
- package/src/prompts/system/system-prompt.md +0 -2
- package/src/prompts/tools/bash.md +7 -1
- package/src/prompts/tools/browser.md +1 -1
- package/src/prompts/tools/cron.md +6 -6
- package/src/prompts/tools/read.md +0 -2
- package/src/prompts/tools/skill-discovery.md +4 -2
- package/src/runtime-mcp/client.ts +427 -23
- package/src/runtime-mcp/config.ts +37 -5
- package/src/runtime-mcp/manager-pool.test.ts +56 -0
- package/src/runtime-mcp/manager.ts +52 -2
- package/src/runtime-mcp/oauth-discovery.ts +13 -0
- package/src/runtime-mcp/oauth-flow.ts +46 -1
- package/src/runtime-mcp/pool-key.ts +5 -1
- package/src/runtime-mcp/pool.test.ts +9 -0
- package/src/runtime-mcp/protocol.test.ts +353 -0
- package/src/runtime-mcp/protocol.ts +624 -0
- package/src/runtime-mcp/scope-config.ts +78 -0
- package/src/runtime-mcp/tool-bridge.ts +44 -10
- package/src/runtime-mcp/transports/http.ts +84 -13
- package/src/runtime-mcp/types.ts +123 -12
- package/src/sdk/acp/adapter.ts +328 -97
- package/src/sdk/broker/broker.ts +160 -741
- package/src/sdk/broker/ensure.ts +9 -1
- package/src/sdk/broker/lifecycle.ts +510 -116
- package/src/sdk/broker/operation-receipt-ledger.ts +11 -2
- package/src/sdk/broker/process-incarnation.ts +19 -0
- package/src/sdk/broker/session-index.ts +516 -117
- package/src/sdk/broker/startup-failure.ts +28 -5
- package/src/sdk/broker/transport.ts +1 -13
- package/src/sdk/bus/chat-daemon-cli.ts +4 -2
- package/src/sdk/bus/chat-daemon-control.ts +67 -6
- package/src/sdk/bus/chat-daemon-runtime.ts +183 -859
- package/src/sdk/bus/config.ts +13 -0
- package/src/sdk/bus/conversation-store.ts +59 -171
- package/src/sdk/bus/daemon-paths.ts +20 -0
- package/src/sdk/bus/discord-conversation.ts +2 -0
- package/src/sdk/bus/discord-daemon.ts +524 -126
- package/src/sdk/bus/discord-live-provider.ts +206 -79
- package/src/sdk/bus/existing-thread-readiness.ts +4 -97
- package/src/sdk/bus/inbound-reaction-ordering.ts +122 -0
- package/src/sdk/bus/index.ts +2480 -456
- package/src/sdk/bus/kind-aware-reconciliation.ts +204 -34
- package/src/sdk/bus/lifecycle-commands.ts +2 -2
- package/src/sdk/bus/managed-daemon.ts +2 -145
- package/src/sdk/bus/notification-service.ts +196 -0
- package/src/sdk/bus/operator-runtime.ts +1 -1
- package/src/sdk/bus/prompt-reconciliation.ts +24 -15
- package/src/sdk/bus/reconciliation-store.ts +553 -24
- package/src/sdk/bus/session-control.ts +49 -3
- package/src/sdk/bus/slack-conversation.ts +4 -0
- package/src/sdk/bus/slack-daemon.ts +733 -134
- package/src/sdk/bus/slack-live-provider.ts +65 -15
- package/src/sdk/bus/slack-provider.ts +4 -0
- package/src/sdk/bus/slack-thread-binding.ts +9 -104
- package/src/sdk/bus/telegram-adoption-intent.ts +299 -209
- package/src/sdk/bus/telegram-daemon-cli.ts +194 -7
- package/src/sdk/bus/telegram-daemon-contract.ts +265 -19
- package/src/sdk/bus/telegram-daemon-control.ts +3 -13
- package/src/sdk/bus/telegram-daemon-orphan-reap.ts +498 -0
- package/src/sdk/bus/telegram-daemon-owner-registry.ts +176 -0
- package/src/sdk/bus/telegram-daemon.ts +2552 -2280
- package/src/sdk/bus/telegram-reference.ts +1 -226
- package/src/sdk/bus/telegram-setup.ts +2 -2
- package/src/sdk/bus/threaded-render.ts +1 -0
- package/src/sdk/bus/topic-registry.ts +279 -146
- package/src/sdk/cli/rows.ts +2 -35
- package/src/sdk/cli/session-cli.ts +776 -700
- package/src/sdk/client/client.ts +892 -1
- package/src/sdk/host/control/dispatch.ts +93 -58
- package/src/sdk/host/control/index.ts +1 -1
- package/src/sdk/host/control/operations.ts +18 -10
- package/src/sdk/host/control/runtime-gate.ts +40 -0
- package/src/sdk/host/host.ts +63 -12
- package/src/sdk/host/query/handlers.ts +66 -7
- package/src/sdk/host/reverse-leases.ts +2 -2
- package/src/sdk/host/sdk-surface-parity.test.ts +1 -1
- package/src/sdk/host/session-runtime.test.ts +2787 -34
- package/src/sdk/host/session-runtime.ts +1489 -101
- package/src/sdk/host/surface-policy.ts +12 -8
- package/src/sdk/host/types.ts +1 -1
- package/src/sdk/host/websocket-transport.lifecycle.test.ts +31 -59
- package/src/sdk/host/websocket-transport.ts +85 -50
- package/src/sdk/index.ts +2 -1
- package/src/sdk/lifecycle/broker-client.ts +53 -0
- package/src/sdk/lifecycle/client.ts +234 -0
- package/src/sdk/lifecycle/index.ts +3 -0
- package/src/sdk/{bus/recent-activity.ts → lifecycle/recent-sessions.ts} +5 -2
- package/src/sdk/lifecycle/service.ts +720 -0
- package/src/sdk/mcp/server.ts +226 -188
- package/src/sdk/prompt-deadline-lease.ts +55 -0
- package/src/sdk/prompt-deadline-manager.ts +148 -0
- package/src/sdk/prompt-status.ts +11 -3
- package/src/sdk/protocol/operation-inventory.generated.json +272 -129
- package/src/sdk/protocol/operation-registry.ts +71 -8
- package/src/sdk/receipt-state.ts +43 -0
- package/src/sdk/reconciliation-extensions.ts +14 -0
- package/src/sdk/router/index.ts +1 -0
- package/src/sdk/router/session-router.ts +1658 -0
- package/src/sdk/session-list.ts +93 -0
- package/src/sdk/session-reconnect.ts +45 -1
- package/src/sdk/session.ts +716 -120
- package/src/sdk/transport/serve-cli.ts +18 -34
- package/src/session/account-inventory.ts +603 -0
- package/src/session/agent-session.ts +2857 -582
- package/src/session/agent-storage.ts +35 -0
- package/src/session/blob-store.ts +32 -1
- package/src/session/coordinator-tool-label.ts +40 -0
- package/src/session/internal/managed-session-scope.ts +4 -0
- package/src/session/internal/managed-session-storage.ts +173 -12
- package/src/session/messages.ts +1 -1
- package/src/session/secure-token-file.ts +80 -0
- package/src/session/session-manager.ts +730 -58
- package/src/session/session-storage.ts +25 -16
- package/src/session/startup-auth-config.ts +297 -0
- package/src/session/terminal-abort.ts +1253 -0
- package/src/session/yield-queue.ts +57 -15
- package/src/session-import/claude.ts +334 -0
- package/src/session-import/codex.ts +1033 -0
- package/src/session-import/command.ts +77 -0
- package/src/session-import/detect.ts +133 -0
- package/src/session-import/index.ts +7 -0
- package/src/session-import/provider-codex.ts +327 -0
- package/src/session-import/provider-service.ts +457 -0
- package/src/session-import/redact.ts +128 -0
- package/src/session-import/service.ts +1264 -0
- package/src/session-import/types.ts +148 -0
- package/src/setup/paseo/check.ts +213 -0
- package/src/setup/paseo/install-saga.ts +293 -0
- package/src/setup/paseo/json-publisher.ts +263 -0
- package/src/setup/paseo/orchestration-preferences.ts +86 -0
- package/src/setup/paseo/paseo-ownership.ts +224 -0
- package/src/setup/paseo/paseo-setup.ts +253 -0
- package/src/setup/paseo/provider-config.ts +139 -0
- package/src/setup/paseo/remove.ts +183 -0
- package/src/setup/paseo/result-types.ts +79 -0
- package/src/setup/paseo/setup-deps.ts +175 -0
- package/src/setup/paseo/skills-bridge.ts +260 -0
- package/src/skill-state/active-state.ts +21 -11
- package/src/slash-commands/acp-builtins.ts +9 -1
- package/src/slash-commands/builtin-registry.ts +98 -16
- package/src/slash-commands/helpers/credential-switch.ts +143 -0
- package/src/slash-commands/helpers/mcp.ts +9 -3
- package/src/slash-commands/helpers/usage-report.ts +61 -56
- package/src/slash-commands/types.ts +7 -2
- package/src/task/executor.ts +30 -11
- package/src/task/index.ts +66 -7
- package/src/task/render.ts +23 -9
- package/src/tools/ask-answer-registry.ts +23 -7
- package/src/tools/ask.ts +8 -4
- package/src/tools/bash-sleep-advisory.ts +115 -0
- package/src/tools/bash.ts +98 -18
- package/src/tools/browser/attach.ts +71 -3
- package/src/tools/browser/launch.ts +86 -13
- package/src/tools/browser/profile-discovery.ts +57 -7
- package/src/tools/browser/render.ts +8 -1
- package/src/tools/browser.ts +130 -21
- package/src/tools/computer.enforcement.test.ts +1 -1
- package/src/tools/computer.ts +3 -2
- package/src/tools/cron.ts +12 -1
- package/src/tools/image-gen.ts +27 -16
- package/src/tools/index.ts +8 -0
- package/src/tools/job.ts +33 -6
- package/src/tools/monitor.ts +41 -2
- package/src/tools/skill-discovery.ts +21 -29
- package/src/tools/subagent.ts +142 -24
- package/src/tools/tool-catalog.generated.ts +6 -6
- package/src/tools/ultragoal-ask-guard.ts +10 -3
- package/src/utils/herdr-pane.ts +345 -0
- package/src/utils/title-generator.ts +2 -0
- package/src/web/scrapers/index.ts +6 -4
- package/dist/types/cli/malloc-env-guard.test.d.ts +0 -1
- package/dist/types/defaults/gjc-defaults.test.d.ts +0 -1
- package/dist/types/memory-backend/lazy-loading.test.d.ts +0 -1
- package/dist/types/runtime/boot-ordering.test.d.ts +0 -1
- package/dist/types/runtime/lazy-service.test.d.ts +0 -1
- package/dist/types/runtime/network-prewarm-service.test.d.ts +0 -1
- package/dist/types/runtime/workspace-tree-service.test.d.ts +0 -1
- package/dist/types/runtime-mcp/config.test.d.ts +0 -1
- package/dist/types/runtime-mcp/http.test.d.ts +0 -1
- package/dist/types/runtime-mcp/manager-pool.test.d.ts +0 -1
- package/dist/types/runtime-mcp/pool-key.test.d.ts +0 -1
- package/dist/types/runtime-mcp/pool.test.d.ts +0 -1
- package/dist/types/sdk/bus/lifecycle-control-runtime.d.ts +0 -117
- package/dist/types/sdk/bus/lifecycle-orchestrator.d.ts +0 -141
- package/dist/types/sdk/bus/telegram-cli.d.ts +0 -31
- package/dist/types/sdk/elevation/allowlist.d.ts +0 -20
- package/dist/types/sdk/elevation/audit.d.ts +0 -93
- package/dist/types/sdk/elevation/capability.d.ts +0 -3
- package/dist/types/sdk/elevation/digest.d.ts +0 -72
- package/dist/types/sdk/elevation/dispatch-receipt.d.ts +0 -85
- package/dist/types/sdk/elevation/grant-ledger.d.ts +0 -163
- package/dist/types/sdk/elevation/owner.d.ts +0 -48
- package/dist/types/sdk/host/import-graph.test.d.ts +0 -1
- package/dist/types/sdk/host/sdk-surface-parity.test.d.ts +0 -1
- package/dist/types/sdk/host/session-runtime.test.d.ts +0 -1
- package/dist/types/sdk/host/websocket-transport.lifecycle.test.d.ts +0 -1
- package/dist/types/session/auth-broker-config.d.ts +0 -13
- package/dist/types/session/heap-eviction-artifacts.test.d.ts +0 -1
- package/dist/types/skills/skills.test.d.ts +0 -1
- package/dist/types/slash-commands/notify-command.test.d.ts +0 -1
- package/dist/types/task/token-log.test.d.ts +0 -1
- package/dist/types/tools/computer.enforcement.test.d.ts +0 -1
- package/dist/types/tools/descriptors.test.d.ts +0 -1
- package/scripts/g005-daemon-smoke.ts +0 -180
- package/scripts/g011-daemon-path-smoke.ts +0 -153
- package/src/sdk/bus/lifecycle-control-runtime.ts +0 -1733
- package/src/sdk/bus/lifecycle-orchestrator.ts +0 -489
- package/src/sdk/bus/telegram-cli.ts +0 -212
- package/src/sdk/elevation/allowlist.ts +0 -54
- package/src/sdk/elevation/audit.ts +0 -208
- package/src/sdk/elevation/capability.ts +0 -41
- package/src/sdk/elevation/digest.ts +0 -129
- package/src/sdk/elevation/dispatch-receipt.ts +0 -184
- package/src/sdk/elevation/grant-ledger.ts +0 -1142
- package/src/sdk/elevation/owner.ts +0 -109
- package/src/session/auth-broker-config.ts +0 -109
- /package/dist/types/{ai-core-import-gate.test.d.ts → discovery/claude-hooks.d.ts} +0 -0
- /package/dist/types/{cli/fixture-report.test.d.ts → discovery/codex-hooks.d.ts} +0 -0
- /package/dist/types/sdk/{bus/recent-activity.d.ts → lifecycle/recent-sessions.d.ts} +0 -0
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
/** Origin class assigned to every causal callback/queue entry before escape. */
|
|
2
|
+
export type DeliveryOrigin = Readonly<{
|
|
3
|
+
kind: "turn-continuation";
|
|
4
|
+
lineageIdHash: string;
|
|
5
|
+
attemptEpoch: number;
|
|
6
|
+
continuationId: string;
|
|
7
|
+
}> | Readonly<{
|
|
8
|
+
kind: "owned-completion";
|
|
9
|
+
lineageIdHash: string;
|
|
10
|
+
attemptEpoch: number;
|
|
11
|
+
registration: TurnRegistrationKey;
|
|
12
|
+
}> | Readonly<{
|
|
13
|
+
kind: "ordinary";
|
|
14
|
+
source: string;
|
|
15
|
+
}>;
|
|
16
|
+
/** Exact causal registration key bound before a job/subagent handle escapes. */
|
|
17
|
+
export interface TurnRegistrationKey {
|
|
18
|
+
/** Endpoint (top-level session) identity that owns this job: the registry is
|
|
19
|
+
* process-global and job ids/generations restart per AsyncJobManager, so
|
|
20
|
+
* two concurrent sessions both mint bg_1/job:1 — without the endpoint in
|
|
21
|
+
* the key the second registration would overwrite the first and an owned
|
|
22
|
+
* abort of the first turn could find an empty causal set (review thread
|
|
23
|
+
* P1). Absent (legacy/test fixtures) = a default scope. */
|
|
24
|
+
endpointId?: string;
|
|
25
|
+
endpointGeneration: number;
|
|
26
|
+
lineageIdHash: string;
|
|
27
|
+
promptAttemptEpoch: number;
|
|
28
|
+
jobId: string;
|
|
29
|
+
jobGeneration: string;
|
|
30
|
+
}
|
|
31
|
+
/** Per-completion delivery key: registration tuple plus entry identity. */
|
|
32
|
+
export type TurnDeliveryKey = TurnRegistrationKey & {
|
|
33
|
+
entryId: string;
|
|
34
|
+
progressSeq?: number;
|
|
35
|
+
};
|
|
36
|
+
/** Private origin envelope carried through the plain AgentMessage boundary. */
|
|
37
|
+
export interface OwnedCompletionEnvelope {
|
|
38
|
+
lineageIdHash: string;
|
|
39
|
+
promptAttemptEpoch: number;
|
|
40
|
+
/** Exact registered five-tuple so the final gate can validate source authority. */
|
|
41
|
+
registration: TurnRegistrationKey;
|
|
42
|
+
}
|
|
43
|
+
export type TurnContinuationFenceState = "open" | "closing" | "closed" | "retained" | "released";
|
|
44
|
+
export type OwnedCompletionPolicy = "enabled" | "disabled";
|
|
45
|
+
/**
|
|
46
|
+
* Continuation fence lifecycle: `open -> closing -> closed` happens
|
|
47
|
+
* synchronously before the first await that interrupts the root turn. Closing
|
|
48
|
+
* records exact continuation tombstones and invalidates ONLY continuation
|
|
49
|
+
* tokens; it never invalidates an owned-completion token, cancels a manager
|
|
50
|
+
* job, or creates a turn delivery receipt. `retained` keeps tombstones for
|
|
51
|
+
* restart/later-owned binding; `released` requires exact tokens gone, teardown
|
|
52
|
+
* with no live continuation, or bounded durable retention. Host response
|
|
53
|
+
* success/replay/retry never releases it.
|
|
54
|
+
*/
|
|
55
|
+
export interface TurnContinuationFence {
|
|
56
|
+
state: TurnContinuationFenceState;
|
|
57
|
+
lineageIdHash: string;
|
|
58
|
+
abortedAttemptEpoch: number;
|
|
59
|
+
terminalScopeId: string;
|
|
60
|
+
blockedContinuationIds: ReadonlySet<string>;
|
|
61
|
+
predecessorTombstones: ReadonlySet<string>;
|
|
62
|
+
ownedCompletionPolicy: OwnedCompletionPolicy;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* The one gate consulted immediately before turn-origin continuation calls and
|
|
66
|
+
* owned-completion admission.
|
|
67
|
+
*
|
|
68
|
+
* `authorizeContinuation` denies any post-close same-turn continuation and
|
|
69
|
+
* allows only a call already linearized as a predecessor before close.
|
|
70
|
+
* `authorizeOwnedCompletion` does NOT consult the closed continuation state as
|
|
71
|
+
* a suppression flag; it validates exact source metadata and, when allowed,
|
|
72
|
+
* AgentSession allocates a FRESH attempt/lineage for the new turn.
|
|
73
|
+
*/
|
|
74
|
+
export interface TurnContinuationGate {
|
|
75
|
+
close(reason: "terminal-turn"): void;
|
|
76
|
+
authorizeContinuation(origin: DeliveryOrigin): "deny" | "allow-predecessor";
|
|
77
|
+
authorizeOwnedCompletion(origin: DeliveryOrigin): "allow-new-turn" | "deny";
|
|
78
|
+
}
|
|
79
|
+
export type OwnedDeliverySettlementPath = "enqueue-acknowledged-return" | "acknowledgeDeliveries-queue-purge" | "delivery-loop-acknowledged-skip" | "deliverDelivery-acknowledged-return" | "terminal-wait-acknowledge-suppression-purge" | "filtered-drain-post-selection-suppression";
|
|
80
|
+
/** Owned-scope-only settlement observer (never installed for turn scope). */
|
|
81
|
+
export type OwnedDeliverySettlementObserver = (event: {
|
|
82
|
+
key: TurnDeliveryKey;
|
|
83
|
+
path: OwnedDeliverySettlementPath;
|
|
84
|
+
action: "owned_settled" | "owned_absent";
|
|
85
|
+
}) => void;
|
|
86
|
+
/** Safe, bounded reasons surfaced on `terminal_uncertain` responses. */
|
|
87
|
+
export declare const TERMINAL_UNCERTAIN_REASONS: readonly ["persistence_unavailable", "publication_failed", "delivery_failed", "owned_unsettled", "worker_unsettled", "unknown_origin", "registration_authority_unavailable"];
|
|
88
|
+
export type TerminalUncertainReason = (typeof TERMINAL_UNCERTAIN_REASONS)[number];
|
|
89
|
+
export interface TerminalScopeDispositions {
|
|
90
|
+
selection: "turn" | "owned";
|
|
91
|
+
turnDisposition: "pending" | "stopped" | "uncertain";
|
|
92
|
+
ownedWorkDisposition: "not_requested" | "left_running" | "stopped" | "uncertain";
|
|
93
|
+
automaticDeliveryDisposition: "enabled" | "none";
|
|
94
|
+
resumeOnOwnedCompletion: boolean;
|
|
95
|
+
}
|
|
96
|
+
export interface ActiveTerminalScope {
|
|
97
|
+
scopeId: string;
|
|
98
|
+
lineageIdHash: string;
|
|
99
|
+
abortedAttemptEpoch: number;
|
|
100
|
+
gate: TurnContinuationGate;
|
|
101
|
+
fence: TurnContinuationFence;
|
|
102
|
+
}
|
|
103
|
+
/** Register one active terminal scope (scopeId -> seam). Bounded; evicts oldest. */
|
|
104
|
+
export declare function registerTerminalScope(scope: ActiveTerminalScope): boolean;
|
|
105
|
+
/** Look up the active terminal scope for an aborted attempt (exact lineage+epoch). */
|
|
106
|
+
export declare function lookupTerminalScope(lineageIdHash: string, attemptEpoch: number): ActiveTerminalScope | undefined;
|
|
107
|
+
export declare function unregisterTerminalScope(scopeId: string): void;
|
|
108
|
+
/** Record an exact owned registration before its handle escapes (bounded). */
|
|
109
|
+
export declare function registerOwnedRegistration(key: TurnRegistrationKey, options?: {
|
|
110
|
+
isJobTerminal?: (candidate: TurnRegistrationKey) => boolean | undefined;
|
|
111
|
+
}): void;
|
|
112
|
+
/** Whether an attempt's owned registration set is KNOWN incomplete (an
|
|
113
|
+
* evicted in-flight lineage binding or a registry-saturation skip) — a
|
|
114
|
+
* scope:"owned" abort of that exact attempt must fail closed to uncertainty
|
|
115
|
+
* (review thread P2). */
|
|
116
|
+
export declare function isOwnedAttemptRegistrationIncomplete(lineageIdHash: string, attemptEpoch: number): boolean;
|
|
117
|
+
/** Exact (jobId, jobGeneration) lookup for completion-origin classification. */
|
|
118
|
+
export declare function lookupOwnedRegistration(jobId: string, jobGeneration: string, endpointId?: string): TurnRegistrationKey | undefined;
|
|
119
|
+
export declare function unregisterOwnedRegistration(key: TurnRegistrationKey): void;
|
|
120
|
+
/**
|
|
121
|
+
* Enumerate every exact owned registration belonging to one aborted turn
|
|
122
|
+
* (matching lineage + attempt epoch). Used by `scope:"owned"` cleanup to
|
|
123
|
+
* capture the exact causal job set; foreign/unclassified work is never
|
|
124
|
+
* returned and is never swept.
|
|
125
|
+
*/
|
|
126
|
+
/** Retire EVERY owned registration owned by a disposing endpoint (live,
|
|
127
|
+
* retained-evidence, and backlogged tuples): after the endpoint's manager is
|
|
128
|
+
* unregistered the tuples can no longer reach a delivery settlement boundary,
|
|
129
|
+
* and future managers deliberately cannot classify foreign-endpoint tuples as
|
|
130
|
+
* terminal for eviction — repeatedly disposing distinct sessions with pending
|
|
131
|
+
* jobs would accumulate tuples until the 8192-entry registry saturates and
|
|
132
|
+
* all later owned aborts fail closed (review thread P2). */
|
|
133
|
+
export declare function retireOwnedRegistrationsForEndpoint(endpointId: string): void;
|
|
134
|
+
export declare function findOwnedRegistrationsForTurn(lineageIdHash: string, attemptEpoch: number): TurnRegistrationKey[];
|
|
135
|
+
export interface OwnedCompletionClassification {
|
|
136
|
+
lineageIdHash: string;
|
|
137
|
+
promptAttemptEpoch: number;
|
|
138
|
+
registration: TurnRegistrationKey;
|
|
139
|
+
terminalScopeId: string;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Classify a manager completion/progress delivery against the terminal-abort
|
|
143
|
+
* registries. Returns an exact owned-completion classification ONLY when the
|
|
144
|
+
* job carries an exact registered five-tuple AND a terminal scope exists for
|
|
145
|
+
* that turn. Missing or mismatched metadata fails closed (undefined) and the
|
|
146
|
+
* delivery is then ordinary. Classification is source/lineage-based, never
|
|
147
|
+
* timing-based; a closed terminal record does NOT suppress an exact
|
|
148
|
+
* left-running owned completion (corrected turn semantics).
|
|
149
|
+
*/
|
|
150
|
+
export declare function classifyOwnedCompletion(jobId: string, jobGeneration: string | undefined): OwnedCompletionClassification | undefined;
|
|
151
|
+
/**
|
|
152
|
+
* Whether an owned-completion envelope is authorized by its owning terminal
|
|
153
|
+
* scope as a fresh-turn resume. Used at batch build (sdk/session.ts) and the
|
|
154
|
+
* final injection boundary (agent-session.ts): a denied envelope — owned scope
|
|
155
|
+
* (policy disabled), forged/unregistered tuple, or vanished scope — must be
|
|
156
|
+
* dropped/partitioned out so stopped work can never call followUp/prompt.
|
|
157
|
+
*/
|
|
158
|
+
/**
|
|
159
|
+
* Classify an owned-completion envelope into three states. A registration
|
|
160
|
+
* without a terminal scope (no abort yet) is ORDINARY — normal delivery;
|
|
161
|
+
* only a scope with the owned policy disabled DROPS, and a turn-scope
|
|
162
|
+
* enabled policy is FRESH (new-turn resume). This lets the batch keep
|
|
163
|
+
* ownership on the entry and reclassify at flush/abort time (review
|
|
164
|
+
* thread P1: a completion finished before the abort must not become an
|
|
165
|
+
* unpurgeable ordinary entry that can still resume the agent).
|
|
166
|
+
*/
|
|
167
|
+
/**
|
|
168
|
+
* Structural validation for envelopes carried through the public AgentMessage
|
|
169
|
+
* `details` boundary: `ExtensionAPI.sendMessage` allows arbitrary details, so
|
|
170
|
+
* a malformed `ownedCompletions` entry (object, null item, missing tuple
|
|
171
|
+
* fields) must never crash the delivery path — invalid entries are skipped,
|
|
172
|
+
* never classified (review thread P2).
|
|
173
|
+
*/
|
|
174
|
+
export declare function isOwnedCompletionEnvelope(value: unknown): value is OwnedCompletionEnvelope;
|
|
175
|
+
export declare function classifyOwnedEnvelope(envelope: OwnedCompletionEnvelope): "ordinary" | "fresh" | "drop";
|
|
176
|
+
/** Whether an envelope must be kept in the batch (not an owned-scope drop). */
|
|
177
|
+
export declare function isOwnedCompletionEnvelopeAllowed(envelope: OwnedCompletionEnvelope): boolean;
|
|
178
|
+
/** Structural subset of AsyncJobManager used by owned-stop settlement (avoids an import cycle). */
|
|
179
|
+
export interface OwnedStopManager {
|
|
180
|
+
cancel(jobId: string): boolean;
|
|
181
|
+
getJob(jobId: string): {
|
|
182
|
+
generation?: string;
|
|
183
|
+
status?: string;
|
|
184
|
+
} | undefined;
|
|
185
|
+
getJobPromise?(jobId: string, generation: string): Promise<void> | undefined;
|
|
186
|
+
acknowledgeDeliveries(jobIds: string[]): number;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Settle exact owned work for `scope:"owned"`: generation-verified cancel, a
|
|
190
|
+
* fixed grace, a second quiescence proof, then a delivery purge. Returns
|
|
191
|
+
* "stopped" only when every captured job is terminal after the grace; a reused
|
|
192
|
+
* job id with a new generation, a missing/evicted record, or still-running/
|
|
193
|
+
* paused work fails closed to "unsettled" (AC 16/36 — foreign work is never
|
|
194
|
+
* swept and unprovable quiescence never claims stopped).
|
|
195
|
+
*/
|
|
196
|
+
export declare function settleOwnedWork(manager: OwnedStopManager, exactJobs: TurnRegistrationKey[], graceMs: number): Promise<"stopped" | "unsettled">;
|
|
197
|
+
export interface LineageBinding {
|
|
198
|
+
lineageIdHash: string;
|
|
199
|
+
promptAttemptEpoch: number;
|
|
200
|
+
endpointGeneration: number;
|
|
201
|
+
/** Endpoint (top-level session) identity that minted this binding. */
|
|
202
|
+
endpointId?: string;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Bind immutable lineage/attempt metadata to an attempt-scoped tool call
|
|
206
|
+
* identity (toolCallId). The binding is set once at prompt admission and must
|
|
207
|
+
* never be mutated from a session-current fallback; missing/mismatched
|
|
208
|
+
* context fails closed (resolve returns undefined).
|
|
209
|
+
*/
|
|
210
|
+
export declare function bindToolLineage(toolCallId: string, binding: LineageBinding): void;
|
|
211
|
+
export declare function resolveToolLineage(toolCallId: string | undefined, endpointId?: string): LineageBinding | undefined;
|
|
212
|
+
/** Close an evicted tool's registration window after its execution settles. */
|
|
213
|
+
export declare function settleToolLineageRegistrationWindow(toolCallId: string, endpointId?: string): void;
|
|
214
|
+
export declare function unbindToolLineage(toolCallId: string, endpointId?: string): void;
|
|
215
|
+
/**
|
|
216
|
+
* Mint an unforgeable opaque lineage id for one prompt turn. The hash binds
|
|
217
|
+
* session id, attempt epoch, and a per-session secret; it never contains
|
|
218
|
+
* prompt body and cannot be re-derived from public session data. It is
|
|
219
|
+
* created before model/tool execution and must never be mutated from a
|
|
220
|
+
* session-current fallback.
|
|
221
|
+
*/
|
|
222
|
+
export declare function mintTurnLineageIdHash(sessionId: string, promptAttemptEpoch: number, sessionSecret: string): string;
|
|
223
|
+
/**
|
|
224
|
+
* Register an exact owned registration when the tool call carries immutable
|
|
225
|
+
* lineage metadata. The generation is read synchronously from the manager's
|
|
226
|
+
* job record; a missing generation fails closed (no ownership claim). A
|
|
227
|
+
* registry failure never breaks ordinary registration.
|
|
228
|
+
*/
|
|
229
|
+
export declare function registerOwnedIfLineaged(manager: {
|
|
230
|
+
getJob?(id: string): {
|
|
231
|
+
generation?: string;
|
|
232
|
+
status?: string;
|
|
233
|
+
} | undefined;
|
|
234
|
+
}, toolCallId: string | undefined, jobId: string, endpointId?: string): void;
|
|
235
|
+
/** Retire the exact (endpoint, jobId, jobGeneration) owned registration when
|
|
236
|
+
* its completion delivery is dead-lettered by the manager (delivery-queue
|
|
237
|
+
* overflow or retry exhaustion): no message is injected and no later
|
|
238
|
+
* consumption boundary will settle it, so the terminal tuple would otherwise
|
|
239
|
+
* occupy the global registries until saturation (review thread P2). The
|
|
240
|
+
* delivery is enqueued only when the job is terminal, so no live job's
|
|
241
|
+
* authority is dropped. */
|
|
242
|
+
export declare function retireOwnedRegistrationForDeadLetter(endpointId: string | undefined, jobId: string, jobGeneration: string): void;
|
|
243
|
+
/** Monotonic fresh-attempt epoch for `resumeFromOwnedCompletion` allocation. */
|
|
244
|
+
export declare function nextPromptAttemptEpoch(): number;
|
|
245
|
+
/** Mint a fresh terminal scope id (opaque, never persisted raw). */
|
|
246
|
+
export declare function newTerminalScopeId(): string;
|
|
247
|
+
export interface TurnContinuationSeam {
|
|
248
|
+
fence: TurnContinuationFence;
|
|
249
|
+
gate: TurnContinuationGate;
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Create a continuation fence + gate for one terminal scope. The fence starts
|
|
253
|
+
* `open` and is closed synchronously via `gate.close()` before the root turn is
|
|
254
|
+
* interrupted. Continuation authorization is source-based (lineageIdHash +
|
|
255
|
+
* attemptEpoch + continuationId); timing alone never authorizes.
|
|
256
|
+
*/
|
|
257
|
+
export declare function createTurnContinuationSeam(options: {
|
|
258
|
+
lineageIdHash: string;
|
|
259
|
+
abortedAttemptEpoch: number;
|
|
260
|
+
terminalScopeId: string;
|
|
261
|
+
ownedCompletionPolicy?: OwnedCompletionPolicy;
|
|
262
|
+
blockedContinuationIds?: readonly string[];
|
|
263
|
+
}): TurnContinuationSeam;
|
|
264
|
+
export interface RegisteredTerminalScope {
|
|
265
|
+
scopeId: string;
|
|
266
|
+
lineageIdHash: string;
|
|
267
|
+
promptAttemptEpoch: number;
|
|
268
|
+
seam: TurnContinuationSeam;
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Create, register, and synchronously close a terminal scope for one aborted
|
|
272
|
+
* turn. The fence closes before the first await that interrupts the root turn;
|
|
273
|
+
* owned-completion policy is enabled for `scope:"turn"` (left-running owned
|
|
274
|
+
* delivery intentionally resumes the agent as a fresh turn) and disabled for
|
|
275
|
+
* `scope:"owned"`. Registered scopes are process-local and bounded; the exact
|
|
276
|
+
* (lineageIdHash, attemptEpoch) key makes later owned-completion classification
|
|
277
|
+
* source-exact and fail-closed.
|
|
278
|
+
*/
|
|
279
|
+
export declare function registerTerminalTurnScope(options: {
|
|
280
|
+
lineageIdHash: string;
|
|
281
|
+
promptAttemptEpoch: number;
|
|
282
|
+
terminalScopeId?: string;
|
|
283
|
+
ownedCompletionPolicy?: OwnedCompletionPolicy;
|
|
284
|
+
blockedContinuationIds?: readonly string[];
|
|
285
|
+
}): RegisteredTerminalScope | undefined;
|
|
286
|
+
/**
|
|
287
|
+
* TEST-ONLY: clear the module-global terminal-abort registries so tests get
|
|
288
|
+
* isolated lineage/binding/scope state. Never call from production code —
|
|
289
|
+
* the registries are intentionally process-lifetime in the runtime.
|
|
290
|
+
*/
|
|
291
|
+
export declare function resetTerminalAbortRegistriesForTests(): void;
|
|
292
|
+
/**
|
|
293
|
+
* Structural subset of a durable terminal-scope row needed for bounding
|
|
294
|
+
* retention (review thread P2). Only rows with a COMPLETED disposition are
|
|
295
|
+
* evictable; pending markers are never touched.
|
|
296
|
+
*/
|
|
297
|
+
export interface DurableScopeRetentionRow {
|
|
298
|
+
idempotencyKeyHash?: string;
|
|
299
|
+
idempotencyInputHash?: string;
|
|
300
|
+
turnDisposition: "pending" | "no_effect" | (string & {});
|
|
301
|
+
acceptedAt?: number;
|
|
302
|
+
ownedWorkDisposition?: "not_requested" | "left_running" | "stopped" | "uncertain";
|
|
303
|
+
responseState?: "pending" | "sent" | "delivered" | "failed";
|
|
304
|
+
responsePayloadHash?: string;
|
|
305
|
+
replayPayloadHash?: string;
|
|
306
|
+
terminalPublished?: boolean;
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Evict the OLDEST COMPLETED terminal-scope rows beyond `cap`, mirroring the
|
|
310
|
+
* bounded in-memory idempotency cache so a long-lived session cannot grow
|
|
311
|
+
* the durable reconciliation document indefinitely. Completed dispositions
|
|
312
|
+
* (stopped/uncertain/no_effect) are evicted oldest-first; pending markers and
|
|
313
|
+
* TRANSITIONAL no_effect_reserved reservations (an in-flight abort that may
|
|
314
|
+
* still transition to active) are never evicted — evicting a reserved row
|
|
315
|
+
* would leave a tombstone that replays uncertainty over an unfinalized
|
|
316
|
+
* reservation (review thread P2). Returns a new array.
|
|
317
|
+
*/
|
|
318
|
+
export declare function boundCompletedTerminalScopeRows<T extends DurableScopeRetentionRow>(rows: T[], cap: number): T[];
|
|
319
|
+
/**
|
|
320
|
+
* Compact key tombstones for completed rows evicted by the retention cap: the
|
|
321
|
+
* key+input hashes are retained durably so a same-key retry after dispatch
|
|
322
|
+
* cache expiry/restart still replays instead of aborting an unrelated later
|
|
323
|
+
* prompt (review thread P2).
|
|
324
|
+
*/
|
|
325
|
+
/** Compact key tombstone with enough disposition metadata to reconstruct the
|
|
326
|
+
* original replay result (the retention cap can evict stopped/uncertain rows,
|
|
327
|
+
* not only no-effect reservations — review thread P2). */
|
|
328
|
+
export interface EvictedTerminalKey {
|
|
329
|
+
keyHash: string;
|
|
330
|
+
inputHash: string;
|
|
331
|
+
turnDisposition: "stopped" | "uncertain" | "no_effect" | "no_effect_marker_failure";
|
|
332
|
+
ownedWorkDisposition: "not_requested" | "left_running" | "stopped" | "uncertain";
|
|
333
|
+
responseState?: "pending" | "sent" | "delivered" | "failed";
|
|
334
|
+
responsePayloadHash?: string;
|
|
335
|
+
replayPayloadHash?: string;
|
|
336
|
+
terminalPublished?: boolean;
|
|
337
|
+
}
|
|
338
|
+
/** Bound the retained evicted-key tombstone collection FIFO: when a
|
|
339
|
+
* long-lived session's unique terminal-abort keys evict completed rows until
|
|
340
|
+
* the tombstone cap is reached, the OLDEST tombstones expire instead of the
|
|
341
|
+
* next finalization throwing after the destructive stop already happened —
|
|
342
|
+
* the client would otherwise receive an error while its durable row stays
|
|
343
|
+
* pending, and subsequent aborts repeat the failure and accumulate
|
|
344
|
+
* non-evictable pending rows (review thread P2). A dropped tombstone only
|
|
345
|
+
* loses replay authority for keys older than the bound; the idempotency
|
|
346
|
+
* guarantee degrades to the in-memory cache horizon instead of disabling
|
|
347
|
+
* future aborts. */
|
|
348
|
+
export declare function boundEvictedTerminalKeys<T extends {
|
|
349
|
+
keyHash: string;
|
|
350
|
+
}>(keys: T[], cap: number): T[];
|
|
351
|
+
export declare function collectEvictedTerminalKeys<T extends DurableScopeRetentionRow>(before: T[], after: T[]): EvictedTerminalKey[];
|
|
352
|
+
/** Durable terminal-scope reservation cap. Idle/already-terminal aborts write
|
|
353
|
+
* durable no-effect reservations, so a client sending idle aborts with unique
|
|
354
|
+
* keys must not grow the reconciliation document indefinitely: only the OLDEST
|
|
355
|
+
* COMPLETED rows beyond this cap are evicted (review thread P2). */
|
|
356
|
+
export declare const MAX_DURABLE_TERMINAL_RESERVATIONS = 256;
|
|
357
|
+
/** Retained evicted-key tombstone cap; see {@link boundEvictedTerminalKeys}. */
|
|
358
|
+
export declare const MAX_RETAINED_TERMINAL_KEY_TOMBSTONES = 4096;
|
|
359
|
+
/**
|
|
360
|
+
* Apply the durable terminal-scope retention bound to a pending
|
|
361
|
+
* `transactTerminalState` mutation: evict the oldest COMPLETED scope rows past
|
|
362
|
+
* {@link MAX_DURABLE_TERMINAL_RESERVATIONS}, retain a compact key tombstone for
|
|
363
|
+
* every evicted row ATOMICALLY with the scope write, and FIFO-expire tombstones
|
|
364
|
+
* past {@link MAX_RETAINED_TERMINAL_KEY_TOMBSTONES} instead of throwing after a
|
|
365
|
+
* destructive stop already happened (review thread P2).
|
|
366
|
+
*
|
|
367
|
+
* Every durable terminal-state write — admission markers, no-effect
|
|
368
|
+
* reservations, reservation finalization, and pending-marker transitions — must
|
|
369
|
+
* go through this single bound in BOTH session runtimes (the notifications-hosted
|
|
370
|
+
* bus runtime and the SDK-only host runtime); a hand-rolled copy is how the two
|
|
371
|
+
* paths drift apart.
|
|
372
|
+
*/
|
|
373
|
+
export declare function boundTerminalRetentionState<Row extends DurableScopeRetentionRow, Key extends {
|
|
374
|
+
keyHash: string;
|
|
375
|
+
}>(priorKeys: readonly Key[], nextScopes: Row[], maxScopes?: number): {
|
|
376
|
+
scopes: Row[];
|
|
377
|
+
keys: Array<Key | EvictedTerminalKey>;
|
|
378
|
+
};
|
|
@@ -2,6 +2,13 @@ import type { AgentMessage } from "@gajae-code/agent-core";
|
|
|
2
2
|
export interface YieldDispatcher<P> {
|
|
3
3
|
/** Drop entries already delivered through another path. Called per-entry at flush time. */
|
|
4
4
|
isStale?(entry: P): boolean;
|
|
5
|
+
/**
|
|
6
|
+
* Optional ownership-origin key: when provided, the flush builds ONE
|
|
7
|
+
* message per distinct key instead of one message for the whole batch, so
|
|
8
|
+
* a later scope:"owned" drop of one origin never suppresses entries of
|
|
9
|
+
* another origin (review thread P2).
|
|
10
|
+
*/
|
|
11
|
+
groupKey?(entry: P): string;
|
|
5
12
|
/** Produce one batched AgentMessage from non-stale entries. Return null to skip. */
|
|
6
13
|
build(survivors: P[]): AgentMessage | null;
|
|
7
14
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Claude adapter (issue #3709).
|
|
3
|
+
*
|
|
4
|
+
* Parses two first-party observable Claude transcript/export shapes:
|
|
5
|
+
*
|
|
6
|
+
* 1. `claude-code-jsonl` — Claude Code session transcripts
|
|
7
|
+
* (`~/.claude/projects/<project-slug>/<session-uuid>.jsonl`), one JSON object
|
|
8
|
+
* per line with `type: "user" | "assistant" | "summary" | "system" | …`.
|
|
9
|
+
* 2. `claude-export-json` — the claude.ai data export (`conversations.json`):
|
|
10
|
+
* a JSON array of conversations (or a single conversation object) whose
|
|
11
|
+
* `chat_messages` carry `sender: "human" | "assistant"` and `content` blocks.
|
|
12
|
+
*
|
|
13
|
+
* The same quarantine contract as the Codex adapter applies: unmappable
|
|
14
|
+
* records/messages are counted and digested, never silently dropped.
|
|
15
|
+
*/
|
|
16
|
+
import type { ImportedConversation, ImportQuarantineRecord, SessionImportCounts } from "./types";
|
|
17
|
+
export interface ClaudeParseResult {
|
|
18
|
+
conversation: ImportedConversation;
|
|
19
|
+
quarantine: ImportQuarantineRecord[];
|
|
20
|
+
counts: SessionImportCounts;
|
|
21
|
+
redactionKinds: string[];
|
|
22
|
+
}
|
|
23
|
+
/** Parse a Claude Code session JSONL transcript. */
|
|
24
|
+
export declare function parseClaudeCodeTranscript(text: string): ClaudeParseResult;
|
|
25
|
+
/** Parse a claude.ai data-export conversation (array or single object). */
|
|
26
|
+
export declare function parseClaudeExport(text: string): ClaudeParseResult;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { type RecoveryFsIdentity, type RecoveryFsRoot } from "@gajae-code/natives";
|
|
2
|
+
export declare const CODEX_PROVIDER_ID = "openai-codex";
|
|
3
|
+
export declare const CODEX_CONVERTER_VERSION = 1;
|
|
4
|
+
export declare const CODEX_IMPORT_BATCH_LIMIT = 256;
|
|
5
|
+
export declare const CODEX_SANITIZER_VERSION = 2;
|
|
6
|
+
export declare const CODEX_MAPPING_VERSION = 3;
|
|
7
|
+
interface CodexWorkspaceIdentity {
|
|
8
|
+
dev: string;
|
|
9
|
+
ino: string;
|
|
10
|
+
}
|
|
11
|
+
export interface CodexSessionSource {
|
|
12
|
+
id: string;
|
|
13
|
+
path: string;
|
|
14
|
+
cwd: string;
|
|
15
|
+
timestamp: string;
|
|
16
|
+
title?: string;
|
|
17
|
+
cliVersion?: string;
|
|
18
|
+
modelProvider?: string;
|
|
19
|
+
identity?: RecoveryFsIdentity;
|
|
20
|
+
workspaceIdentity?: CodexWorkspaceIdentity;
|
|
21
|
+
authority?: {
|
|
22
|
+
root: RecoveryFsRoot;
|
|
23
|
+
relativePath: string;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export type CodexMappedEvent = {
|
|
27
|
+
kind: "user";
|
|
28
|
+
timestamp: string;
|
|
29
|
+
text: string;
|
|
30
|
+
} | {
|
|
31
|
+
kind: "assistant";
|
|
32
|
+
timestamp: string;
|
|
33
|
+
text: string;
|
|
34
|
+
} | {
|
|
35
|
+
kind: "tool_call";
|
|
36
|
+
timestamp: string;
|
|
37
|
+
callId: string;
|
|
38
|
+
name: string;
|
|
39
|
+
arguments: Record<string, unknown>;
|
|
40
|
+
} | {
|
|
41
|
+
kind: "tool_result";
|
|
42
|
+
timestamp: string;
|
|
43
|
+
callId: string;
|
|
44
|
+
output: string;
|
|
45
|
+
};
|
|
46
|
+
export interface CodexQuarantineRecord {
|
|
47
|
+
line: number;
|
|
48
|
+
timestamp?: string;
|
|
49
|
+
eventType: string;
|
|
50
|
+
reason: string;
|
|
51
|
+
payload: unknown;
|
|
52
|
+
}
|
|
53
|
+
export interface CodexConversion {
|
|
54
|
+
source: CodexSessionSource;
|
|
55
|
+
sourceSha256: string;
|
|
56
|
+
sourceBytes: number;
|
|
57
|
+
mapped: CodexMappedEvent[];
|
|
58
|
+
quarantine: CodexQuarantineRecord[];
|
|
59
|
+
quarantineTruncated: boolean;
|
|
60
|
+
counts: {
|
|
61
|
+
input: number;
|
|
62
|
+
mapped: number;
|
|
63
|
+
quarantined: number;
|
|
64
|
+
dropped: number;
|
|
65
|
+
redacted: number;
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
export declare class CodexImportError extends Error {
|
|
69
|
+
readonly code: "source_not_found" | "source_untrusted" | "source_changed" | "malformed_source" | "content_too_large";
|
|
70
|
+
readonly phase: "discovery" | "source" | "source_line" | "source_event" | "quarantine";
|
|
71
|
+
readonly limitBytes?: number | undefined;
|
|
72
|
+
readonly observedBytes?: number | undefined;
|
|
73
|
+
constructor(code: "source_not_found" | "source_untrusted" | "source_changed" | "malformed_source" | "content_too_large", phase: "discovery" | "source" | "source_line" | "source_event" | "quarantine", message: string, limitBytes?: number | undefined, observedBytes?: number | undefined);
|
|
74
|
+
}
|
|
75
|
+
export type CodexMappedEventSink = (event: CodexMappedEvent) => void | Promise<void>;
|
|
76
|
+
export declare function sanitizeImportedString(value: string): {
|
|
77
|
+
value: string;
|
|
78
|
+
redacted: number;
|
|
79
|
+
};
|
|
80
|
+
export declare function sanitizeImportedValue(value: unknown, depth?: number): {
|
|
81
|
+
value: unknown;
|
|
82
|
+
redacted: number;
|
|
83
|
+
};
|
|
84
|
+
export declare function assertCodexWorkspaceIdentity(source: CodexSessionSource): Promise<void>;
|
|
85
|
+
export declare function discoverCodexSessions(cwd: string, requestedIds: readonly string[], codexHome?: string, retainSourceAuthority?: boolean): Promise<CodexSessionSource[]>;
|
|
86
|
+
export declare function closeCodexSessionAuthorities(sources: readonly CodexSessionSource[]): Promise<void>;
|
|
87
|
+
export declare function convertCodexSession(source: CodexSessionSource, mappedEventSink?: CodexMappedEventSink): Promise<CodexConversion>;
|
|
88
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `/import-session` slash-command surface (issue #3709).
|
|
3
|
+
*
|
|
4
|
+
* The documented CLI contract:
|
|
5
|
+
*
|
|
6
|
+
* /import-session <transcript-file> [--provider codex|claude]
|
|
7
|
+
*
|
|
8
|
+
* The file argument is an explicit user-selected Codex rollout transcript,
|
|
9
|
+
* Claude Code transcript, or claude.ai export. Provider detection is automatic;
|
|
10
|
+
* `--provider` narrows it and fails closed on a mismatch.
|
|
11
|
+
*/
|
|
12
|
+
import type { SessionImportCompleted, SessionImportProviderId } from "./types";
|
|
13
|
+
export declare const IMPORT_SESSION_USAGE = "Usage: /import-session <transcript-file> [--provider codex|claude]";
|
|
14
|
+
export type ParsedImportSessionArgs = {
|
|
15
|
+
kind: "ok";
|
|
16
|
+
sourcePath: string;
|
|
17
|
+
provider?: SessionImportProviderId;
|
|
18
|
+
} | {
|
|
19
|
+
kind: "error";
|
|
20
|
+
message: string;
|
|
21
|
+
};
|
|
22
|
+
export declare function parseImportSessionArgs(args: string): ParsedImportSessionArgs;
|
|
23
|
+
export type SessionImportCommandOutcome = {
|
|
24
|
+
kind: "imported";
|
|
25
|
+
result: SessionImportCompleted;
|
|
26
|
+
} | {
|
|
27
|
+
kind: "error";
|
|
28
|
+
message: string;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Shared non-UI flow for both the text/ACP handler and the TUI handler:
|
|
32
|
+
* import into a NEW session file; the caller decides how to present/switch.
|
|
33
|
+
* Never mutates the current session.
|
|
34
|
+
*/
|
|
35
|
+
export declare function runSessionImportCommand(args: string, cwd: string): Promise<SessionImportCommandOutcome>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deterministic source-format detection (issue #3709).
|
|
3
|
+
*
|
|
4
|
+
* Detection inspects only the already-read source bytes: a bounded leading
|
|
5
|
+
* sample decides JSONL-vs-JSON and provider by envelope markers. An explicit
|
|
6
|
+
* `--provider` selection narrows candidates; a sample that matches a different
|
|
7
|
+
* provider than requested fails closed with `format_mismatch`. Detection never
|
|
8
|
+
* guesses: a sample matching no supported envelope fails with
|
|
9
|
+
* `unsupported_format` rather than falling back to a speculative parse.
|
|
10
|
+
*/
|
|
11
|
+
import { type SessionImportFormatId, type SessionImportProviderId } from "./types";
|
|
12
|
+
export interface SessionImportDetection {
|
|
13
|
+
provider: SessionImportProviderId;
|
|
14
|
+
format: SessionImportFormatId;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Detect the provider/format of an explicit transcript file.
|
|
18
|
+
*
|
|
19
|
+
* @param text Full source text (already size-bounded by the caller).
|
|
20
|
+
* @param requestedProvider Explicit provider selection; undefined = auto.
|
|
21
|
+
*/
|
|
22
|
+
export declare function detectSessionImportFormat(text: string, requestedProvider: SessionImportProviderId | undefined): SessionImportDetection;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Codex adapter (issue #3709).
|
|
3
|
+
*
|
|
4
|
+
* Parses the Codex CLI rollout transcript: one JSON object per line
|
|
5
|
+
* (`rollout-*.jsonl`, e.g. `~/.codex/sessions/2026/08/01/rollout-….jsonl`).
|
|
6
|
+
* This is Codex's own observable transcript format; the file the user passes is
|
|
7
|
+
* treated as an explicit export and is only read.
|
|
8
|
+
*
|
|
9
|
+
* Strictness contract: records that fail to parse or lack required fields are
|
|
10
|
+
* quarantined with deterministic digests — never silently dropped. Unknown
|
|
11
|
+
* record/event types are mapped when their payload shape is recognized and
|
|
12
|
+
* quarantined otherwise.
|
|
13
|
+
*/
|
|
14
|
+
import type { ImportedConversation, ImportQuarantineRecord, SessionImportCounts } from "./types";
|
|
15
|
+
export interface CodexParseResult {
|
|
16
|
+
conversation: ImportedConversation;
|
|
17
|
+
quarantine: ImportQuarantineRecord[];
|
|
18
|
+
counts: SessionImportCounts;
|
|
19
|
+
redactionKinds: string[];
|
|
20
|
+
}
|
|
21
|
+
/** Parse a Codex rollout JSONL transcript into the provider-neutral IR. */
|
|
22
|
+
export declare function parseCodexRollout(text: string): CodexParseResult;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type SessionDestinationInput } from "../session/session-manager";
|
|
2
|
+
import { type PreparedSessionImport, type SessionImportCompleted, type SessionImportProviderId } from "./types";
|
|
3
|
+
/** Bumped when normalization/rendering changes; persisted in provenance. */
|
|
4
|
+
export declare const EXTERNAL_IMPORT_CONVERTER_VERSION = 1;
|
|
5
|
+
/** Persisted custom-entry type carrying import provenance (never enters LLM context). */
|
|
6
|
+
export declare const EXTERNAL_IMPORT_PROVENANCE_CUSTOM_TYPE = "session-import";
|
|
7
|
+
/** Persisted custom-message type carrying the reconstructed continuation context. */
|
|
8
|
+
export declare const EXTERNAL_IMPORT_CONTEXT_CUSTOM_TYPE = "session-import";
|
|
9
|
+
/** Hard source size limit; larger exports fail with `content_too_large`. */
|
|
10
|
+
export declare const EXTERNAL_IMPORT_SOURCE_MAX_BYTES: number;
|
|
11
|
+
export interface ExternalSessionImportRequest {
|
|
12
|
+
/** Explicit user-selected transcript/export file. */
|
|
13
|
+
sourcePath: string;
|
|
14
|
+
/** Explicit provider; omitted = deterministic auto-detection. */
|
|
15
|
+
provider?: SessionImportProviderId;
|
|
16
|
+
/** Import-owner workspace (recorded as the new session's cwd). */
|
|
17
|
+
cwd: string;
|
|
18
|
+
/** Session destination; defaults to the workspace's managed session store. */
|
|
19
|
+
destination?: SessionDestinationInput;
|
|
20
|
+
/** Test seam for deterministic provenance timestamps. */
|
|
21
|
+
now?: () => Date;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Phase 1: read, detect, parse, normalize, redact, and bound. Performs no
|
|
25
|
+
* session mutation; safe to run before any session transition.
|
|
26
|
+
*/
|
|
27
|
+
export declare function prepareExternalSessionImport(request: Pick<ExternalSessionImportRequest, "sourcePath" | "provider">): Promise<PreparedSessionImport>;
|
|
28
|
+
/**
|
|
29
|
+
* Phase 2: materialize a prepared import as a NEW GJC session file and verify
|
|
30
|
+
* it reopens as a resumable session. The caller's live session is untouched.
|
|
31
|
+
*/
|
|
32
|
+
export declare function materializeExternalSessionImport(prepared: PreparedSessionImport, options: Pick<ExternalSessionImportRequest, "cwd" | "destination" | "now">): Promise<SessionImportCompleted>;
|
|
33
|
+
/** Full import: prepare + materialize. Never switches the caller's session. */
|
|
34
|
+
export declare function importProviderSessionFile(request: ExternalSessionImportRequest): Promise<SessionImportCompleted>;
|
|
35
|
+
/** Human-facing summary lines for a completed import. */
|
|
36
|
+
export declare function formatProviderSessionImportSummary(result: SessionImportCompleted): string;
|
|
37
|
+
/** Human-facing diagnostic for a failed import. */
|
|
38
|
+
export declare function formatProviderSessionImportError(error: unknown): string;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fail-closed secret redaction for imported session content (issue #3709).
|
|
3
|
+
*
|
|
4
|
+
* Every string that crosses the import boundary passes through
|
|
5
|
+
* {@link redactImportedText}. Patterns are conservative: a false positive costs
|
|
6
|
+
* one `[REDACTED]` span in reconstructed context, a false negative leaks a
|
|
7
|
+
* credential into a new session transcript, so the balance favors redaction.
|
|
8
|
+
*/
|
|
9
|
+
export declare const IMPORT_REDACTED_PLACEHOLDER = "[REDACTED]";
|
|
10
|
+
/** Bumped when patterns change; persisted in import provenance. */
|
|
11
|
+
export declare const IMPORT_SANITIZER_VERSION = 2;
|
|
12
|
+
export interface ImportRedactionResult {
|
|
13
|
+
value: string;
|
|
14
|
+
redacted: number;
|
|
15
|
+
kinds: string[];
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Redact every known credential shape from imported text. The same placeholder
|
|
19
|
+
* is used for all kinds so a partial pattern overlap cannot leak fragments.
|
|
20
|
+
*/
|
|
21
|
+
export declare function redactImportedText(input: string): ImportRedactionResult;
|
|
22
|
+
/** Redact a string, returning only the sanitized value. */
|
|
23
|
+
export declare function sanitizeImportedString(input: string): string;
|