@shipfox/api-logs-dto 12.0.0 → 16.0.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.
@@ -34,77 +34,79 @@ export declare const MAX_RECORD_NAME_BYTES = 1024;
34
34
  export declare const MAX_RECORD_GROUP_ID_BYTES = 256;
35
35
  /** Records a lease-scoped runner may append. The write path validates against this. */
36
36
  export declare const rawLogRecordSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
37
+ v: z.ZodLiteral<1>;
38
+ ts: z.ZodNumber;
37
39
  type: z.ZodLiteral<"output">;
38
40
  stream: z.ZodEnum<{
39
- stdout: "stdout";
40
41
  stderr: "stderr";
42
+ stdout: "stdout";
41
43
  }>;
42
44
  data: z.ZodString;
45
+ }, z.core.$strip>, z.ZodObject<{
43
46
  v: z.ZodLiteral<1>;
44
47
  ts: z.ZodNumber;
45
- }, z.core.$strip>, z.ZodObject<{
46
48
  type: z.ZodLiteral<"group_start">;
47
49
  group_id: z.ZodString;
48
50
  parent_group_id: z.ZodNullable<z.ZodString>;
49
51
  name: z.ZodString;
52
+ }, z.core.$strip>, z.ZodObject<{
50
53
  v: z.ZodLiteral<1>;
51
54
  ts: z.ZodNumber;
52
- }, z.core.$strip>, z.ZodObject<{
53
55
  type: z.ZodLiteral<"group_end">;
54
56
  group_id: z.ZodString;
57
+ }, z.core.$strip>, z.ZodObject<{
55
58
  v: z.ZodLiteral<1>;
56
59
  ts: z.ZodNumber;
57
- }, z.core.$strip>, z.ZodObject<{
58
60
  type: z.ZodLiteral<"end">;
59
61
  total_bytes: z.ZodNumber;
62
+ }, z.core.$strip>, z.ZodObject<{
60
63
  v: z.ZodLiteral<1>;
61
64
  ts: z.ZodNumber;
62
- }, z.core.$strip>, z.ZodObject<{
63
65
  type: z.ZodLiteral<"gap">;
64
66
  dropped_bytes: z.ZodNumber;
67
+ }, z.core.$strip>, z.ZodObject<{
65
68
  v: z.ZodLiteral<1>;
66
69
  ts: z.ZodNumber;
67
- }, z.core.$strip>, z.ZodObject<{
68
70
  type: z.ZodLiteral<"agent_session">;
69
71
  data: z.ZodString;
70
- v: z.ZodLiteral<1>;
71
- ts: z.ZodNumber;
72
72
  }, z.core.$strip>], "type">;
73
- /** Stored/read records: regular records, normalized agent sessions, and tombstones. */
74
73
  export declare const logRecordSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
74
+ v: z.ZodLiteral<1>;
75
+ ts: z.ZodNumber;
75
76
  type: z.ZodLiteral<"output">;
76
77
  stream: z.ZodEnum<{
77
- stdout: "stdout";
78
78
  stderr: "stderr";
79
+ stdout: "stdout";
79
80
  }>;
80
81
  data: z.ZodString;
