@heynixie/contract 0.73.0 → 0.75.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 +137 -0
- package/dist/contract/build-query-utils.d.ts +308 -2
- package/dist/contract/challenge-for-schema.d.ts +4 -0
- package/dist/contract/contract.d.ts +320 -0
- package/dist/contract/forgettable-kinds.d.ts +1 -1
- package/dist/contract/forgotten-items-schema.d.ts +16 -0
- package/dist/contract/host-contract.d.ts +56 -0
- package/dist/contract/host-mandates-contract.d.ts +32 -0
- package/dist/contract/memory-view-contract.d.ts +7 -0
- package/dist/contract/passkey-contract.d.ts +4 -0
- package/dist/contract/rule-contract.d.ts +123 -0
- package/dist/index.js +461 -311
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -152,6 +152,7 @@ var clientHeaderName = "x-nixie-client";
|
|
|
152
152
|
var forgettableKinds = [
|
|
153
153
|
"action.outcome",
|
|
154
154
|
"action.queued",
|
|
155
|
+
"action.reconcile_checked",
|
|
155
156
|
"action.retry_scheduled",
|
|
156
157
|
"model.compaction_failed",
|
|
157
158
|
"model.reply",
|
|
@@ -165,6 +166,8 @@ var forgettableKinds = [
|
|
|
165
166
|
"proposals.deferred",
|
|
166
167
|
"session.enrolled",
|
|
167
168
|
"session.labelled",
|
|
169
|
+
"rules.mandate_proposed",
|
|
170
|
+
"rules.rule_proposed",
|
|
168
171
|
"session_kept",
|
|
169
172
|
"skills.write_rejected",
|
|
170
173
|
"task.created",
|
|
@@ -468,6 +471,7 @@ var reviewReasonSchema = z8.enum([
|
|
|
468
471
|
"from_photo",
|
|
469
472
|
"sensitive",
|
|
470
473
|
"subject_change",
|
|
474
|
+
"labels",
|
|
471
475
|
"ask_rule"
|
|
472
476
|
]);
|
|
473
477
|
var proposalSourceSchema = z8.object({
|
|
@@ -475,6 +479,12 @@ var proposalSourceSchema = z8.object({
|
|
|
475
479
|
proposedAt: z8.date(),
|
|
476
480
|
thread: z8.string().nullable()
|
|
477
481
|
});
|
|
482
|
+
var proposalLabelsSchema = z8.object({
|
|
483
|
+
gist: z8.string(),
|
|
484
|
+
isLabelOnly: z8.boolean(),
|
|
485
|
+
topic: z8.string(),
|
|
486
|
+
triggers: z8.array(z8.string())
|
|
487
|
+
});
|
|
478
488
|
var memoryProposalSchema = z8.object({
|
|
479
489
|
actionHash: z8.string(),
|
|
480
490
|
createdAt: z8.date(),
|
|
@@ -484,6 +494,7 @@ var memoryProposalSchema = z8.object({
|
|
|
484
494
|
isSensitive: z8.boolean(),
|
|
485
495
|
itemID: z8.string(),
|
|
486
496
|
kind: kindSchema,
|
|
497
|
+
labels: proposalLabelsSchema.nullable(),
|
|
487
498
|
lapseAt: z8.date(),
|
|
488
499
|
newSubject: subjectSchema.nullable(),
|
|
489
500
|
operation: z8.enum(["remember", "retire", "pin"]),
|
|
@@ -642,6 +653,7 @@ var bodySchema = z11.object({
|
|
|
642
653
|
fields: z11.record(z11.string(), z11.string()),
|
|
643
654
|
ruleSentence: z11.string().nullable(),
|
|
644
655
|
approveLabel: z11.string(),
|
|
656
|
+
rule: z11.record(z11.string(), z11.unknown()).optional(),
|
|
645
657
|
memory: memoryProposalSchema.optional()
|
|
646
658
|
});
|
|
647
659
|
var itemSchema = z11.object({
|
|
@@ -652,6 +664,35 @@ var itemSchema = z11.object({
|
|
|
652
664
|
choices: z11.array(choiceSchema),
|
|
653
665
|
passkeyChoices: z11.array(choiceSchema)
|
|
654
666
|
});
|
|
667
|
+
var unknownReasonSchema = z11.enum([
|
|
668
|
+
"inconclusive",
|
|
669
|
+
"unknown_streak",
|
|
670
|
+
"no_reconcile",
|
|
671
|
+
"key_expired",
|
|
672
|
+
"not_found_ask"
|
|
673
|
+
]);
|
|
674
|
+
var checkAnswerSchema = z11.enum(["found", "not_found", "inconclusive"]);
|
|
675
|
+
var attemptSchema = z11.object({ attempt: z11.int().nonnegative(), at: z11.date() });
|
|
676
|
+
var checkSchema = z11.object({ answer: checkAnswerSchema, at: z11.date() });
|
|
677
|
+
var unknownOutcomeSchema = z11.object({
|
|
678
|
+
actionID: z11.string(),
|
|
679
|
+
tool: z11.string(),
|
|
680
|
+
sentence: z11.string(),
|
|
681
|
+
fields: z11.record(z11.string(), z11.string()),
|
|
682
|
+
riskClass: z11.enum(["routine", "always_ask", "lifting"]),
|
|
683
|
+
reason: unknownReasonSchema,
|
|
684
|
+
becameUnknownAt: z11.date(),
|
|
685
|
+
attempts: z11.array(attemptSchema),
|
|
686
|
+
checks: z11.array(checkSchema)
|
|
687
|
+
});
|
|
688
|
+
var unknownChoiceSchema = z11.enum(["happened", "retry", "drop"]);
|
|
689
|
+
var unknownItemSchema = z11.object({
|
|
690
|
+
group: z11.literal("unknown_outcome"),
|
|
691
|
+
action: unknownOutcomeSchema,
|
|
692
|
+
task: taskSchema.nullable(),
|
|
693
|
+
choices: z11.array(unknownChoiceSchema),
|
|
694
|
+
passkeyChoices: z11.array(unknownChoiceSchema)
|
|
695
|
+
});
|
|
655
696
|
var readItemSchema = z11.object({
|
|
656
697
|
proposal: proposalSchema,
|
|
657
698
|
body: bodySchema.nullable(),
|
|
@@ -730,7 +771,27 @@ var answerErrors = signedIn.errors(reusedIDErrors).errors({
|
|
|
730
771
|
...noPasskeyError,
|
|
731
772
|
...passkeyFailedError
|
|
732
773
|
});
|
|
733
|
-
var listedSchema = z11.object({
|
|
774
|
+
var listedSchema = z11.object({
|
|
775
|
+
defer: deferSettingsSchema,
|
|
776
|
+
items: z11.array(itemSchema),
|
|
777
|
+
unknownOutcomes: z11.array(unknownItemSchema)
|
|
778
|
+
});
|
|
779
|
+
var unknownAnswerSchema = z11.object({
|
|
780
|
+
actionID: z11.string().min(1).max(200),
|
|
781
|
+
choice: unknownChoiceSchema,
|
|
782
|
+
clientActionID: z11.uuid(),
|
|
783
|
+
passkey: authenticationResponseSchema.optional()
|
|
784
|
+
});
|
|
785
|
+
var unknownAnswerErrors = signedIn.errors(reusedIDErrors).errors({
|
|
786
|
+
NOT_ALLOWED: {
|
|
787
|
+
message: "The action waits for no answer about its outcome",
|
|
788
|
+
status: 403,
|
|
789
|
+
data: z11.object({ reason: z11.string() })
|
|
790
|
+
},
|
|
791
|
+
PASSKEY_REQUIRED: { message: "This answer needs a passkey check", status: 403 },
|
|
792
|
+
...noPasskeyError,
|
|
793
|
+
...passkeyFailedError
|
|
794
|
+
});
|
|
734
795
|
var readInputSchema = z11.object({
|
|
735
796
|
proposalIDs: z11.array(z11.string().min(1).max(200)).min(1).max(100)
|
|
736
797
|
});
|
|
@@ -740,6 +801,7 @@ var approvalContract = {
|
|
|
740
801
|
listItems: signedIn.output(listedSchema),
|
|
741
802
|
readProposals: signedIn.input(readInputSchema).output(z11.object({ proposals: z11.array(readItemSchema) })),
|
|
742
803
|
answerProposal: answerErrors.input(passkeyAnswerSchema).output(resultSchema),
|
|
804
|
+
answerUnknownOutcome: unknownAnswerErrors.input(unknownAnswerSchema).output(z11.object({ actionID: z11.string(), choice: unknownChoiceSchema })),
|
|
743
805
|
answerProposals: signedIn.errors(reusedIDErrors).input(batchInputSchema).output(batchResultSchema)
|
|
744
806
|
};
|
|
745
807
|
|
|
@@ -782,6 +844,11 @@ var challengeForSchema = z13.discriminatedUnion("kind", [
|
|
|
782
844
|
choice: choiceSchema,
|
|
783
845
|
ruleHash: z13.string().optional()
|
|
784
846
|
}),
|
|
847
|
+
z13.object({
|
|
848
|
+
kind: z13.literal("unknown_outcome"),
|
|
849
|
+
actionID: z13.string().min(1).max(200),
|
|
850
|
+
choice: z13.literal("retry")
|
|
851
|
+
}),
|
|
785
852
|
z13.object({ kind: z13.literal("register") }),
|
|
786
853
|
z13.object({ kind: z13.literal("revoke"), passkeyID: z13.string().min(1).max(200) })
|
|
787
854
|
]);
|
|
@@ -958,9 +1025,31 @@ var ruleChange = signedIn.errors(reusedIDErrors).errors({
|
|
|
958
1025
|
NOT_ALLOWED: {
|
|
959
1026
|
message: "The rule takes no such change",
|
|
960
1027
|
status: 403,
|
|
961
|
-
data: z23.object({ reason: z23.enum(["widens", "empty"]) })
|
|
1028
|
+
data: z23.object({ reason: z23.enum(["widens", "empty", "mandate"]) })
|
|
962
1029
|
}
|
|
963
1030
|
});
|
|
1031
|
+
var currentHashSchema = z23.object({ current: z23.object({ actionHash: z23.string() }) });
|
|
1032
|
+
var closedStateSchema = z23.object({
|
|
1033
|
+
state: z23.enum(["approved", "declined", "lapsed", "withdrawn"])
|
|
1034
|
+
});
|
|
1035
|
+
var proposalIDSchema = z23.string().min(1).max(64);
|
|
1036
|
+
var ruleFormSchema = z23.record(z23.string(), z23.unknown());
|
|
1037
|
+
var mandateRuleSchema = z23.object({ ruleID: z23.string(), sentence: z23.string() });
|
|
1038
|
+
var mandateSchema = z23.object({
|
|
1039
|
+
mandateID: z23.string(),
|
|
1040
|
+
title: z23.string().nullable(),
|
|
1041
|
+
rules: z23.array(mandateRuleSchema),
|
|
1042
|
+
startedAt: z23.date(),
|
|
1043
|
+
expires: z23.date()
|
|
1044
|
+
});
|
|
1045
|
+
var faultsSchema = z23.object({ faults: z23.array(z23.string()) });
|
|
1046
|
+
var invalid = {
|
|
1047
|
+
INVALID: {
|
|
1048
|
+
message: "The rule or the mandate breaks the rule format or its limits",
|
|
1049
|
+
status: 400,
|
|
1050
|
+
data: faultsSchema
|
|
1051
|
+
}
|
|
1052
|
+
};
|
|
964
1053
|
var destinationsSchema = z23.array(z23.string().regex(/^\S+$/u)).max(100);
|
|
965
1054
|
var ruleContract = {
|
|
966
1055
|
readRule: signedIn.errors(notFound).input(z23.object({ ruleID: ruleIDSchema })).output(ruleSchema),
|
|
@@ -970,7 +1059,34 @@ var ruleContract = {
|
|
|
970
1059
|
revision: revisionSchema,
|
|
971
1060
|
destinations: destinationsSchema,
|
|
972
1061
|
clientActionID: z23.uuid()
|
|
973
|
-
})).output(z23.object({ ruleID: z23.string(), revision: revisionSchema }))
|
|
1062
|
+
})).output(z23.object({ ruleID: z23.string(), revision: revisionSchema })),
|
|
1063
|
+
editProposedRule: signedIn.errors(reusedIDErrors).errors({
|
|
1064
|
+
...invalid,
|
|
1065
|
+
NOT_FOUND: { message: "No proposed rule has this ID", status: 404 },
|
|
1066
|
+
CONFLICT: {
|
|
1067
|
+
message: "The proposed rule changed since the card showed it",
|
|
1068
|
+
status: 409,
|
|
1069
|
+
data: currentHashSchema
|
|
1070
|
+
},
|
|
1071
|
+
CLOSED: {
|
|
1072
|
+
message: "The proposed rule is no longer open",
|
|
1073
|
+
status: 409,
|
|
1074
|
+
data: closedStateSchema
|
|
1075
|
+
}
|
|
1076
|
+
}).input(z23.object({
|
|
1077
|
+
proposalID: proposalIDSchema,
|
|
1078
|
+
actionHash: z23.string(),
|
|
1079
|
+
rule: ruleFormSchema,
|
|
1080
|
+
clientActionID: z23.uuid()
|
|
1081
|
+
})).output(z23.object({ proposalID: z23.string() })),
|
|
1082
|
+
proposeMandate: signedIn.errors(reusedIDErrors).errors(invalid).input(z23.object({
|
|
1083
|
+
title: z23.string(),
|
|
1084
|
+
rules: z23.array(ruleFormSchema),
|
|
1085
|
+
expires: z23.string().optional(),
|
|
1086
|
+
clientActionID: z23.uuid()
|
|
1087
|
+
})).output(z23.object({ proposalID: z23.string(), mandateID: z23.string(), expires: z23.date() })),
|
|
1088
|
+
listMandates: signedIn.output(z23.object({ mandates: z23.array(mandateSchema) })),
|
|
1089
|
+
endMandate: signedIn.errors(reusedIDErrors).errors({ NOT_FOUND: { message: "No mandate has this ID", status: 404 } }).input(z23.object({ mandateID: z23.string().min(1).max(64), clientActionID: z23.uuid() })).output(z23.object({ mandateID: z23.string(), state: z23.enum(["ended", "expired"]) }))
|
|
974
1090
|
};
|
|
975
1091
|
|
|
976
1092
|
// src/contract/task-schema.ts
|
|
@@ -1086,6 +1202,7 @@ var recordSchema = z26.object({
|
|
|
1086
1202
|
proposal: z26.object({ proposalID: z26.string(), shortID: z26.string() }).optional(),
|
|
1087
1203
|
recall: recallSchema.optional(),
|
|
1088
1204
|
recordedAt: z26.date(),
|
|
1205
|
+
removal: z26.object({ kind: z26.string(), sequence: sequenceSchema, callSequence: sequenceSchema.optional() }).optional(),
|
|
1089
1206
|
sequence: sequenceSchema,
|
|
1090
1207
|
stop: z26.object({ cancelledActions: z26.array(listedActionSchema) }).optional(),
|
|
1091
1208
|
summary: summarySchema.optional(),
|
|
@@ -1133,6 +1250,7 @@ var listedTaskSchema = z26.object({
|
|
|
1133
1250
|
isTakingMessages: z26.boolean(),
|
|
1134
1251
|
lastActivityAt: z26.date(),
|
|
1135
1252
|
name: z26.string(),
|
|
1253
|
+
runner: z26.string(),
|
|
1136
1254
|
state: taskStateSchema2,
|
|
1137
1255
|
taskID: threadSchema,
|
|
1138
1256
|
waitingOn: threadSchema.optional()
|
|
@@ -1149,6 +1267,10 @@ var taskControl = checkedAction.errors({
|
|
|
1149
1267
|
message: "The task is in a state that does not take this control",
|
|
1150
1268
|
status: 409,
|
|
1151
1269
|
data: z26.object({ isPauseRequested: z26.boolean(), state: taskStateSchema2 })
|
|
1270
|
+
},
|
|
1271
|
+
RUNNER_LACKS_CONTROL: {
|
|
1272
|
+
message: "The runner of the task does not take this control",
|
|
1273
|
+
status: 409
|
|
1152
1274
|
}
|
|
1153
1275
|
}).input(z26.object({ clientActionID: clientActionIDSchema2, taskID: threadSchema })).output(controlledTaskSchema);
|
|
1154
1276
|
var nixieControl = checkedAction.input(z26.object({ clientActionID: clientActionIDSchema2 })).output(z26.object({ paused: pauseStateSchema }));
|
|
@@ -1279,8 +1401,8 @@ var contract = {
|
|
|
1279
1401
|
}
|
|
1280
1402
|
};
|
|
1281
1403
|
// src/contract/host-contract.ts
|
|
1282
|
-
import { oc as
|
|
1283
|
-
import { z as
|
|
1404
|
+
import { oc as oc6 } from "@orpc/contract";
|
|
1405
|
+
import { z as z35 } from "zod";
|
|
1284
1406
|
|
|
1285
1407
|
// src/contract/action-proposal-schema.ts
|
|
1286
1408
|
import { z as z27 } from "zod";
|
|
@@ -1302,49 +1424,75 @@ var actionProposalSchema = z27.object({
|
|
|
1302
1424
|
lapseAt: z27.date()
|
|
1303
1425
|
});
|
|
1304
1426
|
|
|
1305
|
-
// src/contract/
|
|
1306
|
-
import { oc as oc3 } from "@orpc/contract";
|
|
1427
|
+
// src/contract/forgotten-items-schema.ts
|
|
1307
1428
|
import { z as z28 } from "zod";
|
|
1308
|
-
var
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1429
|
+
var forgottenItemsSchema = z28.object({
|
|
1430
|
+
itemIDs: z28.array(z28.string()),
|
|
1431
|
+
backup: forgetBackupSchema
|
|
1432
|
+
});
|
|
1433
|
+
|
|
1434
|
+
// src/contract/host-mandates-contract.ts
|
|
1435
|
+
import { oc as oc3 } from "@orpc/contract";
|
|
1436
|
+
import { z as z29 } from "zod";
|
|
1437
|
+
var mandates = oc3.errors({
|
|
1438
|
+
NOT_FOUND: { message: "no mandate has that ID", status: 404 }
|
|
1439
|
+
});
|
|
1440
|
+
var hostMandateRuleSchema = z29.object({ ruleID: z29.string(), sentence: z29.string() });
|
|
1441
|
+
var hostMandateSchema = z29.object({
|
|
1442
|
+
mandateID: z29.string(),
|
|
1443
|
+
title: z29.string().nullable(),
|
|
1444
|
+
rules: z29.array(hostMandateRuleSchema),
|
|
1445
|
+
startedAt: z29.date(),
|
|
1446
|
+
expires: z29.date()
|
|
1447
|
+
});
|
|
1448
|
+
var hostMandatesContract = {
|
|
1449
|
+
list: mandates.output(z29.array(hostMandateSchema)),
|
|
1450
|
+
end: mandates.input(z29.strictObject({ mandateID: z29.string().min(1) })).output(z29.object({ mandateID: z29.string(), state: z29.enum(["ended", "expired"]) }))
|
|
1451
|
+
};
|
|
1452
|
+
|
|
1453
|
+
// src/contract/host-passkey-contract.ts
|
|
1454
|
+
import { oc as oc4 } from "@orpc/contract";
|
|
1455
|
+
import { z as z30 } from "zod";
|
|
1456
|
+
var hostPasskeySchema = z30.object({
|
|
1457
|
+
passkeyID: z30.string(),
|
|
1458
|
+
label: z30.string(),
|
|
1459
|
+
synced: z30.boolean(),
|
|
1460
|
+
origin: z30.string(),
|
|
1461
|
+
registeredBy: z30.string(),
|
|
1462
|
+
authorizedBy: z30.string(),
|
|
1463
|
+
registeredAt: z30.date(),
|
|
1464
|
+
lastUsedAt: z30.date().nullable(),
|
|
1465
|
+
revokedAt: z30.date().nullable()
|
|
1318
1466
|
});
|
|
1319
1467
|
var hostPasskeyContract = {
|
|
1320
|
-
issueCode:
|
|
1321
|
-
list:
|
|
1322
|
-
revoke:
|
|
1468
|
+
issueCode: oc4.output(z30.object({ code: z30.string(), expiresAt: z30.date() })),
|
|
1469
|
+
list: oc4.output(z30.array(hostPasskeySchema)),
|
|
1470
|
+
revoke: oc4.errors({
|
|
1323
1471
|
PASSKEY_NOT_FOUND: { message: "no passkey has that ID", status: 404 }
|
|
1324
|
-
}).input(
|
|
1472
|
+
}).input(z30.strictObject({ passkeyID: z30.string().min(1) })).output(z30.object({ passkeyID: z30.string(), revokedAt: z30.date() }))
|
|
1325
1473
|
};
|
|
1326
1474
|
|
|
1327
1475
|
// src/contract/known-contact-schema.ts
|
|
1328
|
-
import { z as
|
|
1329
|
-
var knownContactSchema =
|
|
1330
|
-
contactID:
|
|
1331
|
-
name:
|
|
1332
|
-
destination:
|
|
1333
|
-
markedAt:
|
|
1476
|
+
import { z as z31 } from "zod";
|
|
1477
|
+
var knownContactSchema = z31.object({
|
|
1478
|
+
contactID: z31.string(),
|
|
1479
|
+
name: z31.string().nullable(),
|
|
1480
|
+
destination: z31.string().nullable(),
|
|
1481
|
+
markedAt: z31.date()
|
|
1334
1482
|
});
|
|
1335
1483
|
|
|
1336
1484
|
// src/contract/turn-inputs-contract.ts
|
|
1337
|
-
import { oc as
|
|
1338
|
-
import { z as
|
|
1485
|
+
import { oc as oc5 } from "@orpc/contract";
|
|
1486
|
+
import { z as z34 } from "zod";
|
|
1339
1487
|
|
|
1340
1488
|
// src/contract/input-miss-schema.ts
|
|
1341
|
-
import { z as
|
|
1342
|
-
var inputMissSchema =
|
|
1343
|
-
missID:
|
|
1344
|
-
captureID:
|
|
1345
|
-
taskID:
|
|
1346
|
-
stepRunID:
|
|
1347
|
-
reason:
|
|
1489
|
+
import { z as z32 } from "zod";
|
|
1490
|
+
var inputMissSchema = z32.object({
|
|
1491
|
+
missID: z32.string(),
|
|
1492
|
+
captureID: z32.string().nullable(),
|
|
1493
|
+
taskID: z32.string(),
|
|
1494
|
+
stepRunID: z32.string(),
|
|
1495
|
+
reason: z32.enum([
|
|
1348
1496
|
"queue_full",
|
|
1349
1497
|
"spool_full",
|
|
1350
1498
|
"spool_write_failed",
|
|
@@ -1356,46 +1504,46 @@ var inputMissSchema = z30.object({
|
|
|
1356
1504
|
"intake_failed",
|
|
1357
1505
|
"holds_own_value"
|
|
1358
1506
|
]),
|
|
1359
|
-
count:
|
|
1360
|
-
writer:
|
|
1361
|
-
counter:
|
|
1362
|
-
createdAt:
|
|
1507
|
+
count: z32.int().positive(),
|
|
1508
|
+
writer: z32.string().nullable(),
|
|
1509
|
+
counter: z32.int().nullable(),
|
|
1510
|
+
createdAt: z32.date()
|
|
1363
1511
|
});
|
|
1364
1512
|
|
|
1365
1513
|
// src/contract/logged-input-schema.ts
|
|
1366
|
-
import { z as
|
|
1367
|
-
var loggedInputSchema =
|
|
1368
|
-
inputID:
|
|
1369
|
-
captureID:
|
|
1370
|
-
taskID:
|
|
1371
|
-
stepRunID:
|
|
1372
|
-
writer:
|
|
1373
|
-
counter:
|
|
1374
|
-
role:
|
|
1375
|
-
profile:
|
|
1376
|
-
model:
|
|
1377
|
-
harness:
|
|
1378
|
-
api:
|
|
1379
|
-
endpoint:
|
|
1380
|
-
route:
|
|
1381
|
-
isRewritten:
|
|
1382
|
-
upstreamStatus:
|
|
1383
|
-
bytes:
|
|
1384
|
-
intakeSequence:
|
|
1385
|
-
receivedAt:
|
|
1386
|
-
takenAt:
|
|
1387
|
-
state:
|
|
1388
|
-
removedCause:
|
|
1514
|
+
import { z as z33 } from "zod";
|
|
1515
|
+
var loggedInputSchema = z33.object({
|
|
1516
|
+
inputID: z33.string(),
|
|
1517
|
+
captureID: z33.string(),
|
|
1518
|
+
taskID: z33.string(),
|
|
1519
|
+
stepRunID: z33.string(),
|
|
1520
|
+
writer: z33.string(),
|
|
1521
|
+
counter: z33.int(),
|
|
1522
|
+
role: z33.string(),
|
|
1523
|
+
profile: z33.string(),
|
|
1524
|
+
model: z33.string(),
|
|
1525
|
+
harness: z33.string(),
|
|
1526
|
+
api: z33.string(),
|
|
1527
|
+
endpoint: z33.string(),
|
|
1528
|
+
route: z33.string(),
|
|
1529
|
+
isRewritten: z33.boolean(),
|
|
1530
|
+
upstreamStatus: z33.int(),
|
|
1531
|
+
bytes: z33.int(),
|
|
1532
|
+
intakeSequence: z33.int(),
|
|
1533
|
+
receivedAt: z33.date(),
|
|
1534
|
+
takenAt: z33.date(),
|
|
1535
|
+
state: z33.enum(["writing", "stored", "missing", "removed"]),
|
|
1536
|
+
removedCause: z33.enum(["retention_days", "retention_bytes", "forget", "dropped", "restore", "reset"]).nullable()
|
|
1389
1537
|
});
|
|
1390
1538
|
|
|
1391
1539
|
// src/contract/turn-inputs-contract.ts
|
|
1392
|
-
var turnInputOn =
|
|
1393
|
-
state:
|
|
1394
|
-
forMs:
|
|
1540
|
+
var turnInputOn = z34.strictObject({
|
|
1541
|
+
state: z34.literal("on"),
|
|
1542
|
+
forMs: z34.int().positive().nullable()
|
|
1395
1543
|
});
|
|
1396
|
-
var turnInputOff =
|
|
1397
|
-
var turnInputSetSchema =
|
|
1398
|
-
var turnInputs =
|
|
1544
|
+
var turnInputOff = z34.strictObject({ state: z34.literal("off"), drop: z34.boolean() });
|
|
1545
|
+
var turnInputSetSchema = z34.discriminatedUnion("state", [turnInputOn, turnInputOff]);
|
|
1546
|
+
var turnInputs = oc5.errors({
|
|
1399
1547
|
NOT_FOUND: { message: "no logged request has that ID", status: 404 },
|
|
1400
1548
|
REMOVED: { message: "that request is removed or its body is missing", status: 410 },
|
|
1401
1549
|
OPEN_NOT_RECORDED: {
|
|
@@ -1404,27 +1552,27 @@ var turnInputs = oc4.errors({
|
|
|
1404
1552
|
},
|
|
1405
1553
|
NOT_CONFIGURED: { message: "the turn-input log is not configured", status: 409 }
|
|
1406
1554
|
});
|
|
1407
|
-
var listedInputsSchema =
|
|
1408
|
-
inputs:
|
|
1409
|
-
misses:
|
|
1555
|
+
var listedInputsSchema = z34.object({
|
|
1556
|
+
inputs: z34.array(loggedInputSchema),
|
|
1557
|
+
misses: z34.array(inputMissSchema)
|
|
1410
1558
|
});
|
|
1411
1559
|
var turnInputsContract = {
|
|
1412
|
-
list: turnInputs.input(
|
|
1413
|
-
open: turnInputs.input(
|
|
1414
|
-
set: turnInputs.input(turnInputSetSchema).output(
|
|
1560
|
+
list: turnInputs.input(z34.strictObject({ limit: z34.int().positive().max(500).default(50) })).output(listedInputsSchema),
|
|
1561
|
+
open: turnInputs.input(z34.strictObject({ inputID: z34.string().min(1) })).output(z34.object({ inputID: z34.string(), body: z34.base64() })),
|
|
1562
|
+
set: turnInputs.input(turnInputSetSchema).output(z34.object({ state: z34.enum(["on", "off"]), until: z34.number().nullable() }))
|
|
1415
1563
|
};
|
|
1416
1564
|
|
|
1417
1565
|
// src/contract/host-contract.ts
|
|
1418
|
-
var versionRefSchema2 =
|
|
1419
|
-
var versionTargetSchema2 =
|
|
1420
|
-
itemID:
|
|
1421
|
-
version:
|
|
1422
|
-
});
|
|
1423
|
-
var itemTextSchema =
|
|
1424
|
-
var proposalOriginSchema2 =
|
|
1425
|
-
var memoryOriginSchema =
|
|
1426
|
-
var contentSourceSchema =
|
|
1427
|
-
var reviewReasonSchema2 =
|
|
1566
|
+
var versionRefSchema2 = z35.object({ itemID: z35.string(), version: z35.int().positive() });
|
|
1567
|
+
var versionTargetSchema2 = z35.strictObject({
|
|
1568
|
+
itemID: z35.string().min(1),
|
|
1569
|
+
version: z35.int().positive()
|
|
1570
|
+
});
|
|
1571
|
+
var itemTextSchema = z35.string().max(2000).regex(/\S/u);
|
|
1572
|
+
var proposalOriginSchema2 = z35.enum(["owner", "conversation", "task"]);
|
|
1573
|
+
var memoryOriginSchema = z35.enum([...proposalOriginSchema2.options, "lapse"]);
|
|
1574
|
+
var contentSourceSchema = z35.enum(["owner", "owner_data", "untrusted"]);
|
|
1575
|
+
var reviewReasonSchema2 = z35.enum([
|
|
1428
1576
|
"no_quote",
|
|
1429
1577
|
"quote_not_typed",
|
|
1430
1578
|
"quote_in_quoted_block",
|
|
@@ -1441,71 +1589,72 @@ var reviewReasonSchema2 = z33.enum([
|
|
|
1441
1589
|
"from_photo",
|
|
1442
1590
|
"sensitive",
|
|
1443
1591
|
"subject_change",
|
|
1592
|
+
"labels",
|
|
1444
1593
|
"ask_rule"
|
|
1445
1594
|
]);
|
|
1446
|
-
var proposalSourceSchema2 =
|
|
1595
|
+
var proposalSourceSchema2 = z35.object({
|
|
1447
1596
|
origin: proposalOriginSchema2,
|
|
1448
|
-
thread:
|
|
1449
|
-
proposedAt:
|
|
1450
|
-
});
|
|
1451
|
-
var pendingProposalSchema =
|
|
1452
|
-
proposalID:
|
|
1453
|
-
operation:
|
|
1454
|
-
itemID:
|
|
1455
|
-
targetVersion:
|
|
1456
|
-
isPinned:
|
|
1457
|
-
subject:
|
|
1458
|
-
newSubject:
|
|
1459
|
-
isSensitive:
|
|
1460
|
-
kind:
|
|
1597
|
+
thread: z35.string().nullable(),
|
|
1598
|
+
proposedAt: z35.date()
|
|
1599
|
+
});
|
|
1600
|
+
var pendingProposalSchema = z35.object({
|
|
1601
|
+
proposalID: z35.string(),
|
|
1602
|
+
operation: z35.enum(["remember", "retire", "pin"]),
|
|
1603
|
+
itemID: z35.string(),
|
|
1604
|
+
targetVersion: z35.int().nullable(),
|
|
1605
|
+
isPinned: z35.boolean(),
|
|
1606
|
+
subject: z35.enum(["owner", "self", "shared"]),
|
|
1607
|
+
newSubject: z35.enum(["owner", "self", "shared"]).nullable(),
|
|
1608
|
+
isSensitive: z35.boolean(),
|
|
1609
|
+
kind: z35.enum(["fact", "self"]),
|
|
1461
1610
|
reason: reviewReasonSchema2,
|
|
1462
|
-
actionHash:
|
|
1611
|
+
actionHash: z35.string(),
|
|
1463
1612
|
origin: proposalOriginSchema2,
|
|
1464
1613
|
source: contentSourceSchema,
|
|
1465
|
-
createdAt:
|
|
1466
|
-
lapseAt:
|
|
1467
|
-
sources:
|
|
1468
|
-
text:
|
|
1469
|
-
quote:
|
|
1470
|
-
});
|
|
1471
|
-
var closeMatchSchema2 =
|
|
1472
|
-
var approvalResultSchema =
|
|
1473
|
-
|
|
1474
|
-
|
|
1614
|
+
createdAt: z35.date(),
|
|
1615
|
+
lapseAt: z35.date(),
|
|
1616
|
+
sources: z35.array(proposalSourceSchema2),
|
|
1617
|
+
text: z35.string(),
|
|
1618
|
+
quote: z35.string().nullable()
|
|
1619
|
+
});
|
|
1620
|
+
var closeMatchSchema2 = z35.object({ itemID: z35.string(), version: z35.int(), text: z35.string() });
|
|
1621
|
+
var approvalResultSchema = z35.discriminatedUnion("status", [
|
|
1622
|
+
z35.object({ status: z35.literal("applied"), itemID: z35.string(), version: z35.int() }),
|
|
1623
|
+
z35.object({ status: z35.literal("close_match"), item: closeMatchSchema2 })
|
|
1475
1624
|
]);
|
|
1476
|
-
var historyVersionSchema =
|
|
1477
|
-
version:
|
|
1478
|
-
change:
|
|
1479
|
-
state:
|
|
1625
|
+
var historyVersionSchema = z35.object({
|
|
1626
|
+
version: z35.int(),
|
|
1627
|
+
change: z35.enum(["created", "edited", "retired", "restored", "undone"]),
|
|
1628
|
+
state: z35.enum(["active", "retired"]),
|
|
1480
1629
|
origin: memoryOriginSchema,
|
|
1481
1630
|
source: contentSourceSchema,
|
|
1482
|
-
recordedAt:
|
|
1483
|
-
status:
|
|
1484
|
-
text:
|
|
1485
|
-
});
|
|
1486
|
-
var itemHistorySchema =
|
|
1487
|
-
itemID:
|
|
1488
|
-
subject:
|
|
1489
|
-
kind:
|
|
1490
|
-
state:
|
|
1491
|
-
versions:
|
|
1492
|
-
});
|
|
1493
|
-
var proposalAnswerSchema =
|
|
1494
|
-
proposalID:
|
|
1495
|
-
actionHash:
|
|
1496
|
-
});
|
|
1497
|
-
var hostSessionSchema =
|
|
1498
|
-
sessionID:
|
|
1499
|
-
deviceName:
|
|
1500
|
-
createdAt:
|
|
1501
|
-
lastUsedAt:
|
|
1502
|
-
});
|
|
1503
|
-
var subjectCountSchema =
|
|
1504
|
-
owner:
|
|
1505
|
-
shared:
|
|
1506
|
-
self:
|
|
1507
|
-
});
|
|
1508
|
-
var memory =
|
|
1631
|
+
recordedAt: z35.date(),
|
|
1632
|
+
status: z35.enum(["readable", "shredded", "unreadable"]),
|
|
1633
|
+
text: z35.string().nullable()
|
|
1634
|
+
});
|
|
1635
|
+
var itemHistorySchema = z35.object({
|
|
1636
|
+
itemID: z35.string(),
|
|
1637
|
+
subject: z35.enum(["owner", "self", "shared"]),
|
|
1638
|
+
kind: z35.enum(["fact", "self"]),
|
|
1639
|
+
state: z35.enum(["active", "retired", "forgetting", "forgotten"]),
|
|
1640
|
+
versions: z35.array(historyVersionSchema)
|
|
1641
|
+
});
|
|
1642
|
+
var proposalAnswerSchema = z35.strictObject({
|
|
1643
|
+
proposalID: z35.string().min(1),
|
|
1644
|
+
actionHash: z35.string().min(1)
|
|
1645
|
+
});
|
|
1646
|
+
var hostSessionSchema = z35.object({
|
|
1647
|
+
sessionID: z35.string(),
|
|
1648
|
+
deviceName: z35.string(),
|
|
1649
|
+
createdAt: z35.date(),
|
|
1650
|
+
lastUsedAt: z35.date()
|
|
1651
|
+
});
|
|
1652
|
+
var subjectCountSchema = z35.object({
|
|
1653
|
+
owner: z35.int().nonnegative(),
|
|
1654
|
+
shared: z35.int().nonnegative(),
|
|
1655
|
+
self: z35.int().nonnegative()
|
|
1656
|
+
});
|
|
1657
|
+
var memory = oc6.errors({
|
|
1509
1658
|
MEMORY_NOT_STARTED: { message: "the memory store has not started yet", status: 503 },
|
|
1510
1659
|
NOT_FOUND: { message: "nothing has that ID", status: 404 },
|
|
1511
1660
|
PROPOSAL_HASH: { message: "the action hash names another proposal", status: 409 },
|
|
@@ -1518,30 +1667,30 @@ var memory = oc5.errors({
|
|
|
1518
1667
|
PIN_EDIT: { message: "a pin takes no edited text", status: 400 },
|
|
1519
1668
|
SELF_NOTE_REFUSED: { message: "a self-note never takes that change", status: 409 }
|
|
1520
1669
|
});
|
|
1521
|
-
var skillFileSchema =
|
|
1522
|
-
var pendingSkillProposalSchema =
|
|
1523
|
-
proposalID:
|
|
1524
|
-
name:
|
|
1525
|
-
skillHash:
|
|
1526
|
-
baseHash:
|
|
1527
|
-
files:
|
|
1528
|
-
inForce:
|
|
1529
|
-
skillHash:
|
|
1530
|
-
origin:
|
|
1531
|
-
files:
|
|
1670
|
+
var skillFileSchema = z35.object({ path: z35.string(), text: z35.string() });
|
|
1671
|
+
var pendingSkillProposalSchema = z35.object({
|
|
1672
|
+
proposalID: z35.string(),
|
|
1673
|
+
name: z35.string(),
|
|
1674
|
+
skillHash: z35.string(),
|
|
1675
|
+
baseHash: z35.string().nullable(),
|
|
1676
|
+
files: z35.array(skillFileSchema),
|
|
1677
|
+
inForce: z35.object({
|
|
1678
|
+
skillHash: z35.string(),
|
|
1679
|
+
origin: z35.enum(["definitions", "vendored", "nixie"]),
|
|
1680
|
+
files: z35.array(skillFileSchema)
|
|
1532
1681
|
}).nullable(),
|
|
1533
|
-
untypedToken:
|
|
1534
|
-
thread:
|
|
1535
|
-
provenance:
|
|
1536
|
-
createdAt:
|
|
1537
|
-
lapseAt:
|
|
1538
|
-
isStale:
|
|
1539
|
-
});
|
|
1540
|
-
var skillAnswerSchema =
|
|
1541
|
-
proposalID:
|
|
1542
|
-
skillHash:
|
|
1543
|
-
});
|
|
1544
|
-
var skills =
|
|
1682
|
+
untypedToken: z35.object({ kind: z35.string(), raw: z35.string() }).nullable(),
|
|
1683
|
+
thread: z35.string().nullable(),
|
|
1684
|
+
provenance: z35.object({ runID: z35.string(), callID: z35.string(), profile: z35.string() }),
|
|
1685
|
+
createdAt: z35.date(),
|
|
1686
|
+
lapseAt: z35.date(),
|
|
1687
|
+
isStale: z35.boolean()
|
|
1688
|
+
});
|
|
1689
|
+
var skillAnswerSchema = z35.strictObject({
|
|
1690
|
+
proposalID: z35.string().min(1),
|
|
1691
|
+
skillHash: z35.string().min(1)
|
|
1692
|
+
});
|
|
1693
|
+
var skills = oc6.errors({
|
|
1545
1694
|
NOT_FOUND: { message: "nothing has that ID", status: 404 },
|
|
1546
1695
|
PROPOSAL_HASH: { message: "the skill hash names other files", status: 409 },
|
|
1547
1696
|
PROPOSAL_CLOSED: { message: "the proposal is answered or lapsed", status: 409 },
|
|
@@ -1549,103 +1698,99 @@ var skills = oc5.errors({
|
|
|
1549
1698
|
SKILL_CHECK: { message: "the files fail the seed checks", status: 400 },
|
|
1550
1699
|
WRONG_STATE: { message: "the skill nixie wrote is no longer in force", status: 409 }
|
|
1551
1700
|
});
|
|
1552
|
-
var definitionsSkillSchema =
|
|
1553
|
-
var writtenSkillSchema =
|
|
1554
|
-
approvalID:
|
|
1555
|
-
proposalID:
|
|
1556
|
-
name:
|
|
1557
|
-
skillHash:
|
|
1701
|
+
var definitionsSkillSchema = z35.object({ skillHash: z35.string(), origin: z35.enum(["definitions", "vendored"]) }).nullable();
|
|
1702
|
+
var writtenSkillSchema = z35.object({
|
|
1703
|
+
approvalID: z35.string(),
|
|
1704
|
+
proposalID: z35.string(),
|
|
1705
|
+
name: z35.string(),
|
|
1706
|
+
skillHash: z35.string(),
|
|
1558
1707
|
base: definitionsSkillSchema,
|
|
1559
1708
|
definitions: definitionsSkillSchema,
|
|
1560
|
-
isConflict:
|
|
1561
|
-
pullRequestURL:
|
|
1562
|
-
approvedAt:
|
|
1563
|
-
});
|
|
1564
|
-
var promptPartFileSchema =
|
|
1565
|
-
var promptEntrySchema =
|
|
1566
|
-
var pendingPromptProposalSchema =
|
|
1567
|
-
proposalID:
|
|
1568
|
-
promptID:
|
|
1569
|
-
proposalHash:
|
|
1570
|
-
baseHash:
|
|
1709
|
+
isConflict: z35.boolean(),
|
|
1710
|
+
pullRequestURL: z35.url().nullable(),
|
|
1711
|
+
approvedAt: z35.date()
|
|
1712
|
+
});
|
|
1713
|
+
var promptPartFileSchema = z35.object({ path: z35.string(), text: z35.string() });
|
|
1714
|
+
var promptEntrySchema = z35.record(z35.string(), z35.string());
|
|
1715
|
+
var pendingPromptProposalSchema = z35.object({
|
|
1716
|
+
proposalID: z35.string(),
|
|
1717
|
+
promptID: z35.string(),
|
|
1718
|
+
proposalHash: z35.string(),
|
|
1719
|
+
baseHash: z35.string().nullable(),
|
|
1571
1720
|
entry: promptEntrySchema,
|
|
1572
|
-
files:
|
|
1573
|
-
reason:
|
|
1574
|
-
inForce:
|
|
1575
|
-
thread:
|
|
1576
|
-
provenance:
|
|
1577
|
-
createdAt:
|
|
1578
|
-
lapseAt:
|
|
1579
|
-
isStale:
|
|
1580
|
-
});
|
|
1581
|
-
var promptAnswerSchema =
|
|
1582
|
-
proposalID:
|
|
1583
|
-
proposalHash:
|
|
1584
|
-
});
|
|
1585
|
-
var prompts =
|
|
1721
|
+
files: z35.array(promptPartFileSchema),
|
|
1722
|
+
reason: z35.string(),
|
|
1723
|
+
inForce: z35.object({ parts: promptEntrySchema, template: z35.string().nullable() }).nullable(),
|
|
1724
|
+
thread: z35.string().nullable(),
|
|
1725
|
+
provenance: z35.object({ runID: z35.string(), callID: z35.string(), profile: z35.string() }),
|
|
1726
|
+
createdAt: z35.date(),
|
|
1727
|
+
lapseAt: z35.date(),
|
|
1728
|
+
isStale: z35.boolean()
|
|
1729
|
+
});
|
|
1730
|
+
var promptAnswerSchema = z35.strictObject({
|
|
1731
|
+
proposalID: z35.string().min(1),
|
|
1732
|
+
proposalHash: z35.string().min(1)
|
|
1733
|
+
});
|
|
1734
|
+
var prompts = oc6.errors({
|
|
1586
1735
|
NOT_FOUND: { message: "nothing has that ID", status: 404 },
|
|
1587
1736
|
PROPOSAL_HASH: { message: "the proposal hash names another override", status: 409 },
|
|
1588
1737
|
PROPOSAL_CLOSED: { message: "the proposal is answered or lapsed", status: 409 },
|
|
1589
1738
|
STALE_BASE: { message: "the override in force moved past the proposal", status: 409 },
|
|
1590
1739
|
PROMPT_CHECK: { message: "the override fails the definitions checks", status: 400 }
|
|
1591
1740
|
});
|
|
1592
|
-
var ruleVersionSchema =
|
|
1593
|
-
var ruleInForceSchema =
|
|
1594
|
-
ruleID:
|
|
1595
|
-
revision:
|
|
1596
|
-
ruleHash:
|
|
1597
|
-
sentence:
|
|
1598
|
-
origin:
|
|
1599
|
-
changeID:
|
|
1600
|
-
lastFiredAt:
|
|
1601
|
-
});
|
|
1602
|
-
var ruleConflictSchema =
|
|
1603
|
-
ruleID:
|
|
1604
|
-
changeID:
|
|
1741
|
+
var ruleVersionSchema = z35.object({ ruleHash: z35.string(), sentence: z35.string() }).nullable();
|
|
1742
|
+
var ruleInForceSchema = z35.object({
|
|
1743
|
+
ruleID: z35.string(),
|
|
1744
|
+
revision: z35.int().positive(),
|
|
1745
|
+
ruleHash: z35.string(),
|
|
1746
|
+
sentence: z35.string(),
|
|
1747
|
+
origin: z35.enum(["definitions", "nixie"]),
|
|
1748
|
+
changeID: z35.string().nullable(),
|
|
1749
|
+
lastFiredAt: z35.date().nullable()
|
|
1750
|
+
});
|
|
1751
|
+
var ruleConflictSchema = z35.object({
|
|
1752
|
+
ruleID: z35.string(),
|
|
1753
|
+
changeID: z35.string(),
|
|
1605
1754
|
nixie: ruleVersionSchema,
|
|
1606
1755
|
repo: ruleVersionSchema,
|
|
1607
1756
|
base: ruleVersionSchema,
|
|
1608
|
-
changedBy:
|
|
1609
|
-
reason:
|
|
1610
|
-
changedAt:
|
|
1757
|
+
changedBy: z35.enum(["owner", "nixie"]),
|
|
1758
|
+
reason: z35.string(),
|
|
1759
|
+
changedAt: z35.date()
|
|
1611
1760
|
});
|
|
1612
|
-
var ruleProposalChangeSchema =
|
|
1613
|
-
ruleID:
|
|
1761
|
+
var ruleProposalChangeSchema = z35.object({
|
|
1762
|
+
ruleID: z35.string(),
|
|
1614
1763
|
before: ruleVersionSchema,
|
|
1615
1764
|
after: ruleVersionSchema
|
|
1616
1765
|
});
|
|
1617
|
-
var effectChangeSchema =
|
|
1618
|
-
tool:
|
|
1619
|
-
remove:
|
|
1620
|
-
sentence:
|
|
1766
|
+
var effectChangeSchema = z35.object({
|
|
1767
|
+
tool: z35.string(),
|
|
1768
|
+
remove: z35.array(z35.string()),
|
|
1769
|
+
sentence: z35.string()
|
|
1621
1770
|
});
|
|
1622
|
-
var pendingRuleProposalSchema =
|
|
1623
|
-
proposalID:
|
|
1624
|
-
changes:
|
|
1625
|
-
effectChanges:
|
|
1626
|
-
createdAt:
|
|
1627
|
-
lapseAt:
|
|
1771
|
+
var pendingRuleProposalSchema = z35.object({
|
|
1772
|
+
proposalID: z35.string(),
|
|
1773
|
+
changes: z35.array(ruleProposalChangeSchema),
|
|
1774
|
+
effectChanges: z35.array(effectChangeSchema),
|
|
1775
|
+
createdAt: z35.date(),
|
|
1776
|
+
lapseAt: z35.date()
|
|
1628
1777
|
});
|
|
1629
|
-
var ruleProposalAnswerSchema =
|
|
1778
|
+
var ruleProposalAnswerSchema = z35.strictObject({ proposalID: z35.string().min(1) });
|
|
1630
1779
|
var ruleProposalRejectionSchema = ruleProposalAnswerSchema.extend({
|
|
1631
|
-
reason:
|
|
1780
|
+
reason: z35.string().max(500).regex(/\S/u)
|
|
1632
1781
|
});
|
|
1633
1782
|
var actionRejectionSchema = ruleProposalAnswerSchema.extend({
|
|
1634
|
-
reason:
|
|
1783
|
+
reason: z35.string().max(500).regex(/\S/u).optional()
|
|
1635
1784
|
});
|
|
1636
1785
|
var ruleProposalErrors = {
|
|
1637
1786
|
NOT_FOUND: { message: "nothing has that ID", status: 404 },
|
|
1638
1787
|
PROPOSAL_CLOSED: { message: "the proposal is answered, withdrawn or lapsed", status: 409 }
|
|
1639
1788
|
};
|
|
1640
|
-
var rules =
|
|
1641
|
-
var contacts =
|
|
1789
|
+
var rules = oc6.errors(ruleProposalErrors);
|
|
1790
|
+
var contacts = oc6.errors({
|
|
1642
1791
|
NOT_FOUND: { message: "no known contact has that ID", status: 404 }
|
|
1643
1792
|
});
|
|
1644
|
-
var
|
|
1645
|
-
itemIDs: z33.array(z33.string()),
|
|
1646
|
-
backup: forgetBackupSchema
|
|
1647
|
-
});
|
|
1648
|
-
var hostTaskStateSchema = z33.enum([
|
|
1793
|
+
var hostTaskStateSchema = z35.enum([
|
|
1649
1794
|
"ready",
|
|
1650
1795
|
"running",
|
|
1651
1796
|
"waiting",
|
|
@@ -1655,35 +1800,39 @@ var hostTaskStateSchema = z33.enum([
|
|
|
1655
1800
|
"failed",
|
|
1656
1801
|
"closed"
|
|
1657
1802
|
]);
|
|
1658
|
-
var taskControl2 =
|
|
1803
|
+
var taskControl2 = oc6.errors({
|
|
1659
1804
|
TASK_NOT_FOUND: { message: "no task has that ID", status: 404 },
|
|
1660
1805
|
TASK_STATE_REFUSED: {
|
|
1661
1806
|
message: "the task is in a state that does not take this control",
|
|
1662
1807
|
status: 409
|
|
1808
|
+
},
|
|
1809
|
+
RUNNER_LACKS_CONTROL: {
|
|
1810
|
+
message: "the runner of the task does not take this control",
|
|
1811
|
+
status: 409
|
|
1663
1812
|
}
|
|
1664
|
-
}).input(
|
|
1665
|
-
taskID:
|
|
1813
|
+
}).input(z35.strictObject({ taskID: z35.string().min(1) })).output(z35.object({
|
|
1814
|
+
taskID: z35.string(),
|
|
1666
1815
|
state: hostTaskStateSchema,
|
|
1667
|
-
isPauseRequested:
|
|
1816
|
+
isPauseRequested: z35.boolean()
|
|
1668
1817
|
}));
|
|
1669
1818
|
var hostContract = {
|
|
1670
|
-
reset:
|
|
1671
|
-
resetAt:
|
|
1672
|
-
lastSequence:
|
|
1673
|
-
keptSessions:
|
|
1819
|
+
reset: oc6.output(z35.object({
|
|
1820
|
+
resetAt: z35.date(),
|
|
1821
|
+
lastSequence: z35.int().nonnegative(),
|
|
1822
|
+
keptSessions: z35.int().nonnegative()
|
|
1674
1823
|
})),
|
|
1675
|
-
resetConversations:
|
|
1676
|
-
resetAt:
|
|
1677
|
-
lastSequence:
|
|
1678
|
-
shreddedRecords:
|
|
1824
|
+
resetConversations: oc6.output(z35.object({
|
|
1825
|
+
resetAt: z35.date(),
|
|
1826
|
+
lastSequence: z35.int().nonnegative(),
|
|
1827
|
+
shreddedRecords: z35.int().nonnegative(),
|
|
1679
1828
|
backup: forgetBackupSchema
|
|
1680
1829
|
})),
|
|
1681
1830
|
nixie: {
|
|
1682
|
-
pause:
|
|
1683
|
-
resume:
|
|
1831
|
+
pause: oc6.output(z35.object({ paused: pauseStateSchema })),
|
|
1832
|
+
resume: oc6.output(z35.object({ paused: pauseStateSchema }))
|
|
1684
1833
|
},
|
|
1685
1834
|
recovery: {
|
|
1686
|
-
read:
|
|
1835
|
+
read: oc6.output(z35.object({ recovery: recoverySchema }))
|
|
1687
1836
|
},
|
|
1688
1837
|
tasks: {
|
|
1689
1838
|
pause: taskControl2,
|
|
@@ -1694,105 +1843,106 @@ var hostContract = {
|
|
|
1694
1843
|
CONVERSATION_NEVER_CLOSES: { message: "the conversation is never closed", status: 409 }
|
|
1695
1844
|
}),
|
|
1696
1845
|
interrupt: taskControl2,
|
|
1697
|
-
raise:
|
|
1846
|
+
raise: oc6.errors({
|
|
1698
1847
|
TASK_NOT_FOUND: { message: "no task has that ID", status: 404 },
|
|
1699
1848
|
TASK_NOT_AT_LIMIT: { message: "the task is not paused at its limit", status: 409 },
|
|
1700
1849
|
LIMIT_NOT_RAISED: { message: "the new limits are not above the old ones", status: 409 }
|
|
1701
|
-
}).input(
|
|
1702
|
-
taskID:
|
|
1703
|
-
turns:
|
|
1704
|
-
dollars:
|
|
1850
|
+
}).input(z35.strictObject({
|
|
1851
|
+
taskID: z35.string().min(1),
|
|
1852
|
+
turns: z35.int().positive().optional(),
|
|
1853
|
+
dollars: z35.number().positive().optional()
|
|
1705
1854
|
}).refine((input) => input.turns !== undefined || input.dollars !== undefined, {
|
|
1706
1855
|
message: "a raise sets turns, dollars or both"
|
|
1707
|
-
})).output(
|
|
1708
|
-
taskID:
|
|
1856
|
+
})).output(z35.object({
|
|
1857
|
+
taskID: z35.string(),
|
|
1709
1858
|
state: hostTaskStateSchema,
|
|
1710
|
-
isPauseRequested:
|
|
1711
|
-
turns:
|
|
1712
|
-
dollars:
|
|
1859
|
+
isPauseRequested: z35.boolean(),
|
|
1860
|
+
turns: z35.int().positive(),
|
|
1861
|
+
dollars: z35.number().positive()
|
|
1713
1862
|
}))
|
|
1714
1863
|
},
|
|
1715
1864
|
sessions: {
|
|
1716
|
-
issueCode:
|
|
1717
|
-
list:
|
|
1718
|
-
label:
|
|
1865
|
+
issueCode: oc6.output(z35.object({ code: z35.string(), expiresAt: z35.date() })),
|
|
1866
|
+
list: oc6.output(z35.array(hostSessionSchema)),
|
|
1867
|
+
label: oc6.errors({
|
|
1719
1868
|
SESSION_NOT_FOUND: {
|
|
1720
1869
|
message: "no device session that is still signed in has that ID",
|
|
1721
1870
|
status: 404
|
|
1722
1871
|
},
|
|
1723
1872
|
LABEL_INVALID: { message: "a label holds 1 to 100 characters besides spaces", status: 400 }
|
|
1724
|
-
}).input(
|
|
1873
|
+
}).input(z35.strictObject({ sessionID: z35.string().min(1), label: z35.string() })).output(z35.object({ sessionID: z35.string(), label: z35.string() }))
|
|
1725
1874
|
},
|
|
1726
1875
|
passkeys: hostPasskeyContract,
|
|
1727
1876
|
memory: {
|
|
1728
1877
|
proposals: {
|
|
1729
|
-
list: memory.output(
|
|
1878
|
+
list: memory.output(z35.array(pendingProposalSchema)),
|
|
1730
1879
|
approve: memory.input(proposalAnswerSchema.extend({
|
|
1731
1880
|
revisionOf: versionTargetSchema2.optional(),
|
|
1732
|
-
ignoreCloseMatch:
|
|
1881
|
+
ignoreCloseMatch: z35.boolean().optional(),
|
|
1733
1882
|
editedText: itemTextSchema.optional()
|
|
1734
1883
|
})).output(approvalResultSchema),
|
|
1735
|
-
reject: memory.input(proposalAnswerSchema.extend({ reason:
|
|
1884
|
+
reject: memory.input(proposalAnswerSchema.extend({ reason: z35.string().max(500).regex(/\S/u).optional() })).output(z35.object({ proposalID: z35.string() }))
|
|
1736
1885
|
},
|
|
1737
|
-
subjects: memory.output(
|
|
1886
|
+
subjects: memory.output(z35.object({ items: subjectCountSchema, proposals: subjectCountSchema })),
|
|
1738
1887
|
items: {
|
|
1739
|
-
read: memory.input(
|
|
1888
|
+
read: memory.input(z35.strictObject({ itemID: z35.string().min(1) })).output(itemHistorySchema),
|
|
1740
1889
|
edit: memory.input(versionTargetSchema2.extend({ text: itemTextSchema })).output(versionRefSchema2),
|
|
1741
1890
|
retire: memory.input(versionTargetSchema2).output(versionRefSchema2),
|
|
1742
1891
|
restore: memory.input(versionTargetSchema2).output(versionRefSchema2),
|
|
1743
|
-
forget: memory.input(versionTargetSchema2).output(
|
|
1892
|
+
forget: memory.input(versionTargetSchema2).output(z35.object({ itemID: z35.string(), backup: forgetBackupSchema })),
|
|
1744
1893
|
forgetAll: memory.output(forgottenItemsSchema),
|
|
1745
|
-
pin: memory.input(
|
|
1894
|
+
pin: memory.input(z35.strictObject({ itemID: z35.string().min(1), isPinned: z35.boolean() })).output(z35.object({ itemID: z35.string(), isPinned: z35.boolean() }))
|
|
1746
1895
|
}
|
|
1747
1896
|
},
|
|
1748
1897
|
skills: {
|
|
1749
1898
|
proposals: {
|
|
1750
|
-
list: skills.output(
|
|
1751
|
-
approve: skills.input(skillAnswerSchema.extend({ files:
|
|
1752
|
-
reject: skills.input(skillAnswerSchema.extend({ reason:
|
|
1899
|
+
list: skills.output(z35.array(pendingSkillProposalSchema)),
|
|
1900
|
+
approve: skills.input(skillAnswerSchema.extend({ files: z35.array(skillFileSchema).min(1).optional() })).output(z35.object({ proposalID: z35.string(), approvalID: z35.string(), skillHash: z35.string() })),
|
|
1901
|
+
reject: skills.input(skillAnswerSchema.extend({ reason: z35.string().max(500).regex(/\S/u) })).output(z35.object({ proposalID: z35.string() }))
|
|
1753
1902
|
},
|
|
1754
1903
|
written: {
|
|
1755
|
-
list: skills.output(
|
|
1756
|
-
resolve: skills.input(
|
|
1757
|
-
approvalID:
|
|
1758
|
-
keep:
|
|
1759
|
-
})).output(
|
|
1904
|
+
list: skills.output(z35.array(writtenSkillSchema)),
|
|
1905
|
+
resolve: skills.input(z35.strictObject({
|
|
1906
|
+
approvalID: z35.string().min(1),
|
|
1907
|
+
keep: z35.enum(["nixie", "definitions"])
|
|
1908
|
+
})).output(z35.object({ approvalID: z35.string(), keep: z35.enum(["nixie", "definitions"]) }))
|
|
1760
1909
|
}
|
|
1761
1910
|
},
|
|
1762
1911
|
rules: {
|
|
1763
|
-
list: rules.output(
|
|
1764
|
-
conflicts: rules.output(
|
|
1765
|
-
resolve: rules.input(
|
|
1912
|
+
list: rules.output(z35.array(ruleInForceSchema)),
|
|
1913
|
+
conflicts: rules.output(z35.array(ruleConflictSchema)),
|
|
1914
|
+
resolve: rules.input(z35.strictObject({ ruleID: z35.string().min(1), keep: z35.enum(["nixie", "repo"]) })).output(z35.object({ ruleID: z35.string(), changeID: z35.string(), keep: z35.enum(["nixie", "repo"]) })),
|
|
1766
1915
|
proposals: {
|
|
1767
|
-
list: rules.output(
|
|
1768
|
-
approve: rules.input(ruleProposalAnswerSchema).output(
|
|
1769
|
-
reject: rules.input(ruleProposalRejectionSchema).output(
|
|
1916
|
+
list: rules.output(z35.array(pendingRuleProposalSchema)),
|
|
1917
|
+
approve: rules.input(ruleProposalAnswerSchema).output(z35.object({ proposalID: z35.string() })),
|
|
1918
|
+
reject: rules.input(ruleProposalRejectionSchema).output(z35.object({ proposalID: z35.string() }))
|
|
1770
1919
|
}
|
|
1771
1920
|
},
|
|
1772
1921
|
actions: {
|
|
1773
1922
|
proposals: {
|
|
1774
|
-
list: rules.output(
|
|
1775
|
-
approve: rules.input(ruleProposalAnswerSchema).output(
|
|
1776
|
-
reject: rules.input(actionRejectionSchema).output(
|
|
1923
|
+
list: rules.output(z35.array(actionProposalSchema)),
|
|
1924
|
+
approve: rules.input(ruleProposalAnswerSchema).output(z35.object({ proposalID: z35.string() })),
|
|
1925
|
+
reject: rules.input(actionRejectionSchema).output(z35.object({ proposalID: z35.string() }))
|
|
1777
1926
|
}
|
|
1778
1927
|
},
|
|
1928
|
+
mandates: hostMandatesContract,
|
|
1779
1929
|
contacts: {
|
|
1780
|
-
list: contacts.output(
|
|
1781
|
-
markKnown: contacts.input(
|
|
1782
|
-
destination:
|
|
1783
|
-
name:
|
|
1784
|
-
})).output(
|
|
1785
|
-
unmark: contacts.input(
|
|
1930
|
+
list: contacts.output(z35.array(knownContactSchema)),
|
|
1931
|
+
markKnown: contacts.input(z35.strictObject({
|
|
1932
|
+
destination: z35.string().min(1).max(500),
|
|
1933
|
+
name: z35.string().min(1).max(200).optional()
|
|
1934
|
+
})).output(z35.object({ contact: knownContactSchema, isNew: z35.boolean() })),
|
|
1935
|
+
unmark: contacts.input(z35.strictObject({ contactID: z35.string().min(1) })).output(z35.object({ contactID: z35.string() }))
|
|
1786
1936
|
},
|
|
1787
1937
|
turnInputs: turnInputsContract,
|
|
1788
1938
|
prompts: {
|
|
1789
1939
|
proposals: {
|
|
1790
|
-
list: prompts.output(
|
|
1940
|
+
list: prompts.output(z35.array(pendingPromptProposalSchema)),
|
|
1791
1941
|
approve: prompts.input(promptAnswerSchema.extend({
|
|
1792
1942
|
entry: promptEntrySchema.optional(),
|
|
1793
|
-
files:
|
|
1794
|
-
})).output(
|
|
1795
|
-
reject: prompts.input(promptAnswerSchema.extend({ reason:
|
|
1943
|
+
files: z35.array(promptPartFileSchema).optional()
|
|
1944
|
+
})).output(z35.object({ proposalID: z35.string(), approvalID: z35.string(), proposalHash: z35.string() })),
|
|
1945
|
+
reject: prompts.input(promptAnswerSchema.extend({ reason: z35.string().max(500).regex(/\S/u) })).output(z35.object({ proposalID: z35.string() }))
|
|
1796
1946
|
}
|
|
1797
1947
|
}
|
|
1798
1948
|
};
|
|
@@ -1814,11 +1964,11 @@ function renderSessionCookie(token) {
|
|
|
1814
1964
|
return `${sessionCookieName}=${token ?? ""}; Path=/; HttpOnly; Secure; SameSite=Lax; Max-Age=${maxAgeS}`;
|
|
1815
1965
|
}
|
|
1816
1966
|
// src/message/task-message-input-schema.ts
|
|
1817
|
-
import { z as
|
|
1967
|
+
import { z as z37 } from "zod";
|
|
1818
1968
|
|
|
1819
1969
|
// src/message/task-message-kind-schema.ts
|
|
1820
|
-
import { z as
|
|
1821
|
-
var taskMessageKindSchema =
|
|
1970
|
+
import { z as z36 } from "zod";
|
|
1971
|
+
var taskMessageKindSchema = z36.enum([
|
|
1822
1972
|
"progress",
|
|
1823
1973
|
"question",
|
|
1824
1974
|
"request",
|
|
@@ -1828,21 +1978,21 @@ var taskMessageKindSchema = z34.enum([
|
|
|
1828
1978
|
]);
|
|
1829
1979
|
|
|
1830
1980
|
// src/message/task-message-input-schema.ts
|
|
1831
|
-
var taskMessageInputSchema =
|
|
1832
|
-
to:
|
|
1981
|
+
var taskMessageInputSchema = z37.object({
|
|
1982
|
+
to: z37.string(),
|
|
1833
1983
|
kind: taskMessageKindSchema,
|
|
1834
|
-
body:
|
|
1835
|
-
replyTo:
|
|
1836
|
-
onBehalfOf:
|
|
1837
|
-
wake:
|
|
1984
|
+
body: z37.string(),
|
|
1985
|
+
replyTo: z37.string().optional(),
|
|
1986
|
+
onBehalfOf: z37.string().array().optional(),
|
|
1987
|
+
wake: z37.boolean().optional()
|
|
1838
1988
|
});
|
|
1839
1989
|
// src/message/task-message-result-schema.ts
|
|
1840
|
-
import { z as
|
|
1841
|
-
var taskMessageResultSchema =
|
|
1842
|
-
messageID:
|
|
1843
|
-
woke:
|
|
1844
|
-
hop:
|
|
1845
|
-
note:
|
|
1990
|
+
import { z as z38 } from "zod";
|
|
1991
|
+
var taskMessageResultSchema = z38.object({
|
|
1992
|
+
messageID: z38.string(),
|
|
1993
|
+
woke: z38.boolean(),
|
|
1994
|
+
hop: z38.int().nonnegative(),
|
|
1995
|
+
note: z38.string().optional()
|
|
1846
1996
|
});
|
|
1847
1997
|
export {
|
|
1848
1998
|
buildPendingInput,
|