@orion-agents/orion-code 0.4.6 → 0.4.7
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 +9 -1
- package/README.md +7 -7
- package/README.zh-CN.md +7 -7
- package/dist/framework/verification-command.d.ts +2 -0
- package/dist/framework/verification-command.js +16 -4
- package/dist/harness/assembler.d.ts +1 -0
- package/dist/harness/assembler.js +5 -2
- package/dist/harness/clarification.d.ts +3 -0
- package/dist/harness/clarification.js +56 -0
- package/dist/harness/context-harness.js +32 -4
- package/dist/harness/contract.js +36 -10
- package/dist/harness/drift-guard.js +12 -4
- package/dist/harness/goal-verification.d.ts +2 -0
- package/dist/harness/goal-verification.js +42 -0
- package/dist/harness/intent.js +10 -12
- package/dist/harness/state.js +15 -2
- package/dist/harness/task-checklist.js +1 -1
- package/dist/harness/verification.d.ts +2 -0
- package/dist/harness/verification.js +16 -5
- package/dist/runtime/agent-loop.js +49 -27
- package/dist/runtime/agent-runtime-controller.js +1 -1
- package/dist/runtime/plan-review.d.ts +1 -0
- package/dist/runtime/plan-review.js +12 -7
- package/dist/runtime/product-orion-runtime.js +1 -1
- package/dist/runtime/step-snapshot.d.ts +1 -0
- package/dist/runtime/step-snapshot.js +2 -1
- package/dist/runtime/task-context-recovery.js +15 -7
- package/dist/runtime/tool-gateway.js +1 -0
- package/docs/cli-guide.md +4 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -22,7 +22,15 @@ which is **not** a pass.
|
|
|
22
22
|
|
|
23
23
|
## [Unreleased]
|
|
24
24
|
|
|
25
|
-
## [0.4.
|
|
25
|
+
## [0.4.7] — UNRELEASED
|
|
26
|
+
|
|
27
|
+
- Answer read-only explanations and status questions within existing sessions while retaining their task checklists and verification requirements (#405).
|
|
28
|
+
- Match custom workflow verification against the requested command, working directory, and fresh executor receipt. Ask for an exact check when a requirement lacks one (#406).
|
|
29
|
+
|
|
30
|
+
## [0.4.6] — 2026-12-04 (Published)
|
|
31
|
+
|
|
32
|
+
The npm package was built from `878a8424d3775654521a6dcbd101aa0a6891a758` and published by
|
|
33
|
+
[GitHub Actions](https://github.com/orion-agents/orion-code/actions/runs/47271619041).
|
|
26
34
|
|
|
27
35
|
- Keep the transcript, status, and composer in place when opening or closing slash command and file suggestions in the TUI.
|
|
28
36
|
- Match slash commands by name or alias. Tab completes the name while preserving arguments, and Esc closes the picker without clearing the draft.
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Local-first, goal-driven coding agent for the terminal (CLI/TUI).
|
|
4
4
|
|
|
5
|
-
> v0.4.
|
|
5
|
+
> v0.4.7 is a candidate for clarification and workflow verification fixes.
|
|
6
6
|
> Web Workbench and desktop product surfaces are retired. Configuration is `orion.yaml`;
|
|
7
7
|
> old-version data compatibility and migration are not part of this release.
|
|
8
8
|
> A version number or local installation is not proof of release qualification or npm publication.
|
|
@@ -27,21 +27,21 @@ does not prove that a particular model or coding task passed quality evaluation.
|
|
|
27
27
|
Supported Node.js: **22.x (22.12+), 24.x or 26.x**.
|
|
28
28
|
The exact package qualification floors are 22.12.0 / 24.0.0 / 26.0.0.
|
|
29
29
|
|
|
30
|
-
Install
|
|
30
|
+
Install the exact candidate tarball from the path where it was built.
|
|
31
31
|
|
|
32
32
|
```bash
|
|
33
|
-
npm install -g /absolute/path/orion-agents-orion-code-0.4.
|
|
33
|
+
npm install -g /absolute/path/orion-agents-orion-code-0.4.7.tgz
|
|
34
34
|
orion --version
|
|
35
35
|
orion doctor
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
Use the following command once version 0.4.7 is available on npm.
|
|
39
39
|
|
|
40
40
|
```bash
|
|
41
|
-
npm install -g @orion-agents/orion-code@0.4.
|
|
41
|
+
npm install -g @orion-agents/orion-code@0.4.7
|
|
42
42
|
```
|
|
43
43
|
|
|
44
|
-
From a checkout
|
|
44
|
+
From a source checkout:
|
|
45
45
|
|
|
46
46
|
```bash
|
|
47
47
|
npm ci
|
|
@@ -108,7 +108,7 @@ npm run format:check
|
|
|
108
108
|
npm run build
|
|
109
109
|
npm run test:coverage -- --runInBand
|
|
110
110
|
npm run test:harness-confluence
|
|
111
|
-
npm run release:check -- --expected-version 0.4.
|
|
111
|
+
npm run release:check -- --expected-version 0.4.7
|
|
112
112
|
```
|
|
113
113
|
|
|
114
114
|
Qualification binds one exact tarball's SHA-256 and source identity to installed CLI, TUI, terminal,
|
package/README.zh-CN.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
面向终端、本地优先的目标驱动 Coding Agent(CLI/TUI)。
|
|
4
4
|
|
|
5
|
-
> v0.4.
|
|
5
|
+
> v0.4.7 是修复说明问答与工作流验证的候选版本。
|
|
6
6
|
> Web Workbench 与桌面产品链已退役,全局配置统一为 `orion.yaml`。
|
|
7
7
|
> 源码版本号、本地可运行、候选包验收与 npm 发布分别记录,不互相替代。
|
|
8
8
|
|
|
@@ -25,21 +25,21 @@
|
|
|
25
25
|
支持 **Node.js 22.x(至少 22.12)、24.x 或 26.x**。
|
|
26
26
|
精确候选包的验收 floor 为 22.12.0 / 24.0.0 / 26.0.0。
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
用构建产出的候选包安装,请替换为实际路径。
|
|
29
29
|
|
|
30
30
|
```bash
|
|
31
|
-
npm install -g /absolute/path/orion-agents-orion-code-0.4.
|
|
31
|
+
npm install -g /absolute/path/orion-agents-orion-code-0.4.7.tgz
|
|
32
32
|
orion --version
|
|
33
33
|
orion doctor
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
确认 npm 已有 0.4.7 后,可按固定版本安装。
|
|
37
37
|
|
|
38
38
|
```bash
|
|
39
|
-
npm install -g @orion-agents/orion-code@0.4.
|
|
39
|
+
npm install -g @orion-agents/orion-code@0.4.7
|
|
40
40
|
```
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
从源码运行:
|
|
43
43
|
|
|
44
44
|
```bash
|
|
45
45
|
npm ci
|
|
@@ -104,7 +104,7 @@ npm run format:check
|
|
|
104
104
|
npm run build
|
|
105
105
|
npm run test:coverage -- --runInBand
|
|
106
106
|
npm run test:harness-confluence
|
|
107
|
-
npm run release:check -- --expected-version 0.4.
|
|
107
|
+
npm run release:check -- --expected-version 0.4.7
|
|
108
108
|
```
|
|
109
109
|
|
|
110
110
|
准出需绑定同一 tarball 的 SHA-256 与源码身份,在三个 Node floor 验证安装后的 CLI、TUI、
|
|
@@ -12,4 +12,6 @@ export interface LocalVerificationReceipt {
|
|
|
12
12
|
export declare function isLocalVerificationKind(value: unknown): value is LocalVerificationKind;
|
|
13
13
|
export declare const SHELL_CONTROL_OPERATOR: RegExp;
|
|
14
14
|
export declare function classifyDirectVerificationCommand(command: string): VerificationCommandKind | undefined;
|
|
15
|
+
/** Support an explicitly requested script without treating arbitrary script runs as checks. */
|
|
16
|
+
export declare function classifyVerificationSelector(command: string): VerificationCommandKind | undefined;
|
|
15
17
|
//# sourceMappingURL=verification-command.d.ts.map
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.SHELL_CONTROL_OPERATOR = exports.LOCAL_VERIFICATION_KINDS = void 0;
|
|
4
4
|
exports.isLocalVerificationKind = isLocalVerificationKind;
|
|
5
5
|
exports.classifyDirectVerificationCommand = classifyDirectVerificationCommand;
|
|
6
|
+
exports.classifyVerificationSelector = classifyVerificationSelector;
|
|
6
7
|
exports.LOCAL_VERIFICATION_KINDS = ['test', 'build', 'lint', 'typecheck', 'diff'];
|
|
7
8
|
function isLocalVerificationKind(value) {
|
|
8
9
|
return exports.LOCAL_VERIFICATION_KINDS.some(kind => kind === value);
|
|
@@ -19,14 +20,25 @@ const directChecks = {
|
|
|
19
20
|
const nonCheckingOption = /(?:^|[\s'"])(?:-h|--help|--version|--listTests|--listFilesOnly|--showConfig|--collect-only|--dry-run|--no-run|--passWithNoTests|--pass-with-no-tests|--if-present|-list)(?=[\s'"=]|$)/u;
|
|
20
21
|
const nonCheckingInvocation = /^(?:npx\s+)?(?:vitest\s+list|tsc\s+(?:-v|--init))(?=\s|$)/u;
|
|
21
22
|
const fileAssertion = /^test\s+-(?:e|f|d|s)\s+(?:"[^"]+"|'[^']+'|[^\s'"<>]+)$/u;
|
|
23
|
+
const customCheck = /^(?:(?:python3?|node)\s+(?:"[^"]+\.(?:py|[cm]?js)"|'[^']+\.(?:py|[cm]?js)'|[^\s'"<>]+\.(?:py|[cm]?js))|\.\/[^\s'"<>]+|(?:npm|pnpm|yarn|bun)\s+run\s+[\w:.-]+)(?=\s|$)/u;
|
|
24
|
+
function isCheckingInvocation(command) {
|
|
25
|
+
return (!exports.SHELL_CONTROL_OPERATOR.test(command) &&
|
|
26
|
+
!nonCheckingOption.test(command) &&
|
|
27
|
+
!nonCheckingInvocation.test(command));
|
|
28
|
+
}
|
|
22
29
|
function classifyDirectVerificationCommand(command) {
|
|
23
30
|
const normalized = command.trim();
|
|
24
|
-
if (
|
|
25
|
-
nonCheckingOption.test(normalized) ||
|
|
26
|
-
nonCheckingInvocation.test(normalized)) {
|
|
31
|
+
if (!isCheckingInvocation(normalized))
|
|
27
32
|
return undefined;
|
|
28
|
-
}
|
|
29
33
|
return (exports.LOCAL_VERIFICATION_KINDS.find(kind => directChecks[kind].test(normalized)) ??
|
|
30
34
|
(fileAssertion.test(normalized) ? 'generic' : undefined));
|
|
31
35
|
}
|
|
36
|
+
/** Support an explicitly requested script without treating arbitrary script runs as checks. */
|
|
37
|
+
function classifyVerificationSelector(command) {
|
|
38
|
+
const normalized = command.trim();
|
|
39
|
+
return (classifyDirectVerificationCommand(normalized) ??
|
|
40
|
+
(isCheckingInvocation(normalized) && !/[<>]/u.test(normalized) && customCheck.test(normalized)
|
|
41
|
+
? 'generic'
|
|
42
|
+
: undefined));
|
|
43
|
+
}
|
|
32
44
|
//# sourceMappingURL=verification-command.js.map
|
|
@@ -77,7 +77,8 @@ function buildHarnessContext(state, modelId, config = {}, options = {}) {
|
|
|
77
77
|
state.ledger.length === 0 &&
|
|
78
78
|
!state.capsule &&
|
|
79
79
|
!state.rootObjective &&
|
|
80
|
-
!state.capabilityProfile
|
|
80
|
+
!state.capabilityProfile &&
|
|
81
|
+
!options.answeringQuestion) {
|
|
81
82
|
const emptyStats = {
|
|
82
83
|
createdAt: Date.now(),
|
|
83
84
|
modelId,
|
|
@@ -161,7 +162,9 @@ function buildHarnessContext(state, modelId, config = {}, options = {}) {
|
|
|
161
162
|
if (tools.length > 0) {
|
|
162
163
|
pushList(coreLines, 'Relevant available tools', tools, 8);
|
|
163
164
|
}
|
|
164
|
-
const finalInstruction =
|
|
165
|
+
const finalInstruction = options.answeringQuestion
|
|
166
|
+
? 'Answer the latest question using the task and verification context. Leave execution and checklist changes for a request to continue the work.'
|
|
167
|
+
: 'Instruction: preserve the root objective across short feedback or refinements. Do not claim verification unless it is listed above or produced by a tool result in this turn.';
|
|
165
168
|
const coreText = coreLines.join('\n');
|
|
166
169
|
const coreTokens = (0, evidence_1.estimateTokens)(coreText);
|
|
167
170
|
const instructionTokens = (0, evidence_1.estimateTokens)(finalInstruction);
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isReadOnlyQuestion = isReadOnlyQuestion;
|
|
4
|
+
const englishRequestPrefix = /^(?:(?:please|first|then|also|just)\s+|(?:can|could|would|will)\s+you\s+|i (?:want|would like) you to\s+)+/iu;
|
|
5
|
+
const chineseRequestPrefix = /^(?:(?:请|麻烦你|帮我|先|再|然后|同时)\s*)+/u;
|
|
6
|
+
const englishQuestion = /^(?:what|why|how|who|when|where|which)\b/iu;
|
|
7
|
+
const chineseQuestion = /^(?:为什么|为何|谁|怎么|如何|哪些|哪个)/u;
|
|
8
|
+
const embeddedQuestion = /^(?:explain|clarify|describe)(?:\s+to me)?\s+(?:what|why|how|when|where)\s+(?:i|we|you|they)\s+(?:can|could|should|must|may|would|do)\b|^(?:解释|说明)(?:一下)?\s*(?:怎么|如何|(?:为什么|为何)(?:要|需要|必须|应该|得))/iu;
|
|
9
|
+
const englishExplanation = /^(?:explain|clarify|describe)\b|^(?:tell me|show me)\s+(?:what|why|how|who|when|where|which)\b/iu;
|
|
10
|
+
const chineseExplanation = /(?:什么意思|解释(?:一下|说明)?|说明一下|能否说明)/u;
|
|
11
|
+
const englishStatus = /^(?:report|show(?: me)?|tell me|summarize)\s+(?:the\s+)?(?:current\s+)?(?:context(?:\s+(?:usage|size|window))?\b|(?:task|goal|session|test|build)\s+status\b|status\b|progress\b)/iu;
|
|
12
|
+
const chineseStatus = /^(?:(?:请|帮我|报告|汇报|查看|告诉我|展示|说一下|列出|总结)(?:一下)?\s*)*(?:当前|现在|目前)?(?:的)?\s*(?:上下文|会话|任务|目标|测试|构建|验证|进度)(?:[^??。\r\n]{0,28})(?:多少|剩余|用量|占用|状态|进度|报告一下|汇报一下|怎么样|结果)/u;
|
|
13
|
+
const englishExecution = /^(?:run|rerun|execute|verify|validate|check|test|build|compile|lint|typecheck|fix|implement|add|adjust|apply|edit|update|modify|change|write|create|delete|remove|replace|rename|refactor|continue|resume|retry|start|commit|merge|push|publish|deploy)\b|^(?:(?:the\s+)?(?:tests?|build|lint|ci)\b.{0,44}\b(?:must|should|needs? to|required to)\b)/iu;
|
|
14
|
+
const chineseExecution = /^(?:执行|运行|重新运行|跑(?:一下|测试|检查|验证|\s*(?:npm|pnpm|yarn|pytest))|重跑|验证|测试|检查|构建|编译|修复|实现|修改|更新|调整|添加|新增|删除|替换|改用|换成|改为|创建|写入|重构|提交|合并|推送|发布|部署|继续|接着|恢复|重试)|^(?:把|将).{1,100}(?:改为|换成|替换|修改|重跑|执行|运行|改成)|^(?:测试|构建|验证|检查).{0,24}(?:必须|需要|务必)(?:通过|成功)/u;
|
|
15
|
+
const actionConjunction = /\b(?:and then|then|and|also)\b\s*|,\s*(?=please\b|just\b)|(?:然后|并且|同时|另外|再|并)/iu;
|
|
16
|
+
const explicitActionConjunction = /\b(?:and then|then|and|also)\b\s+(?=please\b|(?:can|could|would|will)\s+you\b)|,\s*(?:and then|then|also)\b\s+|(?:然后|并且|同时|另外|再|并)(?=\s*(?:请|帮我|麻烦你))/iu;
|
|
17
|
+
function stripRequestPrefix(text) {
|
|
18
|
+
return text.trim().replace(englishRequestPrefix, '').replace(chineseRequestPrefix, '');
|
|
19
|
+
}
|
|
20
|
+
function requestsExecution(text) {
|
|
21
|
+
const action = stripRequestPrefix(text);
|
|
22
|
+
return englishExecution.test(action) || chineseExecution.test(action);
|
|
23
|
+
}
|
|
24
|
+
/** Identify a question about work without treating quoted or described work as an instruction. */
|
|
25
|
+
function isReadOnlyQuestion(input) {
|
|
26
|
+
const prose = input
|
|
27
|
+
.replace(/^[ \t]*\x60{3}[^\r\n]*\r?\n[\s\S]*?^[ \t]*\x60{3}[^\r\n]*/gmu, ' ')
|
|
28
|
+
.replace(/\x60[^\x60\r\n]+\x60|“[^”\r\n]+”|「[^」\r\n]+」|‘[^’\r\n]+’|"[^"\r\n]+"|(?<![\p{L}\p{N}])'[^'\r\n]+'(?![\p{L}\p{N}])/gu, ' reference ');
|
|
29
|
+
const clauses = prose
|
|
30
|
+
.split(/[!??!。;;\r\n]+|\.(?=\s|$)/u)
|
|
31
|
+
.map(clause => clause.trim().replace(/^(?:[-*+]|\d+[.)、])\s+/u, ''))
|
|
32
|
+
.filter(Boolean);
|
|
33
|
+
let sawQuestion = false;
|
|
34
|
+
for (const clause of clauses) {
|
|
35
|
+
const request = stripRequestPrefix(clause);
|
|
36
|
+
const directQuestion = englishQuestion.test(request) || chineseQuestion.test(request);
|
|
37
|
+
const question = directQuestion ||
|
|
38
|
+
englishExplanation.test(request) ||
|
|
39
|
+
chineseExplanation.test(request) ||
|
|
40
|
+
englishStatus.test(request) ||
|
|
41
|
+
chineseStatus.test(clause);
|
|
42
|
+
if (requestsExecution(clause))
|
|
43
|
+
return false;
|
|
44
|
+
// A list of verbs inside "why do we build and test?" describes what the
|
|
45
|
+
// user is asking about. Instructions after a sentence boundary, or with
|
|
46
|
+
// an explicit request marker, can still ask the agent to act.
|
|
47
|
+
const conjunction = directQuestion || embeddedQuestion.test(request)
|
|
48
|
+
? explicitActionConjunction
|
|
49
|
+
: actionConjunction;
|
|
50
|
+
if (clause.split(conjunction).slice(1).some(requestsExecution))
|
|
51
|
+
return false;
|
|
52
|
+
sawQuestion || (sawQuestion = question);
|
|
53
|
+
}
|
|
54
|
+
return sawQuestion;
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=clarification.js.map
|
|
@@ -12,6 +12,7 @@ const verification_command_1 = require("../framework/verification-command");
|
|
|
12
12
|
const assembler_1 = require("./assembler");
|
|
13
13
|
const capability_profile_1 = require("./capability-profile");
|
|
14
14
|
const capsule_1 = require("./capsule");
|
|
15
|
+
const clarification_1 = require("./clarification");
|
|
15
16
|
const contract_1 = require("./contract");
|
|
16
17
|
const drift_guard_1 = require("./drift-guard");
|
|
17
18
|
const evidence_1 = require("./evidence");
|
|
@@ -89,6 +90,12 @@ class HarnessKernel {
|
|
|
89
90
|
return;
|
|
90
91
|
if (goalTaskId && this.goalTaskId === goalTaskId && this.contract)
|
|
91
92
|
return;
|
|
93
|
+
const classified = (0, intent_1.classifyIntent)(input, this.toJSON());
|
|
94
|
+
if (!goalTaskId && classified.kind === 'clarification') {
|
|
95
|
+
this.intentHistory = [...this.intentHistory, classified].slice(-40);
|
|
96
|
+
this.touch();
|
|
97
|
+
return classified;
|
|
98
|
+
}
|
|
92
99
|
const deferral = (0, task_checklist_1.requestedTaskDeferral)(input);
|
|
93
100
|
if (deferral &&
|
|
94
101
|
this.goalTaskId === goalTaskId &&
|
|
@@ -96,7 +103,6 @@ class HarnessKernel {
|
|
|
96
103
|
this.deferTaskTodos(deferral);
|
|
97
104
|
return;
|
|
98
105
|
}
|
|
99
|
-
const classified = (0, intent_1.classifyIntent)(input, this.toJSON());
|
|
100
106
|
const ownerChanged = this.goalTaskId !== goalTaskId;
|
|
101
107
|
const intent = ownerChanged
|
|
102
108
|
? {
|
|
@@ -160,8 +166,25 @@ class HarnessKernel {
|
|
|
160
166
|
}
|
|
161
167
|
observeGoalSteering(input, goalId) {
|
|
162
168
|
const contract = this.contract;
|
|
163
|
-
if (!contract ||
|
|
169
|
+
if (!contract ||
|
|
170
|
+
this.goalTaskId !== goalId ||
|
|
171
|
+
this.config.enabled === false ||
|
|
172
|
+
(0, clarification_1.isReadOnlyQuestion)(input))
|
|
173
|
+
return;
|
|
174
|
+
const bound = (0, goal_verification_1.bindUnspecifiedVerification)(contract, input);
|
|
175
|
+
if (bound) {
|
|
176
|
+
this.ledger.recordUserRequirement(input);
|
|
177
|
+
this.contract = {
|
|
178
|
+
...bound,
|
|
179
|
+
userIntent: input.trim(),
|
|
180
|
+
updatedAt: Math.max(Date.now(), contract.updatedAt + 1),
|
|
181
|
+
};
|
|
182
|
+
this.activeInstruction = input.trim();
|
|
183
|
+
this.goalVerificationBlocker = undefined;
|
|
184
|
+
this.refreshCapsule();
|
|
185
|
+
this.touch();
|
|
164
186
|
return;
|
|
187
|
+
}
|
|
165
188
|
const correction = (0, goal_verification_1.goalVerificationCorrection)(contract, input);
|
|
166
189
|
if (!correction)
|
|
167
190
|
return;
|
|
@@ -980,14 +1003,19 @@ class HarnessKernel {
|
|
|
980
1003
|
if (!this.contract?.criteria || !(0, verification_1.isTrustedEvidence)(entry))
|
|
981
1004
|
return;
|
|
982
1005
|
const kind = (0, verification_1.verificationKindForEntry)(entry, this.requireLocalVerificationReceipt);
|
|
983
|
-
if (kind === 'generic' &&
|
|
1006
|
+
if (kind === 'generic' &&
|
|
1007
|
+
(entry.type !== 'verification' ||
|
|
1008
|
+
(this.requireLocalVerificationReceipt &&
|
|
1009
|
+
typeof entry.metadata?.toolReceiptDigest !== 'string'))) {
|
|
984
1010
|
return;
|
|
1011
|
+
}
|
|
985
1012
|
const workspace = this.contract.allowedScope.cwd;
|
|
986
1013
|
for (const criterion of this.contract.criteria) {
|
|
987
1014
|
if (!(0, verification_1.requiredVerificationKinds)(criterion.statement).includes(kind))
|
|
988
1015
|
continue;
|
|
989
1016
|
const checks = (0, verification_1.requestedLocalChecks)(criterion.statement).filter(check => check.kind === kind);
|
|
990
|
-
if (
|
|
1017
|
+
if ((kind === 'generic' || checks.length) &&
|
|
1018
|
+
!checks.some(check => (0, verification_1.matchesRequestedCheck)(entry, check, workspace)))
|
|
991
1019
|
continue;
|
|
992
1020
|
this.updateCriterionEvidence(criterion.id, entry.id);
|
|
993
1021
|
}
|
package/dist/harness/contract.js
CHANGED
|
@@ -5,9 +5,13 @@ exports.normalizeTaskContract = normalizeTaskContract;
|
|
|
5
5
|
exports.createTaskContract = createTaskContract;
|
|
6
6
|
exports.updateTaskContract = updateTaskContract;
|
|
7
7
|
const crypto_1 = require("crypto");
|
|
8
|
+
const clarification_1 = require("./clarification");
|
|
9
|
+
const goal_verification_1 = require("./goal-verification");
|
|
8
10
|
const verification_1 = require("./verification");
|
|
9
11
|
function normalizeLine(text) {
|
|
10
|
-
return text
|
|
12
|
+
return text
|
|
13
|
+
.trim()
|
|
14
|
+
.replace(/\x60[^\x60\r\n]+\x60|\s+/gu, value => (value.startsWith('\x60') ? value : ' '));
|
|
11
15
|
}
|
|
12
16
|
function cleanLine(line) {
|
|
13
17
|
return line.replace(/^[-*+\d.)\s]+/, '').trim();
|
|
@@ -29,7 +33,11 @@ function isObjectiveFallback(item) {
|
|
|
29
33
|
return item.startsWith('Address the objective: ');
|
|
30
34
|
}
|
|
31
35
|
function stableCriterionId(statement) {
|
|
32
|
-
const
|
|
36
|
+
const normalized = normalizeLine(statement)
|
|
37
|
+
.split(/(\x60[^\x60\r\n]+\x60)/u)
|
|
38
|
+
.map((part, index) => (index % 2 === 0 ? part.toLowerCase() : part))
|
|
39
|
+
.join('');
|
|
40
|
+
const digest = (0, crypto_1.createHash)('sha256').update(normalized).digest('hex');
|
|
33
41
|
return `criterion:harness:${digest.slice(0, 16)}`;
|
|
34
42
|
}
|
|
35
43
|
function normalizeCriterionStatus(criterion) {
|
|
@@ -128,7 +136,19 @@ function extractExplicitObjective(input) {
|
|
|
128
136
|
return undefined;
|
|
129
137
|
}
|
|
130
138
|
function normalizeTaskContract(contract) {
|
|
131
|
-
const
|
|
139
|
+
const isInferredQuestion = (item) => {
|
|
140
|
+
if (!(0, clarification_1.isReadOnlyQuestion)(item))
|
|
141
|
+
return false;
|
|
142
|
+
const statement = normalizeLine(item);
|
|
143
|
+
return !(contract.criteria ?? []).some(criterion => typeof criterion?.statement === 'string' &&
|
|
144
|
+
normalizeLine(criterion.statement) === statement &&
|
|
145
|
+
(criterion.id !== stableCriterionId(statement) ||
|
|
146
|
+
criterion.scope !== 'task' ||
|
|
147
|
+
criterion.source?.kind !== 'user' ||
|
|
148
|
+
criterion.source.ref ||
|
|
149
|
+
criterion.waiver));
|
|
150
|
+
};
|
|
151
|
+
const requirements = unique((contract.requirements ?? []).filter(item => !isSectionHeading(item) && !isInferredQuestion(item)));
|
|
132
152
|
const typedCriterionStatements = (contract.criteria ?? [])
|
|
133
153
|
.map(criterion => criterion?.statement)
|
|
134
154
|
.filter((statement) => typeof statement === 'string');
|
|
@@ -140,7 +160,7 @@ function normalizeTaskContract(contract) {
|
|
|
140
160
|
// statements that remain authoritative.
|
|
141
161
|
const legacySuccessCriteria = contract.successCriteria ?? [];
|
|
142
162
|
const inputSuccessCriteria = legacySuccessCriteria.length > 0 ? legacySuccessCriteria : typedCriterionStatements;
|
|
143
|
-
const explicitSuccessCriteria = unique(inputSuccessCriteria.filter(item => !isSectionHeading(item) && !isObjectiveFallback(item)));
|
|
163
|
+
const explicitSuccessCriteria = unique(inputSuccessCriteria.filter(item => !isSectionHeading(item) && !isObjectiveFallback(item) && !isInferredQuestion(item)));
|
|
144
164
|
const fallbackCriteria = unique(inputSuccessCriteria.filter(isObjectiveFallback));
|
|
145
165
|
const successCriteria = explicitSuccessCriteria.length > 0 || requirements.length > 0
|
|
146
166
|
? explicitSuccessCriteria
|
|
@@ -159,17 +179,20 @@ function normalizeTaskContract(contract) {
|
|
|
159
179
|
function createTaskContract(input, cwd) {
|
|
160
180
|
const now = Date.now();
|
|
161
181
|
const lines = splitMeaningfulLines(input);
|
|
182
|
+
const workLines = (0, clarification_1.isReadOnlyQuestion)(input)
|
|
183
|
+
? []
|
|
184
|
+
: lines.filter(line => !(0, clarification_1.isReadOnlyQuestion)(line));
|
|
162
185
|
const objective = extractExplicitObjective(input) ??
|
|
163
|
-
normalizeLine(lines[0] || input || 'Continue the current task');
|
|
186
|
+
normalizeLine(workLines[0] || lines[0] || input || 'Continue the current task');
|
|
164
187
|
const requirementHints = /(must|should|required|require|need|ensure|verify|test|build|run|希望|需要|必须|要求|确保|验证|测试|完成)/i;
|
|
165
188
|
const prohibitionHints = /(do not|don't|never|avoid|without|禁止|不要|不能|不准|避免)/i;
|
|
166
189
|
const verificationHints = /(test|build|tsc|lint|verify|验证|测试|通过|运行|检查)/i;
|
|
167
|
-
const requirements = unique(
|
|
168
|
-
const prohibitions = unique(
|
|
190
|
+
const requirements = unique(workLines.filter(line => requirementHints.test(line)));
|
|
191
|
+
const prohibitions = unique(workLines.filter(line => prohibitionHints.test(line)));
|
|
169
192
|
const successCriteria = unique([
|
|
170
|
-
...
|
|
193
|
+
...workLines.filter(line => verificationHints.test(line) ||
|
|
171
194
|
((0, verification_1.requestedLocalChecks)(line).length > 0 && (0, verification_1.requiredVerificationKinds)(line).length > 0)),
|
|
172
|
-
requirements.length === 0 ? `Address the objective: ${objective}` : '',
|
|
195
|
+
workLines.length > 0 && requirements.length === 0 ? `Address the objective: ${objective}` : '',
|
|
173
196
|
]);
|
|
174
197
|
return normalizeTaskContract({
|
|
175
198
|
version: 3,
|
|
@@ -192,11 +215,14 @@ function updateTaskContract(previous, input, cwd, intent) {
|
|
|
192
215
|
if (!previous) {
|
|
193
216
|
return createTaskContract(input, cwd);
|
|
194
217
|
}
|
|
195
|
-
const
|
|
218
|
+
const original = normalizeTaskContract(previous);
|
|
219
|
+
if (intent?.kind === 'clarification' || (!intent && (0, clarification_1.isReadOnlyQuestion)(input)))
|
|
220
|
+
return original;
|
|
196
221
|
const next = createTaskContract(input, cwd);
|
|
197
222
|
if (intent?.kind === 'new_task') {
|
|
198
223
|
return { ...next, taskEpoch: intent.taskEpoch };
|
|
199
224
|
}
|
|
225
|
+
const normalizedPrevious = (0, goal_verification_1.bindUnspecifiedVerification)(original, input) ?? original;
|
|
200
226
|
const nextSuccessCriteria = next.successCriteria.filter(item => !isObjectiveFallback(item));
|
|
201
227
|
return normalizeTaskContract({
|
|
202
228
|
...normalizedPrevious,
|
|
@@ -355,11 +355,16 @@ function evaluateCompletionGate(params) {
|
|
|
355
355
|
}
|
|
356
356
|
const candidates = trusted.filter(entry => (0, verification_1.verificationKindForEntry)(entry, params.requireLocalReceipt) === kind &&
|
|
357
357
|
(kind !== 'generic' ||
|
|
358
|
-
!params.requireLocalReceipt ||
|
|
359
358
|
(entry.type === 'verification' &&
|
|
360
|
-
|
|
359
|
+
(!params.requireLocalReceipt ||
|
|
360
|
+
typeof entry.metadata?.toolReceiptDigest === 'string'))));
|
|
361
361
|
const workspace = contract.allowedScope.cwd;
|
|
362
362
|
const expected = checks.filter(check => check.kind === kind);
|
|
363
|
+
if (kind === 'generic' && !expected.length) {
|
|
364
|
+
missingKinds.push(kind);
|
|
365
|
+
verificationProblems.push({ kind, status: 'missing' });
|
|
366
|
+
continue;
|
|
367
|
+
}
|
|
363
368
|
const selectors = expected.length ? expected : [undefined];
|
|
364
369
|
for (const selector of selectors) {
|
|
365
370
|
const matching = selector
|
|
@@ -457,8 +462,11 @@ function verificationProblem(kind, status, workspace, selector, metadata) {
|
|
|
457
462
|
function describeVerificationProblem(problem, statement) {
|
|
458
463
|
const subject = problem.command
|
|
459
464
|
? `\`${problem.command}\` in \`${problem.cwd}\``
|
|
460
|
-
: safeFeedback(statement);
|
|
465
|
+
: safeFeedback(statement).replace(/[.。]+$/u, '');
|
|
461
466
|
const exit = problem.exitCode === undefined ? '' : ` (exit ${problem.exitCode})`;
|
|
462
|
-
|
|
467
|
+
const clarification = problem.kind === 'generic' && !problem.command
|
|
468
|
+
? ' Specify the exact checker command and its working directory.'
|
|
469
|
+
: '';
|
|
470
|
+
return `Verification ${problem.status} for ${subject}${exit}.${clarification}`;
|
|
463
471
|
}
|
|
464
472
|
//# sourceMappingURL=drift-guard.js.map
|
|
@@ -6,6 +6,8 @@ export type GoalVerificationCorrection = {
|
|
|
6
6
|
} | {
|
|
7
7
|
readonly blocker: string;
|
|
8
8
|
};
|
|
9
|
+
/** An explicit user correction can give one unresolved verification its missing selector. */
|
|
10
|
+
export declare function bindUnspecifiedVerification(contract: TaskContract, input: string): TaskContract | undefined;
|
|
9
11
|
/** Only explicit user correction can supersede a required verification selector. */
|
|
10
12
|
export declare function goalVerificationCorrection(contract: TaskContract, input: string): GoalVerificationCorrection | undefined;
|
|
11
13
|
//# sourceMappingURL=goal-verification.d.ts.map
|
|
@@ -1,9 +1,51 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.bindUnspecifiedVerification = bindUnspecifiedVerification;
|
|
3
4
|
exports.goalVerificationCorrection = goalVerificationCorrection;
|
|
4
5
|
const path_1 = require("path");
|
|
5
6
|
const verification_1 = require("./verification");
|
|
6
7
|
const clarification = 'The Goal check could not be identified. Specify “Replace `old command` with `new command`”, with each workspace directory if needed.';
|
|
8
|
+
/** An explicit user correction can give one unresolved verification its missing selector. */
|
|
9
|
+
function bindUnspecifiedVerification(contract, input) {
|
|
10
|
+
if (!(0, verification_1.isVerificationReplacement)(input))
|
|
11
|
+
return undefined;
|
|
12
|
+
const prose = input.replace(/\x60[^\x60]+\x60/gu, ' ').trim();
|
|
13
|
+
const checks = (0, verification_1.locateRequestedChecks)(input);
|
|
14
|
+
if (checks.length !== 1)
|
|
15
|
+
return undefined;
|
|
16
|
+
const [check] = checks;
|
|
17
|
+
const workspace = contract.allowedScope.cwd;
|
|
18
|
+
const scoped = (0, path_1.relative)(workspace, (0, path_1.resolve)(workspace, check.cwd ?? '.'));
|
|
19
|
+
if (scoped === '..' || (0, path_1.isAbsolute)(scoped) || scoped.startsWith(`..${path_1.sep}`))
|
|
20
|
+
return undefined;
|
|
21
|
+
const verification = (contract.criteria ?? []).filter(criterion => (0, verification_1.requiredVerificationKinds)(criterion.statement).length > 0 &&
|
|
22
|
+
!(0, verification_1.criterionHasAuthorizedWaiver)(criterion));
|
|
23
|
+
if (verification.length !== 1 && !/\b(?:generic|unbound|unspecified)\b|通用|未指定/iu.test(prose))
|
|
24
|
+
return undefined;
|
|
25
|
+
const unbound = verification.filter(criterion => {
|
|
26
|
+
const kinds = (0, verification_1.requiredVerificationKinds)(criterion.statement);
|
|
27
|
+
return (kinds.length === 1 &&
|
|
28
|
+
kinds[0] === 'generic' &&
|
|
29
|
+
!(0, verification_1.requestedLocalChecks)(criterion.statement).length);
|
|
30
|
+
});
|
|
31
|
+
if (unbound.length !== 1)
|
|
32
|
+
return undefined;
|
|
33
|
+
const [criterion] = unbound;
|
|
34
|
+
const line = input
|
|
35
|
+
.slice(input.lastIndexOf('\n', check.start) + 1)
|
|
36
|
+
.split('\n', 1)[0]
|
|
37
|
+
.trim();
|
|
38
|
+
const statement = (0, verification_1.requiredVerificationKinds)(line).includes(check.kind)
|
|
39
|
+
? line
|
|
40
|
+
: `Run \`${check.command}\` in \`${check.cwd ?? '.'}\` to verify the workflow.`;
|
|
41
|
+
const replace = (previous) => (previous === criterion.statement ? statement : previous);
|
|
42
|
+
return {
|
|
43
|
+
...contract,
|
|
44
|
+
requirements: contract.requirements.map(replace),
|
|
45
|
+
successCriteria: contract.successCriteria.map(replace),
|
|
46
|
+
criteria: contract.criteria?.map(item => item.id === criterion.id ? { ...item, statement, evidenceRefs: [], status: 'pending' } : item),
|
|
47
|
+
};
|
|
48
|
+
}
|
|
7
49
|
/** Only explicit user correction can supersede a required verification selector. */
|
|
8
50
|
function goalVerificationCorrection(contract, input) {
|
|
9
51
|
const prose = input.replace(/\x60[^\x60]+\x60/gu, ' ');
|
package/dist/harness/intent.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.classifyIntent = classifyIntent;
|
|
4
4
|
exports.shouldReplaceActiveInstruction = shouldReplaceActiveInstruction;
|
|
5
5
|
const crypto_1 = require("crypto");
|
|
6
|
+
const clarification_1 = require("./clarification");
|
|
6
7
|
const task_checklist_1 = require("./task-checklist");
|
|
7
8
|
const MAX_SUMMARY = 220;
|
|
8
9
|
function normalize(input) {
|
|
@@ -67,7 +68,7 @@ function extractQuestions(input) {
|
|
|
67
68
|
.slice(0, 8);
|
|
68
69
|
}
|
|
69
70
|
function isGenericContinue(input) {
|
|
70
|
-
return /^(
|
|
71
|
+
return /^(?:继续|继续吧|继续开发|继续做|接着|接着做|go on|continue|keep going)[.!。!]?$/i.test(input.trim());
|
|
71
72
|
}
|
|
72
73
|
function isExplicitContinuation(input) {
|
|
73
74
|
return /^(?:(?:please\s+)?(?:continue(?:\s+the)?|keep working on|refine)\b|(?:请\s*)?(?:继续|接着))/iu.test(input);
|
|
@@ -102,6 +103,13 @@ function classifyKind(input, state) {
|
|
|
102
103
|
reason: 'short feedback should not replace the root objective',
|
|
103
104
|
};
|
|
104
105
|
}
|
|
106
|
+
if ((0, clarification_1.isReadOnlyQuestion)(input)) {
|
|
107
|
+
return {
|
|
108
|
+
kind: 'clarification',
|
|
109
|
+
confidence: 0.78,
|
|
110
|
+
reason: 'read-only explanation or status request',
|
|
111
|
+
};
|
|
112
|
+
}
|
|
105
113
|
const change = (0, task_checklist_1.requestedWorkspaceChanges)(input);
|
|
106
114
|
if ((change.checklistRequired || change.paths.length > 0) &&
|
|
107
115
|
!isExplicitContinuation(text) &&
|
|
@@ -162,16 +170,6 @@ function classifyKind(input, state) {
|
|
|
162
170
|
reason: 'explicit task creation wording',
|
|
163
171
|
};
|
|
164
172
|
}
|
|
165
|
-
// Clarification: user is asking for explanation or asking about meaning
|
|
166
|
-
// Must be checked BEFORE refinement since clarification phrases may contain "这个"
|
|
167
|
-
if (matches(text, /(什么意思|解释一下|解释说明|clarify|explain to me|what does.*mean|what is.*for|can you explain|meaning of)/) ||
|
|
168
|
-
matches(lower, /^(what|why|how|explain|clarify|could you explain|can you explain)\b/)) {
|
|
169
|
-
return {
|
|
170
|
-
kind: 'clarification',
|
|
171
|
-
confidence: 0.7,
|
|
172
|
-
reason: 'clarification or explanation request',
|
|
173
|
-
};
|
|
174
|
-
}
|
|
175
173
|
if (matches(text, /(补充|另外|同时|还有|希望|可以|顺便|完善|优化|灰色|填充|这个|这里|如图|也|继续)/) ||
|
|
176
174
|
matches(lower, /\b(also|additionally|please also|refine|improve|continue)\b/)) {
|
|
177
175
|
return {
|
|
@@ -192,7 +190,7 @@ function classifyIntent(input, state) {
|
|
|
192
190
|
const now = Date.now();
|
|
193
191
|
const baseEpoch = state?.taskEpoch ?? (state?.contract ? 1 : 0);
|
|
194
192
|
const classified = classifyKind(input, state);
|
|
195
|
-
const rootObjectiveChanged = classified.kind === 'new_task' || !state?.contract;
|
|
193
|
+
const rootObjectiveChanged = classified.kind !== 'clarification' && (classified.kind === 'new_task' || !state?.contract);
|
|
196
194
|
const taskEpoch = rootObjectiveChanged
|
|
197
195
|
? Math.max(1, baseEpoch + (state?.contract ? 1 : 0))
|
|
198
196
|
: Math.max(1, baseEpoch || 1);
|
package/dist/harness/state.js
CHANGED
|
@@ -3,8 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.upgradeHarnessState = upgradeHarnessState;
|
|
4
4
|
exports.summarizeHarnessStateForMeta = summarizeHarnessStateForMeta;
|
|
5
5
|
const capsule_1 = require("./capsule");
|
|
6
|
+
const clarification_1 = require("./clarification");
|
|
6
7
|
const contract_1 = require("./contract");
|
|
7
8
|
const evidence_1 = require("./evidence");
|
|
9
|
+
const intent_1 = require("./intent");
|
|
8
10
|
function unique(items) {
|
|
9
11
|
return [...new Set(items.map(item => item.trim()).filter(Boolean))];
|
|
10
12
|
}
|
|
@@ -47,7 +49,18 @@ function upgradeHarnessState(state, options = {}) {
|
|
|
47
49
|
state?.rootObjective ??
|
|
48
50
|
contract?.objective ??
|
|
49
51
|
(firstUser ? firstUser.trim().replace(/\s+/g, ' ') : undefined);
|
|
50
|
-
const
|
|
52
|
+
const storedInstruction = state?.activeInstruction ?? contract?.userIntent ?? lastUser ?? rootObjective;
|
|
53
|
+
const intents = state?.intentHistory ?? [];
|
|
54
|
+
const matchingIntent = [...intents]
|
|
55
|
+
.reverse()
|
|
56
|
+
.find(intent => intent.taskEpoch === taskEpoch && intent.activeInstruction === storedInstruction);
|
|
57
|
+
const activeInstruction = (0, clarification_1.isReadOnlyQuestion)(matchingIntent?.input ?? storedInstruction ?? '')
|
|
58
|
+
? ([...intents]
|
|
59
|
+
.reverse()
|
|
60
|
+
.find(intent => intent.taskEpoch === taskEpoch &&
|
|
61
|
+
(0, intent_1.shouldReplaceActiveInstruction)(intent) &&
|
|
62
|
+
!(0, clarification_1.isReadOnlyQuestion)(intent.input))?.activeInstruction ?? rootObjective)
|
|
63
|
+
: storedInstruction;
|
|
51
64
|
const turnSummaries = state?.turnSummaries ?? [];
|
|
52
65
|
const evidenceIndex = (0, evidence_1.buildEvidenceIndex)({
|
|
53
66
|
ledger,
|
|
@@ -97,7 +110,7 @@ function upgradeHarnessState(state, options = {}) {
|
|
|
97
110
|
...(state?.taskTodoReceipts ? { taskTodoReceipts: state.taskTodoReceipts } : {}),
|
|
98
111
|
rootObjective,
|
|
99
112
|
activeInstruction,
|
|
100
|
-
intentHistory:
|
|
113
|
+
intentHistory: intents,
|
|
101
114
|
activeConstraints: unique([
|
|
102
115
|
...(state?.activeConstraints ?? []),
|
|
103
116
|
...(contract?.constraints ?? []),
|
|
@@ -49,7 +49,7 @@ function modificationClauses(instruction) {
|
|
|
49
49
|
.replace(/^[ \t]*\x60{3}[^\r\n]*\r?\n[\s\S]*?^[ \t]*\x60{3}[^\r\n]*/gmu, '')
|
|
50
50
|
.split(/\r?\n|[;;]|\b(?:and then|then|and(?=\s+(?:verify|test|run|check|implement|edit|update|modify|fix|refactor|create|write)\b))\b|然后|(?:再|并)(?=实现|修改|更新|修复|新增|添加|重构|删除|运行|验证|测试)/iu)
|
|
51
51
|
.map(part => part.trim().replace(/^(?:[-*]|\d+[.、)])\s*/u, ''))
|
|
52
|
-
.filter(part => writeInstruction.test(part));
|
|
52
|
+
.filter(part => writeInstruction.test(part) && !(0, verification_1.isVerificationReplacement)(part));
|
|
53
53
|
}
|
|
54
54
|
function pathsInActions(actions) {
|
|
55
55
|
return [
|
|
@@ -8,6 +8,7 @@ export declare function requestedFileArtifact(statement: string): {
|
|
|
8
8
|
export declare function workspaceArtifactPath(root: string, path: string): string | undefined;
|
|
9
9
|
export declare function latestArtifactWrite(ledger: readonly ContextLedgerEntry[], contractId: string, cwd: string, path: string): ContextLedgerEntry | undefined;
|
|
10
10
|
export declare function classifyVerificationCommand(command: string | undefined): VerificationKind;
|
|
11
|
+
export declare function isVerificationReplacement(statement: string): boolean;
|
|
11
12
|
export declare function requiredVerificationKinds(statement: string): VerificationKind[];
|
|
12
13
|
export interface RequestedCheck {
|
|
13
14
|
readonly kind: VerificationCommandKind;
|
|
@@ -27,6 +28,7 @@ export declare function equalRequestedChecks(left: RequestedCheck, right: Reques
|
|
|
27
28
|
/** Rewrite only the selected command and its own directory literal. */
|
|
28
29
|
export declare function replaceRequestedCheck(statement: string, previous: RequestedCheck, next: RequestedCheck, workspace: string): string;
|
|
29
30
|
export declare function matchesRequestedCheck(entry: ContextLedgerEntry, check: RequestedCheck, workspace: string): boolean;
|
|
31
|
+
export declare function matchesRequestedCheckInvocation(command: string, cwd: string | undefined, check: RequestedCheck, workspace: string): boolean;
|
|
30
32
|
export declare function verificationKindForEntry(entry: ContextLedgerEntry, requireLocalReceipt?: boolean): VerificationKind;
|
|
31
33
|
export declare function isTrustedEvidence(entry: ContextLedgerEntry): boolean;
|
|
32
34
|
export declare function isFreshVerification(entry: ContextLedgerEntry, workspaceRevision?: number): boolean;
|
|
@@ -4,12 +4,14 @@ exports.requestedFileArtifact = requestedFileArtifact;
|
|
|
4
4
|
exports.workspaceArtifactPath = workspaceArtifactPath;
|
|
5
5
|
exports.latestArtifactWrite = latestArtifactWrite;
|
|
6
6
|
exports.classifyVerificationCommand = classifyVerificationCommand;
|
|
7
|
+
exports.isVerificationReplacement = isVerificationReplacement;
|
|
7
8
|
exports.requiredVerificationKinds = requiredVerificationKinds;
|
|
8
9
|
exports.requestedLocalChecks = requestedLocalChecks;
|
|
9
10
|
exports.locateRequestedChecks = locateRequestedChecks;
|
|
10
11
|
exports.equalRequestedChecks = equalRequestedChecks;
|
|
11
12
|
exports.replaceRequestedCheck = replaceRequestedCheck;
|
|
12
13
|
exports.matchesRequestedCheck = matchesRequestedCheck;
|
|
14
|
+
exports.matchesRequestedCheckInvocation = matchesRequestedCheckInvocation;
|
|
13
15
|
exports.verificationKindForEntry = verificationKindForEntry;
|
|
14
16
|
exports.isTrustedEvidence = isTrustedEvidence;
|
|
15
17
|
exports.isFreshVerification = isFreshVerification;
|
|
@@ -96,6 +98,11 @@ function classifyVerificationCommand(command) {
|
|
|
96
98
|
}
|
|
97
99
|
return 'generic';
|
|
98
100
|
}
|
|
101
|
+
function isVerificationReplacement(statement) {
|
|
102
|
+
const prose = statement.replace(/\x60[^\x60]+\x60/gu, ' ').trim();
|
|
103
|
+
return (/^(?:please\s+)?(?:replace|change|switch)\s+(?:(?:the|previous|old|current|required|generic|unbound|unspecified|workflow)\s+)*(?:verification|check)\s+(?:with|to)\b/iu.test(prose) ||
|
|
104
|
+
/^(?:请\s*)?(?:(?:把|将)\s*)?(?:原来的?|之前的?|前面的?|当前的?|通用的?|未指定的?|工作流的?)*(?:验证|检查)\s*(?:改为|改成|换成|换为|替换为|指定为|绑定到)/u.test(prose));
|
|
105
|
+
}
|
|
99
106
|
function requiredVerificationKinds(statement) {
|
|
100
107
|
const normalized = statement.toLowerCase();
|
|
101
108
|
const englishAction = /^(?:please\s+)?(?:run|execute|verify|validate|check|ensure)\b/u.test(normalized) ||
|
|
@@ -107,7 +114,7 @@ function requiredVerificationKinds(statement) {
|
|
|
107
114
|
// do not add an obligation to pass a separate verification command.
|
|
108
115
|
const chineseAction = /(?:必须|需要|要求|确保|请|(?<!可)(?:运行|执行)|通过|完成|成功).{0,60}(?:测试|验证|构建|编译|检查|发布|提交|推送|流水线)/u.test(statement) ||
|
|
109
116
|
/(?:测试|验证|构建|编译|检查|发布|提交|推送|流水线).{0,60}(?:必须|需要|要求|确保|通过|成功|(?<!可)(?:运行|执行)|完成)/u.test(statement);
|
|
110
|
-
if (!englishAction && !chineseAction)
|
|
117
|
+
if (!englishAction && !chineseAction && !isVerificationReplacement(statement))
|
|
111
118
|
return [];
|
|
112
119
|
const checks = requestedLocalChecks(statement);
|
|
113
120
|
const prose = normalized.replace(/\x60[^\x60]+\x60/gu, '');
|
|
@@ -162,7 +169,7 @@ function locateRequestedChecks(statement) {
|
|
|
162
169
|
for (const match of statement.matchAll(/\x60([^\x60\r\n]+)\x60/gu)) {
|
|
163
170
|
const [span, literal] = match;
|
|
164
171
|
const command = literal.trim();
|
|
165
|
-
const kind = (0, verification_command_1.
|
|
172
|
+
const kind = (0, verification_command_1.classifyVerificationSelector)(command);
|
|
166
173
|
if (!kind)
|
|
167
174
|
continue;
|
|
168
175
|
const index = match.index ?? 0;
|
|
@@ -217,9 +224,13 @@ function replaceRequestedCheck(statement, previous, next, workspace) {
|
|
|
217
224
|
function matchesRequestedCheck(entry, check, workspace) {
|
|
218
225
|
const { command, cwd } = entry.metadata ?? {};
|
|
219
226
|
return (typeof command === 'string' &&
|
|
220
|
-
command
|
|
221
|
-
|
|
222
|
-
|
|
227
|
+
matchesRequestedCheckInvocation(command, typeof cwd === 'string' ? cwd : undefined, check, workspace));
|
|
228
|
+
}
|
|
229
|
+
function matchesRequestedCheckInvocation(command, cwd, check, workspace) {
|
|
230
|
+
return (command.trim() === check.command &&
|
|
231
|
+
(check.kind === 'generic'
|
|
232
|
+
? cwd !== undefined && (0, path_1.resolve)(workspace, cwd) === (0, path_1.resolve)(workspace, check.cwd ?? '.')
|
|
233
|
+
: !check.cwd || (0, path_1.resolve)(workspace, cwd ?? '.') === (0, path_1.resolve)(workspace, check.cwd)));
|
|
223
234
|
}
|
|
224
235
|
function verificationKindForEntry(entry, requireLocalReceipt = false) {
|
|
225
236
|
const stored = entry.metadata?.verificationKind;
|
|
@@ -49,7 +49,8 @@ class AgentLoopV1 {
|
|
|
49
49
|
? (0, task_context_recovery_1.createTaskRecoveryBinder)(this.options.taskContext, this.options.previousCommitDigest, progressAtAdmission)
|
|
50
50
|
: undefined;
|
|
51
51
|
const goal = context.mode === 'goal' ? this.options.resolveGoalTask?.() : undefined;
|
|
52
|
-
this.options.taskContext.observeUserInput(goal?.objective ?? context.input, goal?.goalId);
|
|
52
|
+
const intent = this.options.taskContext.observeUserInput(goal?.objective ?? context.input, goal?.goalId);
|
|
53
|
+
let answeringQuestion = (context.mode === 'build' || context.mode === 'auto') && intent?.kind === 'clarification';
|
|
53
54
|
const messages = (await this.options.loadBaseMessages(context)).map(message => ({
|
|
54
55
|
...message,
|
|
55
56
|
}));
|
|
@@ -122,9 +123,12 @@ class AgentLoopV1 {
|
|
|
122
123
|
},
|
|
123
124
|
};
|
|
124
125
|
const executionChecklist = this.options.enableTaskTodos === true && (0, task_checklist_1.supportsExecutionChecklist)(context.mode);
|
|
126
|
+
const checkTaskPlanStop = executionChecklist
|
|
127
|
+
? this.options.taskContext.prepareTaskPlanStopCheck()
|
|
128
|
+
: undefined;
|
|
125
129
|
const harness = createQueryTaskContextAdapter(this.options.taskContext, decision => {
|
|
126
130
|
taskContextCompletion = decision;
|
|
127
|
-
}, context.mode === 'plan', executionChecklist, context.mode === 'goal');
|
|
131
|
+
}, context.mode === 'plan', executionChecklist, context.mode === 'goal', () => answeringQuestion);
|
|
128
132
|
try {
|
|
129
133
|
for await (const event of (0, query_1.query)({
|
|
130
134
|
messages,
|
|
@@ -154,7 +158,7 @@ class AgentLoopV1 {
|
|
|
154
158
|
activeStep = await this.bindStep(context, prepared, router, bindingInput);
|
|
155
159
|
return {
|
|
156
160
|
receiptDigest: activeStep.digest,
|
|
157
|
-
toolExecutor: (name, args, abortSignal, metadata) => this.invokeTool(context, activeStep, name, args, bindRecovery, abortSignal, metadata),
|
|
161
|
+
toolExecutor: (name, args, abortSignal, metadata) => this.invokeTool(context, activeStep, name, args, answeringQuestion, bindRecovery, abortSignal, metadata),
|
|
158
162
|
};
|
|
159
163
|
},
|
|
160
164
|
};
|
|
@@ -162,14 +166,15 @@ class AgentLoopV1 {
|
|
|
162
166
|
llm: this.options.llm,
|
|
163
167
|
abortSignal: context.abortSignal,
|
|
164
168
|
streamCallbacks,
|
|
165
|
-
holdAssistantUntilCompletionCheck: () =>
|
|
169
|
+
holdAssistantUntilCompletionCheck: () => !answeringQuestion &&
|
|
170
|
+
context.mode !== 'plan' &&
|
|
166
171
|
(context.mode === 'goal' ||
|
|
167
172
|
this.options.taskContext.requiresVerification() ||
|
|
168
173
|
(executionChecklist &&
|
|
169
174
|
(this.options.taskContext.hasTaskTodos() ||
|
|
170
175
|
!!this.options.taskContext.missingExecutionChecklist()))),
|
|
171
|
-
...(
|
|
172
|
-
? { checkTaskPlanStop:
|
|
176
|
+
...(checkTaskPlanStop
|
|
177
|
+
? { checkTaskPlanStop: () => (answeringQuestion ? undefined : checkTaskPlanStop()) }
|
|
173
178
|
: {}),
|
|
174
179
|
harness,
|
|
175
180
|
input: context.input,
|
|
@@ -186,10 +191,13 @@ class AgentLoopV1 {
|
|
|
186
191
|
const inputs = context.takePendingSteering?.(closeIfEmpty) ?? [];
|
|
187
192
|
for (const input of inputs) {
|
|
188
193
|
taskContextCompletion = undefined;
|
|
189
|
-
if (goal)
|
|
194
|
+
if (goal) {
|
|
190
195
|
this.options.taskContext.observeGoalSteering(input, goal.goalId);
|
|
191
|
-
|
|
192
|
-
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
const steering = this.options.taskContext.observeUserInput(input);
|
|
199
|
+
answeringQuestion && (answeringQuestion = steering?.kind === 'clarification');
|
|
200
|
+
}
|
|
193
201
|
}
|
|
194
202
|
return inputs;
|
|
195
203
|
},
|
|
@@ -322,22 +330,28 @@ class AgentLoopV1 {
|
|
|
322
330
|
await this.options.onStepCaptured?.(snapshot);
|
|
323
331
|
return snapshot;
|
|
324
332
|
}
|
|
325
|
-
async invokeTool(context, snapshot, name, args, bindRecovery, abortSignal, metadata) {
|
|
333
|
+
async invokeTool(context, snapshot, name, args, answeringQuestion, bindRecovery, abortSignal, metadata) {
|
|
326
334
|
if (!metadata)
|
|
327
335
|
throw new Error('ToolGateway execution requires provider call identity');
|
|
328
336
|
const executionChecklist = this.options.enableTaskTodos === true && (0, task_checklist_1.supportsExecutionChecklist)(context.mode);
|
|
329
337
|
const descriptor = snapshot.toolRouter.resolveDescriptor(name);
|
|
330
|
-
const
|
|
331
|
-
|
|
338
|
+
const workspaceWrite = mayChangeWorkspace(descriptor, args);
|
|
339
|
+
let prerequisiteFailure;
|
|
340
|
+
if (answeringQuestion &&
|
|
341
|
+
descriptor &&
|
|
342
|
+
!descriptor.risk.readOnly &&
|
|
343
|
+
(descriptor.name !== 'exec_command' || workspaceWrite)) {
|
|
344
|
+
prerequisiteFailure = 'Answer the current question without modifying the task or workspace.';
|
|
345
|
+
}
|
|
346
|
+
else if (executionChecklist && workspaceWrite) {
|
|
347
|
+
prerequisiteFailure = this.options.taskContext.missingExecutionChecklist({
|
|
332
348
|
path: (name === 'write_file' || name === 'edit_file') && typeof args.path === 'string'
|
|
333
349
|
? args.path
|
|
334
350
|
: undefined,
|
|
335
|
-
command: name === 'exec_command' && typeof args.command === 'string'
|
|
336
|
-
? args.command
|
|
337
|
-
: undefined,
|
|
351
|
+
command: name === 'exec_command' && typeof args.command === 'string' ? args.command : undefined,
|
|
338
352
|
cwd: typeof args.cwd === 'string' ? args.cwd : undefined,
|
|
339
|
-
})
|
|
340
|
-
|
|
353
|
+
});
|
|
354
|
+
}
|
|
341
355
|
const invocationId = deterministicRuntimeId([
|
|
342
356
|
context.threadId,
|
|
343
357
|
context.turnId,
|
|
@@ -349,7 +363,7 @@ class AgentLoopV1 {
|
|
|
349
363
|
cwd: snapshot.environment.cwd,
|
|
350
364
|
config: { name: 'orion-code', mode: context.mode },
|
|
351
365
|
};
|
|
352
|
-
const activeTodo = executionChecklist && name !== 'todo_write'
|
|
366
|
+
const activeTodo = executionChecklist && !answeringQuestion && name !== 'todo_write'
|
|
353
367
|
? this.options.taskContext.activeTaskTodo()
|
|
354
368
|
: undefined;
|
|
355
369
|
const invoked = await this.options.gateway.invoke({
|
|
@@ -360,13 +374,15 @@ class AgentLoopV1 {
|
|
|
360
374
|
context: toolContext,
|
|
361
375
|
abortSignal,
|
|
362
376
|
prerequisiteFailure,
|
|
363
|
-
taskRecovery:
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
377
|
+
taskRecovery: answeringQuestion
|
|
378
|
+
? undefined
|
|
379
|
+
: bindRecovery?.({
|
|
380
|
+
descriptor,
|
|
381
|
+
name,
|
|
382
|
+
args,
|
|
383
|
+
cwd: toolContext.cwd,
|
|
384
|
+
activeTodoId: activeTodo,
|
|
385
|
+
}),
|
|
370
386
|
});
|
|
371
387
|
const receipt = invoked.receipt;
|
|
372
388
|
const evidence = (0, task_context_recovery_1.projectTaskToolEvidence)(receipt, args, toolContext.cwd);
|
|
@@ -522,10 +538,14 @@ function createSnapshotToolFacade(descriptor) {
|
|
|
522
538
|
isFileEdit: () => descriptor.risk.fileEdit,
|
|
523
539
|
};
|
|
524
540
|
}
|
|
525
|
-
function createQueryTaskContextAdapter(taskContext, onCompletion, planningPhase, enforceTaskTodos, requireEveryCriterion) {
|
|
541
|
+
function createQueryTaskContextAdapter(taskContext, onCompletion, planningPhase, enforceTaskTodos, requireEveryCriterion, answeringQuestion) {
|
|
526
542
|
return {
|
|
527
543
|
updateCapabilityProfile: input => structuredClone(taskContext.observeCapability(input)),
|
|
528
|
-
assembleMessages: (messages, options) => taskContext.assembleMessages(messages, {
|
|
544
|
+
assembleMessages: (messages, options) => taskContext.assembleMessages(messages, {
|
|
545
|
+
...options,
|
|
546
|
+
includeTaskTodos: enforceTaskTodos,
|
|
547
|
+
answeringQuestion: answeringQuestion(),
|
|
548
|
+
}),
|
|
529
549
|
getCapsule: () => {
|
|
530
550
|
const capsule = taskContext.getCapsule();
|
|
531
551
|
return capsule
|
|
@@ -541,6 +561,8 @@ function createQueryTaskContextAdapter(taskContext, onCompletion, planningPhase,
|
|
|
541
561
|
taskContext.observeToolResult(input);
|
|
542
562
|
},
|
|
543
563
|
beforeComplete: () => {
|
|
564
|
+
if (answeringQuestion())
|
|
565
|
+
return { canComplete: true, missing: [], evidence: [] };
|
|
544
566
|
const decision = taskContext.auditCompletion(enforceTaskTodos, requireEveryCriterion);
|
|
545
567
|
onCompletion(decision);
|
|
546
568
|
// PLAN completes a planning phase, not the parent implementation task.
|
|
@@ -956,7 +956,7 @@ class AgentRuntimeController {
|
|
|
956
956
|
else if (completedPlan) {
|
|
957
957
|
nextRequest = {
|
|
958
958
|
inputKind: 'plan_execution',
|
|
959
|
-
text: `Execute the saved plan now. Continue autonomously
|
|
959
|
+
text: `Execute the saved plan now. Continue autonomously and follow the plan's verification steps.\n\n${completedPlan}`,
|
|
960
960
|
sessionId: this.options.runtime.getSession()?.id ?? request.sessionId,
|
|
961
961
|
persistAsUserMessage: false,
|
|
962
962
|
echoToTranscript: false,
|
|
@@ -35,5 +35,6 @@ export declare function resolvePlanReviewV1(runtime: OrionRuntimeV1, input: {
|
|
|
35
35
|
/** Recover the crash gap between a durable resolution and its turn admission. */
|
|
36
36
|
export declare function recoverResolvedPlanReviewV1(runtime: OrionRuntimeV1): PlanReviewResolutionReceiptV1['admission'];
|
|
37
37
|
export declare function findPlanReceiptForReviewV1(projection: ThreadProjectionV1, review: PlanReviewProjectionV1): PlanReceiptV1;
|
|
38
|
+
export declare function isPlanReviewTurnInput(review: PlanReviewProjectionV1, input: string): boolean;
|
|
38
39
|
export declare function planReviewTurnInput(review: PlanReviewProjectionV1): string;
|
|
39
40
|
//# sourceMappingURL=plan-review.d.ts.map
|
|
@@ -5,6 +5,7 @@ exports.ensurePlanReviewRequestedV1 = ensurePlanReviewRequestedV1;
|
|
|
5
5
|
exports.resolvePlanReviewV1 = resolvePlanReviewV1;
|
|
6
6
|
exports.recoverResolvedPlanReviewV1 = recoverResolvedPlanReviewV1;
|
|
7
7
|
exports.findPlanReceiptForReviewV1 = findPlanReceiptForReviewV1;
|
|
8
|
+
exports.isPlanReviewTurnInput = isPlanReviewTurnInput;
|
|
8
9
|
exports.planReviewTurnInput = planReviewTurnInput;
|
|
9
10
|
const crypto_1 = require("crypto");
|
|
10
11
|
const canonical_1 = require("./protocol/canonical");
|
|
@@ -118,8 +119,8 @@ function admitResolvedPlanReviewV1(runtime, review) {
|
|
|
118
119
|
}
|
|
119
120
|
const input = planReviewTurnInput(review);
|
|
120
121
|
const projection = runtime.thread.getProjection();
|
|
121
|
-
if (Object.values(projection.turns).some(turn => turn.input
|
|
122
|
-
projection.queue.some(item => item.input
|
|
122
|
+
if (Object.values(projection.turns).some(turn => isPlanReviewTurnInput(review, turn.input)) ||
|
|
123
|
+
projection.queue.some(item => isPlanReviewTurnInput(review, item.input))) {
|
|
123
124
|
return { status: 'already_admitted' };
|
|
124
125
|
}
|
|
125
126
|
const result = runtime.thread.dispatch({
|
|
@@ -138,6 +139,14 @@ function admitResolvedPlanReviewV1(runtime, review) {
|
|
|
138
139
|
reason: result.status === 'rejected' ? result.reason : `unexpected_${result.status}`,
|
|
139
140
|
};
|
|
140
141
|
}
|
|
142
|
+
const approvedPlanInstruction = 'Execute the approved durable plan in BUILD mode. Follow its verification steps before finishing.';
|
|
143
|
+
const priorApprovedPlanInstruction = 'Execute the approved durable plan in BUILD mode. Verify the implementation before finishing.';
|
|
144
|
+
function isPlanReviewTurnInput(review, input) {
|
|
145
|
+
const current = planReviewTurnInput(review);
|
|
146
|
+
return (input === current ||
|
|
147
|
+
(review.status === 'approved' &&
|
|
148
|
+
input === current.slice(0, -approvedPlanInstruction.length) + priorApprovedPlanInstruction));
|
|
149
|
+
}
|
|
141
150
|
function planReviewTurnInput(review) {
|
|
142
151
|
const authority = [
|
|
143
152
|
'[Orion Plan Review V1]',
|
|
@@ -145,11 +154,7 @@ function planReviewTurnInput(review) {
|
|
|
145
154
|
`planDigest=${review.planDigest}`,
|
|
146
155
|
];
|
|
147
156
|
if (review.status === 'approved') {
|
|
148
|
-
return [
|
|
149
|
-
...authority,
|
|
150
|
-
'action=approve',
|
|
151
|
-
'Execute the approved durable plan in BUILD mode. Verify the implementation before finishing.',
|
|
152
|
-
].join('\n');
|
|
157
|
+
return [...authority, 'action=approve', approvedPlanInstruction].join('\n');
|
|
153
158
|
}
|
|
154
159
|
return [
|
|
155
160
|
...authority,
|
|
@@ -121,7 +121,7 @@ function createProductOrionRuntimeV1(options, sessionId, activation) {
|
|
|
121
121
|
if (context.mode === 'build' && !composition.taskContext.hasTaskTodos()) {
|
|
122
122
|
const projection = store.loadProjection();
|
|
123
123
|
const review = projection.planReview;
|
|
124
|
-
if (review?.status === 'approved' &&
|
|
124
|
+
if (review?.status === 'approved' && (0, plan_review_1.isPlanReviewTurnInput)(review, context.input)) {
|
|
125
125
|
const plan = (0, plan_review_1.findPlanReceiptForReviewV1)(projection, review).plan;
|
|
126
126
|
const steps = planExecutionChecklist(plan);
|
|
127
127
|
if (steps.length)
|
|
@@ -141,6 +141,7 @@ export interface BoundToolExecutionRequestV1 {
|
|
|
141
141
|
readonly context: ToolContext;
|
|
142
142
|
readonly enforcement: 'full' | 'partial' | 'none';
|
|
143
143
|
readonly abortSignal?: AbortSignal;
|
|
144
|
+
readonly verificationCommand?: string;
|
|
144
145
|
}
|
|
145
146
|
export interface WorkspaceMutationCoordinatorV1 {
|
|
146
147
|
runWorkspaceMutation<T>(input: {
|
|
@@ -153,7 +153,8 @@ class ExecutionService {
|
|
|
153
153
|
// test-generated files have been written and before committing its receipt.
|
|
154
154
|
const verificationWorkspace = descriptor?.executorId === 'builtin:exec_command:v1' &&
|
|
155
155
|
typeof request.args.command === 'string' &&
|
|
156
|
-
(0, verification_command_1.classifyDirectVerificationCommand)(request.args.command)
|
|
156
|
+
((0, verification_command_1.classifyDirectVerificationCommand)(request.args.command) ||
|
|
157
|
+
request.verificationCommand === request.args.command)
|
|
157
158
|
? this.captureVerificationWorkspace?.()
|
|
158
159
|
: undefined;
|
|
159
160
|
return {
|
|
@@ -39,11 +39,17 @@ function createTaskRecoveryBinder(taskContext, previousCommitDigest, progressAtA
|
|
|
39
39
|
};
|
|
40
40
|
checkpoint = { digest: (0, canonical_1.digestRuntimeValue)(seed), epoch: state.taskEpoch ?? 1 };
|
|
41
41
|
}
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
const invocation = name === 'exec_command' && typeof args.command === 'string' ? args.command : undefined;
|
|
43
|
+
const commandCwd = typeof args.cwd === 'string' ? (0, common_1.normalizeToolPath)(args.cwd) : '.';
|
|
44
|
+
const contract = taskContext.getContract();
|
|
45
|
+
const command = invocation &&
|
|
46
|
+
(0, redaction_1.redactTraceText)(invocation) === invocation &&
|
|
47
|
+
((0, verification_command_1.classifyDirectVerificationCommand)(invocation) ||
|
|
48
|
+
((0, verification_command_1.classifyVerificationSelector)(invocation) === 'generic' &&
|
|
49
|
+
contract?.criteria?.some(criterion => (0, verification_1.requiredVerificationKinds)(criterion.statement).includes('generic') &&
|
|
50
|
+
(0, verification_1.requestedLocalChecks)(criterion.statement).some(check => check.kind === 'generic' &&
|
|
51
|
+
(0, verification_1.matchesRequestedCheckInvocation)(invocation, (0, path_1.resolve)(cwd, commandCwd), check, contract.allowedScope.cwd)))))
|
|
52
|
+
? invocation
|
|
47
53
|
: undefined;
|
|
48
54
|
const path = typeof args.path === 'string'
|
|
49
55
|
? (0, verification_1.workspaceArtifactPath)(cwd, (0, common_1.normalizeToolPath)(args.path))
|
|
@@ -62,7 +68,7 @@ function createTaskRecoveryBinder(taskContext, previousCommitDigest, progressAtA
|
|
|
62
68
|
args: {
|
|
63
69
|
path,
|
|
64
70
|
command,
|
|
65
|
-
cwd: command && typeof args.cwd === 'string' ?
|
|
71
|
+
cwd: command && typeof args.cwd === 'string' ? commandCwd : undefined,
|
|
66
72
|
},
|
|
67
73
|
};
|
|
68
74
|
};
|
|
@@ -80,7 +86,9 @@ function projectTaskToolEvidence(receipt, args, cwd) {
|
|
|
80
86
|
const command = receipt.toolName === 'exec_command' && typeof args.command === 'string'
|
|
81
87
|
? args.command
|
|
82
88
|
: undefined;
|
|
83
|
-
const kind = command &&
|
|
89
|
+
const kind = command &&
|
|
90
|
+
((0, verification_command_1.classifyDirectVerificationCommand)(command) ??
|
|
91
|
+
(receipt.verificationWorkspace !== undefined && (0, verification_command_1.classifyVerificationSelector)(command)));
|
|
84
92
|
const verification = command && kind
|
|
85
93
|
? {
|
|
86
94
|
kind,
|
package/docs/cli-guide.md
CHANGED
|
@@ -47,6 +47,10 @@ orion doctor
|
|
|
47
47
|
审批 PLAN 时,`## Execution checklist` 下的未勾选项可直接进入同一执行清单。实际改动和检查的回执决定
|
|
48
48
|
步骤能否完成。输入“先把第一步做完,其他之后再说”可以限制当前任务的范围,输入“继续”恢复已延期的步骤。
|
|
49
49
|
|
|
50
|
+
从 v0.4.7 起,询问检查原因或当前状态可以在任务进行中得到答复。继续执行原任务时,原清单和验证条件仍然生效。
|
|
51
|
+
有自定义验证要求时,请给出检查命令和目录,例如“运行 `python3 inspect_fixture.py` 在 `workflow` 中验证样本”。
|
|
52
|
+
省略目录时使用项目根目录。也可对已有的未指定验证说“把之前的验证改为 `python3 inspect_fixture.py` 在 `workflow` 中”。
|
|
53
|
+
|
|
50
54
|
## TUI 命令与会话
|
|
51
55
|
|
|
52
56
|
从 v0.4.6 起,在输入框开头键入 `/` 可查看命令。候选根据命令名和别名筛选,并贴近输入框显示。
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orion-agents/orion-code",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.7",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@orion-agents/orion-code",
|
|
9
|
-
"version": "0.4.
|
|
9
|
+
"version": "0.4.7",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@agentclientprotocol/sdk": "2.12.0",
|