82
+ }, z.core.$strip>, z.ZodObject<{
81
83
  v: z.ZodLiteral<1>;
82
84
  ts: z.ZodNumber;
83
- }, z.core.$strip>, z.ZodObject<{
84
85
  type: z.ZodLiteral<"group_start">;
85
86
  group_id: z.ZodString;
86
87
  parent_group_id: z.ZodNullable<z.ZodString>;
87
88
  name: z.ZodString;
89
+ }, z.core.$strip>, z.ZodObject<{
88
90
  v: z.ZodLiteral<1>;
89
91
  ts: z.ZodNumber;
90
- }, z.core.$strip>, z.ZodObject<{
91
92
  type: z.ZodLiteral<"group_end">;
92
93
  group_id: z.ZodString;
94
+ }, z.core.$strip>, z.ZodObject<{
93
95
  v: z.ZodLiteral<1>;
94
96
  ts: z.ZodNumber;
95
- }, z.core.$strip>, z.ZodObject<{
96
97
  type: z.ZodLiteral<"end">;
97
98
  total_bytes: z.ZodNumber;
99
+ }, z.core.$strip>, z.ZodObject<{
98
100
  v: z.ZodLiteral<1>;
99
101
  ts: z.ZodNumber;
100
- }, z.core.$strip>, z.ZodObject<{
101
102
  type: z.ZodLiteral<"gap">;
102
103
  dropped_bytes: z.ZodNumber;
104
+ }, z.core.$strip>, z.ZodObject<{
103
105
  v: z.ZodLiteral<1>;
104
106
  ts: z.ZodNumber;
105
- }, z.core.$strip>, z.ZodObject<{
106
107
  type: z.ZodLiteral<"agent_session">;
107
108
  row: z.ZodDiscriminatedUnion<[z.ZodObject<{
109
+ timestamp: z.ZodNumber;
108
110
  kind: z.ZodLiteral<"message">;
109
111
  role: z.ZodString;
110
112
  label: z.ZodString;
@@ -115,26 +117,26 @@ export declare const logRecordSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
115
117
  }, z.core.$strip>>>;
116
118
  text: z.ZodString;
117
119
  terminalFailure: z.ZodBoolean;
118
- timestamp: z.ZodNumber;
119
120
  }, z.core.$strip>, z.ZodObject<{
121
+ timestamp: z.ZodNumber;
120
122
  kind: z.ZodLiteral<"thinking">;
121
123
  text: z.ZodString;
122
- timestamp: z.ZodNumber;
123
124
  }, z.core.$strip>, z.ZodObject<{
125
+ timestamp: z.ZodNumber;
124
126
  kind: z.ZodLiteral<"tool-call">;
125
127
  id: z.ZodNullable<z.ZodString>;
126
128
  name: z.ZodString;
127
129
  input: z.ZodString;
128
130
  summary: z.ZodOptional<z.ZodString>;
129
- timestamp: z.ZodNumber;
130
131
  }, z.core.$strip>, z.ZodObject<{
132
+ timestamp: z.ZodNumber;
131
133
  kind: z.ZodLiteral<"tool-result">;
132
134
  toolCallId: z.ZodNullable<z.ZodString>;
133
135
  toolName: z.ZodString;
134
136
  output: z.ZodString;
135
137
  isError: z.ZodBoolean;
136
- timestamp: z.ZodNumber;
137
138
  }, z.core.$strip>, z.ZodObject<{
139
+ timestamp: z.ZodNumber;
138
140
  kind: z.ZodLiteral<"lifecycle">;
139
141
  label: z.ZodString;
140
142
  detail: z.ZodNullable<z.ZodString>;
@@ -144,31 +146,118 @@ export declare const logRecordSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
144
146
  inline: z.ZodOptional<z.ZodBoolean>;
145
147
  }, z.core.$strip>>>;
146
148
  tone: z.ZodEnum<{
147
- error: "error";
148
149
  default: "default";
150
+ error: "error";
149
151
  warning: "warning";
150
152
  }>;
151
153
  terminalFailure: z.ZodBoolean;
152
- timestamp: z.ZodNumber;
153
154
  }, z.core.$strip>, z.ZodObject<{
155
+ timestamp: z.ZodNumber;
154
156
  kind: z.ZodLiteral<"raw">;
155
157
  label: z.ZodString;
156
158
  raw: z.ZodString;
157
- timestamp: z.ZodNumber;
158
159
  }, z.core.$strip>], "kind">;
