@relayflows/sdk 2.0.26 → 2.0.28
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/dist/authored-flow-executor.d.ts +8 -1
- package/dist/authored-flow-executor.d.ts.map +1 -1
- package/dist/authored-flow-executor.js +16 -7
- package/dist/authored-flow-executor.js.map +1 -1
- package/dist/authored-flow-lifecycle.d.ts +68 -1
- package/dist/authored-flow-lifecycle.d.ts.map +1 -1
- package/dist/authored-flow-lifecycle.js +108 -10
- package/dist/authored-flow-lifecycle.js.map +1 -1
- package/dist/authored-flow-operation.d.ts +9 -1
- package/dist/authored-flow-operation.d.ts.map +1 -1
- package/dist/authored-flow-operation.js +7 -1
- package/dist/authored-flow-operation.js.map +1 -1
- package/dist/authored-node-entry.js +4 -0
- package/dist/authored-node-entry.js.map +1 -1
- package/dist/authored-node-runner.d.ts.map +1 -1
- package/dist/authored-node-runner.js +2 -1
- package/dist/authored-node-runner.js.map +1 -1
- package/dist/authored-promise-graph.d.ts +19 -4
- package/dist/authored-promise-graph.d.ts.map +1 -1
- package/dist/authored-promise-graph.js +44 -19
- package/dist/authored-promise-graph.js.map +1 -1
- package/dist/authored-root.d.ts +2 -0
- package/dist/authored-root.d.ts.map +1 -1
- package/dist/authored-root.js +2 -0
- package/dist/authored-root.js.map +1 -1
- package/dist/authored-step-graph.d.ts +83 -0
- package/dist/authored-step-graph.d.ts.map +1 -0
- package/dist/authored-step-graph.js +217 -0
- package/dist/authored-step-graph.js.map +1 -0
- package/dist/authored-step-index.d.ts +30 -0
- package/dist/authored-step-index.d.ts.map +1 -1
- package/dist/authored-step-index.js +26 -1
- package/dist/authored-step-index.js.map +1 -1
- package/dist/authored-step-output.d.ts +3 -0
- package/dist/authored-step-output.d.ts.map +1 -1
- package/dist/authored-step-output.js +4 -2
- package/dist/authored-step-output.js.map +1 -1
- package/dist/authored-worker-step.d.ts +3 -1
- package/dist/authored-worker-step.d.ts.map +1 -1
- package/dist/authored-worker-step.js +25 -6
- package/dist/authored-worker-step.js.map +1 -1
- package/dist/cli/direct-run.d.ts.map +1 -1
- package/dist/cli/direct-run.js +5 -2
- package/dist/cli/direct-run.js.map +1 -1
- package/dist/cli/run.d.ts +2 -0
- package/dist/cli/run.d.ts.map +1 -1
- package/dist/cli/run.js +9 -5
- package/dist/cli/run.js.map +1 -1
- package/dist/cli/step-excerpt.d.ts +48 -0
- package/dist/cli/step-excerpt.d.ts.map +1 -0
- package/dist/cli/step-excerpt.js +302 -0
- package/dist/cli/step-excerpt.js.map +1 -0
- package/dist/cli/step-failure.d.ts.map +1 -1
- package/dist/cli/step-failure.js +9 -20
- package/dist/cli/step-failure.js.map +1 -1
- package/dist/cli-commands.d.ts +8 -0
- package/dist/cli-commands.d.ts.map +1 -1
- package/dist/cli-commands.js +6 -0
- package/dist/cli-commands.js.map +1 -1
- package/dist/cli.d.ts +2 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +38 -7
- package/dist/cli.js.map +1 -1
- package/dist/cloud-transcript-codex.d.ts +42 -0
- package/dist/cloud-transcript-codex.d.ts.map +1 -0
- package/dist/cloud-transcript-codex.js +411 -0
- package/dist/cloud-transcript-codex.js.map +1 -0
- package/dist/cloud-transcript-types.d.ts +161 -0
- package/dist/cloud-transcript-types.d.ts.map +1 -0
- package/dist/cloud-transcript-types.js +47 -0
- package/dist/cloud-transcript-types.js.map +1 -0
- package/dist/cloud-transcript.d.ts +2 -78
- package/dist/cloud-transcript.d.ts.map +1 -1
- package/dist/cloud-transcript.js +36 -38
- package/dist/cloud-transcript.js.map +1 -1
- package/dist/failure-kinds.d.ts +10 -2
- package/dist/failure-kinds.d.ts.map +1 -1
- package/dist/failure-kinds.js.map +1 -1
- package/dist/journal-client.d.ts +8 -2
- package/dist/journal-client.d.ts.map +1 -1
- package/dist/journal-client.js +22 -6
- package/dist/journal-client.js.map +1 -1
- package/dist/llm-worker.d.ts +2 -1
- package/dist/llm-worker.d.ts.map +1 -1
- package/dist/llm-worker.js +5 -2
- package/dist/llm-worker.js.map +1 -1
- package/dist/local-agent.d.ts +1 -1
- package/dist/local-agent.d.ts.map +1 -1
- package/dist/local-agent.js +8 -3
- package/dist/local-agent.js.map +1 -1
- package/dist/preflight.d.ts.map +1 -1
- package/dist/preflight.js +29 -3
- package/dist/preflight.js.map +1 -1
- package/dist/promise-ancestry.d.ts +20 -0
- package/dist/promise-ancestry.d.ts.map +1 -0
- package/dist/promise-ancestry.js +104 -0
- package/dist/promise-ancestry.js.map +1 -0
- package/dist/validate.d.ts.map +1 -1
- package/dist/validate.js +7 -0
- package/dist/validate.js.map +1 -1
- package/dist/worker-cli.d.ts +7 -0
- package/dist/worker-cli.d.ts.map +1 -1
- package/dist/worker-cli.js +42 -10
- package/dist/worker-cli.js.map +1 -1
- package/dist/worker-slots.d.ts +42 -0
- package/dist/worker-slots.d.ts.map +1 -0
- package/dist/worker-slots.js +94 -0
- package/dist/worker-slots.js.map +1 -0
- package/package.json +2 -2
- package/src/authored-flow-executor.ts +22 -3
- package/src/authored-flow-lifecycle.ts +111 -16
- package/src/authored-flow-operation.ts +10 -0
- package/src/authored-node-entry.ts +4 -1
- package/src/authored-node-runner.ts +2 -1
- package/src/authored-promise-graph.ts +46 -19
- package/src/authored-root.ts +4 -0
- package/src/authored-step-graph.ts +246 -0
- package/src/authored-step-index.ts +44 -1
- package/src/authored-step-output.ts +7 -3
- package/src/authored-worker-step.ts +25 -6
- package/src/cli/direct-run.ts +5 -2
- package/src/cli/run.ts +11 -4
- package/src/cli/step-excerpt.ts +332 -0
- package/src/cli/step-failure.ts +9 -20
- package/src/cli-commands.ts +6 -0
- package/src/cli.ts +40 -9
- package/src/cloud-transcript-codex.ts +429 -0
- package/src/cloud-transcript-types.ts +214 -0
- package/src/cloud-transcript.ts +44 -136
- package/src/failure-kinds.ts +10 -2
- package/src/journal-client.ts +25 -6
- package/src/llm-worker.ts +7 -2
- package/src/local-agent.ts +8 -2
- package/src/preflight.ts +37 -2
- package/src/promise-ancestry.ts +98 -0
- package/src/validate.ts +7 -0
- package/src/worker-cli.ts +41 -9
- package/src/worker-slots.ts +92 -0
|
@@ -0,0 +1,411 @@
|
|
|
1
|
+
// The Codex half of `flows logs --step`: `codex exec --json` JSONL.
|
|
2
|
+
//
|
|
3
|
+
// The vocabulary was captured, not guessed. Every frame shape read here came
|
|
4
|
+
// out of a real `codex exec --json` run of codex-cli 0.155.1 on 2026-09-21;
|
|
5
|
+
// the captures are the two fixtures under `tests/fixtures/`, and the event and
|
|
6
|
+
// item names are the ones the binary's own enums carry (`thread.started`,
|
|
7
|
+
// `turn.started`, `turn.completed`, `turn.failed`, `item.started`,
|
|
8
|
+
// `item.updated`, `item.completed`, `error`; items `agent_message`,
|
|
9
|
+
// `reasoning`, `command_execution`, `file_change`, `mcp_tool_call`,
|
|
10
|
+
// `web_search`, `todo_list`, `error`). `web_search` and `todo_list` keep the
|
|
11
|
+
// unknown-frame placeholder: naming an item type is not the same as knowing
|
|
12
|
+
// which of its fields carry what, and a placeholder is honest.
|
|
13
|
+
//
|
|
14
|
+
// The two rules `cloud-transcript.ts` states hold here too. Nothing is
|
|
15
|
+
// dropped: an item this module cannot read becomes the placeholder line rather
|
|
16
|
+
// than vanishing or being reported as a success. And every provider string is
|
|
17
|
+
// redacted whole before it is bounded, because a truncated credential still
|
|
18
|
+
// matches nothing and is still most of a credential.
|
|
19
|
+
import { ERROR_MAX_CHARS, OUTPUT_MAX_CHARS, OUTPUT_MAX_LINES, PATH_MAX_CHARS, TARGET_MAX_CHARS, isRecord, num, oneLine, safe, separator, str, thousands, } from './cloud-transcript-types.js';
|
|
20
|
+
/** Frame types that make a log a transcript this module can render. */
|
|
21
|
+
export const CODEX_FRAME_TYPES = new Set([
|
|
22
|
+
'thread.started', 'turn.started', 'turn.completed', 'turn.failed',
|
|
23
|
+
'item.started', 'item.updated', 'item.completed', 'error',
|
|
24
|
+
]);
|
|
25
|
+
/** Item types whose lifecycles are matched and whose fields are read. */
|
|
26
|
+
const SUPPORTED_ITEMS = new Set([
|
|
27
|
+
'agent_message', 'reasoning', 'command_execution', 'file_change', 'mcp_tool_call', 'error',
|
|
28
|
+
]);
|
|
29
|
+
const ITEM_FRAMES = new Set(['item.started', 'item.updated', 'item.completed']);
|
|
30
|
+
/** Calls are numbered; an `apply_patch` is file activity, not a call. */
|
|
31
|
+
const NUMBERED_ITEMS = new Set(['command_execution', 'mcp_tool_call']);
|
|
32
|
+
/**
|
|
33
|
+
* Match item lifecycles locally and in order, rather than by a global set of
|
|
34
|
+
* completed ids.
|
|
35
|
+
*
|
|
36
|
+
* `partition` changes at every attempt marker, thread and turn boundary, so a
|
|
37
|
+
* reused id never reaches across one: an attempt that was killed mid-command
|
|
38
|
+
* keeps its unfinished call even when the next attempt completes the same id.
|
|
39
|
+
* Within a partition a lifecycle is keyed by id *and* item type -- two items
|
|
40
|
+
* that merely share an id are two items -- and a start that arrives after that
|
|
41
|
+
* key already completed opens a new one.
|
|
42
|
+
*/
|
|
43
|
+
export function indexCodexItems(frames) {
|
|
44
|
+
const matched = new Set();
|
|
45
|
+
const emit = new Map();
|
|
46
|
+
const open = new Map();
|
|
47
|
+
let partition = 0;
|
|
48
|
+
for (let index = 0; index < frames.length; index += 1) {
|
|
49
|
+
const frame = frames[index].frame;
|
|
50
|
+
if (!isRecord(frame))
|
|
51
|
+
continue;
|
|
52
|
+
const type = str(frame['type']);
|
|
53
|
+
if (type === null)
|
|
54
|
+
continue;
|
|
55
|
+
if (type.startsWith('relayflow.attempt') || type === 'thread.started' || type.startsWith('turn.')) {
|
|
56
|
+
partition += 1;
|
|
57
|
+
open.clear();
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
if (!ITEM_FRAMES.has(type))
|
|
61
|
+
continue;
|
|
62
|
+
const item = isRecord(frame['item']) ? frame['item'] : null;
|
|
63
|
+
if (item === null)
|
|
64
|
+
continue;
|
|
65
|
+
const id = str(item['id']);
|
|
66
|
+
const itemType = str(item['type']);
|
|
67
|
+
// No id is not a correlation key, and an unsupported item is not one this
|
|
68
|
+
// module can merge. Either way the frame stands where it is.
|
|
69
|
+
if (id === null || itemType === null || !SUPPORTED_ITEMS.has(itemType))
|
|
70
|
+
continue;
|
|
71
|
+
const key = `${partition}\u0000${id}\u0000${itemType}`;
|
|
72
|
+
let lifecycle = open.get(key);
|
|
73
|
+
if (lifecycle === undefined || lifecycle.complete) {
|
|
74
|
+
lifecycle = { snapshots: [], complete: false, at: index };
|
|
75
|
+
open.set(key, lifecycle);
|
|
76
|
+
}
|
|
77
|
+
lifecycle.snapshots.push(item);
|
|
78
|
+
lifecycle.complete ||= type === 'item.completed';
|
|
79
|
+
emit.delete(lifecycle.at);
|
|
80
|
+
lifecycle.at = index;
|
|
81
|
+
emit.set(index, lifecycle);
|
|
82
|
+
matched.add(index);
|
|
83
|
+
}
|
|
84
|
+
return { matched, emit };
|
|
85
|
+
}
|
|
86
|
+
function bounded(text, clean, limit = TARGET_MAX_CHARS) {
|
|
87
|
+
return oneLine(clean(text), limit);
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* The textual content of an MCP result, as one string. `content` is a string
|
|
91
|
+
* or the MCP content-block array; a block that carries no text (an image, say)
|
|
92
|
+
* contributes nothing, exactly as `textChars` counts nothing for it.
|
|
93
|
+
*/
|
|
94
|
+
function mcpResultText(result) {
|
|
95
|
+
const content = result['content'];
|
|
96
|
+
if (typeof content === 'string')
|
|
97
|
+
return content.length === 0 ? null : content;
|
|
98
|
+
const parts = [];
|
|
99
|
+
if (Array.isArray(content)) {
|
|
100
|
+
for (const block of content) {
|
|
101
|
+
if (!isRecord(block))
|
|
102
|
+
continue;
|
|
103
|
+
const text = str(block['text']);
|
|
104
|
+
if (text !== null && text.length > 0)
|
|
105
|
+
parts.push(text);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
if (parts.length > 0)
|
|
109
|
+
return parts.join('\n');
|
|
110
|
+
// A result can be structured only; showing it beats reporting a size alone.
|
|
111
|
+
const structured = result['structured_content'];
|
|
112
|
+
return structured === undefined || structured === null ? null : JSON.stringify(structured);
|
|
113
|
+
}
|
|
114
|
+
/** A result's size, never its content. */
|
|
115
|
+
function textChars(content) {
|
|
116
|
+
if (typeof content === 'string')
|
|
117
|
+
return content.length;
|
|
118
|
+
if (!Array.isArray(content))
|
|
119
|
+
return 0;
|
|
120
|
+
let total = 0;
|
|
121
|
+
for (const block of content)
|
|
122
|
+
if (isRecord(block))
|
|
123
|
+
total += str(block['text'])?.length ?? 0;
|
|
124
|
+
return total;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Redact the whole output, then cut it. Both bounds are applied and either one
|
|
128
|
+
* sets the flag, so the reader is told the excerpt is short of the size the
|
|
129
|
+
* call reported.
|
|
130
|
+
*/
|
|
131
|
+
function excerpt(output, clean) {
|
|
132
|
+
const cleaned = clean(output).replace(/\n+$/u, '');
|
|
133
|
+
const lines = cleaned.split('\n');
|
|
134
|
+
let truncated = lines.length > OUTPUT_MAX_LINES;
|
|
135
|
+
let text = lines.slice(0, OUTPUT_MAX_LINES).join('\n');
|
|
136
|
+
if (text.length > OUTPUT_MAX_CHARS) {
|
|
137
|
+
text = text.slice(0, OUTPUT_MAX_CHARS);
|
|
138
|
+
truncated = true;
|
|
139
|
+
}
|
|
140
|
+
return { text, truncated };
|
|
141
|
+
}
|
|
142
|
+
function placeholder(context, itemType) {
|
|
143
|
+
const label = itemType === null ? context.type : `${context.type}/${itemType}`;
|
|
144
|
+
return { kind: 'unknown', type: context.clean(label), chars: context.line.length };
|
|
145
|
+
}
|
|
146
|
+
function tool(name, target, resultChars, isError, codex) {
|
|
147
|
+
return { kind: 'tool', name, target, result_chars: resultChars, is_error: isError, nested: false, codex };
|
|
148
|
+
}
|
|
149
|
+
function commandEntry(item, complete, context, seq) {
|
|
150
|
+
const command = item['command'];
|
|
151
|
+
if (typeof command !== 'string')
|
|
152
|
+
return null;
|
|
153
|
+
const output = typeof item['aggregated_output'] === 'string' ? item['aggregated_output'] : null;
|
|
154
|
+
const cut = output === null ? null : excerpt(output, context.clean);
|
|
155
|
+
const exitCode = num(item['exit_code']);
|
|
156
|
+
const status = str(item['status']);
|
|
157
|
+
return tool('command_execution', bounded(command, context.clean), output === null ? null : output.length, status === 'failed' || (exitCode !== null && exitCode !== 0), {
|
|
158
|
+
seq, status: status === null ? null : bounded(status, context.clean, 40),
|
|
159
|
+
exit_code: exitCode, output_excerpt: cut === null ? null : cut.text,
|
|
160
|
+
output_truncated: cut?.truncated === true, complete, error: null,
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
/** `{"message": "..."}` is the shape both `turn.failed` and a failed call use. */
|
|
164
|
+
function errorText(value) {
|
|
165
|
+
if (typeof value === 'string')
|
|
166
|
+
return value;
|
|
167
|
+
return isRecord(value) ? str(value['message']) : null;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Redact every string an argument value carries, while each one is still the
|
|
171
|
+
* string the provider decoded.
|
|
172
|
+
*
|
|
173
|
+
* `redact` matches an environment value literally, and `JSON.stringify` escapes
|
|
174
|
+
* a quote, backslash, newline or tab inside one -- so a secret containing any
|
|
175
|
+
* of them no longer matches its own value once serialized, and reached the page
|
|
176
|
+
* escaped but complete. Keys are provider strings too: an argument object built
|
|
177
|
+
* out of an environment dump carries the value in the name.
|
|
178
|
+
*/
|
|
179
|
+
function redactLeaves(value, clean) {
|
|
180
|
+
if (typeof value === 'string')
|
|
181
|
+
return clean(value);
|
|
182
|
+
if (Array.isArray(value))
|
|
183
|
+
return value.map((element) => redactLeaves(element, clean));
|
|
184
|
+
if (!isRecord(value))
|
|
185
|
+
return value;
|
|
186
|
+
const out = {};
|
|
187
|
+
for (const [key, element] of Object.entries(value))
|
|
188
|
+
out[clean(key)] = redactLeaves(element, clean);
|
|
189
|
+
return out;
|
|
190
|
+
}
|
|
191
|
+
function mcpEntry(item, complete, context, seq) {
|
|
192
|
+
const server = str(item['server']);
|
|
193
|
+
const name = str(item['tool']);
|
|
194
|
+
if (server === null && name === null)
|
|
195
|
+
return null;
|
|
196
|
+
const args = item['arguments'];
|
|
197
|
+
// Redacted twice, bounded once, and in that order. The leaves go first,
|
|
198
|
+
// before serialization can escape a secret out of its own match; the
|
|
199
|
+
// serialized form is redacted again by the `bounded` call below, because
|
|
200
|
+
// `redact` recognises a credential field by its name and a leaf standing on
|
|
201
|
+
// its own has no name left to recognise. Only then is the line cut.
|
|
202
|
+
const rendered = args === undefined || args === null
|
|
203
|
+
? '' : ` ${JSON.stringify(redactLeaves(args, context.clean))}`;
|
|
204
|
+
const result = isRecord(item['result']) ? item['result'] : null;
|
|
205
|
+
const structured = result === null ? null : result['structured_content'];
|
|
206
|
+
const failure = errorText(item['error']);
|
|
207
|
+
const status = str(item['status']);
|
|
208
|
+
// The result is evidence: bound and redact it exactly as command output is,
|
|
209
|
+
// instead of reporting a size the reader then has to fetch with `--raw`.
|
|
210
|
+
const text = result === null ? null : mcpResultText(result);
|
|
211
|
+
const cut = text === null ? null : excerpt(text, context.clean);
|
|
212
|
+
return tool('mcp_tool_call', bounded(`${server ?? '?'}/${name ?? '?'}${rendered}`, context.clean), result === null ? null : textChars(result['content']) + (structured === undefined || structured === null
|
|
213
|
+
? 0 : JSON.stringify(structured).length), status === 'failed' || failure !== null, {
|
|
214
|
+
seq, status: status === null ? null : bounded(status, context.clean, 40),
|
|
215
|
+
exit_code: null, output_excerpt: cut === null ? null : cut.text,
|
|
216
|
+
output_truncated: cut?.truncated === true, complete,
|
|
217
|
+
error: failure === null ? null : bounded(failure, context.clean, ERROR_MAX_CHARS),
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
function fileChangeEntry(item, complete, context) {
|
|
221
|
+
const raw = item['changes'];
|
|
222
|
+
if (!Array.isArray(raw))
|
|
223
|
+
return null;
|
|
224
|
+
const changes = [];
|
|
225
|
+
let malformed = 0;
|
|
226
|
+
for (const change of raw) {
|
|
227
|
+
if (!isRecord(change)) {
|
|
228
|
+
malformed += 1;
|
|
229
|
+
continue;
|
|
230
|
+
}
|
|
231
|
+
const path = str(change['path']);
|
|
232
|
+
const kind = str(change['kind']);
|
|
233
|
+
if (path === null && kind === null) {
|
|
234
|
+
malformed += 1;
|
|
235
|
+
continue;
|
|
236
|
+
}
|
|
237
|
+
changes.push({
|
|
238
|
+
path: path === null ? null : bounded(path, context.clean, PATH_MAX_CHARS),
|
|
239
|
+
change: kind === null ? null : bounded(kind, context.clean, 40),
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
const status = str(item['status']);
|
|
243
|
+
return {
|
|
244
|
+
kind: 'file_change', changes, malformed,
|
|
245
|
+
status: status === null ? null : bounded(status, context.clean, 40), complete,
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
function itemEntries(item, complete, context) {
|
|
249
|
+
const itemType = str(item['type']);
|
|
250
|
+
if (itemType === 'agent_message') {
|
|
251
|
+
const text = item['text'];
|
|
252
|
+
if (typeof text !== 'string')
|
|
253
|
+
return [placeholder(context, itemType)];
|
|
254
|
+
return [{ kind: 'message', role: 'assistant', text: context.clean(text), nested: false,
|
|
255
|
+
...(complete ? {} : { complete: false }) }];
|
|
256
|
+
}
|
|
257
|
+
if (itemType === 'reasoning') {
|
|
258
|
+
const text = item['text'];
|
|
259
|
+
// The count, never the text -- the one thing Claude's renderer refuses to
|
|
260
|
+
// print, and Codex is not the place that starts printing it.
|
|
261
|
+
if (typeof text !== 'string')
|
|
262
|
+
return [placeholder(context, itemType)];
|
|
263
|
+
return [{ kind: 'thinking', chars: text.length, nested: false }];
|
|
264
|
+
}
|
|
265
|
+
if (itemType === 'error') {
|
|
266
|
+
const message = errorText(item['message']);
|
|
267
|
+
if (message === null)
|
|
268
|
+
return [placeholder(context, itemType)];
|
|
269
|
+
return [{ kind: 'error', source: 'item', message: bounded(message, context.clean, ERROR_MAX_CHARS) }];
|
|
270
|
+
}
|
|
271
|
+
if (itemType === 'command_execution' || itemType === 'mcp_tool_call') {
|
|
272
|
+
// The number is only spent on a call this module could actually read, so a
|
|
273
|
+
// malformed item leaves no gap in the sequence.
|
|
274
|
+
const seq = context.state.seq + 1;
|
|
275
|
+
const entry = itemType === 'command_execution'
|
|
276
|
+
? commandEntry(item, complete, context, seq) : mcpEntry(item, complete, context, seq);
|
|
277
|
+
if (entry === null)
|
|
278
|
+
return [placeholder(context, itemType)];
|
|
279
|
+
context.state.seq = seq;
|
|
280
|
+
return [entry];
|
|
281
|
+
}
|
|
282
|
+
if (itemType === 'file_change') {
|
|
283
|
+
const entry = fileChangeEntry(item, complete, context);
|
|
284
|
+
return [entry ?? placeholder(context, itemType)];
|
|
285
|
+
}
|
|
286
|
+
return [placeholder(context, itemType)];
|
|
287
|
+
}
|
|
288
|
+
const NO_USAGE = {
|
|
289
|
+
tokens_in: null, tokens_out: null, cache_read: null, cache_creation: null, reasoning_out: null,
|
|
290
|
+
};
|
|
291
|
+
/**
|
|
292
|
+
* One Codex frame's entries, or undefined when the frame belongs to a
|
|
293
|
+
* lifecycle that is reported at a later frame.
|
|
294
|
+
*/
|
|
295
|
+
export function codexFrame(frame, type, index, index_, state, clean, line) {
|
|
296
|
+
const context = { clean, state, line, type };
|
|
297
|
+
if (type === 'thread.started') {
|
|
298
|
+
const id = str(frame['thread_id']);
|
|
299
|
+
return [{ kind: 'thread', thread_id: id === null ? null : bounded(id, clean) }];
|
|
300
|
+
}
|
|
301
|
+
if (type === 'turn.started')
|
|
302
|
+
return [{ kind: 'turn', phase: 'started', ...NO_USAGE }];
|
|
303
|
+
if (type === 'turn.completed') {
|
|
304
|
+
const usage = isRecord(frame['usage']) ? frame['usage'] : null;
|
|
305
|
+
return [{
|
|
306
|
+
kind: 'turn', phase: 'completed',
|
|
307
|
+
tokens_in: usage === null ? null : num(usage['input_tokens']),
|
|
308
|
+
tokens_out: usage === null ? null : num(usage['output_tokens']),
|
|
309
|
+
cache_read: usage === null ? null : num(usage['cached_input_tokens']),
|
|
310
|
+
cache_creation: usage === null ? null : num(usage['cache_write_input_tokens']),
|
|
311
|
+
reasoning_out: usage === null ? null : num(usage['reasoning_output_tokens']),
|
|
312
|
+
}];
|
|
313
|
+
}
|
|
314
|
+
if (type === 'turn.failed' || type === 'error') {
|
|
315
|
+
const message = errorText(type === 'error' ? frame['message'] : frame['error']);
|
|
316
|
+
// A failure with no readable message is still a failure; it must not fall
|
|
317
|
+
// through to anything that reads like success.
|
|
318
|
+
const entry = {
|
|
319
|
+
kind: 'error', source: type,
|
|
320
|
+
message: message === null ? '(no message)' : bounded(message, clean, ERROR_MAX_CHARS),
|
|
321
|
+
};
|
|
322
|
+
return type === 'turn.failed' ? [{ kind: 'turn', phase: 'failed', ...NO_USAGE }, entry] : [entry];
|
|
323
|
+
}
|
|
324
|
+
// Everything left in `CODEX_FRAME_TYPES` is an `item.*` frame.
|
|
325
|
+
const lifecycle = index_.emit.get(index);
|
|
326
|
+
if (lifecycle === undefined) {
|
|
327
|
+
// Part of a lifecycle reported later, or an item this module does not
|
|
328
|
+
// correlate -- no id, an unsupported type, a malformed frame.
|
|
329
|
+
if (index_.matched.has(index))
|
|
330
|
+
return [];
|
|
331
|
+
const item = isRecord(frame['item']) ? frame['item'] : null;
|
|
332
|
+
if (item === null)
|
|
333
|
+
return [placeholder(context, null)];
|
|
334
|
+
return itemEntries(item, type === 'item.completed', context);
|
|
335
|
+
}
|
|
336
|
+
// The latest snapshot wins field by field, so a completion's null exit code
|
|
337
|
+
// is not overwritten by the zero-length output its start reported.
|
|
338
|
+
const merged = Object.assign({}, ...lifecycle.snapshots);
|
|
339
|
+
return itemEntries(merged, lifecycle.complete, context);
|
|
340
|
+
}
|
|
341
|
+
function indented(text) {
|
|
342
|
+
return text.split('\n').map((line) => ` ${safe(line)}`);
|
|
343
|
+
}
|
|
344
|
+
/** The Codex entry kinds. Undefined for everything the Claude renderer owns. */
|
|
345
|
+
export function renderCodexEntry(entry) {
|
|
346
|
+
switch (entry.kind) {
|
|
347
|
+
case 'thread':
|
|
348
|
+
return [`session codex${entry.thread_id === null ? '' : ` · thread ${safe(entry.thread_id)}`}`];
|
|
349
|
+
case 'turn': {
|
|
350
|
+
if (entry.phase === 'started')
|
|
351
|
+
return [separator('turn')];
|
|
352
|
+
if (entry.phase === 'failed')
|
|
353
|
+
return [separator('turn failed')];
|
|
354
|
+
const facts = [
|
|
355
|
+
entry.tokens_in === null && entry.tokens_out === null ? null
|
|
356
|
+
: `${entry.tokens_in === null ? '?' : thousands(entry.tokens_in)} in`
|
|
357
|
+
+ ` / ${entry.tokens_out === null ? '?' : thousands(entry.tokens_out)} out`,
|
|
358
|
+
entry.cache_read === null ? null : `${thousands(entry.cache_read)} cache read`,
|
|
359
|
+
entry.cache_creation === null ? null : `${thousands(entry.cache_creation)} cache write`,
|
|
360
|
+
entry.reasoning_out === null ? null : `${thousands(entry.reasoning_out)} reasoning out`,
|
|
361
|
+
].filter((fact) => fact !== null);
|
|
362
|
+
return [separator(`turn complete${facts.length === 0 ? '' : ` · ${facts.join(' · ')}`}`)];
|
|
363
|
+
}
|
|
364
|
+
case 'error':
|
|
365
|
+
return [entry.source === 'error' ? 'error:' : `error (${safe(entry.source)}):`, ...entry.message.split('\n').map((line) => ` ${safe(line)}`)];
|
|
366
|
+
case 'file_change': {
|
|
367
|
+
const total = entry.changes.length + entry.malformed;
|
|
368
|
+
const state = [
|
|
369
|
+
entry.status === null ? null : safe(entry.status),
|
|
370
|
+
entry.complete ? null : 'no completion frame',
|
|
371
|
+
].filter((fact) => fact !== null);
|
|
372
|
+
const lines = [` files ${total} change${total === 1 ? '' : 's'}`
|
|
373
|
+
+ `${state.length === 0 ? '' : ` · ${state.join(' · ')}`}`];
|
|
374
|
+
for (const change of entry.changes) {
|
|
375
|
+
lines.push(` ${safe(change.change ?? '?')} ${safe(change.path ?? '(no path)')}`);
|
|
376
|
+
}
|
|
377
|
+
if (entry.malformed > 0) {
|
|
378
|
+
lines.push(` ${entry.malformed} change${entry.malformed === 1 ? '' : 's'}`
|
|
379
|
+
+ ' not rendered here — see --raw');
|
|
380
|
+
}
|
|
381
|
+
return lines;
|
|
382
|
+
}
|
|
383
|
+
case 'tool': {
|
|
384
|
+
if (entry.codex === undefined)
|
|
385
|
+
return undefined;
|
|
386
|
+
const codex = entry.codex;
|
|
387
|
+
// The size stays on the line whatever happened: a reviewer reading a
|
|
388
|
+
// failed step needs the exit code, the status and the size together.
|
|
389
|
+
const facts = [
|
|
390
|
+
entry.result_chars === null ? 'no result' : `${thousands(entry.result_chars)} chars`,
|
|
391
|
+
codex.exit_code === null ? null : `exit ${codex.exit_code}`,
|
|
392
|
+
codex.status === null ? null : safe(codex.status),
|
|
393
|
+
codex.complete ? null : 'no completion frame',
|
|
394
|
+
].filter((fact) => fact !== null);
|
|
395
|
+
const lines = [` tool ${codex.seq} ${safe(entry.name)} ${safe(entry.target ?? '')} → ${facts.join(' · ')}`];
|
|
396
|
+
if (codex.error !== null)
|
|
397
|
+
lines.push(...indented(`error ${codex.error}`));
|
|
398
|
+
if (codex.output_excerpt !== null && codex.output_excerpt.length > 0) {
|
|
399
|
+
lines.push(...indented(codex.output_excerpt));
|
|
400
|
+
}
|
|
401
|
+
if (codex.output_truncated) {
|
|
402
|
+
lines.push(` … excerpt cut at ${thousands(OUTPUT_MAX_LINES)} lines`
|
|
403
|
+
+ ` / ${thousands(OUTPUT_MAX_CHARS)} chars — see --raw`);
|
|
404
|
+
}
|
|
405
|
+
return lines;
|
|
406
|
+
}
|
|
407
|
+
default:
|
|
408
|
+
return undefined;
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
//# sourceMappingURL=cloud-transcript-codex.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cloud-transcript-codex.js","sourceRoot":"","sources":["../src/cloud-transcript-codex.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,EAAE;AACF,6EAA6E;AAC7E,4EAA4E;AAC5E,+EAA+E;AAC/E,0EAA0E;AAC1E,mEAAmE;AACnE,oEAAoE;AACpE,oEAAoE;AACpE,6EAA6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AAI,KAAK,IAAI,CAAC,CAAC;YAClD,MAAM,KAAK,GAAG,CAAC,UAAU,KAAK,CAAC,GAAG,KAAK,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,EAAE,CAAC,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;YAChH,IAAI,KAAK,CAAC,KAAK,KAAK,IAAI;gBAAE,KAAK,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,UAAU,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;YAC3E,IAAI,KAAK,CAAC,cAAc,KAAK,IAAI,IAAI,KAAK,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACrE,KAAK,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC;YAChD,CAAC;YACD,IAAI,KAAK,CAAC,gBAAgB,EAAE,CAAC;gBAC3B,KAAK,CAAC,IAAI,CAAC,0BAA0B,SAAS,CAAC,gBAAgB,CAAC,QAAQ;sBACpE,MAAM,SAAS,CAAC,gBAAgB,CAAC,oBAAoB,CAAC,CAAC;YAC7D,CAAC;YACD,OAAO,KAAK,CAAC;QACf,CAAC;QACD;YACE,OAAO,SAAS,CAAC;IACrB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
export interface TranscriptAttempt {
|
|
2
|
+
kind: 'attempt';
|
|
3
|
+
attempt: number | null;
|
|
4
|
+
bytes: number | null;
|
|
5
|
+
truncated: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface TranscriptAttemptOmitted {
|
|
8
|
+
kind: 'attempt_omitted';
|
|
9
|
+
attempt: number | null;
|
|
10
|
+
bytes: number | null;
|
|
11
|
+
}
|
|
12
|
+
export interface TranscriptInit {
|
|
13
|
+
kind: 'init';
|
|
14
|
+
model: string | null;
|
|
15
|
+
version: string | null;
|
|
16
|
+
permission_mode: string | null;
|
|
17
|
+
tools: number | null;
|
|
18
|
+
mcp_servers: number | null;
|
|
19
|
+
session_id: string | null;
|
|
20
|
+
}
|
|
21
|
+
export interface TranscriptMessage {
|
|
22
|
+
kind: 'message';
|
|
23
|
+
role: 'assistant' | 'user';
|
|
24
|
+
text: string;
|
|
25
|
+
/** A frame carrying `parent_tool_use_id`: a subagent's turn, not the main one. */
|
|
26
|
+
nested: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Codex only, and only when false: the message was read off an
|
|
29
|
+
* `item.started`/`item.updated` snapshot that never completed, so the text
|
|
30
|
+
* is what had been written so far and not the whole of it.
|
|
31
|
+
*/
|
|
32
|
+
complete?: boolean;
|
|
33
|
+
}
|
|
34
|
+
export interface TranscriptThinking {
|
|
35
|
+
kind: 'thinking';
|
|
36
|
+
/** The count only. A thinking block's text and signature never reach the page. */
|
|
37
|
+
chars: number;
|
|
38
|
+
nested: boolean;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* The Codex half of a tool call. Present on an entry parsed from a Codex
|
|
42
|
+
* `command_execution` or `mcp_tool_call` item and absent on every Claude
|
|
43
|
+
* entry, which is what the renderer discriminates on: a Codex failure has to
|
|
44
|
+
* keep its exit code, its status and its result size on the same line, where
|
|
45
|
+
* Claude's renderer replaces the size with `ERROR`.
|
|
46
|
+
*/
|
|
47
|
+
export interface TranscriptToolCodex {
|
|
48
|
+
/** The call's position among the calls of its attempt, counted from 1. */
|
|
49
|
+
seq: number;
|
|
50
|
+
/** `in_progress`, `completed` or `failed`, as the item reported it. */
|
|
51
|
+
status: string | null;
|
|
52
|
+
/** Null when the item carried no exit code — not the same fact as exit 0. */
|
|
53
|
+
exit_code: number | null;
|
|
54
|
+
/** Redacted, then bounded. Null when the item carried no output field at all. */
|
|
55
|
+
output_excerpt: string | null;
|
|
56
|
+
/** True when a character or line bound cut the excerpt. */
|
|
57
|
+
output_truncated: boolean;
|
|
58
|
+
/** False when no `item.completed` ever arrived for this call. */
|
|
59
|
+
complete: boolean;
|
|
60
|
+
/** Redacted, then bounded. The item's own failure text. */
|
|
61
|
+
error: string | null;
|
|
62
|
+
}
|
|
63
|
+
export interface TranscriptTool {
|
|
64
|
+
kind: 'tool';
|
|
65
|
+
name: string;
|
|
66
|
+
/** What the call was aimed at: a path, a command, a pattern. Null when the input had no string. */
|
|
67
|
+
target: string | null;
|
|
68
|
+
/** Null when no `tool_result` answered it -- not the same fact as a zero-byte result. */
|
|
69
|
+
result_chars: number | null;
|
|
70
|
+
is_error: boolean;
|
|
71
|
+
nested: boolean;
|
|
72
|
+
/** Codex only. Its presence is what tells the renderer which shape to print. */
|
|
73
|
+
codex?: TranscriptToolCodex;
|
|
74
|
+
}
|
|
75
|
+
/** One `apply_patch` item: file activity, not a tool call, so it is not numbered. */
|
|
76
|
+
export interface TranscriptFileChange {
|
|
77
|
+
kind: 'file_change';
|
|
78
|
+
changes: Array<{
|
|
79
|
+
path: string | null;
|
|
80
|
+
change: string | null;
|
|
81
|
+
}>;
|
|
82
|
+
/** Change elements that were not objects. Counted rather than dropped. */
|
|
83
|
+
malformed: number;
|
|
84
|
+
status: string | null;
|
|
85
|
+
complete: boolean;
|
|
86
|
+
}
|
|
87
|
+
export interface TranscriptThread {
|
|
88
|
+
kind: 'thread';
|
|
89
|
+
thread_id: string | null;
|
|
90
|
+
}
|
|
91
|
+
export interface TranscriptTurn {
|
|
92
|
+
kind: 'turn';
|
|
93
|
+
phase: 'started' | 'completed' | 'failed';
|
|
94
|
+
tokens_in: number | null;
|
|
95
|
+
tokens_out: number | null;
|
|
96
|
+
cache_read: number | null;
|
|
97
|
+
cache_creation: number | null;
|
|
98
|
+
reasoning_out: number | null;
|
|
99
|
+
}
|
|
100
|
+
/** A `turn.failed`, a top-level `error` frame, or an `error` item. */
|
|
101
|
+
export interface TranscriptError {
|
|
102
|
+
kind: 'error';
|
|
103
|
+
/** The frame this came from, so the reader knows what failed. */
|
|
104
|
+
source: string;
|
|
105
|
+
message: string;
|
|
106
|
+
}
|
|
107
|
+
export interface TranscriptResult {
|
|
108
|
+
kind: 'result';
|
|
109
|
+
is_error: boolean;
|
|
110
|
+
subtype: string | null;
|
|
111
|
+
duration_ms: number | null;
|
|
112
|
+
num_turns: number | null;
|
|
113
|
+
total_cost_usd: number | null;
|
|
114
|
+
tokens_in: number | null;
|
|
115
|
+
tokens_out: number | null;
|
|
116
|
+
cache_read: number | null;
|
|
117
|
+
cache_creation: number | null;
|
|
118
|
+
}
|
|
119
|
+
export interface TranscriptUnknown {
|
|
120
|
+
kind: 'unknown';
|
|
121
|
+
type: string;
|
|
122
|
+
chars: number;
|
|
123
|
+
}
|
|
124
|
+
export interface TranscriptUnparsed {
|
|
125
|
+
kind: 'unparsed';
|
|
126
|
+
text: string;
|
|
127
|
+
}
|
|
128
|
+
export type TranscriptEntry = TranscriptAttempt | TranscriptAttemptOmitted | TranscriptInit | TranscriptMessage | TranscriptThinking | TranscriptTool | TranscriptFileChange | TranscriptThread | TranscriptTurn | TranscriptError | TranscriptResult | TranscriptUnknown | TranscriptUnparsed;
|
|
129
|
+
export interface ParsedTranscript {
|
|
130
|
+
entries: TranscriptEntry[];
|
|
131
|
+
/** How many attempts said their head was cut to fit the log cap. */
|
|
132
|
+
truncated_attempts: number;
|
|
133
|
+
/** How many attempts were dropped whole to fit the log cap. */
|
|
134
|
+
omitted_attempts: number;
|
|
135
|
+
/**
|
|
136
|
+
* False when the log carried no frame either vocabulary this module knows --
|
|
137
|
+
* a v1 plain-terminal sandbox log, say. The caller prints it raw rather than
|
|
138
|
+
* claiming an empty transcript.
|
|
139
|
+
*/
|
|
140
|
+
stream_json: boolean;
|
|
141
|
+
}
|
|
142
|
+
/** A command, an argument list or a `server/tool` pair on one line. */
|
|
143
|
+
export declare const TARGET_MAX_CHARS = 160;
|
|
144
|
+
/** A command's or a tool's output excerpt: enough to read, bounded either way. */
|
|
145
|
+
export declare const OUTPUT_MAX_CHARS = 1000;
|
|
146
|
+
export declare const OUTPUT_MAX_LINES = 10;
|
|
147
|
+
/** Provider-supplied failure text. Prose from the agent is the only uncapped string. */
|
|
148
|
+
export declare const ERROR_MAX_CHARS = 1000;
|
|
149
|
+
/** A path stays identifiable, so it is bounded far above a one-line target. */
|
|
150
|
+
export declare const PATH_MAX_CHARS = 200;
|
|
151
|
+
export declare function isRecord(value: unknown): value is Record<string, unknown>;
|
|
152
|
+
export declare function str(value: unknown): string | null;
|
|
153
|
+
export declare function num(value: unknown): number | null;
|
|
154
|
+
/** Collapse to one line and bound it; a tool input can be a whole file body. */
|
|
155
|
+
export declare function oneLine(text: string, limit?: number): string;
|
|
156
|
+
export declare function thousands(value: number): string;
|
|
157
|
+
/** Terminal control characters never reach the page, wherever the text came from. */
|
|
158
|
+
export declare function safe(text: string): string;
|
|
159
|
+
/** One rule with a label, the way an attempt boundary reads. */
|
|
160
|
+
export declare function separator(label: string): string;
|
|
161
|
+
//# sourceMappingURL=cloud-transcript-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cloud-transcript-types.d.ts","sourceRoot":"","sources":["../src/cloud-transcript-types.ts"],"names":[],"mappings":"AAaA,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,iBAAiB,CAAC;IACxB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B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