@heynixie/contract 0.75.0 → 0.77.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 +0 -4
- package/dist/contract/build-query-utils.d.ts +579 -116
- package/dist/contract/clip-record-payloads.d.ts +2 -0
- package/dist/contract/clipped-payload-schema.d.ts +11 -0
- package/dist/contract/contract.d.ts +814 -139
- package/dist/contract/definition-notice-schema.d.ts +24 -0
- package/dist/contract/definitions-contract.d.ts +72 -0
- package/dist/contract/forgettable-kinds.d.ts +1 -1
- package/dist/contract/host-contract.d.ts +31 -2
- package/dist/contract/listed-task-schema.d.ts +91 -0
- package/dist/contract/memory-view-contract.d.ts +15 -45
- package/dist/contract/payload-clip-bytes.d.ts +1 -0
- package/dist/contract/read-payload-contract.d.ts +29 -0
- package/dist/contract/schedule-schema.d.ts +31 -0
- package/dist/contract/sequence-schema.d.ts +2 -0
- package/dist/contract/thread-schema.d.ts +2 -0
- package/dist/contract/tool-call-schema.d.ts +1 -0
- package/dist/contract/trigger-schema.d.ts +36 -0
- package/dist/contract/view-contract.d.ts +209 -0
- package/dist/contract/worker-view-schema.d.ts +37 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +1075 -639
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -176,11 +176,13 @@ var forgettableKinds = [
|
|
|
176
176
|
"task.step_errored",
|
|
177
177
|
"task_message",
|
|
178
178
|
"tool_called",
|
|
179
|
-
"tool_result"
|
|
179
|
+
"tool_result",
|
|
180
|
+
"worker.run_ended",
|
|
181
|
+
"worker.turn_ended"
|
|
180
182
|
];
|
|
181
183
|
// src/contract/contract.ts
|
|
182
184
|
import { eventIterator as eventIterator2, oc as oc2 } from "@orpc/contract";
|
|
183
|
-
import { z as
|
|
185
|
+
import { z as z37 } from "zod";
|
|
184
186
|
|
|
185
187
|
// src/span/span-schema.ts
|
|
186
188
|
import { z } from "zod";
|
|
@@ -404,8 +406,8 @@ var memoryItemSchema = z8.object({
|
|
|
404
406
|
changedAt: z8.date(),
|
|
405
407
|
createdAt: z8.date(),
|
|
406
408
|
forgottenAt: z8.date().nullable(),
|
|
409
|
+
isBridge: z8.boolean(),
|
|
407
410
|
isPinned: z8.boolean(),
|
|
408
|
-
isSensitive: z8.boolean(),
|
|
409
411
|
itemID: z8.string(),
|
|
410
412
|
kind: kindSchema,
|
|
411
413
|
origin: originSchema,
|
|
@@ -443,6 +445,8 @@ var memoryVersionSchema = z8.object({
|
|
|
443
445
|
evidence: evidenceSchema.nullable(),
|
|
444
446
|
evidenceQuote: z8.string().nullable(),
|
|
445
447
|
image: ownerImageSchema.nullable(),
|
|
448
|
+
isBridge: z8.boolean(),
|
|
449
|
+
isRemoved: z8.boolean(),
|
|
446
450
|
origin: originSchema,
|
|
447
451
|
proposalID: z8.string().nullable(),
|
|
448
452
|
recordedAt: z8.date(),
|
|
@@ -469,7 +473,6 @@ var reviewReasonSchema = z8.enum([
|
|
|
469
473
|
"other",
|
|
470
474
|
"self_note",
|
|
471
475
|
"from_photo",
|
|
472
|
-
"sensitive",
|
|
473
476
|
"subject_change",
|
|
474
477
|
"labels",
|
|
475
478
|
"ask_rule"
|
|
@@ -491,7 +494,6 @@ var memoryProposalSchema = z8.object({
|
|
|
491
494
|
evidence: evidenceSchema.nullable(),
|
|
492
495
|
image: ownerImageSchema.nullable(),
|
|
493
496
|
isPinned: z8.boolean(),
|
|
494
|
-
isSensitive: z8.boolean(),
|
|
495
497
|
itemID: z8.string(),
|
|
496
498
|
kind: kindSchema,
|
|
497
499
|
labels: proposalLabelsSchema.nullable(),
|
|
@@ -577,7 +579,11 @@ var memoryViewContract = {
|
|
|
577
579
|
restore: memoryChange.input(versionTargetSchema).output(versionResultSchema),
|
|
578
580
|
listNotices: memoryView.input(z8.object({ thread: z8.string().min(1).max(200) })).output(z8.object({ notices: z8.array(memoryNoticeSchema) })),
|
|
579
581
|
undo: memoryChange.errors({
|
|
580
|
-
PINNED_CORE_FULL: { message: "The undo takes the pinned core past its budget", status: 409 }
|
|
582
|
+
PINNED_CORE_FULL: { message: "The undo takes the pinned core past its budget", status: 409 },
|
|
583
|
+
VERSION_REMOVED: {
|
|
584
|
+
message: "The earlier version was removed with a message it quoted",
|
|
585
|
+
status: 409
|
|
586
|
+
}
|
|
581
587
|
}).input(versionTargetSchema).output(versionResultSchema),
|
|
582
588
|
keep: memoryChange.input(versionTargetSchema).output(versionResultSchema),
|
|
583
589
|
previewForget: memoryView.errors({
|
|
@@ -591,7 +597,6 @@ var memoryViewContract = {
|
|
|
591
597
|
pin: memoryChange.errors({
|
|
592
598
|
PINNED_CORE_FULL: { message: "The pin takes the pinned core past its budget", status: 409 }
|
|
593
599
|
}).input(versionTargetSchema.extend({ isPinned: z8.boolean() })).output(z8.object({ isPinned: z8.boolean(), itemID: z8.string() })),
|
|
594
|
-
markSensitive: memoryChange.input(z8.object({ clientActionID: z8.uuid(), isSensitive: z8.boolean(), itemID: itemIDSchema })).output(z8.object({ isSensitive: z8.boolean(), itemID: z8.string() })),
|
|
595
600
|
...memoryExportContract,
|
|
596
601
|
...momentContract
|
|
597
602
|
};
|
|
@@ -805,6 +810,72 @@ var approvalContract = {
|
|
|
805
810
|
answerProposals: signedIn.errors(reusedIDErrors).input(batchInputSchema).output(batchResultSchema)
|
|
806
811
|
};
|
|
807
812
|
|
|
813
|
+
// src/contract/clipped-payload-schema.ts
|
|
814
|
+
import { z as z12 } from "zod";
|
|
815
|
+
var fieldSchema = z12.enum(["toolCall.input", "toolCall.content", "worker.text", "worker.detail"]);
|
|
816
|
+
var pathStepSchema = z12.union([z12.string(), z12.number()]);
|
|
817
|
+
var clippedPayloadSchema = z12.object({
|
|
818
|
+
field: fieldSchema,
|
|
819
|
+
path: z12.array(pathStepSchema),
|
|
820
|
+
bytes: z12.number()
|
|
821
|
+
});
|
|
822
|
+
|
|
823
|
+
// src/contract/definition-notice-schema.ts
|
|
824
|
+
import { z as z13 } from "zod";
|
|
825
|
+
var definitionNoticeSchema = z13.object({
|
|
826
|
+
definitionID: z13.string(),
|
|
827
|
+
name: z13.string().nullable(),
|
|
828
|
+
operation: z13.enum(["add", "change", "remove", "undo"]),
|
|
829
|
+
shortID: z13.string(),
|
|
830
|
+
changeID: z13.string(),
|
|
831
|
+
hasVersion: z13.boolean(),
|
|
832
|
+
rendered: z13.string().nullable(),
|
|
833
|
+
next: z13.string().nullable(),
|
|
834
|
+
state: z13.enum(["in_force", "superseded", "adopted", "retired"]),
|
|
835
|
+
isUnreadable: z13.boolean()
|
|
836
|
+
});
|
|
837
|
+
|
|
838
|
+
// src/contract/definitions-contract.ts
|
|
839
|
+
import { z as z14 } from "zod";
|
|
840
|
+
var operationSchema = z14.enum(["add", "change", "remove", "undo"]);
|
|
841
|
+
var headSchema = z14.object({
|
|
842
|
+
changeID: z14.string(),
|
|
843
|
+
shortID: z14.string(),
|
|
844
|
+
operation: operationSchema
|
|
845
|
+
});
|
|
846
|
+
var replacedSchema = z14.object({ head: headSchema });
|
|
847
|
+
var undo = signedIn.errors(reusedIDErrors).errors({
|
|
848
|
+
NOT_STARTED: { message: "Task definitions are not ready yet", status: 503 },
|
|
849
|
+
NOT_FOUND: { message: "No change has this ID", status: 404 },
|
|
850
|
+
REPLACED: {
|
|
851
|
+
message: "A later change replaced this one",
|
|
852
|
+
status: 409,
|
|
853
|
+
data: replacedSchema
|
|
854
|
+
},
|
|
855
|
+
REPO_MOVED: {
|
|
856
|
+
message: "The definitions repo changed this definition since",
|
|
857
|
+
status: 409,
|
|
858
|
+
data: z14.object({ seedSequence: z14.int().nonnegative() })
|
|
859
|
+
},
|
|
860
|
+
NOT_IN_FORCE: {
|
|
861
|
+
message: "The change is no longer in force",
|
|
862
|
+
status: 409,
|
|
863
|
+
data: z14.object({ cause: z14.enum(["one_shot_fired", "one_shot_skipped", "kept_repo"]) })
|
|
864
|
+
},
|
|
865
|
+
ONE_SHOT_OVER_REPO: {
|
|
866
|
+
message: "A one-time trigger cannot go back over a definition in the repo",
|
|
867
|
+
status: 409
|
|
868
|
+
},
|
|
869
|
+
ONE_SHOT_PAST: { message: "The time of that one-time trigger has passed", status: 409 }
|
|
870
|
+
});
|
|
871
|
+
var definitionsContract = {
|
|
872
|
+
undo: undo.input(z14.object({ clientActionID: z14.uuid(), changeID: z14.string().min(1).max(64) })).output(z14.object({
|
|
873
|
+
definitionID: z14.string(),
|
|
874
|
+
changeID: z14.string(),
|
|
875
|
+
restored: z14.literal("repo").optional()
|
|
876
|
+
}))
|
|
877
|
+
};
|
|
878
|
+
|
|
808
879
|
// src/contract/image-limits.ts
|
|
809
880
|
var imageLimits = {
|
|
810
881
|
count: 4,
|
|
@@ -820,10 +891,10 @@ var imageNotFoundError = {
|
|
|
820
891
|
};
|
|
821
892
|
|
|
822
893
|
// src/contract/image-refused-error.ts
|
|
823
|
-
import { z as
|
|
824
|
-
var imageRefusedDataSchema =
|
|
825
|
-
position:
|
|
826
|
-
reason:
|
|
894
|
+
import { z as z15 } from "zod";
|
|
895
|
+
var imageRefusedDataSchema = z15.object({
|
|
896
|
+
position: z15.int().nonnegative().nullable(),
|
|
897
|
+
reason: z15.enum(["too_many", "too_large", "unsupported_type"])
|
|
827
898
|
});
|
|
828
899
|
var imageRefusedError = {
|
|
829
900
|
message: "An image is too large, of a type nixie does not take, or one too many",
|
|
@@ -831,108 +902,160 @@ var imageRefusedError = {
|
|
|
831
902
|
data: imageRefusedDataSchema
|
|
832
903
|
};
|
|
833
904
|
|
|
905
|
+
// src/contract/listed-task-schema.ts
|
|
906
|
+
import { z as z17 } from "zod";
|
|
907
|
+
|
|
908
|
+
// src/contract/thread-schema.ts
|
|
909
|
+
import { z as z16 } from "zod";
|
|
910
|
+
var threadSchema = z16.string().min(1).max(200);
|
|
911
|
+
|
|
912
|
+
// src/contract/listed-task-schema.ts
|
|
913
|
+
var taskStateSchema = z17.enum([
|
|
914
|
+
"ready",
|
|
915
|
+
"running",
|
|
916
|
+
"waiting",
|
|
917
|
+
"paused",
|
|
918
|
+
"stopped",
|
|
919
|
+
"done",
|
|
920
|
+
"failed",
|
|
921
|
+
"closed"
|
|
922
|
+
]);
|
|
923
|
+
var listedStateSchema = z17.enum([...taskStateSchema.options, "idle", "finished", "asleep"]);
|
|
924
|
+
var runFireSchema = z17.object({
|
|
925
|
+
scheduledFor: z17.string(),
|
|
926
|
+
firedAt: z17.string(),
|
|
927
|
+
isCatchUp: z17.boolean()
|
|
928
|
+
});
|
|
929
|
+
var taskControlSchema = z17.enum(["pause", "resume", "stop", "restart", "close", "interrupt"]);
|
|
930
|
+
var actionCountSchema = z17.int().nonnegative();
|
|
931
|
+
var listedTaskSchema = z17.object({
|
|
932
|
+
actions: z17.object({
|
|
933
|
+
cancelled: actionCountSchema,
|
|
934
|
+
queued: actionCountSchema,
|
|
935
|
+
started: actionCountSchema
|
|
936
|
+
}),
|
|
937
|
+
brief: z17.string(),
|
|
938
|
+
closedBy: z17.enum(["owner", "nixie", "disposable"]).optional(),
|
|
939
|
+
controls: z17.array(taskControlSchema),
|
|
940
|
+
definitionID: z17.string().optional(),
|
|
941
|
+
disposable: z17.boolean().nullable(),
|
|
942
|
+
fire: runFireSchema.nullable().optional(),
|
|
943
|
+
isPauseRequested: z17.boolean(),
|
|
944
|
+
isPausedByNixie: z17.boolean(),
|
|
945
|
+
isTakingMessages: z17.boolean(),
|
|
946
|
+
lastActivityAt: z17.date(),
|
|
947
|
+
listedState: listedStateSchema.optional(),
|
|
948
|
+
name: z17.string(),
|
|
949
|
+
nextRunAt: z17.string().optional(),
|
|
950
|
+
runner: z17.string(),
|
|
951
|
+
state: taskStateSchema,
|
|
952
|
+
taskID: threadSchema,
|
|
953
|
+
wakeable: z17.boolean().optional(),
|
|
954
|
+
waitingOn: threadSchema.optional()
|
|
955
|
+
});
|
|
956
|
+
|
|
834
957
|
// src/contract/passkey-contract.ts
|
|
835
|
-
import { z as
|
|
958
|
+
import { z as z25 } from "zod";
|
|
836
959
|
|
|
837
960
|
// src/contract/challenge-for-schema.ts
|
|
838
|
-
import { z as
|
|
839
|
-
var challengeForSchema =
|
|
840
|
-
|
|
841
|
-
kind:
|
|
842
|
-
proposalID:
|
|
843
|
-
actionHash:
|
|
961
|
+
import { z as z18 } from "zod";
|
|
962
|
+
var challengeForSchema = z18.discriminatedUnion("kind", [
|
|
963
|
+
z18.object({
|
|
964
|
+
kind: z18.literal("answer"),
|
|
965
|
+
proposalID: z18.string().min(1).max(200),
|
|
966
|
+
actionHash: z18.string().min(1),
|
|
844
967
|
choice: choiceSchema,
|
|
845
|
-
ruleHash:
|
|
968
|
+
ruleHash: z18.string().optional()
|
|
846
969
|
}),
|
|
847
|
-
|
|
848
|
-
kind:
|
|
849
|
-
actionID:
|
|
850
|
-
choice:
|
|
970
|
+
z18.object({
|
|
971
|
+
kind: z18.literal("unknown_outcome"),
|
|
972
|
+
actionID: z18.string().min(1).max(200),
|
|
973
|
+
choice: z18.literal("retry")
|
|
851
974
|
}),
|
|
852
|
-
|
|
853
|
-
|
|
975
|
+
z18.object({ kind: z18.literal("register") }),
|
|
976
|
+
z18.object({ kind: z18.literal("revoke"), passkeyID: z18.string().min(1).max(200) })
|
|
854
977
|
]);
|
|
855
978
|
|
|
856
979
|
// src/contract/creation-options-schema.ts
|
|
857
|
-
import { z as
|
|
980
|
+
import { z as z22 } from "zod";
|
|
858
981
|
|
|
859
982
|
// src/contract/credential-descriptor-schema.ts
|
|
860
|
-
import { z as
|
|
983
|
+
import { z as z20 } from "zod";
|
|
861
984
|
|
|
862
985
|
// src/contract/transports-schema.ts
|
|
863
|
-
import { z as
|
|
864
|
-
var transportSchema =
|
|
865
|
-
var transportsSchema =
|
|
986
|
+
import { z as z19 } from "zod";
|
|
987
|
+
var transportSchema = z19.string().max(40);
|
|
988
|
+
var transportsSchema = z19.array(transportSchema).max(10);
|
|
866
989
|
|
|
867
990
|
// src/contract/credential-descriptor-schema.ts
|
|
868
|
-
var credentialDescriptorSchema =
|
|
991
|
+
var credentialDescriptorSchema = z20.object({
|
|
869
992
|
id: base64URLSchema,
|
|
870
|
-
type:
|
|
993
|
+
type: z20.literal("public-key"),
|
|
871
994
|
transports: transportsSchema.optional()
|
|
872
995
|
});
|
|
873
996
|
|
|
874
997
|
// src/contract/user-verification-schema.ts
|
|
875
|
-
import { z as
|
|
876
|
-
var userVerificationSchema =
|
|
998
|
+
import { z as z21 } from "zod";
|
|
999
|
+
var userVerificationSchema = z21.enum(["required", "preferred", "discouraged"]);
|
|
877
1000
|
|
|
878
1001
|
// src/contract/creation-options-schema.ts
|
|
879
|
-
var userSchema =
|
|
880
|
-
var parameterSchema =
|
|
881
|
-
var selectionSchema =
|
|
1002
|
+
var userSchema = z22.object({ id: base64URLSchema, name: z22.string(), displayName: z22.string() });
|
|
1003
|
+
var parameterSchema = z22.object({ type: z22.literal("public-key"), alg: z22.int() });
|
|
1004
|
+
var selectionSchema = z22.object({
|
|
882
1005
|
residentKey: userVerificationSchema,
|
|
883
|
-
requireResidentKey:
|
|
1006
|
+
requireResidentKey: z22.boolean(),
|
|
884
1007
|
userVerification: userVerificationSchema
|
|
885
1008
|
});
|
|
886
|
-
var creationOptionsSchema =
|
|
887
|
-
rp:
|
|
1009
|
+
var creationOptionsSchema = z22.object({
|
|
1010
|
+
rp: z22.object({ id: z22.string(), name: z22.string() }),
|
|
888
1011
|
user: userSchema,
|
|
889
1012
|
challenge: base64URLSchema,
|
|
890
|
-
pubKeyCredParams:
|
|
891
|
-
timeout:
|
|
892
|
-
excludeCredentials:
|
|
1013
|
+
pubKeyCredParams: z22.array(parameterSchema),
|
|
1014
|
+
timeout: z22.int().positive(),
|
|
1015
|
+
excludeCredentials: z22.array(credentialDescriptorSchema),
|
|
893
1016
|
authenticatorSelection: selectionSchema,
|
|
894
|
-
attestation:
|
|
1017
|
+
attestation: z22.enum(["none", "indirect", "direct", "enterprise"])
|
|
895
1018
|
});
|
|
896
1019
|
|
|
897
1020
|
// src/contract/registration-response-schema.ts
|
|
898
|
-
import { z as
|
|
899
|
-
var attestationSchema =
|
|
1021
|
+
import { z as z23 } from "zod";
|
|
1022
|
+
var attestationSchema = z23.object({
|
|
900
1023
|
clientDataJSON: base64URLSchema,
|
|
901
1024
|
attestationObject: base64URLSchema,
|
|
902
1025
|
authenticatorData: base64URLSchema.optional(),
|
|
903
1026
|
transports: transportsSchema.optional(),
|
|
904
|
-
publicKeyAlgorithm:
|
|
1027
|
+
publicKeyAlgorithm: z23.int().optional(),
|
|
905
1028
|
publicKey: base64URLSchema.optional()
|
|
906
1029
|
});
|
|
907
|
-
var registrationResponseSchema =
|
|
1030
|
+
var registrationResponseSchema = z23.object({
|
|
908
1031
|
id: base64URLSchema,
|
|
909
1032
|
rawId: base64URLSchema,
|
|
910
1033
|
response: attestationSchema,
|
|
911
|
-
authenticatorAttachment:
|
|
912
|
-
clientExtensionResults:
|
|
913
|
-
type:
|
|
1034
|
+
authenticatorAttachment: z23.enum(["cross-platform", "platform"]).optional(),
|
|
1035
|
+
clientExtensionResults: z23.object({}),
|
|
1036
|
+
type: z23.literal("public-key")
|
|
914
1037
|
});
|
|
915
1038
|
|
|
916
1039
|
// src/contract/request-options-schema.ts
|
|
917
|
-
import { z as
|
|
918
|
-
var requestOptionsSchema =
|
|
1040
|
+
import { z as z24 } from "zod";
|
|
1041
|
+
var requestOptionsSchema = z24.object({
|
|
919
1042
|
challenge: base64URLSchema,
|
|
920
|
-
rpId:
|
|
921
|
-
allowCredentials:
|
|
1043
|
+
rpId: z24.string(),
|
|
1044
|
+
allowCredentials: z24.array(credentialDescriptorSchema),
|
|
922
1045
|
userVerification: userVerificationSchema,
|
|
923
|
-
timeout:
|
|
1046
|
+
timeout: z24.int().positive()
|
|
924
1047
|
});
|
|
925
1048
|
|
|
926
1049
|
// src/contract/passkey-contract.ts
|
|
927
|
-
var clientActionIDSchema =
|
|
928
|
-
var listedPasskeySchema =
|
|
929
|
-
passkeyID:
|
|
930
|
-
label:
|
|
931
|
-
synced:
|
|
932
|
-
authorizedBy:
|
|
933
|
-
registeredAt:
|
|
934
|
-
lastUsedAt:
|
|
935
|
-
revokedAt:
|
|
1050
|
+
var clientActionIDSchema = z25.uuid();
|
|
1051
|
+
var listedPasskeySchema = z25.object({
|
|
1052
|
+
passkeyID: z25.string(),
|
|
1053
|
+
label: z25.string(),
|
|
1054
|
+
synced: z25.boolean(),
|
|
1055
|
+
authorizedBy: z25.string(),
|
|
1056
|
+
registeredAt: z25.date(),
|
|
1057
|
+
lastUsedAt: z25.date().nullable(),
|
|
1058
|
+
revokedAt: z25.date().nullable()
|
|
936
1059
|
});
|
|
937
1060
|
var registrationErrors = {
|
|
938
1061
|
...passkeyFailedError,
|
|
@@ -944,43 +1067,71 @@ var registrationErrors = {
|
|
|
944
1067
|
ORIGIN_CHANGED: { message: "Live passkeys hold another origin", status: 409 }
|
|
945
1068
|
};
|
|
946
1069
|
var passkeyContract = {
|
|
947
|
-
challenge: signedIn.errors(noPasskeyError).input(
|
|
1070
|
+
challenge: signedIn.errors(noPasskeyError).input(z25.object({ for: challengeForSchema })).output(z25.object({ options: requestOptionsSchema })),
|
|
948
1071
|
registrationOptions: signedIn.errors(registrationErrors).errors({
|
|
949
1072
|
CODE_REQUIRED: { message: "A host code is required", status: 403 },
|
|
950
1073
|
CODE_INVALID: { message: "The host code is unknown, used or lapsed", status: 403 }
|
|
951
|
-
}).input(
|
|
952
|
-
code:
|
|
1074
|
+
}).input(z25.object({
|
|
1075
|
+
code: z25.string().min(1).max(100).optional(),
|
|
953
1076
|
passkey: authenticationResponseSchema.optional()
|
|
954
|
-
})).output(
|
|
1077
|
+
})).output(z25.object({ options: creationOptionsSchema })),
|
|
955
1078
|
register: signedIn.errors(reusedIDErrors).errors({
|
|
956
1079
|
REGISTRATION_FAILED: {
|
|
957
1080
|
message: "The registration failed",
|
|
958
1081
|
status: 400,
|
|
959
|
-
data:
|
|
1082
|
+
data: z25.object({ reason: z25.string() })
|
|
960
1083
|
},
|
|
961
1084
|
TOO_MANY_PASSKEYS: registrationErrors.TOO_MANY_PASSKEYS,
|
|
962
1085
|
ORIGIN_UNSUPPORTED: registrationErrors.ORIGIN_UNSUPPORTED
|
|
963
|
-
}).input(
|
|
1086
|
+
}).input(z25.object({
|
|
964
1087
|
clientActionID: clientActionIDSchema,
|
|
965
1088
|
response: registrationResponseSchema,
|
|
966
|
-
label:
|
|
967
|
-
})).output(
|
|
968
|
-
list: signedIn.output(
|
|
969
|
-
revoke: signedIn.errors(reusedIDErrors).errors(passkeyFailedError).errors({ NOT_FOUND: { message: "No passkey has this ID", status: 404 } }).input(
|
|
1089
|
+
label: z25.string().min(1).max(64).optional()
|
|
1090
|
+
})).output(z25.object({ passkeyID: z25.string() })),
|
|
1091
|
+
list: signedIn.output(z25.object({ passkeys: z25.array(listedPasskeySchema) })),
|
|
1092
|
+
revoke: signedIn.errors(reusedIDErrors).errors(passkeyFailedError).errors({ NOT_FOUND: { message: "No passkey has this ID", status: 404 } }).input(z25.object({
|
|
970
1093
|
clientActionID: clientActionIDSchema,
|
|
971
|
-
passkeyID:
|
|
1094
|
+
passkeyID: z25.string().min(1).max(200),
|
|
972
1095
|
passkey: authenticationResponseSchema
|
|
973
|
-
})).output(
|
|
1096
|
+
})).output(z25.object({ revokedAt: z25.date() }))
|
|
974
1097
|
};
|
|
975
1098
|
|
|
976
1099
|
// src/contract/pause-state-schema.ts
|
|
977
|
-
import { z as
|
|
978
|
-
var pauseCauseSchema =
|
|
979
|
-
var pauseStateSchema =
|
|
1100
|
+
import { z as z26 } from "zod";
|
|
1101
|
+
var pauseCauseSchema = z26.enum(["restore", "owner", "spending"]);
|
|
1102
|
+
var pauseStateSchema = z26.object({ cause: pauseCauseSchema, since: z26.date() }).nullable();
|
|
1103
|
+
|
|
1104
|
+
// src/contract/read-payload-contract.ts
|
|
1105
|
+
import { z as z28 } from "zod";
|
|
1106
|
+
|
|
1107
|
+
// src/contract/sequence-schema.ts
|
|
1108
|
+
import { z as z27 } from "zod";
|
|
1109
|
+
var sequenceSchema = z27.int().nonnegative();
|
|
1110
|
+
|
|
1111
|
+
// src/contract/read-payload-contract.ts
|
|
1112
|
+
var jsonObjectSchema = z28.record(z28.string(), z28.unknown());
|
|
1113
|
+
var readableSchema = z28.object({
|
|
1114
|
+
status: z28.literal("readable"),
|
|
1115
|
+
toolCall: z28.object({ input: jsonObjectSchema.optional(), content: jsonObjectSchema.optional() }).optional(),
|
|
1116
|
+
worker: z28.object({ text: z28.string().optional(), detail: z28.string().optional() }).optional()
|
|
1117
|
+
});
|
|
1118
|
+
var forgottenSchema = z28.object({ status: z28.literal("forgotten") });
|
|
1119
|
+
var unreadableSchema = z28.object({ status: z28.literal("unreadable") });
|
|
1120
|
+
var payloadSchema = z28.discriminatedUnion("status", [
|
|
1121
|
+
readableSchema,
|
|
1122
|
+
forgottenSchema,
|
|
1123
|
+
unreadableSchema
|
|
1124
|
+
]);
|
|
1125
|
+
var notFoundError = {
|
|
1126
|
+
message: "No record on this thread has this sequence",
|
|
1127
|
+
status: 404
|
|
1128
|
+
};
|
|
1129
|
+
var inputSchema = z28.object({ thread: threadSchema, sequence: sequenceSchema });
|
|
1130
|
+
var readPayloadContract = signedIn.errors({ RECORD_NOT_FOUND: notFoundError }).input(inputSchema).output(payloadSchema);
|
|
980
1131
|
|
|
981
1132
|
// src/contract/recovery-schema.ts
|
|
982
|
-
import { z as
|
|
983
|
-
var
|
|
1133
|
+
import { z as z29 } from "zod";
|
|
1134
|
+
var taskStateSchema2 = z29.enum([
|
|
984
1135
|
"ready",
|
|
985
1136
|
"running",
|
|
986
1137
|
"waiting",
|
|
@@ -990,29 +1141,29 @@ var taskStateSchema = z22.enum([
|
|
|
990
1141
|
"failed",
|
|
991
1142
|
"closed"
|
|
992
1143
|
]);
|
|
993
|
-
var taskToCheckSchema =
|
|
994
|
-
taskID:
|
|
995
|
-
name:
|
|
996
|
-
stateAtBackup:
|
|
997
|
-
wasRunning:
|
|
998
|
-
pendingActions:
|
|
999
|
-
});
|
|
1000
|
-
var recoverySchema =
|
|
1001
|
-
restoredAt:
|
|
1002
|
-
backupTakenAt:
|
|
1003
|
-
toCheck:
|
|
1144
|
+
var taskToCheckSchema = z29.object({
|
|
1145
|
+
taskID: z29.string(),
|
|
1146
|
+
name: z29.string(),
|
|
1147
|
+
stateAtBackup: taskStateSchema2,
|
|
1148
|
+
wasRunning: z29.boolean(),
|
|
1149
|
+
pendingActions: z29.int().nonnegative()
|
|
1150
|
+
});
|
|
1151
|
+
var recoverySchema = z29.object({
|
|
1152
|
+
restoredAt: z29.date(),
|
|
1153
|
+
backupTakenAt: z29.date(),
|
|
1154
|
+
toCheck: z29.array(taskToCheckSchema)
|
|
1004
1155
|
}).nullable();
|
|
1005
1156
|
|
|
1006
1157
|
// src/contract/rule-contract.ts
|
|
1007
|
-
import { z as
|
|
1008
|
-
var ruleIDSchema =
|
|
1009
|
-
var revisionSchema =
|
|
1010
|
-
var ruleSchema =
|
|
1011
|
-
ruleID:
|
|
1158
|
+
import { z as z30 } from "zod";
|
|
1159
|
+
var ruleIDSchema = z30.string().min(1).max(200);
|
|
1160
|
+
var revisionSchema = z30.int().positive();
|
|
1161
|
+
var ruleSchema = z30.object({
|
|
1162
|
+
ruleID: z30.string(),
|
|
1012
1163
|
revision: revisionSchema,
|
|
1013
|
-
sentence:
|
|
1014
|
-
outcome:
|
|
1015
|
-
destinations:
|
|
1164
|
+
sentence: z30.string(),
|
|
1165
|
+
outcome: z30.enum(["allow", "ask", "deny"]),
|
|
1166
|
+
destinations: z30.array(z30.string())
|
|
1016
1167
|
});
|
|
1017
1168
|
var notFound = { NOT_FOUND: { message: "No rule has this ID", status: 404 } };
|
|
1018
1169
|
var ruleChange = signedIn.errors(reusedIDErrors).errors({
|
|
@@ -1020,29 +1171,29 @@ var ruleChange = signedIn.errors(reusedIDErrors).errors({
|
|
|
1020
1171
|
CONFLICT: {
|
|
1021
1172
|
message: "The rule changed since the notice showed it",
|
|
1022
1173
|
status: 409,
|
|
1023
|
-
data:
|
|
1174
|
+
data: z30.object({ revision: revisionSchema })
|
|
1024
1175
|
},
|
|
1025
1176
|
NOT_ALLOWED: {
|
|
1026
1177
|
message: "The rule takes no such change",
|
|
1027
1178
|
status: 403,
|
|
1028
|
-
data:
|
|
1179
|
+
data: z30.object({ reason: z30.enum(["widens", "empty", "mandate"]) })
|
|
1029
1180
|
}
|
|
1030
1181
|
});
|
|
1031
|
-
var currentHashSchema =
|
|
1032
|
-
var closedStateSchema =
|
|
1033
|
-
state:
|
|
1034
|
-
});
|
|
1035
|
-
var proposalIDSchema =
|
|
1036
|
-
var ruleFormSchema =
|
|
1037
|
-
var mandateRuleSchema =
|
|
1038
|
-
var mandateSchema =
|
|
1039
|
-
mandateID:
|
|
1040
|
-
title:
|
|
1041
|
-
rules:
|
|
1042
|
-
startedAt:
|
|
1043
|
-
expires:
|
|
1044
|
-
});
|
|
1045
|
-
var faultsSchema =
|
|
1182
|
+
var currentHashSchema = z30.object({ current: z30.object({ actionHash: z30.string() }) });
|
|
1183
|
+
var closedStateSchema = z30.object({
|
|
1184
|
+
state: z30.enum(["approved", "declined", "lapsed", "withdrawn"])
|
|
1185
|
+
});
|
|
1186
|
+
var proposalIDSchema = z30.string().min(1).max(64);
|
|
1187
|
+
var ruleFormSchema = z30.record(z30.string(), z30.unknown());
|
|
1188
|
+
var mandateRuleSchema = z30.object({ ruleID: z30.string(), sentence: z30.string() });
|
|
1189
|
+
var mandateSchema = z30.object({
|
|
1190
|
+
mandateID: z30.string(),
|
|
1191
|
+
title: z30.string().nullable(),
|
|
1192
|
+
rules: z30.array(mandateRuleSchema),
|
|
1193
|
+
startedAt: z30.date(),
|
|
1194
|
+
expires: z30.date()
|
|
1195
|
+
});
|
|
1196
|
+
var faultsSchema = z30.object({ faults: z30.array(z30.string()) });
|
|
1046
1197
|
var invalid = {
|
|
1047
1198
|
INVALID: {
|
|
1048
1199
|
message: "The rule or the mandate breaks the rule format or its limits",
|
|
@@ -1050,16 +1201,16 @@ var invalid = {
|
|
|
1050
1201
|
data: faultsSchema
|
|
1051
1202
|
}
|
|
1052
1203
|
};
|
|
1053
|
-
var destinationsSchema =
|
|
1204
|
+
var destinationsSchema = z30.array(z30.string().regex(/^\S+$/u)).max(100);
|
|
1054
1205
|
var ruleContract = {
|
|
1055
|
-
readRule: signedIn.errors(notFound).input(
|
|
1056
|
-
removeRule: ruleChange.input(
|
|
1057
|
-
editRule: ruleChange.input(
|
|
1206
|
+
readRule: signedIn.errors(notFound).input(z30.object({ ruleID: ruleIDSchema })).output(ruleSchema),
|
|
1207
|
+
removeRule: ruleChange.input(z30.object({ ruleID: ruleIDSchema, revision: revisionSchema, clientActionID: z30.uuid() })).output(z30.object({ ruleID: z30.string() })),
|
|
1208
|
+
editRule: ruleChange.input(z30.object({
|
|
1058
1209
|
ruleID: ruleIDSchema,
|
|
1059
1210
|
revision: revisionSchema,
|
|
1060
1211
|
destinations: destinationsSchema,
|
|
1061
|
-
clientActionID:
|
|
1062
|
-
})).output(
|
|
1212
|
+
clientActionID: z30.uuid()
|
|
1213
|
+
})).output(z30.object({ ruleID: z30.string(), revision: revisionSchema })),
|
|
1063
1214
|
editProposedRule: signedIn.errors(reusedIDErrors).errors({
|
|
1064
1215
|
...invalid,
|
|
1065
1216
|
NOT_FOUND: { message: "No proposed rule has this ID", status: 404 },
|
|
@@ -1073,192 +1224,331 @@ var ruleContract = {
|
|
|
1073
1224
|
status: 409,
|
|
1074
1225
|
data: closedStateSchema
|
|
1075
1226
|
}
|
|
1076
|
-
}).input(
|
|
1227
|
+
}).input(z30.object({
|
|
1077
1228
|
proposalID: proposalIDSchema,
|
|
1078
|
-
actionHash:
|
|
1229
|
+
actionHash: z30.string(),
|
|
1079
1230
|
rule: ruleFormSchema,
|
|
1080
|
-
clientActionID:
|
|
1081
|
-
})).output(
|
|
1082
|
-
proposeMandate: signedIn.errors(reusedIDErrors).errors(invalid).input(
|
|
1083
|
-
title:
|
|
1084
|
-
rules:
|
|
1085
|
-
expires:
|
|
1086
|
-
clientActionID:
|
|
1087
|
-
})).output(
|
|
1088
|
-
listMandates: signedIn.output(
|
|
1089
|
-
endMandate: signedIn.errors(reusedIDErrors).errors({ NOT_FOUND: { message: "No mandate has this ID", status: 404 } }).input(
|
|
1231
|
+
clientActionID: z30.uuid()
|
|
1232
|
+
})).output(z30.object({ proposalID: z30.string() })),
|
|
1233
|
+
proposeMandate: signedIn.errors(reusedIDErrors).errors(invalid).input(z30.object({
|
|
1234
|
+
title: z30.string(),
|
|
1235
|
+
rules: z30.array(ruleFormSchema),
|
|
1236
|
+
expires: z30.string().optional(),
|
|
1237
|
+
clientActionID: z30.uuid()
|
|
1238
|
+
})).output(z30.object({ proposalID: z30.string(), mandateID: z30.string(), expires: z30.date() })),
|
|
1239
|
+
listMandates: signedIn.output(z30.object({ mandates: z30.array(mandateSchema) })),
|
|
1240
|
+
endMandate: signedIn.errors(reusedIDErrors).errors({ NOT_FOUND: { message: "No mandate has this ID", status: 404 } }).input(z30.object({ mandateID: z30.string().min(1).max(64), clientActionID: z30.uuid() })).output(z30.object({ mandateID: z30.string(), state: z30.enum(["ended", "expired"]) }))
|
|
1090
1241
|
};
|
|
1091
1242
|
|
|
1092
1243
|
// src/contract/task-schema.ts
|
|
1093
|
-
import { z as
|
|
1094
|
-
var taskSchema2 =
|
|
1095
|
-
error:
|
|
1096
|
-
errorLimit:
|
|
1097
|
-
errors:
|
|
1098
|
-
isWaitingForRetry:
|
|
1099
|
-
readCursor:
|
|
1100
|
-
reason:
|
|
1101
|
-
retryAt:
|
|
1102
|
-
stepKey:
|
|
1103
|
-
taskID:
|
|
1244
|
+
import { z as z31 } from "zod";
|
|
1245
|
+
var taskSchema2 = z31.object({
|
|
1246
|
+
error: z31.string().optional(),
|
|
1247
|
+
errorLimit: z31.int().positive().optional(),
|
|
1248
|
+
errors: z31.int().positive().optional(),
|
|
1249
|
+
isWaitingForRetry: z31.boolean().optional(),
|
|
1250
|
+
readCursor: z31.int().nonnegative().optional(),
|
|
1251
|
+
reason: z31.string().optional(),
|
|
1252
|
+
retryAt: z31.date().optional(),
|
|
1253
|
+
stepKey: z31.string().optional(),
|
|
1254
|
+
taskID: z31.string()
|
|
1104
1255
|
});
|
|
1105
1256
|
|
|
1106
1257
|
// src/contract/tool-call-schema.ts
|
|
1107
|
-
import { z as
|
|
1108
|
-
var
|
|
1109
|
-
var toolCallSchema =
|
|
1110
|
-
callID:
|
|
1111
|
-
content:
|
|
1112
|
-
input:
|
|
1113
|
-
outcome:
|
|
1114
|
-
|
|
1258
|
+
import { z as z32 } from "zod";
|
|
1259
|
+
var jsonObjectSchema2 = z32.record(z32.string(), z32.unknown());
|
|
1260
|
+
var toolCallSchema = z32.object({
|
|
1261
|
+
callID: z32.string(),
|
|
1262
|
+
content: jsonObjectSchema2.optional(),
|
|
1263
|
+
input: jsonObjectSchema2.optional(),
|
|
1264
|
+
outcome: z32.string().optional(),
|
|
1265
|
+
runID: z32.string().optional(),
|
|
1266
|
+
tool: z32.string().optional()
|
|
1115
1267
|
});
|
|
1116
1268
|
|
|
1117
|
-
// src/contract/contract.ts
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1269
|
+
// src/contract/view-contract.ts
|
|
1270
|
+
import { z as z35 } from "zod";
|
|
1271
|
+
|
|
1272
|
+
// src/contract/trigger-schema.ts
|
|
1273
|
+
import { z as z34 } from "zod";
|
|
1274
|
+
|
|
1275
|
+
// src/contract/schedule-schema.ts
|
|
1276
|
+
import { z as z33 } from "zod";
|
|
1277
|
+
|
|
1278
|
+
// src/contract/is-time-zone.ts
|
|
1279
|
+
function isTimeZone(zone) {
|
|
1280
|
+
try {
|
|
1281
|
+
return new Intl.DateTimeFormat("en-US", { timeZone: zone }).resolvedOptions().timeZone !== "";
|
|
1282
|
+
} catch {
|
|
1283
|
+
return false;
|
|
1284
|
+
}
|
|
1285
|
+
}
|
|
1286
|
+
|
|
1287
|
+
// src/contract/schedule-schema.ts
|
|
1288
|
+
var clockTimeSchema = z33.string().regex(/^(?:[01]\d|2[0-3]):[0-5]\d$/u, "a time is HH:MM, 24-hour");
|
|
1289
|
+
var minutesSchema = z33.strictObject({
|
|
1290
|
+
minutes: z33.int().min(5).max(1440)
|
|
1291
|
+
});
|
|
1292
|
+
var weekdaySchema = z33.enum(["mon", "tue", "wed", "thu", "fri", "sat", "sun"]);
|
|
1293
|
+
var scheduleSchema = z33.strictObject({
|
|
1294
|
+
every: z33.union([z33.enum(["day", "week", "hour"]), minutesSchema]),
|
|
1295
|
+
at: clockTimeSchema.optional(),
|
|
1296
|
+
on: weekdaySchema.optional(),
|
|
1297
|
+
window: z33.strictObject({ from: clockTimeSchema, until: clockTimeSchema }).optional(),
|
|
1298
|
+
idleMinutes: z33.int().min(1).max(720).optional(),
|
|
1299
|
+
zone: z33.string().refine((zone) => zone === "owner" || isTimeZone(zone), "a zone is owner or an IANA zone").default("owner"),
|
|
1300
|
+
catchUp: z33.enum(["once", "skip"]).default("once")
|
|
1301
|
+
}).superRefine((schedule, context) => {
|
|
1302
|
+
const isCalendar = schedule.every === "day" || schedule.every === "week";
|
|
1303
|
+
if (isCalendar && schedule.at === undefined && schedule.window === undefined) {
|
|
1304
|
+
context.addIssue({ code: "custom", message: "day and week need at or window" });
|
|
1305
|
+
}
|
|
1306
|
+
if (isCalendar && schedule.at !== undefined && schedule.window !== undefined) {
|
|
1307
|
+
context.addIssue({ code: "custom", message: "at and window never come together" });
|
|
1308
|
+
}
|
|
1309
|
+
if (!isCalendar && schedule.at !== undefined) {
|
|
1310
|
+
context.addIssue({ code: "custom", message: "hour and minutes schedules take no at" });
|
|
1311
|
+
}
|
|
1312
|
+
if (!isCalendar && schedule.window !== undefined) {
|
|
1313
|
+
context.addIssue({ code: "custom", message: "hour and minutes schedules take no window" });
|
|
1314
|
+
}
|
|
1315
|
+
if (schedule.every === "week" && schedule.on === undefined) {
|
|
1316
|
+
context.addIssue({ code: "custom", message: "a week schedule needs on" });
|
|
1317
|
+
}
|
|
1318
|
+
if (schedule.every !== "week" && schedule.on !== undefined) {
|
|
1319
|
+
context.addIssue({ code: "custom", message: "only a week schedule takes on" });
|
|
1320
|
+
}
|
|
1321
|
+
if (schedule.idleMinutes !== undefined && schedule.window === undefined) {
|
|
1322
|
+
context.addIssue({ code: "custom", message: "idleMinutes needs window" });
|
|
1323
|
+
}
|
|
1324
|
+
});
|
|
1325
|
+
|
|
1326
|
+
// src/contract/trigger-schema.ts
|
|
1327
|
+
var triggerAtSchema = z34.iso.datetime({ offset: true });
|
|
1328
|
+
var triggerSchema = z34.union([
|
|
1329
|
+
z34.strictObject({ schedule: scheduleSchema }),
|
|
1330
|
+
z34.strictObject({ at: triggerAtSchema })
|
|
1331
|
+
]);
|
|
1332
|
+
|
|
1333
|
+
// src/contract/view-contract.ts
|
|
1334
|
+
var skipReasonSchema = z35.enum([
|
|
1335
|
+
"too_late",
|
|
1336
|
+
"catch_up_off",
|
|
1337
|
+
"window_closed",
|
|
1338
|
+
"still_running",
|
|
1339
|
+
"task_held"
|
|
1340
|
+
]);
|
|
1341
|
+
var endedRunSchema = z35.object({
|
|
1342
|
+
runID: z35.string(),
|
|
1343
|
+
taskID: threadSchema,
|
|
1344
|
+
definitionID: z35.string().nullable(),
|
|
1345
|
+
startedAt: z35.date(),
|
|
1346
|
+
endedAt: z35.date(),
|
|
1125
1347
|
sequence: sequenceSchema,
|
|
1126
|
-
|
|
1348
|
+
cause: z35.string(),
|
|
1349
|
+
endedBy: z35.string(),
|
|
1350
|
+
carriesRunID: z35.string().nullable(),
|
|
1351
|
+
reportID: z35.string(),
|
|
1352
|
+
delivery: z35.enum(["wake", "next_turn", "kept"]),
|
|
1353
|
+
fire: runFireSchema.nullable(),
|
|
1354
|
+
used: z35.object({ turns: z35.number(), dollars: z35.number() })
|
|
1355
|
+
});
|
|
1356
|
+
var reportEntrySchema = z35.object({
|
|
1357
|
+
definitionID: z35.string(),
|
|
1358
|
+
name: z35.string(),
|
|
1359
|
+
kind: z35.enum(["late", "skipped"]),
|
|
1360
|
+
scheduledFor: z35.string(),
|
|
1361
|
+
firedAt: z35.string().nullable(),
|
|
1362
|
+
lateBySeconds: z35.number().nullable(),
|
|
1363
|
+
reason: skipReasonSchema.nullable(),
|
|
1364
|
+
sequence: sequenceSchema
|
|
1127
1365
|
});
|
|
1128
|
-
var
|
|
1129
|
-
|
|
1130
|
-
|
|
1366
|
+
var listedDefinitionSchema = z35.object({
|
|
1367
|
+
definitionID: z35.string(),
|
|
1368
|
+
name: z35.string(),
|
|
1369
|
+
enabled: z35.boolean(),
|
|
1370
|
+
target: z35.enum(["task", "conversation"]),
|
|
1371
|
+
trigger: triggerSchema.nullable(),
|
|
1372
|
+
rendered: z35.string().nullable(),
|
|
1373
|
+
next: z35.string().nullable(),
|
|
1374
|
+
tools: z35.array(z35.string()),
|
|
1375
|
+
origin: z35.enum(["definitions", "nixie"]),
|
|
1376
|
+
createdBy: z35.object({
|
|
1377
|
+
sequence: sequenceSchema,
|
|
1378
|
+
kind: z35.enum(["definition.changed", "definitions_seeded"])
|
|
1379
|
+
}),
|
|
1380
|
+
taskID: threadSchema.nullable(),
|
|
1381
|
+
isUnreadable: z35.boolean()
|
|
1131
1382
|
});
|
|
1132
|
-
var
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1383
|
+
var viewContract = {
|
|
1384
|
+
tasks: {
|
|
1385
|
+
listEnded: signedIn.input(z35.object({
|
|
1386
|
+
limit: z35.int().min(1).max(100),
|
|
1387
|
+
before: sequenceSchema.optional(),
|
|
1388
|
+
definitionID: z35.string().min(1).max(200).optional()
|
|
1389
|
+
})).output(z35.object({
|
|
1390
|
+
tasks: z35.array(listedTaskSchema),
|
|
1391
|
+
runs: z35.array(endedRunSchema),
|
|
1392
|
+
next: sequenceSchema.nullable()
|
|
1393
|
+
}))
|
|
1394
|
+
},
|
|
1395
|
+
triggers: {
|
|
1396
|
+
report: signedIn.input(z35.object({
|
|
1397
|
+
since: z35.string().regex(/^\d{4}-\d{2}-\d{2}$/u),
|
|
1398
|
+
definitionID: z35.string().min(1).max(200).optional()
|
|
1399
|
+
})).output(z35.object({ entries: z35.array(reportEntrySchema) }))
|
|
1400
|
+
},
|
|
1401
|
+
definitions: {
|
|
1402
|
+
listTasks: signedIn.output(z35.object({ definitions: z35.array(listedDefinitionSchema) }))
|
|
1403
|
+
}
|
|
1404
|
+
};
|
|
1405
|
+
|
|
1406
|
+
// src/contract/worker-view-schema.ts
|
|
1407
|
+
import { z as z36 } from "zod";
|
|
1408
|
+
var usedSchema = z36.object({
|
|
1409
|
+
minutes: z36.number(),
|
|
1410
|
+
turns: z36.number(),
|
|
1411
|
+
tokens: z36.number(),
|
|
1412
|
+
dollars: z36.number()
|
|
1413
|
+
});
|
|
1414
|
+
var startedSchema = z36.object({
|
|
1415
|
+
phase: z36.literal("started"),
|
|
1416
|
+
workerRunID: z36.string(),
|
|
1417
|
+
shortID: z36.string(),
|
|
1418
|
+
callID: z36.string(),
|
|
1419
|
+
model: z36.string(),
|
|
1420
|
+
tools: z36.array(z36.string()),
|
|
1421
|
+
limits: usedSchema,
|
|
1422
|
+
isTaskLimit: z36.boolean()
|
|
1423
|
+
});
|
|
1424
|
+
var turnSchema = z36.object({
|
|
1425
|
+
phase: z36.literal("turn"),
|
|
1426
|
+
workerRunID: z36.string(),
|
|
1427
|
+
callID: z36.string(),
|
|
1428
|
+
turn: z36.number(),
|
|
1429
|
+
tokens: z36.number(),
|
|
1430
|
+
dollars: z36.number(),
|
|
1431
|
+
text: z36.string().optional()
|
|
1432
|
+
});
|
|
1433
|
+
var endedSchema = z36.object({
|
|
1434
|
+
phase: z36.literal("ended"),
|
|
1435
|
+
workerRunID: z36.string(),
|
|
1436
|
+
callID: z36.string(),
|
|
1437
|
+
outcome: z36.string(),
|
|
1438
|
+
limit: z36.string().optional(),
|
|
1439
|
+
used: usedSchema,
|
|
1440
|
+
detail: z36.string().optional()
|
|
1441
|
+
});
|
|
1442
|
+
var workerViewSchema = z36.discriminatedUnion("phase", [
|
|
1443
|
+
startedSchema,
|
|
1444
|
+
turnSchema,
|
|
1445
|
+
endedSchema
|
|
1446
|
+
]);
|
|
1447
|
+
|
|
1448
|
+
// src/contract/contract.ts
|
|
1449
|
+
var clientActionIDSchema2 = z37.uuid();
|
|
1450
|
+
var imageSchema = z37.object({ mediaType: z37.enum(imageLimits.mediaTypes) });
|
|
1451
|
+
var imageFilesSchema = z37.array(z37.file());
|
|
1452
|
+
var imageRefSchema = z37.object({
|
|
1453
|
+
position: z37.int().nonnegative(),
|
|
1454
|
+
sequence: sequenceSchema,
|
|
1455
|
+
thread: threadSchema
|
|
1137
1456
|
});
|
|
1138
|
-
var
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
recalledSequence: sequenceSchema
|
|
1457
|
+
var versionRefSchema = z37.object({
|
|
1458
|
+
itemID: z37.string().min(1).max(200),
|
|
1459
|
+
version: z37.int().nonnegative()
|
|
1142
1460
|
});
|
|
1143
|
-
var
|
|
1144
|
-
var
|
|
1145
|
-
var
|
|
1461
|
+
var recallItemSchema = versionRefSchema.extend({ score: z37.number().optional() });
|
|
1462
|
+
var recallSchema = z37.object({ items: z37.array(recallItemSchema) });
|
|
1463
|
+
var tokenCountSchema = z37.int().nonnegative();
|
|
1464
|
+
var contextSchema = z37.object({ size: tokenCountSchema, window: z37.int().positive() });
|
|
1465
|
+
var compactionSchema = z37.object({
|
|
1146
1466
|
postTokens: tokenCountSchema.optional(),
|
|
1147
1467
|
preTokens: tokenCountSchema,
|
|
1148
|
-
trigger:
|
|
1468
|
+
trigger: z37.enum(["manual", "auto"])
|
|
1149
1469
|
});
|
|
1150
|
-
var summarySchema =
|
|
1470
|
+
var summarySchema = z37.object({
|
|
1151
1471
|
contextSize: tokenCountSchema.optional(),
|
|
1152
1472
|
summaryTokens: tokenCountSchema,
|
|
1153
|
-
text:
|
|
1154
|
-
trigger:
|
|
1155
|
-
});
|
|
1156
|
-
var compactionFailureSchema = z26.object({ failures: z26.int().positive() });
|
|
1157
|
-
var ratingNoteRefSchema = z26.object({
|
|
1158
|
-
itemID: z26.string().min(1).max(200),
|
|
1159
|
-
sequence: sequenceSchema
|
|
1160
|
-
});
|
|
1161
|
-
var ratingNoteSchema = ratingNoteRefSchema.extend({
|
|
1162
|
-
status: z26.enum(["readable", "shredded", "unreadable", "missing"]),
|
|
1163
|
-
text: z26.string().optional()
|
|
1473
|
+
text: z37.string().optional(),
|
|
1474
|
+
trigger: z37.enum(["threshold", "overflow"])
|
|
1164
1475
|
});
|
|
1476
|
+
var compactionFailureSchema = z37.object({ failures: z37.int().positive() });
|
|
1165
1477
|
var versionTextSchema = versionRefSchema.extend({
|
|
1166
|
-
status:
|
|
1167
|
-
text:
|
|
1478
|
+
status: z37.enum(["readable", "shredded", "unreadable", "missing"]),
|
|
1479
|
+
text: z37.string().optional()
|
|
1168
1480
|
});
|
|
1169
|
-
var listedActionSchema =
|
|
1170
|
-
var taskMessageSchema =
|
|
1481
|
+
var listedActionSchema = z37.object({ actionID: z37.string(), tool: z37.string() });
|
|
1482
|
+
var taskMessageSchema = z37.object({
|
|
1171
1483
|
from: threadSchema,
|
|
1172
|
-
fromName:
|
|
1173
|
-
hop:
|
|
1174
|
-
kind:
|
|
1175
|
-
messageID:
|
|
1176
|
-
replyTo:
|
|
1177
|
-
text:
|
|
1484
|
+
fromName: z37.string(),
|
|
1485
|
+
hop: z37.int().nonnegative(),
|
|
1486
|
+
kind: z37.string(),
|
|
1487
|
+
messageID: z37.string(),
|
|
1488
|
+
replyTo: z37.string().optional(),
|
|
1489
|
+
text: z37.string().optional(),
|
|
1178
1490
|
to: threadSchema,
|
|
1179
|
-
woke:
|
|
1491
|
+
woke: z37.boolean()
|
|
1180
1492
|
});
|
|
1181
|
-
var exchangeNoticeSchema =
|
|
1182
|
-
link:
|
|
1183
|
-
text:
|
|
1493
|
+
var exchangeNoticeSchema = z37.object({
|
|
1494
|
+
link: z37.object({ label: z37.string(), messageID: z37.string(), taskID: threadSchema }),
|
|
1495
|
+
text: z37.string()
|
|
1184
1496
|
});
|
|
1185
|
-
var
|
|
1497
|
+
var reminderSchema = z37.object({
|
|
1498
|
+
brief: z37.string(),
|
|
1499
|
+
scheduledFor: z37.iso.datetime({ offset: true }),
|
|
1500
|
+
lateBySeconds: z37.number().nullable()
|
|
1501
|
+
});
|
|
1502
|
+
var recordSchema = z37.object({
|
|
1503
|
+
clipped: z37.array(clippedPayloadSchema).optional(),
|
|
1186
1504
|
compaction: compactionSchema.optional(),
|
|
1187
1505
|
exchangeNotice: exchangeNoticeSchema.optional(),
|
|
1506
|
+
reminder: reminderSchema.optional(),
|
|
1188
1507
|
compactionFailure: compactionFailureSchema.optional(),
|
|
1189
|
-
forget:
|
|
1508
|
+
forget: z37.object({ sequence: sequenceSchema }).optional(),
|
|
1190
1509
|
context: contextSchema.optional(),
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1510
|
+
definitionNotice: definitionNoticeSchema.optional(),
|
|
1511
|
+
isRemoved: z37.literal(true).optional(),
|
|
1512
|
+
isSilentTurn: z37.literal(true).optional(),
|
|
1513
|
+
kind: z37.string(),
|
|
1514
|
+
message: z37.object({
|
|
1515
|
+
clientMessageId: z37.uuid().optional(),
|
|
1516
|
+
images: z37.array(imageSchema).optional(),
|
|
1517
|
+
spans: z37.array(spanSchema).optional(),
|
|
1518
|
+
text: z37.string()
|
|
1199
1519
|
}).optional(),
|
|
1200
|
-
moment:
|
|
1201
|
-
|
|
1202
|
-
proposal: z26.object({ proposalID: z26.string(), shortID: z26.string() }).optional(),
|
|
1520
|
+
moment: z37.object({ momentID: z37.string(), shortID: z37.string(), title: z37.string().optional() }).optional(),
|
|
1521
|
+
proposal: z37.object({ proposalID: z37.string(), shortID: z37.string() }).optional(),
|
|
1203
1522
|
recall: recallSchema.optional(),
|
|
1204
|
-
recordedAt:
|
|
1205
|
-
removal:
|
|
1523
|
+
recordedAt: z37.date(),
|
|
1524
|
+
removal: z37.object({ kind: z37.string(), sequence: sequenceSchema, callSequence: sequenceSchema.optional() }).optional(),
|
|
1206
1525
|
sequence: sequenceSchema,
|
|
1207
|
-
stop:
|
|
1526
|
+
stop: z37.object({ cancelledActions: z37.array(listedActionSchema) }).optional(),
|
|
1208
1527
|
summary: summarySchema.optional(),
|
|
1209
1528
|
thread: threadSchema,
|
|
1210
1529
|
task: taskSchema2.optional(),
|
|
1211
1530
|
taskMessage: taskMessageSchema.optional(),
|
|
1212
|
-
toolCall: toolCallSchema.optional()
|
|
1531
|
+
toolCall: toolCallSchema.optional(),
|
|
1532
|
+
worker: workerViewSchema.optional()
|
|
1213
1533
|
});
|
|
1214
|
-
var writerErrorSchema =
|
|
1215
|
-
var sessionSchema =
|
|
1216
|
-
createdAt:
|
|
1217
|
-
current:
|
|
1218
|
-
deviceName:
|
|
1219
|
-
lastUsedAt:
|
|
1220
|
-
sessionID:
|
|
1534
|
+
var writerErrorSchema = z37.object({ at: z37.date(), code: z37.string(), message: z37.string().nullable() }).nullable();
|
|
1535
|
+
var sessionSchema = z37.object({
|
|
1536
|
+
createdAt: z37.date(),
|
|
1537
|
+
current: z37.boolean(),
|
|
1538
|
+
deviceName: z37.string(),
|
|
1539
|
+
lastUsedAt: z37.date(),
|
|
1540
|
+
sessionID: z37.uuid()
|
|
1221
1541
|
});
|
|
1222
1542
|
var checkedAction = signedIn.errors(reusedIDErrors);
|
|
1223
|
-
var
|
|
1224
|
-
|
|
1225
|
-
"running",
|
|
1226
|
-
"waiting",
|
|
1227
|
-
"paused",
|
|
1228
|
-
"stopped",
|
|
1229
|
-
"done",
|
|
1230
|
-
"failed",
|
|
1231
|
-
"closed"
|
|
1232
|
-
]);
|
|
1233
|
-
var taskControlSchema = z26.enum(["pause", "resume", "stop", "restart", "close", "interrupt"]);
|
|
1234
|
-
var actionCountSchema = z26.int().nonnegative();
|
|
1235
|
-
var forgetPreviewItemSchema = z26.object({ itemID: z26.string(), text: z26.string() });
|
|
1236
|
-
var recordForgetPreviewSchema = z26.object({
|
|
1543
|
+
var forgetPreviewItemSchema = z37.object({ itemID: z37.string(), text: z37.string() });
|
|
1544
|
+
var recordForgetPreviewSchema = z37.object({
|
|
1237
1545
|
momentCount: actionCountSchema,
|
|
1238
|
-
memoryItems:
|
|
1546
|
+
memoryItems: z37.array(forgetPreviewItemSchema)
|
|
1239
1547
|
});
|
|
1240
|
-
var
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
started: actionCountSchema
|
|
1245
|
-
}),
|
|
1246
|
-
brief: z26.string(),
|
|
1247
|
-
controls: z26.array(taskControlSchema),
|
|
1248
|
-
isPauseRequested: z26.boolean(),
|
|
1249
|
-
isPausedByNixie: z26.boolean(),
|
|
1250
|
-
isTakingMessages: z26.boolean(),
|
|
1251
|
-
lastActivityAt: z26.date(),
|
|
1252
|
-
name: z26.string(),
|
|
1253
|
-
runner: z26.string(),
|
|
1254
|
-
state: taskStateSchema2,
|
|
1255
|
-
taskID: threadSchema,
|
|
1256
|
-
waitingOn: threadSchema.optional()
|
|
1257
|
-
});
|
|
1258
|
-
var controlledTaskSchema = z26.object({
|
|
1259
|
-
controlledAt: z26.date(),
|
|
1260
|
-
isPauseRequested: z26.boolean(),
|
|
1261
|
-
state: taskStateSchema2,
|
|
1548
|
+
var controlledTaskSchema = z37.object({
|
|
1549
|
+
controlledAt: z37.date(),
|
|
1550
|
+
isPauseRequested: z37.boolean(),
|
|
1551
|
+
state: taskStateSchema,
|
|
1262
1552
|
taskID: threadSchema
|
|
1263
1553
|
});
|
|
1264
1554
|
var taskControl = checkedAction.errors({
|
|
@@ -1266,57 +1556,67 @@ var taskControl = checkedAction.errors({
|
|
|
1266
1556
|
TASK_STATE_REFUSED: {
|
|
1267
1557
|
message: "The task is in a state that does not take this control",
|
|
1268
1558
|
status: 409,
|
|
1269
|
-
data:
|
|
1559
|
+
data: z37.object({ isPauseRequested: z37.boolean(), state: taskStateSchema })
|
|
1270
1560
|
},
|
|
1271
1561
|
RUNNER_LACKS_CONTROL: {
|
|
1272
1562
|
message: "The runner of the task does not take this control",
|
|
1273
1563
|
status: 409
|
|
1274
1564
|
}
|
|
1275
|
-
}).input(
|
|
1276
|
-
var
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
});
|
|
1282
|
-
var
|
|
1565
|
+
}).input(z37.object({ clientActionID: clientActionIDSchema2, taskID: threadSchema })).output(controlledTaskSchema);
|
|
1566
|
+
var markedTaskSchema = z37.object({
|
|
1567
|
+
changedAt: z37.date(),
|
|
1568
|
+
disposable: z37.boolean(),
|
|
1569
|
+
taskID: threadSchema
|
|
1570
|
+
});
|
|
1571
|
+
var nixieControl = checkedAction.input(z37.object({ clientActionID: clientActionIDSchema2 })).output(z37.object({ paused: pauseStateSchema }));
|
|
1572
|
+
var backupNoticeSchema = z37.object({
|
|
1573
|
+
cause: z37.enum(["failed", "missing"]),
|
|
1574
|
+
sequence: z37.int().positive(),
|
|
1575
|
+
raisedAt: z37.date()
|
|
1576
|
+
});
|
|
1577
|
+
var followRecords = signedIn.input(z37.object({
|
|
1578
|
+
afterSequence: sequenceSchema,
|
|
1579
|
+
clipPayloads: z37.boolean().optional(),
|
|
1580
|
+
thread: threadSchema.optional()
|
|
1581
|
+
})).output(eventIterator2(z37.object({ record: recordSchema })));
|
|
1283
1582
|
var contract = {
|
|
1284
1583
|
conversation: {
|
|
1285
|
-
read: signedIn.errors({ THREAD_NOT_FOUND: { message: "No thread has this ID", status: 404 } }).input(
|
|
1584
|
+
read: signedIn.errors({ THREAD_NOT_FOUND: { message: "No thread has this ID", status: 404 } }).input(z37.object({
|
|
1286
1585
|
beforeSequence: sequenceSchema.optional(),
|
|
1287
|
-
|
|
1586
|
+
clipPayloads: z37.boolean().optional(),
|
|
1587
|
+
limit: z37.int().min(1).max(200).optional(),
|
|
1288
1588
|
thread: threadSchema
|
|
1289
|
-
})).output(
|
|
1290
|
-
hasEarlier:
|
|
1589
|
+
})).output(z37.object({
|
|
1590
|
+
hasEarlier: z37.boolean(),
|
|
1291
1591
|
readAtSequence: sequenceSchema,
|
|
1292
|
-
records:
|
|
1592
|
+
records: z37.array(recordSchema),
|
|
1293
1593
|
lastStepEnd: recordSchema.nullable().optional()
|
|
1294
1594
|
})),
|
|
1295
1595
|
send: checkedAction.errors({
|
|
1296
1596
|
IMAGE_REFUSED: imageRefusedError,
|
|
1297
1597
|
THREAD_NOT_FOUND: { message: "No thread has this ID", status: 404 }
|
|
1298
|
-
}).input(
|
|
1598
|
+
}).input(z37.object({
|
|
1299
1599
|
clientMessageId: clientActionIDSchema2,
|
|
1300
1600
|
images: imageFilesSchema.optional(),
|
|
1301
|
-
spans:
|
|
1302
|
-
text:
|
|
1601
|
+
spans: z37.array(spanSchema).max(1e5),
|
|
1602
|
+
text: z37.string().min(1).max(1e5),
|
|
1303
1603
|
thread: threadSchema,
|
|
1304
|
-
timeZone:
|
|
1305
|
-
writtenAt:
|
|
1306
|
-
})).output(
|
|
1604
|
+
timeZone: z37.string().min(1).max(100).optional(),
|
|
1605
|
+
writtenAt: z37.iso.datetime().optional()
|
|
1606
|
+
})).output(z37.object({ duplicate: z37.boolean(), sequence: sequenceSchema })),
|
|
1307
1607
|
retry: checkedAction.errors({
|
|
1308
1608
|
NOTHING_TO_RETRY: {
|
|
1309
1609
|
message: "The last turn of the conversation did not fail, or it runs again already",
|
|
1310
1610
|
status: 409
|
|
1311
1611
|
}
|
|
1312
|
-
}).input(
|
|
1313
|
-
readImage: signedIn.errors({ IMAGE_NOT_FOUND: imageNotFoundError }).input(imageRefSchema).output(
|
|
1612
|
+
}).input(z37.object({ clientActionID: clientActionIDSchema2 })).output(z37.object({ retriedAt: z37.date() })),
|
|
1613
|
+
readImage: signedIn.errors({ IMAGE_NOT_FOUND: imageNotFoundError }).input(imageRefSchema).output(z37.file()),
|
|
1314
1614
|
previewForget: signedIn.errors({
|
|
1315
1615
|
RECORD_NOT_FOUND: {
|
|
1316
1616
|
message: "No record on this thread with its own text that a forget removes has this sequence",
|
|
1317
1617
|
status: 404
|
|
1318
1618
|
}
|
|
1319
|
-
}).input(
|
|
1619
|
+
}).input(z37.object({ thread: threadSchema, sequence: sequenceSchema })).output(recordForgetPreviewSchema),
|
|
1320
1620
|
forget: checkedAction.errors({
|
|
1321
1621
|
RECORD_NOT_FOUND: {
|
|
1322
1622
|
message: "No record on this thread with its own text that a forget removes has this sequence",
|
|
@@ -1326,54 +1626,78 @@ var contract = {
|
|
|
1326
1626
|
message: "The queued action has not run yet. Cancel it, or wait for it to run.",
|
|
1327
1627
|
status: 409
|
|
1328
1628
|
}
|
|
1329
|
-
}).input(
|
|
1629
|
+
}).input(z37.object({
|
|
1330
1630
|
clientActionID: clientActionIDSchema2,
|
|
1331
1631
|
sequence: sequenceSchema,
|
|
1332
1632
|
thread: threadSchema
|
|
1333
|
-
})).output(
|
|
1633
|
+
})).output(z37.object({ forgottenAt: z37.date(), backup: forgetBackupSchema }))
|
|
1334
1634
|
},
|
|
1335
1635
|
tasks: {
|
|
1336
|
-
list: signedIn.
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1636
|
+
list: signedIn.input(z37.object({
|
|
1637
|
+
definitionID: z37.string().min(1).max(200).optional(),
|
|
1638
|
+
states: z37.array(listedStateSchema).min(1).max(11).refine((states) => new Set(states).size === states.length, {
|
|
1639
|
+
message: "Each state may appear once"
|
|
1640
|
+
}).optional()
|
|
1641
|
+
}).optional()).output(z37.object({ readAtSequence: sequenceSchema, tasks: z37.array(listedTaskSchema) })),
|
|
1642
|
+
read: signedIn.errors({ TASK_NOT_FOUND: { message: "No task has this ID", status: 404 } }).input(z37.object({ taskID: threadSchema })).output(listedTaskSchema),
|
|
1643
|
+
readActions: signedIn.errors({ TASK_NOT_FOUND: { message: "No task has this ID", status: 404 } }).input(z37.object({ taskID: threadSchema })).output(z37.object({
|
|
1644
|
+
queued: z37.array(listedActionSchema),
|
|
1645
|
+
started: z37.array(listedActionSchema)
|
|
1341
1646
|
})),
|
|
1342
1647
|
pause: taskControl,
|
|
1343
1648
|
resume: taskControl,
|
|
1344
1649
|
stop: taskControl,
|
|
1345
1650
|
restart: taskControl,
|
|
1346
1651
|
close: taskControl.errors({
|
|
1347
|
-
CONVERSATION_NEVER_CLOSES: { message: "The conversation is never closed", status: 409 }
|
|
1652
|
+
CONVERSATION_NEVER_CLOSES: { message: "The conversation is never closed", status: 409 },
|
|
1653
|
+
DEFINITION_TASK_NEVER_CLOSES: {
|
|
1654
|
+
message: "The task of a definition is never closed",
|
|
1655
|
+
status: 409
|
|
1656
|
+
}
|
|
1348
1657
|
}),
|
|
1349
|
-
interrupt: taskControl
|
|
1658
|
+
interrupt: taskControl,
|
|
1659
|
+
setDisposable: checkedAction.errors({
|
|
1660
|
+
TASK_NOT_FOUND: { message: "No task has this ID", status: 404 },
|
|
1661
|
+
TASK_HAS_NO_MARK: { message: "The task has no disposable mark", status: 409 },
|
|
1662
|
+
TASK_STATE_REFUSED: {
|
|
1663
|
+
message: "The task is in a state that does not take this change",
|
|
1664
|
+
status: 409,
|
|
1665
|
+
data: z37.object({ state: taskStateSchema })
|
|
1666
|
+
}
|
|
1667
|
+
}).input(z37.object({
|
|
1668
|
+
clientActionID: clientActionIDSchema2,
|
|
1669
|
+
disposable: z37.boolean(),
|
|
1670
|
+
taskID: threadSchema
|
|
1671
|
+
})).output(markedTaskSchema),
|
|
1672
|
+
...viewContract.tasks
|
|
1350
1673
|
},
|
|
1351
1674
|
memory: {
|
|
1352
|
-
readVersions: signedIn.input(
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
batches: z26.int().nonnegative(),
|
|
1675
|
+
readVersions: signedIn.input(z37.object({ versions: z37.array(versionRefSchema).min(1).max(100) })).output(z37.object({ versions: z37.array(versionTextSchema) })),
|
|
1676
|
+
writerStatus: signedIn.route({ deprecated: true }).output(z37.object({
|
|
1677
|
+
isEnabled: z37.boolean(),
|
|
1678
|
+
backlog: z37.int().nonnegative(),
|
|
1679
|
+
batches: z37.int().nonnegative(),
|
|
1358
1680
|
cursor: sequenceSchema,
|
|
1359
|
-
failures:
|
|
1360
|
-
isCatchingUp:
|
|
1681
|
+
failures: z37.int().nonnegative(),
|
|
1682
|
+
isCatchingUp: z37.boolean(),
|
|
1361
1683
|
lastError: writerErrorSchema,
|
|
1362
|
-
retryAt:
|
|
1684
|
+
retryAt: z37.date().nullable()
|
|
1363
1685
|
})),
|
|
1364
1686
|
...memoryViewContract
|
|
1365
1687
|
},
|
|
1366
1688
|
nixie: {
|
|
1367
|
-
read: signedIn.output(
|
|
1689
|
+
read: signedIn.output(z37.object({ paused: pauseStateSchema })),
|
|
1368
1690
|
pause: nixieControl,
|
|
1369
1691
|
resume: nixieControl
|
|
1370
1692
|
},
|
|
1371
1693
|
recovery: {
|
|
1372
|
-
read: signedIn.output(
|
|
1694
|
+
read: signedIn.output(z37.object({ recovery: recoverySchema }))
|
|
1373
1695
|
},
|
|
1374
1696
|
backups: {
|
|
1375
|
-
readNotice: signedIn.output(
|
|
1697
|
+
readNotice: signedIn.output(z37.object({ notice: backupNoticeSchema.nullable() }))
|
|
1376
1698
|
},
|
|
1699
|
+
triggers: viewContract.triggers,
|
|
1700
|
+
definitions: { ...viewContract.definitions, ...definitionsContract },
|
|
1377
1701
|
rules: ruleContract,
|
|
1378
1702
|
approvals: approvalContract,
|
|
1379
1703
|
passkeys: passkeyContract,
|
|
@@ -1381,7 +1705,8 @@ var contract = {
|
|
|
1381
1705
|
follow: followRecords.route({ deprecated: true })
|
|
1382
1706
|
},
|
|
1383
1707
|
records: {
|
|
1384
|
-
follow: followRecords
|
|
1708
|
+
follow: followRecords,
|
|
1709
|
+
readPayload: readPayloadContract
|
|
1385
1710
|
},
|
|
1386
1711
|
sessions: {
|
|
1387
1712
|
enrol: oc2.errors(reusedIDErrors).errors({
|
|
@@ -1389,28 +1714,28 @@ var contract = {
|
|
|
1389
1714
|
message: "The enrolment code is unknown, used or lapsed",
|
|
1390
1715
|
status: 400
|
|
1391
1716
|
}
|
|
1392
|
-
}).input(
|
|
1717
|
+
}).input(z37.object({
|
|
1393
1718
|
clientActionID: clientActionIDSchema2,
|
|
1394
|
-
code:
|
|
1395
|
-
deviceName:
|
|
1396
|
-
tokenDelivery:
|
|
1397
|
-
})).output(
|
|
1398
|
-
issueCode: checkedAction.input(
|
|
1399
|
-
list: signedIn.output(
|
|
1400
|
-
revoke: checkedAction.errors({ SESSION_NOT_FOUND: { message: "No session has this ID", status: 404 } }).input(
|
|
1719
|
+
code: z37.string().min(1).max(100),
|
|
1720
|
+
deviceName: z37.string().min(1).max(100),
|
|
1721
|
+
tokenDelivery: z37.enum(["cookie", "bearer"])
|
|
1722
|
+
})).output(z37.object({ sessionID: z37.uuid(), token: z37.string().optional() })),
|
|
1723
|
+
issueCode: checkedAction.input(z37.object({ clientActionID: clientActionIDSchema2 })).output(z37.object({ code: z37.string(), expiresAt: z37.date() })),
|
|
1724
|
+
list: signedIn.output(z37.object({ sessions: z37.array(sessionSchema) })),
|
|
1725
|
+
revoke: checkedAction.errors({ SESSION_NOT_FOUND: { message: "No session has this ID", status: 404 } }).input(z37.object({ clientActionID: clientActionIDSchema2, sessionID: z37.uuid() })).output(z37.object({ revokedAt: z37.date() }))
|
|
1401
1726
|
}
|
|
1402
1727
|
};
|
|
1403
1728
|
// src/contract/host-contract.ts
|
|
1404
1729
|
import { oc as oc6 } from "@orpc/contract";
|
|
1405
|
-
import { z as
|
|
1730
|
+
import { z as z46 } from "zod";
|
|
1406
1731
|
|
|
1407
1732
|
// src/contract/action-proposal-schema.ts
|
|
1408
|
-
import { z as
|
|
1409
|
-
var actionProposalSchema =
|
|
1410
|
-
proposalID:
|
|
1411
|
-
tool:
|
|
1412
|
-
effects:
|
|
1413
|
-
cause:
|
|
1733
|
+
import { z as z38 } from "zod";
|
|
1734
|
+
var actionProposalSchema = z38.object({
|
|
1735
|
+
proposalID: z38.string(),
|
|
1736
|
+
tool: z38.string(),
|
|
1737
|
+
effects: z38.array(z38.string()),
|
|
1738
|
+
cause: z38.enum([
|
|
1414
1739
|
"outside_steering",
|
|
1415
1740
|
"always_ask",
|
|
1416
1741
|
"ask_rule",
|
|
@@ -1418,81 +1743,81 @@ var actionProposalSchema = z27.object({
|
|
|
1418
1743
|
"direct_request",
|
|
1419
1744
|
"repeat"
|
|
1420
1745
|
]),
|
|
1421
|
-
sentence:
|
|
1422
|
-
destinations:
|
|
1423
|
-
createdAt:
|
|
1424
|
-
lapseAt:
|
|
1746
|
+
sentence: z38.string(),
|
|
1747
|
+
destinations: z38.array(z38.string()),
|
|
1748
|
+
createdAt: z38.date(),
|
|
1749
|
+
lapseAt: z38.date()
|
|
1425
1750
|
});
|
|
1426
1751
|
|
|
1427
1752
|
// src/contract/forgotten-items-schema.ts
|
|
1428
|
-
import { z as
|
|
1429
|
-
var forgottenItemsSchema =
|
|
1430
|
-
itemIDs:
|
|
1753
|
+
import { z as z39 } from "zod";
|
|
1754
|
+
var forgottenItemsSchema = z39.object({
|
|
1755
|
+
itemIDs: z39.array(z39.string()),
|
|
1431
1756
|
backup: forgetBackupSchema
|
|
1432
1757
|
});
|
|
1433
1758
|
|
|
1434
1759
|
// src/contract/host-mandates-contract.ts
|
|
1435
1760
|
import { oc as oc3 } from "@orpc/contract";
|
|
1436
|
-
import { z as
|
|
1761
|
+
import { z as z40 } from "zod";
|
|
1437
1762
|
var mandates = oc3.errors({
|
|
1438
1763
|
NOT_FOUND: { message: "no mandate has that ID", status: 404 }
|
|
1439
1764
|
});
|
|
1440
|
-
var hostMandateRuleSchema =
|
|
1441
|
-
var hostMandateSchema =
|
|
1442
|
-
mandateID:
|
|
1443
|
-
title:
|
|
1444
|
-
rules:
|
|
1445
|
-
startedAt:
|
|
1446
|
-
expires:
|
|
1765
|
+
var hostMandateRuleSchema = z40.object({ ruleID: z40.string(), sentence: z40.string() });
|
|
1766
|
+
var hostMandateSchema = z40.object({
|
|
1767
|
+
mandateID: z40.string(),
|
|
1768
|
+
title: z40.string().nullable(),
|
|
1769
|
+
rules: z40.array(hostMandateRuleSchema),
|
|
1770
|
+
startedAt: z40.date(),
|
|
1771
|
+
expires: z40.date()
|
|
1447
1772
|
});
|
|
1448
1773
|
var hostMandatesContract = {
|
|
1449
|
-
list: mandates.output(
|
|
1450
|
-
end: mandates.input(
|
|
1774
|
+
list: mandates.output(z40.array(hostMandateSchema)),
|
|
1775
|
+
end: mandates.input(z40.strictObject({ mandateID: z40.string().min(1) })).output(z40.object({ mandateID: z40.string(), state: z40.enum(["ended", "expired"]) }))
|
|
1451
1776
|
};
|
|
1452
1777
|
|
|
1453
1778
|
// src/contract/host-passkey-contract.ts
|
|
1454
1779
|
import { oc as oc4 } from "@orpc/contract";
|
|
1455
|
-
import { z as
|
|
1456
|
-
var hostPasskeySchema =
|
|
1457
|
-
passkeyID:
|
|
1458
|
-
label:
|
|
1459
|
-
synced:
|
|
1460
|
-
origin:
|
|
1461
|
-
registeredBy:
|
|
1462
|
-
authorizedBy:
|
|
1463
|
-
registeredAt:
|
|
1464
|
-
lastUsedAt:
|
|
1465
|
-
revokedAt:
|
|
1780
|
+
import { z as z41 } from "zod";
|
|
1781
|
+
var hostPasskeySchema = z41.object({
|
|
1782
|
+
passkeyID: z41.string(),
|
|
1783
|
+
label: z41.string(),
|
|
1784
|
+
synced: z41.boolean(),
|
|
1785
|
+
origin: z41.string(),
|
|
1786
|
+
registeredBy: z41.string(),
|
|
1787
|
+
authorizedBy: z41.string(),
|
|
1788
|
+
registeredAt: z41.date(),
|
|
1789
|
+
lastUsedAt: z41.date().nullable(),
|
|
1790
|
+
revokedAt: z41.date().nullable()
|
|
1466
1791
|
});
|
|
1467
1792
|
var hostPasskeyContract = {
|
|
1468
|
-
issueCode: oc4.output(
|
|
1469
|
-
list: oc4.output(
|
|
1793
|
+
issueCode: oc4.output(z41.object({ code: z41.string(), expiresAt: z41.date() })),
|
|
1794
|
+
list: oc4.output(z41.array(hostPasskeySchema)),
|
|
1470
1795
|
revoke: oc4.errors({
|
|
1471
1796
|
PASSKEY_NOT_FOUND: { message: "no passkey has that ID", status: 404 }
|
|
1472
|
-
}).input(
|
|
1797
|
+
}).input(z41.strictObject({ passkeyID: z41.string().min(1) })).output(z41.object({ passkeyID: z41.string(), revokedAt: z41.date() }))
|
|
1473
1798
|
};
|
|
1474
1799
|
|
|
1475
1800
|
// src/contract/known-contact-schema.ts
|
|
1476
|
-
import { z as
|
|
1477
|
-
var knownContactSchema =
|
|
1478
|
-
contactID:
|
|
1479
|
-
name:
|
|
1480
|
-
destination:
|
|
1481
|
-
markedAt:
|
|
1801
|
+
import { z as z42 } from "zod";
|
|
1802
|
+
var knownContactSchema = z42.object({
|
|
1803
|
+
contactID: z42.string(),
|
|
1804
|
+
name: z42.string().nullable(),
|
|
1805
|
+
destination: z42.string().nullable(),
|
|
1806
|
+
markedAt: z42.date()
|
|
1482
1807
|
});
|
|
1483
1808
|
|
|
1484
1809
|
// src/contract/turn-inputs-contract.ts
|
|
1485
1810
|
import { oc as oc5 } from "@orpc/contract";
|
|
1486
|
-
import { z as
|
|
1811
|
+
import { z as z45 } from "zod";
|
|
1487
1812
|
|
|
1488
1813
|
// src/contract/input-miss-schema.ts
|
|
1489
|
-
import { z as
|
|
1490
|
-
var inputMissSchema =
|
|
1491
|
-
missID:
|
|
1492
|
-
captureID:
|
|
1493
|
-
taskID:
|
|
1494
|
-
stepRunID:
|
|
1495
|
-
reason:
|
|
1814
|
+
import { z as z43 } from "zod";
|
|
1815
|
+
var inputMissSchema = z43.object({
|
|
1816
|
+
missID: z43.string(),
|
|
1817
|
+
captureID: z43.string().nullable(),
|
|
1818
|
+
taskID: z43.string(),
|
|
1819
|
+
stepRunID: z43.string(),
|
|
1820
|
+
reason: z43.enum([
|
|
1496
1821
|
"queue_full",
|
|
1497
1822
|
"spool_full",
|
|
1498
1823
|
"spool_write_failed",
|
|
@@ -1504,45 +1829,45 @@ var inputMissSchema = z32.object({
|
|
|
1504
1829
|
"intake_failed",
|
|
1505
1830
|
"holds_own_value"
|
|
1506
1831
|
]),
|
|
1507
|
-
count:
|
|
1508
|
-
writer:
|
|
1509
|
-
counter:
|
|
1510
|
-
createdAt:
|
|
1832
|
+
count: z43.int().positive(),
|
|
1833
|
+
writer: z43.string().nullable(),
|
|
1834
|
+
counter: z43.int().nullable(),
|
|
1835
|
+
createdAt: z43.date()
|
|
1511
1836
|
});
|
|
1512
1837
|
|
|
1513
1838
|
// src/contract/logged-input-schema.ts
|
|
1514
|
-
import { z as
|
|
1515
|
-
var loggedInputSchema =
|
|
1516
|
-
inputID:
|
|
1517
|
-
captureID:
|
|
1518
|
-
taskID:
|
|
1519
|
-
stepRunID:
|
|
1520
|
-
writer:
|
|
1521
|
-
counter:
|
|
1522
|
-
role:
|
|
1523
|
-
profile:
|
|
1524
|
-
model:
|
|
1525
|
-
harness:
|
|
1526
|
-
api:
|
|
1527
|
-
endpoint:
|
|
1528
|
-
route:
|
|
1529
|
-
isRewritten:
|
|
1530
|
-
upstreamStatus:
|
|
1531
|
-
bytes:
|
|
1532
|
-
intakeSequence:
|
|
1533
|
-
receivedAt:
|
|
1534
|
-
takenAt:
|
|
1535
|
-
state:
|
|
1536
|
-
removedCause:
|
|
1839
|
+
import { z as z44 } from "zod";
|
|
1840
|
+
var loggedInputSchema = z44.object({
|
|
1841
|
+
inputID: z44.string(),
|
|
1842
|
+
captureID: z44.string(),
|
|
1843
|
+
taskID: z44.string(),
|
|
1844
|
+
stepRunID: z44.string(),
|
|
1845
|
+
writer: z44.string(),
|
|
1846
|
+
counter: z44.int(),
|
|
1847
|
+
role: z44.string(),
|
|
1848
|
+
profile: z44.string(),
|
|
1849
|
+
model: z44.string(),
|
|
1850
|
+
harness: z44.string(),
|
|
1851
|
+
api: z44.string(),
|
|
1852
|
+
endpoint: z44.string(),
|
|
1853
|
+
route: z44.string(),
|
|
1854
|
+
isRewritten: z44.boolean(),
|
|
1855
|
+
upstreamStatus: z44.int(),
|
|
1856
|
+
bytes: z44.int(),
|
|
1857
|
+
intakeSequence: z44.int(),
|
|
1858
|
+
receivedAt: z44.date(),
|
|
1859
|
+
takenAt: z44.date(),
|
|
1860
|
+
state: z44.enum(["writing", "stored", "missing", "removed"]),
|
|
1861
|
+
removedCause: z44.enum(["retention_days", "retention_bytes", "forget", "dropped", "restore", "reset"]).nullable()
|
|
1537
1862
|
});
|
|
1538
1863
|
|
|
1539
1864
|
// src/contract/turn-inputs-contract.ts
|
|
1540
|
-
var turnInputOn =
|
|
1541
|
-
state:
|
|
1542
|
-
forMs:
|
|
1865
|
+
var turnInputOn = z45.strictObject({
|
|
1866
|
+
state: z45.literal("on"),
|
|
1867
|
+
forMs: z45.int().positive().nullable()
|
|
1543
1868
|
});
|
|
1544
|
-
var turnInputOff =
|
|
1545
|
-
var turnInputSetSchema =
|
|
1869
|
+
var turnInputOff = z45.strictObject({ state: z45.literal("off"), drop: z45.boolean() });
|
|
1870
|
+
var turnInputSetSchema = z45.discriminatedUnion("state", [turnInputOn, turnInputOff]);
|
|
1546
1871
|
var turnInputs = oc5.errors({
|
|
1547
1872
|
NOT_FOUND: { message: "no logged request has that ID", status: 404 },
|
|
1548
1873
|
REMOVED: { message: "that request is removed or its body is missing", status: 410 },
|
|
@@ -1552,27 +1877,27 @@ var turnInputs = oc5.errors({
|
|
|
1552
1877
|
},
|
|
1553
1878
|
NOT_CONFIGURED: { message: "the turn-input log is not configured", status: 409 }
|
|
1554
1879
|
});
|
|
1555
|
-
var listedInputsSchema =
|
|
1556
|
-
inputs:
|
|
1557
|
-
misses:
|
|
1880
|
+
var listedInputsSchema = z45.object({
|
|
1881
|
+
inputs: z45.array(loggedInputSchema),
|
|
1882
|
+
misses: z45.array(inputMissSchema)
|
|
1558
1883
|
});
|
|
1559
1884
|
var turnInputsContract = {
|
|
1560
|
-
list: turnInputs.input(
|
|
1561
|
-
open: turnInputs.input(
|
|
1562
|
-
set: turnInputs.input(turnInputSetSchema).output(
|
|
1885
|
+
list: turnInputs.input(z45.strictObject({ limit: z45.int().positive().max(500).default(50) })).output(listedInputsSchema),
|
|
1886
|
+
open: turnInputs.input(z45.strictObject({ inputID: z45.string().min(1) })).output(z45.object({ inputID: z45.string(), body: z45.base64() })),
|
|
1887
|
+
set: turnInputs.input(turnInputSetSchema).output(z45.object({ state: z45.enum(["on", "off"]), until: z45.number().nullable() }))
|
|
1563
1888
|
};
|
|
1564
1889
|
|
|
1565
1890
|
// src/contract/host-contract.ts
|
|
1566
|
-
var versionRefSchema2 =
|
|
1567
|
-
var versionTargetSchema2 =
|
|
1568
|
-
itemID:
|
|
1569
|
-
version:
|
|
1570
|
-
});
|
|
1571
|
-
var itemTextSchema =
|
|
1572
|
-
var proposalOriginSchema2 =
|
|
1573
|
-
var memoryOriginSchema =
|
|
1574
|
-
var contentSourceSchema =
|
|
1575
|
-
var reviewReasonSchema2 =
|
|
1891
|
+
var versionRefSchema2 = z46.object({ itemID: z46.string(), version: z46.int().positive() });
|
|
1892
|
+
var versionTargetSchema2 = z46.strictObject({
|
|
1893
|
+
itemID: z46.string().min(1),
|
|
1894
|
+
version: z46.int().positive()
|
|
1895
|
+
});
|
|
1896
|
+
var itemTextSchema = z46.string().max(2000).regex(/\S/u);
|
|
1897
|
+
var proposalOriginSchema2 = z46.enum(["owner", "conversation", "task"]);
|
|
1898
|
+
var memoryOriginSchema = z46.enum([...proposalOriginSchema2.options, "lapse"]);
|
|
1899
|
+
var contentSourceSchema = z46.enum(["owner", "owner_data", "untrusted"]);
|
|
1900
|
+
var reviewReasonSchema2 = z46.enum([
|
|
1576
1901
|
"no_quote",
|
|
1577
1902
|
"quote_not_typed",
|
|
1578
1903
|
"quote_in_quoted_block",
|
|
@@ -1587,72 +1912,72 @@ var reviewReasonSchema2 = z35.enum([
|
|
|
1587
1912
|
"other",
|
|
1588
1913
|
"self_note",
|
|
1589
1914
|
"from_photo",
|
|
1590
|
-
"sensitive",
|
|
1591
1915
|
"subject_change",
|
|
1592
1916
|
"labels",
|
|
1593
1917
|
"ask_rule"
|
|
1594
1918
|
]);
|
|
1595
|
-
var proposalSourceSchema2 =
|
|
1919
|
+
var proposalSourceSchema2 = z46.object({
|
|
1596
1920
|
origin: proposalOriginSchema2,
|
|
1597
|
-
thread:
|
|
1598
|
-
proposedAt:
|
|
1599
|
-
});
|
|
1600
|
-
var pendingProposalSchema =
|
|
1601
|
-
proposalID:
|
|
1602
|
-
operation:
|
|
1603
|
-
itemID:
|
|
1604
|
-
targetVersion:
|
|
1605
|
-
isPinned:
|
|
1606
|
-
subject:
|
|
1607
|
-
newSubject:
|
|
1608
|
-
|
|
1609
|
-
kind: z35.enum(["fact", "self"]),
|
|
1921
|
+
thread: z46.string().nullable(),
|
|
1922
|
+
proposedAt: z46.date()
|
|
1923
|
+
});
|
|
1924
|
+
var pendingProposalSchema = z46.object({
|
|
1925
|
+
proposalID: z46.string(),
|
|
1926
|
+
operation: z46.enum(["remember", "retire", "pin"]),
|
|
1927
|
+
itemID: z46.string(),
|
|
1928
|
+
targetVersion: z46.int().nullable(),
|
|
1929
|
+
isPinned: z46.boolean(),
|
|
1930
|
+
subject: z46.enum(["owner", "self", "shared"]),
|
|
1931
|
+
newSubject: z46.enum(["owner", "self", "shared"]).nullable(),
|
|
1932
|
+
kind: z46.enum(["fact", "self"]),
|
|
1610
1933
|
reason: reviewReasonSchema2,
|
|
1611
|
-
actionHash:
|
|
1934
|
+
actionHash: z46.string(),
|
|
1612
1935
|
origin: proposalOriginSchema2,
|
|
1613
1936
|
source: contentSourceSchema,
|
|
1614
|
-
createdAt:
|
|
1615
|
-
lapseAt:
|
|
1616
|
-
sources:
|
|
1617
|
-
text:
|
|
1618
|
-
quote:
|
|
1619
|
-
});
|
|
1620
|
-
var closeMatchSchema2 =
|
|
1621
|
-
var approvalResultSchema =
|
|
1622
|
-
|
|
1623
|
-
|
|
1937
|
+
createdAt: z46.date(),
|
|
1938
|
+
lapseAt: z46.date(),
|
|
1939
|
+
sources: z46.array(proposalSourceSchema2),
|
|
1940
|
+
text: z46.string(),
|
|
1941
|
+
quote: z46.string().nullable()
|
|
1942
|
+
});
|
|
1943
|
+
var closeMatchSchema2 = z46.object({ itemID: z46.string(), version: z46.int(), text: z46.string() });
|
|
1944
|
+
var approvalResultSchema = z46.discriminatedUnion("status", [
|
|
1945
|
+
z46.object({ status: z46.literal("applied"), itemID: z46.string(), version: z46.int() }),
|
|
1946
|
+
z46.object({ status: z46.literal("close_match"), item: closeMatchSchema2 })
|
|
1624
1947
|
]);
|
|
1625
|
-
var historyVersionSchema =
|
|
1626
|
-
version:
|
|
1627
|
-
change:
|
|
1628
|
-
state:
|
|
1948
|
+
var historyVersionSchema = z46.object({
|
|
1949
|
+
version: z46.int(),
|
|
1950
|
+
change: z46.enum(["created", "edited", "retired", "restored", "undone"]),
|
|
1951
|
+
state: z46.enum(["active", "retired"]),
|
|
1629
1952
|
origin: memoryOriginSchema,
|
|
1630
1953
|
source: contentSourceSchema,
|
|
1631
|
-
recordedAt:
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1954
|
+
recordedAt: z46.date(),
|
|
1955
|
+
isRemoved: z46.boolean(),
|
|
1956
|
+
isBridge: z46.boolean(),
|
|
1957
|
+
status: z46.enum(["readable", "shredded", "unreadable"]),
|
|
1958
|
+
text: z46.string().nullable()
|
|
1959
|
+
});
|
|
1960
|
+
var itemHistorySchema = z46.object({
|
|
1961
|
+
itemID: z46.string(),
|
|
1962
|
+
subject: z46.enum(["owner", "self", "shared"]),
|
|
1963
|
+
kind: z46.enum(["fact", "self"]),
|
|
1964
|
+
state: z46.enum(["active", "retired", "forgetting", "forgotten"]),
|
|
1965
|
+
versions: z46.array(historyVersionSchema)
|
|
1966
|
+
});
|
|
1967
|
+
var proposalAnswerSchema = z46.strictObject({
|
|
1968
|
+
proposalID: z46.string().min(1),
|
|
1969
|
+
actionHash: z46.string().min(1)
|
|
1970
|
+
});
|
|
1971
|
+
var hostSessionSchema = z46.object({
|
|
1972
|
+
sessionID: z46.string(),
|
|
1973
|
+
deviceName: z46.string(),
|
|
1974
|
+
createdAt: z46.date(),
|
|
1975
|
+
lastUsedAt: z46.date()
|
|
1976
|
+
});
|
|
1977
|
+
var subjectCountSchema = z46.object({
|
|
1978
|
+
owner: z46.int().nonnegative(),
|
|
1979
|
+
shared: z46.int().nonnegative(),
|
|
1980
|
+
self: z46.int().nonnegative()
|
|
1656
1981
|
});
|
|
1657
1982
|
var memory = oc6.errors({
|
|
1658
1983
|
MEMORY_NOT_STARTED: { message: "the memory store has not started yet", status: 503 },
|
|
@@ -1667,28 +1992,28 @@ var memory = oc6.errors({
|
|
|
1667
1992
|
PIN_EDIT: { message: "a pin takes no edited text", status: 400 },
|
|
1668
1993
|
SELF_NOTE_REFUSED: { message: "a self-note never takes that change", status: 409 }
|
|
1669
1994
|
});
|
|
1670
|
-
var skillFileSchema =
|
|
1671
|
-
var pendingSkillProposalSchema =
|
|
1672
|
-
proposalID:
|
|
1673
|
-
name:
|
|
1674
|
-
skillHash:
|
|
1675
|
-
baseHash:
|
|
1676
|
-
files:
|
|
1677
|
-
inForce:
|
|
1678
|
-
skillHash:
|
|
1679
|
-
origin:
|
|
1680
|
-
files:
|
|
1995
|
+
var skillFileSchema = z46.object({ path: z46.string(), text: z46.string() });
|
|
1996
|
+
var pendingSkillProposalSchema = z46.object({
|
|
1997
|
+
proposalID: z46.string(),
|
|
1998
|
+
name: z46.string(),
|
|
1999
|
+
skillHash: z46.string(),
|
|
2000
|
+
baseHash: z46.string().nullable(),
|
|
2001
|
+
files: z46.array(skillFileSchema),
|
|
2002
|
+
inForce: z46.object({
|
|
2003
|
+
skillHash: z46.string(),
|
|
2004
|
+
origin: z46.enum(["definitions", "vendored", "nixie"]),
|
|
2005
|
+
files: z46.array(skillFileSchema)
|
|
1681
2006
|
}).nullable(),
|
|
1682
|
-
untypedToken:
|
|
1683
|
-
thread:
|
|
1684
|
-
provenance:
|
|
1685
|
-
createdAt:
|
|
1686
|
-
lapseAt:
|
|
1687
|
-
isStale:
|
|
2007
|
+
untypedToken: z46.object({ kind: z46.string(), raw: z46.string() }).nullable(),
|
|
2008
|
+
thread: z46.string().nullable(),
|
|
2009
|
+
provenance: z46.object({ runID: z46.string(), callID: z46.string(), profile: z46.string() }),
|
|
2010
|
+
createdAt: z46.date(),
|
|
2011
|
+
lapseAt: z46.date(),
|
|
2012
|
+
isStale: z46.boolean()
|
|
1688
2013
|
});
|
|
1689
|
-
var skillAnswerSchema =
|
|
1690
|
-
proposalID:
|
|
1691
|
-
skillHash:
|
|
2014
|
+
var skillAnswerSchema = z46.strictObject({
|
|
2015
|
+
proposalID: z46.string().min(1),
|
|
2016
|
+
skillHash: z46.string().min(1)
|
|
1692
2017
|
});
|
|
1693
2018
|
var skills = oc6.errors({
|
|
1694
2019
|
NOT_FOUND: { message: "nothing has that ID", status: 404 },
|
|
@@ -1698,38 +2023,38 @@ var skills = oc6.errors({
|
|
|
1698
2023
|
SKILL_CHECK: { message: "the files fail the seed checks", status: 400 },
|
|
1699
2024
|
WRONG_STATE: { message: "the skill nixie wrote is no longer in force", status: 409 }
|
|
1700
2025
|
});
|
|
1701
|
-
var definitionsSkillSchema =
|
|
1702
|
-
var writtenSkillSchema =
|
|
1703
|
-
approvalID:
|
|
1704
|
-
proposalID:
|
|
1705
|
-
name:
|
|
1706
|
-
skillHash:
|
|
2026
|
+
var definitionsSkillSchema = z46.object({ skillHash: z46.string(), origin: z46.enum(["definitions", "vendored"]) }).nullable();
|
|
2027
|
+
var writtenSkillSchema = z46.object({
|
|
2028
|
+
approvalID: z46.string(),
|
|
2029
|
+
proposalID: z46.string(),
|
|
2030
|
+
name: z46.string(),
|
|
2031
|
+
skillHash: z46.string(),
|
|
1707
2032
|
base: definitionsSkillSchema,
|
|
1708
2033
|
definitions: definitionsSkillSchema,
|
|
1709
|
-
isConflict:
|
|
1710
|
-
pullRequestURL:
|
|
1711
|
-
approvedAt:
|
|
1712
|
-
});
|
|
1713
|
-
var promptPartFileSchema =
|
|
1714
|
-
var promptEntrySchema =
|
|
1715
|
-
var pendingPromptProposalSchema =
|
|
1716
|
-
proposalID:
|
|
1717
|
-
promptID:
|
|
1718
|
-
proposalHash:
|
|
1719
|
-
baseHash:
|
|
2034
|
+
isConflict: z46.boolean(),
|
|
2035
|
+
pullRequestURL: z46.url().nullable(),
|
|
2036
|
+
approvedAt: z46.date()
|
|
2037
|
+
});
|
|
2038
|
+
var promptPartFileSchema = z46.object({ path: z46.string(), text: z46.string() });
|
|
2039
|
+
var promptEntrySchema = z46.record(z46.string(), z46.string());
|
|
2040
|
+
var pendingPromptProposalSchema = z46.object({
|
|
2041
|
+
proposalID: z46.string(),
|
|
2042
|
+
promptID: z46.string(),
|
|
2043
|
+
proposalHash: z46.string(),
|
|
2044
|
+
baseHash: z46.string().nullable(),
|
|
1720
2045
|
entry: promptEntrySchema,
|
|
1721
|
-
files:
|
|
1722
|
-
reason:
|
|
1723
|
-
inForce:
|
|
1724
|
-
thread:
|
|
1725
|
-
provenance:
|
|
1726
|
-
createdAt:
|
|
1727
|
-
lapseAt:
|
|
1728
|
-
isStale:
|
|
1729
|
-
});
|
|
1730
|
-
var promptAnswerSchema =
|
|
1731
|
-
proposalID:
|
|
1732
|
-
proposalHash:
|
|
2046
|
+
files: z46.array(promptPartFileSchema),
|
|
2047
|
+
reason: z46.string(),
|
|
2048
|
+
inForce: z46.object({ parts: promptEntrySchema, template: z46.string().nullable() }).nullable(),
|
|
2049
|
+
thread: z46.string().nullable(),
|
|
2050
|
+
provenance: z46.object({ runID: z46.string(), callID: z46.string(), profile: z46.string() }),
|
|
2051
|
+
createdAt: z46.date(),
|
|
2052
|
+
lapseAt: z46.date(),
|
|
2053
|
+
isStale: z46.boolean()
|
|
2054
|
+
});
|
|
2055
|
+
var promptAnswerSchema = z46.strictObject({
|
|
2056
|
+
proposalID: z46.string().min(1),
|
|
2057
|
+
proposalHash: z46.string().min(1)
|
|
1733
2058
|
});
|
|
1734
2059
|
var prompts = oc6.errors({
|
|
1735
2060
|
NOT_FOUND: { message: "nothing has that ID", status: 404 },
|
|
@@ -1738,59 +2063,63 @@ var prompts = oc6.errors({
|
|
|
1738
2063
|
STALE_BASE: { message: "the override in force moved past the proposal", status: 409 },
|
|
1739
2064
|
PROMPT_CHECK: { message: "the override fails the definitions checks", status: 400 }
|
|
1740
2065
|
});
|
|
1741
|
-
var ruleVersionSchema =
|
|
1742
|
-
var ruleInForceSchema =
|
|
1743
|
-
ruleID:
|
|
1744
|
-
revision:
|
|
1745
|
-
ruleHash:
|
|
1746
|
-
sentence:
|
|
1747
|
-
origin:
|
|
1748
|
-
changeID:
|
|
1749
|
-
lastFiredAt:
|
|
1750
|
-
});
|
|
1751
|
-
var ruleConflictSchema =
|
|
1752
|
-
ruleID:
|
|
1753
|
-
changeID:
|
|
2066
|
+
var ruleVersionSchema = z46.object({ ruleHash: z46.string(), sentence: z46.string() }).nullable();
|
|
2067
|
+
var ruleInForceSchema = z46.object({
|
|
2068
|
+
ruleID: z46.string(),
|
|
2069
|
+
revision: z46.int().positive(),
|
|
2070
|
+
ruleHash: z46.string(),
|
|
2071
|
+
sentence: z46.string(),
|
|
2072
|
+
origin: z46.enum(["definitions", "nixie"]),
|
|
2073
|
+
changeID: z46.string().nullable(),
|
|
2074
|
+
lastFiredAt: z46.date().nullable()
|
|
2075
|
+
});
|
|
2076
|
+
var ruleConflictSchema = z46.object({
|
|
2077
|
+
ruleID: z46.string(),
|
|
2078
|
+
changeID: z46.string(),
|
|
1754
2079
|
nixie: ruleVersionSchema,
|
|
1755
2080
|
repo: ruleVersionSchema,
|
|
1756
2081
|
base: ruleVersionSchema,
|
|
1757
|
-
changedBy:
|
|
1758
|
-
reason:
|
|
1759
|
-
changedAt:
|
|
2082
|
+
changedBy: z46.enum(["owner", "nixie"]),
|
|
2083
|
+
reason: z46.string(),
|
|
2084
|
+
changedAt: z46.date()
|
|
1760
2085
|
});
|
|
1761
|
-
var ruleProposalChangeSchema =
|
|
1762
|
-
ruleID:
|
|
2086
|
+
var ruleProposalChangeSchema = z46.object({
|
|
2087
|
+
ruleID: z46.string(),
|
|
1763
2088
|
before: ruleVersionSchema,
|
|
1764
2089
|
after: ruleVersionSchema
|
|
1765
2090
|
});
|
|
1766
|
-
var effectChangeSchema =
|
|
1767
|
-
tool:
|
|
1768
|
-
remove:
|
|
1769
|
-
sentence:
|
|
2091
|
+
var effectChangeSchema = z46.object({
|
|
2092
|
+
tool: z46.string(),
|
|
2093
|
+
remove: z46.array(z46.string()),
|
|
2094
|
+
sentence: z46.string()
|
|
1770
2095
|
});
|
|
1771
|
-
var pendingRuleProposalSchema =
|
|
1772
|
-
proposalID:
|
|
1773
|
-
changes:
|
|
1774
|
-
effectChanges:
|
|
1775
|
-
createdAt:
|
|
1776
|
-
lapseAt:
|
|
2096
|
+
var pendingRuleProposalSchema = z46.object({
|
|
2097
|
+
proposalID: z46.string(),
|
|
2098
|
+
changes: z46.array(ruleProposalChangeSchema),
|
|
2099
|
+
effectChanges: z46.array(effectChangeSchema),
|
|
2100
|
+
createdAt: z46.date(),
|
|
2101
|
+
lapseAt: z46.date()
|
|
1777
2102
|
});
|
|
1778
|
-
var ruleProposalAnswerSchema =
|
|
2103
|
+
var ruleProposalAnswerSchema = z46.strictObject({ proposalID: z46.string().min(1) });
|
|
1779
2104
|
var ruleProposalRejectionSchema = ruleProposalAnswerSchema.extend({
|
|
1780
|
-
reason:
|
|
2105
|
+
reason: z46.string().max(500).regex(/\S/u)
|
|
1781
2106
|
});
|
|
1782
2107
|
var actionRejectionSchema = ruleProposalAnswerSchema.extend({
|
|
1783
|
-
reason:
|
|
2108
|
+
reason: z46.string().max(500).regex(/\S/u).optional()
|
|
1784
2109
|
});
|
|
1785
2110
|
var ruleProposalErrors = {
|
|
1786
2111
|
NOT_FOUND: { message: "nothing has that ID", status: 404 },
|
|
1787
2112
|
PROPOSAL_CLOSED: { message: "the proposal is answered, withdrawn or lapsed", status: 409 }
|
|
1788
2113
|
};
|
|
1789
2114
|
var rules = oc6.errors(ruleProposalErrors);
|
|
2115
|
+
var definitions = oc6.errors({
|
|
2116
|
+
NOT_FOUND: { message: "the definition has no conflict with the repo", status: 404 },
|
|
2117
|
+
DEFINITIONS_NOT_STARTED: { message: "nixie has not started its definitions yet", status: 503 }
|
|
2118
|
+
});
|
|
1790
2119
|
var contacts = oc6.errors({
|
|
1791
2120
|
NOT_FOUND: { message: "no known contact has that ID", status: 404 }
|
|
1792
2121
|
});
|
|
1793
|
-
var hostTaskStateSchema =
|
|
2122
|
+
var hostTaskStateSchema = z46.enum([
|
|
1794
2123
|
"ready",
|
|
1795
2124
|
"running",
|
|
1796
2125
|
"waiting",
|
|
@@ -1810,29 +2139,29 @@ var taskControl2 = oc6.errors({
|
|
|
1810
2139
|
message: "the runner of the task does not take this control",
|
|
1811
2140
|
status: 409
|
|
1812
2141
|
}
|
|
1813
|
-
}).input(
|
|
1814
|
-
taskID:
|
|
2142
|
+
}).input(z46.strictObject({ taskID: z46.string().min(1) })).output(z46.object({
|
|
2143
|
+
taskID: z46.string(),
|
|
1815
2144
|
state: hostTaskStateSchema,
|
|
1816
|
-
isPauseRequested:
|
|
2145
|
+
isPauseRequested: z46.boolean()
|
|
1817
2146
|
}));
|
|
1818
2147
|
var hostContract = {
|
|
1819
|
-
reset: oc6.output(
|
|
1820
|
-
resetAt:
|
|
1821
|
-
lastSequence:
|
|
1822
|
-
keptSessions:
|
|
2148
|
+
reset: oc6.output(z46.object({
|
|
2149
|
+
resetAt: z46.date(),
|
|
2150
|
+
lastSequence: z46.int().nonnegative(),
|
|
2151
|
+
keptSessions: z46.int().nonnegative()
|
|
1823
2152
|
})),
|
|
1824
|
-
resetConversations: oc6.output(
|
|
1825
|
-
resetAt:
|
|
1826
|
-
lastSequence:
|
|
1827
|
-
shreddedRecords:
|
|
2153
|
+
resetConversations: oc6.output(z46.object({
|
|
2154
|
+
resetAt: z46.date(),
|
|
2155
|
+
lastSequence: z46.int().nonnegative(),
|
|
2156
|
+
shreddedRecords: z46.int().nonnegative(),
|
|
1828
2157
|
backup: forgetBackupSchema
|
|
1829
2158
|
})),
|
|
1830
2159
|
nixie: {
|
|
1831
|
-
pause: oc6.output(
|
|
1832
|
-
resume: oc6.output(
|
|
2160
|
+
pause: oc6.output(z46.object({ paused: pauseStateSchema })),
|
|
2161
|
+
resume: oc6.output(z46.object({ paused: pauseStateSchema }))
|
|
1833
2162
|
},
|
|
1834
2163
|
recovery: {
|
|
1835
|
-
read: oc6.output(
|
|
2164
|
+
read: oc6.output(z46.object({ recovery: recoverySchema }))
|
|
1836
2165
|
},
|
|
1837
2166
|
tasks: {
|
|
1838
2167
|
pause: taskControl2,
|
|
@@ -1840,119 +2169,217 @@ var hostContract = {
|
|
|
1840
2169
|
stop: taskControl2,
|
|
1841
2170
|
restart: taskControl2,
|
|
1842
2171
|
close: taskControl2.errors({
|
|
1843
|
-
CONVERSATION_NEVER_CLOSES: { message: "the conversation is never closed", status: 409 }
|
|
2172
|
+
CONVERSATION_NEVER_CLOSES: { message: "the conversation is never closed", status: 409 },
|
|
2173
|
+
DEFINITION_TASK_NEVER_CLOSES: {
|
|
2174
|
+
message: "the task of a definition is never closed",
|
|
2175
|
+
status: 409
|
|
2176
|
+
}
|
|
1844
2177
|
}),
|
|
1845
2178
|
interrupt: taskControl2,
|
|
1846
2179
|
raise: oc6.errors({
|
|
1847
2180
|
TASK_NOT_FOUND: { message: "no task has that ID", status: 404 },
|
|
1848
2181
|
TASK_NOT_AT_LIMIT: { message: "the task is not paused at its limit", status: 409 },
|
|
1849
2182
|
LIMIT_NOT_RAISED: { message: "the new limits are not above the old ones", status: 409 }
|
|
1850
|
-
}).input(
|
|
1851
|
-
taskID:
|
|
1852
|
-
turns:
|
|
1853
|
-
dollars:
|
|
2183
|
+
}).input(z46.strictObject({
|
|
2184
|
+
taskID: z46.string().min(1),
|
|
2185
|
+
turns: z46.int().positive().optional(),
|
|
2186
|
+
dollars: z46.number().positive().optional()
|
|
1854
2187
|
}).refine((input) => input.turns !== undefined || input.dollars !== undefined, {
|
|
1855
2188
|
message: "a raise sets turns, dollars or both"
|
|
1856
|
-
})).output(
|
|
1857
|
-
taskID:
|
|
2189
|
+
})).output(z46.object({
|
|
2190
|
+
taskID: z46.string(),
|
|
1858
2191
|
state: hostTaskStateSchema,
|
|
1859
|
-
isPauseRequested:
|
|
1860
|
-
turns:
|
|
1861
|
-
dollars:
|
|
2192
|
+
isPauseRequested: z46.boolean(),
|
|
2193
|
+
turns: z46.int().positive(),
|
|
2194
|
+
dollars: z46.number().positive()
|
|
1862
2195
|
}))
|
|
1863
2196
|
},
|
|
1864
2197
|
sessions: {
|
|
1865
|
-
issueCode: oc6.output(
|
|
1866
|
-
list: oc6.output(
|
|
2198
|
+
issueCode: oc6.output(z46.object({ code: z46.string(), expiresAt: z46.date() })),
|
|
2199
|
+
list: oc6.output(z46.array(hostSessionSchema)),
|
|
1867
2200
|
label: oc6.errors({
|
|
1868
2201
|
SESSION_NOT_FOUND: {
|
|
1869
2202
|
message: "no device session that is still signed in has that ID",
|
|
1870
2203
|
status: 404
|
|
1871
2204
|
},
|
|
1872
2205
|
LABEL_INVALID: { message: "a label holds 1 to 100 characters besides spaces", status: 400 }
|
|
1873
|
-
}).input(
|
|
2206
|
+
}).input(z46.strictObject({ sessionID: z46.string().min(1), label: z46.string() })).output(z46.object({ sessionID: z46.string(), label: z46.string() }))
|
|
1874
2207
|
},
|
|
1875
2208
|
passkeys: hostPasskeyContract,
|
|
1876
2209
|
memory: {
|
|
1877
2210
|
proposals: {
|
|
1878
|
-
list: memory.output(
|
|
2211
|
+
list: memory.output(z46.array(pendingProposalSchema)),
|
|
1879
2212
|
approve: memory.input(proposalAnswerSchema.extend({
|
|
1880
2213
|
revisionOf: versionTargetSchema2.optional(),
|
|
1881
|
-
ignoreCloseMatch:
|
|
2214
|
+
ignoreCloseMatch: z46.boolean().optional(),
|
|
1882
2215
|
editedText: itemTextSchema.optional()
|
|
1883
2216
|
})).output(approvalResultSchema),
|
|
1884
|
-
reject: memory.input(proposalAnswerSchema.extend({ reason:
|
|
2217
|
+
reject: memory.input(proposalAnswerSchema.extend({ reason: z46.string().max(500).regex(/\S/u).optional() })).output(z46.object({ proposalID: z46.string() }))
|
|
1885
2218
|
},
|
|
1886
|
-
subjects: memory.output(
|
|
2219
|
+
subjects: memory.output(z46.object({ items: subjectCountSchema, proposals: subjectCountSchema })),
|
|
1887
2220
|
items: {
|
|
1888
|
-
read: memory.input(
|
|
2221
|
+
read: memory.input(z46.strictObject({ itemID: z46.string().min(1) })).output(itemHistorySchema),
|
|
1889
2222
|
edit: memory.input(versionTargetSchema2.extend({ text: itemTextSchema })).output(versionRefSchema2),
|
|
1890
2223
|
retire: memory.input(versionTargetSchema2).output(versionRefSchema2),
|
|
1891
2224
|
restore: memory.input(versionTargetSchema2).output(versionRefSchema2),
|
|
1892
|
-
forget: memory.input(versionTargetSchema2).output(
|
|
2225
|
+
forget: memory.input(versionTargetSchema2).output(z46.object({ itemID: z46.string(), backup: forgetBackupSchema })),
|
|
1893
2226
|
forgetAll: memory.output(forgottenItemsSchema),
|
|
1894
|
-
pin: memory.input(
|
|
2227
|
+
pin: memory.input(z46.strictObject({ itemID: z46.string().min(1), isPinned: z46.boolean() })).output(z46.object({ itemID: z46.string(), isPinned: z46.boolean() }))
|
|
1895
2228
|
}
|
|
1896
2229
|
},
|
|
1897
2230
|
skills: {
|
|
1898
2231
|
proposals: {
|
|
1899
|
-
list: skills.output(
|
|
1900
|
-
approve: skills.input(skillAnswerSchema.extend({ files:
|
|
1901
|
-
reject: skills.input(skillAnswerSchema.extend({ reason:
|
|
2232
|
+
list: skills.output(z46.array(pendingSkillProposalSchema)),
|
|
2233
|
+
approve: skills.input(skillAnswerSchema.extend({ files: z46.array(skillFileSchema).min(1).optional() })).output(z46.object({ proposalID: z46.string(), approvalID: z46.string(), skillHash: z46.string() })),
|
|
2234
|
+
reject: skills.input(skillAnswerSchema.extend({ reason: z46.string().max(500).regex(/\S/u) })).output(z46.object({ proposalID: z46.string() }))
|
|
1902
2235
|
},
|
|
1903
2236
|
written: {
|
|
1904
|
-
list: skills.output(
|
|
1905
|
-
resolve: skills.input(
|
|
1906
|
-
approvalID:
|
|
1907
|
-
keep:
|
|
1908
|
-
})).output(
|
|
2237
|
+
list: skills.output(z46.array(writtenSkillSchema)),
|
|
2238
|
+
resolve: skills.input(z46.strictObject({
|
|
2239
|
+
approvalID: z46.string().min(1),
|
|
2240
|
+
keep: z46.enum(["nixie", "definitions"])
|
|
2241
|
+
})).output(z46.object({ approvalID: z46.string(), keep: z46.enum(["nixie", "definitions"]) }))
|
|
1909
2242
|
}
|
|
1910
2243
|
},
|
|
1911
2244
|
rules: {
|
|
1912
|
-
list: rules.output(
|
|
1913
|
-
conflicts: rules.output(
|
|
1914
|
-
resolve: rules.input(
|
|
2245
|
+
list: rules.output(z46.array(ruleInForceSchema)),
|
|
2246
|
+
conflicts: rules.output(z46.array(ruleConflictSchema)),
|
|
2247
|
+
resolve: rules.input(z46.strictObject({ ruleID: z46.string().min(1), keep: z46.enum(["nixie", "repo"]) })).output(z46.object({ ruleID: z46.string(), changeID: z46.string(), keep: z46.enum(["nixie", "repo"]) })),
|
|
1915
2248
|
proposals: {
|
|
1916
|
-
list: rules.output(
|
|
1917
|
-
approve: rules.input(ruleProposalAnswerSchema).output(
|
|
1918
|
-
reject: rules.input(ruleProposalRejectionSchema).output(
|
|
2249
|
+
list: rules.output(z46.array(pendingRuleProposalSchema)),
|
|
2250
|
+
approve: rules.input(ruleProposalAnswerSchema).output(z46.object({ proposalID: z46.string() })),
|
|
2251
|
+
reject: rules.input(ruleProposalRejectionSchema).output(z46.object({ proposalID: z46.string() }))
|
|
1919
2252
|
}
|
|
1920
2253
|
},
|
|
2254
|
+
definitions: {
|
|
2255
|
+
resolve: definitions.input(z46.strictObject({ definitionID: z46.string().min(1), keep: z46.enum(["nixie", "repo"]) })).output(z46.object({
|
|
2256
|
+
definitionID: z46.string(),
|
|
2257
|
+
changeID: z46.string(),
|
|
2258
|
+
keep: z46.enum(["nixie", "repo"])
|
|
2259
|
+
}))
|
|
2260
|
+
},
|
|
1921
2261
|
actions: {
|
|
1922
2262
|
proposals: {
|
|
1923
|
-
list: rules.output(
|
|
1924
|
-
approve: rules.input(ruleProposalAnswerSchema).output(
|
|
1925
|
-
reject: rules.input(actionRejectionSchema).output(
|
|
2263
|
+
list: rules.output(z46.array(actionProposalSchema)),
|
|
2264
|
+
approve: rules.input(ruleProposalAnswerSchema).output(z46.object({ proposalID: z46.string() })),
|
|
2265
|
+
reject: rules.input(actionRejectionSchema).output(z46.object({ proposalID: z46.string() }))
|
|
1926
2266
|
}
|
|
1927
2267
|
},
|
|
1928
2268
|
mandates: hostMandatesContract,
|
|
1929
2269
|
contacts: {
|
|
1930
|
-
list: contacts.output(
|
|
1931
|
-
markKnown: contacts.input(
|
|
1932
|
-
destination:
|
|
1933
|
-
name:
|
|
1934
|
-
})).output(
|
|
1935
|
-
unmark: contacts.input(
|
|
2270
|
+
list: contacts.output(z46.array(knownContactSchema)),
|
|
2271
|
+
markKnown: contacts.input(z46.strictObject({
|
|
2272
|
+
destination: z46.string().min(1).max(500),
|
|
2273
|
+
name: z46.string().min(1).max(200).optional()
|
|
2274
|
+
})).output(z46.object({ contact: knownContactSchema, isNew: z46.boolean() })),
|
|
2275
|
+
unmark: contacts.input(z46.strictObject({ contactID: z46.string().min(1) })).output(z46.object({ contactID: z46.string() }))
|
|
1936
2276
|
},
|
|
1937
2277
|
turnInputs: turnInputsContract,
|
|
1938
2278
|
prompts: {
|
|
1939
2279
|
proposals: {
|
|
1940
|
-
list: prompts.output(
|
|
2280
|
+
list: prompts.output(z46.array(pendingPromptProposalSchema)),
|
|
1941
2281
|
approve: prompts.input(promptAnswerSchema.extend({
|
|
1942
2282
|
entry: promptEntrySchema.optional(),
|
|
1943
|
-
files:
|
|
1944
|
-
})).output(
|
|
1945
|
-
reject: prompts.input(promptAnswerSchema.extend({ reason:
|
|
2283
|
+
files: z46.array(promptPartFileSchema).optional()
|
|
2284
|
+
})).output(z46.object({ proposalID: z46.string(), approvalID: z46.string(), proposalHash: z46.string() })),
|
|
2285
|
+
reject: prompts.input(promptAnswerSchema.extend({ reason: z46.string().max(500).regex(/\S/u) })).output(z46.object({ proposalID: z46.string() }))
|
|
1946
2286
|
}
|
|
1947
2287
|
}
|
|
1948
2288
|
};
|
|
1949
|
-
// src/contract/
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
2289
|
+
// src/contract/payload-clip-bytes.ts
|
|
2290
|
+
var payloadClipBytes = 4096;
|
|
2291
|
+
|
|
2292
|
+
// src/contract/clip-record-payloads.ts
|
|
2293
|
+
function clipRecordPayloads(record) {
|
|
2294
|
+
const clipped = [];
|
|
2295
|
+
let toolCall = record.toolCall;
|
|
2296
|
+
let worker = record.worker;
|
|
2297
|
+
if (toolCall !== undefined) {
|
|
2298
|
+
const input = clipObjectField(toolCall.input, "toolCall.input", clipped);
|
|
2299
|
+
const content = clipObjectField(toolCall.content, "toolCall.content", clipped);
|
|
2300
|
+
const { input: _input, content: _content, ...rest } = toolCall;
|
|
2301
|
+
toolCall = {
|
|
2302
|
+
...rest,
|
|
2303
|
+
...input === undefined ? {} : { input },
|
|
2304
|
+
...content === undefined ? {} : { content }
|
|
2305
|
+
};
|
|
2306
|
+
}
|
|
2307
|
+
if (worker?.phase === "turn" && worker.text !== undefined) {
|
|
2308
|
+
const cut = cutString(worker.text);
|
|
2309
|
+
if (cut !== null) {
|
|
2310
|
+
clipped.push({ field: "worker.text", path: [], bytes: cut.bytes });
|
|
2311
|
+
worker = { ...worker, text: cut.text };
|
|
2312
|
+
}
|
|
1955
2313
|
}
|
|
2314
|
+
if (worker?.phase === "ended" && worker.detail !== undefined) {
|
|
2315
|
+
const cut = cutString(worker.detail);
|
|
2316
|
+
if (cut !== null) {
|
|
2317
|
+
clipped.push({ field: "worker.detail", path: [], bytes: cut.bytes });
|
|
2318
|
+
worker = { ...worker, detail: cut.text };
|
|
2319
|
+
}
|
|
2320
|
+
}
|
|
2321
|
+
if (clipped.length === 0) {
|
|
2322
|
+
return record;
|
|
2323
|
+
}
|
|
2324
|
+
return {
|
|
2325
|
+
...record,
|
|
2326
|
+
clipped,
|
|
2327
|
+
...toolCall === undefined ? {} : { toolCall },
|
|
2328
|
+
...worker === undefined ? {} : { worker }
|
|
2329
|
+
};
|
|
2330
|
+
}
|
|
2331
|
+
var maxFieldBytes = 64 * 1024;
|
|
2332
|
+
function clipObjectField(value, field, clipped) {
|
|
2333
|
+
if (value === undefined) {
|
|
2334
|
+
return;
|
|
2335
|
+
}
|
|
2336
|
+
const found = [];
|
|
2337
|
+
const cut = clipValue(value, field, [], found);
|
|
2338
|
+
const size = byteLength(JSON.stringify(cut));
|
|
2339
|
+
if (size > maxFieldBytes) {
|
|
2340
|
+
clipped.push({ field, path: [], bytes: byteLength(JSON.stringify(value)) });
|
|
2341
|
+
return;
|
|
2342
|
+
}
|
|
2343
|
+
clipped.push(...found);
|
|
2344
|
+
return isObject(cut) ? cut : value;
|
|
2345
|
+
}
|
|
2346
|
+
function clipValue(value, field, path, found) {
|
|
2347
|
+
if (typeof value === "string") {
|
|
2348
|
+
const cut = cutString(value);
|
|
2349
|
+
if (cut === null) {
|
|
2350
|
+
return value;
|
|
2351
|
+
}
|
|
2352
|
+
found.push({ field, path, bytes: cut.bytes });
|
|
2353
|
+
return cut.text;
|
|
2354
|
+
}
|
|
2355
|
+
if (Array.isArray(value)) {
|
|
2356
|
+
return value.map((item, index) => clipValue(item, field, [...path, index], found));
|
|
2357
|
+
}
|
|
2358
|
+
if (isObject(value)) {
|
|
2359
|
+
return Object.fromEntries(Object.entries(value).map(([key, item]) => [
|
|
2360
|
+
key,
|
|
2361
|
+
clipValue(item, field, [...path, key], found)
|
|
2362
|
+
]));
|
|
2363
|
+
}
|
|
2364
|
+
return value;
|
|
2365
|
+
}
|
|
2366
|
+
var decoder = new TextDecoder;
|
|
2367
|
+
function cutString(text) {
|
|
2368
|
+
const bytes = new TextEncoder().encode(text);
|
|
2369
|
+
if (bytes.length <= payloadClipBytes) {
|
|
2370
|
+
return null;
|
|
2371
|
+
}
|
|
2372
|
+
let end = payloadClipBytes;
|
|
2373
|
+
while (end > 0 && ((bytes[end] ?? 0) & 192) === 128) {
|
|
2374
|
+
end -= 1;
|
|
2375
|
+
}
|
|
2376
|
+
return { text: decoder.decode(bytes.subarray(0, end)), bytes: bytes.length };
|
|
2377
|
+
}
|
|
2378
|
+
function isObject(value) {
|
|
2379
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
2380
|
+
}
|
|
2381
|
+
function byteLength(text) {
|
|
2382
|
+
return new TextEncoder().encode(text).length;
|
|
1956
2383
|
}
|
|
1957
2384
|
// src/contract/session-cookie-name.ts
|
|
1958
2385
|
var sessionCookieName = "nixie_session";
|
|
@@ -1964,11 +2391,11 @@ function renderSessionCookie(token) {
|
|
|
1964
2391
|
return `${sessionCookieName}=${token ?? ""}; Path=/; HttpOnly; Secure; SameSite=Lax; Max-Age=${maxAgeS}`;
|
|
1965
2392
|
}
|
|
1966
2393
|
// src/message/task-message-input-schema.ts
|
|
1967
|
-
import { z as
|
|
2394
|
+
import { z as z48 } from "zod";
|
|
1968
2395
|
|
|
1969
2396
|
// src/message/task-message-kind-schema.ts
|
|
1970
|
-
import { z as
|
|
1971
|
-
var taskMessageKindSchema =
|
|
2397
|
+
import { z as z47 } from "zod";
|
|
2398
|
+
var taskMessageKindSchema = z47.enum([
|
|
1972
2399
|
"progress",
|
|
1973
2400
|
"question",
|
|
1974
2401
|
"request",
|
|
@@ -1978,37 +2405,46 @@ var taskMessageKindSchema = z36.enum([
|
|
|
1978
2405
|
]);
|
|
1979
2406
|
|
|
1980
2407
|
// src/message/task-message-input-schema.ts
|
|
1981
|
-
var taskMessageInputSchema =
|
|
1982
|
-
to:
|
|
2408
|
+
var taskMessageInputSchema = z48.object({
|
|
2409
|
+
to: z48.string(),
|
|
1983
2410
|
kind: taskMessageKindSchema,
|
|
1984
|
-
body:
|
|
1985
|
-
replyTo:
|
|
1986
|
-
onBehalfOf:
|
|
1987
|
-
wake:
|
|
2411
|
+
body: z48.string(),
|
|
2412
|
+
replyTo: z48.string().optional(),
|
|
2413
|
+
onBehalfOf: z48.string().array().optional(),
|
|
2414
|
+
wake: z48.boolean().optional()
|
|
1988
2415
|
});
|
|
1989
2416
|
// src/message/task-message-result-schema.ts
|
|
1990
|
-
import { z as
|
|
1991
|
-
var taskMessageResultSchema =
|
|
1992
|
-
messageID:
|
|
1993
|
-
woke:
|
|
1994
|
-
hop:
|
|
1995
|
-
note:
|
|
2417
|
+
import { z as z49 } from "zod";
|
|
2418
|
+
var taskMessageResultSchema = z49.object({
|
|
2419
|
+
messageID: z49.string(),
|
|
2420
|
+
woke: z49.boolean(),
|
|
2421
|
+
hop: z49.int().nonnegative(),
|
|
2422
|
+
note: z49.string().optional()
|
|
1996
2423
|
});
|
|
1997
2424
|
export {
|
|
1998
2425
|
buildPendingInput,
|
|
1999
2426
|
buildQueryUtils,
|
|
2000
2427
|
buildSpanState,
|
|
2001
2428
|
clientHeaderName,
|
|
2429
|
+
clipRecordPayloads,
|
|
2002
2430
|
contract,
|
|
2003
2431
|
forgettableKinds,
|
|
2004
2432
|
hostContract,
|
|
2005
2433
|
imageLimits,
|
|
2006
2434
|
isTimeZone,
|
|
2435
|
+
listedStateSchema,
|
|
2436
|
+
payloadClipBytes,
|
|
2007
2437
|
pickSpanSource,
|
|
2008
2438
|
renderSessionCookie,
|
|
2439
|
+
runFireSchema,
|
|
2440
|
+
scheduleSchema,
|
|
2009
2441
|
sessionCookieName,
|
|
2442
|
+
skipReasonSchema,
|
|
2010
2443
|
spanSchema,
|
|
2011
2444
|
taskMessageInputSchema,
|
|
2012
2445
|
taskMessageKindSchema,
|
|
2013
|
-
taskMessageResultSchema
|
|
2446
|
+
taskMessageResultSchema,
|
|
2447
|
+
triggerAtSchema,
|
|
2448
|
+
triggerSchema,
|
|
2449
|
+
workerViewSchema
|
|
2014
2450
|
};
|