@orion-agents/orion-code 0.4.4 → 0.4.6
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 +15 -0
- package/README.md +4 -4
- package/README.zh-CN.md +4 -4
- package/dist/commands/context-commands.js +16 -28
- package/dist/commands/context-tool-command-handlers.d.ts +2 -3
- package/dist/commands/context-tool-command-handlers.js +2 -20
- package/dist/commands/registry.js +24 -61
- package/dist/commands/retired-commands.d.ts +2 -0
- package/dist/commands/retired-commands.js +24 -0
- package/dist/commands/session-command-handlers.d.ts +3 -2
- package/dist/commands/session-command-handlers.js +41 -42
- package/dist/commands/session-commands.js +21 -0
- package/dist/commands/system-commands.js +2 -27
- package/dist/commands/tool-commands.js +0 -10
- package/dist/commands/types.d.ts +6 -4
- package/dist/commands/workflow-commands.js +0 -24
- package/dist/core/tool-artifacts.js +17 -4
- package/dist/framework/query.js +151 -17
- package/dist/framework/tool-state.d.ts +4 -0
- package/dist/harness/context-harness.d.ts +7 -3
- package/dist/harness/context-harness.js +222 -48
- package/dist/harness/contract.js +3 -1
- package/dist/harness/drift-guard.js +67 -17
- package/dist/harness/goal-verification.d.ts +11 -0
- package/dist/harness/goal-verification.js +62 -0
- package/dist/harness/ledger.js +16 -3
- package/dist/harness/state.js +3 -0
- package/dist/harness/stop-controller.js +1 -1
- package/dist/harness/task-checklist.d.ts +11 -1
- package/dist/harness/task-checklist.js +48 -4
- package/dist/harness/types.d.ts +10 -0
- package/dist/harness/verification.d.ts +11 -1
- package/dist/harness/verification.js +47 -2
- package/dist/runtime/agent-loop.js +4 -1
- package/dist/runtime/agent-runtime-controller.d.ts +4 -2
- package/dist/runtime/agent-runtime-controller.js +115 -30
- package/dist/runtime/batch-read-service.js +21 -4
- package/dist/runtime/goal-runtime-coordinator.js +1 -0
- package/dist/runtime/orion-session-runner.js +3 -5
- package/dist/runtime/product-bootstrap.js +24 -11
- package/dist/runtime/product-orion-runtime.js +24 -2
- package/dist/runtime/task-context-recovery.js +21 -5
- package/dist/runtime/task-context-service.d.ts +3 -1
- package/dist/runtime/task-context-service.js +3 -0
- package/dist/runtime/ui-events.d.ts +4 -1
- package/dist/runtime/ui-view-model.js +7 -3
- package/dist/runtime/workspace-verification.d.ts +2 -2
- package/dist/runtime/workspace-verification.js +24 -9
- package/dist/services/chat-completion-sse.d.ts +9 -0
- package/dist/services/chat-completion-sse.js +50 -0
- package/dist/services/compact/summary-generator.d.ts +1 -1
- package/dist/services/compact/summary-generator.js +12 -0
- package/dist/services/llm.d.ts +1 -1
- package/dist/services/llm.js +165 -292
- package/dist/services/provider-diagnostics.d.ts +1 -1
- package/dist/services/provider-diagnostics.js +7 -2
- package/dist/services/provider-resilience/error-classifier.d.ts +3 -0
- package/dist/services/provider-resilience/error-classifier.js +14 -0
- package/dist/skills/builtin/security-check/SKILL.md +2 -2
- package/dist/skills/builtin/test-gen/SKILL.md +2 -2
- package/dist/terminal-ui/launch.js +1 -1
- package/dist/tools/core/common.d.ts +0 -11
- package/dist/tools/core/common.js +0 -18
- package/dist/tools/core/edit-file.js +57 -86
- package/dist/tools/core/exec-command.js +61 -80
- package/dist/tools/core/grep.js +84 -24
- package/dist/tools/core/read-file.js +3 -2
- package/dist/tools/todo.d.ts +2 -2
- package/dist/tools/todo.js +13 -10
- package/dist/tui-ui/launch.js +4 -1
- package/dist/tui-ui/layout.d.ts +2 -2
- package/dist/tui-ui/layout.js +59 -47
- package/dist/tui-ui/pickers.d.ts +3 -1
- package/dist/tui-ui/pickers.js +17 -11
- package/dist/tui-ui/runner.d.ts +1 -1
- package/dist/tui-ui/runner.js +61 -68
- package/dist/tui-ui/state.d.ts +4 -0
- package/dist/tui-ui/state.js +33 -2
- package/dist/utils/utf8.d.ts +6 -0
- package/dist/utils/utf8.js +14 -0
- package/docs/cli-guide.md +27 -3
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/dist/commands/types.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* 使用 `/` 前缀的命令系统,支持 Tab 补全、命令建议、参数定义。
|
|
5
5
|
* 非 `/` 前缀的输入直接作为 chat 消息处理。
|
|
6
6
|
*/
|
|
7
|
-
import type { Store } from '../framework/store';
|
|
7
|
+
import type { AppState, Store } from '../framework/store';
|
|
8
8
|
import type { LLMService } from '../services/llm';
|
|
9
9
|
import type { OrionCodeCLIConfig, UIRenderer } from '../services/config';
|
|
10
10
|
import type { SessionMeta } from '../services/session-storage';
|
|
@@ -32,9 +32,13 @@ export interface CommandContext {
|
|
|
32
32
|
sessionId?: string;
|
|
33
33
|
/** Lazily create or return the active session. */
|
|
34
34
|
ensureSession?: () => SessionMeta;
|
|
35
|
+
/** Start an independent durable session and activate its runtime. */
|
|
36
|
+
startNewSession?: () => Promise<SessionMeta>;
|
|
35
37
|
/** Switch the active session after /resume. */
|
|
36
38
|
setSession?: (session: SessionMeta) => void;
|
|
37
|
-
/**
|
|
39
|
+
/** Activate a verified Session/Thread and its read-side projection as one transition. */
|
|
40
|
+
activateSessionRuntime?: (session: SessionMeta, activation: ThreadSessionRuntimeActivationV1 | undefined, projection: Pick<AppState, 'conversationHistory' | 'harnessState'>) => Promise<void>;
|
|
41
|
+
/** Rebind an external runtime after selecting a Session. */
|
|
38
42
|
restoreSessionRuntime?: (activation?: ThreadSessionRuntimeActivationV1) => Promise<void>;
|
|
39
43
|
/** Notify renderer-independent runtime protocol consumers after /resume. */
|
|
40
44
|
sessionRestored?: (event: RuntimeSessionRestoredEvent) => void;
|
|
@@ -52,8 +56,6 @@ export interface CommandContext {
|
|
|
52
56
|
writeOutput?: (text: string) => void;
|
|
53
57
|
/** Write one line while preserving the live input frame, when supported by the UI. */
|
|
54
58
|
writeLine?: (text?: string) => void;
|
|
55
|
-
/** Ask the active renderer to clear its viewport without deleting session data. */
|
|
56
|
-
clearView?: () => void;
|
|
57
59
|
/** Ask the active renderer to begin graceful shutdown. */
|
|
58
60
|
requestShutdown?: (reason?: string) => void;
|
|
59
61
|
/** Active renderer adapter identity, including non-config renderers such as print mode. */
|
|
@@ -74,30 +74,6 @@ exports.WORKFLOW_COMMANDS = [
|
|
|
74
74
|
risk: 'read-only',
|
|
75
75
|
execute: (_ctx, args) => (0, workflow_command_handlers_1.continueAsSlashChat)('research', args),
|
|
76
76
|
},
|
|
77
|
-
{
|
|
78
|
-
name: 'security',
|
|
79
|
-
aliases: ['audit'],
|
|
80
|
-
description: 'Review code or dependencies for security risks',
|
|
81
|
-
argumentHint: '[scope]',
|
|
82
|
-
category: 'workflow',
|
|
83
|
-
priority: 20,
|
|
84
|
-
type: 'chat',
|
|
85
|
-
execution: 'agent-workflow',
|
|
86
|
-
risk: 'read-only',
|
|
87
|
-
execute: (_ctx, args) => (0, workflow_command_handlers_1.continueAsSlashChat)('security', args),
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
name: 'test-gen',
|
|
91
|
-
aliases: ['tests'],
|
|
92
|
-
description: 'Generate or improve tests for a target area',
|
|
93
|
-
argumentHint: '[scope]',
|
|
94
|
-
category: 'workflow',
|
|
95
|
-
priority: 30,
|
|
96
|
-
type: 'chat',
|
|
97
|
-
execution: 'agent-workflow',
|
|
98
|
-
risk: 'state-write',
|
|
99
|
-
execute: (_ctx, args) => (0, workflow_command_handlers_1.continueAsSlashChat)('test-gen', args),
|
|
100
|
-
},
|
|
101
77
|
{
|
|
102
78
|
name: 'todos',
|
|
103
79
|
aliases: ['todo'],
|
|
@@ -105,7 +105,13 @@ function storeArtifact(projectPath, toolName, output, outputBytes) {
|
|
|
105
105
|
return null;
|
|
106
106
|
const safeToolName = sanitizeArtifactToolName(toolName);
|
|
107
107
|
const id = `${safeToolName}-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
108
|
-
|
|
108
|
+
let artifactDir;
|
|
109
|
+
try {
|
|
110
|
+
artifactDir = path.resolve(getArtifactDir(projectPath));
|
|
111
|
+
}
|
|
112
|
+
catch {
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
109
115
|
const artifactPath = path.resolve(artifactDir, `${id}.txt`);
|
|
110
116
|
if (!artifactPath.startsWith(`${artifactDir}${path.sep}`)) {
|
|
111
117
|
return null;
|
|
@@ -203,9 +209,16 @@ function truncateForContext(output, maxBytes = 4096) {
|
|
|
203
209
|
return output;
|
|
204
210
|
const half = Math.floor(maxBytes / 2);
|
|
205
211
|
const buf = Buffer.from(output, 'utf8');
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
212
|
+
let headEnd = half;
|
|
213
|
+
let tailStart = buf.length - half;
|
|
214
|
+
// Keep both cuts on UTF-8 boundaries, inside their respective byte limits.
|
|
215
|
+
while (headEnd > 0 && (buf[headEnd] & 0xc0) === 0x80)
|
|
216
|
+
headEnd--;
|
|
217
|
+
while (tailStart < buf.length && (buf[tailStart] & 0xc0) === 0x80)
|
|
218
|
+
tailStart++;
|
|
219
|
+
const head = buf.subarray(0, headEnd).toString('utf8');
|
|
220
|
+
const tail = buf.subarray(tailStart).toString('utf8');
|
|
221
|
+
return `${head}\n\n[... ${tailStart - headEnd} bytes truncated, ${byteLen}B total — see artifact for full output]\n\n${tail}`;
|
|
209
222
|
}
|
|
210
223
|
/**
|
|
211
224
|
* Clean up expired artifacts (older than 24h).
|
package/dist/framework/query.js
CHANGED
|
@@ -17,6 +17,7 @@ exports.createFailedLoopStats = createFailedLoopStats;
|
|
|
17
17
|
exports.query = query;
|
|
18
18
|
const llm_1 = require("../services/llm");
|
|
19
19
|
const provider_diagnostics_1 = require("../services/provider-diagnostics");
|
|
20
|
+
const tool_artifacts_1 = require("../core/tool-artifacts");
|
|
20
21
|
const tool_1 = require("./tool");
|
|
21
22
|
const auto_compact_1 = require("../services/compact/auto-compact");
|
|
22
23
|
const fingerprint_1 = require("../services/compact/fingerprint");
|
|
@@ -452,7 +453,92 @@ function truncateModelField(text, maxSerializedBytes) {
|
|
|
452
453
|
}
|
|
453
454
|
return result;
|
|
454
455
|
}
|
|
455
|
-
function
|
|
456
|
+
function parseBatchPreviewSteps(output) {
|
|
457
|
+
const batch = parseRecord(output);
|
|
458
|
+
if (batch?.version !== 1 ||
|
|
459
|
+
!Array.isArray(batch.steps) ||
|
|
460
|
+
batch.steps.length === 0 ||
|
|
461
|
+
batch.steps.length > 8)
|
|
462
|
+
return;
|
|
463
|
+
const steps = [];
|
|
464
|
+
for (const [index, step] of batch.steps.entries()) {
|
|
465
|
+
if (!isRecord(step) ||
|
|
466
|
+
step.index !== index + 1 ||
|
|
467
|
+
typeof step.tool !== 'string' ||
|
|
468
|
+
!/^[a-z_]{1,32}$/u.test(step.tool) ||
|
|
469
|
+
(step.state !== 'completed' && step.state !== 'skipped') ||
|
|
470
|
+
typeof step.success !== 'boolean' ||
|
|
471
|
+
typeof step.output !== 'string')
|
|
472
|
+
return;
|
|
473
|
+
const terminal = typeof step.terminal === 'string' &&
|
|
474
|
+
['completed', 'failed', 'interrupted', 'indeterminate'].includes(step.terminal)
|
|
475
|
+
? step.terminal
|
|
476
|
+
: undefined;
|
|
477
|
+
steps.push({
|
|
478
|
+
index: step.index,
|
|
479
|
+
tool: step.tool,
|
|
480
|
+
state: step.state,
|
|
481
|
+
success: step.success,
|
|
482
|
+
terminal,
|
|
483
|
+
output: step.output,
|
|
484
|
+
truncated: step.truncated === true,
|
|
485
|
+
});
|
|
486
|
+
}
|
|
487
|
+
return steps;
|
|
488
|
+
}
|
|
489
|
+
function projectBatchPreview(steps, compactEnvelope, minimalEnvelope, maxBytes) {
|
|
490
|
+
const succeeded = steps.filter(step => step.state === 'completed' && step.success).length;
|
|
491
|
+
const skipped = steps.filter(step => step.state === 'skipped').length;
|
|
492
|
+
const failed = steps.length - succeeded - skipped;
|
|
493
|
+
const makePreview = (childBytes) => compactEnvelope(JSON.stringify({
|
|
494
|
+
version: 1,
|
|
495
|
+
success: failed === 0 && skipped === 0,
|
|
496
|
+
succeeded,
|
|
497
|
+
failed,
|
|
498
|
+
skipped,
|
|
499
|
+
steps: steps.map(step => {
|
|
500
|
+
const output = takeUtf8Prefix(step.output, childBytes);
|
|
501
|
+
return {
|
|
502
|
+
...step,
|
|
503
|
+
output,
|
|
504
|
+
truncated: step.truncated || output.length < step.output.length,
|
|
505
|
+
};
|
|
506
|
+
}),
|
|
507
|
+
}));
|
|
508
|
+
let preview = makePreview(0);
|
|
509
|
+
if (byteLength(preview) > maxBytes) {
|
|
510
|
+
// The recovery floor normally fits even eight object rows. Keep the same
|
|
511
|
+
// child identities and terminal states for callers with a smaller limit.
|
|
512
|
+
const output = JSON.stringify({
|
|
513
|
+
version: 1,
|
|
514
|
+
stepFields: ['index', 'status', 'truncated'],
|
|
515
|
+
steps: steps.map(step => [
|
|
516
|
+
step.index,
|
|
517
|
+
step.state === 'skipped'
|
|
518
|
+
? 'skipped'
|
|
519
|
+
: (step.terminal ?? (step.success ? 'completed' : 'failed')),
|
|
520
|
+
step.truncated || step.output.length > 0,
|
|
521
|
+
]),
|
|
522
|
+
});
|
|
523
|
+
const compact = compactEnvelope(output);
|
|
524
|
+
return byteLength(compact) <= maxBytes ? compact : minimalEnvelope(output);
|
|
525
|
+
}
|
|
526
|
+
let low = 1;
|
|
527
|
+
let high = maxBytes;
|
|
528
|
+
while (low <= high) {
|
|
529
|
+
const middle = Math.floor((low + high) / 2);
|
|
530
|
+
const candidate = makePreview(middle);
|
|
531
|
+
if (byteLength(candidate) <= maxBytes) {
|
|
532
|
+
preview = candidate;
|
|
533
|
+
low = middle + 1;
|
|
534
|
+
}
|
|
535
|
+
else {
|
|
536
|
+
high = middle - 1;
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
return preview;
|
|
540
|
+
}
|
|
541
|
+
function summarizeModelVisibleToolResult(executed, maxBytes, budgetRemainingBytes, budgetLimitBytes, projectPath) {
|
|
456
542
|
const rawBytes = byteLength(executed.result);
|
|
457
543
|
const fullOutputBytes = executed.outputBytes ?? rawBytes;
|
|
458
544
|
const envelope = (0, tool_serializer_1.parseToolResultEnvelope)(executed.result);
|
|
@@ -476,6 +562,44 @@ function summarizeModelVisibleToolResult(executed, maxBytes, budgetRemainingByte
|
|
|
476
562
|
if (byteLength(fullResult) <= maxBytes) {
|
|
477
563
|
return { result: fullResult, bytes: byteLength(fullResult), summarizedBytes: 0 };
|
|
478
564
|
}
|
|
565
|
+
if (executed.prepared.tc.function.name === 'batch_read') {
|
|
566
|
+
const steps = parseBatchPreviewSteps(output);
|
|
567
|
+
if (steps) {
|
|
568
|
+
const existing = executed.artifactRef;
|
|
569
|
+
const artifact = existing &&
|
|
570
|
+
/^[a-z0-9_-]{1,64}$/iu.test(existing.id) &&
|
|
571
|
+
Number.isSafeInteger(existing.outputBytes)
|
|
572
|
+
? existing
|
|
573
|
+
: (0, tool_artifacts_1.storeArtifact)(projectPath, 'batch_read', output, byteLength(output));
|
|
574
|
+
const artifactRef = artifact
|
|
575
|
+
? { id: artifact.id, outputBytes: artifact.outputBytes }
|
|
576
|
+
: undefined;
|
|
577
|
+
const minimal = { success: executed.success, artifactRef };
|
|
578
|
+
const compactSummary = summary ? truncateModelField(summary, 128) : undefined;
|
|
579
|
+
const compactError = rawError ? truncateModelField(rawError, 128) : undefined;
|
|
580
|
+
const result = projectBatchPreview(steps, compactOutput => (0, tool_serializer_1.serializeToolResult)({
|
|
581
|
+
...minimal,
|
|
582
|
+
output: compactOutput,
|
|
583
|
+
outputBytes: fullOutputBytes,
|
|
584
|
+
summary: compactSummary,
|
|
585
|
+
error: compactError,
|
|
586
|
+
metadata: {
|
|
587
|
+
modelVisibleCompressed: true,
|
|
588
|
+
originalResultBytes: rawBytes,
|
|
589
|
+
...budgetMetadata,
|
|
590
|
+
},
|
|
591
|
+
}), compactOutput => (0, tool_serializer_1.serializeToolResult)({
|
|
592
|
+
...minimal,
|
|
593
|
+
output: compactOutput,
|
|
594
|
+
metadata: {
|
|
595
|
+
modelVisibleCompressed: true,
|
|
596
|
+
budgetExhausted: budgetMetadata.budgetExhausted,
|
|
597
|
+
},
|
|
598
|
+
}), maxBytes);
|
|
599
|
+
const bytes = byteLength(result);
|
|
600
|
+
return { result, bytes, summarizedBytes: Math.max(0, fullOutputBytes - bytes), artifactRef };
|
|
601
|
+
}
|
|
602
|
+
}
|
|
479
603
|
// Keep a real excerpt, status and a budget signal even after exhaustion. An
|
|
480
604
|
// untrusted tool's arbitrarily large metadata must not displace the excerpt.
|
|
481
605
|
const compactError = rawError ? truncateModelField(rawError, 192) : undefined;
|
|
@@ -739,7 +863,7 @@ async function* query(params) {
|
|
|
739
863
|
status: planStop.code === 'task_step_blocked' ? 'blocked' : 'stopped',
|
|
740
864
|
reason: { code: planStop.code, message: planStop.message },
|
|
741
865
|
nextActions: [
|
|
742
|
-
{ kind: 'inspect', label: 'Inspect the current checklist', command: '/
|
|
866
|
+
{ kind: 'inspect', label: 'Inspect the current checklist', command: '/context explain' },
|
|
743
867
|
{ kind: 'continue', label: 'Continue the current task', command: '继续' },
|
|
744
868
|
],
|
|
745
869
|
};
|
|
@@ -983,23 +1107,29 @@ async function* query(params) {
|
|
|
983
1107
|
return;
|
|
984
1108
|
}
|
|
985
1109
|
const visibleContent = (0, terminal_text_1.hasVisibleAssistantText)(response.content) ? response.content : '';
|
|
986
|
-
if (response.finishReason === 'length' ||
|
|
1110
|
+
if (response.finishReason === 'length' ||
|
|
1111
|
+
response.finishReason === 'content_filter' ||
|
|
1112
|
+
response.finishReason === 'incomplete') {
|
|
987
1113
|
if (visibleContent) {
|
|
988
1114
|
appendMessage({ role: 'assistant', content: visibleContent });
|
|
989
1115
|
if (holdAssistant)
|
|
990
1116
|
streamCallbacks?.onChunk?.(visibleContent);
|
|
991
1117
|
yield { type: 'message', role: 'assistant', content: visibleContent };
|
|
992
1118
|
}
|
|
993
|
-
stats.providerStop =
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
:
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1119
|
+
stats.providerStop = {
|
|
1120
|
+
length: {
|
|
1121
|
+
code: 'provider_output_limit',
|
|
1122
|
+
message: 'The provider reached its output token limit. Continue with a narrower request.',
|
|
1123
|
+
},
|
|
1124
|
+
content_filter: {
|
|
1125
|
+
code: 'provider_content_filter',
|
|
1126
|
+
message: 'The provider stopped generation at its content filter.',
|
|
1127
|
+
},
|
|
1128
|
+
incomplete: {
|
|
1129
|
+
code: 'provider_stream_incomplete',
|
|
1130
|
+
message: 'The provider stream ended with an incomplete response. Retry the request.',
|
|
1131
|
+
},
|
|
1132
|
+
}[response.finishReason];
|
|
1003
1133
|
yield attachCompactCommit({
|
|
1004
1134
|
type: 'complete',
|
|
1005
1135
|
content: stats.providerStop.message,
|
|
@@ -1080,7 +1210,7 @@ async function* query(params) {
|
|
|
1080
1210
|
const { tc, args, attemptId } = prepared;
|
|
1081
1211
|
const remainingModelVisibleBytes = Math.max(0, loopBudget.maxModelVisibleToolBytes - stats.modelVisibleToolBytes);
|
|
1082
1212
|
const visibilityFloor = Math.min(exports.MIN_MODEL_VISIBLE_TOOL_RESULT_BYTES, maxModelVisibleToolResultBytes);
|
|
1083
|
-
const modelVisible = summarizeModelVisibleToolResult(executed, Math.max(visibilityFloor, Math.min(maxModelVisibleToolResultBytes, remainingModelVisibleBytes)), remainingModelVisibleBytes, loopBudget.maxModelVisibleToolBytes);
|
|
1213
|
+
const modelVisible = summarizeModelVisibleToolResult(executed, Math.max(visibilityFloor, Math.min(maxModelVisibleToolResultBytes, remainingModelVisibleBytes)), remainingModelVisibleBytes, loopBudget.maxModelVisibleToolBytes, params.toolContext?.cwd);
|
|
1084
1214
|
stats.toolResultBytes += executed.outputBytes ?? byteLength(executed.result);
|
|
1085
1215
|
stats.modelVisibleToolBytes += modelVisible.bytes;
|
|
1086
1216
|
stats.summarizedBytes += modelVisible.summarizedBytes;
|
|
@@ -1161,7 +1291,7 @@ async function* query(params) {
|
|
|
1161
1291
|
modelVisibleResult: modelVisible.result,
|
|
1162
1292
|
duration: executed.duration,
|
|
1163
1293
|
success: executed.success,
|
|
1164
|
-
artifactRef: executed.artifactRef,
|
|
1294
|
+
artifactRef: modelVisible.artifactRef ?? executed.artifactRef,
|
|
1165
1295
|
externalAssertion: executed.externalAssertion,
|
|
1166
1296
|
error: executed.error,
|
|
1167
1297
|
summary: executed.summary,
|
|
@@ -1278,8 +1408,12 @@ async function* query(params) {
|
|
|
1278
1408
|
if (completionGate && !completionGate.canComplete) {
|
|
1279
1409
|
const rejectedState = JSON.stringify([
|
|
1280
1410
|
completionGate.missing,
|
|
1281
|
-
completionGate.
|
|
1282
|
-
completionGate.
|
|
1411
|
+
completionGate.progressDelta?.workspaceStateHash,
|
|
1412
|
+
completionGate.criterionResults?.map(result => [
|
|
1413
|
+
result.criterionId,
|
|
1414
|
+
result.status,
|
|
1415
|
+
result.verificationProblems,
|
|
1416
|
+
]),
|
|
1283
1417
|
]);
|
|
1284
1418
|
if (rejectedCompletionStates.has(rejectedState)) {
|
|
1285
1419
|
const missing = completionGate.missing?.length
|
|
@@ -11,6 +11,10 @@ export interface TodoItem {
|
|
|
11
11
|
activeForm: string;
|
|
12
12
|
verification?: LocalVerificationKind[];
|
|
13
13
|
}
|
|
14
|
+
export interface TodoWriteAdjustment {
|
|
15
|
+
todos: TodoItem[];
|
|
16
|
+
warnings: string[];
|
|
17
|
+
}
|
|
14
18
|
export interface ToolState {
|
|
15
19
|
todos: TodoItem[];
|
|
16
20
|
/** v0.2.24 — Goal target mode (set by create_goal / update_goal) */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { LLMResponse, Message } from '../services/llm';
|
|
2
|
-
import type { TodoItem } from '../framework/tool-state';
|
|
2
|
+
import type { TodoItem, TodoWriteAdjustment } from '../framework/tool-state';
|
|
3
3
|
import { type PromptAssemblyOptions } from './assembler';
|
|
4
4
|
import { type CreateTurnSummaryInput } from './turn-summary';
|
|
5
5
|
import type { CompletionGateResult, CapabilityProfileInput, ContextCapsule, DriftCheckResult, HarnessConfig, HarnessProgressState, HarnessState, IntentUpdate, ProgressDelta, TaskPlanStop, TaskTodoObservation, TaskWorkspaceAction, ToolResultObservation, TurnSummary } from './types';
|
|
@@ -25,6 +25,7 @@ export declare class HarnessKernel {
|
|
|
25
25
|
private taskChecklistTargets;
|
|
26
26
|
private verificationWorkspace?;
|
|
27
27
|
private goalTaskId?;
|
|
28
|
+
private goalVerificationBlocker?;
|
|
28
29
|
private taskTodos;
|
|
29
30
|
private reportedTaskBlocker?;
|
|
30
31
|
private readonly taskTodoReceipts;
|
|
@@ -47,6 +48,7 @@ export declare class HarnessKernel {
|
|
|
47
48
|
constructor(options: ContextHarnessOptions);
|
|
48
49
|
updateContractFromUserInput(input: string, goalTaskId?: string): IntentUpdate | undefined;
|
|
49
50
|
classifyIntent(input: string): IntentUpdate;
|
|
51
|
+
observeGoalSteering(input: string, goalId: string): void;
|
|
50
52
|
activeTaskTodo(): string | undefined;
|
|
51
53
|
hasTaskTodos(): boolean;
|
|
52
54
|
missingExecutionChecklist(action?: TaskWorkspaceAction): string | undefined;
|
|
@@ -56,9 +58,11 @@ export declare class HarnessKernel {
|
|
|
56
58
|
private deferTaskTodos;
|
|
57
59
|
requiresVerification(): boolean;
|
|
58
60
|
recordTaskTodoReceipt(step: string, observation: TaskTodoObservation): void;
|
|
59
|
-
updateTaskTodos(todos: TodoItem[], blockedReason?: string): string | undefined;
|
|
61
|
+
updateTaskTodos(todos: TodoItem[], blockedReason?: string): TodoWriteAdjustment | string | undefined;
|
|
60
62
|
private taskTodoId;
|
|
61
63
|
private missingTodoEvidence;
|
|
64
|
+
private formatTodoCheck;
|
|
65
|
+
private diffTodoCheckHint;
|
|
62
66
|
updateCapabilityProfile(input: CapabilityProfileInput): HarnessState['capabilityProfile'];
|
|
63
67
|
assembleMessages(messages: Message[], options?: PromptAssemblyOptions): Message[];
|
|
64
68
|
recordAssistantResponse(response: LLMResponse): void;
|
|
@@ -96,7 +100,7 @@ export declare class HarnessKernel {
|
|
|
96
100
|
getContract(): HarnessState['contract'];
|
|
97
101
|
getIntentHistory(): IntentUpdate[];
|
|
98
102
|
/**
|
|
99
|
-
* Generate a structured diagnostic summary for /
|
|
103
|
+
* Generate a structured diagnostic summary for /context explain
|
|
100
104
|
*/
|
|
101
105
|
explain(): {
|
|
102
106
|
contract: HarnessState['contract'];
|