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