@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
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LoopProgress =
|
|
3
|
+
exports.LoopProgress = void 0;
|
|
4
4
|
const path_1 = require("path");
|
|
5
5
|
const canonical_1 = require("../runtime/protocol/canonical");
|
|
6
6
|
const verification_command_1 = require("./verification-command");
|
|
7
|
-
exports.ADAPTIVE_CHECKPOINT_REQUESTS = 8;
|
|
8
7
|
const DIRECT_REPOSITORY_READ = /^(?:(?:rg|grep|cat|head|tail|ls)|git\s+(?:grep|show|log|status|diff|ls-files))(?=\s|$)/u;
|
|
9
8
|
// Credit bounded line printing, without interpreting arbitrary sed programs as reads.
|
|
10
9
|
const SED_LINE_PRINT = /^sed\s+-n\s+(?:-e\s+)?(['"]?)\d+(?:,\d+)?p\1\s+(?:--\s+)?(?:'[^'-][^']*'|"[^"-][^"]*"|[^-\s'"<>][^\s'"<>]*)$/u;
|
|
11
10
|
const READ_TRUNCATION_NOTE = /\n\n\[\.\.\. truncated(?:, \d+ more lines; showing lines \d+-\d+ of \d+| at \d+B(?: of \d+B)?)\]$/u;
|
|
12
|
-
/**
|
|
11
|
+
/** Distinct evidence observations for diagnostics. They do not govern sampling or tool execution. */
|
|
13
12
|
class LoopProgress {
|
|
14
13
|
constructor(cwd) {
|
|
15
14
|
this.cwd = cwd;
|
|
16
15
|
this.seen = new Set();
|
|
17
|
-
this.lastProgress = 0;
|
|
18
16
|
}
|
|
19
|
-
|
|
17
|
+
get observations() {
|
|
18
|
+
return this.seen.size;
|
|
19
|
+
}
|
|
20
|
+
observe(observation) {
|
|
20
21
|
const { name, args, output, fileEdit, assertion } = observation;
|
|
21
22
|
if (name === 'todo_write')
|
|
22
23
|
return;
|
|
@@ -55,24 +56,7 @@ class LoopProgress {
|
|
|
55
56
|
name === 'git_diff'
|
|
56
57
|
? [name, observed]
|
|
57
58
|
: [name, args];
|
|
58
|
-
|
|
59
|
-
if (this.seen.has(digest))
|
|
60
|
-
return;
|
|
61
|
-
this.seen.add(digest);
|
|
62
|
-
this.lastProgress = requests;
|
|
63
|
-
this.recoveryAt = undefined;
|
|
64
|
-
}
|
|
65
|
-
checkpoint(requests) {
|
|
66
|
-
if (requests - this.lastProgress < exports.ADAPTIVE_CHECKPOINT_REQUESTS)
|
|
67
|
-
return 'working';
|
|
68
|
-
if (this.recoveryAt !== undefined) {
|
|
69
|
-
return requests - this.recoveryAt < exports.ADAPTIVE_CHECKPOINT_REQUESTS ? 'working' : 'stop';
|
|
70
|
-
}
|
|
71
|
-
this.recoveryAt = requests;
|
|
72
|
-
return 'recover';
|
|
73
|
-
}
|
|
74
|
-
recentlyAdvanced(requests) {
|
|
75
|
-
return this.lastProgress > 0 && requests - this.lastProgress < exports.ADAPTIVE_CHECKPOINT_REQUESTS;
|
|
59
|
+
this.seen.add((0, canonical_1.digestRuntimeValue)(identity));
|
|
76
60
|
}
|
|
77
61
|
}
|
|
78
62
|
exports.LoopProgress = LoopProgress;
|
|
@@ -12,7 +12,7 @@ import type { LLMRequestDiagnostics, LLMService, Message, StreamCallbacks } from
|
|
|
12
12
|
import type { ProviderErrorType } from '../services/provider-diagnostics';
|
|
13
13
|
import type { OrionCodeTool, ToolContext } from './tool';
|
|
14
14
|
import type { CostTracker } from '../core/cost-tracker';
|
|
15
|
-
import {
|
|
15
|
+
import type { StrategyTracker } from '../core/strategy-tracker';
|
|
16
16
|
import { type CompactPauseFailure } from '../services/compact/auto-compact';
|
|
17
17
|
import type { CompactResult } from '../services/compact/compact';
|
|
18
18
|
import type { CompactCoordinator } from '../services/compact/coordinator';
|
|
@@ -23,7 +23,7 @@ import { type AuthoritativeToolExecutor, type ToolPermissionDecision } from './t
|
|
|
23
23
|
import { type ContextUsageSnapshot } from '../services/model-context';
|
|
24
24
|
import type { ToolExternalAssertion } from './external-assertion';
|
|
25
25
|
import { type StopDecision } from './stop-decision';
|
|
26
|
-
import { type LoopBudget, type LoopBudgetBaseProfile, type LoopBudgetSource
|
|
26
|
+
import { type LoopBudget, type LoopBudgetBaseProfile, type LoopBudgetSource } from './loop-budget-contract';
|
|
27
27
|
export { DEFAULT_LOOP_BUDGET } from './loop-budget-contract';
|
|
28
28
|
export type { LoopBudget, LoopBudgetBaseProfile, LoopBudgetSource } from './loop-budget-contract';
|
|
29
29
|
export declare const DEFAULT_MAX_MODEL_VISIBLE_TOOL_RESULT_BYTES = 4096;
|
|
@@ -31,6 +31,7 @@ export declare const DEFAULT_MAX_MODEL_VISIBLE_TOOL_RESULT_BYTES = 4096;
|
|
|
31
31
|
export declare const MIN_MODEL_VISIBLE_TOOL_RESULT_BYTES = 2048;
|
|
32
32
|
export type LoopFinishReason = 'completed' | 'cancelled' | 'failed' | 'blocked' | 'completion_gate' | 'budget_exceeded' | 'compact_paused' | 'running';
|
|
33
33
|
export type LoopContinuationAction = 'reply_continue' | 'narrow_instruction' | 'inspect_loop_stats' | 'raise_budget';
|
|
34
|
+
type RequestResourceStopCode = 'goal_token_budget' | 'goal_time_budget' | 'provider_preflight_budget';
|
|
34
35
|
export interface LoopStats {
|
|
35
36
|
turnsStarted: number;
|
|
36
37
|
llmRequests: number;
|
|
@@ -47,22 +48,16 @@ export interface LoopStats {
|
|
|
47
48
|
/** Structured compact failure when the request pauses to protect context integrity. */
|
|
48
49
|
compactFailure?: CompactPauseFailure;
|
|
49
50
|
budgetExceededReason?: string;
|
|
50
|
-
|
|
51
|
+
budgetStopCode?: RequestResourceStopCode;
|
|
52
|
+
toolProgressObservations?: number;
|
|
51
53
|
budgetCompaction?: 'compacted' | 'disabled' | 'unavailable';
|
|
52
|
-
budgetCompactPending?: true;
|
|
53
|
-
loopBudgetBaseLlmRequests?: number;
|
|
54
54
|
missingAssistantOutput?: 'empty_output' | 'no_visible_output';
|
|
55
55
|
providerStop?: {
|
|
56
56
|
code: string;
|
|
57
57
|
message: string;
|
|
58
58
|
};
|
|
59
59
|
loopBudgetSource?: LoopBudgetSource;
|
|
60
|
-
loopBudgetRequestPolicy?: RequestBudgetPolicy;
|
|
61
|
-
adaptiveStop?: 'no_progress_after_recovery' | 'request_safety_limit';
|
|
62
60
|
loopBudgetBaseProfile?: LoopBudgetBaseProfile;
|
|
63
|
-
loopBudgetMaxLlmRequests?: number;
|
|
64
|
-
loopBudgetMaxToolCalls?: number;
|
|
65
|
-
loopBudgetMaxReadOnlyFragmentation?: number;
|
|
66
61
|
loopBudgetMaxModelVisibleBytes?: number;
|
|
67
62
|
loopBudgetConfigOverride?: boolean;
|
|
68
63
|
providerRetryCount?: number;
|
|
@@ -93,8 +88,6 @@ export interface LoopStats {
|
|
|
93
88
|
verificationFailedCommands?: string[];
|
|
94
89
|
verificationMissingCommands?: string[];
|
|
95
90
|
verificationSkippedReason?: string;
|
|
96
|
-
singleReadOnlyStreak: number;
|
|
97
|
-
batchReadSuggestionCount: number;
|
|
98
91
|
localFastPathUsed: boolean;
|
|
99
92
|
}
|
|
100
93
|
export declare class QueryLoopError extends Error {
|
|
@@ -120,10 +113,6 @@ export type QueryEvent = {
|
|
|
120
113
|
type: 'request_start';
|
|
121
114
|
model: string;
|
|
122
115
|
turn: number;
|
|
123
|
-
} | {
|
|
124
|
-
type: 'budget_recovery';
|
|
125
|
-
additionalRequests: number;
|
|
126
|
-
reason: 'progress' | 'recovery';
|
|
127
116
|
} | {
|
|
128
117
|
type: 'prompt_assembly';
|
|
129
118
|
modelId: string;
|
|
@@ -181,9 +170,6 @@ export type QueryEvent = {
|
|
|
181
170
|
outputBytes?: number;
|
|
182
171
|
batchCount?: number;
|
|
183
172
|
batchIndex?: number;
|
|
184
|
-
} | {
|
|
185
|
-
type: 'strategy_exhausted';
|
|
186
|
-
suggestion: string;
|
|
187
173
|
} | {
|
|
188
174
|
type: 'message';
|
|
189
175
|
role: 'assistant';
|
|
@@ -236,8 +222,6 @@ export interface QueryParams {
|
|
|
236
222
|
resolveStep?: (input: QueryStepResolveInput) => QueryStepRuntime | Promise<QueryStepRuntime>;
|
|
237
223
|
/** LLM service instance */
|
|
238
224
|
llm: LLMService;
|
|
239
|
-
/** @deprecated Use loopBudget.maxLlmRequestsPerUserTurn. This alias is resource-only. */
|
|
240
|
-
maxTurns?: number;
|
|
241
225
|
/** Abort signal for cancellation */
|
|
242
226
|
abortSignal?: AbortSignal;
|
|
243
227
|
/** Streaming callbacks (onChunk writes to stdout, etc.) */
|
|
@@ -260,12 +244,16 @@ export interface QueryParams {
|
|
|
260
244
|
maxParallelToolCalls?: number;
|
|
261
245
|
/** Maximum bytes of one tool result to expose to the next model request. */
|
|
262
246
|
maxModelVisibleToolResultBytes?: number;
|
|
263
|
-
/**
|
|
247
|
+
/** Shared tool-output compression allowance for this turn. */
|
|
264
248
|
loopBudget?: Partial<LoopBudget>;
|
|
265
249
|
/** Remaining reported tokens for an active Goal at turn admission. */
|
|
266
250
|
remainingGoalTokens?: number;
|
|
267
|
-
/**
|
|
268
|
-
|
|
251
|
+
/** Absolute deadline for the remaining elapsed Goal budget. */
|
|
252
|
+
goalDeadlineAt?: number;
|
|
253
|
+
/** Permit proactive compaction when tool results approach their visibility allowance. */
|
|
254
|
+
allowToolPressureCompaction?: boolean;
|
|
255
|
+
/** Take durably admitted user input. Seal steering when requested and the inbox is empty. */
|
|
256
|
+
takePendingSteering?: (closeIfEmpty?: boolean) => readonly string[];
|
|
269
257
|
/** Runtime observer for current context pressure. Renderers consume Store state instead. */
|
|
270
258
|
onContextUsage?: (usage: ContextUsageSnapshot) => void;
|
|
271
259
|
/** Runtime observer for autonomous core compaction. */
|