@heynixie/contract 0.72.0 → 0.73.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/approval-contract.d.ts +52 -4
- package/dist/contract/authentication-response-schema.d.ts +17 -0
- package/dist/contract/base64-url-schema.d.ts +2 -0
- package/dist/contract/build-query-utils.d.ts +366 -23
- package/dist/contract/challenge-for-schema.d.ts +18 -0
- package/dist/contract/choice-schema.d.ts +7 -0
- package/dist/contract/contract.d.ts +321 -23
- package/dist/contract/creation-options-schema.d.ts +42 -0
- package/dist/contract/credential-descriptor-schema.d.ts +6 -0
- package/dist/contract/forgettable-kinds.d.ts +1 -1
- package/dist/contract/host-contract.d.ts +28 -199
- package/dist/contract/host-passkey-contract.d.ts +29 -0
- package/dist/contract/memory-view-contract.d.ts +0 -13
- package/dist/contract/no-passkey-error.d.ts +6 -0
- package/dist/contract/passkey-contract.d.ts +270 -0
- package/dist/contract/passkey-failed-error.d.ts +18 -0
- package/dist/contract/passkey-failure-schema.d.ts +10 -0
- package/dist/contract/registration-response-schema.d.ts +19 -0
- package/dist/contract/request-options-schema.d.ts +16 -0
- package/dist/contract/transports-schema.d.ts +2 -0
- package/dist/contract/user-verification-schema.d.ts +6 -0
- package/dist/index.js +1010 -830
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -153,11 +153,11 @@ var forgettableKinds = [
|
|
|
153
153
|
"action.outcome",
|
|
154
154
|
"action.queued",
|
|
155
155
|
"action.retry_scheduled",
|
|
156
|
-
"memory.writer_failed",
|
|
157
156
|
"model.compaction_failed",
|
|
158
157
|
"model.reply",
|
|
159
158
|
"model.session_summarized",
|
|
160
159
|
"owner_message",
|
|
160
|
+
"passkey.registered",
|
|
161
161
|
"policy.action_answered",
|
|
162
162
|
"policy.action_proposed",
|
|
163
163
|
"policy.contact_marked_known",
|
|
@@ -177,7 +177,7 @@ var forgettableKinds = [
|
|
|
177
177
|
];
|
|
178
178
|
// src/contract/contract.ts
|
|
179
179
|
import { eventIterator as eventIterator2, oc as oc2 } from "@orpc/contract";
|
|
180
|
-
import { z as
|
|
180
|
+
import { z as z26 } from "zod";
|
|
181
181
|
|
|
182
182
|
// src/span/span-schema.ts
|
|
183
183
|
import { z } from "zod";
|
|
@@ -188,24 +188,51 @@ var spanSchema = z.object({
|
|
|
188
188
|
});
|
|
189
189
|
|
|
190
190
|
// src/contract/approval-contract.ts
|
|
191
|
-
import { z as
|
|
191
|
+
import { z as z11 } from "zod";
|
|
192
|
+
|
|
193
|
+
// src/contract/authentication-response-schema.ts
|
|
194
|
+
import { z as z3 } from "zod";
|
|
195
|
+
|
|
196
|
+
// src/contract/base64-url-schema.ts
|
|
197
|
+
import { z as z2 } from "zod";
|
|
198
|
+
var base64URLSchema = z2.string().min(1).max(20000);
|
|
199
|
+
|
|
200
|
+
// src/contract/authentication-response-schema.ts
|
|
201
|
+
var assertionSchema = z3.object({
|
|
202
|
+
clientDataJSON: base64URLSchema,
|
|
203
|
+
authenticatorData: base64URLSchema,
|
|
204
|
+
signature: base64URLSchema,
|
|
205
|
+
userHandle: base64URLSchema.optional()
|
|
206
|
+
});
|
|
207
|
+
var authenticationResponseSchema = z3.object({
|
|
208
|
+
id: base64URLSchema,
|
|
209
|
+
rawId: base64URLSchema,
|
|
210
|
+
response: assertionSchema,
|
|
211
|
+
authenticatorAttachment: z3.enum(["cross-platform", "platform"]).optional(),
|
|
212
|
+
clientExtensionResults: z3.object({}),
|
|
213
|
+
type: z3.literal("public-key")
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
// src/contract/choice-schema.ts
|
|
217
|
+
import { z as z4 } from "zod";
|
|
218
|
+
var choiceSchema = z4.enum(["approve", "always_allow", "defer", "decline"]);
|
|
192
219
|
|
|
193
220
|
// src/contract/memory-view-contract.ts
|
|
194
|
-
import { z as
|
|
221
|
+
import { z as z8 } from "zod";
|
|
195
222
|
|
|
196
223
|
// src/contract/forget-backup-schema.ts
|
|
197
|
-
import { z as
|
|
198
|
-
var forgetBackupSchema =
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
224
|
+
import { z as z5 } from "zod";
|
|
225
|
+
var forgetBackupSchema = z5.discriminatedUnion("state", [
|
|
226
|
+
z5.object({ state: z5.literal("off") }),
|
|
227
|
+
z5.object({ state: z5.literal("pending") }),
|
|
228
|
+
z5.object({ state: z5.literal("failed"), failure: z5.string() }),
|
|
229
|
+
z5.object({ state: z5.literal("complete") }),
|
|
230
|
+
z5.object({ state: z5.literal("unknown") })
|
|
204
231
|
]);
|
|
205
232
|
|
|
206
233
|
// src/contract/memory-export-contract.ts
|
|
207
234
|
import { eventIterator } from "@orpc/contract";
|
|
208
|
-
import { z as
|
|
235
|
+
import { z as z6 } from "zod";
|
|
209
236
|
|
|
210
237
|
// src/contract/reused-id-errors.ts
|
|
211
238
|
var reusedIDErrors = {
|
|
@@ -225,42 +252,42 @@ var signedIn = oc.errors({
|
|
|
225
252
|
var checkedExport = signedIn.errors(reusedIDErrors).errors({
|
|
226
253
|
MEMORY_NOT_STARTED: { message: "The memory store has not started yet", status: 503 }
|
|
227
254
|
});
|
|
228
|
-
var exportEvent =
|
|
229
|
-
|
|
230
|
-
|
|
255
|
+
var exportEvent = z6.union([
|
|
256
|
+
z6.object({ chunk: z6.string() }),
|
|
257
|
+
z6.object({ isComplete: z6.literal(true) })
|
|
231
258
|
]);
|
|
232
259
|
var exportEvents = eventIterator(exportEvent);
|
|
233
260
|
var memoryExportContract = {
|
|
234
|
-
export: checkedExport.input(
|
|
261
|
+
export: checkedExport.input(z6.object({ clientActionID: z6.uuid() })).output(exportEvents)
|
|
235
262
|
};
|
|
236
263
|
|
|
237
264
|
// src/contract/moment-contract.ts
|
|
238
|
-
import { z as
|
|
265
|
+
import { z as z7 } from "zod";
|
|
239
266
|
var momentView = signedIn.errors({
|
|
240
267
|
MEMORY_NOT_STARTED: { message: "The memory store has not started yet", status: 503 },
|
|
241
268
|
MOMENT_NOT_FOUND: { message: "No moment has this ID", status: 404 },
|
|
242
269
|
STALE_VERSION: { message: "The moment has moved past that version", status: 409 }
|
|
243
270
|
});
|
|
244
|
-
var momentIDSchema =
|
|
245
|
-
var momentTargetSchema =
|
|
246
|
-
var reflectionSchema =
|
|
247
|
-
model:
|
|
248
|
-
text:
|
|
249
|
-
writtenAt:
|
|
250
|
-
});
|
|
251
|
-
var destroyPreviewSchema =
|
|
252
|
-
keptAt:
|
|
253
|
-
keptBy:
|
|
254
|
-
kept:
|
|
255
|
-
lost:
|
|
256
|
-
momentID:
|
|
257
|
-
note:
|
|
258
|
-
reflections:
|
|
259
|
-
shortID:
|
|
260
|
-
state:
|
|
261
|
-
thread:
|
|
262
|
-
title:
|
|
263
|
-
version:
|
|
271
|
+
var momentIDSchema = z7.string().min(1).max(200);
|
|
272
|
+
var momentTargetSchema = z7.object({ momentID: momentIDSchema, version: z7.int().positive() });
|
|
273
|
+
var reflectionSchema = z7.object({
|
|
274
|
+
model: z7.string(),
|
|
275
|
+
text: z7.string().nullable(),
|
|
276
|
+
writtenAt: z7.date()
|
|
277
|
+
});
|
|
278
|
+
var destroyPreviewSchema = z7.object({
|
|
279
|
+
keptAt: z7.date(),
|
|
280
|
+
keptBy: z7.enum(["owner", "model"]),
|
|
281
|
+
kept: z7.object({ records: z7.int().nonnegative() }),
|
|
282
|
+
lost: z7.object({ links: z7.int().nonnegative(), texts: z7.int().nonnegative() }),
|
|
283
|
+
momentID: z7.string(),
|
|
284
|
+
note: z7.string().nullable(),
|
|
285
|
+
reflections: z7.array(reflectionSchema),
|
|
286
|
+
shortID: z7.string(),
|
|
287
|
+
state: z7.enum(["active", "retired"]),
|
|
288
|
+
thread: z7.string(),
|
|
289
|
+
title: z7.string().nullable(),
|
|
290
|
+
version: z7.int().positive()
|
|
264
291
|
});
|
|
265
292
|
var momentKeep = signedIn.errors(reusedIDErrors).errors({
|
|
266
293
|
MEMORY_NOT_STARTED: { message: "The memory store has not started yet", status: 503 },
|
|
@@ -269,90 +296,90 @@ var momentKeep = signedIn.errors(reusedIDErrors).errors({
|
|
|
269
296
|
status: 422
|
|
270
297
|
}
|
|
271
298
|
});
|
|
272
|
-
var titleSchema =
|
|
273
|
-
var keepSchema =
|
|
274
|
-
clientActionID:
|
|
275
|
-
firstSequence:
|
|
276
|
-
lastSequence:
|
|
277
|
-
thread:
|
|
299
|
+
var titleSchema = z7.string().min(1).max(120).regex(/\S/u);
|
|
300
|
+
var keepSchema = z7.object({
|
|
301
|
+
clientActionID: z7.uuid(),
|
|
302
|
+
firstSequence: z7.int().nonnegative(),
|
|
303
|
+
lastSequence: z7.int().nonnegative(),
|
|
304
|
+
thread: z7.string().min(1).max(200),
|
|
278
305
|
title: titleSchema
|
|
279
306
|
});
|
|
280
|
-
var momentSummarySchema =
|
|
281
|
-
editedAt:
|
|
282
|
-
keptAt:
|
|
283
|
-
keptBy:
|
|
284
|
-
momentID:
|
|
285
|
-
shortID:
|
|
286
|
-
state:
|
|
287
|
-
title:
|
|
288
|
-
});
|
|
289
|
-
var momentListSchema =
|
|
290
|
-
before:
|
|
291
|
-
includeRetired:
|
|
292
|
-
query:
|
|
293
|
-
});
|
|
294
|
-
var linkSchema =
|
|
295
|
-
itemID:
|
|
296
|
-
shortID:
|
|
297
|
-
text:
|
|
298
|
-
});
|
|
299
|
-
var noteSchema =
|
|
300
|
-
var shownReflectionSchema = reflectionSchema.extend({ reflectionID:
|
|
307
|
+
var momentSummarySchema = z7.object({
|
|
308
|
+
editedAt: z7.date().nullable(),
|
|
309
|
+
keptAt: z7.date(),
|
|
310
|
+
keptBy: z7.enum(["owner", "model"]),
|
|
311
|
+
momentID: z7.string(),
|
|
312
|
+
shortID: z7.string(),
|
|
313
|
+
state: z7.enum(["active", "retired"]),
|
|
314
|
+
title: z7.string().nullable()
|
|
315
|
+
});
|
|
316
|
+
var momentListSchema = z7.object({
|
|
317
|
+
before: z7.int().nonnegative().optional(),
|
|
318
|
+
includeRetired: z7.boolean(),
|
|
319
|
+
query: z7.string().max(500).optional()
|
|
320
|
+
});
|
|
321
|
+
var linkSchema = z7.object({
|
|
322
|
+
itemID: z7.string(),
|
|
323
|
+
shortID: z7.string(),
|
|
324
|
+
text: z7.string().nullable()
|
|
325
|
+
});
|
|
326
|
+
var noteSchema = z7.object({ text: z7.string(), writtenAt: z7.date() });
|
|
327
|
+
var shownReflectionSchema = reflectionSchema.extend({ reflectionID: z7.string() });
|
|
301
328
|
var momentDetailSchema = momentSummarySchema.extend({
|
|
302
|
-
firstSequence:
|
|
303
|
-
lastSequence:
|
|
304
|
-
links:
|
|
329
|
+
firstSequence: z7.int().nonnegative(),
|
|
330
|
+
lastSequence: z7.int().nonnegative(),
|
|
331
|
+
links: z7.array(linkSchema),
|
|
305
332
|
note: noteSchema.nullable(),
|
|
306
|
-
reflections:
|
|
307
|
-
thread:
|
|
308
|
-
titleBy:
|
|
309
|
-
version:
|
|
310
|
-
});
|
|
311
|
-
var spanRecordSchema =
|
|
312
|
-
isGap:
|
|
313
|
-
isRemoved:
|
|
314
|
-
kind:
|
|
315
|
-
recordedAt:
|
|
316
|
-
sequence:
|
|
317
|
-
text:
|
|
318
|
-
tool:
|
|
319
|
-
});
|
|
320
|
-
var momentChangeSchema =
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
kind:
|
|
324
|
-
firstSequence:
|
|
325
|
-
lastSequence:
|
|
333
|
+
reflections: z7.array(shownReflectionSchema),
|
|
334
|
+
thread: z7.string(),
|
|
335
|
+
titleBy: z7.enum(["owner", "model"]),
|
|
336
|
+
version: z7.int().positive()
|
|
337
|
+
});
|
|
338
|
+
var spanRecordSchema = z7.object({
|
|
339
|
+
isGap: z7.boolean(),
|
|
340
|
+
isRemoved: z7.boolean(),
|
|
341
|
+
kind: z7.string(),
|
|
342
|
+
recordedAt: z7.date(),
|
|
343
|
+
sequence: z7.int().nonnegative(),
|
|
344
|
+
text: z7.string().nullable(),
|
|
345
|
+
tool: z7.string().nullable()
|
|
346
|
+
});
|
|
347
|
+
var momentChangeSchema = z7.discriminatedUnion("kind", [
|
|
348
|
+
z7.object({ kind: z7.literal("title"), title: titleSchema }),
|
|
349
|
+
z7.object({
|
|
350
|
+
kind: z7.literal("edges"),
|
|
351
|
+
firstSequence: z7.int().nonnegative(),
|
|
352
|
+
lastSequence: z7.int().nonnegative()
|
|
326
353
|
}),
|
|
327
|
-
|
|
328
|
-
|
|
354
|
+
z7.object({ kind: z7.literal("note"), note: z7.string().min(1).max(4000).regex(/\S/u) }),
|
|
355
|
+
z7.object({ kind: z7.literal("reflection_removed"), reflectionID: z7.string().min(1).max(200) })
|
|
329
356
|
]);
|
|
330
357
|
var momentChange = momentView.errors(reusedIDErrors);
|
|
331
358
|
var momentContract = {
|
|
332
|
-
keepMoment: momentKeep.input(keepSchema).output(
|
|
359
|
+
keepMoment: momentKeep.input(keepSchema).output(z7.object({ momentID: z7.string(), shortID: z7.string() })),
|
|
333
360
|
listMoments: signedIn.errors({
|
|
334
361
|
MEMORY_NOT_STARTED: { message: "The memory store has not started yet", status: 503 }
|
|
335
|
-
}).input(momentListSchema).output(
|
|
336
|
-
readMoment: momentView.input(
|
|
337
|
-
readMomentSpan: momentView.input(
|
|
362
|
+
}).input(momentListSchema).output(z7.object({ moments: z7.array(momentSummarySchema), next: z7.int().nonnegative().nullable() })),
|
|
363
|
+
readMoment: momentView.input(z7.object({ momentID: momentIDSchema })).output(momentDetailSchema),
|
|
364
|
+
readMomentSpan: momentView.input(z7.object({ momentID: momentIDSchema, after: z7.int().nonnegative().optional() })).output(z7.object({ records: z7.array(spanRecordSchema), next: z7.int().nonnegative().nullable() })),
|
|
338
365
|
editMoment: momentChange.errors({
|
|
339
366
|
BAD_SPAN: {
|
|
340
367
|
message: "The span needs a first and a last record on the thread, in order",
|
|
341
368
|
status: 422
|
|
342
369
|
},
|
|
343
370
|
REFLECTION_NOT_FOUND: { message: "The moment has no reflection with this ID", status: 404 }
|
|
344
|
-
}).input(momentTargetSchema.extend({ clientActionID:
|
|
371
|
+
}).input(momentTargetSchema.extend({ clientActionID: z7.uuid(), change: momentChangeSchema })).output(z7.object({ momentID: z7.string(), version: z7.int().positive() })),
|
|
345
372
|
linkMoment: momentChange.errors({
|
|
346
373
|
MEMORY_ITEM_NOT_FOUND: { message: "No memory item has this ID", status: 404 },
|
|
347
374
|
ALREADY_LINKED: { message: "The item is already linked to the moment", status: 409 },
|
|
348
375
|
NOT_LINKED: { message: "The item is not linked to the moment", status: 409 }
|
|
349
376
|
}).input(momentTargetSchema.extend({
|
|
350
|
-
clientActionID:
|
|
351
|
-
isLinked:
|
|
352
|
-
itemID:
|
|
353
|
-
})).output(
|
|
377
|
+
clientActionID: z7.uuid(),
|
|
378
|
+
isLinked: z7.boolean(),
|
|
379
|
+
itemID: z7.string().min(1).max(200)
|
|
380
|
+
})).output(z7.object({ momentID: z7.string(), version: z7.int().positive() })),
|
|
354
381
|
previewMomentDestroy: momentView.input(momentTargetSchema).output(destroyPreviewSchema),
|
|
355
|
-
destroyMoment: momentView.errors(reusedIDErrors).input(momentTargetSchema.extend({ clientActionID:
|
|
382
|
+
destroyMoment: momentView.errors(reusedIDErrors).input(momentTargetSchema.extend({ clientActionID: z7.uuid() })).output(z7.object({ momentID: z7.string() }))
|
|
356
383
|
};
|
|
357
384
|
|
|
358
385
|
// src/contract/memory-view-contract.ts
|
|
@@ -364,67 +391,67 @@ var memoryChange = memoryView.errors(reusedIDErrors).errors({
|
|
|
364
391
|
STALE_VERSION: { message: "The memory item has moved past that version", status: 409 },
|
|
365
392
|
WRONG_STATE: { message: "The memory item is not in a state that change takes", status: 409 }
|
|
366
393
|
});
|
|
367
|
-
var itemIDSchema =
|
|
368
|
-
var proposalOriginSchema =
|
|
369
|
-
var originSchema =
|
|
370
|
-
var sourceSchema =
|
|
371
|
-
var subjectSchema =
|
|
372
|
-
var kindSchema =
|
|
373
|
-
var memoryItemSchema =
|
|
374
|
-
changedAt:
|
|
375
|
-
createdAt:
|
|
376
|
-
forgottenAt:
|
|
377
|
-
isPinned:
|
|
378
|
-
isSensitive:
|
|
379
|
-
itemID:
|
|
394
|
+
var itemIDSchema = z8.string().min(1).max(200);
|
|
395
|
+
var proposalOriginSchema = z8.enum(["owner", "conversation", "task"]);
|
|
396
|
+
var originSchema = z8.enum([...proposalOriginSchema.options, "lapse"]);
|
|
397
|
+
var sourceSchema = z8.enum(["owner", "owner_data", "untrusted"]);
|
|
398
|
+
var subjectSchema = z8.enum(["owner", "self", "shared"]);
|
|
399
|
+
var kindSchema = z8.enum(["fact", "self"]);
|
|
400
|
+
var memoryItemSchema = z8.object({
|
|
401
|
+
changedAt: z8.date(),
|
|
402
|
+
createdAt: z8.date(),
|
|
403
|
+
forgottenAt: z8.date().nullable(),
|
|
404
|
+
isPinned: z8.boolean(),
|
|
405
|
+
isSensitive: z8.boolean(),
|
|
406
|
+
itemID: z8.string(),
|
|
380
407
|
kind: kindSchema,
|
|
381
408
|
origin: originSchema,
|
|
382
|
-
shortID:
|
|
409
|
+
shortID: z8.string(),
|
|
383
410
|
source: sourceSchema,
|
|
384
|
-
state:
|
|
385
|
-
status:
|
|
411
|
+
state: z8.enum(["active", "retired", "forgetting", "forgotten"]),
|
|
412
|
+
status: z8.enum(["readable", "shredded", "unreadable"]),
|
|
386
413
|
subject: subjectSchema,
|
|
387
|
-
text:
|
|
388
|
-
until:
|
|
389
|
-
version:
|
|
414
|
+
text: z8.string().optional(),
|
|
415
|
+
until: z8.date().nullable(),
|
|
416
|
+
version: z8.int().positive()
|
|
390
417
|
});
|
|
391
418
|
var memoryMatchSchema = memoryItemSchema.extend({
|
|
392
|
-
score:
|
|
393
|
-
similarity:
|
|
394
|
-
});
|
|
395
|
-
var evidenceSchema =
|
|
396
|
-
end:
|
|
397
|
-
message:
|
|
398
|
-
status:
|
|
399
|
-
text:
|
|
419
|
+
score: z8.number().optional(),
|
|
420
|
+
similarity: z8.number().optional()
|
|
421
|
+
});
|
|
422
|
+
var evidenceSchema = z8.object({
|
|
423
|
+
end: z8.int().nonnegative(),
|
|
424
|
+
message: z8.object({
|
|
425
|
+
status: z8.enum(["readable", "shredded", "unreadable", "missing"]),
|
|
426
|
+
text: z8.string().optional()
|
|
400
427
|
}).nullable(),
|
|
401
|
-
sequence:
|
|
402
|
-
start:
|
|
403
|
-
});
|
|
404
|
-
var ownerImageSchema =
|
|
405
|
-
position:
|
|
406
|
-
sequence:
|
|
407
|
-
thread:
|
|
408
|
-
});
|
|
409
|
-
var memoryVersionSchema =
|
|
410
|
-
change:
|
|
411
|
-
checkerModel:
|
|
412
|
-
checks:
|
|
428
|
+
sequence: z8.int().nonnegative(),
|
|
429
|
+
start: z8.int().nonnegative()
|
|
430
|
+
});
|
|
431
|
+
var ownerImageSchema = z8.object({
|
|
432
|
+
position: z8.int().nonnegative(),
|
|
433
|
+
sequence: z8.int().positive(),
|
|
434
|
+
thread: z8.string()
|
|
435
|
+
});
|
|
436
|
+
var memoryVersionSchema = z8.object({
|
|
437
|
+
change: z8.enum(["created", "edited", "retired", "restored", "undone"]),
|
|
438
|
+
checkerModel: z8.string().nullable(),
|
|
439
|
+
checks: z8.record(z8.string(), z8.unknown()).nullable(),
|
|
413
440
|
evidence: evidenceSchema.nullable(),
|
|
414
|
-
evidenceQuote:
|
|
441
|
+
evidenceQuote: z8.string().nullable(),
|
|
415
442
|
image: ownerImageSchema.nullable(),
|
|
416
443
|
origin: originSchema,
|
|
417
|
-
proposalID:
|
|
418
|
-
recordedAt:
|
|
444
|
+
proposalID: z8.string().nullable(),
|
|
445
|
+
recordedAt: z8.date(),
|
|
419
446
|
source: sourceSchema,
|
|
420
|
-
state:
|
|
421
|
-
status:
|
|
422
|
-
taskID:
|
|
423
|
-
text:
|
|
424
|
-
version:
|
|
425
|
-
writerModel:
|
|
426
|
-
});
|
|
427
|
-
var reviewReasonSchema =
|
|
447
|
+
state: z8.enum(["active", "retired"]),
|
|
448
|
+
status: z8.enum(["readable", "shredded", "unreadable"]),
|
|
449
|
+
taskID: z8.string().nullable(),
|
|
450
|
+
text: z8.string().optional(),
|
|
451
|
+
version: z8.int().positive(),
|
|
452
|
+
writerModel: z8.string().nullable()
|
|
453
|
+
});
|
|
454
|
+
var reviewReasonSchema = z8.enum([
|
|
428
455
|
"no_quote",
|
|
429
456
|
"quote_not_typed",
|
|
430
457
|
"quote_in_quoted_block",
|
|
@@ -443,101 +470,101 @@ var reviewReasonSchema = z5.enum([
|
|
|
443
470
|
"subject_change",
|
|
444
471
|
"ask_rule"
|
|
445
472
|
]);
|
|
446
|
-
var proposalSourceSchema =
|
|
473
|
+
var proposalSourceSchema = z8.object({
|
|
447
474
|
origin: proposalOriginSchema,
|
|
448
|
-
proposedAt:
|
|
449
|
-
thread:
|
|
475
|
+
proposedAt: z8.date(),
|
|
476
|
+
thread: z8.string().nullable()
|
|
450
477
|
});
|
|
451
|
-
var memoryProposalSchema =
|
|
452
|
-
actionHash:
|
|
453
|
-
createdAt:
|
|
478
|
+
var memoryProposalSchema = z8.object({
|
|
479
|
+
actionHash: z8.string(),
|
|
480
|
+
createdAt: z8.date(),
|
|
454
481
|
evidence: evidenceSchema.nullable(),
|
|
455
482
|
image: ownerImageSchema.nullable(),
|
|
456
|
-
isPinned:
|
|
457
|
-
isSensitive:
|
|
458
|
-
itemID:
|
|
483
|
+
isPinned: z8.boolean(),
|
|
484
|
+
isSensitive: z8.boolean(),
|
|
485
|
+
itemID: z8.string(),
|
|
459
486
|
kind: kindSchema,
|
|
460
|
-
lapseAt:
|
|
487
|
+
lapseAt: z8.date(),
|
|
461
488
|
newSubject: subjectSchema.nullable(),
|
|
462
|
-
operation:
|
|
489
|
+
operation: z8.enum(["remember", "retire", "pin"]),
|
|
463
490
|
origin: proposalOriginSchema,
|
|
464
|
-
proposalID:
|
|
465
|
-
quote:
|
|
491
|
+
proposalID: z8.string(),
|
|
492
|
+
quote: z8.string().nullable(),
|
|
466
493
|
reason: reviewReasonSchema,
|
|
467
494
|
source: sourceSchema,
|
|
468
|
-
sources:
|
|
495
|
+
sources: z8.array(proposalSourceSchema),
|
|
469
496
|
subject: subjectSchema,
|
|
470
|
-
targetVersion:
|
|
471
|
-
text:
|
|
472
|
-
until:
|
|
497
|
+
targetVersion: z8.int().positive().nullable(),
|
|
498
|
+
text: z8.string(),
|
|
499
|
+
until: z8.date().nullable()
|
|
473
500
|
});
|
|
474
|
-
var revisionTargetSchema =
|
|
475
|
-
var memoryItemDetailSchema = memoryItemSchema.extend({ versions:
|
|
476
|
-
var forgetLossSchema =
|
|
477
|
-
evidenceMessages:
|
|
478
|
-
proposals:
|
|
501
|
+
var revisionTargetSchema = z8.object({ itemID: itemIDSchema, version: z8.int().positive() });
|
|
502
|
+
var memoryItemDetailSchema = memoryItemSchema.extend({ versions: z8.array(memoryVersionSchema) });
|
|
503
|
+
var forgetLossSchema = z8.object({
|
|
504
|
+
evidenceMessages: z8.int().nonnegative(),
|
|
505
|
+
proposals: z8.int().nonnegative()
|
|
479
506
|
});
|
|
480
507
|
var forgetPreviewSchema = memoryItemDetailSchema.extend({ lost: forgetLossSchema });
|
|
481
|
-
var retiredForgetPreviewSchema =
|
|
482
|
-
hasMore:
|
|
483
|
-
items:
|
|
508
|
+
var retiredForgetPreviewSchema = z8.object({
|
|
509
|
+
hasMore: z8.boolean(),
|
|
510
|
+
items: z8.array(memoryItemSchema.extend({ lost: forgetLossSchema }))
|
|
484
511
|
});
|
|
485
|
-
var retiredForgetSchema =
|
|
486
|
-
clientActionID:
|
|
487
|
-
targets:
|
|
512
|
+
var retiredForgetSchema = z8.object({
|
|
513
|
+
clientActionID: z8.uuid(),
|
|
514
|
+
targets: z8.array(revisionTargetSchema).min(1).max(100).refine((targets) => new Set(targets.map((target) => target.itemID)).size === targets.length, {
|
|
488
515
|
message: "Each item appears once"
|
|
489
516
|
})
|
|
490
517
|
});
|
|
491
|
-
var forgetStatusSchema =
|
|
492
|
-
deleted:
|
|
493
|
-
pending:
|
|
518
|
+
var forgetStatusSchema = z8.object({
|
|
519
|
+
deleted: z8.array(z8.string()),
|
|
520
|
+
pending: z8.array(z8.string()),
|
|
494
521
|
backup: forgetBackupSchema
|
|
495
522
|
});
|
|
496
|
-
var versionTargetSchema =
|
|
497
|
-
clientActionID:
|
|
523
|
+
var versionTargetSchema = z8.object({
|
|
524
|
+
clientActionID: z8.uuid(),
|
|
498
525
|
itemID: itemIDSchema,
|
|
499
|
-
version:
|
|
500
|
-
});
|
|
501
|
-
var versionResultSchema =
|
|
502
|
-
var noticeEntrySchema =
|
|
503
|
-
change:
|
|
504
|
-
isKept:
|
|
505
|
-
item: memoryItemSchema.extend({ change:
|
|
506
|
-
itemID:
|
|
507
|
-
proposalID:
|
|
508
|
-
sequence:
|
|
509
|
-
version:
|
|
510
|
-
});
|
|
511
|
-
var memoryNoticeSchema =
|
|
512
|
-
entries:
|
|
513
|
-
kind:
|
|
514
|
-
messageSequence:
|
|
515
|
-
noticeKey:
|
|
516
|
-
proposed:
|
|
517
|
-
remembered:
|
|
518
|
-
retired:
|
|
519
|
-
sequence:
|
|
526
|
+
version: z8.int().positive()
|
|
527
|
+
});
|
|
528
|
+
var versionResultSchema = z8.object({ itemID: z8.string(), version: z8.int().positive() });
|
|
529
|
+
var noticeEntrySchema = z8.object({
|
|
530
|
+
change: z8.enum(["created", "edited", "retired", "restored", "undone", "proposed"]),
|
|
531
|
+
isKept: z8.boolean(),
|
|
532
|
+
item: memoryItemSchema.extend({ change: z8.enum(["created", "edited", "retired", "restored", "undone"]) }).nullable(),
|
|
533
|
+
itemID: z8.string(),
|
|
534
|
+
proposalID: z8.string().nullable(),
|
|
535
|
+
sequence: z8.int().nonnegative(),
|
|
536
|
+
version: z8.int().positive().nullable()
|
|
537
|
+
});
|
|
538
|
+
var memoryNoticeSchema = z8.object({
|
|
539
|
+
entries: z8.array(noticeEntrySchema),
|
|
540
|
+
kind: z8.enum(["turn", "run"]),
|
|
541
|
+
messageSequence: z8.int().nonnegative().nullable(),
|
|
542
|
+
noticeKey: z8.string(),
|
|
543
|
+
proposed: z8.int().nonnegative(),
|
|
544
|
+
remembered: z8.int().nonnegative(),
|
|
545
|
+
retired: z8.int().nonnegative(),
|
|
546
|
+
sequence: z8.int().nonnegative()
|
|
520
547
|
});
|
|
521
548
|
var memoryViewContract = {
|
|
522
|
-
listItems: memoryView.errors({ INVALID_CURSOR: { message: "No page returned this cursor", status: 400 } }).input(
|
|
523
|
-
after:
|
|
549
|
+
listItems: memoryView.errors({ INVALID_CURSOR: { message: "No page returned this cursor", status: 400 } }).input(z8.object({
|
|
550
|
+
after: z8.string().max(20).optional(),
|
|
524
551
|
kind: kindSchema.optional(),
|
|
525
|
-
limit:
|
|
526
|
-
state:
|
|
527
|
-
})).output(
|
|
528
|
-
findItems: memoryView.input(
|
|
529
|
-
items:
|
|
530
|
-
searchMode:
|
|
552
|
+
limit: z8.int().min(1).max(100).optional(),
|
|
553
|
+
state: z8.enum(["active", "retired", "forgotten"])
|
|
554
|
+
})).output(z8.object({ items: z8.array(memoryItemSchema), next: z8.string().nullable() })),
|
|
555
|
+
findItems: memoryView.input(z8.object({ query: z8.string().min(1).max(500) })).output(z8.object({
|
|
556
|
+
items: z8.array(memoryMatchSchema),
|
|
557
|
+
searchMode: z8.enum(["hybrid", "keyword", "keyword-fallback"])
|
|
531
558
|
})),
|
|
532
|
-
readPinnedCore: memoryView.output(
|
|
533
|
-
budget:
|
|
534
|
-
items:
|
|
535
|
-
tokens:
|
|
559
|
+
readPinnedCore: memoryView.output(z8.object({
|
|
560
|
+
budget: z8.int().nonnegative(),
|
|
561
|
+
items: z8.array(memoryItemSchema),
|
|
562
|
+
tokens: z8.int().nonnegative()
|
|
536
563
|
})),
|
|
537
|
-
readItem: memoryView.errors({ MEMORY_ITEM_NOT_FOUND: { message: "No memory item has this ID", status: 404 } }).input(
|
|
564
|
+
readItem: memoryView.errors({ MEMORY_ITEM_NOT_FOUND: { message: "No memory item has this ID", status: 404 } }).input(z8.object({ itemID: itemIDSchema })).output(memoryItemDetailSchema),
|
|
538
565
|
retire: memoryChange.input(versionTargetSchema).output(versionResultSchema),
|
|
539
566
|
restore: memoryChange.input(versionTargetSchema).output(versionResultSchema),
|
|
540
|
-
listNotices: memoryView.input(
|
|
567
|
+
listNotices: memoryView.input(z8.object({ thread: z8.string().min(1).max(200) })).output(z8.object({ notices: z8.array(memoryNoticeSchema) })),
|
|
541
568
|
undo: memoryChange.errors({
|
|
542
569
|
PINNED_CORE_FULL: { message: "The undo takes the pinned core past its budget", status: 409 }
|
|
543
570
|
}).input(versionTargetSchema).output(versionResultSchema),
|
|
@@ -545,138 +572,174 @@ var memoryViewContract = {
|
|
|
545
572
|
previewForget: memoryView.errors({
|
|
546
573
|
MEMORY_ITEM_NOT_FOUND: { message: "No memory item has this ID", status: 404 },
|
|
547
574
|
STALE_VERSION: { message: "The memory item has moved past that version", status: 409 }
|
|
548
|
-
}).input(
|
|
549
|
-
forget: memoryChange.input(versionTargetSchema).output(
|
|
575
|
+
}).input(z8.object({ itemID: itemIDSchema, version: z8.int().positive() })).output(forgetPreviewSchema),
|
|
576
|
+
forget: memoryChange.input(versionTargetSchema).output(z8.object({ itemID: z8.string(), backup: forgetBackupSchema })),
|
|
550
577
|
previewForgetRetired: memoryView.output(retiredForgetPreviewSchema),
|
|
551
578
|
forgetRetired: memoryChange.input(retiredForgetSchema).output(forgetStatusSchema),
|
|
552
|
-
readForgetStatus: memoryView.input(
|
|
579
|
+
readForgetStatus: memoryView.input(z8.object({ itemIDs: z8.array(itemIDSchema).min(1).max(100) })).output(forgetStatusSchema),
|
|
553
580
|
pin: memoryChange.errors({
|
|
554
581
|
PINNED_CORE_FULL: { message: "The pin takes the pinned core past its budget", status: 409 }
|
|
555
|
-
}).input(versionTargetSchema.extend({ isPinned:
|
|
556
|
-
markSensitive: memoryChange.input(
|
|
582
|
+
}).input(versionTargetSchema.extend({ isPinned: z8.boolean() })).output(z8.object({ isPinned: z8.boolean(), itemID: z8.string() })),
|
|
583
|
+
markSensitive: memoryChange.input(z8.object({ clientActionID: z8.uuid(), isSensitive: z8.boolean(), itemID: itemIDSchema })).output(z8.object({ isSensitive: z8.boolean(), itemID: z8.string() })),
|
|
557
584
|
...memoryExportContract,
|
|
558
585
|
...momentContract
|
|
559
586
|
};
|
|
560
587
|
|
|
588
|
+
// src/contract/no-passkey-error.ts
|
|
589
|
+
var noPasskeyError = {
|
|
590
|
+
NO_PASSKEY: { message: "No passkey is registered", status: 403 }
|
|
591
|
+
};
|
|
592
|
+
|
|
593
|
+
// src/contract/passkey-failed-error.ts
|
|
594
|
+
import { z as z10 } from "zod";
|
|
595
|
+
|
|
596
|
+
// src/contract/passkey-failure-schema.ts
|
|
597
|
+
import { z as z9 } from "zod";
|
|
598
|
+
var passkeyFailureSchema = z9.enum([
|
|
599
|
+
"unknown_challenge",
|
|
600
|
+
"binding",
|
|
601
|
+
"unknown_passkey",
|
|
602
|
+
"origin",
|
|
603
|
+
"no_user_verification",
|
|
604
|
+
"signature",
|
|
605
|
+
"counter"
|
|
606
|
+
]);
|
|
607
|
+
|
|
608
|
+
// src/contract/passkey-failed-error.ts
|
|
609
|
+
var passkeyFailedError = {
|
|
610
|
+
PASSKEY_FAILED: {
|
|
611
|
+
message: "The passkey check failed",
|
|
612
|
+
status: 403,
|
|
613
|
+
data: z10.object({ reason: passkeyFailureSchema })
|
|
614
|
+
}
|
|
615
|
+
};
|
|
616
|
+
|
|
561
617
|
// src/contract/approval-contract.ts
|
|
562
|
-
var
|
|
563
|
-
var
|
|
564
|
-
var
|
|
565
|
-
var
|
|
566
|
-
var
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
cause: z6.string(),
|
|
618
|
+
var stateSchema = z11.enum(["pending", "deferred", "approved", "declined", "lapsed", "withdrawn"]);
|
|
619
|
+
var hashesSchema = z11.object({ actionHash: z11.string(), ruleHash: z11.string().nullable() });
|
|
620
|
+
var versionSchema = z11.int().positive();
|
|
621
|
+
var taskSchema = z11.object({ id: z11.string(), name: z11.string() });
|
|
622
|
+
var proposalSchema = z11.object({
|
|
623
|
+
proposalID: z11.string(),
|
|
624
|
+
shortID: z11.string(),
|
|
625
|
+
kind: z11.enum(["action", "memory_write", "internal_change"]),
|
|
626
|
+
riskClass: z11.enum(["routine", "always_ask", "lifting"]),
|
|
627
|
+
actionHash: z11.string(),
|
|
628
|
+
ruleHash: z11.string().nullable(),
|
|
629
|
+
cause: z11.string(),
|
|
575
630
|
state: stateSchema,
|
|
576
|
-
createdAt:
|
|
577
|
-
lapsesAt:
|
|
578
|
-
deadlineAt:
|
|
579
|
-
deferGeneration:
|
|
580
|
-
deferUntil:
|
|
581
|
-
thread:
|
|
582
|
-
taskID:
|
|
583
|
-
sequence:
|
|
584
|
-
});
|
|
585
|
-
var bodySchema =
|
|
586
|
-
sentence:
|
|
587
|
-
fields:
|
|
588
|
-
ruleSentence:
|
|
589
|
-
approveLabel:
|
|
631
|
+
createdAt: z11.date(),
|
|
632
|
+
lapsesAt: z11.date(),
|
|
633
|
+
deadlineAt: z11.date().nullable(),
|
|
634
|
+
deferGeneration: z11.int().nonnegative(),
|
|
635
|
+
deferUntil: z11.date().nullable(),
|
|
636
|
+
thread: z11.string().nullable(),
|
|
637
|
+
taskID: z11.string().nullable(),
|
|
638
|
+
sequence: z11.int().positive()
|
|
639
|
+
});
|
|
640
|
+
var bodySchema = z11.object({
|
|
641
|
+
sentence: z11.string(),
|
|
642
|
+
fields: z11.record(z11.string(), z11.string()),
|
|
643
|
+
ruleSentence: z11.string().nullable(),
|
|
644
|
+
approveLabel: z11.string(),
|
|
590
645
|
memory: memoryProposalSchema.optional()
|
|
591
646
|
});
|
|
592
|
-
var itemSchema =
|
|
593
|
-
group:
|
|
647
|
+
var itemSchema = z11.object({
|
|
648
|
+
group: z11.enum(["always_ask", "routine", "memory", "deferred"]),
|
|
594
649
|
proposal: proposalSchema,
|
|
595
650
|
body: bodySchema,
|
|
596
651
|
task: taskSchema.nullable(),
|
|
597
|
-
choices:
|
|
652
|
+
choices: z11.array(choiceSchema),
|
|
653
|
+
passkeyChoices: z11.array(choiceSchema)
|
|
598
654
|
});
|
|
599
|
-
var readItemSchema =
|
|
655
|
+
var readItemSchema = z11.object({
|
|
600
656
|
proposal: proposalSchema,
|
|
601
657
|
body: bodySchema.nullable(),
|
|
602
658
|
task: taskSchema.nullable(),
|
|
603
|
-
choices:
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
659
|
+
choices: z11.array(choiceSchema),
|
|
660
|
+
passkeyChoices: z11.array(choiceSchema),
|
|
661
|
+
answeredOn: z11.string().nullable(),
|
|
662
|
+
isAnsweredHere: z11.boolean()
|
|
663
|
+
});
|
|
664
|
+
var deferSettingsSchema = z11.object({
|
|
665
|
+
defaultMinutes: z11.int().positive(),
|
|
666
|
+
eveningAt: z11.string(),
|
|
667
|
+
morningAt: z11.string(),
|
|
668
|
+
zone: z11.string()
|
|
669
|
+
});
|
|
670
|
+
var memoryAnswerSchema = z11.object({
|
|
671
|
+
editedText: z11.string().optional(),
|
|
672
|
+
revisionOf: z11.object({ itemID: z11.string(), version: versionSchema }).optional(),
|
|
673
|
+
ignoreCloseMatch: z11.boolean().optional()
|
|
674
|
+
});
|
|
675
|
+
var answerSchema = z11.object({
|
|
676
|
+
proposalID: z11.string().min(1).max(200),
|
|
677
|
+
actionHash: z11.string().min(1),
|
|
621
678
|
choice: choiceSchema,
|
|
622
|
-
ruleHash:
|
|
623
|
-
deferUntil:
|
|
624
|
-
note:
|
|
625
|
-
clientActionID:
|
|
679
|
+
ruleHash: z11.string().optional(),
|
|
680
|
+
deferUntil: z11.date().optional(),
|
|
681
|
+
note: z11.string().min(1).max(500).optional(),
|
|
682
|
+
clientActionID: z11.uuid(),
|
|
626
683
|
memory: memoryAnswerSchema.optional()
|
|
627
684
|
});
|
|
628
|
-
var
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
685
|
+
var passkeyAnswerSchema = answerSchema.extend({
|
|
686
|
+
passkey: authenticationResponseSchema.optional()
|
|
687
|
+
});
|
|
688
|
+
var ruleRefSchema = z11.object({ id: z11.string(), revision: versionSchema });
|
|
689
|
+
var closeMatchSchema = z11.object({ itemID: z11.string(), text: z11.string(), version: versionSchema });
|
|
690
|
+
var approvedSchema = z11.object({
|
|
691
|
+
proposalID: z11.string(),
|
|
692
|
+
state: z11.literal("approved"),
|
|
633
693
|
rule: ruleRefSchema.optional()
|
|
634
694
|
});
|
|
635
|
-
var closedSchema =
|
|
636
|
-
var closeMatchResultSchema =
|
|
637
|
-
proposalID:
|
|
638
|
-
state:
|
|
695
|
+
var closedSchema = z11.object({ proposalID: z11.string(), state: z11.enum(["declined", "deferred"]) });
|
|
696
|
+
var closeMatchResultSchema = z11.object({
|
|
697
|
+
proposalID: z11.string(),
|
|
698
|
+
state: z11.literal("pending"),
|
|
639
699
|
closeMatch: closeMatchSchema
|
|
640
700
|
});
|
|
641
|
-
var resultSchema =
|
|
701
|
+
var resultSchema = z11.discriminatedUnion("state", [
|
|
642
702
|
approvedSchema,
|
|
643
703
|
closedSchema,
|
|
644
704
|
closeMatchResultSchema
|
|
645
705
|
]);
|
|
646
|
-
var refusedSchema =
|
|
647
|
-
proposalID:
|
|
648
|
-
error:
|
|
706
|
+
var refusedSchema = z11.object({
|
|
707
|
+
proposalID: z11.string(),
|
|
708
|
+
error: z11.enum(["CONFLICT", "CLOSED", "NOT_ALLOWED", "PASSKEY_REQUIRED"]),
|
|
649
709
|
current: hashesSchema.optional(),
|
|
650
710
|
state: stateSchema.optional(),
|
|
651
|
-
reason:
|
|
711
|
+
reason: z11.string().optional()
|
|
652
712
|
});
|
|
653
713
|
var answerErrors = signedIn.errors(reusedIDErrors).errors({
|
|
654
714
|
CONFLICT: {
|
|
655
715
|
message: "The proposal changed since the card showed it",
|
|
656
716
|
status: 409,
|
|
657
|
-
data:
|
|
717
|
+
data: z11.object({ current: hashesSchema })
|
|
658
718
|
},
|
|
659
719
|
CLOSED: {
|
|
660
720
|
message: "The proposal is answered, withdrawn or lapsed",
|
|
661
721
|
status: 409,
|
|
662
|
-
data:
|
|
722
|
+
data: z11.object({ state: stateSchema })
|
|
663
723
|
},
|
|
664
724
|
NOT_ALLOWED: {
|
|
665
725
|
message: "The proposal does not take this answer",
|
|
666
726
|
status: 403,
|
|
667
|
-
data:
|
|
668
|
-
}
|
|
727
|
+
data: z11.object({ reason: z11.string() })
|
|
728
|
+
},
|
|
729
|
+
PASSKEY_REQUIRED: { message: "This answer needs a passkey check", status: 403 },
|
|
730
|
+
...noPasskeyError,
|
|
731
|
+
...passkeyFailedError
|
|
669
732
|
});
|
|
670
|
-
var listedSchema =
|
|
671
|
-
var readInputSchema =
|
|
672
|
-
proposalIDs:
|
|
733
|
+
var listedSchema = z11.object({ defer: deferSettingsSchema, items: z11.array(itemSchema) });
|
|
734
|
+
var readInputSchema = z11.object({
|
|
735
|
+
proposalIDs: z11.array(z11.string().min(1).max(200)).min(1).max(100)
|
|
673
736
|
});
|
|
674
|
-
var batchInputSchema =
|
|
675
|
-
var batchResultSchema =
|
|
737
|
+
var batchInputSchema = z11.object({ answers: z11.array(answerSchema).min(1).max(100) });
|
|
738
|
+
var batchResultSchema = z11.object({ results: z11.array(z11.union([resultSchema, refusedSchema])) });
|
|
676
739
|
var approvalContract = {
|
|
677
740
|
listItems: signedIn.output(listedSchema),
|
|
678
|
-
readProposals: signedIn.input(readInputSchema).output(
|
|
679
|
-
answerProposal: answerErrors.input(
|
|
741
|
+
readProposals: signedIn.input(readInputSchema).output(z11.object({ proposals: z11.array(readItemSchema) })),
|
|
742
|
+
answerProposal: answerErrors.input(passkeyAnswerSchema).output(resultSchema),
|
|
680
743
|
answerProposals: signedIn.errors(reusedIDErrors).input(batchInputSchema).output(batchResultSchema)
|
|
681
744
|
};
|
|
682
745
|
|
|
@@ -695,10 +758,10 @@ var imageNotFoundError = {
|
|
|
695
758
|
};
|
|
696
759
|
|
|
697
760
|
// src/contract/image-refused-error.ts
|
|
698
|
-
import { z as
|
|
699
|
-
var imageRefusedDataSchema =
|
|
700
|
-
position:
|
|
701
|
-
reason:
|
|
761
|
+
import { z as z12 } from "zod";
|
|
762
|
+
var imageRefusedDataSchema = z12.object({
|
|
763
|
+
position: z12.int().nonnegative().nullable(),
|
|
764
|
+
reason: z12.enum(["too_many", "too_large", "unsupported_type"])
|
|
702
765
|
});
|
|
703
766
|
var imageRefusedError = {
|
|
704
767
|
message: "An image is too large, of a type nixie does not take, or one too many",
|
|
@@ -706,14 +769,151 @@ var imageRefusedError = {
|
|
|
706
769
|
data: imageRefusedDataSchema
|
|
707
770
|
};
|
|
708
771
|
|
|
772
|
+
// src/contract/passkey-contract.ts
|
|
773
|
+
import { z as z20 } from "zod";
|
|
774
|
+
|
|
775
|
+
// src/contract/challenge-for-schema.ts
|
|
776
|
+
import { z as z13 } from "zod";
|
|
777
|
+
var challengeForSchema = z13.discriminatedUnion("kind", [
|
|
778
|
+
z13.object({
|
|
779
|
+
kind: z13.literal("answer"),
|
|
780
|
+
proposalID: z13.string().min(1).max(200),
|
|
781
|
+
actionHash: z13.string().min(1),
|
|
782
|
+
choice: choiceSchema,
|
|
783
|
+
ruleHash: z13.string().optional()
|
|
784
|
+
}),
|
|
785
|
+
z13.object({ kind: z13.literal("register") }),
|
|
786
|
+
z13.object({ kind: z13.literal("revoke"), passkeyID: z13.string().min(1).max(200) })
|
|
787
|
+
]);
|
|
788
|
+
|
|
789
|
+
// src/contract/creation-options-schema.ts
|
|
790
|
+
import { z as z17 } from "zod";
|
|
791
|
+
|
|
792
|
+
// src/contract/credential-descriptor-schema.ts
|
|
793
|
+
import { z as z15 } from "zod";
|
|
794
|
+
|
|
795
|
+
// src/contract/transports-schema.ts
|
|
796
|
+
import { z as z14 } from "zod";
|
|
797
|
+
var transportSchema = z14.string().max(40);
|
|
798
|
+
var transportsSchema = z14.array(transportSchema).max(10);
|
|
799
|
+
|
|
800
|
+
// src/contract/credential-descriptor-schema.ts
|
|
801
|
+
var credentialDescriptorSchema = z15.object({
|
|
802
|
+
id: base64URLSchema,
|
|
803
|
+
type: z15.literal("public-key"),
|
|
804
|
+
transports: transportsSchema.optional()
|
|
805
|
+
});
|
|
806
|
+
|
|
807
|
+
// src/contract/user-verification-schema.ts
|
|
808
|
+
import { z as z16 } from "zod";
|
|
809
|
+
var userVerificationSchema = z16.enum(["required", "preferred", "discouraged"]);
|
|
810
|
+
|
|
811
|
+
// src/contract/creation-options-schema.ts
|
|
812
|
+
var userSchema = z17.object({ id: base64URLSchema, name: z17.string(), displayName: z17.string() });
|
|
813
|
+
var parameterSchema = z17.object({ type: z17.literal("public-key"), alg: z17.int() });
|
|
814
|
+
var selectionSchema = z17.object({
|
|
815
|
+
residentKey: userVerificationSchema,
|
|
816
|
+
requireResidentKey: z17.boolean(),
|
|
817
|
+
userVerification: userVerificationSchema
|
|
818
|
+
});
|
|
819
|
+
var creationOptionsSchema = z17.object({
|
|
820
|
+
rp: z17.object({ id: z17.string(), name: z17.string() }),
|
|
821
|
+
user: userSchema,
|
|
822
|
+
challenge: base64URLSchema,
|
|
823
|
+
pubKeyCredParams: z17.array(parameterSchema),
|
|
824
|
+
timeout: z17.int().positive(),
|
|
825
|
+
excludeCredentials: z17.array(credentialDescriptorSchema),
|
|
826
|
+
authenticatorSelection: selectionSchema,
|
|
827
|
+
attestation: z17.enum(["none", "indirect", "direct", "enterprise"])
|
|
828
|
+
});
|
|
829
|
+
|
|
830
|
+
// src/contract/registration-response-schema.ts
|
|
831
|
+
import { z as z18 } from "zod";
|
|
832
|
+
var attestationSchema = z18.object({
|
|
833
|
+
clientDataJSON: base64URLSchema,
|
|
834
|
+
attestationObject: base64URLSchema,
|
|
835
|
+
authenticatorData: base64URLSchema.optional(),
|
|
836
|
+
transports: transportsSchema.optional(),
|
|
837
|
+
publicKeyAlgorithm: z18.int().optional(),
|
|
838
|
+
publicKey: base64URLSchema.optional()
|
|
839
|
+
});
|
|
840
|
+
var registrationResponseSchema = z18.object({
|
|
841
|
+
id: base64URLSchema,
|
|
842
|
+
rawId: base64URLSchema,
|
|
843
|
+
response: attestationSchema,
|
|
844
|
+
authenticatorAttachment: z18.enum(["cross-platform", "platform"]).optional(),
|
|
845
|
+
clientExtensionResults: z18.object({}),
|
|
846
|
+
type: z18.literal("public-key")
|
|
847
|
+
});
|
|
848
|
+
|
|
849
|
+
// src/contract/request-options-schema.ts
|
|
850
|
+
import { z as z19 } from "zod";
|
|
851
|
+
var requestOptionsSchema = z19.object({
|
|
852
|
+
challenge: base64URLSchema,
|
|
853
|
+
rpId: z19.string(),
|
|
854
|
+
allowCredentials: z19.array(credentialDescriptorSchema),
|
|
855
|
+
userVerification: userVerificationSchema,
|
|
856
|
+
timeout: z19.int().positive()
|
|
857
|
+
});
|
|
858
|
+
|
|
859
|
+
// src/contract/passkey-contract.ts
|
|
860
|
+
var clientActionIDSchema = z20.uuid();
|
|
861
|
+
var listedPasskeySchema = z20.object({
|
|
862
|
+
passkeyID: z20.string(),
|
|
863
|
+
label: z20.string(),
|
|
864
|
+
synced: z20.boolean(),
|
|
865
|
+
authorizedBy: z20.string(),
|
|
866
|
+
registeredAt: z20.date(),
|
|
867
|
+
lastUsedAt: z20.date().nullable(),
|
|
868
|
+
revokedAt: z20.date().nullable()
|
|
869
|
+
});
|
|
870
|
+
var registrationErrors = {
|
|
871
|
+
...passkeyFailedError,
|
|
872
|
+
TOO_MANY_PASSKEYS: { message: "Ten passkeys are live already", status: 409 },
|
|
873
|
+
ORIGIN_UNSUPPORTED: {
|
|
874
|
+
message: "A passkey needs an https origin with a domain name",
|
|
875
|
+
status: 400
|
|
876
|
+
},
|
|
877
|
+
ORIGIN_CHANGED: { message: "Live passkeys hold another origin", status: 409 }
|
|
878
|
+
};
|
|
879
|
+
var passkeyContract = {
|
|
880
|
+
challenge: signedIn.errors(noPasskeyError).input(z20.object({ for: challengeForSchema })).output(z20.object({ options: requestOptionsSchema })),
|
|
881
|
+
registrationOptions: signedIn.errors(registrationErrors).errors({
|
|
882
|
+
CODE_REQUIRED: { message: "A host code is required", status: 403 },
|
|
883
|
+
CODE_INVALID: { message: "The host code is unknown, used or lapsed", status: 403 }
|
|
884
|
+
}).input(z20.object({
|
|
885
|
+
code: z20.string().min(1).max(100).optional(),
|
|
886
|
+
passkey: authenticationResponseSchema.optional()
|
|
887
|
+
})).output(z20.object({ options: creationOptionsSchema })),
|
|
888
|
+
register: signedIn.errors(reusedIDErrors).errors({
|
|
889
|
+
REGISTRATION_FAILED: {
|
|
890
|
+
message: "The registration failed",
|
|
891
|
+
status: 400,
|
|
892
|
+
data: z20.object({ reason: z20.string() })
|
|
893
|
+
},
|
|
894
|
+
TOO_MANY_PASSKEYS: registrationErrors.TOO_MANY_PASSKEYS,
|
|
895
|
+
ORIGIN_UNSUPPORTED: registrationErrors.ORIGIN_UNSUPPORTED
|
|
896
|
+
}).input(z20.object({
|
|
897
|
+
clientActionID: clientActionIDSchema,
|
|
898
|
+
response: registrationResponseSchema,
|
|
899
|
+
label: z20.string().min(1).max(64).optional()
|
|
900
|
+
})).output(z20.object({ passkeyID: z20.string() })),
|
|
901
|
+
list: signedIn.output(z20.object({ passkeys: z20.array(listedPasskeySchema) })),
|
|
902
|
+
revoke: signedIn.errors(reusedIDErrors).errors(passkeyFailedError).errors({ NOT_FOUND: { message: "No passkey has this ID", status: 404 } }).input(z20.object({
|
|
903
|
+
clientActionID: clientActionIDSchema,
|
|
904
|
+
passkeyID: z20.string().min(1).max(200),
|
|
905
|
+
passkey: authenticationResponseSchema
|
|
906
|
+
})).output(z20.object({ revokedAt: z20.date() }))
|
|
907
|
+
};
|
|
908
|
+
|
|
709
909
|
// src/contract/pause-state-schema.ts
|
|
710
|
-
import { z as
|
|
711
|
-
var pauseCauseSchema =
|
|
712
|
-
var pauseStateSchema =
|
|
910
|
+
import { z as z21 } from "zod";
|
|
911
|
+
var pauseCauseSchema = z21.enum(["restore", "owner", "spending"]);
|
|
912
|
+
var pauseStateSchema = z21.object({ cause: pauseCauseSchema, since: z21.date() }).nullable();
|
|
713
913
|
|
|
714
914
|
// src/contract/recovery-schema.ts
|
|
715
|
-
import { z as
|
|
716
|
-
var taskStateSchema =
|
|
915
|
+
import { z as z22 } from "zod";
|
|
916
|
+
var taskStateSchema = z22.enum([
|
|
717
917
|
"ready",
|
|
718
918
|
"running",
|
|
719
919
|
"waiting",
|
|
@@ -723,29 +923,29 @@ var taskStateSchema = z9.enum([
|
|
|
723
923
|
"failed",
|
|
724
924
|
"closed"
|
|
725
925
|
]);
|
|
726
|
-
var taskToCheckSchema =
|
|
727
|
-
taskID:
|
|
728
|
-
name:
|
|
926
|
+
var taskToCheckSchema = z22.object({
|
|
927
|
+
taskID: z22.string(),
|
|
928
|
+
name: z22.string(),
|
|
729
929
|
stateAtBackup: taskStateSchema,
|
|
730
|
-
wasRunning:
|
|
731
|
-
pendingActions:
|
|
930
|
+
wasRunning: z22.boolean(),
|
|
931
|
+
pendingActions: z22.int().nonnegative()
|
|
732
932
|
});
|
|
733
|
-
var recoverySchema =
|
|
734
|
-
restoredAt:
|
|
735
|
-
backupTakenAt:
|
|
736
|
-
toCheck:
|
|
933
|
+
var recoverySchema = z22.object({
|
|
934
|
+
restoredAt: z22.date(),
|
|
935
|
+
backupTakenAt: z22.date(),
|
|
936
|
+
toCheck: z22.array(taskToCheckSchema)
|
|
737
937
|
}).nullable();
|
|
738
938
|
|
|
739
939
|
// src/contract/rule-contract.ts
|
|
740
|
-
import { z as
|
|
741
|
-
var ruleIDSchema =
|
|
742
|
-
var revisionSchema =
|
|
743
|
-
var ruleSchema =
|
|
744
|
-
ruleID:
|
|
940
|
+
import { z as z23 } from "zod";
|
|
941
|
+
var ruleIDSchema = z23.string().min(1).max(200);
|
|
942
|
+
var revisionSchema = z23.int().positive();
|
|
943
|
+
var ruleSchema = z23.object({
|
|
944
|
+
ruleID: z23.string(),
|
|
745
945
|
revision: revisionSchema,
|
|
746
|
-
sentence:
|
|
747
|
-
outcome:
|
|
748
|
-
destinations:
|
|
946
|
+
sentence: z23.string(),
|
|
947
|
+
outcome: z23.enum(["allow", "ask", "deny"]),
|
|
948
|
+
destinations: z23.array(z23.string())
|
|
749
949
|
});
|
|
750
950
|
var notFound = { NOT_FOUND: { message: "No rule has this ID", status: 404 } };
|
|
751
951
|
var ruleChange = signedIn.errors(reusedIDErrors).errors({
|
|
@@ -753,157 +953,157 @@ var ruleChange = signedIn.errors(reusedIDErrors).errors({
|
|
|
753
953
|
CONFLICT: {
|
|
754
954
|
message: "The rule changed since the notice showed it",
|
|
755
955
|
status: 409,
|
|
756
|
-
data:
|
|
956
|
+
data: z23.object({ revision: revisionSchema })
|
|
757
957
|
},
|
|
758
958
|
NOT_ALLOWED: {
|
|
759
959
|
message: "The rule takes no such change",
|
|
760
960
|
status: 403,
|
|
761
|
-
data:
|
|
961
|
+
data: z23.object({ reason: z23.enum(["widens", "empty"]) })
|
|
762
962
|
}
|
|
763
963
|
});
|
|
764
|
-
var destinationsSchema =
|
|
964
|
+
var destinationsSchema = z23.array(z23.string().regex(/^\S+$/u)).max(100);
|
|
765
965
|
var ruleContract = {
|
|
766
|
-
readRule: signedIn.errors(notFound).input(
|
|
767
|
-
removeRule: ruleChange.input(
|
|
768
|
-
editRule: ruleChange.input(
|
|
966
|
+
readRule: signedIn.errors(notFound).input(z23.object({ ruleID: ruleIDSchema })).output(ruleSchema),
|
|
967
|
+
removeRule: ruleChange.input(z23.object({ ruleID: ruleIDSchema, revision: revisionSchema, clientActionID: z23.uuid() })).output(z23.object({ ruleID: z23.string() })),
|
|
968
|
+
editRule: ruleChange.input(z23.object({
|
|
769
969
|
ruleID: ruleIDSchema,
|
|
770
970
|
revision: revisionSchema,
|
|
771
971
|
destinations: destinationsSchema,
|
|
772
|
-
clientActionID:
|
|
773
|
-
})).output(
|
|
972
|
+
clientActionID: z23.uuid()
|
|
973
|
+
})).output(z23.object({ ruleID: z23.string(), revision: revisionSchema }))
|
|
774
974
|
};
|
|
775
975
|
|
|
776
976
|
// src/contract/task-schema.ts
|
|
777
|
-
import { z as
|
|
778
|
-
var taskSchema2 =
|
|
779
|
-
error:
|
|
780
|
-
errorLimit:
|
|
781
|
-
errors:
|
|
782
|
-
isWaitingForRetry:
|
|
783
|
-
readCursor:
|
|
784
|
-
reason:
|
|
785
|
-
retryAt:
|
|
786
|
-
stepKey:
|
|
787
|
-
taskID:
|
|
977
|
+
import { z as z24 } from "zod";
|
|
978
|
+
var taskSchema2 = z24.object({
|
|
979
|
+
error: z24.string().optional(),
|
|
980
|
+
errorLimit: z24.int().positive().optional(),
|
|
981
|
+
errors: z24.int().positive().optional(),
|
|
982
|
+
isWaitingForRetry: z24.boolean().optional(),
|
|
983
|
+
readCursor: z24.int().nonnegative().optional(),
|
|
984
|
+
reason: z24.string().optional(),
|
|
985
|
+
retryAt: z24.date().optional(),
|
|
986
|
+
stepKey: z24.string().optional(),
|
|
987
|
+
taskID: z24.string()
|
|
788
988
|
});
|
|
789
989
|
|
|
790
990
|
// src/contract/tool-call-schema.ts
|
|
791
|
-
import { z as
|
|
792
|
-
var jsonObjectSchema =
|
|
793
|
-
var toolCallSchema =
|
|
794
|
-
callID:
|
|
991
|
+
import { z as z25 } from "zod";
|
|
992
|
+
var jsonObjectSchema = z25.record(z25.string(), z25.unknown());
|
|
993
|
+
var toolCallSchema = z25.object({
|
|
994
|
+
callID: z25.string(),
|
|
795
995
|
content: jsonObjectSchema.optional(),
|
|
796
996
|
input: jsonObjectSchema.optional(),
|
|
797
|
-
outcome:
|
|
798
|
-
tool:
|
|
997
|
+
outcome: z25.string().optional(),
|
|
998
|
+
tool: z25.string().optional()
|
|
799
999
|
});
|
|
800
1000
|
|
|
801
1001
|
// src/contract/contract.ts
|
|
802
|
-
var
|
|
803
|
-
var sequenceSchema =
|
|
804
|
-
var threadSchema =
|
|
805
|
-
var imageSchema =
|
|
806
|
-
var imageFilesSchema =
|
|
807
|
-
var imageRefSchema =
|
|
808
|
-
position:
|
|
1002
|
+
var clientActionIDSchema2 = z26.uuid();
|
|
1003
|
+
var sequenceSchema = z26.int().nonnegative();
|
|
1004
|
+
var threadSchema = z26.string().min(1).max(200);
|
|
1005
|
+
var imageSchema = z26.object({ mediaType: z26.enum(imageLimits.mediaTypes) });
|
|
1006
|
+
var imageFilesSchema = z26.array(z26.file());
|
|
1007
|
+
var imageRefSchema = z26.object({
|
|
1008
|
+
position: z26.int().nonnegative(),
|
|
809
1009
|
sequence: sequenceSchema,
|
|
810
1010
|
thread: threadSchema
|
|
811
1011
|
});
|
|
812
|
-
var versionRefSchema =
|
|
813
|
-
itemID:
|
|
814
|
-
version:
|
|
1012
|
+
var versionRefSchema = z26.object({
|
|
1013
|
+
itemID: z26.string().min(1).max(200),
|
|
1014
|
+
version: z26.int().nonnegative()
|
|
815
1015
|
});
|
|
816
|
-
var recallItemSchema = versionRefSchema.extend({ score:
|
|
817
|
-
var recallSchema =
|
|
1016
|
+
var recallItemSchema = versionRefSchema.extend({ score: z26.number().optional() });
|
|
1017
|
+
var recallSchema = z26.object({ items: z26.array(recallItemSchema) });
|
|
818
1018
|
var ratingItemSchema = versionRefSchema.extend({
|
|
819
|
-
hasNote:
|
|
820
|
-
verdict:
|
|
1019
|
+
hasNote: z26.boolean(),
|
|
1020
|
+
verdict: z26.enum(["helpful", "noise", "misleading"])
|
|
821
1021
|
});
|
|
822
|
-
var ratingSchema =
|
|
823
|
-
items:
|
|
824
|
-
ratedBy:
|
|
1022
|
+
var ratingSchema = z26.object({
|
|
1023
|
+
items: z26.array(ratingItemSchema),
|
|
1024
|
+
ratedBy: z26.string().optional(),
|
|
825
1025
|
recalledSequence: sequenceSchema
|
|
826
1026
|
});
|
|
827
|
-
var tokenCountSchema =
|
|
828
|
-
var contextSchema =
|
|
829
|
-
var compactionSchema =
|
|
1027
|
+
var tokenCountSchema = z26.int().nonnegative();
|
|
1028
|
+
var contextSchema = z26.object({ size: tokenCountSchema, window: z26.int().positive() });
|
|
1029
|
+
var compactionSchema = z26.object({
|
|
830
1030
|
postTokens: tokenCountSchema.optional(),
|
|
831
1031
|
preTokens: tokenCountSchema,
|
|
832
|
-
trigger:
|
|
1032
|
+
trigger: z26.enum(["manual", "auto"])
|
|
833
1033
|
});
|
|
834
|
-
var summarySchema =
|
|
1034
|
+
var summarySchema = z26.object({
|
|
835
1035
|
contextSize: tokenCountSchema.optional(),
|
|
836
1036
|
summaryTokens: tokenCountSchema,
|
|
837
|
-
text:
|
|
838
|
-
trigger:
|
|
1037
|
+
text: z26.string().optional(),
|
|
1038
|
+
trigger: z26.enum(["threshold", "overflow"])
|
|
839
1039
|
});
|
|
840
|
-
var compactionFailureSchema =
|
|
841
|
-
var ratingNoteRefSchema =
|
|
842
|
-
itemID:
|
|
1040
|
+
var compactionFailureSchema = z26.object({ failures: z26.int().positive() });
|
|
1041
|
+
var ratingNoteRefSchema = z26.object({
|
|
1042
|
+
itemID: z26.string().min(1).max(200),
|
|
843
1043
|
sequence: sequenceSchema
|
|
844
1044
|
});
|
|
845
1045
|
var ratingNoteSchema = ratingNoteRefSchema.extend({
|
|
846
|
-
status:
|
|
847
|
-
text:
|
|
1046
|
+
status: z26.enum(["readable", "shredded", "unreadable", "missing"]),
|
|
1047
|
+
text: z26.string().optional()
|
|
848
1048
|
});
|
|
849
1049
|
var versionTextSchema = versionRefSchema.extend({
|
|
850
|
-
status:
|
|
851
|
-
text:
|
|
1050
|
+
status: z26.enum(["readable", "shredded", "unreadable", "missing"]),
|
|
1051
|
+
text: z26.string().optional()
|
|
852
1052
|
});
|
|
853
|
-
var listedActionSchema =
|
|
854
|
-
var taskMessageSchema =
|
|
1053
|
+
var listedActionSchema = z26.object({ actionID: z26.string(), tool: z26.string() });
|
|
1054
|
+
var taskMessageSchema = z26.object({
|
|
855
1055
|
from: threadSchema,
|
|
856
|
-
fromName:
|
|
857
|
-
hop:
|
|
858
|
-
kind:
|
|
859
|
-
messageID:
|
|
860
|
-
replyTo:
|
|
861
|
-
text:
|
|
1056
|
+
fromName: z26.string(),
|
|
1057
|
+
hop: z26.int().nonnegative(),
|
|
1058
|
+
kind: z26.string(),
|
|
1059
|
+
messageID: z26.string(),
|
|
1060
|
+
replyTo: z26.string().optional(),
|
|
1061
|
+
text: z26.string().optional(),
|
|
862
1062
|
to: threadSchema,
|
|
863
|
-
woke:
|
|
1063
|
+
woke: z26.boolean()
|
|
864
1064
|
});
|
|
865
|
-
var exchangeNoticeSchema =
|
|
866
|
-
link:
|
|
867
|
-
text:
|
|
1065
|
+
var exchangeNoticeSchema = z26.object({
|
|
1066
|
+
link: z26.object({ label: z26.string(), messageID: z26.string(), taskID: threadSchema }),
|
|
1067
|
+
text: z26.string()
|
|
868
1068
|
});
|
|
869
|
-
var recordSchema =
|
|
1069
|
+
var recordSchema = z26.object({
|
|
870
1070
|
compaction: compactionSchema.optional(),
|
|
871
1071
|
exchangeNotice: exchangeNoticeSchema.optional(),
|
|
872
1072
|
compactionFailure: compactionFailureSchema.optional(),
|
|
873
|
-
forget:
|
|
1073
|
+
forget: z26.object({ sequence: sequenceSchema }).optional(),
|
|
874
1074
|
context: contextSchema.optional(),
|
|
875
|
-
isRemoved:
|
|
876
|
-
isSilentTurn:
|
|
877
|
-
kind:
|
|
878
|
-
message:
|
|
879
|
-
clientMessageId:
|
|
880
|
-
images:
|
|
881
|
-
spans:
|
|
882
|
-
text:
|
|
1075
|
+
isRemoved: z26.literal(true).optional(),
|
|
1076
|
+
isSilentTurn: z26.literal(true).optional(),
|
|
1077
|
+
kind: z26.string(),
|
|
1078
|
+
message: z26.object({
|
|
1079
|
+
clientMessageId: z26.uuid().optional(),
|
|
1080
|
+
images: z26.array(imageSchema).optional(),
|
|
1081
|
+
spans: z26.array(spanSchema).optional(),
|
|
1082
|
+
text: z26.string()
|
|
883
1083
|
}).optional(),
|
|
884
|
-
moment:
|
|
1084
|
+
moment: z26.object({ momentID: z26.string(), shortID: z26.string(), title: z26.string().optional() }).optional(),
|
|
885
1085
|
rating: ratingSchema.optional(),
|
|
886
|
-
proposal:
|
|
1086
|
+
proposal: z26.object({ proposalID: z26.string(), shortID: z26.string() }).optional(),
|
|
887
1087
|
recall: recallSchema.optional(),
|
|
888
|
-
recordedAt:
|
|
1088
|
+
recordedAt: z26.date(),
|
|
889
1089
|
sequence: sequenceSchema,
|
|
890
|
-
stop:
|
|
1090
|
+
stop: z26.object({ cancelledActions: z26.array(listedActionSchema) }).optional(),
|
|
891
1091
|
summary: summarySchema.optional(),
|
|
892
1092
|
thread: threadSchema,
|
|
893
1093
|
task: taskSchema2.optional(),
|
|
894
1094
|
taskMessage: taskMessageSchema.optional(),
|
|
895
1095
|
toolCall: toolCallSchema.optional()
|
|
896
1096
|
});
|
|
897
|
-
var writerErrorSchema =
|
|
898
|
-
var sessionSchema =
|
|
899
|
-
createdAt:
|
|
900
|
-
current:
|
|
901
|
-
deviceName:
|
|
902
|
-
lastUsedAt:
|
|
903
|
-
sessionID:
|
|
1097
|
+
var writerErrorSchema = z26.object({ at: z26.date(), code: z26.string(), message: z26.string().nullable() }).nullable();
|
|
1098
|
+
var sessionSchema = z26.object({
|
|
1099
|
+
createdAt: z26.date(),
|
|
1100
|
+
current: z26.boolean(),
|
|
1101
|
+
deviceName: z26.string(),
|
|
1102
|
+
lastUsedAt: z26.date(),
|
|
1103
|
+
sessionID: z26.uuid()
|
|
904
1104
|
});
|
|
905
1105
|
var checkedAction = signedIn.errors(reusedIDErrors);
|
|
906
|
-
var taskStateSchema2 =
|
|
1106
|
+
var taskStateSchema2 = z26.enum([
|
|
907
1107
|
"ready",
|
|
908
1108
|
"running",
|
|
909
1109
|
"waiting",
|
|
@@ -913,33 +1113,33 @@ var taskStateSchema2 = z13.enum([
|
|
|
913
1113
|
"failed",
|
|
914
1114
|
"closed"
|
|
915
1115
|
]);
|
|
916
|
-
var taskControlSchema =
|
|
917
|
-
var actionCountSchema =
|
|
918
|
-
var forgetPreviewItemSchema =
|
|
919
|
-
var recordForgetPreviewSchema =
|
|
1116
|
+
var taskControlSchema = z26.enum(["pause", "resume", "stop", "restart", "close", "interrupt"]);
|
|
1117
|
+
var actionCountSchema = z26.int().nonnegative();
|
|
1118
|
+
var forgetPreviewItemSchema = z26.object({ itemID: z26.string(), text: z26.string() });
|
|
1119
|
+
var recordForgetPreviewSchema = z26.object({
|
|
920
1120
|
momentCount: actionCountSchema,
|
|
921
|
-
memoryItems:
|
|
1121
|
+
memoryItems: z26.array(forgetPreviewItemSchema)
|
|
922
1122
|
});
|
|
923
|
-
var listedTaskSchema =
|
|
924
|
-
actions:
|
|
1123
|
+
var listedTaskSchema = z26.object({
|
|
1124
|
+
actions: z26.object({
|
|
925
1125
|
cancelled: actionCountSchema,
|
|
926
1126
|
queued: actionCountSchema,
|
|
927
1127
|
started: actionCountSchema
|
|
928
1128
|
}),
|
|
929
|
-
brief:
|
|
930
|
-
controls:
|
|
931
|
-
isPauseRequested:
|
|
932
|
-
isPausedByNixie:
|
|
933
|
-
isTakingMessages:
|
|
934
|
-
lastActivityAt:
|
|
935
|
-
name:
|
|
1129
|
+
brief: z26.string(),
|
|
1130
|
+
controls: z26.array(taskControlSchema),
|
|
1131
|
+
isPauseRequested: z26.boolean(),
|
|
1132
|
+
isPausedByNixie: z26.boolean(),
|
|
1133
|
+
isTakingMessages: z26.boolean(),
|
|
1134
|
+
lastActivityAt: z26.date(),
|
|
1135
|
+
name: z26.string(),
|
|
936
1136
|
state: taskStateSchema2,
|
|
937
1137
|
taskID: threadSchema,
|
|
938
1138
|
waitingOn: threadSchema.optional()
|
|
939
1139
|
});
|
|
940
|
-
var controlledTaskSchema =
|
|
941
|
-
controlledAt:
|
|
942
|
-
isPauseRequested:
|
|
1140
|
+
var controlledTaskSchema = z26.object({
|
|
1141
|
+
controlledAt: z26.date(),
|
|
1142
|
+
isPauseRequested: z26.boolean(),
|
|
943
1143
|
state: taskStateSchema2,
|
|
944
1144
|
taskID: threadSchema
|
|
945
1145
|
});
|
|
@@ -948,53 +1148,53 @@ var taskControl = checkedAction.errors({
|
|
|
948
1148
|
TASK_STATE_REFUSED: {
|
|
949
1149
|
message: "The task is in a state that does not take this control",
|
|
950
1150
|
status: 409,
|
|
951
|
-
data:
|
|
1151
|
+
data: z26.object({ isPauseRequested: z26.boolean(), state: taskStateSchema2 })
|
|
952
1152
|
}
|
|
953
|
-
}).input(
|
|
954
|
-
var nixieControl = checkedAction.input(
|
|
955
|
-
var backupNoticeSchema =
|
|
956
|
-
cause:
|
|
957
|
-
sequence:
|
|
958
|
-
raisedAt:
|
|
959
|
-
});
|
|
960
|
-
var followRecords = signedIn.input(
|
|
1153
|
+
}).input(z26.object({ clientActionID: clientActionIDSchema2, taskID: threadSchema })).output(controlledTaskSchema);
|
|
1154
|
+
var nixieControl = checkedAction.input(z26.object({ clientActionID: clientActionIDSchema2 })).output(z26.object({ paused: pauseStateSchema }));
|
|
1155
|
+
var backupNoticeSchema = z26.object({
|
|
1156
|
+
cause: z26.enum(["failed", "missing"]),
|
|
1157
|
+
sequence: z26.int().positive(),
|
|
1158
|
+
raisedAt: z26.date()
|
|
1159
|
+
});
|
|
1160
|
+
var followRecords = signedIn.input(z26.object({ afterSequence: sequenceSchema, thread: threadSchema.optional() })).output(eventIterator2(z26.object({ record: recordSchema })));
|
|
961
1161
|
var contract = {
|
|
962
1162
|
conversation: {
|
|
963
|
-
read: signedIn.errors({ THREAD_NOT_FOUND: { message: "No thread has this ID", status: 404 } }).input(
|
|
1163
|
+
read: signedIn.errors({ THREAD_NOT_FOUND: { message: "No thread has this ID", status: 404 } }).input(z26.object({
|
|
964
1164
|
beforeSequence: sequenceSchema.optional(),
|
|
965
|
-
limit:
|
|
1165
|
+
limit: z26.int().min(1).max(200).optional(),
|
|
966
1166
|
thread: threadSchema
|
|
967
|
-
})).output(
|
|
968
|
-
hasEarlier:
|
|
1167
|
+
})).output(z26.object({
|
|
1168
|
+
hasEarlier: z26.boolean(),
|
|
969
1169
|
readAtSequence: sequenceSchema,
|
|
970
|
-
records:
|
|
1170
|
+
records: z26.array(recordSchema),
|
|
971
1171
|
lastStepEnd: recordSchema.nullable().optional()
|
|
972
1172
|
})),
|
|
973
1173
|
send: checkedAction.errors({
|
|
974
1174
|
IMAGE_REFUSED: imageRefusedError,
|
|
975
1175
|
THREAD_NOT_FOUND: { message: "No thread has this ID", status: 404 }
|
|
976
|
-
}).input(
|
|
977
|
-
clientMessageId:
|
|
1176
|
+
}).input(z26.object({
|
|
1177
|
+
clientMessageId: clientActionIDSchema2,
|
|
978
1178
|
images: imageFilesSchema.optional(),
|
|
979
|
-
spans:
|
|
980
|
-
text:
|
|
1179
|
+
spans: z26.array(spanSchema).max(1e5),
|
|
1180
|
+
text: z26.string().min(1).max(1e5),
|
|
981
1181
|
thread: threadSchema,
|
|
982
|
-
timeZone:
|
|
983
|
-
writtenAt:
|
|
984
|
-
})).output(
|
|
1182
|
+
timeZone: z26.string().min(1).max(100).optional(),
|
|
1183
|
+
writtenAt: z26.iso.datetime().optional()
|
|
1184
|
+
})).output(z26.object({ duplicate: z26.boolean(), sequence: sequenceSchema })),
|
|
985
1185
|
retry: checkedAction.errors({
|
|
986
1186
|
NOTHING_TO_RETRY: {
|
|
987
1187
|
message: "The last turn of the conversation did not fail, or it runs again already",
|
|
988
1188
|
status: 409
|
|
989
1189
|
}
|
|
990
|
-
}).input(
|
|
991
|
-
readImage: signedIn.errors({ IMAGE_NOT_FOUND: imageNotFoundError }).input(imageRefSchema).output(
|
|
1190
|
+
}).input(z26.object({ clientActionID: clientActionIDSchema2 })).output(z26.object({ retriedAt: z26.date() })),
|
|
1191
|
+
readImage: signedIn.errors({ IMAGE_NOT_FOUND: imageNotFoundError }).input(imageRefSchema).output(z26.file()),
|
|
992
1192
|
previewForget: signedIn.errors({
|
|
993
1193
|
RECORD_NOT_FOUND: {
|
|
994
1194
|
message: "No record on this thread with its own text that a forget removes has this sequence",
|
|
995
1195
|
status: 404
|
|
996
1196
|
}
|
|
997
|
-
}).input(
|
|
1197
|
+
}).input(z26.object({ thread: threadSchema, sequence: sequenceSchema })).output(recordForgetPreviewSchema),
|
|
998
1198
|
forget: checkedAction.errors({
|
|
999
1199
|
RECORD_NOT_FOUND: {
|
|
1000
1200
|
message: "No record on this thread with its own text that a forget removes has this sequence",
|
|
@@ -1004,18 +1204,18 @@ var contract = {
|
|
|
1004
1204
|
message: "The queued action has not run yet. Cancel it, or wait for it to run.",
|
|
1005
1205
|
status: 409
|
|
1006
1206
|
}
|
|
1007
|
-
}).input(
|
|
1008
|
-
clientActionID:
|
|
1207
|
+
}).input(z26.object({
|
|
1208
|
+
clientActionID: clientActionIDSchema2,
|
|
1009
1209
|
sequence: sequenceSchema,
|
|
1010
1210
|
thread: threadSchema
|
|
1011
|
-
})).output(
|
|
1211
|
+
})).output(z26.object({ forgottenAt: z26.date(), backup: forgetBackupSchema }))
|
|
1012
1212
|
},
|
|
1013
1213
|
tasks: {
|
|
1014
|
-
list: signedIn.output(
|
|
1015
|
-
read: signedIn.errors({ TASK_NOT_FOUND: { message: "No task has this ID", status: 404 } }).input(
|
|
1016
|
-
readActions: signedIn.errors({ TASK_NOT_FOUND: { message: "No task has this ID", status: 404 } }).input(
|
|
1017
|
-
queued:
|
|
1018
|
-
started:
|
|
1214
|
+
list: signedIn.output(z26.object({ readAtSequence: sequenceSchema, tasks: z26.array(listedTaskSchema) })),
|
|
1215
|
+
read: signedIn.errors({ TASK_NOT_FOUND: { message: "No task has this ID", status: 404 } }).input(z26.object({ taskID: threadSchema })).output(listedTaskSchema),
|
|
1216
|
+
readActions: signedIn.errors({ TASK_NOT_FOUND: { message: "No task has this ID", status: 404 } }).input(z26.object({ taskID: threadSchema })).output(z26.object({
|
|
1217
|
+
queued: z26.array(listedActionSchema),
|
|
1218
|
+
started: z26.array(listedActionSchema)
|
|
1019
1219
|
})),
|
|
1020
1220
|
pause: taskControl,
|
|
1021
1221
|
resume: taskControl,
|
|
@@ -1027,34 +1227,34 @@ var contract = {
|
|
|
1027
1227
|
interrupt: taskControl
|
|
1028
1228
|
},
|
|
1029
1229
|
memory: {
|
|
1030
|
-
readVersions: signedIn.input(
|
|
1031
|
-
readRatingNotes: signedIn.input(
|
|
1032
|
-
writerStatus: signedIn.output(
|
|
1033
|
-
isEnabled:
|
|
1034
|
-
backlog:
|
|
1035
|
-
batches:
|
|
1230
|
+
readVersions: signedIn.input(z26.object({ versions: z26.array(versionRefSchema).min(1).max(100) })).output(z26.object({ versions: z26.array(versionTextSchema) })),
|
|
1231
|
+
readRatingNotes: signedIn.input(z26.object({ notes: z26.array(ratingNoteRefSchema).min(1).max(100) })).output(z26.object({ notes: z26.array(ratingNoteSchema) })),
|
|
1232
|
+
writerStatus: signedIn.route({ deprecated: true }).output(z26.object({
|
|
1233
|
+
isEnabled: z26.boolean(),
|
|
1234
|
+
backlog: z26.int().nonnegative(),
|
|
1235
|
+
batches: z26.int().nonnegative(),
|
|
1036
1236
|
cursor: sequenceSchema,
|
|
1037
|
-
failures:
|
|
1038
|
-
isCatchingUp:
|
|
1237
|
+
failures: z26.int().nonnegative(),
|
|
1238
|
+
isCatchingUp: z26.boolean(),
|
|
1039
1239
|
lastError: writerErrorSchema,
|
|
1040
|
-
retryAt:
|
|
1240
|
+
retryAt: z26.date().nullable()
|
|
1041
1241
|
})),
|
|
1042
|
-
consolidatorStatus: signedIn.output(z13.object({ isEnabled: z13.boolean() })),
|
|
1043
1242
|
...memoryViewContract
|
|
1044
1243
|
},
|
|
1045
1244
|
nixie: {
|
|
1046
|
-
read: signedIn.output(
|
|
1245
|
+
read: signedIn.output(z26.object({ paused: pauseStateSchema })),
|
|
1047
1246
|
pause: nixieControl,
|
|
1048
1247
|
resume: nixieControl
|
|
1049
1248
|
},
|
|
1050
1249
|
recovery: {
|
|
1051
|
-
read: signedIn.output(
|
|
1250
|
+
read: signedIn.output(z26.object({ recovery: recoverySchema }))
|
|
1052
1251
|
},
|
|
1053
1252
|
backups: {
|
|
1054
|
-
readNotice: signedIn.output(
|
|
1253
|
+
readNotice: signedIn.output(z26.object({ notice: backupNoticeSchema.nullable() }))
|
|
1055
1254
|
},
|
|
1056
1255
|
rules: ruleContract,
|
|
1057
1256
|
approvals: approvalContract,
|
|
1257
|
+
passkeys: passkeyContract,
|
|
1058
1258
|
log: {
|
|
1059
1259
|
follow: followRecords.route({ deprecated: true })
|
|
1060
1260
|
},
|
|
@@ -1067,28 +1267,28 @@ var contract = {
|
|
|
1067
1267
|
message: "The enrolment code is unknown, used or lapsed",
|
|
1068
1268
|
status: 400
|
|
1069
1269
|
}
|
|
1070
|
-
}).input(
|
|
1071
|
-
clientActionID:
|
|
1072
|
-
code:
|
|
1073
|
-
deviceName:
|
|
1074
|
-
tokenDelivery:
|
|
1075
|
-
})).output(
|
|
1076
|
-
issueCode: checkedAction.input(
|
|
1077
|
-
list: signedIn.output(
|
|
1078
|
-
revoke: checkedAction.errors({ SESSION_NOT_FOUND: { message: "No session has this ID", status: 404 } }).input(
|
|
1270
|
+
}).input(z26.object({
|
|
1271
|
+
clientActionID: clientActionIDSchema2,
|
|
1272
|
+
code: z26.string().min(1).max(100),
|
|
1273
|
+
deviceName: z26.string().min(1).max(100),
|
|
1274
|
+
tokenDelivery: z26.enum(["cookie", "bearer"])
|
|
1275
|
+
})).output(z26.object({ sessionID: z26.uuid(), token: z26.string().optional() })),
|
|
1276
|
+
issueCode: checkedAction.input(z26.object({ clientActionID: clientActionIDSchema2 })).output(z26.object({ code: z26.string(), expiresAt: z26.date() })),
|
|
1277
|
+
list: signedIn.output(z26.object({ sessions: z26.array(sessionSchema) })),
|
|
1278
|
+
revoke: checkedAction.errors({ SESSION_NOT_FOUND: { message: "No session has this ID", status: 404 } }).input(z26.object({ clientActionID: clientActionIDSchema2, sessionID: z26.uuid() })).output(z26.object({ revokedAt: z26.date() }))
|
|
1079
1279
|
}
|
|
1080
1280
|
};
|
|
1081
1281
|
// src/contract/host-contract.ts
|
|
1082
|
-
import { oc as
|
|
1083
|
-
import { z as
|
|
1282
|
+
import { oc as oc5 } from "@orpc/contract";
|
|
1283
|
+
import { z as z33 } from "zod";
|
|
1084
1284
|
|
|
1085
1285
|
// src/contract/action-proposal-schema.ts
|
|
1086
|
-
import { z as
|
|
1087
|
-
var actionProposalSchema =
|
|
1088
|
-
proposalID:
|
|
1089
|
-
tool:
|
|
1090
|
-
effects:
|
|
1091
|
-
cause:
|
|
1286
|
+
import { z as z27 } from "zod";
|
|
1287
|
+
var actionProposalSchema = z27.object({
|
|
1288
|
+
proposalID: z27.string(),
|
|
1289
|
+
tool: z27.string(),
|
|
1290
|
+
effects: z27.array(z27.string()),
|
|
1291
|
+
cause: z27.enum([
|
|
1092
1292
|
"outside_steering",
|
|
1093
1293
|
"always_ask",
|
|
1094
1294
|
"ask_rule",
|
|
@@ -1096,33 +1296,55 @@ var actionProposalSchema = z14.object({
|
|
|
1096
1296
|
"direct_request",
|
|
1097
1297
|
"repeat"
|
|
1098
1298
|
]),
|
|
1099
|
-
sentence:
|
|
1100
|
-
destinations:
|
|
1101
|
-
createdAt:
|
|
1102
|
-
lapseAt:
|
|
1299
|
+
sentence: z27.string(),
|
|
1300
|
+
destinations: z27.array(z27.string()),
|
|
1301
|
+
createdAt: z27.date(),
|
|
1302
|
+
lapseAt: z27.date()
|
|
1103
1303
|
});
|
|
1104
1304
|
|
|
1305
|
+
// src/contract/host-passkey-contract.ts
|
|
1306
|
+
import { oc as oc3 } from "@orpc/contract";
|
|
1307
|
+
import { z as z28 } from "zod";
|
|
1308
|
+
var hostPasskeySchema = z28.object({
|
|
1309
|
+
passkeyID: z28.string(),
|
|
1310
|
+
label: z28.string(),
|
|
1311
|
+
synced: z28.boolean(),
|
|
1312
|
+
origin: z28.string(),
|
|
1313
|
+
registeredBy: z28.string(),
|
|
1314
|
+
authorizedBy: z28.string(),
|
|
1315
|
+
registeredAt: z28.date(),
|
|
1316
|
+
lastUsedAt: z28.date().nullable(),
|
|
1317
|
+
revokedAt: z28.date().nullable()
|
|
1318
|
+
});
|
|
1319
|
+
var hostPasskeyContract = {
|
|
1320
|
+
issueCode: oc3.output(z28.object({ code: z28.string(), expiresAt: z28.date() })),
|
|
1321
|
+
list: oc3.output(z28.array(hostPasskeySchema)),
|
|
1322
|
+
revoke: oc3.errors({
|
|
1323
|
+
PASSKEY_NOT_FOUND: { message: "no passkey has that ID", status: 404 }
|
|
1324
|
+
}).input(z28.strictObject({ passkeyID: z28.string().min(1) })).output(z28.object({ passkeyID: z28.string(), revokedAt: z28.date() }))
|
|
1325
|
+
};
|
|
1326
|
+
|
|
1105
1327
|
// src/contract/known-contact-schema.ts
|
|
1106
|
-
import { z as
|
|
1107
|
-
var knownContactSchema =
|
|
1108
|
-
contactID:
|
|
1109
|
-
name:
|
|
1110
|
-
destination:
|
|
1111
|
-
markedAt:
|
|
1328
|
+
import { z as z29 } from "zod";
|
|
1329
|
+
var knownContactSchema = z29.object({
|
|
1330
|
+
contactID: z29.string(),
|
|
1331
|
+
name: z29.string().nullable(),
|
|
1332
|
+
destination: z29.string().nullable(),
|
|
1333
|
+
markedAt: z29.date()
|
|
1112
1334
|
});
|
|
1113
1335
|
|
|
1114
1336
|
// src/contract/turn-inputs-contract.ts
|
|
1115
|
-
import { oc as
|
|
1116
|
-
import { z as
|
|
1337
|
+
import { oc as oc4 } from "@orpc/contract";
|
|
1338
|
+
import { z as z32 } from "zod";
|
|
1117
1339
|
|
|
1118
1340
|
// src/contract/input-miss-schema.ts
|
|
1119
|
-
import { z as
|
|
1120
|
-
var inputMissSchema =
|
|
1121
|
-
missID:
|
|
1122
|
-
captureID:
|
|
1123
|
-
taskID:
|
|
1124
|
-
stepRunID:
|
|
1125
|
-
reason:
|
|
1341
|
+
import { z as z30 } from "zod";
|
|
1342
|
+
var inputMissSchema = z30.object({
|
|
1343
|
+
missID: z30.string(),
|
|
1344
|
+
captureID: z30.string().nullable(),
|
|
1345
|
+
taskID: z30.string(),
|
|
1346
|
+
stepRunID: z30.string(),
|
|
1347
|
+
reason: z30.enum([
|
|
1126
1348
|
"queue_full",
|
|
1127
1349
|
"spool_full",
|
|
1128
1350
|
"spool_write_failed",
|
|
@@ -1134,46 +1356,46 @@ var inputMissSchema = z16.object({
|
|
|
1134
1356
|
"intake_failed",
|
|
1135
1357
|
"holds_own_value"
|
|
1136
1358
|
]),
|
|
1137
|
-
count:
|
|
1138
|
-
writer:
|
|
1139
|
-
counter:
|
|
1140
|
-
createdAt:
|
|
1359
|
+
count: z30.int().positive(),
|
|
1360
|
+
writer: z30.string().nullable(),
|
|
1361
|
+
counter: z30.int().nullable(),
|
|
1362
|
+
createdAt: z30.date()
|
|
1141
1363
|
});
|
|
1142
1364
|
|
|
1143
1365
|
// src/contract/logged-input-schema.ts
|
|
1144
|
-
import { z as
|
|
1145
|
-
var loggedInputSchema =
|
|
1146
|
-
inputID:
|
|
1147
|
-
captureID:
|
|
1148
|
-
taskID:
|
|
1149
|
-
stepRunID:
|
|
1150
|
-
writer:
|
|
1151
|
-
counter:
|
|
1152
|
-
role:
|
|
1153
|
-
profile:
|
|
1154
|
-
model:
|
|
1155
|
-
harness:
|
|
1156
|
-
api:
|
|
1157
|
-
endpoint:
|
|
1158
|
-
route:
|
|
1159
|
-
isRewritten:
|
|
1160
|
-
upstreamStatus:
|
|
1161
|
-
bytes:
|
|
1162
|
-
intakeSequence:
|
|
1163
|
-
receivedAt:
|
|
1164
|
-
takenAt:
|
|
1165
|
-
state:
|
|
1166
|
-
removedCause:
|
|
1366
|
+
import { z as z31 } from "zod";
|
|
1367
|
+
var loggedInputSchema = z31.object({
|
|
1368
|
+
inputID: z31.string(),
|
|
1369
|
+
captureID: z31.string(),
|
|
1370
|
+
taskID: z31.string(),
|
|
1371
|
+
stepRunID: z31.string(),
|
|
1372
|
+
writer: z31.string(),
|
|
1373
|
+
counter: z31.int(),
|
|
1374
|
+
role: z31.string(),
|
|
1375
|
+
profile: z31.string(),
|
|
1376
|
+
model: z31.string(),
|
|
1377
|
+
harness: z31.string(),
|
|
1378
|
+
api: z31.string(),
|
|
1379
|
+
endpoint: z31.string(),
|
|
1380
|
+
route: z31.string(),
|
|
1381
|
+
isRewritten: z31.boolean(),
|
|
1382
|
+
upstreamStatus: z31.int(),
|
|
1383
|
+
bytes: z31.int(),
|
|
1384
|
+
intakeSequence: z31.int(),
|
|
1385
|
+
receivedAt: z31.date(),
|
|
1386
|
+
takenAt: z31.date(),
|
|
1387
|
+
state: z31.enum(["writing", "stored", "missing", "removed"]),
|
|
1388
|
+
removedCause: z31.enum(["retention_days", "retention_bytes", "forget", "dropped", "restore", "reset"]).nullable()
|
|
1167
1389
|
});
|
|
1168
1390
|
|
|
1169
1391
|
// src/contract/turn-inputs-contract.ts
|
|
1170
|
-
var turnInputOn =
|
|
1171
|
-
state:
|
|
1172
|
-
forMs:
|
|
1392
|
+
var turnInputOn = z32.strictObject({
|
|
1393
|
+
state: z32.literal("on"),
|
|
1394
|
+
forMs: z32.int().positive().nullable()
|
|
1173
1395
|
});
|
|
1174
|
-
var turnInputOff =
|
|
1175
|
-
var turnInputSetSchema =
|
|
1176
|
-
var turnInputs =
|
|
1396
|
+
var turnInputOff = z32.strictObject({ state: z32.literal("off"), drop: z32.boolean() });
|
|
1397
|
+
var turnInputSetSchema = z32.discriminatedUnion("state", [turnInputOn, turnInputOff]);
|
|
1398
|
+
var turnInputs = oc4.errors({
|
|
1177
1399
|
NOT_FOUND: { message: "no logged request has that ID", status: 404 },
|
|
1178
1400
|
REMOVED: { message: "that request is removed or its body is missing", status: 410 },
|
|
1179
1401
|
OPEN_NOT_RECORDED: {
|
|
@@ -1182,27 +1404,27 @@ var turnInputs = oc3.errors({
|
|
|
1182
1404
|
},
|
|
1183
1405
|
NOT_CONFIGURED: { message: "the turn-input log is not configured", status: 409 }
|
|
1184
1406
|
});
|
|
1185
|
-
var listedInputsSchema =
|
|
1186
|
-
inputs:
|
|
1187
|
-
misses:
|
|
1407
|
+
var listedInputsSchema = z32.object({
|
|
1408
|
+
inputs: z32.array(loggedInputSchema),
|
|
1409
|
+
misses: z32.array(inputMissSchema)
|
|
1188
1410
|
});
|
|
1189
1411
|
var turnInputsContract = {
|
|
1190
|
-
list: turnInputs.input(
|
|
1191
|
-
open: turnInputs.input(
|
|
1192
|
-
set: turnInputs.input(turnInputSetSchema).output(
|
|
1412
|
+
list: turnInputs.input(z32.strictObject({ limit: z32.int().positive().max(500).default(50) })).output(listedInputsSchema),
|
|
1413
|
+
open: turnInputs.input(z32.strictObject({ inputID: z32.string().min(1) })).output(z32.object({ inputID: z32.string(), body: z32.base64() })),
|
|
1414
|
+
set: turnInputs.input(turnInputSetSchema).output(z32.object({ state: z32.enum(["on", "off"]), until: z32.number().nullable() }))
|
|
1193
1415
|
};
|
|
1194
1416
|
|
|
1195
1417
|
// src/contract/host-contract.ts
|
|
1196
|
-
var versionRefSchema2 =
|
|
1197
|
-
var versionTargetSchema2 =
|
|
1198
|
-
itemID:
|
|
1199
|
-
version:
|
|
1200
|
-
});
|
|
1201
|
-
var itemTextSchema =
|
|
1202
|
-
var proposalOriginSchema2 =
|
|
1203
|
-
var memoryOriginSchema =
|
|
1204
|
-
var contentSourceSchema =
|
|
1205
|
-
var reviewReasonSchema2 =
|
|
1418
|
+
var versionRefSchema2 = z33.object({ itemID: z33.string(), version: z33.int().positive() });
|
|
1419
|
+
var versionTargetSchema2 = z33.strictObject({
|
|
1420
|
+
itemID: z33.string().min(1),
|
|
1421
|
+
version: z33.int().positive()
|
|
1422
|
+
});
|
|
1423
|
+
var itemTextSchema = z33.string().max(2000).regex(/\S/u);
|
|
1424
|
+
var proposalOriginSchema2 = z33.enum(["owner", "conversation", "task"]);
|
|
1425
|
+
var memoryOriginSchema = z33.enum([...proposalOriginSchema2.options, "lapse"]);
|
|
1426
|
+
var contentSourceSchema = z33.enum(["owner", "owner_data", "untrusted"]);
|
|
1427
|
+
var reviewReasonSchema2 = z33.enum([
|
|
1206
1428
|
"no_quote",
|
|
1207
1429
|
"quote_not_typed",
|
|
1208
1430
|
"quote_in_quoted_block",
|
|
@@ -1221,107 +1443,69 @@ var reviewReasonSchema2 = z19.enum([
|
|
|
1221
1443
|
"subject_change",
|
|
1222
1444
|
"ask_rule"
|
|
1223
1445
|
]);
|
|
1224
|
-
var proposalSourceSchema2 =
|
|
1446
|
+
var proposalSourceSchema2 = z33.object({
|
|
1225
1447
|
origin: proposalOriginSchema2,
|
|
1226
|
-
thread:
|
|
1227
|
-
proposedAt:
|
|
1228
|
-
});
|
|
1229
|
-
var pendingProposalSchema =
|
|
1230
|
-
proposalID:
|
|
1231
|
-
operation:
|
|
1232
|
-
itemID:
|
|
1233
|
-
targetVersion:
|
|
1234
|
-
isPinned:
|
|
1235
|
-
subject:
|
|
1236
|
-
newSubject:
|
|
1237
|
-
isSensitive:
|
|
1238
|
-
kind:
|
|
1448
|
+
thread: z33.string().nullable(),
|
|
1449
|
+
proposedAt: z33.date()
|
|
1450
|
+
});
|
|
1451
|
+
var pendingProposalSchema = z33.object({
|
|
1452
|
+
proposalID: z33.string(),
|
|
1453
|
+
operation: z33.enum(["remember", "retire", "pin"]),
|
|
1454
|
+
itemID: z33.string(),
|
|
1455
|
+
targetVersion: z33.int().nullable(),
|
|
1456
|
+
isPinned: z33.boolean(),
|
|
1457
|
+
subject: z33.enum(["owner", "self", "shared"]),
|
|
1458
|
+
newSubject: z33.enum(["owner", "self", "shared"]).nullable(),
|
|
1459
|
+
isSensitive: z33.boolean(),
|
|
1460
|
+
kind: z33.enum(["fact", "self"]),
|
|
1239
1461
|
reason: reviewReasonSchema2,
|
|
1240
|
-
actionHash:
|
|
1462
|
+
actionHash: z33.string(),
|
|
1241
1463
|
origin: proposalOriginSchema2,
|
|
1242
1464
|
source: contentSourceSchema,
|
|
1243
|
-
createdAt:
|
|
1244
|
-
lapseAt:
|
|
1245
|
-
sources:
|
|
1246
|
-
text:
|
|
1247
|
-
quote:
|
|
1248
|
-
});
|
|
1249
|
-
var closeMatchSchema2 =
|
|
1250
|
-
var approvalResultSchema =
|
|
1251
|
-
|
|
1252
|
-
|
|
1465
|
+
createdAt: z33.date(),
|
|
1466
|
+
lapseAt: z33.date(),
|
|
1467
|
+
sources: z33.array(proposalSourceSchema2),
|
|
1468
|
+
text: z33.string(),
|
|
1469
|
+
quote: z33.string().nullable()
|
|
1470
|
+
});
|
|
1471
|
+
var closeMatchSchema2 = z33.object({ itemID: z33.string(), version: z33.int(), text: z33.string() });
|
|
1472
|
+
var approvalResultSchema = z33.discriminatedUnion("status", [
|
|
1473
|
+
z33.object({ status: z33.literal("applied"), itemID: z33.string(), version: z33.int() }),
|
|
1474
|
+
z33.object({ status: z33.literal("close_match"), item: closeMatchSchema2 })
|
|
1253
1475
|
]);
|
|
1254
|
-
var historyVersionSchema =
|
|
1255
|
-
version:
|
|
1256
|
-
change:
|
|
1257
|
-
state:
|
|
1476
|
+
var historyVersionSchema = z33.object({
|
|
1477
|
+
version: z33.int(),
|
|
1478
|
+
change: z33.enum(["created", "edited", "retired", "restored", "undone"]),
|
|
1479
|
+
state: z33.enum(["active", "retired"]),
|
|
1258
1480
|
origin: memoryOriginSchema,
|
|
1259
1481
|
source: contentSourceSchema,
|
|
1260
|
-
recordedAt:
|
|
1261
|
-
status:
|
|
1262
|
-
text:
|
|
1263
|
-
});
|
|
1264
|
-
var itemHistorySchema =
|
|
1265
|
-
itemID:
|
|
1266
|
-
subject:
|
|
1267
|
-
kind:
|
|
1268
|
-
state:
|
|
1269
|
-
versions:
|
|
1270
|
-
});
|
|
1271
|
-
var
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
lapseAt: z19.date(),
|
|
1288
|
-
comment: changeCommentSchema.nullable()
|
|
1289
|
-
});
|
|
1290
|
-
var consolidationDiffSchema = z19.object({
|
|
1291
|
-
diffID: z19.string(),
|
|
1292
|
-
model: z19.string().nullable(),
|
|
1293
|
-
createdAt: z19.date(),
|
|
1294
|
-
changes: z19.array(consolidationChangeSchema),
|
|
1295
|
-
summary: z19.string().nullable()
|
|
1296
|
-
});
|
|
1297
|
-
var changeOutcomeSchema = z19.discriminatedUnion("status", [
|
|
1298
|
-
z19.object({
|
|
1299
|
-
changeID: z19.string(),
|
|
1300
|
-
status: z19.literal("applied"),
|
|
1301
|
-
versions: z19.array(versionRefSchema2)
|
|
1302
|
-
}),
|
|
1303
|
-
z19.object({ changeID: z19.string(), status: z19.literal("refused"), code: z19.string() })
|
|
1304
|
-
]);
|
|
1305
|
-
var changeAnswerSchema = z19.strictObject({
|
|
1306
|
-
changeID: z19.string().min(1),
|
|
1307
|
-
actionHash: z19.string().min(1)
|
|
1308
|
-
});
|
|
1309
|
-
var proposalAnswerSchema = z19.strictObject({
|
|
1310
|
-
proposalID: z19.string().min(1),
|
|
1311
|
-
actionHash: z19.string().min(1)
|
|
1312
|
-
});
|
|
1313
|
-
var hostSessionSchema = z19.object({
|
|
1314
|
-
sessionID: z19.string(),
|
|
1315
|
-
deviceName: z19.string(),
|
|
1316
|
-
createdAt: z19.date(),
|
|
1317
|
-
lastUsedAt: z19.date()
|
|
1318
|
-
});
|
|
1319
|
-
var subjectCountSchema = z19.object({
|
|
1320
|
-
owner: z19.int().nonnegative(),
|
|
1321
|
-
shared: z19.int().nonnegative(),
|
|
1322
|
-
self: z19.int().nonnegative()
|
|
1323
|
-
});
|
|
1324
|
-
var memory = oc4.errors({
|
|
1482
|
+
recordedAt: z33.date(),
|
|
1483
|
+
status: z33.enum(["readable", "shredded", "unreadable"]),
|
|
1484
|
+
text: z33.string().nullable()
|
|
1485
|
+
});
|
|
1486
|
+
var itemHistorySchema = z33.object({
|
|
1487
|
+
itemID: z33.string(),
|
|
1488
|
+
subject: z33.enum(["owner", "self", "shared"]),
|
|
1489
|
+
kind: z33.enum(["fact", "self"]),
|
|
1490
|
+
state: z33.enum(["active", "retired", "forgetting", "forgotten"]),
|
|
1491
|
+
versions: z33.array(historyVersionSchema)
|
|
1492
|
+
});
|
|
1493
|
+
var proposalAnswerSchema = z33.strictObject({
|
|
1494
|
+
proposalID: z33.string().min(1),
|
|
1495
|
+
actionHash: z33.string().min(1)
|
|
1496
|
+
});
|
|
1497
|
+
var hostSessionSchema = z33.object({
|
|
1498
|
+
sessionID: z33.string(),
|
|
1499
|
+
deviceName: z33.string(),
|
|
1500
|
+
createdAt: z33.date(),
|
|
1501
|
+
lastUsedAt: z33.date()
|
|
1502
|
+
});
|
|
1503
|
+
var subjectCountSchema = z33.object({
|
|
1504
|
+
owner: z33.int().nonnegative(),
|
|
1505
|
+
shared: z33.int().nonnegative(),
|
|
1506
|
+
self: z33.int().nonnegative()
|
|
1507
|
+
});
|
|
1508
|
+
var memory = oc5.errors({
|
|
1325
1509
|
MEMORY_NOT_STARTED: { message: "the memory store has not started yet", status: 503 },
|
|
1326
1510
|
NOT_FOUND: { message: "nothing has that ID", status: 404 },
|
|
1327
1511
|
PROPOSAL_HASH: { message: "the action hash names another proposal", status: 409 },
|
|
@@ -1334,30 +1518,30 @@ var memory = oc4.errors({
|
|
|
1334
1518
|
PIN_EDIT: { message: "a pin takes no edited text", status: 400 },
|
|
1335
1519
|
SELF_NOTE_REFUSED: { message: "a self-note never takes that change", status: 409 }
|
|
1336
1520
|
});
|
|
1337
|
-
var skillFileSchema =
|
|
1338
|
-
var pendingSkillProposalSchema =
|
|
1339
|
-
proposalID:
|
|
1340
|
-
name:
|
|
1341
|
-
skillHash:
|
|
1342
|
-
baseHash:
|
|
1343
|
-
files:
|
|
1344
|
-
inForce:
|
|
1345
|
-
skillHash:
|
|
1346
|
-
origin:
|
|
1347
|
-
files:
|
|
1521
|
+
var skillFileSchema = z33.object({ path: z33.string(), text: z33.string() });
|
|
1522
|
+
var pendingSkillProposalSchema = z33.object({
|
|
1523
|
+
proposalID: z33.string(),
|
|
1524
|
+
name: z33.string(),
|
|
1525
|
+
skillHash: z33.string(),
|
|
1526
|
+
baseHash: z33.string().nullable(),
|
|
1527
|
+
files: z33.array(skillFileSchema),
|
|
1528
|
+
inForce: z33.object({
|
|
1529
|
+
skillHash: z33.string(),
|
|
1530
|
+
origin: z33.enum(["definitions", "vendored", "nixie"]),
|
|
1531
|
+
files: z33.array(skillFileSchema)
|
|
1348
1532
|
}).nullable(),
|
|
1349
|
-
untypedToken:
|
|
1350
|
-
thread:
|
|
1351
|
-
provenance:
|
|
1352
|
-
createdAt:
|
|
1353
|
-
lapseAt:
|
|
1354
|
-
isStale:
|
|
1355
|
-
});
|
|
1356
|
-
var skillAnswerSchema =
|
|
1357
|
-
proposalID:
|
|
1358
|
-
skillHash:
|
|
1359
|
-
});
|
|
1360
|
-
var skills =
|
|
1533
|
+
untypedToken: z33.object({ kind: z33.string(), raw: z33.string() }).nullable(),
|
|
1534
|
+
thread: z33.string().nullable(),
|
|
1535
|
+
provenance: z33.object({ runID: z33.string(), callID: z33.string(), profile: z33.string() }),
|
|
1536
|
+
createdAt: z33.date(),
|
|
1537
|
+
lapseAt: z33.date(),
|
|
1538
|
+
isStale: z33.boolean()
|
|
1539
|
+
});
|
|
1540
|
+
var skillAnswerSchema = z33.strictObject({
|
|
1541
|
+
proposalID: z33.string().min(1),
|
|
1542
|
+
skillHash: z33.string().min(1)
|
|
1543
|
+
});
|
|
1544
|
+
var skills = oc5.errors({
|
|
1361
1545
|
NOT_FOUND: { message: "nothing has that ID", status: 404 },
|
|
1362
1546
|
PROPOSAL_HASH: { message: "the skill hash names other files", status: 409 },
|
|
1363
1547
|
PROPOSAL_CLOSED: { message: "the proposal is answered or lapsed", status: 409 },
|
|
@@ -1365,103 +1549,103 @@ var skills = oc4.errors({
|
|
|
1365
1549
|
SKILL_CHECK: { message: "the files fail the seed checks", status: 400 },
|
|
1366
1550
|
WRONG_STATE: { message: "the skill nixie wrote is no longer in force", status: 409 }
|
|
1367
1551
|
});
|
|
1368
|
-
var definitionsSkillSchema =
|
|
1369
|
-
var writtenSkillSchema =
|
|
1370
|
-
approvalID:
|
|
1371
|
-
proposalID:
|
|
1372
|
-
name:
|
|
1373
|
-
skillHash:
|
|
1552
|
+
var definitionsSkillSchema = z33.object({ skillHash: z33.string(), origin: z33.enum(["definitions", "vendored"]) }).nullable();
|
|
1553
|
+
var writtenSkillSchema = z33.object({
|
|
1554
|
+
approvalID: z33.string(),
|
|
1555
|
+
proposalID: z33.string(),
|
|
1556
|
+
name: z33.string(),
|
|
1557
|
+
skillHash: z33.string(),
|
|
1374
1558
|
base: definitionsSkillSchema,
|
|
1375
1559
|
definitions: definitionsSkillSchema,
|
|
1376
|
-
isConflict:
|
|
1377
|
-
pullRequestURL:
|
|
1378
|
-
approvedAt:
|
|
1379
|
-
});
|
|
1380
|
-
var promptPartFileSchema =
|
|
1381
|
-
var promptEntrySchema =
|
|
1382
|
-
var pendingPromptProposalSchema =
|
|
1383
|
-
proposalID:
|
|
1384
|
-
promptID:
|
|
1385
|
-
proposalHash:
|
|
1386
|
-
baseHash:
|
|
1560
|
+
isConflict: z33.boolean(),
|
|
1561
|
+
pullRequestURL: z33.url().nullable(),
|
|
1562
|
+
approvedAt: z33.date()
|
|
1563
|
+
});
|
|
1564
|
+
var promptPartFileSchema = z33.object({ path: z33.string(), text: z33.string() });
|
|
1565
|
+
var promptEntrySchema = z33.record(z33.string(), z33.string());
|
|
1566
|
+
var pendingPromptProposalSchema = z33.object({
|
|
1567
|
+
proposalID: z33.string(),
|
|
1568
|
+
promptID: z33.string(),
|
|
1569
|
+
proposalHash: z33.string(),
|
|
1570
|
+
baseHash: z33.string().nullable(),
|
|
1387
1571
|
entry: promptEntrySchema,
|
|
1388
|
-
files:
|
|
1389
|
-
reason:
|
|
1390
|
-
inForce:
|
|
1391
|
-
thread:
|
|
1392
|
-
provenance:
|
|
1393
|
-
createdAt:
|
|
1394
|
-
lapseAt:
|
|
1395
|
-
isStale:
|
|
1396
|
-
});
|
|
1397
|
-
var promptAnswerSchema =
|
|
1398
|
-
proposalID:
|
|
1399
|
-
proposalHash:
|
|
1400
|
-
});
|
|
1401
|
-
var prompts =
|
|
1572
|
+
files: z33.array(promptPartFileSchema),
|
|
1573
|
+
reason: z33.string(),
|
|
1574
|
+
inForce: z33.object({ parts: promptEntrySchema, template: z33.string().nullable() }).nullable(),
|
|
1575
|
+
thread: z33.string().nullable(),
|
|
1576
|
+
provenance: z33.object({ runID: z33.string(), callID: z33.string(), profile: z33.string() }),
|
|
1577
|
+
createdAt: z33.date(),
|
|
1578
|
+
lapseAt: z33.date(),
|
|
1579
|
+
isStale: z33.boolean()
|
|
1580
|
+
});
|
|
1581
|
+
var promptAnswerSchema = z33.strictObject({
|
|
1582
|
+
proposalID: z33.string().min(1),
|
|
1583
|
+
proposalHash: z33.string().min(1)
|
|
1584
|
+
});
|
|
1585
|
+
var prompts = oc5.errors({
|
|
1402
1586
|
NOT_FOUND: { message: "nothing has that ID", status: 404 },
|
|
1403
1587
|
PROPOSAL_HASH: { message: "the proposal hash names another override", status: 409 },
|
|
1404
1588
|
PROPOSAL_CLOSED: { message: "the proposal is answered or lapsed", status: 409 },
|
|
1405
1589
|
STALE_BASE: { message: "the override in force moved past the proposal", status: 409 },
|
|
1406
1590
|
PROMPT_CHECK: { message: "the override fails the definitions checks", status: 400 }
|
|
1407
1591
|
});
|
|
1408
|
-
var ruleVersionSchema =
|
|
1409
|
-
var ruleInForceSchema =
|
|
1410
|
-
ruleID:
|
|
1411
|
-
revision:
|
|
1412
|
-
ruleHash:
|
|
1413
|
-
sentence:
|
|
1414
|
-
origin:
|
|
1415
|
-
changeID:
|
|
1416
|
-
lastFiredAt:
|
|
1417
|
-
});
|
|
1418
|
-
var ruleConflictSchema =
|
|
1419
|
-
ruleID:
|
|
1420
|
-
changeID:
|
|
1592
|
+
var ruleVersionSchema = z33.object({ ruleHash: z33.string(), sentence: z33.string() }).nullable();
|
|
1593
|
+
var ruleInForceSchema = z33.object({
|
|
1594
|
+
ruleID: z33.string(),
|
|
1595
|
+
revision: z33.int().positive(),
|
|
1596
|
+
ruleHash: z33.string(),
|
|
1597
|
+
sentence: z33.string(),
|
|
1598
|
+
origin: z33.enum(["definitions", "nixie"]),
|
|
1599
|
+
changeID: z33.string().nullable(),
|
|
1600
|
+
lastFiredAt: z33.date().nullable()
|
|
1601
|
+
});
|
|
1602
|
+
var ruleConflictSchema = z33.object({
|
|
1603
|
+
ruleID: z33.string(),
|
|
1604
|
+
changeID: z33.string(),
|
|
1421
1605
|
nixie: ruleVersionSchema,
|
|
1422
1606
|
repo: ruleVersionSchema,
|
|
1423
1607
|
base: ruleVersionSchema,
|
|
1424
|
-
changedBy:
|
|
1425
|
-
reason:
|
|
1426
|
-
changedAt:
|
|
1608
|
+
changedBy: z33.enum(["owner", "nixie"]),
|
|
1609
|
+
reason: z33.string(),
|
|
1610
|
+
changedAt: z33.date()
|
|
1427
1611
|
});
|
|
1428
|
-
var ruleProposalChangeSchema =
|
|
1429
|
-
ruleID:
|
|
1612
|
+
var ruleProposalChangeSchema = z33.object({
|
|
1613
|
+
ruleID: z33.string(),
|
|
1430
1614
|
before: ruleVersionSchema,
|
|
1431
1615
|
after: ruleVersionSchema
|
|
1432
1616
|
});
|
|
1433
|
-
var effectChangeSchema =
|
|
1434
|
-
tool:
|
|
1435
|
-
remove:
|
|
1436
|
-
sentence:
|
|
1617
|
+
var effectChangeSchema = z33.object({
|
|
1618
|
+
tool: z33.string(),
|
|
1619
|
+
remove: z33.array(z33.string()),
|
|
1620
|
+
sentence: z33.string()
|
|
1437
1621
|
});
|
|
1438
|
-
var pendingRuleProposalSchema =
|
|
1439
|
-
proposalID:
|
|
1440
|
-
changes:
|
|
1441
|
-
effectChanges:
|
|
1442
|
-
createdAt:
|
|
1443
|
-
lapseAt:
|
|
1622
|
+
var pendingRuleProposalSchema = z33.object({
|
|
1623
|
+
proposalID: z33.string(),
|
|
1624
|
+
changes: z33.array(ruleProposalChangeSchema),
|
|
1625
|
+
effectChanges: z33.array(effectChangeSchema),
|
|
1626
|
+
createdAt: z33.date(),
|
|
1627
|
+
lapseAt: z33.date()
|
|
1444
1628
|
});
|
|
1445
|
-
var ruleProposalAnswerSchema =
|
|
1629
|
+
var ruleProposalAnswerSchema = z33.strictObject({ proposalID: z33.string().min(1) });
|
|
1446
1630
|
var ruleProposalRejectionSchema = ruleProposalAnswerSchema.extend({
|
|
1447
|
-
reason:
|
|
1631
|
+
reason: z33.string().max(500).regex(/\S/u)
|
|
1448
1632
|
});
|
|
1449
1633
|
var actionRejectionSchema = ruleProposalAnswerSchema.extend({
|
|
1450
|
-
reason:
|
|
1634
|
+
reason: z33.string().max(500).regex(/\S/u).optional()
|
|
1451
1635
|
});
|
|
1452
1636
|
var ruleProposalErrors = {
|
|
1453
1637
|
NOT_FOUND: { message: "nothing has that ID", status: 404 },
|
|
1454
1638
|
PROPOSAL_CLOSED: { message: "the proposal is answered, withdrawn or lapsed", status: 409 }
|
|
1455
1639
|
};
|
|
1456
|
-
var rules =
|
|
1457
|
-
var contacts =
|
|
1640
|
+
var rules = oc5.errors(ruleProposalErrors);
|
|
1641
|
+
var contacts = oc5.errors({
|
|
1458
1642
|
NOT_FOUND: { message: "no known contact has that ID", status: 404 }
|
|
1459
1643
|
});
|
|
1460
|
-
var forgottenItemsSchema =
|
|
1461
|
-
itemIDs:
|
|
1644
|
+
var forgottenItemsSchema = z33.object({
|
|
1645
|
+
itemIDs: z33.array(z33.string()),
|
|
1462
1646
|
backup: forgetBackupSchema
|
|
1463
1647
|
});
|
|
1464
|
-
var hostTaskStateSchema =
|
|
1648
|
+
var hostTaskStateSchema = z33.enum([
|
|
1465
1649
|
"ready",
|
|
1466
1650
|
"running",
|
|
1467
1651
|
"waiting",
|
|
@@ -1471,35 +1655,35 @@ var hostTaskStateSchema = z19.enum([
|
|
|
1471
1655
|
"failed",
|
|
1472
1656
|
"closed"
|
|
1473
1657
|
]);
|
|
1474
|
-
var taskControl2 =
|
|
1658
|
+
var taskControl2 = oc5.errors({
|
|
1475
1659
|
TASK_NOT_FOUND: { message: "no task has that ID", status: 404 },
|
|
1476
1660
|
TASK_STATE_REFUSED: {
|
|
1477
1661
|
message: "the task is in a state that does not take this control",
|
|
1478
1662
|
status: 409
|
|
1479
1663
|
}
|
|
1480
|
-
}).input(
|
|
1481
|
-
taskID:
|
|
1664
|
+
}).input(z33.strictObject({ taskID: z33.string().min(1) })).output(z33.object({
|
|
1665
|
+
taskID: z33.string(),
|
|
1482
1666
|
state: hostTaskStateSchema,
|
|
1483
|
-
isPauseRequested:
|
|
1667
|
+
isPauseRequested: z33.boolean()
|
|
1484
1668
|
}));
|
|
1485
1669
|
var hostContract = {
|
|
1486
|
-
reset:
|
|
1487
|
-
resetAt:
|
|
1488
|
-
lastSequence:
|
|
1489
|
-
keptSessions:
|
|
1670
|
+
reset: oc5.output(z33.object({
|
|
1671
|
+
resetAt: z33.date(),
|
|
1672
|
+
lastSequence: z33.int().nonnegative(),
|
|
1673
|
+
keptSessions: z33.int().nonnegative()
|
|
1490
1674
|
})),
|
|
1491
|
-
resetConversations:
|
|
1492
|
-
resetAt:
|
|
1493
|
-
lastSequence:
|
|
1494
|
-
shreddedRecords:
|
|
1675
|
+
resetConversations: oc5.output(z33.object({
|
|
1676
|
+
resetAt: z33.date(),
|
|
1677
|
+
lastSequence: z33.int().nonnegative(),
|
|
1678
|
+
shreddedRecords: z33.int().nonnegative(),
|
|
1495
1679
|
backup: forgetBackupSchema
|
|
1496
1680
|
})),
|
|
1497
1681
|
nixie: {
|
|
1498
|
-
pause:
|
|
1499
|
-
resume:
|
|
1682
|
+
pause: oc5.output(z33.object({ paused: pauseStateSchema })),
|
|
1683
|
+
resume: oc5.output(z33.object({ paused: pauseStateSchema }))
|
|
1500
1684
|
},
|
|
1501
1685
|
recovery: {
|
|
1502
|
-
read:
|
|
1686
|
+
read: oc5.output(z33.object({ recovery: recoverySchema }))
|
|
1503
1687
|
},
|
|
1504
1688
|
tasks: {
|
|
1505
1689
|
pause: taskControl2,
|
|
@@ -1510,109 +1694,105 @@ var hostContract = {
|
|
|
1510
1694
|
CONVERSATION_NEVER_CLOSES: { message: "the conversation is never closed", status: 409 }
|
|
1511
1695
|
}),
|
|
1512
1696
|
interrupt: taskControl2,
|
|
1513
|
-
raise:
|
|
1697
|
+
raise: oc5.errors({
|
|
1514
1698
|
TASK_NOT_FOUND: { message: "no task has that ID", status: 404 },
|
|
1515
1699
|
TASK_NOT_AT_LIMIT: { message: "the task is not paused at its limit", status: 409 },
|
|
1516
1700
|
LIMIT_NOT_RAISED: { message: "the new limits are not above the old ones", status: 409 }
|
|
1517
|
-
}).input(
|
|
1518
|
-
taskID:
|
|
1519
|
-
turns:
|
|
1520
|
-
dollars:
|
|
1701
|
+
}).input(z33.strictObject({
|
|
1702
|
+
taskID: z33.string().min(1),
|
|
1703
|
+
turns: z33.int().positive().optional(),
|
|
1704
|
+
dollars: z33.number().positive().optional()
|
|
1521
1705
|
}).refine((input) => input.turns !== undefined || input.dollars !== undefined, {
|
|
1522
1706
|
message: "a raise sets turns, dollars or both"
|
|
1523
|
-
})).output(
|
|
1524
|
-
taskID:
|
|
1707
|
+
})).output(z33.object({
|
|
1708
|
+
taskID: z33.string(),
|
|
1525
1709
|
state: hostTaskStateSchema,
|
|
1526
|
-
isPauseRequested:
|
|
1527
|
-
turns:
|
|
1528
|
-
dollars:
|
|
1710
|
+
isPauseRequested: z33.boolean(),
|
|
1711
|
+
turns: z33.int().positive(),
|
|
1712
|
+
dollars: z33.number().positive()
|
|
1529
1713
|
}))
|
|
1530
1714
|
},
|
|
1531
1715
|
sessions: {
|
|
1532
|
-
issueCode:
|
|
1533
|
-
list:
|
|
1534
|
-
label:
|
|
1716
|
+
issueCode: oc5.output(z33.object({ code: z33.string(), expiresAt: z33.date() })),
|
|
1717
|
+
list: oc5.output(z33.array(hostSessionSchema)),
|
|
1718
|
+
label: oc5.errors({
|
|
1535
1719
|
SESSION_NOT_FOUND: {
|
|
1536
1720
|
message: "no device session that is still signed in has that ID",
|
|
1537
1721
|
status: 404
|
|
1538
1722
|
},
|
|
1539
1723
|
LABEL_INVALID: { message: "a label holds 1 to 100 characters besides spaces", status: 400 }
|
|
1540
|
-
}).input(
|
|
1724
|
+
}).input(z33.strictObject({ sessionID: z33.string().min(1), label: z33.string() })).output(z33.object({ sessionID: z33.string(), label: z33.string() }))
|
|
1541
1725
|
},
|
|
1726
|
+
passkeys: hostPasskeyContract,
|
|
1542
1727
|
memory: {
|
|
1543
1728
|
proposals: {
|
|
1544
|
-
list: memory.output(
|
|
1729
|
+
list: memory.output(z33.array(pendingProposalSchema)),
|
|
1545
1730
|
approve: memory.input(proposalAnswerSchema.extend({
|
|
1546
1731
|
revisionOf: versionTargetSchema2.optional(),
|
|
1547
|
-
ignoreCloseMatch:
|
|
1732
|
+
ignoreCloseMatch: z33.boolean().optional(),
|
|
1548
1733
|
editedText: itemTextSchema.optional()
|
|
1549
1734
|
})).output(approvalResultSchema),
|
|
1550
|
-
reject: memory.input(proposalAnswerSchema.extend({ reason:
|
|
1735
|
+
reject: memory.input(proposalAnswerSchema.extend({ reason: z33.string().max(500).regex(/\S/u).optional() })).output(z33.object({ proposalID: z33.string() }))
|
|
1551
1736
|
},
|
|
1552
|
-
subjects: memory.output(
|
|
1737
|
+
subjects: memory.output(z33.object({ items: subjectCountSchema, proposals: subjectCountSchema })),
|
|
1553
1738
|
items: {
|
|
1554
|
-
read: memory.input(
|
|
1739
|
+
read: memory.input(z33.strictObject({ itemID: z33.string().min(1) })).output(itemHistorySchema),
|
|
1555
1740
|
edit: memory.input(versionTargetSchema2.extend({ text: itemTextSchema })).output(versionRefSchema2),
|
|
1556
1741
|
retire: memory.input(versionTargetSchema2).output(versionRefSchema2),
|
|
1557
1742
|
restore: memory.input(versionTargetSchema2).output(versionRefSchema2),
|
|
1558
|
-
forget: memory.input(versionTargetSchema2).output(
|
|
1743
|
+
forget: memory.input(versionTargetSchema2).output(z33.object({ itemID: z33.string(), backup: forgetBackupSchema })),
|
|
1559
1744
|
forgetAll: memory.output(forgottenItemsSchema),
|
|
1560
|
-
pin: memory.input(
|
|
1561
|
-
},
|
|
1562
|
-
consolidation: {
|
|
1563
|
-
read: memory.output(consolidationDiffSchema.nullable()),
|
|
1564
|
-
approve: memory.input(z19.strictObject({ answers: z19.array(changeAnswerSchema).min(1).max(30) })).output(z19.object({ outcomes: z19.array(changeOutcomeSchema) })),
|
|
1565
|
-
reject: memory.input(changeAnswerSchema).output(z19.object({ changeID: z19.string() }))
|
|
1745
|
+
pin: memory.input(z33.strictObject({ itemID: z33.string().min(1), isPinned: z33.boolean() })).output(z33.object({ itemID: z33.string(), isPinned: z33.boolean() }))
|
|
1566
1746
|
}
|
|
1567
1747
|
},
|
|
1568
1748
|
skills: {
|
|
1569
1749
|
proposals: {
|
|
1570
|
-
list: skills.output(
|
|
1571
|
-
approve: skills.input(skillAnswerSchema.extend({ files:
|
|
1572
|
-
reject: skills.input(skillAnswerSchema.extend({ reason:
|
|
1750
|
+
list: skills.output(z33.array(pendingSkillProposalSchema)),
|
|
1751
|
+
approve: skills.input(skillAnswerSchema.extend({ files: z33.array(skillFileSchema).min(1).optional() })).output(z33.object({ proposalID: z33.string(), approvalID: z33.string(), skillHash: z33.string() })),
|
|
1752
|
+
reject: skills.input(skillAnswerSchema.extend({ reason: z33.string().max(500).regex(/\S/u) })).output(z33.object({ proposalID: z33.string() }))
|
|
1573
1753
|
},
|
|
1574
1754
|
written: {
|
|
1575
|
-
list: skills.output(
|
|
1576
|
-
resolve: skills.input(
|
|
1577
|
-
approvalID:
|
|
1578
|
-
keep:
|
|
1579
|
-
})).output(
|
|
1755
|
+
list: skills.output(z33.array(writtenSkillSchema)),
|
|
1756
|
+
resolve: skills.input(z33.strictObject({
|
|
1757
|
+
approvalID: z33.string().min(1),
|
|
1758
|
+
keep: z33.enum(["nixie", "definitions"])
|
|
1759
|
+
})).output(z33.object({ approvalID: z33.string(), keep: z33.enum(["nixie", "definitions"]) }))
|
|
1580
1760
|
}
|
|
1581
1761
|
},
|
|
1582
1762
|
rules: {
|
|
1583
|
-
list: rules.output(
|
|
1584
|
-
conflicts: rules.output(
|
|
1585
|
-
resolve: rules.input(
|
|
1763
|
+
list: rules.output(z33.array(ruleInForceSchema)),
|
|
1764
|
+
conflicts: rules.output(z33.array(ruleConflictSchema)),
|
|
1765
|
+
resolve: rules.input(z33.strictObject({ ruleID: z33.string().min(1), keep: z33.enum(["nixie", "repo"]) })).output(z33.object({ ruleID: z33.string(), changeID: z33.string(), keep: z33.enum(["nixie", "repo"]) })),
|
|
1586
1766
|
proposals: {
|
|
1587
|
-
list: rules.output(
|
|
1588
|
-
approve: rules.input(ruleProposalAnswerSchema).output(
|
|
1589
|
-
reject: rules.input(ruleProposalRejectionSchema).output(
|
|
1767
|
+
list: rules.output(z33.array(pendingRuleProposalSchema)),
|
|
1768
|
+
approve: rules.input(ruleProposalAnswerSchema).output(z33.object({ proposalID: z33.string() })),
|
|
1769
|
+
reject: rules.input(ruleProposalRejectionSchema).output(z33.object({ proposalID: z33.string() }))
|
|
1590
1770
|
}
|
|
1591
1771
|
},
|
|
1592
1772
|
actions: {
|
|
1593
1773
|
proposals: {
|
|
1594
|
-
list: rules.output(
|
|
1595
|
-
approve: rules.input(ruleProposalAnswerSchema).output(
|
|
1596
|
-
reject: rules.input(actionRejectionSchema).output(
|
|
1774
|
+
list: rules.output(z33.array(actionProposalSchema)),
|
|
1775
|
+
approve: rules.input(ruleProposalAnswerSchema).output(z33.object({ proposalID: z33.string() })),
|
|
1776
|
+
reject: rules.input(actionRejectionSchema).output(z33.object({ proposalID: z33.string() }))
|
|
1597
1777
|
}
|
|
1598
1778
|
},
|
|
1599
1779
|
contacts: {
|
|
1600
|
-
list: contacts.output(
|
|
1601
|
-
markKnown: contacts.input(
|
|
1602
|
-
destination:
|
|
1603
|
-
name:
|
|
1604
|
-
})).output(
|
|
1605
|
-
unmark: contacts.input(
|
|
1780
|
+
list: contacts.output(z33.array(knownContactSchema)),
|
|
1781
|
+
markKnown: contacts.input(z33.strictObject({
|
|
1782
|
+
destination: z33.string().min(1).max(500),
|
|
1783
|
+
name: z33.string().min(1).max(200).optional()
|
|
1784
|
+
})).output(z33.object({ contact: knownContactSchema, isNew: z33.boolean() })),
|
|
1785
|
+
unmark: contacts.input(z33.strictObject({ contactID: z33.string().min(1) })).output(z33.object({ contactID: z33.string() }))
|
|
1606
1786
|
},
|
|
1607
1787
|
turnInputs: turnInputsContract,
|
|
1608
1788
|
prompts: {
|
|
1609
1789
|
proposals: {
|
|
1610
|
-
list: prompts.output(
|
|
1790
|
+
list: prompts.output(z33.array(pendingPromptProposalSchema)),
|
|
1611
1791
|
approve: prompts.input(promptAnswerSchema.extend({
|
|
1612
1792
|
entry: promptEntrySchema.optional(),
|
|
1613
|
-
files:
|
|
1614
|
-
})).output(
|
|
1615
|
-
reject: prompts.input(promptAnswerSchema.extend({ reason:
|
|
1793
|
+
files: z33.array(promptPartFileSchema).optional()
|
|
1794
|
+
})).output(z33.object({ proposalID: z33.string(), approvalID: z33.string(), proposalHash: z33.string() })),
|
|
1795
|
+
reject: prompts.input(promptAnswerSchema.extend({ reason: z33.string().max(500).regex(/\S/u) })).output(z33.object({ proposalID: z33.string() }))
|
|
1616
1796
|
}
|
|
1617
1797
|
}
|
|
1618
1798
|
};
|
|
@@ -1634,11 +1814,11 @@ function renderSessionCookie(token) {
|
|
|
1634
1814
|
return `${sessionCookieName}=${token ?? ""}; Path=/; HttpOnly; Secure; SameSite=Lax; Max-Age=${maxAgeS}`;
|
|
1635
1815
|
}
|
|
1636
1816
|
// src/message/task-message-input-schema.ts
|
|
1637
|
-
import { z as
|
|
1817
|
+
import { z as z35 } from "zod";
|
|
1638
1818
|
|
|
1639
1819
|
// src/message/task-message-kind-schema.ts
|
|
1640
|
-
import { z as
|
|
1641
|
-
var taskMessageKindSchema =
|
|
1820
|
+
import { z as z34 } from "zod";
|
|
1821
|
+
var taskMessageKindSchema = z34.enum([
|
|
1642
1822
|
"progress",
|
|
1643
1823
|
"question",
|
|
1644
1824
|
"request",
|
|
@@ -1648,21 +1828,21 @@ var taskMessageKindSchema = z20.enum([
|
|
|
1648
1828
|
]);
|
|
1649
1829
|
|
|
1650
1830
|
// src/message/task-message-input-schema.ts
|
|
1651
|
-
var taskMessageInputSchema =
|
|
1652
|
-
to:
|
|
1831
|
+
var taskMessageInputSchema = z35.object({
|
|
1832
|
+
to: z35.string(),
|
|
1653
1833
|
kind: taskMessageKindSchema,
|
|
1654
|
-
body:
|
|
1655
|
-
replyTo:
|
|
1656
|
-
onBehalfOf:
|
|
1657
|
-
wake:
|
|
1834
|
+
body: z35.string(),
|
|
1835
|
+
replyTo: z35.string().optional(),
|
|
1836
|
+
onBehalfOf: z35.string().array().optional(),
|
|
1837
|
+
wake: z35.boolean().optional()
|
|
1658
1838
|
});
|
|
1659
1839
|
// src/message/task-message-result-schema.ts
|
|
1660
|
-
import { z as
|
|
1661
|
-
var taskMessageResultSchema =
|
|
1662
|
-
messageID:
|
|
1663
|
-
woke:
|
|
1664
|
-
hop:
|
|
1665
|
-
note:
|
|
1840
|
+
import { z as z36 } from "zod";
|
|
1841
|
+
var taskMessageResultSchema = z36.object({
|
|
1842
|
+
messageID: z36.string(),
|
|
1843
|
+
woke: z36.boolean(),
|
|
1844
|
+
hop: z36.int().nonnegative(),
|
|
1845
|
+
note: z36.string().optional()
|
|
1666
1846
|
});
|
|
1667
1847
|
export {
|
|
1668
1848
|
buildPendingInput,
|