160
+ }, z.core.$strip>, z.ZodObject<{
159
161
  v: z.ZodLiteral<1>;
160
162
  ts: z.ZodNumber;
161
- }, z.core.$strip>, z.ZodObject<{
162
163
  type: z.ZodLiteral<"capped">;
164
+ }, z.core.$strip>, z.ZodObject<{
163
165
  v: z.ZodLiteral<1>;
164
166
  ts: z.ZodNumber;
165
- }, z.core.$strip>, z.ZodObject<{
166
167
  type: z.ZodLiteral<"runner_lost">;
168
+ }, z.core.$strip>], "type">;
169
+ /** Records a trusted server-origin writer may append: stored records without tombstones. */
170
+ export declare const serverLogRecordSchema: z.ZodDiscriminatedUnion<readonly [z.ZodObject<{
167
171
  v: z.ZodLiteral<1>;
168
172
  ts: z.ZodNumber;
173
+ type: z.ZodLiteral<"output">;
174
+ stream: z.ZodEnum<{
175
+ stderr: "stderr";
176
+ stdout: "stdout";
177
+ }>;
178
+ data: z.ZodString;
179
+ }, z.core.$strip>, z.ZodObject<{
180
+ v: z.ZodLiteral<1>;
181
+ ts: z.ZodNumber;
182
+ type: z.ZodLiteral<"group_start">;
183
+ group_id: z.ZodString;
184
+ parent_group_id: z.ZodNullable<z.ZodString>;
185
+ name: z.ZodString;
186
+ }, z.core.$strip>, z.ZodObject<{
187
+ v: z.ZodLiteral<1>;
188
+ ts: z.ZodNumber;
189
+ type: z.ZodLiteral<"group_end">;
190
+ group_id: z.ZodString;
191
+ }, z.core.$strip>, z.ZodObject<{
192
+ v: z.ZodLiteral<1>;
193
+ ts: z.ZodNumber;
194
+ type: z.ZodLiteral<"end">;
195
+ total_bytes: z.ZodNumber;
196
+ }, z.core.$strip>, z.ZodObject<{
197
+ v: z.ZodLiteral<1>;
198
+ ts: z.ZodNumber;
199
+ type: z.ZodLiteral<"gap">;
200
+ dropped_bytes: z.ZodNumber;
201
+ }, z.core.$strip>, z.ZodObject<{
202
+ v: z.ZodLiteral<1>;
203
+ ts: z.ZodNumber;
204
+ type: z.ZodLiteral<"agent_session">;
205
+ row: z.ZodDiscriminatedUnion<[z.ZodObject<{
206
+ timestamp: z.ZodNumber;
207
+ kind: z.ZodLiteral<"message">;
208
+ role: z.ZodString;
209
+ label: z.ZodString;
210
+ meta: z.ZodReadonly<z.ZodArray<z.ZodObject<{
211
+ label: z.ZodString;
212
+ value: z.ZodString;
213
+ inline: z.ZodOptional<z.ZodBoolean>;
214
+ }, z.core.$strip>>>;
215
+ text: z.ZodString;
216
+ terminalFailure: z.ZodBoolean;
217
+ }, z.core.$strip>, z.ZodObject<{
218
+ timestamp: z.ZodNumber;
219
+ kind: z.ZodLiteral<"thinking">;
220
+ text: z.ZodString;
221
+ }, z.core.$strip>, z.ZodObject<{
222
+ timestamp: z.ZodNumber;
223
+ kind: z.ZodLiteral<"tool-call">;
224
+ id: z.ZodNullable<z.ZodString>;
225
+ name: z.ZodString;
226
+ input: z.ZodString;
227
+ summary: z.ZodOptional<z.ZodString>;
228
+ }, z.core.$strip>, z.ZodObject<{
229
+ timestamp: z.ZodNumber;
230
+ kind: z.ZodLiteral<"tool-result">;
231
+ toolCallId: z.ZodNullable<z.ZodString>;
232
+ toolName: z.ZodString;
233
+ output: z.ZodString;
234
+ isError: z.ZodBoolean;
235
+ }, z.core.$strip>, z.ZodObject<{
236
+ timestamp: z.ZodNumber;
237
+ kind: z.ZodLiteral<"lifecycle">;
238
+ label: z.ZodString;
239
+ detail: z.ZodNullable<z.ZodString>;
240
+ meta: z.ZodReadonly<z.ZodArray<z.ZodObject<{
241
+ label: z.ZodString;
242
+ value: z.ZodString;
243
+ inline: z.ZodOptional<z.ZodBoolean>;
244
+ }, z.core.$strip>>>;
245
+ tone: z.ZodEnum<{
246
+ default: "default";
247
+ error: "error";
248
+ warning: "warning";
249
+ }>;
250
+ terminalFailure: z.ZodBoolean;
251
+ }, z.core.$strip>, z.ZodObject<{
252
+ timestamp: z.ZodNumber;
253
+ kind: z.ZodLiteral<"raw">;
254
+ label: z.ZodString;
255
+ raw: z.ZodString;
256
+ }, z.core.$strip>], "kind">;
169
257
  }, z.core.$strip>], "type">;
170
258
  export type RawLogRecord = z.infer<typeof rawLogRecordSchema>;
171
259
  export type LogRecord = z.infer<typeof logRecordSchema>;
260
+ export type ServerLogRecord = z.infer<typeof serverLogRecordSchema>;
172
261
  export declare function parseLogRecordLine(line: string): LogRecord;
