@orion-agents/orion-code 0.4.3 → 0.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/README.md +4 -4
- package/README.zh-CN.md +4 -4
- package/dist/acp/session-updates.d.ts +4 -3
- package/dist/acp/session-updates.js +23 -2
- package/dist/acp/sessions.js +19 -6
- package/dist/commands/core-command-handlers.js +10 -22
- package/dist/commands/diagnostic-command-handlers.js +48 -52
- package/dist/commands/registry.js +1 -1
- package/dist/commands/target-command.js +49 -6
- package/dist/commands/workflow-commands.js +2 -2
- package/dist/core/tool-artifacts.js +17 -4
- package/dist/framework/loop-budget-contract.d.ts +1 -12
- package/dist/framework/loop-budget-contract.js +1 -7
- package/dist/framework/loop-progress.d.ts +3 -7
- package/dist/framework/loop-progress.js +7 -23
- package/dist/framework/query.d.ts +12 -24
- package/dist/framework/query.js +294 -301
- package/dist/framework/tool-state.d.ts +4 -0
- package/dist/harness/assembler.js +1 -1
- package/dist/harness/context-harness.d.ts +12 -2
- package/dist/harness/context-harness.js +288 -60
- 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/index.d.ts +1 -1
- package/dist/harness/ledger.d.ts +1 -0
- package/dist/harness/ledger.js +28 -4
- package/dist/harness/progress-controller.js +57 -35
- package/dist/harness/state.js +4 -0
- package/dist/harness/stop-controller.d.ts +0 -5
- package/dist/harness/stop-controller.js +11 -31
- package/dist/harness/task-checklist.d.ts +12 -2
- package/dist/harness/task-checklist.js +50 -9
- package/dist/harness/types.d.ts +15 -0
- package/dist/harness/verification.d.ts +11 -1
- package/dist/harness/verification.js +47 -2
- package/dist/print-ui/event-stream.d.ts +5 -0
- package/dist/print-ui/event-stream.js +22 -5
- package/dist/runtime/agent-loop.d.ts +2 -1
- package/dist/runtime/agent-loop.js +23 -17
- package/dist/runtime/agent-runtime-controller.d.ts +1 -1
- package/dist/runtime/agent-runtime-controller.js +21 -11
- package/dist/runtime/batch-read-service.js +21 -4
- package/dist/runtime/goal-lifecycle-v2.d.ts +6 -4
- package/dist/runtime/goal-lifecycle-v2.js +164 -56
- package/dist/runtime/goal-runtime-coordinator.d.ts +6 -3
- package/dist/runtime/goal-runtime-coordinator.js +91 -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 -54
- package/dist/runtime/orion-runtime-v1.js +55 -14
- package/dist/runtime/product-orion-runtime.js +30 -13
- package/dist/runtime/rsi/evaluation.js +1 -7
- package/dist/runtime/step-snapshot.d.ts +3 -1
- package/dist/runtime/step-snapshot.js +11 -1
- package/dist/runtime/subagent-thread-runtime.js +27 -5
- package/dist/runtime/subagents/production.js +0 -4
- package/dist/runtime/task-context-recovery.js +30 -7
- package/dist/runtime/task-context-service.d.ts +7 -1
- package/dist/runtime/task-context-service.js +40 -8
- package/dist/runtime/thread-admission.d.ts +2 -0
- package/dist/runtime/thread-admission.js +9 -1
- package/dist/runtime/thread-runtime.d.ts +3 -0
- package/dist/runtime/thread-runtime.js +42 -3
- package/dist/runtime/thread-ui-adapter.js +1 -11
- package/dist/runtime/tool-gateway.d.ts +2 -0
- package/dist/runtime/tool-gateway.js +4 -0
- package/dist/runtime/tool-receipt-validator.js +4 -0
- package/dist/runtime/ui-events.d.ts +3 -1
- package/dist/runtime/ui-view-model.js +62 -59
- package/dist/runtime/workspace-verification.d.ts +7 -0
- package/dist/runtime/workspace-verification.js +98 -0
- 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/config.js +3 -7
- package/dist/services/global-config.d.ts +3 -11
- package/dist/services/global-config.js +36 -26
- package/dist/services/llm.d.ts +3 -1
- package/dist/services/llm.js +171 -285
- package/dist/services/provider-diagnostics.d.ts +2 -1
- package/dist/services/provider-diagnostics.js +15 -4
- package/dist/services/provider-resilience/error-classifier.d.ts +3 -0
- package/dist/services/provider-resilience/error-classifier.js +14 -0
- package/dist/tools/core/common.d.ts +0 -11
- package/dist/tools/core/common.js +0 -18
- package/dist/tools/core/edit-file.js +61 -88
- 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/core/write-file.js +5 -3
- package/dist/tools/todo.d.ts +2 -2
- package/dist/tools/todo.js +29 -10
- package/dist/tui-ui/chrome-view-model.js +15 -6
- package/dist/utils/utf8.d.ts +6 -0
- package/dist/utils/utf8.js +14 -0
- package/docs/cli-guide.md +58 -40
- package/docs/orion.example.yaml +4 -3
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
|
@@ -2,11 +2,4 @@ import { type LoopBudget } from '../framework/loop-budget-contract';
|
|
|
2
2
|
import type { OrionCodeCLIConfig } from '../services/config';
|
|
3
3
|
import type { HarnessState } from '../harness/types';
|
|
4
4
|
export declare function resolveRuntimeLoopBudget(input: string, config: Pick<OrionCodeCLIConfig, 'agentLoop'>, harnessState?: Pick<HarnessState, 'rootObjective' | 'activeInstruction' | 'contract' | 'capsule'>): LoopBudget;
|
|
5
|
-
/**
|
|
6
|
-
* Autonomous Goal continuations have no fresh human decision boundary. Cap
|
|
7
|
-
* each one even when task heuristics or config select a larger loop profile.
|
|
8
|
-
*/
|
|
9
|
-
export declare function capAutonomousGoalLoopBudget(budget: LoopBudget): LoopBudget;
|
|
10
|
-
/** Resolve a continuation from config only; model-authored Goal text must not promote its profile. */
|
|
11
|
-
export declare function resolveAutonomousGoalLoopBudget(config: Pick<OrionCodeCLIConfig, 'agentLoop'>): LoopBudget;
|
|
12
5
|
//# sourceMappingURL=loop-budget.d.ts.map
|
|
@@ -1,35 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.resolveRuntimeLoopBudget = resolveRuntimeLoopBudget;
|
|
4
|
-
exports.capAutonomousGoalLoopBudget = capAutonomousGoalLoopBudget;
|
|
5
|
-
exports.resolveAutonomousGoalLoopBudget = resolveAutonomousGoalLoopBudget;
|
|
6
4
|
const loop_budget_contract_1 = require("../framework/loop-budget-contract");
|
|
7
|
-
const types_1 = require("./goals/types");
|
|
8
|
-
const COMPLEX_TASK_LLM_BUDGET = 48;
|
|
9
|
-
const RELEASE_TASK_LLM_BUDGET = 64;
|
|
10
|
-
const COMPLEX_TASK_TOOL_BUDGET = 180;
|
|
11
|
-
const RELEASE_TASK_TOOL_BUDGET = 240;
|
|
12
5
|
const COMPLEX_TASK_MODEL_VISIBLE_BYTES = 96 * 1024;
|
|
13
6
|
const RELEASE_TASK_MODEL_VISIBLE_BYTES = 128 * 1024;
|
|
14
|
-
function toBaseProfile(value) {
|
|
15
|
-
return value === 'complex' || value === 'release' ? value : 'default';
|
|
16
|
-
}
|
|
17
|
-
function applyConfigOverrides(budget, overrides) {
|
|
18
|
-
const numericOverrides = Object.fromEntries(Object.entries(overrides?.budget ?? {}).filter(([, value]) => typeof value === 'number' && Number.isFinite(value) && value > 0));
|
|
19
|
-
const requestPolicy = overrides?.budgetPolicy === 'fixed' || numericOverrides.maxLlmRequestsPerUserTurn !== undefined
|
|
20
|
-
? 'fixed'
|
|
21
|
-
: 'adaptive';
|
|
22
|
-
if (Object.keys(numericOverrides).length === 0)
|
|
23
|
-
return { ...budget, requestPolicy };
|
|
24
|
-
return {
|
|
25
|
-
...budget,
|
|
26
|
-
...numericOverrides,
|
|
27
|
-
requestPolicy,
|
|
28
|
-
profile: 'config',
|
|
29
|
-
baseProfile: budget.baseProfile ?? toBaseProfile(budget.profile),
|
|
30
|
-
configOverride: true,
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
7
|
function looksLikeReleaseTask(input) {
|
|
34
8
|
return (/(?<![\p{L}\p{N}_])(?:push|pull request|pr|publish|release|npm publish|prepublish)(?![\p{L}\p{N}_])/iu.test(input) || /(发布|发版|提交|推送)/.test(input));
|
|
35
9
|
}
|
|
@@ -41,12 +15,7 @@ function looksLikeComplexTask(input) {
|
|
|
41
15
|
/(开发|实现|重构|迁移|优化|修复|完成|完整|复杂|大任务|大的任务|大型任务|大规模|长任务|长期任务|多步骤|检查|审查|按计划|执行计划|继续)/.test(normalized));
|
|
42
16
|
}
|
|
43
17
|
function resolveRuntimeLoopBudget(input, config, harnessState) {
|
|
44
|
-
let budget = {
|
|
45
|
-
...loop_budget_contract_1.DEFAULT_LOOP_BUDGET,
|
|
46
|
-
profile: 'default',
|
|
47
|
-
baseProfile: 'default',
|
|
48
|
-
configOverride: false,
|
|
49
|
-
};
|
|
18
|
+
let budget = { ...loop_budget_contract_1.DEFAULT_LOOP_BUDGET };
|
|
50
19
|
const taskSegments = [
|
|
51
20
|
input,
|
|
52
21
|
harnessState?.rootObjective,
|
|
@@ -58,8 +27,6 @@ function resolveRuntimeLoopBudget(input, config, harnessState) {
|
|
|
58
27
|
if (taskSegments.some(looksLikeReleaseTask)) {
|
|
59
28
|
budget = {
|
|
60
29
|
...budget,
|
|
61
|
-
maxLlmRequestsPerUserTurn: RELEASE_TASK_LLM_BUDGET,
|
|
62
|
-
maxToolCallsPerUserTurn: RELEASE_TASK_TOOL_BUDGET,
|
|
63
30
|
maxModelVisibleToolBytes: RELEASE_TASK_MODEL_VISIBLE_BYTES,
|
|
64
31
|
profile: 'release',
|
|
65
32
|
baseProfile: 'release',
|
|
@@ -68,30 +35,17 @@ function resolveRuntimeLoopBudget(input, config, harnessState) {
|
|
|
68
35
|
else if (taskSegments.some(looksLikeComplexTask)) {
|
|
69
36
|
budget = {
|
|
70
37
|
...budget,
|
|
71
|
-
maxLlmRequestsPerUserTurn: COMPLEX_TASK_LLM_BUDGET,
|
|
72
|
-
maxToolCallsPerUserTurn: COMPLEX_TASK_TOOL_BUDGET,
|
|
73
38
|
maxModelVisibleToolBytes: COMPLEX_TASK_MODEL_VISIBLE_BYTES,
|
|
74
39
|
profile: 'complex',
|
|
75
40
|
baseProfile: 'complex',
|
|
76
41
|
};
|
|
77
42
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
return {
|
|
86
|
-
...budget,
|
|
87
|
-
requestPolicy: 'fixed',
|
|
88
|
-
maxLlmRequestsPerUserTurn: Math.min(budget.maxLlmRequestsPerUserTurn, types_1.GOAL_INVARIANTS.maxAutonomousLlmRequestsPerTurn),
|
|
89
|
-
maxToolCallsPerUserTurn: Math.min(budget.maxToolCallsPerUserTurn, types_1.GOAL_INVARIANTS.maxAutonomousToolCallsPerTurn),
|
|
90
|
-
maxModelVisibleToolBytes: Math.min(budget.maxModelVisibleToolBytes, types_1.GOAL_INVARIANTS.maxAutonomousModelVisibleBytesPerTurn),
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
/** Resolve a continuation from config only; model-authored Goal text must not promote its profile. */
|
|
94
|
-
function resolveAutonomousGoalLoopBudget(config) {
|
|
95
|
-
return capAutonomousGoalLoopBudget(resolveRuntimeLoopBudget('', config));
|
|
43
|
+
const maxModelVisibleToolBytes = config.agentLoop?.budget?.maxModelVisibleToolBytes;
|
|
44
|
+
if (typeof maxModelVisibleToolBytes === 'number' &&
|
|
45
|
+
Number.isSafeInteger(maxModelVisibleToolBytes) &&
|
|
46
|
+
maxModelVisibleToolBytes > 0) {
|
|
47
|
+
return { ...budget, maxModelVisibleToolBytes, profile: 'config', configOverride: true };
|
|
48
|
+
}
|
|
49
|
+
return budget;
|
|
96
50
|
}
|
|
97
51
|
//# sourceMappingURL=loop-budget.js.map
|
|
@@ -4,6 +4,7 @@ exports.OrionRuntimeV1 = exports.OrionRuntimeV1Error = void 0;
|
|
|
4
4
|
exports.createOrionRuntimeV1 = createOrionRuntimeV1;
|
|
5
5
|
const fs_1 = require("fs");
|
|
6
6
|
const path_1 = require("path");
|
|
7
|
+
const paths_1 = require("../product/paths");
|
|
7
8
|
const task_checklist_1 = require("../harness/task-checklist");
|
|
8
9
|
const file_lock_1 = require("../services/file-lock");
|
|
9
10
|
const agent_loop_1 = require("./agent-loop");
|
|
@@ -28,6 +29,7 @@ const task_context_service_1 = require("./task-context-service");
|
|
|
28
29
|
const thread_event_store_1 = require("./thread-event-store");
|
|
29
30
|
const thread_runtime_1 = require("./thread-runtime");
|
|
30
31
|
const thread_tool_journal_1 = require("./thread-tool-journal");
|
|
32
|
+
const workspace_verification_1 = require("./workspace-verification");
|
|
31
33
|
const tool_gateway_1 = require("./tool-gateway");
|
|
32
34
|
const turn_commit_1 = require("./turn-commit");
|
|
33
35
|
class OrionRuntimeV1Error extends Error {
|
|
@@ -319,13 +321,25 @@ class OrionRuntimeV1 {
|
|
|
319
321
|
? startupProjection.turns[startupProjection.activeTurnId]
|
|
320
322
|
: undefined;
|
|
321
323
|
const previousCommit = restoreLatestTurnCommit(eventStore);
|
|
322
|
-
const
|
|
324
|
+
const captureWorkspace = () => (0, workspace_verification_1.captureVerificationWorkspace)(this.options.taskContext.cwd, [
|
|
325
|
+
(0, paths_1.getConfigDir)(),
|
|
326
|
+
this.options.eventStore.rootDir,
|
|
327
|
+
]);
|
|
328
|
+
const taskOptions = {
|
|
329
|
+
...mergeTaskContextOptions(this.options.taskContext, previousCommit),
|
|
330
|
+
captureVerificationWorkspace: captureWorkspace,
|
|
331
|
+
};
|
|
323
332
|
const recovered = (0, task_context_recovery_1.recoverInterruptedTaskContext)({
|
|
324
333
|
store: eventStore,
|
|
325
334
|
previousCommit,
|
|
326
335
|
taskOptions,
|
|
327
336
|
loadImportedHistory: this.options.loadImportedHistory,
|
|
328
|
-
restoreGoalState: () =>
|
|
337
|
+
restoreGoalState: () => {
|
|
338
|
+
if (orphan?.mode === 'goal')
|
|
339
|
+
return (0, goal_runtime_coordinator_1.recoverInterruptedGoalState)(previousCommit);
|
|
340
|
+
const saved = (0, goal_runtime_coordinator_1.readGoalRuntimePersistenceV2)(previousCommit);
|
|
341
|
+
return saved.state ?? saved.tombstone;
|
|
342
|
+
},
|
|
329
343
|
});
|
|
330
344
|
const restored = recovered ?? previousCommit;
|
|
331
345
|
const taskContext = (0, task_context_service_1.createTaskContextService)({
|
|
@@ -366,7 +380,9 @@ class OrionRuntimeV1 {
|
|
|
366
380
|
},
|
|
367
381
|
});
|
|
368
382
|
const todoCatalog = this.options.enableTaskTodos
|
|
369
|
-
? (0, builtin_tool_provider_1.createBuiltinToolCatalogV1)([
|
|
383
|
+
? (0, builtin_tool_provider_1.createBuiltinToolCatalogV1)([
|
|
384
|
+
(0, todo_1.createTodoWriteTool)((todos, blockedReason) => taskContext.updateTaskTodos(todos, blockedReason)),
|
|
385
|
+
], { context: this.options.toolContext })
|
|
370
386
|
: undefined;
|
|
371
387
|
const basePolicy = new first_party_tool_services_1.FirstPartyToolPolicyServiceV1(this.options.toolCatalog, this.options.toolContext);
|
|
372
388
|
const todoPolicy = todoCatalog
|
|
@@ -403,7 +419,7 @@ class OrionRuntimeV1 {
|
|
|
403
419
|
});
|
|
404
420
|
const approval = new first_party_tool_services_1.FirstPartyToolApprovalServiceV1(this.options.approvalHandler);
|
|
405
421
|
const sandbox = new first_party_tool_services_1.FirstPartySandboxServiceV1();
|
|
406
|
-
const execution = new step_snapshot_1.ExecutionService(this.options.workspaceMutationCoordinator);
|
|
422
|
+
const execution = new step_snapshot_1.ExecutionService(this.options.workspaceMutationCoordinator, captureWorkspace);
|
|
407
423
|
const toolJournal = new thread_tool_journal_1.ThreadToolInvocationJournalV1(eventStore);
|
|
408
424
|
const gateway = new tool_gateway_1.ToolGateway({
|
|
409
425
|
policy,
|
|
@@ -540,11 +556,18 @@ class OrionRuntimeV1 {
|
|
|
540
556
|
},
|
|
541
557
|
get remainingGoalTokens() {
|
|
542
558
|
const state = goal.state;
|
|
543
|
-
return
|
|
559
|
+
return activeTurnContext?.mode === 'goal' &&
|
|
560
|
+
state?.status === 'active' &&
|
|
561
|
+
state.budget.maxTokens !== undefined
|
|
544
562
|
? Math.max(0, state.budget.maxTokens - state.tokensUsed)
|
|
545
563
|
: undefined;
|
|
546
564
|
},
|
|
547
|
-
|
|
565
|
+
get goalDeadlineAt() {
|
|
566
|
+
return activeTurnContext?.mode === 'goal'
|
|
567
|
+
? goal.deadlineAt(activeTurnContext.turnId)
|
|
568
|
+
: undefined;
|
|
569
|
+
},
|
|
570
|
+
allowToolPressureCompaction: true,
|
|
548
571
|
onContextUsage: this.options.loop?.onContextUsage,
|
|
549
572
|
compactCoordinator: this.options.loop?.compactCoordinator,
|
|
550
573
|
commitTurn: commit => {
|
|
@@ -574,7 +597,7 @@ class OrionRuntimeV1 {
|
|
|
574
597
|
...(prepared?.plan ? { plan: prepared.plan } : {}),
|
|
575
598
|
});
|
|
576
599
|
return durableCommit;
|
|
577
|
-
});
|
|
600
|
+
}, activeTurnContext?.mode === 'goal');
|
|
578
601
|
if (!durableCommit) {
|
|
579
602
|
throw new OrionRuntimeV1Error('ORION_RUNTIME_INVALID_CONFIGURATION', `Turn ${commit.turnId} completed without an authoritative TurnCommit.`);
|
|
580
603
|
}
|
|
@@ -600,6 +623,11 @@ class OrionRuntimeV1 {
|
|
|
600
623
|
run: async (context) => {
|
|
601
624
|
activeTurnContext = context;
|
|
602
625
|
try {
|
|
626
|
+
const goalId = context.mode === 'goal' ? goal.state?.goalId : undefined;
|
|
627
|
+
if (goalId) {
|
|
628
|
+
restoreGoalTaskCheckpoint(eventStore, taskContext, goalId);
|
|
629
|
+
goal.markTurnStarted(context.turnId, undefined, taskContext.exportState().ledger.map(entry => entry.id));
|
|
630
|
+
}
|
|
603
631
|
return await agentLoop.run(context);
|
|
604
632
|
}
|
|
605
633
|
finally {
|
|
@@ -610,10 +638,6 @@ class OrionRuntimeV1 {
|
|
|
610
638
|
maintenanceRunner: compactRunner,
|
|
611
639
|
projectPath: this.options.projectPath,
|
|
612
640
|
requireTurnCommit: true,
|
|
613
|
-
onTurnStarted: turn => {
|
|
614
|
-
goal.markTurnStarted(turn.turnId, turn.startedAt, taskContext.exportState().ledger.map(entry => entry.id));
|
|
615
|
-
this.options.thread?.onTurnStarted?.(turn);
|
|
616
|
-
},
|
|
617
641
|
onTurnDurablyTerminal: terminal => goal.afterDurableTerminal(terminal.turnId, terminal.terminal) ??
|
|
618
642
|
this.options.thread?.onTurnDurablyTerminal?.(terminal),
|
|
619
643
|
onTurnSettled: async (turnId) => {
|
|
@@ -700,9 +724,11 @@ class OrionRuntimeV1 {
|
|
|
700
724
|
? eventStore.loadProjection().turns[restored.turnId]
|
|
701
725
|
: undefined;
|
|
702
726
|
if (!this.closeRequested &&
|
|
703
|
-
!(orphan
|
|
704
|
-
restoredTurn?.status ===
|
|
705
|
-
|
|
727
|
+
!(orphan?.mode === 'goal' && !orphan.commit) &&
|
|
728
|
+
restoredTurn?.status === restored?.terminal &&
|
|
729
|
+
restoredTurn !== undefined &&
|
|
730
|
+
!thread.getAdmissionSnapshot().activeTurn &&
|
|
731
|
+
thread.getAdmissionSnapshot().queue.length === 0) {
|
|
706
732
|
const continuation = goal.takeRestoredContinuation();
|
|
707
733
|
if (continuation)
|
|
708
734
|
thread.startGoalContinuation(continuation);
|
|
@@ -986,6 +1012,21 @@ function parseTaskContextState(commit) {
|
|
|
986
1012
|
invalidConfiguration('Durable TurnCommit TaskContext is not valid JSON.');
|
|
987
1013
|
}
|
|
988
1014
|
}
|
|
1015
|
+
function restoreGoalTaskCheckpoint(store, taskContext, goalId) {
|
|
1016
|
+
if (taskContext.exportState().goalTaskId === goalId)
|
|
1017
|
+
return;
|
|
1018
|
+
const goalCommits = Object.values(store.loadProjection().turns)
|
|
1019
|
+
.flatMap(turn => (turn.mode === 'goal' && turn.commit ? [turn.commit] : []))
|
|
1020
|
+
.sort((left, right) => right.seq - left.seq);
|
|
1021
|
+
for (const saved of goalCommits) {
|
|
1022
|
+
const commit = (0, turn_commit_1.parseTurnCommitV1)(saved.receipt);
|
|
1023
|
+
const state = parseTaskContextState(commit);
|
|
1024
|
+
if (state.goalTaskId !== goalId)
|
|
1025
|
+
continue;
|
|
1026
|
+
taskContext.restoreGoalCheckpoint(state, commit.taskContextRevision);
|
|
1027
|
+
return;
|
|
1028
|
+
}
|
|
1029
|
+
}
|
|
989
1030
|
async function loadRuntimeBaseMessages(compact, configured) {
|
|
990
1031
|
const authoritative = compact.loadModelVisibleHistory();
|
|
991
1032
|
const configuredMessages = configured ? await configured : undefined;
|
|
@@ -9,13 +9,13 @@ const prompt_context_1 = require("../memory/prompt-context");
|
|
|
9
9
|
const file_context_1 = require("../services/file-context");
|
|
10
10
|
const goal_storage_1 = require("../services/goal-storage");
|
|
11
11
|
const llm_1 = require("../services/llm");
|
|
12
|
+
const redaction_1 = require("../services/redaction");
|
|
12
13
|
const session_storage_1 = require("../services/session-storage");
|
|
13
14
|
const model_registry_1 = require("../services/model-registry");
|
|
14
15
|
const token_estimate_1 = require("../utils/token-estimate");
|
|
15
16
|
const debug_log_1 = require("../utils/debug-log");
|
|
16
17
|
const paths_1 = require("../product/paths");
|
|
17
18
|
const builtin_tool_provider_1 = require("./builtin-tool-provider");
|
|
18
|
-
const goal_runtime_coordinator_1 = require("./goal-runtime-coordinator");
|
|
19
19
|
const loop_budget_1 = require("./loop-budget");
|
|
20
20
|
const legacy_thread_materializer_1 = require("./legacy-thread-materializer");
|
|
21
21
|
const orion_runtime_v1_1 = require("./orion-runtime-v1");
|
|
@@ -89,10 +89,7 @@ function createProductOrionRuntimeV1(options, sessionId, activation) {
|
|
|
89
89
|
...(goalSeed ? { goal: goalSeed } : {}),
|
|
90
90
|
goalPolicy: {
|
|
91
91
|
continuation: options.config.agentLoop?.continuation ?? 'agent',
|
|
92
|
-
defaultBudget:
|
|
93
|
-
...goal_runtime_coordinator_1.DEFAULT_GOAL_RUNTIME_BUDGET_V2,
|
|
94
|
-
...options.config.agentLoop?.goalBudget,
|
|
95
|
-
},
|
|
92
|
+
defaultBudget: options.config.agentLoop?.goalBudget,
|
|
96
93
|
},
|
|
97
94
|
skills: { providers: [...(options.skillProviders ?? [])] },
|
|
98
95
|
mcp: {
|
|
@@ -539,10 +536,9 @@ function loadProductGoalSeed(projectPath, sessionId) {
|
|
|
539
536
|
throw new Error(`Cannot start Goal runtime: ${loaded.message}`);
|
|
540
537
|
}
|
|
541
538
|
const legacy = loaded.value;
|
|
542
|
-
const status = legacy.status === '
|
|
539
|
+
const status = legacy.status === 'complete' ? 'completed' : legacy.status;
|
|
543
540
|
const budget = {
|
|
544
|
-
maxTokens: legacy.tokenBudget
|
|
545
|
-
maxElapsedMs: Number.MAX_SAFE_INTEGER,
|
|
541
|
+
...(legacy.tokenBudget == null ? {} : { maxTokens: legacy.tokenBudget }),
|
|
546
542
|
};
|
|
547
543
|
const content = {
|
|
548
544
|
version: 2,
|
|
@@ -580,8 +576,8 @@ function buildGoalRuntimeContext(state) {
|
|
|
580
576
|
`- Status: ${state.status}`,
|
|
581
577
|
`- Generation: ${state.generation}`,
|
|
582
578
|
`- Continuations: ${state.continuationCount}`,
|
|
583
|
-
`- Tokens: ${state.tokensUsed}/${state.budget.maxTokens}`,
|
|
584
|
-
`- Elapsed ms: ${state.elapsedMs}/${state.budget.maxElapsedMs}`,
|
|
579
|
+
`- Tokens: ${state.tokensUsed}/${state.budget.maxTokens ?? 'unlimited'}`,
|
|
580
|
+
`- Elapsed ms: ${state.elapsedMs}/${state.budget.maxElapsedMs ?? 'unlimited'}`,
|
|
585
581
|
state.status === 'active'
|
|
586
582
|
? '- Continue autonomously; only TaskContext may verify completion.'
|
|
587
583
|
: '- Do not autonomously continue this Goal unless the user explicitly resumes it.',
|
|
@@ -593,7 +589,7 @@ async function buildProductMessages(options, sessionId, eventStore, prompts, com
|
|
|
593
589
|
const history = durable ?? legacyHistory(sessionId);
|
|
594
590
|
const withoutOldSystem = history.filter(message => message.role !== 'system');
|
|
595
591
|
const snapshot = options.store.getSnapshot();
|
|
596
|
-
const goalContent = buildGoalRuntimeContext(composition.goal.state);
|
|
592
|
+
const goalContent = mode === 'goal' ? buildGoalRuntimeContext(composition.goal.state) : undefined;
|
|
597
593
|
const review = projection.planReview;
|
|
598
594
|
const planReceipt = mode !== 'plan' && review?.status === 'approved'
|
|
599
595
|
? (0, plan_review_1.findPlanReceiptForReviewV1)(projection, review)
|
|
@@ -1110,7 +1106,7 @@ async function resolveMcpToolsForStep(input, runtime, catalog) {
|
|
|
1110
1106
|
execute: async (args, context) => {
|
|
1111
1107
|
try {
|
|
1112
1108
|
const result = await binding.invoke(args, context.abortSignal);
|
|
1113
|
-
return
|
|
1109
|
+
return projectMcpResult(result);
|
|
1114
1110
|
}
|
|
1115
1111
|
catch (error) {
|
|
1116
1112
|
const message = error instanceof Error ? error.message : String(error);
|
|
@@ -1156,11 +1152,32 @@ function normalizeLookup(value) {
|
|
|
1156
1152
|
.replace(/[^\p{L}\p{N}]+/gu, ' ')
|
|
1157
1153
|
.trim();
|
|
1158
1154
|
}
|
|
1155
|
+
function projectMcpResult(value) {
|
|
1156
|
+
const output = renderMcpResult(value);
|
|
1157
|
+
if (!value || typeof value !== 'object' || !('isError' in value) || value.isError !== true) {
|
|
1158
|
+
return { success: true, output };
|
|
1159
|
+
}
|
|
1160
|
+
const content = 'content' in value && Array.isArray(value.content) ? value.content : [];
|
|
1161
|
+
const diagnostic = content.find((item) => !!item &&
|
|
1162
|
+
typeof item === 'object' &&
|
|
1163
|
+
'type' in item &&
|
|
1164
|
+
item.type === 'text' &&
|
|
1165
|
+
'text' in item &&
|
|
1166
|
+
typeof item.text === 'string' &&
|
|
1167
|
+
!!item.text.trim());
|
|
1168
|
+
return {
|
|
1169
|
+
success: false,
|
|
1170
|
+
output,
|
|
1171
|
+
error: diagnostic
|
|
1172
|
+
? (0, redaction_1.redactTraceText)(diagnostic.text.trim()).slice(0, 2048)
|
|
1173
|
+
: 'MCP tool reported an error.',
|
|
1174
|
+
};
|
|
1175
|
+
}
|
|
1159
1176
|
function renderMcpResult(value) {
|
|
1160
1177
|
if (typeof value === 'string')
|
|
1161
1178
|
return value;
|
|
1162
1179
|
try {
|
|
1163
|
-
return JSON.stringify(value);
|
|
1180
|
+
return JSON.stringify(value) ?? String(value);
|
|
1164
1181
|
}
|
|
1165
1182
|
catch {
|
|
1166
1183
|
return String(value);
|
|
@@ -98,13 +98,7 @@ async function runArm(task, suite, input, signal) {
|
|
|
98
98
|
],
|
|
99
99
|
defaultModel: 'rsi-evaluation',
|
|
100
100
|
subagents: { mode: 'off' },
|
|
101
|
-
agentLoop: {
|
|
102
|
-
continuation: 'manual',
|
|
103
|
-
budget: {
|
|
104
|
-
maxLlmRequestsPerUserTurn: suite.maxRequests,
|
|
105
|
-
maxToolCallsPerUserTurn: suite.maxTools,
|
|
106
|
-
},
|
|
107
|
-
},
|
|
101
|
+
agentLoop: { continuation: 'manual' },
|
|
108
102
|
}));
|
|
109
103
|
const inputPath = (0, path_1.join)(sandbox, 'input.json');
|
|
110
104
|
const outputPath = (0, path_1.join)(sandbox, 'arm.json');
|
|
@@ -155,11 +155,13 @@ export interface BoundToolExecutionResultV1 {
|
|
|
155
155
|
readonly terminal: 'completed' | 'failed' | 'interrupted' | 'indeterminate';
|
|
156
156
|
readonly result: ToolResult;
|
|
157
157
|
readonly durationMs: number;
|
|
158
|
+
readonly verificationWorkspace?: string | null;
|
|
158
159
|
}
|
|
159
160
|
/** The only runtime primitive allowed to call a frozen concrete tool executor. */
|
|
160
161
|
export declare class ExecutionService {
|
|
161
162
|
private readonly workspaceMutations?;
|
|
162
|
-
|
|
163
|
+
private readonly captureVerificationWorkspace?;
|
|
164
|
+
constructor(workspaceMutations?: WorkspaceMutationCoordinatorV1 | undefined, captureVerificationWorkspace?: (() => string | null) | undefined);
|
|
163
165
|
run(request: BoundToolExecutionRequestV1): Promise<BoundToolExecutionResultV1>;
|
|
164
166
|
}
|
|
165
167
|
export interface StepSnapshotV1 {
|
|
@@ -5,6 +5,7 @@ exports.captureStepSnapshotV1 = captureStepSnapshotV1;
|
|
|
5
5
|
exports.createCapabilityPlanV1 = createCapabilityPlanV1;
|
|
6
6
|
exports.createAuthoritySnapshotV1 = createAuthoritySnapshotV1;
|
|
7
7
|
exports.createExecutionPolicySnapshotV1 = createExecutionPolicySnapshotV1;
|
|
8
|
+
const verification_command_1 = require("../framework/verification-command");
|
|
8
9
|
const tool_artifacts_1 = require("../core/tool-artifacts");
|
|
9
10
|
const canonical_1 = require("./protocol/canonical");
|
|
10
11
|
const runtime_protocol_v1_1 = require("./protocol/runtime-protocol-v1");
|
|
@@ -105,8 +106,9 @@ class ToolRouterSnapshotV1 {
|
|
|
105
106
|
exports.ToolRouterSnapshotV1 = ToolRouterSnapshotV1;
|
|
106
107
|
/** The only runtime primitive allowed to call a frozen concrete tool executor. */
|
|
107
108
|
class ExecutionService {
|
|
108
|
-
constructor(workspaceMutations) {
|
|
109
|
+
constructor(workspaceMutations, captureVerificationWorkspace) {
|
|
109
110
|
this.workspaceMutations = workspaceMutations;
|
|
111
|
+
this.captureVerificationWorkspace = captureVerificationWorkspace;
|
|
110
112
|
}
|
|
111
113
|
async run(request) {
|
|
112
114
|
const startedAt = Date.now();
|
|
@@ -147,6 +149,13 @@ class ExecutionService {
|
|
|
147
149
|
}, execute)
|
|
148
150
|
: await execute();
|
|
149
151
|
const presented = persistLargeToolOutput(request.context.cwd, request.toolName, result);
|
|
152
|
+
// Capture the completed check's actual workspace, after any
|
|
153
|
+
// test-generated files have been written and before committing its receipt.
|
|
154
|
+
const verificationWorkspace = descriptor?.executorId === 'builtin:exec_command:v1' &&
|
|
155
|
+
typeof request.args.command === 'string' &&
|
|
156
|
+
(0, verification_command_1.classifyDirectVerificationCommand)(request.args.command)
|
|
157
|
+
? this.captureVerificationWorkspace?.()
|
|
158
|
+
: undefined;
|
|
150
159
|
return {
|
|
151
160
|
terminal: timeoutController.signal.aborted
|
|
152
161
|
? 'interrupted'
|
|
@@ -155,6 +164,7 @@ class ExecutionService {
|
|
|
155
164
|
: 'failed',
|
|
156
165
|
result: presented,
|
|
157
166
|
durationMs: Date.now() - startedAt,
|
|
167
|
+
...(verificationWorkspace !== undefined ? { verificationWorkspace } : {}),
|
|
158
168
|
};
|
|
159
169
|
}
|
|
160
170
|
catch (error) {
|
|
@@ -286,16 +286,19 @@ class SubagentThreadRuntimeV1 {
|
|
|
286
286
|
}
|
|
287
287
|
const projection = store.loadProjection();
|
|
288
288
|
const turn = projection.turns[admission.turnId];
|
|
289
|
-
if (budget.failure)
|
|
290
|
-
throw budget.failure;
|
|
291
289
|
if (!turn || turn.status === 'active' || !turn.commit) {
|
|
290
|
+
if (budget.failure)
|
|
291
|
+
throw budget.failure;
|
|
292
292
|
throw new SubagentThreadRuntimeError('ORION_SUBAGENT_CHILD_COMMIT_MISSING', 'Child AgentLoop did not durably publish a terminal TurnCommitV1.');
|
|
293
293
|
}
|
|
294
294
|
const childCommit = (0, turn_commit_1.parseTurnCommitV1)(turn.commit.receipt);
|
|
295
295
|
assertIndependentStepSnapshots(parent.stepSnapshotDigest, childCommit, turn.status);
|
|
296
296
|
const usage = budget.snapshot();
|
|
297
|
-
const
|
|
298
|
-
const
|
|
297
|
+
const budgetFailure = turn.status === 'interrupted' ? undefined : budget.failure;
|
|
298
|
+
const stopDecision = childStopDecision(childCommit, turn.status, usage, budget.limits, parent, budgetFailure);
|
|
299
|
+
const summary = budgetFailure
|
|
300
|
+
? truncateUtf8(budgetFailure.message, this.options.maxSummaryBytes)
|
|
301
|
+
: boundedChildSummary(projection, admission.turnId, childCommit, this.options.maxSummaryBytes);
|
|
299
302
|
const evidenceItems = boundedEvidence(evidence.snapshot(), childCommit, this.options.maxEvidenceItems, this.options.maxEvidenceBytes);
|
|
300
303
|
const receipt = createSubagentThreadReceiptV1({
|
|
301
304
|
receiptId: (0, runtime_protocol_v1_1.createRuntimeId)(),
|
|
@@ -695,7 +698,7 @@ function assertIndependentStepSnapshots(parentStepSnapshotDigest, child, termina
|
|
|
695
698
|
throw new SubagentThreadRuntimeError('ORION_SUBAGENT_CHILD_SNAPSHOT_INVALID', 'Child StepSnapshotV1 aliases a parent snapshot digest.');
|
|
696
699
|
}
|
|
697
700
|
}
|
|
698
|
-
function childStopDecision(commit, terminal, usage, limits, parent) {
|
|
701
|
+
function childStopDecision(commit, terminal, usage, limits, parent, budgetFailure) {
|
|
699
702
|
const parsed = parseStopDecision(commit);
|
|
700
703
|
const status = terminal === 'interrupted' ? 'cancelled' : terminal === 'failed' ? 'failed' : 'completed';
|
|
701
704
|
const base = parsed ??
|
|
@@ -718,8 +721,27 @@ function childStopDecision(commit, terminal, usage, limits, parent) {
|
|
|
718
721
|
return (0, stop_decision_1.createStopDecision)({
|
|
719
722
|
...base,
|
|
720
723
|
scope: 'subagent',
|
|
724
|
+
...(budgetFailure
|
|
725
|
+
? {
|
|
726
|
+
status: 'stopped',
|
|
727
|
+
disposition: 'resume_allowed',
|
|
728
|
+
reason: { code: 'subagent_budget_exceeded', message: budgetFailure.message },
|
|
729
|
+
nextActions: [
|
|
730
|
+
{ kind: 'retry', label: 'Inspect the child budget before retrying.' },
|
|
731
|
+
],
|
|
732
|
+
}
|
|
733
|
+
: {}),
|
|
721
734
|
evidence: [
|
|
722
735
|
...base.evidence,
|
|
736
|
+
...(budgetFailure
|
|
737
|
+
? [
|
|
738
|
+
{
|
|
739
|
+
kind: 'resource_limit',
|
|
740
|
+
source: 'subagent-lease',
|
|
741
|
+
detail: budgetFailure.message,
|
|
742
|
+
},
|
|
743
|
+
]
|
|
744
|
+
: []),
|
|
723
745
|
{
|
|
724
746
|
kind: 'runtime',
|
|
725
747
|
source: 'subagent-thread-runtime',
|
|
@@ -281,10 +281,6 @@ class ProductionSubagentRuntimeV1 {
|
|
|
281
281
|
gateway,
|
|
282
282
|
loadBaseMessages: () => baseMessages.map(message => ({ ...message })),
|
|
283
283
|
toolContext: () => context,
|
|
284
|
-
loopBudget: {
|
|
285
|
-
maxLlmRequestsPerUserTurn: input.budget.limits.maxModelRequests,
|
|
286
|
-
maxToolCallsPerUserTurn: input.budget.limits.maxToolCalls,
|
|
287
|
-
},
|
|
288
284
|
commitTurn: commit => commitAgentLoopTurn(turnCommits, commit),
|
|
289
285
|
});
|
|
290
286
|
return new CommitCompletingChildRunnerV1(agentLoop, input, taskContext, turnCommits, baseMessages);
|
|
@@ -87,17 +87,20 @@ function projectTaskToolEvidence(receipt, args, cwd) {
|
|
|
87
87
|
toolReceiptDigest: receipt.digest,
|
|
88
88
|
command,
|
|
89
89
|
cwd: (0, path_1.resolve)(cwd, typeof args.cwd === 'string' ? (0, common_1.normalizeToolPath)(args.cwd) : '.'),
|
|
90
|
-
passed: receipt.success,
|
|
90
|
+
passed: receipt.success && receipt.verificationWorkspace !== null,
|
|
91
91
|
}
|
|
92
92
|
: undefined;
|
|
93
93
|
return { changedFile, verification };
|
|
94
94
|
}
|
|
95
95
|
function recordTaskTodoToolReceipt(taskContext, todo, receipt, { changedFile, verification }) {
|
|
96
|
+
if (verification && receipt.verificationWorkspace !== undefined) {
|
|
97
|
+
taskContext.observeVerificationWorkspace(receipt.verificationWorkspace);
|
|
98
|
+
}
|
|
96
99
|
if (!todo || receipt.terminalPhase !== 'execute' || (!receipt.success && !verification))
|
|
97
100
|
return;
|
|
98
101
|
taskContext.recordTaskTodoReceipt(todo, {
|
|
99
102
|
digest: receipt.digest,
|
|
100
|
-
passed: receipt.success,
|
|
103
|
+
passed: verification?.passed ?? receipt.success,
|
|
101
104
|
kind: (0, verification_command_1.isLocalVerificationKind)(verification?.kind) ? verification.kind : undefined,
|
|
102
105
|
changedFile,
|
|
103
106
|
command: verification?.command,
|
|
@@ -139,10 +142,8 @@ function recoverInterruptedTaskContext(input) {
|
|
|
139
142
|
}
|
|
140
143
|
}
|
|
141
144
|
const goalState = restoreGoalState();
|
|
142
|
-
const
|
|
143
|
-
|
|
144
|
-
'status' in goalState &&
|
|
145
|
-
goalState.status === 'paused' &&
|
|
145
|
+
const interruptedGoal = turn.mode === 'goal' && goalState && 'status' in goalState ? goalState : undefined;
|
|
146
|
+
const goalInterruptedBeforeTools = interruptedGoal?.status === 'paused' &&
|
|
146
147
|
turn.itemIds.every(itemId => projection.items[itemId].kind !== 'command');
|
|
147
148
|
// A Goal can crash on its first provider request, before a task seed is
|
|
148
149
|
// bound to any tool. Persist its pause or a later reopen will see only the
|
|
@@ -171,10 +172,17 @@ function recoverInterruptedTaskContext(input) {
|
|
|
171
172
|
state: seed.state,
|
|
172
173
|
revision: seed.revision,
|
|
173
174
|
requireLocalVerificationReceipt: true,
|
|
175
|
+
captureVerificationWorkspace: undefined,
|
|
174
176
|
});
|
|
175
177
|
let unconfirmedWorkspaceRevisions = 0;
|
|
176
178
|
for (const event of events) {
|
|
177
|
-
if (
|
|
179
|
+
if (event.seq < checkpoint.event.seq)
|
|
180
|
+
continue;
|
|
181
|
+
if (interruptedGoal && event.payload.type === 'turn.steered') {
|
|
182
|
+
taskContext.observeGoalSteering(event.payload.data.input, interruptedGoal.goalId);
|
|
183
|
+
continue;
|
|
184
|
+
}
|
|
185
|
+
if (!event.itemId)
|
|
178
186
|
continue;
|
|
179
187
|
const bound = intents.get(event.itemId);
|
|
180
188
|
if (!bound ||
|
|
@@ -196,10 +204,25 @@ function recoverInterruptedTaskContext(input) {
|
|
|
196
204
|
unconfirmedWorkspaceRevisions++;
|
|
197
205
|
}
|
|
198
206
|
}
|
|
207
|
+
if (taskOptions.captureVerificationWorkspace) {
|
|
208
|
+
taskContext.refreshVerificationWorkspace(taskOptions.captureVerificationWorkspace);
|
|
209
|
+
}
|
|
199
210
|
taskContext.recordProgress(seed.progressAtAdmission, unconfirmedWorkspaceRevisions);
|
|
200
211
|
taskContextState = taskContext.exportState();
|
|
201
212
|
taskContextRevision = taskContext.revision;
|
|
202
213
|
}
|
|
214
|
+
else if (interruptedGoal && events.some(event => event.payload.type === 'turn.steered')) {
|
|
215
|
+
// A user correction is durable independently of the first tool in a turn.
|
|
216
|
+
const taskContext = (0, task_context_service_1.createTaskContextService)(taskOptions);
|
|
217
|
+
taskContext.observeUserInput(interruptedGoal.objective, interruptedGoal.goalId);
|
|
218
|
+
for (const event of events) {
|
|
219
|
+
if (event.payload.type === 'turn.steered') {
|
|
220
|
+
taskContext.observeGoalSteering(event.payload.data.input, interruptedGoal.goalId);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
taskContextState = taskContext.exportState();
|
|
224
|
+
taskContextRevision = taskContext.revision;
|
|
225
|
+
}
|
|
203
226
|
if (!taskContextState || taskContextRevision === undefined)
|
|
204
227
|
return;
|
|
205
228
|
const openItems = turn.itemIds
|
|
@@ -3,6 +3,7 @@ import type { PromptAssemblyOptions } from '../harness/assembler';
|
|
|
3
3
|
import type { CreateTurnSummaryInput } from '../harness/turn-summary';
|
|
4
4
|
import type { CapabilityProfileInput, CompletionGateResult, ContextCapsule, DriftCheckResult, HarnessConfig, HarnessProgressState, HarnessState, IntentUpdate, TaskContract, TaskTodoObservation, TaskWorkspaceAction, ToolResultObservation, TurnSummary } from '../harness/types';
|
|
5
5
|
import type { LLMResponse, Message } from '../services/llm';
|
|
6
|
+
import type { TodoWriteAdjustment } from '../framework/tool-state';
|
|
6
7
|
export type DeepReadonly<T> = T extends (...args: never[]) => unknown ? T : T extends readonly (infer U)[] ? readonly DeepReadonly<U>[] : T extends object ? {
|
|
7
8
|
readonly [K in keyof T]: DeepReadonly<T[K]>;
|
|
8
9
|
} : T;
|
|
@@ -13,6 +14,7 @@ export interface TaskContextServiceOptions {
|
|
|
13
14
|
readonly config?: HarnessConfig;
|
|
14
15
|
readonly revision?: number;
|
|
15
16
|
readonly requireLocalVerificationReceipt?: boolean;
|
|
17
|
+
readonly captureVerificationWorkspace?: () => string | null;
|
|
16
18
|
}
|
|
17
19
|
export interface TaskContextToolInput {
|
|
18
20
|
readonly name: string;
|
|
@@ -62,6 +64,7 @@ export interface TaskContextService {
|
|
|
62
64
|
readonly serviceId: 'task-context';
|
|
63
65
|
readonly revision: number;
|
|
64
66
|
observeUserInput(input: string, goalTaskId?: string): DeepReadonly<IntentUpdate> | undefined;
|
|
67
|
+
observeGoalSteering(input: string, goalId: string): void;
|
|
65
68
|
classifyIntent(input: string): DeepReadonly<IntentUpdate>;
|
|
66
69
|
observeCapability(input: CapabilityProfileInput): DeepReadonly<HarnessState['capabilityProfile']>;
|
|
67
70
|
assembleMessages(messages: Message[], options?: PromptAssemblyOptions): Message[];
|
|
@@ -69,6 +72,8 @@ export interface TaskContextService {
|
|
|
69
72
|
observeAppliedSkills(skills: TaskContextAppliedSkill[]): void;
|
|
70
73
|
checkToolUse(input: TaskContextToolInput): DeepReadonly<DriftCheckResult>;
|
|
71
74
|
observeToolResult(input: TaskContextToolResultInput): void;
|
|
75
|
+
observeVerificationWorkspace(fingerprint: string | null): void;
|
|
76
|
+
refreshVerificationWorkspace(capture?: () => string | null): void;
|
|
72
77
|
noteIndeterminateWorkspaceChange(): void;
|
|
73
78
|
observeTurn(input: TaskContextTurnInput): DeepReadonly<TurnSummary> | undefined;
|
|
74
79
|
activeTaskTodo(): string | undefined;
|
|
@@ -77,7 +82,7 @@ export interface TaskContextService {
|
|
|
77
82
|
prepareTaskPlanStopCheck(): ReturnType<HarnessKernel['prepareTaskPlanStopCheck']>;
|
|
78
83
|
requiresVerification(): boolean;
|
|
79
84
|
recordTaskTodoReceipt(step: string, observation: TaskTodoObservation): void;
|
|
80
|
-
updateTaskTodos(todos: NonNullable<HarnessState['taskTodos']
|
|
85
|
+
updateTaskTodos(todos: NonNullable<HarnessState['taskTodos']>, blockedReason?: string): TodoWriteAdjustment | string | undefined;
|
|
81
86
|
progressState(): HarnessProgressState;
|
|
82
87
|
recordProgress(baseline: HarnessProgressState, unconfirmedWorkspaceRevisions?: number): void;
|
|
83
88
|
auditCompletion(enforceTaskTodos?: boolean, requireEveryCriterion?: boolean): TaskContextCompletionDecisionV1;
|
|
@@ -90,6 +95,7 @@ export interface TaskContextService {
|
|
|
90
95
|
getCapsule(): DeepReadonly<ContextCapsule> | undefined;
|
|
91
96
|
explain(): TaskContextExplanation;
|
|
92
97
|
snapshot(): DeepReadonly<TaskContextSnapshotV1>;
|
|
98
|
+
restoreGoalCheckpoint(state: HarnessState, revision: number): void;
|
|
93
99
|
/** Mutable clone intended for the future atomic TurnCommit owner. */
|
|
94
100
|
exportState(): HarnessState;
|
|
95
101
|
}
|