@orion-agents/orion-code 0.3.4 → 0.3.9
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 +157 -0
- package/README.md +59 -5
- package/README.zh-CN.md +6 -3
- package/dist/cli.js +58 -32
- package/dist/commands/context-tool-command-handlers.js +1 -5
- package/dist/commands/registry.js +1 -4
- package/dist/harness/intent.js +69 -16
- package/dist/harness/turn-summary.js +3 -1
- package/dist/memory/embeddings.js +2 -3
- package/dist/memory/prompts.js +1 -1
- package/dist/memory/relevant-finder.js +125 -15
- package/dist/memory/vector-store.js +13 -8
- package/dist/migration/migrate.js +8 -12
- package/dist/runtime/composer/history.js +1 -3
- package/dist/runtime/composer/layout.js +7 -4
- package/dist/runtime/legacy-thread-materializer.d.ts +3 -1
- package/dist/runtime/legacy-thread-materializer.js +15 -3
- package/dist/runtime/product-bootstrap.d.ts +12 -0
- package/dist/runtime/product-bootstrap.js +37 -22
- package/dist/runtime/rich-text/ansi-parser.js +12 -2
- package/dist/runtime/rich-text/layout.js +15 -19
- package/dist/runtime/subagents/budget.js +4 -1
- package/dist/runtime/subagents/policy.js +11 -4
- package/dist/runtime/subagents/provider-gate.js +6 -4
- package/dist/runtime/subagents/research-quality.js +3 -1
- package/dist/runtime/subagents/research-renderer.js +9 -2
- package/dist/runtime/subagents/result-parser.js +18 -7
- package/dist/runtime/thread-event-store.d.ts +5 -3
- package/dist/runtime/thread-event-store.js +29 -8
- package/dist/runtime/thread-projection.d.ts +17 -0
- package/dist/runtime/thread-projection.js +42 -1
- package/dist/runtime/tool-output-presentation.js +7 -7
- package/dist/runtime/turn-controller.js +1 -2
- package/dist/services/auth/auth.js +1 -4
- package/dist/services/auth/aws.js +24 -14
- package/dist/services/auto-fix/autoFixRunner.js +1 -1
- package/dist/services/auto-fix/index.d.ts +1 -1
- package/dist/services/diagnostic-tracking/diagnosticTracking.js +4 -2
- package/dist/services/diagnostic-tracking/index.d.ts +1 -1
- package/dist/services/effort.js +1 -9
- package/dist/services/file-glob.js +3 -4
- package/dist/services/mcp/transports.js +4 -4
- package/dist/services/model-catalog.js +179 -30
- package/dist/services/model-context.js +1 -1
- package/dist/services/provider-resilience/stream-recovery.js +1 -3
- package/dist/services/redaction.js +8 -0
- package/dist/services/session-storage.d.ts +28 -3
- package/dist/services/session-storage.js +70 -6
- package/dist/services/smart-routing.js +19 -11
- package/dist/services/verification-profile.js +17 -22
- package/dist/services/web-search-provider.js +21 -9
- package/dist/services/workspace-diff.js +10 -4
- package/dist/skills/builtin/code-review/SKILL.md +1 -1
- package/dist/skills/builtin/security-check/SKILL.md +1 -1
- package/dist/skills/builtin/test-gen/SKILL.md +1 -1
- package/dist/terminal-ui/editor.js +6 -2
- package/dist/terminal-ui/output-queue.js +9 -3
- package/dist/tools/lsp.js +12 -6
- package/dist/tui-core/frame.js +9 -7
- package/dist/tui-ui/transcript-cache.js +6 -6
- package/dist/tui-ui/transcript-inspector-surface.js +4 -1
- package/dist/tui-ui/transcript-inspector.js +3 -8
- package/dist/ui/box.js +14 -7
- package/dist/ui/markdown.js +4 -2
- package/dist/ui/shared/input-frame.js +12 -8
- package/dist/ui/stream-markdown.js +1 -1
- package/dist/ui/tool-preview.js +11 -3
- package/dist/ui/user-input.js +16 -10
- package/dist/web/cli-options.d.ts +13 -0
- package/dist/web/cli-options.js +47 -0
- package/dist/web/host-daemon.d.ts +61 -0
- package/dist/web/host-daemon.js +193 -0
- package/dist/web/launch.d.ts +3 -0
- package/dist/web/launch.js +24 -0
- package/dist/web/protocol.d.ts +2 -0
- package/dist/web/protocol.js +1 -0
- package/dist/web/review-service.js +41 -13
- package/dist/web/server.js +69 -0
- package/dist/web/session-runtime-registry.d.ts +14 -0
- package/dist/web/session-runtime-registry.js +23 -0
- package/dist/web/workbench-controller.d.ts +55 -0
- package/dist/web/workbench-controller.js +224 -14
- package/dist/web-client/assets/{DiffViewer-D6mG729y.js → DiffViewer-MMhvMif-.js} +1 -1
- package/dist/web-client/assets/{FilesPanel-CCDoAZ1J.js → FilesPanel-4litEN1k.js} +1 -1
- package/dist/web-client/assets/{GitPanel-DtNgiH7A.js → GitPanel-BVwlDRVo.js} +1 -1
- package/dist/web-client/assets/ReviewPanel-ChA0Zd2g.js +1 -0
- package/dist/web-client/assets/{TerminalPanel-CNxMaBLp.js → TerminalPanel-D8C1uybv.js} +1 -1
- package/dist/web-client/assets/index-DQfpqPTD.css +1 -0
- package/dist/web-client/assets/index-Dv_uE9dk.js +17 -0
- package/dist/web-client/index.html +2 -2
- package/npm-shrinkwrap.json +356 -120
- package/package.json +3 -1
- package/dist/web-client/assets/ReviewPanel-CKEBSt6P.js +0 -1
- package/dist/web-client/assets/index-BBvNg3By.css +0 -1
- package/dist/web-client/assets/index-C6TDJwMC.js +0 -17
|
@@ -126,7 +126,9 @@ function renderTerminal(view) {
|
|
|
126
126
|
}
|
|
127
127
|
function renderPrint(view) {
|
|
128
128
|
// Stable schema text (not raw concatenated claim text).
|
|
129
|
-
const claims = view.claims
|
|
129
|
+
const claims = view.claims
|
|
130
|
+
.map(c => ` - ${c.id}: ${c.verification} (${c.bindingStatus})`)
|
|
131
|
+
.join('\n');
|
|
130
132
|
return [
|
|
131
133
|
`# Research: ${view.objective}`,
|
|
132
134
|
`Status: ${view.stage} | Audit: ${view.auditStatus}`,
|
|
@@ -139,7 +141,12 @@ function renderPrint(view) {
|
|
|
139
141
|
}
|
|
140
142
|
function toLifecycleEvents(view, resolution) {
|
|
141
143
|
const events = [
|
|
142
|
-
{
|
|
144
|
+
{
|
|
145
|
+
type: 'research_started',
|
|
146
|
+
packetId: view.packetId,
|
|
147
|
+
objective: view.objective,
|
|
148
|
+
mode: view.mode,
|
|
149
|
+
},
|
|
143
150
|
];
|
|
144
151
|
for (const s of view.sources) {
|
|
145
152
|
events.push({
|
|
@@ -46,7 +46,9 @@ function parseFindings(raw) {
|
|
|
46
46
|
severity: parseSeverity(obj.severity),
|
|
47
47
|
evidence: str(obj.evidence, 1500),
|
|
48
48
|
file: obj.file != null ? str(obj.file, 500) : undefined,
|
|
49
|
-
line: typeof obj.line === 'number' && Number.isFinite(obj.line)
|
|
49
|
+
line: typeof obj.line === 'number' && Number.isFinite(obj.line)
|
|
50
|
+
? Math.max(0, Math.floor(obj.line))
|
|
51
|
+
: undefined,
|
|
50
52
|
});
|
|
51
53
|
if (out.length >= MAX_FINDINGS)
|
|
52
54
|
break;
|
|
@@ -54,7 +56,11 @@ function parseFindings(raw) {
|
|
|
54
56
|
return out;
|
|
55
57
|
}
|
|
56
58
|
function parseSeverity(value) {
|
|
57
|
-
if (value === 'critical' ||
|
|
59
|
+
if (value === 'critical' ||
|
|
60
|
+
value === 'high' ||
|
|
61
|
+
value === 'medium' ||
|
|
62
|
+
value === 'low' ||
|
|
63
|
+
value === 'info') {
|
|
58
64
|
return value;
|
|
59
65
|
}
|
|
60
66
|
return undefined;
|
|
@@ -163,11 +169,16 @@ function parseSubtaskResult(args) {
|
|
|
163
169
|
function summarizeFailure(status, content) {
|
|
164
170
|
const tail = truncate(content.trim(), 300);
|
|
165
171
|
switch (status) {
|
|
166
|
-
case 'timed_out':
|
|
167
|
-
|
|
168
|
-
case '
|
|
169
|
-
|
|
170
|
-
|
|
172
|
+
case 'timed_out':
|
|
173
|
+
return `Child timed out. Partial output: ${tail || '(none)'}`;
|
|
174
|
+
case 'cancelled':
|
|
175
|
+
return `Child was cancelled. Partial output: ${tail || '(none)'}`;
|
|
176
|
+
case 'failed':
|
|
177
|
+
return `Child failed. Output: ${tail || '(none)'}`;
|
|
178
|
+
case 'rejected':
|
|
179
|
+
return `Child was rejected by policy before running.`;
|
|
180
|
+
default:
|
|
181
|
+
return tail || '(no output)';
|
|
171
182
|
}
|
|
172
183
|
}
|
|
173
184
|
//# sourceMappingURL=result-parser.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type RuntimeEventEnvelopeV1, type RuntimeEventV1 } from './protocol/runtime-protocol-v1';
|
|
2
|
-
import { type ThreadProjectionV1 } from './thread-projection';
|
|
2
|
+
import { type ThreadProjectionDigestVersionV1, type ThreadProjectionV1 } from './thread-projection';
|
|
3
3
|
import type { CompactAuthoritativeSourceV1, CompactCheckpointCommitReceiptV1, CompactCompareAndCommitInputV1, CompactCompareAndCommitResultV1, CompactRuntimeEventV1 } from './compact-transaction';
|
|
4
4
|
export interface AppendRuntimeEventV1<T extends RuntimeEventV1 = RuntimeEventV1> {
|
|
5
5
|
readonly turnId?: string;
|
|
@@ -14,7 +14,7 @@ export interface ThreadEventReplayV1 {
|
|
|
14
14
|
readonly nextCursor: number;
|
|
15
15
|
readonly hasMore: boolean;
|
|
16
16
|
}
|
|
17
|
-
export type ThreadEventReplayReasonV1 = 'direct' | 'capability_receipt_journal' | 'durable_tool_receipt' | 'legacy_materializer' | 'runtime_diagnostics_legacy' | 'subagent_receipt_journal' | 'thread_session_view' | 'turn_commit_journal' | 'ui_gap_recovery' | 'ui_initial_history';
|
|
17
|
+
export type ThreadEventReplayReasonV1 = 'direct' | 'capability_receipt_journal' | 'durable_tool_receipt' | 'legacy_materializer' | 'projection_schema_upgrade' | 'runtime_diagnostics_legacy' | 'subagent_receipt_journal' | 'thread_session_view' | 'turn_commit_journal' | 'ui_gap_recovery' | 'ui_initial_history';
|
|
18
18
|
export interface ThreadEventCommitV1 {
|
|
19
19
|
readonly events: readonly RuntimeEventEnvelopeV1[];
|
|
20
20
|
readonly projection: ThreadProjectionV1;
|
|
@@ -44,6 +44,8 @@ export interface ThreadVerifiedPrefixV1 {
|
|
|
44
44
|
readonly cursor: number;
|
|
45
45
|
readonly eventDigest: string;
|
|
46
46
|
readonly projectionDigest: string;
|
|
47
|
+
/** Missing on receipts written before projection digests were versioned. */
|
|
48
|
+
readonly projectionDigestVersion?: ThreadProjectionDigestVersionV1;
|
|
47
49
|
}
|
|
48
50
|
/**
|
|
49
51
|
* Crash-safe derived checkpoint for opening a Thread in a fresh process.
|
|
@@ -136,7 +138,7 @@ export declare class ThreadEventStore {
|
|
|
136
138
|
* exact log identity/projection checkpoint remains current. Internal append
|
|
137
139
|
* carries the proof forward because the hash-chained prefix cannot change.
|
|
138
140
|
*/
|
|
139
|
-
verifyDurablePrefix(cursor: number, eventDigest: string, projectionDigest: string): boolean;
|
|
141
|
+
verifyDurablePrefix(cursor: number, eventDigest: string, projectionDigest: string, projectionDigestVersion?: ThreadProjectionDigestVersionV1): boolean;
|
|
140
142
|
getCursor(): number;
|
|
141
143
|
/**
|
|
142
144
|
* Read the compact persisted receipt without parsing the potentially large
|
|
@@ -71,7 +71,12 @@ class ThreadEventStore {
|
|
|
71
71
|
}
|
|
72
72
|
const commit = this.withLogLock(() => {
|
|
73
73
|
ensurePrivateDirectory(this.rootDir);
|
|
74
|
-
|
|
74
|
+
let head = this.loadVerifiedHead();
|
|
75
|
+
if (!(0, thread_projection_1.hasCurrentThreadProjectionShapeV1)(head.projection)) {
|
|
76
|
+
// An older projection cannot be incrementally advanced because it did
|
|
77
|
+
// not retain all diagnostic/compact history. Rebuild from facts once.
|
|
78
|
+
head = this.loadVerifiedHead(true, 'projection_schema_upgrade');
|
|
79
|
+
}
|
|
75
80
|
if (head.discardedTailBytes > 0)
|
|
76
81
|
(0, fs_1.truncateSync)(this.logPath, head.safeByteLength);
|
|
77
82
|
let seq = head.projection.cursor;
|
|
@@ -216,7 +221,7 @@ class ThreadEventStore {
|
|
|
216
221
|
* exact log identity/projection checkpoint remains current. Internal append
|
|
217
222
|
* carries the proof forward because the hash-chained prefix cannot change.
|
|
218
223
|
*/
|
|
219
|
-
verifyDurablePrefix(cursor, eventDigest, projectionDigest) {
|
|
224
|
+
verifyDurablePrefix(cursor, eventDigest, projectionDigest, projectionDigestVersion) {
|
|
220
225
|
if (!Number.isSafeInteger(cursor) ||
|
|
221
226
|
cursor <= 0 ||
|
|
222
227
|
!isSha256(eventDigest) ||
|
|
@@ -227,21 +232,31 @@ class ThreadEventStore {
|
|
|
227
232
|
let head = this.loadVerifiedHead();
|
|
228
233
|
if (cursor > head.projection.cursor)
|
|
229
234
|
return false;
|
|
230
|
-
const expected = { cursor, eventDigest, projectionDigest };
|
|
235
|
+
const expected = { cursor, eventDigest, projectionDigest, projectionDigestVersion };
|
|
231
236
|
if (head.verifiedPrefixes.some(prefix => sameVerifiedPrefix(prefix, expected)))
|
|
232
237
|
return true;
|
|
233
238
|
head = this.loadVerifiedHead(true, 'verify_durable_prefix');
|
|
234
239
|
const scan = requireVerifiedScan(head);
|
|
235
240
|
const events = scan.events.slice(0, cursor);
|
|
241
|
+
const resolvedProjectionDigestVersion = (0, thread_projection_1.resolveThreadProjectionDigestVersionV1)((0, thread_projection_1.projectThreadEvents)(this.threadId, events), projectionDigest, projectionDigestVersion);
|
|
236
242
|
if (events.length !== cursor ||
|
|
237
243
|
(0, canonical_1.digestRuntimeValue)(events) !== eventDigest ||
|
|
238
|
-
|
|
244
|
+
resolvedProjectionDigestVersion === undefined) {
|
|
239
245
|
return false;
|
|
240
246
|
}
|
|
247
|
+
const verified = {
|
|
248
|
+
cursor,
|
|
249
|
+
eventDigest,
|
|
250
|
+
projectionDigest,
|
|
251
|
+
projectionDigestVersion: resolvedProjectionDigestVersion,
|
|
252
|
+
};
|
|
241
253
|
const next = {
|
|
242
254
|
...head,
|
|
243
255
|
generation: head.generation + 1,
|
|
244
|
-
verifiedPrefixes: [
|
|
256
|
+
verifiedPrefixes: [
|
|
257
|
+
...head.verifiedPrefixes.filter(prefix => prefix.cursor !== cursor),
|
|
258
|
+
verified,
|
|
259
|
+
].sort((left, right) => left.cursor - right.cursor),
|
|
245
260
|
};
|
|
246
261
|
this.cachedHead = next;
|
|
247
262
|
this.tryPersistVerifiedHead(next);
|
|
@@ -858,7 +873,7 @@ function retainVerifiedPrefixes(prefixes, scan, threadId) {
|
|
|
858
873
|
return false;
|
|
859
874
|
const events = scan.events.slice(0, prefix.cursor);
|
|
860
875
|
return ((0, canonical_1.digestRuntimeValue)(events) === prefix.eventDigest &&
|
|
861
|
-
(0, thread_projection_1.projectThreadEvents)(threadId, events).
|
|
876
|
+
(0, thread_projection_1.resolveThreadProjectionDigestVersionV1)((0, thread_projection_1.projectThreadEvents)(threadId, events), prefix.projectionDigest, prefix.projectionDigestVersion) !== undefined);
|
|
862
877
|
});
|
|
863
878
|
}
|
|
864
879
|
function requireVerifiedScan(head) {
|
|
@@ -891,12 +906,18 @@ function isStoredVerifiedPrefix(value, headCursor) {
|
|
|
891
906
|
value.cursor > 0 &&
|
|
892
907
|
value.cursor <= headCursor &&
|
|
893
908
|
isSha256(value.eventDigest) &&
|
|
894
|
-
isSha256(value.projectionDigest)
|
|
909
|
+
isSha256(value.projectionDigest) &&
|
|
910
|
+
(value.projectionDigestVersion === undefined ||
|
|
911
|
+
value.projectionDigestVersion === 1 ||
|
|
912
|
+
value.projectionDigestVersion === thread_projection_1.CURRENT_THREAD_PROJECTION_DIGEST_VERSION_V1));
|
|
895
913
|
}
|
|
896
914
|
function sameVerifiedPrefix(left, right) {
|
|
897
915
|
return (left.cursor === right.cursor &&
|
|
898
916
|
left.eventDigest === right.eventDigest &&
|
|
899
|
-
left.projectionDigest === right.projectionDigest
|
|
917
|
+
left.projectionDigest === right.projectionDigest &&
|
|
918
|
+
(left.projectionDigestVersion === right.projectionDigestVersion ||
|
|
919
|
+
left.projectionDigestVersion === undefined ||
|
|
920
|
+
right.projectionDigestVersion === undefined));
|
|
900
921
|
}
|
|
901
922
|
function isStoredLogIdentity(value) {
|
|
902
923
|
return (isRecord(value) &&
|
|
@@ -2,6 +2,14 @@ import type { RuntimeEventEnvelopeV1, RuntimeEventTypeV1 } from './protocol/runt
|
|
|
2
2
|
import type { CompactRuntimeEventV1 } from './compact-transaction';
|
|
3
3
|
export type ThreadProjectionStatusV1 = 'new' | 'active' | 'idle';
|
|
4
4
|
export type TurnProjectionStatusV1 = 'active' | 'completed' | 'failed' | 'interrupted';
|
|
5
|
+
/**
|
|
6
|
+
* Version of the canonical content included in a Thread projection digest.
|
|
7
|
+
*
|
|
8
|
+
* Version 1 predates head-only diagnostic and compact lifecycle fields.
|
|
9
|
+
* Version 2 covers the complete current projection shape.
|
|
10
|
+
*/
|
|
11
|
+
export type ThreadProjectionDigestVersionV1 = 1 | 2;
|
|
12
|
+
export declare const CURRENT_THREAD_PROJECTION_DIGEST_VERSION_V1: ThreadProjectionDigestVersionV1;
|
|
5
13
|
export type ItemProjectionStatusV1 = 'started' | 'completed' | 'failed' | 'interrupted' | 'indeterminate';
|
|
6
14
|
export interface ItemProjectionV1 {
|
|
7
15
|
readonly itemId: string;
|
|
@@ -133,5 +141,14 @@ export declare function projectThreadEvents(threadId: string, events: readonly R
|
|
|
133
141
|
export declare function advanceThreadProjection(projection: ThreadProjectionV1, events: readonly RuntimeEventEnvelopeV1[]): ThreadProjectionV1;
|
|
134
142
|
export declare function applyThreadEvent(state: MutableThreadProjectionV1, event: RuntimeEventEnvelopeV1): void;
|
|
135
143
|
export declare function verifyThreadProjectionDigest(projection: ThreadProjectionV1): boolean;
|
|
144
|
+
/**
|
|
145
|
+
* Compute one explicitly versioned digest without weakening projection-file
|
|
146
|
+
* integrity. This is used only for immutable cutover-prefix compatibility.
|
|
147
|
+
*/
|
|
148
|
+
export declare function threadProjectionDigestForVersionV1(projection: ThreadProjectionV1, version: ThreadProjectionDigestVersionV1): string;
|
|
149
|
+
/** Resolve an exact known digest scheme; missing metadata is inferred safely. */
|
|
150
|
+
export declare function resolveThreadProjectionDigestVersionV1(projection: ThreadProjectionV1, digest: string, requestedVersion?: ThreadProjectionDigestVersionV1): ThreadProjectionDigestVersionV1 | undefined;
|
|
151
|
+
/** Older persisted projections must be rebuilt before incremental advance. */
|
|
152
|
+
export declare function hasCurrentThreadProjectionShapeV1(projection: ThreadProjectionV1): boolean;
|
|
136
153
|
export {};
|
|
137
154
|
//# sourceMappingURL=thread-projection.d.ts.map
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ThreadProjectionInvariantError = void 0;
|
|
3
|
+
exports.ThreadProjectionInvariantError = exports.CURRENT_THREAD_PROJECTION_DIGEST_VERSION_V1 = void 0;
|
|
4
4
|
exports.projectThreadEvents = projectThreadEvents;
|
|
5
5
|
exports.advanceThreadProjection = advanceThreadProjection;
|
|
6
6
|
exports.applyThreadEvent = applyThreadEvent;
|
|
7
7
|
exports.verifyThreadProjectionDigest = verifyThreadProjectionDigest;
|
|
8
|
+
exports.threadProjectionDigestForVersionV1 = threadProjectionDigestForVersionV1;
|
|
9
|
+
exports.resolveThreadProjectionDigestVersionV1 = resolveThreadProjectionDigestVersionV1;
|
|
10
|
+
exports.hasCurrentThreadProjectionShapeV1 = hasCurrentThreadProjectionShapeV1;
|
|
8
11
|
const canonical_1 = require("./protocol/canonical");
|
|
12
|
+
exports.CURRENT_THREAD_PROJECTION_DIGEST_VERSION_V1 = 2;
|
|
9
13
|
class ThreadProjectionInvariantError extends Error {
|
|
10
14
|
constructor(message, seq, eventType) {
|
|
11
15
|
super(`Thread projection invariant failed at seq ${seq} (${eventType}): ${message}`);
|
|
@@ -187,6 +191,43 @@ function verifyThreadProjectionDigest(projection) {
|
|
|
187
191
|
void _digest;
|
|
188
192
|
return (0, canonical_1.digestRuntimeValue)(content) === projection.digest;
|
|
189
193
|
}
|
|
194
|
+
/**
|
|
195
|
+
* Compute one explicitly versioned digest without weakening projection-file
|
|
196
|
+
* integrity. This is used only for immutable cutover-prefix compatibility.
|
|
197
|
+
*/
|
|
198
|
+
function threadProjectionDigestForVersionV1(projection, version) {
|
|
199
|
+
const { digest: _digest, diagnosticEvents: _diagnosticEvents, compactEvents: _compactEvents, ...legacyContent } = projection;
|
|
200
|
+
void _digest;
|
|
201
|
+
void _diagnosticEvents;
|
|
202
|
+
void _compactEvents;
|
|
203
|
+
if (version === 1)
|
|
204
|
+
return (0, canonical_1.digestRuntimeValue)(legacyContent);
|
|
205
|
+
const content = {
|
|
206
|
+
...legacyContent,
|
|
207
|
+
diagnosticEvents: projection.diagnosticEvents ?? {},
|
|
208
|
+
compactEvents: projection.compactEvents ?? [],
|
|
209
|
+
};
|
|
210
|
+
return (0, canonical_1.digestRuntimeValue)(content);
|
|
211
|
+
}
|
|
212
|
+
/** Resolve an exact known digest scheme; missing metadata is inferred safely. */
|
|
213
|
+
function resolveThreadProjectionDigestVersionV1(projection, digest, requestedVersion) {
|
|
214
|
+
if (requestedVersion !== undefined) {
|
|
215
|
+
if (requestedVersion !== 1 && requestedVersion !== 2)
|
|
216
|
+
return undefined;
|
|
217
|
+
return threadProjectionDigestForVersionV1(projection, requestedVersion) === digest
|
|
218
|
+
? requestedVersion
|
|
219
|
+
: undefined;
|
|
220
|
+
}
|
|
221
|
+
for (const version of [exports.CURRENT_THREAD_PROJECTION_DIGEST_VERSION_V1, 1]) {
|
|
222
|
+
if (threadProjectionDigestForVersionV1(projection, version) === digest)
|
|
223
|
+
return version;
|
|
224
|
+
}
|
|
225
|
+
return undefined;
|
|
226
|
+
}
|
|
227
|
+
/** Older persisted projections must be rebuilt before incremental advance. */
|
|
228
|
+
function hasCurrentThreadProjectionShapeV1(projection) {
|
|
229
|
+
return projection.diagnosticEvents !== undefined && projection.compactEvents !== undefined;
|
|
230
|
+
}
|
|
190
231
|
function startTurn(state, event) {
|
|
191
232
|
const turnId = requiredIdentity(event.turnId, 'turnId', event);
|
|
192
233
|
if (state.activeTurnId)
|
|
@@ -23,11 +23,7 @@ exports.DEFAULT_TOOL_OUTPUT_POLICY = {
|
|
|
23
23
|
// ============================================================================
|
|
24
24
|
// Known noisy aggregate tool names — always collapsed.
|
|
25
25
|
// ============================================================================
|
|
26
|
-
const ALWAYS_COLLAPSE_TOOLS = new Set([
|
|
27
|
-
'batch_read',
|
|
28
|
-
'batch_write',
|
|
29
|
-
'batch_edit',
|
|
30
|
-
]);
|
|
26
|
+
const ALWAYS_COLLAPSE_TOOLS = new Set(['batch_read', 'batch_write', 'batch_edit']);
|
|
31
27
|
function createToolOutputView(input) {
|
|
32
28
|
const { toolName, success, summary, rawOutput, outputBytes, callId, sequence, policy } = input;
|
|
33
29
|
const contentKind = classifyContent(toolName, rawOutput);
|
|
@@ -85,7 +81,7 @@ function createToolOutputView(input) {
|
|
|
85
81
|
return aggregate ? { ...view, contentKind: 'batch', aggregate } : view;
|
|
86
82
|
}
|
|
87
83
|
function computeAdaptiveView(input) {
|
|
88
|
-
const { toolName, success, defaultSummary, sanitized, outputBytes, outputLines, detailRef, policy } = input;
|
|
84
|
+
const { toolName, success, defaultSummary, sanitized, outputBytes, outputLines, detailRef, policy, } = input;
|
|
89
85
|
// Empty output.
|
|
90
86
|
if (!sanitized || outputBytes === 0) {
|
|
91
87
|
return {
|
|
@@ -324,6 +320,10 @@ function firstString(...values) {
|
|
|
324
320
|
return values.find(value => typeof value === 'string' && value.trim().length > 0);
|
|
325
321
|
}
|
|
326
322
|
function summarizeOutput(output) {
|
|
327
|
-
return output
|
|
323
|
+
return (output
|
|
324
|
+
.split(/\r?\n/u)
|
|
325
|
+
.find(line => line.trim())
|
|
326
|
+
?.trim()
|
|
327
|
+
.slice(0, 160) ?? '');
|
|
328
328
|
}
|
|
329
329
|
//# sourceMappingURL=tool-output-presentation.js.map
|
|
@@ -81,8 +81,7 @@ class TurnController {
|
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
83
|
registerExitIntent(now = Date.now()) {
|
|
84
|
-
const shouldExit = this.lastExitIntentAt > 0 &&
|
|
85
|
-
now - this.lastExitIntentAt <= this.exitConfirmWindowMs;
|
|
84
|
+
const shouldExit = this.lastExitIntentAt > 0 && now - this.lastExitIntentAt <= this.exitConfirmWindowMs;
|
|
86
85
|
this.lastExitIntentAt = shouldExit ? 0 : now;
|
|
87
86
|
return shouldExit;
|
|
88
87
|
}
|
|
@@ -200,10 +200,7 @@ function loadOrCreateKey() {
|
|
|
200
200
|
function encryptMap(plain, key) {
|
|
201
201
|
const iv = (0, crypto_1.randomBytes)(12);
|
|
202
202
|
const cipher = (0, crypto_1.createCipheriv)('aes-256-gcm', key, iv);
|
|
203
|
-
const ciphertext = Buffer.concat([
|
|
204
|
-
cipher.update(JSON.stringify(plain), 'utf-8'),
|
|
205
|
-
cipher.final(),
|
|
206
|
-
]);
|
|
203
|
+
const ciphertext = Buffer.concat([cipher.update(JSON.stringify(plain), 'utf-8'), cipher.final()]);
|
|
207
204
|
const blob = {
|
|
208
205
|
v: 1,
|
|
209
206
|
iv: iv.toString('base64'),
|
|
@@ -87,14 +87,16 @@ async function verifyAwsCredentials(auth) {
|
|
|
87
87
|
if (credentialContext.error)
|
|
88
88
|
return { success: false, error: credentialContext.error };
|
|
89
89
|
// 尝试调用 AWS CLI
|
|
90
|
-
return new Promise(
|
|
90
|
+
return new Promise(resolve => {
|
|
91
91
|
const region = auth.region || 'us-east-1';
|
|
92
92
|
(0, child_process_1.execFile)('aws', [
|
|
93
93
|
'sts',
|
|
94
94
|
'get-caller-identity',
|
|
95
95
|
...credentialContext.profileArgs,
|
|
96
|
-
'--region',
|
|
97
|
-
|
|
96
|
+
'--region',
|
|
97
|
+
region,
|
|
98
|
+
'--output',
|
|
99
|
+
'json',
|
|
98
100
|
], {
|
|
99
101
|
timeout: 10000,
|
|
100
102
|
env: credentialContext.env,
|
|
@@ -136,15 +138,18 @@ async function getStsToken(auth, durationSeconds = 3600) {
|
|
|
136
138
|
const credentialContext = resolveCredentialContext(auth);
|
|
137
139
|
if (credentialContext.error)
|
|
138
140
|
return { success: false, error: credentialContext.error };
|
|
139
|
-
return new Promise(
|
|
141
|
+
return new Promise(resolve => {
|
|
140
142
|
const region = auth.region || 'us-east-1';
|
|
141
143
|
(0, child_process_1.execFile)('aws', [
|
|
142
144
|
'sts',
|
|
143
145
|
'get-session-token',
|
|
144
146
|
...credentialContext.profileArgs,
|
|
145
|
-
'--region',
|
|
146
|
-
|
|
147
|
-
'--
|
|
147
|
+
'--region',
|
|
148
|
+
region,
|
|
149
|
+
'--duration-seconds',
|
|
150
|
+
String(durationSeconds),
|
|
151
|
+
'--output',
|
|
152
|
+
'json',
|
|
148
153
|
], {
|
|
149
154
|
timeout: 15000,
|
|
150
155
|
env: credentialContext.env,
|
|
@@ -183,13 +188,18 @@ async function assumeAwsRole(auth, roleArn, durationSeconds = 3600) {
|
|
|
183
188
|
(0, child_process_1.execFile)('aws', [
|
|
184
189
|
'sts',
|
|
185
190
|
'assume-role',
|
|
186
|
-
'--role-arn',
|
|
187
|
-
|
|
191
|
+
'--role-arn',
|
|
192
|
+
roleArn,
|
|
193
|
+
'--role-session-name',
|
|
194
|
+
sessionName,
|
|
188
195
|
...externalIdArgs,
|
|
189
196
|
...credentialContext.profileArgs,
|
|
190
|
-
'--region',
|
|
191
|
-
|
|
192
|
-
'--
|
|
197
|
+
'--region',
|
|
198
|
+
region,
|
|
199
|
+
'--duration-seconds',
|
|
200
|
+
String(durationSeconds),
|
|
201
|
+
'--output',
|
|
202
|
+
'json',
|
|
193
203
|
], {
|
|
194
204
|
timeout: 15000,
|
|
195
205
|
env: credentialContext.env,
|
|
@@ -212,10 +222,10 @@ async function assumeAwsRole(auth, roleArn, durationSeconds = 3600) {
|
|
|
212
222
|
* 检测 AWS CLI 是否可用
|
|
213
223
|
*/
|
|
214
224
|
async function checkAwsCliAvailable() {
|
|
215
|
-
return new Promise(
|
|
225
|
+
return new Promise(resolve => {
|
|
216
226
|
(0, child_process_1.execFile)('aws', ['--version'], {
|
|
217
227
|
timeout: 5000,
|
|
218
|
-
},
|
|
228
|
+
}, error => {
|
|
219
229
|
resolve(!error);
|
|
220
230
|
});
|
|
221
231
|
});
|
|
@@ -104,7 +104,7 @@ class AutoFixRunner {
|
|
|
104
104
|
// 内部方法
|
|
105
105
|
// ============================================================================
|
|
106
106
|
async runCommand(command) {
|
|
107
|
-
return new Promise(
|
|
107
|
+
return new Promise(resolve => {
|
|
108
108
|
const [cmd, ...args] = command.split(' ');
|
|
109
109
|
(0, child_process_1.execFile)(cmd, args, {
|
|
110
110
|
cwd: this.projectPath,
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export { AutoFixRunner, getAutoFixRunner, resetAutoFixRunner, type AutoFixResult, type AutoFixError, type AutoFixContext, } from './autoFixRunner';
|
|
5
5
|
export { DEFAULT_AUTOFIX_CONFIG, detectAutoFixConfig, type AutoFixConfig, type AutoFixTrigger, } from './autoFixConfig';
|
|
6
|
-
export { autoFixHook, shouldTriggerAutoFix
|
|
6
|
+
export { autoFixHook, shouldTriggerAutoFix } from './autoFixHook';
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -105,8 +105,10 @@ class DiagnosticTracker {
|
|
|
105
105
|
currentCount: this.currentDiagnostics.length,
|
|
106
106
|
newCount: this.newDiagnostics.length,
|
|
107
107
|
resolvedCount: this.resolvedDiagnostics.length,
|
|
108
|
-
errorCount: this.currentDiagnostics.filter(d => d.severity === types_1.DiagnosticSeverity.Error)
|
|
109
|
-
|
|
108
|
+
errorCount: this.currentDiagnostics.filter(d => d.severity === types_1.DiagnosticSeverity.Error)
|
|
109
|
+
.length,
|
|
110
|
+
warningCount: this.currentDiagnostics.filter(d => d.severity === types_1.DiagnosticSeverity.Warning)
|
|
111
|
+
.length,
|
|
110
112
|
};
|
|
111
113
|
}
|
|
112
114
|
/**
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export { DiagnosticTracker, getDiagnosticTracker, resetDiagnosticTracker, } from './diagnosticTracking';
|
|
5
5
|
export { Diagnostic, DiagnosticBaseline, DiagnosticSeverity, NewDiagnosticsResult, diagnosticKey, isDiagnosticEqual, } from './types';
|
|
6
|
-
export { formatDiagnostic, formatDiagnostics, formatDiagnosticSummary
|
|
6
|
+
export { formatDiagnostic, formatDiagnostics, formatDiagnosticSummary } from './formatter';
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/services/effort.js
CHANGED
|
@@ -5,15 +5,7 @@ exports.isEffortPreference = isEffortPreference;
|
|
|
5
5
|
exports.resolveEffort = resolveEffort;
|
|
6
6
|
exports.buildProviderEffortParams = buildProviderEffortParams;
|
|
7
7
|
exports.resolveProfileEffort = resolveProfileEffort;
|
|
8
|
-
exports.EFFORT_LEVELS = [
|
|
9
|
-
'none',
|
|
10
|
-
'minimal',
|
|
11
|
-
'low',
|
|
12
|
-
'medium',
|
|
13
|
-
'high',
|
|
14
|
-
'xhigh',
|
|
15
|
-
'max',
|
|
16
|
-
];
|
|
8
|
+
exports.EFFORT_LEVELS = ['none', 'minimal', 'low', 'medium', 'high', 'xhigh', 'max'];
|
|
17
9
|
function isEffortPreference(value) {
|
|
18
10
|
return value === 'auto' || exports.EFFORT_LEVELS.includes(value);
|
|
19
11
|
}
|
|
@@ -24,7 +24,8 @@ function parseGitignore(cwd) {
|
|
|
24
24
|
if ((0, fs_1.existsSync)(gitignorePath)) {
|
|
25
25
|
try {
|
|
26
26
|
const content = (0, fs_1.readFileSync)(gitignorePath, 'utf-8');
|
|
27
|
-
const lines = content
|
|
27
|
+
const lines = content
|
|
28
|
+
.split('\n')
|
|
28
29
|
.map(line => line.trim())
|
|
29
30
|
.filter(line => line && !line.startsWith('#'));
|
|
30
31
|
patterns.push(...lines);
|
|
@@ -88,9 +89,7 @@ function matchFiles(query, cwd, options = {}) {
|
|
|
88
89
|
}
|
|
89
90
|
const entries = (0, fs_1.readdirSync)(dirPath);
|
|
90
91
|
for (const entry of entries) {
|
|
91
|
-
const entryPath = parts.length > 1
|
|
92
|
-
? parts.slice(0, -1).join('/') + '/' + entry
|
|
93
|
-
: entry;
|
|
92
|
+
const entryPath = parts.length > 1 ? parts.slice(0, -1).join('/') + '/' + entry : entry;
|
|
94
93
|
// 过滤
|
|
95
94
|
const comparableEntry = caseSensitive ? entry : entry.toLowerCase();
|
|
96
95
|
if (normalizedFilter && !comparableEntry.startsWith(normalizedFilter)) {
|
|
@@ -68,7 +68,7 @@ class SseTransport extends BaseTransport {
|
|
|
68
68
|
this.reconnectAttempts = 0;
|
|
69
69
|
this.emitConnected();
|
|
70
70
|
};
|
|
71
|
-
this.eventSource.onmessage =
|
|
71
|
+
this.eventSource.onmessage = event => {
|
|
72
72
|
try {
|
|
73
73
|
const msg = JSON.parse(event.data);
|
|
74
74
|
this.emitMessage(msg);
|
|
@@ -159,7 +159,7 @@ class WebSocketTransport extends BaseTransport {
|
|
|
159
159
|
this.emitConnected();
|
|
160
160
|
resolve();
|
|
161
161
|
};
|
|
162
|
-
this.ws.onmessage =
|
|
162
|
+
this.ws.onmessage = event => {
|
|
163
163
|
try {
|
|
164
164
|
const msg = JSON.parse(event.data);
|
|
165
165
|
this.emitMessage(msg);
|
|
@@ -168,7 +168,7 @@ class WebSocketTransport extends BaseTransport {
|
|
|
168
168
|
this.emitError(new Error(`Failed to parse WebSocket message: ${err}`));
|
|
169
169
|
}
|
|
170
170
|
};
|
|
171
|
-
this.ws.onerror =
|
|
171
|
+
this.ws.onerror = err => {
|
|
172
172
|
this.emitError(new Error('WebSocket error'));
|
|
173
173
|
reject(err);
|
|
174
174
|
};
|
|
@@ -274,7 +274,7 @@ class HttpTransport extends BaseTransport {
|
|
|
274
274
|
if (!response.ok) {
|
|
275
275
|
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
|
276
276
|
}
|
|
277
|
-
const data = await response.json();
|
|
277
|
+
const data = (await response.json());
|
|
278
278
|
this.emitMessage(data);
|
|
279
279
|
}
|
|
280
280
|
catch (err) {
|