@heynixie/contract 0.82.0 → 0.83.1
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/contract/build-query-utils.d.ts +28 -0
- package/dist/contract/contract.d.ts +28 -0
- package/dist/file/code-file-schema.d.ts +15 -0
- package/dist/index.js +1214 -1190
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -182,62 +182,85 @@ var forgettableKinds = [
|
|
|
182
182
|
];
|
|
183
183
|
// src/contract/contract.ts
|
|
184
184
|
import { eventIterator as eventIterator2, oc as oc2 } from "@orpc/contract";
|
|
185
|
-
import { z as
|
|
185
|
+
import { z as z40 } from "zod";
|
|
186
186
|
|
|
187
|
-
// src/
|
|
187
|
+
// src/file/code-file-schema.ts
|
|
188
|
+
import { z as z2 } from "zod";
|
|
189
|
+
|
|
190
|
+
// src/contract/thread-schema.ts
|
|
188
191
|
import { z } from "zod";
|
|
189
|
-
var
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
192
|
+
var threadSchema = z.string().min(1).max(200);
|
|
193
|
+
|
|
194
|
+
// src/file/code-file-schema.ts
|
|
195
|
+
var codeFileSchema = z2.object({
|
|
196
|
+
file: z2.string().min(1).max(100),
|
|
197
|
+
name: z2.string(),
|
|
198
|
+
bytes: z2.int().nonnegative(),
|
|
199
|
+
mediaType: z2.string(),
|
|
200
|
+
recordedAt: z2.date(),
|
|
201
|
+
thread: threadSchema,
|
|
202
|
+
sequence: z2.int().positive(),
|
|
203
|
+
position: z2.int().nonnegative(),
|
|
204
|
+
isSent: z2.boolean(),
|
|
205
|
+
runFileCount: z2.int().positive(),
|
|
206
|
+
taskID: threadSchema.nullable(),
|
|
207
|
+
taskName: z2.string().nullable()
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
// src/span/span-schema.ts
|
|
211
|
+
import { z as z3 } from "zod";
|
|
212
|
+
var spanSchema = z3.object({
|
|
213
|
+
end: z3.int().nonnegative(),
|
|
214
|
+
source: z3.enum(["typed", "pasted", "dropped", "unknown"]),
|
|
215
|
+
start: z3.int().nonnegative()
|
|
193
216
|
});
|
|
194
217
|
|
|
195
218
|
// src/contract/approval-contract.ts
|
|
196
|
-
import { z as
|
|
219
|
+
import { z as z13 } from "zod";
|
|
197
220
|
|
|
198
221
|
// src/contract/authentication-response-schema.ts
|
|
199
|
-
import { z as
|
|
222
|
+
import { z as z5 } from "zod";
|
|
200
223
|
|
|
201
224
|
// src/contract/base64-url-schema.ts
|
|
202
|
-
import { z as
|
|
203
|
-
var base64URLSchema =
|
|
225
|
+
import { z as z4 } from "zod";
|
|
226
|
+
var base64URLSchema = z4.string().min(1).max(20000);
|
|
204
227
|
|
|
205
228
|
// src/contract/authentication-response-schema.ts
|
|
206
|
-
var assertionSchema =
|
|
229
|
+
var assertionSchema = z5.object({
|
|
207
230
|
clientDataJSON: base64URLSchema,
|
|
208
231
|
authenticatorData: base64URLSchema,
|
|
209
232
|
signature: base64URLSchema,
|
|
210
233
|
userHandle: base64URLSchema.optional()
|
|
211
234
|
});
|
|
212
|
-
var authenticationResponseSchema =
|
|
235
|
+
var authenticationResponseSchema = z5.object({
|
|
213
236
|
id: base64URLSchema,
|
|
214
237
|
rawId: base64URLSchema,
|
|
215
238
|
response: assertionSchema,
|
|
216
|
-
authenticatorAttachment:
|
|
217
|
-
clientExtensionResults:
|
|
218
|
-
type:
|
|
239
|
+
authenticatorAttachment: z5.enum(["cross-platform", "platform"]).optional(),
|
|
240
|
+
clientExtensionResults: z5.object({}),
|
|
241
|
+
type: z5.literal("public-key")
|
|
219
242
|
});
|
|
220
243
|
|
|
221
244
|
// src/contract/choice-schema.ts
|
|
222
|
-
import { z as
|
|
223
|
-
var choiceSchema =
|
|
245
|
+
import { z as z6 } from "zod";
|
|
246
|
+
var choiceSchema = z6.enum(["approve", "always_allow", "defer", "decline"]);
|
|
224
247
|
|
|
225
248
|
// src/contract/memory-view-contract.ts
|
|
226
|
-
import { z as
|
|
249
|
+
import { z as z10 } from "zod";
|
|
227
250
|
|
|
228
251
|
// src/contract/forget-backup-schema.ts
|
|
229
|
-
import { z as
|
|
230
|
-
var forgetBackupSchema =
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
252
|
+
import { z as z7 } from "zod";
|
|
253
|
+
var forgetBackupSchema = z7.discriminatedUnion("state", [
|
|
254
|
+
z7.object({ state: z7.literal("off") }),
|
|
255
|
+
z7.object({ state: z7.literal("pending") }),
|
|
256
|
+
z7.object({ state: z7.literal("failed"), failure: z7.string() }),
|
|
257
|
+
z7.object({ state: z7.literal("complete") }),
|
|
258
|
+
z7.object({ state: z7.literal("unknown") })
|
|
236
259
|
]);
|
|
237
260
|
|
|
238
261
|
// src/contract/memory-export-contract.ts
|
|
239
262
|
import { eventIterator } from "@orpc/contract";
|
|
240
|
-
import { z as
|
|
263
|
+
import { z as z8 } from "zod";
|
|
241
264
|
|
|
242
265
|
// src/contract/reused-id-errors.ts
|
|
243
266
|
var reusedIDErrors = {
|
|
@@ -257,42 +280,42 @@ var signedIn = oc.errors({
|
|
|
257
280
|
var checkedExport = signedIn.errors(reusedIDErrors).errors({
|
|
258
281
|
MEMORY_NOT_STARTED: { message: "The memory store has not started yet", status: 503 }
|
|
259
282
|
});
|
|
260
|
-
var exportEvent =
|
|
261
|
-
|
|
262
|
-
|
|
283
|
+
var exportEvent = z8.union([
|
|
284
|
+
z8.object({ chunk: z8.string() }),
|
|
285
|
+
z8.object({ isComplete: z8.literal(true) })
|
|
263
286
|
]);
|
|
264
287
|
var exportEvents = eventIterator(exportEvent);
|
|
265
288
|
var memoryExportContract = {
|
|
266
|
-
export: checkedExport.input(
|
|
289
|
+
export: checkedExport.input(z8.object({ clientActionID: z8.uuid() })).output(exportEvents)
|
|
267
290
|
};
|
|
268
291
|
|
|
269
292
|
// src/contract/moment-contract.ts
|
|
270
|
-
import { z as
|
|
293
|
+
import { z as z9 } from "zod";
|
|
271
294
|
var momentView = signedIn.errors({
|
|
272
295
|
MEMORY_NOT_STARTED: { message: "The memory store has not started yet", status: 503 },
|
|
273
296
|
MOMENT_NOT_FOUND: { message: "No moment has this ID", status: 404 },
|
|
274
297
|
STALE_VERSION: { message: "The moment has moved past that version", status: 409 }
|
|
275
298
|
});
|
|
276
|
-
var momentIDSchema =
|
|
277
|
-
var momentTargetSchema =
|
|
278
|
-
var reflectionSchema =
|
|
279
|
-
model:
|
|
280
|
-
text:
|
|
281
|
-
writtenAt:
|
|
282
|
-
});
|
|
283
|
-
var destroyPreviewSchema =
|
|
284
|
-
keptAt:
|
|
285
|
-
keptBy:
|
|
286
|
-
kept:
|
|
287
|
-
lost:
|
|
288
|
-
momentID:
|
|
289
|
-
note:
|
|
290
|
-
reflections:
|
|
291
|
-
shortID:
|
|
292
|
-
state:
|
|
293
|
-
thread:
|
|
294
|
-
title:
|
|
295
|
-
version:
|
|
299
|
+
var momentIDSchema = z9.string().min(1).max(200);
|
|
300
|
+
var momentTargetSchema = z9.object({ momentID: momentIDSchema, version: z9.int().positive() });
|
|
301
|
+
var reflectionSchema = z9.object({
|
|
302
|
+
model: z9.string(),
|
|
303
|
+
text: z9.string().nullable(),
|
|
304
|
+
writtenAt: z9.date()
|
|
305
|
+
});
|
|
306
|
+
var destroyPreviewSchema = z9.object({
|
|
307
|
+
keptAt: z9.date(),
|
|
308
|
+
keptBy: z9.enum(["owner", "model"]),
|
|
309
|
+
kept: z9.object({ records: z9.int().nonnegative() }),
|
|
310
|
+
lost: z9.object({ links: z9.int().nonnegative(), texts: z9.int().nonnegative() }),
|
|
311
|
+
momentID: z9.string(),
|
|
312
|
+
note: z9.string().nullable(),
|
|
313
|
+
reflections: z9.array(reflectionSchema),
|
|
314
|
+
shortID: z9.string(),
|
|
315
|
+
state: z9.enum(["active", "retired"]),
|
|
316
|
+
thread: z9.string(),
|
|
317
|
+
title: z9.string().nullable(),
|
|
318
|
+
version: z9.int().positive()
|
|
296
319
|
});
|
|
297
320
|
var momentKeep = signedIn.errors(reusedIDErrors).errors({
|
|
298
321
|
MEMORY_NOT_STARTED: { message: "The memory store has not started yet", status: 503 },
|
|
@@ -301,90 +324,90 @@ var momentKeep = signedIn.errors(reusedIDErrors).errors({
|
|
|
301
324
|
status: 422
|
|
302
325
|
}
|
|
303
326
|
});
|
|
304
|
-
var titleSchema =
|
|
305
|
-
var keepSchema =
|
|
306
|
-
clientActionID:
|
|
307
|
-
firstSequence:
|
|
308
|
-
lastSequence:
|
|
309
|
-
thread:
|
|
327
|
+
var titleSchema = z9.string().min(1).max(120).regex(/\S/u);
|
|
328
|
+
var keepSchema = z9.object({
|
|
329
|
+
clientActionID: z9.uuid(),
|
|
330
|
+
firstSequence: z9.int().nonnegative(),
|
|
331
|
+
lastSequence: z9.int().nonnegative(),
|
|
332
|
+
thread: z9.string().min(1).max(200),
|
|
310
333
|
title: titleSchema
|
|
311
334
|
});
|
|
312
|
-
var momentSummarySchema =
|
|
313
|
-
editedAt:
|
|
314
|
-
keptAt:
|
|
315
|
-
keptBy:
|
|
316
|
-
momentID:
|
|
317
|
-
shortID:
|
|
318
|
-
state:
|
|
319
|
-
title:
|
|
320
|
-
});
|
|
321
|
-
var momentListSchema =
|
|
322
|
-
before:
|
|
323
|
-
includeRetired:
|
|
324
|
-
query:
|
|
325
|
-
});
|
|
326
|
-
var linkSchema =
|
|
327
|
-
itemID:
|
|
328
|
-
shortID:
|
|
329
|
-
text:
|
|
330
|
-
});
|
|
331
|
-
var noteSchema =
|
|
332
|
-
var shownReflectionSchema = reflectionSchema.extend({ reflectionID:
|
|
335
|
+
var momentSummarySchema = z9.object({
|
|
336
|
+
editedAt: z9.date().nullable(),
|
|
337
|
+
keptAt: z9.date(),
|
|
338
|
+
keptBy: z9.enum(["owner", "model"]),
|
|
339
|
+
momentID: z9.string(),
|
|
340
|
+
shortID: z9.string(),
|
|
341
|
+
state: z9.enum(["active", "retired"]),
|
|
342
|
+
title: z9.string().nullable()
|
|
343
|
+
});
|
|
344
|
+
var momentListSchema = z9.object({
|
|
345
|
+
before: z9.int().nonnegative().optional(),
|
|
346
|
+
includeRetired: z9.boolean(),
|
|
347
|
+
query: z9.string().max(500).optional()
|
|
348
|
+
});
|
|
349
|
+
var linkSchema = z9.object({
|
|
350
|
+
itemID: z9.string(),
|
|
351
|
+
shortID: z9.string(),
|
|
352
|
+
text: z9.string().nullable()
|
|
353
|
+
});
|
|
354
|
+
var noteSchema = z9.object({ text: z9.string(), writtenAt: z9.date() });
|
|
355
|
+
var shownReflectionSchema = reflectionSchema.extend({ reflectionID: z9.string() });
|
|
333
356
|
var momentDetailSchema = momentSummarySchema.extend({
|
|
334
|
-
firstSequence:
|
|
335
|
-
lastSequence:
|
|
336
|
-
links:
|
|
357
|
+
firstSequence: z9.int().nonnegative(),
|
|
358
|
+
lastSequence: z9.int().nonnegative(),
|
|
359
|
+
links: z9.array(linkSchema),
|
|
337
360
|
note: noteSchema.nullable(),
|
|
338
|
-
reflections:
|
|
339
|
-
thread:
|
|
340
|
-
titleBy:
|
|
341
|
-
version:
|
|
342
|
-
});
|
|
343
|
-
var spanRecordSchema =
|
|
344
|
-
isGap:
|
|
345
|
-
isRemoved:
|
|
346
|
-
kind:
|
|
347
|
-
recordedAt:
|
|
348
|
-
sequence:
|
|
349
|
-
text:
|
|
350
|
-
tool:
|
|
351
|
-
});
|
|
352
|
-
var momentChangeSchema =
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
kind:
|
|
356
|
-
firstSequence:
|
|
357
|
-
lastSequence:
|
|
361
|
+
reflections: z9.array(shownReflectionSchema),
|
|
362
|
+
thread: z9.string(),
|
|
363
|
+
titleBy: z9.enum(["owner", "model"]),
|
|
364
|
+
version: z9.int().positive()
|
|
365
|
+
});
|
|
366
|
+
var spanRecordSchema = z9.object({
|
|
367
|
+
isGap: z9.boolean(),
|
|
368
|
+
isRemoved: z9.boolean(),
|
|
369
|
+
kind: z9.string(),
|
|
370
|
+
recordedAt: z9.date(),
|
|
371
|
+
sequence: z9.int().nonnegative(),
|
|
372
|
+
text: z9.string().nullable(),
|
|
373
|
+
tool: z9.string().nullable()
|
|
374
|
+
});
|
|
375
|
+
var momentChangeSchema = z9.discriminatedUnion("kind", [
|
|
376
|
+
z9.object({ kind: z9.literal("title"), title: titleSchema }),
|
|
377
|
+
z9.object({
|
|
378
|
+
kind: z9.literal("edges"),
|
|
379
|
+
firstSequence: z9.int().nonnegative(),
|
|
380
|
+
lastSequence: z9.int().nonnegative()
|
|
358
381
|
}),
|
|
359
|
-
|
|
360
|
-
|
|
382
|
+
z9.object({ kind: z9.literal("note"), note: z9.string().min(1).max(4000).regex(/\S/u) }),
|
|
383
|
+
z9.object({ kind: z9.literal("reflection_removed"), reflectionID: z9.string().min(1).max(200) })
|
|
361
384
|
]);
|
|
362
385
|
var momentChange = momentView.errors(reusedIDErrors);
|
|
363
386
|
var momentContract = {
|
|
364
|
-
keepMoment: momentKeep.input(keepSchema).output(
|
|
387
|
+
keepMoment: momentKeep.input(keepSchema).output(z9.object({ momentID: z9.string(), shortID: z9.string() })),
|
|
365
388
|
listMoments: signedIn.errors({
|
|
366
389
|
MEMORY_NOT_STARTED: { message: "The memory store has not started yet", status: 503 }
|
|
367
|
-
}).input(momentListSchema).output(
|
|
368
|
-
readMoment: momentView.input(
|
|
369
|
-
readMomentSpan: momentView.input(
|
|
390
|
+
}).input(momentListSchema).output(z9.object({ moments: z9.array(momentSummarySchema), next: z9.int().nonnegative().nullable() })),
|
|
391
|
+
readMoment: momentView.input(z9.object({ momentID: momentIDSchema })).output(momentDetailSchema),
|
|
392
|
+
readMomentSpan: momentView.input(z9.object({ momentID: momentIDSchema, after: z9.int().nonnegative().optional() })).output(z9.object({ records: z9.array(spanRecordSchema), next: z9.int().nonnegative().nullable() })),
|
|
370
393
|
editMoment: momentChange.errors({
|
|
371
394
|
BAD_SPAN: {
|
|
372
395
|
message: "The span needs a first and a last record on the thread, in order",
|
|
373
396
|
status: 422
|
|
374
397
|
},
|
|
375
398
|
REFLECTION_NOT_FOUND: { message: "The moment has no reflection with this ID", status: 404 }
|
|
376
|
-
}).input(momentTargetSchema.extend({ clientActionID:
|
|
399
|
+
}).input(momentTargetSchema.extend({ clientActionID: z9.uuid(), change: momentChangeSchema })).output(z9.object({ momentID: z9.string(), version: z9.int().positive() })),
|
|
377
400
|
linkMoment: momentChange.errors({
|
|
378
401
|
MEMORY_ITEM_NOT_FOUND: { message: "No memory item has this ID", status: 404 },
|
|
379
402
|
ALREADY_LINKED: { message: "The item is already linked to the moment", status: 409 },
|
|
380
403
|
NOT_LINKED: { message: "The item is not linked to the moment", status: 409 }
|
|
381
404
|
}).input(momentTargetSchema.extend({
|
|
382
|
-
clientActionID:
|
|
383
|
-
isLinked:
|
|
384
|
-
itemID:
|
|
385
|
-
})).output(
|
|
405
|
+
clientActionID: z9.uuid(),
|
|
406
|
+
isLinked: z9.boolean(),
|
|
407
|
+
itemID: z9.string().min(1).max(200)
|
|
408
|
+
})).output(z9.object({ momentID: z9.string(), version: z9.int().positive() })),
|
|
386
409
|
previewMomentDestroy: momentView.input(momentTargetSchema).output(destroyPreviewSchema),
|
|
387
|
-
destroyMoment: momentView.errors(reusedIDErrors).input(momentTargetSchema.extend({ clientActionID:
|
|
410
|
+
destroyMoment: momentView.errors(reusedIDErrors).input(momentTargetSchema.extend({ clientActionID: z9.uuid() })).output(z9.object({ momentID: z9.string() }))
|
|
388
411
|
};
|
|
389
412
|
|
|
390
413
|
// src/contract/memory-view-contract.ts
|
|
@@ -396,69 +419,69 @@ var memoryChange = memoryView.errors(reusedIDErrors).errors({
|
|
|
396
419
|
STALE_VERSION: { message: "The memory item has moved past that version", status: 409 },
|
|
397
420
|
WRONG_STATE: { message: "The memory item is not in a state that change takes", status: 409 }
|
|
398
421
|
});
|
|
399
|
-
var itemIDSchema =
|
|
400
|
-
var proposalOriginSchema =
|
|
401
|
-
var originSchema =
|
|
402
|
-
var sourceSchema =
|
|
403
|
-
var subjectSchema =
|
|
404
|
-
var kindSchema =
|
|
405
|
-
var memoryItemSchema =
|
|
406
|
-
changedAt:
|
|
407
|
-
createdAt:
|
|
408
|
-
forgottenAt:
|
|
409
|
-
isBridge:
|
|
410
|
-
isPinned:
|
|
411
|
-
itemID:
|
|
422
|
+
var itemIDSchema = z10.string().min(1).max(200);
|
|
423
|
+
var proposalOriginSchema = z10.enum(["owner", "conversation", "task"]);
|
|
424
|
+
var originSchema = z10.enum([...proposalOriginSchema.options, "lapse"]);
|
|
425
|
+
var sourceSchema = z10.enum(["owner", "owner_data", "untrusted"]);
|
|
426
|
+
var subjectSchema = z10.enum(["owner", "self", "shared"]);
|
|
427
|
+
var kindSchema = z10.enum(["fact", "self"]);
|
|
428
|
+
var memoryItemSchema = z10.object({
|
|
429
|
+
changedAt: z10.date(),
|
|
430
|
+
createdAt: z10.date(),
|
|
431
|
+
forgottenAt: z10.date().nullable(),
|
|
432
|
+
isBridge: z10.boolean(),
|
|
433
|
+
isPinned: z10.boolean(),
|
|
434
|
+
itemID: z10.string(),
|
|
412
435
|
kind: kindSchema,
|
|
413
436
|
origin: originSchema,
|
|
414
|
-
shortID:
|
|
437
|
+
shortID: z10.string(),
|
|
415
438
|
source: sourceSchema,
|
|
416
|
-
state:
|
|
417
|
-
status:
|
|
439
|
+
state: z10.enum(["active", "retired", "forgetting", "forgotten"]),
|
|
440
|
+
status: z10.enum(["readable", "shredded", "unreadable"]),
|
|
418
441
|
subject: subjectSchema,
|
|
419
|
-
text:
|
|
420
|
-
until:
|
|
421
|
-
version:
|
|
442
|
+
text: z10.string().optional(),
|
|
443
|
+
until: z10.date().nullable(),
|
|
444
|
+
version: z10.int().positive()
|
|
422
445
|
});
|
|
423
446
|
var memoryMatchSchema = memoryItemSchema.extend({
|
|
424
|
-
score:
|
|
425
|
-
similarity:
|
|
426
|
-
});
|
|
427
|
-
var evidenceSchema =
|
|
428
|
-
end:
|
|
429
|
-
message:
|
|
430
|
-
status:
|
|
431
|
-
text:
|
|
447
|
+
score: z10.number().optional(),
|
|
448
|
+
similarity: z10.number().optional()
|
|
449
|
+
});
|
|
450
|
+
var evidenceSchema = z10.object({
|
|
451
|
+
end: z10.int().nonnegative(),
|
|
452
|
+
message: z10.object({
|
|
453
|
+
status: z10.enum(["readable", "shredded", "unreadable", "missing"]),
|
|
454
|
+
text: z10.string().optional()
|
|
432
455
|
}).nullable(),
|
|
433
|
-
sequence:
|
|
434
|
-
start:
|
|
435
|
-
});
|
|
436
|
-
var ownerImageSchema =
|
|
437
|
-
position:
|
|
438
|
-
sequence:
|
|
439
|
-
thread:
|
|
440
|
-
});
|
|
441
|
-
var memoryVersionSchema =
|
|
442
|
-
change:
|
|
443
|
-
checkerModel:
|
|
444
|
-
checks:
|
|
456
|
+
sequence: z10.int().nonnegative(),
|
|
457
|
+
start: z10.int().nonnegative()
|
|
458
|
+
});
|
|
459
|
+
var ownerImageSchema = z10.object({
|
|
460
|
+
position: z10.int().nonnegative(),
|
|
461
|
+
sequence: z10.int().positive(),
|
|
462
|
+
thread: z10.string()
|
|
463
|
+
});
|
|
464
|
+
var memoryVersionSchema = z10.object({
|
|
465
|
+
change: z10.enum(["created", "edited", "retired", "restored", "undone"]),
|
|
466
|
+
checkerModel: z10.string().nullable(),
|
|
467
|
+
checks: z10.record(z10.string(), z10.unknown()).nullable(),
|
|
445
468
|
evidence: evidenceSchema.nullable(),
|
|
446
|
-
evidenceQuote:
|
|
469
|
+
evidenceQuote: z10.string().nullable(),
|
|
447
470
|
image: ownerImageSchema.nullable(),
|
|
448
|
-
isBridge:
|
|
449
|
-
isRemoved:
|
|
471
|
+
isBridge: z10.boolean(),
|
|
472
|
+
isRemoved: z10.boolean(),
|
|
450
473
|
origin: originSchema,
|
|
451
|
-
proposalID:
|
|
452
|
-
recordedAt:
|
|
474
|
+
proposalID: z10.string().nullable(),
|
|
475
|
+
recordedAt: z10.date(),
|
|
453
476
|
source: sourceSchema,
|
|
454
|
-
state:
|
|
455
|
-
status:
|
|
456
|
-
taskID:
|
|
457
|
-
text:
|
|
458
|
-
version:
|
|
459
|
-
writerModel:
|
|
460
|
-
});
|
|
461
|
-
var reviewReasonSchema =
|
|
477
|
+
state: z10.enum(["active", "retired"]),
|
|
478
|
+
status: z10.enum(["readable", "shredded", "unreadable"]),
|
|
479
|
+
taskID: z10.string().nullable(),
|
|
480
|
+
text: z10.string().optional(),
|
|
481
|
+
version: z10.int().positive(),
|
|
482
|
+
writerModel: z10.string().nullable()
|
|
483
|
+
});
|
|
484
|
+
var reviewReasonSchema = z10.enum([
|
|
462
485
|
"no_quote",
|
|
463
486
|
"quote_not_typed",
|
|
464
487
|
"quote_in_quoted_block",
|
|
@@ -477,70 +500,70 @@ var reviewReasonSchema = z8.enum([
|
|
|
477
500
|
"labels",
|
|
478
501
|
"ask_rule"
|
|
479
502
|
]);
|
|
480
|
-
var proposalSourceSchema =
|
|
503
|
+
var proposalSourceSchema = z10.object({
|
|
481
504
|
origin: proposalOriginSchema,
|
|
482
|
-
proposedAt:
|
|
483
|
-
thread:
|
|
484
|
-
});
|
|
485
|
-
var proposalLabelsSchema =
|
|
486
|
-
gist:
|
|
487
|
-
isLabelOnly:
|
|
488
|
-
topic:
|
|
489
|
-
triggers:
|
|
490
|
-
});
|
|
491
|
-
var memoryProposalSchema =
|
|
492
|
-
actionHash:
|
|
493
|
-
createdAt:
|
|
505
|
+
proposedAt: z10.date(),
|
|
506
|
+
thread: z10.string().nullable()
|
|
507
|
+
});
|
|
508
|
+
var proposalLabelsSchema = z10.object({
|
|
509
|
+
gist: z10.string(),
|
|
510
|
+
isLabelOnly: z10.boolean(),
|
|
511
|
+
topic: z10.string(),
|
|
512
|
+
triggers: z10.array(z10.string())
|
|
513
|
+
});
|
|
514
|
+
var memoryProposalSchema = z10.object({
|
|
515
|
+
actionHash: z10.string(),
|
|
516
|
+
createdAt: z10.date(),
|
|
494
517
|
evidence: evidenceSchema.nullable(),
|
|
495
518
|
image: ownerImageSchema.nullable(),
|
|
496
|
-
isPinned:
|
|
497
|
-
itemID:
|
|
519
|
+
isPinned: z10.boolean(),
|
|
520
|
+
itemID: z10.string(),
|
|
498
521
|
kind: kindSchema,
|
|
499
522
|
labels: proposalLabelsSchema.nullable(),
|
|
500
|
-
lapseAt:
|
|
523
|
+
lapseAt: z10.date(),
|
|
501
524
|
newSubject: subjectSchema.nullable(),
|
|
502
|
-
operation:
|
|
525
|
+
operation: z10.enum(["remember", "retire", "pin"]),
|
|
503
526
|
origin: proposalOriginSchema,
|
|
504
|
-
proposalID:
|
|
505
|
-
quote:
|
|
527
|
+
proposalID: z10.string(),
|
|
528
|
+
quote: z10.string().nullable(),
|
|
506
529
|
reason: reviewReasonSchema,
|
|
507
530
|
source: sourceSchema,
|
|
508
|
-
sources:
|
|
531
|
+
sources: z10.array(proposalSourceSchema),
|
|
509
532
|
subject: subjectSchema,
|
|
510
|
-
targetVersion:
|
|
511
|
-
text:
|
|
512
|
-
until:
|
|
533
|
+
targetVersion: z10.int().positive().nullable(),
|
|
534
|
+
text: z10.string(),
|
|
535
|
+
until: z10.date().nullable()
|
|
513
536
|
});
|
|
514
|
-
var revisionTargetSchema =
|
|
515
|
-
var memoryItemDetailSchema = memoryItemSchema.extend({ versions:
|
|
516
|
-
var forgetLossSchema =
|
|
517
|
-
evidenceMessages:
|
|
518
|
-
proposals:
|
|
537
|
+
var revisionTargetSchema = z10.object({ itemID: itemIDSchema, version: z10.int().positive() });
|
|
538
|
+
var memoryItemDetailSchema = memoryItemSchema.extend({ versions: z10.array(memoryVersionSchema) });
|
|
539
|
+
var forgetLossSchema = z10.object({
|
|
540
|
+
evidenceMessages: z10.int().nonnegative(),
|
|
541
|
+
proposals: z10.int().nonnegative()
|
|
519
542
|
});
|
|
520
543
|
var forgetPreviewSchema = memoryItemDetailSchema.extend({ lost: forgetLossSchema });
|
|
521
|
-
var retiredForgetPreviewSchema =
|
|
522
|
-
hasMore:
|
|
523
|
-
items:
|
|
544
|
+
var retiredForgetPreviewSchema = z10.object({
|
|
545
|
+
hasMore: z10.boolean(),
|
|
546
|
+
items: z10.array(memoryItemSchema.extend({ lost: forgetLossSchema }))
|
|
524
547
|
});
|
|
525
|
-
var retiredForgetSchema =
|
|
526
|
-
clientActionID:
|
|
527
|
-
targets:
|
|
548
|
+
var retiredForgetSchema = z10.object({
|
|
549
|
+
clientActionID: z10.uuid(),
|
|
550
|
+
targets: z10.array(revisionTargetSchema).min(1).max(100).refine((targets) => new Set(targets.map((target) => target.itemID)).size === targets.length, {
|
|
528
551
|
message: "Each item appears once"
|
|
529
552
|
})
|
|
530
553
|
});
|
|
531
|
-
var forgetStatusSchema =
|
|
532
|
-
deleted:
|
|
533
|
-
pending:
|
|
554
|
+
var forgetStatusSchema = z10.object({
|
|
555
|
+
deleted: z10.array(z10.string()),
|
|
556
|
+
pending: z10.array(z10.string()),
|
|
534
557
|
backup: forgetBackupSchema
|
|
535
558
|
});
|
|
536
|
-
var versionTargetSchema =
|
|
537
|
-
clientActionID:
|
|
559
|
+
var versionTargetSchema = z10.object({
|
|
560
|
+
clientActionID: z10.uuid(),
|
|
538
561
|
itemID: itemIDSchema,
|
|
539
|
-
version:
|
|
562
|
+
version: z10.int().positive()
|
|
540
563
|
});
|
|
541
|
-
var versionResultSchema =
|
|
542
|
-
var noticeEntrySchema =
|
|
543
|
-
change:
|
|
564
|
+
var versionResultSchema = z10.object({ itemID: z10.string(), version: z10.int().positive() });
|
|
565
|
+
var noticeEntrySchema = z10.object({
|
|
566
|
+
change: z10.enum([
|
|
544
567
|
"created",
|
|
545
568
|
"edited",
|
|
546
569
|
"retired",
|
|
@@ -551,43 +574,43 @@ var noticeEntrySchema = z8.object({
|
|
|
551
574
|
"pinned",
|
|
552
575
|
"unpinned"
|
|
553
576
|
]),
|
|
554
|
-
isKept:
|
|
555
|
-
item: memoryItemSchema.extend({ change:
|
|
556
|
-
itemID:
|
|
557
|
-
proposalID:
|
|
558
|
-
sequence:
|
|
559
|
-
version:
|
|
560
|
-
});
|
|
561
|
-
var memoryNoticeSchema =
|
|
562
|
-
entries:
|
|
563
|
-
kind:
|
|
564
|
-
messageSequence:
|
|
565
|
-
noticeKey:
|
|
566
|
-
proposed:
|
|
567
|
-
remembered:
|
|
568
|
-
retired:
|
|
569
|
-
sequence:
|
|
577
|
+
isKept: z10.boolean(),
|
|
578
|
+
item: memoryItemSchema.extend({ change: z10.enum(["created", "edited", "retired", "restored", "undone"]) }).nullable(),
|
|
579
|
+
itemID: z10.string(),
|
|
580
|
+
proposalID: z10.string().nullable(),
|
|
581
|
+
sequence: z10.int().nonnegative(),
|
|
582
|
+
version: z10.int().positive().nullable()
|
|
583
|
+
});
|
|
584
|
+
var memoryNoticeSchema = z10.object({
|
|
585
|
+
entries: z10.array(noticeEntrySchema),
|
|
586
|
+
kind: z10.enum(["turn", "run"]),
|
|
587
|
+
messageSequence: z10.int().nonnegative().nullable(),
|
|
588
|
+
noticeKey: z10.string(),
|
|
589
|
+
proposed: z10.int().nonnegative(),
|
|
590
|
+
remembered: z10.int().nonnegative(),
|
|
591
|
+
retired: z10.int().nonnegative(),
|
|
592
|
+
sequence: z10.int().nonnegative()
|
|
570
593
|
});
|
|
571
594
|
var memoryViewContract = {
|
|
572
|
-
listItems: memoryView.errors({ INVALID_CURSOR: { message: "No page returned this cursor", status: 400 } }).input(
|
|
573
|
-
after:
|
|
595
|
+
listItems: memoryView.errors({ INVALID_CURSOR: { message: "No page returned this cursor", status: 400 } }).input(z10.object({
|
|
596
|
+
after: z10.string().max(20).optional(),
|
|
574
597
|
kind: kindSchema.optional(),
|
|
575
|
-
limit:
|
|
576
|
-
state:
|
|
577
|
-
})).output(
|
|
578
|
-
findItems: memoryView.input(
|
|
579
|
-
items:
|
|
580
|
-
searchMode:
|
|
598
|
+
limit: z10.int().min(1).max(100).optional(),
|
|
599
|
+
state: z10.enum(["active", "retired", "forgotten"])
|
|
600
|
+
})).output(z10.object({ items: z10.array(memoryItemSchema), next: z10.string().nullable() })),
|
|
601
|
+
findItems: memoryView.input(z10.object({ query: z10.string().min(1).max(500) })).output(z10.object({
|
|
602
|
+
items: z10.array(memoryMatchSchema),
|
|
603
|
+
searchMode: z10.enum(["hybrid", "keyword", "keyword-fallback"])
|
|
581
604
|
})),
|
|
582
|
-
readPinnedCore: memoryView.output(
|
|
583
|
-
budget:
|
|
584
|
-
items:
|
|
585
|
-
tokens:
|
|
605
|
+
readPinnedCore: memoryView.output(z10.object({
|
|
606
|
+
budget: z10.int().nonnegative(),
|
|
607
|
+
items: z10.array(memoryItemSchema),
|
|
608
|
+
tokens: z10.int().nonnegative()
|
|
586
609
|
})),
|
|
587
|
-
readItem: memoryView.errors({ MEMORY_ITEM_NOT_FOUND: { message: "No memory item has this ID", status: 404 } }).input(
|
|
610
|
+
readItem: memoryView.errors({ MEMORY_ITEM_NOT_FOUND: { message: "No memory item has this ID", status: 404 } }).input(z10.object({ itemID: itemIDSchema })).output(memoryItemDetailSchema),
|
|
588
611
|
retire: memoryChange.input(versionTargetSchema).output(versionResultSchema),
|
|
589
612
|
restore: memoryChange.input(versionTargetSchema).output(versionResultSchema),
|
|
590
|
-
listNotices: memoryView.input(
|
|
613
|
+
listNotices: memoryView.input(z10.object({ thread: z10.string().min(1).max(200) })).output(z10.object({ notices: z10.array(memoryNoticeSchema) })),
|
|
591
614
|
undo: memoryChange.errors({
|
|
592
615
|
PINNED_CORE_FULL: { message: "The undo takes the pinned core past its budget", status: 409 },
|
|
593
616
|
VERSION_REMOVED: {
|
|
@@ -599,14 +622,14 @@ var memoryViewContract = {
|
|
|
599
622
|
previewForget: memoryView.errors({
|
|
600
623
|
MEMORY_ITEM_NOT_FOUND: { message: "No memory item has this ID", status: 404 },
|
|
601
624
|
STALE_VERSION: { message: "The memory item has moved past that version", status: 409 }
|
|
602
|
-
}).input(
|
|
603
|
-
forget: memoryChange.input(versionTargetSchema).output(
|
|
625
|
+
}).input(z10.object({ itemID: itemIDSchema, version: z10.int().positive() })).output(forgetPreviewSchema),
|
|
626
|
+
forget: memoryChange.input(versionTargetSchema).output(z10.object({ itemID: z10.string(), backup: forgetBackupSchema })),
|
|
604
627
|
previewForgetRetired: memoryView.output(retiredForgetPreviewSchema),
|
|
605
628
|
forgetRetired: memoryChange.input(retiredForgetSchema).output(forgetStatusSchema),
|
|
606
|
-
readForgetStatus: memoryView.input(
|
|
629
|
+
readForgetStatus: memoryView.input(z10.object({ itemIDs: z10.array(itemIDSchema).min(1).max(100) })).output(forgetStatusSchema),
|
|
607
630
|
pin: memoryChange.errors({
|
|
608
631
|
PINNED_CORE_FULL: { message: "The pin takes the pinned core past its budget", status: 409 }
|
|
609
|
-
}).input(versionTargetSchema.extend({ isPinned:
|
|
632
|
+
}).input(versionTargetSchema.extend({ isPinned: z10.boolean() })).output(z10.object({ isPinned: z10.boolean(), itemID: z10.string() })),
|
|
610
633
|
...memoryExportContract,
|
|
611
634
|
...momentContract
|
|
612
635
|
};
|
|
@@ -617,11 +640,11 @@ var noPasskeyError = {
|
|
|
617
640
|
};
|
|
618
641
|
|
|
619
642
|
// src/contract/passkey-failed-error.ts
|
|
620
|
-
import { z as
|
|
643
|
+
import { z as z12 } from "zod";
|
|
621
644
|
|
|
622
645
|
// src/contract/passkey-failure-schema.ts
|
|
623
|
-
import { z as
|
|
624
|
-
var passkeyFailureSchema =
|
|
646
|
+
import { z as z11 } from "zod";
|
|
647
|
+
var passkeyFailureSchema = z11.enum([
|
|
625
648
|
"unknown_challenge",
|
|
626
649
|
"binding",
|
|
627
650
|
"unknown_passkey",
|
|
@@ -636,229 +659,229 @@ var passkeyFailedError = {
|
|
|
636
659
|
PASSKEY_FAILED: {
|
|
637
660
|
message: "The passkey check failed",
|
|
638
661
|
status: 403,
|
|
639
|
-
data:
|
|
662
|
+
data: z12.object({ reason: passkeyFailureSchema })
|
|
640
663
|
}
|
|
641
664
|
};
|
|
642
665
|
|
|
643
666
|
// src/contract/approval-contract.ts
|
|
644
|
-
var stateSchema =
|
|
645
|
-
var hashesSchema =
|
|
646
|
-
var versionSchema =
|
|
647
|
-
var taskSchema =
|
|
648
|
-
var proposalSchema =
|
|
649
|
-
proposalID:
|
|
650
|
-
shortID:
|
|
651
|
-
kind:
|
|
652
|
-
riskClass:
|
|
653
|
-
actionHash:
|
|
654
|
-
ruleHash:
|
|
655
|
-
cause:
|
|
667
|
+
var stateSchema = z13.enum(["pending", "deferred", "approved", "declined", "lapsed", "withdrawn"]);
|
|
668
|
+
var hashesSchema = z13.object({ actionHash: z13.string(), ruleHash: z13.string().nullable() });
|
|
669
|
+
var versionSchema = z13.int().positive();
|
|
670
|
+
var taskSchema = z13.object({ id: z13.string(), name: z13.string() });
|
|
671
|
+
var proposalSchema = z13.object({
|
|
672
|
+
proposalID: z13.string(),
|
|
673
|
+
shortID: z13.string(),
|
|
674
|
+
kind: z13.enum(["action", "memory_write", "internal_change"]),
|
|
675
|
+
riskClass: z13.enum(["routine", "always_ask", "lifting"]),
|
|
676
|
+
actionHash: z13.string(),
|
|
677
|
+
ruleHash: z13.string().nullable(),
|
|
678
|
+
cause: z13.string(),
|
|
656
679
|
state: stateSchema,
|
|
657
|
-
createdAt:
|
|
658
|
-
lapsesAt:
|
|
659
|
-
deadlineAt:
|
|
660
|
-
deferGeneration:
|
|
661
|
-
deferUntil:
|
|
662
|
-
thread:
|
|
663
|
-
taskID:
|
|
664
|
-
sequence:
|
|
665
|
-
});
|
|
666
|
-
var bodySchema =
|
|
667
|
-
sentence:
|
|
668
|
-
fields:
|
|
669
|
-
ruleSentence:
|
|
670
|
-
approveLabel:
|
|
671
|
-
rule:
|
|
680
|
+
createdAt: z13.date(),
|
|
681
|
+
lapsesAt: z13.date(),
|
|
682
|
+
deadlineAt: z13.date().nullable(),
|
|
683
|
+
deferGeneration: z13.int().nonnegative(),
|
|
684
|
+
deferUntil: z13.date().nullable(),
|
|
685
|
+
thread: z13.string().nullable(),
|
|
686
|
+
taskID: z13.string().nullable(),
|
|
687
|
+
sequence: z13.int().positive()
|
|
688
|
+
});
|
|
689
|
+
var bodySchema = z13.object({
|
|
690
|
+
sentence: z13.string(),
|
|
691
|
+
fields: z13.record(z13.string(), z13.string()),
|
|
692
|
+
ruleSentence: z13.string().nullable(),
|
|
693
|
+
approveLabel: z13.string(),
|
|
694
|
+
rule: z13.record(z13.string(), z13.unknown()).optional(),
|
|
672
695
|
memory: memoryProposalSchema.optional()
|
|
673
696
|
});
|
|
674
|
-
var itemSchema =
|
|
675
|
-
group:
|
|
697
|
+
var itemSchema = z13.object({
|
|
698
|
+
group: z13.enum(["always_ask", "routine", "memory", "deferred"]),
|
|
676
699
|
proposal: proposalSchema,
|
|
677
700
|
body: bodySchema,
|
|
678
701
|
task: taskSchema.nullable(),
|
|
679
|
-
choices:
|
|
680
|
-
passkeyChoices:
|
|
702
|
+
choices: z13.array(choiceSchema),
|
|
703
|
+
passkeyChoices: z13.array(choiceSchema)
|
|
681
704
|
});
|
|
682
|
-
var unknownReasonSchema =
|
|
705
|
+
var unknownReasonSchema = z13.enum([
|
|
683
706
|
"inconclusive",
|
|
684
707
|
"unknown_streak",
|
|
685
708
|
"no_reconcile",
|
|
686
709
|
"key_expired",
|
|
687
710
|
"not_found_ask"
|
|
688
711
|
]);
|
|
689
|
-
var checkAnswerSchema =
|
|
690
|
-
var attemptSchema =
|
|
691
|
-
var checkSchema =
|
|
692
|
-
var unknownOutcomeSchema =
|
|
693
|
-
actionID:
|
|
694
|
-
tool:
|
|
695
|
-
sentence:
|
|
696
|
-
fields:
|
|
697
|
-
riskClass:
|
|
712
|
+
var checkAnswerSchema = z13.enum(["found", "not_found", "inconclusive"]);
|
|
713
|
+
var attemptSchema = z13.object({ attempt: z13.int().nonnegative(), at: z13.date() });
|
|
714
|
+
var checkSchema = z13.object({ answer: checkAnswerSchema, at: z13.date() });
|
|
715
|
+
var unknownOutcomeSchema = z13.object({
|
|
716
|
+
actionID: z13.string(),
|
|
717
|
+
tool: z13.string(),
|
|
718
|
+
sentence: z13.string(),
|
|
719
|
+
fields: z13.record(z13.string(), z13.string()),
|
|
720
|
+
riskClass: z13.enum(["routine", "always_ask", "lifting"]),
|
|
698
721
|
reason: unknownReasonSchema,
|
|
699
|
-
becameUnknownAt:
|
|
700
|
-
attempts:
|
|
701
|
-
checks:
|
|
722
|
+
becameUnknownAt: z13.date(),
|
|
723
|
+
attempts: z13.array(attemptSchema),
|
|
724
|
+
checks: z13.array(checkSchema)
|
|
702
725
|
});
|
|
703
|
-
var unknownChoiceSchema =
|
|
704
|
-
var unknownItemSchema =
|
|
705
|
-
group:
|
|
726
|
+
var unknownChoiceSchema = z13.enum(["happened", "retry", "drop"]);
|
|
727
|
+
var unknownItemSchema = z13.object({
|
|
728
|
+
group: z13.literal("unknown_outcome"),
|
|
706
729
|
action: unknownOutcomeSchema,
|
|
707
730
|
task: taskSchema.nullable(),
|
|
708
|
-
choices:
|
|
709
|
-
passkeyChoices:
|
|
731
|
+
choices: z13.array(unknownChoiceSchema),
|
|
732
|
+
passkeyChoices: z13.array(unknownChoiceSchema)
|
|
710
733
|
});
|
|
711
|
-
var callSchema =
|
|
712
|
-
state:
|
|
713
|
-
reason:
|
|
734
|
+
var callSchema = z13.object({
|
|
735
|
+
state: z13.enum(["waiting", "applied", "failed", "unknown"]),
|
|
736
|
+
reason: z13.string().nullable()
|
|
714
737
|
});
|
|
715
|
-
var readItemSchema =
|
|
738
|
+
var readItemSchema = z13.object({
|
|
716
739
|
proposal: proposalSchema,
|
|
717
740
|
body: bodySchema.nullable(),
|
|
718
741
|
task: taskSchema.nullable(),
|
|
719
|
-
choices:
|
|
720
|
-
passkeyChoices:
|
|
721
|
-
answeredOn:
|
|
722
|
-
isAnsweredHere:
|
|
742
|
+
choices: z13.array(choiceSchema),
|
|
743
|
+
passkeyChoices: z13.array(choiceSchema),
|
|
744
|
+
answeredOn: z13.string().nullable(),
|
|
745
|
+
isAnsweredHere: z13.boolean(),
|
|
723
746
|
call: callSchema.nullable()
|
|
724
747
|
});
|
|
725
|
-
var deferSettingsSchema =
|
|
726
|
-
defaultMinutes:
|
|
727
|
-
eveningAt:
|
|
728
|
-
morningAt:
|
|
729
|
-
zone:
|
|
748
|
+
var deferSettingsSchema = z13.object({
|
|
749
|
+
defaultMinutes: z13.int().positive(),
|
|
750
|
+
eveningAt: z13.string(),
|
|
751
|
+
morningAt: z13.string(),
|
|
752
|
+
zone: z13.string()
|
|
730
753
|
});
|
|
731
|
-
var memoryAnswerSchema =
|
|
732
|
-
editedText:
|
|
733
|
-
revisionOf:
|
|
734
|
-
ignoreCloseMatch:
|
|
754
|
+
var memoryAnswerSchema = z13.object({
|
|
755
|
+
editedText: z13.string().optional(),
|
|
756
|
+
revisionOf: z13.object({ itemID: z13.string(), version: versionSchema }).optional(),
|
|
757
|
+
ignoreCloseMatch: z13.boolean().optional()
|
|
735
758
|
});
|
|
736
|
-
var answerSchema =
|
|
737
|
-
proposalID:
|
|
738
|
-
actionHash:
|
|
759
|
+
var answerSchema = z13.object({
|
|
760
|
+
proposalID: z13.string().min(1).max(200),
|
|
761
|
+
actionHash: z13.string().min(1),
|
|
739
762
|
choice: choiceSchema,
|
|
740
|
-
ruleHash:
|
|
741
|
-
deferUntil:
|
|
742
|
-
note:
|
|
743
|
-
clientActionID:
|
|
763
|
+
ruleHash: z13.string().optional(),
|
|
764
|
+
deferUntil: z13.date().optional(),
|
|
765
|
+
note: z13.string().min(1).max(500).optional(),
|
|
766
|
+
clientActionID: z13.uuid(),
|
|
744
767
|
memory: memoryAnswerSchema.optional()
|
|
745
768
|
});
|
|
746
769
|
var passkeyAnswerSchema = answerSchema.extend({
|
|
747
770
|
passkey: authenticationResponseSchema.optional()
|
|
748
771
|
});
|
|
749
|
-
var ruleRefSchema =
|
|
750
|
-
var closeMatchSchema =
|
|
751
|
-
var approvedSchema =
|
|
752
|
-
proposalID:
|
|
753
|
-
state:
|
|
772
|
+
var ruleRefSchema = z13.object({ id: z13.string(), revision: versionSchema });
|
|
773
|
+
var closeMatchSchema = z13.object({ itemID: z13.string(), text: z13.string(), version: versionSchema });
|
|
774
|
+
var approvedSchema = z13.object({
|
|
775
|
+
proposalID: z13.string(),
|
|
776
|
+
state: z13.literal("approved"),
|
|
754
777
|
rule: ruleRefSchema.optional()
|
|
755
778
|
});
|
|
756
|
-
var closedSchema =
|
|
757
|
-
var closeMatchResultSchema =
|
|
758
|
-
proposalID:
|
|
759
|
-
state:
|
|
779
|
+
var closedSchema = z13.object({ proposalID: z13.string(), state: z13.enum(["declined", "deferred"]) });
|
|
780
|
+
var closeMatchResultSchema = z13.object({
|
|
781
|
+
proposalID: z13.string(),
|
|
782
|
+
state: z13.literal("pending"),
|
|
760
783
|
closeMatch: closeMatchSchema
|
|
761
784
|
});
|
|
762
|
-
var resultSchema =
|
|
785
|
+
var resultSchema = z13.discriminatedUnion("state", [
|
|
763
786
|
approvedSchema,
|
|
764
787
|
closedSchema,
|
|
765
788
|
closeMatchResultSchema
|
|
766
789
|
]);
|
|
767
|
-
var refusedSchema =
|
|
768
|
-
proposalID:
|
|
769
|
-
error:
|
|
790
|
+
var refusedSchema = z13.object({
|
|
791
|
+
proposalID: z13.string(),
|
|
792
|
+
error: z13.enum(["CONFLICT", "CLOSED", "NOT_ALLOWED", "PASSKEY_REQUIRED"]),
|
|
770
793
|
current: hashesSchema.optional(),
|
|
771
794
|
state: stateSchema.optional(),
|
|
772
|
-
reason:
|
|
795
|
+
reason: z13.string().optional()
|
|
773
796
|
});
|
|
774
797
|
var answerErrors = signedIn.errors(reusedIDErrors).errors({
|
|
775
798
|
CONFLICT: {
|
|
776
799
|
message: "The proposal changed since the card showed it",
|
|
777
800
|
status: 409,
|
|
778
|
-
data:
|
|
801
|
+
data: z13.object({ current: hashesSchema })
|
|
779
802
|
},
|
|
780
803
|
CLOSED: {
|
|
781
804
|
message: "The proposal is answered, withdrawn or lapsed",
|
|
782
805
|
status: 409,
|
|
783
|
-
data:
|
|
806
|
+
data: z13.object({ state: stateSchema })
|
|
784
807
|
},
|
|
785
808
|
NOT_ALLOWED: {
|
|
786
809
|
message: "The proposal does not take this answer",
|
|
787
810
|
status: 403,
|
|
788
|
-
data:
|
|
811
|
+
data: z13.object({ reason: z13.string() })
|
|
789
812
|
},
|
|
790
813
|
PASSKEY_REQUIRED: { message: "This answer needs a passkey check", status: 403 },
|
|
791
814
|
...noPasskeyError,
|
|
792
815
|
...passkeyFailedError
|
|
793
816
|
});
|
|
794
|
-
var listedSchema =
|
|
817
|
+
var listedSchema = z13.object({
|
|
795
818
|
defer: deferSettingsSchema,
|
|
796
|
-
items:
|
|
797
|
-
unknownOutcomes:
|
|
819
|
+
items: z13.array(itemSchema),
|
|
820
|
+
unknownOutcomes: z13.array(unknownItemSchema)
|
|
798
821
|
});
|
|
799
|
-
var unknownAnswerSchema =
|
|
800
|
-
actionID:
|
|
822
|
+
var unknownAnswerSchema = z13.object({
|
|
823
|
+
actionID: z13.string().min(1).max(200),
|
|
801
824
|
choice: unknownChoiceSchema,
|
|
802
|
-
clientActionID:
|
|
825
|
+
clientActionID: z13.uuid(),
|
|
803
826
|
passkey: authenticationResponseSchema.optional()
|
|
804
827
|
});
|
|
805
828
|
var unknownAnswerErrors = signedIn.errors(reusedIDErrors).errors({
|
|
806
829
|
NOT_ALLOWED: {
|
|
807
830
|
message: "The action waits for no answer about its outcome",
|
|
808
831
|
status: 403,
|
|
809
|
-
data:
|
|
832
|
+
data: z13.object({ reason: z13.string() })
|
|
810
833
|
},
|
|
811
834
|
PASSKEY_REQUIRED: { message: "This answer needs a passkey check", status: 403 },
|
|
812
835
|
...noPasskeyError,
|
|
813
836
|
...passkeyFailedError
|
|
814
837
|
});
|
|
815
|
-
var readInputSchema =
|
|
816
|
-
proposalIDs:
|
|
838
|
+
var readInputSchema = z13.object({
|
|
839
|
+
proposalIDs: z13.array(z13.string().min(1).max(200)).min(1).max(100)
|
|
817
840
|
});
|
|
818
|
-
var batchInputSchema =
|
|
819
|
-
var batchResultSchema =
|
|
841
|
+
var batchInputSchema = z13.object({ answers: z13.array(answerSchema).min(1).max(100) });
|
|
842
|
+
var batchResultSchema = z13.object({ results: z13.array(z13.union([resultSchema, refusedSchema])) });
|
|
820
843
|
var approvalContract = {
|
|
821
844
|
listItems: signedIn.output(listedSchema),
|
|
822
|
-
readProposals: signedIn.input(readInputSchema).output(
|
|
845
|
+
readProposals: signedIn.input(readInputSchema).output(z13.object({ proposals: z13.array(readItemSchema) })),
|
|
823
846
|
answerProposal: answerErrors.input(passkeyAnswerSchema).output(resultSchema),
|
|
824
|
-
answerUnknownOutcome: unknownAnswerErrors.input(unknownAnswerSchema).output(
|
|
847
|
+
answerUnknownOutcome: unknownAnswerErrors.input(unknownAnswerSchema).output(z13.object({ actionID: z13.string(), choice: unknownChoiceSchema })),
|
|
825
848
|
answerProposals: signedIn.errors(reusedIDErrors).input(batchInputSchema).output(batchResultSchema)
|
|
826
849
|
};
|
|
827
850
|
|
|
828
851
|
// src/contract/clipped-payload-schema.ts
|
|
829
|
-
import { z as
|
|
830
|
-
var fieldSchema =
|
|
831
|
-
var pathStepSchema =
|
|
832
|
-
var clippedPayloadSchema =
|
|
852
|
+
import { z as z14 } from "zod";
|
|
853
|
+
var fieldSchema = z14.enum(["toolCall.input", "toolCall.content", "worker.text", "worker.detail"]);
|
|
854
|
+
var pathStepSchema = z14.union([z14.string(), z14.number()]);
|
|
855
|
+
var clippedPayloadSchema = z14.object({
|
|
833
856
|
field: fieldSchema,
|
|
834
|
-
path:
|
|
835
|
-
bytes:
|
|
857
|
+
path: z14.array(pathStepSchema),
|
|
858
|
+
bytes: z14.number()
|
|
836
859
|
});
|
|
837
860
|
|
|
838
861
|
// src/contract/definition-notice-schema.ts
|
|
839
|
-
import { z as
|
|
840
|
-
var definitionNoticeSchema =
|
|
841
|
-
definitionID:
|
|
842
|
-
name:
|
|
843
|
-
operation:
|
|
844
|
-
shortID:
|
|
845
|
-
changeID:
|
|
846
|
-
hasVersion:
|
|
847
|
-
rendered:
|
|
848
|
-
next:
|
|
849
|
-
state:
|
|
850
|
-
isUnreadable:
|
|
862
|
+
import { z as z15 } from "zod";
|
|
863
|
+
var definitionNoticeSchema = z15.object({
|
|
864
|
+
definitionID: z15.string(),
|
|
865
|
+
name: z15.string().nullable(),
|
|
866
|
+
operation: z15.enum(["add", "change", "remove", "undo"]),
|
|
867
|
+
shortID: z15.string(),
|
|
868
|
+
changeID: z15.string(),
|
|
869
|
+
hasVersion: z15.boolean(),
|
|
870
|
+
rendered: z15.string().nullable(),
|
|
871
|
+
next: z15.string().nullable(),
|
|
872
|
+
state: z15.enum(["in_force", "superseded", "adopted", "retired"]),
|
|
873
|
+
isUnreadable: z15.boolean()
|
|
851
874
|
});
|
|
852
875
|
|
|
853
876
|
// src/contract/definitions-contract.ts
|
|
854
|
-
import { z as
|
|
855
|
-
var operationSchema =
|
|
856
|
-
var headSchema =
|
|
857
|
-
changeID:
|
|
858
|
-
shortID:
|
|
877
|
+
import { z as z16 } from "zod";
|
|
878
|
+
var operationSchema = z16.enum(["add", "change", "remove", "undo"]);
|
|
879
|
+
var headSchema = z16.object({
|
|
880
|
+
changeID: z16.string(),
|
|
881
|
+
shortID: z16.string(),
|
|
859
882
|
operation: operationSchema
|
|
860
883
|
});
|
|
861
|
-
var replacedSchema =
|
|
884
|
+
var replacedSchema = z16.object({ head: headSchema });
|
|
862
885
|
var undo = signedIn.errors(reusedIDErrors).errors({
|
|
863
886
|
NOT_STARTED: { message: "Task definitions are not ready yet", status: 503 },
|
|
864
887
|
NOT_FOUND: { message: "No change has this ID", status: 404 },
|
|
@@ -870,12 +893,12 @@ var undo = signedIn.errors(reusedIDErrors).errors({
|
|
|
870
893
|
REPO_MOVED: {
|
|
871
894
|
message: "The definitions repo changed this definition since",
|
|
872
895
|
status: 409,
|
|
873
|
-
data:
|
|
896
|
+
data: z16.object({ seedSequence: z16.int().nonnegative() })
|
|
874
897
|
},
|
|
875
898
|
NOT_IN_FORCE: {
|
|
876
899
|
message: "The change is no longer in force",
|
|
877
900
|
status: 409,
|
|
878
|
-
data:
|
|
901
|
+
data: z16.object({ cause: z16.enum(["one_shot_fired", "one_shot_skipped", "kept_repo"]) })
|
|
879
902
|
},
|
|
880
903
|
ONE_SHOT_OVER_REPO: {
|
|
881
904
|
message: "A one-time trigger cannot go back over a definition in the repo",
|
|
@@ -884,10 +907,10 @@ var undo = signedIn.errors(reusedIDErrors).errors({
|
|
|
884
907
|
ONE_SHOT_PAST: { message: "The time of that one-time trigger has passed", status: 409 }
|
|
885
908
|
});
|
|
886
909
|
var definitionsContract = {
|
|
887
|
-
undo: undo.input(
|
|
888
|
-
definitionID:
|
|
889
|
-
changeID:
|
|
890
|
-
restored:
|
|
910
|
+
undo: undo.input(z16.object({ clientActionID: z16.uuid(), changeID: z16.string().min(1).max(64) })).output(z16.object({
|
|
911
|
+
definitionID: z16.string(),
|
|
912
|
+
changeID: z16.string(),
|
|
913
|
+
restored: z16.literal("repo").optional()
|
|
891
914
|
}))
|
|
892
915
|
};
|
|
893
916
|
|
|
@@ -906,10 +929,10 @@ var imageNotFoundError = {
|
|
|
906
929
|
};
|
|
907
930
|
|
|
908
931
|
// src/contract/image-refused-error.ts
|
|
909
|
-
import { z as
|
|
910
|
-
var imageRefusedDataSchema =
|
|
911
|
-
position:
|
|
912
|
-
reason:
|
|
932
|
+
import { z as z17 } from "zod";
|
|
933
|
+
var imageRefusedDataSchema = z17.object({
|
|
934
|
+
position: z17.int().nonnegative().nullable(),
|
|
935
|
+
reason: z17.enum(["too_many", "too_large", "unsupported_type"])
|
|
913
936
|
});
|
|
914
937
|
var imageRefusedError = {
|
|
915
938
|
message: "An image is too large, of a type nixie does not take, or one too many",
|
|
@@ -918,14 +941,8 @@ var imageRefusedError = {
|
|
|
918
941
|
};
|
|
919
942
|
|
|
920
943
|
// src/contract/listed-task-schema.ts
|
|
921
|
-
import { z as
|
|
922
|
-
|
|
923
|
-
// src/contract/thread-schema.ts
|
|
924
|
-
import { z as z16 } from "zod";
|
|
925
|
-
var threadSchema = z16.string().min(1).max(200);
|
|
926
|
-
|
|
927
|
-
// src/contract/listed-task-schema.ts
|
|
928
|
-
var taskStateSchema = z17.enum([
|
|
944
|
+
import { z as z18 } from "zod";
|
|
945
|
+
var taskStateSchema = z18.enum([
|
|
929
946
|
"ready",
|
|
930
947
|
"running",
|
|
931
948
|
"waiting",
|
|
@@ -935,142 +952,142 @@ var taskStateSchema = z17.enum([
|
|
|
935
952
|
"failed",
|
|
936
953
|
"closed"
|
|
937
954
|
]);
|
|
938
|
-
var listedStateSchema =
|
|
939
|
-
var runFireSchema =
|
|
940
|
-
scheduledFor:
|
|
941
|
-
firedAt:
|
|
942
|
-
isCatchUp:
|
|
943
|
-
});
|
|
944
|
-
var taskControlSchema =
|
|
945
|
-
var actionCountSchema =
|
|
946
|
-
var listedTaskSchema =
|
|
947
|
-
actions:
|
|
955
|
+
var listedStateSchema = z18.enum([...taskStateSchema.options, "idle", "finished", "asleep"]);
|
|
956
|
+
var runFireSchema = z18.object({
|
|
957
|
+
scheduledFor: z18.string(),
|
|
958
|
+
firedAt: z18.string(),
|
|
959
|
+
isCatchUp: z18.boolean()
|
|
960
|
+
});
|
|
961
|
+
var taskControlSchema = z18.enum(["pause", "resume", "stop", "restart", "close", "interrupt"]);
|
|
962
|
+
var actionCountSchema = z18.int().nonnegative();
|
|
963
|
+
var listedTaskSchema = z18.object({
|
|
964
|
+
actions: z18.object({
|
|
948
965
|
cancelled: actionCountSchema,
|
|
949
966
|
queued: actionCountSchema,
|
|
950
967
|
started: actionCountSchema
|
|
951
968
|
}),
|
|
952
|
-
brief:
|
|
953
|
-
closedBy:
|
|
954
|
-
controls:
|
|
955
|
-
definitionID:
|
|
956
|
-
disposable:
|
|
969
|
+
brief: z18.string(),
|
|
970
|
+
closedBy: z18.enum(["owner", "nixie", "disposable"]).optional(),
|
|
971
|
+
controls: z18.array(taskControlSchema),
|
|
972
|
+
definitionID: z18.string().optional(),
|
|
973
|
+
disposable: z18.boolean().nullable(),
|
|
957
974
|
fire: runFireSchema.nullable().optional(),
|
|
958
|
-
isPauseRequested:
|
|
959
|
-
isPausedByNixie:
|
|
960
|
-
isTakingMessages:
|
|
961
|
-
lastActivityAt:
|
|
975
|
+
isPauseRequested: z18.boolean(),
|
|
976
|
+
isPausedByNixie: z18.boolean(),
|
|
977
|
+
isTakingMessages: z18.boolean(),
|
|
978
|
+
lastActivityAt: z18.date(),
|
|
962
979
|
listedState: listedStateSchema.optional(),
|
|
963
|
-
name:
|
|
964
|
-
nextRunAt:
|
|
965
|
-
runner:
|
|
980
|
+
name: z18.string(),
|
|
981
|
+
nextRunAt: z18.string().optional(),
|
|
982
|
+
runner: z18.string(),
|
|
966
983
|
state: taskStateSchema,
|
|
967
984
|
taskID: threadSchema,
|
|
968
|
-
wakeable:
|
|
985
|
+
wakeable: z18.boolean().optional(),
|
|
969
986
|
waitingOn: threadSchema.optional()
|
|
970
987
|
});
|
|
971
988
|
|
|
972
989
|
// src/contract/passkey-contract.ts
|
|
973
|
-
import { z as
|
|
990
|
+
import { z as z26 } from "zod";
|
|
974
991
|
|
|
975
992
|
// src/contract/challenge-for-schema.ts
|
|
976
|
-
import { z as
|
|
977
|
-
var challengeForSchema =
|
|
978
|
-
|
|
979
|
-
kind:
|
|
980
|
-
proposalID:
|
|
981
|
-
actionHash:
|
|
993
|
+
import { z as z19 } from "zod";
|
|
994
|
+
var challengeForSchema = z19.discriminatedUnion("kind", [
|
|
995
|
+
z19.object({
|
|
996
|
+
kind: z19.literal("answer"),
|
|
997
|
+
proposalID: z19.string().min(1).max(200),
|
|
998
|
+
actionHash: z19.string().min(1),
|
|
982
999
|
choice: choiceSchema,
|
|
983
|
-
ruleHash:
|
|
1000
|
+
ruleHash: z19.string().optional()
|
|
984
1001
|
}),
|
|
985
|
-
|
|
986
|
-
kind:
|
|
987
|
-
actionID:
|
|
988
|
-
choice:
|
|
1002
|
+
z19.object({
|
|
1003
|
+
kind: z19.literal("unknown_outcome"),
|
|
1004
|
+
actionID: z19.string().min(1).max(200),
|
|
1005
|
+
choice: z19.literal("retry")
|
|
989
1006
|
}),
|
|
990
|
-
|
|
991
|
-
|
|
1007
|
+
z19.object({ kind: z19.literal("register") }),
|
|
1008
|
+
z19.object({ kind: z19.literal("revoke"), passkeyID: z19.string().min(1).max(200) })
|
|
992
1009
|
]);
|
|
993
1010
|
|
|
994
1011
|
// src/contract/creation-options-schema.ts
|
|
995
|
-
import { z as
|
|
1012
|
+
import { z as z23 } from "zod";
|
|
996
1013
|
|
|
997
1014
|
// src/contract/credential-descriptor-schema.ts
|
|
998
|
-
import { z as
|
|
1015
|
+
import { z as z21 } from "zod";
|
|
999
1016
|
|
|
1000
1017
|
// src/contract/transports-schema.ts
|
|
1001
|
-
import { z as
|
|
1002
|
-
var transportSchema =
|
|
1003
|
-
var transportsSchema =
|
|
1018
|
+
import { z as z20 } from "zod";
|
|
1019
|
+
var transportSchema = z20.string().max(40);
|
|
1020
|
+
var transportsSchema = z20.array(transportSchema).max(10);
|
|
1004
1021
|
|
|
1005
1022
|
// src/contract/credential-descriptor-schema.ts
|
|
1006
|
-
var credentialDescriptorSchema =
|
|
1023
|
+
var credentialDescriptorSchema = z21.object({
|
|
1007
1024
|
id: base64URLSchema,
|
|
1008
|
-
type:
|
|
1025
|
+
type: z21.literal("public-key"),
|
|
1009
1026
|
transports: transportsSchema.optional()
|
|
1010
1027
|
});
|
|
1011
1028
|
|
|
1012
1029
|
// src/contract/user-verification-schema.ts
|
|
1013
|
-
import { z as
|
|
1014
|
-
var userVerificationSchema =
|
|
1030
|
+
import { z as z22 } from "zod";
|
|
1031
|
+
var userVerificationSchema = z22.enum(["required", "preferred", "discouraged"]);
|
|
1015
1032
|
|
|
1016
1033
|
// src/contract/creation-options-schema.ts
|
|
1017
|
-
var userSchema =
|
|
1018
|
-
var parameterSchema =
|
|
1019
|
-
var selectionSchema =
|
|
1034
|
+
var userSchema = z23.object({ id: base64URLSchema, name: z23.string(), displayName: z23.string() });
|
|
1035
|
+
var parameterSchema = z23.object({ type: z23.literal("public-key"), alg: z23.int() });
|
|
1036
|
+
var selectionSchema = z23.object({
|
|
1020
1037
|
residentKey: userVerificationSchema,
|
|
1021
|
-
requireResidentKey:
|
|
1038
|
+
requireResidentKey: z23.boolean(),
|
|
1022
1039
|
userVerification: userVerificationSchema
|
|
1023
1040
|
});
|
|
1024
|
-
var creationOptionsSchema =
|
|
1025
|
-
rp:
|
|
1041
|
+
var creationOptionsSchema = z23.object({
|
|
1042
|
+
rp: z23.object({ id: z23.string(), name: z23.string() }),
|
|
1026
1043
|
user: userSchema,
|
|
1027
1044
|
challenge: base64URLSchema,
|
|
1028
|
-
pubKeyCredParams:
|
|
1029
|
-
timeout:
|
|
1030
|
-
excludeCredentials:
|
|
1045
|
+
pubKeyCredParams: z23.array(parameterSchema),
|
|
1046
|
+
timeout: z23.int().positive(),
|
|
1047
|
+
excludeCredentials: z23.array(credentialDescriptorSchema),
|
|
1031
1048
|
authenticatorSelection: selectionSchema,
|
|
1032
|
-
attestation:
|
|
1049
|
+
attestation: z23.enum(["none", "indirect", "direct", "enterprise"])
|
|
1033
1050
|
});
|
|
1034
1051
|
|
|
1035
1052
|
// src/contract/registration-response-schema.ts
|
|
1036
|
-
import { z as
|
|
1037
|
-
var attestationSchema =
|
|
1053
|
+
import { z as z24 } from "zod";
|
|
1054
|
+
var attestationSchema = z24.object({
|
|
1038
1055
|
clientDataJSON: base64URLSchema,
|
|
1039
1056
|
attestationObject: base64URLSchema,
|
|
1040
1057
|
authenticatorData: base64URLSchema.optional(),
|
|
1041
1058
|
transports: transportsSchema.optional(),
|
|
1042
|
-
publicKeyAlgorithm:
|
|
1059
|
+
publicKeyAlgorithm: z24.int().optional(),
|
|
1043
1060
|
publicKey: base64URLSchema.optional()
|
|
1044
1061
|
});
|
|
1045
|
-
var registrationResponseSchema =
|
|
1062
|
+
var registrationResponseSchema = z24.object({
|
|
1046
1063
|
id: base64URLSchema,
|
|
1047
1064
|
rawId: base64URLSchema,
|
|
1048
1065
|
response: attestationSchema,
|
|
1049
|
-
authenticatorAttachment:
|
|
1050
|
-
clientExtensionResults:
|
|
1051
|
-
type:
|
|
1066
|
+
authenticatorAttachment: z24.enum(["cross-platform", "platform"]).optional(),
|
|
1067
|
+
clientExtensionResults: z24.object({}),
|
|
1068
|
+
type: z24.literal("public-key")
|
|
1052
1069
|
});
|
|
1053
1070
|
|
|
1054
1071
|
// src/contract/request-options-schema.ts
|
|
1055
|
-
import { z as
|
|
1056
|
-
var requestOptionsSchema =
|
|
1072
|
+
import { z as z25 } from "zod";
|
|
1073
|
+
var requestOptionsSchema = z25.object({
|
|
1057
1074
|
challenge: base64URLSchema,
|
|
1058
|
-
rpId:
|
|
1059
|
-
allowCredentials:
|
|
1075
|
+
rpId: z25.string(),
|
|
1076
|
+
allowCredentials: z25.array(credentialDescriptorSchema),
|
|
1060
1077
|
userVerification: userVerificationSchema,
|
|
1061
|
-
timeout:
|
|
1078
|
+
timeout: z25.int().positive()
|
|
1062
1079
|
});
|
|
1063
1080
|
|
|
1064
1081
|
// src/contract/passkey-contract.ts
|
|
1065
|
-
var clientActionIDSchema =
|
|
1066
|
-
var listedPasskeySchema =
|
|
1067
|
-
passkeyID:
|
|
1068
|
-
label:
|
|
1069
|
-
synced:
|
|
1070
|
-
authorizedBy:
|
|
1071
|
-
registeredAt:
|
|
1072
|
-
lastUsedAt:
|
|
1073
|
-
revokedAt:
|
|
1082
|
+
var clientActionIDSchema = z26.uuid();
|
|
1083
|
+
var listedPasskeySchema = z26.object({
|
|
1084
|
+
passkeyID: z26.string(),
|
|
1085
|
+
label: z26.string(),
|
|
1086
|
+
synced: z26.boolean(),
|
|
1087
|
+
authorizedBy: z26.string(),
|
|
1088
|
+
registeredAt: z26.date(),
|
|
1089
|
+
lastUsedAt: z26.date().nullable(),
|
|
1090
|
+
revokedAt: z26.date().nullable()
|
|
1074
1091
|
});
|
|
1075
1092
|
var registrationErrors = {
|
|
1076
1093
|
...passkeyFailedError,
|
|
@@ -1082,57 +1099,57 @@ var registrationErrors = {
|
|
|
1082
1099
|
ORIGIN_CHANGED: { message: "Live passkeys hold another origin", status: 409 }
|
|
1083
1100
|
};
|
|
1084
1101
|
var passkeyContract = {
|
|
1085
|
-
challenge: signedIn.errors(noPasskeyError).input(
|
|
1102
|
+
challenge: signedIn.errors(noPasskeyError).input(z26.object({ for: challengeForSchema })).output(z26.object({ options: requestOptionsSchema })),
|
|
1086
1103
|
registrationOptions: signedIn.errors(registrationErrors).errors({
|
|
1087
1104
|
CODE_REQUIRED: { message: "A host code is required", status: 403 },
|
|
1088
1105
|
CODE_INVALID: { message: "The host code is unknown, used or lapsed", status: 403 }
|
|
1089
|
-
}).input(
|
|
1090
|
-
code:
|
|
1106
|
+
}).input(z26.object({
|
|
1107
|
+
code: z26.string().min(1).max(100).optional(),
|
|
1091
1108
|
passkey: authenticationResponseSchema.optional()
|
|
1092
|
-
})).output(
|
|
1109
|
+
})).output(z26.object({ options: creationOptionsSchema })),
|
|
1093
1110
|
register: signedIn.errors(reusedIDErrors).errors({
|
|
1094
1111
|
REGISTRATION_FAILED: {
|
|
1095
1112
|
message: "The registration failed",
|
|
1096
1113
|
status: 400,
|
|
1097
|
-
data:
|
|
1114
|
+
data: z26.object({ reason: z26.string() })
|
|
1098
1115
|
},
|
|
1099
1116
|
TOO_MANY_PASSKEYS: registrationErrors.TOO_MANY_PASSKEYS,
|
|
1100
1117
|
ORIGIN_UNSUPPORTED: registrationErrors.ORIGIN_UNSUPPORTED
|
|
1101
|
-
}).input(
|
|
1118
|
+
}).input(z26.object({
|
|
1102
1119
|
clientActionID: clientActionIDSchema,
|
|
1103
1120
|
response: registrationResponseSchema,
|
|
1104
|
-
label:
|
|
1105
|
-
})).output(
|
|
1106
|
-
list: signedIn.output(
|
|
1107
|
-
revoke: signedIn.errors(reusedIDErrors).errors(passkeyFailedError).errors({ NOT_FOUND: { message: "No passkey has this ID", status: 404 } }).input(
|
|
1121
|
+
label: z26.string().min(1).max(64).optional()
|
|
1122
|
+
})).output(z26.object({ passkeyID: z26.string() })),
|
|
1123
|
+
list: signedIn.output(z26.object({ passkeys: z26.array(listedPasskeySchema) })),
|
|
1124
|
+
revoke: signedIn.errors(reusedIDErrors).errors(passkeyFailedError).errors({ NOT_FOUND: { message: "No passkey has this ID", status: 404 } }).input(z26.object({
|
|
1108
1125
|
clientActionID: clientActionIDSchema,
|
|
1109
|
-
passkeyID:
|
|
1126
|
+
passkeyID: z26.string().min(1).max(200),
|
|
1110
1127
|
passkey: authenticationResponseSchema
|
|
1111
|
-
})).output(
|
|
1128
|
+
})).output(z26.object({ revokedAt: z26.date() }))
|
|
1112
1129
|
};
|
|
1113
1130
|
|
|
1114
1131
|
// src/contract/pause-state-schema.ts
|
|
1115
|
-
import { z as
|
|
1116
|
-
var pauseCauseSchema =
|
|
1117
|
-
var pauseStateSchema =
|
|
1132
|
+
import { z as z27 } from "zod";
|
|
1133
|
+
var pauseCauseSchema = z27.enum(["restore", "owner", "spending"]);
|
|
1134
|
+
var pauseStateSchema = z27.object({ cause: pauseCauseSchema, since: z27.date() }).nullable();
|
|
1118
1135
|
|
|
1119
1136
|
// src/contract/read-payload-contract.ts
|
|
1120
|
-
import { z as
|
|
1137
|
+
import { z as z29 } from "zod";
|
|
1121
1138
|
|
|
1122
1139
|
// src/contract/sequence-schema.ts
|
|
1123
|
-
import { z as
|
|
1124
|
-
var sequenceSchema =
|
|
1140
|
+
import { z as z28 } from "zod";
|
|
1141
|
+
var sequenceSchema = z28.int().nonnegative();
|
|
1125
1142
|
|
|
1126
1143
|
// src/contract/read-payload-contract.ts
|
|
1127
|
-
var jsonObjectSchema =
|
|
1128
|
-
var readableSchema =
|
|
1129
|
-
status:
|
|
1130
|
-
toolCall:
|
|
1131
|
-
worker:
|
|
1132
|
-
});
|
|
1133
|
-
var forgottenSchema =
|
|
1134
|
-
var unreadableSchema =
|
|
1135
|
-
var payloadSchema =
|
|
1144
|
+
var jsonObjectSchema = z29.record(z29.string(), z29.unknown());
|
|
1145
|
+
var readableSchema = z29.object({
|
|
1146
|
+
status: z29.literal("readable"),
|
|
1147
|
+
toolCall: z29.object({ input: jsonObjectSchema.optional(), content: jsonObjectSchema.optional() }).optional(),
|
|
1148
|
+
worker: z29.object({ text: z29.string().optional(), detail: z29.string().optional() }).optional()
|
|
1149
|
+
});
|
|
1150
|
+
var forgottenSchema = z29.object({ status: z29.literal("forgotten") });
|
|
1151
|
+
var unreadableSchema = z29.object({ status: z29.literal("unreadable") });
|
|
1152
|
+
var payloadSchema = z29.discriminatedUnion("status", [
|
|
1136
1153
|
readableSchema,
|
|
1137
1154
|
forgottenSchema,
|
|
1138
1155
|
unreadableSchema
|
|
@@ -1141,12 +1158,12 @@ var notFoundError = {
|
|
|
1141
1158
|
message: "No record on this thread has this sequence",
|
|
1142
1159
|
status: 404
|
|
1143
1160
|
};
|
|
1144
|
-
var inputSchema =
|
|
1161
|
+
var inputSchema = z29.object({ thread: threadSchema, sequence: sequenceSchema });
|
|
1145
1162
|
var readPayloadContract = signedIn.errors({ RECORD_NOT_FOUND: notFoundError }).input(inputSchema).output(payloadSchema);
|
|
1146
1163
|
|
|
1147
1164
|
// src/contract/recovery-schema.ts
|
|
1148
|
-
import { z as
|
|
1149
|
-
var taskStateSchema2 =
|
|
1165
|
+
import { z as z30 } from "zod";
|
|
1166
|
+
var taskStateSchema2 = z30.enum([
|
|
1150
1167
|
"ready",
|
|
1151
1168
|
"running",
|
|
1152
1169
|
"waiting",
|
|
@@ -1156,27 +1173,27 @@ var taskStateSchema2 = z29.enum([
|
|
|
1156
1173
|
"failed",
|
|
1157
1174
|
"closed"
|
|
1158
1175
|
]);
|
|
1159
|
-
var taskToCheckSchema =
|
|
1160
|
-
taskID:
|
|
1161
|
-
name:
|
|
1176
|
+
var taskToCheckSchema = z30.object({
|
|
1177
|
+
taskID: z30.string(),
|
|
1178
|
+
name: z30.string(),
|
|
1162
1179
|
stateAtBackup: taskStateSchema2,
|
|
1163
|
-
wasRunning:
|
|
1164
|
-
pendingActions:
|
|
1180
|
+
wasRunning: z30.boolean(),
|
|
1181
|
+
pendingActions: z30.int().nonnegative()
|
|
1165
1182
|
});
|
|
1166
|
-
var recoverySchema =
|
|
1167
|
-
restoredAt:
|
|
1168
|
-
backupTakenAt:
|
|
1169
|
-
toCheck:
|
|
1183
|
+
var recoverySchema = z30.object({
|
|
1184
|
+
restoredAt: z30.date(),
|
|
1185
|
+
backupTakenAt: z30.date(),
|
|
1186
|
+
toCheck: z30.array(taskToCheckSchema)
|
|
1170
1187
|
}).nullable();
|
|
1171
1188
|
|
|
1172
1189
|
// src/contract/reminders-contract.ts
|
|
1173
|
-
import { z as
|
|
1190
|
+
import { z as z33 } from "zod";
|
|
1174
1191
|
|
|
1175
1192
|
// src/contract/trigger-schema.ts
|
|
1176
|
-
import { z as
|
|
1193
|
+
import { z as z32 } from "zod";
|
|
1177
1194
|
|
|
1178
1195
|
// src/contract/schedule-schema.ts
|
|
1179
|
-
import { z as
|
|
1196
|
+
import { z as z31 } from "zod";
|
|
1180
1197
|
|
|
1181
1198
|
// src/contract/is-time-zone.ts
|
|
1182
1199
|
function isTimeZone(zone) {
|
|
@@ -1188,19 +1205,19 @@ function isTimeZone(zone) {
|
|
|
1188
1205
|
}
|
|
1189
1206
|
|
|
1190
1207
|
// src/contract/schedule-schema.ts
|
|
1191
|
-
var clockTimeSchema =
|
|
1192
|
-
var minutesSchema =
|
|
1193
|
-
minutes:
|
|
1208
|
+
var clockTimeSchema = z31.string().regex(/^(?:[01]\d|2[0-3]):[0-5]\d$/u, "a time is HH:MM, 24-hour");
|
|
1209
|
+
var minutesSchema = z31.strictObject({
|
|
1210
|
+
minutes: z31.int().min(5).max(1440)
|
|
1194
1211
|
});
|
|
1195
|
-
var weekdaySchema =
|
|
1196
|
-
var scheduleSchema =
|
|
1197
|
-
every:
|
|
1212
|
+
var weekdaySchema = z31.enum(["mon", "tue", "wed", "thu", "fri", "sat", "sun"]);
|
|
1213
|
+
var scheduleSchema = z31.strictObject({
|
|
1214
|
+
every: z31.union([z31.enum(["day", "week", "hour"]), minutesSchema]),
|
|
1198
1215
|
at: clockTimeSchema.optional(),
|
|
1199
1216
|
on: weekdaySchema.optional(),
|
|
1200
|
-
window:
|
|
1201
|
-
idleMinutes:
|
|
1202
|
-
zone:
|
|
1203
|
-
catchUp:
|
|
1217
|
+
window: z31.strictObject({ from: clockTimeSchema, until: clockTimeSchema }).optional(),
|
|
1218
|
+
idleMinutes: z31.int().min(1).max(720).optional(),
|
|
1219
|
+
zone: z31.string().refine((zone) => zone === "owner" || isTimeZone(zone), "a zone is owner or an IANA zone").default("owner"),
|
|
1220
|
+
catchUp: z31.enum(["once", "skip"]).default("once")
|
|
1204
1221
|
}).superRefine((schedule, context) => {
|
|
1205
1222
|
const isCalendar = schedule.every === "day" || schedule.every === "week";
|
|
1206
1223
|
if (isCalendar && schedule.at === undefined && schedule.window === undefined) {
|
|
@@ -1227,41 +1244,41 @@ var scheduleSchema = z30.strictObject({
|
|
|
1227
1244
|
});
|
|
1228
1245
|
|
|
1229
1246
|
// src/contract/trigger-schema.ts
|
|
1230
|
-
var triggerAtSchema =
|
|
1231
|
-
var triggerSchema =
|
|
1232
|
-
|
|
1233
|
-
|
|
1247
|
+
var triggerAtSchema = z32.iso.datetime({ offset: true });
|
|
1248
|
+
var triggerSchema = z32.union([
|
|
1249
|
+
z32.strictObject({ schedule: scheduleSchema }),
|
|
1250
|
+
z32.strictObject({ at: triggerAtSchema })
|
|
1234
1251
|
]);
|
|
1235
1252
|
|
|
1236
1253
|
// src/contract/reminders-contract.ts
|
|
1237
|
-
var listedReminderSchema =
|
|
1238
|
-
reminder:
|
|
1239
|
-
name:
|
|
1240
|
-
note:
|
|
1254
|
+
var listedReminderSchema = z33.object({
|
|
1255
|
+
reminder: z33.string(),
|
|
1256
|
+
name: z33.string(),
|
|
1257
|
+
note: z33.string(),
|
|
1241
1258
|
trigger: triggerSchema,
|
|
1242
|
-
rendered:
|
|
1243
|
-
state:
|
|
1244
|
-
next:
|
|
1245
|
-
recentFires:
|
|
1259
|
+
rendered: z33.string(),
|
|
1260
|
+
state: z33.enum(["active", "fired"]),
|
|
1261
|
+
next: z33.string().nullable(),
|
|
1262
|
+
recentFires: z33.array(z33.string())
|
|
1246
1263
|
});
|
|
1247
1264
|
var remindersContract = {
|
|
1248
|
-
list: signedIn.output(
|
|
1265
|
+
list: signedIn.output(z33.object({ reminders: z33.array(listedReminderSchema) })),
|
|
1249
1266
|
cancel: signedIn.errors({
|
|
1250
1267
|
NOT_FOUND: { message: "No reminder has this ID", status: 404 },
|
|
1251
1268
|
NOT_ACTIVE: { message: "The reminder already fired or was cancelled", status: 409 }
|
|
1252
|
-
}).input(
|
|
1269
|
+
}).input(z33.object({ reminder: z33.string().min(1).max(64) })).output(z33.object({ reminder: z33.string() }))
|
|
1253
1270
|
};
|
|
1254
1271
|
|
|
1255
1272
|
// src/contract/rule-contract.ts
|
|
1256
|
-
import { z as
|
|
1257
|
-
var ruleIDSchema =
|
|
1258
|
-
var revisionSchema =
|
|
1259
|
-
var ruleSchema =
|
|
1260
|
-
ruleID:
|
|
1273
|
+
import { z as z34 } from "zod";
|
|
1274
|
+
var ruleIDSchema = z34.string().min(1).max(200);
|
|
1275
|
+
var revisionSchema = z34.int().positive();
|
|
1276
|
+
var ruleSchema = z34.object({
|
|
1277
|
+
ruleID: z34.string(),
|
|
1261
1278
|
revision: revisionSchema,
|
|
1262
|
-
sentence:
|
|
1263
|
-
outcome:
|
|
1264
|
-
destinations:
|
|
1279
|
+
sentence: z34.string(),
|
|
1280
|
+
outcome: z34.enum(["allow", "ask", "deny"]),
|
|
1281
|
+
destinations: z34.array(z34.string())
|
|
1265
1282
|
});
|
|
1266
1283
|
var notFound = { NOT_FOUND: { message: "No rule has this ID", status: 404 } };
|
|
1267
1284
|
var ruleChange = signedIn.errors(reusedIDErrors).errors({
|
|
@@ -1269,38 +1286,38 @@ var ruleChange = signedIn.errors(reusedIDErrors).errors({
|
|
|
1269
1286
|
CONFLICT: {
|
|
1270
1287
|
message: "The rule changed since the notice showed it",
|
|
1271
1288
|
status: 409,
|
|
1272
|
-
data:
|
|
1289
|
+
data: z34.object({ revision: revisionSchema })
|
|
1273
1290
|
},
|
|
1274
1291
|
NOT_ALLOWED: {
|
|
1275
1292
|
message: "The rule takes no such change",
|
|
1276
1293
|
status: 403,
|
|
1277
|
-
data:
|
|
1294
|
+
data: z34.object({ reason: z34.enum(["widens", "empty", "mandate"]) })
|
|
1278
1295
|
}
|
|
1279
1296
|
});
|
|
1280
|
-
var currentHashSchema =
|
|
1281
|
-
var closedStateSchema =
|
|
1282
|
-
state:
|
|
1283
|
-
});
|
|
1284
|
-
var proposalIDSchema =
|
|
1285
|
-
var ruleFormSchema =
|
|
1286
|
-
var mandateRuleSchema =
|
|
1287
|
-
var mandateSchema =
|
|
1288
|
-
mandateID:
|
|
1289
|
-
title:
|
|
1290
|
-
rules:
|
|
1291
|
-
startedAt:
|
|
1292
|
-
expires:
|
|
1293
|
-
});
|
|
1294
|
-
var expiryRefusalSchema =
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
reason:
|
|
1298
|
-
maxHours:
|
|
1299
|
-
latestExpiry:
|
|
1297
|
+
var currentHashSchema = z34.object({ current: z34.object({ actionHash: z34.string() }) });
|
|
1298
|
+
var closedStateSchema = z34.object({
|
|
1299
|
+
state: z34.enum(["approved", "declined", "lapsed", "withdrawn"])
|
|
1300
|
+
});
|
|
1301
|
+
var proposalIDSchema = z34.string().min(1).max(64);
|
|
1302
|
+
var ruleFormSchema = z34.record(z34.string(), z34.unknown());
|
|
1303
|
+
var mandateRuleSchema = z34.object({ ruleID: z34.string(), sentence: z34.string() });
|
|
1304
|
+
var mandateSchema = z34.object({
|
|
1305
|
+
mandateID: z34.string(),
|
|
1306
|
+
title: z34.string().nullable(),
|
|
1307
|
+
rules: z34.array(mandateRuleSchema),
|
|
1308
|
+
startedAt: z34.date(),
|
|
1309
|
+
expires: z34.date()
|
|
1310
|
+
});
|
|
1311
|
+
var expiryRefusalSchema = z34.discriminatedUnion("reason", [
|
|
1312
|
+
z34.object({ reason: z34.literal("expires_past"), now: z34.string() }),
|
|
1313
|
+
z34.object({
|
|
1314
|
+
reason: z34.literal("expires_beyond_max"),
|
|
1315
|
+
maxHours: z34.number(),
|
|
1316
|
+
latestExpiry: z34.string()
|
|
1300
1317
|
})
|
|
1301
1318
|
]);
|
|
1302
|
-
var faultsSchema =
|
|
1303
|
-
faults:
|
|
1319
|
+
var faultsSchema = z34.object({
|
|
1320
|
+
faults: z34.array(z34.string()),
|
|
1304
1321
|
expiry: expiryRefusalSchema.optional()
|
|
1305
1322
|
});
|
|
1306
1323
|
var invalid = {
|
|
@@ -1310,16 +1327,16 @@ var invalid = {
|
|
|
1310
1327
|
data: faultsSchema
|
|
1311
1328
|
}
|
|
1312
1329
|
};
|
|
1313
|
-
var destinationsSchema =
|
|
1330
|
+
var destinationsSchema = z34.array(z34.string().regex(/^\S+$/u)).max(100);
|
|
1314
1331
|
var ruleContract = {
|
|
1315
|
-
readRule: signedIn.errors(notFound).input(
|
|
1316
|
-
removeRule: ruleChange.input(
|
|
1317
|
-
editRule: ruleChange.input(
|
|
1332
|
+
readRule: signedIn.errors(notFound).input(z34.object({ ruleID: ruleIDSchema })).output(ruleSchema),
|
|
1333
|
+
removeRule: ruleChange.input(z34.object({ ruleID: ruleIDSchema, revision: revisionSchema, clientActionID: z34.uuid() })).output(z34.object({ ruleID: z34.string() })),
|
|
1334
|
+
editRule: ruleChange.input(z34.object({
|
|
1318
1335
|
ruleID: ruleIDSchema,
|
|
1319
1336
|
revision: revisionSchema,
|
|
1320
1337
|
destinations: destinationsSchema,
|
|
1321
|
-
clientActionID:
|
|
1322
|
-
})).output(
|
|
1338
|
+
clientActionID: z34.uuid()
|
|
1339
|
+
})).output(z34.object({ ruleID: z34.string(), revision: revisionSchema })),
|
|
1323
1340
|
editProposedRule: signedIn.errors(reusedIDErrors).errors({
|
|
1324
1341
|
...invalid,
|
|
1325
1342
|
NOT_FOUND: { message: "No proposed rule has this ID", status: 404 },
|
|
@@ -1333,56 +1350,56 @@ var ruleContract = {
|
|
|
1333
1350
|
status: 409,
|
|
1334
1351
|
data: closedStateSchema
|
|
1335
1352
|
}
|
|
1336
|
-
}).input(
|
|
1353
|
+
}).input(z34.object({
|
|
1337
1354
|
proposalID: proposalIDSchema,
|
|
1338
|
-
actionHash:
|
|
1355
|
+
actionHash: z34.string(),
|
|
1339
1356
|
rule: ruleFormSchema,
|
|
1340
|
-
clientActionID:
|
|
1341
|
-
})).output(
|
|
1342
|
-
proposeMandate: signedIn.errors(reusedIDErrors).errors(invalid).input(
|
|
1343
|
-
title:
|
|
1344
|
-
rules:
|
|
1345
|
-
expires:
|
|
1346
|
-
clientActionID:
|
|
1347
|
-
})).output(
|
|
1348
|
-
listMandates: signedIn.output(
|
|
1349
|
-
endMandate: signedIn.errors(reusedIDErrors).errors({ NOT_FOUND: { message: "No mandate has this ID", status: 404 } }).input(
|
|
1357
|
+
clientActionID: z34.uuid()
|
|
1358
|
+
})).output(z34.object({ proposalID: z34.string() })),
|
|
1359
|
+
proposeMandate: signedIn.errors(reusedIDErrors).errors(invalid).input(z34.object({
|
|
1360
|
+
title: z34.string(),
|
|
1361
|
+
rules: z34.array(ruleFormSchema),
|
|
1362
|
+
expires: z34.string().optional(),
|
|
1363
|
+
clientActionID: z34.uuid()
|
|
1364
|
+
})).output(z34.object({ proposalID: z34.string(), mandateID: z34.string(), expires: z34.date() })),
|
|
1365
|
+
listMandates: signedIn.output(z34.object({ mandates: z34.array(mandateSchema) })),
|
|
1366
|
+
endMandate: signedIn.errors(reusedIDErrors).errors({ NOT_FOUND: { message: "No mandate has this ID", status: 404 } }).input(z34.object({ mandateID: z34.string().min(1).max(64), clientActionID: z34.uuid() })).output(z34.object({ mandateID: z34.string(), state: z34.enum(["ended", "expired"]) }))
|
|
1350
1367
|
};
|
|
1351
1368
|
|
|
1352
1369
|
// src/contract/spend-stop-schema.ts
|
|
1353
|
-
import { z as
|
|
1354
|
-
var triple =
|
|
1355
|
-
var spendStopSchema =
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
state:
|
|
1361
|
-
period:
|
|
1362
|
-
start:
|
|
1363
|
-
measure:
|
|
1364
|
-
limit:
|
|
1365
|
-
spent:
|
|
1366
|
-
at:
|
|
1367
|
-
resetsAt:
|
|
1368
|
-
canRaise:
|
|
1370
|
+
import { z as z35 } from "zod";
|
|
1371
|
+
var triple = z35.object({ dollars: z35.number(), tokens: z35.number(), turns: z35.number() });
|
|
1372
|
+
var spendStopSchema = z35.discriminatedUnion("state", [
|
|
1373
|
+
z35.object({ state: z35.literal("clear") }),
|
|
1374
|
+
z35.object({ state: z35.literal("unreachable") }),
|
|
1375
|
+
z35.object({ state: z35.literal("lost") }),
|
|
1376
|
+
z35.object({
|
|
1377
|
+
state: z35.literal("tripped"),
|
|
1378
|
+
period: z35.enum(["day", "month"]),
|
|
1379
|
+
start: z35.string(),
|
|
1380
|
+
measure: z35.enum(["dollars", "tokens", "turns"]),
|
|
1381
|
+
limit: z35.number(),
|
|
1382
|
+
spent: z35.number(),
|
|
1383
|
+
at: z35.date(),
|
|
1384
|
+
resetsAt: z35.date(),
|
|
1385
|
+
canRaise: z35.boolean(),
|
|
1369
1386
|
limits: triple,
|
|
1370
1387
|
used: triple,
|
|
1371
1388
|
cap: triple
|
|
1372
1389
|
})
|
|
1373
1390
|
]);
|
|
1374
|
-
var spendRaiseInputSchema =
|
|
1375
|
-
start:
|
|
1376
|
-
dollars:
|
|
1377
|
-
tokens:
|
|
1378
|
-
turns:
|
|
1379
|
-
});
|
|
1380
|
-
var spendRaiseOutputSchema =
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1391
|
+
var spendRaiseInputSchema = z35.object({
|
|
1392
|
+
start: z35.string().regex(/^\d{4}-\d{2}-\d{2}$/u),
|
|
1393
|
+
dollars: z35.number().positive(),
|
|
1394
|
+
tokens: z35.int().positive(),
|
|
1395
|
+
turns: z35.int().positive()
|
|
1396
|
+
});
|
|
1397
|
+
var spendRaiseOutputSchema = z35.union([
|
|
1398
|
+
z35.object({ state: z35.literal("clear") }),
|
|
1399
|
+
z35.object({ state: z35.literal("stopped") }),
|
|
1400
|
+
z35.object({ error: z35.literal("above_cap"), cap: triple }),
|
|
1401
|
+
z35.object({ error: z35.literal("period_ended") }),
|
|
1402
|
+
z35.object({ error: z35.literal("unreachable") })
|
|
1386
1403
|
]);
|
|
1387
1404
|
var spendStopStandsError = {
|
|
1388
1405
|
message: "Model spending is stopped, and nixie resumes when the stop clears",
|
|
@@ -1390,226 +1407,226 @@ var spendStopStandsError = {
|
|
|
1390
1407
|
};
|
|
1391
1408
|
|
|
1392
1409
|
// src/contract/task-schema.ts
|
|
1393
|
-
import { z as
|
|
1394
|
-
var taskSchema2 =
|
|
1395
|
-
error:
|
|
1396
|
-
errorLimit:
|
|
1397
|
-
errors:
|
|
1398
|
-
isWaitingForRetry:
|
|
1399
|
-
readCursor:
|
|
1400
|
-
reason:
|
|
1401
|
-
retryAt:
|
|
1402
|
-
stepKey:
|
|
1403
|
-
taskID:
|
|
1410
|
+
import { z as z36 } from "zod";
|
|
1411
|
+
var taskSchema2 = z36.object({
|
|
1412
|
+
error: z36.string().optional(),
|
|
1413
|
+
errorLimit: z36.int().positive().optional(),
|
|
1414
|
+
errors: z36.int().positive().optional(),
|
|
1415
|
+
isWaitingForRetry: z36.boolean().optional(),
|
|
1416
|
+
readCursor: z36.int().nonnegative().optional(),
|
|
1417
|
+
reason: z36.string().optional(),
|
|
1418
|
+
retryAt: z36.date().optional(),
|
|
1419
|
+
stepKey: z36.string().optional(),
|
|
1420
|
+
taskID: z36.string()
|
|
1404
1421
|
});
|
|
1405
1422
|
|
|
1406
1423
|
// src/contract/tool-call-schema.ts
|
|
1407
|
-
import { z as
|
|
1408
|
-
var jsonObjectSchema2 =
|
|
1409
|
-
var toolCallSchema =
|
|
1410
|
-
callID:
|
|
1424
|
+
import { z as z37 } from "zod";
|
|
1425
|
+
var jsonObjectSchema2 = z37.record(z37.string(), z37.unknown());
|
|
1426
|
+
var toolCallSchema = z37.object({
|
|
1427
|
+
callID: z37.string(),
|
|
1411
1428
|
content: jsonObjectSchema2.optional(),
|
|
1412
1429
|
input: jsonObjectSchema2.optional(),
|
|
1413
|
-
outcome:
|
|
1414
|
-
runID:
|
|
1415
|
-
tool:
|
|
1430
|
+
outcome: z37.string().optional(),
|
|
1431
|
+
runID: z37.string().optional(),
|
|
1432
|
+
tool: z37.string().optional()
|
|
1416
1433
|
});
|
|
1417
1434
|
|
|
1418
1435
|
// src/contract/view-contract.ts
|
|
1419
|
-
import { z as
|
|
1420
|
-
var skipReasonSchema =
|
|
1436
|
+
import { z as z38 } from "zod";
|
|
1437
|
+
var skipReasonSchema = z38.enum([
|
|
1421
1438
|
"too_late",
|
|
1422
1439
|
"catch_up_off",
|
|
1423
1440
|
"window_closed",
|
|
1424
1441
|
"still_running",
|
|
1425
1442
|
"task_held"
|
|
1426
1443
|
]);
|
|
1427
|
-
var endedRunSchema =
|
|
1428
|
-
runID:
|
|
1444
|
+
var endedRunSchema = z38.object({
|
|
1445
|
+
runID: z38.string(),
|
|
1429
1446
|
taskID: threadSchema,
|
|
1430
|
-
definitionID:
|
|
1431
|
-
startedAt:
|
|
1432
|
-
endedAt:
|
|
1447
|
+
definitionID: z38.string().nullable(),
|
|
1448
|
+
startedAt: z38.date(),
|
|
1449
|
+
endedAt: z38.date(),
|
|
1433
1450
|
sequence: sequenceSchema,
|
|
1434
|
-
cause:
|
|
1435
|
-
endedBy:
|
|
1436
|
-
carriesRunID:
|
|
1437
|
-
reportID:
|
|
1438
|
-
delivery:
|
|
1451
|
+
cause: z38.string(),
|
|
1452
|
+
endedBy: z38.string(),
|
|
1453
|
+
carriesRunID: z38.string().nullable(),
|
|
1454
|
+
reportID: z38.string(),
|
|
1455
|
+
delivery: z38.enum(["wake", "next_turn", "kept"]),
|
|
1439
1456
|
fire: runFireSchema.nullable(),
|
|
1440
|
-
used:
|
|
1441
|
-
});
|
|
1442
|
-
var reportEntrySchema =
|
|
1443
|
-
definitionID:
|
|
1444
|
-
name:
|
|
1445
|
-
kind:
|
|
1446
|
-
scheduledFor:
|
|
1447
|
-
firedAt:
|
|
1448
|
-
lateBySeconds:
|
|
1457
|
+
used: z38.object({ turns: z38.number(), dollars: z38.number() })
|
|
1458
|
+
});
|
|
1459
|
+
var reportEntrySchema = z38.object({
|
|
1460
|
+
definitionID: z38.string(),
|
|
1461
|
+
name: z38.string(),
|
|
1462
|
+
kind: z38.enum(["late", "skipped"]),
|
|
1463
|
+
scheduledFor: z38.string(),
|
|
1464
|
+
firedAt: z38.string().nullable(),
|
|
1465
|
+
lateBySeconds: z38.number().nullable(),
|
|
1449
1466
|
reason: skipReasonSchema.nullable(),
|
|
1450
1467
|
sequence: sequenceSchema
|
|
1451
1468
|
});
|
|
1452
|
-
var listedDefinitionSchema =
|
|
1453
|
-
definitionID:
|
|
1454
|
-
name:
|
|
1455
|
-
enabled:
|
|
1469
|
+
var listedDefinitionSchema = z38.object({
|
|
1470
|
+
definitionID: z38.string(),
|
|
1471
|
+
name: z38.string(),
|
|
1472
|
+
enabled: z38.boolean(),
|
|
1456
1473
|
trigger: triggerSchema.nullable(),
|
|
1457
|
-
rendered:
|
|
1458
|
-
next:
|
|
1459
|
-
tools:
|
|
1460
|
-
origin:
|
|
1461
|
-
createdBy:
|
|
1474
|
+
rendered: z38.string().nullable(),
|
|
1475
|
+
next: z38.string().nullable(),
|
|
1476
|
+
tools: z38.array(z38.string()),
|
|
1477
|
+
origin: z38.enum(["definitions", "nixie"]),
|
|
1478
|
+
createdBy: z38.object({
|
|
1462
1479
|
sequence: sequenceSchema,
|
|
1463
|
-
kind:
|
|
1480
|
+
kind: z38.enum(["definition.changed", "definitions_seeded"])
|
|
1464
1481
|
}),
|
|
1465
1482
|
taskID: threadSchema.nullable(),
|
|
1466
|
-
isUnreadable:
|
|
1483
|
+
isUnreadable: z38.boolean()
|
|
1467
1484
|
});
|
|
1468
1485
|
var viewContract = {
|
|
1469
1486
|
tasks: {
|
|
1470
|
-
listEnded: signedIn.input(
|
|
1471
|
-
limit:
|
|
1487
|
+
listEnded: signedIn.input(z38.object({
|
|
1488
|
+
limit: z38.int().min(1).max(100),
|
|
1472
1489
|
before: sequenceSchema.optional(),
|
|
1473
|
-
definitionID:
|
|
1474
|
-
})).output(
|
|
1475
|
-
tasks:
|
|
1476
|
-
runs:
|
|
1490
|
+
definitionID: z38.string().min(1).max(200).optional()
|
|
1491
|
+
})).output(z38.object({
|
|
1492
|
+
tasks: z38.array(listedTaskSchema),
|
|
1493
|
+
runs: z38.array(endedRunSchema),
|
|
1477
1494
|
next: sequenceSchema.nullable()
|
|
1478
1495
|
}))
|
|
1479
1496
|
},
|
|
1480
1497
|
triggers: {
|
|
1481
|
-
report: signedIn.input(
|
|
1482
|
-
since:
|
|
1483
|
-
definitionID:
|
|
1484
|
-
})).output(
|
|
1498
|
+
report: signedIn.input(z38.object({
|
|
1499
|
+
since: z38.string().regex(/^\d{4}-\d{2}-\d{2}$/u),
|
|
1500
|
+
definitionID: z38.string().min(1).max(200).optional()
|
|
1501
|
+
})).output(z38.object({ entries: z38.array(reportEntrySchema) }))
|
|
1485
1502
|
},
|
|
1486
1503
|
definitions: {
|
|
1487
|
-
listTasks: signedIn.output(
|
|
1504
|
+
listTasks: signedIn.output(z38.object({ definitions: z38.array(listedDefinitionSchema) }))
|
|
1488
1505
|
}
|
|
1489
1506
|
};
|
|
1490
1507
|
|
|
1491
1508
|
// src/contract/worker-view-schema.ts
|
|
1492
|
-
import { z as
|
|
1493
|
-
var usedSchema =
|
|
1494
|
-
minutes:
|
|
1495
|
-
turns:
|
|
1496
|
-
tokens:
|
|
1497
|
-
dollars:
|
|
1498
|
-
});
|
|
1499
|
-
var startedSchema =
|
|
1500
|
-
phase:
|
|
1501
|
-
workerRunID:
|
|
1502
|
-
shortID:
|
|
1503
|
-
callID:
|
|
1504
|
-
model:
|
|
1505
|
-
tools:
|
|
1509
|
+
import { z as z39 } from "zod";
|
|
1510
|
+
var usedSchema = z39.object({
|
|
1511
|
+
minutes: z39.number(),
|
|
1512
|
+
turns: z39.number(),
|
|
1513
|
+
tokens: z39.number(),
|
|
1514
|
+
dollars: z39.number()
|
|
1515
|
+
});
|
|
1516
|
+
var startedSchema = z39.object({
|
|
1517
|
+
phase: z39.literal("started"),
|
|
1518
|
+
workerRunID: z39.string(),
|
|
1519
|
+
shortID: z39.string(),
|
|
1520
|
+
callID: z39.string(),
|
|
1521
|
+
model: z39.string(),
|
|
1522
|
+
tools: z39.array(z39.string()),
|
|
1506
1523
|
limits: usedSchema,
|
|
1507
|
-
isTaskLimit:
|
|
1508
|
-
});
|
|
1509
|
-
var turnSchema =
|
|
1510
|
-
phase:
|
|
1511
|
-
workerRunID:
|
|
1512
|
-
callID:
|
|
1513
|
-
turn:
|
|
1514
|
-
tokens:
|
|
1515
|
-
dollars:
|
|
1516
|
-
text:
|
|
1517
|
-
});
|
|
1518
|
-
var endedSchema =
|
|
1519
|
-
phase:
|
|
1520
|
-
workerRunID:
|
|
1521
|
-
callID:
|
|
1522
|
-
outcome:
|
|
1523
|
-
limit:
|
|
1524
|
+
isTaskLimit: z39.boolean()
|
|
1525
|
+
});
|
|
1526
|
+
var turnSchema = z39.object({
|
|
1527
|
+
phase: z39.literal("turn"),
|
|
1528
|
+
workerRunID: z39.string(),
|
|
1529
|
+
callID: z39.string(),
|
|
1530
|
+
turn: z39.number(),
|
|
1531
|
+
tokens: z39.number(),
|
|
1532
|
+
dollars: z39.number(),
|
|
1533
|
+
text: z39.string().optional()
|
|
1534
|
+
});
|
|
1535
|
+
var endedSchema = z39.object({
|
|
1536
|
+
phase: z39.literal("ended"),
|
|
1537
|
+
workerRunID: z39.string(),
|
|
1538
|
+
callID: z39.string(),
|
|
1539
|
+
outcome: z39.string(),
|
|
1540
|
+
limit: z39.string().optional(),
|
|
1524
1541
|
used: usedSchema,
|
|
1525
|
-
detail:
|
|
1542
|
+
detail: z39.string().optional()
|
|
1526
1543
|
});
|
|
1527
|
-
var workerViewSchema =
|
|
1544
|
+
var workerViewSchema = z39.discriminatedUnion("phase", [
|
|
1528
1545
|
startedSchema,
|
|
1529
1546
|
turnSchema,
|
|
1530
1547
|
endedSchema
|
|
1531
1548
|
]);
|
|
1532
1549
|
|
|
1533
1550
|
// src/contract/contract.ts
|
|
1534
|
-
var clientActionIDSchema2 =
|
|
1535
|
-
var imageSchema =
|
|
1536
|
-
var imageFilesSchema =
|
|
1537
|
-
var imageRefSchema =
|
|
1538
|
-
position:
|
|
1551
|
+
var clientActionIDSchema2 = z40.uuid();
|
|
1552
|
+
var imageSchema = z40.object({ mediaType: z40.enum(imageLimits.mediaTypes) });
|
|
1553
|
+
var imageFilesSchema = z40.array(z40.file());
|
|
1554
|
+
var imageRefSchema = z40.object({
|
|
1555
|
+
position: z40.int().nonnegative(),
|
|
1539
1556
|
sequence: sequenceSchema,
|
|
1540
1557
|
thread: threadSchema
|
|
1541
1558
|
});
|
|
1542
|
-
var versionRefSchema =
|
|
1543
|
-
itemID:
|
|
1544
|
-
version:
|
|
1559
|
+
var versionRefSchema = z40.object({
|
|
1560
|
+
itemID: z40.string().min(1).max(200),
|
|
1561
|
+
version: z40.int().nonnegative()
|
|
1545
1562
|
});
|
|
1546
|
-
var recallItemSchema = versionRefSchema.extend({ score:
|
|
1547
|
-
var recallSchema =
|
|
1548
|
-
var tokenCountSchema =
|
|
1549
|
-
var contextSchema =
|
|
1550
|
-
var compactionSchema =
|
|
1563
|
+
var recallItemSchema = versionRefSchema.extend({ score: z40.number().optional() });
|
|
1564
|
+
var recallSchema = z40.object({ items: z40.array(recallItemSchema) });
|
|
1565
|
+
var tokenCountSchema = z40.int().nonnegative();
|
|
1566
|
+
var contextSchema = z40.object({ size: tokenCountSchema, window: z40.int().positive() });
|
|
1567
|
+
var compactionSchema = z40.object({
|
|
1551
1568
|
postTokens: tokenCountSchema.optional(),
|
|
1552
1569
|
preTokens: tokenCountSchema,
|
|
1553
|
-
trigger:
|
|
1570
|
+
trigger: z40.enum(["manual", "auto"])
|
|
1554
1571
|
});
|
|
1555
|
-
var summarySchema =
|
|
1572
|
+
var summarySchema = z40.object({
|
|
1556
1573
|
contextSize: tokenCountSchema.optional(),
|
|
1557
1574
|
summaryTokens: tokenCountSchema,
|
|
1558
|
-
text:
|
|
1559
|
-
trigger:
|
|
1575
|
+
text: z40.string().optional(),
|
|
1576
|
+
trigger: z40.enum(["threshold", "overflow"])
|
|
1560
1577
|
});
|
|
1561
|
-
var compactionFailureSchema =
|
|
1578
|
+
var compactionFailureSchema = z40.object({ failures: z40.int().positive() });
|
|
1562
1579
|
var versionTextSchema = versionRefSchema.extend({
|
|
1563
|
-
status:
|
|
1564
|
-
text:
|
|
1580
|
+
status: z40.enum(["readable", "shredded", "unreadable", "missing"]),
|
|
1581
|
+
text: z40.string().optional()
|
|
1565
1582
|
});
|
|
1566
|
-
var listedActionSchema =
|
|
1567
|
-
var taskMessageSchema =
|
|
1583
|
+
var listedActionSchema = z40.object({ actionID: z40.string(), tool: z40.string() });
|
|
1584
|
+
var taskMessageSchema = z40.object({
|
|
1568
1585
|
from: threadSchema,
|
|
1569
|
-
fromName:
|
|
1570
|
-
hop:
|
|
1571
|
-
kind:
|
|
1572
|
-
messageID:
|
|
1573
|
-
replyTo:
|
|
1574
|
-
text:
|
|
1586
|
+
fromName: z40.string(),
|
|
1587
|
+
hop: z40.int().nonnegative(),
|
|
1588
|
+
kind: z40.string(),
|
|
1589
|
+
messageID: z40.string(),
|
|
1590
|
+
replyTo: z40.string().optional(),
|
|
1591
|
+
text: z40.string().optional(),
|
|
1575
1592
|
to: threadSchema,
|
|
1576
|
-
woke:
|
|
1593
|
+
woke: z40.boolean()
|
|
1577
1594
|
});
|
|
1578
|
-
var exchangeNoticeSchema =
|
|
1579
|
-
link:
|
|
1580
|
-
text:
|
|
1595
|
+
var exchangeNoticeSchema = z40.object({
|
|
1596
|
+
link: z40.object({ label: z40.string(), messageID: z40.string(), taskID: threadSchema }),
|
|
1597
|
+
text: z40.string()
|
|
1581
1598
|
});
|
|
1582
|
-
var reminderSchema =
|
|
1583
|
-
name:
|
|
1584
|
-
note:
|
|
1585
|
-
scheduledFor:
|
|
1586
|
-
lateBySeconds:
|
|
1599
|
+
var reminderSchema = z40.object({
|
|
1600
|
+
name: z40.string().nullable(),
|
|
1601
|
+
note: z40.string(),
|
|
1602
|
+
scheduledFor: z40.iso.datetime({ offset: true }),
|
|
1603
|
+
lateBySeconds: z40.number().nullable()
|
|
1587
1604
|
});
|
|
1588
|
-
var recordSchema =
|
|
1589
|
-
clipped:
|
|
1605
|
+
var recordSchema = z40.object({
|
|
1606
|
+
clipped: z40.array(clippedPayloadSchema).optional(),
|
|
1590
1607
|
compaction: compactionSchema.optional(),
|
|
1591
1608
|
exchangeNotice: exchangeNoticeSchema.optional(),
|
|
1592
1609
|
reminder: reminderSchema.optional(),
|
|
1593
1610
|
compactionFailure: compactionFailureSchema.optional(),
|
|
1594
|
-
forget:
|
|
1611
|
+
forget: z40.object({ sequence: sequenceSchema }).optional(),
|
|
1595
1612
|
context: contextSchema.optional(),
|
|
1596
1613
|
definitionNotice: definitionNoticeSchema.optional(),
|
|
1597
|
-
isRemoved:
|
|
1598
|
-
isSilentTurn:
|
|
1599
|
-
kind:
|
|
1600
|
-
message:
|
|
1601
|
-
clientMessageId:
|
|
1602
|
-
images:
|
|
1603
|
-
spans:
|
|
1604
|
-
text:
|
|
1614
|
+
isRemoved: z40.literal(true).optional(),
|
|
1615
|
+
isSilentTurn: z40.literal(true).optional(),
|
|
1616
|
+
kind: z40.string(),
|
|
1617
|
+
message: z40.object({
|
|
1618
|
+
clientMessageId: z40.uuid().optional(),
|
|
1619
|
+
images: z40.array(imageSchema).optional(),
|
|
1620
|
+
spans: z40.array(spanSchema).optional(),
|
|
1621
|
+
text: z40.string()
|
|
1605
1622
|
}).optional(),
|
|
1606
|
-
moment:
|
|
1607
|
-
proposal:
|
|
1623
|
+
moment: z40.object({ momentID: z40.string(), shortID: z40.string(), title: z40.string().optional() }).optional(),
|
|
1624
|
+
proposal: z40.object({ proposalID: z40.string(), shortID: z40.string() }).optional(),
|
|
1608
1625
|
recall: recallSchema.optional(),
|
|
1609
|
-
recordedAt:
|
|
1610
|
-
removal:
|
|
1626
|
+
recordedAt: z40.date(),
|
|
1627
|
+
removal: z40.object({ kind: z40.string(), sequence: sequenceSchema, callSequence: sequenceSchema.optional() }).optional(),
|
|
1611
1628
|
sequence: sequenceSchema,
|
|
1612
|
-
stop:
|
|
1629
|
+
stop: z40.object({ cancelledActions: z40.array(listedActionSchema) }).optional(),
|
|
1613
1630
|
summary: summarySchema.optional(),
|
|
1614
1631
|
thread: threadSchema,
|
|
1615
1632
|
task: taskSchema2.optional(),
|
|
@@ -1617,23 +1634,23 @@ var recordSchema = z39.object({
|
|
|
1617
1634
|
toolCall: toolCallSchema.optional(),
|
|
1618
1635
|
worker: workerViewSchema.optional()
|
|
1619
1636
|
});
|
|
1620
|
-
var writerErrorSchema =
|
|
1621
|
-
var sessionSchema =
|
|
1622
|
-
createdAt:
|
|
1623
|
-
current:
|
|
1624
|
-
deviceName:
|
|
1625
|
-
lastUsedAt:
|
|
1626
|
-
sessionID:
|
|
1637
|
+
var writerErrorSchema = z40.object({ at: z40.date(), code: z40.string(), message: z40.string().nullable() }).nullable();
|
|
1638
|
+
var sessionSchema = z40.object({
|
|
1639
|
+
createdAt: z40.date(),
|
|
1640
|
+
current: z40.boolean(),
|
|
1641
|
+
deviceName: z40.string(),
|
|
1642
|
+
lastUsedAt: z40.date(),
|
|
1643
|
+
sessionID: z40.uuid()
|
|
1627
1644
|
});
|
|
1628
1645
|
var checkedAction = signedIn.errors(reusedIDErrors);
|
|
1629
|
-
var forgetPreviewItemSchema =
|
|
1630
|
-
var recordForgetPreviewSchema =
|
|
1646
|
+
var forgetPreviewItemSchema = z40.object({ itemID: z40.string(), text: z40.string() });
|
|
1647
|
+
var recordForgetPreviewSchema = z40.object({
|
|
1631
1648
|
momentCount: actionCountSchema,
|
|
1632
|
-
memoryItems:
|
|
1649
|
+
memoryItems: z40.array(forgetPreviewItemSchema)
|
|
1633
1650
|
});
|
|
1634
|
-
var controlledTaskSchema =
|
|
1635
|
-
controlledAt:
|
|
1636
|
-
isPauseRequested:
|
|
1651
|
+
var controlledTaskSchema = z40.object({
|
|
1652
|
+
controlledAt: z40.date(),
|
|
1653
|
+
isPauseRequested: z40.boolean(),
|
|
1637
1654
|
state: taskStateSchema,
|
|
1638
1655
|
taskID: threadSchema
|
|
1639
1656
|
});
|
|
@@ -1642,68 +1659,68 @@ var taskControl = checkedAction.errors({
|
|
|
1642
1659
|
TASK_STATE_REFUSED: {
|
|
1643
1660
|
message: "The task is in a state that does not take this control",
|
|
1644
1661
|
status: 409,
|
|
1645
|
-
data:
|
|
1662
|
+
data: z40.object({ isPauseRequested: z40.boolean(), state: taskStateSchema })
|
|
1646
1663
|
},
|
|
1647
1664
|
RUNNER_LACKS_CONTROL: {
|
|
1648
1665
|
message: "The runner of the task does not take this control",
|
|
1649
1666
|
status: 409
|
|
1650
1667
|
}
|
|
1651
|
-
}).input(
|
|
1652
|
-
var markedTaskSchema =
|
|
1653
|
-
changedAt:
|
|
1654
|
-
disposable:
|
|
1668
|
+
}).input(z40.object({ clientActionID: clientActionIDSchema2, taskID: threadSchema })).output(controlledTaskSchema);
|
|
1669
|
+
var markedTaskSchema = z40.object({
|
|
1670
|
+
changedAt: z40.date(),
|
|
1671
|
+
disposable: z40.boolean(),
|
|
1655
1672
|
taskID: threadSchema
|
|
1656
1673
|
});
|
|
1657
|
-
var nixieControl = checkedAction.input(
|
|
1674
|
+
var nixieControl = checkedAction.input(z40.object({ clientActionID: clientActionIDSchema2 })).output(z40.object({ paused: pauseStateSchema }));
|
|
1658
1675
|
var spendStopErrors = { SPEND_STOP_STANDS: spendStopStandsError };
|
|
1659
|
-
var backupNoticeSchema =
|
|
1660
|
-
cause:
|
|
1661
|
-
sequence:
|
|
1662
|
-
raisedAt:
|
|
1676
|
+
var backupNoticeSchema = z40.object({
|
|
1677
|
+
cause: z40.enum(["failed", "missing"]),
|
|
1678
|
+
sequence: z40.int().positive(),
|
|
1679
|
+
raisedAt: z40.date()
|
|
1663
1680
|
});
|
|
1664
|
-
var followRecords = signedIn.input(
|
|
1681
|
+
var followRecords = signedIn.input(z40.object({
|
|
1665
1682
|
afterSequence: sequenceSchema,
|
|
1666
|
-
clipPayloads:
|
|
1683
|
+
clipPayloads: z40.boolean().optional(),
|
|
1667
1684
|
thread: threadSchema.optional()
|
|
1668
|
-
})).output(eventIterator2(
|
|
1685
|
+
})).output(eventIterator2(z40.object({ record: recordSchema })));
|
|
1669
1686
|
var contract = {
|
|
1670
1687
|
conversation: {
|
|
1671
|
-
read: signedIn.errors({ THREAD_NOT_FOUND: { message: "No thread has this ID", status: 404 } }).input(
|
|
1688
|
+
read: signedIn.errors({ THREAD_NOT_FOUND: { message: "No thread has this ID", status: 404 } }).input(z40.object({
|
|
1672
1689
|
beforeSequence: sequenceSchema.optional(),
|
|
1673
|
-
clipPayloads:
|
|
1674
|
-
limit:
|
|
1690
|
+
clipPayloads: z40.boolean().optional(),
|
|
1691
|
+
limit: z40.int().min(1).max(200).optional(),
|
|
1675
1692
|
thread: threadSchema
|
|
1676
|
-
})).output(
|
|
1677
|
-
hasEarlier:
|
|
1693
|
+
})).output(z40.object({
|
|
1694
|
+
hasEarlier: z40.boolean(),
|
|
1678
1695
|
readAtSequence: sequenceSchema,
|
|
1679
|
-
records:
|
|
1696
|
+
records: z40.array(recordSchema),
|
|
1680
1697
|
lastStepEnd: recordSchema.nullable().optional()
|
|
1681
1698
|
})),
|
|
1682
1699
|
send: checkedAction.errors({
|
|
1683
1700
|
IMAGE_REFUSED: imageRefusedError,
|
|
1684
1701
|
THREAD_NOT_FOUND: { message: "No thread has this ID", status: 404 }
|
|
1685
|
-
}).input(
|
|
1702
|
+
}).input(z40.object({
|
|
1686
1703
|
clientMessageId: clientActionIDSchema2,
|
|
1687
1704
|
images: imageFilesSchema.optional(),
|
|
1688
|
-
spans:
|
|
1689
|
-
text:
|
|
1705
|
+
spans: z40.array(spanSchema).max(1e5),
|
|
1706
|
+
text: z40.string().min(1).max(1e5),
|
|
1690
1707
|
thread: threadSchema,
|
|
1691
|
-
timeZone:
|
|
1692
|
-
writtenAt:
|
|
1693
|
-
})).output(
|
|
1708
|
+
timeZone: z40.string().min(1).max(100).optional(),
|
|
1709
|
+
writtenAt: z40.iso.datetime().optional()
|
|
1710
|
+
})).output(z40.object({ duplicate: z40.boolean(), sequence: sequenceSchema })),
|
|
1694
1711
|
retry: checkedAction.errors({
|
|
1695
1712
|
NOTHING_TO_RETRY: {
|
|
1696
1713
|
message: "The last turn of the conversation did not fail, or it runs again already",
|
|
1697
1714
|
status: 409
|
|
1698
1715
|
}
|
|
1699
|
-
}).input(
|
|
1700
|
-
readImage: signedIn.errors({ IMAGE_NOT_FOUND: imageNotFoundError }).input(imageRefSchema).output(
|
|
1716
|
+
}).input(z40.object({ clientActionID: clientActionIDSchema2 })).output(z40.object({ retriedAt: z40.date() })),
|
|
1717
|
+
readImage: signedIn.errors({ IMAGE_NOT_FOUND: imageNotFoundError }).input(imageRefSchema).output(z40.file()),
|
|
1701
1718
|
previewForget: signedIn.errors({
|
|
1702
1719
|
RECORD_NOT_FOUND: {
|
|
1703
1720
|
message: "No record on this thread with its own text that a forget removes has this sequence",
|
|
1704
1721
|
status: 404
|
|
1705
1722
|
}
|
|
1706
|
-
}).input(
|
|
1723
|
+
}).input(z40.object({ thread: threadSchema, sequence: sequenceSchema })).output(recordForgetPreviewSchema),
|
|
1707
1724
|
forget: checkedAction.errors({
|
|
1708
1725
|
RECORD_NOT_FOUND: {
|
|
1709
1726
|
message: "No record on this thread with its own text that a forget removes has this sequence",
|
|
@@ -1713,23 +1730,23 @@ var contract = {
|
|
|
1713
1730
|
message: "The queued action has not run yet. Cancel it, or wait for it to run.",
|
|
1714
1731
|
status: 409
|
|
1715
1732
|
}
|
|
1716
|
-
}).input(
|
|
1733
|
+
}).input(z40.object({
|
|
1717
1734
|
clientActionID: clientActionIDSchema2,
|
|
1718
1735
|
sequence: sequenceSchema,
|
|
1719
1736
|
thread: threadSchema
|
|
1720
|
-
})).output(
|
|
1737
|
+
})).output(z40.object({ forgottenAt: z40.date(), backup: forgetBackupSchema }))
|
|
1721
1738
|
},
|
|
1722
1739
|
tasks: {
|
|
1723
|
-
list: signedIn.input(
|
|
1724
|
-
definitionID:
|
|
1725
|
-
states:
|
|
1740
|
+
list: signedIn.input(z40.object({
|
|
1741
|
+
definitionID: z40.string().min(1).max(200).optional(),
|
|
1742
|
+
states: z40.array(listedStateSchema).min(1).max(11).refine((states) => new Set(states).size === states.length, {
|
|
1726
1743
|
message: "Each state may appear once"
|
|
1727
1744
|
}).optional()
|
|
1728
|
-
}).optional()).output(
|
|
1729
|
-
read: signedIn.errors({ TASK_NOT_FOUND: { message: "No task has this ID", status: 404 } }).input(
|
|
1730
|
-
readActions: signedIn.errors({ TASK_NOT_FOUND: { message: "No task has this ID", status: 404 } }).input(
|
|
1731
|
-
queued:
|
|
1732
|
-
started:
|
|
1745
|
+
}).optional()).output(z40.object({ readAtSequence: sequenceSchema, tasks: z40.array(listedTaskSchema) })),
|
|
1746
|
+
read: signedIn.errors({ TASK_NOT_FOUND: { message: "No task has this ID", status: 404 } }).input(z40.object({ taskID: threadSchema })).output(listedTaskSchema),
|
|
1747
|
+
readActions: signedIn.errors({ TASK_NOT_FOUND: { message: "No task has this ID", status: 404 } }).input(z40.object({ taskID: threadSchema })).output(z40.object({
|
|
1748
|
+
queued: z40.array(listedActionSchema),
|
|
1749
|
+
started: z40.array(listedActionSchema)
|
|
1733
1750
|
})),
|
|
1734
1751
|
pause: taskControl,
|
|
1735
1752
|
resume: taskControl.errors(spendStopErrors),
|
|
@@ -1749,26 +1766,26 @@ var contract = {
|
|
|
1749
1766
|
TASK_STATE_REFUSED: {
|
|
1750
1767
|
message: "The task is in a state that does not take this change",
|
|
1751
1768
|
status: 409,
|
|
1752
|
-
data:
|
|
1769
|
+
data: z40.object({ state: taskStateSchema })
|
|
1753
1770
|
}
|
|
1754
|
-
}).input(
|
|
1771
|
+
}).input(z40.object({
|
|
1755
1772
|
clientActionID: clientActionIDSchema2,
|
|
1756
|
-
disposable:
|
|
1773
|
+
disposable: z40.boolean(),
|
|
1757
1774
|
taskID: threadSchema
|
|
1758
1775
|
})).output(markedTaskSchema),
|
|
1759
1776
|
...viewContract.tasks
|
|
1760
1777
|
},
|
|
1761
1778
|
memory: {
|
|
1762
|
-
readVersions: signedIn.input(
|
|
1763
|
-
writerStatus: signedIn.route({ deprecated: true }).output(
|
|
1764
|
-
isEnabled:
|
|
1765
|
-
backlog:
|
|
1766
|
-
batches:
|
|
1779
|
+
readVersions: signedIn.input(z40.object({ versions: z40.array(versionRefSchema).min(1).max(100) })).output(z40.object({ versions: z40.array(versionTextSchema) })),
|
|
1780
|
+
writerStatus: signedIn.route({ deprecated: true }).output(z40.object({
|
|
1781
|
+
isEnabled: z40.boolean(),
|
|
1782
|
+
backlog: z40.int().nonnegative(),
|
|
1783
|
+
batches: z40.int().nonnegative(),
|
|
1767
1784
|
cursor: sequenceSchema,
|
|
1768
|
-
failures:
|
|
1769
|
-
isCatchingUp:
|
|
1785
|
+
failures: z40.int().nonnegative(),
|
|
1786
|
+
isCatchingUp: z40.boolean(),
|
|
1770
1787
|
lastError: writerErrorSchema,
|
|
1771
|
-
retryAt:
|
|
1788
|
+
retryAt: z40.date().nullable()
|
|
1772
1789
|
})),
|
|
1773
1790
|
...memoryViewContract
|
|
1774
1791
|
},
|
|
@@ -1776,10 +1793,17 @@ var contract = {
|
|
|
1776
1793
|
read: signedIn.errors({
|
|
1777
1794
|
FILE_NOT_FOUND: { message: "No code-run file has this ID", status: 404 },
|
|
1778
1795
|
FILE_FORGOTTEN: { message: "A forget made this file unreadable", status: 410 }
|
|
1779
|
-
}).input(
|
|
1796
|
+
}).input(z40.object({ file: z40.string().min(1).max(100) })).output(z40.file()),
|
|
1797
|
+
list: signedIn.input(z40.object({
|
|
1798
|
+
cursor: z40.string().max(100).regex(/^\d+:\d+$/u).optional(),
|
|
1799
|
+
kind: z40.enum(["image", "other"]).optional()
|
|
1800
|
+
})).output(z40.object({
|
|
1801
|
+
files: z40.array(codeFileSchema).max(30),
|
|
1802
|
+
nextCursor: z40.string().nullable()
|
|
1803
|
+
}))
|
|
1780
1804
|
},
|
|
1781
1805
|
nixie: {
|
|
1782
|
-
read: signedIn.output(
|
|
1806
|
+
read: signedIn.output(z40.object({ paused: pauseStateSchema })),
|
|
1783
1807
|
pause: nixieControl,
|
|
1784
1808
|
resume: nixieControl.errors(spendStopErrors)
|
|
1785
1809
|
},
|
|
@@ -1788,10 +1812,10 @@ var contract = {
|
|
|
1788
1812
|
raise: signedIn.input(spendRaiseInputSchema).output(spendRaiseOutputSchema)
|
|
1789
1813
|
},
|
|
1790
1814
|
recovery: {
|
|
1791
|
-
read: signedIn.output(
|
|
1815
|
+
read: signedIn.output(z40.object({ recovery: recoverySchema }))
|
|
1792
1816
|
},
|
|
1793
1817
|
backups: {
|
|
1794
|
-
readNotice: signedIn.output(
|
|
1818
|
+
readNotice: signedIn.output(z40.object({ notice: backupNoticeSchema.nullable() }))
|
|
1795
1819
|
},
|
|
1796
1820
|
triggers: viewContract.triggers,
|
|
1797
1821
|
reminders: remindersContract,
|
|
@@ -1812,28 +1836,28 @@ var contract = {
|
|
|
1812
1836
|
message: "The enrolment code is unknown, used or lapsed",
|
|
1813
1837
|
status: 400
|
|
1814
1838
|
}
|
|
1815
|
-
}).input(
|
|
1839
|
+
}).input(z40.object({
|
|
1816
1840
|
clientActionID: clientActionIDSchema2,
|
|
1817
|
-
code:
|
|
1818
|
-
deviceName:
|
|
1819
|
-
tokenDelivery:
|
|
1820
|
-
})).output(
|
|
1821
|
-
issueCode: checkedAction.input(
|
|
1822
|
-
list: signedIn.output(
|
|
1823
|
-
revoke: checkedAction.errors({ SESSION_NOT_FOUND: { message: "No session has this ID", status: 404 } }).input(
|
|
1841
|
+
code: z40.string().min(1).max(100),
|
|
1842
|
+
deviceName: z40.string().min(1).max(100),
|
|
1843
|
+
tokenDelivery: z40.enum(["cookie", "bearer"])
|
|
1844
|
+
})).output(z40.object({ sessionID: z40.uuid(), token: z40.string().optional() })),
|
|
1845
|
+
issueCode: checkedAction.input(z40.object({ clientActionID: clientActionIDSchema2 })).output(z40.object({ code: z40.string(), expiresAt: z40.date() })),
|
|
1846
|
+
list: signedIn.output(z40.object({ sessions: z40.array(sessionSchema) })),
|
|
1847
|
+
revoke: checkedAction.errors({ SESSION_NOT_FOUND: { message: "No session has this ID", status: 404 } }).input(z40.object({ clientActionID: clientActionIDSchema2, sessionID: z40.uuid() })).output(z40.object({ revokedAt: z40.date() }))
|
|
1824
1848
|
}
|
|
1825
1849
|
};
|
|
1826
1850
|
// src/contract/host-contract.ts
|
|
1827
1851
|
import { oc as oc8 } from "@orpc/contract";
|
|
1828
|
-
import { z as
|
|
1852
|
+
import { z as z51 } from "zod";
|
|
1829
1853
|
|
|
1830
1854
|
// src/contract/action-proposal-schema.ts
|
|
1831
|
-
import { z as
|
|
1832
|
-
var actionProposalSchema =
|
|
1833
|
-
proposalID:
|
|
1834
|
-
tool:
|
|
1835
|
-
effects:
|
|
1836
|
-
cause:
|
|
1855
|
+
import { z as z41 } from "zod";
|
|
1856
|
+
var actionProposalSchema = z41.object({
|
|
1857
|
+
proposalID: z41.string(),
|
|
1858
|
+
tool: z41.string(),
|
|
1859
|
+
effects: z41.array(z41.string()),
|
|
1860
|
+
cause: z41.enum([
|
|
1837
1861
|
"outside_steering",
|
|
1838
1862
|
"always_ask",
|
|
1839
1863
|
"ask_rule",
|
|
@@ -1841,22 +1865,22 @@ var actionProposalSchema = z40.object({
|
|
|
1841
1865
|
"direct_request",
|
|
1842
1866
|
"repeat"
|
|
1843
1867
|
]),
|
|
1844
|
-
sentence:
|
|
1845
|
-
destinations:
|
|
1846
|
-
createdAt:
|
|
1847
|
-
lapseAt:
|
|
1868
|
+
sentence: z41.string(),
|
|
1869
|
+
destinations: z41.array(z41.string()),
|
|
1870
|
+
createdAt: z41.date(),
|
|
1871
|
+
lapseAt: z41.date()
|
|
1848
1872
|
});
|
|
1849
1873
|
|
|
1850
1874
|
// src/contract/forgotten-items-schema.ts
|
|
1851
|
-
import { z as
|
|
1852
|
-
var forgottenItemsSchema =
|
|
1853
|
-
itemIDs:
|
|
1875
|
+
import { z as z42 } from "zod";
|
|
1876
|
+
var forgottenItemsSchema = z42.object({
|
|
1877
|
+
itemIDs: z42.array(z42.string()),
|
|
1854
1878
|
backup: forgetBackupSchema
|
|
1855
1879
|
});
|
|
1856
1880
|
|
|
1857
1881
|
// src/contract/host-backups-contract.ts
|
|
1858
1882
|
import { oc as oc3 } from "@orpc/contract";
|
|
1859
|
-
import { z as
|
|
1883
|
+
import { z as z43 } from "zod";
|
|
1860
1884
|
var hostBackupsContract = {
|
|
1861
1885
|
stage: oc3.errors({
|
|
1862
1886
|
BACKUP_SET_WAITING: {
|
|
@@ -1875,107 +1899,107 @@ var hostBackupsContract = {
|
|
|
1875
1899
|
message: "nixie is paused after a restore and stages no backup set until you read `nixie recovery` and run `nixie resume`",
|
|
1876
1900
|
status: 409
|
|
1877
1901
|
}
|
|
1878
|
-
}).output(
|
|
1879
|
-
sequence:
|
|
1880
|
-
kind:
|
|
1881
|
-
stagedAt:
|
|
1902
|
+
}).output(z43.object({
|
|
1903
|
+
sequence: z43.int().positive(),
|
|
1904
|
+
kind: z43.enum(["scheduled", "forget"]),
|
|
1905
|
+
stagedAt: z43.date()
|
|
1882
1906
|
}))
|
|
1883
1907
|
};
|
|
1884
1908
|
|
|
1885
1909
|
// src/contract/host-budgets-contract.ts
|
|
1886
1910
|
import { oc as oc4 } from "@orpc/contract";
|
|
1887
|
-
import { z as
|
|
1911
|
+
import { z as z44 } from "zod";
|
|
1888
1912
|
var budgets = oc4.errors({
|
|
1889
1913
|
BUDGETS_NOT_CONFIGURED: { message: "the server holds no budgets", status: 409 }
|
|
1890
1914
|
});
|
|
1891
|
-
var budgetStatusSchema =
|
|
1892
|
-
budgetID:
|
|
1893
|
-
counts:
|
|
1894
|
-
limitMicros:
|
|
1895
|
-
period:
|
|
1896
|
-
spentMicros:
|
|
1897
|
-
resetsAt:
|
|
1898
|
-
source:
|
|
1899
|
-
});
|
|
1900
|
-
var budgetChargeSchema =
|
|
1901
|
-
chargeID:
|
|
1902
|
-
amountMicros:
|
|
1903
|
-
for:
|
|
1904
|
-
isCredited:
|
|
1915
|
+
var budgetStatusSchema = z44.object({
|
|
1916
|
+
budgetID: z44.string(),
|
|
1917
|
+
counts: z44.string(),
|
|
1918
|
+
limitMicros: z44.number(),
|
|
1919
|
+
period: z44.enum(["day", "week", "month"]),
|
|
1920
|
+
spentMicros: z44.number(),
|
|
1921
|
+
resetsAt: z44.date(),
|
|
1922
|
+
source: z44.enum(["definitions", "built_in"])
|
|
1923
|
+
});
|
|
1924
|
+
var budgetChargeSchema = z44.object({
|
|
1925
|
+
chargeID: z44.string(),
|
|
1926
|
+
amountMicros: z44.number(),
|
|
1927
|
+
for: z44.object({ kind: z44.string(), id: z44.string() }),
|
|
1928
|
+
isCredited: z44.boolean()
|
|
1905
1929
|
});
|
|
1906
1930
|
var hostBudgetsContract = {
|
|
1907
|
-
list: budgets.output(
|
|
1908
|
-
ledger: budgets.errors({ NOT_FOUND: { message: "no budget has that ID", status: 404 } }).input(
|
|
1909
|
-
budgetID:
|
|
1910
|
-
periodStart:
|
|
1911
|
-
resetsAt:
|
|
1912
|
-
spentMicros:
|
|
1913
|
-
charges:
|
|
1931
|
+
list: budgets.output(z44.array(budgetStatusSchema)),
|
|
1932
|
+
ledger: budgets.errors({ NOT_FOUND: { message: "no budget has that ID", status: 404 } }).input(z44.strictObject({ budgetID: z44.string().min(1) })).output(z44.object({
|
|
1933
|
+
budgetID: z44.string(),
|
|
1934
|
+
periodStart: z44.string(),
|
|
1935
|
+
resetsAt: z44.date(),
|
|
1936
|
+
spentMicros: z44.number(),
|
|
1937
|
+
charges: z44.array(budgetChargeSchema)
|
|
1914
1938
|
}))
|
|
1915
1939
|
};
|
|
1916
1940
|
|
|
1917
1941
|
// src/contract/host-mandates-contract.ts
|
|
1918
1942
|
import { oc as oc5 } from "@orpc/contract";
|
|
1919
|
-
import { z as
|
|
1943
|
+
import { z as z45 } from "zod";
|
|
1920
1944
|
var mandates = oc5.errors({
|
|
1921
1945
|
NOT_FOUND: { message: "no mandate has that ID", status: 404 }
|
|
1922
1946
|
});
|
|
1923
|
-
var hostMandateRuleSchema =
|
|
1924
|
-
var hostMandateSchema =
|
|
1925
|
-
mandateID:
|
|
1926
|
-
title:
|
|
1927
|
-
rules:
|
|
1928
|
-
startedAt:
|
|
1929
|
-
expires:
|
|
1947
|
+
var hostMandateRuleSchema = z45.object({ ruleID: z45.string(), sentence: z45.string() });
|
|
1948
|
+
var hostMandateSchema = z45.object({
|
|
1949
|
+
mandateID: z45.string(),
|
|
1950
|
+
title: z45.string().nullable(),
|
|
1951
|
+
rules: z45.array(hostMandateRuleSchema),
|
|
1952
|
+
startedAt: z45.date(),
|
|
1953
|
+
expires: z45.date()
|
|
1930
1954
|
});
|
|
1931
1955
|
var hostMandatesContract = {
|
|
1932
|
-
list: mandates.output(
|
|
1933
|
-
end: mandates.input(
|
|
1956
|
+
list: mandates.output(z45.array(hostMandateSchema)),
|
|
1957
|
+
end: mandates.input(z45.strictObject({ mandateID: z45.string().min(1) })).output(z45.object({ mandateID: z45.string(), state: z45.enum(["ended", "expired"]) }))
|
|
1934
1958
|
};
|
|
1935
1959
|
|
|
1936
1960
|
// src/contract/host-passkey-contract.ts
|
|
1937
1961
|
import { oc as oc6 } from "@orpc/contract";
|
|
1938
|
-
import { z as
|
|
1939
|
-
var hostPasskeySchema =
|
|
1940
|
-
passkeyID:
|
|
1941
|
-
label:
|
|
1942
|
-
synced:
|
|
1943
|
-
origin:
|
|
1944
|
-
registeredBy:
|
|
1945
|
-
authorizedBy:
|
|
1946
|
-
registeredAt:
|
|
1947
|
-
lastUsedAt:
|
|
1948
|
-
revokedAt:
|
|
1962
|
+
import { z as z46 } from "zod";
|
|
1963
|
+
var hostPasskeySchema = z46.object({
|
|
1964
|
+
passkeyID: z46.string(),
|
|
1965
|
+
label: z46.string(),
|
|
1966
|
+
synced: z46.boolean(),
|
|
1967
|
+
origin: z46.string(),
|
|
1968
|
+
registeredBy: z46.string(),
|
|
1969
|
+
authorizedBy: z46.string(),
|
|
1970
|
+
registeredAt: z46.date(),
|
|
1971
|
+
lastUsedAt: z46.date().nullable(),
|
|
1972
|
+
revokedAt: z46.date().nullable()
|
|
1949
1973
|
});
|
|
1950
1974
|
var hostPasskeyContract = {
|
|
1951
|
-
issueCode: oc6.output(
|
|
1952
|
-
list: oc6.output(
|
|
1975
|
+
issueCode: oc6.output(z46.object({ code: z46.string(), expiresAt: z46.date() })),
|
|
1976
|
+
list: oc6.output(z46.array(hostPasskeySchema)),
|
|
1953
1977
|
revoke: oc6.errors({
|
|
1954
1978
|
PASSKEY_NOT_FOUND: { message: "no passkey has that ID", status: 404 }
|
|
1955
|
-
}).input(
|
|
1979
|
+
}).input(z46.strictObject({ passkeyID: z46.string().min(1) })).output(z46.object({ passkeyID: z46.string(), revokedAt: z46.date() }))
|
|
1956
1980
|
};
|
|
1957
1981
|
|
|
1958
1982
|
// src/contract/known-contact-schema.ts
|
|
1959
|
-
import { z as
|
|
1960
|
-
var knownContactSchema =
|
|
1961
|
-
contactID:
|
|
1962
|
-
name:
|
|
1963
|
-
destination:
|
|
1964
|
-
markedAt:
|
|
1983
|
+
import { z as z47 } from "zod";
|
|
1984
|
+
var knownContactSchema = z47.object({
|
|
1985
|
+
contactID: z47.string(),
|
|
1986
|
+
name: z47.string().nullable(),
|
|
1987
|
+
destination: z47.string().nullable(),
|
|
1988
|
+
markedAt: z47.date()
|
|
1965
1989
|
});
|
|
1966
1990
|
|
|
1967
1991
|
// src/contract/turn-inputs-contract.ts
|
|
1968
1992
|
import { oc as oc7 } from "@orpc/contract";
|
|
1969
|
-
import { z as
|
|
1993
|
+
import { z as z50 } from "zod";
|
|
1970
1994
|
|
|
1971
1995
|
// src/contract/input-miss-schema.ts
|
|
1972
|
-
import { z as
|
|
1973
|
-
var inputMissSchema =
|
|
1974
|
-
missID:
|
|
1975
|
-
captureID:
|
|
1976
|
-
taskID:
|
|
1977
|
-
stepRunID:
|
|
1978
|
-
reason:
|
|
1996
|
+
import { z as z48 } from "zod";
|
|
1997
|
+
var inputMissSchema = z48.object({
|
|
1998
|
+
missID: z48.string(),
|
|
1999
|
+
captureID: z48.string().nullable(),
|
|
2000
|
+
taskID: z48.string(),
|
|
2001
|
+
stepRunID: z48.string(),
|
|
2002
|
+
reason: z48.enum([
|
|
1979
2003
|
"queue_full",
|
|
1980
2004
|
"spool_full",
|
|
1981
2005
|
"spool_write_failed",
|
|
@@ -1987,45 +2011,45 @@ var inputMissSchema = z47.object({
|
|
|
1987
2011
|
"intake_failed",
|
|
1988
2012
|
"holds_own_value"
|
|
1989
2013
|
]),
|
|
1990
|
-
count:
|
|
1991
|
-
writer:
|
|
1992
|
-
counter:
|
|
1993
|
-
createdAt:
|
|
2014
|
+
count: z48.int().positive(),
|
|
2015
|
+
writer: z48.string().nullable(),
|
|
2016
|
+
counter: z48.int().nullable(),
|
|
2017
|
+
createdAt: z48.date()
|
|
1994
2018
|
});
|
|
1995
2019
|
|
|
1996
2020
|
// src/contract/logged-input-schema.ts
|
|
1997
|
-
import { z as
|
|
1998
|
-
var loggedInputSchema =
|
|
1999
|
-
inputID:
|
|
2000
|
-
captureID:
|
|
2001
|
-
taskID:
|
|
2002
|
-
stepRunID:
|
|
2003
|
-
writer:
|
|
2004
|
-
counter:
|
|
2005
|
-
role:
|
|
2006
|
-
profile:
|
|
2007
|
-
model:
|
|
2008
|
-
harness:
|
|
2009
|
-
api:
|
|
2010
|
-
endpoint:
|
|
2011
|
-
route:
|
|
2012
|
-
isRewritten:
|
|
2013
|
-
upstreamStatus:
|
|
2014
|
-
bytes:
|
|
2015
|
-
intakeSequence:
|
|
2016
|
-
receivedAt:
|
|
2017
|
-
takenAt:
|
|
2018
|
-
state:
|
|
2019
|
-
removedCause:
|
|
2021
|
+
import { z as z49 } from "zod";
|
|
2022
|
+
var loggedInputSchema = z49.object({
|
|
2023
|
+
inputID: z49.string(),
|
|
2024
|
+
captureID: z49.string(),
|
|
2025
|
+
taskID: z49.string(),
|
|
2026
|
+
stepRunID: z49.string(),
|
|
2027
|
+
writer: z49.string(),
|
|
2028
|
+
counter: z49.int(),
|
|
2029
|
+
role: z49.string(),
|
|
2030
|
+
profile: z49.string(),
|
|
2031
|
+
model: z49.string(),
|
|
2032
|
+
harness: z49.string(),
|
|
2033
|
+
api: z49.string(),
|
|
2034
|
+
endpoint: z49.string(),
|
|
2035
|
+
route: z49.string(),
|
|
2036
|
+
isRewritten: z49.boolean(),
|
|
2037
|
+
upstreamStatus: z49.int(),
|
|
2038
|
+
bytes: z49.int(),
|
|
2039
|
+
intakeSequence: z49.int(),
|
|
2040
|
+
receivedAt: z49.date(),
|
|
2041
|
+
takenAt: z49.date(),
|
|
2042
|
+
state: z49.enum(["writing", "stored", "missing", "removed"]),
|
|
2043
|
+
removedCause: z49.enum(["retention_days", "retention_bytes", "forget", "dropped", "restore", "reset"]).nullable()
|
|
2020
2044
|
});
|
|
2021
2045
|
|
|
2022
2046
|
// src/contract/turn-inputs-contract.ts
|
|
2023
|
-
var turnInputOn =
|
|
2024
|
-
state:
|
|
2025
|
-
forMs:
|
|
2047
|
+
var turnInputOn = z50.strictObject({
|
|
2048
|
+
state: z50.literal("on"),
|
|
2049
|
+
forMs: z50.int().positive().nullable()
|
|
2026
2050
|
});
|
|
2027
|
-
var turnInputOff =
|
|
2028
|
-
var turnInputSetSchema =
|
|
2051
|
+
var turnInputOff = z50.strictObject({ state: z50.literal("off"), drop: z50.boolean() });
|
|
2052
|
+
var turnInputSetSchema = z50.discriminatedUnion("state", [turnInputOn, turnInputOff]);
|
|
2029
2053
|
var turnInputs = oc7.errors({
|
|
2030
2054
|
NOT_FOUND: { message: "no logged request has that ID", status: 404 },
|
|
2031
2055
|
REMOVED: { message: "that request is removed or its body is missing", status: 410 },
|
|
@@ -2035,27 +2059,27 @@ var turnInputs = oc7.errors({
|
|
|
2035
2059
|
},
|
|
2036
2060
|
NOT_CONFIGURED: { message: "the turn-input log is not configured", status: 409 }
|
|
2037
2061
|
});
|
|
2038
|
-
var listedInputsSchema =
|
|
2039
|
-
inputs:
|
|
2040
|
-
misses:
|
|
2062
|
+
var listedInputsSchema = z50.object({
|
|
2063
|
+
inputs: z50.array(loggedInputSchema),
|
|
2064
|
+
misses: z50.array(inputMissSchema)
|
|
2041
2065
|
});
|
|
2042
2066
|
var turnInputsContract = {
|
|
2043
|
-
list: turnInputs.input(
|
|
2044
|
-
open: turnInputs.input(
|
|
2045
|
-
set: turnInputs.input(turnInputSetSchema).output(
|
|
2067
|
+
list: turnInputs.input(z50.strictObject({ limit: z50.int().positive().max(500).default(50) })).output(listedInputsSchema),
|
|
2068
|
+
open: turnInputs.input(z50.strictObject({ inputID: z50.string().min(1) })).output(z50.object({ inputID: z50.string(), body: z50.base64() })),
|
|
2069
|
+
set: turnInputs.input(turnInputSetSchema).output(z50.object({ state: z50.enum(["on", "off"]), until: z50.number().nullable() }))
|
|
2046
2070
|
};
|
|
2047
2071
|
|
|
2048
2072
|
// src/contract/host-contract.ts
|
|
2049
|
-
var versionRefSchema2 =
|
|
2050
|
-
var versionTargetSchema2 =
|
|
2051
|
-
itemID:
|
|
2052
|
-
version:
|
|
2053
|
-
});
|
|
2054
|
-
var itemTextSchema =
|
|
2055
|
-
var proposalOriginSchema2 =
|
|
2056
|
-
var memoryOriginSchema =
|
|
2057
|
-
var contentSourceSchema =
|
|
2058
|
-
var reviewReasonSchema2 =
|
|
2073
|
+
var versionRefSchema2 = z51.object({ itemID: z51.string(), version: z51.int().positive() });
|
|
2074
|
+
var versionTargetSchema2 = z51.strictObject({
|
|
2075
|
+
itemID: z51.string().min(1),
|
|
2076
|
+
version: z51.int().positive()
|
|
2077
|
+
});
|
|
2078
|
+
var itemTextSchema = z51.string().max(2000).regex(/\S/u);
|
|
2079
|
+
var proposalOriginSchema2 = z51.enum(["owner", "conversation", "task"]);
|
|
2080
|
+
var memoryOriginSchema = z51.enum([...proposalOriginSchema2.options, "lapse"]);
|
|
2081
|
+
var contentSourceSchema = z51.enum(["owner", "owner_data", "untrusted"]);
|
|
2082
|
+
var reviewReasonSchema2 = z51.enum([
|
|
2059
2083
|
"no_quote",
|
|
2060
2084
|
"quote_not_typed",
|
|
2061
2085
|
"quote_in_quoted_block",
|
|
@@ -2074,68 +2098,68 @@ var reviewReasonSchema2 = z50.enum([
|
|
|
2074
2098
|
"labels",
|
|
2075
2099
|
"ask_rule"
|
|
2076
2100
|
]);
|
|
2077
|
-
var proposalSourceSchema2 =
|
|
2101
|
+
var proposalSourceSchema2 = z51.object({
|
|
2078
2102
|
origin: proposalOriginSchema2,
|
|
2079
|
-
thread:
|
|
2080
|
-
proposedAt:
|
|
2081
|
-
});
|
|
2082
|
-
var pendingProposalSchema =
|
|
2083
|
-
proposalID:
|
|
2084
|
-
operation:
|
|
2085
|
-
itemID:
|
|
2086
|
-
targetVersion:
|
|
2087
|
-
isPinned:
|
|
2088
|
-
subject:
|
|
2089
|
-
newSubject:
|
|
2090
|
-
kind:
|
|
2103
|
+
thread: z51.string().nullable(),
|
|
2104
|
+
proposedAt: z51.date()
|
|
2105
|
+
});
|
|
2106
|
+
var pendingProposalSchema = z51.object({
|
|
2107
|
+
proposalID: z51.string(),
|
|
2108
|
+
operation: z51.enum(["remember", "retire", "pin"]),
|
|
2109
|
+
itemID: z51.string(),
|
|
2110
|
+
targetVersion: z51.int().nullable(),
|
|
2111
|
+
isPinned: z51.boolean(),
|
|
2112
|
+
subject: z51.enum(["owner", "self", "shared"]),
|
|
2113
|
+
newSubject: z51.enum(["owner", "self", "shared"]).nullable(),
|
|
2114
|
+
kind: z51.enum(["fact", "self"]),
|
|
2091
2115
|
reason: reviewReasonSchema2,
|
|
2092
|
-
actionHash:
|
|
2116
|
+
actionHash: z51.string(),
|
|
2093
2117
|
origin: proposalOriginSchema2,
|
|
2094
2118
|
source: contentSourceSchema,
|
|
2095
|
-
createdAt:
|
|
2096
|
-
lapseAt:
|
|
2097
|
-
sources:
|
|
2098
|
-
text:
|
|
2099
|
-
quote:
|
|
2100
|
-
});
|
|
2101
|
-
var closeMatchSchema2 =
|
|
2102
|
-
var approvalResultSchema =
|
|
2103
|
-
|
|
2104
|
-
|
|
2119
|
+
createdAt: z51.date(),
|
|
2120
|
+
lapseAt: z51.date(),
|
|
2121
|
+
sources: z51.array(proposalSourceSchema2),
|
|
2122
|
+
text: z51.string(),
|
|
2123
|
+
quote: z51.string().nullable()
|
|
2124
|
+
});
|
|
2125
|
+
var closeMatchSchema2 = z51.object({ itemID: z51.string(), version: z51.int(), text: z51.string() });
|
|
2126
|
+
var approvalResultSchema = z51.discriminatedUnion("status", [
|
|
2127
|
+
z51.object({ status: z51.literal("applied"), itemID: z51.string(), version: z51.int() }),
|
|
2128
|
+
z51.object({ status: z51.literal("close_match"), item: closeMatchSchema2 })
|
|
2105
2129
|
]);
|
|
2106
|
-
var historyVersionSchema =
|
|
2107
|
-
version:
|
|
2108
|
-
change:
|
|
2109
|
-
state:
|
|
2130
|
+
var historyVersionSchema = z51.object({
|
|
2131
|
+
version: z51.int(),
|
|
2132
|
+
change: z51.enum(["created", "edited", "retired", "restored", "undone"]),
|
|
2133
|
+
state: z51.enum(["active", "retired"]),
|
|
2110
2134
|
origin: memoryOriginSchema,
|
|
2111
2135
|
source: contentSourceSchema,
|
|
2112
|
-
recordedAt:
|
|
2113
|
-
isRemoved:
|
|
2114
|
-
isBridge:
|
|
2115
|
-
status:
|
|
2116
|
-
text:
|
|
2117
|
-
});
|
|
2118
|
-
var itemHistorySchema =
|
|
2119
|
-
itemID:
|
|
2120
|
-
subject:
|
|
2121
|
-
kind:
|
|
2122
|
-
state:
|
|
2123
|
-
versions:
|
|
2124
|
-
});
|
|
2125
|
-
var proposalAnswerSchema =
|
|
2126
|
-
proposalID:
|
|
2127
|
-
actionHash:
|
|
2128
|
-
});
|
|
2129
|
-
var hostSessionSchema =
|
|
2130
|
-
sessionID:
|
|
2131
|
-
deviceName:
|
|
2132
|
-
createdAt:
|
|
2133
|
-
lastUsedAt:
|
|
2134
|
-
});
|
|
2135
|
-
var subjectCountSchema =
|
|
2136
|
-
owner:
|
|
2137
|
-
shared:
|
|
2138
|
-
self:
|
|
2136
|
+
recordedAt: z51.date(),
|
|
2137
|
+
isRemoved: z51.boolean(),
|
|
2138
|
+
isBridge: z51.boolean(),
|
|
2139
|
+
status: z51.enum(["readable", "shredded", "unreadable"]),
|
|
2140
|
+
text: z51.string().nullable()
|
|
2141
|
+
});
|
|
2142
|
+
var itemHistorySchema = z51.object({
|
|
2143
|
+
itemID: z51.string(),
|
|
2144
|
+
subject: z51.enum(["owner", "self", "shared"]),
|
|
2145
|
+
kind: z51.enum(["fact", "self"]),
|
|
2146
|
+
state: z51.enum(["active", "retired", "forgetting", "forgotten"]),
|
|
2147
|
+
versions: z51.array(historyVersionSchema)
|
|
2148
|
+
});
|
|
2149
|
+
var proposalAnswerSchema = z51.strictObject({
|
|
2150
|
+
proposalID: z51.string().min(1),
|
|
2151
|
+
actionHash: z51.string().min(1)
|
|
2152
|
+
});
|
|
2153
|
+
var hostSessionSchema = z51.object({
|
|
2154
|
+
sessionID: z51.string(),
|
|
2155
|
+
deviceName: z51.string(),
|
|
2156
|
+
createdAt: z51.date(),
|
|
2157
|
+
lastUsedAt: z51.date()
|
|
2158
|
+
});
|
|
2159
|
+
var subjectCountSchema = z51.object({
|
|
2160
|
+
owner: z51.int().nonnegative(),
|
|
2161
|
+
shared: z51.int().nonnegative(),
|
|
2162
|
+
self: z51.int().nonnegative()
|
|
2139
2163
|
});
|
|
2140
2164
|
var memory = oc8.errors({
|
|
2141
2165
|
MEMORY_NOT_STARTED: { message: "the memory store has not started yet", status: 503 },
|
|
@@ -2150,28 +2174,28 @@ var memory = oc8.errors({
|
|
|
2150
2174
|
PIN_EDIT: { message: "a pin takes no edited text", status: 400 },
|
|
2151
2175
|
SELF_NOTE_REFUSED: { message: "a self-note never takes that change", status: 409 }
|
|
2152
2176
|
});
|
|
2153
|
-
var skillFileSchema =
|
|
2154
|
-
var pendingSkillProposalSchema =
|
|
2155
|
-
proposalID:
|
|
2156
|
-
name:
|
|
2157
|
-
skillHash:
|
|
2158
|
-
baseHash:
|
|
2159
|
-
files:
|
|
2160
|
-
inForce:
|
|
2161
|
-
skillHash:
|
|
2162
|
-
origin:
|
|
2163
|
-
files:
|
|
2177
|
+
var skillFileSchema = z51.object({ path: z51.string(), text: z51.string() });
|
|
2178
|
+
var pendingSkillProposalSchema = z51.object({
|
|
2179
|
+
proposalID: z51.string(),
|
|
2180
|
+
name: z51.string(),
|
|
2181
|
+
skillHash: z51.string(),
|
|
2182
|
+
baseHash: z51.string().nullable(),
|
|
2183
|
+
files: z51.array(skillFileSchema),
|
|
2184
|
+
inForce: z51.object({
|
|
2185
|
+
skillHash: z51.string(),
|
|
2186
|
+
origin: z51.enum(["definitions", "vendored", "nixie"]),
|
|
2187
|
+
files: z51.array(skillFileSchema)
|
|
2164
2188
|
}).nullable(),
|
|
2165
|
-
untypedToken:
|
|
2166
|
-
thread:
|
|
2167
|
-
provenance:
|
|
2168
|
-
createdAt:
|
|
2169
|
-
lapseAt:
|
|
2170
|
-
isStale:
|
|
2189
|
+
untypedToken: z51.object({ kind: z51.string(), raw: z51.string() }).nullable(),
|
|
2190
|
+
thread: z51.string().nullable(),
|
|
2191
|
+
provenance: z51.object({ runID: z51.string(), callID: z51.string(), profile: z51.string() }),
|
|
2192
|
+
createdAt: z51.date(),
|
|
2193
|
+
lapseAt: z51.date(),
|
|
2194
|
+
isStale: z51.boolean()
|
|
2171
2195
|
});
|
|
2172
|
-
var skillAnswerSchema =
|
|
2173
|
-
proposalID:
|
|
2174
|
-
skillHash:
|
|
2196
|
+
var skillAnswerSchema = z51.strictObject({
|
|
2197
|
+
proposalID: z51.string().min(1),
|
|
2198
|
+
skillHash: z51.string().min(1)
|
|
2175
2199
|
});
|
|
2176
2200
|
var skills = oc8.errors({
|
|
2177
2201
|
NOT_FOUND: { message: "nothing has that ID", status: 404 },
|
|
@@ -2181,38 +2205,38 @@ var skills = oc8.errors({
|
|
|
2181
2205
|
SKILL_CHECK: { message: "the files fail the seed checks", status: 400 },
|
|
2182
2206
|
WRONG_STATE: { message: "the skill nixie wrote is no longer in force", status: 409 }
|
|
2183
2207
|
});
|
|
2184
|
-
var definitionsSkillSchema =
|
|
2185
|
-
var writtenSkillSchema =
|
|
2186
|
-
approvalID:
|
|
2187
|
-
proposalID:
|
|
2188
|
-
name:
|
|
2189
|
-
skillHash:
|
|
2208
|
+
var definitionsSkillSchema = z51.object({ skillHash: z51.string(), origin: z51.enum(["definitions", "vendored"]) }).nullable();
|
|
2209
|
+
var writtenSkillSchema = z51.object({
|
|
2210
|
+
approvalID: z51.string(),
|
|
2211
|
+
proposalID: z51.string(),
|
|
2212
|
+
name: z51.string(),
|
|
2213
|
+
skillHash: z51.string(),
|
|
2190
2214
|
base: definitionsSkillSchema,
|
|
2191
2215
|
definitions: definitionsSkillSchema,
|
|
2192
|
-
isConflict:
|
|
2193
|
-
pullRequestURL:
|
|
2194
|
-
approvedAt:
|
|
2195
|
-
});
|
|
2196
|
-
var promptPartFileSchema =
|
|
2197
|
-
var promptEntrySchema =
|
|
2198
|
-
var pendingPromptProposalSchema =
|
|
2199
|
-
proposalID:
|
|
2200
|
-
promptID:
|
|
2201
|
-
proposalHash:
|
|
2202
|
-
baseHash:
|
|
2216
|
+
isConflict: z51.boolean(),
|
|
2217
|
+
pullRequestURL: z51.url().nullable(),
|
|
2218
|
+
approvedAt: z51.date()
|
|
2219
|
+
});
|
|
2220
|
+
var promptPartFileSchema = z51.object({ path: z51.string(), text: z51.string() });
|
|
2221
|
+
var promptEntrySchema = z51.record(z51.string(), z51.string());
|
|
2222
|
+
var pendingPromptProposalSchema = z51.object({
|
|
2223
|
+
proposalID: z51.string(),
|
|
2224
|
+
promptID: z51.string(),
|
|
2225
|
+
proposalHash: z51.string(),
|
|
2226
|
+
baseHash: z51.string().nullable(),
|
|
2203
2227
|
entry: promptEntrySchema,
|
|
2204
|
-
files:
|
|
2205
|
-
reason:
|
|
2206
|
-
inForce:
|
|
2207
|
-
thread:
|
|
2208
|
-
provenance:
|
|
2209
|
-
createdAt:
|
|
2210
|
-
lapseAt:
|
|
2211
|
-
isStale:
|
|
2212
|
-
});
|
|
2213
|
-
var promptAnswerSchema =
|
|
2214
|
-
proposalID:
|
|
2215
|
-
proposalHash:
|
|
2228
|
+
files: z51.array(promptPartFileSchema),
|
|
2229
|
+
reason: z51.string(),
|
|
2230
|
+
inForce: z51.object({ parts: promptEntrySchema, template: z51.string().nullable() }).nullable(),
|
|
2231
|
+
thread: z51.string().nullable(),
|
|
2232
|
+
provenance: z51.object({ runID: z51.string(), callID: z51.string(), profile: z51.string() }),
|
|
2233
|
+
createdAt: z51.date(),
|
|
2234
|
+
lapseAt: z51.date(),
|
|
2235
|
+
isStale: z51.boolean()
|
|
2236
|
+
});
|
|
2237
|
+
var promptAnswerSchema = z51.strictObject({
|
|
2238
|
+
proposalID: z51.string().min(1),
|
|
2239
|
+
proposalHash: z51.string().min(1)
|
|
2216
2240
|
});
|
|
2217
2241
|
var prompts = oc8.errors({
|
|
2218
2242
|
NOT_FOUND: { message: "nothing has that ID", status: 404 },
|
|
@@ -2221,49 +2245,49 @@ var prompts = oc8.errors({
|
|
|
2221
2245
|
STALE_BASE: { message: "the override in force moved past the proposal", status: 409 },
|
|
2222
2246
|
PROMPT_CHECK: { message: "the override fails the definitions checks", status: 400 }
|
|
2223
2247
|
});
|
|
2224
|
-
var ruleVersionSchema =
|
|
2225
|
-
var ruleInForceSchema =
|
|
2226
|
-
ruleID:
|
|
2227
|
-
revision:
|
|
2228
|
-
ruleHash:
|
|
2229
|
-
sentence:
|
|
2230
|
-
origin:
|
|
2231
|
-
changeID:
|
|
2232
|
-
lastFiredAt:
|
|
2233
|
-
});
|
|
2234
|
-
var ruleConflictSchema =
|
|
2235
|
-
ruleID:
|
|
2236
|
-
changeID:
|
|
2248
|
+
var ruleVersionSchema = z51.object({ ruleHash: z51.string(), sentence: z51.string() }).nullable();
|
|
2249
|
+
var ruleInForceSchema = z51.object({
|
|
2250
|
+
ruleID: z51.string(),
|
|
2251
|
+
revision: z51.int().positive(),
|
|
2252
|
+
ruleHash: z51.string(),
|
|
2253
|
+
sentence: z51.string(),
|
|
2254
|
+
origin: z51.enum(["definitions", "nixie"]),
|
|
2255
|
+
changeID: z51.string().nullable(),
|
|
2256
|
+
lastFiredAt: z51.date().nullable()
|
|
2257
|
+
});
|
|
2258
|
+
var ruleConflictSchema = z51.object({
|
|
2259
|
+
ruleID: z51.string(),
|
|
2260
|
+
changeID: z51.string(),
|
|
2237
2261
|
nixie: ruleVersionSchema,
|
|
2238
2262
|
repo: ruleVersionSchema,
|
|
2239
2263
|
base: ruleVersionSchema,
|
|
2240
|
-
changedBy:
|
|
2241
|
-
reason:
|
|
2242
|
-
changedAt:
|
|
2264
|
+
changedBy: z51.enum(["owner", "nixie"]),
|
|
2265
|
+
reason: z51.string(),
|
|
2266
|
+
changedAt: z51.date()
|
|
2243
2267
|
});
|
|
2244
|
-
var ruleProposalChangeSchema =
|
|
2245
|
-
ruleID:
|
|
2268
|
+
var ruleProposalChangeSchema = z51.object({
|
|
2269
|
+
ruleID: z51.string(),
|
|
2246
2270
|
before: ruleVersionSchema,
|
|
2247
2271
|
after: ruleVersionSchema
|
|
2248
2272
|
});
|
|
2249
|
-
var effectChangeSchema =
|
|
2250
|
-
tool:
|
|
2251
|
-
remove:
|
|
2252
|
-
sentence:
|
|
2273
|
+
var effectChangeSchema = z51.object({
|
|
2274
|
+
tool: z51.string(),
|
|
2275
|
+
remove: z51.array(z51.string()),
|
|
2276
|
+
sentence: z51.string()
|
|
2253
2277
|
});
|
|
2254
|
-
var pendingRuleProposalSchema =
|
|
2255
|
-
proposalID:
|
|
2256
|
-
changes:
|
|
2257
|
-
effectChanges:
|
|
2258
|
-
createdAt:
|
|
2259
|
-
lapseAt:
|
|
2278
|
+
var pendingRuleProposalSchema = z51.object({
|
|
2279
|
+
proposalID: z51.string(),
|
|
2280
|
+
changes: z51.array(ruleProposalChangeSchema),
|
|
2281
|
+
effectChanges: z51.array(effectChangeSchema),
|
|
2282
|
+
createdAt: z51.date(),
|
|
2283
|
+
lapseAt: z51.date()
|
|
2260
2284
|
});
|
|
2261
|
-
var ruleProposalAnswerSchema =
|
|
2285
|
+
var ruleProposalAnswerSchema = z51.strictObject({ proposalID: z51.string().min(1) });
|
|
2262
2286
|
var ruleProposalRejectionSchema = ruleProposalAnswerSchema.extend({
|
|
2263
|
-
reason:
|
|
2287
|
+
reason: z51.string().max(500).regex(/\S/u)
|
|
2264
2288
|
});
|
|
2265
2289
|
var actionRejectionSchema = ruleProposalAnswerSchema.extend({
|
|
2266
|
-
reason:
|
|
2290
|
+
reason: z51.string().max(500).regex(/\S/u).optional()
|
|
2267
2291
|
});
|
|
2268
2292
|
var ruleProposalErrors = {
|
|
2269
2293
|
NOT_FOUND: { message: "nothing has that ID", status: 404 },
|
|
@@ -2277,7 +2301,7 @@ var definitions = oc8.errors({
|
|
|
2277
2301
|
var contacts = oc8.errors({
|
|
2278
2302
|
NOT_FOUND: { message: "no known contact has that ID", status: 404 }
|
|
2279
2303
|
});
|
|
2280
|
-
var hostTaskStateSchema =
|
|
2304
|
+
var hostTaskStateSchema = z51.enum([
|
|
2281
2305
|
"ready",
|
|
2282
2306
|
"running",
|
|
2283
2307
|
"waiting",
|
|
@@ -2298,39 +2322,39 @@ var taskControl2 = oc8.errors({
|
|
|
2298
2322
|
message: "the runner of the task does not take this control",
|
|
2299
2323
|
status: 409
|
|
2300
2324
|
}
|
|
2301
|
-
}).input(
|
|
2302
|
-
taskID:
|
|
2325
|
+
}).input(z51.strictObject({ taskID: z51.string().min(1) })).output(z51.object({
|
|
2326
|
+
taskID: z51.string(),
|
|
2303
2327
|
state: hostTaskStateSchema,
|
|
2304
|
-
isPauseRequested:
|
|
2328
|
+
isPauseRequested: z51.boolean()
|
|
2305
2329
|
}));
|
|
2306
2330
|
var hostContract = {
|
|
2307
|
-
reset: oc8.output(
|
|
2308
|
-
resetAt:
|
|
2309
|
-
lastSequence:
|
|
2310
|
-
keptSessions:
|
|
2331
|
+
reset: oc8.output(z51.object({
|
|
2332
|
+
resetAt: z51.date(),
|
|
2333
|
+
lastSequence: z51.int().nonnegative(),
|
|
2334
|
+
keptSessions: z51.int().nonnegative()
|
|
2311
2335
|
})),
|
|
2312
|
-
resetConversations: oc8.output(
|
|
2313
|
-
resetAt:
|
|
2314
|
-
lastSequence:
|
|
2315
|
-
shreddedRecords:
|
|
2336
|
+
resetConversations: oc8.output(z51.object({
|
|
2337
|
+
resetAt: z51.date(),
|
|
2338
|
+
lastSequence: z51.int().nonnegative(),
|
|
2339
|
+
shreddedRecords: z51.int().nonnegative(),
|
|
2316
2340
|
backup: forgetBackupSchema
|
|
2317
2341
|
})),
|
|
2318
2342
|
nixie: {
|
|
2319
|
-
pause: oc8.output(
|
|
2320
|
-
resume: oc8.errors(spendStopErrors2).output(
|
|
2343
|
+
pause: oc8.output(z51.object({ paused: pauseStateSchema })),
|
|
2344
|
+
resume: oc8.errors(spendStopErrors2).output(z51.object({ paused: pauseStateSchema }))
|
|
2321
2345
|
},
|
|
2322
2346
|
spend: {
|
|
2323
2347
|
raise: oc8.errors({
|
|
2324
2348
|
SPEND_NOT_CONFIGURED: { message: "the config sets no spendStop", status: 409 }
|
|
2325
|
-
}).input(
|
|
2326
|
-
start:
|
|
2327
|
-
dollars:
|
|
2328
|
-
tokens:
|
|
2329
|
-
turns:
|
|
2349
|
+
}).input(z51.strictObject({ turns: z51.int().positive() })).output(z51.object({
|
|
2350
|
+
start: z51.string(),
|
|
2351
|
+
dollars: z51.number(),
|
|
2352
|
+
tokens: z51.number(),
|
|
2353
|
+
turns: z51.number()
|
|
2330
2354
|
}))
|
|
2331
2355
|
},
|
|
2332
2356
|
recovery: {
|
|
2333
|
-
read: oc8.output(
|
|
2357
|
+
read: oc8.output(z51.object({ recovery: recoverySchema }))
|
|
2334
2358
|
},
|
|
2335
2359
|
backups: hostBackupsContract,
|
|
2336
2360
|
tasks: {
|
|
@@ -2350,110 +2374,110 @@ var hostContract = {
|
|
|
2350
2374
|
TASK_NOT_FOUND: { message: "no task has that ID", status: 404 },
|
|
2351
2375
|
TASK_NOT_AT_LIMIT: { message: "the task is not paused at its limit", status: 409 },
|
|
2352
2376
|
LIMIT_NOT_RAISED: { message: "the new limits are not above the old ones", status: 409 }
|
|
2353
|
-
}).input(
|
|
2354
|
-
taskID:
|
|
2355
|
-
turns:
|
|
2356
|
-
dollars:
|
|
2377
|
+
}).input(z51.strictObject({
|
|
2378
|
+
taskID: z51.string().min(1),
|
|
2379
|
+
turns: z51.int().positive().optional(),
|
|
2380
|
+
dollars: z51.number().positive().optional()
|
|
2357
2381
|
}).refine((input) => input.turns !== undefined || input.dollars !== undefined, {
|
|
2358
2382
|
message: "a raise sets turns, dollars or both"
|
|
2359
|
-
})).output(
|
|
2360
|
-
taskID:
|
|
2383
|
+
})).output(z51.object({
|
|
2384
|
+
taskID: z51.string(),
|
|
2361
2385
|
state: hostTaskStateSchema,
|
|
2362
|
-
isPauseRequested:
|
|
2363
|
-
turns:
|
|
2364
|
-
dollars:
|
|
2386
|
+
isPauseRequested: z51.boolean(),
|
|
2387
|
+
turns: z51.int().positive(),
|
|
2388
|
+
dollars: z51.number().positive()
|
|
2365
2389
|
}))
|
|
2366
2390
|
},
|
|
2367
2391
|
sessions: {
|
|
2368
|
-
issueCode: oc8.output(
|
|
2369
|
-
list: oc8.output(
|
|
2392
|
+
issueCode: oc8.output(z51.object({ code: z51.string(), expiresAt: z51.date() })),
|
|
2393
|
+
list: oc8.output(z51.array(hostSessionSchema)),
|
|
2370
2394
|
label: oc8.errors({
|
|
2371
2395
|
SESSION_NOT_FOUND: {
|
|
2372
2396
|
message: "no device session that is still signed in has that ID",
|
|
2373
2397
|
status: 404
|
|
2374
2398
|
},
|
|
2375
2399
|
LABEL_INVALID: { message: "a label holds 1 to 100 characters besides spaces", status: 400 }
|
|
2376
|
-
}).input(
|
|
2400
|
+
}).input(z51.strictObject({ sessionID: z51.string().min(1), label: z51.string() })).output(z51.object({ sessionID: z51.string(), label: z51.string() }))
|
|
2377
2401
|
},
|
|
2378
2402
|
passkeys: hostPasskeyContract,
|
|
2379
2403
|
memory: {
|
|
2380
2404
|
proposals: {
|
|
2381
|
-
list: memory.output(
|
|
2405
|
+
list: memory.output(z51.array(pendingProposalSchema)),
|
|
2382
2406
|
approve: memory.input(proposalAnswerSchema.extend({
|
|
2383
2407
|
revisionOf: versionTargetSchema2.optional(),
|
|
2384
|
-
ignoreCloseMatch:
|
|
2408
|
+
ignoreCloseMatch: z51.boolean().optional(),
|
|
2385
2409
|
editedText: itemTextSchema.optional()
|
|
2386
2410
|
})).output(approvalResultSchema),
|
|
2387
|
-
reject: memory.input(proposalAnswerSchema.extend({ reason:
|
|
2411
|
+
reject: memory.input(proposalAnswerSchema.extend({ reason: z51.string().max(500).regex(/\S/u).optional() })).output(z51.object({ proposalID: z51.string() }))
|
|
2388
2412
|
},
|
|
2389
|
-
subjects: memory.output(
|
|
2413
|
+
subjects: memory.output(z51.object({ items: subjectCountSchema, proposals: subjectCountSchema })),
|
|
2390
2414
|
items: {
|
|
2391
|
-
read: memory.input(
|
|
2415
|
+
read: memory.input(z51.strictObject({ itemID: z51.string().min(1) })).output(itemHistorySchema),
|
|
2392
2416
|
edit: memory.input(versionTargetSchema2.extend({ text: itemTextSchema })).output(versionRefSchema2),
|
|
2393
2417
|
retire: memory.input(versionTargetSchema2).output(versionRefSchema2),
|
|
2394
2418
|
restore: memory.input(versionTargetSchema2).output(versionRefSchema2),
|
|
2395
|
-
forget: memory.input(versionTargetSchema2).output(
|
|
2419
|
+
forget: memory.input(versionTargetSchema2).output(z51.object({ itemID: z51.string(), backup: forgetBackupSchema })),
|
|
2396
2420
|
forgetAll: memory.output(forgottenItemsSchema),
|
|
2397
|
-
pin: memory.input(
|
|
2421
|
+
pin: memory.input(z51.strictObject({ itemID: z51.string().min(1), isPinned: z51.boolean() })).output(z51.object({ itemID: z51.string(), isPinned: z51.boolean() }))
|
|
2398
2422
|
}
|
|
2399
2423
|
},
|
|
2400
2424
|
skills: {
|
|
2401
2425
|
proposals: {
|
|
2402
|
-
list: skills.output(
|
|
2403
|
-
approve: skills.input(skillAnswerSchema.extend({ files:
|
|
2404
|
-
reject: skills.input(skillAnswerSchema.extend({ reason:
|
|
2426
|
+
list: skills.output(z51.array(pendingSkillProposalSchema)),
|
|
2427
|
+
approve: skills.input(skillAnswerSchema.extend({ files: z51.array(skillFileSchema).min(1).optional() })).output(z51.object({ proposalID: z51.string(), approvalID: z51.string(), skillHash: z51.string() })),
|
|
2428
|
+
reject: skills.input(skillAnswerSchema.extend({ reason: z51.string().max(500).regex(/\S/u) })).output(z51.object({ proposalID: z51.string() }))
|
|
2405
2429
|
},
|
|
2406
2430
|
written: {
|
|
2407
|
-
list: skills.output(
|
|
2408
|
-
resolve: skills.input(
|
|
2409
|
-
approvalID:
|
|
2410
|
-
keep:
|
|
2411
|
-
})).output(
|
|
2431
|
+
list: skills.output(z51.array(writtenSkillSchema)),
|
|
2432
|
+
resolve: skills.input(z51.strictObject({
|
|
2433
|
+
approvalID: z51.string().min(1),
|
|
2434
|
+
keep: z51.enum(["nixie", "definitions"])
|
|
2435
|
+
})).output(z51.object({ approvalID: z51.string(), keep: z51.enum(["nixie", "definitions"]) }))
|
|
2412
2436
|
}
|
|
2413
2437
|
},
|
|
2414
2438
|
rules: {
|
|
2415
|
-
list: rules.output(
|
|
2416
|
-
conflicts: rules.output(
|
|
2417
|
-
resolve: rules.input(
|
|
2439
|
+
list: rules.output(z51.array(ruleInForceSchema)),
|
|
2440
|
+
conflicts: rules.output(z51.array(ruleConflictSchema)),
|
|
2441
|
+
resolve: rules.input(z51.strictObject({ ruleID: z51.string().min(1), keep: z51.enum(["nixie", "repo"]) })).output(z51.object({ ruleID: z51.string(), changeID: z51.string(), keep: z51.enum(["nixie", "repo"]) })),
|
|
2418
2442
|
proposals: {
|
|
2419
|
-
list: rules.output(
|
|
2420
|
-
approve: rules.input(ruleProposalAnswerSchema).output(
|
|
2421
|
-
reject: rules.input(ruleProposalRejectionSchema).output(
|
|
2443
|
+
list: rules.output(z51.array(pendingRuleProposalSchema)),
|
|
2444
|
+
approve: rules.input(ruleProposalAnswerSchema).output(z51.object({ proposalID: z51.string() })),
|
|
2445
|
+
reject: rules.input(ruleProposalRejectionSchema).output(z51.object({ proposalID: z51.string() }))
|
|
2422
2446
|
}
|
|
2423
2447
|
},
|
|
2424
2448
|
definitions: {
|
|
2425
|
-
resolve: definitions.input(
|
|
2426
|
-
definitionID:
|
|
2427
|
-
changeID:
|
|
2428
|
-
keep:
|
|
2449
|
+
resolve: definitions.input(z51.strictObject({ definitionID: z51.string().min(1), keep: z51.enum(["nixie", "repo"]) })).output(z51.object({
|
|
2450
|
+
definitionID: z51.string(),
|
|
2451
|
+
changeID: z51.string(),
|
|
2452
|
+
keep: z51.enum(["nixie", "repo"])
|
|
2429
2453
|
}))
|
|
2430
2454
|
},
|
|
2431
2455
|
actions: {
|
|
2432
2456
|
proposals: {
|
|
2433
|
-
list: rules.output(
|
|
2434
|
-
approve: rules.input(ruleProposalAnswerSchema).output(
|
|
2435
|
-
reject: rules.input(actionRejectionSchema).output(
|
|
2457
|
+
list: rules.output(z51.array(actionProposalSchema)),
|
|
2458
|
+
approve: rules.input(ruleProposalAnswerSchema).output(z51.object({ proposalID: z51.string() })),
|
|
2459
|
+
reject: rules.input(actionRejectionSchema).output(z51.object({ proposalID: z51.string() }))
|
|
2436
2460
|
}
|
|
2437
2461
|
},
|
|
2438
2462
|
mandates: hostMandatesContract,
|
|
2439
2463
|
budgets: hostBudgetsContract,
|
|
2440
2464
|
contacts: {
|
|
2441
|
-
list: contacts.output(
|
|
2442
|
-
markKnown: contacts.input(
|
|
2443
|
-
destination:
|
|
2444
|
-
name:
|
|
2445
|
-
})).output(
|
|
2446
|
-
unmark: contacts.input(
|
|
2465
|
+
list: contacts.output(z51.array(knownContactSchema)),
|
|
2466
|
+
markKnown: contacts.input(z51.strictObject({
|
|
2467
|
+
destination: z51.string().min(1).max(500),
|
|
2468
|
+
name: z51.string().min(1).max(200).optional()
|
|
2469
|
+
})).output(z51.object({ contact: knownContactSchema, isNew: z51.boolean() })),
|
|
2470
|
+
unmark: contacts.input(z51.strictObject({ contactID: z51.string().min(1) })).output(z51.object({ contactID: z51.string() }))
|
|
2447
2471
|
},
|
|
2448
2472
|
turnInputs: turnInputsContract,
|
|
2449
2473
|
prompts: {
|
|
2450
2474
|
proposals: {
|
|
2451
|
-
list: prompts.output(
|
|
2475
|
+
list: prompts.output(z51.array(pendingPromptProposalSchema)),
|
|
2452
2476
|
approve: prompts.input(promptAnswerSchema.extend({
|
|
2453
2477
|
entry: promptEntrySchema.optional(),
|
|
2454
|
-
files:
|
|
2455
|
-
})).output(
|
|
2456
|
-
reject: prompts.input(promptAnswerSchema.extend({ reason:
|
|
2478
|
+
files: z51.array(promptPartFileSchema).optional()
|
|
2479
|
+
})).output(z51.object({ proposalID: z51.string(), approvalID: z51.string(), proposalHash: z51.string() })),
|
|
2480
|
+
reject: prompts.input(promptAnswerSchema.extend({ reason: z51.string().max(500).regex(/\S/u) })).output(z51.object({ proposalID: z51.string() }))
|
|
2457
2481
|
}
|
|
2458
2482
|
}
|
|
2459
2483
|
};
|
|
@@ -2562,25 +2586,25 @@ function renderSessionCookie(token) {
|
|
|
2562
2586
|
return `${sessionCookieName}=${token ?? ""}; Path=/; HttpOnly; Secure; SameSite=Lax; Max-Age=${maxAgeS}`;
|
|
2563
2587
|
}
|
|
2564
2588
|
// src/file/file-send-input-schema.ts
|
|
2565
|
-
import { z as
|
|
2566
|
-
var fileSendInputSchema =
|
|
2567
|
-
file:
|
|
2568
|
-
caption:
|
|
2589
|
+
import { z as z52 } from "zod";
|
|
2590
|
+
var fileSendInputSchema = z52.object({
|
|
2591
|
+
file: z52.string().min(1).max(100),
|
|
2592
|
+
caption: z52.string().min(1).max(1000).optional()
|
|
2569
2593
|
});
|
|
2570
2594
|
// src/file/file-send-result-schema.ts
|
|
2571
|
-
import { z as
|
|
2572
|
-
var fileSendResultSchema =
|
|
2573
|
-
file:
|
|
2574
|
-
name:
|
|
2575
|
-
bytes:
|
|
2576
|
-
mediaType:
|
|
2595
|
+
import { z as z53 } from "zod";
|
|
2596
|
+
var fileSendResultSchema = z53.object({
|
|
2597
|
+
file: z53.string(),
|
|
2598
|
+
name: z53.string(),
|
|
2599
|
+
bytes: z53.int().nonnegative(),
|
|
2600
|
+
mediaType: z53.string()
|
|
2577
2601
|
});
|
|
2578
2602
|
// src/message/task-message-input-schema.ts
|
|
2579
|
-
import { z as
|
|
2603
|
+
import { z as z55 } from "zod";
|
|
2580
2604
|
|
|
2581
2605
|
// src/message/task-message-kind-schema.ts
|
|
2582
|
-
import { z as
|
|
2583
|
-
var taskMessageKindSchema =
|
|
2606
|
+
import { z as z54 } from "zod";
|
|
2607
|
+
var taskMessageKindSchema = z54.enum([
|
|
2584
2608
|
"progress",
|
|
2585
2609
|
"question",
|
|
2586
2610
|
"request",
|
|
@@ -2590,21 +2614,21 @@ var taskMessageKindSchema = z53.enum([
|
|
|
2590
2614
|
]);
|
|
2591
2615
|
|
|
2592
2616
|
// src/message/task-message-input-schema.ts
|
|
2593
|
-
var taskMessageInputSchema =
|
|
2594
|
-
to:
|
|
2617
|
+
var taskMessageInputSchema = z55.object({
|
|
2618
|
+
to: z55.string(),
|
|
2595
2619
|
kind: taskMessageKindSchema,
|
|
2596
|
-
body:
|
|
2597
|
-
replyTo:
|
|
2598
|
-
onBehalfOf:
|
|
2599
|
-
wake:
|
|
2620
|
+
body: z55.string(),
|
|
2621
|
+
replyTo: z55.string().optional(),
|
|
2622
|
+
onBehalfOf: z55.string().array().optional(),
|
|
2623
|
+
wake: z55.boolean().optional()
|
|
2600
2624
|
});
|
|
2601
2625
|
// src/message/task-message-result-schema.ts
|
|
2602
|
-
import { z as
|
|
2603
|
-
var taskMessageResultSchema =
|
|
2604
|
-
messageID:
|
|
2605
|
-
woke:
|
|
2606
|
-
hop:
|
|
2607
|
-
note:
|
|
2626
|
+
import { z as z56 } from "zod";
|
|
2627
|
+
var taskMessageResultSchema = z56.object({
|
|
2628
|
+
messageID: z56.string(),
|
|
2629
|
+
woke: z56.boolean(),
|
|
2630
|
+
hop: z56.int().nonnegative(),
|
|
2631
|
+
note: z56.string().optional()
|
|
2608
2632
|
});
|
|
2609
2633
|
export {
|
|
2610
2634
|
buildPendingInput,
|