@heynixie/contract 0.77.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/contract/build-query-utils.d.ts +83 -3
- package/dist/contract/contract.d.ts +87 -2
- package/dist/contract/host-contract.d.ts +27 -2
- package/dist/contract/memory-view-contract.d.ts +3 -0
- package/dist/contract/spend-stop-schema.d.ts +66 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +623 -556
- package/package.json +1 -1
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
|
|
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([
|
|
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/
|
|
1253
|
+
// src/contract/spend-stop-schema.ts
|
|
1244
1254
|
import { z as z31 } from "zod";
|
|
1245
|
-
var
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
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
|
|
1259
|
-
var jsonObjectSchema2 =
|
|
1260
|
-
var toolCallSchema =
|
|
1261
|
-
callID:
|
|
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:
|
|
1265
|
-
runID:
|
|
1266
|
-
tool:
|
|
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
|
|
1320
|
+
import { z as z36 } from "zod";
|
|
1271
1321
|
|
|
1272
1322
|
// src/contract/trigger-schema.ts
|
|
1273
|
-
import { z as
|
|
1323
|
+
import { z as z35 } from "zod";
|
|
1274
1324
|
|
|
1275
1325
|
// src/contract/schedule-schema.ts
|
|
1276
|
-
import { z as
|
|
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 =
|
|
1289
|
-
var minutesSchema =
|
|
1290
|
-
minutes:
|
|
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 =
|
|
1293
|
-
var scheduleSchema =
|
|
1294
|
-
every:
|
|
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:
|
|
1298
|
-
idleMinutes:
|
|
1299
|
-
zone:
|
|
1300
|
-
catchUp:
|
|
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 =
|
|
1328
|
-
var triggerSchema =
|
|
1329
|
-
|
|
1330
|
-
|
|
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 =
|
|
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 =
|
|
1342
|
-
runID:
|
|
1391
|
+
var endedRunSchema = z36.object({
|
|
1392
|
+
runID: z36.string(),
|
|
1343
1393
|
taskID: threadSchema,
|
|
1344
|
-
definitionID:
|
|
1345
|
-
startedAt:
|
|
1346
|
-
endedAt:
|
|
1394
|
+
definitionID: z36.string().nullable(),
|
|
1395
|
+
startedAt: z36.date(),
|
|
1396
|
+
endedAt: z36.date(),
|
|
1347
1397
|
sequence: sequenceSchema,
|
|
1348
|
-
cause:
|
|
1349
|
-
endedBy:
|
|
1350
|
-
carriesRunID:
|
|
1351
|
-
reportID:
|
|
1352
|
-
delivery:
|
|
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:
|
|
1355
|
-
});
|
|
1356
|
-
var reportEntrySchema =
|
|
1357
|
-
definitionID:
|
|
1358
|
-
name:
|
|
1359
|
-
kind:
|
|
1360
|
-
scheduledFor:
|
|
1361
|
-
firedAt:
|
|
1362
|
-
lateBySeconds:
|
|
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 =
|
|
1367
|
-
definitionID:
|
|
1368
|
-
name:
|
|
1369
|
-
enabled:
|
|
1370
|
-
target:
|
|
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:
|
|
1373
|
-
next:
|
|
1374
|
-
tools:
|
|
1375
|
-
origin:
|
|
1376
|
-
createdBy:
|
|
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:
|
|
1428
|
+
kind: z36.enum(["definition.changed", "definitions_seeded"])
|
|
1379
1429
|
}),
|
|
1380
1430
|
taskID: threadSchema.nullable(),
|
|
1381
|
-
isUnreadable:
|
|
1431
|
+
isUnreadable: z36.boolean()
|
|
1382
1432
|
});
|
|
1383
1433
|
var viewContract = {
|
|
1384
1434
|
tasks: {
|
|
1385
|
-
listEnded: signedIn.input(
|
|
1386
|
-
limit:
|
|
1435
|
+
listEnded: signedIn.input(z36.object({
|
|
1436
|
+
limit: z36.int().min(1).max(100),
|
|
1387
1437
|
before: sequenceSchema.optional(),
|
|
1388
|
-
definitionID:
|
|
1389
|
-
})).output(
|
|
1390
|
-
tasks:
|
|
1391
|
-
runs:
|
|
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(
|
|
1397
|
-
since:
|
|
1398
|
-
definitionID:
|
|
1399
|
-
})).output(
|
|
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(
|
|
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
|
|
1408
|
-
var usedSchema =
|
|
1409
|
-
minutes:
|
|
1410
|
-
turns:
|
|
1411
|
-
tokens:
|
|
1412
|
-
dollars:
|
|
1413
|
-
});
|
|
1414
|
-
var startedSchema =
|
|
1415
|
-
phase:
|
|
1416
|
-
workerRunID:
|
|
1417
|
-
shortID:
|
|
1418
|
-
callID:
|
|
1419
|
-
model:
|
|
1420
|
-
tools:
|
|
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:
|
|
1423
|
-
});
|
|
1424
|
-
var turnSchema =
|
|
1425
|
-
phase:
|
|
1426
|
-
workerRunID:
|
|
1427
|
-
callID:
|
|
1428
|
-
turn:
|
|
1429
|
-
tokens:
|
|
1430
|
-
dollars:
|
|
1431
|
-
text:
|
|
1432
|
-
});
|
|
1433
|
-
var endedSchema =
|
|
1434
|
-
phase:
|
|
1435
|
-
workerRunID:
|
|
1436
|
-
callID:
|
|
1437
|
-
outcome:
|
|
1438
|
-
limit:
|
|
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:
|
|
1490
|
+
detail: z37.string().optional()
|
|
1441
1491
|
});
|
|
1442
|
-
var workerViewSchema =
|
|
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 =
|
|
1450
|
-
var imageSchema =
|
|
1451
|
-
var imageFilesSchema =
|
|
1452
|
-
var imageRefSchema =
|
|
1453
|
-
position:
|
|
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 =
|
|
1458
|
-
itemID:
|
|
1459
|
-
version:
|
|
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:
|
|
1462
|
-
var recallSchema =
|
|
1463
|
-
var tokenCountSchema =
|
|
1464
|
-
var contextSchema =
|
|
1465
|
-
var compactionSchema =
|
|
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:
|
|
1518
|
+
trigger: z38.enum(["manual", "auto"])
|
|
1469
1519
|
});
|
|
1470
|
-
var summarySchema =
|
|
1520
|
+
var summarySchema = z38.object({
|
|
1471
1521
|
contextSize: tokenCountSchema.optional(),
|
|
1472
1522
|
summaryTokens: tokenCountSchema,
|
|
1473
|
-
text:
|
|
1474
|
-
trigger:
|
|
1523
|
+
text: z38.string().optional(),
|
|
1524
|
+
trigger: z38.enum(["threshold", "overflow"])
|
|
1475
1525
|
});
|
|
1476
|
-
var compactionFailureSchema =
|
|
1526
|
+
var compactionFailureSchema = z38.object({ failures: z38.int().positive() });
|
|
1477
1527
|
var versionTextSchema = versionRefSchema.extend({
|
|
1478
|
-
status:
|
|
1479
|
-
text:
|
|
1528
|
+
status: z38.enum(["readable", "shredded", "unreadable", "missing"]),
|
|
1529
|
+
text: z38.string().optional()
|
|
1480
1530
|
});
|
|
1481
|
-
var listedActionSchema =
|
|
1482
|
-
var taskMessageSchema =
|
|
1531
|
+
var listedActionSchema = z38.object({ actionID: z38.string(), tool: z38.string() });
|
|
1532
|
+
var taskMessageSchema = z38.object({
|
|
1483
1533
|
from: threadSchema,
|
|
1484
|
-
fromName:
|
|
1485
|
-
hop:
|
|
1486
|
-
kind:
|
|
1487
|
-
messageID:
|
|
1488
|
-
replyTo:
|
|
1489
|
-
text:
|
|
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:
|
|
1541
|
+
woke: z38.boolean()
|
|
1492
1542
|
});
|
|
1493
|
-
var exchangeNoticeSchema =
|
|
1494
|
-
link:
|
|
1495
|
-
text:
|
|
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 =
|
|
1498
|
-
brief:
|
|
1499
|
-
scheduledFor:
|
|
1500
|
-
lateBySeconds:
|
|
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 =
|
|
1503
|
-
clipped:
|
|
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:
|
|
1558
|
+
forget: z38.object({ sequence: sequenceSchema }).optional(),
|
|
1509
1559
|
context: contextSchema.optional(),
|
|
1510
1560
|
definitionNotice: definitionNoticeSchema.optional(),
|
|
1511
|
-
isRemoved:
|
|
1512
|
-
isSilentTurn:
|
|
1513
|
-
kind:
|
|
1514
|
-
message:
|
|
1515
|
-
clientMessageId:
|
|
1516
|
-
images:
|
|
1517
|
-
spans:
|
|
1518
|
-
text:
|
|
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:
|
|
1521
|
-
proposal:
|
|
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:
|
|
1524
|
-
removal:
|
|
1573
|
+
recordedAt: z38.date(),
|
|
1574
|
+
removal: z38.object({ kind: z38.string(), sequence: sequenceSchema, callSequence: sequenceSchema.optional() }).optional(),
|
|
1525
1575
|
sequence: sequenceSchema,
|
|
1526
|
-
stop:
|
|
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 =
|
|
1535
|
-
var sessionSchema =
|
|
1536
|
-
createdAt:
|
|
1537
|
-
current:
|
|
1538
|
-
deviceName:
|
|
1539
|
-
lastUsedAt:
|
|
1540
|
-
sessionID:
|
|
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 =
|
|
1544
|
-
var recordForgetPreviewSchema =
|
|
1593
|
+
var forgetPreviewItemSchema = z38.object({ itemID: z38.string(), text: z38.string() });
|
|
1594
|
+
var recordForgetPreviewSchema = z38.object({
|
|
1545
1595
|
momentCount: actionCountSchema,
|
|
1546
|
-
memoryItems:
|
|
1596
|
+
memoryItems: z38.array(forgetPreviewItemSchema)
|
|
1547
1597
|
});
|
|
1548
|
-
var controlledTaskSchema =
|
|
1549
|
-
controlledAt:
|
|
1550
|
-
isPauseRequested:
|
|
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:
|
|
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(
|
|
1566
|
-
var markedTaskSchema =
|
|
1567
|
-
changedAt:
|
|
1568
|
-
disposable:
|
|
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(
|
|
1572
|
-
var
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
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(
|
|
1628
|
+
var followRecords = signedIn.input(z38.object({
|
|
1578
1629
|
afterSequence: sequenceSchema,
|
|
1579
|
-
clipPayloads:
|
|
1630
|
+
clipPayloads: z38.boolean().optional(),
|
|
1580
1631
|
thread: threadSchema.optional()
|
|
1581
|
-
})).output(eventIterator2(
|
|
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(
|
|
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:
|
|
1587
|
-
limit:
|
|
1637
|
+
clipPayloads: z38.boolean().optional(),
|
|
1638
|
+
limit: z38.int().min(1).max(200).optional(),
|
|
1588
1639
|
thread: threadSchema
|
|
1589
|
-
})).output(
|
|
1590
|
-
hasEarlier:
|
|
1640
|
+
})).output(z38.object({
|
|
1641
|
+
hasEarlier: z38.boolean(),
|
|
1591
1642
|
readAtSequence: sequenceSchema,
|
|
1592
|
-
records:
|
|
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(
|
|
1649
|
+
}).input(z38.object({
|
|
1599
1650
|
clientMessageId: clientActionIDSchema2,
|
|
1600
1651
|
images: imageFilesSchema.optional(),
|
|
1601
|
-
spans:
|
|
1602
|
-
text:
|
|
1652
|
+
spans: z38.array(spanSchema).max(1e5),
|
|
1653
|
+
text: z38.string().min(1).max(1e5),
|
|
1603
1654
|
thread: threadSchema,
|
|
1604
|
-
timeZone:
|
|
1605
|
-
writtenAt:
|
|
1606
|
-
})).output(
|
|
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(
|
|
1613
|
-
readImage: signedIn.errors({ IMAGE_NOT_FOUND: imageNotFoundError }).input(imageRefSchema).output(
|
|
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(
|
|
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(
|
|
1680
|
+
}).input(z38.object({
|
|
1630
1681
|
clientActionID: clientActionIDSchema2,
|
|
1631
1682
|
sequence: sequenceSchema,
|
|
1632
1683
|
thread: threadSchema
|
|
1633
|
-
})).output(
|
|
1684
|
+
})).output(z38.object({ forgottenAt: z38.date(), backup: forgetBackupSchema }))
|
|
1634
1685
|
},
|
|
1635
1686
|
tasks: {
|
|
1636
|
-
list: signedIn.input(
|
|
1637
|
-
definitionID:
|
|
1638
|
-
states:
|
|
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(
|
|
1642
|
-
read: signedIn.errors({ TASK_NOT_FOUND: { message: "No task has this ID", status: 404 } }).input(
|
|
1643
|
-
readActions: signedIn.errors({ TASK_NOT_FOUND: { message: "No task has this ID", status: 404 } }).input(
|
|
1644
|
-
queued:
|
|
1645
|
-
started:
|
|
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:
|
|
1716
|
+
data: z38.object({ state: taskStateSchema })
|
|
1666
1717
|
}
|
|
1667
|
-
}).input(
|
|
1718
|
+
}).input(z38.object({
|
|
1668
1719
|
clientActionID: clientActionIDSchema2,
|
|
1669
|
-
disposable:
|
|
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(
|
|
1676
|
-
writerStatus: signedIn.route({ deprecated: true }).output(
|
|
1677
|
-
isEnabled:
|
|
1678
|
-
backlog:
|
|
1679
|
-
batches:
|
|
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:
|
|
1682
|
-
isCatchingUp:
|
|
1732
|
+
failures: z38.int().nonnegative(),
|
|
1733
|
+
isCatchingUp: z38.boolean(),
|
|
1683
1734
|
lastError: writerErrorSchema,
|
|
1684
|
-
retryAt:
|
|
1735
|
+
retryAt: z38.date().nullable()
|
|
1685
1736
|
})),
|
|
1686
1737
|
...memoryViewContract
|
|
1687
1738
|
},
|
|
1688
1739
|
nixie: {
|
|
1689
|
-
read: signedIn.output(
|
|
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(
|
|
1749
|
+
read: signedIn.output(z38.object({ recovery: recoverySchema }))
|
|
1695
1750
|
},
|
|
1696
1751
|
backups: {
|
|
1697
|
-
readNotice: signedIn.output(
|
|
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(
|
|
1772
|
+
}).input(z38.object({
|
|
1718
1773
|
clientActionID: clientActionIDSchema2,
|
|
1719
|
-
code:
|
|
1720
|
-
deviceName:
|
|
1721
|
-
tokenDelivery:
|
|
1722
|
-
})).output(
|
|
1723
|
-
issueCode: checkedAction.input(
|
|
1724
|
-
list: signedIn.output(
|
|
1725
|
-
revoke: checkedAction.errors({ SESSION_NOT_FOUND: { message: "No session has this ID", status: 404 } }).input(
|
|
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
|
|
1785
|
+
import { z as z47 } from "zod";
|
|
1731
1786
|
|
|
1732
1787
|
// src/contract/action-proposal-schema.ts
|
|
1733
|
-
import { z as
|
|
1734
|
-
var actionProposalSchema =
|
|
1735
|
-
proposalID:
|
|
1736
|
-
tool:
|
|
1737
|
-
effects:
|
|
1738
|
-
cause:
|
|
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:
|
|
1747
|
-
destinations:
|
|
1748
|
-
createdAt:
|
|
1749
|
-
lapseAt:
|
|
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
|
|
1754
|
-
var forgottenItemsSchema =
|
|
1755
|
-
itemIDs:
|
|
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
|
|
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 =
|
|
1766
|
-
var hostMandateSchema =
|
|
1767
|
-
mandateID:
|
|
1768
|
-
title:
|
|
1769
|
-
rules:
|
|
1770
|
-
startedAt:
|
|
1771
|
-
expires:
|
|
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(
|
|
1775
|
-
end: mandates.input(
|
|
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
|
|
1781
|
-
var hostPasskeySchema =
|
|
1782
|
-
passkeyID:
|
|
1783
|
-
label:
|
|
1784
|
-
synced:
|
|
1785
|
-
origin:
|
|
1786
|
-
registeredBy:
|
|
1787
|
-
authorizedBy:
|
|
1788
|
-
registeredAt:
|
|
1789
|
-
lastUsedAt:
|
|
1790
|
-
revokedAt:
|
|
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(
|
|
1794
|
-
list: oc4.output(
|
|
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(
|
|
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
|
|
1802
|
-
var knownContactSchema =
|
|
1803
|
-
contactID:
|
|
1804
|
-
name:
|
|
1805
|
-
destination:
|
|
1806
|
-
markedAt:
|
|
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
|
|
1866
|
+
import { z as z46 } from "zod";
|
|
1812
1867
|
|
|
1813
1868
|
// src/contract/input-miss-schema.ts
|
|
1814
|
-
import { z as
|
|
1815
|
-
var inputMissSchema =
|
|
1816
|
-
missID:
|
|
1817
|
-
captureID:
|
|
1818
|
-
taskID:
|
|
1819
|
-
stepRunID:
|
|
1820
|
-
reason:
|
|
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:
|
|
1833
|
-
writer:
|
|
1834
|
-
counter:
|
|
1835
|
-
createdAt:
|
|
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
|
|
1840
|
-
var loggedInputSchema =
|
|
1841
|
-
inputID:
|
|
1842
|
-
captureID:
|
|
1843
|
-
taskID:
|
|
1844
|
-
stepRunID:
|
|
1845
|
-
writer:
|
|
1846
|
-
counter:
|
|
1847
|
-
role:
|
|
1848
|
-
profile:
|
|
1849
|
-
model:
|
|
1850
|
-
harness:
|
|
1851
|
-
api:
|
|
1852
|
-
endpoint:
|
|
1853
|
-
route:
|
|
1854
|
-
isRewritten:
|
|
1855
|
-
upstreamStatus:
|
|
1856
|
-
bytes:
|
|
1857
|
-
intakeSequence:
|
|
1858
|
-
receivedAt:
|
|
1859
|
-
takenAt:
|
|
1860
|
-
state:
|
|
1861
|
-
removedCause:
|
|
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 =
|
|
1866
|
-
state:
|
|
1867
|
-
forMs:
|
|
1920
|
+
var turnInputOn = z46.strictObject({
|
|
1921
|
+
state: z46.literal("on"),
|
|
1922
|
+
forMs: z46.int().positive().nullable()
|
|
1868
1923
|
});
|
|
1869
|
-
var turnInputOff =
|
|
1870
|
-
var turnInputSetSchema =
|
|
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 =
|
|
1881
|
-
inputs:
|
|
1882
|
-
misses:
|
|
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(
|
|
1886
|
-
open: turnInputs.input(
|
|
1887
|
-
set: turnInputs.input(turnInputSetSchema).output(
|
|
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 =
|
|
1892
|
-
var versionTargetSchema2 =
|
|
1893
|
-
itemID:
|
|
1894
|
-
version:
|
|
1895
|
-
});
|
|
1896
|
-
var itemTextSchema =
|
|
1897
|
-
var proposalOriginSchema2 =
|
|
1898
|
-
var memoryOriginSchema =
|
|
1899
|
-
var contentSourceSchema =
|
|
1900
|
-
var reviewReasonSchema2 =
|
|
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 =
|
|
1974
|
+
var proposalSourceSchema2 = z47.object({
|
|
1920
1975
|
origin: proposalOriginSchema2,
|
|
1921
|
-
thread:
|
|
1922
|
-
proposedAt:
|
|
1923
|
-
});
|
|
1924
|
-
var pendingProposalSchema =
|
|
1925
|
-
proposalID:
|
|
1926
|
-
operation:
|
|
1927
|
-
itemID:
|
|
1928
|
-
targetVersion:
|
|
1929
|
-
isPinned:
|
|
1930
|
-
subject:
|
|
1931
|
-
newSubject:
|
|
1932
|
-
kind:
|
|
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:
|
|
1989
|
+
actionHash: z47.string(),
|
|
1935
1990
|
origin: proposalOriginSchema2,
|
|
1936
1991
|
source: contentSourceSchema,
|
|
1937
|
-
createdAt:
|
|
1938
|
-
lapseAt:
|
|
1939
|
-
sources:
|
|
1940
|
-
text:
|
|
1941
|
-
quote:
|
|
1942
|
-
});
|
|
1943
|
-
var closeMatchSchema2 =
|
|
1944
|
-
var approvalResultSchema =
|
|
1945
|
-
|
|
1946
|
-
|
|
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 =
|
|
1949
|
-
version:
|
|
1950
|
-
change:
|
|
1951
|
-
state:
|
|
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:
|
|
1955
|
-
isRemoved:
|
|
1956
|
-
isBridge:
|
|
1957
|
-
status:
|
|
1958
|
-
text:
|
|
1959
|
-
});
|
|
1960
|
-
var itemHistorySchema =
|
|
1961
|
-
itemID:
|
|
1962
|
-
subject:
|
|
1963
|
-
kind:
|
|
1964
|
-
state:
|
|
1965
|
-
versions:
|
|
1966
|
-
});
|
|
1967
|
-
var proposalAnswerSchema =
|
|
1968
|
-
proposalID:
|
|
1969
|
-
actionHash:
|
|
1970
|
-
});
|
|
1971
|
-
var hostSessionSchema =
|
|
1972
|
-
sessionID:
|
|
1973
|
-
deviceName:
|
|
1974
|
-
createdAt:
|
|
1975
|
-
lastUsedAt:
|
|
1976
|
-
});
|
|
1977
|
-
var subjectCountSchema =
|
|
1978
|
-
owner:
|
|
1979
|
-
shared:
|
|
1980
|
-
self:
|
|
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 =
|
|
1996
|
-
var pendingSkillProposalSchema =
|
|
1997
|
-
proposalID:
|
|
1998
|
-
name:
|
|
1999
|
-
skillHash:
|
|
2000
|
-
baseHash:
|
|
2001
|
-
files:
|
|
2002
|
-
inForce:
|
|
2003
|
-
skillHash:
|
|
2004
|
-
origin:
|
|
2005
|
-
files:
|
|
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:
|
|
2008
|
-
thread:
|
|
2009
|
-
provenance:
|
|
2010
|
-
createdAt:
|
|
2011
|
-
lapseAt:
|
|
2012
|
-
isStale:
|
|
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 =
|
|
2015
|
-
proposalID:
|
|
2016
|
-
skillHash:
|
|
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 =
|
|
2027
|
-
var writtenSkillSchema =
|
|
2028
|
-
approvalID:
|
|
2029
|
-
proposalID:
|
|
2030
|
-
name:
|
|
2031
|
-
skillHash:
|
|
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:
|
|
2035
|
-
pullRequestURL:
|
|
2036
|
-
approvedAt:
|
|
2037
|
-
});
|
|
2038
|
-
var promptPartFileSchema =
|
|
2039
|
-
var promptEntrySchema =
|
|
2040
|
-
var pendingPromptProposalSchema =
|
|
2041
|
-
proposalID:
|
|
2042
|
-
promptID:
|
|
2043
|
-
proposalHash:
|
|
2044
|
-
baseHash:
|
|
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:
|
|
2047
|
-
reason:
|
|
2048
|
-
inForce:
|
|
2049
|
-
thread:
|
|
2050
|
-
provenance:
|
|
2051
|
-
createdAt:
|
|
2052
|
-
lapseAt:
|
|
2053
|
-
isStale:
|
|
2054
|
-
});
|
|
2055
|
-
var promptAnswerSchema =
|
|
2056
|
-
proposalID:
|
|
2057
|
-
proposalHash:
|
|
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 =
|
|
2067
|
-
var ruleInForceSchema =
|
|
2068
|
-
ruleID:
|
|
2069
|
-
revision:
|
|
2070
|
-
ruleHash:
|
|
2071
|
-
sentence:
|
|
2072
|
-
origin:
|
|
2073
|
-
changeID:
|
|
2074
|
-
lastFiredAt:
|
|
2075
|
-
});
|
|
2076
|
-
var ruleConflictSchema =
|
|
2077
|
-
ruleID:
|
|
2078
|
-
changeID:
|
|
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:
|
|
2083
|
-
reason:
|
|
2084
|
-
changedAt:
|
|
2137
|
+
changedBy: z47.enum(["owner", "nixie"]),
|
|
2138
|
+
reason: z47.string(),
|
|
2139
|
+
changedAt: z47.date()
|
|
2085
2140
|
});
|
|
2086
|
-
var ruleProposalChangeSchema =
|
|
2087
|
-
ruleID:
|
|
2141
|
+
var ruleProposalChangeSchema = z47.object({
|
|
2142
|
+
ruleID: z47.string(),
|
|
2088
2143
|
before: ruleVersionSchema,
|
|
2089
2144
|
after: ruleVersionSchema
|
|
2090
2145
|
});
|
|
2091
|
-
var effectChangeSchema =
|
|
2092
|
-
tool:
|
|
2093
|
-
remove:
|
|
2094
|
-
sentence:
|
|
2146
|
+
var effectChangeSchema = z47.object({
|
|
2147
|
+
tool: z47.string(),
|
|
2148
|
+
remove: z47.array(z47.string()),
|
|
2149
|
+
sentence: z47.string()
|
|
2095
2150
|
});
|
|
2096
|
-
var pendingRuleProposalSchema =
|
|
2097
|
-
proposalID:
|
|
2098
|
-
changes:
|
|
2099
|
-
effectChanges:
|
|
2100
|
-
createdAt:
|
|
2101
|
-
lapseAt:
|
|
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 =
|
|
2158
|
+
var ruleProposalAnswerSchema = z47.strictObject({ proposalID: z47.string().min(1) });
|
|
2104
2159
|
var ruleProposalRejectionSchema = ruleProposalAnswerSchema.extend({
|
|
2105
|
-
reason:
|
|
2160
|
+
reason: z47.string().max(500).regex(/\S/u)
|
|
2106
2161
|
});
|
|
2107
2162
|
var actionRejectionSchema = ruleProposalAnswerSchema.extend({
|
|
2108
|
-
reason:
|
|
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 =
|
|
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(
|
|
2143
|
-
taskID:
|
|
2198
|
+
}).input(z47.strictObject({ taskID: z47.string().min(1) })).output(z47.object({
|
|
2199
|
+
taskID: z47.string(),
|
|
2144
2200
|
state: hostTaskStateSchema,
|
|
2145
|
-
isPauseRequested:
|
|
2201
|
+
isPauseRequested: z47.boolean()
|
|
2146
2202
|
}));
|
|
2147
2203
|
var hostContract = {
|
|
2148
|
-
reset: oc6.output(
|
|
2149
|
-
resetAt:
|
|
2150
|
-
lastSequence:
|
|
2151
|
-
keptSessions:
|
|
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(
|
|
2154
|
-
resetAt:
|
|
2155
|
-
lastSequence:
|
|
2156
|
-
shreddedRecords:
|
|
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(
|
|
2161
|
-
resume: oc6.output(
|
|
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(
|
|
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(
|
|
2184
|
-
taskID:
|
|
2185
|
-
turns:
|
|
2186
|
-
dollars:
|
|
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(
|
|
2190
|
-
taskID:
|
|
2255
|
+
})).output(z47.object({
|
|
2256
|
+
taskID: z47.string(),
|
|
2191
2257
|
state: hostTaskStateSchema,
|
|
2192
|
-
isPauseRequested:
|
|
2193
|
-
turns:
|
|
2194
|
-
dollars:
|
|
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(
|
|
2199
|
-
list: oc6.output(
|
|
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(
|
|
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(
|
|
2277
|
+
list: memory.output(z47.array(pendingProposalSchema)),
|
|
2212
2278
|
approve: memory.input(proposalAnswerSchema.extend({
|
|
2213
2279
|
revisionOf: versionTargetSchema2.optional(),
|
|
2214
|
-
ignoreCloseMatch:
|
|
2280
|
+
ignoreCloseMatch: z47.boolean().optional(),
|
|
2215
2281
|
editedText: itemTextSchema.optional()
|
|
2216
2282
|
})).output(approvalResultSchema),
|
|
2217
|
-
reject: memory.input(proposalAnswerSchema.extend({ reason:
|
|
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(
|
|
2285
|
+
subjects: memory.output(z47.object({ items: subjectCountSchema, proposals: subjectCountSchema })),
|
|
2220
2286
|
items: {
|
|
2221
|
-
read: memory.input(
|
|
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(
|
|
2291
|
+
forget: memory.input(versionTargetSchema2).output(z47.object({ itemID: z47.string(), backup: forgetBackupSchema })),
|
|
2226
2292
|
forgetAll: memory.output(forgottenItemsSchema),
|
|
2227
|
-
pin: memory.input(
|
|
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(
|
|
2233
|
-
approve: skills.input(skillAnswerSchema.extend({ files:
|
|
2234
|
-
reject: skills.input(skillAnswerSchema.extend({ reason:
|
|
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(
|
|
2238
|
-
resolve: skills.input(
|
|
2239
|
-
approvalID:
|
|
2240
|
-
keep:
|
|
2241
|
-
})).output(
|
|
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(
|
|
2246
|
-
conflicts: rules.output(
|
|
2247
|
-
resolve: rules.input(
|
|
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(
|
|
2250
|
-
approve: rules.input(ruleProposalAnswerSchema).output(
|
|
2251
|
-
reject: rules.input(ruleProposalRejectionSchema).output(
|
|
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(
|
|
2256
|
-
definitionID:
|
|
2257
|
-
changeID:
|
|
2258
|
-
keep:
|
|
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(
|
|
2264
|
-
approve: rules.input(ruleProposalAnswerSchema).output(
|
|
2265
|
-
reject: rules.input(actionRejectionSchema).output(
|
|
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(
|
|
2271
|
-
markKnown: contacts.input(
|
|
2272
|
-
destination:
|
|
2273
|
-
name:
|
|
2274
|
-
})).output(
|
|
2275
|
-
unmark: contacts.input(
|
|
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(
|
|
2346
|
+
list: prompts.output(z47.array(pendingPromptProposalSchema)),
|
|
2281
2347
|
approve: prompts.input(promptAnswerSchema.extend({
|
|
2282
2348
|
entry: promptEntrySchema.optional(),
|
|
2283
|
-
files:
|
|
2284
|
-
})).output(
|
|
2285
|
-
reject: prompts.input(promptAnswerSchema.extend({ reason:
|
|
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
|
|
2460
|
+
import { z as z49 } from "zod";
|
|
2395
2461
|
|
|
2396
2462
|
// src/message/task-message-kind-schema.ts
|
|
2397
|
-
import { z as
|
|
2398
|
-
var taskMessageKindSchema =
|
|
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 =
|
|
2409
|
-
to:
|
|
2474
|
+
var taskMessageInputSchema = z49.object({
|
|
2475
|
+
to: z49.string(),
|
|
2410
2476
|
kind: taskMessageKindSchema,
|
|
2411
|
-
body:
|
|
2412
|
-
replyTo:
|
|
2413
|
-
onBehalfOf:
|
|
2414
|
-
wake:
|
|
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
|
|
2418
|
-
var taskMessageResultSchema =
|
|
2419
|
-
messageID:
|
|
2420
|
-
woke:
|
|
2421
|
-
hop:
|
|
2422
|
-
note:
|
|
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,
|