173
262
  /**
174
263
  * Parses one NDJSON line against the raw write union. A forged
@@ -1 +1 @@
1
- {"version":3,"file":"record.d.ts","sourceRoot":"","sources":["../../src/schemas/record.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAGtB;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,uFAAuF;AACvF,eAAO,MAAM,qBAAqB,QAAY,CAAC;AAE/C,iFAAiF;AACjF,eAAO,MAAM,qBAAqB,OAAO,CAAC;AAE1C;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,MAAM,CAAC;AA4E7C,uFAAuF;AACvF,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAO7B,CAAC;AAEH,uFAAuF;AACvF,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAS1B,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAC9D,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAExD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAE1D;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CAEhE"}
1
+ {"version":3,"file":"record.d.ts","sourceRoot":"","sources":["../../src/schemas/record.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAGtB;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,uFAAuF;AACvF,eAAO,MAAM,qBAAqB,QAAY,CAAC;AAE/C,iFAAiF;AACjF,eAAO,MAAM,qBAAqB,OAAO,CAAC;AAE1C;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,MAAM,CAAC;AA4E7C,uFAAuF;AACvF,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAO7B,CAAC;AAYH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAI1B,CAAC;AAEH,4FAA4F;AAC5F,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAAuD,CAAC;AAE1F,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAC9D,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AACxD,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAE1D;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CAEhE"}
@@ -112,16 +112,20 @@ const logRunnerLost = z.object({
112
112
  logGap,
113
113
  rawAgentSession
114
114
  ]);
115
- /** Stored/read records: regular records, normalized agent sessions, and tombstones. */ export const logRecordSchema = z.discriminatedUnion('type', [
115
+ /** Stored/read records: regular records, normalized agent sessions, and tombstones. */ const storedLogRecordSchemas = [
116
116
  logOutput,
117
117
  logGroupStart,
118
118
  logGroupEnd,
119
119
  logEnd,
120
120
  logGap,
121
- agentSession,
121
+ agentSession
122
+ ];
123
+ export const logRecordSchema = z.discriminatedUnion('type', [
124
+ ...storedLogRecordSchemas,
122
125
  logCapped,
123
126
  logRunnerLost
124
127
  ]);
128
+ /** Records a trusted server-origin writer may append: stored records without tombstones. */ export const serverLogRecordSchema = z.discriminatedUnion('type', storedLogRecordSchemas);
125
129
  export function parseLogRecordLine(line) {
126
130
  return logRecordSchema.parse(JSON.parse(line));
127
131
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/schemas/record.ts"],"sourcesContent":["import {z} from 'zod';\nimport {sessionViewRowSchema} from './session-view.js';\n\n/**\n * NDJSON log record contract: one JSON object per line, runner-framed.\n *\n * `offset` / `committed_length` are byte positions in the raw append NDJSON spool stream\n * (envelope included): the offset-CAS axis the runner tracks. The per-job accrual\n * budget charges the normalized NDJSON bytes the server stores, so framing and control records\n * count against it too. The per-record byte caps below bound each record so a single\n * entry's overhead is known and a runner cannot grow storage without moving the\n * budget: `data` is non-empty and <= MAX_RECORD_DATA_BYTES, the group `name` is\n * <= MAX_RECORD_NAME_BYTES, the group ids are <= MAX_RECORD_GROUP_ID_BYTES, and every\n * other field is fixed-shape.\n *\n * The envelope is `{v, ts}`, and every record is discriminated by a single flat\n * `type`. The raw/write and stored/read unions are distinct types: the server-only\n * `capped` / `runner_lost` tombstones are members of the read union only, so a forged\n * tombstone cannot pass append validation.\n *\n * The append-side `agent_session` record carries one verbatim agent session entry line\n * in `data`, forwarded opaquely by the runner. On successful ingest, the API normalizes\n * that raw entry into one or more read-side `agent_session` records whose `row` is the\n * canonical session view row. The raw and normalized records travel through the same log\n * append/read pipe; only their contract at each boundary differs.\n */\n\n/** Largest decoded `data` payload per record. Longer lines are split by the runner. */\nexport const MAX_RECORD_DATA_BYTES = 16 * 1024;\n\n/** Largest `group_start` name. Bounds the only variable-length control field. */\nexport const MAX_RECORD_NAME_BYTES = 1024;\n\n/**\n * Largest `group_id` / `parent_group_id`. The runner emits short monotonic ids (`g1`,\n * `g2`, …); this only bounds a forged id from a lease-scoped writer so the ids stay a\n * fixed-shape field like every other record field.\n */\nexport const MAX_RECORD_GROUP_ID_BYTES = 256;\n\n// UTF-8 byte length without node:buffer, so this shared DTO stays browser-safe (the\n// client log viewer imports these types too). Identical to Buffer.byteLength(x, 'utf8').\nconst utf8Encoder = new TextEncoder();\nconst utf8ByteLength = (value: string): number => utf8Encoder.encode(value).length;\n\nconst groupId = z\n .string()\n .min(1, {message: 'group id must not be empty'})\n .refine((value) => utf8ByteLength(value) <= MAX_RECORD_GROUP_ID_BYTES, {\n message: `group id exceeds ${MAX_RECORD_GROUP_ID_BYTES} bytes`,\n });\n\nconst envelope = {\n v: z.literal(1),\n /** Epoch milliseconds, assigned by the runner at capture. */\n ts: z.number().int().nonnegative(),\n};\n\nconst logOutput = z.object({\n ...envelope,\n type: z.literal('output'),\n stream: z.enum(['stdout', 'stderr']),\n data: z\n .string()\n .min(1, {message: 'output data must not be empty'})\n .refine((value) => utf8ByteLength(value) <= MAX_RECORD_DATA_BYTES, {\n message: `data exceeds ${MAX_RECORD_DATA_BYTES} payload bytes`,\n }),\n});\n\nconst logGroupStart = z.object({\n ...envelope,\n type: z.literal('group_start'),\n group_id: groupId,\n parent_group_id: groupId.nullable(),\n name: z.string().refine((value) => utf8ByteLength(value) <= MAX_RECORD_NAME_BYTES, {\n message: `group name exceeds ${MAX_RECORD_NAME_BYTES} bytes`,\n }),\n});\n\nconst logGroupEnd = z.object({...envelope, type: z.literal('group_end'), group_id: groupId});\n\nconst logEnd = z.object({\n ...envelope,\n type: z.literal('end'),\n total_bytes: z.number().int().nonnegative(),\n});\n\nconst logGap = z.object({\n ...envelope,\n type: z.literal('gap'),\n dropped_bytes: z.number().int().nonnegative(),\n});\n\n// One verbatim agent session entry line, forwarded opaquely by the runner. `data` is\n// intentionally uncapped here: the per-line byte limit is the server's configurable\n// LOG_MAX_SESSION_LINE_BYTES (a Zod schema cannot read runtime config, and a static cap\n// would collide with the body-limit invariant), enforced in the append write path.\nconst rawAgentSession = z.object({\n ...envelope,\n type: z.literal('agent_session'),\n data: z.string().min(1, {message: 'agent_session data must not be empty'}),\n});\n\nconst agentSession = z.object({\n ...envelope,\n type: z.literal('agent_session'),\n row: sessionViewRowSchema,\n});\n\n// Server-only tombstones: NOT members of the raw write union.\nconst logCapped = z.object({...envelope, type: z.literal('capped')});\nconst logRunnerLost = z.object({...envelope, type: z.literal('runner_lost')});\n\n/** Records a lease-scoped runner may append. The write path validates against this. */\nexport const rawLogRecordSchema = z.discriminatedUnion('type', [\n logOutput,\n logGroupStart,\n logGroupEnd,\n logEnd,\n logGap,\n rawAgentSession,\n]);\n\n/** Stored/read records: regular records, normalized agent sessions, and tombstones. */\nexport const logRecordSchema = z.discriminatedUnion('type', [\n logOutput,\n logGroupStart,\n logGroupEnd,\n logEnd,\n logGap,\n agentSession,\n logCapped,\n logRunnerLost,\n]);\n\nexport type RawLogRecord = z.infer<typeof rawLogRecordSchema>;\nexport type LogRecord = z.infer<typeof logRecordSchema>;\n\nexport function parseLogRecordLine(line: string): LogRecord {\n return logRecordSchema.parse(JSON.parse(line));\n}\n\n/**\n * Parses one NDJSON line against the raw write union. A forged\n * server-only `capped` / `runner_lost` record fails here even though it is valid\n * under the read union: this is the write-path forgery guard.\n */\nexport function parseRawLogRecordLine(line: string): RawLogRecord {\n return rawLogRecordSchema.parse(JSON.parse(line));\n}\n"],"names":["z","sessionViewRowSchema","MAX_RECORD_DATA_BYTES","MAX_RECORD_NAME_BYTES","MAX_RECORD_GROUP_ID_BYTES","utf8Encoder","TextEncoder","utf8ByteLength","value","encode","length","groupId","string","min","message","refine","envelope","v","literal","ts","number","int","nonnegative","logOutput","object","type","stream","enum","data","logGroupStart","group_id","parent_group_id","nullable","name","logGroupEnd","logEnd","total_bytes","logGap","dropped_bytes","rawAgentSession","agentSession","row","logCapped","logRunnerLost","rawLogRecordSchema","discriminatedUnion","logRecordSchema","parseLogRecordLine","line","parse","JSON","parseRawLogRecordLine"],"mappings":"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"}
1
+ {"version":3,"sources":["../../src/schemas/record.ts"],"sourcesContent":["import {z} from 'zod';\nimport {sessionViewRowSchema} from './session-view.js';\n\n/**\n * NDJSON log record contract: one JSON object per line, runner-framed.\n *\n * `offset` / `committed_length` are byte positions in the raw append NDJSON spool stream\n * (envelope included): the offset-CAS axis the runner tracks. The per-job accrual\n * budget charges the normalized NDJSON bytes the server stores, so framing and control records\n * count against it too. The per-record byte caps below bound each record so a single\n * entry's overhead is known and a runner cannot grow storage without moving the\n * budget: `data` is non-empty and <= MAX_RECORD_DATA_BYTES, the group `name` is\n * <= MAX_RECORD_NAME_BYTES, the group ids are <= MAX_RECORD_GROUP_ID_BYTES, and every\n * other field is fixed-shape.\n *\n * The envelope is `{v, ts}`, and every record is discriminated by a single flat\n * `type`. The raw/write and stored/read unions are distinct types: the server-only\n * `capped` / `runner_lost` tombstones are members of the read union only, so a forged\n * tombstone cannot pass append validation.\n *\n * The append-side `agent_session` record carries one verbatim agent session entry line\n * in `data`, forwarded opaquely by the runner. On successful ingest, the API normalizes\n * that raw entry into one or more read-side `agent_session` records whose `row` is the\n * canonical session view row. The raw and normalized records travel through the same log\n * append/read pipe; only their contract at each boundary differs.\n */\n\n/** Largest decoded `data` payload per record. Longer lines are split by the runner. */\nexport const MAX_RECORD_DATA_BYTES = 16 * 1024;\n\n/** Largest `group_start` name. Bounds the only variable-length control field. */\nexport const MAX_RECORD_NAME_BYTES = 1024;\n\n/**\n * Largest `group_id` / `parent_group_id`. The runner emits short monotonic ids (`g1`,\n * `g2`, …); this only bounds a forged id from a lease-scoped writer so the ids stay a\n * fixed-shape field like every other record field.\n */\nexport const MAX_RECORD_GROUP_ID_BYTES = 256;\n\n// UTF-8 byte length without node:buffer, so this shared DTO stays browser-safe (the\n// client log viewer imports these types too). Identical to Buffer.byteLength(x, 'utf8').\nconst utf8Encoder = new TextEncoder();\nconst utf8ByteLength = (value: string): number => utf8Encoder.encode(value).length;\n\nconst groupId = z\n .string()\n .min(1, {message: 'group id must not be empty'})\n .refine((value) => utf8ByteLength(value) <= MAX_RECORD_GROUP_ID_BYTES, {\n message: `group id exceeds ${MAX_RECORD_GROUP_ID_BYTES} bytes`,\n });\n\nconst envelope = {\n v: z.literal(1),\n /** Epoch milliseconds, assigned by the runner at capture. */\n ts: z.number().int().nonnegative(),\n};\n\nconst logOutput = z.object({\n ...envelope,\n type: z.literal('output'),\n stream: z.enum(['stdout', 'stderr']),\n data: z\n .string()\n .min(1, {message: 'output data must not be empty'})\n .refine((value) => utf8ByteLength(value) <= MAX_RECORD_DATA_BYTES, {\n message: `data exceeds ${MAX_RECORD_DATA_BYTES} payload bytes`,\n }),\n});\n\nconst logGroupStart = z.object({\n ...envelope,\n type: z.literal('group_start'),\n group_id: groupId,\n parent_group_id: groupId.nullable(),\n name: z.string().refine((value) => utf8ByteLength(value) <= MAX_RECORD_NAME_BYTES, {\n message: `group name exceeds ${MAX_RECORD_NAME_BYTES} bytes`,\n }),\n});\n\nconst logGroupEnd = z.object({...envelope, type: z.literal('group_end'), group_id: groupId});\n\nconst logEnd = z.object({\n ...envelope,\n type: z.literal('end'),\n total_bytes: z.number().int().nonnegative(),\n});\n\nconst logGap = z.object({\n ...envelope,\n type: z.literal('gap'),\n dropped_bytes: z.number().int().nonnegative(),\n});\n\n// One verbatim agent session entry line, forwarded opaquely by the runner. `data` is\n// intentionally uncapped here: the per-line byte limit is the server's configurable\n// LOG_MAX_SESSION_LINE_BYTES (a Zod schema cannot read runtime config, and a static cap\n// would collide with the body-limit invariant), enforced in the append write path.\nconst rawAgentSession = z.object({\n ...envelope,\n type: z.literal('agent_session'),\n data: z.string().min(1, {message: 'agent_session data must not be empty'}),\n});\n\nconst agentSession = z.object({\n ...envelope,\n type: z.literal('agent_session'),\n row: sessionViewRowSchema,\n});\n\n// Server-only tombstones: NOT members of the raw write union.\nconst logCapped = z.object({...envelope, type: z.literal('capped')});\nconst logRunnerLost = z.object({...envelope, type: z.literal('runner_lost')});\n\n/** Records a lease-scoped runner may append. The write path validates against this. */\nexport const rawLogRecordSchema = z.discriminatedUnion('type', [\n logOutput,\n logGroupStart,\n logGroupEnd,\n logEnd,\n logGap,\n rawAgentSession,\n]);\n\n/** Stored/read records: regular records, normalized agent sessions, and tombstones. */\nconst storedLogRecordSchemas = [\n logOutput,\n logGroupStart,\n logGroupEnd,\n logEnd,\n logGap,\n agentSession,\n] as const;\n\nexport const logRecordSchema = z.discriminatedUnion('type', [\n ...storedLogRecordSchemas,\n logCapped,\n logRunnerLost,\n]);\n\n/** Records a trusted server-origin writer may append: stored records without tombstones. */\nexport const serverLogRecordSchema = z.discriminatedUnion('type', storedLogRecordSchemas);\n\nexport type RawLogRecord = z.infer<typeof rawLogRecordSchema>;\nexport type LogRecord = z.infer<typeof logRecordSchema>;\nexport type ServerLogRecord = z.infer<typeof serverLogRecordSchema>;\n\nexport function parseLogRecordLine(line: string): LogRecord {\n return logRecordSchema.parse(JSON.parse(line));\n}\n\n/**\n * Parses one NDJSON line against the raw write union. A forged\n * server-only `capped` / `runner_lost` record fails here even though it is valid\n * under the read union: this is the write-path forgery guard.\n */\nexport function parseRawLogRecordLine(line: string): RawLogRecord {\n return rawLogRecordSchema.parse(JSON.parse(line));\n}\n"],"names":["z","sessionViewRowSchema","MAX_RECORD_DATA_BYTES","MAX_RECORD_NAME_BYTES","MAX_RECORD_GROUP_ID_BYTES","utf8Encoder","TextEncoder","utf8ByteLength","value","encode","length","groupId","string","min","message","refine","envelope","v","literal","ts","number","int","nonnegative","logOutput","object","type","stream","enum","data","logGroupStart","group_id","parent_group_id","nullable","name","logGroupEnd","logEnd","total_bytes","logGap","dropped_bytes","rawAgentSession","agentSession","row","logCapped","logRunnerLost","rawLogRecordSchema","discriminatedUnion","storedLogRecordSchemas","logRecordSchema","serverLogRecordSchema","parseLogRecordLine","line","parse","JSON","parseRawLogRecordLine"],"mappings":"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"}
@@ -6,6 +6,7 @@ export declare const sessionViewRowMetaSchema: z.ZodObject<{
6
6
  inline: z.ZodOptional<z.ZodBoolean>;
7
7
  }, z.core.$strip>;
8
8
  export declare const sessionViewMessageRowSchema: z.ZodObject<{
9
+ timestamp: z.ZodNumber;
9
10
  kind: z.ZodLiteral<"message">;
10
11
  role: z.ZodString;
11
12
  label: z.ZodString;
@@ -16,30 +17,30 @@ export declare const sessionViewMessageRowSchema: z.ZodObject<{
16
17
  }, z.core.$strip>>>;
17
18
  text: z.ZodString;
18
19
  terminalFailure: z.ZodBoolean;
19
- timestamp: z.ZodNumber;
20
20
  }, z.core.$strip>;
21
21
  export declare const sessionViewThinkingRowSchema: z.ZodObject<{
22
+ timestamp: z.ZodNumber;
22
23
  kind: z.ZodLiteral<"thinking">;
23
24
  text: z.ZodString;
24
- timestamp: z.ZodNumber;
25
25
  }, z.core.$strip>;
26
26
  export declare const sessionViewToolCallRowSchema: z.ZodObject<{
27
+ timestamp: z.ZodNumber;
27
28
  kind: z.ZodLiteral<"tool-call">;
28
29
  id: z.ZodNullable<z.ZodString>;
29
30
  name: z.ZodString;
30
31
  input: z.ZodString;
31
32
  summary: z.ZodOptional<z.ZodString>;
32
- timestamp: z.ZodNumber;
33
33
  }, z.core.$strip>;
34
34
  export declare const sessionViewToolResultRowSchema: z.ZodObject<{
35
+ timestamp: z.ZodNumber;
35
36
  kind: z.ZodLiteral<"tool-result">;
36
37
  toolCallId: z.ZodNullable<z.ZodString>;
37
38
  toolName: z.ZodString;
38
39
  output: z.ZodString;
39
40
  isError: z.ZodBoolean;
40
- timestamp: z.ZodNumber;
41
41
  }, z.core.$strip>;
42
42
  export declare const sessionViewLifecycleRowSchema: z.ZodObject<{
43
+ timestamp: z.ZodNumber;
43
44
  kind: z.ZodLiteral<"lifecycle">;
44
45
  label: z.ZodString;
45
46
  detail: z.ZodNullable<z.ZodString>;
@@ -49,20 +50,20 @@ export declare const sessionViewLifecycleRowSchema: z.ZodObject<{
49
50
  inline: z.ZodOptional<z.ZodBoolean>;
50
51
  }, z.core.$strip>>>;
51
52
  tone: z.ZodEnum<{
52
- error: "error";
53
53
  default: "default";
54
+ error: "error";
54
55
  warning: "warning";
55
56
  }>;
56
57
  terminalFailure: z.ZodBoolean;
57
- timestamp: z.ZodNumber;
58
58
  }, z.core.$strip>;
59
59
  export declare const sessionViewRawRowSchema: z.ZodObject<{
60
+ timestamp: z.ZodNumber;
60
61
  kind: z.ZodLiteral<"raw">;
61
62
  label: z.ZodString;
62
63
  raw: z.ZodString;
63
- timestamp: z.ZodNumber;
64
64
  }, z.core.$strip>;
65
65
  export declare const sessionViewRowSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
66
+ timestamp: z.ZodNumber;
66
67
  kind: z.ZodLiteral<"message">;
67
68
  role: z.ZodString;
68
69
  label: z.ZodString;
@@ -73,26 +74,26 @@ export declare const sessionViewRowSchema: z.ZodDiscriminatedUnion<[z.ZodObject<
73
74
  }, z.core.$strip>>>;
74
75
  text: z.ZodString;
75
76
  terminalFailure: z.ZodBoolean;
76
- timestamp: z.ZodNumber;
77
77
  }, z.core.$strip>, z.ZodObject<{
78
+ timestamp: z.ZodNumber;
78
79
  kind: z.ZodLiteral<"thinking">;
79
80
  text: z.ZodString;
80
- timestamp: z.ZodNumber;
81
81
  }, z.core.$strip>, z.ZodObject<{
82
+ timestamp: z.ZodNumber;
82
83
  kind: z.ZodLiteral<"tool-call">;
83
84
  id: z.ZodNullable<z.ZodString>;
84
85
  name: z.ZodString;
85
86
  input: z.ZodString;
86
87
  summary: z.ZodOptional<z.ZodString>;
87
- timestamp: z.ZodNumber;
88
88
  }, z.core.$strip>, z.ZodObject<{
89
+ timestamp: z.ZodNumber;
89
90
  kind: z.ZodLiteral<"tool-result">;
90
91
  toolCallId: z.ZodNullable<z.ZodString>;
91
92
  toolName: z.ZodString;
92
93
  output: z.ZodString;
93
94
  isError: z.ZodBoolean;
94
- timestamp: z.ZodNumber;
95
95
  }, z.core.$strip>, z.ZodObject<{
96
+ timestamp: z.ZodNumber;
96
97
  kind: z.ZodLiteral<"lifecycle">;
97
98
  label: z.ZodString;
98
99
  detail: z.ZodNullable<z.ZodString>;
@@ -102,21 +103,21 @@ export declare const sessionViewRowSchema: z.ZodDiscriminatedUnion<[z.ZodObject<
102
103
  inline: z.ZodOptional<z.ZodBoolean>;
103
104
  }, z.core.$strip>>>;
104
105
  tone: z.ZodEnum<{
105
- error: "error";
106
106
  default: "default";
107
+ error: "error";
107
108
  warning: "warning";
108
109
  }>;
109
110
  terminalFailure: z.ZodBoolean;
110
- timestamp: z.ZodNumber;
111
111
  }, z.core.$strip>, z.ZodObject<{
112
+ timestamp: z.ZodNumber;
112
113
  kind: z.ZodLiteral<"raw">;
113
114
  label: z.ZodString;
114
115
  raw: z.ZodString;
115
- timestamp: z.ZodNumber;
116
116
  }, z.core.$strip>], "kind">;
117
117
  export declare const sessionViewSchema: z.ZodObject<{
118
118
  v: z.ZodLiteral<1>;
119
119
  rows: z.ZodReadonly<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
120
+ timestamp: z.ZodNumber;
120
121
  kind: z.ZodLiteral<"message">;
121
122
  role: z.ZodString;
122
123
  label: z.ZodString;
@@ -127,26 +128,26 @@ export declare const sessionViewSchema: z.ZodObject<{
127
128
  }, z.core.$strip>>>;
128
129
  text: z.ZodString;
129
130
  terminalFailure: z.ZodBoolean;
130
- timestamp: z.ZodNumber;
131
131
  }, z.core.$strip>, z.ZodObject<{
132
+ timestamp: z.ZodNumber;
132
133
  kind: z.ZodLiteral<"thinking">;
133
134
  text: z.ZodString;
134
- timestamp: z.ZodNumber;
135
135
  }, z.core.$strip>, z.ZodObject<{
136
+ timestamp: z.ZodNumber;
136
137
  kind: z.ZodLiteral<"tool-call">;
137
138
  id: z.ZodNullable<z.ZodString>;
138
139
  name: z.ZodString;
139
140
  input: z.ZodString;
140
141
  summary: z.ZodOptional<z.ZodString>;
141
- timestamp: z.ZodNumber;
142
142
  }, z.core.$strip>, z.ZodObject<{
143
+ timestamp: z.ZodNumber;
143
144
  kind: z.ZodLiteral<"tool-result">;
144
145
  toolCallId: z.ZodNullable<z.ZodString>;
145
146
  toolName: z.ZodString;
146
147
  output: z.ZodString;
147
148
  isError: z.ZodBoolean;
148
- timestamp: z.ZodNumber;
149
149
  }, z.core.$strip>, z.ZodObject<{
150
+ timestamp: z.ZodNumber;
150
151
  kind: z.ZodLiteral<"lifecycle">;
151
152
  label: z.ZodString;
152
153
  detail: z.ZodNullable<z.ZodString>;
@@ -156,17 +157,16 @@ export declare const sessionViewSchema: z.ZodObject<{
156
157
  inline: z.ZodOptional<z.ZodBoolean>;
157
158
  }, z.core.$strip>>>;
158
159
  tone: z.ZodEnum<{
159
- error: "error";
160
160
  default: "default";
161
+ error: "error";
161
162
  warning: "warning";
162
163
  }>;
163
164
  terminalFailure: z.ZodBoolean;
164
- timestamp: z.ZodNumber;
165
165
  }, z.core.$strip>, z.ZodObject<{
166
+ timestamp: z.ZodNumber;
166
167
  kind: z.ZodLiteral<"raw">;
167
168
  label: z.ZodString;
168
169
  raw: z.ZodString;
169
- timestamp: z.ZodNumber;
170
170
  }, z.core.$strip>], "kind">>>;
171
171
  }, z.core.$strip>;
172
172
  export type SessionViewRowMeta = z.infer<typeof sessionViewRowMetaSchema>;