@orion-agents/orion-code 0.3.65 → 0.4.3
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 +128 -2
- package/README.md +78 -361
- package/README.zh-CN.md +71 -263
- package/bin/orion +4 -1
- package/dist/acp/session-updates.d.ts +34 -0
- package/dist/acp/session-updates.js +162 -0
- package/dist/acp/sessions.d.ts +32 -0
- package/dist/acp/sessions.js +315 -0
- package/dist/acp/stdio.d.ts +3 -0
- package/dist/acp/stdio.js +59 -0
- package/dist/cli.js +136 -185
- package/dist/commands/context-tool-command-handlers.d.ts +1 -1
- package/dist/commands/context-tool-command-handlers.js +24 -3
- package/dist/commands/core-command-handlers.js +5 -1
- package/dist/commands/diagnostic-command-handlers.js +20 -6
- package/dist/commands/diagnostic-commands.js +0 -12
- package/dist/commands/init-command.d.ts +3 -0
- package/dist/commands/init-command.js +131 -0
- package/dist/commands/model-command-handlers.d.ts +1 -2
- package/dist/commands/model-command-handlers.js +15 -100
- package/dist/commands/model-commands.js +0 -11
- package/dist/commands/registry.js +0 -18
- package/dist/commands/rsi-command.d.ts +2 -0
- package/dist/commands/rsi-command.js +180 -0
- package/dist/commands/session-command-handlers.js +28 -19
- package/dist/commands/system-commands.js +0 -1
- package/dist/commands/tool-commands.js +1 -1
- package/dist/commands/types.d.ts +4 -10
- package/dist/commands/types.js +1 -21
- package/dist/commands/workflow-command-handlers.js +13 -4
- package/dist/framework/loop-budget-contract.d.ts +7 -2
- package/dist/framework/loop-budget-contract.js +4 -1
- package/dist/framework/loop-progress.d.ts +22 -0
- package/dist/framework/loop-progress.js +79 -0
- package/dist/framework/prompt.d.ts +0 -2
- package/dist/framework/prompt.js +9 -27
- package/dist/framework/query.d.ts +27 -20
- package/dist/framework/query.js +453 -153
- package/dist/framework/store.d.ts +6 -10
- package/dist/framework/store.js +2 -21
- package/dist/framework/tool-call-orchestrator.d.ts +7 -0
- package/dist/framework/tool-call-orchestrator.js +8 -3
- package/dist/framework/tool-state.d.ts +2 -0
- package/dist/framework/tool.d.ts +0 -23
- package/dist/framework/verification-command.d.ts +15 -0
- package/dist/framework/verification-command.js +32 -0
- package/dist/harness/assembler.d.ts +1 -0
- package/dist/harness/assembler.js +24 -0
- package/dist/harness/capsule.d.ts +1 -1
- package/dist/harness/capsule.js +33 -14
- package/dist/harness/context-harness.d.ts +31 -12
- package/dist/harness/context-harness.js +491 -35
- package/dist/harness/contract.js +1 -1
- package/dist/harness/drift-guard.d.ts +4 -0
- package/dist/harness/drift-guard.js +68 -16
- package/dist/harness/intent.js +21 -0
- package/dist/harness/ledger.d.ts +6 -11
- package/dist/harness/ledger.js +39 -9
- package/dist/harness/progress-controller.d.ts +12 -7
- package/dist/harness/progress-controller.js +66 -21
- package/dist/harness/state.js +9 -1
- package/dist/harness/task-checklist.d.ts +16 -0
- package/dist/harness/task-checklist.js +95 -0
- package/dist/harness/types.d.ts +73 -1
- package/dist/harness/verification.d.ts +19 -1
- package/dist/harness/verification.js +116 -29
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -3
- package/dist/print-ui/event-stream.d.ts +38 -0
- package/dist/print-ui/event-stream.js +187 -0
- package/dist/print-ui/launch.d.ts +12 -1
- package/dist/print-ui/launch.js +173 -11
- package/dist/product/environment.d.ts +1 -1
- package/dist/product/environment.js +1 -1
- package/dist/product/identity.d.ts +1 -1
- package/dist/product/identity.js +1 -1
- package/dist/product/paths.d.ts +3 -2
- package/dist/product/paths.js +6 -2
- package/dist/runtime/agent-loop.d.ts +11 -2
- package/dist/runtime/agent-loop.js +165 -25
- package/dist/runtime/agent-runtime-controller.d.ts +13 -3
- package/dist/runtime/agent-runtime-controller.js +347 -183
- package/dist/runtime/agent-runtime-protocol.d.ts +10 -18
- package/dist/runtime/agent-runtime-runner.d.ts +10 -0
- package/dist/runtime/builtin-tool-provider.js +5 -1
- package/dist/runtime/capability-receipt-journal.js +1 -0
- package/dist/runtime/durable-tool-receipt-reader.js +2 -1
- package/dist/runtime/first-party-tool-services.d.ts +1 -0
- package/dist/runtime/first-party-tool-services.js +2 -12
- package/dist/runtime/first-party-tool-universe.d.ts +1 -0
- package/dist/runtime/first-party-tool-universe.js +1 -1
- package/dist/runtime/followup-queue-store.d.ts +16 -0
- package/dist/runtime/followup-queue-store.js +75 -0
- package/dist/runtime/goal-lifecycle-v2.d.ts +11 -1
- package/dist/runtime/goal-lifecycle-v2.js +85 -15
- package/dist/runtime/goal-runtime-coordinator.d.ts +10 -1
- package/dist/runtime/goal-runtime-coordinator.js +81 -24
- package/dist/runtime/loop-budget.js +7 -5
- package/dist/runtime/mcp/first-party-mcp-adapter.d.ts +2 -0
- package/dist/runtime/mcp/first-party-mcp-adapter.js +23 -19
- package/dist/runtime/model-coordinator.js +2 -5
- package/dist/runtime/orion-runtime-v1.d.ts +18 -2
- package/dist/runtime/orion-runtime-v1.js +135 -39
- package/dist/runtime/orion-session-runner.d.ts +7 -0
- package/dist/runtime/orion-session-runner.js +82 -0
- package/dist/runtime/plan-review.d.ts +1 -0
- package/dist/runtime/plan-review.js +8 -4
- package/dist/runtime/product-bootstrap.d.ts +6 -0
- package/dist/runtime/product-bootstrap.js +41 -51
- package/dist/runtime/product-orion-runtime.js +128 -52
- package/dist/runtime/release-receipts.d.ts +24 -124
- package/dist/runtime/release-receipts.js +129 -683
- package/dist/runtime/rich-text/layout.js +108 -65
- package/dist/runtime/rsi/contracts.d.ts +50 -0
- package/dist/runtime/rsi/contracts.js +17 -0
- package/dist/runtime/rsi/diagnosis.d.ts +46 -0
- package/dist/runtime/rsi/diagnosis.js +98 -0
- package/dist/runtime/rsi/evaluation-suite.d.ts +25 -0
- package/dist/runtime/rsi/evaluation-suite.js +141 -0
- package/dist/runtime/rsi/evaluation-worker.d.ts +19 -0
- package/dist/runtime/rsi/evaluation-worker.js +64 -0
- package/dist/runtime/rsi/evaluation.d.ts +49 -0
- package/dist/runtime/rsi/evaluation.js +351 -0
- package/dist/runtime/rsi/lifecycle.d.ts +54 -0
- package/dist/runtime/rsi/lifecycle.js +279 -0
- package/dist/runtime/rsi/proposal.d.ts +39 -0
- package/dist/runtime/rsi/proposal.js +312 -0
- package/dist/runtime/rsi/receipt.d.ts +28 -0
- package/dist/runtime/rsi/receipt.js +138 -0
- package/dist/runtime/rsi/skill-state.d.ts +7 -0
- package/dist/runtime/rsi/skill-state.js +50 -0
- package/dist/runtime/rsi/trajectory.d.ts +19 -0
- package/dist/runtime/rsi/trajectory.js +314 -0
- package/dist/runtime/rsi/triage.d.ts +274 -0
- package/dist/runtime/rsi/triage.js +58 -0
- package/dist/runtime/session-composer-control.d.ts +5 -24
- package/dist/runtime/session-composer-control.js +27 -189
- package/dist/runtime/step-snapshot.d.ts +1 -0
- package/dist/runtime/subagents/policy.js +0 -1
- package/dist/runtime/subagents/production.js +1 -1
- package/dist/runtime/subagents/runtime-integration.js +2 -4
- package/dist/runtime/subagents/types.d.ts +0 -5
- package/dist/runtime/subagents/types.js +0 -2
- package/dist/runtime/task-context-recovery.d.ts +55 -0
- package/dist/runtime/task-context-recovery.js +342 -0
- package/dist/runtime/task-context-service.d.ts +16 -10
- package/dist/runtime/task-context-service.js +35 -4
- package/dist/runtime/thread-admission.d.ts +1 -1
- package/dist/runtime/thread-admission.js +12 -6
- package/dist/runtime/thread-event-store.d.ts +2 -2
- package/dist/runtime/thread-event-store.js +7 -2
- package/dist/runtime/thread-projection.js +4 -2
- package/dist/runtime/thread-runtime.d.ts +7 -0
- package/dist/runtime/thread-runtime.js +43 -0
- package/dist/runtime/thread-session-index.d.ts +8 -0
- package/dist/runtime/thread-session-index.js +50 -1
- package/dist/runtime/thread-session-view.d.ts +2 -1
- package/dist/runtime/thread-session-view.js +4 -0
- package/dist/runtime/thread-tool-journal.d.ts +1 -0
- package/dist/runtime/thread-tool-journal.js +6 -2
- package/dist/runtime/thread-ui-adapter.d.ts +1 -0
- package/dist/runtime/thread-ui-adapter.js +88 -11
- package/dist/runtime/tool-gateway.d.ts +7 -0
- package/dist/runtime/tool-gateway.js +20 -0
- package/dist/runtime/tool-transcript-entry.d.ts +16 -0
- package/dist/runtime/tool-transcript-entry.js +73 -0
- package/dist/runtime/turn-commit.d.ts +4 -1
- package/dist/runtime/turn-commit.js +19 -15
- package/dist/runtime/ui-events.d.ts +12 -0
- package/dist/runtime/ui-view-model.d.ts +6 -5
- package/dist/runtime/ui-view-model.js +33 -19
- package/dist/runtime/workspace-runtime-kernel.js +0 -1
- package/dist/services/atomic-write.d.ts +2 -0
- package/dist/services/atomic-write.js +12 -1
- package/dist/services/code-review/format.d.ts +4 -1
- package/dist/services/code-review/format.js +5 -1
- package/dist/services/code-review/runner.d.ts +2 -2
- package/dist/services/code-review/runner.js +86 -64
- package/dist/services/code-review/snapshot.d.ts +9 -9
- package/dist/services/code-review/snapshot.js +182 -166
- package/dist/services/compact/auto-compact.d.ts +21 -6
- package/dist/services/compact/auto-compact.js +148 -22
- package/dist/services/compact/background-candidate.d.ts +33 -0
- package/dist/services/compact/background-candidate.js +184 -0
- package/dist/services/compact/compact.d.ts +4 -1
- package/dist/services/compact/compact.js +30 -3
- package/dist/services/compact/coordinator.d.ts +10 -4
- package/dist/services/compact/coordinator.js +17 -7
- package/dist/services/compact/summary-generator.d.ts +4 -2
- package/dist/services/compact/summary-generator.js +17 -3
- package/dist/services/config.d.ts +5 -5
- package/dist/services/config.js +30 -45
- package/dist/services/doctor.js +85 -13
- package/dist/services/effort.d.ts +5 -5
- package/dist/services/effort.js +5 -11
- package/dist/services/file-lock.d.ts +9 -3
- package/dist/services/file-lock.js +92 -26
- package/dist/services/global-config.d.ts +26 -56
- package/dist/services/global-config.js +213 -183
- package/dist/services/llm.d.ts +40 -4
- package/dist/services/llm.js +164 -45
- package/dist/services/model-client-pool.d.ts +15 -9
- package/dist/services/model-client-pool.js +62 -33
- package/dist/services/model-context.d.ts +2 -1
- package/dist/services/model-context.js +15 -9
- package/dist/services/model-registry.d.ts +4 -15
- package/dist/services/model-registry.js +32 -101
- package/dist/services/provider-diagnostics.d.ts +7 -0
- package/dist/services/provider-diagnostics.js +9 -10
- package/dist/services/provider-resilience/coordinator.d.ts +1 -1
- package/dist/services/provider-resilience/coordinator.js +10 -6
- package/dist/services/provider-resilience/request-gate.d.ts +3 -0
- package/dist/services/provider-resilience/request-gate.js +29 -18
- package/dist/services/provider-resilience/types.d.ts +2 -0
- package/dist/services/session-storage.d.ts +7 -10
- package/dist/services/session-storage.js +57 -30
- package/dist/services/settings-coordinator.d.ts +0 -6
- package/dist/services/settings-coordinator.js +19 -56
- package/dist/services/settings-document-repository.d.ts +3 -10
- package/dist/services/settings-document-repository.js +7 -85
- package/dist/services/usage-state.d.ts +3 -3
- package/dist/services/usage-state.js +11 -42
- package/dist/terminal-ui/answer-format.d.ts +14 -0
- package/dist/terminal-ui/answer-format.js +119 -0
- package/dist/terminal-ui/launch.d.ts +7 -6
- package/dist/terminal-ui/launch.js +160 -70
- package/dist/terminal-ui/output-queue.d.ts +2 -1
- package/dist/terminal-ui/output-queue.js +1 -1
- package/dist/terminal-ui/raw-editor.d.ts +2 -1
- package/dist/terminal-ui/raw-editor.js +56 -15
- package/dist/tools/core/edit-file.js +2 -0
- package/dist/tools/core/write-file.js +5 -0
- package/dist/tools/lsp.d.ts +16 -1
- package/dist/tools/lsp.js +60 -19
- package/dist/tools/sandbox.d.ts +1 -1
- package/dist/tools/sandbox.js +3 -16
- package/dist/tools/todo.d.ts +4 -2
- package/dist/tools/todo.js +76 -31
- package/dist/tui-core/input-parser.d.ts +1 -0
- package/dist/tui-core/input-parser.js +6 -0
- package/dist/tui-core/style.d.ts +1 -8
- package/dist/tui-core/style.js +3 -110
- package/dist/tui-ui/chrome-view-model.d.ts +1 -1
- package/dist/tui-ui/chrome-view-model.js +22 -27
- package/dist/tui-ui/launch.js +14 -14
- package/dist/tui-ui/layout.d.ts +5 -7
- package/dist/tui-ui/layout.js +129 -124
- package/dist/tui-ui/runner.d.ts +11 -12
- package/dist/tui-ui/runner.js +88 -67
- package/dist/tui-ui/state.d.ts +0 -11
- package/dist/tui-ui/state.js +22 -33
- package/dist/tui-ui/terminal-image.js +22 -4
- package/dist/tui-ui/transcript-inspector-layout.js +6 -3
- package/dist/tui-ui/transcript-inspector.d.ts +1 -0
- package/dist/tui-ui/transcript-inspector.js +7 -1
- package/dist/tui-ui/transcript-layout.js +42 -6
- package/dist/utils/terminal-text.d.ts +11 -0
- package/dist/utils/terminal-text.js +114 -0
- package/docs/cli-guide.md +562 -0
- package/docs/orion.example.yaml +42 -0
- package/docs/readme.md +12 -57
- package/npm-shrinkwrap.json +484 -1855
- package/package.json +13 -63
- package/dist/migration/command.d.ts +0 -9
- package/dist/migration/command.js +0 -100
- package/dist/migration/index.d.ts +0 -7
- package/dist/migration/index.js +0 -14
- package/dist/migration/migrate.d.ts +0 -19
- package/dist/migration/migrate.js +0 -406
- package/dist/migration/types.d.ts +0 -55
- package/dist/migration/types.js +0 -6
- package/dist/services/tool-allowlist.d.ts +0 -110
- package/dist/services/tool-allowlist.js +0 -299
- package/dist/services/yaml-config.d.ts +0 -57
- package/dist/services/yaml-config.js +0 -178
- package/dist/web/cli-options.d.ts +0 -17
- package/dist/web/cli-options.js +0 -51
- package/dist/web/code-review-run-service.d.ts +0 -68
- package/dist/web/code-review-run-service.js +0 -228
- package/dist/web/context-text.d.ts +0 -17
- package/dist/web/context-text.js +0 -40
- package/dist/web/errors.d.ts +0 -6
- package/dist/web/errors.js +0 -13
- package/dist/web/event-hub.d.ts +0 -45
- package/dist/web/event-hub.js +0 -370
- package/dist/web/file-read-service.d.ts +0 -101
- package/dist/web/file-read-service.js +0 -593
- package/dist/web/file-write-service.d.ts +0 -16
- package/dist/web/file-write-service.js +0 -103
- package/dist/web/git-compare-service.d.ts +0 -45
- package/dist/web/git-compare-service.js +0 -160
- package/dist/web/git-diff-document.d.ts +0 -102
- package/dist/web/git-diff-document.js +0 -258
- package/dist/web/git-file-source.d.ts +0 -25
- package/dist/web/git-file-source.js +0 -21
- package/dist/web/git-history-service.d.ts +0 -151
- package/dist/web/git-history-service.js +0 -619
- package/dist/web/git-index-transaction.d.ts +0 -45
- package/dist/web/git-index-transaction.js +0 -174
- package/dist/web/git-patch-builder.d.ts +0 -30
- package/dist/web/git-patch-builder.js +0 -138
- package/dist/web/git-read-model-service.d.ts +0 -452
- package/dist/web/git-read-model-service.js +0 -1833
- package/dist/web/git-version-service.d.ts +0 -79
- package/dist/web/git-version-service.js +0 -279
- package/dist/web/host-daemon.d.ts +0 -70
- package/dist/web/host-daemon.js +0 -237
- package/dist/web/index.d.ts +0 -6
- package/dist/web/index.js +0 -28
- package/dist/web/launch.d.ts +0 -12
- package/dist/web/launch.js +0 -89
- package/dist/web/native-directory-picker.d.ts +0 -63
- package/dist/web/native-directory-picker.js +0 -169
- package/dist/web/protocol.d.ts +0 -705
- package/dist/web/protocol.js +0 -639
- package/dist/web/review-service.d.ts +0 -22
- package/dist/web/review-service.js +0 -68
- package/dist/web/server.d.ts +0 -20
- package/dist/web/server.js +0 -1453
- package/dist/web/session-runtime-registry.d.ts +0 -138
- package/dist/web/session-runtime-registry.js +0 -471
- package/dist/web/terminal-manager.d.ts +0 -156
- package/dist/web/terminal-manager.js +0 -779
- package/dist/web/terminal-server.d.ts +0 -8
- package/dist/web/terminal-server.js +0 -304
- package/dist/web/workbench-controller.d.ts +0 -395
- package/dist/web/workbench-controller.js +0 -3077
- package/dist/web/workspace-discovery.d.ts +0 -92
- package/dist/web/workspace-discovery.js +0 -324
- package/dist/web/workspace-mutation-arbiter.d.ts +0 -54
- package/dist/web/workspace-mutation-arbiter.js +0 -267
- package/dist/web/workspace-open-telemetry.d.ts +0 -55
- package/dist/web/workspace-open-telemetry.js +0 -73
- package/dist/web-client/assets/FilesPanel-iBYj9ZRf.js +0 -1
- package/dist/web-client/assets/GitPanel-D33R_bZr.js +0 -4
- package/dist/web-client/assets/ReviewPanel-C_0upsDk.js +0 -6
- package/dist/web-client/assets/TerminalPanel-C7A8dMNf.js +0 -23
- package/dist/web-client/assets/TerminalPanel-DLuoa74B.css +0 -1
- package/dist/web-client/assets/index-BaOxrwGB.css +0 -1
- package/dist/web-client/assets/index-CqCgJ2ov.js +0 -20
- package/dist/web-client/assets/useAutoNotice-C1qM-_Sg.js +0 -1
- package/dist/web-client/favicon.svg +0 -9
- package/dist/web-client/index.html +0 -17
- package/docs/architecture/agent-mode-permission-contract.md +0 -87
- package/docs/architecture/v0.3.0-web-api.yaml +0 -1340
- package/docs/architecture/v0.3.1-web-api.yaml +0 -2338
- package/docs/architecture/v0.3.2-web-api.yaml +0 -3029
- package/docs/architecture/v0.3.3-web-api.yaml +0 -3205
- package/docs/architecture/v0.3.4-stabilization-contract.md +0 -32
- package/docs/migration/v0.1.9-to-v0.2.0.md +0 -98
- package/docs/migration/v0.2.2-to-v0.3.0-settings.md +0 -114
- package/docs/migration/v0.2.2-to-v0.3.0.md +0 -55
- package/docs/migration/v0.3.0-to-v0.3.1.md +0 -88
- package/docs/migration/v0.3.1-to-v0.3.2.md +0 -94
- package/docs/migration/v0.3.2-to-v0.3.3.md +0 -62
- package/docs/migration/v0.3.3-to-v0.3.4.md +0 -36
- package/docs/orion.example.json +0 -86
- package/docs/plan/v0.2.0-dsh-harness-redesign-plan.md +0 -1234
- package/docs/plan/v0.2.0-release-checklist.md +0 -91
- package/docs/plan/v0.3.0-node-runtime-compatibility-plan.md +0 -57
- package/docs/plan/v0.3.0-settings-integration-plan.md +0 -740
- package/docs/plan/v0.3.0-web-workbench-plan.md +0 -376
- package/docs/plan/v0.3.1-web-workbench-professional-shell-plan.md +0 -848
- package/docs/plan/v0.3.2-web-workbench-layout-and-composer-plan.md +0 -869
- package/docs/plan/v0.3.3-plan.md +0 -1113
- package/docs/plan/v0.3.4-stabilization-plan.md +0 -89
- package/docs/test/v0.3.1-web-workbench-e2e-plan.md +0 -140
- package/docs/test/v0.3.2-web-workbench-e2e-plan.md +0 -100
- package/docs/test/v0.3.3-web-workbench-e2e-plan.md +0 -79
- package/docs/test/v0.3.4-stabilization-e2e-plan.md +0 -54
package/dist/harness/types.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { TodoItem } from '../framework/tool-state';
|
|
2
|
+
import type { LocalVerificationKind, LocalVerificationReceipt } from '../framework/verification-command';
|
|
1
3
|
export type LedgerEntryType = 'user_requirement' | 'decision' | 'file_fact' | 'tool_result' | 'test_result' | 'risk' | 'todo' | 'skill' | 'blocker' | 'verification';
|
|
2
4
|
export type TaskCriterionStatus = 'pending' | 'passed' | 'failed' | 'waived';
|
|
3
5
|
export type TaskCriterionScope = 'task' | 'project' | 'release';
|
|
@@ -63,6 +65,19 @@ export interface ContextLedgerEntry {
|
|
|
63
65
|
createdAt: number;
|
|
64
66
|
metadata?: Record<string, unknown>;
|
|
65
67
|
}
|
|
68
|
+
export interface ToolResultObservation {
|
|
69
|
+
readonly name: string;
|
|
70
|
+
readonly args: Record<string, unknown>;
|
|
71
|
+
readonly result: string;
|
|
72
|
+
readonly duration: number;
|
|
73
|
+
readonly success: boolean;
|
|
74
|
+
readonly error?: string;
|
|
75
|
+
readonly summary?: string;
|
|
76
|
+
readonly verification?: LocalVerificationReceipt;
|
|
77
|
+
readonly toolReceiptDigest?: string;
|
|
78
|
+
readonly changedFile?: string;
|
|
79
|
+
readonly readOnly?: boolean;
|
|
80
|
+
}
|
|
66
81
|
export interface PlanStep {
|
|
67
82
|
id: string;
|
|
68
83
|
title: string;
|
|
@@ -184,13 +199,62 @@ export interface PromptSectionManifestEntry {
|
|
|
184
199
|
contentHash: string;
|
|
185
200
|
reason?: string;
|
|
186
201
|
}
|
|
202
|
+
export interface TaskTodoObservation {
|
|
203
|
+
readonly digest: string;
|
|
204
|
+
readonly passed: boolean;
|
|
205
|
+
readonly kind?: LocalVerificationKind;
|
|
206
|
+
readonly changedFile?: string;
|
|
207
|
+
readonly command?: string;
|
|
208
|
+
readonly cwd?: string;
|
|
209
|
+
}
|
|
210
|
+
export interface TaskTodoItem extends TodoItem {
|
|
211
|
+
readonly id: string;
|
|
212
|
+
readonly deferredReason?: string;
|
|
213
|
+
readonly recovery?: {
|
|
214
|
+
readonly failures: number;
|
|
215
|
+
readonly consecutiveFailures: number;
|
|
216
|
+
readonly strategies: readonly string[];
|
|
217
|
+
readonly lastFailure: string;
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
export interface TaskPlanStop {
|
|
221
|
+
readonly code: 'task_deferred' | 'task_step_blocked';
|
|
222
|
+
readonly message: string;
|
|
223
|
+
}
|
|
224
|
+
export interface TaskWorkspaceAction {
|
|
225
|
+
readonly path?: string;
|
|
226
|
+
readonly command?: string;
|
|
227
|
+
readonly cwd?: string;
|
|
228
|
+
}
|
|
229
|
+
export type TaskTodoReceipt = [
|
|
230
|
+
stepId: string,
|
|
231
|
+
toolReceiptDigest: string,
|
|
232
|
+
evidence?: {
|
|
233
|
+
kind: LocalVerificationKind;
|
|
234
|
+
passed: boolean;
|
|
235
|
+
command?: string;
|
|
236
|
+
cwd?: string;
|
|
237
|
+
workspaceRevision?: number;
|
|
238
|
+
} | {
|
|
239
|
+
changedFile: string;
|
|
240
|
+
}
|
|
241
|
+
];
|
|
187
242
|
export interface HarnessState {
|
|
188
243
|
version?: 2;
|
|
189
244
|
contract?: TaskContract;
|
|
190
245
|
ledger: ContextLedgerEntry[];
|
|
246
|
+
/** Monotonic revision of observed workspace writes, retained independently of the ledger. */
|
|
247
|
+
workspaceRevision?: number;
|
|
191
248
|
capsule?: ContextCapsule;
|
|
192
249
|
completionBlockCount?: number;
|
|
193
250
|
taskEpoch?: number;
|
|
251
|
+
taskChecklistRequired?: boolean;
|
|
252
|
+
taskChecklistTargets?: string[];
|
|
253
|
+
goalTaskId?: string;
|
|
254
|
+
taskTodos?: (Omit<TaskTodoItem, 'id'> & {
|
|
255
|
+
id?: string;
|
|
256
|
+
})[];
|
|
257
|
+
taskTodoReceipts?: TaskTodoReceipt[];
|
|
194
258
|
rootObjective?: string;
|
|
195
259
|
activeInstruction?: string;
|
|
196
260
|
intentHistory?: IntentUpdate[];
|
|
@@ -238,7 +302,7 @@ export interface CompletionGateResult {
|
|
|
238
302
|
progressDelta?: ProgressDelta;
|
|
239
303
|
stopDecision?: import('../framework/stop-decision').StopDecision;
|
|
240
304
|
}
|
|
241
|
-
export type VerificationKind = 'test' | 'build' | 'lint' | 'typecheck' | 'diff' | 'git' | 'ci' | 'release' | 'generic';
|
|
305
|
+
export type VerificationKind = 'test' | 'build' | 'lint' | 'typecheck' | 'diff' | 'git' | 'ci' | 'release' | 'file' | 'generic';
|
|
242
306
|
export interface CompletionCriterionResult {
|
|
243
307
|
criterionId: string;
|
|
244
308
|
statement: string;
|
|
@@ -257,15 +321,22 @@ export interface ProgressSnapshot {
|
|
|
257
321
|
}>;
|
|
258
322
|
evidenceRefs: string[];
|
|
259
323
|
changedFiles: string[];
|
|
324
|
+
workspaceRevision?: number;
|
|
325
|
+
verificationObservations?: string[];
|
|
326
|
+
exploredPaths?: string[];
|
|
327
|
+
explorationObservations?: string[];
|
|
328
|
+
todoStateHash?: string;
|
|
260
329
|
decisions: string[];
|
|
261
330
|
blockers: string[];
|
|
262
331
|
diagnostics: string[];
|
|
263
332
|
toolSignature?: string;
|
|
264
333
|
workspaceStateHash: string;
|
|
265
334
|
}
|
|
335
|
+
export type ProgressReason = 'workspace_change' | 'verification_change' | 'explicit_task_state' | 'readonly_exploration' | 'agent_output' | 'no_effect';
|
|
266
336
|
export interface ProgressDelta {
|
|
267
337
|
schemaVersion: 1;
|
|
268
338
|
changed: boolean;
|
|
339
|
+
reason?: ProgressReason;
|
|
269
340
|
criterionChanges: Array<{
|
|
270
341
|
id: string;
|
|
271
342
|
from?: TaskCriterionStatus;
|
|
@@ -273,6 +344,7 @@ export interface ProgressDelta {
|
|
|
273
344
|
}>;
|
|
274
345
|
newEvidenceRefs: string[];
|
|
275
346
|
newChangedFiles: string[];
|
|
347
|
+
newExploredPaths?: string[];
|
|
276
348
|
newDecisions: string[];
|
|
277
349
|
newBlockers: string[];
|
|
278
350
|
newDiagnostics: string[];
|
|
@@ -1,7 +1,25 @@
|
|
|
1
|
+
import { type VerificationCommandKind } from '../framework/verification-command';
|
|
1
2
|
import type { ContextLedgerEntry, TaskCriterion, VerificationKind } from './types';
|
|
3
|
+
/** An explicit file deliverable can be checked against its durable tool readback. */
|
|
4
|
+
export declare function requestedFileArtifact(statement: string): {
|
|
5
|
+
path: string;
|
|
6
|
+
contains?: string;
|
|
7
|
+
} | undefined;
|
|
8
|
+
export declare function workspaceArtifactPath(root: string, path: string): string | undefined;
|
|
9
|
+
export declare function latestArtifactWrite(ledger: readonly ContextLedgerEntry[], contractId: string, cwd: string, path: string): ContextLedgerEntry | undefined;
|
|
2
10
|
export declare function classifyVerificationCommand(command: string | undefined): VerificationKind;
|
|
3
11
|
export declare function requiredVerificationKinds(statement: string): VerificationKind[];
|
|
4
|
-
|
|
12
|
+
interface RequestedCheck {
|
|
13
|
+
readonly kind: VerificationCommandKind;
|
|
14
|
+
readonly command: string;
|
|
15
|
+
readonly cwd?: string;
|
|
16
|
+
}
|
|
17
|
+
/** Quoted commands preserve user-specified test selectors and workspace scope. */
|
|
18
|
+
export declare function requestedLocalChecks(statement: string): RequestedCheck[];
|
|
19
|
+
export declare function matchesRequestedCheck(entry: ContextLedgerEntry, check: RequestedCheck, workspace: string): boolean;
|
|
20
|
+
export declare function verificationKindForEntry(entry: ContextLedgerEntry, requireLocalReceipt?: boolean): VerificationKind;
|
|
5
21
|
export declare function isTrustedEvidence(entry: ContextLedgerEntry): boolean;
|
|
22
|
+
export declare function isFreshVerification(entry: ContextLedgerEntry, workspaceRevision?: number): boolean;
|
|
6
23
|
export declare function criterionHasAuthorizedWaiver(criterion: TaskCriterion): boolean;
|
|
24
|
+
export {};
|
|
7
25
|
//# sourceMappingURL=verification.d.ts.map
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.requestedFileArtifact = requestedFileArtifact;
|
|
4
|
+
exports.workspaceArtifactPath = workspaceArtifactPath;
|
|
5
|
+
exports.latestArtifactWrite = latestArtifactWrite;
|
|
3
6
|
exports.classifyVerificationCommand = classifyVerificationCommand;
|
|
4
7
|
exports.requiredVerificationKinds = requiredVerificationKinds;
|
|
8
|
+
exports.requestedLocalChecks = requestedLocalChecks;
|
|
9
|
+
exports.matchesRequestedCheck = matchesRequestedCheck;
|
|
5
10
|
exports.verificationKindForEntry = verificationKindForEntry;
|
|
6
11
|
exports.isTrustedEvidence = isTrustedEvidence;
|
|
12
|
+
exports.isFreshVerification = isFreshVerification;
|
|
7
13
|
exports.criterionHasAuthorizedWaiver = criterionHasAuthorizedWaiver;
|
|
14
|
+
const path_1 = require("path");
|
|
15
|
+
const verification_command_1 = require("../framework/verification-command");
|
|
8
16
|
const KIND_ORDER = [
|
|
9
17
|
'test',
|
|
10
18
|
'build',
|
|
@@ -14,37 +22,73 @@ const KIND_ORDER = [
|
|
|
14
22
|
'git',
|
|
15
23
|
'ci',
|
|
16
24
|
'release',
|
|
25
|
+
'file',
|
|
17
26
|
'generic',
|
|
18
27
|
];
|
|
28
|
+
/** An explicit file deliverable can be checked against its durable tool readback. */
|
|
29
|
+
function requestedFileArtifact(statement) {
|
|
30
|
+
const objective = statement.replace(/^(?:Address the objective:|Objective:|目标[::])\s*/iu, '');
|
|
31
|
+
const match = /^(?:(?:please\s+)?(?:create|write)\s+(?:(?:a|the)\s+file\s+)?|(?:请\s*)?(?:创建|新建|写入)\s*)(?:`([^`]+)`|"([^"]+)"|'([^']+)'|([^\s,。]+\.[\p{L}\p{N}]+))(?:\s+(?:containing|with content)\s+|\s*[,,]?\s*(?:包含|内容为)\s*)?(.*)$/iu.exec(objective);
|
|
32
|
+
if (!match)
|
|
33
|
+
return undefined;
|
|
34
|
+
const path = match[1] ?? match[2] ?? match[3] ?? match[4];
|
|
35
|
+
const tail = match[5].trim();
|
|
36
|
+
if (!path || !path.includes('.'))
|
|
37
|
+
return undefined;
|
|
38
|
+
if (!tail || tail === '.' || tail === '。')
|
|
39
|
+
return { path };
|
|
40
|
+
if (!/\b(?:containing|with content)\s|(?:包含|内容为)/iu.test(objective))
|
|
41
|
+
return undefined;
|
|
42
|
+
const quoted = /^(?:`([^`]+)`|"([^"]+)"|'([^']+)'|“([^”]+)”)/u.exec(tail);
|
|
43
|
+
const contains = quoted
|
|
44
|
+
? (quoted[1] ?? quoted[2] ?? quoted[3] ?? quoted[4])
|
|
45
|
+
: tail.replace(/[.。]$/u, '');
|
|
46
|
+
return contains ? { path, contains } : undefined;
|
|
47
|
+
}
|
|
48
|
+
function workspaceArtifactPath(root, path) {
|
|
49
|
+
const candidate = (0, path_1.relative)(root, (0, path_1.resolve)(root, path));
|
|
50
|
+
return candidate &&
|
|
51
|
+
candidate !== '..' &&
|
|
52
|
+
!candidate.startsWith(`..${path_1.sep}`) &&
|
|
53
|
+
!(0, path_1.isAbsolute)(candidate)
|
|
54
|
+
? candidate
|
|
55
|
+
: undefined;
|
|
56
|
+
}
|
|
57
|
+
function latestArtifactWrite(ledger, contractId, cwd, path) {
|
|
58
|
+
const target = workspaceArtifactPath(cwd, path);
|
|
59
|
+
if (!target)
|
|
60
|
+
return;
|
|
61
|
+
for (let index = ledger.length - 1; index >= 0; index--) {
|
|
62
|
+
const entry = ledger[index];
|
|
63
|
+
const metadata = entry.metadata;
|
|
64
|
+
if ((metadata?.toolName === 'write_file' || metadata?.toolName === 'edit_file') &&
|
|
65
|
+
metadata.taskContractId === contractId &&
|
|
66
|
+
typeof metadata.toolReceiptDigest === 'string' &&
|
|
67
|
+
metadata.success === true &&
|
|
68
|
+
isTrustedEvidence(entry) &&
|
|
69
|
+
metadata.changedFile === target)
|
|
70
|
+
return entry;
|
|
71
|
+
}
|
|
72
|
+
return undefined;
|
|
73
|
+
}
|
|
19
74
|
function uniqueKinds(kinds) {
|
|
20
75
|
const found = new Set(kinds);
|
|
21
76
|
return KIND_ORDER.filter(kind => found.has(kind));
|
|
22
77
|
}
|
|
23
78
|
function classifyVerificationCommand(command) {
|
|
24
|
-
|
|
79
|
+
const normalized = command?.trim();
|
|
80
|
+
if (!normalized || verification_command_1.SHELL_CONTROL_OPERATOR.test(normalized))
|
|
25
81
|
return 'generic';
|
|
26
|
-
const
|
|
27
|
-
if (
|
|
28
|
-
return
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
return 'lint';
|
|
32
|
-
}
|
|
33
|
-
if (/\b(?:tsc|typecheck|type-check|mypy|pyright)\b/u.test(normalized)) {
|
|
34
|
-
return 'typecheck';
|
|
35
|
-
}
|
|
36
|
-
if (/\b(?:npm\s+run\s+build|pnpm\s+(?:run\s+)?build|yarn\s+build|cargo\s+build|go\s+build)\b/u.test(normalized)) {
|
|
37
|
-
return 'build';
|
|
82
|
+
const local = (0, verification_command_1.classifyDirectVerificationCommand)(normalized);
|
|
83
|
+
if (local)
|
|
84
|
+
return local;
|
|
85
|
+
if (/^(?:npm\s+publish|gh\s+release|git\s+tag)(?=\s|$)/u.test(normalized)) {
|
|
86
|
+
return 'release';
|
|
38
87
|
}
|
|
39
|
-
if (
|
|
40
|
-
return 'diff';
|
|
41
|
-
if (/\b(?:github|gh\s+(?:run|workflow|pr)|circleci|buildkite|jenkins)\b/u.test(normalized)) {
|
|
88
|
+
if (/^(?:gh\s+(?:run|workflow|pr)|circleci|buildkite|jenkins)(?=\s|$)/u.test(normalized)) {
|
|
42
89
|
return 'ci';
|
|
43
90
|
}
|
|
44
|
-
if (
|
|
45
|
-
return 'release';
|
|
46
|
-
}
|
|
47
|
-
if (/\bgit\s+(?:status|commit|push|fetch|pull|merge|rebase|tag|rev-parse)\b/u.test(normalized)) {
|
|
91
|
+
if (/^git\s+(?:status|commit|push|fetch|pull|merge|rebase|rev-parse)(?=\s|$)/u.test(normalized)) {
|
|
48
92
|
return 'git';
|
|
49
93
|
}
|
|
50
94
|
return 'generic';
|
|
@@ -56,12 +100,16 @@ function requiredVerificationKinds(statement) {
|
|
|
56
100
|
/\b(?:tests?|jest|vitest|tsc|lint|build|verification|ci|release)\b.{0,120}\b(?:must|should|required|pass(?:ed|ing)?|succeed(?:ed|ing)?|green|complete[sd]?)\b/u.test(normalized) ||
|
|
57
101
|
/\b(?:npm|pnpm|yarn)\s+(?:run\s+)?(?:test|build|lint|typecheck)\b/u.test(normalized) ||
|
|
58
102
|
/\bgit\s+(?:diff\s+--check|commit|push|merge|rebase)\b/u.test(normalized);
|
|
59
|
-
|
|
60
|
-
|
|
103
|
+
// Runnable examples (可运行/可执行示例) describe the deliverable. They
|
|
104
|
+
// do not add an obligation to pass a separate verification command.
|
|
105
|
+
const chineseAction = /(?:必须|需要|要求|确保|请|(?<!可)(?:运行|执行)|通过|完成|成功).{0,60}(?:测试|验证|构建|编译|检查|发布|提交|推送|流水线)/u.test(statement) ||
|
|
106
|
+
/(?:测试|验证|构建|编译|检查|发布|提交|推送|流水线).{0,60}(?:必须|需要|要求|确保|通过|成功|(?<!可)(?:运行|执行)|完成)/u.test(statement);
|
|
61
107
|
if (!englishAction && !chineseAction)
|
|
62
108
|
return [];
|
|
63
|
-
const
|
|
64
|
-
|
|
109
|
+
const checks = requestedLocalChecks(statement);
|
|
110
|
+
const prose = normalized.replace(/\x60[^\x60]+\x60/gu, '');
|
|
111
|
+
const kinds = checks.map(check => check.kind);
|
|
112
|
+
if (/\b(?:tests?|jest|vitest|pytest)\b/u.test(prose) ||
|
|
65
113
|
/(?:测试|用例).{0,20}(?:通过|运行|执行|成功)/u.test(statement) ||
|
|
66
114
|
/(?:运行|执行|通过).{0,20}(?:测试|用例)/u.test(statement)) {
|
|
67
115
|
kinds.push('test');
|
|
@@ -102,17 +150,56 @@ function requiredVerificationKinds(statement) {
|
|
|
102
150
|
}
|
|
103
151
|
return uniqueKinds(kinds);
|
|
104
152
|
}
|
|
105
|
-
|
|
153
|
+
/** Quoted commands preserve user-specified test selectors and workspace scope. */
|
|
154
|
+
function requestedLocalChecks(statement) {
|
|
155
|
+
const checks = [];
|
|
156
|
+
for (const match of statement.matchAll(/\x60([^\x60\r\n]+)\x60/gu)) {
|
|
157
|
+
const [span, literal] = match;
|
|
158
|
+
const command = literal.trim();
|
|
159
|
+
const kind = (0, verification_command_1.classifyDirectVerificationCommand)(command);
|
|
160
|
+
if (!kind)
|
|
161
|
+
continue;
|
|
162
|
+
const index = match.index ?? 0;
|
|
163
|
+
const before = statement.slice(0, index);
|
|
164
|
+
const after = statement.slice(index + span.length);
|
|
165
|
+
const trailing = after.match(/^\s*(?:(?:in|inside|under)\s+|在\s*)\x60([^\x60\r\n]+)\x60/iu);
|
|
166
|
+
const leading = before.match(/(?:\b(?:in|inside|under)\s+|在\s*)\x60([^\x60\r\n]+)\x60\s*(?:中|内|下)?\s*[,,]?\s*(?:run|execute|运行|执行)\s*$/iu);
|
|
167
|
+
const cwd = (trailing?.[1] ?? leading?.[1])?.trim();
|
|
168
|
+
checks.push({ kind, command, cwd });
|
|
169
|
+
}
|
|
170
|
+
return checks;
|
|
171
|
+
}
|
|
172
|
+
function matchesRequestedCheck(entry, check, workspace) {
|
|
173
|
+
const { command, cwd } = entry.metadata ?? {};
|
|
174
|
+
return (typeof command === 'string' &&
|
|
175
|
+
command.trim() === check.command &&
|
|
176
|
+
(!check.cwd ||
|
|
177
|
+
(0, path_1.resolve)(workspace, typeof cwd === 'string' ? cwd : '.') === (0, path_1.resolve)(workspace, check.cwd)));
|
|
178
|
+
}
|
|
179
|
+
function verificationKindForEntry(entry, requireLocalReceipt = false) {
|
|
106
180
|
const stored = entry.metadata?.verificationKind;
|
|
107
|
-
if (
|
|
181
|
+
if (stored === 'generic')
|
|
108
182
|
return stored;
|
|
109
|
-
|
|
110
|
-
const
|
|
111
|
-
|
|
183
|
+
const command = entry.metadata?.command;
|
|
184
|
+
const kind = typeof command === 'string'
|
|
185
|
+
? classifyVerificationCommand(command)
|
|
186
|
+
: typeof stored === 'string' && KIND_ORDER.includes(stored)
|
|
187
|
+
? stored
|
|
188
|
+
: 'generic';
|
|
189
|
+
return requireLocalReceipt &&
|
|
190
|
+
(0, verification_command_1.isLocalVerificationKind)(kind) &&
|
|
191
|
+
typeof entry.metadata?.toolReceiptDigest !== 'string'
|
|
192
|
+
? 'generic'
|
|
193
|
+
: kind;
|
|
112
194
|
}
|
|
113
195
|
function isTrustedEvidence(entry) {
|
|
114
196
|
return (entry.metadata?.resultTrust === 'structured' && typeof entry.metadata?.success === 'boolean');
|
|
115
197
|
}
|
|
198
|
+
function isFreshVerification(entry, workspaceRevision) {
|
|
199
|
+
return (workspaceRevision === undefined ||
|
|
200
|
+
(entry.type !== 'verification' && entry.type !== 'test_result') ||
|
|
201
|
+
entry.metadata?.workspaceRevision === workspaceRevision);
|
|
202
|
+
}
|
|
116
203
|
function criterionHasAuthorizedWaiver(criterion) {
|
|
117
204
|
return !!(criterion.status === 'waived' &&
|
|
118
205
|
criterion.waiver?.authorizedBy === 'user' &&
|
package/dist/index.d.ts
CHANGED
|
@@ -64,7 +64,7 @@ export { AGENT_RUNTIME_COMMAND_DEFINITIONS_V1, RUNTIME_EVENT_DEFINITIONS_V1, Run
|
|
|
64
64
|
export type { AgentRuntimeCommandV1, AgentRuntimeProtocolSchemaV1, RuntimeDurabilityV1, RuntimeEventEnvelopeV1, RuntimeEventTypeV1, RuntimeEventV1, } from './runtime/protocol';
|
|
65
65
|
export { getConfigErrors, getConfigSummary, isConfigured, loadConfig } from './services/config';
|
|
66
66
|
export type { OrionCodeCLIConfig } from './services/config';
|
|
67
|
-
export { buildRegistry,
|
|
67
|
+
export { buildRegistry, lookupProfile, resolveModelProfile } from './services/model-registry';
|
|
68
68
|
export type { ModelProfile, ModelRegistry, ModelRegistryConfig, ProviderConfig, ProviderProtocol, RegistryValidationError, RegistryValidationResult, ResolvedModelProfile, } from './services/model-registry';
|
|
69
69
|
export { LLMService, LLMProviderError } from './services/llm';
|
|
70
70
|
export type { LLMConfig, LLMRequestDiagnostics, LLMResponse, Message, StreamCallback, StreamCallbacks, } from './services/llm';
|
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* and the legacy query/agent harnesses remain package-private.
|
|
9
9
|
*/
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
-
exports.createNodeStdioMcpFactoryV1 = exports.createFirstPartyMcpAdapterV1 = exports.FirstPartyMcpAdapterError = exports.createProductionFilesystemSkillProviderV1 = exports.createFilesystemSkillRootsV1 = exports.createFilesystemSkillProviderV1 = exports.LLMProviderError = exports.LLMService = exports.resolveModelProfile = exports.lookupProfile = exports.
|
|
11
|
+
exports.createNodeStdioMcpFactoryV1 = exports.createFirstPartyMcpAdapterV1 = exports.FirstPartyMcpAdapterError = exports.createProductionFilesystemSkillProviderV1 = exports.createFilesystemSkillRootsV1 = exports.createFilesystemSkillProviderV1 = exports.LLMProviderError = exports.LLMService = exports.resolveModelProfile = exports.lookupProfile = exports.buildRegistry = exports.loadConfig = exports.isConfigured = exports.getConfigSummary = exports.getConfigErrors = exports.isRuntimeId = exports.getAgentRuntimeProtocolSchemaV1 = exports.createRuntimeId = exports.assertRuntimeEventEnvelopeV1 = exports.assertAgentRuntimeCommandV1 = exports.RuntimeProtocolValidationError = exports.RUNTIME_EVENT_DEFINITIONS_V1 = exports.AGENT_RUNTIME_COMMAND_DEFINITIONS_V1 = void 0;
|
|
12
12
|
exports.createOrionRuntime = createOrionRuntime;
|
|
13
13
|
const product_orion_runtime_1 = require("./runtime/product-orion-runtime");
|
|
14
14
|
/** The sole supported package-root composition entry point. */
|
|
@@ -51,8 +51,6 @@ Object.defineProperty(exports, "isConfigured", { enumerable: true, get: function
|
|
|
51
51
|
Object.defineProperty(exports, "loadConfig", { enumerable: true, get: function () { return config_1.loadConfig; } });
|
|
52
52
|
var model_registry_1 = require("./services/model-registry");
|
|
53
53
|
Object.defineProperty(exports, "buildRegistry", { enumerable: true, get: function () { return model_registry_1.buildRegistry; } });
|
|
54
|
-
Object.defineProperty(exports, "getLegacyMigrationHint", { enumerable: true, get: function () { return model_registry_1.getLegacyMigrationHint; } });
|
|
55
|
-
Object.defineProperty(exports, "isLegacyConfig", { enumerable: true, get: function () { return model_registry_1.isLegacyConfig; } });
|
|
56
54
|
Object.defineProperty(exports, "lookupProfile", { enumerable: true, get: function () { return model_registry_1.lookupProfile; } });
|
|
57
55
|
Object.defineProperty(exports, "resolveModelProfile", { enumerable: true, get: function () { return model_registry_1.resolveModelProfile; } });
|
|
58
56
|
var llm_1 = require("./services/llm");
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { ThreadRuntimeV1 } from '../runtime/thread-runtime';
|
|
2
|
+
import type { ToolPermissionRequest } from '../runtime/ui-events';
|
|
3
|
+
declare const EXIT_CODES: {
|
|
4
|
+
readonly completed: 0;
|
|
5
|
+
readonly failed: 1;
|
|
6
|
+
readonly incomplete: 2;
|
|
7
|
+
readonly approval_required: 3;
|
|
8
|
+
readonly cancelled: 130;
|
|
9
|
+
};
|
|
10
|
+
export interface PrintOutcome {
|
|
11
|
+
status: keyof typeof EXIT_CODES;
|
|
12
|
+
reasonCode: string;
|
|
13
|
+
resumable: boolean;
|
|
14
|
+
}
|
|
15
|
+
/** Versioned shell protocol. Internal receipts, tool arguments and reasoning stay in Runtime. */
|
|
16
|
+
export declare class PrintEventStreamV1 {
|
|
17
|
+
private readonly writeLine?;
|
|
18
|
+
private sessionId;
|
|
19
|
+
private threadId;
|
|
20
|
+
private turnId;
|
|
21
|
+
private sequence;
|
|
22
|
+
private readonly items;
|
|
23
|
+
private committedOutcome?;
|
|
24
|
+
private terminalOutcome?;
|
|
25
|
+
private approvalRequired;
|
|
26
|
+
private projectionFailed;
|
|
27
|
+
private exitCode?;
|
|
28
|
+
constructor(writeLine?: ((line: string) => void) | undefined);
|
|
29
|
+
attach(thread: ThreadRuntimeV1, sessionId: string, resumed: boolean): () => void;
|
|
30
|
+
output(content: string): void;
|
|
31
|
+
approval(request: ToolPermissionRequest): void;
|
|
32
|
+
/** Terminate an invocation once, after all live events have drained. */
|
|
33
|
+
finish(fallback: PrintOutcome, forced?: boolean): number;
|
|
34
|
+
private emit;
|
|
35
|
+
private project;
|
|
36
|
+
}
|
|
37
|
+
export {};
|
|
38
|
+
//# sourceMappingURL=event-stream.d.ts.map
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PrintEventStreamV1 = void 0;
|
|
4
|
+
const tool_transcript_entry_1 = require("../runtime/tool-transcript-entry");
|
|
5
|
+
const turn_commit_1 = require("../runtime/turn-commit");
|
|
6
|
+
const EXIT_CODES = {
|
|
7
|
+
completed: 0,
|
|
8
|
+
failed: 1,
|
|
9
|
+
incomplete: 2,
|
|
10
|
+
approval_required: 3,
|
|
11
|
+
cancelled: 130,
|
|
12
|
+
};
|
|
13
|
+
function decisionOutcome(decision) {
|
|
14
|
+
const { status, reason, resumable } = decision;
|
|
15
|
+
return {
|
|
16
|
+
status: status === 'stopped' ||
|
|
17
|
+
status === 'blocked' ||
|
|
18
|
+
reason.code === 'budget_exhausted_without_progress'
|
|
19
|
+
? 'incomplete'
|
|
20
|
+
: status,
|
|
21
|
+
reasonCode: reason.code,
|
|
22
|
+
resumable: resumable ?? status === 'stopped',
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/** Versioned shell protocol. Internal receipts, tool arguments and reasoning stay in Runtime. */
|
|
26
|
+
class PrintEventStreamV1 {
|
|
27
|
+
constructor(writeLine) {
|
|
28
|
+
this.writeLine = writeLine;
|
|
29
|
+
this.sessionId = null;
|
|
30
|
+
this.threadId = null;
|
|
31
|
+
this.turnId = null;
|
|
32
|
+
this.sequence = 0;
|
|
33
|
+
this.items = new Map();
|
|
34
|
+
this.approvalRequired = false;
|
|
35
|
+
this.projectionFailed = false;
|
|
36
|
+
}
|
|
37
|
+
attach(thread, sessionId, resumed) {
|
|
38
|
+
if (this.threadId !== thread.threadId) {
|
|
39
|
+
this.sessionId = sessionId;
|
|
40
|
+
this.threadId = thread.threadId;
|
|
41
|
+
this.turnId = null;
|
|
42
|
+
this.items.clear();
|
|
43
|
+
this.committedOutcome = undefined;
|
|
44
|
+
this.terminalOutcome = undefined;
|
|
45
|
+
this.emit({ type: 'thread.ready', resumed });
|
|
46
|
+
}
|
|
47
|
+
return thread.observeLiveEvents(events => {
|
|
48
|
+
try {
|
|
49
|
+
for (const event of events)
|
|
50
|
+
this.project(event);
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
this.projectionFailed = true;
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
output(content) {
|
|
58
|
+
if (content.trim())
|
|
59
|
+
this.emit({ type: 'output', content });
|
|
60
|
+
}
|
|
61
|
+
approval(request) {
|
|
62
|
+
this.approvalRequired = true;
|
|
63
|
+
this.emit({ type: 'approval.requested', requestId: request.id, name: request.name });
|
|
64
|
+
}
|
|
65
|
+
/** Terminate an invocation once, after all live events have drained. */
|
|
66
|
+
finish(fallback, forced = false) {
|
|
67
|
+
if (this.exitCode !== undefined)
|
|
68
|
+
return this.exitCode;
|
|
69
|
+
const outcome = forced
|
|
70
|
+
? fallback
|
|
71
|
+
: this.approvalRequired
|
|
72
|
+
? { status: 'approval_required', reasonCode: 'approval_required', resumable: true }
|
|
73
|
+
: this.projectionFailed
|
|
74
|
+
? { status: 'failed', reasonCode: 'event_projection_failed', resumable: false }
|
|
75
|
+
: (this.terminalOutcome ?? fallback);
|
|
76
|
+
const exitCode = EXIT_CODES[outcome.status];
|
|
77
|
+
this.emit({ type: 'result', ...outcome, exitCode });
|
|
78
|
+
this.exitCode = exitCode;
|
|
79
|
+
return exitCode;
|
|
80
|
+
}
|
|
81
|
+
emit(event) {
|
|
82
|
+
if (!this.writeLine || this.exitCode !== undefined)
|
|
83
|
+
return;
|
|
84
|
+
this.writeLine(JSON.stringify({
|
|
85
|
+
schemaVersion: 1,
|
|
86
|
+
sequence: ++this.sequence,
|
|
87
|
+
sessionId: this.sessionId,
|
|
88
|
+
threadId: this.threadId,
|
|
89
|
+
turnId: this.turnId,
|
|
90
|
+
...event,
|
|
91
|
+
}) + '\n');
|
|
92
|
+
}
|
|
93
|
+
project(event) {
|
|
94
|
+
const { payload, turnId, itemId } = event;
|
|
95
|
+
if (payload.type === 'turn.started' && turnId) {
|
|
96
|
+
if (payload.data.mode === 'maintenance')
|
|
97
|
+
return;
|
|
98
|
+
this.turnId = turnId;
|
|
99
|
+
this.committedOutcome = undefined;
|
|
100
|
+
this.terminalOutcome = undefined;
|
|
101
|
+
this.items.clear();
|
|
102
|
+
this.emit({ type: 'turn.started', mode: payload.data.mode });
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
if (this.turnId === null || turnId !== this.turnId)
|
|
106
|
+
return;
|
|
107
|
+
switch (payload.type) {
|
|
108
|
+
case 'turn.committed': {
|
|
109
|
+
const commit = (0, turn_commit_1.parseTurnCommitV1)(payload.data.receipt);
|
|
110
|
+
if (commit.stopDecision) {
|
|
111
|
+
this.committedOutcome = decisionOutcome(JSON.parse(commit.stopDecision));
|
|
112
|
+
}
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
case 'turn.completed':
|
|
116
|
+
this.terminalOutcome = this.committedOutcome ?? {
|
|
117
|
+
status: 'completed',
|
|
118
|
+
reasonCode: 'completed',
|
|
119
|
+
resumable: false,
|
|
120
|
+
};
|
|
121
|
+
return;
|
|
122
|
+
case 'turn.failed':
|
|
123
|
+
this.terminalOutcome = this.committedOutcome ?? {
|
|
124
|
+
status: 'failed',
|
|
125
|
+
reasonCode: 'runtime_failure',
|
|
126
|
+
resumable: false,
|
|
127
|
+
};
|
|
128
|
+
return;
|
|
129
|
+
case 'turn.interrupted':
|
|
130
|
+
this.terminalOutcome = {
|
|
131
|
+
status: 'cancelled',
|
|
132
|
+
reasonCode: this.committedOutcome?.reasonCode ?? 'cancelled',
|
|
133
|
+
resumable: true,
|
|
134
|
+
};
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
if (!this.writeLine || !itemId)
|
|
138
|
+
return;
|
|
139
|
+
if (payload.type === 'item.started') {
|
|
140
|
+
if (payload.data.kind === 'message' && payload.data.role === 'assistant') {
|
|
141
|
+
this.items.set(itemId, { role: 'assistant' });
|
|
142
|
+
this.emit({ type: 'item.started', itemId, role: 'assistant' });
|
|
143
|
+
}
|
|
144
|
+
else if ((0, tool_transcript_entry_1.isToolTranscriptItem)(payload.data.kind)) {
|
|
145
|
+
const name = payload.data.name ?? payload.data.kind;
|
|
146
|
+
this.items.set(itemId, { tool: name });
|
|
147
|
+
this.emit({ type: 'tool.started', itemId, name });
|
|
148
|
+
}
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
const item = this.items.get(itemId);
|
|
152
|
+
if (!item)
|
|
153
|
+
return;
|
|
154
|
+
if (payload.type === 'item.delta' && item.role && payload.data.channel !== 'reasoning') {
|
|
155
|
+
this.emit({ type: 'item.delta', itemId, delta: payload.data.delta });
|
|
156
|
+
}
|
|
157
|
+
else if (payload.type === 'tool.receipt' && item.tool) {
|
|
158
|
+
item.receiptDigest = payload.data.receiptDigest;
|
|
159
|
+
}
|
|
160
|
+
else if (payload.type === 'item.completed' ||
|
|
161
|
+
payload.type === 'item.failed' ||
|
|
162
|
+
payload.type === 'item.interrupted' ||
|
|
163
|
+
payload.type === 'item.indeterminate') {
|
|
164
|
+
if (item.tool) {
|
|
165
|
+
const status = {
|
|
166
|
+
'item.completed': 'completed',
|
|
167
|
+
'item.failed': 'failed',
|
|
168
|
+
'item.interrupted': 'interrupted',
|
|
169
|
+
'item.indeterminate': 'indeterminate',
|
|
170
|
+
};
|
|
171
|
+
this.emit({
|
|
172
|
+
type: 'tool.finished',
|
|
173
|
+
itemId,
|
|
174
|
+
name: item.tool,
|
|
175
|
+
status: status[payload.type],
|
|
176
|
+
...(item.receiptDigest ? { receiptDigest: item.receiptDigest } : {}),
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
else if (payload.type === 'item.completed') {
|
|
180
|
+
this.emit({ type: 'item.completed', itemId, content: payload.data.content });
|
|
181
|
+
}
|
|
182
|
+
this.items.delete(itemId);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
exports.PrintEventStreamV1 = PrintEventStreamV1;
|
|
187
|
+
//# sourceMappingURL=event-stream.js.map
|
|
@@ -2,9 +2,13 @@ import type { EditPreviewRequest, ModelPickerRequest, OrionCodeUiRuntime, Runtim
|
|
|
2
2
|
import type { GoalRuntimeEvent } from '../runtime/goals/types';
|
|
3
3
|
import type { ResearchLifecycleEvent } from '../runtime/subagents/research-renderer';
|
|
4
4
|
import { type ResearchStatusProjection } from '../runtime/ui-view-model';
|
|
5
|
-
|
|
5
|
+
import { type UIRenderer } from '../services/global-config';
|
|
6
|
+
import { PrintEventStreamV1 } from './event-stream';
|
|
7
|
+
export type PrintOutputFormat = 'text' | 'json' | 'jsonl';
|
|
6
8
|
export interface PrintModeOptions {
|
|
7
9
|
outputFormat?: PrintOutputFormat;
|
|
10
|
+
resumeSessionId?: string;
|
|
11
|
+
eventStream?: PrintEventStreamV1;
|
|
8
12
|
}
|
|
9
13
|
export interface PrintModeResult {
|
|
10
14
|
content: string;
|
|
@@ -63,4 +67,11 @@ export declare class PrintEventSink implements UiEventSink {
|
|
|
63
67
|
}
|
|
64
68
|
export declare function readPromptFromStdinIfAvailable(stdin?: NodeJS.ReadStream): Promise<string>;
|
|
65
69
|
export declare function launchPrintMode(runtime: OrionCodeUiRuntime, input: string, options?: PrintModeOptions): Promise<number>;
|
|
70
|
+
/** Keep the shell transport separate from incidental product stdout and restore it on exit. */
|
|
71
|
+
export declare function runPrintCommand(promptArgs: readonly string[], options: {
|
|
72
|
+
uiRenderer: UIRenderer;
|
|
73
|
+
outputFormat: PrintOutputFormat;
|
|
74
|
+
strictExit: boolean;
|
|
75
|
+
resumeSessionId?: string;
|
|
76
|
+
}): Promise<number>;
|
|
66
77
|
//# sourceMappingURL=launch.d.ts.map
|