jg-agent-hq 13.1.1 → 13.1.2
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 +5 -0
- package/README.md +1 -1
- package/api/README.md +1 -1
- package/dist/providers/codex/codex.js +3 -23
- package/dist/providers/codex/constants.d.ts +0 -3
- package/dist/providers/codex/constants.js +0 -5
- package/dist/providers/codex/events.js +8 -15
- package/dist/providers/codex/transformers.d.ts +4 -5
- package/dist/providers/codex/transformers.js +7 -10
- package/dist/providers/codex/types.d.ts +8 -0
- package/dist/providers/codex/types.js +16 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 13.1.2
|
|
4
|
+
|
|
5
|
+
- Preserve native Codex item lifecycle timestamps in history, item details, evidence and live notifications. Operator messages use their own start time and replies their own completion time, retaining millisecond precision. Missing item times remain unknown instead of borrowing a turn time.
|
|
6
|
+
- Remove the extra turn-history requests used only for item timing. Public response shapes, storage schema, action key and native session ownership are unchanged.
|
|
7
|
+
|
|
3
8
|
## 13.1.1
|
|
4
9
|
|
|
5
10
|
- Preserve quarantined Codex controls and their producing runtime epoch during shutdown. Stopping HQ no longer turns unverified native ownership into a managed inactive record or discards its recorded turn, so the next runtime can explicitly recover a still-loaded idle or active session. Queued input stays paused and no input is replayed.
|
package/README.md
CHANGED
|
@@ -47,7 +47,7 @@ Intentional failures use `Exception` from `jg-exception`, with the named string
|
|
|
47
47
|
|
|
48
48
|
## Local controller
|
|
49
49
|
|
|
50
|
-
Install the providers you want and sign in through their native CLIs, then start `jg-agent-hq serve --state-root .runtime --workspace-root /path/to/workspace`. Run `jg-agent-hq status --state-root .runtime` in a client. `threads` lists the sessions of several folders and both providers by last activity, with the sessions the runtime created before their first turn, in pages whose cursor resumes each source where it stopped; see [session discovery](api/README.md#session-discovery). `thread`, `items` and `usage` read native information, and each item carries its time as `createdAt
|
|
50
|
+
Install the providers you want and sign in through their native CLIs, then start `jg-agent-hq serve --state-root .runtime --workspace-root /path/to/workspace`. Run `jg-agent-hq status --state-root .runtime` in a client. `threads` lists the sessions of several folders and both providers by last activity, with the sessions the runtime created before their first turn, in pages whose cursor resumes each source where it stopped; see [session discovery](api/README.md#session-discovery). `thread`, `items` and `usage` read native information, and each item carries its time as `createdAt` (Unix milliseconds, null when unavailable); Codex uses recorded item lifecycle times for saved and live items, without substituting a shared turn time; `thread` answers from the runtime's records, its history unavailable, when its provider can't read it. `item-detail` reads what a developer inspects in one item: its command and output, tool call, file diffs and images, and `item-image` returns one of its images. `stop` waits for confirmed runtime shutdown.
|
|
51
51
|
|
|
52
52
|
The Node API exposes `createAgentHq({ stateRoot, allowedRoots })` and `requestAgentHq(stateRoot, command)`, whose results, like the runtime's `request`, are typed by their command's kind, and `getErrorKind(error)`, which reads an error's safe classification. The runtime's `runtimeEpoch` is the epoch actions name. Configuration comes from these trusted operator inputs. Coding-instruction files are not runtime configuration.
|
|
53
53
|
|
package/api/README.md
CHANGED
|
@@ -371,7 +371,7 @@ Control pages default to 32 and cap at 128. Seek cursors are bound to their comp
|
|
|
371
371
|
|
|
372
372
|
Live item presentation is bounded to 128 items per cached thread, 32 windows and 4 MiB of serialized presentation across the runtime, including escaped text and identifiers. This leaves room inside the IPC response limit. Display text uses the same truncation contract as native history. Eviction, an unavailable window or missing chunks sets `hasGap`. Completed items remain `awaiting-flush` after thread closure until a native history page holds the same item, with exactly matching normalized content or, for an item with an outcome, the same final outcome, or the bounded cache evicts them. The outcome is enough because Codex shortens long command output when it saves it. An item still streaming when its turn ended, such as a message an interrupt or a Codex steer cut, stays `awaiting-flush` until a native history page holds an item of that turn, since the provider may never save it; the history then shows what was saved of it. A client's `items` read is one such page, and when a turn ends the runtime reads that turn's own history too, newest first and at most 8 pages of 128, until none of its finished items remain, so the window doesn't wait on a client that never reads them. Codex's saved state can trail its turn's end, so a turn whose items remain is read once more 2 seconds later; a failed read leaves them to the next history read. A client that shows live items should therefore expect them to leave the window before its own history read holds them. Read persisted history and the live window together after reconnect; a process restart cannot reconstruct unflushed in-memory content.
|
|
373
373
|
|
|
374
|
-
Items expose only normalized presentation fields, and one mapping per provider presents `items`, live items and `session-evidence` alike, as the provider's CLI shows them. Kinds are `user-message`, `agent-message`, `command`, `tool`, `file-change`, `notice` and `unsupported`. `callId` pairs a tool call with its result, or is null. `outcome` is `succeeded`, `failed`, or null when unknown or still running. `files` lists each file a file change touched, at most 128, with its added and removed lines, and is empty on other items. `outcome` and `files` come from the full native record, so `textLimit` never changes them. Unknown native kinds report `unsupported` without copying arbitrary payloads. Display text is bounded to 65,536 UTF-16 code units without splitting a surrogate pair; `isTruncated` reports omissions. An unsupported or oversized native transport frame fails explicitly. `createdAt` is the item's time in Unix milliseconds, or null when the provider records none. A Claude item takes its record's `timestamp`, and a live one the time its frame arrived. A Codex item takes its
|
|
374
|
+
Items expose only normalized presentation fields, and one mapping per provider presents `items`, live items and `session-evidence` alike, as the provider's CLI shows them. Kinds are `user-message`, `agent-message`, `command`, `tool`, `file-change`, `notice` and `unsupported`. `callId` pairs a tool call with its result, or is null. `outcome` is `succeeded`, `failed`, or null when unknown or still running. `files` lists each file a file change touched, at most 128, with its added and removed lines, and is empty on other items. `outcome` and `files` come from the full native record, so `textLimit` never changes them. Unknown native kinds report `unsupported` without copying arbitrary payloads. Display text is bounded to 65,536 UTF-16 code units without splitting a surrogate pair; `isTruncated` reports omissions. An unsupported or oversized native transport frame fails explicitly. `createdAt` is the item's time in Unix milliseconds, or null when the provider records none. A Claude item takes its record's `timestamp`, and a live one the time its frame arrived. A Codex item takes its own native lifecycle timestamps, already in milliseconds: operator input prefers `startedAtMs`, and other items prefer `completedAtMs`, using the other item timestamp when the preferred one is missing. History entries and live notifications use the same mapping, with entry/notification metadata preferred over the matching embedded item field. Missing item timestamps remain null; turn times and observation times are never substituted. History pages and item details need no additional turn reads for timing.
|
|
375
375
|
|
|
376
376
|
Codex leaves `reasoning` items out as it reads them, so a Codex page can hold fewer items than its limit. `contextCompaction` is a `notice` with empty text, because Codex records no summary. `webSearch` and `imageView` are `tool` items reading the query or the image path. A command, file change or tool call takes its `outcome` from its `status`: `completed` succeeded, and `failed` or `declined` failed. `files` counts each change's diff, and an added or deleted file without hunks counts its whole content. A Codex item holds its call and its result together, so its `callId` is null. Claude's rules are under [Claude history](#claude-history).
|
|
377
377
|
|
|
@@ -5,7 +5,7 @@ import { MAX_PAGE_SIZE, } from '../../contracts/index.js';
|
|
|
5
5
|
import { NativeIdSchema } from '../../contracts/identities/index.js';
|
|
6
6
|
import { decodeBase64Image, imageUnavailable, readImageFile } from '../../sessions/index.js';
|
|
7
7
|
import { HQ_ERRORS } from '../../errors/index.js';
|
|
8
|
-
import { LOADED_THREADS_PAGE_SIZE,
|
|
8
|
+
import { LOADED_THREADS_PAGE_SIZE, NO_ROLLOUT_MESSAGE, SKILL_HINT_READ_CONCURRENCY, } from './constants.js';
|
|
9
9
|
import { createCodexRpc } from './rpc.js';
|
|
10
10
|
import { NativeBucketSchema, NativeSkillsSchema, NativeItemPageSchema, NativeThreadPageSchema, NativeThreadSchema, NativeTurnPageSchema, NativeUsageSchema, NativeTurnSchema, } from './types.js';
|
|
11
11
|
import { toHistoryItem, toImageSources, toItemDetail, toThreadSummary, toTurnSummary, toUsageSnapshot, } from './transformers.js';
|
|
@@ -141,24 +141,6 @@ export const createCodexProvider = async (extraSkillRoots = [], daemonLauncher =
|
|
|
141
141
|
});
|
|
142
142
|
return { data: page.data.map(toTurnSummary), nextCursor: page.nextCursor };
|
|
143
143
|
};
|
|
144
|
-
/*
|
|
145
|
-
* Reads turns newest first until every turn a history page's items belong to is found, so a
|
|
146
|
-
* recent page takes one read; a turn older than the most pages read leaves its items untimed.
|
|
147
|
-
*/
|
|
148
|
-
const readItemTurns = async (nativeId, turnIds) => {
|
|
149
|
-
const turns = new Map();
|
|
150
|
-
let cursor;
|
|
151
|
-
for (let read = 0; read < MAX_TURN_TIME_PAGES && turns.size < turnIds.size; read += 1) {
|
|
152
|
-
const page = await listTurns(nativeId, TURN_TIMES_PAGE_SIZE, cursor);
|
|
153
|
-
for (const turn of page.data)
|
|
154
|
-
if (turnIds.has(turn.nativeId))
|
|
155
|
-
turns.set(turn.nativeId, turn);
|
|
156
|
-
if (!page.nextCursor)
|
|
157
|
-
break;
|
|
158
|
-
cursor = page.nextCursor;
|
|
159
|
-
}
|
|
160
|
-
return turns;
|
|
161
|
-
};
|
|
162
144
|
/**
|
|
163
145
|
* Finds one item of a turn; Codex has no lookup of one item, so the turn's items are read,
|
|
164
146
|
* 128 at a time, until it appears.
|
|
@@ -265,10 +247,9 @@ export const createCodexProvider = async (extraSkillRoots = [], daemonLauncher =
|
|
|
265
247
|
throw HQ_ERRORS.create('codexFailed', {
|
|
266
248
|
data: { kind: 'agent-unavailable' },
|
|
267
249
|
});
|
|
268
|
-
const turns = await readItemTurns(nativeId, new Set(page.data.map((item) => item.turnId)));
|
|
269
250
|
return {
|
|
270
251
|
// reasoning is left out, so a page can hold fewer items than its limit
|
|
271
|
-
data: page.data.flatMap((item) => toHistoryItem(item,
|
|
252
|
+
data: page.data.flatMap((item) => toHistoryItem(item, fullBody) ?? []),
|
|
272
253
|
nextCursor: page.nextCursor,
|
|
273
254
|
};
|
|
274
255
|
},
|
|
@@ -276,8 +257,7 @@ export const createCodexProvider = async (extraSkillRoots = [], daemonLauncher =
|
|
|
276
257
|
const entry = await findItem(nativeId, turnId, nativeItemId);
|
|
277
258
|
if (!entry)
|
|
278
259
|
return null;
|
|
279
|
-
const
|
|
280
|
-
const item = toHistoryItem(entry, turns.get(entry.turnId));
|
|
260
|
+
const item = toHistoryItem(entry);
|
|
281
261
|
return item && { item, ...toItemDetail(entry) };
|
|
282
262
|
},
|
|
283
263
|
async readItemImage(nativeId, turnId, nativeItemId, index) {
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
export declare const LOADED_THREADS_PAGE_SIZE = 128;
|
|
2
2
|
export declare const MAX_LOADED_THREAD_PAGES = 8;
|
|
3
|
-
export declare const TURN_TIMES_PAGE_SIZE = 128;
|
|
4
|
-
export declare const MAX_TURN_TIME_PAGES = 8;
|
|
5
|
-
export declare const RUNNING_TURNS_CAPACITY = 1024;
|
|
6
3
|
export declare const SKILL_HINT_READ_CONCURRENCY = 8;
|
|
7
4
|
export declare const LOST_NOTIFICATIONS: Map<string, "unknown" | "turn-started" | "turn-completed" | "approval-resolved">;
|
|
8
5
|
export declare const KNOWN_NATIVE_STATES: readonly ["notLoaded", "idle", "systemError", "active"];
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
// threads read per page of the daemon's loaded threads, and the most pages one connection reads
|
|
2
2
|
export const LOADED_THREADS_PAGE_SIZE = 128;
|
|
3
3
|
export const MAX_LOADED_THREAD_PAGES = 8;
|
|
4
|
-
// turns read per page when timing a history page's items, and the most pages one page reads
|
|
5
|
-
export const TURN_TIMES_PAGE_SIZE = 128;
|
|
6
|
-
export const MAX_TURN_TIME_PAGES = 8;
|
|
7
|
-
// the most threads whose running turn the live events keep
|
|
8
|
-
export const RUNNING_TURNS_CAPACITY = 1024;
|
|
9
4
|
// the most skill files a catalog read reads at once for their argument hints
|
|
10
5
|
export const SKILL_HINT_READ_CONCURRENCY = 8;
|
|
11
6
|
// the lifecycle notifications whose loss a live re-check of the session makes up for
|
|
@@ -6,10 +6,10 @@ import { HQ_ERRORS } from '../../errors/index.js';
|
|
|
6
6
|
import { toTurnResult } from '../results/index.js';
|
|
7
7
|
import { NativeIdSchema } from '../../contracts/identities/index.js';
|
|
8
8
|
import { parseActionRequest } from '../utilities.js';
|
|
9
|
-
import { LOST_NOTIFICATIONS
|
|
9
|
+
import { LOST_NOTIFICATIONS } from './constants.js';
|
|
10
10
|
import { NativeItemSchema, NativeThreadSchema, NativeThreadStatusSchema, NativeTurnSchema, } from './types.js';
|
|
11
11
|
import { parseNative } from './validations.js';
|
|
12
|
-
import { toHistoryItem, toNativeLineage, toNativeState, toSessionState
|
|
12
|
+
import { toHistoryItem, toNativeLineage, toNativeState, toSessionState } from './transformers.js';
|
|
13
13
|
import { buildCodexReply, parseCodexPrompt, toApprovalPresentation } from './approvals/index.js';
|
|
14
14
|
const TargetSchema = z.object({ threadId: NativeIdSchema, turnId: NativeIdSchema });
|
|
15
15
|
const DeltaSchema = TargetSchema.extend({ itemId: NativeIdSchema, delta: z.string() });
|
|
@@ -29,8 +29,6 @@ export const createCodexEvents = (native, events, observeSession, observeLoaded)
|
|
|
29
29
|
let connectionId = randomUUID();
|
|
30
30
|
const scopedRequestId = (id) => JSON.stringify([connectionId, id]);
|
|
31
31
|
const turns = new Map();
|
|
32
|
-
// each thread's running turn, which times its live items
|
|
33
|
-
const runningTurns = new Map();
|
|
34
32
|
/**
|
|
35
33
|
* Keeps HQ's result capture in step with a turn whose start or end failed validation: a lost
|
|
36
34
|
* start still binds the capture prepared for HQ's input, and a lost end drops its turn's capture,
|
|
@@ -63,11 +61,6 @@ export const createCodexEvents = (native, events, observeSession, observeLoaded)
|
|
|
63
61
|
// a second turn started for HQ's own input breaks the protocol
|
|
64
62
|
if (captured?.turnId && captured.turnId !== turn.id)
|
|
65
63
|
parseNative(z.never(), params);
|
|
66
|
-
const summary = toTurnSummary(turn);
|
|
67
|
-
runningTurns.delete(threadId);
|
|
68
|
-
if (runningTurns.size >= RUNNING_TURNS_CAPACITY)
|
|
69
|
-
runningTurns.delete(runningTurns.keys().next().value);
|
|
70
|
-
runningTurns.set(threadId, summary);
|
|
71
64
|
if (captured)
|
|
72
65
|
captured.turnId = turn.id;
|
|
73
66
|
events.observe({
|
|
@@ -78,8 +71,6 @@ export const createCodexEvents = (native, events, observeSession, observeLoaded)
|
|
|
78
71
|
});
|
|
79
72
|
}
|
|
80
73
|
else if (turn.status !== 'inProgress') {
|
|
81
|
-
if (runningTurns.get(threadId)?.nativeId === turn.id)
|
|
82
|
-
runningTurns.delete(threadId);
|
|
83
74
|
const pending = turns.get(threadId);
|
|
84
75
|
const captured = pending?.turnId === turn.id ? pending : undefined;
|
|
85
76
|
const result = captured
|
|
@@ -108,7 +99,11 @@ export const createCodexEvents = (native, events, observeSession, observeLoaded)
|
|
|
108
99
|
parseNative(z.never(), params);
|
|
109
100
|
}
|
|
110
101
|
else if (method === 'item/started' || method === 'item/completed') {
|
|
111
|
-
const { threadId, turnId, item } = parseNative(TargetSchema.extend({
|
|
102
|
+
const { threadId, turnId, item, startedAtMs, completedAtMs } = parseNative(TargetSchema.extend({
|
|
103
|
+
item: NativeItemSchema.shape.item,
|
|
104
|
+
startedAtMs: NativeItemSchema.shape.startedAtMs,
|
|
105
|
+
completedAtMs: NativeItemSchema.shape.completedAtMs,
|
|
106
|
+
}), params);
|
|
112
107
|
const captured = turns.get(threadId);
|
|
113
108
|
if (captured?.turnId === turnId &&
|
|
114
109
|
method === 'item/completed' &&
|
|
@@ -125,8 +120,7 @@ export const createCodexEvents = (native, events, observeSession, observeLoaded)
|
|
|
125
120
|
captured.text = message.text;
|
|
126
121
|
}
|
|
127
122
|
}
|
|
128
|
-
const
|
|
129
|
-
const presented = toHistoryItem({ turnId, item }, running?.nativeId === turnId ? running : undefined);
|
|
123
|
+
const presented = toHistoryItem({ turnId, item, startedAtMs, completedAtMs });
|
|
130
124
|
if (presented)
|
|
131
125
|
events.item(threadId, presented, method === 'item/completed');
|
|
132
126
|
}
|
|
@@ -307,7 +301,6 @@ export const createCodexEvents = (native, events, observeSession, observeLoaded)
|
|
|
307
301
|
connectionId = randomUUID();
|
|
308
302
|
// a disconnected stream cannot supply a complete result from its partial capture
|
|
309
303
|
turns.clear();
|
|
310
|
-
runningTurns.clear();
|
|
311
304
|
events.unavailable();
|
|
312
305
|
},
|
|
313
306
|
connected: () => observeLoaded(),
|
|
@@ -24,15 +24,14 @@ export declare const toThreadSummary: (thread: INativeThread) => IThreadSummary;
|
|
|
24
24
|
export declare const toTurnSummary: (turn: INativeTurn) => ITurnSummary;
|
|
25
25
|
/**
|
|
26
26
|
* Presents one native item as the CLI shows it, shared by history pages, live items and evidence.
|
|
27
|
-
* Outcome and files come from the full item, before the text is cut.
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* known has no time.
|
|
27
|
+
* Outcome and files come from the full item, before the text is cut. Native lifecycle times are
|
|
28
|
+
* already milliseconds: operator input prefers its start, other items their completion. A
|
|
29
|
+
* missing preferred time uses the other item time; absent item times never use a turn's time.
|
|
31
30
|
* @returns The item, or null for reasoning, which the CLI leaves out of history.
|
|
32
31
|
* @throws
|
|
33
32
|
* - JG_AGENT_HQ_CODEX_FAILED: The Codex integration failed
|
|
34
33
|
*/
|
|
35
|
-
export declare const toHistoryItem: ({ turnId, item
|
|
34
|
+
export declare const toHistoryItem: ({ turnId, item, startedAtMs, completedAtMs }: INativeItem, fullBody?: boolean) => IHistoryItem | null;
|
|
36
35
|
/**
|
|
37
36
|
* Lists the images a native item holds or names, in order: an image view's file, and a user
|
|
38
37
|
* message's attached files and images, an image it holds as a data URL described by its data.
|
|
@@ -112,15 +112,14 @@ const toHistoryFile = (change) => {
|
|
|
112
112
|
};
|
|
113
113
|
/**
|
|
114
114
|
* Presents one native item as the CLI shows it, shared by history pages, live items and evidence.
|
|
115
|
-
* Outcome and files come from the full item, before the text is cut.
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
* known has no time.
|
|
115
|
+
* Outcome and files come from the full item, before the text is cut. Native lifecycle times are
|
|
116
|
+
* already milliseconds: operator input prefers its start, other items their completion. A
|
|
117
|
+
* missing preferred time uses the other item time; absent item times never use a turn's time.
|
|
119
118
|
* @returns The item, or null for reasoning, which the CLI leaves out of history.
|
|
120
119
|
* @throws
|
|
121
120
|
* - JG_AGENT_HQ_CODEX_FAILED: The Codex integration failed
|
|
122
121
|
*/
|
|
123
|
-
export const toHistoryItem = ({ turnId, item
|
|
122
|
+
export const toHistoryItem = ({ turnId, item, startedAtMs, completedAtMs }, fullBody = false) => {
|
|
124
123
|
let kind = 'unsupported';
|
|
125
124
|
let text = '';
|
|
126
125
|
// the text part a user message's input sent first, which links it to the action that sent it
|
|
@@ -203,11 +202,9 @@ export const toHistoryItem = ({ turnId, item }, turn, fullBody = false) => {
|
|
|
203
202
|
callId: null,
|
|
204
203
|
outcome,
|
|
205
204
|
files,
|
|
206
|
-
createdAt:
|
|
207
|
-
? null
|
|
208
|
-
: item.
|
|
209
|
-
? turn.startedAt
|
|
210
|
-
: (turn.completedAt ?? turn.startedAt),
|
|
205
|
+
createdAt: item.type === 'userMessage'
|
|
206
|
+
? (startedAtMs ?? item.startedAtMs ?? completedAtMs ?? item.completedAtMs ?? null)
|
|
207
|
+
: (completedAtMs ?? item.completedAtMs ?? startedAtMs ?? item.startedAtMs ?? null),
|
|
211
208
|
});
|
|
212
209
|
};
|
|
213
210
|
// the fields a detail reads beyond what history presents
|
|
@@ -48,9 +48,13 @@ export declare const TurnSummarySchema: z.ZodObject<{
|
|
|
48
48
|
export type ITurnSummary = z.infer<typeof TurnSummarySchema>;
|
|
49
49
|
export declare const NativeItemSchema: z.ZodObject<{
|
|
50
50
|
turnId: z.ZodString;
|
|
51
|
+
startedAtMs: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
52
|
+
completedAtMs: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
51
53
|
item: z.ZodObject<{
|
|
52
54
|
id: z.ZodString;
|
|
53
55
|
type: z.ZodString;
|
|
56
|
+
startedAtMs: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
57
|
+
completedAtMs: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
54
58
|
}, z.core.$catchall<z.ZodUnknown>>;
|
|
55
59
|
}, z.core.$strip>;
|
|
56
60
|
export declare const NativeThreadPageSchema: z.ZodObject<{
|
|
@@ -88,9 +92,13 @@ export declare const NativeTurnPageSchema: z.ZodObject<{
|
|
|
88
92
|
export declare const NativeItemPageSchema: z.ZodObject<{
|
|
89
93
|
data: z.ZodArray<z.ZodObject<{
|
|
90
94
|
turnId: z.ZodString;
|
|
95
|
+
startedAtMs: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
96
|
+
completedAtMs: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
91
97
|
item: z.ZodObject<{
|
|
92
98
|
id: z.ZodString;
|
|
93
99
|
type: z.ZodString;
|
|
100
|
+
startedAtMs: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
101
|
+
completedAtMs: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
94
102
|
}, z.core.$catchall<z.ZodUnknown>>;
|
|
95
103
|
}, z.core.$strip>>;
|
|
96
104
|
nextCursor: z.ZodNullable<z.ZodString>;
|
|
@@ -32,10 +32,25 @@ export const TurnSummarySchema = z.object({
|
|
|
32
32
|
startedAt: z.number().int().nullable(),
|
|
33
33
|
completedAt: z.number().int().nullable(),
|
|
34
34
|
});
|
|
35
|
+
// recorded native item lifecycle times are milliseconds; older producers may omit them
|
|
36
|
+
const NativeItemTimeSchema = z
|
|
37
|
+
.number()
|
|
38
|
+
.int()
|
|
39
|
+
.safe()
|
|
40
|
+
.nonnegative()
|
|
41
|
+
.max(8_640_000_000_000_000)
|
|
42
|
+
.nullish();
|
|
35
43
|
export const NativeItemSchema = z.object({
|
|
36
44
|
turnId: z.string().min(1).max(4096),
|
|
45
|
+
startedAtMs: NativeItemTimeSchema,
|
|
46
|
+
completedAtMs: NativeItemTimeSchema,
|
|
37
47
|
item: z
|
|
38
|
-
.object({
|
|
48
|
+
.object({
|
|
49
|
+
id: z.string().min(1).max(4096),
|
|
50
|
+
type: z.string().min(1).max(256),
|
|
51
|
+
startedAtMs: NativeItemTimeSchema,
|
|
52
|
+
completedAtMs: NativeItemTimeSchema,
|
|
53
|
+
})
|
|
39
54
|
.catchall(z.unknown()),
|
|
40
55
|
});
|
|
41
56
|
export const NativeThreadPageSchema = z.object({
|
package/package.json
CHANGED