@the-open-engine/zeroshot 6.39.2 → 6.40.0

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.
Files changed (53) hide show
  1. package/README.md +12 -0
  2. package/cli/agent-provider-boundary.js +19 -0
  3. package/cli/agent-provider-boundary.ts +79 -0
  4. package/cli/export-stream.js +94 -0
  5. package/cli/export-stream.ts +118 -0
  6. package/cli/index.js +102 -54
  7. package/cli/json-export.js +2 -38
  8. package/cli/json-export.ts +2 -56
  9. package/cli/semantic-canonical.js +60 -0
  10. package/cli/semantic-canonical.ts +59 -0
  11. package/cli/semantic-contract.js +97 -0
  12. package/cli/semantic-contract.ts +153 -0
  13. package/cli/semantic-events.js +53 -0
  14. package/cli/semantic-events.ts +65 -0
  15. package/cli/semantic-evidence.js +63 -0
  16. package/cli/semantic-evidence.ts +65 -0
  17. package/cli/semantic-export.js +186 -0
  18. package/cli/semantic-export.ts +245 -0
  19. package/cli/semantic-json.js +69 -0
  20. package/cli/semantic-json.ts +69 -0
  21. package/cli/semantic-line-scanner.js +56 -0
  22. package/cli/semantic-line-scanner.ts +54 -0
  23. package/cli/semantic-parser.js +78 -0
  24. package/cli/semantic-parser.ts +95 -0
  25. package/cli/semantic-provider-line.js +91 -0
  26. package/cli/semantic-provider-line.ts +106 -0
  27. package/cli/trace-evidence.js +86 -0
  28. package/cli/trace-evidence.ts +115 -0
  29. package/cli/trace-export.js +120 -0
  30. package/cli/trace-export.ts +164 -0
  31. package/cli/trace-output-record.js +15 -0
  32. package/cli/trace-output-record.ts +18 -0
  33. package/cli/trace-output.js +98 -0
  34. package/cli/trace-output.ts +119 -0
  35. package/lib/agent-cli-provider/log-prefix.d.ts.map +1 -1
  36. package/lib/agent-cli-provider/log-prefix.js +8 -6
  37. package/lib/agent-cli-provider/log-prefix.js.map +1 -1
  38. package/lib/stream-json-parser.js +6 -5
  39. package/npm-shrinkwrap.json +2 -2
  40. package/package.json +6 -4
  41. package/src/agent/agent-task-executor.js +36 -40
  42. package/src/agent/output-extraction-json.js +5 -6
  43. package/src/agent/output-extraction-json.ts +4 -7
  44. package/src/agent-cli-provider/log-prefix.ts +12 -7
  45. package/src/claude-task-runner.js +9 -9
  46. package/src/legacy-lib/stream-json-parser.ts +10 -5
  47. package/src/providers/index.js +1 -19
  48. package/src/task-log-line.d.ts +20 -0
  49. package/src/task-log-line.js +80 -0
  50. package/task-lib/commands/logs.js +5 -8
  51. package/task-lib/sdk-watcher-output.js +31 -0
  52. package/task-lib/sdk-watcher.js +4 -11
  53. package/task-lib/watcher-output-runtime.js +30 -16
