@orion-agents/orion-code 0.3.66 → 0.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +87 -0
- package/README.md +78 -361
- package/README.zh-CN.md +71 -262
- package/bin/orion +4 -1
- package/dist/acp/session-updates.d.ts +35 -0
- package/dist/acp/session-updates.js +183 -0
- package/dist/acp/sessions.d.ts +32 -0
- package/dist/acp/sessions.js +328 -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 +10 -18
- package/dist/commands/diagnostic-command-handlers.js +58 -48
- 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 +1 -19
- 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/target-command.js +49 -6
- 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/commands/workflow-commands.js +2 -2
- package/dist/framework/loop-budget-contract.d.ts +2 -8
- package/dist/framework/loop-budget-contract.js +0 -3
- package/dist/framework/loop-progress.d.ts +18 -0
- package/dist/framework/loop-progress.js +63 -0
- package/dist/framework/prompt.d.ts +0 -2
- package/dist/framework/prompt.js +9 -27
- package/dist/framework/query.d.ts +26 -31
- package/dist/framework/query.js +451 -292
- 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 +37 -12
- package/dist/harness/context-harness.js +545 -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/index.d.ts +1 -1
- package/dist/harness/intent.js +21 -0
- package/dist/harness/ledger.d.ts +7 -11
- package/dist/harness/ledger.js +50 -9
- package/dist/harness/progress-controller.d.ts +12 -7
- package/dist/harness/progress-controller.js +96 -29
- package/dist/harness/state.js +10 -1
- package/dist/harness/stop-controller.d.ts +0 -5
- package/dist/harness/stop-controller.js +11 -31
- package/dist/harness/task-checklist.d.ts +16 -0
- package/dist/harness/task-checklist.js +92 -0
- package/dist/harness/types.d.ts +78 -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 +43 -0
- package/dist/print-ui/event-stream.js +204 -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 +12 -2
- package/dist/runtime/agent-loop.js +172 -29
- package/dist/runtime/agent-runtime-controller.d.ts +14 -4
- package/dist/runtime/agent-runtime-controller.js +366 -192
- 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 +16 -4
- package/dist/runtime/goal-lifecycle-v2.js +217 -39
- package/dist/runtime/goal-runtime-coordinator.d.ts +14 -2
- package/dist/runtime/goal-runtime-coordinator.js +147 -36
- package/dist/runtime/goals/presentation.js +3 -1
- package/dist/runtime/goals/types.d.ts +1 -3
- package/dist/runtime/goals/types.js +0 -3
- package/dist/runtime/loop-budget.d.ts +0 -7
- package/dist/runtime/loop-budget.js +8 -52
- 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 +183 -46
- 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 +129 -58
- package/dist/runtime/release-receipts.d.ts +24 -133
- package/dist/runtime/release-receipts.js +129 -693
- 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 +345 -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 +4 -1
- package/dist/runtime/step-snapshot.js +11 -1
- package/dist/runtime/subagent-thread-runtime.js +27 -5
- package/dist/runtime/subagents/policy.js +0 -1
- package/dist/runtime/subagents/production.js +1 -5
- 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 +349 -0
- package/dist/runtime/task-context-service.d.ts +20 -10
- package/dist/runtime/task-context-service.js +69 -9
- package/dist/runtime/thread-admission.d.ts +3 -1
- package/dist/runtime/thread-admission.js +21 -7
- 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 +10 -0
- package/dist/runtime/thread-runtime.js +85 -3
- 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 +89 -22
- package/dist/runtime/tool-gateway.d.ts +9 -0
- package/dist/runtime/tool-gateway.js +24 -0
- package/dist/runtime/tool-receipt-validator.js +4 -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 +15 -1
- package/dist/runtime/ui-view-model.d.ts +6 -5
- package/dist/runtime/ui-view-model.js +78 -61
- package/dist/runtime/workspace-runtime-kernel.js +0 -1
- package/dist/runtime/workspace-verification.d.ts +7 -0
- package/dist/runtime/workspace-verification.js +83 -0
- 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 +29 -48
- 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 -64
- package/dist/services/global-config.js +233 -193
- package/dist/services/llm.d.ts +42 -4
- package/dist/services/llm.js +177 -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 +8 -0
- package/dist/services/provider-diagnostics.js +17 -12
- 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 +6 -2
- package/dist/tools/core/write-file.js +9 -2
- 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 +91 -30
- 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 +36 -32
- 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 +575 -0
- package/docs/orion.example.yaml +43 -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-CPDovK_K.js +0 -1
- package/dist/web-client/assets/GitPanel-DtU_TD61.js +0 -4
- package/dist/web-client/assets/ReviewPanel-vMO7BEA3.js +0 -6
- package/dist/web-client/assets/TerminalPanel-C9vDTAlS.js +0 -23
- package/dist/web-client/assets/TerminalPanel-DLuoa74B.css +0 -1
- package/dist/web-client/assets/index-CABdwh4l.css +0 -1
- package/dist/web-client/assets/index-KvshfEbl.js +0 -20
- package/dist/web-client/assets/useAutoNotice-IE1g2wcb.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
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { TodoItem } from '../framework/tool-state';
|
|
2
|
+
import type { TaskTodoItem } from './types';
|
|
3
|
+
export declare const TASK_CHECKLIST_REQUIRED = "Create an execution checklist with todo_write before changing the workspace. Include distinct implementation and verification steps. You can inspect files first.";
|
|
4
|
+
export declare function supportsExecutionChecklist(mode: string): boolean;
|
|
5
|
+
export declare const TASK_RECOVERY_STRATEGY_HISTORY_LIMIT = 4;
|
|
6
|
+
/** Deferral is applied from explicit user input. Tool arguments cannot defer work. */
|
|
7
|
+
export declare function requestedTaskDeferral(input: string): 'first' | 'current' | 'all' | undefined;
|
|
8
|
+
export declare function taskTodoDisplayStatus(todo: Omit<TaskTodoItem, 'id'>): string;
|
|
9
|
+
export declare function requestedWorkspaceChanges(instruction: string): {
|
|
10
|
+
checklistRequired: boolean;
|
|
11
|
+
paths: string[];
|
|
12
|
+
};
|
|
13
|
+
export declare function isImplementationTodo(todo: TodoItem): boolean;
|
|
14
|
+
export declare function workspaceChangeTargets(root: string, paths: readonly string[]): string[];
|
|
15
|
+
export declare function executionChecklistIssue(todos: readonly TodoItem[], targets: readonly string[], cwd: string): string | undefined;
|
|
16
|
+
//# sourceMappingURL=task-checklist.d.ts.map
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TASK_RECOVERY_STRATEGY_HISTORY_LIMIT = exports.TASK_CHECKLIST_REQUIRED = void 0;
|
|
4
|
+
exports.supportsExecutionChecklist = supportsExecutionChecklist;
|
|
5
|
+
exports.requestedTaskDeferral = requestedTaskDeferral;
|
|
6
|
+
exports.taskTodoDisplayStatus = taskTodoDisplayStatus;
|
|
7
|
+
exports.requestedWorkspaceChanges = requestedWorkspaceChanges;
|
|
8
|
+
exports.isImplementationTodo = isImplementationTodo;
|
|
9
|
+
exports.workspaceChangeTargets = workspaceChangeTargets;
|
|
10
|
+
exports.executionChecklistIssue = executionChecklistIssue;
|
|
11
|
+
const verification_1 = require("./verification");
|
|
12
|
+
const writeInstruction = /^(?:(?:please|first|then|also)\s+)*(?:implement|add|apply|edit|update|modify|change|adjust|fix|refactor|migrate|remove|rename|replace|rewrite|create|patch|write|wire|introduce|optimi[sz]e)\b|^(?:(?:请|帮我|先|再|同时)\s*)*(?:实现|开发|接入|新增|添加|应用|修改|改动|更新|调整|修复|重构|迁移|移除|删除|替换|重写|创建|编写|优化)/iu;
|
|
13
|
+
const multipleChanges = /\b(?:multi[- ](?:file|step)|cross[- ]file|multiple files|several files|across (?:the )?(?:files|modules|packages))\b|跨文件|跨模块|多步骤|多个文件|多处改动/iu;
|
|
14
|
+
const pathToken = /\x60[^\x60\r\n]+\x60|[\w.\/-]+/gu;
|
|
15
|
+
const fileExtension = /\.[a-z][a-z0-9]{0,7}$/iu;
|
|
16
|
+
const referenceClause = /\s+(?:to (?:match|follow|use)|based on|according to|using|after reading|as (?:in|described in))\s+|(?:,|\s)*(?:参考|参照|依据|基于|对照|按照)/iu;
|
|
17
|
+
const checkInstruction = /^(?:(?:verify|validate|check|review)\b|验收|验证|核对|检查|审阅)/iu;
|
|
18
|
+
const sameFileScope = /^(?:(?:edit|modify|change|update)\s+(?:only\s+)?(?:this|that|the same)\s+file(?:\s+only)?|(?:只)?(?:修改|编辑|更新)(?:这个|该|同一)文件)[.,,。]?$/iu;
|
|
19
|
+
exports.TASK_CHECKLIST_REQUIRED = 'Create an execution checklist with todo_write before changing the workspace. Include distinct implementation and verification steps. You can inspect files first.';
|
|
20
|
+
function supportsExecutionChecklist(mode) {
|
|
21
|
+
return mode === 'build' || mode === 'auto' || mode === 'goal';
|
|
22
|
+
}
|
|
23
|
+
exports.TASK_RECOVERY_STRATEGY_HISTORY_LIMIT = 4;
|
|
24
|
+
/** Deferral is applied from explicit user input. Tool arguments cannot defer work. */
|
|
25
|
+
function requestedTaskDeferral(input) {
|
|
26
|
+
const text = input.trim();
|
|
27
|
+
if (/^(?:please\s+)?(?:defer|postpone|pause)\s+(?:the\s+)?remaining\s+(?:tasks|steps)[.!]?$/iu.test(text) ||
|
|
28
|
+
/^(?:请\s*)?(?:暂缓|推迟|暂停)(?:其余|其他|剩余|后续)(?:任务|步骤)[。!]?$/u.test(text)) {
|
|
29
|
+
return 'all';
|
|
30
|
+
}
|
|
31
|
+
const limited = /^(?:please\s+)?(?:finish|complete|do)\s+(?:only\s+)?(?:the\s+)?(first|current)\s+step(?:\s+only)?\s*[,;.,;]\s*(?:defer|postpone|leave)\s+(?:the\s+)?rest(?:\s+for later)?[.!]?$/iu.exec(text);
|
|
32
|
+
if (limited)
|
|
33
|
+
return limited[1].toLowerCase() === 'first' ? 'first' : 'current';
|
|
34
|
+
const chinese = /^(?:请\s*)?先\s*(?:把|完成|做完)?\s*(第[一1]步|当前(?:这)?一步)(?:做完|完成)?[,,;;]\s*(?:其他|其余|剩余|后续)(?:的)?(?:任务|步骤)?\s*(?:先)?(?:之后再说|以后再做|稍后再做|暂缓|延期)[。!]?$/u.exec(text);
|
|
35
|
+
if (chinese)
|
|
36
|
+
return chinese[1].startsWith('第') ? 'first' : 'current';
|
|
37
|
+
return undefined;
|
|
38
|
+
}
|
|
39
|
+
function taskTodoDisplayStatus(todo) {
|
|
40
|
+
if (todo.deferredReason)
|
|
41
|
+
return 'deferred';
|
|
42
|
+
return todo.status;
|
|
43
|
+
}
|
|
44
|
+
function modificationClauses(instruction) {
|
|
45
|
+
return instruction
|
|
46
|
+
.replace(/^[ \t]*\x60{3}[^\r\n]*\r?\n[\s\S]*?^[ \t]*\x60{3}[^\r\n]*/gmu, '')
|
|
47
|
+
.split(/\r?\n|[;;]|\b(?:and then|then|and(?=\s+(?:verify|test|run|check|implement|edit|update|modify|fix|refactor|create|write)\b))\b|然后|(?:再|并)(?=实现|修改|更新|修复|新增|添加|重构|删除|运行|验证|测试)/iu)
|
|
48
|
+
.map(part => part.trim().replace(/^(?:[-*]|\d+[.、)])\s*/u, ''))
|
|
49
|
+
.filter(part => writeInstruction.test(part));
|
|
50
|
+
}
|
|
51
|
+
function pathsInActions(actions) {
|
|
52
|
+
return [
|
|
53
|
+
...new Set(actions.flatMap(action => (action.split(referenceClause, 1)[0].match(pathToken) ?? [])
|
|
54
|
+
.map(token => token.replace(/^\x60|\x60$|\.+$/gu, ''))
|
|
55
|
+
.filter(token => fileExtension.test(token)))),
|
|
56
|
+
];
|
|
57
|
+
}
|
|
58
|
+
function requestedWorkspaceChanges(instruction) {
|
|
59
|
+
const actions = modificationClauses(instruction);
|
|
60
|
+
const paths = pathsInActions(actions);
|
|
61
|
+
// A scope reminder like "edit that file only" refers to the one named
|
|
62
|
+
// target and does not introduce a second implementation step.
|
|
63
|
+
const distinctActions = paths.length === 1 ? actions.filter(action => !sameFileScope.test(action)) : actions;
|
|
64
|
+
return {
|
|
65
|
+
paths,
|
|
66
|
+
checklistRequired: distinctActions.length > 1 ||
|
|
67
|
+
paths.length > 1 ||
|
|
68
|
+
actions.some(action => multipleChanges.test(action)),
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
function isVerification(todo) {
|
|
72
|
+
return Boolean(todo.verification?.length) || checkInstruction.test(todo.content);
|
|
73
|
+
}
|
|
74
|
+
function isImplementationTodo(todo) {
|
|
75
|
+
return !isVerification(todo) && modificationClauses(todo.content).length > 0;
|
|
76
|
+
}
|
|
77
|
+
function workspaceChangeTargets(root, paths) {
|
|
78
|
+
return [
|
|
79
|
+
...new Set(paths
|
|
80
|
+
.map(path => (0, verification_1.workspaceArtifactPath)(root, path))
|
|
81
|
+
.filter((path) => path !== undefined)),
|
|
82
|
+
];
|
|
83
|
+
}
|
|
84
|
+
function executionChecklistIssue(todos, targets, cwd) {
|
|
85
|
+
const implementation = todos.filter(isImplementationTodo);
|
|
86
|
+
if (!todos.some(isVerification) || implementation.length === 0)
|
|
87
|
+
return exports.TASK_CHECKLIST_REQUIRED;
|
|
88
|
+
const planned = new Set(workspaceChangeTargets(cwd, implementation.flatMap(todo => requestedWorkspaceChanges(todo.content).paths)));
|
|
89
|
+
const missing = targets.filter(path => !planned.has(path));
|
|
90
|
+
return missing.length ? `${exports.TASK_CHECKLIST_REQUIRED} Include: ${missing.join(', ')}.` : undefined;
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=task-checklist.js.map
|
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,63 @@ 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;
|
|
248
|
+
verificationWorkspace?: string;
|
|
191
249
|
capsule?: ContextCapsule;
|
|
192
250
|
completionBlockCount?: number;
|
|
193
251
|
taskEpoch?: number;
|
|
252
|
+
taskChecklistRequired?: boolean;
|
|
253
|
+
taskChecklistTargets?: string[];
|
|
254
|
+
goalTaskId?: string;
|
|
255
|
+
taskTodos?: (Omit<TaskTodoItem, 'id'> & {
|
|
256
|
+
id?: string;
|
|
257
|
+
})[];
|
|
258
|
+
taskTodoReceipts?: TaskTodoReceipt[];
|
|
194
259
|
rootObjective?: string;
|
|
195
260
|
activeInstruction?: string;
|
|
196
261
|
intentHistory?: IntentUpdate[];
|
|
@@ -238,7 +303,7 @@ export interface CompletionGateResult {
|
|
|
238
303
|
progressDelta?: ProgressDelta;
|
|
239
304
|
stopDecision?: import('../framework/stop-decision').StopDecision;
|
|
240
305
|
}
|
|
241
|
-
export type VerificationKind = 'test' | 'build' | 'lint' | 'typecheck' | 'diff' | 'git' | 'ci' | 'release' | 'generic';
|
|
306
|
+
export type VerificationKind = 'test' | 'build' | 'lint' | 'typecheck' | 'diff' | 'git' | 'ci' | 'release' | 'file' | 'generic';
|
|
242
307
|
export interface CompletionCriterionResult {
|
|
243
308
|
criterionId: string;
|
|
244
309
|
statement: string;
|
|
@@ -257,15 +322,24 @@ export interface ProgressSnapshot {
|
|
|
257
322
|
}>;
|
|
258
323
|
evidenceRefs: string[];
|
|
259
324
|
changedFiles: string[];
|
|
325
|
+
workspaceRevision?: number;
|
|
326
|
+
verificationObservations?: string[];
|
|
327
|
+
exploredPaths?: string[];
|
|
328
|
+
explorationObservations?: string[];
|
|
329
|
+
decisionObservations?: string[];
|
|
330
|
+
todoStateHash?: string;
|
|
260
331
|
decisions: string[];
|
|
261
332
|
blockers: string[];
|
|
262
333
|
diagnostics: string[];
|
|
263
334
|
toolSignature?: string;
|
|
264
335
|
workspaceStateHash: string;
|
|
265
336
|
}
|
|
337
|
+
export type ProgressReason = 'workspace_change' | 'verification_change' | 'explicit_task_state' | 'readonly_exploration' | 'agent_output' | 'no_effect';
|
|
338
|
+
export type ProgressCounts = Record<Exclude<ProgressReason, 'no_effect'>, number>;
|
|
266
339
|
export interface ProgressDelta {
|
|
267
340
|
schemaVersion: 1;
|
|
268
341
|
changed: boolean;
|
|
342
|
+
reason?: ProgressReason;
|
|
269
343
|
criterionChanges: Array<{
|
|
270
344
|
id: string;
|
|
271
345
|
from?: TaskCriterionStatus;
|
|
@@ -273,6 +347,7 @@ export interface ProgressDelta {
|
|
|
273
347
|
}>;
|
|
274
348
|
newEvidenceRefs: string[];
|
|
275
349
|
newChangedFiles: string[];
|
|
350
|
+
newExploredPaths?: string[];
|
|
276
351
|
newDecisions: string[];
|
|
277
352
|
newBlockers: string[];
|
|
278
353
|
newDiagnostics: string[];
|
|
@@ -285,6 +360,8 @@ export interface HarnessProgressState {
|
|
|
285
360
|
schemaVersion: 1;
|
|
286
361
|
snapshot?: ProgressSnapshot;
|
|
287
362
|
lastDelta?: ProgressDelta;
|
|
363
|
+
/** Cumulative observations by category since progress counting began for this thread. */
|
|
364
|
+
progressCountedByReason?: ProgressCounts;
|
|
288
365
|
}
|
|
289
366
|
export interface CapabilityProfile {
|
|
290
367
|
schemaVersion: 1;
|
|
@@ -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,43 @@
|
|
|
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
|
+
reasonMessage?: string;
|
|
14
|
+
resumable: boolean;
|
|
15
|
+
metrics?: {
|
|
16
|
+
llmRequests: number;
|
|
17
|
+
toolCalls: number;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
/** Versioned shell protocol. Internal receipts, tool arguments and reasoning stay in Runtime. */
|
|
21
|
+
export declare class PrintEventStreamV1 {
|
|
22
|
+
private readonly writeLine?;
|
|
23
|
+
private sessionId;
|
|
24
|
+
private threadId;
|
|
25
|
+
private turnId;
|
|
26
|
+
private sequence;
|
|
27
|
+
private readonly items;
|
|
28
|
+
private committedOutcome?;
|
|
29
|
+
private terminalOutcome?;
|
|
30
|
+
private approvalRequired;
|
|
31
|
+
private projectionFailed;
|
|
32
|
+
private exitCode?;
|
|
33
|
+
constructor(writeLine?: ((line: string) => void) | undefined);
|
|
34
|
+
attach(thread: ThreadRuntimeV1, sessionId: string, resumed: boolean): () => void;
|
|
35
|
+
output(content: string): void;
|
|
36
|
+
approval(request: ToolPermissionRequest): void;
|
|
37
|
+
/** Terminate an invocation once, after all live events have drained. */
|
|
38
|
+
finish(fallback: PrintOutcome, forced?: boolean): number;
|
|
39
|
+
private emit;
|
|
40
|
+
private project;
|
|
41
|
+
}
|
|
42
|
+
export {};
|
|
43
|
+
//# sourceMappingURL=event-stream.d.ts.map
|