open-multi-agent-kit 0.98.3 → 0.98.5
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 +44 -0
- package/README.md +12 -2
- package/dist/cli/args.d.ts +1 -0
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +14 -0
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/help.d.ts.map +1 -1
- package/dist/cli/help.js +3 -0
- package/dist/cli/help.js.map +1 -1
- package/dist/cli/mcp-attach.d.ts +3 -3
- package/dist/cli/mcp-attach.d.ts.map +1 -1
- package/dist/cli/mcp-attach.js +5 -4
- package/dist/cli/mcp-attach.js.map +1 -1
- package/dist/cli/model-contract.d.ts +5 -0
- package/dist/cli/model-contract.d.ts.map +1 -0
- package/dist/cli/model-contract.js +45 -0
- package/dist/cli/model-contract.js.map +1 -0
- package/dist/commands/adaptorch-doctor-cli.d.ts.map +1 -1
- package/dist/commands/adaptorch-doctor-cli.js +32 -10
- package/dist/commands/adaptorch-doctor-cli.js.map +1 -1
- package/dist/commands/init-cli.d.ts +12 -0
- package/dist/commands/init-cli.d.ts.map +1 -0
- package/dist/commands/init-cli.js +76 -0
- package/dist/commands/init-cli.js.map +1 -0
- package/dist/commands/provider-sync-cli.d.ts +27 -0
- package/dist/commands/provider-sync-cli.d.ts.map +1 -0
- package/dist/commands/provider-sync-cli.js +177 -0
- package/dist/commands/provider-sync-cli.js.map +1 -0
- package/dist/commands/run-command.d.ts +9 -0
- package/dist/commands/run-command.d.ts.map +1 -0
- package/dist/commands/run-command.js +34 -0
- package/dist/commands/run-command.js.map +1 -0
- package/dist/commands/verified-run-cli.d.ts +6 -0
- package/dist/commands/verified-run-cli.d.ts.map +1 -0
- package/dist/commands/verified-run-cli.js +190 -0
- package/dist/commands/verified-run-cli.js.map +1 -0
- package/dist/core/active-skill-state.d.ts +7 -0
- package/dist/core/active-skill-state.d.ts.map +1 -0
- package/dist/core/active-skill-state.js +25 -0
- package/dist/core/active-skill-state.js.map +1 -0
- package/dist/core/agent-session-services.d.ts +10 -1
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +43 -0
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session.d.ts +7 -9
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +91 -126
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/codex-chatgpt-web-bridge.d.ts +99 -0
- package/dist/core/codex-chatgpt-web-bridge.d.ts.map +1 -0
- package/dist/core/codex-chatgpt-web-bridge.js +192 -0
- package/dist/core/codex-chatgpt-web-bridge.js.map +1 -0
- package/dist/core/codex-chatgpt-web-sync.d.ts +50 -0
- package/dist/core/codex-chatgpt-web-sync.d.ts.map +1 -0
- package/dist/core/codex-chatgpt-web-sync.js +119 -0
- package/dist/core/codex-chatgpt-web-sync.js.map +1 -0
- package/dist/core/compaction/compaction-headroom.d.ts +30 -0
- package/dist/core/compaction/compaction-headroom.d.ts.map +1 -0
- package/dist/core/compaction/compaction-headroom.js +48 -0
- package/dist/core/compaction/compaction-headroom.js.map +1 -0
- package/dist/core/compaction/compaction.d.ts +2 -29
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +19 -47
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/compaction/overflow-retry-guard.d.ts +20 -0
- package/dist/core/compaction/overflow-retry-guard.d.ts.map +1 -0
- package/dist/core/compaction/overflow-retry-guard.js +38 -0
- package/dist/core/compaction/overflow-retry-guard.js.map +1 -0
- package/dist/core/context-budget-headroom-types.d.ts.map +1 -1
- package/dist/core/context-budget-headroom-types.js +1 -1
- package/dist/core/context-budget-headroom-types.js.map +1 -1
- package/dist/core/context-budget-token-counter-types.d.ts +27 -0
- package/dist/core/context-budget-token-counter-types.d.ts.map +1 -0
- package/dist/core/context-budget-token-counter-types.js +2 -0
- package/dist/core/context-budget-token-counter-types.js.map +1 -0
- package/dist/core/context-budget-token-counter.d.ts +2 -26
- package/dist/core/context-budget-token-counter.d.ts.map +1 -1
- package/dist/core/context-budget-token-counter.js +2 -0
- package/dist/core/context-budget-token-counter.js.map +1 -1
- package/dist/core/context-budget-v2-scoring.d.ts.map +1 -1
- package/dist/core/context-budget-v2-scoring.js +14 -10
- package/dist/core/context-budget-v2-scoring.js.map +1 -1
- package/dist/core/domain-router.d.ts.map +1 -1
- package/dist/core/domain-router.js +1 -1
- package/dist/core/domain-router.js.map +1 -1
- package/dist/core/grok-harness-dispatch.d.ts +4 -0
- package/dist/core/grok-harness-dispatch.d.ts.map +1 -1
- package/dist/core/grok-harness-dispatch.js +20 -3
- package/dist/core/grok-harness-dispatch.js.map +1 -1
- package/dist/core/grok-harness.d.ts +15 -9
- package/dist/core/grok-harness.d.ts.map +1 -1
- package/dist/core/grok-harness.js +34 -8
- package/dist/core/grok-harness.js.map +1 -1
- package/dist/core/mcp/tools.d.ts +2 -2
- package/dist/core/mcp/tools.d.ts.map +1 -1
- package/dist/core/mcp/tools.js +29 -3
- package/dist/core/mcp/tools.js.map +1 -1
- package/dist/core/model-registry-schema.d.ts +1081 -0
- package/dist/core/model-registry-schema.d.ts.map +1 -0
- package/dist/core/model-registry-schema.js +148 -0
- package/dist/core/model-registry-schema.js.map +1 -0
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +1 -146
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/model-resolver.d.ts +2 -1
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +2 -1
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/prompt-preset.d.ts +1 -1
- package/dist/core/prompt-preset.d.ts.map +1 -1
- package/dist/core/prompt-preset.js +16 -1
- package/dist/core/prompt-preset.js.map +1 -1
- package/dist/core/prompt-settlement.d.ts +4 -3
- package/dist/core/prompt-settlement.d.ts.map +1 -1
- package/dist/core/prompt-settlement.js.map +1 -1
- package/dist/core/provider-display-names.d.ts.map +1 -1
- package/dist/core/provider-display-names.js +1 -0
- package/dist/core/provider-display-names.js.map +1 -1
- package/dist/core/provider-resilience.d.ts +8 -0
- package/dist/core/provider-resilience.d.ts.map +1 -1
- package/dist/core/provider-resilience.js +20 -3
- package/dist/core/provider-resilience.js.map +1 -1
- package/dist/core/provider-usage-types.d.ts +42 -0
- package/dist/core/provider-usage-types.d.ts.map +1 -0
- package/dist/core/provider-usage-types.js +2 -0
- package/dist/core/provider-usage-types.js.map +1 -0
- package/dist/core/provider-usage.d.ts +2 -31
- package/dist/core/provider-usage.d.ts.map +1 -1
- package/dist/core/provider-usage.js +4 -0
- package/dist/core/provider-usage.js.map +1 -1
- package/dist/core/redaction.d.ts.map +1 -1
- package/dist/core/redaction.js +18 -2
- package/dist/core/redaction.js.map +1 -1
- package/dist/core/run-budget-policy.d.ts +18 -0
- package/dist/core/run-budget-policy.d.ts.map +1 -0
- package/dist/core/run-budget-policy.js +52 -0
- package/dist/core/run-budget-policy.js.map +1 -0
- package/dist/core/run-budget.d.ts +33 -0
- package/dist/core/run-budget.d.ts.map +1 -0
- package/dist/core/run-budget.js +89 -0
- package/dist/core/run-budget.js.map +1 -0
- package/dist/core/run-execution-api.d.ts +15 -0
- package/dist/core/run-execution-api.d.ts.map +1 -0
- package/dist/core/run-execution-api.js +7 -0
- package/dist/core/run-execution-api.js.map +1 -0
- package/dist/core/run-journal.d.ts.map +1 -1
- package/dist/core/run-journal.js +30 -208
- package/dist/core/run-journal.js.map +1 -1
- package/dist/core/sandbox/policy-merge.d.ts +6 -0
- package/dist/core/sandbox/policy-merge.d.ts.map +1 -0
- package/dist/core/sandbox/policy-merge.js +74 -0
- package/dist/core/sandbox/policy-merge.js.map +1 -0
- package/dist/core/sandbox/policy-paths.d.ts +4 -0
- package/dist/core/sandbox/policy-paths.d.ts.map +1 -0
- package/dist/core/sandbox/policy-paths.js +21 -0
- package/dist/core/sandbox/policy-paths.js.map +1 -0
- package/dist/core/sandbox/policy-types.d.ts +75 -0
- package/dist/core/sandbox/policy-types.d.ts.map +1 -0
- package/dist/core/sandbox/policy-types.js +2 -0
- package/dist/core/sandbox/policy-types.js.map +1 -0
- package/dist/core/sandbox/policy.d.ts +3 -77
- package/dist/core/sandbox/policy.d.ts.map +1 -1
- package/dist/core/sandbox/policy.js +3 -98
- package/dist/core/sandbox/policy.js.map +1 -1
- package/dist/core/sdk-provider-stream.d.ts +14 -0
- package/dist/core/sdk-provider-stream.d.ts.map +1 -0
- package/dist/core/sdk-provider-stream.js +38 -0
- package/dist/core/sdk-provider-stream.js.map +1 -0
- package/dist/core/sdk.d.ts +5 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +17 -33
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-bash-service.d.ts +2 -2
- package/dist/core/session-bash-service.d.ts.map +1 -1
- package/dist/core/session-bash-service.js +21 -9
- package/dist/core/session-bash-service.js.map +1 -1
- package/dist/core/session-failure-cause.d.ts.map +1 -1
- package/dist/core/session-failure-cause.js +15 -3
- package/dist/core/session-failure-cause.js.map +1 -1
- package/dist/core/session-prompt-lifecycle.d.ts +25 -0
- package/dist/core/session-prompt-lifecycle.d.ts.map +1 -0
- package/dist/core/session-prompt-lifecycle.js +87 -0
- package/dist/core/session-prompt-lifecycle.js.map +1 -0
- package/dist/core/session-run-budget.d.ts +28 -0
- package/dist/core/session-run-budget.d.ts.map +1 -0
- package/dist/core/session-run-budget.js +127 -0
- package/dist/core/session-run-budget.js.map +1 -0
- package/dist/core/session-run-termination.d.ts +18 -0
- package/dist/core/session-run-termination.d.ts.map +1 -0
- package/dist/core/session-run-termination.js +72 -0
- package/dist/core/session-run-termination.js.map +1 -0
- package/dist/core/session-termination-types.d.ts +97 -0
- package/dist/core/session-termination-types.d.ts.map +1 -0
- package/dist/core/session-termination-types.js +26 -0
- package/dist/core/session-termination-types.js.map +1 -0
- package/dist/core/session-termination.d.ts +3 -97
- package/dist/core/session-termination.d.ts.map +1 -1
- package/dist/core/session-termination.js +25 -29
- package/dist/core/session-termination.js.map +1 -1
- package/dist/core/skill-selector.d.ts +40 -0
- package/dist/core/skill-selector.d.ts.map +1 -0
- package/dist/core/skill-selector.js +102 -0
- package/dist/core/skill-selector.js.map +1 -0
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +1 -0
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/subagent-lane-launcher.d.ts +3 -2
- package/dist/core/subagent-lane-launcher.d.ts.map +1 -1
- package/dist/core/subagent-lane-launcher.js +24 -13
- package/dist/core/subagent-lane-launcher.js.map +1 -1
- package/dist/core/tools/render-utils.d.ts.map +1 -1
- package/dist/core/tools/render-utils.js +2 -4
- package/dist/core/tools/render-utils.js.map +1 -1
- package/dist/core/turn-metrics-record.d.ts +55 -0
- package/dist/core/turn-metrics-record.d.ts.map +1 -0
- package/dist/core/turn-metrics-record.js +149 -0
- package/dist/core/turn-metrics-record.js.map +1 -0
- package/dist/core/turn-metrics.d.ts +4 -56
- package/dist/core/turn-metrics.d.ts.map +1 -1
- package/dist/core/turn-metrics.js +12 -60
- package/dist/core/turn-metrics.js.map +1 -1
- package/dist/core/verified-run/broker.d.ts +26 -0
- package/dist/core/verified-run/broker.d.ts.map +1 -0
- package/dist/core/verified-run/broker.js +210 -0
- package/dist/core/verified-run/broker.js.map +1 -0
- package/dist/core/verified-run/candidate.d.ts +24 -0
- package/dist/core/verified-run/candidate.d.ts.map +1 -0
- package/dist/core/verified-run/candidate.js +167 -0
- package/dist/core/verified-run/candidate.js.map +1 -0
- package/dist/core/verified-run/check-receipt.d.ts +18 -0
- package/dist/core/verified-run/check-receipt.d.ts.map +1 -0
- package/dist/core/verified-run/check-receipt.js +92 -0
- package/dist/core/verified-run/check-receipt.js.map +1 -0
- package/dist/core/verified-run/coordinator.d.ts +39 -0
- package/dist/core/verified-run/coordinator.d.ts.map +1 -0
- package/dist/core/verified-run/coordinator.js +190 -0
- package/dist/core/verified-run/coordinator.js.map +1 -0
- package/dist/core/verified-run/dag-candidates.d.ts +8 -0
- package/dist/core/verified-run/dag-candidates.d.ts.map +1 -0
- package/dist/core/verified-run/dag-candidates.js +65 -0
- package/dist/core/verified-run/dag-candidates.js.map +1 -0
- package/dist/core/verified-run/dag-phase.d.ts +7 -0
- package/dist/core/verified-run/dag-phase.d.ts.map +1 -0
- package/dist/core/verified-run/dag-phase.js +92 -0
- package/dist/core/verified-run/dag-phase.js.map +1 -0
- package/dist/core/verified-run/dag-projection.d.ts +7 -0
- package/dist/core/verified-run/dag-projection.d.ts.map +1 -0
- package/dist/core/verified-run/dag-projection.js +90 -0
- package/dist/core/verified-run/dag-projection.js.map +1 -0
- package/dist/core/verified-run/dag-recovery.d.ts +13 -0
- package/dist/core/verified-run/dag-recovery.d.ts.map +1 -0
- package/dist/core/verified-run/dag-recovery.js +98 -0
- package/dist/core/verified-run/dag-recovery.js.map +1 -0
- package/dist/core/verified-run/dag-retry-projection.d.ts +9 -0
- package/dist/core/verified-run/dag-retry-projection.d.ts.map +1 -0
- package/dist/core/verified-run/dag-retry-projection.js +43 -0
- package/dist/core/verified-run/dag-retry-projection.js.map +1 -0
- package/dist/core/verified-run/dag-types.d.ts +47 -0
- package/dist/core/verified-run/dag-types.d.ts.map +1 -0
- package/dist/core/verified-run/dag-types.js +2 -0
- package/dist/core/verified-run/dag-types.js.map +1 -0
- package/dist/core/verified-run/event-parser.d.ts +3 -0
- package/dist/core/verified-run/event-parser.d.ts.map +1 -0
- package/dist/core/verified-run/event-parser.js +153 -0
- package/dist/core/verified-run/event-parser.js.map +1 -0
- package/dist/core/verified-run/events.d.ts +4 -0
- package/dist/core/verified-run/events.d.ts.map +1 -0
- package/dist/core/verified-run/events.js +3 -0
- package/dist/core/verified-run/events.js.map +1 -0
- package/dist/core/verified-run/evidence-binding.d.ts +18 -0
- package/dist/core/verified-run/evidence-binding.d.ts.map +1 -0
- package/dist/core/verified-run/evidence-binding.js +81 -0
- package/dist/core/verified-run/evidence-binding.js.map +1 -0
- package/dist/core/verified-run/evidence.d.ts +27 -0
- package/dist/core/verified-run/evidence.d.ts.map +1 -0
- package/dist/core/verified-run/evidence.js +100 -0
- package/dist/core/verified-run/evidence.js.map +1 -0
- package/dist/core/verified-run/journal.d.ts +32 -0
- package/dist/core/verified-run/journal.d.ts.map +1 -0
- package/dist/core/verified-run/journal.js +103 -0
- package/dist/core/verified-run/journal.js.map +1 -0
- package/dist/core/verified-run/namespace-identity.d.ts +11 -0
- package/dist/core/verified-run/namespace-identity.d.ts.map +1 -0
- package/dist/core/verified-run/namespace-identity.js +77 -0
- package/dist/core/verified-run/namespace-identity.js.map +1 -0
- package/dist/core/verified-run/owned-execution.d.ts +21 -0
- package/dist/core/verified-run/owned-execution.d.ts.map +1 -0
- package/dist/core/verified-run/owned-execution.js +43 -0
- package/dist/core/verified-run/owned-execution.js.map +1 -0
- package/dist/core/verified-run/phase-context.d.ts +9 -0
- package/dist/core/verified-run/phase-context.d.ts.map +1 -0
- package/dist/core/verified-run/phase-context.js +2 -0
- package/dist/core/verified-run/phase-context.js.map +1 -0
- package/dist/core/verified-run/process-gate.d.ts +5 -0
- package/dist/core/verified-run/process-gate.d.ts.map +1 -0
- package/dist/core/verified-run/process-gate.js +31 -0
- package/dist/core/verified-run/process-gate.js.map +1 -0
- package/dist/core/verified-run/projection.d.ts +4 -0
- package/dist/core/verified-run/projection.d.ts.map +1 -0
- package/dist/core/verified-run/projection.js +219 -0
- package/dist/core/verified-run/projection.js.map +1 -0
- package/dist/core/verified-run/recovery-clock.d.ts +19 -0
- package/dist/core/verified-run/recovery-clock.d.ts.map +1 -0
- package/dist/core/verified-run/recovery-clock.js +69 -0
- package/dist/core/verified-run/recovery-clock.js.map +1 -0
- package/dist/core/verified-run/recovery-command.d.ts +11 -0
- package/dist/core/verified-run/recovery-command.d.ts.map +1 -0
- package/dist/core/verified-run/recovery-command.js +73 -0
- package/dist/core/verified-run/recovery-command.js.map +1 -0
- package/dist/core/verified-run/recovery-projection.d.ts +12 -0
- package/dist/core/verified-run/recovery-projection.d.ts.map +1 -0
- package/dist/core/verified-run/recovery-projection.js +88 -0
- package/dist/core/verified-run/recovery-projection.js.map +1 -0
- package/dist/core/verified-run/recovery.d.ts +12 -0
- package/dist/core/verified-run/recovery.d.ts.map +1 -0
- package/dist/core/verified-run/recovery.js +115 -0
- package/dist/core/verified-run/recovery.js.map +1 -0
- package/dist/core/verified-run/run-types.d.ts +103 -0
- package/dist/core/verified-run/run-types.d.ts.map +1 -0
- package/dist/core/verified-run/run-types.js +2 -0
- package/dist/core/verified-run/run-types.js.map +1 -0
- package/dist/core/verified-run/scripted-writer.d.ts +15 -0
- package/dist/core/verified-run/scripted-writer.d.ts.map +1 -0
- package/dist/core/verified-run/scripted-writer.js +94 -0
- package/dist/core/verified-run/scripted-writer.js.map +1 -0
- package/dist/core/verified-run/session-port.d.ts +27 -0
- package/dist/core/verified-run/session-port.d.ts.map +1 -0
- package/dist/core/verified-run/session-port.js +2 -0
- package/dist/core/verified-run/session-port.js.map +1 -0
- package/dist/core/verified-run/storage.d.ts +15 -0
- package/dist/core/verified-run/storage.d.ts.map +1 -0
- package/dist/core/verified-run/storage.js +96 -0
- package/dist/core/verified-run/storage.js.map +1 -0
- package/dist/core/verified-run/verification-phase.d.ts +5 -0
- package/dist/core/verified-run/verification-phase.d.ts.map +1 -0
- package/dist/core/verified-run/verification-phase.js +56 -0
- package/dist/core/verified-run/verification-phase.js.map +1 -0
- package/dist/core/verified-run/work-recovery.d.ts +8 -0
- package/dist/core/verified-run/work-recovery.d.ts.map +1 -0
- package/dist/core/verified-run/work-recovery.js +44 -0
- package/dist/core/verified-run/work-recovery.js.map +1 -0
- package/dist/core/verified-run/writer-completion.d.ts +4 -0
- package/dist/core/verified-run/writer-completion.d.ts.map +1 -0
- package/dist/core/verified-run/writer-completion.js +27 -0
- package/dist/core/verified-run/writer-completion.js.map +1 -0
- package/dist/core/verified-run/writer-phase.d.ts +8 -0
- package/dist/core/verified-run/writer-phase.d.ts.map +1 -0
- package/dist/core/verified-run/writer-phase.js +76 -0
- package/dist/core/verified-run/writer-phase.js.map +1 -0
- package/dist/core/verified-run/writer-projection.d.ts +11 -0
- package/dist/core/verified-run/writer-projection.d.ts.map +1 -0
- package/dist/core/verified-run/writer-projection.js +70 -0
- package/dist/core/verified-run/writer-projection.js.map +1 -0
- package/dist/core/verified-run/writer-recovery.d.ts +16 -0
- package/dist/core/verified-run/writer-recovery.d.ts.map +1 -0
- package/dist/core/verified-run/writer-recovery.js +107 -0
- package/dist/core/verified-run/writer-recovery.js.map +1 -0
- package/dist/core/workload-permit-pool.d.ts +1 -3
- package/dist/core/workload-permit-pool.d.ts.map +1 -1
- package/dist/core/workload-permit-pool.js +11 -11
- package/dist/core/workload-permit-pool.js.map +1 -1
- package/dist/guardrails/evidence-system.d.ts +1 -1
- package/dist/guardrails/evidence-system.d.ts.map +1 -1
- package/dist/guardrails/evidence-system.js +18 -29
- package/dist/guardrails/evidence-system.js.map +1 -1
- package/dist/guardrails/merge-gate-result.d.ts +4 -0
- package/dist/guardrails/merge-gate-result.d.ts.map +1 -0
- package/dist/guardrails/merge-gate-result.js +32 -0
- package/dist/guardrails/merge-gate-result.js.map +1 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +17 -23
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/session-failure.d.ts +13 -0
- package/dist/modes/interactive/components/session-failure.d.ts.map +1 -0
- package/dist/modes/interactive/components/session-failure.js +81 -0
- package/dist/modes/interactive/components/session-failure.js.map +1 -0
- package/dist/modes/interactive/interactive-login-options.d.ts +27 -0
- package/dist/modes/interactive/interactive-login-options.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-login-options.js +54 -0
- package/dist/modes/interactive/interactive-login-options.js.map +1 -0
- package/dist/modes/interactive/interactive-mode.d.ts +8 -4
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +183 -171
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/interactive-resume-command.d.ts +3 -0
- package/dist/modes/interactive/interactive-resume-command.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-resume-command.js +24 -0
- package/dist/modes/interactive/interactive-resume-command.js.map +1 -0
- package/dist/modes/interactive/interactive-tool-result.d.ts +32 -0
- package/dist/modes/interactive/interactive-tool-result.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-tool-result.js +59 -0
- package/dist/modes/interactive/interactive-tool-result.js.map +1 -0
- package/dist/modes/interactive/tui-diagnostics.d.ts +36 -0
- package/dist/modes/interactive/tui-diagnostics.d.ts.map +1 -0
- package/dist/modes/interactive/tui-diagnostics.js +105 -0
- package/dist/modes/interactive/tui-diagnostics.js.map +1 -0
- package/dist/modes/interactive/tui-runtime-info.d.ts +20 -0
- package/dist/modes/interactive/tui-runtime-info.d.ts.map +1 -0
- package/dist/modes/interactive/tui-runtime-info.js +76 -0
- package/dist/modes/interactive/tui-runtime-info.js.map +1 -0
- package/dist/modes/print-mode.d.ts.map +1 -1
- package/dist/modes/print-mode.js +22 -0
- package/dist/modes/print-mode.js.map +1 -1
- package/dist/utils/clipboard-image.d.ts.map +1 -1
- package/dist/utils/clipboard-image.js +10 -60
- package/dist/utils/clipboard-image.js.map +1 -1
- package/dist/utils/terminal-links.d.ts +13 -0
- package/dist/utils/terminal-links.d.ts.map +1 -0
- package/dist/utils/terminal-links.js +68 -0
- package/dist/utils/terminal-links.js.map +1 -0
- package/dist/utils/windows-clipboard-image.d.ts +16 -0
- package/dist/utils/windows-clipboard-image.d.ts.map +1 -0
- package/dist/utils/windows-clipboard-image.js +87 -0
- package/dist/utils/windows-clipboard-image.js.map +1 -0
- package/docs/adaptorch-onboarding.md +80 -0
- package/docs/containerization.md +12 -0
- package/docs/context-files.md +97 -0
- package/docs/correctness-wall.md +8 -0
- package/docs/custom-provider.md +35 -0
- package/docs/development.md +28 -3
- package/docs/environment-variables.md +2 -0
- package/docs/grok-harness.md +4 -0
- package/docs/harness-boundaries.md +154 -0
- package/docs/harness-improvements.md +90 -0
- package/docs/json.md +19 -0
- package/docs/keybindings.md +2 -2
- package/docs/mcp.md +22 -2
- package/docs/metrics.md +66 -16
- package/docs/model-catalog-refresh.md +190 -0
- package/docs/model-contract.md +168 -0
- package/docs/models.md +21 -4
- package/docs/provider-resilience.md +5 -3
- package/docs/providers.md +68 -1
- package/docs/quickstart.md +4 -0
- package/docs/release-audit-0.98.4.md +112 -0
- package/docs/release-audit-0.98.5.md +84 -0
- package/docs/review-bundle-followup.md +195 -0
- package/docs/run-protocol.md +33 -1
- package/docs/runtime-algorithms.md +45 -0
- package/docs/sdk.md +204 -2
- package/docs/sessions.md +1 -1
- package/docs/settings.md +17 -1
- package/docs/skills.md +2 -0
- package/docs/tb21-audit.md +131 -0
- package/docs/terminal-setup.md +20 -0
- package/docs/usage.md +77 -1
- package/docs/verified-run-testing.md +417 -0
- package/docs/verified-run.md +388 -0
- package/docs/windows.md +48 -0
- package/examples/README.md +4 -0
- package/examples/context/AGENTS.md +64 -0
- package/examples/context/CLAUDE.md +17 -0
- package/examples/context/INTERNET.md +42 -0
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/gondolin/package-lock.json +2 -2
- package/examples/extensions/gondolin/package.json +1 -1
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/npm-shrinkwrap.json +18 -18
- package/package.json +6 -6
|
@@ -24,6 +24,7 @@ import { stripFrontmatter } from "../utils/frontmatter.js";
|
|
|
24
24
|
import { resolvePath } from "../utils/paths.js";
|
|
25
25
|
import { getShellConfig } from "../utils/shell.js";
|
|
26
26
|
import { sleep } from "../utils/sleep.js";
|
|
27
|
+
import { addActiveSkills, createActiveSkillState } from "./active-skill-state.js";
|
|
27
28
|
import { createAdaptorchBridge } from "./adaptorch-bridge.js";
|
|
28
29
|
import { applyCategoryTimeoutDefaults, resolveAgentToolSettings, resolveToolTimeoutCategory, } from "./agent-tool-settings.js";
|
|
29
30
|
import { formatNoApiKeyFoundMessage, formatNoModelSelectedMessage } from "./auth-guidance.js";
|
|
@@ -43,7 +44,7 @@ import { exportSessionToHtml } from "./export-html/index.js";
|
|
|
43
44
|
import { createToolHtmlRenderer } from "./export-html/tool-renderer.js";
|
|
44
45
|
import { ExtensionRunner, wrapRegisteredTools, } from "./extensions/index.js";
|
|
45
46
|
import { emitSessionShutdownEvent } from "./extensions/runner.js";
|
|
46
|
-
import { assertTextChatModelForCompletion } from "./grok-harness.js";
|
|
47
|
+
import { assertTextChatModelForCompletion, grokHarnessAutoApplyEnabled, isGrokOAuthProvider, selectGrokHarnessSkills, } from "./grok-harness.js";
|
|
47
48
|
import { grokPlaybookAppendForProvider } from "./grok-playbook.js";
|
|
48
49
|
import { captureHostResourceSnapshot } from "./host-resource-snapshot.js";
|
|
49
50
|
import { decideLoadoutAccess } from "./loadout-access-policy.js";
|
|
@@ -102,14 +103,18 @@ import { resolveResourceGovernorSettings } from "./resource-governor-settings.js
|
|
|
102
103
|
import { admissionObservationFacts, classificationObservationFacts, ResourceObservationJournal, settledObservationFacts, snapshotObservationFacts, soundObservationFacts, } from "./resource-observation-journal.js";
|
|
103
104
|
import { decideResourceSafetyGate, RESOURCE_PRESSURE_REQUIRED_ACTION } from "./resource-safety-gate.js";
|
|
104
105
|
import { appendRouterFeedbackRecord, ROUTER_FEEDBACK_LEVELS, } from "./router-feedback-collector.js";
|
|
106
|
+
import { RunBudgetExceededError, RunBudgetPolicyError } from "./run-budget-policy.js";
|
|
105
107
|
import { RunJournalStore } from "./run-journal-store.js";
|
|
106
108
|
import { RunResourceLeaseController } from "./run-resource-lease.js";
|
|
107
109
|
import { SessionBashRuntime } from "./session-bash-runtime.js";
|
|
108
110
|
import { SessionBashService } from "./session-bash-service.js";
|
|
109
111
|
import { SessionCompactionService } from "./session-compaction-service.js";
|
|
110
|
-
import { preflightFailureCause,
|
|
112
|
+
import { preflightFailureCause, runtimeFailureCause, terminationMessage } from "./session-failure-cause.js";
|
|
111
113
|
import { CURRENT_SESSION_VERSION, getLatestCompactionEntry } from "./session-manager.js";
|
|
112
114
|
import { acquireSessionOwnerLeaseSync } from "./session-owner-lease.js";
|
|
115
|
+
import { PromptExecutionBusyError, SessionPromptLifecycle } from "./session-prompt-lifecycle.js";
|
|
116
|
+
import { SessionRunBudget } from "./session-run-budget.js";
|
|
117
|
+
import { classifyRunTermination } from "./session-run-termination.js";
|
|
113
118
|
import { assembleSessionSystemPrompt } from "./session-system-prompt.js";
|
|
114
119
|
import { classifySessionTermination, } from "./session-termination.js";
|
|
115
120
|
import { createSyntheticSourceInfo } from "./source-info.js";
|
|
@@ -136,17 +141,6 @@ export function parseSkillBlock(text) {
|
|
|
136
141
|
userMessage: match[4]?.trim() || undefined,
|
|
137
142
|
};
|
|
138
143
|
}
|
|
139
|
-
function mergePromptActiveSkillNames(first, second) {
|
|
140
|
-
const names = [];
|
|
141
|
-
const seen = new Set();
|
|
142
|
-
for (const name of [...first, ...second]) {
|
|
143
|
-
if (!seen.has(name)) {
|
|
144
|
-
seen.add(name);
|
|
145
|
-
names.push(name);
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
return names;
|
|
149
|
-
}
|
|
150
144
|
const PENDING_TOOL_RESULT_TOKENS = {
|
|
151
145
|
text: 1024,
|
|
152
146
|
image: 4096,
|
|
@@ -226,6 +220,11 @@ export class AgentSession {
|
|
|
226
220
|
// Event subscription state
|
|
227
221
|
_unsubscribeAgent;
|
|
228
222
|
_eventListeners = [];
|
|
223
|
+
_runBudget;
|
|
224
|
+
_promptLifecycle = new SessionPromptLifecycle({
|
|
225
|
+
canSettle: () => !this.isStreaming && !this.agent.hasQueuedMessages(),
|
|
226
|
+
auditsLateSettlement: () => this.agent.toolExecutionPolicy?.lateSettlement !== "ignore",
|
|
227
|
+
});
|
|
229
228
|
_messageEndReplacements = new WeakMap();
|
|
230
229
|
/** Tracks pending steering messages for UI display. Removed when delivered. */
|
|
231
230
|
_steeringMessages = [];
|
|
@@ -322,6 +321,21 @@ export class AgentSession {
|
|
|
322
321
|
_promptCacheLastBreakReason;
|
|
323
322
|
constructor(config) {
|
|
324
323
|
this.agent = config.agent;
|
|
324
|
+
this._runBudget = new SessionRunBudget(this.agent, {
|
|
325
|
+
assertIdle: () => {
|
|
326
|
+
this._promptLifecycle.assertIdle();
|
|
327
|
+
if (this.isRetrying || this.isCompacting || this._branchSummaryAbortController)
|
|
328
|
+
throw new PromptExecutionBusyError();
|
|
329
|
+
},
|
|
330
|
+
stop: (error) => {
|
|
331
|
+
this._pendingRuntimeTerminationCause = { area: "budget", code: error.code };
|
|
332
|
+
this.agent.abort();
|
|
333
|
+
this.abortRetry();
|
|
334
|
+
this.abortCompaction();
|
|
335
|
+
this.abortBranchSummary();
|
|
336
|
+
},
|
|
337
|
+
reject: (error) => this._publishRuntimeFailure(error),
|
|
338
|
+
});
|
|
325
339
|
this.sessionManager = config.sessionManager;
|
|
326
340
|
this.settingsManager = config.settingsManager;
|
|
327
341
|
this._scopedModels = config.scopedModels ?? [];
|
|
@@ -515,64 +529,6 @@ export class AgentSession {
|
|
|
515
529
|
});
|
|
516
530
|
this._appendReplayEvent(event, details);
|
|
517
531
|
}
|
|
518
|
-
_classifyRunTermination(runId, event) {
|
|
519
|
-
const timestamp = new Date().toISOString();
|
|
520
|
-
let assistant;
|
|
521
|
-
for (let index = event.messages.length - 1; index >= 0; index -= 1) {
|
|
522
|
-
const message = event.messages[index];
|
|
523
|
-
if (message?.role === "assistant") {
|
|
524
|
-
assistant = message;
|
|
525
|
-
break;
|
|
526
|
-
}
|
|
527
|
-
}
|
|
528
|
-
let cause;
|
|
529
|
-
let message;
|
|
530
|
-
let sideEffects = this._sessionRiskLevel === "elevated" ? "possible" : "none";
|
|
531
|
-
let toolCallId;
|
|
532
|
-
let toolName;
|
|
533
|
-
if (this._activeRunToolTermination) {
|
|
534
|
-
cause = { area: "tool", code: "timeout" };
|
|
535
|
-
message = `Tool ${this._activeRunToolTermination.toolName} timed out.`;
|
|
536
|
-
toolCallId = this._activeRunToolTermination.toolCallId;
|
|
537
|
-
toolName = this._activeRunToolTermination.toolName;
|
|
538
|
-
sideEffects = this._activeRunToolTermination.executionStarted ? "possible" : sideEffects;
|
|
539
|
-
}
|
|
540
|
-
else if (!assistant) {
|
|
541
|
-
cause = { area: "internal", code: "unclassified" };
|
|
542
|
-
message = "Agent run ended without an assistant result.";
|
|
543
|
-
}
|
|
544
|
-
else if (assistant.stopReason === "aborted") {
|
|
545
|
-
cause = this._userAbortRequested ? { area: "user", code: "abort" } : { area: "provider", code: "abort" };
|
|
546
|
-
message = terminationMessage(assistant.errorMessage, this._userAbortRequested ? "The user aborted the run." : "The provider aborted the run.");
|
|
547
|
-
}
|
|
548
|
-
else if (assistant.stopReason === "error") {
|
|
549
|
-
cause = providerFailureCause(assistant, this.model?.contextWindow ?? 0);
|
|
550
|
-
message = terminationMessage(assistant.errorMessage, "The provider request failed.");
|
|
551
|
-
}
|
|
552
|
-
else {
|
|
553
|
-
cause = { area: "completed" };
|
|
554
|
-
message = "Run completed.";
|
|
555
|
-
}
|
|
556
|
-
let provider = this.model?.provider;
|
|
557
|
-
if (assistant?.provider)
|
|
558
|
-
provider = assistant.provider;
|
|
559
|
-
let model = this.model?.id;
|
|
560
|
-
if (assistant?.model)
|
|
561
|
-
model = assistant.model;
|
|
562
|
-
return classifySessionTermination({
|
|
563
|
-
sessionId: this.sessionId,
|
|
564
|
-
runId,
|
|
565
|
-
timestamp,
|
|
566
|
-
source: "observed",
|
|
567
|
-
message,
|
|
568
|
-
cause,
|
|
569
|
-
sideEffects,
|
|
570
|
-
...(provider ? { provider } : {}),
|
|
571
|
-
...(model ? { model } : {}),
|
|
572
|
-
...(toolCallId ? { toolCallId } : {}),
|
|
573
|
-
...(toolName ? { toolName } : {}),
|
|
574
|
-
});
|
|
575
|
-
}
|
|
576
532
|
_publishTermination(termination) {
|
|
577
533
|
this._lastTermination = termination;
|
|
578
534
|
this._emit({ type: "session_termination", termination });
|
|
@@ -647,11 +603,23 @@ export class AgentSession {
|
|
|
647
603
|
}
|
|
648
604
|
return;
|
|
649
605
|
}
|
|
606
|
+
if (event.type === "provider_denied" && event.deniedReason === "contract-violation") {
|
|
607
|
+
this._pendingRuntimeTerminationCause = { area: "configuration", code: "invalid" };
|
|
608
|
+
}
|
|
650
609
|
if (event.type !== "agent_end")
|
|
651
610
|
return;
|
|
652
611
|
if (this._activeRunId === null)
|
|
653
612
|
throw new Error("run journal received agent_end without run_started");
|
|
654
|
-
const termination =
|
|
613
|
+
const termination = classifyRunTermination(event.messages, {
|
|
614
|
+
sessionId: this.sessionId,
|
|
615
|
+
runId: this._activeRunId,
|
|
616
|
+
timestamp: new Date().toISOString(),
|
|
617
|
+
model: this.model,
|
|
618
|
+
elevatedRisk: this._sessionRiskLevel === "elevated",
|
|
619
|
+
userAbortRequested: this._userAbortRequested,
|
|
620
|
+
pendingCause: this._pendingRuntimeTerminationCause,
|
|
621
|
+
toolTimeout: this._activeRunToolTermination,
|
|
622
|
+
});
|
|
655
623
|
try {
|
|
656
624
|
this._runJournalStore.finish({
|
|
657
625
|
termination,
|
|
@@ -743,6 +711,7 @@ export class AgentSession {
|
|
|
743
711
|
throw new Error(formatNoApiKeyFoundMessage(model.provider));
|
|
744
712
|
}
|
|
745
713
|
async _getCompactionRequestAuth(model) {
|
|
714
|
+
this._runBudget.assertAdmission();
|
|
746
715
|
const options = { minRemainingMs: COMPACTION_MIN_TOKEN_VALIDITY_MS };
|
|
747
716
|
if (isBuiltinStreamFn(this.agent.streamFn)) {
|
|
748
717
|
return this._getRequiredRequestAuth(model, options);
|
|
@@ -897,6 +866,8 @@ export class AgentSession {
|
|
|
897
866
|
}
|
|
898
867
|
}
|
|
899
868
|
}
|
|
869
|
+
if (event.type === "tool_execution_late_settlement")
|
|
870
|
+
this._promptLifecycle.flush();
|
|
900
871
|
};
|
|
901
872
|
_willRetryAfterAgentEnd(event) {
|
|
902
873
|
const settings = this.settingsManager.getRetrySettings();
|
|
@@ -1164,6 +1135,8 @@ export class AgentSession {
|
|
|
1164
1135
|
* Call this when completely done with the session.
|
|
1165
1136
|
*/
|
|
1166
1137
|
dispose() {
|
|
1138
|
+
this._promptLifecycle.dispose();
|
|
1139
|
+
this._runBudget.close();
|
|
1167
1140
|
try {
|
|
1168
1141
|
try {
|
|
1169
1142
|
this.abortRetry();
|
|
@@ -1290,7 +1263,7 @@ export class AgentSession {
|
|
|
1290
1263
|
for (const name of desiredToolNames) {
|
|
1291
1264
|
const tool = this._toolRegistry.get(name);
|
|
1292
1265
|
if (tool) {
|
|
1293
|
-
tools.push(tool);
|
|
1266
|
+
tools.push(this._promptLifecycle.wrapTool(tool));
|
|
1294
1267
|
validToolNames.push(name);
|
|
1295
1268
|
}
|
|
1296
1269
|
else if (lockedToolNames?.includes(name)) {
|
|
@@ -1515,13 +1488,14 @@ export class AgentSession {
|
|
|
1515
1488
|
// One identity per top-level run (§16.2): internal retries and
|
|
1516
1489
|
// continuations inside this call share it, as does the resource lease.
|
|
1517
1490
|
const promptRunId = `prompt-run-${randomUUID()}`;
|
|
1518
|
-
const
|
|
1491
|
+
const ownedRun = this._promptLifecycle.begin(promptRunId);
|
|
1519
1492
|
// Roadmap M2: the lease spans the whole run including internal retries
|
|
1520
1493
|
// and continuations, so they share one admission decision (§8.3).
|
|
1521
1494
|
const resourceLease = await this._beginResourceGovernedRun(promptRunId);
|
|
1522
1495
|
const resourceObservations = this._resourceObservationJournals.get(promptRunId) ?? null;
|
|
1523
1496
|
let outcome = "completed";
|
|
1524
1497
|
try {
|
|
1498
|
+
this._runBudget.assertActive();
|
|
1525
1499
|
await this.agent.prompt(messages);
|
|
1526
1500
|
while (await this._handlePostAgentRun()) {
|
|
1527
1501
|
await this.agent.continue();
|
|
@@ -1533,43 +1507,18 @@ export class AgentSession {
|
|
|
1533
1507
|
throw error;
|
|
1534
1508
|
}
|
|
1535
1509
|
finally {
|
|
1510
|
+
if (this._runBudget.failure && this._lastTermination?.kind !== "budget_exhausted")
|
|
1511
|
+
this._publishRuntimeFailure(this._runBudget.failure);
|
|
1536
1512
|
outcome = promptSettlement.resolvePromptSettlementOutcome(outcome, this._lastTermination?.kind);
|
|
1537
|
-
if (resourceLease !== null) {
|
|
1538
|
-
// Generation-safe: a stale release after another run acquired the
|
|
1539
|
-
// lease is a no-op instead of clobbering the newer cap (§8.1).
|
|
1540
|
-
this._resourceLeaseController?.release(resourceLease);
|
|
1541
|
-
resourceObservations?.record("resource_lease_released_v1", { promptRunId });
|
|
1542
|
-
}
|
|
1543
1513
|
this._flushPendingBashMessages();
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
* conservatively — the continuation run settles under its own id.
|
|
1553
|
-
* Settlement is a UX signal only and must never affect the run (§16.1).
|
|
1554
|
-
*/
|
|
1555
|
-
_emitPromptSettledIfReady(input) {
|
|
1556
|
-
try {
|
|
1557
|
-
let state = promptSettlement.createPromptSettlementState(input.promptRunId, input.startedAtEpochMs);
|
|
1558
|
-
state = promptSettlement.reducePromptSettlement(state, { kind: "terminal", outcome: input.outcome });
|
|
1559
|
-
if (this.isStreaming) {
|
|
1560
|
-
state = promptSettlement.reducePromptSettlement(state, { kind: "tool", delta: 1 });
|
|
1561
|
-
}
|
|
1562
|
-
if (this.agent.hasQueuedMessages()) {
|
|
1563
|
-
state = promptSettlement.reducePromptSettlement(state, { kind: "continuation", delta: 1 });
|
|
1564
|
-
}
|
|
1565
|
-
const settled = promptSettlement.settlePromptIfReady(state, Date.now());
|
|
1566
|
-
if (settled.event !== null) {
|
|
1567
|
-
input.resourceObservations?.record("prompt_settled_v1", settledObservationFacts(settled.event));
|
|
1568
|
-
this._emit(settled.event);
|
|
1569
|
-
}
|
|
1570
|
-
}
|
|
1571
|
-
catch {
|
|
1572
|
-
// Never let settlement bookkeeping break a run.
|
|
1514
|
+
ownedRun.finish(outcome, (event) => {
|
|
1515
|
+
if (resourceLease !== null) {
|
|
1516
|
+
this._resourceLeaseController?.release(resourceLease);
|
|
1517
|
+
resourceObservations?.record("resource_lease_released_v1", { promptRunId });
|
|
1518
|
+
}
|
|
1519
|
+
resourceObservations?.record("prompt_settled_v1", settledObservationFacts(event));
|
|
1520
|
+
this._emit(event);
|
|
1521
|
+
});
|
|
1573
1522
|
}
|
|
1574
1523
|
}
|
|
1575
1524
|
/**
|
|
@@ -1581,7 +1530,7 @@ export class AgentSession {
|
|
|
1581
1530
|
* delayed. The pending probe is bounded (~cpuSampleMs) and never rejects.
|
|
1582
1531
|
* - `adaptive`/`strict`: bounded blocking probe (default 300 ms deadline),
|
|
1583
1532
|
* then a generation-safe lease applies the effective tool cap for this
|
|
1584
|
-
* run.
|
|
1533
|
+
* run. Prompt settlement releases it after owned tool promises terminate.
|
|
1585
1534
|
*
|
|
1586
1535
|
* Never throws: any probe or policy failure leaves this run ungoverned
|
|
1587
1536
|
* (§2.1: probe failure must not crash or block the prompt).
|
|
@@ -1776,6 +1725,7 @@ export class AgentSession {
|
|
|
1776
1725
|
}
|
|
1777
1726
|
}
|
|
1778
1727
|
async _handlePostAgentRun() {
|
|
1728
|
+
this._runBudget.assertActive();
|
|
1779
1729
|
const msg = this._lastAssistantMessage;
|
|
1780
1730
|
this._lastAssistantMessage = undefined;
|
|
1781
1731
|
if (!msg) {
|
|
@@ -1810,17 +1760,20 @@ export class AgentSession {
|
|
|
1810
1760
|
* @throws Error if streaming and no streamingBehavior specified
|
|
1811
1761
|
* @throws Error if no model selected or no API key available (when not streaming)
|
|
1812
1762
|
*/
|
|
1813
|
-
|
|
1763
|
+
prompt(text, options) {
|
|
1764
|
+
if (options?.runBudget === undefined && (this.isStreaming || this.isRetrying))
|
|
1765
|
+
return this._prompt(text, options);
|
|
1766
|
+
return this._runBudget.execute(options?.runBudget, () => this._prompt(text, options), options?.preflightResult);
|
|
1767
|
+
}
|
|
1768
|
+
getRunBudgetSnapshot() {
|
|
1769
|
+
return this._runBudget.snapshot();
|
|
1770
|
+
}
|
|
1771
|
+
async _prompt(text, options) {
|
|
1814
1772
|
const expandPromptTemplates = options?.expandPromptTemplates ?? true;
|
|
1815
1773
|
const preflightResult = options?.preflightResult;
|
|
1816
1774
|
let currentText = redactSensitiveText(text);
|
|
1817
1775
|
const defaultActiveSkills = this._getDefaultActiveSkills();
|
|
1818
|
-
let
|
|
1819
|
-
let promptActiveSkillSource = defaultActiveSkills.length > 0
|
|
1820
|
-
? options?.activeSkillSource
|
|
1821
|
-
? `settings+${options.activeSkillSource}`
|
|
1822
|
-
: "settings"
|
|
1823
|
-
: options?.activeSkillSource;
|
|
1776
|
+
let promptSkills = createActiveSkillState(defaultActiveSkills, options?.activeSkillNames ?? [], options?.activeSkillSource);
|
|
1824
1777
|
let isBangSkillInvocation = false;
|
|
1825
1778
|
if (expandPromptTemplates) {
|
|
1826
1779
|
const bangInvocation = parseBangInvocation(text, {
|
|
@@ -1831,9 +1784,7 @@ export class AgentSession {
|
|
|
1831
1784
|
currentText = bangInvocation.prompt
|
|
1832
1785
|
? `/skill:${bangInvocation.skillName} ${bangInvocation.prompt}`
|
|
1833
1786
|
: `/skill:${bangInvocation.skillName}`;
|
|
1834
|
-
|
|
1835
|
-
promptActiveSkillSource =
|
|
1836
|
-
defaultActiveSkills.length > 0 ? `settings+${bangInvocation.source}` : bangInvocation.source;
|
|
1787
|
+
promptSkills = addActiveSkills(promptSkills, bangInvocation.activeSkillNames, bangInvocation.source);
|
|
1837
1788
|
}
|
|
1838
1789
|
}
|
|
1839
1790
|
let messages;
|
|
@@ -1882,6 +1833,7 @@ export class AgentSession {
|
|
|
1882
1833
|
preflightResult?.(true);
|
|
1883
1834
|
return;
|
|
1884
1835
|
}
|
|
1836
|
+
this._promptLifecycle.assertIdle();
|
|
1885
1837
|
// Flush any pending bash messages before the new prompt
|
|
1886
1838
|
this._flushPendingBashMessages();
|
|
1887
1839
|
// Validate model
|
|
@@ -1934,11 +1886,18 @@ export class AgentSession {
|
|
|
1934
1886
|
messages.push(msg);
|
|
1935
1887
|
}
|
|
1936
1888
|
this._pendingNextTurnMessages = [];
|
|
1889
|
+
if (isGrokOAuthProvider(this.model?.provider) && grokHarnessAutoApplyEnabled(process.env)) {
|
|
1890
|
+
const skillQuery = isBangSkillInvocation ? currentText : expandedText;
|
|
1891
|
+
const grokSkills = selectGrokHarnessSkills(skillQuery, this._resourceLoader.getSkills().skills, {
|
|
1892
|
+
contextPressure: this._computePressureBucket(messages) > 0,
|
|
1893
|
+
});
|
|
1894
|
+
promptSkills = addActiveSkills(promptSkills, grokSkills, "grok-harness");
|
|
1895
|
+
}
|
|
1937
1896
|
const turnSystemPromptOptions = {
|
|
1938
1897
|
...this._baseSystemPromptOptions,
|
|
1939
1898
|
contextBudget: this._getContextBudgetOptions(expandedText),
|
|
1940
|
-
activeSkillNames:
|
|
1941
|
-
activeSkillSource:
|
|
1899
|
+
activeSkillNames: promptSkills.names,
|
|
1900
|
+
activeSkillSource: promptSkills.source,
|
|
1942
1901
|
};
|
|
1943
1902
|
const turnSystemPrompt = buildSystemPromptPlan(turnSystemPromptOptions);
|
|
1944
1903
|
// Emit before_agent_start extension event
|
|
@@ -1973,11 +1932,16 @@ export class AgentSession {
|
|
|
1973
1932
|
}
|
|
1974
1933
|
this._recordPromptCachePlan(result?.systemPrompt ? "extension-override" : "turn-plan");
|
|
1975
1934
|
await this._checkProjectedCompaction(messages);
|
|
1935
|
+
this._runBudget.assertActive();
|
|
1976
1936
|
}
|
|
1977
1937
|
catch (error) {
|
|
1978
1938
|
preflightResult?.(false);
|
|
1979
1939
|
const rawMessage = error instanceof Error ? error.message : String(error);
|
|
1980
|
-
const cause =
|
|
1940
|
+
const cause = error instanceof RunBudgetExceededError
|
|
1941
|
+
? { area: "budget", code: error.code }
|
|
1942
|
+
: error instanceof RunBudgetPolicyError
|
|
1943
|
+
? { area: "configuration", code: "invalid" }
|
|
1944
|
+
: preflightFailureCause(rawMessage, Boolean(this.model));
|
|
1981
1945
|
const timestamp = new Date().toISOString();
|
|
1982
1946
|
this._publishTermination(classifySessionTermination({
|
|
1983
1947
|
sessionId: this.sessionId,
|
|
@@ -2227,6 +2191,7 @@ export class AgentSession {
|
|
|
2227
2191
|
this._followUpMessages = [];
|
|
2228
2192
|
this.agent.clearAllQueues();
|
|
2229
2193
|
this._emitQueueUpdate();
|
|
2194
|
+
this._promptLifecycle.flush();
|
|
2230
2195
|
return { steering, followUp };
|
|
2231
2196
|
}
|
|
2232
2197
|
/** Number of pending messages (includes both steering and follow-up) */
|
|
@@ -2573,11 +2538,11 @@ export class AgentSession {
|
|
|
2573
2538
|
* 1..<0.75, 2..<0.9, 3..>=0.9. The released default pressure coefficient
|
|
2574
2539
|
* is 1 and participates only after the classifier has prompt evidence.
|
|
2575
2540
|
*/
|
|
2576
|
-
_computePressureBucket() {
|
|
2541
|
+
_computePressureBucket(pendingMessages = []) {
|
|
2577
2542
|
const contextWindow = this.model?.contextWindow ?? 0;
|
|
2578
2543
|
if (contextWindow <= 0)
|
|
2579
2544
|
return 0;
|
|
2580
|
-
const estimate = estimateProjectedContextTokens(this.agent.state.messages,
|
|
2545
|
+
const estimate = estimateProjectedContextTokens(this.agent.state.messages, pendingMessages);
|
|
2581
2546
|
const pressure = estimate.tokens / contextWindow;
|
|
2582
2547
|
if (pressure >= 0.9)
|
|
2583
2548
|
return 3;
|
|
@@ -3993,7 +3958,7 @@ export class AgentSession {
|
|
|
3993
3958
|
const failoverTo = await this._maybeFailoverFromSafetyStop(message);
|
|
3994
3959
|
const switchedVia = failoverTo ? `failover ${failoverTo}` : rotatedTo ? `route ${rotatedTo}` : undefined;
|
|
3995
3960
|
// Safety stops are usually immediate false positives — short delay after failover, full backoff otherwise.
|
|
3996
|
-
const delayMs = computeRetryDelayMs(settings.baseDelayMs, attempt, switchedVia !== undefined);
|
|
3961
|
+
const delayMs = Math.min(computeRetryDelayMs(settings.baseDelayMs, attempt, switchedVia !== undefined), this._runBudget.remainingMs ?? Infinity);
|
|
3997
3962
|
const errorMessage = switchedVia
|
|
3998
3963
|
? `${message.errorMessage || "content/safety stop"} → ${switchedVia}`
|
|
3999
3964
|
: message.errorMessage || "Unknown error";
|