@heynixie/contract 0.78.0 → 0.79.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/index.js CHANGED
@@ -182,7 +182,7 @@ var forgettableKinds = [
182
182
  ];
183
183
  // src/contract/contract.ts
184
184
  import { eventIterator as eventIterator2, oc as oc2 } from "@orpc/contract";
185
- import { z as z37 } from "zod";
185
+ import { z as z38 } from "zod";
186
186
 
187
187
  // src/span/span-schema.ts
188
188
  import { z } from "zod";
@@ -540,7 +540,17 @@ var versionTargetSchema = z8.object({
540
540
  });
541
541
  var versionResultSchema = z8.object({ itemID: z8.string(), version: z8.int().positive() });
542
542
  var noticeEntrySchema = z8.object({
543
- change: z8.enum(["created", "edited", "retired", "restored", "undone", "proposed"]),
543
+ change: z8.enum([
544
+ "created",
545
+ "edited",
546
+ "retired",
547
+ "restored",
548
+ "undone",
549
+ "proposed",
550
+ "labelled",
551
+ "pinned",
552
+ "unpinned"
553
+ ]),
544
554
  isKept: z8.boolean(),
545
555
  item: memoryItemSchema.extend({ change: z8.enum(["created", "edited", "retired", "restored", "undone"]) }).nullable(),
546
556
  itemID: z8.string(),
@@ -1240,40 +1250,80 @@ var ruleContract = {
1240
1250
  endMandate: signedIn.errors(reusedIDErrors).errors({ NOT_FOUND: { message: "No mandate has this ID", status: 404 } }).input(z30.object({ mandateID: z30.string().min(1).max(64), clientActionID: z30.uuid() })).output(z30.object({ mandateID: z30.string(), state: z30.enum(["ended", "expired"]) }))
1241
1251
  };
1242
1252
 
1243
- // src/contract/task-schema.ts
1253
+ // src/contract/spend-stop-schema.ts
1244
1254
  import { z as z31 } from "zod";
1245
- var taskSchema2 = z31.object({
1246
- error: z31.string().optional(),
1247
- errorLimit: z31.int().positive().optional(),
1248
- errors: z31.int().positive().optional(),
1249
- isWaitingForRetry: z31.boolean().optional(),
1250
- readCursor: z31.int().nonnegative().optional(),
1251
- reason: z31.string().optional(),
1252
- retryAt: z31.date().optional(),
1253
- stepKey: z31.string().optional(),
1254
- taskID: z31.string()
1255
+ var triple = z31.object({ dollars: z31.number(), tokens: z31.number(), turns: z31.number() });
1256
+ var spendStopSchema = z31.discriminatedUnion("state", [
1257
+ z31.object({ state: z31.literal("clear") }),
1258
+ z31.object({ state: z31.literal("unreachable") }),
1259
+ z31.object({ state: z31.literal("lost") }),
1260
+ z31.object({
1261
+ state: z31.literal("tripped"),
1262
+ period: z31.enum(["day", "month"]),
1263
+ start: z31.string(),
1264
+ measure: z31.enum(["dollars", "tokens", "turns"]),
1265
+ limit: z31.number(),
1266
+ spent: z31.number(),
1267
+ at: z31.date(),
1268
+ resetsAt: z31.date(),
1269
+ canRaise: z31.boolean(),
1270
+ limits: triple,
1271
+ used: triple,
1272
+ cap: triple
1273
+ })
1274
+ ]);
1275
+ var spendRaiseInputSchema = z31.object({
1276
+ start: z31.string().regex(/^\d{4}-\d{2}-\d{2}$/u),
1277
+ dollars: z31.number().positive(),
1278
+ tokens: z31.int().positive(),
1279
+ turns: z31.int().positive()
1280
+ });
1281
+ var spendRaiseOutputSchema = z31.union([
1282
+ z31.object({ state: z31.literal("clear") }),
1283
+ z31.object({ state: z31.literal("stopped") }),
1284
+ z31.object({ error: z31.literal("above_cap"), cap: triple }),
1285
+ z31.object({ error: z31.literal("period_ended") }),
1286
+ z31.object({ error: z31.literal("unreachable") })
1287
+ ]);
1288
+ var spendStopStandsError = {
1289
+ message: "Model spending is stopped, and nixie resumes when the stop clears",
1290
+ status: 409
1291
+ };
1292
+
1293
+ // src/contract/task-schema.ts
1294
+ import { z as z32 } from "zod";
1295
+ var taskSchema2 = z32.object({
1296
+ error: z32.string().optional(),
1297
+ errorLimit: z32.int().positive().optional(),
1298
+ errors: z32.int().positive().optional(),
1299
+ isWaitingForRetry: z32.boolean().optional(),
1300
+ readCursor: z32.int().nonnegative().optional(),
1301
+ reason: z32.string().optional(),
1302
+ retryAt: z32.date().optional(),
1303
+ stepKey: z32.string().optional(),
1304
+ taskID: z32.string()
1255
1305
  });
1256
1306
 
1257
1307
  // src/contract/tool-call-schema.ts
1258
- import { z as z32 } from "zod";
1259
- var jsonObjectSchema2 = z32.record(z32.string(), z32.unknown());
1260
- var toolCallSchema = z32.object({
1261
- callID: z32.string(),
1308
+ import { z as z33 } from "zod";
1309
+ var jsonObjectSchema2 = z33.record(z33.string(), z33.unknown());
1310
+ var toolCallSchema = z33.object({
1311
+ callID: z33.string(),
1262
1312
  content: jsonObjectSchema2.optional(),
1263
1313
  input: jsonObjectSchema2.optional(),
1264
- outcome: z32.string().optional(),
1265
- runID: z32.string().optional(),
1266
- tool: z32.string().optional()
1314
+ outcome: z33.string().optional(),
1315
+ runID: z33.string().optional(),
1316
+ tool: z33.string().optional()
1267
1317
  });
1268
1318
 
1269
1319
  // src/contract/view-contract.ts
1270
- import { z as z35 } from "zod";
1320
+ import { z as z36 } from "zod";
1271
1321
 
1272
1322
  // src/contract/trigger-schema.ts
1273
- import { z as z34 } from "zod";
1323
+ import { z as z35 } from "zod";
1274
1324
 
1275
1325
  // src/contract/schedule-schema.ts
1276
- import { z as z33 } from "zod";
1326
+ import { z as z34 } from "zod";
1277
1327
 
1278
1328
  // src/contract/is-time-zone.ts
1279
1329
  function isTimeZone(zone) {
@@ -1285,19 +1335,19 @@ function isTimeZone(zone) {
1285
1335
  }
1286
1336
 
1287
1337
  // src/contract/schedule-schema.ts
1288
- var clockTimeSchema = z33.string().regex(/^(?:[01]\d|2[0-3]):[0-5]\d$/u, "a time is HH:MM, 24-hour");
1289
- var minutesSchema = z33.strictObject({
1290
- minutes: z33.int().min(5).max(1440)
1338
+ var clockTimeSchema = z34.string().regex(/^(?:[01]\d|2[0-3]):[0-5]\d$/u, "a time is HH:MM, 24-hour");
1339
+ var minutesSchema = z34.strictObject({
1340
+ minutes: z34.int().min(5).max(1440)
1291
1341
  });
1292
- var weekdaySchema = z33.enum(["mon", "tue", "wed", "thu", "fri", "sat", "sun"]);
1293
- var scheduleSchema = z33.strictObject({
1294
- every: z33.union([z33.enum(["day", "week", "hour"]), minutesSchema]),
1342
+ var weekdaySchema = z34.enum(["mon", "tue", "wed", "thu", "fri", "sat", "sun"]);
1343
+ var scheduleSchema = z34.strictObject({
1344
+ every: z34.union([z34.enum(["day", "week", "hour"]), minutesSchema]),
1295
1345
  at: clockTimeSchema.optional(),
1296
1346
  on: weekdaySchema.optional(),
1297
- window: z33.strictObject({ from: clockTimeSchema, until: clockTimeSchema }).optional(),
1298
- idleMinutes: z33.int().min(1).max(720).optional(),
1299
- zone: z33.string().refine((zone) => zone === "owner" || isTimeZone(zone), "a zone is owner or an IANA zone").default("owner"),
1300
- catchUp: z33.enum(["once", "skip"]).default("once")
1347
+ window: z34.strictObject({ from: clockTimeSchema, until: clockTimeSchema }).optional(),
1348
+ idleMinutes: z34.int().min(1).max(720).optional(),
1349
+ zone: z34.string().refine((zone) => zone === "owner" || isTimeZone(zone), "a zone is owner or an IANA zone").default("owner"),
1350
+ catchUp: z34.enum(["once", "skip"]).default("once")
1301
1351
  }).superRefine((schedule, context) => {
1302
1352
  const isCalendar = schedule.every === "day" || schedule.every === "week";
1303
1353
  if (isCalendar && schedule.at === undefined && schedule.window === undefined) {
@@ -1324,206 +1374,206 @@ var scheduleSchema = z33.strictObject({
1324
1374
  });
1325
1375
 
1326
1376
  // src/contract/trigger-schema.ts
1327
- var triggerAtSchema = z34.iso.datetime({ offset: true });
1328
- var triggerSchema = z34.union([
1329
- z34.strictObject({ schedule: scheduleSchema }),
1330
- z34.strictObject({ at: triggerAtSchema })
1377
+ var triggerAtSchema = z35.iso.datetime({ offset: true });
1378
+ var triggerSchema = z35.union([
1379
+ z35.strictObject({ schedule: scheduleSchema }),
1380
+ z35.strictObject({ at: triggerAtSchema })
1331
1381
  ]);
1332
1382
 
1333
1383
  // src/contract/view-contract.ts
1334
- var skipReasonSchema = z35.enum([
1384
+ var skipReasonSchema = z36.enum([
1335
1385
  "too_late",
1336
1386
  "catch_up_off",
1337
1387
  "window_closed",
1338
1388
  "still_running",
1339
1389
  "task_held"
1340
1390
  ]);
1341
- var endedRunSchema = z35.object({
1342
- runID: z35.string(),
1391
+ var endedRunSchema = z36.object({
1392
+ runID: z36.string(),
1343
1393
  taskID: threadSchema,
1344
- definitionID: z35.string().nullable(),
1345
- startedAt: z35.date(),
1346
- endedAt: z35.date(),
1394
+ definitionID: z36.string().nullable(),
1395
+ startedAt: z36.date(),
1396
+ endedAt: z36.date(),
1347
1397
  sequence: sequenceSchema,
1348
- cause: z35.string(),
1349
- endedBy: z35.string(),
1350
- carriesRunID: z35.string().nullable(),
1351
- reportID: z35.string(),
1352
- delivery: z35.enum(["wake", "next_turn", "kept"]),
1398
+ cause: z36.string(),
1399
+ endedBy: z36.string(),
1400
+ carriesRunID: z36.string().nullable(),
1401
+ reportID: z36.string(),
1402
+ delivery: z36.enum(["wake", "next_turn", "kept"]),
1353
1403
  fire: runFireSchema.nullable(),
1354
- used: z35.object({ turns: z35.number(), dollars: z35.number() })
1355
- });
1356
- var reportEntrySchema = z35.object({
1357
- definitionID: z35.string(),
1358
- name: z35.string(),
1359
- kind: z35.enum(["late", "skipped"]),
1360
- scheduledFor: z35.string(),
1361
- firedAt: z35.string().nullable(),
1362
- lateBySeconds: z35.number().nullable(),
1404
+ used: z36.object({ turns: z36.number(), dollars: z36.number() })
1405
+ });
1406
+ var reportEntrySchema = z36.object({
1407
+ definitionID: z36.string(),
1408
+ name: z36.string(),
1409
+ kind: z36.enum(["late", "skipped"]),
1410
+ scheduledFor: z36.string(),
1411
+ firedAt: z36.string().nullable(),
1412
+ lateBySeconds: z36.number().nullable(),
1363
1413
  reason: skipReasonSchema.nullable(),
1364
1414
  sequence: sequenceSchema
1365
1415
  });
1366
- var listedDefinitionSchema = z35.object({
1367
- definitionID: z35.string(),
1368
- name: z35.string(),
1369
- enabled: z35.boolean(),
1370
- target: z35.enum(["task", "conversation"]),
1416
+ var listedDefinitionSchema = z36.object({
1417
+ definitionID: z36.string(),
1418
+ name: z36.string(),
1419
+ enabled: z36.boolean(),
1420
+ target: z36.enum(["task", "conversation"]),
1371
1421
  trigger: triggerSchema.nullable(),
1372
- rendered: z35.string().nullable(),
1373
- next: z35.string().nullable(),
1374
- tools: z35.array(z35.string()),
1375
- origin: z35.enum(["definitions", "nixie"]),
1376
- createdBy: z35.object({
1422
+ rendered: z36.string().nullable(),
1423
+ next: z36.string().nullable(),
1424
+ tools: z36.array(z36.string()),
1425
+ origin: z36.enum(["definitions", "nixie"]),
1426
+ createdBy: z36.object({
1377
1427
  sequence: sequenceSchema,
1378
- kind: z35.enum(["definition.changed", "definitions_seeded"])
1428
+ kind: z36.enum(["definition.changed", "definitions_seeded"])
1379
1429
  }),
1380
1430
  taskID: threadSchema.nullable(),
1381
- isUnreadable: z35.boolean()
1431
+ isUnreadable: z36.boolean()
1382
1432
  });
1383
1433
  var viewContract = {
1384
1434
  tasks: {
1385
- listEnded: signedIn.input(z35.object({
1386
- limit: z35.int().min(1).max(100),
1435
+ listEnded: signedIn.input(z36.object({
1436
+ limit: z36.int().min(1).max(100),
1387
1437
  before: sequenceSchema.optional(),
1388
- definitionID: z35.string().min(1).max(200).optional()
1389
- })).output(z35.object({
1390
- tasks: z35.array(listedTaskSchema),
1391
- runs: z35.array(endedRunSchema),
1438
+ definitionID: z36.string().min(1).max(200).optional()
1439
+ })).output(z36.object({
1440
+ tasks: z36.array(listedTaskSchema),
1441
+ runs: z36.array(endedRunSchema),
1392
1442
  next: sequenceSchema.nullable()
1393
1443
  }))
1394
1444
  },
1395
1445
  triggers: {
1396
- report: signedIn.input(z35.object({
1397
- since: z35.string().regex(/^\d{4}-\d{2}-\d{2}$/u),
1398
- definitionID: z35.string().min(1).max(200).optional()
1399
- })).output(z35.object({ entries: z35.array(reportEntrySchema) }))
1446
+ report: signedIn.input(z36.object({
1447
+ since: z36.string().regex(/^\d{4}-\d{2}-\d{2}$/u),
1448
+ definitionID: z36.string().min(1).max(200).optional()
1449
+ })).output(z36.object({ entries: z36.array(reportEntrySchema) }))
1400
1450
  },
1401
1451
  definitions: {
1402
- listTasks: signedIn.output(z35.object({ definitions: z35.array(listedDefinitionSchema) }))
1452
+ listTasks: signedIn.output(z36.object({ definitions: z36.array(listedDefinitionSchema) }))
1403
1453
  }
1404
1454
  };
1405
1455
 
1406
1456
  // src/contract/worker-view-schema.ts
1407
- import { z as z36 } from "zod";
1408
- var usedSchema = z36.object({
1409
- minutes: z36.number(),
1410
- turns: z36.number(),
1411
- tokens: z36.number(),
1412
- dollars: z36.number()
1413
- });
1414
- var startedSchema = z36.object({
1415
- phase: z36.literal("started"),
1416
- workerRunID: z36.string(),
1417
- shortID: z36.string(),
1418
- callID: z36.string(),
1419
- model: z36.string(),
1420
- tools: z36.array(z36.string()),
1457
+ import { z as z37 } from "zod";
1458
+ var usedSchema = z37.object({
1459
+ minutes: z37.number(),
1460
+ turns: z37.number(),
1461
+ tokens: z37.number(),
1462
+ dollars: z37.number()
1463
+ });
1464
+ var startedSchema = z37.object({
1465
+ phase: z37.literal("started"),
1466
+ workerRunID: z37.string(),
1467
+ shortID: z37.string(),
1468
+ callID: z37.string(),
1469
+ model: z37.string(),
1470
+ tools: z37.array(z37.string()),
1421
1471
  limits: usedSchema,
1422
- isTaskLimit: z36.boolean()
1423
- });
1424
- var turnSchema = z36.object({
1425
- phase: z36.literal("turn"),
1426
- workerRunID: z36.string(),
1427
- callID: z36.string(),
1428
- turn: z36.number(),
1429
- tokens: z36.number(),
1430
- dollars: z36.number(),
1431
- text: z36.string().optional()
1432
- });
1433
- var endedSchema = z36.object({
1434
- phase: z36.literal("ended"),
1435
- workerRunID: z36.string(),
1436
- callID: z36.string(),
1437
- outcome: z36.string(),
1438
- limit: z36.string().optional(),
1472
+ isTaskLimit: z37.boolean()
1473
+ });
1474
+ var turnSchema = z37.object({
1475
+ phase: z37.literal("turn"),
1476
+ workerRunID: z37.string(),
1477
+ callID: z37.string(),
1478
+ turn: z37.number(),
1479
+ tokens: z37.number(),
1480
+ dollars: z37.number(),
1481
+ text: z37.string().optional()
1482
+ });
1483
+ var endedSchema = z37.object({
1484
+ phase: z37.literal("ended"),
1485
+ workerRunID: z37.string(),
1486
+ callID: z37.string(),
1487
+ outcome: z37.string(),
1488
+ limit: z37.string().optional(),
1439
1489
  used: usedSchema,
1440
- detail: z36.string().optional()
1490
+ detail: z37.string().optional()
1441
1491
  });
1442
- var workerViewSchema = z36.discriminatedUnion("phase", [
1492
+ var workerViewSchema = z37.discriminatedUnion("phase", [
1443
1493
  startedSchema,
1444
1494
  turnSchema,
1445
1495
  endedSchema
1446
1496
  ]);
1447
1497
 
1448
1498
  // src/contract/contract.ts
1449
- var clientActionIDSchema2 = z37.uuid();
1450
- var imageSchema = z37.object({ mediaType: z37.enum(imageLimits.mediaTypes) });
1451
- var imageFilesSchema = z37.array(z37.file());
1452
- var imageRefSchema = z37.object({
1453
- position: z37.int().nonnegative(),
1499
+ var clientActionIDSchema2 = z38.uuid();
1500
+ var imageSchema = z38.object({ mediaType: z38.enum(imageLimits.mediaTypes) });
1501
+ var imageFilesSchema = z38.array(z38.file());
1502
+ var imageRefSchema = z38.object({
1503
+ position: z38.int().nonnegative(),
1454
1504
  sequence: sequenceSchema,
1455
1505
  thread: threadSchema
1456
1506
  });
1457
- var versionRefSchema = z37.object({
1458
- itemID: z37.string().min(1).max(200),
1459
- version: z37.int().nonnegative()
1507
+ var versionRefSchema = z38.object({
1508
+ itemID: z38.string().min(1).max(200),
1509
+ version: z38.int().nonnegative()
1460
1510
  });
1461
- var recallItemSchema = versionRefSchema.extend({ score: z37.number().optional() });
1462
- var recallSchema = z37.object({ items: z37.array(recallItemSchema) });
1463
- var tokenCountSchema = z37.int().nonnegative();
1464
- var contextSchema = z37.object({ size: tokenCountSchema, window: z37.int().positive() });
1465
- var compactionSchema = z37.object({
1511
+ var recallItemSchema = versionRefSchema.extend({ score: z38.number().optional() });
1512
+ var recallSchema = z38.object({ items: z38.array(recallItemSchema) });
1513
+ var tokenCountSchema = z38.int().nonnegative();
1514
+ var contextSchema = z38.object({ size: tokenCountSchema, window: z38.int().positive() });
1515
+ var compactionSchema = z38.object({
1466
1516
  postTokens: tokenCountSchema.optional(),
1467
1517
  preTokens: tokenCountSchema,
1468
- trigger: z37.enum(["manual", "auto"])
1518
+ trigger: z38.enum(["manual", "auto"])
1469
1519
  });
1470
- var summarySchema = z37.object({
1520
+ var summarySchema = z38.object({
1471
1521
  contextSize: tokenCountSchema.optional(),
1472
1522
  summaryTokens: tokenCountSchema,
1473
- text: z37.string().optional(),
1474
- trigger: z37.enum(["threshold", "overflow"])
1523
+ text: z38.string().optional(),
1524
+ trigger: z38.enum(["threshold", "overflow"])
1475
1525
  });
1476
- var compactionFailureSchema = z37.object({ failures: z37.int().positive() });
1526
+ var compactionFailureSchema = z38.object({ failures: z38.int().positive() });
1477
1527
  var versionTextSchema = versionRefSchema.extend({
1478
- status: z37.enum(["readable", "shredded", "unreadable", "missing"]),
1479
- text: z37.string().optional()
1528
+ status: z38.enum(["readable", "shredded", "unreadable", "missing"]),
1529
+ text: z38.string().optional()
1480
1530
  });
1481
- var listedActionSchema = z37.object({ actionID: z37.string(), tool: z37.string() });
1482
- var taskMessageSchema = z37.object({
1531
+ var listedActionSchema = z38.object({ actionID: z38.string(), tool: z38.string() });
1532
+ var taskMessageSchema = z38.object({
1483
1533
  from: threadSchema,
1484
- fromName: z37.string(),
1485
- hop: z37.int().nonnegative(),
1486
- kind: z37.string(),
1487
- messageID: z37.string(),
1488
- replyTo: z37.string().optional(),
1489
- text: z37.string().optional(),
1534
+ fromName: z38.string(),
1535
+ hop: z38.int().nonnegative(),
1536
+ kind: z38.string(),
1537
+ messageID: z38.string(),
1538
+ replyTo: z38.string().optional(),
1539
+ text: z38.string().optional(),
1490
1540
  to: threadSchema,
1491
- woke: z37.boolean()
1541
+ woke: z38.boolean()
1492
1542
  });
1493
- var exchangeNoticeSchema = z37.object({
1494
- link: z37.object({ label: z37.string(), messageID: z37.string(), taskID: threadSchema }),
1495
- text: z37.string()
1543
+ var exchangeNoticeSchema = z38.object({
1544
+ link: z38.object({ label: z38.string(), messageID: z38.string(), taskID: threadSchema }),
1545
+ text: z38.string()
1496
1546
  });
1497
- var reminderSchema = z37.object({
1498
- brief: z37.string(),
1499
- scheduledFor: z37.iso.datetime({ offset: true }),
1500
- lateBySeconds: z37.number().nullable()
1547
+ var reminderSchema = z38.object({
1548
+ brief: z38.string(),
1549
+ scheduledFor: z38.iso.datetime({ offset: true }),
1550
+ lateBySeconds: z38.number().nullable()
1501
1551
  });
1502
- var recordSchema = z37.object({
1503
- clipped: z37.array(clippedPayloadSchema).optional(),
1552
+ var recordSchema = z38.object({
1553
+ clipped: z38.array(clippedPayloadSchema).optional(),
1504
1554
  compaction: compactionSchema.optional(),
1505
1555
  exchangeNotice: exchangeNoticeSchema.optional(),
1506
1556
  reminder: reminderSchema.optional(),
1507
1557
  compactionFailure: compactionFailureSchema.optional(),
1508
- forget: z37.object({ sequence: sequenceSchema }).optional(),
1558
+ forget: z38.object({ sequence: sequenceSchema }).optional(),
1509
1559
  context: contextSchema.optional(),
1510
1560
  definitionNotice: definitionNoticeSchema.optional(),
1511
- isRemoved: z37.literal(true).optional(),
1512
- isSilentTurn: z37.literal(true).optional(),
1513
- kind: z37.string(),
1514
- message: z37.object({
1515
- clientMessageId: z37.uuid().optional(),
1516
- images: z37.array(imageSchema).optional(),
1517
- spans: z37.array(spanSchema).optional(),
1518
- text: z37.string()
1561
+ isRemoved: z38.literal(true).optional(),
1562
+ isSilentTurn: z38.literal(true).optional(),
1563
+ kind: z38.string(),
1564
+ message: z38.object({
1565
+ clientMessageId: z38.uuid().optional(),
1566
+ images: z38.array(imageSchema).optional(),
1567
+ spans: z38.array(spanSchema).optional(),
1568
+ text: z38.string()
1519
1569
  }).optional(),
1520
- moment: z37.object({ momentID: z37.string(), shortID: z37.string(), title: z37.string().optional() }).optional(),
1521
- proposal: z37.object({ proposalID: z37.string(), shortID: z37.string() }).optional(),
1570
+ moment: z38.object({ momentID: z38.string(), shortID: z38.string(), title: z38.string().optional() }).optional(),
1571
+ proposal: z38.object({ proposalID: z38.string(), shortID: z38.string() }).optional(),
1522
1572
  recall: recallSchema.optional(),
1523
- recordedAt: z37.date(),
1524
- removal: z37.object({ kind: z37.string(), sequence: sequenceSchema, callSequence: sequenceSchema.optional() }).optional(),
1573
+ recordedAt: z38.date(),
1574
+ removal: z38.object({ kind: z38.string(), sequence: sequenceSchema, callSequence: sequenceSchema.optional() }).optional(),
1525
1575
  sequence: sequenceSchema,
1526
- stop: z37.object({ cancelledActions: z37.array(listedActionSchema) }).optional(),
1576
+ stop: z38.object({ cancelledActions: z38.array(listedActionSchema) }).optional(),
1527
1577
  summary: summarySchema.optional(),
1528
1578
  thread: threadSchema,
1529
1579
  task: taskSchema2.optional(),
@@ -1531,23 +1581,23 @@ var recordSchema = z37.object({
1531
1581
  toolCall: toolCallSchema.optional(),
1532
1582
  worker: workerViewSchema.optional()
1533
1583
  });
1534
- var writerErrorSchema = z37.object({ at: z37.date(), code: z37.string(), message: z37.string().nullable() }).nullable();
1535
- var sessionSchema = z37.object({
1536
- createdAt: z37.date(),
1537
- current: z37.boolean(),
1538
- deviceName: z37.string(),
1539
- lastUsedAt: z37.date(),
1540
- sessionID: z37.uuid()
1584
+ var writerErrorSchema = z38.object({ at: z38.date(), code: z38.string(), message: z38.string().nullable() }).nullable();
1585
+ var sessionSchema = z38.object({
1586
+ createdAt: z38.date(),
1587
+ current: z38.boolean(),
1588
+ deviceName: z38.string(),
1589
+ lastUsedAt: z38.date(),
1590
+ sessionID: z38.uuid()
1541
1591
  });
1542
1592
  var checkedAction = signedIn.errors(reusedIDErrors);
1543
- var forgetPreviewItemSchema = z37.object({ itemID: z37.string(), text: z37.string() });
1544
- var recordForgetPreviewSchema = z37.object({
1593
+ var forgetPreviewItemSchema = z38.object({ itemID: z38.string(), text: z38.string() });
1594
+ var recordForgetPreviewSchema = z38.object({
1545
1595
  momentCount: actionCountSchema,
1546
- memoryItems: z37.array(forgetPreviewItemSchema)
1596
+ memoryItems: z38.array(forgetPreviewItemSchema)
1547
1597
  });
1548
- var controlledTaskSchema = z37.object({
1549
- controlledAt: z37.date(),
1550
- isPauseRequested: z37.boolean(),
1598
+ var controlledTaskSchema = z38.object({
1599
+ controlledAt: z38.date(),
1600
+ isPauseRequested: z38.boolean(),
1551
1601
  state: taskStateSchema,
1552
1602
  taskID: threadSchema
1553
1603
  });
@@ -1556,67 +1606,68 @@ var taskControl = checkedAction.errors({
1556
1606
  TASK_STATE_REFUSED: {
1557
1607
  message: "The task is in a state that does not take this control",
1558
1608
  status: 409,
1559
- data: z37.object({ isPauseRequested: z37.boolean(), state: taskStateSchema })
1609
+ data: z38.object({ isPauseRequested: z38.boolean(), state: taskStateSchema })
1560
1610
  },
1561
1611
  RUNNER_LACKS_CONTROL: {
1562
1612
  message: "The runner of the task does not take this control",
1563
1613
  status: 409
1564
1614
  }
1565
- }).input(z37.object({ clientActionID: clientActionIDSchema2, taskID: threadSchema })).output(controlledTaskSchema);
1566
- var markedTaskSchema = z37.object({
1567
- changedAt: z37.date(),
1568
- disposable: z37.boolean(),
1615
+ }).input(z38.object({ clientActionID: clientActionIDSchema2, taskID: threadSchema })).output(controlledTaskSchema);
1616
+ var markedTaskSchema = z38.object({
1617
+ changedAt: z38.date(),
1618
+ disposable: z38.boolean(),
1569
1619
  taskID: threadSchema
1570
1620
  });
1571
- var nixieControl = checkedAction.input(z37.object({ clientActionID: clientActionIDSchema2 })).output(z37.object({ paused: pauseStateSchema }));
1572
- var backupNoticeSchema = z37.object({
1573
- cause: z37.enum(["failed", "missing"]),
1574
- sequence: z37.int().positive(),
1575
- raisedAt: z37.date()
1621
+ var nixieControl = checkedAction.input(z38.object({ clientActionID: clientActionIDSchema2 })).output(z38.object({ paused: pauseStateSchema }));
1622
+ var spendStopErrors = { SPEND_STOP_STANDS: spendStopStandsError };
1623
+ var backupNoticeSchema = z38.object({
1624
+ cause: z38.enum(["failed", "missing"]),
1625
+ sequence: z38.int().positive(),
1626
+ raisedAt: z38.date()
1576
1627
  });
1577
- var followRecords = signedIn.input(z37.object({
1628
+ var followRecords = signedIn.input(z38.object({
1578
1629
  afterSequence: sequenceSchema,
1579
- clipPayloads: z37.boolean().optional(),
1630
+ clipPayloads: z38.boolean().optional(),
1580
1631
  thread: threadSchema.optional()
1581
- })).output(eventIterator2(z37.object({ record: recordSchema })));
1632
+ })).output(eventIterator2(z38.object({ record: recordSchema })));
1582
1633
  var contract = {
1583
1634
  conversation: {
1584
- read: signedIn.errors({ THREAD_NOT_FOUND: { message: "No thread has this ID", status: 404 } }).input(z37.object({
1635
+ read: signedIn.errors({ THREAD_NOT_FOUND: { message: "No thread has this ID", status: 404 } }).input(z38.object({
1585
1636
  beforeSequence: sequenceSchema.optional(),
1586
- clipPayloads: z37.boolean().optional(),
1587
- limit: z37.int().min(1).max(200).optional(),
1637
+ clipPayloads: z38.boolean().optional(),
1638
+ limit: z38.int().min(1).max(200).optional(),
1588
1639
  thread: threadSchema
1589
- })).output(z37.object({
1590
- hasEarlier: z37.boolean(),
1640
+ })).output(z38.object({
1641
+ hasEarlier: z38.boolean(),
1591
1642
  readAtSequence: sequenceSchema,
1592
- records: z37.array(recordSchema),
1643
+ records: z38.array(recordSchema),
1593
1644
  lastStepEnd: recordSchema.nullable().optional()
1594
1645
  })),
1595
1646
  send: checkedAction.errors({
1596
1647
  IMAGE_REFUSED: imageRefusedError,
1597
1648
  THREAD_NOT_FOUND: { message: "No thread has this ID", status: 404 }
1598
- }).input(z37.object({
1649
+ }).input(z38.object({
1599
1650
  clientMessageId: clientActionIDSchema2,
1600
1651
  images: imageFilesSchema.optional(),
1601
- spans: z37.array(spanSchema).max(1e5),
1602
- text: z37.string().min(1).max(1e5),
1652
+ spans: z38.array(spanSchema).max(1e5),
1653
+ text: z38.string().min(1).max(1e5),
1603
1654
  thread: threadSchema,
1604
- timeZone: z37.string().min(1).max(100).optional(),
1605
- writtenAt: z37.iso.datetime().optional()
1606
- })).output(z37.object({ duplicate: z37.boolean(), sequence: sequenceSchema })),
1655
+ timeZone: z38.string().min(1).max(100).optional(),
1656
+ writtenAt: z38.iso.datetime().optional()
1657
+ })).output(z38.object({ duplicate: z38.boolean(), sequence: sequenceSchema })),
1607
1658
  retry: checkedAction.errors({
1608
1659
  NOTHING_TO_RETRY: {
1609
1660
  message: "The last turn of the conversation did not fail, or it runs again already",
1610
1661
  status: 409
1611
1662
  }
1612
- }).input(z37.object({ clientActionID: clientActionIDSchema2 })).output(z37.object({ retriedAt: z37.date() })),
1613
- readImage: signedIn.errors({ IMAGE_NOT_FOUND: imageNotFoundError }).input(imageRefSchema).output(z37.file()),
1663
+ }).input(z38.object({ clientActionID: clientActionIDSchema2 })).output(z38.object({ retriedAt: z38.date() })),
1664
+ readImage: signedIn.errors({ IMAGE_NOT_FOUND: imageNotFoundError }).input(imageRefSchema).output(z38.file()),
1614
1665
  previewForget: signedIn.errors({
1615
1666
  RECORD_NOT_FOUND: {
1616
1667
  message: "No record on this thread with its own text that a forget removes has this sequence",
1617
1668
  status: 404
1618
1669
  }
1619
- }).input(z37.object({ thread: threadSchema, sequence: sequenceSchema })).output(recordForgetPreviewSchema),
1670
+ }).input(z38.object({ thread: threadSchema, sequence: sequenceSchema })).output(recordForgetPreviewSchema),
1620
1671
  forget: checkedAction.errors({
1621
1672
  RECORD_NOT_FOUND: {
1622
1673
  message: "No record on this thread with its own text that a forget removes has this sequence",
@@ -1626,26 +1677,26 @@ var contract = {
1626
1677
  message: "The queued action has not run yet. Cancel it, or wait for it to run.",
1627
1678
  status: 409
1628
1679
  }
1629
- }).input(z37.object({
1680
+ }).input(z38.object({
1630
1681
  clientActionID: clientActionIDSchema2,
1631
1682
  sequence: sequenceSchema,
1632
1683
  thread: threadSchema
1633
- })).output(z37.object({ forgottenAt: z37.date(), backup: forgetBackupSchema }))
1684
+ })).output(z38.object({ forgottenAt: z38.date(), backup: forgetBackupSchema }))
1634
1685
  },
1635
1686
  tasks: {
1636
- list: signedIn.input(z37.object({
1637
- definitionID: z37.string().min(1).max(200).optional(),
1638
- states: z37.array(listedStateSchema).min(1).max(11).refine((states) => new Set(states).size === states.length, {
1687
+ list: signedIn.input(z38.object({
1688
+ definitionID: z38.string().min(1).max(200).optional(),
1689
+ states: z38.array(listedStateSchema).min(1).max(11).refine((states) => new Set(states).size === states.length, {
1639
1690
  message: "Each state may appear once"
1640
1691
  }).optional()
1641
- }).optional()).output(z37.object({ readAtSequence: sequenceSchema, tasks: z37.array(listedTaskSchema) })),
1642
- read: signedIn.errors({ TASK_NOT_FOUND: { message: "No task has this ID", status: 404 } }).input(z37.object({ taskID: threadSchema })).output(listedTaskSchema),
1643
- readActions: signedIn.errors({ TASK_NOT_FOUND: { message: "No task has this ID", status: 404 } }).input(z37.object({ taskID: threadSchema })).output(z37.object({
1644
- queued: z37.array(listedActionSchema),
1645
- started: z37.array(listedActionSchema)
1692
+ }).optional()).output(z38.object({ readAtSequence: sequenceSchema, tasks: z38.array(listedTaskSchema) })),
1693
+ read: signedIn.errors({ TASK_NOT_FOUND: { message: "No task has this ID", status: 404 } }).input(z38.object({ taskID: threadSchema })).output(listedTaskSchema),
1694
+ readActions: signedIn.errors({ TASK_NOT_FOUND: { message: "No task has this ID", status: 404 } }).input(z38.object({ taskID: threadSchema })).output(z38.object({
1695
+ queued: z38.array(listedActionSchema),
1696
+ started: z38.array(listedActionSchema)
1646
1697
  })),
1647
1698
  pause: taskControl,
1648
- resume: taskControl,
1699
+ resume: taskControl.errors(spendStopErrors),
1649
1700
  stop: taskControl,
1650
1701
  restart: taskControl,
1651
1702
  close: taskControl.errors({
@@ -1662,39 +1713,43 @@ var contract = {
1662
1713
  TASK_STATE_REFUSED: {
1663
1714
  message: "The task is in a state that does not take this change",
1664
1715
  status: 409,
1665
- data: z37.object({ state: taskStateSchema })
1716
+ data: z38.object({ state: taskStateSchema })
1666
1717
  }
1667
- }).input(z37.object({
1718
+ }).input(z38.object({
1668
1719
  clientActionID: clientActionIDSchema2,
1669
- disposable: z37.boolean(),
1720
+ disposable: z38.boolean(),
1670
1721
  taskID: threadSchema
1671
1722
  })).output(markedTaskSchema),
1672
1723
  ...viewContract.tasks
1673
1724
  },
1674
1725
  memory: {
1675
- readVersions: signedIn.input(z37.object({ versions: z37.array(versionRefSchema).min(1).max(100) })).output(z37.object({ versions: z37.array(versionTextSchema) })),
1676
- writerStatus: signedIn.route({ deprecated: true }).output(z37.object({
1677
- isEnabled: z37.boolean(),
1678
- backlog: z37.int().nonnegative(),
1679
- batches: z37.int().nonnegative(),
1726
+ readVersions: signedIn.input(z38.object({ versions: z38.array(versionRefSchema).min(1).max(100) })).output(z38.object({ versions: z38.array(versionTextSchema) })),
1727
+ writerStatus: signedIn.route({ deprecated: true }).output(z38.object({
1728
+ isEnabled: z38.boolean(),
1729
+ backlog: z38.int().nonnegative(),
1730
+ batches: z38.int().nonnegative(),
1680
1731
  cursor: sequenceSchema,
1681
- failures: z37.int().nonnegative(),
1682
- isCatchingUp: z37.boolean(),
1732
+ failures: z38.int().nonnegative(),
1733
+ isCatchingUp: z38.boolean(),
1683
1734
  lastError: writerErrorSchema,
1684
- retryAt: z37.date().nullable()
1735
+ retryAt: z38.date().nullable()
1685
1736
  })),
1686
1737
  ...memoryViewContract
1687
1738
  },
1688
1739
  nixie: {
1689
- read: signedIn.output(z37.object({ paused: pauseStateSchema })),
1740
+ read: signedIn.output(z38.object({ paused: pauseStateSchema })),
1690
1741
  pause: nixieControl,
1691
- resume: nixieControl
1742
+ resume: nixieControl.errors(spendStopErrors)
1743
+ },
1744
+ spend: {
1745
+ read: signedIn.output(spendStopSchema),
1746
+ raise: signedIn.input(spendRaiseInputSchema).output(spendRaiseOutputSchema)
1692
1747
  },
1693
1748
  recovery: {
1694
- read: signedIn.output(z37.object({ recovery: recoverySchema }))
1749
+ read: signedIn.output(z38.object({ recovery: recoverySchema }))
1695
1750
  },
1696
1751
  backups: {
1697
- readNotice: signedIn.output(z37.object({ notice: backupNoticeSchema.nullable() }))
1752
+ readNotice: signedIn.output(z38.object({ notice: backupNoticeSchema.nullable() }))
1698
1753
  },
1699
1754
  triggers: viewContract.triggers,
1700
1755
  definitions: { ...viewContract.definitions, ...definitionsContract },
@@ -1714,28 +1769,28 @@ var contract = {
1714
1769
  message: "The enrolment code is unknown, used or lapsed",
1715
1770
  status: 400
1716
1771
  }
1717
- }).input(z37.object({
1772
+ }).input(z38.object({
1718
1773
  clientActionID: clientActionIDSchema2,
1719
- code: z37.string().min(1).max(100),
1720
- deviceName: z37.string().min(1).max(100),
1721
- tokenDelivery: z37.enum(["cookie", "bearer"])
1722
- })).output(z37.object({ sessionID: z37.uuid(), token: z37.string().optional() })),
1723
- issueCode: checkedAction.input(z37.object({ clientActionID: clientActionIDSchema2 })).output(z37.object({ code: z37.string(), expiresAt: z37.date() })),
1724
- list: signedIn.output(z37.object({ sessions: z37.array(sessionSchema) })),
1725
- revoke: checkedAction.errors({ SESSION_NOT_FOUND: { message: "No session has this ID", status: 404 } }).input(z37.object({ clientActionID: clientActionIDSchema2, sessionID: z37.uuid() })).output(z37.object({ revokedAt: z37.date() }))
1774
+ code: z38.string().min(1).max(100),
1775
+ deviceName: z38.string().min(1).max(100),
1776
+ tokenDelivery: z38.enum(["cookie", "bearer"])
1777
+ })).output(z38.object({ sessionID: z38.uuid(), token: z38.string().optional() })),
1778
+ issueCode: checkedAction.input(z38.object({ clientActionID: clientActionIDSchema2 })).output(z38.object({ code: z38.string(), expiresAt: z38.date() })),
1779
+ list: signedIn.output(z38.object({ sessions: z38.array(sessionSchema) })),
1780
+ revoke: checkedAction.errors({ SESSION_NOT_FOUND: { message: "No session has this ID", status: 404 } }).input(z38.object({ clientActionID: clientActionIDSchema2, sessionID: z38.uuid() })).output(z38.object({ revokedAt: z38.date() }))
1726
1781
  }
1727
1782
  };
1728
1783
  // src/contract/host-contract.ts
1729
1784
  import { oc as oc6 } from "@orpc/contract";
1730
- import { z as z46 } from "zod";
1785
+ import { z as z47 } from "zod";
1731
1786
 
1732
1787
  // src/contract/action-proposal-schema.ts
1733
- import { z as z38 } from "zod";
1734
- var actionProposalSchema = z38.object({
1735
- proposalID: z38.string(),
1736
- tool: z38.string(),
1737
- effects: z38.array(z38.string()),
1738
- cause: z38.enum([
1788
+ import { z as z39 } from "zod";
1789
+ var actionProposalSchema = z39.object({
1790
+ proposalID: z39.string(),
1791
+ tool: z39.string(),
1792
+ effects: z39.array(z39.string()),
1793
+ cause: z39.enum([
1739
1794
  "outside_steering",
1740
1795
  "always_ask",
1741
1796
  "ask_rule",
@@ -1743,81 +1798,81 @@ var actionProposalSchema = z38.object({
1743
1798
  "direct_request",
1744
1799
  "repeat"
1745
1800
  ]),
1746
- sentence: z38.string(),
1747
- destinations: z38.array(z38.string()),
1748
- createdAt: z38.date(),
1749
- lapseAt: z38.date()
1801
+ sentence: z39.string(),
1802
+ destinations: z39.array(z39.string()),
1803
+ createdAt: z39.date(),
1804
+ lapseAt: z39.date()
1750
1805
  });
1751
1806
 
1752
1807
  // src/contract/forgotten-items-schema.ts
1753
- import { z as z39 } from "zod";
1754
- var forgottenItemsSchema = z39.object({
1755
- itemIDs: z39.array(z39.string()),
1808
+ import { z as z40 } from "zod";
1809
+ var forgottenItemsSchema = z40.object({
1810
+ itemIDs: z40.array(z40.string()),
1756
1811
  backup: forgetBackupSchema
1757
1812
  });
1758
1813
 
1759
1814
  // src/contract/host-mandates-contract.ts
1760
1815
  import { oc as oc3 } from "@orpc/contract";
1761
- import { z as z40 } from "zod";
1816
+ import { z as z41 } from "zod";
1762
1817
  var mandates = oc3.errors({
1763
1818
  NOT_FOUND: { message: "no mandate has that ID", status: 404 }
1764
1819
  });
1765
- var hostMandateRuleSchema = z40.object({ ruleID: z40.string(), sentence: z40.string() });
1766
- var hostMandateSchema = z40.object({
1767
- mandateID: z40.string(),
1768
- title: z40.string().nullable(),
1769
- rules: z40.array(hostMandateRuleSchema),
1770
- startedAt: z40.date(),
1771
- expires: z40.date()
1820
+ var hostMandateRuleSchema = z41.object({ ruleID: z41.string(), sentence: z41.string() });
1821
+ var hostMandateSchema = z41.object({
1822
+ mandateID: z41.string(),
1823
+ title: z41.string().nullable(),
1824
+ rules: z41.array(hostMandateRuleSchema),
1825
+ startedAt: z41.date(),
1826
+ expires: z41.date()
1772
1827
  });
1773
1828
  var hostMandatesContract = {
1774
- list: mandates.output(z40.array(hostMandateSchema)),
1775
- end: mandates.input(z40.strictObject({ mandateID: z40.string().min(1) })).output(z40.object({ mandateID: z40.string(), state: z40.enum(["ended", "expired"]) }))
1829
+ list: mandates.output(z41.array(hostMandateSchema)),
1830
+ end: mandates.input(z41.strictObject({ mandateID: z41.string().min(1) })).output(z41.object({ mandateID: z41.string(), state: z41.enum(["ended", "expired"]) }))
1776
1831
  };
1777
1832
 
1778
1833
  // src/contract/host-passkey-contract.ts
1779
1834
  import { oc as oc4 } from "@orpc/contract";
1780
- import { z as z41 } from "zod";
1781
- var hostPasskeySchema = z41.object({
1782
- passkeyID: z41.string(),
1783
- label: z41.string(),
1784
- synced: z41.boolean(),
1785
- origin: z41.string(),
1786
- registeredBy: z41.string(),
1787
- authorizedBy: z41.string(),
1788
- registeredAt: z41.date(),
1789
- lastUsedAt: z41.date().nullable(),
1790
- revokedAt: z41.date().nullable()
1835
+ import { z as z42 } from "zod";
1836
+ var hostPasskeySchema = z42.object({
1837
+ passkeyID: z42.string(),
1838
+ label: z42.string(),
1839
+ synced: z42.boolean(),
1840
+ origin: z42.string(),
1841
+ registeredBy: z42.string(),
1842
+ authorizedBy: z42.string(),
1843
+ registeredAt: z42.date(),
1844
+ lastUsedAt: z42.date().nullable(),
1845
+ revokedAt: z42.date().nullable()
1791
1846
  });
1792
1847
  var hostPasskeyContract = {
1793
- issueCode: oc4.output(z41.object({ code: z41.string(), expiresAt: z41.date() })),
1794
- list: oc4.output(z41.array(hostPasskeySchema)),
1848
+ issueCode: oc4.output(z42.object({ code: z42.string(), expiresAt: z42.date() })),
1849
+ list: oc4.output(z42.array(hostPasskeySchema)),
1795
1850
  revoke: oc4.errors({
1796
1851
  PASSKEY_NOT_FOUND: { message: "no passkey has that ID", status: 404 }
1797
- }).input(z41.strictObject({ passkeyID: z41.string().min(1) })).output(z41.object({ passkeyID: z41.string(), revokedAt: z41.date() }))
1852
+ }).input(z42.strictObject({ passkeyID: z42.string().min(1) })).output(z42.object({ passkeyID: z42.string(), revokedAt: z42.date() }))
1798
1853
  };
1799
1854
 
1800
1855
  // src/contract/known-contact-schema.ts
1801
- import { z as z42 } from "zod";
1802
- var knownContactSchema = z42.object({
1803
- contactID: z42.string(),
1804
- name: z42.string().nullable(),
1805
- destination: z42.string().nullable(),
1806
- markedAt: z42.date()
1856
+ import { z as z43 } from "zod";
1857
+ var knownContactSchema = z43.object({
1858
+ contactID: z43.string(),
1859
+ name: z43.string().nullable(),
1860
+ destination: z43.string().nullable(),
1861
+ markedAt: z43.date()
1807
1862
  });
1808
1863
 
1809
1864
  // src/contract/turn-inputs-contract.ts
1810
1865
  import { oc as oc5 } from "@orpc/contract";
1811
- import { z as z45 } from "zod";
1866
+ import { z as z46 } from "zod";
1812
1867
 
1813
1868
  // src/contract/input-miss-schema.ts
1814
- import { z as z43 } from "zod";
1815
- var inputMissSchema = z43.object({
1816
- missID: z43.string(),
1817
- captureID: z43.string().nullable(),
1818
- taskID: z43.string(),
1819
- stepRunID: z43.string(),
1820
- reason: z43.enum([
1869
+ import { z as z44 } from "zod";
1870
+ var inputMissSchema = z44.object({
1871
+ missID: z44.string(),
1872
+ captureID: z44.string().nullable(),
1873
+ taskID: z44.string(),
1874
+ stepRunID: z44.string(),
1875
+ reason: z44.enum([
1821
1876
  "queue_full",
1822
1877
  "spool_full",
1823
1878
  "spool_write_failed",
@@ -1829,45 +1884,45 @@ var inputMissSchema = z43.object({
1829
1884
  "intake_failed",
1830
1885
  "holds_own_value"
1831
1886
  ]),
1832
- count: z43.int().positive(),
1833
- writer: z43.string().nullable(),
1834
- counter: z43.int().nullable(),
1835
- createdAt: z43.date()
1887
+ count: z44.int().positive(),
1888
+ writer: z44.string().nullable(),
1889
+ counter: z44.int().nullable(),
1890
+ createdAt: z44.date()
1836
1891
  });
1837
1892
 
1838
1893
  // src/contract/logged-input-schema.ts
1839
- import { z as z44 } from "zod";
1840
- var loggedInputSchema = z44.object({
1841
- inputID: z44.string(),
1842
- captureID: z44.string(),
1843
- taskID: z44.string(),
1844
- stepRunID: z44.string(),
1845
- writer: z44.string(),
1846
- counter: z44.int(),
1847
- role: z44.string(),
1848
- profile: z44.string(),
1849
- model: z44.string(),
1850
- harness: z44.string(),
1851
- api: z44.string(),
1852
- endpoint: z44.string(),
1853
- route: z44.string(),
1854
- isRewritten: z44.boolean(),
1855
- upstreamStatus: z44.int(),
1856
- bytes: z44.int(),
1857
- intakeSequence: z44.int(),
1858
- receivedAt: z44.date(),
1859
- takenAt: z44.date(),
1860
- state: z44.enum(["writing", "stored", "missing", "removed"]),
1861
- removedCause: z44.enum(["retention_days", "retention_bytes", "forget", "dropped", "restore", "reset"]).nullable()
1894
+ import { z as z45 } from "zod";
1895
+ var loggedInputSchema = z45.object({
1896
+ inputID: z45.string(),
1897
+ captureID: z45.string(),
1898
+ taskID: z45.string(),
1899
+ stepRunID: z45.string(),
1900
+ writer: z45.string(),
1901
+ counter: z45.int(),
1902
+ role: z45.string(),
1903
+ profile: z45.string(),
1904
+ model: z45.string(),
1905
+ harness: z45.string(),
1906
+ api: z45.string(),
1907
+ endpoint: z45.string(),
1908
+ route: z45.string(),
1909
+ isRewritten: z45.boolean(),
1910
+ upstreamStatus: z45.int(),
1911
+ bytes: z45.int(),
1912
+ intakeSequence: z45.int(),
1913
+ receivedAt: z45.date(),
1914
+ takenAt: z45.date(),
1915
+ state: z45.enum(["writing", "stored", "missing", "removed"]),
1916
+ removedCause: z45.enum(["retention_days", "retention_bytes", "forget", "dropped", "restore", "reset"]).nullable()
1862
1917
  });
1863
1918
 
1864
1919
  // src/contract/turn-inputs-contract.ts
1865
- var turnInputOn = z45.strictObject({
1866
- state: z45.literal("on"),
1867
- forMs: z45.int().positive().nullable()
1920
+ var turnInputOn = z46.strictObject({
1921
+ state: z46.literal("on"),
1922
+ forMs: z46.int().positive().nullable()
1868
1923
  });
1869
- var turnInputOff = z45.strictObject({ state: z45.literal("off"), drop: z45.boolean() });
1870
- var turnInputSetSchema = z45.discriminatedUnion("state", [turnInputOn, turnInputOff]);
1924
+ var turnInputOff = z46.strictObject({ state: z46.literal("off"), drop: z46.boolean() });
1925
+ var turnInputSetSchema = z46.discriminatedUnion("state", [turnInputOn, turnInputOff]);
1871
1926
  var turnInputs = oc5.errors({
1872
1927
  NOT_FOUND: { message: "no logged request has that ID", status: 404 },
1873
1928
  REMOVED: { message: "that request is removed or its body is missing", status: 410 },
@@ -1877,27 +1932,27 @@ var turnInputs = oc5.errors({
1877
1932
  },
1878
1933
  NOT_CONFIGURED: { message: "the turn-input log is not configured", status: 409 }
1879
1934
  });
1880
- var listedInputsSchema = z45.object({
1881
- inputs: z45.array(loggedInputSchema),
1882
- misses: z45.array(inputMissSchema)
1935
+ var listedInputsSchema = z46.object({
1936
+ inputs: z46.array(loggedInputSchema),
1937
+ misses: z46.array(inputMissSchema)
1883
1938
  });
1884
1939
  var turnInputsContract = {
1885
- list: turnInputs.input(z45.strictObject({ limit: z45.int().positive().max(500).default(50) })).output(listedInputsSchema),
1886
- open: turnInputs.input(z45.strictObject({ inputID: z45.string().min(1) })).output(z45.object({ inputID: z45.string(), body: z45.base64() })),
1887
- set: turnInputs.input(turnInputSetSchema).output(z45.object({ state: z45.enum(["on", "off"]), until: z45.number().nullable() }))
1940
+ list: turnInputs.input(z46.strictObject({ limit: z46.int().positive().max(500).default(50) })).output(listedInputsSchema),
1941
+ open: turnInputs.input(z46.strictObject({ inputID: z46.string().min(1) })).output(z46.object({ inputID: z46.string(), body: z46.base64() })),
1942
+ set: turnInputs.input(turnInputSetSchema).output(z46.object({ state: z46.enum(["on", "off"]), until: z46.number().nullable() }))
1888
1943
  };
1889
1944
 
1890
1945
  // src/contract/host-contract.ts
1891
- var versionRefSchema2 = z46.object({ itemID: z46.string(), version: z46.int().positive() });
1892
- var versionTargetSchema2 = z46.strictObject({
1893
- itemID: z46.string().min(1),
1894
- version: z46.int().positive()
1895
- });
1896
- var itemTextSchema = z46.string().max(2000).regex(/\S/u);
1897
- var proposalOriginSchema2 = z46.enum(["owner", "conversation", "task"]);
1898
- var memoryOriginSchema = z46.enum([...proposalOriginSchema2.options, "lapse"]);
1899
- var contentSourceSchema = z46.enum(["owner", "owner_data", "untrusted"]);
1900
- var reviewReasonSchema2 = z46.enum([
1946
+ var versionRefSchema2 = z47.object({ itemID: z47.string(), version: z47.int().positive() });
1947
+ var versionTargetSchema2 = z47.strictObject({
1948
+ itemID: z47.string().min(1),
1949
+ version: z47.int().positive()
1950
+ });
1951
+ var itemTextSchema = z47.string().max(2000).regex(/\S/u);
1952
+ var proposalOriginSchema2 = z47.enum(["owner", "conversation", "task"]);
1953
+ var memoryOriginSchema = z47.enum([...proposalOriginSchema2.options, "lapse"]);
1954
+ var contentSourceSchema = z47.enum(["owner", "owner_data", "untrusted"]);
1955
+ var reviewReasonSchema2 = z47.enum([
1901
1956
  "no_quote",
1902
1957
  "quote_not_typed",
1903
1958
  "quote_in_quoted_block",
@@ -1916,68 +1971,68 @@ var reviewReasonSchema2 = z46.enum([
1916
1971
  "labels",
1917
1972
  "ask_rule"
1918
1973
  ]);
1919
- var proposalSourceSchema2 = z46.object({
1974
+ var proposalSourceSchema2 = z47.object({
1920
1975
  origin: proposalOriginSchema2,
1921
- thread: z46.string().nullable(),
1922
- proposedAt: z46.date()
1923
- });
1924
- var pendingProposalSchema = z46.object({
1925
- proposalID: z46.string(),
1926
- operation: z46.enum(["remember", "retire", "pin"]),
1927
- itemID: z46.string(),
1928
- targetVersion: z46.int().nullable(),
1929
- isPinned: z46.boolean(),
1930
- subject: z46.enum(["owner", "self", "shared"]),
1931
- newSubject: z46.enum(["owner", "self", "shared"]).nullable(),
1932
- kind: z46.enum(["fact", "self"]),
1976
+ thread: z47.string().nullable(),
1977
+ proposedAt: z47.date()
1978
+ });
1979
+ var pendingProposalSchema = z47.object({
1980
+ proposalID: z47.string(),
1981
+ operation: z47.enum(["remember", "retire", "pin"]),
1982
+ itemID: z47.string(),
1983
+ targetVersion: z47.int().nullable(),
1984
+ isPinned: z47.boolean(),
1985
+ subject: z47.enum(["owner", "self", "shared"]),
1986
+ newSubject: z47.enum(["owner", "self", "shared"]).nullable(),
1987
+ kind: z47.enum(["fact", "self"]),
1933
1988
  reason: reviewReasonSchema2,
1934
- actionHash: z46.string(),
1989
+ actionHash: z47.string(),
1935
1990
  origin: proposalOriginSchema2,
1936
1991
  source: contentSourceSchema,
1937
- createdAt: z46.date(),
1938
- lapseAt: z46.date(),
1939
- sources: z46.array(proposalSourceSchema2),
1940
- text: z46.string(),
1941
- quote: z46.string().nullable()
1942
- });
1943
- var closeMatchSchema2 = z46.object({ itemID: z46.string(), version: z46.int(), text: z46.string() });
1944
- var approvalResultSchema = z46.discriminatedUnion("status", [
1945
- z46.object({ status: z46.literal("applied"), itemID: z46.string(), version: z46.int() }),
1946
- z46.object({ status: z46.literal("close_match"), item: closeMatchSchema2 })
1992
+ createdAt: z47.date(),
1993
+ lapseAt: z47.date(),
1994
+ sources: z47.array(proposalSourceSchema2),
1995
+ text: z47.string(),
1996
+ quote: z47.string().nullable()
1997
+ });
1998
+ var closeMatchSchema2 = z47.object({ itemID: z47.string(), version: z47.int(), text: z47.string() });
1999
+ var approvalResultSchema = z47.discriminatedUnion("status", [
2000
+ z47.object({ status: z47.literal("applied"), itemID: z47.string(), version: z47.int() }),
2001
+ z47.object({ status: z47.literal("close_match"), item: closeMatchSchema2 })
1947
2002
  ]);
1948
- var historyVersionSchema = z46.object({
1949
- version: z46.int(),
1950
- change: z46.enum(["created", "edited", "retired", "restored", "undone"]),
1951
- state: z46.enum(["active", "retired"]),
2003
+ var historyVersionSchema = z47.object({
2004
+ version: z47.int(),
2005
+ change: z47.enum(["created", "edited", "retired", "restored", "undone"]),
2006
+ state: z47.enum(["active", "retired"]),
1952
2007
  origin: memoryOriginSchema,
1953
2008
  source: contentSourceSchema,
1954
- recordedAt: z46.date(),
1955
- isRemoved: z46.boolean(),
1956
- isBridge: z46.boolean(),
1957
- status: z46.enum(["readable", "shredded", "unreadable"]),
1958
- text: z46.string().nullable()
1959
- });
1960
- var itemHistorySchema = z46.object({
1961
- itemID: z46.string(),
1962
- subject: z46.enum(["owner", "self", "shared"]),
1963
- kind: z46.enum(["fact", "self"]),
1964
- state: z46.enum(["active", "retired", "forgetting", "forgotten"]),
1965
- versions: z46.array(historyVersionSchema)
1966
- });
1967
- var proposalAnswerSchema = z46.strictObject({
1968
- proposalID: z46.string().min(1),
1969
- actionHash: z46.string().min(1)
1970
- });
1971
- var hostSessionSchema = z46.object({
1972
- sessionID: z46.string(),
1973
- deviceName: z46.string(),
1974
- createdAt: z46.date(),
1975
- lastUsedAt: z46.date()
1976
- });
1977
- var subjectCountSchema = z46.object({
1978
- owner: z46.int().nonnegative(),
1979
- shared: z46.int().nonnegative(),
1980
- self: z46.int().nonnegative()
2009
+ recordedAt: z47.date(),
2010
+ isRemoved: z47.boolean(),
2011
+ isBridge: z47.boolean(),
2012
+ status: z47.enum(["readable", "shredded", "unreadable"]),
2013
+ text: z47.string().nullable()
2014
+ });
2015
+ var itemHistorySchema = z47.object({
2016
+ itemID: z47.string(),
2017
+ subject: z47.enum(["owner", "self", "shared"]),
2018
+ kind: z47.enum(["fact", "self"]),
2019
+ state: z47.enum(["active", "retired", "forgetting", "forgotten"]),
2020
+ versions: z47.array(historyVersionSchema)
2021
+ });
2022
+ var proposalAnswerSchema = z47.strictObject({
2023
+ proposalID: z47.string().min(1),
2024
+ actionHash: z47.string().min(1)
2025
+ });
2026
+ var hostSessionSchema = z47.object({
2027
+ sessionID: z47.string(),
2028
+ deviceName: z47.string(),
2029
+ createdAt: z47.date(),
2030
+ lastUsedAt: z47.date()
2031
+ });
2032
+ var subjectCountSchema = z47.object({
2033
+ owner: z47.int().nonnegative(),
2034
+ shared: z47.int().nonnegative(),
2035
+ self: z47.int().nonnegative()
1981
2036
  });
1982
2037
  var memory = oc6.errors({
1983
2038
  MEMORY_NOT_STARTED: { message: "the memory store has not started yet", status: 503 },
@@ -1992,28 +2047,28 @@ var memory = oc6.errors({
1992
2047
  PIN_EDIT: { message: "a pin takes no edited text", status: 400 },
1993
2048
  SELF_NOTE_REFUSED: { message: "a self-note never takes that change", status: 409 }
1994
2049
  });
1995
- var skillFileSchema = z46.object({ path: z46.string(), text: z46.string() });
1996
- var pendingSkillProposalSchema = z46.object({
1997
- proposalID: z46.string(),
1998
- name: z46.string(),
1999
- skillHash: z46.string(),
2000
- baseHash: z46.string().nullable(),
2001
- files: z46.array(skillFileSchema),
2002
- inForce: z46.object({
2003
- skillHash: z46.string(),
2004
- origin: z46.enum(["definitions", "vendored", "nixie"]),
2005
- files: z46.array(skillFileSchema)
2050
+ var skillFileSchema = z47.object({ path: z47.string(), text: z47.string() });
2051
+ var pendingSkillProposalSchema = z47.object({
2052
+ proposalID: z47.string(),
2053
+ name: z47.string(),
2054
+ skillHash: z47.string(),
2055
+ baseHash: z47.string().nullable(),
2056
+ files: z47.array(skillFileSchema),
2057
+ inForce: z47.object({
2058
+ skillHash: z47.string(),
2059
+ origin: z47.enum(["definitions", "vendored", "nixie"]),
2060
+ files: z47.array(skillFileSchema)
2006
2061
  }).nullable(),
2007
- untypedToken: z46.object({ kind: z46.string(), raw: z46.string() }).nullable(),
2008
- thread: z46.string().nullable(),
2009
- provenance: z46.object({ runID: z46.string(), callID: z46.string(), profile: z46.string() }),
2010
- createdAt: z46.date(),
2011
- lapseAt: z46.date(),
2012
- isStale: z46.boolean()
2062
+ untypedToken: z47.object({ kind: z47.string(), raw: z47.string() }).nullable(),
2063
+ thread: z47.string().nullable(),
2064
+ provenance: z47.object({ runID: z47.string(), callID: z47.string(), profile: z47.string() }),
2065
+ createdAt: z47.date(),
2066
+ lapseAt: z47.date(),
2067
+ isStale: z47.boolean()
2013
2068
  });
2014
- var skillAnswerSchema = z46.strictObject({
2015
- proposalID: z46.string().min(1),
2016
- skillHash: z46.string().min(1)
2069
+ var skillAnswerSchema = z47.strictObject({
2070
+ proposalID: z47.string().min(1),
2071
+ skillHash: z47.string().min(1)
2017
2072
  });
2018
2073
  var skills = oc6.errors({
2019
2074
  NOT_FOUND: { message: "nothing has that ID", status: 404 },
@@ -2023,38 +2078,38 @@ var skills = oc6.errors({
2023
2078
  SKILL_CHECK: { message: "the files fail the seed checks", status: 400 },
2024
2079
  WRONG_STATE: { message: "the skill nixie wrote is no longer in force", status: 409 }
2025
2080
  });
2026
- var definitionsSkillSchema = z46.object({ skillHash: z46.string(), origin: z46.enum(["definitions", "vendored"]) }).nullable();
2027
- var writtenSkillSchema = z46.object({
2028
- approvalID: z46.string(),
2029
- proposalID: z46.string(),
2030
- name: z46.string(),
2031
- skillHash: z46.string(),
2081
+ var definitionsSkillSchema = z47.object({ skillHash: z47.string(), origin: z47.enum(["definitions", "vendored"]) }).nullable();
2082
+ var writtenSkillSchema = z47.object({
2083
+ approvalID: z47.string(),
2084
+ proposalID: z47.string(),
2085
+ name: z47.string(),
2086
+ skillHash: z47.string(),
2032
2087
  base: definitionsSkillSchema,
2033
2088
  definitions: definitionsSkillSchema,
2034
- isConflict: z46.boolean(),
2035
- pullRequestURL: z46.url().nullable(),
2036
- approvedAt: z46.date()
2037
- });
2038
- var promptPartFileSchema = z46.object({ path: z46.string(), text: z46.string() });
2039
- var promptEntrySchema = z46.record(z46.string(), z46.string());
2040
- var pendingPromptProposalSchema = z46.object({
2041
- proposalID: z46.string(),
2042
- promptID: z46.string(),
2043
- proposalHash: z46.string(),
2044
- baseHash: z46.string().nullable(),
2089
+ isConflict: z47.boolean(),
2090
+ pullRequestURL: z47.url().nullable(),
2091
+ approvedAt: z47.date()
2092
+ });
2093
+ var promptPartFileSchema = z47.object({ path: z47.string(), text: z47.string() });
2094
+ var promptEntrySchema = z47.record(z47.string(), z47.string());
2095
+ var pendingPromptProposalSchema = z47.object({
2096
+ proposalID: z47.string(),
2097
+ promptID: z47.string(),
2098
+ proposalHash: z47.string(),
2099
+ baseHash: z47.string().nullable(),
2045
2100
  entry: promptEntrySchema,
2046
- files: z46.array(promptPartFileSchema),
2047
- reason: z46.string(),
2048
- inForce: z46.object({ parts: promptEntrySchema, template: z46.string().nullable() }).nullable(),
2049
- thread: z46.string().nullable(),
2050
- provenance: z46.object({ runID: z46.string(), callID: z46.string(), profile: z46.string() }),
2051
- createdAt: z46.date(),
2052
- lapseAt: z46.date(),
2053
- isStale: z46.boolean()
2054
- });
2055
- var promptAnswerSchema = z46.strictObject({
2056
- proposalID: z46.string().min(1),
2057
- proposalHash: z46.string().min(1)
2101
+ files: z47.array(promptPartFileSchema),
2102
+ reason: z47.string(),
2103
+ inForce: z47.object({ parts: promptEntrySchema, template: z47.string().nullable() }).nullable(),
2104
+ thread: z47.string().nullable(),
2105
+ provenance: z47.object({ runID: z47.string(), callID: z47.string(), profile: z47.string() }),
2106
+ createdAt: z47.date(),
2107
+ lapseAt: z47.date(),
2108
+ isStale: z47.boolean()
2109
+ });
2110
+ var promptAnswerSchema = z47.strictObject({
2111
+ proposalID: z47.string().min(1),
2112
+ proposalHash: z47.string().min(1)
2058
2113
  });
2059
2114
  var prompts = oc6.errors({
2060
2115
  NOT_FOUND: { message: "nothing has that ID", status: 404 },
@@ -2063,49 +2118,49 @@ var prompts = oc6.errors({
2063
2118
  STALE_BASE: { message: "the override in force moved past the proposal", status: 409 },
2064
2119
  PROMPT_CHECK: { message: "the override fails the definitions checks", status: 400 }
2065
2120
  });
2066
- var ruleVersionSchema = z46.object({ ruleHash: z46.string(), sentence: z46.string() }).nullable();
2067
- var ruleInForceSchema = z46.object({
2068
- ruleID: z46.string(),
2069
- revision: z46.int().positive(),
2070
- ruleHash: z46.string(),
2071
- sentence: z46.string(),
2072
- origin: z46.enum(["definitions", "nixie"]),
2073
- changeID: z46.string().nullable(),
2074
- lastFiredAt: z46.date().nullable()
2075
- });
2076
- var ruleConflictSchema = z46.object({
2077
- ruleID: z46.string(),
2078
- changeID: z46.string(),
2121
+ var ruleVersionSchema = z47.object({ ruleHash: z47.string(), sentence: z47.string() }).nullable();
2122
+ var ruleInForceSchema = z47.object({
2123
+ ruleID: z47.string(),
2124
+ revision: z47.int().positive(),
2125
+ ruleHash: z47.string(),
2126
+ sentence: z47.string(),
2127
+ origin: z47.enum(["definitions", "nixie"]),
2128
+ changeID: z47.string().nullable(),
2129
+ lastFiredAt: z47.date().nullable()
2130
+ });
2131
+ var ruleConflictSchema = z47.object({
2132
+ ruleID: z47.string(),
2133
+ changeID: z47.string(),
2079
2134
  nixie: ruleVersionSchema,
2080
2135
  repo: ruleVersionSchema,
2081
2136
  base: ruleVersionSchema,
2082
- changedBy: z46.enum(["owner", "nixie"]),
2083
- reason: z46.string(),
2084
- changedAt: z46.date()
2137
+ changedBy: z47.enum(["owner", "nixie"]),
2138
+ reason: z47.string(),
2139
+ changedAt: z47.date()
2085
2140
  });
2086
- var ruleProposalChangeSchema = z46.object({
2087
- ruleID: z46.string(),
2141
+ var ruleProposalChangeSchema = z47.object({
2142
+ ruleID: z47.string(),
2088
2143
  before: ruleVersionSchema,
2089
2144
  after: ruleVersionSchema
2090
2145
  });
2091
- var effectChangeSchema = z46.object({
2092
- tool: z46.string(),
2093
- remove: z46.array(z46.string()),
2094
- sentence: z46.string()
2146
+ var effectChangeSchema = z47.object({
2147
+ tool: z47.string(),
2148
+ remove: z47.array(z47.string()),
2149
+ sentence: z47.string()
2095
2150
  });
2096
- var pendingRuleProposalSchema = z46.object({
2097
- proposalID: z46.string(),
2098
- changes: z46.array(ruleProposalChangeSchema),
2099
- effectChanges: z46.array(effectChangeSchema),
2100
- createdAt: z46.date(),
2101
- lapseAt: z46.date()
2151
+ var pendingRuleProposalSchema = z47.object({
2152
+ proposalID: z47.string(),
2153
+ changes: z47.array(ruleProposalChangeSchema),
2154
+ effectChanges: z47.array(effectChangeSchema),
2155
+ createdAt: z47.date(),
2156
+ lapseAt: z47.date()
2102
2157
  });
2103
- var ruleProposalAnswerSchema = z46.strictObject({ proposalID: z46.string().min(1) });
2158
+ var ruleProposalAnswerSchema = z47.strictObject({ proposalID: z47.string().min(1) });
2104
2159
  var ruleProposalRejectionSchema = ruleProposalAnswerSchema.extend({
2105
- reason: z46.string().max(500).regex(/\S/u)
2160
+ reason: z47.string().max(500).regex(/\S/u)
2106
2161
  });
2107
2162
  var actionRejectionSchema = ruleProposalAnswerSchema.extend({
2108
- reason: z46.string().max(500).regex(/\S/u).optional()
2163
+ reason: z47.string().max(500).regex(/\S/u).optional()
2109
2164
  });
2110
2165
  var ruleProposalErrors = {
2111
2166
  NOT_FOUND: { message: "nothing has that ID", status: 404 },
@@ -2119,7 +2174,7 @@ var definitions = oc6.errors({
2119
2174
  var contacts = oc6.errors({
2120
2175
  NOT_FOUND: { message: "no known contact has that ID", status: 404 }
2121
2176
  });
2122
- var hostTaskStateSchema = z46.enum([
2177
+ var hostTaskStateSchema = z47.enum([
2123
2178
  "ready",
2124
2179
  "running",
2125
2180
  "waiting",
@@ -2129,6 +2184,7 @@ var hostTaskStateSchema = z46.enum([
2129
2184
  "failed",
2130
2185
  "closed"
2131
2186
  ]);
2187
+ var spendStopErrors2 = { SPEND_STOP_STANDS: spendStopStandsError };
2132
2188
  var taskControl2 = oc6.errors({
2133
2189
  TASK_NOT_FOUND: { message: "no task has that ID", status: 404 },
2134
2190
  TASK_STATE_REFUSED: {
@@ -2139,33 +2195,43 @@ var taskControl2 = oc6.errors({
2139
2195
  message: "the runner of the task does not take this control",
2140
2196
  status: 409
2141
2197
  }
2142
- }).input(z46.strictObject({ taskID: z46.string().min(1) })).output(z46.object({
2143
- taskID: z46.string(),
2198
+ }).input(z47.strictObject({ taskID: z47.string().min(1) })).output(z47.object({
2199
+ taskID: z47.string(),
2144
2200
  state: hostTaskStateSchema,
2145
- isPauseRequested: z46.boolean()
2201
+ isPauseRequested: z47.boolean()
2146
2202
  }));
2147
2203
  var hostContract = {
2148
- reset: oc6.output(z46.object({
2149
- resetAt: z46.date(),
2150
- lastSequence: z46.int().nonnegative(),
2151
- keptSessions: z46.int().nonnegative()
2204
+ reset: oc6.output(z47.object({
2205
+ resetAt: z47.date(),
2206
+ lastSequence: z47.int().nonnegative(),
2207
+ keptSessions: z47.int().nonnegative()
2152
2208
  })),
2153
- resetConversations: oc6.output(z46.object({
2154
- resetAt: z46.date(),
2155
- lastSequence: z46.int().nonnegative(),
2156
- shreddedRecords: z46.int().nonnegative(),
2209
+ resetConversations: oc6.output(z47.object({
2210
+ resetAt: z47.date(),
2211
+ lastSequence: z47.int().nonnegative(),
2212
+ shreddedRecords: z47.int().nonnegative(),
2157
2213
  backup: forgetBackupSchema
2158
2214
  })),
2159
2215
  nixie: {
2160
- pause: oc6.output(z46.object({ paused: pauseStateSchema })),
2161
- resume: oc6.output(z46.object({ paused: pauseStateSchema }))
2216
+ pause: oc6.output(z47.object({ paused: pauseStateSchema })),
2217
+ resume: oc6.errors(spendStopErrors2).output(z47.object({ paused: pauseStateSchema }))
2218
+ },
2219
+ spend: {
2220
+ raise: oc6.errors({
2221
+ SPEND_NOT_CONFIGURED: { message: "the config sets no spendStop", status: 409 }
2222
+ }).input(z47.strictObject({ turns: z47.int().positive() })).output(z47.object({
2223
+ start: z47.string(),
2224
+ dollars: z47.number(),
2225
+ tokens: z47.number(),
2226
+ turns: z47.number()
2227
+ }))
2162
2228
  },
2163
2229
  recovery: {
2164
- read: oc6.output(z46.object({ recovery: recoverySchema }))
2230
+ read: oc6.output(z47.object({ recovery: recoverySchema }))
2165
2231
  },
2166
2232
  tasks: {
2167
2233
  pause: taskControl2,
2168
- resume: taskControl2,
2234
+ resume: taskControl2.errors(spendStopErrors2),
2169
2235
  stop: taskControl2,
2170
2236
  restart: taskControl2,
2171
2237
  close: taskControl2.errors({
@@ -2180,109 +2246,109 @@ var hostContract = {
2180
2246
  TASK_NOT_FOUND: { message: "no task has that ID", status: 404 },
2181
2247
  TASK_NOT_AT_LIMIT: { message: "the task is not paused at its limit", status: 409 },
2182
2248
  LIMIT_NOT_RAISED: { message: "the new limits are not above the old ones", status: 409 }
2183
- }).input(z46.strictObject({
2184
- taskID: z46.string().min(1),
2185
- turns: z46.int().positive().optional(),
2186
- dollars: z46.number().positive().optional()
2249
+ }).input(z47.strictObject({
2250
+ taskID: z47.string().min(1),
2251
+ turns: z47.int().positive().optional(),
2252
+ dollars: z47.number().positive().optional()
2187
2253
  }).refine((input) => input.turns !== undefined || input.dollars !== undefined, {
2188
2254
  message: "a raise sets turns, dollars or both"
2189
- })).output(z46.object({
2190
- taskID: z46.string(),
2255
+ })).output(z47.object({
2256
+ taskID: z47.string(),
2191
2257
  state: hostTaskStateSchema,
2192
- isPauseRequested: z46.boolean(),
2193
- turns: z46.int().positive(),
2194
- dollars: z46.number().positive()
2258
+ isPauseRequested: z47.boolean(),
2259
+ turns: z47.int().positive(),
2260
+ dollars: z47.number().positive()
2195
2261
  }))
2196
2262
  },
2197
2263
  sessions: {
2198
- issueCode: oc6.output(z46.object({ code: z46.string(), expiresAt: z46.date() })),
2199
- list: oc6.output(z46.array(hostSessionSchema)),
2264
+ issueCode: oc6.output(z47.object({ code: z47.string(), expiresAt: z47.date() })),
2265
+ list: oc6.output(z47.array(hostSessionSchema)),
2200
2266
  label: oc6.errors({
2201
2267
  SESSION_NOT_FOUND: {
2202
2268
  message: "no device session that is still signed in has that ID",
2203
2269
  status: 404
2204
2270
  },
2205
2271
  LABEL_INVALID: { message: "a label holds 1 to 100 characters besides spaces", status: 400 }
2206
- }).input(z46.strictObject({ sessionID: z46.string().min(1), label: z46.string() })).output(z46.object({ sessionID: z46.string(), label: z46.string() }))
2272
+ }).input(z47.strictObject({ sessionID: z47.string().min(1), label: z47.string() })).output(z47.object({ sessionID: z47.string(), label: z47.string() }))
2207
2273
  },
2208
2274
  passkeys: hostPasskeyContract,
2209
2275
  memory: {
2210
2276
  proposals: {
2211
- list: memory.output(z46.array(pendingProposalSchema)),
2277
+ list: memory.output(z47.array(pendingProposalSchema)),
2212
2278
  approve: memory.input(proposalAnswerSchema.extend({
2213
2279
  revisionOf: versionTargetSchema2.optional(),
2214
- ignoreCloseMatch: z46.boolean().optional(),
2280
+ ignoreCloseMatch: z47.boolean().optional(),
2215
2281
  editedText: itemTextSchema.optional()
2216
2282
  })).output(approvalResultSchema),
2217
- reject: memory.input(proposalAnswerSchema.extend({ reason: z46.string().max(500).regex(/\S/u).optional() })).output(z46.object({ proposalID: z46.string() }))
2283
+ reject: memory.input(proposalAnswerSchema.extend({ reason: z47.string().max(500).regex(/\S/u).optional() })).output(z47.object({ proposalID: z47.string() }))
2218
2284
  },
2219
- subjects: memory.output(z46.object({ items: subjectCountSchema, proposals: subjectCountSchema })),
2285
+ subjects: memory.output(z47.object({ items: subjectCountSchema, proposals: subjectCountSchema })),
2220
2286
  items: {
2221
- read: memory.input(z46.strictObject({ itemID: z46.string().min(1) })).output(itemHistorySchema),
2287
+ read: memory.input(z47.strictObject({ itemID: z47.string().min(1) })).output(itemHistorySchema),
2222
2288
  edit: memory.input(versionTargetSchema2.extend({ text: itemTextSchema })).output(versionRefSchema2),
2223
2289
  retire: memory.input(versionTargetSchema2).output(versionRefSchema2),
2224
2290
  restore: memory.input(versionTargetSchema2).output(versionRefSchema2),
2225
- forget: memory.input(versionTargetSchema2).output(z46.object({ itemID: z46.string(), backup: forgetBackupSchema })),
2291
+ forget: memory.input(versionTargetSchema2).output(z47.object({ itemID: z47.string(), backup: forgetBackupSchema })),
2226
2292
  forgetAll: memory.output(forgottenItemsSchema),
2227
- pin: memory.input(z46.strictObject({ itemID: z46.string().min(1), isPinned: z46.boolean() })).output(z46.object({ itemID: z46.string(), isPinned: z46.boolean() }))
2293
+ pin: memory.input(z47.strictObject({ itemID: z47.string().min(1), isPinned: z47.boolean() })).output(z47.object({ itemID: z47.string(), isPinned: z47.boolean() }))
2228
2294
  }
2229
2295
  },
2230
2296
  skills: {
2231
2297
  proposals: {
2232
- list: skills.output(z46.array(pendingSkillProposalSchema)),
2233
- approve: skills.input(skillAnswerSchema.extend({ files: z46.array(skillFileSchema).min(1).optional() })).output(z46.object({ proposalID: z46.string(), approvalID: z46.string(), skillHash: z46.string() })),
2234
- reject: skills.input(skillAnswerSchema.extend({ reason: z46.string().max(500).regex(/\S/u) })).output(z46.object({ proposalID: z46.string() }))
2298
+ list: skills.output(z47.array(pendingSkillProposalSchema)),
2299
+ approve: skills.input(skillAnswerSchema.extend({ files: z47.array(skillFileSchema).min(1).optional() })).output(z47.object({ proposalID: z47.string(), approvalID: z47.string(), skillHash: z47.string() })),
2300
+ reject: skills.input(skillAnswerSchema.extend({ reason: z47.string().max(500).regex(/\S/u) })).output(z47.object({ proposalID: z47.string() }))
2235
2301
  },
2236
2302
  written: {
2237
- list: skills.output(z46.array(writtenSkillSchema)),
2238
- resolve: skills.input(z46.strictObject({
2239
- approvalID: z46.string().min(1),
2240
- keep: z46.enum(["nixie", "definitions"])
2241
- })).output(z46.object({ approvalID: z46.string(), keep: z46.enum(["nixie", "definitions"]) }))
2303
+ list: skills.output(z47.array(writtenSkillSchema)),
2304
+ resolve: skills.input(z47.strictObject({
2305
+ approvalID: z47.string().min(1),
2306
+ keep: z47.enum(["nixie", "definitions"])
2307
+ })).output(z47.object({ approvalID: z47.string(), keep: z47.enum(["nixie", "definitions"]) }))
2242
2308
  }
2243
2309
  },
2244
2310
  rules: {
2245
- list: rules.output(z46.array(ruleInForceSchema)),
2246
- conflicts: rules.output(z46.array(ruleConflictSchema)),
2247
- resolve: rules.input(z46.strictObject({ ruleID: z46.string().min(1), keep: z46.enum(["nixie", "repo"]) })).output(z46.object({ ruleID: z46.string(), changeID: z46.string(), keep: z46.enum(["nixie", "repo"]) })),
2311
+ list: rules.output(z47.array(ruleInForceSchema)),
2312
+ conflicts: rules.output(z47.array(ruleConflictSchema)),
2313
+ resolve: rules.input(z47.strictObject({ ruleID: z47.string().min(1), keep: z47.enum(["nixie", "repo"]) })).output(z47.object({ ruleID: z47.string(), changeID: z47.string(), keep: z47.enum(["nixie", "repo"]) })),
2248
2314
  proposals: {
2249
- list: rules.output(z46.array(pendingRuleProposalSchema)),
2250
- approve: rules.input(ruleProposalAnswerSchema).output(z46.object({ proposalID: z46.string() })),
2251
- reject: rules.input(ruleProposalRejectionSchema).output(z46.object({ proposalID: z46.string() }))
2315
+ list: rules.output(z47.array(pendingRuleProposalSchema)),
2316
+ approve: rules.input(ruleProposalAnswerSchema).output(z47.object({ proposalID: z47.string() })),
2317
+ reject: rules.input(ruleProposalRejectionSchema).output(z47.object({ proposalID: z47.string() }))
2252
2318
  }
2253
2319
  },
2254
2320
  definitions: {
2255
- resolve: definitions.input(z46.strictObject({ definitionID: z46.string().min(1), keep: z46.enum(["nixie", "repo"]) })).output(z46.object({
2256
- definitionID: z46.string(),
2257
- changeID: z46.string(),
2258
- keep: z46.enum(["nixie", "repo"])
2321
+ resolve: definitions.input(z47.strictObject({ definitionID: z47.string().min(1), keep: z47.enum(["nixie", "repo"]) })).output(z47.object({
2322
+ definitionID: z47.string(),
2323
+ changeID: z47.string(),
2324
+ keep: z47.enum(["nixie", "repo"])
2259
2325
  }))
2260
2326
  },
2261
2327
  actions: {
2262
2328
  proposals: {
2263
- list: rules.output(z46.array(actionProposalSchema)),
2264
- approve: rules.input(ruleProposalAnswerSchema).output(z46.object({ proposalID: z46.string() })),
2265
- reject: rules.input(actionRejectionSchema).output(z46.object({ proposalID: z46.string() }))
2329
+ list: rules.output(z47.array(actionProposalSchema)),
2330
+ approve: rules.input(ruleProposalAnswerSchema).output(z47.object({ proposalID: z47.string() })),
2331
+ reject: rules.input(actionRejectionSchema).output(z47.object({ proposalID: z47.string() }))
2266
2332
  }
2267
2333
  },
2268
2334
  mandates: hostMandatesContract,
2269
2335
  contacts: {
2270
- list: contacts.output(z46.array(knownContactSchema)),
2271
- markKnown: contacts.input(z46.strictObject({
2272
- destination: z46.string().min(1).max(500),
2273
- name: z46.string().min(1).max(200).optional()
2274
- })).output(z46.object({ contact: knownContactSchema, isNew: z46.boolean() })),
2275
- unmark: contacts.input(z46.strictObject({ contactID: z46.string().min(1) })).output(z46.object({ contactID: z46.string() }))
2336
+ list: contacts.output(z47.array(knownContactSchema)),
2337
+ markKnown: contacts.input(z47.strictObject({
2338
+ destination: z47.string().min(1).max(500),
2339
+ name: z47.string().min(1).max(200).optional()
2340
+ })).output(z47.object({ contact: knownContactSchema, isNew: z47.boolean() })),
2341
+ unmark: contacts.input(z47.strictObject({ contactID: z47.string().min(1) })).output(z47.object({ contactID: z47.string() }))
2276
2342
  },
2277
2343
  turnInputs: turnInputsContract,
2278
2344
  prompts: {
2279
2345
  proposals: {
2280
- list: prompts.output(z46.array(pendingPromptProposalSchema)),
2346
+ list: prompts.output(z47.array(pendingPromptProposalSchema)),
2281
2347
  approve: prompts.input(promptAnswerSchema.extend({
2282
2348
  entry: promptEntrySchema.optional(),
2283
- files: z46.array(promptPartFileSchema).optional()
2284
- })).output(z46.object({ proposalID: z46.string(), approvalID: z46.string(), proposalHash: z46.string() })),
2285
- reject: prompts.input(promptAnswerSchema.extend({ reason: z46.string().max(500).regex(/\S/u) })).output(z46.object({ proposalID: z46.string() }))
2349
+ files: z47.array(promptPartFileSchema).optional()
2350
+ })).output(z47.object({ proposalID: z47.string(), approvalID: z47.string(), proposalHash: z47.string() })),
2351
+ reject: prompts.input(promptAnswerSchema.extend({ reason: z47.string().max(500).regex(/\S/u) })).output(z47.object({ proposalID: z47.string() }))
2286
2352
  }
2287
2353
  }
2288
2354
  };
@@ -2391,11 +2457,11 @@ function renderSessionCookie(token) {
2391
2457
  return `${sessionCookieName}=${token ?? ""}; Path=/; HttpOnly; Secure; SameSite=Lax; Max-Age=${maxAgeS}`;
2392
2458
  }
2393
2459
  // src/message/task-message-input-schema.ts
2394
- import { z as z48 } from "zod";
2460
+ import { z as z49 } from "zod";
2395
2461
 
2396
2462
  // src/message/task-message-kind-schema.ts
2397
- import { z as z47 } from "zod";
2398
- var taskMessageKindSchema = z47.enum([
2463
+ import { z as z48 } from "zod";
2464
+ var taskMessageKindSchema = z48.enum([
2399
2465
  "progress",
2400
2466
  "question",
2401
2467
  "request",
@@ -2405,21 +2471,21 @@ var taskMessageKindSchema = z47.enum([
2405
2471
  ]);
2406
2472
 
2407
2473
  // src/message/task-message-input-schema.ts
2408
- var taskMessageInputSchema = z48.object({
2409
- to: z48.string(),
2474
+ var taskMessageInputSchema = z49.object({
2475
+ to: z49.string(),
2410
2476
  kind: taskMessageKindSchema,
2411
- body: z48.string(),
2412
- replyTo: z48.string().optional(),
2413
- onBehalfOf: z48.string().array().optional(),
2414
- wake: z48.boolean().optional()
2477
+ body: z49.string(),
2478
+ replyTo: z49.string().optional(),
2479
+ onBehalfOf: z49.string().array().optional(),
2480
+ wake: z49.boolean().optional()
2415
2481
  });
2416
2482
  // src/message/task-message-result-schema.ts
2417
- import { z as z49 } from "zod";
2418
- var taskMessageResultSchema = z49.object({
2419
- messageID: z49.string(),
2420
- woke: z49.boolean(),
2421
- hop: z49.int().nonnegative(),
2422
- note: z49.string().optional()
2483
+ import { z as z50 } from "zod";
2484
+ var taskMessageResultSchema = z50.object({
2485
+ messageID: z50.string(),
2486
+ woke: z50.boolean(),
2487
+ hop: z50.int().nonnegative(),
2488
+ note: z50.string().optional()
2423
2489
  });
2424
2490
  export {
2425
2491
  buildPendingInput,
@@ -2441,6 +2507,7 @@ export {
2441
2507
  sessionCookieName,
2442
2508
  skipReasonSchema,
2443
2509
  spanSchema,
2510
+ spendStopSchema,
2444
2511
  taskMessageInputSchema,
2445
2512
  taskMessageKindSchema,
2446
2513
  taskMessageResultSchema,