@heynixie/contract 0.81.0 → 0.83.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/contract/build-query-utils.d.ts +49 -0
- package/dist/contract/contract.d.ts +47 -0
- package/dist/file/code-file-schema.d.ts +15 -0
- package/dist/file/file-send-input-schema.d.ts +5 -0
- package/dist/file/file-send-result-schema.d.ts +7 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1225 -1179
- 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,31 +1766,44 @@ 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
|
},
|
|
1792
|
+
files: {
|
|
1793
|
+
read: signedIn.errors({
|
|
1794
|
+
FILE_NOT_FOUND: { message: "No code-run file has this ID", status: 404 },
|
|
1795
|
+
FILE_FORGOTTEN: { message: "A forget made this file unreadable", status: 410 }
|
|
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
|
+
}))
|
|
1804
|
+
},
|
|
1775
1805
|
nixie: {
|
|
1776
|
-
read: signedIn.output(
|
|
1806
|
+
read: signedIn.output(z40.object({ paused: pauseStateSchema })),
|
|
1777
1807
|
pause: nixieControl,
|
|
1778
1808
|
resume: nixieControl.errors(spendStopErrors)
|
|
1779
1809
|
},
|
|
@@ -1782,10 +1812,10 @@ var contract = {
|
|
|
1782
1812
|
raise: signedIn.input(spendRaiseInputSchema).output(spendRaiseOutputSchema)
|
|
1783
1813
|
},
|
|
1784
1814
|
recovery: {
|
|
1785
|
-
read: signedIn.output(
|
|
1815
|
+
read: signedIn.output(z40.object({ recovery: recoverySchema }))
|
|
1786
1816
|
},
|
|
1787
1817
|
backups: {
|
|
1788
|
-
readNotice: signedIn.output(
|
|
1818
|
+
readNotice: signedIn.output(z40.object({ notice: backupNoticeSchema.nullable() }))
|
|
1789
1819
|
},
|
|
1790
1820
|
triggers: viewContract.triggers,
|
|
1791
1821
|
reminders: remindersContract,
|
|
@@ -1806,28 +1836,28 @@ var contract = {
|
|
|
1806
1836
|
message: "The enrolment code is unknown, used or lapsed",
|
|
1807
1837
|
status: 400
|
|
1808
1838
|
}
|
|
1809
|
-
}).input(
|
|
1839
|
+
}).input(z40.object({
|
|
1810
1840
|
clientActionID: clientActionIDSchema2,
|
|
1811
|
-
code:
|
|
1812
|
-
deviceName:
|
|
1813
|
-
tokenDelivery:
|
|
1814
|
-
})).output(
|
|
1815
|
-
issueCode: checkedAction.input(
|
|
1816
|
-
list: signedIn.output(
|
|
1817
|
-
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() }))
|
|
1818
1848
|
}
|
|
1819
1849
|
};
|
|
1820
1850
|
// src/contract/host-contract.ts
|
|
1821
1851
|
import { oc as oc8 } from "@orpc/contract";
|
|
1822
|
-
import { z as
|
|
1852
|
+
import { z as z51 } from "zod";
|
|
1823
1853
|
|
|
1824
1854
|
// src/contract/action-proposal-schema.ts
|
|
1825
|
-
import { z as
|
|
1826
|
-
var actionProposalSchema =
|
|
1827
|
-
proposalID:
|
|
1828
|
-
tool:
|
|
1829
|
-
effects:
|
|
1830
|
-
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([
|
|
1831
1861
|
"outside_steering",
|
|
1832
1862
|
"always_ask",
|
|
1833
1863
|
"ask_rule",
|
|
@@ -1835,22 +1865,22 @@ var actionProposalSchema = z40.object({
|
|
|
1835
1865
|
"direct_request",
|
|
1836
1866
|
"repeat"
|
|
1837
1867
|
]),
|
|
1838
|
-
sentence:
|
|
1839
|
-
destinations:
|
|
1840
|
-
createdAt:
|
|
1841
|
-
lapseAt:
|
|
1868
|
+
sentence: z41.string(),
|
|
1869
|
+
destinations: z41.array(z41.string()),
|
|
1870
|
+
createdAt: z41.date(),
|
|
1871
|
+
lapseAt: z41.date()
|
|
1842
1872
|
});
|
|
1843
1873
|
|
|
1844
1874
|
// src/contract/forgotten-items-schema.ts
|
|
1845
|
-
import { z as
|
|
1846
|
-
var forgottenItemsSchema =
|
|
1847
|
-
itemIDs:
|
|
1875
|
+
import { z as z42 } from "zod";
|
|
1876
|
+
var forgottenItemsSchema = z42.object({
|
|
1877
|
+
itemIDs: z42.array(z42.string()),
|
|
1848
1878
|
backup: forgetBackupSchema
|
|
1849
1879
|
});
|
|
1850
1880
|
|
|
1851
1881
|
// src/contract/host-backups-contract.ts
|
|
1852
1882
|
import { oc as oc3 } from "@orpc/contract";
|
|
1853
|
-
import { z as
|
|
1883
|
+
import { z as z43 } from "zod";
|
|
1854
1884
|
var hostBackupsContract = {
|
|
1855
1885
|
stage: oc3.errors({
|
|
1856
1886
|
BACKUP_SET_WAITING: {
|
|
@@ -1869,107 +1899,107 @@ var hostBackupsContract = {
|
|
|
1869
1899
|
message: "nixie is paused after a restore and stages no backup set until you read `nixie recovery` and run `nixie resume`",
|
|
1870
1900
|
status: 409
|
|
1871
1901
|
}
|
|
1872
|
-
}).output(
|
|
1873
|
-
sequence:
|
|
1874
|
-
kind:
|
|
1875
|
-
stagedAt:
|
|
1902
|
+
}).output(z43.object({
|
|
1903
|
+
sequence: z43.int().positive(),
|
|
1904
|
+
kind: z43.enum(["scheduled", "forget"]),
|
|
1905
|
+
stagedAt: z43.date()
|
|
1876
1906
|
}))
|
|
1877
1907
|
};
|
|
1878
1908
|
|
|
1879
1909
|
// src/contract/host-budgets-contract.ts
|
|
1880
1910
|
import { oc as oc4 } from "@orpc/contract";
|
|
1881
|
-
import { z as
|
|
1911
|
+
import { z as z44 } from "zod";
|
|
1882
1912
|
var budgets = oc4.errors({
|
|
1883
1913
|
BUDGETS_NOT_CONFIGURED: { message: "the server holds no budgets", status: 409 }
|
|
1884
1914
|
});
|
|
1885
|
-
var budgetStatusSchema =
|
|
1886
|
-
budgetID:
|
|
1887
|
-
counts:
|
|
1888
|
-
limitMicros:
|
|
1889
|
-
period:
|
|
1890
|
-
spentMicros:
|
|
1891
|
-
resetsAt:
|
|
1892
|
-
source:
|
|
1893
|
-
});
|
|
1894
|
-
var budgetChargeSchema =
|
|
1895
|
-
chargeID:
|
|
1896
|
-
amountMicros:
|
|
1897
|
-
for:
|
|
1898
|
-
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()
|
|
1899
1929
|
});
|
|
1900
1930
|
var hostBudgetsContract = {
|
|
1901
|
-
list: budgets.output(
|
|
1902
|
-
ledger: budgets.errors({ NOT_FOUND: { message: "no budget has that ID", status: 404 } }).input(
|
|
1903
|
-
budgetID:
|
|
1904
|
-
periodStart:
|
|
1905
|
-
resetsAt:
|
|
1906
|
-
spentMicros:
|
|
1907
|
-
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)
|
|
1908
1938
|
}))
|
|
1909
1939
|
};
|
|
1910
1940
|
|
|
1911
1941
|
// src/contract/host-mandates-contract.ts
|
|
1912
1942
|
import { oc as oc5 } from "@orpc/contract";
|
|
1913
|
-
import { z as
|
|
1943
|
+
import { z as z45 } from "zod";
|
|
1914
1944
|
var mandates = oc5.errors({
|
|
1915
1945
|
NOT_FOUND: { message: "no mandate has that ID", status: 404 }
|
|
1916
1946
|
});
|
|
1917
|
-
var hostMandateRuleSchema =
|
|
1918
|
-
var hostMandateSchema =
|
|
1919
|
-
mandateID:
|
|
1920
|
-
title:
|
|
1921
|
-
rules:
|
|
1922
|
-
startedAt:
|
|
1923
|
-
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()
|
|
1924
1954
|
});
|
|
1925
1955
|
var hostMandatesContract = {
|
|
1926
|
-
list: mandates.output(
|
|
1927
|
-
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"]) }))
|
|
1928
1958
|
};
|
|
1929
1959
|
|
|
1930
1960
|
// src/contract/host-passkey-contract.ts
|
|
1931
1961
|
import { oc as oc6 } from "@orpc/contract";
|
|
1932
|
-
import { z as
|
|
1933
|
-
var hostPasskeySchema =
|
|
1934
|
-
passkeyID:
|
|
1935
|
-
label:
|
|
1936
|
-
synced:
|
|
1937
|
-
origin:
|
|
1938
|
-
registeredBy:
|
|
1939
|
-
authorizedBy:
|
|
1940
|
-
registeredAt:
|
|
1941
|
-
lastUsedAt:
|
|
1942
|
-
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()
|
|
1943
1973
|
});
|
|
1944
1974
|
var hostPasskeyContract = {
|
|
1945
|
-
issueCode: oc6.output(
|
|
1946
|
-
list: oc6.output(
|
|
1975
|
+
issueCode: oc6.output(z46.object({ code: z46.string(), expiresAt: z46.date() })),
|
|
1976
|
+
list: oc6.output(z46.array(hostPasskeySchema)),
|
|
1947
1977
|
revoke: oc6.errors({
|
|
1948
1978
|
PASSKEY_NOT_FOUND: { message: "no passkey has that ID", status: 404 }
|
|
1949
|
-
}).input(
|
|
1979
|
+
}).input(z46.strictObject({ passkeyID: z46.string().min(1) })).output(z46.object({ passkeyID: z46.string(), revokedAt: z46.date() }))
|
|
1950
1980
|
};
|
|
1951
1981
|
|
|
1952
1982
|
// src/contract/known-contact-schema.ts
|
|
1953
|
-
import { z as
|
|
1954
|
-
var knownContactSchema =
|
|
1955
|
-
contactID:
|
|
1956
|
-
name:
|
|
1957
|
-
destination:
|
|
1958
|
-
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()
|
|
1959
1989
|
});
|
|
1960
1990
|
|
|
1961
1991
|
// src/contract/turn-inputs-contract.ts
|
|
1962
1992
|
import { oc as oc7 } from "@orpc/contract";
|
|
1963
|
-
import { z as
|
|
1993
|
+
import { z as z50 } from "zod";
|
|
1964
1994
|
|
|
1965
1995
|
// src/contract/input-miss-schema.ts
|
|
1966
|
-
import { z as
|
|
1967
|
-
var inputMissSchema =
|
|
1968
|
-
missID:
|
|
1969
|
-
captureID:
|
|
1970
|
-
taskID:
|
|
1971
|
-
stepRunID:
|
|
1972
|
-
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([
|
|
1973
2003
|
"queue_full",
|
|
1974
2004
|
"spool_full",
|
|
1975
2005
|
"spool_write_failed",
|
|
@@ -1981,45 +2011,45 @@ var inputMissSchema = z47.object({
|
|
|
1981
2011
|
"intake_failed",
|
|
1982
2012
|
"holds_own_value"
|
|
1983
2013
|
]),
|
|
1984
|
-
count:
|
|
1985
|
-
writer:
|
|
1986
|
-
counter:
|
|
1987
|
-
createdAt:
|
|
2014
|
+
count: z48.int().positive(),
|
|
2015
|
+
writer: z48.string().nullable(),
|
|
2016
|
+
counter: z48.int().nullable(),
|
|
2017
|
+
createdAt: z48.date()
|
|
1988
2018
|
});
|
|
1989
2019
|
|
|
1990
2020
|
// src/contract/logged-input-schema.ts
|
|
1991
|
-
import { z as
|
|
1992
|
-
var loggedInputSchema =
|
|
1993
|
-
inputID:
|
|
1994
|
-
captureID:
|
|
1995
|
-
taskID:
|
|
1996
|
-
stepRunID:
|
|
1997
|
-
writer:
|
|
1998
|
-
counter:
|
|
1999
|
-
role:
|
|
2000
|
-
profile:
|
|
2001
|
-
model:
|
|
2002
|
-
harness:
|
|
2003
|
-
api:
|
|
2004
|
-
endpoint:
|
|
2005
|
-
route:
|
|
2006
|
-
isRewritten:
|
|
2007
|
-
upstreamStatus:
|
|
2008
|
-
bytes:
|
|
2009
|
-
intakeSequence:
|
|
2010
|
-
receivedAt:
|
|
2011
|
-
takenAt:
|
|
2012
|
-
state:
|
|
2013
|
-
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()
|
|
2014
2044
|
});
|
|
2015
2045
|
|
|
2016
2046
|
// src/contract/turn-inputs-contract.ts
|
|
2017
|
-
var turnInputOn =
|
|
2018
|
-
state:
|
|
2019
|
-
forMs:
|
|
2047
|
+
var turnInputOn = z50.strictObject({
|
|
2048
|
+
state: z50.literal("on"),
|
|
2049
|
+
forMs: z50.int().positive().nullable()
|
|
2020
2050
|
});
|
|
2021
|
-
var turnInputOff =
|
|
2022
|
-
var turnInputSetSchema =
|
|
2051
|
+
var turnInputOff = z50.strictObject({ state: z50.literal("off"), drop: z50.boolean() });
|
|
2052
|
+
var turnInputSetSchema = z50.discriminatedUnion("state", [turnInputOn, turnInputOff]);
|
|
2023
2053
|
var turnInputs = oc7.errors({
|
|
2024
2054
|
NOT_FOUND: { message: "no logged request has that ID", status: 404 },
|
|
2025
2055
|
REMOVED: { message: "that request is removed or its body is missing", status: 410 },
|
|
@@ -2029,27 +2059,27 @@ var turnInputs = oc7.errors({
|
|
|
2029
2059
|
},
|
|
2030
2060
|
NOT_CONFIGURED: { message: "the turn-input log is not configured", status: 409 }
|
|
2031
2061
|
});
|
|
2032
|
-
var listedInputsSchema =
|
|
2033
|
-
inputs:
|
|
2034
|
-
misses:
|
|
2062
|
+
var listedInputsSchema = z50.object({
|
|
2063
|
+
inputs: z50.array(loggedInputSchema),
|
|
2064
|
+
misses: z50.array(inputMissSchema)
|
|
2035
2065
|
});
|
|
2036
2066
|
var turnInputsContract = {
|
|
2037
|
-
list: turnInputs.input(
|
|
2038
|
-
open: turnInputs.input(
|
|
2039
|
-
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() }))
|
|
2040
2070
|
};
|
|
2041
2071
|
|
|
2042
2072
|
// src/contract/host-contract.ts
|
|
2043
|
-
var versionRefSchema2 =
|
|
2044
|
-
var versionTargetSchema2 =
|
|
2045
|
-
itemID:
|
|
2046
|
-
version:
|
|
2047
|
-
});
|
|
2048
|
-
var itemTextSchema =
|
|
2049
|
-
var proposalOriginSchema2 =
|
|
2050
|
-
var memoryOriginSchema =
|
|
2051
|
-
var contentSourceSchema =
|
|
2052
|
-
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([
|
|
2053
2083
|
"no_quote",
|
|
2054
2084
|
"quote_not_typed",
|
|
2055
2085
|
"quote_in_quoted_block",
|
|
@@ -2068,68 +2098,68 @@ var reviewReasonSchema2 = z50.enum([
|
|
|
2068
2098
|
"labels",
|
|
2069
2099
|
"ask_rule"
|
|
2070
2100
|
]);
|
|
2071
|
-
var proposalSourceSchema2 =
|
|
2101
|
+
var proposalSourceSchema2 = z51.object({
|
|
2072
2102
|
origin: proposalOriginSchema2,
|
|
2073
|
-
thread:
|
|
2074
|
-
proposedAt:
|
|
2075
|
-
});
|
|
2076
|
-
var pendingProposalSchema =
|
|
2077
|
-
proposalID:
|
|
2078
|
-
operation:
|
|
2079
|
-
itemID:
|
|
2080
|
-
targetVersion:
|
|
2081
|
-
isPinned:
|
|
2082
|
-
subject:
|
|
2083
|
-
newSubject:
|
|
2084
|
-
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"]),
|
|
2085
2115
|
reason: reviewReasonSchema2,
|
|
2086
|
-
actionHash:
|
|
2116
|
+
actionHash: z51.string(),
|
|
2087
2117
|
origin: proposalOriginSchema2,
|
|
2088
2118
|
source: contentSourceSchema,
|
|
2089
|
-
createdAt:
|
|
2090
|
-
lapseAt:
|
|
2091
|
-
sources:
|
|
2092
|
-
text:
|
|
2093
|
-
quote:
|
|
2094
|
-
});
|
|
2095
|
-
var closeMatchSchema2 =
|
|
2096
|
-
var approvalResultSchema =
|
|
2097
|
-
|
|
2098
|
-
|
|
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 })
|
|
2099
2129
|
]);
|
|
2100
|
-
var historyVersionSchema =
|
|
2101
|
-
version:
|
|
2102
|
-
change:
|
|
2103
|
-
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"]),
|
|
2104
2134
|
origin: memoryOriginSchema,
|
|
2105
2135
|
source: contentSourceSchema,
|
|
2106
|
-
recordedAt:
|
|
2107
|
-
isRemoved:
|
|
2108
|
-
isBridge:
|
|
2109
|
-
status:
|
|
2110
|
-
text:
|
|
2111
|
-
});
|
|
2112
|
-
var itemHistorySchema =
|
|
2113
|
-
itemID:
|
|
2114
|
-
subject:
|
|
2115
|
-
kind:
|
|
2116
|
-
state:
|
|
2117
|
-
versions:
|
|
2118
|
-
});
|
|
2119
|
-
var proposalAnswerSchema =
|
|
2120
|
-
proposalID:
|
|
2121
|
-
actionHash:
|
|
2122
|
-
});
|
|
2123
|
-
var hostSessionSchema =
|
|
2124
|
-
sessionID:
|
|
2125
|
-
deviceName:
|
|
2126
|
-
createdAt:
|
|
2127
|
-
lastUsedAt:
|
|
2128
|
-
});
|
|
2129
|
-
var subjectCountSchema =
|
|
2130
|
-
owner:
|
|
2131
|
-
shared:
|
|
2132
|
-
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()
|
|
2133
2163
|
});
|
|
2134
2164
|
var memory = oc8.errors({
|
|
2135
2165
|
MEMORY_NOT_STARTED: { message: "the memory store has not started yet", status: 503 },
|
|
@@ -2144,28 +2174,28 @@ var memory = oc8.errors({
|
|
|
2144
2174
|
PIN_EDIT: { message: "a pin takes no edited text", status: 400 },
|
|
2145
2175
|
SELF_NOTE_REFUSED: { message: "a self-note never takes that change", status: 409 }
|
|
2146
2176
|
});
|
|
2147
|
-
var skillFileSchema =
|
|
2148
|
-
var pendingSkillProposalSchema =
|
|
2149
|
-
proposalID:
|
|
2150
|
-
name:
|
|
2151
|
-
skillHash:
|
|
2152
|
-
baseHash:
|
|
2153
|
-
files:
|
|
2154
|
-
inForce:
|
|
2155
|
-
skillHash:
|
|
2156
|
-
origin:
|
|
2157
|
-
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)
|
|
2158
2188
|
}).nullable(),
|
|
2159
|
-
untypedToken:
|
|
2160
|
-
thread:
|
|
2161
|
-
provenance:
|
|
2162
|
-
createdAt:
|
|
2163
|
-
lapseAt:
|
|
2164
|
-
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()
|
|
2165
2195
|
});
|
|
2166
|
-
var skillAnswerSchema =
|
|
2167
|
-
proposalID:
|
|
2168
|
-
skillHash:
|
|
2196
|
+
var skillAnswerSchema = z51.strictObject({
|
|
2197
|
+
proposalID: z51.string().min(1),
|
|
2198
|
+
skillHash: z51.string().min(1)
|
|
2169
2199
|
});
|
|
2170
2200
|
var skills = oc8.errors({
|
|
2171
2201
|
NOT_FOUND: { message: "nothing has that ID", status: 404 },
|
|
@@ -2175,38 +2205,38 @@ var skills = oc8.errors({
|
|
|
2175
2205
|
SKILL_CHECK: { message: "the files fail the seed checks", status: 400 },
|
|
2176
2206
|
WRONG_STATE: { message: "the skill nixie wrote is no longer in force", status: 409 }
|
|
2177
2207
|
});
|
|
2178
|
-
var definitionsSkillSchema =
|
|
2179
|
-
var writtenSkillSchema =
|
|
2180
|
-
approvalID:
|
|
2181
|
-
proposalID:
|
|
2182
|
-
name:
|
|
2183
|
-
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(),
|
|
2184
2214
|
base: definitionsSkillSchema,
|
|
2185
2215
|
definitions: definitionsSkillSchema,
|
|
2186
|
-
isConflict:
|
|
2187
|
-
pullRequestURL:
|
|
2188
|
-
approvedAt:
|
|
2189
|
-
});
|
|
2190
|
-
var promptPartFileSchema =
|
|
2191
|
-
var promptEntrySchema =
|
|
2192
|
-
var pendingPromptProposalSchema =
|
|
2193
|
-
proposalID:
|
|
2194
|
-
promptID:
|
|
2195
|
-
proposalHash:
|
|
2196
|
-
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(),
|
|
2197
2227
|
entry: promptEntrySchema,
|
|
2198
|
-
files:
|
|
2199
|
-
reason:
|
|
2200
|
-
inForce:
|
|
2201
|
-
thread:
|
|
2202
|
-
provenance:
|
|
2203
|
-
createdAt:
|
|
2204
|
-
lapseAt:
|
|
2205
|
-
isStale:
|
|
2206
|
-
});
|
|
2207
|
-
var promptAnswerSchema =
|
|
2208
|
-
proposalID:
|
|
2209
|
-
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)
|
|
2210
2240
|
});
|
|
2211
2241
|
var prompts = oc8.errors({
|
|
2212
2242
|
NOT_FOUND: { message: "nothing has that ID", status: 404 },
|
|
@@ -2215,49 +2245,49 @@ var prompts = oc8.errors({
|
|
|
2215
2245
|
STALE_BASE: { message: "the override in force moved past the proposal", status: 409 },
|
|
2216
2246
|
PROMPT_CHECK: { message: "the override fails the definitions checks", status: 400 }
|
|
2217
2247
|
});
|
|
2218
|
-
var ruleVersionSchema =
|
|
2219
|
-
var ruleInForceSchema =
|
|
2220
|
-
ruleID:
|
|
2221
|
-
revision:
|
|
2222
|
-
ruleHash:
|
|
2223
|
-
sentence:
|
|
2224
|
-
origin:
|
|
2225
|
-
changeID:
|
|
2226
|
-
lastFiredAt:
|
|
2227
|
-
});
|
|
2228
|
-
var ruleConflictSchema =
|
|
2229
|
-
ruleID:
|
|
2230
|
-
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(),
|
|
2231
2261
|
nixie: ruleVersionSchema,
|
|
2232
2262
|
repo: ruleVersionSchema,
|
|
2233
2263
|
base: ruleVersionSchema,
|
|
2234
|
-
changedBy:
|
|
2235
|
-
reason:
|
|
2236
|
-
changedAt:
|
|
2264
|
+
changedBy: z51.enum(["owner", "nixie"]),
|
|
2265
|
+
reason: z51.string(),
|
|
2266
|
+
changedAt: z51.date()
|
|
2237
2267
|
});
|
|
2238
|
-
var ruleProposalChangeSchema =
|
|
2239
|
-
ruleID:
|
|
2268
|
+
var ruleProposalChangeSchema = z51.object({
|
|
2269
|
+
ruleID: z51.string(),
|
|
2240
2270
|
before: ruleVersionSchema,
|
|
2241
2271
|
after: ruleVersionSchema
|
|
2242
2272
|
});
|
|
2243
|
-
var effectChangeSchema =
|
|
2244
|
-
tool:
|
|
2245
|
-
remove:
|
|
2246
|
-
sentence:
|
|
2273
|
+
var effectChangeSchema = z51.object({
|
|
2274
|
+
tool: z51.string(),
|
|
2275
|
+
remove: z51.array(z51.string()),
|
|
2276
|
+
sentence: z51.string()
|
|
2247
2277
|
});
|
|
2248
|
-
var pendingRuleProposalSchema =
|
|
2249
|
-
proposalID:
|
|
2250
|
-
changes:
|
|
2251
|
-
effectChanges:
|
|
2252
|
-
createdAt:
|
|
2253
|
-
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()
|
|
2254
2284
|
});
|
|
2255
|
-
var ruleProposalAnswerSchema =
|
|
2285
|
+
var ruleProposalAnswerSchema = z51.strictObject({ proposalID: z51.string().min(1) });
|
|
2256
2286
|
var ruleProposalRejectionSchema = ruleProposalAnswerSchema.extend({
|
|
2257
|
-
reason:
|
|
2287
|
+
reason: z51.string().max(500).regex(/\S/u)
|
|
2258
2288
|
});
|
|
2259
2289
|
var actionRejectionSchema = ruleProposalAnswerSchema.extend({
|
|
2260
|
-
reason:
|
|
2290
|
+
reason: z51.string().max(500).regex(/\S/u).optional()
|
|
2261
2291
|
});
|
|
2262
2292
|
var ruleProposalErrors = {
|
|
2263
2293
|
NOT_FOUND: { message: "nothing has that ID", status: 404 },
|
|
@@ -2271,7 +2301,7 @@ var definitions = oc8.errors({
|
|
|
2271
2301
|
var contacts = oc8.errors({
|
|
2272
2302
|
NOT_FOUND: { message: "no known contact has that ID", status: 404 }
|
|
2273
2303
|
});
|
|
2274
|
-
var hostTaskStateSchema =
|
|
2304
|
+
var hostTaskStateSchema = z51.enum([
|
|
2275
2305
|
"ready",
|
|
2276
2306
|
"running",
|
|
2277
2307
|
"waiting",
|
|
@@ -2292,39 +2322,39 @@ var taskControl2 = oc8.errors({
|
|
|
2292
2322
|
message: "the runner of the task does not take this control",
|
|
2293
2323
|
status: 409
|
|
2294
2324
|
}
|
|
2295
|
-
}).input(
|
|
2296
|
-
taskID:
|
|
2325
|
+
}).input(z51.strictObject({ taskID: z51.string().min(1) })).output(z51.object({
|
|
2326
|
+
taskID: z51.string(),
|
|
2297
2327
|
state: hostTaskStateSchema,
|
|
2298
|
-
isPauseRequested:
|
|
2328
|
+
isPauseRequested: z51.boolean()
|
|
2299
2329
|
}));
|
|
2300
2330
|
var hostContract = {
|
|
2301
|
-
reset: oc8.output(
|
|
2302
|
-
resetAt:
|
|
2303
|
-
lastSequence:
|
|
2304
|
-
keptSessions:
|
|
2331
|
+
reset: oc8.output(z51.object({
|
|
2332
|
+
resetAt: z51.date(),
|
|
2333
|
+
lastSequence: z51.int().nonnegative(),
|
|
2334
|
+
keptSessions: z51.int().nonnegative()
|
|
2305
2335
|
})),
|
|
2306
|
-
resetConversations: oc8.output(
|
|
2307
|
-
resetAt:
|
|
2308
|
-
lastSequence:
|
|
2309
|
-
shreddedRecords:
|
|
2336
|
+
resetConversations: oc8.output(z51.object({
|
|
2337
|
+
resetAt: z51.date(),
|
|
2338
|
+
lastSequence: z51.int().nonnegative(),
|
|
2339
|
+
shreddedRecords: z51.int().nonnegative(),
|
|
2310
2340
|
backup: forgetBackupSchema
|
|
2311
2341
|
})),
|
|
2312
2342
|
nixie: {
|
|
2313
|
-
pause: oc8.output(
|
|
2314
|
-
resume: oc8.errors(spendStopErrors2).output(
|
|
2343
|
+
pause: oc8.output(z51.object({ paused: pauseStateSchema })),
|
|
2344
|
+
resume: oc8.errors(spendStopErrors2).output(z51.object({ paused: pauseStateSchema }))
|
|
2315
2345
|
},
|
|
2316
2346
|
spend: {
|
|
2317
2347
|
raise: oc8.errors({
|
|
2318
2348
|
SPEND_NOT_CONFIGURED: { message: "the config sets no spendStop", status: 409 }
|
|
2319
|
-
}).input(
|
|
2320
|
-
start:
|
|
2321
|
-
dollars:
|
|
2322
|
-
tokens:
|
|
2323
|
-
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()
|
|
2324
2354
|
}))
|
|
2325
2355
|
},
|
|
2326
2356
|
recovery: {
|
|
2327
|
-
read: oc8.output(
|
|
2357
|
+
read: oc8.output(z51.object({ recovery: recoverySchema }))
|
|
2328
2358
|
},
|
|
2329
2359
|
backups: hostBackupsContract,
|
|
2330
2360
|
tasks: {
|
|
@@ -2344,110 +2374,110 @@ var hostContract = {
|
|
|
2344
2374
|
TASK_NOT_FOUND: { message: "no task has that ID", status: 404 },
|
|
2345
2375
|
TASK_NOT_AT_LIMIT: { message: "the task is not paused at its limit", status: 409 },
|
|
2346
2376
|
LIMIT_NOT_RAISED: { message: "the new limits are not above the old ones", status: 409 }
|
|
2347
|
-
}).input(
|
|
2348
|
-
taskID:
|
|
2349
|
-
turns:
|
|
2350
|
-
dollars:
|
|
2377
|
+
}).input(z51.strictObject({
|
|
2378
|
+
taskID: z51.string().min(1),
|
|
2379
|
+
turns: z51.int().positive().optional(),
|
|
2380
|
+
dollars: z51.number().positive().optional()
|
|
2351
2381
|
}).refine((input) => input.turns !== undefined || input.dollars !== undefined, {
|
|
2352
2382
|
message: "a raise sets turns, dollars or both"
|
|
2353
|
-
})).output(
|
|
2354
|
-
taskID:
|
|
2383
|
+
})).output(z51.object({
|
|
2384
|
+
taskID: z51.string(),
|
|
2355
2385
|
state: hostTaskStateSchema,
|
|
2356
|
-
isPauseRequested:
|
|
2357
|
-
turns:
|
|
2358
|
-
dollars:
|
|
2386
|
+
isPauseRequested: z51.boolean(),
|
|
2387
|
+
turns: z51.int().positive(),
|
|
2388
|
+
dollars: z51.number().positive()
|
|
2359
2389
|
}))
|
|
2360
2390
|
},
|
|
2361
2391
|
sessions: {
|
|
2362
|
-
issueCode: oc8.output(
|
|
2363
|
-
list: oc8.output(
|
|
2392
|
+
issueCode: oc8.output(z51.object({ code: z51.string(), expiresAt: z51.date() })),
|
|
2393
|
+
list: oc8.output(z51.array(hostSessionSchema)),
|
|
2364
2394
|
label: oc8.errors({
|
|
2365
2395
|
SESSION_NOT_FOUND: {
|
|
2366
2396
|
message: "no device session that is still signed in has that ID",
|
|
2367
2397
|
status: 404
|
|
2368
2398
|
},
|
|
2369
2399
|
LABEL_INVALID: { message: "a label holds 1 to 100 characters besides spaces", status: 400 }
|
|
2370
|
-
}).input(
|
|
2400
|
+
}).input(z51.strictObject({ sessionID: z51.string().min(1), label: z51.string() })).output(z51.object({ sessionID: z51.string(), label: z51.string() }))
|
|
2371
2401
|
},
|
|
2372
2402
|
passkeys: hostPasskeyContract,
|
|
2373
2403
|
memory: {
|
|
2374
2404
|
proposals: {
|
|
2375
|
-
list: memory.output(
|
|
2405
|
+
list: memory.output(z51.array(pendingProposalSchema)),
|
|
2376
2406
|
approve: memory.input(proposalAnswerSchema.extend({
|
|
2377
2407
|
revisionOf: versionTargetSchema2.optional(),
|
|
2378
|
-
ignoreCloseMatch:
|
|
2408
|
+
ignoreCloseMatch: z51.boolean().optional(),
|
|
2379
2409
|
editedText: itemTextSchema.optional()
|
|
2380
2410
|
})).output(approvalResultSchema),
|
|
2381
|
-
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() }))
|
|
2382
2412
|
},
|
|
2383
|
-
subjects: memory.output(
|
|
2413
|
+
subjects: memory.output(z51.object({ items: subjectCountSchema, proposals: subjectCountSchema })),
|
|
2384
2414
|
items: {
|
|
2385
|
-
read: memory.input(
|
|
2415
|
+
read: memory.input(z51.strictObject({ itemID: z51.string().min(1) })).output(itemHistorySchema),
|
|
2386
2416
|
edit: memory.input(versionTargetSchema2.extend({ text: itemTextSchema })).output(versionRefSchema2),
|
|
2387
2417
|
retire: memory.input(versionTargetSchema2).output(versionRefSchema2),
|
|
2388
2418
|
restore: memory.input(versionTargetSchema2).output(versionRefSchema2),
|
|
2389
|
-
forget: memory.input(versionTargetSchema2).output(
|
|
2419
|
+
forget: memory.input(versionTargetSchema2).output(z51.object({ itemID: z51.string(), backup: forgetBackupSchema })),
|
|
2390
2420
|
forgetAll: memory.output(forgottenItemsSchema),
|
|
2391
|
-
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() }))
|
|
2392
2422
|
}
|
|
2393
2423
|
},
|
|
2394
2424
|
skills: {
|
|
2395
2425
|
proposals: {
|
|
2396
|
-
list: skills.output(
|
|
2397
|
-
approve: skills.input(skillAnswerSchema.extend({ files:
|
|
2398
|
-
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() }))
|
|
2399
2429
|
},
|
|
2400
2430
|
written: {
|
|
2401
|
-
list: skills.output(
|
|
2402
|
-
resolve: skills.input(
|
|
2403
|
-
approvalID:
|
|
2404
|
-
keep:
|
|
2405
|
-
})).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"]) }))
|
|
2406
2436
|
}
|
|
2407
2437
|
},
|
|
2408
2438
|
rules: {
|
|
2409
|
-
list: rules.output(
|
|
2410
|
-
conflicts: rules.output(
|
|
2411
|
-
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"]) })),
|
|
2412
2442
|
proposals: {
|
|
2413
|
-
list: rules.output(
|
|
2414
|
-
approve: rules.input(ruleProposalAnswerSchema).output(
|
|
2415
|
-
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() }))
|
|
2416
2446
|
}
|
|
2417
2447
|
},
|
|
2418
2448
|
definitions: {
|
|
2419
|
-
resolve: definitions.input(
|
|
2420
|
-
definitionID:
|
|
2421
|
-
changeID:
|
|
2422
|
-
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"])
|
|
2423
2453
|
}))
|
|
2424
2454
|
},
|
|
2425
2455
|
actions: {
|
|
2426
2456
|
proposals: {
|
|
2427
|
-
list: rules.output(
|
|
2428
|
-
approve: rules.input(ruleProposalAnswerSchema).output(
|
|
2429
|
-
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() }))
|
|
2430
2460
|
}
|
|
2431
2461
|
},
|
|
2432
2462
|
mandates: hostMandatesContract,
|
|
2433
2463
|
budgets: hostBudgetsContract,
|
|
2434
2464
|
contacts: {
|
|
2435
|
-
list: contacts.output(
|
|
2436
|
-
markKnown: contacts.input(
|
|
2437
|
-
destination:
|
|
2438
|
-
name:
|
|
2439
|
-
})).output(
|
|
2440
|
-
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() }))
|
|
2441
2471
|
},
|
|
2442
2472
|
turnInputs: turnInputsContract,
|
|
2443
2473
|
prompts: {
|
|
2444
2474
|
proposals: {
|
|
2445
|
-
list: prompts.output(
|
|
2475
|
+
list: prompts.output(z51.array(pendingPromptProposalSchema)),
|
|
2446
2476
|
approve: prompts.input(promptAnswerSchema.extend({
|
|
2447
2477
|
entry: promptEntrySchema.optional(),
|
|
2448
|
-
files:
|
|
2449
|
-
})).output(
|
|
2450
|
-
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() }))
|
|
2451
2481
|
}
|
|
2452
2482
|
}
|
|
2453
2483
|
};
|
|
@@ -2555,12 +2585,26 @@ function renderSessionCookie(token) {
|
|
|
2555
2585
|
const maxAgeS = token === null ? 0 : MAX_AGE_S;
|
|
2556
2586
|
return `${sessionCookieName}=${token ?? ""}; Path=/; HttpOnly; Secure; SameSite=Lax; Max-Age=${maxAgeS}`;
|
|
2557
2587
|
}
|
|
2558
|
-
// src/
|
|
2588
|
+
// src/file/file-send-input-schema.ts
|
|
2559
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()
|
|
2593
|
+
});
|
|
2594
|
+
// src/file/file-send-result-schema.ts
|
|
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()
|
|
2601
|
+
});
|
|
2602
|
+
// src/message/task-message-input-schema.ts
|
|
2603
|
+
import { z as z55 } from "zod";
|
|
2560
2604
|
|
|
2561
2605
|
// src/message/task-message-kind-schema.ts
|
|
2562
|
-
import { z as
|
|
2563
|
-
var taskMessageKindSchema =
|
|
2606
|
+
import { z as z54 } from "zod";
|
|
2607
|
+
var taskMessageKindSchema = z54.enum([
|
|
2564
2608
|
"progress",
|
|
2565
2609
|
"question",
|
|
2566
2610
|
"request",
|
|
@@ -2570,21 +2614,21 @@ var taskMessageKindSchema = z51.enum([
|
|
|
2570
2614
|
]);
|
|
2571
2615
|
|
|
2572
2616
|
// src/message/task-message-input-schema.ts
|
|
2573
|
-
var taskMessageInputSchema =
|
|
2574
|
-
to:
|
|
2617
|
+
var taskMessageInputSchema = z55.object({
|
|
2618
|
+
to: z55.string(),
|
|
2575
2619
|
kind: taskMessageKindSchema,
|
|
2576
|
-
body:
|
|
2577
|
-
replyTo:
|
|
2578
|
-
onBehalfOf:
|
|
2579
|
-
wake:
|
|
2620
|
+
body: z55.string(),
|
|
2621
|
+
replyTo: z55.string().optional(),
|
|
2622
|
+
onBehalfOf: z55.string().array().optional(),
|
|
2623
|
+
wake: z55.boolean().optional()
|
|
2580
2624
|
});
|
|
2581
2625
|
// src/message/task-message-result-schema.ts
|
|
2582
|
-
import { z as
|
|
2583
|
-
var taskMessageResultSchema =
|
|
2584
|
-
messageID:
|
|
2585
|
-
woke:
|
|
2586
|
-
hop:
|
|
2587
|
-
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()
|
|
2588
2632
|
});
|
|
2589
2633
|
export {
|
|
2590
2634
|
buildPendingInput,
|
|
@@ -2593,6 +2637,8 @@ export {
|
|
|
2593
2637
|
clientHeaderName,
|
|
2594
2638
|
clipRecordPayloads,
|
|
2595
2639
|
contract,
|
|
2640
|
+
fileSendInputSchema,
|
|
2641
|
+
fileSendResultSchema,
|
|
2596
2642
|
forgettableKinds,
|
|
2597
2643
|
hostContract,
|
|
2598
2644
|
imageLimits,
|