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