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