@@ -0,0 +1,164 @@
1
+ import path = require('path');
2
+ import {
3
+ compareText,
4
+ createExclusiveDestination,
5
+ createRecordWriter,
6
+ nullableString,
7
+ type ExportStream,
8
+ type RecordWriter,
9
+ } from './export-stream';
10
+ import {
11
+ collectTaskCauses,
12
+ expectedLogPath,
13
+ forEachLedgerMessage,
14
+ hasTerminalTaskStatus,
15
+ logicalTaskRef,
16
+ readTraceTask,
17
+ type ClusterLedger,
18
+ type TaskCause,
19
+ type TraceTask,
20
+ } from './trace-evidence';
21
+ import { streamTaskOutput, TRACE_OUTPUT_CHUNK_BYTES, writeUnavailableOutput } from './trace-output';
22
+
23
+ const TRACE_SCHEMA_VERSION = 'zeroshot.trace.v1';
24
+ const TRACE_MEDIA_TYPE = 'application/x-zeroshot-trace+jsonl';
25
+
26
+ interface TraceExportOptions {
27
+ ledger: ClusterLedger;
28
+ clusterId: string;
29
+ readTask(taskId: string): TraceTask | null;
30
+ allowedLogRoot: string;
31
+ outputPath?: string | null;
32
+ stdout?: ExportStream;
33
+ }
34
+
35
+ interface StreamTaskOptions {
36
+ writer: RecordWriter;
37
+ taskId: string;
38
+ cause: TaskCause;
39
+ readTask(taskId: string): TraceTask | null;
40
+ allowedLogRoot: string;
41
+ issues: string[];
42
+ }
43
+
44
+ function nullableInteger(value: unknown): number | null {
45
+ return typeof value === 'number' && Number.isInteger(value) ? value : null;
46
+ }
47
+
48
+ function assertOutputDoesNotReplaceTaskLog(
49
+ outputPath: string | null | undefined,
50
+ allowedLogRoot: string,
51
+ taskIds: Iterable<string>
52
+ ): void {
53
+ if (!outputPath) return;
54
+ const resolvedOutput = path.resolve(outputPath);
55
+ for (const taskId of taskIds) {
56
+ if (expectedLogPath(allowedLogRoot, taskId) === resolvedOutput) {
57
+ throw new Error('Trace export output cannot replace a source task log');
58
+ }
59
+ }
60
+ }
61
+
62
+ function taskPrompt(task: TraceTask): string | null {
63
+ return nullableString(task.fullPrompt) ?? nullableString(task.prompt);
64
+ }
65
+
66
+ function streamTask(options: StreamTaskOptions): { bytes: number } {
67
+ const { writer, taskId, cause, readTask, allowedLogRoot, issues } = options;
68
+ const agentIds = [...cause.agentIds].sort(compareText);
69
+ if (agentIds.length > 1) issues.push(`task:${taskId}:ambiguous_agent`);
70
+ const taskRead = readTraceTask(taskId, readTask);
71
+ const task = taskRead.task;
72
+ if (taskRead.issue) issues.push(taskRead.issue);
73
+ const taskTerminal = task !== null && hasTerminalTaskStatus(task);
74
+ if (task && !taskTerminal) issues.push(`task:${taskId}:task_not_terminal`);
75
+ const promptRef = logicalTaskRef(taskId, 'prompt');
76
+ const rawOutputRef = logicalTaskRef(taskId, 'output');
77
+ writer.write({
78
+ record_type: 'task',
79
+ task_id: taskId,
80
+ agent_id: agentIds.length === 1 ? agentIds[0] : null,
81
+ provider: nullableString(task?.provider),
82
+ model: nullableString(task?.model),
83
+ status: nullableString(task?.status),
84
+ created_at: nullableString(task?.createdAt),
85
+ updated_at: nullableString(task?.updatedAt),
86
+ exit_code: nullableInteger(task?.exitCode),
87
+ prompt_ref: promptRef,
88
+ prompt: task ? taskPrompt(task) : null,
89
+ raw_output_ref: rawOutputRef,
90
+ });
91
+ if (!task) {
92
+ writeUnavailableOutput(writer, taskId, rawOutputRef);
93
+ return { bytes: 0 };
94
+ }
95
+ return streamTaskOutput({
96
+ writer,
97
+ taskId,
98
+ task,
99
+ allowedLogRoot,
100
+ rawOutputRef,
101
+ taskTerminal,
102
+ issues,
103
+ });
104
+ }
105
+
106
+ function streamClusterTraceExport(options: TraceExportOptions): void {
107
+ const { ledger, clusterId, readTask, allowedLogRoot, outputPath = null } = options;
108
+ const causes = collectTaskCauses(ledger, clusterId);
109
+ assertOutputDoesNotReplaceTaskLog(outputPath, allowedLogRoot, causes.keys());
110
+ const destination = createExclusiveDestination(
111
+ outputPath,
112
+ options.stdout ?? process.stdout,
113
+ 'Trace'
114
+ );
115
+ const writer = createRecordWriter(destination);
116
+ let ledgerMessages = 0;
117
+ let taskOutputBytes = 0;
118
+ const issues: string[] = [];
119
+ try {
120
+ writer.write({
121
+ record_type: 'header',
122
+ schema_version: TRACE_SCHEMA_VERSION,
123
+ media_type: TRACE_MEDIA_TYPE,
124
+ cluster_id: clusterId,
125
+ chunk_bytes: TRACE_OUTPUT_CHUNK_BYTES,
126
+ });
127
+ forEachLedgerMessage(ledger, clusterId, (message) => {
128
+ writer.write({ record_type: 'ledger_message', message });
129
+ ledgerMessages += 1;
130
+ });
131
+ const ordered = [...causes.entries()].sort(([left], [right]) => compareText(left, right));
132
+ for (const [taskId, cause] of ordered) {
133
+ taskOutputBytes += streamTask({
134
+ writer,
135
+ taskId,
136
+ cause,
137
+ readTask,
138
+ allowedLogRoot,
139
+ issues,
140
+ }).bytes;
141
+ }
142
+ issues.sort(compareText);
143
+ writer.finish({
144
+ record_type: 'footer',
145
+ complete: issues.length === 0,
146
+ ledger_messages: ledgerMessages,
147
+ tasks: causes.size,
148
+ task_output_bytes: taskOutputBytes,
149
+ issues,
150
+ });
151
+ } finally {
152
+ destination.close();
153
+ }
154
+ }
155
+
156
+ export = {
157
+ TRACE_OUTPUT_CHUNK_BYTES,
158
+ collectTaskCauses,
159
+ expectedLogPath,
160
+ hasTerminalTaskStatus,
161
+ logicalTaskRef,
162
+ readTraceTask,
163
+ streamClusterTraceExport,
164
+ };
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.writeUnavailableOutput = writeUnavailableOutput;
4
+ function writeUnavailableOutput(writer, taskId, rawOutputRef) {
5
+ writer.write({
6
+ record_type: 'task_output_end',
7
+ task_id: taskId,
8
+ raw_output_ref: rawOutputRef,
9
+ available: false,
10
+ complete: false,
11
+ byte_length: null,
12
+ chunks: 0,
13
+ sha256: null,
14
+ });
15
+ }
@@ -0,0 +1,18 @@
1
+ import type { RecordWriter } from './export-stream';
2
+
3
+ export function writeUnavailableOutput(
4
+ writer: RecordWriter,
5
+ taskId: string,
6
+ rawOutputRef: string
7
+ ): void {
8
+ writer.write({
9
+ record_type: 'task_output_end',
10
+ task_id: taskId,
11
+ raw_output_ref: rawOutputRef,
12
+ available: false,
13
+ complete: false,
14
+ byte_length: null,
15
+ chunks: 0,
16
+ sha256: null,
17
+ });
18
+ }
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.writeUnavailableOutput = exports.TRACE_OUTPUT_CHUNK_BYTES = void 0;
4
+ exports.streamTaskOutput = streamTaskOutput;
5
+ const crypto = require("crypto");
6
+ const fs = require("fs");
7
+ const path = require("path");
8
+ const export_stream_1 = require("./export-stream");
9
+ const trace_evidence_1 = require("./trace-evidence");
10
+ const trace_output_record_1 = require("./trace-output-record");
11
+ Object.defineProperty(exports, "writeUnavailableOutput", { enumerable: true, get: function () { return trace_output_record_1.writeUnavailableOutput; } });
12
+ exports.TRACE_OUTPUT_CHUNK_BYTES = 48 * 1024;
13
+ function openTaskLog(expected, taskId, issues) {
14
+ try {
15
+ return fs.openSync(expected, fs.constants.O_RDONLY | (fs.constants.O_NOFOLLOW || 0));
16
+ }
17
+ catch (error) {
18
+ issues.push(`task:${taskId}:${issueForOpenFailure(error)}`);
19
+ return null;
20
+ }
21
+ }
22
+ function captureOpenedTaskLog(fd, options) {
23
+ const { writer, taskId, rawOutputRef, issues } = options;
24
+ let bytes = 0;
25
+ let chunks = 0;
26
+ const digest = crypto.createHash('sha256');
27
+ try {
28
+ const before = fs.fstatSync(fd, { bigint: true });
29
+ if (!before.isFile() || before.size > BigInt(Number.MAX_SAFE_INTEGER)) {
30
+ issues.push(`task:${taskId}:log_not_regular`);
31
+ return { available: false, complete: false, bytes, chunks, sha256: null };
32
+ }
33
+ const targetBytes = Number(before.size);
34
+ while (bytes < targetBytes) {
35
+ const buffer = Buffer.allocUnsafe(Math.min(exports.TRACE_OUTPUT_CHUNK_BYTES, targetBytes - bytes));
36
+ const read = fs.readSync(fd, buffer, 0, buffer.length, bytes);
37
+ if (read === 0)
38
+ break;
39
+ const chunk = read === buffer.length ? buffer : buffer.subarray(0, read);
40
+ digest.update(chunk);
41
+ writer.write({
42
+ record_type: 'task_output_chunk',
43
+ task_id: taskId,
44
+ raw_output_ref: rawOutputRef,
45
+ chunk_index: chunks,
46
+ encoding: 'base64',
47
+ data_base64: chunk.toString('base64'),
48
+ });
49
+ bytes += read;
50
+ chunks += 1;
51
+ }
52
+ const after = fs.fstatSync(fd, { bigint: true });
53
+ const complete = bytes === targetBytes && (0, export_stream_1.sameFileSnapshot)(before, after);
54
+ if (!complete)
55
+ issues.push(`task:${taskId}:log_changed_during_export`);
56
+ return { available: true, complete, bytes, chunks, sha256: digest.digest('hex') };
57
+ }
58
+ catch {
59
+ issues.push(`task:${taskId}:log_read_failed`);
60
+ return { available: true, complete: false, bytes, chunks, sha256: digest.digest('hex') };
61
+ }
62
+ }
63
+ function streamTaskOutput(options) {
64
+ const { writer, taskId, task, allowedLogRoot, rawOutputRef, taskTerminal, issues } = options;
65
+ const expected = (0, trace_evidence_1.expectedLogPath)(allowedLogRoot, taskId);
66
+ const recorded = (0, export_stream_1.nullableString)(task.logFile);
67
+ if (!expected || !recorded || path.resolve(recorded) !== expected) {
68
+ issues.push(`task:${taskId}:log_reference_invalid`);
69
+ (0, trace_output_record_1.writeUnavailableOutput)(writer, taskId, rawOutputRef);
70
+ return { bytes: 0 };
71
+ }
72
+ const fd = openTaskLog(expected, taskId, issues);
73
+ if (fd === null) {
74
+ (0, trace_output_record_1.writeUnavailableOutput)(writer, taskId, rawOutputRef);
75
+ return { bytes: 0 };
76
+ }
77
+ let captured;
78
+ try {
79
+ captured = captureOpenedTaskLog(fd, { writer, taskId, rawOutputRef, issues });
80
+ }
81
+ finally {
82
+ fs.closeSync(fd);
83
+ }
84
+ writer.write({
85
+ record_type: 'task_output_end',
86
+ task_id: taskId,
87
+ raw_output_ref: rawOutputRef,
88
+ available: captured.available,
89
+ complete: captured.complete && taskTerminal,
90
+ byte_length: captured.available ? captured.bytes : null,
91
+ chunks: captured.chunks,
92
+ sha256: captured.sha256,
93
+ });
94
+ return { bytes: captured.bytes };
95
+ }
96
+ function issueForOpenFailure(error) {
97
+ return (0, export_stream_1.isRecord)(error) && error.code === 'ENOENT' ? 'log_missing' : 'log_unreadable';
98
+ }
@@ -0,0 +1,119 @@
1
+ import crypto = require('crypto');
2
+ import fs = require('fs');
3
+ import path = require('path');
4
+ import { isRecord, nullableString, type RecordWriter, sameFileSnapshot } from './export-stream';
5
+ import { expectedLogPath, type TraceTask } from './trace-evidence';
6
+ import { writeUnavailableOutput } from './trace-output-record';
7
+
8
+ export const TRACE_OUTPUT_CHUNK_BYTES = 48 * 1024;
9
+
10
+ interface OutputCapture {
11
+ bytes: number;
12
+ }
13
+
14
+ interface CapturedTaskOutput extends OutputCapture {
15
+ available: boolean;
16
+ complete: boolean;
17
+ chunks: number;
18
+ sha256: string | null;
19
+ }
20
+
21
+ interface StreamTaskOutputOptions {
22
+ writer: RecordWriter;
23
+ taskId: string;
24
+ task: TraceTask;
25
+ allowedLogRoot: string;
26
+ rawOutputRef: string;
27
+ taskTerminal: boolean;
28
+ issues: string[];
29
+ }
30
+
31
+ function openTaskLog(expected: string, taskId: string, issues: string[]): number | null {
32
+ try {
33
+ return fs.openSync(expected, fs.constants.O_RDONLY | (fs.constants.O_NOFOLLOW || 0));
34
+ } catch (error) {
35
+ issues.push(`task:${taskId}:${issueForOpenFailure(error)}`);
36
+ return null;
37
+ }
38
+ }
39
+
40
+ function captureOpenedTaskLog(
41
+ fd: number,
42
+ options: Pick<StreamTaskOutputOptions, 'writer' | 'taskId' | 'rawOutputRef' | 'issues'>
43
+ ): CapturedTaskOutput {
44
+ const { writer, taskId, rawOutputRef, issues } = options;
45
+ let bytes = 0;
46
+ let chunks = 0;
47
+ const digest = crypto.createHash('sha256');
48
+ try {
49
+ const before = fs.fstatSync(fd, { bigint: true });
50
+ if (!before.isFile() || before.size > BigInt(Number.MAX_SAFE_INTEGER)) {
51
+ issues.push(`task:${taskId}:log_not_regular`);
52
+ return { available: false, complete: false, bytes, chunks, sha256: null };
53
+ }
54
+ const targetBytes = Number(before.size);
55
+ while (bytes < targetBytes) {
56
+ const buffer = Buffer.allocUnsafe(Math.min(TRACE_OUTPUT_CHUNK_BYTES, targetBytes - bytes));
57
+ const read = fs.readSync(fd, buffer, 0, buffer.length, bytes);
58
+ if (read === 0) break;
59
+ const chunk = read === buffer.length ? buffer : buffer.subarray(0, read);
60
+ digest.update(chunk);
61
+ writer.write({
62
+ record_type: 'task_output_chunk',
63
+ task_id: taskId,
64
+ raw_output_ref: rawOutputRef,
65
+ chunk_index: chunks,
66
+ encoding: 'base64',
67
+ data_base64: chunk.toString('base64'),
68
+ });
69
+ bytes += read;
70
+ chunks += 1;
71
+ }
72
+ const after = fs.fstatSync(fd, { bigint: true });
73
+ const complete = bytes === targetBytes && sameFileSnapshot(before, after);
74
+ if (!complete) issues.push(`task:${taskId}:log_changed_during_export`);
75
+ return { available: true, complete, bytes, chunks, sha256: digest.digest('hex') };
76
+ } catch {
77
+ issues.push(`task:${taskId}:log_read_failed`);
78
+ return { available: true, complete: false, bytes, chunks, sha256: digest.digest('hex') };
79
+ }
80
+ }
81
+
82
+ export function streamTaskOutput(options: StreamTaskOutputOptions): OutputCapture {
83
+ const { writer, taskId, task, allowedLogRoot, rawOutputRef, taskTerminal, issues } = options;
84
+ const expected = expectedLogPath(allowedLogRoot, taskId);
85
+ const recorded = nullableString(task.logFile);
86
+ if (!expected || !recorded || path.resolve(recorded) !== expected) {
87
+ issues.push(`task:${taskId}:log_reference_invalid`);
88
+ writeUnavailableOutput(writer, taskId, rawOutputRef);
89
+ return { bytes: 0 };
90
+ }
91
+ const fd = openTaskLog(expected, taskId, issues);
92
+ if (fd === null) {
93
+ writeUnavailableOutput(writer, taskId, rawOutputRef);
94
+ return { bytes: 0 };
95
+ }
96
+ let captured: CapturedTaskOutput;
97
+ try {
98
+ captured = captureOpenedTaskLog(fd, { writer, taskId, rawOutputRef, issues });
99
+ } finally {
100
+ fs.closeSync(fd);
101
+ }
102
+ writer.write({
103
+ record_type: 'task_output_end',
104
+ task_id: taskId,
105
+ raw_output_ref: rawOutputRef,
106
+ available: captured.available,
107
+ complete: captured.complete && taskTerminal,
108
+ byte_length: captured.available ? captured.bytes : null,
109
+ chunks: captured.chunks,
110
+ sha256: captured.sha256,
111
+ });
112
+ return { bytes: captured.bytes };
113
+ }
114
+
115
+ function issueForOpenFailure(error: unknown): 'log_missing' | 'log_unreadable' {
116
+ return isRecord(error) && error.code === 'ENOENT' ? 'log_missing' : 'log_unreadable';
117
+ }
118
+
119
+ export { writeUnavailableOutput };
@@ -1 +1 @@
1
- {"version":3,"file":"log-prefix.d.ts","sourceRoot":"","sources":["../../src/agent-cli-provider/log-prefix.ts"],"names":[],"mappings":"AAAA,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAmBzD"}
1
+ {"version":3,"file":"log-prefix.d.ts","sourceRoot":"","sources":["../../src/agent-cli-provider/log-prefix.ts"],"names":[],"mappings":"AASA,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAezD"}
@@ -1,15 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.stripTimestampPrefix = stripTimestampPrefix;
4
+ // The canonical decoder is maintained JavaScript and remains at the same source path after build.
5
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
6
+ const taskLogDecoder = require('../../src/task-log-line');
7
+ const { decodeTaskLogLine } = taskLogDecoder;
4
8
  function stripTimestampPrefix(line) {
5
- let trimmed = line.trim().replace(/\r$/, '');
9
+ const decoded = decodeTaskLogLine(line.trim());
10
+ if (!decoded.providerOutput)
11
+ return '';
12
+ let trimmed = decoded.content;
6
13
  if (!trimmed)
7
14
  return '';
8
- const timestampMatch = /^\[(\d{13})\](.*)$/.exec(trimmed);
9
- const timestampRemainder = timestampMatch?.[2];
10
- if (typeof timestampRemainder === 'string') {
11
- trimmed = timestampRemainder.trimStart();
12
- }
13
15
  if (!trimmed.startsWith('{') && !trimmed.startsWith('[')) {
14
16
  const pipeMatch = /^[^|]{1,40}\|\s*(.*)$/.exec(trimmed);
15
17
  const afterPipe = pipeMatch?.[1]?.trimStart();
@@ -1 +1 @@
1
- {"version":3,"file":"log-prefix.js","sourceRoot":"","sources":["../../src/agent-cli-provider/log-prefix.ts"],"names":[],"mappings":";;AAAA,oDAmBC;AAnBD,SAAgB,oBAAoB,CAAC,IAAY;IAC/C,IAAI,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAC7C,IAAI,CAAC,OAAO;QAAE,OAAO,EAAE,CAAC;IAExB,MAAM,cAAc,GAAG,oBAAoB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC1D,MAAM,kBAAkB,GAAG,cAAc,EAAE,CAAC,CAAC,CAAC,CAAC;IAC/C,IAAI,OAAO,kBAAkB,KAAK,QAAQ,EAAE,CAAC;QAC3C,OAAO,GAAG,kBAAkB,CAAC,SAAS,EAAE,CAAC;IAC3C,CAAC;IAED,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QACzD,MAAM,SAAS,GAAG,uBAAuB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACxD,MAAM,SAAS,GAAG,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC;QAC9C,IAAI,OAAO,SAAS,KAAK,QAAQ,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;YAC9F,OAAO,SAAS,CAAC;QACnB,CAAC;IACH,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
1
+ {"version":3,"file":"log-prefix.js","sourceRoot":"","sources":["../../src/agent-cli-provider/log-prefix.ts"],"names":[],"mappings":";;AASA,oDAeC;AApBD,kGAAkG;AAClG,mEAAmE;AACnE,MAAM,cAAc,GAAmB,OAAO,CAAC,yBAAyB,CAAC,CAAC;AAC1E,MAAM,EAAE,iBAAiB,EAAE,GAAG,cAAc,CAAC;AAE7C,SAAgB,oBAAoB,CAAC,IAAY;IAC/C,MAAM,OAAO,GAAG,iBAAiB,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;IAC/C,IAAI,CAAC,OAAO,CAAC,cAAc;QAAE,OAAO,EAAE,CAAC;IACvC,IAAI,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAC9B,IAAI,CAAC,OAAO;QAAE,OAAO,EAAE,CAAC;IAExB,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QACzD,MAAM,SAAS,GAAG,uBAAuB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACxD,MAAM,SAAS,GAAG,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC;QAC9C,IAAI,OAAO,SAAS,KAAK,QAAQ,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;YAC9F,OAAO,SAAS,CAAC;QACnB,CAAC;IACH,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -7,18 +7,19 @@
7
7
  // The runtime facade is maintained JavaScript; keep its original emitted require path.
8
8
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
9
9
  const { getProvider, listProviders } = require('../src/providers');
10
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
11
+ const taskLogDecoder = require('../src/task-log-line');
12
+ const { decodeTaskLogLine } = taskLogDecoder;
10
13
  function createProviderParsers() {
11
14
  return listProviders().map((name) => getProvider(name));
12
15
  }
13
16
  function stripTimestampPrefix(line) {
14
17
  if (!line || typeof line !== 'string')
15
18
  return '';
16
- let trimmed = line.trim().replace(/\r$/, '');
17
- if (!trimmed)
19
+ const decoded = decodeTaskLogLine(line.trim());
20
+ if (!decoded.providerOutput)
18
21
  return '';
19
- const tsMatch = /^\[(\d{13})\](.*)$/.exec(trimmed);
20
- if (tsMatch)
21
- trimmed = (tsMatch[2] || '').trimStart();
22
+ const trimmed = decoded.content;
22
23
  if (!trimmed.startsWith('{') && !trimmed.startsWith('[')) {
23
24
  const pipeMatch = /^[^|]{1,40}\|\s*(.*)$/.exec(trimmed);
24
25
  if (pipeMatch) {
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@the-open-engine/zeroshot",
3
- "version": "6.39.2",
3
+ "version": "6.40.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@the-open-engine/zeroshot",
9
- "version": "6.39.2",
9
+ "version": "6.40.0",
10
10
  "hasInstallScript": true,
11
11
  "license": "MIT",
12
12
  "dependencies": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@the-open-engine/zeroshot",
3
- "version": "6.39.2",
3
+ "version": "6.40.0",
4
4
  "description": "Independent executor–verifier orchestration for software changes.",
5
5
  "main": "src/orchestrator.js",
6
6
  "bin": {
@@ -29,7 +29,7 @@
29
29
  ]
30
30
  },
31
31
  "scripts": {
32
- "pretest": "npm run build:agent-cli-provider && npm run build:target && npm run build:legacy-lib && npm run build:legacy-runtime && npm run build:task-lib",
32
+ "pretest": "npm run build:agent-cli-provider && npm run build:target && npm run build:legacy-lib && npm run build:legacy-runtime && npm run build:task-lib && npm run build:cli-runtime",
33
33
  "test": "node tests/run-tests.js",
34
34
  "test:unit": "node tests/run-tests.js",
35
35
  "test:e2e": "mocha 'tests/e2e/**/*.test.js' --timeout 120000",
@@ -55,6 +55,7 @@
55
55
  "typecheck:cluster": "tsc --project tsconfig.cluster.json",
56
56
  "lint:agent-cli-provider": "eslint \"src/agent-cli-provider/**/*.ts\" \"tests/agent-cli-provider/**/*.ts\"",
57
57
  "build:agent-cli-provider": "tsc --project tsconfig.agent-cli-provider.build.json",
58
+ "build:cli-runtime": "node scripts/build-cli-runtime.js",
58
59
  "build:legacy-lib": "tsc --project tsconfig.legacy-lib.build.json",
59
60
  "build:legacy-runtime": "tsc --project tsconfig.legacy-runtime.build.json",
60
61
  "build:task-lib": "tsc --project tsconfig.task-lib.build.json",
@@ -97,9 +98,9 @@
97
98
  "release:preflight": "node scripts/release-preflight.js",
98
99
  "release:recover": "node scripts/release-recovery.js",
99
100
  "release:assert-published": "node scripts/assert-release-published.js",
100
- "prepack": "npm run build:cluster && npm run build:target && npm run build:legacy-lib && npm run build:legacy-runtime && npm run build:task-lib",
101
+ "prepack": "npm run build:cluster && npm run build:target && npm run build:legacy-lib && npm run build:legacy-runtime && npm run build:task-lib && npm run build:cli-runtime",
101
102
  "prepublishOnly": "npm run lint && npm run typecheck && npm run check:agent-cli-provider:ci",
102
- "prepare": "npm run build:agent-cli-provider && npm run build:target && npm run build:legacy-lib && npm run build:legacy-runtime && npm run build:task-lib && husky"
103
+ "prepare": "npm run build:agent-cli-provider && npm run build:target && npm run build:legacy-lib && npm run build:legacy-runtime && npm run build:task-lib && npm run build:cli-runtime && husky"
103
104
  },
104
105
  "c8": {
105
106
  "reporter": [
@@ -181,6 +182,7 @@
181
182
  "docker/",
182
183
  "!docker/zeroshot-oecp/",
183
184
  "scripts/",
185
+ "!scripts/build-cli-runtime.js",
184
186
  "!scripts/hosted-oecp-ci-relevance.js",
185
187
  "!scripts/hosted-oecp-image.js",
186
188
  "!scripts/hosted-oecp-image-commands.js",