@paradow/ledge-relay 0.62.0 → 0.64.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/{chunk-MMNLRU2E.js → chunk-KNMT653U.js} +1755 -1551
- package/dist/cli.js +1 -1
- package/dist/main.js +1 -1
- package/package.json +1 -1
- package/web/assets/App-CZdQQob4.js +24 -0
- package/web/assets/{boot-CVZrC-BC.js → boot-Df6KxLoV.js} +1 -1
- package/web/assets/index-B7Qk80Pv.css +1 -0
- package/web/assets/index-Cm_-9uqI.js +52 -0
- package/web/assets/label-BjpUvtdY.js +1 -0
- package/web/assets/{xterm-DvXhod87.js → xterm-DbCZs1Jk.js} +1 -1
- package/web/build.json +1 -1
- package/web/index.html +2 -2
- package/web/sw.js +2 -2
- package/web/assets/App-QCFRjB9X.js +0 -24
- package/web/assets/index-8umF5gyB.js +0 -52
- package/web/assets/index-BaysgtGY.css +0 -1
- package/web/assets/label-BS00gz7G.js +0 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { existsSync } from "fs";
|
|
3
3
|
import { join } from "path";
|
|
4
4
|
import { createPrivateKey, createPublicKey, sign, verify } from "crypto";
|
|
5
|
-
import { z as
|
|
5
|
+
import { z as z41 } from "zod";
|
|
6
6
|
|
|
7
7
|
// ../../packages/protocol/src/attachments.ts
|
|
8
8
|
import { z } from "zod";
|
|
@@ -39,7 +39,7 @@ var AttachmentDataSchema = z.object({ type: z.literal("attachment.data"), reques
|
|
|
39
39
|
var AttachmentErrorSchema = z.object({ type: z.literal("attachment.error"), requestId, reason: AttachmentErrorReasonSchema });
|
|
40
40
|
|
|
41
41
|
// ../../packages/protocol/src/chat.ts
|
|
42
|
-
import { z as
|
|
42
|
+
import { z as z13 } from "zod";
|
|
43
43
|
|
|
44
44
|
// ../../packages/protocol/src/session.ts
|
|
45
45
|
import { z as z4 } from "zod";
|
|
@@ -276,7 +276,7 @@ var ModelRefusalSchema = z5.enum(["not_launched", "ended", "no_conversation", "n
|
|
|
276
276
|
var SessionModelAcceptedSchema = z5.object({ type: z5.literal("session.model.accepted"), id: z5.string(), when: z5.enum(["now", "turn", "none"]) });
|
|
277
277
|
|
|
278
278
|
// ../../packages/protocol/src/actions.ts
|
|
279
|
-
import { z as
|
|
279
|
+
import { z as z11 } from "zod";
|
|
280
280
|
|
|
281
281
|
// ../../packages/protocol/src/proposal.ts
|
|
282
282
|
import { z as z6 } from "zod";
|
|
@@ -296,7 +296,7 @@ var TaskBlockSchema = z6.object({
|
|
|
296
296
|
});
|
|
297
297
|
|
|
298
298
|
// ../../packages/protocol/src/tasks.ts
|
|
299
|
-
import { z as
|
|
299
|
+
import { z as z10 } from "zod";
|
|
300
300
|
|
|
301
301
|
// ../../packages/protocol/src/report.ts
|
|
302
302
|
import { z as z8 } from "zod";
|
|
@@ -833,78 +833,224 @@ var ReportAgentResultSchema = z8.object({
|
|
|
833
833
|
reason: z8.string().optional()
|
|
834
834
|
});
|
|
835
835
|
|
|
836
|
+
// ../../packages/protocol/src/routines.ts
|
|
837
|
+
import { z as z9 } from "zod";
|
|
838
|
+
|
|
839
|
+
// ../../packages/protocol/src/names.ts
|
|
840
|
+
var NAME_MAX = 24;
|
|
841
|
+
|
|
842
|
+
// ../../packages/protocol/src/routines.ts
|
|
843
|
+
var WEEKDAYS = ["mon", "tue", "wed", "thu", "fri", "sat", "sun"];
|
|
844
|
+
var WeekdaySchema = z9.enum(WEEKDAYS);
|
|
845
|
+
var RoutineIdSchema = z9.string().regex(/^r[0-9a-f]{6}$/, "not a routine id");
|
|
846
|
+
var ROUTINE_NAME_MAX = 40;
|
|
847
|
+
var RoutineNameSchema = z9.string().regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/, "not a routine name").max(ROUTINE_NAME_MAX);
|
|
848
|
+
var RoutineTimeSchema = z9.string().regex(/^([01]\d|2[0-3]):[0-5]\d$/, "not a time");
|
|
849
|
+
var ROUTINE_TIMES_MAX = 24;
|
|
850
|
+
var ROUTINE_PROMPT_MAX = 8e3;
|
|
851
|
+
var ROUTINE_REASON_MAX = 500;
|
|
852
|
+
var ROUTINES_ACTIVE_MAX = 50;
|
|
853
|
+
var ROUTINES_DONE_MAX = 20;
|
|
854
|
+
var ROUTINES_MAX = ROUTINES_ACTIVE_MAX + ROUTINES_DONE_MAX;
|
|
855
|
+
var ROUTINE_RUNS_MAX = 5;
|
|
856
|
+
var ROUTINE_NEXT_MAX = 3;
|
|
857
|
+
var ROUTINE_ONCE_MAX = 20;
|
|
858
|
+
var PHONE_ROUTINE_CWD_MAX = 512;
|
|
859
|
+
var RoutineKeySchema = z9.string().min(1).max(64);
|
|
860
|
+
var unique = (xs) => new Set(xs).size === xs.length;
|
|
861
|
+
var RoutineDateSchema = z9.string().regex(/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/, "not a date");
|
|
862
|
+
var RoutineDateTimeSchema = z9.string().regex(/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])T([01]\d|2[0-3]):[0-5]\d$/, "not a date-time");
|
|
863
|
+
var ZoneSchema = z9.string().min(1).max(64);
|
|
864
|
+
var RoutineEverySchema = z9.object({ weeks: z9.union([z9.literal(1), z9.literal(2)]), anchor: RoutineDateSchema });
|
|
865
|
+
var RecurringScheduleSchema = z9.object({
|
|
866
|
+
kind: z9.literal("recurring"),
|
|
867
|
+
times: z9.array(RoutineTimeSchema).min(1).max(ROUTINE_TIMES_MAX).refine(unique, "a time twice"),
|
|
868
|
+
days: z9.array(WeekdaySchema).min(1).max(7).refine(unique, "a day twice"),
|
|
869
|
+
every: RoutineEverySchema.optional(),
|
|
870
|
+
tz: ZoneSchema.optional()
|
|
871
|
+
});
|
|
872
|
+
var OnceScheduleSchema = z9.object({
|
|
873
|
+
kind: z9.literal("once"),
|
|
874
|
+
at: z9.array(RoutineDateTimeSchema).min(1).max(ROUTINE_ONCE_MAX).refine(unique, "a moment twice"),
|
|
875
|
+
tz: ZoneSchema.optional()
|
|
876
|
+
});
|
|
877
|
+
var RoutineScheduleSchema = z9.discriminatedUnion("kind", [RecurringScheduleSchema, OnceScheduleSchema]);
|
|
878
|
+
var RoutineTargetSchema = z9.object({
|
|
879
|
+
name: z9.string().trim().min(1).max(NAME_MAX),
|
|
880
|
+
cwd: z9.string().min(1).max(4096),
|
|
881
|
+
tool: ToolSchema,
|
|
882
|
+
model: ModelIdSchema.optional()
|
|
883
|
+
});
|
|
884
|
+
var RoutineCatchUpSchema = z9.enum(["once", "skip"]);
|
|
885
|
+
var RoutineStateSchema = z9.enum(["enabled", "paused", "pending", "done"]);
|
|
886
|
+
var RoutineOutcomeSchema = z9.enum(["delivered", "launched", "resumed", "failed"]);
|
|
887
|
+
var RoutineFieldSchema = z9.enum(["name", "session", "session_untracked", "cwd", "tool", "model", "schedule", "tz", "at", "prompt"]);
|
|
888
|
+
var FieldReadSchema = RoutineFieldSchema.optional().catch(void 0);
|
|
889
|
+
var RoutineCauseSchema = z9.enum(["timeout", "restart", "resume_failed", "launch_failed", "gone"]);
|
|
890
|
+
var RoutineRunSchema = z9.object({
|
|
891
|
+
at: z9.string().datetime(),
|
|
892
|
+
slot: RoutineTimeSchema,
|
|
893
|
+
slotAt: z9.string().datetime().optional(),
|
|
894
|
+
outcome: RoutineOutcomeSchema,
|
|
895
|
+
/** The id of the session the firing reached: typed into (`delivered`), resumed, or launched; none for a failure. */
|
|
896
|
+
session: z9.string().min(1).max(100).optional(),
|
|
897
|
+
reason: z9.string().max(ROUTINE_REASON_MAX).optional(),
|
|
898
|
+
field: FieldReadSchema,
|
|
899
|
+
cause: RoutineCauseSchema.optional().catch(void 0),
|
|
900
|
+
late: z9.literal(true).optional()
|
|
901
|
+
});
|
|
902
|
+
var RoutineCreatorSchema = z9.discriminatedUnion("kind", [
|
|
903
|
+
z9.object({ kind: z9.literal("user") }),
|
|
904
|
+
z9.object({ kind: z9.literal("session"), id: z9.string().min(1).max(100), name: z9.string().max(NAME_MAX) })
|
|
905
|
+
]);
|
|
906
|
+
var RoutineSpecSchema = z9.object({
|
|
907
|
+
name: RoutineNameSchema,
|
|
908
|
+
target: RoutineTargetSchema,
|
|
909
|
+
schedule: RoutineScheduleSchema,
|
|
910
|
+
prompt: z9.string().trim().min(1).max(ROUTINE_PROMPT_MAX),
|
|
911
|
+
catchUp: RoutineCatchUpSchema.optional(),
|
|
912
|
+
expiresAfterRun: z9.literal(true).optional()
|
|
913
|
+
});
|
|
914
|
+
var RoutineProposalSchema = z9.object({
|
|
915
|
+
spec: RoutineSpecSchema,
|
|
916
|
+
by: z9.object({ id: z9.string().min(1).max(100), name: z9.string().max(NAME_MAX) }),
|
|
917
|
+
at: z9.string().datetime()
|
|
918
|
+
});
|
|
919
|
+
var RoutineSchema = RoutineSpecSchema.extend({
|
|
920
|
+
id: RoutineIdSchema,
|
|
921
|
+
catchUp: RoutineCatchUpSchema,
|
|
922
|
+
state: RoutineStateSchema,
|
|
923
|
+
createdBy: RoutineCreatorSchema,
|
|
924
|
+
createdAt: z9.string().datetime(),
|
|
925
|
+
proposal: RoutineProposalSchema.optional(),
|
|
926
|
+
runs: z9.array(RoutineRunSchema).max(ROUTINE_RUNS_MAX).optional(),
|
|
927
|
+
lastRun: RoutineRunSchema.optional(),
|
|
928
|
+
nextRun: z9.string().datetime().optional(),
|
|
929
|
+
nextRuns: z9.array(z9.string().datetime()).max(ROUTINE_NEXT_MAX).optional(),
|
|
930
|
+
/** What an « Activer » applies (the proposal when one waits, else the routine), as the daemon computes it: an approve sends it
|
|
931
|
+
* back as `expect`. Sent to the fronts, never kept. */
|
|
932
|
+
key: RoutineKeySchema.optional()
|
|
933
|
+
});
|
|
934
|
+
var ROUTINE_OPS = ["add", "update", "pause", "resume", "run", "rm", "approve", "refuse"];
|
|
935
|
+
var RoutineOpSchema = z9.enum(ROUTINE_OPS);
|
|
936
|
+
var RoutineRefusalSchema = z9.enum(["not_found", "name_taken", "invalid", "forbidden", "not_pending", "stale"]);
|
|
937
|
+
var RoutineListSchema = z9.object({ type: z9.literal("routine.list"), rid: z9.string().min(1).max(100), by: z9.string().min(1).max(100).optional() });
|
|
938
|
+
var RoutineListedSchema = z9.object({ type: z9.literal("routine.listed"), rid: z9.string(), routines: z9.array(RoutineSchema).max(ROUTINES_MAX), owned: z9.array(RoutineIdSchema).max(ROUTINES_MAX).optional() });
|
|
939
|
+
var RoutineCmdSchema = z9.object({
|
|
940
|
+
type: z9.literal("routine.cmd"),
|
|
941
|
+
rid: z9.string().min(1).max(100),
|
|
942
|
+
op: RoutineOpSchema,
|
|
943
|
+
routine: z9.string().min(1).max(ROUTINE_NAME_MAX).optional(),
|
|
944
|
+
spec: RoutineSpecSchema.optional(),
|
|
945
|
+
patch: RoutineSpecSchema.partial().optional(),
|
|
946
|
+
/** An approve's: the routine's key as the caller showed it (the phone's `routineKey`); the daemon refuses `stale` once it changed,
|
|
947
|
+
* checked as it applies, so nothing changed meanwhile is approved. */
|
|
948
|
+
expect: RoutineKeySchema.optional(),
|
|
949
|
+
/** « Activer les N » / « Refuser les N » of a grouped request: the other routines, each with the key the caller showed. An approve
|
|
950
|
+
* needs every key (`expect` for the first one, and each other's); a refuse needs none, refusing what changed being harmless. All or nothing: every one is checked (waiting, its key, its folder) before any is
|
|
951
|
+
* answered, and none is if one fails. Only for a daemon that says `routineGroups` in its snapshot: an older one drops `others`
|
|
952
|
+
* and would answer the first routine alone. */
|
|
953
|
+
others: z9.array(z9.object({ routine: RoutineIdSchema, expect: RoutineKeySchema.optional() })).max(ROUTINES_ACTIVE_MAX - 1).optional(),
|
|
954
|
+
by: z9.string().min(1).max(100).optional(),
|
|
955
|
+
key: z9.string().min(1).max(128).optional()
|
|
956
|
+
});
|
|
957
|
+
var RoutineResultSchema = z9.object({
|
|
958
|
+
type: z9.literal("routine.result"),
|
|
959
|
+
rid: z9.string(),
|
|
960
|
+
routine: RoutineSchema.optional(),
|
|
961
|
+
removed: RoutineIdSchema.optional(),
|
|
962
|
+
/** A code a reader does not know yet (a newer daemon's) still reads as a refusal: `invalid`. */
|
|
963
|
+
reason: z9.string().max(ROUTINE_REASON_MAX).optional(),
|
|
964
|
+
code: RoutineRefusalSchema.catch("invalid").optional(),
|
|
965
|
+
field: FieldReadSchema
|
|
966
|
+
});
|
|
967
|
+
var RoutineChangedSchema = z9.object({ type: z9.literal("routine.changed"), routine: RoutineSchema.optional(), removed: RoutineIdSchema.optional() });
|
|
968
|
+
var RoutinePreviewSchema = z9.object({ type: z9.literal("routine.preview"), rid: z9.string().min(1).max(100), schedule: RoutineScheduleSchema });
|
|
969
|
+
var RoutinePreviewedSchema = z9.object({ type: z9.literal("routine.previewed"), rid: z9.string(), nextRuns: z9.array(z9.string().datetime()).max(ROUTINE_NEXT_MAX), reason: z9.string().max(ROUTINE_REASON_MAX).optional(), field: FieldReadSchema });
|
|
970
|
+
var TaskRoutineSchema = z9.object({
|
|
971
|
+
kind: z9.enum(["approve", "failed"]),
|
|
972
|
+
id: RoutineIdSchema,
|
|
973
|
+
name: RoutineNameSchema,
|
|
974
|
+
reason: z9.string().max(ROUTINE_REASON_MAX).optional(),
|
|
975
|
+
ids: z9.array(RoutineIdSchema).min(2).max(ROUTINES_ACTIVE_MAX).optional()
|
|
976
|
+
});
|
|
977
|
+
var PHONE_ROUTINE_ACTIONS = ["run", "pause", "resume", "approve", "refuse"];
|
|
978
|
+
var PhoneRoutineActionSchema = z9.enum(PHONE_ROUTINE_ACTIONS);
|
|
979
|
+
|
|
836
980
|
// ../../packages/protocol/src/tasks.ts
|
|
837
981
|
var TASK_TITLE_MAX = 200;
|
|
838
982
|
var TASK_TEXT_MAX = 2e4;
|
|
839
983
|
var TASK_OPS = ["give", "take", "pass", "done", "refuse", "cancel", "drop"];
|
|
840
984
|
var TRANSMISSION_OPS = ["give", "pass", "done", "refuse", "cancel"];
|
|
841
|
-
var TaskLogEntrySchema =
|
|
842
|
-
at:
|
|
843
|
-
by:
|
|
844
|
-
what:
|
|
845
|
-
op:
|
|
846
|
-
from:
|
|
847
|
-
to:
|
|
848
|
-
fromName:
|
|
849
|
-
toName:
|
|
850
|
-
note:
|
|
985
|
+
var TaskLogEntrySchema = z10.object({
|
|
986
|
+
at: z10.string(),
|
|
987
|
+
by: z10.string(),
|
|
988
|
+
what: z10.string(),
|
|
989
|
+
op: z10.enum(TASK_OPS).optional(),
|
|
990
|
+
from: z10.string().optional(),
|
|
991
|
+
to: z10.string().optional(),
|
|
992
|
+
fromName: z10.string().optional(),
|
|
993
|
+
toName: z10.string().optional(),
|
|
994
|
+
note: z10.string().optional()
|
|
851
995
|
});
|
|
852
996
|
var BRAIN_FACT_MAX = 500;
|
|
853
997
|
var BRAIN_SOURCE_MAX = 300;
|
|
854
|
-
var NoteNameSchema =
|
|
855
|
-
var BrainProposalSchema =
|
|
856
|
-
kind:
|
|
998
|
+
var NoteNameSchema = z10.string().regex(/^[A-Za-z0-9][A-Za-z0-9._-]{0,59}$/);
|
|
999
|
+
var BrainProposalSchema = z10.object({
|
|
1000
|
+
kind: z10.enum(["add", "flag"]),
|
|
857
1001
|
note: NoteNameSchema,
|
|
858
|
-
create:
|
|
859
|
-
fact:
|
|
860
|
-
source:
|
|
1002
|
+
create: z10.boolean().optional(),
|
|
1003
|
+
fact: z10.string().trim().min(1).max(BRAIN_FACT_MAX),
|
|
1004
|
+
source: z10.string().trim().min(1).max(BRAIN_SOURCE_MAX).optional(),
|
|
861
1005
|
/** A new note's title and « quand la lire », as the session proposes them (the user may correct them). */
|
|
862
|
-
title:
|
|
863
|
-
when:
|
|
1006
|
+
title: z10.string().trim().min(1).max(200).optional(),
|
|
1007
|
+
when: z10.string().trim().min(1).max(300).optional()
|
|
864
1008
|
});
|
|
865
1009
|
var NOTE_TITLE_MAX = 200;
|
|
866
1010
|
var NOTE_WHEN_MAX = 300;
|
|
867
|
-
var oneLineOf = (max) =>
|
|
868
|
-
var BrainChoiceSchema =
|
|
869
|
-
yes:
|
|
1011
|
+
var oneLineOf = (max) => z10.string().trim().min(1).max(max).refine((s) => !/[\r\n]/.test(s), "one line");
|
|
1012
|
+
var BrainChoiceSchema = z10.object({
|
|
1013
|
+
yes: z10.boolean(),
|
|
870
1014
|
text: oneLineOf(BRAIN_FACT_MAX).optional(),
|
|
871
1015
|
title: oneLineOf(NOTE_TITLE_MAX).optional(),
|
|
872
1016
|
when: oneLineOf(NOTE_WHEN_MAX).optional()
|
|
873
1017
|
}).strict();
|
|
874
|
-
var TaskSchema =
|
|
875
|
-
id:
|
|
876
|
-
title:
|
|
877
|
-
text:
|
|
878
|
-
giver:
|
|
879
|
-
giverName:
|
|
880
|
-
owner:
|
|
881
|
-
ownerName:
|
|
882
|
-
state:
|
|
883
|
-
result:
|
|
1018
|
+
var TaskSchema = z10.object({
|
|
1019
|
+
id: z10.string(),
|
|
1020
|
+
title: z10.string(),
|
|
1021
|
+
text: z10.string().optional(),
|
|
1022
|
+
giver: z10.string(),
|
|
1023
|
+
giverName: z10.string(),
|
|
1024
|
+
owner: z10.string(),
|
|
1025
|
+
ownerName: z10.string(),
|
|
1026
|
+
state: z10.enum(["open", "taken", "done", "refused", "dropped"]),
|
|
1027
|
+
result: z10.string().optional(),
|
|
884
1028
|
/** A task Ledge gave and the user put away from « À toi » once closed. */
|
|
885
|
-
seen:
|
|
886
|
-
at:
|
|
887
|
-
updatedAt:
|
|
888
|
-
log:
|
|
1029
|
+
seen: z10.boolean().optional(),
|
|
1030
|
+
at: z10.string(),
|
|
1031
|
+
updatedAt: z10.string(),
|
|
1032
|
+
log: z10.array(TaskLogEntrySchema),
|
|
889
1033
|
/** A decision about the user's notes: its answer writes them (brain spec §3.6). */
|
|
890
1034
|
brain: BrainProposalSchema.optional(),
|
|
891
1035
|
/** An agent's report (issue #9): « Créer l'issue » (report.create with this task), « Modifier avant », « Ignorer » (report.ignore). */
|
|
892
|
-
report: ReportRequestSchema.optional()
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
1036
|
+
report: ReportRequestSchema.optional(),
|
|
1037
|
+
/** A routine's « À toi » item (routines spec §3.2, §3.4): its buttons send `routine.cmd`, never `task.cmd`. */
|
|
1038
|
+
routine: TaskRoutineSchema.optional()
|
|
1039
|
+
});
|
|
1040
|
+
var TaskCmdSchema = z10.object({
|
|
1041
|
+
type: z10.literal("task.cmd"),
|
|
1042
|
+
rid: z10.string().min(1),
|
|
1043
|
+
by: z10.string().min(1),
|
|
1044
|
+
op: z10.enum(["give", "take", "done", "refuse", "pass", "show", "list", "seen", "cancel"]),
|
|
1045
|
+
task: z10.string().min(1).max(40).optional(),
|
|
1046
|
+
to: z10.string().min(1).optional(),
|
|
1047
|
+
title: z10.string().min(1).max(TASK_TITLE_MAX).optional(),
|
|
1048
|
+
text: z10.string().max(TASK_TEXT_MAX).optional(),
|
|
1049
|
+
all: z10.boolean().optional(),
|
|
1050
|
+
qid: z10.string().min(1).optional(),
|
|
1051
|
+
row: z10.number().int().min(0).max(7).optional(),
|
|
906
1052
|
/** Session `by`'s key (#93, #152): without it, a session only reads (`list`, `show`, `seen`). */
|
|
907
|
-
key:
|
|
1053
|
+
key: z10.string().min(1).max(128).optional(),
|
|
908
1054
|
/** A `give` to `ledge` only: a proposal about the user's notes, whose title and detail the daemon writes. */
|
|
909
1055
|
brain: BrainProposalSchema.optional(),
|
|
910
1056
|
/** An agent's report (issue #9): the daemon's own give, from `report.agent`; a client's `task.cmd` carrying it is refused. */
|
|
@@ -912,17 +1058,17 @@ var TaskCmdSchema = z9.object({
|
|
|
912
1058
|
/** A `done` by Ledge of such a proposal, from its buttons: what to write, instead of reading `text`. */
|
|
913
1059
|
choice: BrainChoiceSchema.optional()
|
|
914
1060
|
});
|
|
915
|
-
var TaskUpdatedSchema =
|
|
916
|
-
var TaskResultSchema =
|
|
917
|
-
type:
|
|
918
|
-
rid:
|
|
1061
|
+
var TaskUpdatedSchema = z10.object({ type: z10.literal("task.updated"), task: TaskSchema });
|
|
1062
|
+
var TaskResultSchema = z10.object({
|
|
1063
|
+
type: z10.literal("task.result"),
|
|
1064
|
+
rid: z10.string(),
|
|
919
1065
|
task: TaskSchema.optional(),
|
|
920
|
-
tasks:
|
|
921
|
-
reason:
|
|
1066
|
+
tasks: z10.array(TaskSchema).optional(),
|
|
1067
|
+
reason: z10.string().optional()
|
|
922
1068
|
});
|
|
923
1069
|
|
|
924
1070
|
// ../../packages/protocol/src/actions.ts
|
|
925
|
-
var ActionRiskSchema =
|
|
1071
|
+
var ActionRiskSchema = z11.enum(["read", "reversible", "destructive"]);
|
|
926
1072
|
var ACTION_IDS = [
|
|
927
1073
|
"session.launch",
|
|
928
1074
|
"session.relay",
|
|
@@ -949,18 +1095,18 @@ var ACTION_IDS = [
|
|
|
949
1095
|
"session.handover",
|
|
950
1096
|
"pr.fix"
|
|
951
1097
|
];
|
|
952
|
-
var ActionIdSchema =
|
|
1098
|
+
var ActionIdSchema = z11.enum(ACTION_IDS);
|
|
953
1099
|
var def = (d) => d;
|
|
954
|
-
var SessionRef =
|
|
955
|
-
var TaskRef =
|
|
1100
|
+
var SessionRef = z11.string().trim().min(1).max(80);
|
|
1101
|
+
var TaskRef = z11.string().trim().min(1).max(40);
|
|
956
1102
|
var LAUNCH_OPTIONS = ["confirm", "launch-rig"];
|
|
957
|
-
var RigAnswer =
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
1103
|
+
var RigAnswer = z11.union([
|
|
1104
|
+
z11.object({ option: z11.string().trim().min(1).max(200) }).strict(),
|
|
1105
|
+
z11.object({ text: z11.string().trim().min(1).max(8e3) }).strict(),
|
|
1106
|
+
z11.object({ seen: z11.literal(true) }).strict()
|
|
961
1107
|
]);
|
|
962
1108
|
var RIG_CHAT_KINDS = ["rig.start", "rig.stop", "rig.restart", "rig.snapshot", "kernel.start", "kernel.stop", "kernel.restart"];
|
|
963
|
-
var RigActArgs =
|
|
1109
|
+
var RigActArgs = z11.object({ kind: z11.enum(RIG_CHAT_KINDS), rig: RigNameSchema.optional() }).refine((a) => a.kind.startsWith("rig.") ? a.rig !== void 0 : a.rig === void 0, "rig names the rig of a rig.* kind, and only of one");
|
|
964
1110
|
var LaunchArgs = ProposalBlockSchema.extend({ model: ModelIdSchema.optional(), effort: EffortSchema.optional() });
|
|
965
1111
|
var ACTIONS = [
|
|
966
1112
|
def({
|
|
@@ -1026,14 +1172,14 @@ var ACTIONS = [
|
|
|
1026
1172
|
phone: null,
|
|
1027
1173
|
risk: "reversible",
|
|
1028
1174
|
max: 8,
|
|
1029
|
-
args:
|
|
1175
|
+
args: z11.object({ session: SessionRef, model: ModelIdSchema.nullable(), effort: EffortSchema.nullable() }),
|
|
1030
1176
|
summary: "changer le mod\xE8le et l'effort d'une session en cours (null : le d\xE9faut de l'agent) ; elle red\xE9marre sur la m\xEAme conversation, \xE0 son prochain moment libre",
|
|
1031
1177
|
when: "quand l'utilisateur demande de passer une session sur un autre mod\xE8le ou un autre effort",
|
|
1032
1178
|
example: { session: "Nova", model: "claude-opus-5-5", effort: "high" }
|
|
1033
1179
|
}),
|
|
1034
1180
|
def({
|
|
1035
1181
|
id: "session.interrupt",
|
|
1036
|
-
args:
|
|
1182
|
+
args: z11.object({ session: SessionRef }),
|
|
1037
1183
|
card: "generic",
|
|
1038
1184
|
phone: null,
|
|
1039
1185
|
risk: "reversible",
|
|
@@ -1044,7 +1190,7 @@ var ACTIONS = [
|
|
|
1044
1190
|
}),
|
|
1045
1191
|
def({
|
|
1046
1192
|
id: "session.archive",
|
|
1047
|
-
args:
|
|
1193
|
+
args: z11.object({ session: SessionRef }),
|
|
1048
1194
|
card: "generic",
|
|
1049
1195
|
phone: null,
|
|
1050
1196
|
risk: "reversible",
|
|
@@ -1055,7 +1201,7 @@ var ACTIONS = [
|
|
|
1055
1201
|
}),
|
|
1056
1202
|
def({
|
|
1057
1203
|
id: "session.restore",
|
|
1058
|
-
args:
|
|
1204
|
+
args: z11.object({ session: SessionRef }),
|
|
1059
1205
|
card: "generic",
|
|
1060
1206
|
phone: null,
|
|
1061
1207
|
risk: "reversible",
|
|
@@ -1066,7 +1212,7 @@ var ACTIONS = [
|
|
|
1066
1212
|
}),
|
|
1067
1213
|
def({
|
|
1068
1214
|
id: "session.resume",
|
|
1069
|
-
args:
|
|
1215
|
+
args: z11.object({ session: SessionRef }),
|
|
1070
1216
|
card: "generic",
|
|
1071
1217
|
phone: "act",
|
|
1072
1218
|
risk: "reversible",
|
|
@@ -1080,7 +1226,7 @@ var ACTIONS = [
|
|
|
1080
1226
|
card: "generic",
|
|
1081
1227
|
phone: "act",
|
|
1082
1228
|
max: 1,
|
|
1083
|
-
args:
|
|
1229
|
+
args: z11.object({ session: SessionRef, decision: z11.enum(["accept", "deny"]), note: z11.string().trim().min(1).max(NOTE_MAX).optional() }),
|
|
1084
1230
|
risk: (a) => a.decision === "accept" ? "destructive" : "reversible",
|
|
1085
1231
|
summary: "accepter ou refuser la demande en attente d'une session (permission, diff ou plan), note possible avec un refus ; jamais \xAB toujours \xBB",
|
|
1086
1232
|
when: "seulement quand l'utilisateur demande explicitement d'accepter ou de refuser la demande d'une session pr\xE9cise, et que sessions.md montre une demande en attente pour elle ; cite la demande telle quelle dans ta r\xE9ponse",
|
|
@@ -1088,7 +1234,7 @@ var ACTIONS = [
|
|
|
1088
1234
|
}),
|
|
1089
1235
|
def({
|
|
1090
1236
|
id: "task.cancel",
|
|
1091
|
-
args:
|
|
1237
|
+
args: z11.object({ task: TaskRef, reason: z11.string().trim().min(1).max(500).optional() }),
|
|
1092
1238
|
card: "generic",
|
|
1093
1239
|
phone: "act",
|
|
1094
1240
|
risk: "destructive",
|
|
@@ -1099,7 +1245,7 @@ var ACTIONS = [
|
|
|
1099
1245
|
}),
|
|
1100
1246
|
def({
|
|
1101
1247
|
id: "task.pass",
|
|
1102
|
-
args:
|
|
1248
|
+
args: z11.object({ task: TaskRef, to: SessionRef, note: z11.string().trim().min(1).max(TASK_TEXT_MAX).optional() }),
|
|
1103
1249
|
card: "generic",
|
|
1104
1250
|
phone: null,
|
|
1105
1251
|
risk: "reversible",
|
|
@@ -1110,7 +1256,7 @@ var ACTIONS = [
|
|
|
1110
1256
|
}),
|
|
1111
1257
|
def({
|
|
1112
1258
|
id: "task.answer",
|
|
1113
|
-
args:
|
|
1259
|
+
args: z11.object({ task: TaskRef, answer: z11.string().trim().min(1).max(TASK_TEXT_MAX) }),
|
|
1114
1260
|
card: "generic",
|
|
1115
1261
|
phone: "act",
|
|
1116
1262
|
risk: "destructive",
|
|
@@ -1125,7 +1271,7 @@ var ACTIONS = [
|
|
|
1125
1271
|
phone: null,
|
|
1126
1272
|
risk: "reversible",
|
|
1127
1273
|
max: 1,
|
|
1128
|
-
args:
|
|
1274
|
+
args: z11.object({ note: NoteNameSchema, fact: z11.string().trim().min(1).max(BRAIN_FACT_MAX).refine((t) => !/[\r\n]/.test(t), "one line"), source: z11.string().trim().min(1).max(BRAIN_SOURCE_MAX).optional() }),
|
|
1129
1275
|
summary: "ajouter un fait durable \xE0 une note de l'utilisateur (context-index.md), dat\xE9 et sign\xE9 \xAB dit par l'utilisateur \xBB, sous \xAB Ajouts \xBB",
|
|
1130
1276
|
when: "seulement quand l'utilisateur dit un fait sur son environnement et demande de le retenir (\xAB retiens que\u2026 \xBB) : note est le nom d'une note de context-index.md (son fichier sans context- ni .md) qui en parle ; aucune ne convient, ou plusieurs : cite-les et demande laquelle ; jamais la valeur d'un secret",
|
|
1131
1277
|
example: { note: "machines", fact: "Legion a 64 Go de RAM" }
|
|
@@ -1143,7 +1289,7 @@ var ACTIONS = [
|
|
|
1143
1289
|
}),
|
|
1144
1290
|
def({
|
|
1145
1291
|
id: "rig.seats",
|
|
1146
|
-
args:
|
|
1292
|
+
args: z11.object({ rig: RigNameSchema, role: RigRoleSchema, count: z11.number().int().min(0).max(9) }),
|
|
1147
1293
|
card: "generic",
|
|
1148
1294
|
phone: "act",
|
|
1149
1295
|
max: 4,
|
|
@@ -1158,7 +1304,7 @@ var ACTIONS = [
|
|
|
1158
1304
|
card: "generic",
|
|
1159
1305
|
phone: "act",
|
|
1160
1306
|
max: 4,
|
|
1161
|
-
args:
|
|
1307
|
+
args: z11.object({ qitem: z11.string().trim().min(1).max(200), answer: RigAnswer }),
|
|
1162
1308
|
// The daemon knows whether the ask proposes a team; here an option that confirms or launches is taken as the destructive one.
|
|
1163
1309
|
risk: (a) => "option" in a.answer && LAUNCH_OPTIONS.includes(a.answer.option) ? "destructive" : "reversible",
|
|
1164
1310
|
summary: "r\xE9pondre, au nom de l'utilisateur, \xE0 une demande de \xAB \xC0 toi \xBB (attentes.md) : une option (option, son id), ses propres mots (text) ou \xAB Vu \xBB sur une nouvelle (seen) ; confirmer un lancement de rig ne se d\xE9fait pas",
|
|
@@ -1171,7 +1317,7 @@ var ACTIONS = [
|
|
|
1171
1317
|
phone: null,
|
|
1172
1318
|
risk: "reversible",
|
|
1173
1319
|
max: 1,
|
|
1174
|
-
args:
|
|
1320
|
+
args: z11.object({ text: z11.string().trim().min(1).max(2e3), folder: z11.string().trim().min(1).max(4096).refine((f) => f.startsWith("/"), "an absolute path").optional() }),
|
|
1175
1321
|
summary: "donner un objectif \xE0 Max, l'orchestrateur d'OpenRig, qui propose l'\xE9quipe ; folder (chemin absolu) seulement s'il est connu",
|
|
1176
1322
|
when: "seulement quand l'utilisateur demande explicitement de donner un objectif aux rigs ; text reprend ses mots, folder un chemin absolu lu dans sessions.md ou folders.md ou donn\xE9 tel quel",
|
|
1177
1323
|
example: { text: "Ajouter la pagination \xE0 /invoices", folder: "/home/alice/projets/api" }
|
|
@@ -1181,7 +1327,7 @@ var ACTIONS = [
|
|
|
1181
1327
|
card: "generic",
|
|
1182
1328
|
phone: "act",
|
|
1183
1329
|
max: 1,
|
|
1184
|
-
args:
|
|
1330
|
+
args: z11.object({ goal: z11.string().trim().min(1).max(100), answer: z11.union([z11.literal("confirm"), z11.object({ text: z11.string().trim().min(1).max(8e3) }).strict()]) }),
|
|
1185
1331
|
risk: (a) => a.answer === "confirm" ? "destructive" : "reversible",
|
|
1186
1332
|
summary: "r\xE9pondre \xE0 Max au sujet d'un objectif (goal, son id de rigs.md) : confirmer l'\xE9quipe qu'il propose (confirm), ou lui \xE9crire (text) ; confirmer un lancement de rig ne se d\xE9fait pas",
|
|
1187
1333
|
when: "seulement quand l'utilisateur demande explicitement de confirmer l'\xE9quipe propos\xE9e pour un objectif ou d'\xE9crire \xE0 Max \xE0 son sujet, et que rigs.md ou attentes.md montre cet objectif ; confirm seulement s'il a dit oui \xE0 cette \xE9quipe",
|
|
@@ -1193,7 +1339,7 @@ var ACTIONS = [
|
|
|
1193
1339
|
phone: null,
|
|
1194
1340
|
risk: "reversible",
|
|
1195
1341
|
max: 4,
|
|
1196
|
-
args:
|
|
1342
|
+
args: z11.object({ rig: RigNameSchema, seat: z11.string().trim().min(1).max(200), text: z11.string().trim().min(1).max(4e3) }),
|
|
1197
1343
|
summary: "\xE9crire \xE0 un si\xE8ge d'un rig qui tourne (rig send) : le texte lui est envoy\xE9 tel quel",
|
|
1198
1344
|
when: "seulement quand l'utilisateur demande explicitement d'\xE9crire \xE0 un si\xE8ge d'un rig ; seat tel que rigs.md le donne (son identifiant ou sa session) ; le texte est formul\xE9 pour l'agent",
|
|
1199
1345
|
example: { rig: "ledge-dev", seat: "dev.back", text: "Peux-tu relire la PR 226 ?" }
|
|
@@ -1204,14 +1350,14 @@ var ACTIONS = [
|
|
|
1204
1350
|
phone: "act",
|
|
1205
1351
|
risk: "reversible",
|
|
1206
1352
|
max: 4,
|
|
1207
|
-
args:
|
|
1353
|
+
args: z11.object({ task: TaskRef, choice: z11.union([z11.enum(["add", "refuse"]), z11.object({ edit: z11.string().trim().min(1).max(BRAIN_FACT_MAX) }).strict()]) }),
|
|
1208
1354
|
summary: "r\xE9pondre \xE0 une proposition de note de \xAB \xC0 toi \xBB (tasks.md) : l'ajouter telle quelle (add), la refuser (refuse), ou l'ajouter corrig\xE9e (edit, le fait corrig\xE9)",
|
|
1209
1355
|
when: "seulement quand l'utilisateur dit s'il veut ajouter, refuser ou corriger une proposition de note de tasks.md",
|
|
1210
1356
|
example: { task: "t91b0d4", choice: "add" }
|
|
1211
1357
|
}),
|
|
1212
1358
|
def({
|
|
1213
1359
|
id: "session.handover",
|
|
1214
|
-
args:
|
|
1360
|
+
args: z11.object({ session: SessionRef }),
|
|
1215
1361
|
card: "generic",
|
|
1216
1362
|
phone: null,
|
|
1217
1363
|
risk: "reversible",
|
|
@@ -1222,7 +1368,7 @@ var ACTIONS = [
|
|
|
1222
1368
|
}),
|
|
1223
1369
|
def({
|
|
1224
1370
|
id: "pr.fix",
|
|
1225
|
-
args:
|
|
1371
|
+
args: z11.object({ pr: z11.string().trim().min(1).max(500), session: SessionRef.optional() }),
|
|
1226
1372
|
card: "generic",
|
|
1227
1373
|
phone: "act",
|
|
1228
1374
|
risk: "reversible",
|
|
@@ -1233,147 +1379,148 @@ var ACTIONS = [
|
|
|
1233
1379
|
})
|
|
1234
1380
|
];
|
|
1235
1381
|
var byId = new Map(ACTIONS.map((a) => [a.id, a]));
|
|
1236
|
-
var ActionBlockSchema =
|
|
1382
|
+
var ActionBlockSchema = z11.object({ action: z11.string().trim().min(1).max(40), args: z11.record(z11.unknown()).default({}) });
|
|
1237
1383
|
|
|
1238
1384
|
// ../../packages/protocol/src/operator.ts
|
|
1239
|
-
import { z as
|
|
1240
|
-
var PointGroupSchema =
|
|
1241
|
-
var PointRefSchema =
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1385
|
+
import { z as z12 } from "zod";
|
|
1386
|
+
var PointGroupSchema = z12.enum(["atoi", "done", "ongoing", "rigs"]);
|
|
1387
|
+
var PointRefSchema = z12.discriminatedUnion("kind", [
|
|
1388
|
+
z12.object({ kind: z12.literal("session.request"), session: z12.string(), key: z12.string() }),
|
|
1389
|
+
z12.object({ kind: z12.literal("rig.ask"), qitem: z12.string() }),
|
|
1390
|
+
z12.object({ kind: z12.literal("task"), task: z12.string() })
|
|
1245
1391
|
]);
|
|
1246
|
-
var PointItemSchema =
|
|
1247
|
-
id:
|
|
1248
|
-
event:
|
|
1392
|
+
var PointItemSchema = z12.object({
|
|
1393
|
+
id: z12.string(),
|
|
1394
|
+
event: z12.number().int(),
|
|
1249
1395
|
group: PointGroupSchema,
|
|
1250
|
-
tone:
|
|
1251
|
-
who:
|
|
1252
|
-
rig:
|
|
1253
|
-
text:
|
|
1254
|
-
sub:
|
|
1255
|
-
at:
|
|
1396
|
+
tone: z12.enum(["perm", "ask", "work", "idle", "off"]),
|
|
1397
|
+
who: z12.string().max(100),
|
|
1398
|
+
rig: z12.string().max(100).optional(),
|
|
1399
|
+
text: z12.string().max(400),
|
|
1400
|
+
sub: z12.string().max(200).optional(),
|
|
1401
|
+
at: z12.string().datetime(),
|
|
1256
1402
|
ref: PointRefSchema.optional(),
|
|
1257
|
-
answers:
|
|
1258
|
-
freeText:
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1403
|
+
answers: z12.array(z12.object({ id: z12.string(), label: z12.string().max(60), style: z12.enum(["primary", "danger", "plain"]) })).max(4).optional(),
|
|
1404
|
+
freeText: z12.boolean().optional(),
|
|
1405
|
+
/** `routine`: a routine's page (its id), which a routine's « À toi » row opens (« Voir »). */
|
|
1406
|
+
nav: z12.array(z12.object({ kind: z12.enum(["session", "pr", "rig", "task", "routine"]), id: z12.string() })).max(2).optional(),
|
|
1407
|
+
suggestion: z12.lazy(() => ChatActionSchema).optional(),
|
|
1408
|
+
settled: z12.object({ at: z12.string().datetime(), where: z12.enum(["terminal", "phone", "desktop", "chat", "elsewhere"]), answer: z12.string().max(60).optional() }).optional(),
|
|
1409
|
+
error: z12.string().max(200).optional()
|
|
1410
|
+
});
|
|
1411
|
+
var ChatPointSchema = z12.object({
|
|
1412
|
+
since: z12.string().datetime(),
|
|
1413
|
+
lead: z12.string().max(300),
|
|
1414
|
+
leadBy: z12.enum(["agent", "daemon"]),
|
|
1415
|
+
items: z12.array(PointItemSchema).max(40),
|
|
1416
|
+
foldedAt: z12.string().datetime().optional(),
|
|
1417
|
+
laterAt: z12.string().datetime().optional()
|
|
1418
|
+
});
|
|
1419
|
+
var OperatorNoticeSchema = z12.object({
|
|
1273
1420
|
/** `decision`: a decision a session put to the user (a task given to Ledge), said at once; its `id` is `decision:<task id>`. */
|
|
1274
|
-
id:
|
|
1275
|
-
kind:
|
|
1276
|
-
qid:
|
|
1277
|
-
text:
|
|
1278
|
-
who:
|
|
1279
|
-
rig:
|
|
1280
|
-
qitem:
|
|
1281
|
-
options:
|
|
1282
|
-
priority:
|
|
1283
|
-
at:
|
|
1284
|
-
});
|
|
1285
|
-
var PointAnswerSchema =
|
|
1421
|
+
id: z12.string(),
|
|
1422
|
+
kind: z12.enum(["point", "rig.ask", "decision"]),
|
|
1423
|
+
qid: z12.string().optional(),
|
|
1424
|
+
text: z12.string().max(300),
|
|
1425
|
+
who: z12.string().max(100).optional(),
|
|
1426
|
+
rig: z12.string().optional(),
|
|
1427
|
+
qitem: z12.string().optional(),
|
|
1428
|
+
options: z12.array(z12.object({ id: z12.string(), label: z12.string().max(60) })).max(3).optional(),
|
|
1429
|
+
priority: z12.enum(["routine", "urgent", "critical"]),
|
|
1430
|
+
at: z12.string().datetime()
|
|
1431
|
+
});
|
|
1432
|
+
var PointAnswerSchema = z12.union([z12.object({ id: z12.string().min(1) }).strict(), z12.object({ text: z12.string().min(1).max(4e3) }).strict()]);
|
|
1286
1433
|
|
|
1287
1434
|
// ../../packages/protocol/src/chat.ts
|
|
1288
|
-
var ChatStepSchema =
|
|
1289
|
-
kind:
|
|
1290
|
-
id:
|
|
1291
|
-
name:
|
|
1292
|
-
path:
|
|
1293
|
-
});
|
|
1294
|
-
var ChatProposalSchema =
|
|
1295
|
-
cwd:
|
|
1296
|
-
project:
|
|
1297
|
-
prompt:
|
|
1435
|
+
var ChatStepSchema = z13.object({
|
|
1436
|
+
kind: z13.enum(["sessions", "pane", "reply", "git", "repo"]),
|
|
1437
|
+
id: z13.string().optional(),
|
|
1438
|
+
name: z13.string().optional(),
|
|
1439
|
+
path: z13.string().optional()
|
|
1440
|
+
});
|
|
1441
|
+
var ChatProposalSchema = z13.object({
|
|
1442
|
+
cwd: z13.string().min(1),
|
|
1443
|
+
project: z13.string(),
|
|
1444
|
+
prompt: z13.string().optional(),
|
|
1298
1445
|
tool: ToolSchema,
|
|
1299
1446
|
/** What Ledge proposed on the card's picker (spec 2026-10-26 action registry §4), the agent's own default when left out. */
|
|
1300
1447
|
model: ModelIdSchema.optional(),
|
|
1301
1448
|
effort: EffortSchema.optional(),
|
|
1302
|
-
launchedId:
|
|
1303
|
-
error:
|
|
1449
|
+
launchedId: z13.string().optional(),
|
|
1450
|
+
error: z13.string().optional()
|
|
1304
1451
|
});
|
|
1305
1452
|
var MAX_PROPOSALS = 8;
|
|
1306
|
-
var ChatProposalsSchema =
|
|
1307
|
-
var ChatRelaySchema =
|
|
1308
|
-
id:
|
|
1309
|
-
name:
|
|
1453
|
+
var ChatProposalsSchema = z13.array(ChatProposalSchema).min(1).max(MAX_PROPOSALS);
|
|
1454
|
+
var ChatRelaySchema = z13.object({
|
|
1455
|
+
id: z13.string().min(1),
|
|
1456
|
+
name: z13.string(),
|
|
1310
1457
|
tool: ToolSchema,
|
|
1311
|
-
text:
|
|
1312
|
-
status:
|
|
1313
|
-
sentAt:
|
|
1314
|
-
error:
|
|
1458
|
+
text: z13.string().min(1),
|
|
1459
|
+
status: z13.enum(["queued", "sent"]).optional(),
|
|
1460
|
+
sentAt: z13.string().datetime().optional(),
|
|
1461
|
+
error: z13.string().optional(),
|
|
1315
1462
|
/** Why it failed, as a code a front words itself (a RefusalCode, `ended`, or `failed` for the machinery); goes with `error`. */
|
|
1316
|
-
code:
|
|
1463
|
+
code: z13.string().max(40).optional()
|
|
1317
1464
|
});
|
|
1318
|
-
var ChatCloseSchema =
|
|
1319
|
-
id:
|
|
1320
|
-
name:
|
|
1465
|
+
var ChatCloseSchema = z13.object({
|
|
1466
|
+
id: z13.string().min(1),
|
|
1467
|
+
name: z13.string(),
|
|
1321
1468
|
tool: ToolSchema,
|
|
1322
|
-
closedAt:
|
|
1323
|
-
how:
|
|
1324
|
-
error:
|
|
1325
|
-
});
|
|
1326
|
-
var ChatClosesSchema =
|
|
1327
|
-
var ChatProjectProposalSchema =
|
|
1328
|
-
name:
|
|
1329
|
-
description:
|
|
1330
|
-
repos:
|
|
1331
|
-
addTo:
|
|
1332
|
-
});
|
|
1333
|
-
var ChatTaskProposalSchema =
|
|
1334
|
-
to:
|
|
1335
|
-
toName:
|
|
1336
|
-
title:
|
|
1337
|
-
text:
|
|
1338
|
-
taskId:
|
|
1339
|
-
ownerName:
|
|
1340
|
-
state:
|
|
1341
|
-
givenAt:
|
|
1342
|
-
error:
|
|
1343
|
-
});
|
|
1344
|
-
var ChatTasksSchema =
|
|
1345
|
-
var ActionVarsSchema =
|
|
1469
|
+
closedAt: z13.string().datetime().optional(),
|
|
1470
|
+
how: z13.enum(["exit", "killed"]).optional(),
|
|
1471
|
+
error: z13.string().optional()
|
|
1472
|
+
});
|
|
1473
|
+
var ChatClosesSchema = z13.array(ChatCloseSchema).min(1).max(MAX_PROPOSALS);
|
|
1474
|
+
var ChatProjectProposalSchema = z13.object({
|
|
1475
|
+
name: z13.string().min(1).max(80),
|
|
1476
|
+
description: z13.string().max(500).optional(),
|
|
1477
|
+
repos: z13.array(z13.object({ path: z13.string().min(1).max(4096), why: z13.string().min(1).max(200) })).min(1).max(50),
|
|
1478
|
+
addTo: z13.string().min(1).max(80).optional()
|
|
1479
|
+
});
|
|
1480
|
+
var ChatTaskProposalSchema = z13.object({
|
|
1481
|
+
to: z13.string().min(1),
|
|
1482
|
+
toName: z13.string().optional(),
|
|
1483
|
+
title: z13.string().min(1).max(200),
|
|
1484
|
+
text: z13.string().max(2e4).optional(),
|
|
1485
|
+
taskId: z13.string().optional(),
|
|
1486
|
+
ownerName: z13.string().optional(),
|
|
1487
|
+
state: z13.enum(["open", "taken", "done", "refused", "dropped"]).optional(),
|
|
1488
|
+
givenAt: z13.string().datetime().optional(),
|
|
1489
|
+
error: z13.string().optional()
|
|
1490
|
+
});
|
|
1491
|
+
var ChatTasksSchema = z13.array(ChatTaskProposalSchema).min(1).max(MAX_PROPOSALS);
|
|
1492
|
+
var ActionVarsSchema = z13.record(z13.string().max(40), z13.string().max(300));
|
|
1346
1493
|
var DETAIL_MAX = 4e3;
|
|
1347
|
-
var ChatActionStateSchema =
|
|
1348
|
-
var ChatActionSchema =
|
|
1349
|
-
action:
|
|
1350
|
-
args:
|
|
1351
|
-
summary:
|
|
1494
|
+
var ChatActionStateSchema = z13.enum(["running", "done", "denied", "failed", "refused"]);
|
|
1495
|
+
var ChatActionSchema = z13.object({
|
|
1496
|
+
action: z13.string().min(1).max(40),
|
|
1497
|
+
args: z13.record(z13.unknown()),
|
|
1498
|
+
summary: z13.string().min(1).max(300),
|
|
1352
1499
|
vars: ActionVarsSchema.optional(),
|
|
1353
|
-
detail:
|
|
1354
|
-
detailCut:
|
|
1500
|
+
detail: z13.string().max(DETAIL_MAX).optional(),
|
|
1501
|
+
detailCut: z13.literal(true).optional(),
|
|
1355
1502
|
risk: ActionRiskSchema,
|
|
1356
|
-
session:
|
|
1503
|
+
session: z13.string().optional(),
|
|
1357
1504
|
/** The sessions an OpenRig step stops, whole (`vars.seats` is cut for the screen): the step is refused if they changed before it applies. */
|
|
1358
|
-
cuts:
|
|
1505
|
+
cuts: z13.array(z13.string().max(200)).max(500).optional(),
|
|
1359
1506
|
state: ChatActionStateSchema.optional(),
|
|
1360
|
-
doneAt:
|
|
1361
|
-
error:
|
|
1362
|
-
code:
|
|
1363
|
-
});
|
|
1364
|
-
var ChatActionsSchema =
|
|
1365
|
-
var ChatTurnSchema =
|
|
1366
|
-
machineId:
|
|
1367
|
-
machineName:
|
|
1368
|
-
choices:
|
|
1369
|
-
qid:
|
|
1370
|
-
question:
|
|
1371
|
-
askedAt:
|
|
1372
|
-
steps:
|
|
1373
|
-
answer:
|
|
1374
|
-
answeredAt:
|
|
1375
|
-
error:
|
|
1376
|
-
errorCause:
|
|
1507
|
+
doneAt: z13.string().datetime().optional(),
|
|
1508
|
+
error: z13.string().optional(),
|
|
1509
|
+
code: z13.string().max(40).optional()
|
|
1510
|
+
});
|
|
1511
|
+
var ChatActionsSchema = z13.array(ChatActionSchema).min(1).max(MAX_PROPOSALS);
|
|
1512
|
+
var ChatTurnSchema = z13.object({
|
|
1513
|
+
machineId: z13.string().optional(),
|
|
1514
|
+
machineName: z13.string().optional(),
|
|
1515
|
+
choices: z13.array(z13.object({ id: z13.string(), label: z13.string() })).optional(),
|
|
1516
|
+
qid: z13.string().min(1),
|
|
1517
|
+
question: z13.string(),
|
|
1518
|
+
askedAt: z13.string().datetime(),
|
|
1519
|
+
steps: z13.array(ChatStepSchema),
|
|
1520
|
+
answer: z13.string().optional(),
|
|
1521
|
+
answeredAt: z13.string().datetime().optional(),
|
|
1522
|
+
error: z13.string().optional(),
|
|
1523
|
+
errorCause: z13.string().max(40).optional(),
|
|
1377
1524
|
proposal: ChatProposalSchema.optional(),
|
|
1378
1525
|
proposals: ChatProposalsSchema.optional(),
|
|
1379
1526
|
relay: ChatRelaySchema.optional(),
|
|
@@ -1381,36 +1528,36 @@ var ChatTurnSchema = z12.object({
|
|
|
1381
1528
|
projectProposal: ChatProjectProposalSchema.optional(),
|
|
1382
1529
|
tasks: ChatTasksSchema.optional(),
|
|
1383
1530
|
actions: ChatActionsSchema.optional(),
|
|
1384
|
-
ignoredAt:
|
|
1385
|
-
attachments:
|
|
1531
|
+
ignoredAt: z13.string().datetime().optional(),
|
|
1532
|
+
attachments: z13.array(AttachmentRefSchema).optional(),
|
|
1386
1533
|
/** When Ledge read the account limits for this answer (`limits.md`): a phone shows the limits under it (M3 Q31). */
|
|
1387
|
-
limitsAt:
|
|
1534
|
+
limitsAt: z13.string().datetime().optional(),
|
|
1388
1535
|
/** `ledge`: a turn Ledge wrote on its own (a point), with an empty `question`; lazy because `operator.ts` imports this file. */
|
|
1389
|
-
by:
|
|
1390
|
-
point:
|
|
1536
|
+
by: z13.literal("ledge").optional(),
|
|
1537
|
+
point: z13.lazy(() => ChatPointSchema).optional()
|
|
1391
1538
|
});
|
|
1392
1539
|
|
|
1393
1540
|
// ../../packages/protocol/src/documents.ts
|
|
1394
|
-
import { z as
|
|
1395
|
-
var path =
|
|
1396
|
-
var requestId2 =
|
|
1397
|
-
var DocumentReadSchema =
|
|
1398
|
-
type:
|
|
1541
|
+
import { z as z14 } from "zod";
|
|
1542
|
+
var path = z14.string().min(1).max(4096);
|
|
1543
|
+
var requestId2 = z14.string().min(1);
|
|
1544
|
+
var DocumentReadSchema = z14.object({
|
|
1545
|
+
type: z14.literal("document.read"),
|
|
1399
1546
|
requestId: requestId2,
|
|
1400
1547
|
path,
|
|
1401
|
-
machineId:
|
|
1402
|
-
sessionId:
|
|
1548
|
+
machineId: z14.string().optional(),
|
|
1549
|
+
sessionId: z14.string().min(1).optional(),
|
|
1403
1550
|
basePath: path.optional()
|
|
1404
1551
|
});
|
|
1405
|
-
var DocumentContentSchema =
|
|
1406
|
-
type:
|
|
1552
|
+
var DocumentContentSchema = z14.object({
|
|
1553
|
+
type: z14.literal("document.content"),
|
|
1407
1554
|
requestId: requestId2,
|
|
1408
1555
|
path,
|
|
1409
|
-
text:
|
|
1410
|
-
bytes:
|
|
1411
|
-
modifiedAt:
|
|
1556
|
+
text: z14.string(),
|
|
1557
|
+
bytes: z14.number().int().nonnegative(),
|
|
1558
|
+
modifiedAt: z14.string().datetime()
|
|
1412
1559
|
});
|
|
1413
|
-
var DocumentErrorCodeSchema =
|
|
1560
|
+
var DocumentErrorCodeSchema = z14.enum([
|
|
1414
1561
|
"not_found",
|
|
1415
1562
|
"not_file",
|
|
1416
1563
|
"unsupported_path",
|
|
@@ -1422,126 +1569,126 @@ var DocumentErrorCodeSchema = z13.enum([
|
|
|
1422
1569
|
"session_missing",
|
|
1423
1570
|
"read_failed"
|
|
1424
1571
|
]);
|
|
1425
|
-
var DocumentErrorSchema =
|
|
1426
|
-
type:
|
|
1572
|
+
var DocumentErrorSchema = z14.object({
|
|
1573
|
+
type: z14.literal("document.error"),
|
|
1427
1574
|
requestId: requestId2,
|
|
1428
1575
|
path,
|
|
1429
1576
|
code: DocumentErrorCodeSchema
|
|
1430
1577
|
});
|
|
1431
1578
|
|
|
1432
1579
|
// ../../packages/protocol/src/browser.ts
|
|
1433
|
-
import { z as
|
|
1434
|
-
var BrowserStateSchema =
|
|
1435
|
-
var BrowserClosedHowSchema =
|
|
1580
|
+
import { z as z15 } from "zod";
|
|
1581
|
+
var BrowserStateSchema = z15.enum(["none", "off", "live", "closed"]);
|
|
1582
|
+
var BrowserClosedHowSchema = z15.enum(["browser", "tabs", "stopped"]);
|
|
1436
1583
|
var BROWSER_URL_MAX = 2048;
|
|
1437
1584
|
var BROWSER_TITLE_MAX = 300;
|
|
1438
1585
|
var BROWSER_FRAME_MAX = 2e6;
|
|
1439
|
-
var url =
|
|
1440
|
-
var page =
|
|
1441
|
-
var title =
|
|
1442
|
-
var BrowserLiveSchema =
|
|
1443
|
-
type:
|
|
1444
|
-
id:
|
|
1586
|
+
var url = z15.string().max(BROWSER_URL_MAX);
|
|
1587
|
+
var page = z15.string().min(1).max(64);
|
|
1588
|
+
var title = z15.string().max(BROWSER_TITLE_MAX);
|
|
1589
|
+
var BrowserLiveSchema = z15.object({
|
|
1590
|
+
type: z15.literal("browser.live"),
|
|
1591
|
+
id: z15.string(),
|
|
1445
1592
|
state: BrowserStateSchema,
|
|
1446
1593
|
url: url.optional(),
|
|
1447
1594
|
title: title.optional(),
|
|
1448
1595
|
/** The page the film shows now (live), or showed last (closed). A front shows a frame only when its `page` is this one. */
|
|
1449
1596
|
page: page.optional(),
|
|
1450
|
-
tabs:
|
|
1451
|
-
since:
|
|
1452
|
-
closedAt:
|
|
1597
|
+
tabs: z15.number().int().nonnegative(),
|
|
1598
|
+
since: z15.string().datetime().optional(),
|
|
1599
|
+
closedAt: z15.string().datetime().optional(),
|
|
1453
1600
|
closed: BrowserClosedHowSchema.optional(),
|
|
1454
|
-
image:
|
|
1455
|
-
});
|
|
1456
|
-
var BrowserFrameSchema =
|
|
1457
|
-
type:
|
|
1458
|
-
id:
|
|
1459
|
-
data:
|
|
1460
|
-
at:
|
|
1461
|
-
width:
|
|
1462
|
-
height:
|
|
1601
|
+
image: z15.object({ at: z15.string().datetime(), url: url.optional(), title: title.optional(), page: page.optional() }).optional()
|
|
1602
|
+
});
|
|
1603
|
+
var BrowserFrameSchema = z15.object({
|
|
1604
|
+
type: z15.literal("browser.frame"),
|
|
1605
|
+
id: z15.string(),
|
|
1606
|
+
data: z15.string().min(1).max(BROWSER_FRAME_MAX),
|
|
1607
|
+
at: z15.string().datetime(),
|
|
1608
|
+
width: z15.number().int().positive().optional(),
|
|
1609
|
+
height: z15.number().int().positive().optional(),
|
|
1463
1610
|
/** The page this image is of (film or kept image): a late frame of another page is told apart by it. */
|
|
1464
1611
|
page: page.optional(),
|
|
1465
|
-
live:
|
|
1466
|
-
});
|
|
1467
|
-
var BrowserWatchSchema =
|
|
1468
|
-
var BrowserUnwatchSchema =
|
|
1469
|
-
var BrowserEnableSchema =
|
|
1470
|
-
var BrowserEnabledSchema =
|
|
1471
|
-
type:
|
|
1472
|
-
rid:
|
|
1473
|
-
outcome:
|
|
1474
|
-
reason:
|
|
1475
|
-
path:
|
|
1612
|
+
live: z15.boolean()
|
|
1613
|
+
});
|
|
1614
|
+
var BrowserWatchSchema = z15.object({ type: z15.literal("browser.watch"), id: z15.string().min(1) });
|
|
1615
|
+
var BrowserUnwatchSchema = z15.object({ type: z15.literal("browser.unwatch"), id: z15.string().min(1) });
|
|
1616
|
+
var BrowserEnableSchema = z15.object({ type: z15.literal("browser.enable"), rid: z15.string().min(1).max(100), confirmed: z15.literal(true) });
|
|
1617
|
+
var BrowserEnabledSchema = z15.object({
|
|
1618
|
+
type: z15.literal("browser.enabled"),
|
|
1619
|
+
rid: z15.string(),
|
|
1620
|
+
outcome: z15.enum(["enabled", "already", "refused"]),
|
|
1621
|
+
reason: z15.enum(["not_configured", "invalid_config", "write_failed"]).optional(),
|
|
1622
|
+
path: z15.string().optional()
|
|
1476
1623
|
});
|
|
1477
1624
|
|
|
1478
1625
|
// ../../packages/protocol/src/term.ts
|
|
1479
|
-
import { z as
|
|
1626
|
+
import { z as z16 } from "zod";
|
|
1480
1627
|
var TERM_CHUNK_B64 = 22e3;
|
|
1481
1628
|
var TERM_PANE_SCREEN_MAX = 65536;
|
|
1482
1629
|
var PANE_INPUT_MAX = 4096;
|
|
1483
|
-
var id =
|
|
1484
|
-
var cols =
|
|
1485
|
-
var rows =
|
|
1486
|
-
var shell =
|
|
1487
|
-
var TermWatchSchema =
|
|
1488
|
-
type:
|
|
1630
|
+
var id = z16.string().min(1).max(200);
|
|
1631
|
+
var cols = z16.number().int().min(2).max(500);
|
|
1632
|
+
var rows = z16.number().int().min(2).max(200);
|
|
1633
|
+
var shell = z16.string().regex(/^[A-Za-z0-9_-]{1,40}$/);
|
|
1634
|
+
var TermWatchSchema = z16.object({
|
|
1635
|
+
type: z16.literal("term.watch"),
|
|
1489
1636
|
id,
|
|
1490
1637
|
cols,
|
|
1491
1638
|
rows,
|
|
1492
|
-
readOnly:
|
|
1493
|
-
});
|
|
1494
|
-
var TermShellSchema =
|
|
1495
|
-
var TermUnwatchSchema =
|
|
1496
|
-
var TermInputSchema =
|
|
1497
|
-
var TermResizeSchema =
|
|
1498
|
-
var PaneExitWhySchema =
|
|
1499
|
-
var TermModesSchema =
|
|
1500
|
-
alt:
|
|
1501
|
-
cursor:
|
|
1502
|
-
appCursor:
|
|
1503
|
-
appKeypad:
|
|
1504
|
-
mouse:
|
|
1505
|
-
sgr:
|
|
1506
|
-
wrap:
|
|
1507
|
-
insert:
|
|
1508
|
-
paste:
|
|
1509
|
-
});
|
|
1510
|
-
var TermOpenedSchema =
|
|
1511
|
-
type:
|
|
1639
|
+
readOnly: z16.literal(true).optional()
|
|
1640
|
+
});
|
|
1641
|
+
var TermShellSchema = z16.object({ type: z16.literal("term.shell"), id, shell, cols, rows });
|
|
1642
|
+
var TermUnwatchSchema = z16.object({ type: z16.literal("term.unwatch"), id, shell: shell.optional() });
|
|
1643
|
+
var TermInputSchema = z16.object({ type: z16.literal("term.input"), id, shell: shell.optional(), data: z16.string().min(1).max(PANE_INPUT_MAX) });
|
|
1644
|
+
var TermResizeSchema = z16.object({ type: z16.literal("term.resize"), id, shell: shell.optional(), cols, rows });
|
|
1645
|
+
var PaneExitWhySchema = z16.enum(["ended", "gone", "failed"]);
|
|
1646
|
+
var TermModesSchema = z16.object({
|
|
1647
|
+
alt: z16.boolean(),
|
|
1648
|
+
cursor: z16.boolean(),
|
|
1649
|
+
appCursor: z16.boolean(),
|
|
1650
|
+
appKeypad: z16.boolean(),
|
|
1651
|
+
mouse: z16.enum(["none", "standard", "button", "any"]),
|
|
1652
|
+
sgr: z16.boolean(),
|
|
1653
|
+
wrap: z16.boolean(),
|
|
1654
|
+
insert: z16.boolean(),
|
|
1655
|
+
paste: z16.boolean().optional()
|
|
1656
|
+
});
|
|
1657
|
+
var TermOpenedSchema = z16.object({
|
|
1658
|
+
type: z16.literal("term.opened"),
|
|
1512
1659
|
id,
|
|
1513
1660
|
shell: shell.optional(),
|
|
1514
1661
|
cols,
|
|
1515
1662
|
rows,
|
|
1516
|
-
screen:
|
|
1517
|
-
cursor:
|
|
1663
|
+
screen: z16.string().max(TERM_PANE_SCREEN_MAX),
|
|
1664
|
+
cursor: z16.object({ x: z16.number().int().nonnegative().max(1e3), y: z16.number().int().nonnegative().max(1e3) }),
|
|
1518
1665
|
/** Absent from an older daemon: the screen is painted with xterm's own modes, as before. */
|
|
1519
1666
|
modes: TermModesSchema.optional(),
|
|
1520
1667
|
/** #299: a free shell with Ledge's integration signs its command lines (OSC 633;E;<line>;<nonce>) with this: an E without it, or
|
|
1521
1668
|
* with another, comes from what a program wrote, not from the shell, and is never run again. Absent: no integration. */
|
|
1522
|
-
nonce:
|
|
1669
|
+
nonce: z16.string().regex(/^[0-9a-f]{32}$/).optional()
|
|
1523
1670
|
});
|
|
1524
|
-
var TermOutputSchema =
|
|
1525
|
-
var TermSizeSchema =
|
|
1526
|
-
var TermExitSchema =
|
|
1671
|
+
var TermOutputSchema = z16.object({ type: z16.literal("term.output"), id, shell: shell.optional(), data: z16.string().min(1).max(TERM_CHUNK_B64) });
|
|
1672
|
+
var TermSizeSchema = z16.object({ type: z16.literal("term.size"), id, shell: shell.optional(), cols, rows });
|
|
1673
|
+
var TermExitSchema = z16.object({ type: z16.literal("term.exit"), id, shell: shell.optional(), why: PaneExitWhySchema });
|
|
1527
1674
|
|
|
1528
1675
|
// ../../packages/protocol/src/machines.ts
|
|
1529
|
-
import { z as
|
|
1676
|
+
import { z as z18 } from "zod";
|
|
1530
1677
|
|
|
1531
1678
|
// ../../packages/protocol/src/ssh.ts
|
|
1532
|
-
import { z as
|
|
1533
|
-
var SshAliasSchema =
|
|
1679
|
+
import { z as z17 } from "zod";
|
|
1680
|
+
var SshAliasSchema = z17.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9_.-]{0,127}$/);
|
|
1534
1681
|
|
|
1535
1682
|
// ../../packages/protocol/src/machines.ts
|
|
1536
|
-
var MachineIdSchema =
|
|
1537
|
-
var MachineSchema =
|
|
1683
|
+
var MachineIdSchema = z18.string().regex(/^[a-zA-Z0-9_-]{1,64}$/);
|
|
1684
|
+
var MachineSchema = z18.object({
|
|
1538
1685
|
id: MachineIdSchema,
|
|
1539
|
-
label:
|
|
1686
|
+
label: z18.string().trim().min(1).max(80),
|
|
1540
1687
|
ssh: SshAliasSchema.optional(),
|
|
1541
1688
|
/** Kept in the list but never connected to: no peer, no retry, no session shown until it is enabled again. */
|
|
1542
|
-
disabled:
|
|
1689
|
+
disabled: z18.boolean().optional()
|
|
1543
1690
|
});
|
|
1544
|
-
var MachinesSchema =
|
|
1691
|
+
var MachinesSchema = z18.array(MachineSchema).min(1).max(20).superRefine((list, ctx) => {
|
|
1545
1692
|
if (list[0]?.id !== "local" || list[0].ssh !== void 0) ctx.addIssue({ code: "custom", message: "the first machine is local, without ssh", path: [0] });
|
|
1546
1693
|
const ids = /* @__PURE__ */ new Set(), aliases = /* @__PURE__ */ new Set();
|
|
1547
1694
|
list.forEach((m, i) => {
|
|
@@ -1557,54 +1704,54 @@ var MachinesSchema = z17.array(MachineSchema).min(1).max(20).superRefine((list,
|
|
|
1557
1704
|
});
|
|
1558
1705
|
|
|
1559
1706
|
// ../../packages/protocol/src/island.ts
|
|
1560
|
-
import { z as
|
|
1561
|
-
var IslandScaleSchema =
|
|
1562
|
-
var IslandPrefsSchema =
|
|
1707
|
+
import { z as z19 } from "zod";
|
|
1708
|
+
var IslandScaleSchema = z19.union([z19.literal("auto"), z19.literal(1), z19.literal(1.25), z19.literal(1.5), z19.literal(2)]);
|
|
1709
|
+
var IslandPrefsSchema = z19.object({
|
|
1563
1710
|
/** Shown at the top of the screen; hidden, Desktop still notifies. */
|
|
1564
|
-
visible:
|
|
1711
|
+
visible: z19.boolean(),
|
|
1565
1712
|
/** `primary` (whichever it is after a reconfiguration), or a monitor's id as the shell lists it (`list_monitors`: the OS
|
|
1566
1713
|
* name, `#index` without one). `second`, written by older fronts, is the first monitor that is not the primary. */
|
|
1567
|
-
screen:
|
|
1568
|
-
position:
|
|
1714
|
+
screen: z19.string().trim().min(1).max(200),
|
|
1715
|
+
position: z19.enum(["center", "left", "right"]),
|
|
1569
1716
|
/** A strip under a maximised window. */
|
|
1570
|
-
discreet:
|
|
1717
|
+
discreet: z19.boolean(),
|
|
1571
1718
|
islandScale: IslandScaleSchema,
|
|
1572
1719
|
panelScale: IslandScaleSchema,
|
|
1573
1720
|
/** What the island shows besides asks and questions, which it always shows. */
|
|
1574
|
-
shows:
|
|
1721
|
+
shows: z19.object({
|
|
1575
1722
|
/** Allow, deny or answer in a line from the island; off, its cards only say « Open in Ledge ». */
|
|
1576
|
-
quick:
|
|
1723
|
+
quick: z19.boolean(),
|
|
1577
1724
|
/** The 6 s bubble when an agent finishes. */
|
|
1578
|
-
finished:
|
|
1725
|
+
finished: z19.boolean(),
|
|
1579
1726
|
/** An agent's sentence in a bubble. */
|
|
1580
|
-
say:
|
|
1727
|
+
say: z19.boolean(),
|
|
1581
1728
|
/** The sub-agents next to their main agent. */
|
|
1582
|
-
helpers:
|
|
1729
|
+
helpers: z19.boolean()
|
|
1583
1730
|
}),
|
|
1584
1731
|
/** The global shortcut that opens the island, as shown (`Ctrl Alt L`). */
|
|
1585
|
-
shortcut:
|
|
1732
|
+
shortcut: z19.string().trim().min(1).max(40)
|
|
1586
1733
|
});
|
|
1587
1734
|
|
|
1588
1735
|
// ../../packages/protocol/src/projects.ts
|
|
1589
|
-
import { z as
|
|
1590
|
-
var ProjectColorSchema =
|
|
1591
|
-
var ProjectIdSchema =
|
|
1736
|
+
import { z as z20 } from "zod";
|
|
1737
|
+
var ProjectColorSchema = z20.enum(["blue", "green", "amber", "violet", "teal", "pink", "red", "slate"]);
|
|
1738
|
+
var ProjectIdSchema = z20.string().regex(/^[a-z0-9][a-z0-9-]{0,63}$/);
|
|
1592
1739
|
function normalizePath(raw) {
|
|
1593
1740
|
const p = raw.trim().replace(/\/+/g, "/");
|
|
1594
1741
|
return p.length > 1 && p.endsWith("/") ? p.slice(0, -1) : p;
|
|
1595
1742
|
}
|
|
1596
|
-
var PathSchema =
|
|
1743
|
+
var PathSchema = z20.string().max(4096).refine((p) => p.startsWith("/") && p === normalizePath(p), "an absolute, normalized path");
|
|
1597
1744
|
var FolderPathSchema = PathSchema;
|
|
1598
|
-
var RepoSchema =
|
|
1599
|
-
var ProjectNameSchema =
|
|
1600
|
-
var ProjectSchema =
|
|
1745
|
+
var RepoSchema = z20.object({ machine: MachineIdSchema, path: PathSchema });
|
|
1746
|
+
var ProjectNameSchema = z20.string().trim().min(1).max(80);
|
|
1747
|
+
var ProjectSchema = z20.object({
|
|
1601
1748
|
id: ProjectIdSchema,
|
|
1602
1749
|
name: ProjectNameSchema,
|
|
1603
1750
|
color: ProjectColorSchema,
|
|
1604
|
-
description:
|
|
1605
|
-
repos:
|
|
1751
|
+
description: z20.string().max(500).default(""),
|
|
1752
|
+
repos: z20.array(RepoSchema).max(50)
|
|
1606
1753
|
});
|
|
1607
|
-
var RuleSchema =
|
|
1754
|
+
var RuleSchema = z20.object({ machine: MachineIdSchema, path: PathSchema, project: ProjectIdSchema });
|
|
1608
1755
|
function projectsProblems(p) {
|
|
1609
1756
|
const out = [];
|
|
1610
1757
|
const ids = /* @__PURE__ */ new Set(), names = /* @__PURE__ */ new Set(), repos = /* @__PURE__ */ new Set(), rules = /* @__PURE__ */ new Set();
|
|
@@ -1630,7 +1777,7 @@ ${rule.path}`;
|
|
|
1630
1777
|
});
|
|
1631
1778
|
return out;
|
|
1632
1779
|
}
|
|
1633
|
-
var ProjectsSchema =
|
|
1780
|
+
var ProjectsSchema = z20.object({ projects: z20.array(ProjectSchema).max(100), rules: z20.array(RuleSchema).max(1e3) }).superRefine((p, ctx) => {
|
|
1634
1781
|
for (const problem of projectsProblems(p)) ctx.addIssue({ code: "custom", message: problem.code, path: problem.path });
|
|
1635
1782
|
});
|
|
1636
1783
|
|
|
@@ -1639,421 +1786,421 @@ var BROADCAST_SESSIONS_MAX = 32;
|
|
|
1639
1786
|
var BROADCAST_LABEL_MAX = 120;
|
|
1640
1787
|
|
|
1641
1788
|
// ../../packages/protocol/src/messages.ts
|
|
1642
|
-
import { z as
|
|
1789
|
+
import { z as z33 } from "zod";
|
|
1643
1790
|
|
|
1644
1791
|
// ../../packages/protocol/src/repos.ts
|
|
1645
|
-
import { z as
|
|
1646
|
-
var ReposInspectSchema =
|
|
1647
|
-
type:
|
|
1648
|
-
requestId:
|
|
1649
|
-
paths:
|
|
1650
|
-
machineId:
|
|
1651
|
-
});
|
|
1652
|
-
var RepoInfoSchema =
|
|
1653
|
-
var ReposInfoSchema =
|
|
1792
|
+
import { z as z21 } from "zod";
|
|
1793
|
+
var ReposInspectSchema = z21.object({
|
|
1794
|
+
type: z21.literal("repos.inspect"),
|
|
1795
|
+
requestId: z21.string().min(1).max(100),
|
|
1796
|
+
paths: z21.array(z21.string().min(1)).min(1).max(50),
|
|
1797
|
+
machineId: z21.string().optional()
|
|
1798
|
+
});
|
|
1799
|
+
var RepoInfoSchema = z21.object({ path: z21.string(), exists: z21.boolean(), branch: z21.string().nullable() });
|
|
1800
|
+
var ReposInfoSchema = z21.object({ type: z21.literal("repos.info"), requestId: z21.string(), repos: z21.array(RepoInfoSchema) });
|
|
1654
1801
|
|
|
1655
1802
|
// ../../packages/protocol/src/commands.ts
|
|
1656
|
-
import { z as
|
|
1657
|
-
var SlashSourceSchema =
|
|
1803
|
+
import { z as z22 } from "zod";
|
|
1804
|
+
var SlashSourceSchema = z22.enum(["builtin", "project", "user", "plugin", "extension"]);
|
|
1658
1805
|
var SLASH_COMMANDS_MAX = 400;
|
|
1659
1806
|
var SLASH_DESCRIPTION_MAX = 300;
|
|
1660
|
-
var SlashCommandSchema =
|
|
1661
|
-
name:
|
|
1662
|
-
description:
|
|
1663
|
-
argumentHint:
|
|
1664
|
-
aliases:
|
|
1807
|
+
var SlashCommandSchema = z22.object({
|
|
1808
|
+
name: z22.string().min(1).max(200),
|
|
1809
|
+
description: z22.string().max(SLASH_DESCRIPTION_MAX).optional(),
|
|
1810
|
+
argumentHint: z22.string().max(200).optional(),
|
|
1811
|
+
aliases: z22.array(z22.string().min(1).max(200)).max(10).optional(),
|
|
1665
1812
|
source: SlashSourceSchema,
|
|
1666
|
-
blocked:
|
|
1667
|
-
bare:
|
|
1668
|
-
});
|
|
1669
|
-
var SessionCommandsSchema =
|
|
1670
|
-
var SessionCommandsListingSchema =
|
|
1671
|
-
type:
|
|
1672
|
-
requestId:
|
|
1673
|
-
id:
|
|
1813
|
+
blocked: z22.enum(["panel", "close"]).optional(),
|
|
1814
|
+
bare: z22.literal("panel").optional()
|
|
1815
|
+
});
|
|
1816
|
+
var SessionCommandsSchema = z22.object({ type: z22.literal("session.commands"), requestId: z22.string().min(1).max(100), id: z22.string() });
|
|
1817
|
+
var SessionCommandsListingSchema = z22.object({
|
|
1818
|
+
type: z22.literal("session.commands.listing"),
|
|
1819
|
+
requestId: z22.string(),
|
|
1820
|
+
id: z22.string(),
|
|
1674
1821
|
tool: ToolSchema.optional(),
|
|
1675
|
-
commands:
|
|
1676
|
-
error:
|
|
1822
|
+
commands: z22.array(SlashCommandSchema).max(SLASH_COMMANDS_MAX),
|
|
1823
|
+
error: z22.string().max(200).optional()
|
|
1677
1824
|
});
|
|
1678
1825
|
|
|
1679
1826
|
// ../../packages/protocol/src/scan.ts
|
|
1680
|
-
import { z as
|
|
1681
|
-
var ReposScanSchema =
|
|
1682
|
-
var FoundRepoSchema =
|
|
1683
|
-
var ReposFoundSchema =
|
|
1827
|
+
import { z as z23 } from "zod";
|
|
1828
|
+
var ReposScanSchema = z23.object({ type: z23.literal("repos.scan"), requestId: z23.string().min(1).max(100), machineId: z23.string().optional() });
|
|
1829
|
+
var FoundRepoSchema = z23.object({ path: z23.string(), branch: z23.string().nullable(), remote: z23.string().optional(), manifest: z23.string().max(200).optional() });
|
|
1830
|
+
var ReposFoundSchema = z23.object({ type: z23.literal("repos.found"), requestId: z23.string(), repos: z23.array(FoundRepoSchema).max(500), truncated: z23.boolean(), error: z23.string().optional() });
|
|
1684
1831
|
|
|
1685
1832
|
// ../../packages/protocol/src/rigMessages.ts
|
|
1686
|
-
import { z as
|
|
1687
|
-
var QitemIdSchema =
|
|
1833
|
+
import { z as z24 } from "zod";
|
|
1834
|
+
var QitemIdSchema = z24.string().regex(/^qitem-[A-Za-z0-9-]{1,120}$/, "not a qitem");
|
|
1688
1835
|
var QITEM = "qitem-[A-Za-z0-9-]+";
|
|
1689
|
-
var RigKindSchema =
|
|
1690
|
-
var RigInfoSchema =
|
|
1836
|
+
var RigKindSchema = z24.enum(["message", "handoff", "unblocked", "openrig", "unreadable"]);
|
|
1837
|
+
var RigInfoSchema = z24.object({
|
|
1691
1838
|
kind: RigKindSchema,
|
|
1692
1839
|
/** The envelope's From, as written (`pilot-lead@ledge-dev-2`, `daemon@kernel`, `ledge@external`, `<unknown sender>`).
|
|
1693
1840
|
* On the seat's own `sent`: absent (it is the seat). The item's `peer` is the Ledge session of that seat, when known. */
|
|
1694
|
-
from:
|
|
1841
|
+
from: z24.string().optional(),
|
|
1695
1842
|
/** The envelope's To, as written (a seat, a list `a, b`, or `broadcast to <rig> (n seats)`); on an outgoing item, the
|
|
1696
1843
|
* destination the command named. */
|
|
1697
|
-
to:
|
|
1844
|
+
to: z24.string().optional(),
|
|
1698
1845
|
/** The envelope's `Sent:` stamp as an ISO time (OpenRig gives no year: the year of receipt, or the year before when
|
|
1699
1846
|
* that would put it in the future). Absent when the envelope has no `Sent:` line. */
|
|
1700
|
-
sentAt:
|
|
1847
|
+
sentAt: z24.string().datetime().optional(),
|
|
1701
1848
|
/** The sender's generation (8 hex), when the stamp carries one. */
|
|
1702
|
-
gen:
|
|
1849
|
+
gen: z24.string().optional(),
|
|
1703
1850
|
/** The row the item is about. `handoff`: the row handed (outgoing: the new row, when the command's output names it);
|
|
1704
1851
|
* `unblocked`: the parked row now pending; `openrig`: the row it names (a stuck sweep: the stalled row). */
|
|
1705
1852
|
qitem: QitemIdSchema.optional(),
|
|
1706
1853
|
/** `handoff`: the row's summary as OpenRig carried it (one line, at most 120 characters, `…` when cut). */
|
|
1707
|
-
summary:
|
|
1854
|
+
summary: z24.string().optional(),
|
|
1708
1855
|
/** `unblocked`: the row whose closing unblocked it. */
|
|
1709
1856
|
blocker: QitemIdSchema.optional(),
|
|
1710
1857
|
/** `openrig`: the recovery row OpenRig opened for it (a stuck sweep comes as a handoff of a `qitem-recovery-…` row). */
|
|
1711
1858
|
recovery: QitemIdSchema.optional(),
|
|
1712
1859
|
/** `openrig`: `stalled` a stuck sweep (a seat that does not move: amber), `custody` a custody check; else absent. */
|
|
1713
|
-
alert:
|
|
1860
|
+
alert: z24.enum(["stalled", "custody"]).optional(),
|
|
1714
1861
|
/** `openrig` with an alert: how long, in minutes, as OpenRig said. */
|
|
1715
|
-
minutes:
|
|
1862
|
+
minutes: z24.number().int().nonnegative().optional(),
|
|
1716
1863
|
/** The seat's own command (an outgoing `sent` or `handoff`): the Bash command, as run. */
|
|
1717
|
-
command:
|
|
1864
|
+
command: z24.string().optional(),
|
|
1718
1865
|
/** OpenRig said the delivery may repeat (`Recovered queue notification`). */
|
|
1719
|
-
recovered:
|
|
1866
|
+
recovered: z24.literal(true).optional(),
|
|
1720
1867
|
/** Received that many times (2 or more): the same block came again, and this item stands for all of them. */
|
|
1721
|
-
count:
|
|
1868
|
+
count: z24.number().int().min(2).optional(),
|
|
1722
1869
|
/** Blocks pasted together in one prompt: the prompt's id, this block's place and how many there were. The front shows
|
|
1723
1870
|
* one raw for the packet, the raws of its items joined. */
|
|
1724
|
-
packet:
|
|
1871
|
+
packet: z24.object({ id: z24.string().min(1), index: z24.number().int().nonnegative(), count: z24.number().int().min(2) }).optional(),
|
|
1725
1872
|
/** The block exactly as received (every delivery, separated by a blank line, when `count` is set); outgoing: the command
|
|
1726
1873
|
* and what it printed. Always there. */
|
|
1727
|
-
raw:
|
|
1874
|
+
raw: z24.string()
|
|
1728
1875
|
});
|
|
1729
1876
|
var HANDOFF = new RegExp(`^Queue handoff: (${QITEM}) - check your queue\\.(?: Summary: (.*))?$`);
|
|
1730
1877
|
var BLOCKER = new RegExp(`^Blocker (${QITEM}) resolved; parked qitem (${QITEM}) is pending\\.`);
|
|
1731
1878
|
var STALLED = new RegExp(`^Stuck sweep: \\S+ on (${QITEM}) \\((\\d+) min\\)`);
|
|
1732
1879
|
var CUSTODY = new RegExp(`^Custody not checked\\b.*?(?:for |of )(${QITEM}).*?\\((\\d+) min\\)`);
|
|
1733
|
-
var RigRowSchema =
|
|
1880
|
+
var RigRowSchema = z24.object({
|
|
1734
1881
|
id: QitemIdSchema,
|
|
1735
|
-
state:
|
|
1736
|
-
summary:
|
|
1882
|
+
state: z24.string().min(1),
|
|
1883
|
+
summary: z24.string().optional(),
|
|
1737
1884
|
/** Who made it and who holds it (seats). */
|
|
1738
|
-
from:
|
|
1739
|
-
to:
|
|
1885
|
+
from: z24.string(),
|
|
1886
|
+
to: z24.string(),
|
|
1740
1887
|
/** `handed-off`: the seat it went to. */
|
|
1741
|
-
handedOffTo:
|
|
1888
|
+
handedOffTo: z24.string().optional(),
|
|
1742
1889
|
/** `blocked`: the row it waits on. */
|
|
1743
|
-
blockedOn:
|
|
1744
|
-
createdAt:
|
|
1745
|
-
claimedAt:
|
|
1746
|
-
updatedAt:
|
|
1890
|
+
blockedOn: z24.string().optional(),
|
|
1891
|
+
createdAt: z24.string(),
|
|
1892
|
+
claimedAt: z24.string().optional(),
|
|
1893
|
+
updatedAt: z24.string(),
|
|
1747
1894
|
/** When Ledge read it. */
|
|
1748
|
-
at:
|
|
1895
|
+
at: z24.string(),
|
|
1749
1896
|
/** The request waits on a prompt (`waiting.liveness.needsInput`): how many, and why (`permission_prompt`…). Only set when `count` > 0. */
|
|
1750
|
-
needsInput:
|
|
1751
|
-
});
|
|
1752
|
-
var OpenRigRowSchema =
|
|
1753
|
-
var OpenRigRowStateSchema =
|
|
1754
|
-
type:
|
|
1755
|
-
requestId:
|
|
1756
|
-
machineId:
|
|
1757
|
-
qitem:
|
|
1897
|
+
needsInput: z24.object({ count: z24.number().int().min(1), reason: z24.string().nullable() }).optional()
|
|
1898
|
+
});
|
|
1899
|
+
var OpenRigRowSchema = z24.object({ type: z24.literal("openrig.row"), requestId: z24.string().min(1).max(100), qitem: QitemIdSchema, machineId: z24.string().optional() });
|
|
1900
|
+
var OpenRigRowStateSchema = z24.object({
|
|
1901
|
+
type: z24.literal("openrig.rowState"),
|
|
1902
|
+
requestId: z24.string(),
|
|
1903
|
+
machineId: z24.string().optional(),
|
|
1904
|
+
qitem: z24.string(),
|
|
1758
1905
|
row: RigRowSchema.optional(),
|
|
1759
|
-
error:
|
|
1760
|
-
});
|
|
1761
|
-
var OpenRigQueueSchema =
|
|
1762
|
-
var OpenRigQueueStateSchema =
|
|
1763
|
-
type:
|
|
1764
|
-
requestId:
|
|
1765
|
-
machineId:
|
|
1766
|
-
rig:
|
|
1767
|
-
rows:
|
|
1768
|
-
truncated:
|
|
1769
|
-
error:
|
|
1906
|
+
error: z24.string().optional()
|
|
1907
|
+
});
|
|
1908
|
+
var OpenRigQueueSchema = z24.object({ type: z24.literal("openrig.queue"), requestId: z24.string().min(1).max(100), machineId: z24.string().optional(), rig: RigNameSchema });
|
|
1909
|
+
var OpenRigQueueStateSchema = z24.object({
|
|
1910
|
+
type: z24.literal("openrig.queueState"),
|
|
1911
|
+
requestId: z24.string(),
|
|
1912
|
+
machineId: z24.string().optional(),
|
|
1913
|
+
rig: z24.string(),
|
|
1914
|
+
rows: z24.array(RigRowSchema),
|
|
1915
|
+
truncated: z24.boolean(),
|
|
1916
|
+
error: z24.string().optional()
|
|
1770
1917
|
});
|
|
1771
1918
|
|
|
1772
1919
|
// ../../packages/protocol/src/openrigRoles.ts
|
|
1773
|
-
import { z as
|
|
1774
|
-
var RoleUnknownWhySchema =
|
|
1775
|
-
var RoleFromSchema =
|
|
1776
|
-
var OriginSchema =
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1920
|
+
import { z as z25 } from "zod";
|
|
1921
|
+
var RoleUnknownWhySchema = z25.enum(["resolved_at_launch", "not_exposed", "unreadable", "ambiguous", "not_found", "missing_from_guidance"]);
|
|
1922
|
+
var RoleFromSchema = z25.enum(["import", "defaults", "profile", "rig", "pod", "member", "launch", "openrig", "plugin", "seat"]);
|
|
1923
|
+
var OriginSchema = z25.discriminatedUnion("kind", [
|
|
1924
|
+
z25.object({ kind: z25.literal("here"), key: z25.string().optional() }),
|
|
1925
|
+
z25.object({ kind: z25.literal("inherited"), from: RoleFromSchema, ref: z25.string().optional(), key: z25.string().optional(), path: z25.string().optional() }),
|
|
1926
|
+
z25.object({ kind: z25.literal("absent") }),
|
|
1927
|
+
z25.object({ kind: z25.literal("unknown"), why: RoleUnknownWhySchema, detail: z25.string().optional() })
|
|
1781
1928
|
]);
|
|
1782
|
-
var SourcedStringSchema =
|
|
1783
|
-
var RoleResourceCategorySchema =
|
|
1784
|
-
var RoleResourceSchema =
|
|
1929
|
+
var SourcedStringSchema = z25.object({ value: z25.string().nullable(), origin: OriginSchema });
|
|
1930
|
+
var RoleResourceCategorySchema = z25.enum(["skill", "guidance", "plugin", "subagent", "runtime_resource"]);
|
|
1931
|
+
var RoleResourceSchema = z25.object({
|
|
1785
1932
|
category: RoleResourceCategorySchema,
|
|
1786
|
-
id:
|
|
1787
|
-
path:
|
|
1788
|
-
absolutePath:
|
|
1789
|
-
runtime:
|
|
1790
|
-
type:
|
|
1791
|
-
target:
|
|
1792
|
-
plugin:
|
|
1933
|
+
id: z25.string(),
|
|
1934
|
+
path: z25.string().optional(),
|
|
1935
|
+
absolutePath: z25.string().optional(),
|
|
1936
|
+
runtime: z25.string().optional(),
|
|
1937
|
+
type: z25.string().optional(),
|
|
1938
|
+
target: z25.string().optional(),
|
|
1939
|
+
plugin: z25.object({ version: z25.string().optional(), skills: z25.array(z25.string()), hooks: z25.number().int().min(0) }).optional(),
|
|
1793
1940
|
origin: OriginSchema
|
|
1794
1941
|
});
|
|
1795
|
-
var RoleUsesListSchema =
|
|
1796
|
-
var StartupLayerSchema =
|
|
1797
|
-
var StartupEntrySchema =
|
|
1798
|
-
kind:
|
|
1799
|
-
path:
|
|
1800
|
-
absolutePath:
|
|
1801
|
-
size:
|
|
1802
|
-
value:
|
|
1803
|
-
builtin:
|
|
1942
|
+
var RoleUsesListSchema = z25.object({ declared: z25.boolean(), key: z25.string(), items: z25.array(RoleResourceSchema) });
|
|
1943
|
+
var StartupLayerSchema = z25.enum(["agent", "profile", "culture", "rig", "pod", "member", "openrig", "seat", "unknown"]);
|
|
1944
|
+
var StartupEntrySchema = z25.object({
|
|
1945
|
+
kind: z25.enum(["file", "action"]),
|
|
1946
|
+
path: z25.string().optional(),
|
|
1947
|
+
absolutePath: z25.string().optional(),
|
|
1948
|
+
size: z25.number().int().min(0).optional(),
|
|
1949
|
+
value: z25.string().optional(),
|
|
1950
|
+
builtin: z25.string().optional(),
|
|
1804
1951
|
layer: StartupLayerSchema,
|
|
1805
|
-
layerInferred:
|
|
1806
|
-
delivery:
|
|
1807
|
-
into:
|
|
1808
|
-
delivered:
|
|
1809
|
-
required:
|
|
1810
|
-
orientation:
|
|
1811
|
-
appliesOn:
|
|
1952
|
+
layerInferred: z25.boolean(),
|
|
1953
|
+
delivery: z25.string(),
|
|
1954
|
+
into: z25.string().optional(),
|
|
1955
|
+
delivered: z25.boolean().optional(),
|
|
1956
|
+
required: z25.boolean().optional(),
|
|
1957
|
+
orientation: z25.string().optional(),
|
|
1958
|
+
appliesOn: z25.array(z25.string()),
|
|
1812
1959
|
origin: OriginSchema
|
|
1813
1960
|
});
|
|
1814
|
-
var RoleFileErrorSchema =
|
|
1815
|
-
var RoleSummarySchema =
|
|
1816
|
-
id:
|
|
1817
|
-
name:
|
|
1818
|
-
version:
|
|
1819
|
-
description:
|
|
1820
|
-
source:
|
|
1821
|
-
path:
|
|
1822
|
-
runtime:
|
|
1823
|
-
importOnly:
|
|
1824
|
-
seats:
|
|
1825
|
-
running:
|
|
1826
|
-
skills:
|
|
1827
|
-
startupFiles:
|
|
1961
|
+
var RoleFileErrorSchema = z25.object({ kind: z25.enum(["missing", "invalid"]), message: z25.string(), line: z25.number().int().optional(), col: z25.number().int().optional() });
|
|
1962
|
+
var RoleSummarySchema = z25.object({
|
|
1963
|
+
id: z25.string(),
|
|
1964
|
+
name: z25.string(),
|
|
1965
|
+
version: z25.string().optional(),
|
|
1966
|
+
description: z25.string().optional(),
|
|
1967
|
+
source: z25.enum(["builtin", "user"]),
|
|
1968
|
+
path: z25.string(),
|
|
1969
|
+
runtime: z25.string().optional(),
|
|
1970
|
+
importOnly: z25.boolean(),
|
|
1971
|
+
seats: z25.number().int().min(0),
|
|
1972
|
+
running: z25.number().int().min(0),
|
|
1973
|
+
skills: z25.array(z25.string()),
|
|
1974
|
+
startupFiles: z25.array(z25.string()),
|
|
1828
1975
|
/** The seats that run it, so a seat of the Rigs page opens its role « seen from » it (`openrig.role` with `id`, then the seat by `rig` + `logicalId`). */
|
|
1829
|
-
seatRefs:
|
|
1830
|
-
error:
|
|
1831
|
-
});
|
|
1832
|
-
var RoleImportSchema =
|
|
1833
|
-
ref:
|
|
1834
|
-
key:
|
|
1835
|
-
name:
|
|
1836
|
-
path:
|
|
1837
|
-
version:
|
|
1838
|
-
resolved:
|
|
1839
|
-
error:
|
|
1840
|
-
});
|
|
1841
|
-
var RoleProfileSchema =
|
|
1842
|
-
name:
|
|
1843
|
-
description:
|
|
1976
|
+
seatRefs: z25.array(z25.object({ rig: z25.string(), logicalId: z25.string(), session: z25.string().optional() })),
|
|
1977
|
+
error: z25.enum(["missing", "invalid"]).optional()
|
|
1978
|
+
});
|
|
1979
|
+
var RoleImportSchema = z25.object({
|
|
1980
|
+
ref: z25.string(),
|
|
1981
|
+
key: z25.string(),
|
|
1982
|
+
name: z25.string().optional(),
|
|
1983
|
+
path: z25.string().optional(),
|
|
1984
|
+
version: z25.string().optional(),
|
|
1985
|
+
resolved: z25.boolean(),
|
|
1986
|
+
error: z25.string().optional()
|
|
1987
|
+
});
|
|
1988
|
+
var RoleProfileSchema = z25.object({
|
|
1989
|
+
name: z25.string(),
|
|
1990
|
+
description: z25.string().optional(),
|
|
1844
1991
|
runtime: SourcedStringSchema,
|
|
1845
1992
|
model: SourcedStringSchema,
|
|
1846
1993
|
effort: SourcedStringSchema,
|
|
1847
|
-
uses:
|
|
1994
|
+
uses: z25.object({ skills: RoleUsesListSchema, guidance: RoleUsesListSchema, subagents: RoleUsesListSchema, plugins: RoleUsesListSchema, runtimeResources: RoleUsesListSchema }),
|
|
1848
1995
|
/** The role's share of the startup: agent then profile files and actions, in that order. */
|
|
1849
|
-
startup:
|
|
1850
|
-
});
|
|
1851
|
-
var RoleSeatSchema =
|
|
1852
|
-
rig:
|
|
1853
|
-
rigId:
|
|
1854
|
-
rigSpecPath:
|
|
1855
|
-
composed:
|
|
1856
|
-
logicalId:
|
|
1857
|
-
session:
|
|
1858
|
-
label:
|
|
1859
|
-
profile:
|
|
1860
|
-
running:
|
|
1861
|
-
activity:
|
|
1996
|
+
startup: z25.array(StartupEntrySchema)
|
|
1997
|
+
});
|
|
1998
|
+
var RoleSeatSchema = z25.object({
|
|
1999
|
+
rig: z25.string(),
|
|
2000
|
+
rigId: z25.string(),
|
|
2001
|
+
rigSpecPath: z25.string().optional(),
|
|
2002
|
+
composed: z25.boolean(),
|
|
2003
|
+
logicalId: z25.string(),
|
|
2004
|
+
session: z25.string().optional(),
|
|
2005
|
+
label: z25.string().optional(),
|
|
2006
|
+
profile: z25.string(),
|
|
2007
|
+
running: z25.boolean(),
|
|
2008
|
+
activity: z25.string(),
|
|
1862
2009
|
runtime: SourcedStringSchema,
|
|
1863
2010
|
model: SourcedStringSchema,
|
|
1864
2011
|
effort: SourcedStringSchema,
|
|
1865
2012
|
cwd: SourcedStringSchema,
|
|
1866
2013
|
cultureFile: SourcedStringSchema,
|
|
1867
|
-
member:
|
|
1868
|
-
memberStartup:
|
|
2014
|
+
member: z25.string().optional(),
|
|
2015
|
+
memberStartup: z25.array(StartupEntrySchema),
|
|
1869
2016
|
/** The Role tab of this seat: its role guidance (`role.md`), then the startup files of its own (member layer), in delivery
|
|
1870
2017
|
* order — OpenRig's when the seat was launched, else the spec's. */
|
|
1871
|
-
roleDocs:
|
|
1872
|
-
live:
|
|
1873
|
-
resolvedSpec:
|
|
1874
|
-
resources:
|
|
2018
|
+
roleDocs: z25.array(StartupEntrySchema),
|
|
2019
|
+
live: z25.object({
|
|
2020
|
+
resolvedSpec: z25.object({ name: z25.string().optional(), version: z25.string().optional(), hash: z25.string().optional() }),
|
|
2021
|
+
resources: z25.array(RoleResourceSchema),
|
|
1875
2022
|
/** In the order OpenRig returns them. */
|
|
1876
|
-
startup:
|
|
2023
|
+
startup: z25.array(StartupEntrySchema),
|
|
1877
2024
|
/** `rig skill loadout --seat`: the skills projected for this seat; absent when it could not be read. */
|
|
1878
|
-
skills:
|
|
2025
|
+
skills: z25.array(z25.object({ id: z25.string(), trigger: z25.string().optional() })).optional()
|
|
1879
2026
|
}).optional()
|
|
1880
2027
|
});
|
|
1881
|
-
var RoleUnavailableSchema =
|
|
1882
|
-
var RoleDetailSchema =
|
|
2028
|
+
var RoleUnavailableSchema = z25.enum(["harness_prompt", "effective_settings", "delivered_content", "harness_own_files"]);
|
|
2029
|
+
var RoleDetailSchema = z25.object({
|
|
1883
2030
|
summary: RoleSummarySchema,
|
|
1884
|
-
file:
|
|
1885
|
-
path:
|
|
1886
|
-
relativePath:
|
|
1887
|
-
modifiedAt:
|
|
1888
|
-
copies:
|
|
2031
|
+
file: z25.object({
|
|
2032
|
+
path: z25.string(),
|
|
2033
|
+
relativePath: z25.string().optional(),
|
|
2034
|
+
modifiedAt: z25.string().optional(),
|
|
2035
|
+
copies: z25.array(z25.object({ kind: z25.literal("repo"), path: z25.string(), identical: z25.boolean(), modifiedAt: z25.string().optional() }))
|
|
1889
2036
|
}),
|
|
1890
2037
|
error: RoleFileErrorSchema.optional(),
|
|
1891
|
-
role:
|
|
1892
|
-
defaults:
|
|
1893
|
-
imports:
|
|
1894
|
-
importedBy:
|
|
1895
|
-
profiles:
|
|
2038
|
+
role: z25.object({ path: z25.string(), absolutePath: z25.string(), origin: OriginSchema }).nullable(),
|
|
2039
|
+
defaults: z25.object({ runtime: SourcedStringSchema, model: SourcedStringSchema, effort: SourcedStringSchema }),
|
|
2040
|
+
imports: z25.array(RoleImportSchema),
|
|
2041
|
+
importedBy: z25.array(z25.string()),
|
|
2042
|
+
profiles: z25.array(RoleProfileSchema),
|
|
1896
2043
|
/** What the file declares in `resources`. */
|
|
1897
|
-
resources:
|
|
1898
|
-
seats:
|
|
1899
|
-
unavailable:
|
|
1900
|
-
warnings:
|
|
1901
|
-
openrigVersion:
|
|
1902
|
-
});
|
|
1903
|
-
var RoleErrorSchema =
|
|
1904
|
-
var LibraryIdSchema =
|
|
1905
|
-
var OpenRigRolesSchema =
|
|
1906
|
-
var OpenRigRoleListSchema =
|
|
1907
|
-
type:
|
|
1908
|
-
requestId:
|
|
1909
|
-
machineId:
|
|
1910
|
-
roles:
|
|
1911
|
-
openrigVersion:
|
|
2044
|
+
resources: z25.array(RoleResourceSchema),
|
|
2045
|
+
seats: z25.array(RoleSeatSchema),
|
|
2046
|
+
unavailable: z25.array(RoleUnavailableSchema),
|
|
2047
|
+
warnings: z25.array(z25.string()),
|
|
2048
|
+
openrigVersion: z25.string().optional()
|
|
2049
|
+
});
|
|
2050
|
+
var RoleErrorSchema = z25.string();
|
|
2051
|
+
var LibraryIdSchema = z25.string().min(1).max(200).regex(/^[A-Za-z0-9][A-Za-z0-9._:-]*$/, "not a library id");
|
|
2052
|
+
var OpenRigRolesSchema = z25.object({ type: z25.literal("openrig.roles"), requestId: z25.string().min(1).max(100), machineId: z25.string().optional() });
|
|
2053
|
+
var OpenRigRoleListSchema = z25.object({
|
|
2054
|
+
type: z25.literal("openrig.roleList"),
|
|
2055
|
+
requestId: z25.string(),
|
|
2056
|
+
machineId: z25.string().optional(),
|
|
2057
|
+
roles: z25.array(RoleSummarySchema),
|
|
2058
|
+
openrigVersion: z25.string().optional(),
|
|
1912
2059
|
error: RoleErrorSchema.optional()
|
|
1913
2060
|
});
|
|
1914
|
-
var OpenRigRoleSchema =
|
|
1915
|
-
var OpenRigRoleDetailSchema =
|
|
1916
|
-
type:
|
|
1917
|
-
requestId:
|
|
1918
|
-
machineId:
|
|
1919
|
-
roleId:
|
|
2061
|
+
var OpenRigRoleSchema = z25.object({ type: z25.literal("openrig.role"), requestId: z25.string().min(1).max(100), machineId: z25.string().optional(), roleId: LibraryIdSchema });
|
|
2062
|
+
var OpenRigRoleDetailSchema = z25.object({
|
|
2063
|
+
type: z25.literal("openrig.roleDetail"),
|
|
2064
|
+
requestId: z25.string(),
|
|
2065
|
+
machineId: z25.string().optional(),
|
|
2066
|
+
roleId: z25.string(),
|
|
1920
2067
|
role: RoleDetailSchema.optional(),
|
|
1921
2068
|
error: RoleErrorSchema.optional()
|
|
1922
2069
|
});
|
|
1923
|
-
var OpenRigRoleFileSchema =
|
|
1924
|
-
type:
|
|
1925
|
-
requestId:
|
|
1926
|
-
machineId:
|
|
2070
|
+
var OpenRigRoleFileSchema = z25.object({
|
|
2071
|
+
type: z25.literal("openrig.roleFile"),
|
|
2072
|
+
requestId: z25.string().min(1).max(100),
|
|
2073
|
+
machineId: z25.string().optional(),
|
|
1927
2074
|
roleId: LibraryIdSchema,
|
|
1928
|
-
path:
|
|
1929
|
-
});
|
|
1930
|
-
var OpenRigRoleFileContentSchema =
|
|
1931
|
-
type:
|
|
1932
|
-
requestId:
|
|
1933
|
-
machineId:
|
|
1934
|
-
roleId:
|
|
1935
|
-
path:
|
|
1936
|
-
content:
|
|
1937
|
-
size:
|
|
1938
|
-
truncated:
|
|
2075
|
+
path: z25.string().min(1).max(4096)
|
|
2076
|
+
});
|
|
2077
|
+
var OpenRigRoleFileContentSchema = z25.object({
|
|
2078
|
+
type: z25.literal("openrig.roleFileContent"),
|
|
2079
|
+
requestId: z25.string(),
|
|
2080
|
+
machineId: z25.string().optional(),
|
|
2081
|
+
roleId: z25.string(),
|
|
2082
|
+
path: z25.string(),
|
|
2083
|
+
content: z25.string().optional(),
|
|
2084
|
+
size: z25.number().int().min(0).optional(),
|
|
2085
|
+
truncated: z25.boolean().optional(),
|
|
1939
2086
|
error: RoleErrorSchema.optional()
|
|
1940
2087
|
});
|
|
1941
|
-
var OpenRigRoleDuplicateSchema =
|
|
1942
|
-
type:
|
|
1943
|
-
requestId:
|
|
1944
|
-
machineId:
|
|
2088
|
+
var OpenRigRoleDuplicateSchema = z25.object({
|
|
2089
|
+
type: z25.literal("openrig.role.duplicate"),
|
|
2090
|
+
requestId: z25.string().min(1).max(100),
|
|
2091
|
+
machineId: z25.string().optional(),
|
|
1945
2092
|
roleId: LibraryIdSchema,
|
|
1946
2093
|
name: RigNameSchema
|
|
1947
2094
|
});
|
|
1948
|
-
var OpenRigRoleDuplicatedSchema =
|
|
1949
|
-
type:
|
|
1950
|
-
requestId:
|
|
1951
|
-
machineId:
|
|
1952
|
-
ok:
|
|
1953
|
-
roleId:
|
|
1954
|
-
path:
|
|
2095
|
+
var OpenRigRoleDuplicatedSchema = z25.object({
|
|
2096
|
+
type: z25.literal("openrig.roleDuplicated"),
|
|
2097
|
+
requestId: z25.string(),
|
|
2098
|
+
machineId: z25.string().optional(),
|
|
2099
|
+
ok: z25.boolean(),
|
|
2100
|
+
roleId: z25.string().optional(),
|
|
2101
|
+
path: z25.string().optional(),
|
|
1955
2102
|
error: RoleErrorSchema.optional()
|
|
1956
2103
|
});
|
|
1957
2104
|
var ROLE_FILE_MAX = 512 * 1024;
|
|
1958
2105
|
|
|
1959
2106
|
// ../../packages/protocol/src/routing.ts
|
|
1960
|
-
import { z as
|
|
1961
|
-
var MachineInventorySchema =
|
|
1962
|
-
id:
|
|
1963
|
-
label:
|
|
1964
|
-
online:
|
|
1965
|
-
local:
|
|
1966
|
-
sessions:
|
|
1967
|
-
folders:
|
|
1968
|
-
});
|
|
1969
|
-
var RoutingContextSchema =
|
|
1970
|
-
machines:
|
|
1971
|
-
history:
|
|
1972
|
-
});
|
|
1973
|
-
var RouteResultSchema =
|
|
2107
|
+
import { z as z26 } from "zod";
|
|
2108
|
+
var MachineInventorySchema = z26.object({
|
|
2109
|
+
id: z26.string().min(1).max(80),
|
|
2110
|
+
label: z26.string().min(1).max(120),
|
|
2111
|
+
online: z26.boolean(),
|
|
2112
|
+
local: z26.boolean(),
|
|
2113
|
+
sessions: z26.array(z26.object({ id: z26.string(), name: z26.string(), project: z26.string(), cwd: z26.string(), topic: z26.string().optional(), state: z26.string(), readOnly: z26.boolean() })).max(500),
|
|
2114
|
+
folders: z26.array(z26.object({ project: z26.string(), cwd: z26.string() })).max(100)
|
|
2115
|
+
});
|
|
2116
|
+
var RoutingContextSchema = z26.object({
|
|
2117
|
+
machines: z26.array(MachineInventorySchema).min(1).max(20),
|
|
2118
|
+
history: z26.array(z26.object({ question: z26.string().max(2e4), answer: z26.string().max(2e4).optional(), machineId: z26.string().optional() })).max(50)
|
|
2119
|
+
});
|
|
2120
|
+
var RouteResultSchema = z26.object({
|
|
1974
2121
|
/** Null means an answer or a clarification, never an implicit local destination. */
|
|
1975
|
-
machineId:
|
|
1976
|
-
text:
|
|
1977
|
-
choices:
|
|
2122
|
+
machineId: z26.string().nullable(),
|
|
2123
|
+
text: z26.string().min(1).max(2e4),
|
|
2124
|
+
choices: z26.array(z26.string()).max(20).optional()
|
|
1978
2125
|
});
|
|
1979
2126
|
|
|
1980
2127
|
// ../../packages/protocol/src/thread.ts
|
|
1981
|
-
import { z as
|
|
1982
|
-
var ToolStatusSchema =
|
|
1983
|
-
var FileChangeSchema =
|
|
1984
|
-
var base = { id:
|
|
1985
|
-
var ThreadItemSchema =
|
|
1986
|
-
|
|
1987
|
-
|
|
2128
|
+
import { z as z27 } from "zod";
|
|
2129
|
+
var ToolStatusSchema = z27.enum(["running", "success", "failed", "unknown"]);
|
|
2130
|
+
var FileChangeSchema = z27.object({ path: z27.string().min(1), from: z27.string().min(1).optional(), change: z27.enum(["add", "edit", "delete", "write"]), diff: z27.string().optional() });
|
|
2131
|
+
var base = { id: z27.string().min(1), at: z27.string().datetime(), turn: z27.number().int().nonnegative(), helperId: z27.string().optional() };
|
|
2132
|
+
var ThreadItemSchema = z27.discriminatedUnion("kind", [
|
|
2133
|
+
z27.object({ kind: z27.literal("prompt"), ...base, text: z27.string(), images: z27.array(AttachmentRefSchema).optional() }),
|
|
2134
|
+
z27.object({ kind: z27.literal("message"), ...base, text: z27.string() }),
|
|
1988
2135
|
/** `id` is the harness's tool_use_id when it gives one, so the result updates the same row; `byClose`: a question
|
|
1989
2136
|
* dismissed by Ledge closing the session. */
|
|
1990
|
-
|
|
1991
|
-
kind:
|
|
2137
|
+
z27.object({
|
|
2138
|
+
kind: z27.literal("tool"),
|
|
1992
2139
|
...base,
|
|
1993
|
-
tool:
|
|
1994
|
-
label:
|
|
1995
|
-
input:
|
|
1996
|
-
output:
|
|
1997
|
-
error:
|
|
2140
|
+
tool: z27.string(),
|
|
2141
|
+
label: z27.string(),
|
|
2142
|
+
input: z27.string().optional(),
|
|
2143
|
+
output: z27.string().optional(),
|
|
2144
|
+
error: z27.string().optional(),
|
|
1998
2145
|
status: ToolStatusSchema,
|
|
1999
|
-
durationMs:
|
|
2000
|
-
files:
|
|
2001
|
-
byClose:
|
|
2146
|
+
durationMs: z27.number().nonnegative().optional(),
|
|
2147
|
+
files: z27.array(FileChangeSchema).default([]),
|
|
2148
|
+
byClose: z27.literal(true).optional(),
|
|
2002
2149
|
/** Images the tool returned (a browser screenshot), in order; `imagesDropped`: some were not kept. */
|
|
2003
|
-
images:
|
|
2004
|
-
imagesDropped:
|
|
2150
|
+
images: z27.array(AttachmentRefSchema).max(ATTACHMENTS_MAX).optional(),
|
|
2151
|
+
imagesDropped: z27.literal(true).optional()
|
|
2005
2152
|
}),
|
|
2006
2153
|
/** `unknown`: answered in the terminal, the daemon only saw the prompt go away; `always`: allowed and not asked again;
|
|
2007
2154
|
* `byClose`: denied by Ledge closing the session; `by`: who answered it from Ledge (the PC or a device, its name then). */
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2155
|
+
z27.object({ kind: z27.literal("permission"), ...base, tool: z27.string(), text: z27.string(), decision: z27.enum(["accept", "deny", "always", "unknown"]).optional(), byClose: z27.literal(true).optional(), by: DecidedBySchema.optional() }),
|
|
2156
|
+
z27.object({ kind: z27.literal("reply"), ...base, text: z27.string() }),
|
|
2157
|
+
z27.object({ kind: z27.literal("helper"), ...base, task: z27.string(), agentType: z27.string().optional(), state: z27.enum(["working", "exited"]) }),
|
|
2011
2158
|
/** A message this session sent to another agent; `id` is the tool_use_id, `to` the address it used, `peer` the Ledge session id, `received` the paired item's id in the peer's thread, `via` set when Ledge's mailbox carries it. */
|
|
2012
|
-
|
|
2013
|
-
kind:
|
|
2159
|
+
z27.object({
|
|
2160
|
+
kind: z27.literal("sent"),
|
|
2014
2161
|
...base,
|
|
2015
|
-
to:
|
|
2016
|
-
peer:
|
|
2017
|
-
summary:
|
|
2018
|
-
text:
|
|
2019
|
-
status:
|
|
2020
|
-
received:
|
|
2021
|
-
via:
|
|
2162
|
+
to: z27.string(),
|
|
2163
|
+
peer: z27.string().optional(),
|
|
2164
|
+
summary: z27.string().optional(),
|
|
2165
|
+
text: z27.string(),
|
|
2166
|
+
status: z27.enum(["sending", "delivered", "read", "failed"]),
|
|
2167
|
+
received: z27.string().optional(),
|
|
2168
|
+
via: z27.literal("ledge").optional(),
|
|
2022
2169
|
/** The seat's own `rig send` (its Bash call), docs/mockups/ledge-openrig-messages.html: `rig.command` is what it ran. */
|
|
2023
2170
|
rig: RigInfoSchema.optional()
|
|
2024
2171
|
}),
|
|
2025
2172
|
/** A message another agent sent to this session; `from` is its from-name (else its address), `sent` the paired item's id in the peer's thread. */
|
|
2026
|
-
|
|
2027
|
-
kind:
|
|
2173
|
+
z27.object({
|
|
2174
|
+
kind: z27.literal("received"),
|
|
2028
2175
|
...base,
|
|
2029
|
-
from:
|
|
2030
|
-
peer:
|
|
2031
|
-
text:
|
|
2032
|
-
sent:
|
|
2176
|
+
from: z27.string(),
|
|
2177
|
+
peer: z27.string().optional(),
|
|
2178
|
+
text: z27.string(),
|
|
2179
|
+
sent: z27.string().optional(),
|
|
2033
2180
|
/** An OpenRig `rig send` typed into this seat (`rig.kind` `message`): `from` is the envelope's sender, `text` its body. */
|
|
2034
2181
|
rig: RigInfoSchema.optional()
|
|
2035
2182
|
}),
|
|
2036
2183
|
/** An automated notice of the agent's harness about messages between sessions (Claude Code's `[Cross-session idle
|
|
2037
2184
|
* notice]` / `[Cross-session delivery notice]`): a system event, never the user's words. `name` is the session it is
|
|
2038
2185
|
* about as quoted, `peer` its Ledge session id; a delivery notice says the outcome of `count` messages to `recipients`. */
|
|
2039
|
-
|
|
2040
|
-
kind:
|
|
2186
|
+
z27.object({
|
|
2187
|
+
kind: z27.literal("notice"),
|
|
2041
2188
|
...base,
|
|
2042
|
-
notice:
|
|
2189
|
+
notice: z27.enum(["idle", "exited", "unavailable", "expired", "delivery", "other"]),
|
|
2043
2190
|
/** An `other` notice from Ledge: `task`, the task a `<ledge-task>` is about. An older front, which does not know it, shows it as any other notice. */
|
|
2044
|
-
task:
|
|
2191
|
+
task: z27.string().optional(),
|
|
2045
2192
|
/** A task this session handed over (`outgoing`), and how (issue #92). */
|
|
2046
|
-
taskOp:
|
|
2047
|
-
outgoing:
|
|
2048
|
-
name:
|
|
2049
|
-
peer:
|
|
2050
|
-
time:
|
|
2051
|
-
summary:
|
|
2052
|
-
status:
|
|
2053
|
-
count:
|
|
2054
|
-
recipients:
|
|
2055
|
-
reason:
|
|
2056
|
-
text:
|
|
2193
|
+
taskOp: z27.enum(TRANSMISSION_OPS).optional(),
|
|
2194
|
+
outgoing: z27.literal(true).optional(),
|
|
2195
|
+
name: z27.string().optional(),
|
|
2196
|
+
peer: z27.string().optional(),
|
|
2197
|
+
time: z27.string().optional(),
|
|
2198
|
+
summary: z27.string().optional(),
|
|
2199
|
+
status: z27.enum(["held", "denied", "expired", "delivered", "refused", "dropped", "unknown"]).optional(),
|
|
2200
|
+
count: z27.number().int().positive().optional(),
|
|
2201
|
+
recipients: z27.array(z27.string()).optional(),
|
|
2202
|
+
reason: z27.string().optional(),
|
|
2203
|
+
text: z27.string(),
|
|
2057
2204
|
/** An OpenRig block that is not a message: a row handed to this seat or passed by it (`handoff`, `outgoing` for its own),
|
|
2058
2205
|
* a row unblocked, OpenRig's own notice, or an unreadable block; `text` is the body (unreadable: the block as is). */
|
|
2059
2206
|
rig: RigInfoSchema.optional()
|
|
@@ -2061,11 +2208,11 @@ var ThreadItemSchema = z26.discriminatedUnion("kind", [
|
|
|
2061
2208
|
]);
|
|
2062
2209
|
|
|
2063
2210
|
// ../../packages/protocol/src/mobile.ts
|
|
2064
|
-
import { z as
|
|
2065
|
-
var RelayUrlSchema =
|
|
2211
|
+
import { z as z28 } from "zod";
|
|
2212
|
+
var RelayUrlSchema = z28.string().transform((v, ctx) => {
|
|
2066
2213
|
const bad = () => {
|
|
2067
|
-
ctx.addIssue({ code:
|
|
2068
|
-
return
|
|
2214
|
+
ctx.addIssue({ code: z28.ZodIssueCode.custom, message: "invalid relay URL" });
|
|
2215
|
+
return z28.NEVER;
|
|
2069
2216
|
};
|
|
2070
2217
|
let u;
|
|
2071
2218
|
try {
|
|
@@ -2078,168 +2225,168 @@ var RelayUrlSchema = z27.string().transform((v, ctx) => {
|
|
|
2078
2225
|
if (u.username || u.password || u.pathname !== "/" || u.search || u.hash) return bad();
|
|
2079
2226
|
return u.origin;
|
|
2080
2227
|
});
|
|
2081
|
-
var MobileConfigSchema =
|
|
2082
|
-
var MobileLinkStateSchema =
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2228
|
+
var MobileConfigSchema = z28.object({ enabled: z28.boolean(), relayUrl: RelayUrlSchema, terminalInput: z28.boolean().optional() });
|
|
2229
|
+
var MobileLinkStateSchema = z28.discriminatedUnion("state", [
|
|
2230
|
+
z28.object({ state: z28.literal("off") }),
|
|
2231
|
+
z28.object({ state: z28.literal("connecting") }),
|
|
2232
|
+
z28.object({ state: z28.literal("online") }),
|
|
2233
|
+
z28.object({ state: z28.literal("offline"), retryAt: z28.string().datetime(), error: z28.string() }),
|
|
2234
|
+
z28.object({ state: z28.literal("signed_out"), reason: z28.enum(["other_pc", "session_invalid"]) }),
|
|
2088
2235
|
/** The mobile service did not start (a broken mobile.json, a missing key store): nothing is linked until the daemon restarts. */
|
|
2089
|
-
|
|
2236
|
+
z28.object({ state: z28.literal("unavailable"), error: z28.string().max(200) })
|
|
2090
2237
|
]);
|
|
2091
|
-
var DeviceKindSchema =
|
|
2238
|
+
var DeviceKindSchema = z28.enum(["phone", "tablet"]);
|
|
2092
2239
|
var DEVICE_NAME_MAX = 40;
|
|
2093
|
-
var DeviceNameSchema =
|
|
2094
|
-
var MobilePairingSchema =
|
|
2095
|
-
id:
|
|
2096
|
-
label:
|
|
2097
|
-
code:
|
|
2098
|
-
expiresAt:
|
|
2099
|
-
state:
|
|
2100
|
-
});
|
|
2101
|
-
var RecoveredSchema =
|
|
2102
|
-
var MobileStateSchema =
|
|
2103
|
-
enabled:
|
|
2104
|
-
relayUrl:
|
|
2105
|
-
account:
|
|
2106
|
-
signin:
|
|
2240
|
+
var DeviceNameSchema = z28.string().trim().min(1).max(DEVICE_NAME_MAX).regex(/^[^\u0000-\u001f\u007f]+$/);
|
|
2241
|
+
var MobilePairingSchema = z28.object({
|
|
2242
|
+
id: z28.string(),
|
|
2243
|
+
label: z28.string(),
|
|
2244
|
+
code: z28.string().nullable(),
|
|
2245
|
+
expiresAt: z28.string().datetime(),
|
|
2246
|
+
state: z28.enum(["waiting", "confirm", "approved", "linked", "expired", "refused"])
|
|
2247
|
+
});
|
|
2248
|
+
var RecoveredSchema = z28.object({ at: z28.string().datetime(), model: z28.string().max(40).optional(), pending: z28.literal(true).optional() });
|
|
2249
|
+
var MobileStateSchema = z28.object({
|
|
2250
|
+
enabled: z28.boolean(),
|
|
2251
|
+
relayUrl: z28.string(),
|
|
2252
|
+
account: z28.object({ login: z28.string(), accountId: z28.string() }).nullable(),
|
|
2253
|
+
signin: z28.object({ userCode: z28.string(), verificationUri: z28.string(), expiresAt: z28.string().datetime() }).nullable(),
|
|
2107
2254
|
/** The last sign-in that did not end with a session; cleared by the next one. */
|
|
2108
|
-
signinError:
|
|
2255
|
+
signinError: z28.enum(["expired", "denied", "not_allowed", "failed"]).nullable(),
|
|
2109
2256
|
link: MobileLinkStateSchema,
|
|
2110
|
-
devices:
|
|
2111
|
-
id:
|
|
2112
|
-
label:
|
|
2113
|
-
approvedAt:
|
|
2114
|
-
online:
|
|
2115
|
-
lastSeenAt:
|
|
2257
|
+
devices: z28.array(z28.object({
|
|
2258
|
+
id: z28.string(),
|
|
2259
|
+
label: z28.string(),
|
|
2260
|
+
approvedAt: z28.string(),
|
|
2261
|
+
online: z28.boolean(),
|
|
2262
|
+
lastSeenAt: z28.string().optional(),
|
|
2116
2263
|
/** Absent from an older daemon; `name` absent: the user gave none, the front derives one from the label. */
|
|
2117
2264
|
kind: DeviceKindSchema.optional(),
|
|
2118
|
-
name:
|
|
2265
|
+
name: z28.string().optional(),
|
|
2119
2266
|
/** Its passkey can bring it back after a reinstall (registered with the PC key's digest, docs/mobile-passkey-recover-contract.md). */
|
|
2120
|
-
recover:
|
|
2267
|
+
recover: z28.literal(true).optional(),
|
|
2121
2268
|
/** It came back with its passkey: when, on what it says it runs (`iPhone`, `iPad`), and `pending` until « C'était bien moi »
|
|
2122
2269
|
* (`mobile.device.ack` `recovered`). Kept after that, for the « reconnecté avec sa passkey le … » line. */
|
|
2123
2270
|
recovered: RecoveredSchema.optional(),
|
|
2124
2271
|
/** Another device tried to take its place with its passkey while it was connected; until « Compris » (`mobile.device.ack` `refused`). */
|
|
2125
|
-
refused:
|
|
2272
|
+
refused: z28.object({ at: z28.string().datetime(), model: z28.string().optional() }).optional()
|
|
2126
2273
|
})),
|
|
2127
|
-
pairings:
|
|
2274
|
+
pairings: z28.array(MobilePairingSchema),
|
|
2128
2275
|
/** « Taper dans les terminaux depuis le téléphone »: absent from an older daemon, which has no phone terminal. */
|
|
2129
|
-
terminalInput:
|
|
2276
|
+
terminalInput: z28.boolean().optional(),
|
|
2130
2277
|
/** Passkey recovery on the account: `blocked` after 3 failed verifications, until « Débloquer » (`mobile.recovery.unblock`). */
|
|
2131
|
-
recovery:
|
|
2278
|
+
recovery: z28.object({ blocked: z28.object({ since: z28.string().datetime(), failures: z28.number().int().min(0) }).optional() }).optional()
|
|
2132
2279
|
});
|
|
2133
|
-
var MobileRecoveryEventSchema =
|
|
2134
|
-
event:
|
|
2135
|
-
id:
|
|
2136
|
-
at:
|
|
2280
|
+
var MobileRecoveryEventSchema = z28.object({
|
|
2281
|
+
event: z28.enum(["recovered", "refused", "blocked"]),
|
|
2282
|
+
id: z28.string().optional(),
|
|
2283
|
+
at: z28.string().datetime()
|
|
2137
2284
|
});
|
|
2138
2285
|
|
|
2139
2286
|
// ../../packages/protocol/src/brain.ts
|
|
2140
|
-
import { z as
|
|
2141
|
-
var NoteInfoSchema =
|
|
2142
|
-
name:
|
|
2143
|
-
file:
|
|
2144
|
-
title:
|
|
2145
|
-
when:
|
|
2146
|
-
firstLine:
|
|
2147
|
-
scope:
|
|
2148
|
-
projects:
|
|
2149
|
-
modifiedAt:
|
|
2150
|
-
checkedAt:
|
|
2287
|
+
import { z as z29 } from "zod";
|
|
2288
|
+
var NoteInfoSchema = z29.object({
|
|
2289
|
+
name: z29.string(),
|
|
2290
|
+
file: z29.string(),
|
|
2291
|
+
title: z29.string(),
|
|
2292
|
+
when: z29.string().optional(),
|
|
2293
|
+
firstLine: z29.string(),
|
|
2294
|
+
scope: z29.enum(["all", "chat", "sessions"]),
|
|
2295
|
+
projects: z29.array(z29.string()),
|
|
2296
|
+
modifiedAt: z29.string(),
|
|
2297
|
+
checkedAt: z29.string().optional(),
|
|
2151
2298
|
/** Days since it was last checked or changed, past the threshold (spec §3.7). */
|
|
2152
|
-
oldDays:
|
|
2153
|
-
flag:
|
|
2299
|
+
oldDays: z29.number().int().optional(),
|
|
2300
|
+
flag: z29.object({ what: z29.string(), by: z29.string(), at: z29.string() }).optional(),
|
|
2154
2301
|
/** Lines under « ## Ajouts ». */
|
|
2155
|
-
additions:
|
|
2156
|
-
truncated:
|
|
2157
|
-
});
|
|
2158
|
-
var BrainAnswerSchema =
|
|
2159
|
-
var BrainListSchema =
|
|
2160
|
-
var BrainNoteSchema =
|
|
2161
|
-
var BrainAddSchema =
|
|
2162
|
-
type:
|
|
2163
|
-
rid:
|
|
2302
|
+
additions: z29.number().int(),
|
|
2303
|
+
truncated: z29.boolean()
|
|
2304
|
+
});
|
|
2305
|
+
var BrainAnswerSchema = z29.object({ type: z29.literal("brain.answer"), rid: z29.string().min(1).max(100), task: z29.string().min(1).max(40), choice: BrainChoiceSchema });
|
|
2306
|
+
var BrainListSchema = z29.object({ type: z29.literal("brain.list"), rid: z29.string().min(1).max(100) });
|
|
2307
|
+
var BrainNoteSchema = z29.object({ type: z29.literal("brain.note"), rid: z29.string().min(1).max(100), note: NoteNameSchema, op: z29.enum(["checked", "unflag"]) });
|
|
2308
|
+
var BrainAddSchema = z29.object({
|
|
2309
|
+
type: z29.literal("brain.add"),
|
|
2310
|
+
rid: z29.string().min(1).max(100),
|
|
2164
2311
|
note: NoteNameSchema,
|
|
2165
|
-
fact:
|
|
2166
|
-
source:
|
|
2312
|
+
fact: z29.string().trim().min(1).max(BRAIN_FACT_MAX),
|
|
2313
|
+
source: z29.string().trim().min(1).max(BRAIN_SOURCE_MAX).optional()
|
|
2167
2314
|
});
|
|
2168
|
-
var BrainResultSchema =
|
|
2169
|
-
type:
|
|
2170
|
-
rid:
|
|
2171
|
-
reason:
|
|
2315
|
+
var BrainResultSchema = z29.object({
|
|
2316
|
+
type: z29.literal("brain.result"),
|
|
2317
|
+
rid: z29.string(),
|
|
2318
|
+
reason: z29.string().optional(),
|
|
2172
2319
|
/** What came of an answer (the text its proposer is told). */
|
|
2173
|
-
result:
|
|
2174
|
-
dir:
|
|
2175
|
-
notes:
|
|
2320
|
+
result: z29.string().optional(),
|
|
2321
|
+
dir: z29.string().optional(),
|
|
2322
|
+
notes: z29.array(NoteInfoSchema).optional()
|
|
2176
2323
|
});
|
|
2177
2324
|
|
|
2178
2325
|
// ../../packages/protocol/src/usage.ts
|
|
2179
|
-
import { z as
|
|
2180
|
-
var UsageHarnessSchema =
|
|
2326
|
+
import { z as z30 } from "zod";
|
|
2327
|
+
var UsageHarnessSchema = z30.enum(["claude", "codex", "cursor"]);
|
|
2181
2328
|
var USAGE_WINDOW_KINDS = ["five_hour", "seven_day", "model", "month", "pool"];
|
|
2182
2329
|
var POOLS = ["cursor", "other"];
|
|
2183
2330
|
var poolMatchesKind = (w) => w.kind === "pool" === (w.pool !== void 0) && (w.pool === void 0 || POOLS.includes(w.pool));
|
|
2184
|
-
var UsageWindowSchema =
|
|
2185
|
-
kind:
|
|
2186
|
-
model:
|
|
2331
|
+
var UsageWindowSchema = z30.object({
|
|
2332
|
+
kind: z30.enum(USAGE_WINDOW_KINDS),
|
|
2333
|
+
model: z30.string().min(1).max(80).optional(),
|
|
2187
2334
|
/** A pool of the included usage (`kind: 'pool'`): Cursor's own models (`cursor`) or the others at API prices (`other`). */
|
|
2188
|
-
pool:
|
|
2335
|
+
pool: z30.enum(POOLS).optional(),
|
|
2189
2336
|
/** How much of it is used, in percent (rounded); 100 or more: reached. */
|
|
2190
|
-
pct:
|
|
2337
|
+
pct: z30.number().int().min(0).max(1e3),
|
|
2191
2338
|
/** When it starts again from zero; null when the harness does not say. */
|
|
2192
|
-
resetsAt:
|
|
2339
|
+
resetsAt: z30.string().datetime().nullable()
|
|
2193
2340
|
}).refine(poolMatchesKind, { message: "a pool window names its pool, and only a pool window does", path: ["pool"] });
|
|
2194
|
-
var UsageStatusSchema =
|
|
2341
|
+
var UsageStatusSchema = z30.enum(["ok", "loading", "stale", "unreachable", "expired"]);
|
|
2195
2342
|
var USAGE_ALERT_MIN = 0.5;
|
|
2196
2343
|
var USAGE_ALERT_MAX = 0.95;
|
|
2197
|
-
var UsagePrefsSchema =
|
|
2198
|
-
var HarnessUsageSchema =
|
|
2344
|
+
var UsagePrefsSchema = z30.object({ alert: z30.number().min(USAGE_ALERT_MIN).max(USAGE_ALERT_MAX) });
|
|
2345
|
+
var HarnessUsageSchema = z30.object({
|
|
2199
2346
|
harness: UsageHarnessSchema,
|
|
2200
|
-
account:
|
|
2347
|
+
account: z30.string().regex(/^[0-9a-f]{12}$/).nullable(),
|
|
2201
2348
|
status: UsageStatusSchema,
|
|
2202
2349
|
/** The last read that succeeded; null when none did. */
|
|
2203
|
-
readAt:
|
|
2350
|
+
readAt: z30.string().datetime().nullable(),
|
|
2204
2351
|
/** The 5 hours and the week first, then one window per model. Empty while loading, expired, or read more than an hour ago. */
|
|
2205
|
-
windows:
|
|
2352
|
+
windows: z30.array(UsageWindowSchema).max(20),
|
|
2206
2353
|
/**
|
|
2207
2354
|
* Why the account cannot be read now (#301), absent when it can. `local_expired`: the token on this machine is past its time, which
|
|
2208
2355
|
* the harness renews itself at its next use (Claude Code's access token is short): still signed in, so the last values are kept
|
|
2209
2356
|
* as `stale` while under an hour old, then the harness is no longer listed. `refused`: the provider refused the token (401):
|
|
2210
2357
|
* status `expired`, no window. A refusal wins over a local expiry.
|
|
2211
2358
|
*/
|
|
2212
|
-
cause:
|
|
2359
|
+
cause: z30.enum(["local_expired", "refused"]).optional()
|
|
2213
2360
|
});
|
|
2214
|
-
var UsageAlertSchema =
|
|
2215
|
-
id:
|
|
2361
|
+
var UsageAlertSchema = z30.object({
|
|
2362
|
+
id: z30.string().min(1).max(200),
|
|
2216
2363
|
harness: UsageHarnessSchema,
|
|
2217
|
-
account:
|
|
2364
|
+
account: z30.string().regex(/^[0-9a-f]{12}$/).nullable(),
|
|
2218
2365
|
window: UsageWindowSchema,
|
|
2219
|
-
level:
|
|
2220
|
-
at:
|
|
2366
|
+
level: z30.enum(["threshold", "full"]),
|
|
2367
|
+
at: z30.string().datetime()
|
|
2221
2368
|
});
|
|
2222
2369
|
var isRecord = (v) => typeof v === "object" && v !== null;
|
|
2223
2370
|
var knownHarness = (h) => UsageHarnessSchema.safeParse(h).success;
|
|
2224
2371
|
var knownKind = (k) => USAGE_WINDOW_KINDS.includes(k);
|
|
2225
2372
|
var dropUnknownHarnesses = (raw) => Array.isArray(raw) ? raw.filter((h) => isRecord(h) && knownHarness(h.harness)).map((h) => Array.isArray(h.windows) ? { ...h, windows: h.windows.filter((w) => !isRecord(w) || knownKind(w.kind) && poolMatchesKind(w)) } : h) : raw;
|
|
2226
2373
|
var dropUnknownAlerts = (raw) => Array.isArray(raw) ? raw.filter((a) => isRecord(a) && knownHarness(a.harness) && (!isRecord(a.window) || knownKind(a.window.kind) && poolMatchesKind(a.window))) : raw;
|
|
2227
|
-
var UsageStateMessageSchema =
|
|
2228
|
-
type:
|
|
2229
|
-
machineId:
|
|
2230
|
-
harnesses:
|
|
2231
|
-
alerts:
|
|
2374
|
+
var UsageStateMessageSchema = z30.object({
|
|
2375
|
+
type: z30.literal("usage.state"),
|
|
2376
|
+
machineId: z30.string().optional(),
|
|
2377
|
+
harnesses: z30.preprocess(dropUnknownHarnesses, z30.array(HarnessUsageSchema).max(4)),
|
|
2378
|
+
alerts: z30.preprocess(dropUnknownAlerts, z30.array(UsageAlertSchema).max(40)),
|
|
2232
2379
|
prefs: UsagePrefsSchema
|
|
2233
2380
|
});
|
|
2234
|
-
var UsageSetSchema =
|
|
2235
|
-
var UsageAckSchema =
|
|
2381
|
+
var UsageSetSchema = z30.object({ type: z30.literal("usage.set"), prefs: UsagePrefsSchema, machineId: z30.string().optional() });
|
|
2382
|
+
var UsageAckSchema = z30.object({ type: z30.literal("usage.ack"), id: z30.string().min(1).max(200), machineId: z30.string().optional() });
|
|
2236
2383
|
|
|
2237
2384
|
// ../../packages/protocol/src/forge.ts
|
|
2238
|
-
import { z as
|
|
2385
|
+
import { z as z32 } from "zod";
|
|
2239
2386
|
|
|
2240
2387
|
// ../../packages/protocol/src/refusal.ts
|
|
2241
|
-
import { z as
|
|
2242
|
-
var RefusalCodeSchema =
|
|
2388
|
+
import { z as z31 } from "zod";
|
|
2389
|
+
var RefusalCodeSchema = z31.enum([
|
|
2243
2390
|
"stale",
|
|
2244
2391
|
"read_only",
|
|
2245
2392
|
"no_prompt",
|
|
@@ -2261,257 +2408,261 @@ var RefusalCodeSchema = z30.enum([
|
|
|
2261
2408
|
|
|
2262
2409
|
// ../../packages/protocol/src/forge.ts
|
|
2263
2410
|
var FORGE_KINDS = ["github", "gitlab"];
|
|
2264
|
-
var ForgeKindSchema =
|
|
2411
|
+
var ForgeKindSchema = z32.enum(FORGE_KINDS);
|
|
2265
2412
|
var PIPE_STATUSES = ["ok", "run", "fail", "wait", "skip", "none"];
|
|
2266
|
-
var PipeStatusSchema =
|
|
2413
|
+
var PipeStatusSchema = z32.enum(PIPE_STATUSES);
|
|
2267
2414
|
var PR_STATES = ["draft", "open", "review", "merged", "closed"];
|
|
2268
|
-
var PrStateSchema =
|
|
2415
|
+
var PrStateSchema = z32.enum(PR_STATES);
|
|
2269
2416
|
var PR_ROLES = ["author", "assignee", "reviewer"];
|
|
2270
|
-
var PrRoleSchema =
|
|
2417
|
+
var PrRoleSchema = z32.enum(PR_ROLES);
|
|
2271
2418
|
var dropUnknownRoles = (raw) => Array.isArray(raw) ? raw.filter((r) => known(PR_ROLES, r)) : raw;
|
|
2272
2419
|
var FORGE_BODY_MAX = 65536;
|
|
2273
|
-
var PullRequestSchema =
|
|
2420
|
+
var PullRequestSchema = z32.object({
|
|
2274
2421
|
/** `${host}/${repo}#${number}`, stable. */
|
|
2275
|
-
id:
|
|
2422
|
+
id: z32.string().min(1),
|
|
2276
2423
|
forge: ForgeKindSchema,
|
|
2277
|
-
host:
|
|
2424
|
+
host: z32.string().min(1),
|
|
2278
2425
|
/** The repository's path: `owner/name`, or `group/sub/project`. */
|
|
2279
|
-
repo:
|
|
2280
|
-
number:
|
|
2426
|
+
repo: z32.string().min(1),
|
|
2427
|
+
number: z32.number().int().positive(),
|
|
2281
2428
|
/** As the forge shows it: `#226` (GitHub) or `!41` (GitLab). */
|
|
2282
|
-
ref:
|
|
2429
|
+
ref: z32.string(),
|
|
2283
2430
|
/** « Ouvrir sur GitHub / GitLab »: the front opens it itself (R11). */
|
|
2284
|
-
url:
|
|
2285
|
-
title:
|
|
2431
|
+
url: z32.string().url(),
|
|
2432
|
+
title: z32.string(),
|
|
2286
2433
|
state: PrStateSchema,
|
|
2287
2434
|
/** The source branch, and the branch it goes into. */
|
|
2288
|
-
branch:
|
|
2289
|
-
target:
|
|
2290
|
-
headSha:
|
|
2435
|
+
branch: z32.string(),
|
|
2436
|
+
target: z32.string(),
|
|
2437
|
+
headSha: z32.string(),
|
|
2291
2438
|
pipeline: PipeStatusSchema,
|
|
2292
2439
|
/** `required` when the forge gives it (GitLab); GitHub leaves it out. */
|
|
2293
|
-
approvals:
|
|
2440
|
+
approvals: z32.object({ given: z32.number().int().min(0), required: z32.number().int().min(0).optional() }),
|
|
2294
2441
|
/** The mockup's `ok`: all that a merge needs (R5), the pipeline set apart. */
|
|
2295
|
-
mergeable:
|
|
2442
|
+
mergeable: z32.boolean(),
|
|
2296
2443
|
/** Threads that can be resolved and are not. */
|
|
2297
|
-
openThreads:
|
|
2298
|
-
updatedAt:
|
|
2444
|
+
openThreads: z32.number().int().min(0),
|
|
2445
|
+
updatedAt: z32.string().datetime(),
|
|
2299
2446
|
/** The daemon's sessions on that branch, most recently active first (R12); the fleet qualifies them `machine:id`. */
|
|
2300
|
-
sessions:
|
|
2447
|
+
sessions: z32.array(z32.string()),
|
|
2301
2448
|
/**
|
|
2302
2449
|
* The account's roles on the request (issue #3), in the order author, assignee, reviewer; absent when it has none, and from a daemon
|
|
2303
2450
|
* older than this field.
|
|
2304
2451
|
*/
|
|
2305
|
-
roles:
|
|
2452
|
+
roles: z32.preprocess(dropUnknownRoles, z32.array(PrRoleSchema)).optional()
|
|
2306
2453
|
});
|
|
2307
|
-
var FollowedSessionSchema =
|
|
2308
|
-
var ForgeStatusSchema =
|
|
2454
|
+
var FollowedSessionSchema = z32.object({ session: z32.string(), forge: ForgeKindSchema, host: z32.string(), repo: z32.string() });
|
|
2455
|
+
var ForgeStatusSchema = z32.object({
|
|
2309
2456
|
forge: ForgeKindSchema,
|
|
2310
|
-
host:
|
|
2311
|
-
status:
|
|
2312
|
-
message:
|
|
2313
|
-
at:
|
|
2457
|
+
host: z32.string(),
|
|
2458
|
+
status: z32.enum(["ok", "missing", "unauthenticated", "error"]),
|
|
2459
|
+
message: z32.string().optional(),
|
|
2460
|
+
at: z32.string().datetime(),
|
|
2314
2461
|
/** Not `ok`: since when the forge cannot be read, whatever its messages since (« le relevé échoue depuis 10:42 »). */
|
|
2315
|
-
since:
|
|
2462
|
+
since: z32.string().datetime().optional(),
|
|
2316
2463
|
/** After a failed read (`error` mostly): when the daemon reads it again, its backoff of 2 to 10 minutes (« Nouvel essai à 10:50 »). */
|
|
2317
|
-
retryAt:
|
|
2464
|
+
retryAt: z32.string().datetime().optional(),
|
|
2318
2465
|
/** Not `ok`: when its requests, still shown, were last read; absent when they never were. */
|
|
2319
|
-
readAt:
|
|
2466
|
+
readAt: z32.string().datetime().optional()
|
|
2320
2467
|
});
|
|
2321
2468
|
var isRecord2 = (v) => typeof v === "object" && v !== null;
|
|
2322
2469
|
var known = (list, v) => typeof v === "string" && list.includes(v);
|
|
2323
2470
|
var dropUnknownPrs = (raw) => Array.isArray(raw) ? raw.filter((p) => isRecord2(p) && known(FORGE_KINDS, p.forge) && known(PR_STATES, p.state) && known(PIPE_STATUSES, p.pipeline)) : raw;
|
|
2324
2471
|
var dropUnknownForges = (raw) => Array.isArray(raw) ? raw.filter((f) => isRecord2(f) && known(FORGE_KINDS, f.forge)) : raw;
|
|
2325
|
-
var ForgeStateMessageSchema =
|
|
2326
|
-
type:
|
|
2327
|
-
prs:
|
|
2328
|
-
forges:
|
|
2472
|
+
var ForgeStateMessageSchema = z32.object({
|
|
2473
|
+
type: z32.literal("forge.state"),
|
|
2474
|
+
prs: z32.preprocess(dropUnknownPrs, z32.array(PullRequestSchema)),
|
|
2475
|
+
forges: z32.preprocess(dropUnknownForges, z32.array(ForgeStatusSchema)),
|
|
2329
2476
|
/** Absent from a daemon older than this field. */
|
|
2330
|
-
followed:
|
|
2477
|
+
followed: z32.preprocess(dropUnknownForges, z32.array(FollowedSessionSchema)).optional(),
|
|
2331
2478
|
/**
|
|
2332
2479
|
* The account's own requests no session follows (issue #3): `sessions` empty, `roles` set. A request is in `prs` or here, never in
|
|
2333
2480
|
* both; a followed one carries its `roles` in `prs`. Absent from a daemon older than this field.
|
|
2334
2481
|
*/
|
|
2335
|
-
mine:
|
|
2336
|
-
machineId:
|
|
2337
|
-
});
|
|
2338
|
-
var PrJobSchema =
|
|
2339
|
-
id:
|
|
2340
|
-
name:
|
|
2341
|
-
column:
|
|
2342
|
-
columnName:
|
|
2343
|
-
status:
|
|
2344
|
-
durationS:
|
|
2345
|
-
});
|
|
2346
|
-
var PrCommentSchema =
|
|
2347
|
-
var PrThreadSchema =
|
|
2348
|
-
id:
|
|
2349
|
-
resolvable:
|
|
2350
|
-
resolved:
|
|
2351
|
-
file:
|
|
2352
|
-
line:
|
|
2353
|
-
code:
|
|
2354
|
-
comments:
|
|
2355
|
-
});
|
|
2356
|
-
var PrFileSchema =
|
|
2357
|
-
var PrReviewerSchema =
|
|
2358
|
-
var PrCommitSchema =
|
|
2359
|
-
var PrDetailSchema =
|
|
2482
|
+
mine: z32.preprocess(dropUnknownPrs, z32.array(PullRequestSchema)).optional(),
|
|
2483
|
+
machineId: z32.string().optional()
|
|
2484
|
+
});
|
|
2485
|
+
var PrJobSchema = z32.object({
|
|
2486
|
+
id: z32.string(),
|
|
2487
|
+
name: z32.string(),
|
|
2488
|
+
column: z32.number().int().min(0),
|
|
2489
|
+
columnName: z32.string(),
|
|
2490
|
+
status: z32.preprocess((s) => known(PIPE_STATUSES, s) ? s : "none", PipeStatusSchema),
|
|
2491
|
+
durationS: z32.number().min(0).optional()
|
|
2492
|
+
});
|
|
2493
|
+
var PrCommentSchema = z32.object({ id: z32.string(), author: z32.string(), at: z32.string().datetime(), body: z32.string() });
|
|
2494
|
+
var PrThreadSchema = z32.object({
|
|
2495
|
+
id: z32.string(),
|
|
2496
|
+
resolvable: z32.boolean(),
|
|
2497
|
+
resolved: z32.boolean(),
|
|
2498
|
+
file: z32.string().optional(),
|
|
2499
|
+
line: z32.number().int().optional(),
|
|
2500
|
+
code: z32.string().optional(),
|
|
2501
|
+
comments: z32.array(PrCommentSchema).min(1)
|
|
2502
|
+
});
|
|
2503
|
+
var PrFileSchema = z32.object({ path: z32.string(), added: z32.number().int().min(0), removed: z32.number().int().min(0), patch: z32.string().optional() });
|
|
2504
|
+
var PrReviewerSchema = z32.object({ name: z32.string(), state: z32.enum(["approved", "changes", "pending"]) });
|
|
2505
|
+
var PrCommitSchema = z32.object({ sha: z32.string(), title: z32.string(), author: z32.string(), at: z32.string().datetime() });
|
|
2506
|
+
var PrDetailSchema = z32.object({
|
|
2360
2507
|
pr: PullRequestSchema,
|
|
2361
|
-
description:
|
|
2362
|
-
author:
|
|
2363
|
-
reviewers:
|
|
2364
|
-
labels:
|
|
2508
|
+
description: z32.string(),
|
|
2509
|
+
author: z32.string(),
|
|
2510
|
+
reviewers: z32.array(PrReviewerSchema),
|
|
2511
|
+
labels: z32.array(z32.string()),
|
|
2365
2512
|
/** The tickets it closes, as the forge shows them (`#38`). */
|
|
2366
|
-
issues:
|
|
2367
|
-
jobs:
|
|
2513
|
+
issues: z32.array(z32.string()),
|
|
2514
|
+
jobs: z32.array(PrJobSchema),
|
|
2368
2515
|
/** A job's log when asked (`forge.detail` with `log`): its last 60 lines, no ANSI, redacted. */
|
|
2369
|
-
log:
|
|
2370
|
-
threads:
|
|
2371
|
-
files:
|
|
2372
|
-
commits:
|
|
2516
|
+
log: z32.object({ jobId: z32.string(), text: z32.string() }).optional(),
|
|
2517
|
+
threads: z32.array(PrThreadSchema),
|
|
2518
|
+
files: z32.array(PrFileSchema),
|
|
2519
|
+
commits: z32.array(PrCommitSchema),
|
|
2373
2520
|
/** The exact command a merge runs, for the front's confirmation (R5). */
|
|
2374
|
-
mergeCommand:
|
|
2521
|
+
mergeCommand: z32.string(),
|
|
2375
2522
|
/**
|
|
2376
2523
|
* Why a merge is refused now, as codes; empty: it can be merged (R5). `not_open`, `draft`, `approvals`, `changes_requested`;
|
|
2377
2524
|
* `pipeline`: the pipeline is not green (`pr.pipeline` says how); `pipeline_not_started`: no pipeline yet on the head, in a
|
|
2378
2525
|
* repository with CI or whose CI is unknown (`pr.pipeline` reads `wait`). A repository without any CI gives `none` and no code.
|
|
2379
2526
|
* A front shows a code it does not know as is.
|
|
2380
2527
|
*/
|
|
2381
|
-
mergeBlockers:
|
|
2528
|
+
mergeBlockers: z32.array(z32.string())
|
|
2382
2529
|
});
|
|
2383
|
-
var ForgeActionSchema =
|
|
2384
|
-
|
|
2530
|
+
var ForgeActionSchema = z32.discriminatedUnion("kind", [
|
|
2531
|
+
z32.object({ kind: z32.literal("rerun") }),
|
|
2385
2532
|
/** `headSha`: the head the person saw; `stale` when it has moved. */
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2533
|
+
z32.object({ kind: z32.literal("merge"), headSha: z32.string().min(1).max(64) }),
|
|
2534
|
+
z32.object({ kind: z32.literal("comment"), body: z32.string().min(1).max(FORGE_BODY_MAX) }),
|
|
2535
|
+
z32.object({ kind: z32.literal("reply"), threadId: z32.string().min(1).max(200), body: z32.string().min(1).max(FORGE_BODY_MAX) }),
|
|
2536
|
+
z32.object({ kind: z32.literal("resolve"), threadId: z32.string().min(1).max(200) })
|
|
2390
2537
|
]);
|
|
2391
|
-
var ForgeDetailSchema =
|
|
2392
|
-
var ForgeActSchema =
|
|
2393
|
-
var ForgeDetailReplySchema =
|
|
2394
|
-
var ForgeActReplySchema =
|
|
2538
|
+
var ForgeDetailSchema = z32.object({ type: z32.literal("forge.detail"), requestId: z32.string().min(1).max(100), prId: z32.string().min(1).max(500), log: z32.string().min(1).max(40).optional(), machineId: z32.string().optional() });
|
|
2539
|
+
var ForgeActSchema = z32.object({ type: z32.literal("forge.act"), requestId: z32.string().min(1).max(100), prId: z32.string().min(1).max(500), machineId: z32.string().optional(), action: ForgeActionSchema });
|
|
2540
|
+
var ForgeDetailReplySchema = z32.object({ type: z32.literal("forge.detail.reply"), requestId: z32.string(), ok: z32.boolean(), detail: PrDetailSchema.optional(), message: z32.string().optional(), code: RefusalCodeSchema.optional() });
|
|
2541
|
+
var ForgeActReplySchema = z32.object({ type: z32.literal("forge.act.reply"), requestId: z32.string(), ok: z32.boolean(), command: z32.string().optional(), message: z32.string().optional(), code: RefusalCodeSchema.optional() });
|
|
2395
2542
|
var CLOSED_KEEP_DAYS = 7;
|
|
2396
2543
|
var CLOSED_KEEP_MS = CLOSED_KEEP_DAYS * 24 * 60 * 6e4;
|
|
2397
2544
|
var PR_ROLE_FILTERS = ["all", ...PR_ROLES];
|
|
2398
2545
|
|
|
2399
2546
|
// ../../packages/protocol/src/messages.ts
|
|
2400
|
-
var SessionEventSchema =
|
|
2401
|
-
name:
|
|
2402
|
-
at:
|
|
2403
|
-
source:
|
|
2404
|
-
tool:
|
|
2405
|
-
text:
|
|
2406
|
-
options:
|
|
2547
|
+
var SessionEventSchema = z33.object({
|
|
2548
|
+
name: z33.enum(["SessionStart", "UserPromptSubmit", "PreToolUse", "PermissionRequest", "Notification", "Stop", "SessionEnd", "PaneChanged", "PaneGone", "PanePrompt", "PaneIdle", "InjectFailed", "Decided", "PostToolUse", "PostToolUseFailure", "StopFailure", "SubagentStart", "SubagentStop", "PaneTitle", "Renamed", "NativeRequest", "AgentMessage", "QueueUpdate", "PaneUnreadable", "PaneReadable"]),
|
|
2549
|
+
at: z33.string().datetime(),
|
|
2550
|
+
source: z33.enum(["hook", "pane", "daemon"]),
|
|
2551
|
+
tool: z33.string().optional(),
|
|
2552
|
+
text: z33.string().optional(),
|
|
2553
|
+
options: z33.array(z33.string()).optional(),
|
|
2407
2554
|
/** Each option's description, by index ('' when it has none); left out when no option has one. */
|
|
2408
|
-
optionDetails:
|
|
2409
|
-
kind:
|
|
2555
|
+
optionDetails: z33.array(z33.string()).optional(),
|
|
2556
|
+
kind: z33.enum(["question", "permission", "plan", "diff"]).optional(),
|
|
2410
2557
|
/** PanePrompt: what to review in full before deciding (a plan read in the terminal), when `text` is its summary. */
|
|
2411
|
-
body:
|
|
2412
|
-
exitCode:
|
|
2413
|
-
helperId:
|
|
2558
|
+
body: z33.string().optional(),
|
|
2559
|
+
exitCode: z33.number().int().nullable().optional(),
|
|
2560
|
+
helperId: z33.string().optional(),
|
|
2414
2561
|
/** The helper's description, once known (Claude Code: its `.meta.json`, written after SubagentStart). */
|
|
2415
|
-
task:
|
|
2562
|
+
task: z33.string().optional(),
|
|
2416
2563
|
/** PostToolUseFailure: the user interrupted the turn (Esc); Claude then waits for input with no Stop. */
|
|
2417
|
-
interrupt:
|
|
2564
|
+
interrupt: z33.boolean().optional(),
|
|
2418
2565
|
/** UserPromptSubmit, PostToolUse: the images the prompt or the tool result carried, by attachment id. */
|
|
2419
|
-
attachments:
|
|
2566
|
+
attachments: z33.array(AttachmentIdSchema).max(ATTACHMENTS_MAX).optional(),
|
|
2420
2567
|
/** PostToolUse: some of the result's images were not kept. */
|
|
2421
|
-
imagesDropped:
|
|
2568
|
+
imagesDropped: z33.boolean().optional(),
|
|
2422
2569
|
/** QueueUpdate: OMP's queue as it stands. */
|
|
2423
|
-
queue:
|
|
2570
|
+
queue: z33.array(z33.object({ text: z33.string(), mode: z33.enum(["steer", "follow_up"]) })).optional(),
|
|
2424
2571
|
/** AgentMessage: the harness's own message, its text so far (`streaming`) or whole. `messageId` is unique for the session's life. */
|
|
2425
|
-
messageId:
|
|
2426
|
-
streaming:
|
|
2572
|
+
messageId: z33.string().optional(),
|
|
2573
|
+
streaming: z33.boolean().optional(),
|
|
2427
2574
|
/** NativeRequest: the dialog's id, and OMP's `ask` questions when it is one. */
|
|
2428
|
-
requestId:
|
|
2429
|
-
questions:
|
|
2575
|
+
requestId: z33.string().optional(),
|
|
2576
|
+
questions: z33.array(AskQuestionSchema).optional(),
|
|
2430
2577
|
/** Stop: its text is already in the thread as AgentMessage cards, which the reply card must not repeat. */
|
|
2431
|
-
streamed:
|
|
2578
|
+
streamed: z33.boolean().optional(),
|
|
2432
2579
|
/** Native tracking (spec 2026-10-13 §2): the harness's id of the tool call, so its result lands on the same row. */
|
|
2433
|
-
toolUseId:
|
|
2580
|
+
toolUseId: z33.string().optional(),
|
|
2434
2581
|
/** The tool's input as the harness gave it, every string capped by the hook. */
|
|
2435
|
-
toolInput:
|
|
2582
|
+
toolInput: z33.record(z33.string(), z33.unknown()).optional(),
|
|
2436
2583
|
/** PostToolUse: the id the harness gave a call it left running in the background (Claude Code's `backgroundTaskId`, issue #1). */
|
|
2437
|
-
backgroundTaskId:
|
|
2584
|
+
backgroundTaskId: z33.string().optional(),
|
|
2438
2585
|
/** PostToolUse: the result as text; SubagentStop: nothing (the report travels in `text`). */
|
|
2439
|
-
output:
|
|
2440
|
-
durationMs:
|
|
2586
|
+
output: z33.string().optional(),
|
|
2587
|
+
durationMs: z33.number().nonnegative().optional(),
|
|
2441
2588
|
/** PostToolUseFailure: the harness's error message. */
|
|
2442
|
-
error:
|
|
2589
|
+
error: z33.string().optional(),
|
|
2443
2590
|
/** The session's transcript, or the helper's on SubagentStop; the daemon reads its tail for the agent's messages. */
|
|
2444
|
-
transcriptPath:
|
|
2591
|
+
transcriptPath: z33.string().optional(),
|
|
2445
2592
|
/** Decided: what was chosen when the daemon knows it. */
|
|
2446
2593
|
decision: DecisionSchema.optional(),
|
|
2447
2594
|
/** Decided: the request was refused by Ledge closing the session (its interrupt keys), not by the user's answer. */
|
|
2448
|
-
byClose:
|
|
2595
|
+
byClose: z33.literal(true).optional(),
|
|
2449
2596
|
/** Decided: who answered, when the daemon typed it (absent: answered in the terminal, or an older daemon). */
|
|
2450
2597
|
by: DecidedBySchema.optional(),
|
|
2451
2598
|
/** The agent's own session id when the hook names it, so the daemon can resume that conversation. */
|
|
2452
|
-
agentSessionId:
|
|
2599
|
+
agentSessionId: z33.string().optional()
|
|
2453
2600
|
});
|
|
2454
|
-
var RecentSchema =
|
|
2601
|
+
var RecentSchema = z33.object({ cwd: z33.string().min(1), project: z33.string().min(1), lastAt: z33.string().datetime() });
|
|
2455
2602
|
var SEMVER = /^\d+\.\d+\.\d+$/;
|
|
2456
|
-
var PingSchema =
|
|
2457
|
-
var PongSchema =
|
|
2458
|
-
var DaemonInfoSchema =
|
|
2459
|
-
version:
|
|
2460
|
-
install:
|
|
2461
|
-
systemd:
|
|
2462
|
-
manual:
|
|
2463
|
-
routing:
|
|
2464
|
-
archive:
|
|
2603
|
+
var PingSchema = z33.object({ type: z33.literal("ping"), requestId: z33.string().min(1).max(100), machineId: z33.string().optional() });
|
|
2604
|
+
var PongSchema = z33.object({ type: z33.literal("pong"), requestId: z33.string(), machineId: z33.string().optional(), error: z33.enum(["offline", "outdated"]).optional() });
|
|
2605
|
+
var DaemonInfoSchema = z33.object({
|
|
2606
|
+
version: z33.string(),
|
|
2607
|
+
install: z33.enum(["npm", "git", "unknown"]),
|
|
2608
|
+
systemd: z33.boolean(),
|
|
2609
|
+
manual: z33.string().optional(),
|
|
2610
|
+
routing: z33.boolean().optional(),
|
|
2611
|
+
archive: z33.boolean().optional(),
|
|
2465
2612
|
/** Takes `model` and `effort` on `session.launch` and answers `models.list` (#58). */
|
|
2466
|
-
models:
|
|
2613
|
+
models: z33.boolean().optional(),
|
|
2467
2614
|
/** Drives OMP over its RPC: launching `omp` sessions is possible when the binary is there (`models.list` says so). */
|
|
2468
|
-
omp:
|
|
2615
|
+
omp: z33.boolean().optional(),
|
|
2469
2616
|
/** Takes `session.model`: a live session's model and effort changed (#58, lot 2). */
|
|
2470
|
-
modelSwitch:
|
|
2617
|
+
modelSwitch: z33.boolean().optional(),
|
|
2471
2618
|
/** Answers `session.commands`: the slash commands a session's agent offers. */
|
|
2472
|
-
commands:
|
|
2619
|
+
commands: z33.boolean().optional(),
|
|
2473
2620
|
/** Takes `approval` on an OMP `session.launch` (auto mode). */
|
|
2474
|
-
ompApproval:
|
|
2621
|
+
ompApproval: z33.boolean().optional(),
|
|
2475
2622
|
/** Its home folder, so a client shows the folders under it as `~` (absent from older daemons). */
|
|
2476
|
-
home:
|
|
2477
|
-
mobile:
|
|
2623
|
+
home: z33.string().optional(),
|
|
2624
|
+
mobile: z33.boolean().optional(),
|
|
2478
2625
|
/** Answers `openrig.status` and `openrig.act`: drives OpenRig on its machine. */
|
|
2479
|
-
openrig:
|
|
2626
|
+
openrig: z33.boolean().optional(),
|
|
2480
2627
|
/** Answers `openrig.roles`, `openrig.role` and `openrig.roleFile`: reads OpenRig's roles (agent specs). */
|
|
2481
|
-
openrigRoles:
|
|
2628
|
+
openrigRoles: z33.boolean().optional(),
|
|
2482
2629
|
/** Answers `openrig.graph`, `openrig.snapshots`, `openrig.permissions`, `openrig.queue` and `openrig.role.duplicate`, and takes the actions `rig.snapshot`, `rig.permissions` and `rig.start` with a `snapshot` (lot 7a):
|
|
2483
2630
|
* a client (the fleet) sends none of them to a daemon without it. */
|
|
2484
|
-
openrigRig:
|
|
2631
|
+
openrigRig: z33.boolean().optional(),
|
|
2485
2632
|
/** Takes the action `rig.policy` (lot 7c): a client (the fleet) sends it only when this is set. */
|
|
2486
|
-
openrigPolicy:
|
|
2633
|
+
openrigPolicy: z33.boolean().optional(),
|
|
2487
2634
|
/** Takes `rig.start` with `fresh` (lot 7d): a client (the fleet) sends it only when this is set. */
|
|
2488
|
-
openrigFresh:
|
|
2635
|
+
openrigFresh: z33.boolean().optional(),
|
|
2489
2636
|
/** Answers `ping` with `pong`: a client measures the round trip to this machine (lot 7d). */
|
|
2490
|
-
ping:
|
|
2637
|
+
ping: z33.boolean().optional(),
|
|
2491
2638
|
/** Answers `openrig.row`: a queue row's state, for the OpenRig task cards of a thread. */
|
|
2492
|
-
openrigRows:
|
|
2639
|
+
openrigRows: z33.boolean().optional(),
|
|
2493
2640
|
/** Answers `openrig.asks` and `openrig.answer`: what OpenRig asks the person, and their answers (« À toi »). */
|
|
2494
|
-
openrigAsks:
|
|
2641
|
+
openrigAsks: z33.boolean().optional(),
|
|
2495
2642
|
/** Answers `openrig.goal.send`, `openrig.goals` and `openrig.goal.reply`: goals given to Max (lot 2). */
|
|
2496
|
-
openrigGoals:
|
|
2643
|
+
openrigGoals: z33.boolean().optional(),
|
|
2497
2644
|
/** Takes `session.broadcast` (its `ledge bridge` too, on this machine): a client sends it only when this is set. */
|
|
2498
|
-
broadcast:
|
|
2645
|
+
broadcast: z33.boolean().optional(),
|
|
2499
2646
|
/** Sends `browser.live` and answers `browser.watch`, `browser.unwatch` and `browser.enable`: the agent's browser, live. */
|
|
2500
|
-
browserLive:
|
|
2647
|
+
browserLive: z33.boolean().optional(),
|
|
2501
2648
|
/** Answers `term.watch` and `term.shell`: the pane and the shells as a tmux control stream, xterm.js the only emulator. */
|
|
2502
|
-
terminalStream:
|
|
2649
|
+
terminalStream: z33.boolean().optional(),
|
|
2503
2650
|
/** Sends `usage.state` (each harness's account limits, the alerts, the threshold) and takes `usage.set` and `usage.ack`. */
|
|
2504
|
-
usage:
|
|
2651
|
+
usage: z33.boolean().optional(),
|
|
2505
2652
|
/** `term.watch` also streams an OpenRig seat (`@` in its tmux name), through a control client on the seat's own tmux server.
|
|
2506
2653
|
* Without it, a front keeps a seat on the pseudo-terminal: an older daemon answers its watch `failed`. */
|
|
2507
|
-
terminalStreamSeats:
|
|
2654
|
+
terminalStreamSeats: z33.boolean().optional(),
|
|
2508
2655
|
/** Sends `forge.state` and answers `forge.detail` and `forge.act`: the pull and merge requests of its sessions' branches (lot 8a). */
|
|
2509
|
-
forge:
|
|
2656
|
+
forge: z33.boolean().optional(),
|
|
2657
|
+
/** Answers `routine.list`, `routine.cmd` and `routine.preview`, and sends `routine.changed` (spec 2026-11-23 routines). */
|
|
2658
|
+
routines: z33.boolean().optional(),
|
|
2659
|
+
/** Answers a grouped `routine.cmd` (`others`) all or nothing: a client sends one only to a daemon that says it. */
|
|
2660
|
+
routineGroups: z33.boolean().optional(),
|
|
2510
2661
|
/** Its launcher answers `shell --nonce <N> <dir>` (#299): a free shell started through it gets the shell integration (OSC 633). */
|
|
2511
|
-
freeShell:
|
|
2662
|
+
freeShell: z33.boolean().optional()
|
|
2512
2663
|
});
|
|
2513
|
-
var UpdateFailureSchema =
|
|
2514
|
-
var ServerMessageSchema =
|
|
2664
|
+
var UpdateFailureSchema = z33.enum(["git-install", "no-systemd", "sessions-at-risk", "npm-failed", "busy"]);
|
|
2665
|
+
var ServerMessageSchema = z33.discriminatedUnion("type", [
|
|
2515
2666
|
BrowserLiveSchema,
|
|
2516
2667
|
BrowserFrameSchema,
|
|
2517
2668
|
BrowserEnabledSchema,
|
|
@@ -2520,7 +2671,7 @@ var ServerMessageSchema = z32.discriminatedUnion("type", [
|
|
|
2520
2671
|
TermSizeSchema,
|
|
2521
2672
|
TermExitSchema,
|
|
2522
2673
|
SessionModelAcceptedSchema,
|
|
2523
|
-
|
|
2674
|
+
z33.object({ type: z33.literal("chat.routed"), qid: z33.string(), result: RouteResultSchema }),
|
|
2524
2675
|
DocumentContentSchema,
|
|
2525
2676
|
DocumentErrorSchema,
|
|
2526
2677
|
AttachmentStoredSchema,
|
|
@@ -2553,87 +2704,87 @@ var ServerMessageSchema = z32.discriminatedUnion("type", [
|
|
|
2553
2704
|
/** `recents`: the folders of past sessions, most recent first. `launcher`: the command that runs `ledge` inside WSL
|
|
2554
2705
|
* (`[node, cli]`), so the overlay can attach a terminal to a session with `<launcher> attach <id>`. `daemon`: absent
|
|
2555
2706
|
* from daemons older than the auto-update. */
|
|
2556
|
-
|
|
2557
|
-
|
|
2707
|
+
z33.object({ type: z33.literal("snapshot"), sessions: z33.array(SessionSchema), recents: z33.array(RecentSchema).optional(), launcher: z33.array(z33.string()).optional(), daemon: DaemonInfoSchema.optional(), sshAlias: SshAliasSchema.optional() }),
|
|
2708
|
+
z33.object({ type: z33.literal("session.updated"), session: SessionSchema }),
|
|
2558
2709
|
/** OMP: the instructions taken back from its queue by an interrupt that restores it; the asker puts them back in its draft. */
|
|
2559
|
-
|
|
2560
|
-
type:
|
|
2561
|
-
id:
|
|
2562
|
-
texts:
|
|
2710
|
+
z33.object({
|
|
2711
|
+
type: z33.literal("session.queue.restored"),
|
|
2712
|
+
id: z33.string(),
|
|
2713
|
+
texts: z33.array(z33.string()),
|
|
2563
2714
|
/** The same instructions with the images they carried; `imagesDropped`: some images could not be put back. */
|
|
2564
|
-
entries:
|
|
2565
|
-
imagesDropped:
|
|
2715
|
+
entries: z33.array(z33.object({ text: z33.string(), attachments: z33.array(AttachmentIdSchema).optional() })).optional(),
|
|
2716
|
+
imagesDropped: z33.boolean().optional()
|
|
2566
2717
|
}),
|
|
2567
|
-
|
|
2568
|
-
|
|
2718
|
+
z33.object({ type: z33.literal("session.removed"), id: z33.string() }),
|
|
2719
|
+
z33.object({ type: z33.literal("session.preview"), id: z33.string(), lines: z33.array(z33.string()) }),
|
|
2569
2720
|
/** A session's thread, on request (spec 2026-10-13 §5); then each created or updated item, broadcast. */
|
|
2570
|
-
|
|
2571
|
-
|
|
2721
|
+
z33.object({ type: z33.literal("session.thread"), id: z33.string(), items: z33.array(ThreadItemSchema) }),
|
|
2722
|
+
z33.object({ type: z33.literal("session.thread.item"), id: z33.string(), item: ThreadItemSchema }),
|
|
2572
2723
|
/** Answer to the requester of a `session.launch`: the session exists (its `session.updated` is broadcast as usual). */
|
|
2573
|
-
|
|
2724
|
+
z33.object({ type: z33.literal("session.launched"), id: z33.string() }),
|
|
2574
2725
|
/** Answer to the requester of a `session.close`, once per row closed: the session `id` and how it ended. */
|
|
2575
|
-
|
|
2576
|
-
|
|
2726
|
+
z33.object({ type: z33.literal("session.closed"), qid: z33.string(), row: z33.number().int().min(0), id: z33.string(), how: z33.enum(["exit", "killed"]) }),
|
|
2727
|
+
z33.object({ type: z33.literal("recents"), recents: z33.array(RecentSchema) }),
|
|
2577
2728
|
/** Answer to the requester of a `folder.list` or `folder.create`: `path` resolved (`~` expanded), `parent` null at the
|
|
2578
2729
|
* root, `entries` its subfolders by name (hidden ones left out). A failure keeps the asked path and says why in `error`,
|
|
2579
2730
|
* never in an `error` message, which the launch form reads as a failed launch. */
|
|
2580
|
-
|
|
2581
|
-
type:
|
|
2582
|
-
path:
|
|
2583
|
-
parent:
|
|
2584
|
-
entries:
|
|
2585
|
-
error:
|
|
2731
|
+
z33.object({
|
|
2732
|
+
type: z33.literal("folder.listing"),
|
|
2733
|
+
path: z33.string(),
|
|
2734
|
+
parent: z33.string().nullable(),
|
|
2735
|
+
entries: z33.array(z33.string()),
|
|
2736
|
+
error: z33.string().optional(),
|
|
2586
2737
|
/** The request this answers, when it carried one. */
|
|
2587
|
-
requestId:
|
|
2738
|
+
requestId: z33.string().optional(),
|
|
2588
2739
|
/** Those `entries` that are Git repositories, with their branch (the short commit when HEAD is detached). */
|
|
2589
|
-
repos:
|
|
2740
|
+
repos: z33.array(z33.object({ name: z33.string(), branch: z33.string() })).optional()
|
|
2590
2741
|
}),
|
|
2591
2742
|
/** The chat (spec 2026-10-11 §5): what Ledge reads, its words as they come, the final text, or why it stopped; the day's turns after each snapshot. */
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2743
|
+
z33.object({ type: z33.literal("chat.step"), qid: z33.string(), step: ChatStepSchema }),
|
|
2744
|
+
z33.object({ type: z33.literal("chat.delta"), qid: z33.string(), text: z33.string() }),
|
|
2745
|
+
z33.object({ type: z33.literal("chat.done"), qid: z33.string(), text: z33.string(), at: z33.string().datetime(), proposal: ChatProposalSchema.optional(), proposals: ChatProposalsSchema.optional(), relay: ChatRelaySchema.optional(), closes: ChatClosesSchema.optional(), projectProposal: ChatProjectProposalSchema.optional(), tasks: ChatTasksSchema.optional(), actions: ChatActionsSchema.optional() }),
|
|
2595
2746
|
/** What a `chat.act` applied: the rows done, and the one that failed with why (the rows after it stay proposed). */
|
|
2596
|
-
|
|
2597
|
-
row:
|
|
2598
|
-
message:
|
|
2747
|
+
z33.object({ type: z33.literal("chat.acted"), rid: z33.string(), qid: z33.string(), done: z33.array(z33.number().int().min(0)), failed: z33.array(z33.object({
|
|
2748
|
+
row: z33.number().int().min(0),
|
|
2749
|
+
message: z33.string(),
|
|
2599
2750
|
/** nothing was sent */
|
|
2600
|
-
refused:
|
|
2751
|
+
refused: z33.literal(true).optional()
|
|
2601
2752
|
})) }),
|
|
2602
2753
|
/** What an `action.run` came to: `row` the action as the daemon resolved it (its summary, its risk); `reason` why it was not
|
|
2603
2754
|
* done, with `code` (`refused`: not possible now; `agent`: a session may not run it; `confirm_required`: destructive, ask
|
|
2604
2755
|
* again; `failed`: the handler turned it down; a free string, as an `error`'s). */
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2756
|
+
z33.object({ type: z33.literal("action.result"), rid: z33.string(), action: z33.string().min(1).max(40), row: ChatActionSchema.optional(), reason: z33.string().optional(), code: z33.string().optional() }),
|
|
2757
|
+
z33.object({ type: z33.literal("chat.error"), qid: z33.string(), message: z33.string() }),
|
|
2758
|
+
z33.object({ type: z33.literal("chat.history"), turns: z33.array(ChatTurnSchema) }),
|
|
2608
2759
|
/** The daemon updating itself: npm is running, then the service restarts (the socket closes right after). */
|
|
2609
|
-
|
|
2760
|
+
z33.object({ type: z33.literal("update.progress"), version: z33.string(), step: z33.enum(["installing", "restarting"]) }),
|
|
2610
2761
|
/** Nothing was changed. `detail`: the useful end of npm's output; `command`: what the person can run instead. */
|
|
2611
|
-
|
|
2762
|
+
z33.object({ type: z33.literal("update.failed"), version: z33.string(), reason: UpdateFailureSchema, detail: z33.string().optional(), command: z33.string().optional() }),
|
|
2612
2763
|
/** The shared machines list (spec 2026-10-14 §5), sent to local clients only. */
|
|
2613
|
-
|
|
2764
|
+
z33.object({ type: z33.literal("machines"), machines: MachinesSchema }),
|
|
2614
2765
|
/** The local daemon's projects and folder rules (spec 2026-10-16 build §5), sent to local clients only. */
|
|
2615
|
-
|
|
2766
|
+
z33.object({ type: z33.literal("projects"), projects: ProjectsSchema }),
|
|
2616
2767
|
/** The island's settings shared by the local fronts; null until a front sets them (the island then sends its own). Local clients only. */
|
|
2617
|
-
|
|
2768
|
+
z33.object({ type: z33.literal("island"), prefs: IslandPrefsSchema.nullable() }),
|
|
2618
2769
|
/** Mobile access (lot 3), after the island in each snapshot and on every change. Local clients only. */
|
|
2619
|
-
|
|
2770
|
+
z33.object({ type: z33.literal("mobile"), state: MobileStateSchema }),
|
|
2620
2771
|
/** A passkey recovery as it happens (docs/mobile-passkey-recover-contract.md), for the local fronts' toast; the lasting trace is in `mobile`. */
|
|
2621
|
-
|
|
2772
|
+
z33.object({ type: z33.literal("mobile.recovery") }).merge(MobileRecoveryEventSchema),
|
|
2622
2773
|
/** The sessions a phone types into (« Téléphone au clavier »), after each snapshot and each change; `device` is its label. */
|
|
2623
|
-
|
|
2774
|
+
z33.object({ type: z33.literal("terminal.holders"), holds: z33.array(z33.object({ id: z33.string(), device: z33.string() })) }),
|
|
2624
2775
|
/** The daemon's immediate answer to a `session.message`: delivered (`accepted`), held for later (`queued`), left to Claude's own SendMessage (`native`), or refused with a `reason`. */
|
|
2625
|
-
|
|
2626
|
-
type:
|
|
2627
|
-
rid:
|
|
2628
|
-
outcome:
|
|
2629
|
-
reason:
|
|
2776
|
+
z33.object({
|
|
2777
|
+
type: z33.literal("message.ack"),
|
|
2778
|
+
rid: z33.string(),
|
|
2779
|
+
outcome: z33.enum(["accepted", "queued", "native", "refused"]),
|
|
2780
|
+
reason: z33.string().optional(),
|
|
2630
2781
|
/** A broadcast's per-recipient outcome, by name. */
|
|
2631
|
-
recipients:
|
|
2782
|
+
recipients: z33.object({ sent: z33.array(z33.string()), refused: z33.array(z33.object({ name: z33.string(), reason: z33.string() })) }).optional()
|
|
2632
2783
|
}),
|
|
2633
2784
|
/** The answer to a `session.broadcast`: who got it (`sent`) and who did not; `reason`: the whole broadcast was refused. */
|
|
2634
|
-
|
|
2785
|
+
z33.object({ type: z33.literal("session.broadcast.result"), rid: z33.string(), sent: z33.array(z33.object({ id: z33.string(), name: z33.string() })), refused: z33.array(z33.object({ name: z33.string(), reason: z33.string() })), reason: z33.string().optional() }),
|
|
2635
2786
|
/** The answer to a `message.read`: the body with its sender, target and time, or the refusal's `reason`. */
|
|
2636
|
-
|
|
2787
|
+
z33.object({ type: z33.literal("message.body"), id: z33.string(), from: z33.string().optional(), to: z33.string().optional(), at: z33.string().optional(), text: z33.string().optional(), reason: z33.string().optional() }),
|
|
2637
2788
|
TaskResultSchema,
|
|
2638
2789
|
ReportPreviewReplySchema,
|
|
2639
2790
|
ReportCreatedSchema,
|
|
@@ -2648,22 +2799,27 @@ var ServerMessageSchema = z32.discriminatedUnion("type", [
|
|
|
2648
2799
|
HandoverResultSchema,
|
|
2649
2800
|
TaskUpdatedSchema,
|
|
2650
2801
|
BrainResultSchema,
|
|
2802
|
+
/** Routines (spec 2026-11-23): the list, a command's answer, and every change to every front. */
|
|
2803
|
+
RoutineListedSchema,
|
|
2804
|
+
RoutineResultSchema,
|
|
2805
|
+
RoutineChangedSchema,
|
|
2806
|
+
RoutinePreviewedSchema,
|
|
2651
2807
|
/** The operator's notices, broadcast on change and in the snapshot. */
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
type:
|
|
2655
|
-
message:
|
|
2656
|
-
id:
|
|
2808
|
+
z33.object({ type: z33.literal("operator.state"), notices: z33.array(OperatorNoticeSchema).max(50) }),
|
|
2809
|
+
z33.object({
|
|
2810
|
+
type: z33.literal("error"),
|
|
2811
|
+
message: z33.string(),
|
|
2812
|
+
id: z33.string().optional(),
|
|
2657
2813
|
/** Le type du message client refusé. */
|
|
2658
|
-
request:
|
|
2814
|
+
request: z33.string().optional(),
|
|
2659
2815
|
/** Ce que le front doit reconnaître au-delà du texte (NOTE_NOT_TYPED) ; une chaîne libre, qu'un front plus ancien ignore. */
|
|
2660
|
-
code:
|
|
2816
|
+
code: z33.string().optional()
|
|
2661
2817
|
})
|
|
2662
2818
|
]);
|
|
2663
2819
|
var MESSAGE_MAX = 2e4;
|
|
2664
2820
|
var SUMMARY_MAX = 500;
|
|
2665
|
-
var launchRows =
|
|
2666
|
-
var ClientMessageSchema =
|
|
2821
|
+
var launchRows = z33.array(z33.number().int().min(0).max(MAX_PROPOSALS - 1)).min(1).max(MAX_PROPOSALS).refine((r) => new Set(r).size === r.length, "a row twice");
|
|
2822
|
+
var ClientMessageSchema = z33.discriminatedUnion("type", [
|
|
2667
2823
|
BrowserWatchSchema,
|
|
2668
2824
|
BrowserUnwatchSchema,
|
|
2669
2825
|
BrowserEnableSchema,
|
|
@@ -2672,7 +2828,7 @@ var ClientMessageSchema = z32.discriminatedUnion("type", [
|
|
|
2672
2828
|
TermUnwatchSchema,
|
|
2673
2829
|
TermInputSchema,
|
|
2674
2830
|
TermResizeSchema,
|
|
2675
|
-
|
|
2831
|
+
z33.object({ type: z33.literal("chat.route"), qid: z33.string().min(1).max(100), text: z33.string().min(1).max(2e4), tool: ToolSchema.optional(), context: RoutingContextSchema }),
|
|
2676
2832
|
DocumentReadSchema,
|
|
2677
2833
|
AttachmentPutSchema,
|
|
2678
2834
|
AttachmentCaptureSchema,
|
|
@@ -2705,188 +2861,188 @@ var ClientMessageSchema = z32.discriminatedUnion("type", [
|
|
|
2705
2861
|
* free one otherwise), `prompt` the agent's first instruction, `continue` resumes the folder's last conversation.
|
|
2706
2862
|
* With `qid` it is the chat card of that turn: the daemon launches the turn's proposal and ignores the other fields
|
|
2707
2863
|
* but `rows`, `model` and `effort`. */
|
|
2708
|
-
|
|
2709
|
-
type:
|
|
2864
|
+
z33.object({
|
|
2865
|
+
type: z33.literal("session.launch"),
|
|
2710
2866
|
tool: ToolSchema,
|
|
2711
|
-
cwd:
|
|
2712
|
-
name:
|
|
2713
|
-
prompt:
|
|
2714
|
-
continue:
|
|
2715
|
-
qid:
|
|
2867
|
+
cwd: z33.string().min(1),
|
|
2868
|
+
name: z33.string().optional(),
|
|
2869
|
+
prompt: z33.string().optional(),
|
|
2870
|
+
continue: z33.boolean().optional(),
|
|
2871
|
+
qid: z33.string().min(1).optional(),
|
|
2716
2872
|
/** With `qid`: the card's rows to launch (#24), indexes into the turn's `proposals`, each once; the first row without it. */
|
|
2717
2873
|
rows: launchRows.optional(),
|
|
2718
2874
|
/** Folders in addition to `cwd` (Claude: `--add-dir`); resolved like `cwd`. */
|
|
2719
|
-
dirs:
|
|
2875
|
+
dirs: z33.array(z33.string().min(1)).max(20).optional(),
|
|
2720
2876
|
/** The agent's model and effort (#58), the agent's own default when left out; with `qid`, for every row launched. */
|
|
2721
2877
|
model: ModelIdSchema.optional(),
|
|
2722
2878
|
effort: EffortSchema.optional(),
|
|
2723
2879
|
/** OMP only: its approval mode, `always-ask` when left out. */
|
|
2724
2880
|
approval: OmpApprovalSchema.optional(),
|
|
2725
2881
|
/** Routing by the fleet, removed before the message reaches the daemon. */
|
|
2726
|
-
machineId:
|
|
2882
|
+
machineId: z33.string().optional()
|
|
2727
2883
|
}),
|
|
2728
2884
|
/** The launch form's folder browser: list a folder's subfolders (home when no `path`), or make `name` inside `parent`
|
|
2729
2885
|
* and list it. Both are answered with a `folder.listing`. */
|
|
2730
|
-
|
|
2731
|
-
type:
|
|
2732
|
-
path:
|
|
2886
|
+
z33.object({
|
|
2887
|
+
type: z33.literal("folder.list"),
|
|
2888
|
+
path: z33.string().optional(),
|
|
2733
2889
|
/** Routing by the fleet, removed before the message reaches the daemon. */
|
|
2734
|
-
machineId:
|
|
2890
|
+
machineId: z33.string().optional(),
|
|
2735
2891
|
/** Copied into the `folder.listing` that answers; the fleet relays only that listing, from the machine asked. */
|
|
2736
|
-
requestId:
|
|
2892
|
+
requestId: z33.string().min(1).max(100).optional()
|
|
2737
2893
|
}),
|
|
2738
|
-
|
|
2739
|
-
type:
|
|
2740
|
-
parent:
|
|
2741
|
-
name:
|
|
2894
|
+
z33.object({
|
|
2895
|
+
type: z33.literal("folder.create"),
|
|
2896
|
+
parent: z33.string().min(1),
|
|
2897
|
+
name: z33.string().min(1),
|
|
2742
2898
|
/** As for `folder.list`: routing by the fleet, and the request its `folder.listing` answers. */
|
|
2743
|
-
machineId:
|
|
2744
|
-
requestId:
|
|
2899
|
+
machineId: z33.string().optional(),
|
|
2900
|
+
requestId: z33.string().min(1).max(100).optional()
|
|
2745
2901
|
}),
|
|
2746
2902
|
/** `steer`: OMP only, redirect the turn running now instead of queueing the text after it. */
|
|
2747
2903
|
/** OMP's `ask`: the answers to every question of the dialog `requestId`, in order (`selected` labels, and/or free `text`); `cancel` declines it. */
|
|
2748
|
-
|
|
2904
|
+
z33.object({ type: z33.literal("session.answer"), id: z33.string(), requestId: z33.string().min(1).max(200), answers: z33.array(z33.object({ id: z33.string(), selected: z33.array(z33.string().max(2e3)).max(100), text: z33.string().max(2e4).optional() })).max(50), cancel: z33.boolean().optional() }),
|
|
2749
2905
|
/** `by`: as session.decide's, who answers when the reply answers a request (set by the phone gateway for a device; absent, the PC). */
|
|
2750
|
-
|
|
2906
|
+
z33.object({ type: z33.literal("session.reply"), id: z33.string(), text: z33.string(), attachments: z33.array(AttachmentIdSchema).max(ATTACHMENTS_MAX).optional(), steer: z33.boolean().optional(), by: DecidedBySchema.optional() }),
|
|
2751
2907
|
/** The chat card's instruction (spec 2026-10-12 relay §4): sent now if the session is free, else queued until it is. */
|
|
2752
|
-
|
|
2908
|
+
z33.object({ type: z33.literal("session.relay"), qid: z33.string().min(1) }),
|
|
2753
2909
|
/** Takes the card's queued instruction back out of the queue. */
|
|
2754
|
-
|
|
2910
|
+
z33.object({ type: z33.literal("session.relay.cancel"), qid: z33.string().min(1) }),
|
|
2755
2911
|
/** The chat's generic card (action registry spec §5.1): applies its rows in order (all of them without `rows`), stopping at
|
|
2756
2912
|
* the first failure. `confirmed` says the front asked again; refused without it when a row is destructive. */
|
|
2757
|
-
|
|
2758
|
-
type:
|
|
2759
|
-
rid:
|
|
2760
|
-
qid:
|
|
2913
|
+
z33.object({
|
|
2914
|
+
type: z33.literal("chat.act"),
|
|
2915
|
+
rid: z33.string().min(1).max(100),
|
|
2916
|
+
qid: z33.string().min(1),
|
|
2761
2917
|
rows: launchRows.optional(),
|
|
2762
|
-
confirmed:
|
|
2918
|
+
confirmed: z33.literal(true).optional(),
|
|
2763
2919
|
/** « Refuser »: each row (session.decide only) answers its session's request with deny, whatever its own decision; never
|
|
2764
2920
|
* confirmed, and allowed on a request shown cut. The rows become `denied`. */
|
|
2765
|
-
deny:
|
|
2921
|
+
deny: z33.literal(true).optional()
|
|
2766
2922
|
}),
|
|
2767
2923
|
/** « Ignorer » the turn's cards, for every device and for Ledge (who is told at the next question); `undo` opens them
|
|
2768
2924
|
* again (« Revoir »). Refused while one of them is under way. Every client gets the turn's `ignoredAt` through chat.history. */
|
|
2769
|
-
|
|
2925
|
+
z33.object({ type: z33.literal("chat.ignore"), qid: z33.string().min(1), undo: z33.literal(true).optional() }),
|
|
2770
2926
|
/** The operator's point: answer a row (`item` is its id), set the point aside, or mark events up to `eventId` read by the sender's device. */
|
|
2771
|
-
|
|
2772
|
-
type:
|
|
2773
|
-
qid:
|
|
2774
|
-
item:
|
|
2927
|
+
z33.object({
|
|
2928
|
+
type: z33.literal("point.act"),
|
|
2929
|
+
qid: z33.string().min(1),
|
|
2930
|
+
item: z33.string().min(1).max(200),
|
|
2775
2931
|
answer: PointAnswerSchema.optional(),
|
|
2776
2932
|
/** Applies the row's suggestion instead of answering it (exactly one of `answer` and `suggest`). */
|
|
2777
|
-
suggest:
|
|
2933
|
+
suggest: z33.literal(true).optional(),
|
|
2778
2934
|
/** The front's confirmation of a destructive answer (an accepted request, a decision), as `chat.act` takes it. */
|
|
2779
|
-
confirmed:
|
|
2935
|
+
confirmed: z33.literal(true).optional()
|
|
2780
2936
|
}),
|
|
2781
|
-
|
|
2782
|
-
|
|
2937
|
+
z33.object({ type: z33.literal("point.later"), qid: z33.string().min(1) }),
|
|
2938
|
+
z33.object({ type: z33.literal("operator.read"), eventId: z33.number().int().min(0) }),
|
|
2783
2939
|
/** A registry action run outside the chat (#93, the CLI): the daemon resolves `args` as it does a generic card's row, then
|
|
2784
2940
|
* applies it through its own handler. `by` the session that asks, left out for the user; `confirmed` for a destructive one. */
|
|
2785
|
-
|
|
2786
|
-
type:
|
|
2787
|
-
rid:
|
|
2788
|
-
by:
|
|
2941
|
+
z33.object({
|
|
2942
|
+
type: z33.literal("action.run"),
|
|
2943
|
+
rid: z33.string().min(1).max(100),
|
|
2944
|
+
by: z33.string().min(1).optional(),
|
|
2789
2945
|
/** `by`'s key (LEDGE_SESSION_KEY) */
|
|
2790
|
-
key:
|
|
2946
|
+
key: z33.string().max(128).optional(),
|
|
2791
2947
|
action: ActionIdSchema,
|
|
2792
|
-
args:
|
|
2793
|
-
confirmed:
|
|
2948
|
+
args: z33.record(z33.unknown()),
|
|
2949
|
+
confirmed: z33.literal(true).optional()
|
|
2794
2950
|
}),
|
|
2795
2951
|
/** The chat's close card: closes the turn's sessions, `rows` (indexes into its `closes`) or all of them. */
|
|
2796
|
-
|
|
2952
|
+
z33.object({ type: z33.literal("session.close"), qid: z33.string().min(1), rows: launchRows.optional() }),
|
|
2797
2953
|
/** `always` and `note` only where the harness offers them (`offers`); a note goes with `deny`, for the agent to read. */
|
|
2798
|
-
|
|
2799
|
-
type:
|
|
2800
|
-
id:
|
|
2954
|
+
z33.object({
|
|
2955
|
+
type: z33.literal("session.decide"),
|
|
2956
|
+
id: z33.string(),
|
|
2801
2957
|
decision: DecisionSchema,
|
|
2802
|
-
note:
|
|
2958
|
+
note: z33.string().trim().min(1).max(NOTE_MAX).optional(),
|
|
2803
2959
|
/** The request the user saw when deciding: refused (the request changed) unless it is still the pending one. Left out by older fronts and the island.
|
|
2804
2960
|
* `key` (pendingKey) covers its whole content; older fronts send kind and text only. */
|
|
2805
|
-
expect: PendingSchema.pick({ kind: true, text: true }).extend({ key:
|
|
2961
|
+
expect: PendingSchema.pick({ kind: true, text: true }).extend({ key: z33.string().max(64).optional() }).optional(),
|
|
2806
2962
|
/** Who decides: set by the phone gateway for a device (over anything the device sent); left out by a local front, which means the PC. */
|
|
2807
2963
|
by: DecidedBySchema.optional()
|
|
2808
2964
|
}),
|
|
2809
|
-
|
|
2810
|
-
|
|
2965
|
+
z33.object({ type: z33.literal("session.focus"), id: z33.string() }),
|
|
2966
|
+
z33.object({ type: z33.literal("session.kill"), id: z33.string() }),
|
|
2811
2967
|
/** `restoreQueue` (OMP): also take back what waits in its queue, returned as `session.queue.restored` to put in the draft. */
|
|
2812
|
-
|
|
2968
|
+
z33.object({ type: z33.literal("session.interrupt"), id: z33.string(), restoreQueue: z33.boolean().optional() }),
|
|
2813
2969
|
/** Removes a finished (exited) or read-only (hook_only) session from the list; refused for a live launcher session. */
|
|
2814
|
-
|
|
2970
|
+
z33.object({ type: z33.literal("session.dismiss"), id: z33.string() }),
|
|
2815
2971
|
/** Puts a session in the archive: it leaves the live list but is kept. */
|
|
2816
|
-
|
|
2972
|
+
z33.object({ type: z33.literal("session.archive"), id: z33.string() }),
|
|
2817
2973
|
/** Takes an archived session back out of the archive, as it was. */
|
|
2818
|
-
|
|
2974
|
+
z33.object({ type: z33.literal("session.restore"), id: z33.string() }),
|
|
2819
2975
|
/** Starts the agent again on an archived session's conversation. */
|
|
2820
|
-
|
|
2976
|
+
z33.object({ type: z33.literal("session.resume"), id: z33.string() }),
|
|
2821
2977
|
/** Changes a live session's model and effort (#58, lot 2), `null` for the agent's own default: the daemon restarts the
|
|
2822
2978
|
* agent on the same conversation with them, at once when the session is free, else at its next free moment. */
|
|
2823
|
-
|
|
2979
|
+
z33.object({ type: z33.literal("session.model"), id: z33.string(), model: ModelIdSchema.nullable(), effort: EffortSchema.nullable() }),
|
|
2824
2980
|
/** Deletes a session for good, archived or not. */
|
|
2825
|
-
|
|
2981
|
+
z33.object({ type: z33.literal("session.delete"), id: z33.string() }),
|
|
2826
2982
|
/** The user names the session's topic from the overlay (500 characters at most, the hook's prompt cap); an empty topic hands back to the automatic sources. */
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2983
|
+
z33.object({ type: z33.literal("session.rename"), id: z33.string(), topic: z33.string().max(500) }),
|
|
2984
|
+
z33.object({ type: z33.literal("session.thread"), id: z33.string() }),
|
|
2985
|
+
z33.object({ type: z33.literal("session.register"), session: SessionSchema }),
|
|
2830
2986
|
/** `agent` and `cwd` describe the session when the daemon does not know it yet (a hook from an agent started without ledge). */
|
|
2831
|
-
|
|
2832
|
-
type:
|
|
2833
|
-
id:
|
|
2987
|
+
z33.object({
|
|
2988
|
+
type: z33.literal("session.event"),
|
|
2989
|
+
id: z33.string(),
|
|
2834
2990
|
event: SessionEventSchema,
|
|
2835
2991
|
agent: ToolSchema.optional(),
|
|
2836
|
-
cwd:
|
|
2992
|
+
cwd: z33.string().optional(),
|
|
2837
2993
|
/** The OpenRig seat the agent runs in (`OPENRIG_SESSION_NAME`, `pod-member@rig`), when OpenRig launched it. */
|
|
2838
2994
|
rigSeat: RigSeatNameSchema.optional()
|
|
2839
2995
|
}),
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2996
|
+
z33.object({ type: z33.literal("session.unregister"), id: z33.string(), exitCode: z33.number().int().nullable() }),
|
|
2997
|
+
z33.object({ type: z33.literal("snapshot.request") }),
|
|
2998
|
+
z33.object({ type: z33.literal("chat.ask"), qid: z33.string().min(1), text: z33.string(), images: z33.array(ImageUploadSchema).max(ATTACHMENTS_MAX).optional(), tool: ToolSchema.optional() }),
|
|
2999
|
+
z33.object({ type: z33.literal("chat.cancel"), qid: z33.string().min(1) }),
|
|
2844
3000
|
/** Starts a new conversation with Ledge: the day's turns are cleared and the next question opens a new harness session. */
|
|
2845
|
-
|
|
3001
|
+
z33.object({ type: z33.literal("chat.reset") }),
|
|
2846
3002
|
/** Installs `@paradow/ledge@version` and restarts the service (spec 2026-10-12 auto-update §6). */
|
|
2847
|
-
|
|
3003
|
+
z33.object({ type: z33.literal("update.daemon"), version: z33.string().regex(SEMVER) }),
|
|
2848
3004
|
/** Replaces the daemon's machines list (first connected front wins); refused unless valid. */
|
|
2849
|
-
|
|
3005
|
+
z33.object({ type: z33.literal("machines.set"), machines: MachinesSchema }),
|
|
2850
3006
|
/** Replaces the local daemon's projects and rules as a whole; refused unless valid. */
|
|
2851
|
-
|
|
3007
|
+
z33.object({ type: z33.literal("projects.set"), projects: ProjectsSchema }),
|
|
2852
3008
|
/** Replaces the island's settings as a whole; refused unless valid. */
|
|
2853
|
-
|
|
3009
|
+
z33.object({ type: z33.literal("island.set"), prefs: IslandPrefsSchema }),
|
|
2854
3010
|
/** Mobile access (lot 3), local fronts only. A changed `relayUrl` drops the relay session. */
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
3011
|
+
z33.object({ type: z33.literal("mobile.set"), enabled: z33.boolean(), relayUrl: RelayUrlSchema }),
|
|
3012
|
+
z33.object({ type: z33.literal("mobile.signin") }),
|
|
3013
|
+
z33.object({ type: z33.literal("mobile.signin.cancel") }),
|
|
3014
|
+
z33.object({ type: z33.literal("mobile.signout") }),
|
|
2859
3015
|
/** While the link is offline: try again now. */
|
|
2860
|
-
|
|
3016
|
+
z33.object({ type: z33.literal("mobile.retry") }),
|
|
2861
3017
|
/** `replaces`: an approved device this one takes the place of (the same app reinstalled), revoked once this one is stored. */
|
|
2862
|
-
|
|
2863
|
-
|
|
3018
|
+
z33.object({ type: z33.literal("mobile.pairing.approve"), id: z33.string().min(1).max(100), replaces: z33.string().min(1).max(100).optional() }),
|
|
3019
|
+
z33.object({ type: z33.literal("mobile.pairing.deny"), id: z33.string().min(1).max(100) }),
|
|
2864
3020
|
/** `id`: the device's fingerprint. */
|
|
2865
|
-
|
|
3021
|
+
z33.object({ type: z33.literal("mobile.device.revoke"), id: z33.string().min(1).max(100) }),
|
|
2866
3022
|
/** Names a device (`id`: its fingerprint); the device sees its new name in its next snapshot. */
|
|
2867
|
-
|
|
3023
|
+
z33.object({ type: z33.literal("mobile.device.rename"), id: z33.string().min(1).max(100), name: DeviceNameSchema }),
|
|
2868
3024
|
/** « Taper dans les terminaux depuis le téléphone »; turned off, every phone loses the hand. */
|
|
2869
|
-
|
|
3025
|
+
z33.object({ type: z33.literal("mobile.terminal"), input: z33.boolean() }),
|
|
2870
3026
|
/** « C'était bien moi » (`recovered`: its notice goes, the trace stays) or « Compris » (`refused`) on a device's row. */
|
|
2871
|
-
|
|
3027
|
+
z33.object({ type: z33.literal("mobile.device.ack"), id: z33.string().min(1).max(100), what: z33.enum(["recovered", "refused"]) }),
|
|
2872
3028
|
/** « Débloquer »: passkey recovery is taken again after 3 failed verifications. */
|
|
2873
|
-
|
|
3029
|
+
z33.object({ type: z33.literal("mobile.recovery.unblock") }),
|
|
2874
3030
|
/** « Reprendre la main »: the phone typing into the session's terminal goes back to reading it. */
|
|
2875
|
-
|
|
3031
|
+
z33.object({ type: z33.literal("terminal.release"), id: z33.string().min(1) }),
|
|
2876
3032
|
/** One session writing to another by Ledge name (`to` may end in ` [ref]`); `intercept` (the Claude hook): answer `native` unless `to` is a live non-Claude session. */
|
|
2877
|
-
|
|
3033
|
+
z33.object({ type: z33.literal("session.message"), rid: z33.string().min(1), from: z33.string().min(1), to: z33.string().min(1), text: z33.string().min(1).max(MESSAGE_MAX), summary: z33.string().max(SUMMARY_MAX).optional(), intercept: z33.boolean().optional() }),
|
|
2878
3034
|
/** The user writing to every session of a project, or to several sessions (ids or names). */
|
|
2879
|
-
|
|
2880
|
-
type:
|
|
2881
|
-
rid:
|
|
2882
|
-
to:
|
|
2883
|
-
text:
|
|
2884
|
-
summary:
|
|
3035
|
+
z33.object({
|
|
3036
|
+
type: z33.literal("session.broadcast"),
|
|
3037
|
+
rid: z33.string().min(1).max(100),
|
|
3038
|
+
to: z33.union([z33.object({ project: z33.string().min(1).max(80) }), z33.object({ sessions: z33.array(z33.string().min(1)).min(1).max(BROADCAST_SESSIONS_MAX) })]),
|
|
3039
|
+
text: z33.string().trim().min(1).max(MESSAGE_MAX),
|
|
3040
|
+
summary: z33.string().max(SUMMARY_MAX).optional(),
|
|
2885
3041
|
/** How the recipients are told who it went to (« (à <label>) »), instead of the names: a project the fleet turned into sessions. */
|
|
2886
|
-
label:
|
|
3042
|
+
label: z33.string().min(1).max(BROADCAST_LABEL_MAX).optional()
|
|
2887
3043
|
}),
|
|
2888
3044
|
/** `ledge read <id>`: a message's whole body, for its receiver or its sender (`by`, a session id). */
|
|
2889
|
-
|
|
3045
|
+
z33.object({ type: z33.literal("message.read"), id: z33.string().min(1).max(40), by: z33.string().min(1) }),
|
|
2890
3046
|
TaskCmdSchema,
|
|
2891
3047
|
/** Reports (issue #9): the « Signaler » form's preview, creation and an agent's report ignored; `ledge report`. */
|
|
2892
3048
|
ReportPreviewSchema,
|
|
@@ -2904,115 +3060,119 @@ var ClientMessageSchema = z32.discriminatedUnion("type", [
|
|
|
2904
3060
|
BrainAnswerSchema,
|
|
2905
3061
|
BrainListSchema,
|
|
2906
3062
|
BrainNoteSchema,
|
|
2907
|
-
BrainAddSchema
|
|
3063
|
+
BrainAddSchema,
|
|
3064
|
+
/** Routines (spec 2026-11-23): `ledge routine …` and the Routines screens. */
|
|
3065
|
+
RoutineListSchema,
|
|
3066
|
+
RoutineCmdSchema,
|
|
3067
|
+
RoutinePreviewSchema
|
|
2908
3068
|
]);
|
|
2909
3069
|
|
|
2910
3070
|
// ../../packages/protocol/src/relay.ts
|
|
2911
|
-
import { z as
|
|
3071
|
+
import { z as z34 } from "zod";
|
|
2912
3072
|
var SEALED_MAX = 1048576;
|
|
2913
|
-
var RelayPeerSchema =
|
|
2914
|
-
var RelayClientMessageSchema =
|
|
2915
|
-
type:
|
|
3073
|
+
var RelayPeerSchema = z34.union([z34.literal("pc"), z34.string().regex(/^d_[A-Za-z0-9_-]{16,40}$/)]);
|
|
3074
|
+
var RelayClientMessageSchema = z34.object({
|
|
3075
|
+
type: z34.literal("send"),
|
|
2916
3076
|
to: RelayPeerSchema,
|
|
2917
|
-
body:
|
|
3077
|
+
body: z34.string().max(SEALED_MAX)
|
|
2918
3078
|
});
|
|
2919
|
-
var RelayServerMessageSchema =
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
3079
|
+
var RelayServerMessageSchema = z34.discriminatedUnion("type", [
|
|
3080
|
+
z34.object({ type: z34.literal("welcome"), accountId: z34.string(), self: RelayPeerSchema, online: z34.array(RelayPeerSchema) }),
|
|
3081
|
+
z34.object({ type: z34.literal("deliver"), from: RelayPeerSchema, body: z34.string() }),
|
|
3082
|
+
z34.object({ type: z34.literal("presence"), peer: RelayPeerSchema, online: z34.boolean() }),
|
|
2923
3083
|
/**
|
|
2924
3084
|
* A frame was refused; `to` names the target when it is known.
|
|
2925
3085
|
* Contract: an error concerning a sealed body (`offline`, `too_large`, or a socket closed with 4008
|
|
2926
3086
|
* `rate_limited`) means that body was not delivered, so the sequence on that channel is lost: the
|
|
2927
3087
|
* sender must re-handshake with that peer before sending to it again.
|
|
2928
3088
|
*/
|
|
2929
|
-
|
|
2930
|
-
type:
|
|
2931
|
-
code:
|
|
3089
|
+
z34.object({
|
|
3090
|
+
type: z34.literal("error"),
|
|
3091
|
+
code: z34.enum(["bad_frame", "too_large", "bad_target", "offline", "rate_limited"]),
|
|
2932
3092
|
to: RelayPeerSchema.optional()
|
|
2933
3093
|
})
|
|
2934
3094
|
]);
|
|
2935
3095
|
var PAIR_LABEL_MAX = 40;
|
|
2936
|
-
var KeyB64 =
|
|
2937
|
-
var Nonce =
|
|
2938
|
-
var Fingerprint =
|
|
2939
|
-
var B64U =
|
|
2940
|
-
var RecoverWhySchema =
|
|
3096
|
+
var KeyB64 = z34.string().regex(/^[A-Za-z0-9_-]{87}$/);
|
|
3097
|
+
var Nonce = z34.string().regex(/^[A-Za-z0-9_-]{43}$/);
|
|
3098
|
+
var Fingerprint = z34.string().regex(/^[A-Za-z0-9_-]{22}$/);
|
|
3099
|
+
var B64U = z34.string().regex(/^[A-Za-z0-9_-]*$/);
|
|
3100
|
+
var RecoverWhySchema = z34.enum(["none", "old", "offline", "otherPc", "timeout", "revoked", "connected", "rate", "blocked", "failed"]);
|
|
2941
3101
|
var RecoverRefusalSchema = RecoverWhySchema.extract(["revoked", "connected", "rate", "blocked", "failed"]);
|
|
2942
|
-
var ModelLabel =
|
|
2943
|
-
var RecoverAssertion =
|
|
3102
|
+
var ModelLabel = z34.string().trim().min(1).max(PAIR_LABEL_MAX);
|
|
3103
|
+
var RecoverAssertion = z34.object({
|
|
2944
3104
|
id: B64U.max(1366),
|
|
2945
3105
|
clientDataJSON: B64U.max(4096),
|
|
2946
3106
|
authenticatorData: B64U.max(4096),
|
|
2947
3107
|
signature: B64U.max(1024)
|
|
2948
3108
|
}).strict();
|
|
2949
|
-
var SealedFrameSchema =
|
|
3109
|
+
var SealedFrameSchema = z34.discriminatedUnion("k", [
|
|
2950
3110
|
/** `e` is the ephemeral key, `f` the fingerprint of the sender's static key. */
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
3111
|
+
z34.object({ k: z34.literal("hello"), e: KeyB64, f: Fingerprint }),
|
|
3112
|
+
z34.object({ k: z34.literal("msg"), s: z34.string() }),
|
|
3113
|
+
z34.object({ k: z34.literal("pair_commit"), c: Nonce, label: z34.string().trim().min(1).max(PAIR_LABEL_MAX) }),
|
|
3114
|
+
z34.object({ k: z34.literal("pair_offer"), pc: KeyB64, n: Nonce }),
|
|
3115
|
+
z34.object({ k: z34.literal("pair_reveal"), d: KeyB64, n: Nonce }),
|
|
3116
|
+
z34.object({ k: z34.literal("pair_ok") }),
|
|
3117
|
+
z34.object({ k: z34.literal("pair_no") }),
|
|
3118
|
+
z34.object({ k: z34.literal("denied") }),
|
|
3119
|
+
z34.object({ k: z34.literal("rekey") }),
|
|
2960
3120
|
// ── Passkey recovery after a reinstall (unsealed, like pairing: nothing in them lets the relay act) ──
|
|
2961
3121
|
/** Phone → PC: the app's new device key `d`, its nonce `n`, and what it runs on (`iPhone`, `iPad`), told to the PC as it is. */
|
|
2962
|
-
|
|
3122
|
+
z34.object({ k: z34.literal("recover_start"), d: KeyB64, n: Nonce, model: ModelLabel.optional() }),
|
|
2963
3123
|
/** PC → phone: its key `pc`, a one-use nonce `n` (60 s), and its name (`WSL`), for the phone's screens. */
|
|
2964
|
-
|
|
3124
|
+
z34.object({ k: z34.literal("recover_offer"), pc: KeyB64, n: Nonce, name: z34.string().max(PAIR_LABEL_MAX).optional() }),
|
|
2965
3125
|
/** Phone → PC: the discoverable assertion over `recoverChallenge(pc, d, pcNonce, n)`, and its `userHandle` (« L1 » ‖ digest ‖ random). */
|
|
2966
|
-
|
|
3126
|
+
z34.object({ k: z34.literal("recover_proof"), assertion: RecoverAssertion, userHandle: B64U.max(128) }),
|
|
2967
3127
|
/** PC → phone: the device is back under its new key; `name` the one it keeps. The phone pins the PC key, then says `hello`. */
|
|
2968
|
-
|
|
3128
|
+
z34.object({ k: z34.literal("recover_ok"), name: z34.string().max(PAIR_LABEL_MAX).optional() }),
|
|
2969
3129
|
/** PC → phone: refused. `device` the device the passkey names (`revoked`, `connected`); `revokedAt` when it was revoked (ISO,
|
|
2970
3130
|
* `revoked` within 90 days); `retryInMs` until a recovery is taken again (`rate`). */
|
|
2971
|
-
|
|
2972
|
-
k:
|
|
3131
|
+
z34.object({
|
|
3132
|
+
k: z34.literal("recover_no"),
|
|
2973
3133
|
why: RecoverRefusalSchema,
|
|
2974
|
-
device:
|
|
2975
|
-
revokedAt:
|
|
2976
|
-
retryInMs:
|
|
3134
|
+
device: z34.string().max(PAIR_LABEL_MAX).optional(),
|
|
3135
|
+
revokedAt: z34.string().datetime().optional(),
|
|
3136
|
+
retryInMs: z34.number().int().min(0).optional()
|
|
2977
3137
|
})
|
|
2978
3138
|
]);
|
|
2979
3139
|
|
|
2980
3140
|
// ../../packages/protocol/src/relayAuth.ts
|
|
2981
|
-
import { z as
|
|
3141
|
+
import { z as z35 } from "zod";
|
|
2982
3142
|
var RELAY_SESSION_COOKIE = "ledge_session";
|
|
2983
3143
|
var RELAY_CLOSE_SIGNED_OUT = 4001;
|
|
2984
3144
|
var RELAY_CLOSE_REPLACED = 4e3;
|
|
2985
3145
|
var RELAY_CLOSE_RATE_LIMITED = 4008;
|
|
2986
|
-
var DeviceStartResponseSchema =
|
|
2987
|
-
deviceCode:
|
|
2988
|
-
userCode:
|
|
2989
|
-
verificationUri:
|
|
2990
|
-
expiresIn:
|
|
2991
|
-
interval:
|
|
2992
|
-
});
|
|
2993
|
-
var DevicePollResponseSchema =
|
|
2994
|
-
|
|
2995
|
-
|
|
3146
|
+
var DeviceStartResponseSchema = z35.object({
|
|
3147
|
+
deviceCode: z35.string().min(1),
|
|
3148
|
+
userCode: z35.string().min(1),
|
|
3149
|
+
verificationUri: z35.string().min(1),
|
|
3150
|
+
expiresIn: z35.number().int().positive(),
|
|
3151
|
+
interval: z35.number().int().positive()
|
|
3152
|
+
});
|
|
3153
|
+
var DevicePollResponseSchema = z35.discriminatedUnion("status", [
|
|
3154
|
+
z35.object({ status: z35.literal("pending") }),
|
|
3155
|
+
z35.object({ status: z35.literal("slow_down"), interval: z35.number().int().positive() }),
|
|
2996
3156
|
/** `token` is the relay session token, shown this once only. */
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3157
|
+
z35.object({ status: z35.literal("ok"), token: z35.string().min(1), accountId: z35.string().min(1), login: z35.string().min(1) }),
|
|
3158
|
+
z35.object({ status: z35.literal("expired") }),
|
|
3159
|
+
z35.object({ status: z35.literal("denied") }),
|
|
3160
|
+
z35.object({ status: z35.literal("not_allowed") })
|
|
3001
3161
|
]);
|
|
3002
|
-
var DeviceRevokeResponseSchema =
|
|
3003
|
-
var MeResponseSchema =
|
|
3004
|
-
accountId:
|
|
3005
|
-
login:
|
|
3162
|
+
var DeviceRevokeResponseSchema = z35.object({ revoked: z35.number().int().min(0) });
|
|
3163
|
+
var MeResponseSchema = z35.object({
|
|
3164
|
+
accountId: z35.string().min(1),
|
|
3165
|
+
login: z35.string().min(1),
|
|
3006
3166
|
peer: RelayPeerSchema,
|
|
3007
|
-
kind:
|
|
3167
|
+
kind: z35.enum(["pc", "device"])
|
|
3008
3168
|
});
|
|
3009
3169
|
|
|
3010
3170
|
// ../../packages/protocol/src/phone.ts
|
|
3011
|
-
import { z as
|
|
3171
|
+
import { z as z39 } from "zod";
|
|
3012
3172
|
|
|
3013
3173
|
// ../../packages/protocol/src/push.ts
|
|
3014
|
-
import { z as
|
|
3015
|
-
var B64U2 =
|
|
3174
|
+
import { z as z36 } from "zod";
|
|
3175
|
+
var B64U2 = z36.string().regex(/^[A-Za-z0-9_-]*$/);
|
|
3016
3176
|
var PUSH_HOSTS = ["*.push.apple.com", "fcm.googleapis.com", "updates.push.services.mozilla.com", "*.notify.windows.com"];
|
|
3017
3177
|
function pushEndpointAllowed(url2) {
|
|
3018
3178
|
let u;
|
|
@@ -3029,43 +3189,43 @@ function pushEndpointAllowed(url2) {
|
|
|
3029
3189
|
return host.length > suffix.length && host.endsWith(suffix);
|
|
3030
3190
|
});
|
|
3031
3191
|
}
|
|
3032
|
-
var PushSendSchema =
|
|
3033
|
-
endpoint:
|
|
3192
|
+
var PushSendSchema = z36.object({
|
|
3193
|
+
endpoint: z36.string().url().max(1024),
|
|
3034
3194
|
body: B64U2.max(5462),
|
|
3035
|
-
ttl:
|
|
3036
|
-
urgency:
|
|
3037
|
-
topic:
|
|
3195
|
+
ttl: z36.number().int().min(0).max(86400),
|
|
3196
|
+
urgency: z36.enum(["normal", "high"]),
|
|
3197
|
+
topic: z36.string().regex(/^[A-Za-z0-9_-]{1,32}$/)
|
|
3038
3198
|
});
|
|
3039
|
-
var PushSendResultSchema =
|
|
3040
|
-
result:
|
|
3041
|
-
status:
|
|
3199
|
+
var PushSendResultSchema = z36.object({
|
|
3200
|
+
result: z36.enum(["sent", "gone", "failed"]),
|
|
3201
|
+
status: z36.number().int().optional()
|
|
3042
3202
|
});
|
|
3043
|
-
var PushSubscriptionSchema =
|
|
3044
|
-
endpoint:
|
|
3045
|
-
keys:
|
|
3203
|
+
var PushSubscriptionSchema = z36.object({
|
|
3204
|
+
endpoint: z36.string().url().max(1024).refine(pushEndpointAllowed),
|
|
3205
|
+
keys: z36.object({ p256dh: B64U2.length(87), auth: B64U2.length(22) })
|
|
3046
3206
|
});
|
|
3047
|
-
var PushPayloadSchema =
|
|
3048
|
-
v:
|
|
3207
|
+
var PushPayloadSchema = z36.object({
|
|
3208
|
+
v: z36.literal(1),
|
|
3049
3209
|
/** `resolved`: a request or question answered (anywhere), replacing its notification under the same tag; only sent to a
|
|
3050
3210
|
* device whose subscription says its service worker knows it (`push.subscribe` `resolved`). `point`: the operator's point, one per
|
|
3051
3211
|
* paired device (the body is its lead); it replaces `finished`, which stays in the schema for older daemons but is no longer sent. */
|
|
3052
|
-
kind:
|
|
3053
|
-
title:
|
|
3212
|
+
kind: z36.enum(["request", "question", "finished", "chat", "decision", "resolved", "point"]),
|
|
3213
|
+
title: z36.string().max(80),
|
|
3054
3214
|
/**
|
|
3055
3215
|
* Who the notification is about, so the phone writes its own title in its language (Q29): the session's name for `request`,
|
|
3056
3216
|
* `question` and `resolved`, the giver's for `decision`; none for `chat`. Optional: an older daemon sends none, and an
|
|
3057
3217
|
* older phone ignores it and shows `title`.
|
|
3058
3218
|
*/
|
|
3059
|
-
name:
|
|
3060
|
-
body:
|
|
3061
|
-
url:
|
|
3062
|
-
badge:
|
|
3063
|
-
tag:
|
|
3219
|
+
name: z36.string().max(100).optional(),
|
|
3220
|
+
body: z36.string().max(120),
|
|
3221
|
+
url: z36.string().regex(/^\/#\/[A-Za-z0-9/%._~-]*$/).max(300),
|
|
3222
|
+
badge: z36.number().int().min(0).max(999),
|
|
3223
|
+
tag: z36.string().regex(/^[A-Za-z0-9_-]{1,32}$/)
|
|
3064
3224
|
});
|
|
3065
3225
|
|
|
3066
3226
|
// ../../packages/protocol/src/phoneRigs.ts
|
|
3067
|
-
import { z as
|
|
3068
|
-
var PhoneRigErrorSchema =
|
|
3227
|
+
import { z as z37 } from "zod";
|
|
3228
|
+
var PhoneRigErrorSchema = z37.enum(["unknown_rig", "not_installed", "daemon_stopped", "unavailable"]);
|
|
3069
3229
|
var PHONE_RIG_TEXT_MAX = 500;
|
|
3070
3230
|
var PHONE_RIGS_MAX = 50;
|
|
3071
3231
|
var PHONE_RIG_SEATS_MAX = 200;
|
|
@@ -3075,73 +3235,73 @@ var PHONE_GOALS_MAX = 50;
|
|
|
3075
3235
|
var PhoneRigSchema = RigSchema.omit({ specPath: true }).extend({ nodes: RigSchema.shape.nodes.max(PHONE_RIG_SEATS_MAX) });
|
|
3076
3236
|
var PhoneOpenRigStateSchema = OpenRigStateSchema.extend({
|
|
3077
3237
|
daemon: OpenRigStateSchema.shape.daemon.omit({ message: true, pid: true }),
|
|
3078
|
-
rigs:
|
|
3238
|
+
rigs: z37.array(PhoneRigSchema).max(PHONE_RIGS_MAX)
|
|
3079
3239
|
});
|
|
3080
|
-
var PhoneRigQueueRowSchema = RigRowSchema.extend({ summary:
|
|
3081
|
-
var PhoneRigRoutingSchema = RigRoutingEntrySchema.extend({ summary:
|
|
3082
|
-
var PhoneRigPermissionSchema = RigSeatPermissionSchema.extend({ summary:
|
|
3240
|
+
var PhoneRigQueueRowSchema = RigRowSchema.extend({ summary: z37.string().max(PHONE_RIG_SUMMARY_MAX).optional() });
|
|
3241
|
+
var PhoneRigRoutingSchema = RigRoutingEntrySchema.extend({ summary: z37.string().max(PHONE_RIG_SUMMARY_MAX).optional() });
|
|
3242
|
+
var PhoneRigPermissionSchema = RigSeatPermissionSchema.extend({ summary: z37.string().max(PHONE_RIG_TEXT_MAX).optional(), error: z37.string().max(PHONE_RIG_TEXT_MAX).optional() });
|
|
3083
3243
|
var PhoneGoalSchema = GoalSchema;
|
|
3084
|
-
var RigSeatCountsSchema =
|
|
3085
|
-
var PhoneRigRejectedSchema =
|
|
3244
|
+
var RigSeatCountsSchema = z37.record(RigRoleSchema, z37.number().int().min(0).max(9));
|
|
3245
|
+
var PhoneRigRejectedSchema = z37.enum(["confirm_required", "assertion_invalid", "assertion_expired", "unavailable"]);
|
|
3086
3246
|
|
|
3087
3247
|
// ../../packages/protocol/src/phoneForge.ts
|
|
3088
|
-
import { z as
|
|
3248
|
+
import { z as z38 } from "zod";
|
|
3089
3249
|
var PHONE_FORGE_PRS_MAX = 100;
|
|
3090
3250
|
var PHONE_FORGE_FOLLOWED_MAX = 200;
|
|
3091
3251
|
var PHONE_FORGE_MESSAGE_MAX = 500;
|
|
3092
3252
|
var PhoneForgeStatusSchema = ForgeStatusSchema.omit({ message: true });
|
|
3093
|
-
var PhoneForgeErrorSchema =
|
|
3094
|
-
var PhoneForgeActErrorSchema =
|
|
3095
|
-
var PhoneForgeRejectedSchema =
|
|
3096
|
-
var PhoneForgeStateSchema =
|
|
3253
|
+
var PhoneForgeErrorSchema = z38.enum(["unavailable", "failed", "too_large"]);
|
|
3254
|
+
var PhoneForgeActErrorSchema = z38.enum(["stale", "busy", "not_offered", "unavailable", "failed"]);
|
|
3255
|
+
var PhoneForgeRejectedSchema = z38.enum(["confirm_required", "assertion_invalid", "assertion_expired", "unavailable"]);
|
|
3256
|
+
var PhoneForgeStateSchema = z38.object({
|
|
3097
3257
|
/** Newest change first. A request whose forge, state or pipeline an older phone does not know is dropped, not the message. */
|
|
3098
|
-
prs:
|
|
3099
|
-
forges:
|
|
3100
|
-
followed:
|
|
3258
|
+
prs: z38.preprocess(dropUnknownPrs, z38.array(PullRequestSchema).max(PHONE_FORGE_PRS_MAX)),
|
|
3259
|
+
forges: z38.preprocess(dropUnknownForges, z38.array(PhoneForgeStatusSchema).max(20)),
|
|
3260
|
+
followed: z38.preprocess(dropUnknownForges, z38.array(FollowedSessionSchema).max(PHONE_FORGE_FOLLOWED_MAX)),
|
|
3101
3261
|
/** The account's own requests no session follows (issue #3), newest change first; absent from an older daemon. */
|
|
3102
|
-
mine:
|
|
3262
|
+
mine: z38.preprocess(dropUnknownPrs, z38.array(PullRequestSchema).max(PHONE_FORGE_PRS_MAX)).optional()
|
|
3103
3263
|
});
|
|
3104
3264
|
|
|
3105
3265
|
// ../../packages/protocol/src/phone.ts
|
|
3106
3266
|
var PHONE_ROW_SUMMARY_MAX = 200;
|
|
3107
|
-
var PhoneRigRowSchema = RigRowSchema.extend({ summary:
|
|
3108
|
-
var PhoneRowErrorSchema =
|
|
3267
|
+
var PhoneRigRowSchema = RigRowSchema.extend({ summary: z39.string().max(PHONE_ROW_SUMMARY_MAX).optional() });
|
|
3268
|
+
var PhoneRowErrorSchema = z39.enum(["not_found", "unavailable"]);
|
|
3109
3269
|
var PHONE_PROTOCOL = 1;
|
|
3110
3270
|
var utf8 = new TextEncoder();
|
|
3111
3271
|
var THREAD_TEXT_MAX = 8192;
|
|
3112
3272
|
var TOOL_TEXT_MAX = 2048;
|
|
3113
3273
|
var CHECKLIST_TASKS_MAX = 50;
|
|
3114
3274
|
var CHECKLIST_TEXT_MAX = 200;
|
|
3115
|
-
var ChecklistStatusSchema =
|
|
3116
|
-
var PhoneChecklistSchema =
|
|
3117
|
-
tasks:
|
|
3118
|
-
done:
|
|
3119
|
-
total:
|
|
3120
|
-
cut:
|
|
3121
|
-
});
|
|
3122
|
-
var PhoneChecklistSummarySchema =
|
|
3123
|
-
done:
|
|
3124
|
-
total:
|
|
3125
|
-
current:
|
|
3126
|
-
cut:
|
|
3127
|
-
});
|
|
3128
|
-
var RiskSchema =
|
|
3129
|
-
var RiskReasonSchema =
|
|
3130
|
-
var OperationIdSchema =
|
|
3131
|
-
var OperationStatusSchema =
|
|
3132
|
-
var OperationReasonSchema =
|
|
3133
|
-
var CapabilitiesSchema =
|
|
3275
|
+
var ChecklistStatusSchema = z39.enum(["pending", "in_progress", "completed"]);
|
|
3276
|
+
var PhoneChecklistSchema = z39.object({
|
|
3277
|
+
tasks: z39.array(z39.object({ text: z39.string().max(CHECKLIST_TEXT_MAX), status: ChecklistStatusSchema })).max(CHECKLIST_TASKS_MAX),
|
|
3278
|
+
done: z39.number().int().nonnegative(),
|
|
3279
|
+
total: z39.number().int().nonnegative(),
|
|
3280
|
+
cut: z39.literal(true).optional()
|
|
3281
|
+
});
|
|
3282
|
+
var PhoneChecklistSummarySchema = z39.object({
|
|
3283
|
+
done: z39.number().int().nonnegative(),
|
|
3284
|
+
total: z39.number().int().nonnegative(),
|
|
3285
|
+
current: z39.string().max(CHECKLIST_TEXT_MAX).optional(),
|
|
3286
|
+
cut: z39.literal(true).optional()
|
|
3287
|
+
});
|
|
3288
|
+
var RiskSchema = z39.enum(["low", "high"]);
|
|
3289
|
+
var RiskReasonSchema = z39.enum(["question", "read_only_command", "edit_inside_folder", "pushes", "destroys", "deploys", "publishes", "pipes_to_shell", "network", "writes_outside_folder", "sensitive_path", "unsafe_flag", "shell_syntax", "script", "plan", "unknown"]);
|
|
3290
|
+
var OperationIdSchema = z39.string().uuid();
|
|
3291
|
+
var OperationStatusSchema = z39.enum(["received", "applied", "rejected", "failed"]);
|
|
3292
|
+
var OperationReasonSchema = z39.enum([...RefusalCodeSchema.options, "untypable", "confirm_required", "conflict", "assertion_invalid", "assertion_expired", "scheduled", "name_taken", "folder_taken", "not_found", "not_pending", ...ModelRefusalSchema.options]);
|
|
3293
|
+
var CapabilitiesSchema = z39.object({
|
|
3134
3294
|
/** A question can be answered in free text. */
|
|
3135
|
-
freeTextAnswer:
|
|
3295
|
+
freeTextAnswer: z39.boolean(),
|
|
3136
3296
|
/** The session's accept/deny can be typed; absent = true. */
|
|
3137
|
-
decide:
|
|
3297
|
+
decide: z39.boolean().optional(),
|
|
3138
3298
|
/** OMP's dialog questions can be answered from the phone; absent = false. */
|
|
3139
|
-
questions:
|
|
3299
|
+
questions: z39.boolean().optional()
|
|
3140
3300
|
});
|
|
3141
|
-
var CapabilitiesByToolSchema =
|
|
3142
|
-
var PhonePendingSchema = PendingSchema.extend({ key:
|
|
3143
|
-
var SwitchableSessionSchema = SessionSchema.extend({ canSwitch:
|
|
3144
|
-
var PhoneProjectSchema =
|
|
3301
|
+
var CapabilitiesByToolSchema = z39.object({ claude: CapabilitiesSchema, codex: CapabilitiesSchema, cursor: CapabilitiesSchema, omp: CapabilitiesSchema });
|
|
3302
|
+
var PhonePendingSchema = PendingSchema.extend({ key: z39.string().max(64), risk: RiskSchema, riskReason: RiskReasonSchema, cut: z39.literal(true).optional() });
|
|
3303
|
+
var SwitchableSessionSchema = SessionSchema.extend({ canSwitch: z39.literal(true).optional() });
|
|
3304
|
+
var PhoneProjectSchema = z39.object({ id: ProjectIdSchema, name: z39.string().max(80), color: ProjectColorSchema });
|
|
3145
3305
|
var PHONE_PROJECTS_MAX = 100;
|
|
3146
3306
|
var PHONE_RIG_NAME_MAX = 100;
|
|
3147
3307
|
var PhoneSessionSchema = SwitchableSessionSchema.pick({
|
|
@@ -3176,203 +3336,218 @@ var PhoneSessionSchema = SwitchableSessionSchema.pick({
|
|
|
3176
3336
|
closedHow: true
|
|
3177
3337
|
}).extend({
|
|
3178
3338
|
/** What it is running now (« pnpm --filter desktop test »), `doingOf` on the PC: the list row and « En cours ». Older phones drop the field. */
|
|
3179
|
-
doing:
|
|
3339
|
+
doing: z39.object({ tool: z39.string().max(DOING_TOOL_MAX), label: z39.string().max(DOING_LABEL_MAX), since: z39.string().datetime() }).optional(),
|
|
3180
3340
|
pending: PhonePendingSchema.optional(),
|
|
3181
|
-
unread:
|
|
3182
|
-
handover:
|
|
3341
|
+
unread: z39.boolean(),
|
|
3342
|
+
handover: z39.object({ state: HandoverStateSchema, toName: z39.string().max(80).optional() }).strict().optional(),
|
|
3183
3343
|
/** Absent: the agent has no checklist. */
|
|
3184
3344
|
checklist: PhoneChecklistSummarySchema.optional(),
|
|
3185
3345
|
/** Started without Ledge (`hook_only`): the phone can neither close nor resume it. */
|
|
3186
|
-
readOnly:
|
|
3346
|
+
readOnly: z39.literal(true).optional(),
|
|
3187
3347
|
/** Its room in the Atelier (`daemon.atelier`): the user's project it belongs to, placed by the PC as the desktop places it; absent: none (« Sans projet »). */
|
|
3188
3348
|
projectId: ProjectIdSchema.optional(),
|
|
3189
3349
|
/** The OpenRig seat it is (`daemon.atelier`): its rig and its role once OpenRig named it. Never the seat's folder. */
|
|
3190
|
-
rig:
|
|
3350
|
+
rig: z39.object({ name: z39.string().max(PHONE_RIG_NAME_MAX), role: z39.string().max(PHONE_RIG_NAME_MAX).optional() }).optional()
|
|
3191
3351
|
});
|
|
3192
|
-
var B64U3 =
|
|
3193
|
-
var CredentialSchema =
|
|
3352
|
+
var B64U3 = z39.string().regex(/^[A-Za-z0-9_-]*$/);
|
|
3353
|
+
var CredentialSchema = z39.object({
|
|
3194
3354
|
id: B64U3.max(1366),
|
|
3195
3355
|
publicKey: B64U3.max(2048),
|
|
3196
|
-
alg:
|
|
3356
|
+
alg: z39.union([z39.literal(-7), z39.literal(-257)]),
|
|
3197
3357
|
clientDataJSON: B64U3.max(4096),
|
|
3198
3358
|
authenticatorData: B64U3.max(4096),
|
|
3199
|
-
transports:
|
|
3359
|
+
transports: z39.array(z39.string().max(20)).max(8).optional()
|
|
3200
3360
|
});
|
|
3201
|
-
var AssertionSchema =
|
|
3361
|
+
var AssertionSchema = z39.object({
|
|
3202
3362
|
id: B64U3.max(1366),
|
|
3203
3363
|
clientDataJSON: B64U3.max(4096),
|
|
3204
3364
|
authenticatorData: B64U3.max(4096),
|
|
3205
3365
|
signature: B64U3.max(1024)
|
|
3206
3366
|
});
|
|
3207
|
-
var ConfirmPurposeSchema =
|
|
3367
|
+
var ConfirmPurposeSchema = z39.enum(["register", "decide", "launch", "close", "act", "pc", "terminal", "rig", "note", "project", "folder", "rigs", "forge", "routine"]);
|
|
3208
3368
|
var PhoneChatStepSchema = ChatStepSchema.pick({ kind: true, id: true, name: true }).strict();
|
|
3209
|
-
var PhoneChatProposalSchema =
|
|
3210
|
-
project:
|
|
3369
|
+
var PhoneChatProposalSchema = z39.object({
|
|
3370
|
+
project: z39.string().max(80),
|
|
3211
3371
|
tool: ToolSchema,
|
|
3212
|
-
prompt:
|
|
3213
|
-
launchedId:
|
|
3214
|
-
failed:
|
|
3372
|
+
prompt: z39.string().max(TOOL_TEXT_MAX).optional(),
|
|
3373
|
+
launchedId: z39.string().optional(),
|
|
3374
|
+
failed: z39.literal(true).optional()
|
|
3215
3375
|
}).strict();
|
|
3216
|
-
var PhoneChatRelaySchema =
|
|
3217
|
-
id:
|
|
3218
|
-
name:
|
|
3376
|
+
var PhoneChatRelaySchema = z39.object({
|
|
3377
|
+
id: z39.string().min(1),
|
|
3378
|
+
name: z39.string(),
|
|
3219
3379
|
tool: ToolSchema,
|
|
3220
|
-
text:
|
|
3221
|
-
status:
|
|
3222
|
-
sentAt:
|
|
3223
|
-
failed:
|
|
3380
|
+
text: z39.string().max(TOOL_TEXT_MAX),
|
|
3381
|
+
status: z39.enum(["queued", "sent"]).optional(),
|
|
3382
|
+
sentAt: z39.string().datetime().optional(),
|
|
3383
|
+
failed: z39.literal(true).optional(),
|
|
3224
3384
|
/** With `failed`: why, as the PC's code (never its text). */
|
|
3225
|
-
code:
|
|
3385
|
+
code: z39.string().max(40).optional()
|
|
3226
3386
|
}).strict();
|
|
3227
|
-
var CloseHowSchema =
|
|
3228
|
-
var PhoneChatCloseSchema =
|
|
3229
|
-
id:
|
|
3230
|
-
name:
|
|
3387
|
+
var CloseHowSchema = z39.enum(["exit", "killed"]);
|
|
3388
|
+
var PhoneChatCloseSchema = z39.object({
|
|
3389
|
+
id: z39.string().min(1),
|
|
3390
|
+
name: z39.string(),
|
|
3231
3391
|
tool: ToolSchema,
|
|
3232
3392
|
how: CloseHowSchema.optional(),
|
|
3233
|
-
closedAt:
|
|
3234
|
-
failed:
|
|
3393
|
+
closedAt: z39.string().datetime().optional(),
|
|
3394
|
+
failed: z39.literal(true).optional()
|
|
3235
3395
|
}).strict();
|
|
3236
|
-
var PhoneChatTaskSchema =
|
|
3237
|
-
to:
|
|
3238
|
-
toName:
|
|
3239
|
-
title:
|
|
3240
|
-
text:
|
|
3241
|
-
taskId:
|
|
3242
|
-
ownerName:
|
|
3243
|
-
state:
|
|
3244
|
-
failed:
|
|
3396
|
+
var PhoneChatTaskSchema = z39.object({
|
|
3397
|
+
to: z39.string().max(80),
|
|
3398
|
+
toName: z39.string().max(80).optional(),
|
|
3399
|
+
title: z39.string().max(200),
|
|
3400
|
+
text: z39.string().max(TOOL_TEXT_MAX).optional(),
|
|
3401
|
+
taskId: z39.string().max(40).optional(),
|
|
3402
|
+
ownerName: z39.string().max(80).optional(),
|
|
3403
|
+
state: z39.enum(["open", "taken", "done", "refused", "dropped"]).optional(),
|
|
3404
|
+
failed: z39.literal(true).optional()
|
|
3245
3405
|
}).strict();
|
|
3246
|
-
var PhoneChatActionSchema =
|
|
3247
|
-
action:
|
|
3248
|
-
summary:
|
|
3406
|
+
var PhoneChatActionSchema = z39.object({
|
|
3407
|
+
action: z39.string().min(1).max(40),
|
|
3408
|
+
summary: z39.string().max(300),
|
|
3249
3409
|
vars: ActionVarsSchema.optional(),
|
|
3250
|
-
detail:
|
|
3251
|
-
detailCut:
|
|
3410
|
+
detail: z39.string().max(TOOL_TEXT_MAX).optional(),
|
|
3411
|
+
detailCut: z39.literal(true).optional(),
|
|
3252
3412
|
risk: ActionRiskSchema,
|
|
3253
|
-
session:
|
|
3413
|
+
session: z39.string().max(100).optional(),
|
|
3254
3414
|
state: ChatActionStateSchema.optional(),
|
|
3255
|
-
doneAt:
|
|
3256
|
-
code:
|
|
3415
|
+
doneAt: z39.string().datetime().optional(),
|
|
3416
|
+
code: z39.string().max(40).optional()
|
|
3257
3417
|
}).strict();
|
|
3258
|
-
var PhoneTaskSchema =
|
|
3259
|
-
id:
|
|
3260
|
-
title:
|
|
3261
|
-
owner:
|
|
3262
|
-
ownerName:
|
|
3418
|
+
var PhoneTaskSchema = z39.object({
|
|
3419
|
+
id: z39.string().max(40),
|
|
3420
|
+
title: z39.string().max(200),
|
|
3421
|
+
owner: z39.string().max(100),
|
|
3422
|
+
ownerName: z39.string().max(80),
|
|
3263
3423
|
/** Who gave it: `ledge` for Ledge's own; a session for a decision it put to the user (owner `ledge`), with its detail (the options). */
|
|
3264
|
-
giver:
|
|
3265
|
-
giverName:
|
|
3266
|
-
text:
|
|
3267
|
-
state:
|
|
3268
|
-
result:
|
|
3269
|
-
cut:
|
|
3270
|
-
at:
|
|
3271
|
-
updatedAt:
|
|
3272
|
-
seen:
|
|
3424
|
+
giver: z39.string().max(100).optional(),
|
|
3425
|
+
giverName: z39.string().max(80).optional(),
|
|
3426
|
+
text: z39.string().max(TOOL_TEXT_MAX).optional(),
|
|
3427
|
+
state: z39.enum(["open", "taken", "done", "refused", "dropped"]),
|
|
3428
|
+
result: z39.string().max(TOOL_TEXT_MAX).optional(),
|
|
3429
|
+
cut: z39.literal(true).optional(),
|
|
3430
|
+
at: z39.string(),
|
|
3431
|
+
updatedAt: z39.string(),
|
|
3432
|
+
seen: z39.literal(true).optional(),
|
|
3273
3433
|
/** A proposal about the user's notes (brain spec §3.6): the phone answers it with its buttons (`brain.answer`). */
|
|
3274
|
-
brain: BrainProposalSchema.optional()
|
|
3434
|
+
brain: BrainProposalSchema.optional(),
|
|
3435
|
+
/** A routine's item (routines spec): an activation request the phone answers with `routine.cmd` (`approve` / `refuse`), or a failure (`run`). */
|
|
3436
|
+
routine: TaskRoutineSchema.optional()
|
|
3275
3437
|
}).strict();
|
|
3276
|
-
var
|
|
3277
|
-
var
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3438
|
+
var PhoneRoutineRefSchema = z39.object({ routine: RoutineIdSchema, routineKey: RoutineKeySchema }).strict();
|
|
3439
|
+
var PhoneRoutineSchema = RoutineSchema.omit({ prompt: true, target: true, runs: true, proposal: true }).extend({
|
|
3440
|
+
target: RoutineTargetSchema.extend({ cwd: z39.string().min(1).max(PHONE_ROUTINE_CWD_MAX) }),
|
|
3441
|
+
cut: z39.literal(true).optional(),
|
|
3442
|
+
proposed: z39.literal(true).optional(),
|
|
3443
|
+
key: RoutineKeySchema
|
|
3444
|
+
});
|
|
3445
|
+
var PhoneRoutineDetailSchema = PhoneRoutineSchema.omit({ cut: true, proposed: true }).extend({
|
|
3446
|
+
target: RoutineTargetSchema,
|
|
3447
|
+
prompt: RoutineSchema.shape.prompt,
|
|
3448
|
+
proposal: RoutineSchema.shape.proposal,
|
|
3449
|
+
runs: RoutineSchema.shape.runs
|
|
3450
|
+
});
|
|
3451
|
+
var ChatErrorCodeSchema = z39.enum(["busy", "timeout", "cancelled", "failed"]);
|
|
3452
|
+
var ChatLimitsReadSchema = z39.object({ qid: OperationIdSchema, at: z39.string().datetime() }).strict();
|
|
3453
|
+
var ChatConversationSummarySchema = z39.object({
|
|
3454
|
+
id: z39.string().uuid(),
|
|
3455
|
+
startedAt: z39.string().datetime(),
|
|
3456
|
+
lastAt: z39.string().datetime(),
|
|
3457
|
+
first: z39.string().max(200),
|
|
3458
|
+
count: z39.number().int().min(1)
|
|
3284
3459
|
}).strict();
|
|
3285
|
-
var PhoneChatTurnSchema =
|
|
3460
|
+
var PhoneChatTurnSchema = z39.object({
|
|
3286
3461
|
qid: OperationIdSchema,
|
|
3287
|
-
question:
|
|
3288
|
-
askedAt:
|
|
3289
|
-
steps:
|
|
3290
|
-
answer:
|
|
3291
|
-
answeredAt:
|
|
3462
|
+
question: z39.string().max(MESSAGE_MAX),
|
|
3463
|
+
askedAt: z39.string().datetime(),
|
|
3464
|
+
steps: z39.array(PhoneChatStepSchema).max(50),
|
|
3465
|
+
answer: z39.string().max(THREAD_TEXT_MAX).optional(),
|
|
3466
|
+
answeredAt: z39.string().datetime().optional(),
|
|
3292
3467
|
error: ChatErrorCodeSchema.optional(),
|
|
3293
|
-
proposals:
|
|
3468
|
+
proposals: z39.array(PhoneChatProposalSchema).max(MAX_PROPOSALS).optional(),
|
|
3294
3469
|
relay: PhoneChatRelaySchema.optional(),
|
|
3295
|
-
closes:
|
|
3296
|
-
cut:
|
|
3297
|
-
tasks:
|
|
3298
|
-
actions:
|
|
3299
|
-
ignoredAt:
|
|
3300
|
-
attachments:
|
|
3301
|
-
by:
|
|
3470
|
+
closes: z39.array(PhoneChatCloseSchema).min(1).max(MAX_PROPOSALS).optional(),
|
|
3471
|
+
cut: z39.literal(true).optional(),
|
|
3472
|
+
tasks: z39.array(PhoneChatTaskSchema).min(1).max(MAX_PROPOSALS).optional(),
|
|
3473
|
+
actions: z39.array(PhoneChatActionSchema).min(1).max(MAX_PROPOSALS).optional(),
|
|
3474
|
+
ignoredAt: z39.string().datetime().optional(),
|
|
3475
|
+
attachments: z39.array(AttachmentRefSchema).max(ATTACHMENTS_MAX).optional(),
|
|
3476
|
+
by: z39.literal("ledge").optional(),
|
|
3302
3477
|
point: ChatPointSchema.optional()
|
|
3303
3478
|
}).strict();
|
|
3304
|
-
var sessionId =
|
|
3305
|
-
var PhoneExpectSchema = PendingSchema.pick({ kind: true, text: true }).extend({ key:
|
|
3306
|
-
var CardRowsSchema =
|
|
3479
|
+
var sessionId = z39.string().min(1).max(100);
|
|
3480
|
+
var PhoneExpectSchema = PendingSchema.pick({ kind: true, text: true }).extend({ key: z39.string().min(1).max(64) });
|
|
3481
|
+
var CardRowsSchema = z39.array(z39.number().int().min(0).max(MAX_PROPOSALS - 1)).min(1).max(MAX_PROPOSALS).refine((r) => new Set(r).size === r.length, "a row twice");
|
|
3307
3482
|
var pcOp = { op: OperationIdSchema, assertion: AssertionSchema.optional() };
|
|
3308
3483
|
var PHONE_LAUNCH_FOLDERS_MAX = 20;
|
|
3309
|
-
var PhoneLaunchSchema =
|
|
3484
|
+
var PhoneLaunchSchema = z39.object({
|
|
3310
3485
|
project: ProjectIdSchema,
|
|
3311
3486
|
tool: ToolSchema,
|
|
3312
|
-
folders:
|
|
3313
|
-
prompt:
|
|
3487
|
+
folders: z39.array(FolderPathSchema).min(1).max(PHONE_LAUNCH_FOLDERS_MAX),
|
|
3488
|
+
prompt: z39.string().trim().min(1).max(MESSAGE_MAX),
|
|
3314
3489
|
model: ModelIdSchema.optional(),
|
|
3315
3490
|
effort: EffortSchema.optional(),
|
|
3316
3491
|
approval: OmpApprovalSchema.optional()
|
|
3317
3492
|
}).strict();
|
|
3318
|
-
var PcActionSchema =
|
|
3493
|
+
var PcActionSchema = z39.enum(["update", "restart"]);
|
|
3319
3494
|
var PHONE_FOLDER_ENTRIES_MAX = 500;
|
|
3320
|
-
var PhoneFolderErrorSchema =
|
|
3321
|
-
var PhoneFolderSchema =
|
|
3495
|
+
var PhoneFolderErrorSchema = z39.enum(["not_found", "not_folder", "unreadable"]);
|
|
3496
|
+
var PhoneFolderSchema = z39.object({
|
|
3322
3497
|
machine: MachineIdSchema,
|
|
3323
|
-
label:
|
|
3498
|
+
label: z39.string().max(80).optional(),
|
|
3324
3499
|
path: FolderPathSchema,
|
|
3325
|
-
exists:
|
|
3326
|
-
branch:
|
|
3500
|
+
exists: z39.boolean().optional(),
|
|
3501
|
+
branch: z39.string().max(200).nullable().optional()
|
|
3327
3502
|
});
|
|
3328
3503
|
var PHONE_RECENT_FOLDERS_MAX = 20;
|
|
3329
|
-
var TerminalIdSchema =
|
|
3504
|
+
var TerminalIdSchema = z39.string().regex(/^t_[A-Za-z0-9_-]{8,40}$/);
|
|
3330
3505
|
var TERM_INPUT_MAX = 4096;
|
|
3331
3506
|
var TERM_SCREEN_MAX = 65536;
|
|
3332
3507
|
var TERM_OUTPUT_MAX = 32768;
|
|
3333
|
-
var TermDimSchema =
|
|
3334
|
-
var TermReleaseWhySchema =
|
|
3335
|
-
var TermExitWhySchema =
|
|
3336
|
-
var DevicePrefsSchema =
|
|
3337
|
-
notify:
|
|
3508
|
+
var TermDimSchema = z39.number().int().min(1).max(1e4);
|
|
3509
|
+
var TermReleaseWhySchema = z39.enum(["asked", "pc", "idle", "expired", "background", "link"]);
|
|
3510
|
+
var TermExitWhySchema = z39.enum(["ended", "gone", "closed", "superseded", "failed"]);
|
|
3511
|
+
var DevicePrefsSchema = z39.object({
|
|
3512
|
+
notify: z39.object({
|
|
3338
3513
|
/** « Le point de Ledge » (the key keeps its first name, « Agent terminé »): the operator's point. */
|
|
3339
|
-
finished:
|
|
3514
|
+
finished: z39.boolean(),
|
|
3340
3515
|
/** « Réponse de Ledge »: the end of a question asked from this device. */
|
|
3341
|
-
chat:
|
|
3516
|
+
chat: z39.boolean(),
|
|
3342
3517
|
/** « Décision à prendre »: a session puts a decision to the user. */
|
|
3343
|
-
decision:
|
|
3518
|
+
decision: z39.boolean()
|
|
3344
3519
|
}),
|
|
3345
3520
|
/** No notification before this moment (a `resolved` still replaces one already shown); null: no pause. */
|
|
3346
|
-
quietUntil:
|
|
3521
|
+
quietUntil: z39.string().datetime().nullable(),
|
|
3347
3522
|
/** The agent of this device's chat with Ledge; null: the PC's (the one its own chat last used). */
|
|
3348
3523
|
chatTool: ToolSchema.nullable()
|
|
3349
3524
|
});
|
|
3350
|
-
var PhoneClientMessageSchema =
|
|
3351
|
-
|
|
3352
|
-
|
|
3525
|
+
var PhoneClientMessageSchema = z39.discriminatedUnion("type", [
|
|
3526
|
+
z39.object({ type: z39.literal("snapshot.request") }),
|
|
3527
|
+
z39.object({ type: z39.literal("session.thread"), id: sessionId }),
|
|
3353
3528
|
/** The session's request with its whole body (up to `PENDING_BODY_MAX`). */
|
|
3354
|
-
|
|
3529
|
+
z39.object({ type: z39.literal("session.pending"), id: sessionId }),
|
|
3355
3530
|
/** The session whose terminal the phone shows; null when it shows none. */
|
|
3356
|
-
|
|
3357
|
-
|
|
3531
|
+
z39.object({ type: z39.literal("session.watch"), id: sessionId.nullable() }),
|
|
3532
|
+
z39.object({ type: z39.literal("session.read"), id: sessionId, at: z39.string().datetime() }),
|
|
3358
3533
|
/**
|
|
3359
3534
|
* Asks for a challenge. One object for every purpose: the gateway refuses a `decide` without `id` and `expect`. A `close`
|
|
3360
3535
|
* or `act` names a turn of the chat (`qid`) or a session (`id`, for `session.close` and `session.resume`).
|
|
3361
3536
|
*/
|
|
3362
|
-
|
|
3363
|
-
type:
|
|
3537
|
+
z39.object({
|
|
3538
|
+
type: z39.literal("confirm.prepare"),
|
|
3364
3539
|
purpose: ConfirmPurposeSchema,
|
|
3365
3540
|
id: sessionId.optional(),
|
|
3366
3541
|
expect: PhoneExpectSchema.optional(),
|
|
3367
3542
|
qid: OperationIdSchema.optional(),
|
|
3368
3543
|
/** A `pc` challenge: what it is for, and for an update the version it covers. */
|
|
3369
3544
|
action: PcActionSchema.optional(),
|
|
3370
|
-
version:
|
|
3545
|
+
version: z39.string().regex(SEMVER).optional(),
|
|
3371
3546
|
/** A `rig` challenge: the OpenRig row and the exact answer it covers. */
|
|
3372
|
-
qitem:
|
|
3547
|
+
qitem: z39.string().min(1).max(200).optional(),
|
|
3373
3548
|
answer: HumanAnswerSchema.optional(),
|
|
3374
3549
|
/** A `note` challenge: the proposal (a task) and the exact choice it covers. */
|
|
3375
|
-
task:
|
|
3550
|
+
task: z39.string().min(1).max(40).optional(),
|
|
3376
3551
|
choice: BrainChoiceSchema.optional(),
|
|
3377
3552
|
/** A `project` challenge: the project deleted and where its agents go (null: no project). */
|
|
3378
3553
|
project: ProjectIdSchema.optional(),
|
|
@@ -3383,71 +3558,76 @@ var PhoneClientMessageSchema = z38.discriminatedUnion("type", [
|
|
|
3383
3558
|
newProject: ProjectNameSchema.optional(),
|
|
3384
3559
|
/** A `rigs` challenge: the action (`rigAct`) or the change of seats (`rigSeats`) it covers, exactly as it will be sent. */
|
|
3385
3560
|
rigAct: OpenRigActionSchema.optional(),
|
|
3386
|
-
rigSeats:
|
|
3561
|
+
rigSeats: z39.object({ rig: RigNameSchema, seats: RigSeatCountsSchema }).strict().optional(),
|
|
3387
3562
|
/** An `act` challenge for a point row (`qid` and `item`): bound to that row and to its `pointAnswer`, or to its suggestion when `suggest`. */
|
|
3388
|
-
item:
|
|
3563
|
+
item: z39.string().min(1).max(200).optional(),
|
|
3389
3564
|
pointAnswer: PointAnswerSchema.optional(),
|
|
3390
|
-
suggest:
|
|
3565
|
+
suggest: z39.literal(true).optional(),
|
|
3391
3566
|
/** A `launch` challenge without `qid`: the « Nouvelle session » it covers, exactly as it will be sent. */
|
|
3392
3567
|
launch: PhoneLaunchSchema.optional(),
|
|
3393
3568
|
/** A `forge` challenge: the request and the action it covers, exactly as they will be sent. */
|
|
3394
|
-
forge:
|
|
3569
|
+
forge: z39.object({ prId: z39.string().min(1).max(500), action: ForgeActionSchema }).strict().optional(),
|
|
3570
|
+
/** A `routine` challenge: the pending routine its « Activer » covers, and its key as the phone showed it; `routineOthers`, the
|
|
3571
|
+
* other routines of a grouped request « Activer les N » covers with the same check. */
|
|
3572
|
+
routine: RoutineIdSchema.optional(),
|
|
3573
|
+
routineKey: RoutineKeySchema.optional(),
|
|
3574
|
+
routineOthers: z39.array(PhoneRoutineRefSchema).max(ROUTINES_ACTIVE_MAX - 1).optional()
|
|
3395
3575
|
}),
|
|
3396
3576
|
/** `userId`: the passkey's `user.id` as the phone made it (« L1 » ‖ the PC key's digest ‖ random, docs/mobile-passkey-recover-contract.md);
|
|
3397
3577
|
* given and made for this PC, the passkey can bring the device back after a reinstall (the snapshot's `device.recover`). */
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
type:
|
|
3578
|
+
z39.object({ type: z39.literal("credential.register"), op: OperationIdSchema, credential: CredentialSchema, userId: B64U3.max(128).optional() }),
|
|
3579
|
+
z39.object({
|
|
3580
|
+
type: z39.literal("session.decide"),
|
|
3401
3581
|
op: OperationIdSchema,
|
|
3402
3582
|
id: sessionId,
|
|
3403
3583
|
decision: DecisionSchema,
|
|
3404
|
-
note:
|
|
3584
|
+
note: z39.string().trim().min(1).max(NOTE_MAX).optional(),
|
|
3405
3585
|
/** The request the phone showed: refused unless it is still the pending one. */
|
|
3406
3586
|
expect: PhoneExpectSchema,
|
|
3407
3587
|
/** The device check over the challenge of `confirm.prepare`; required by the daemon for a high-risk accept. */
|
|
3408
3588
|
assertion: AssertionSchema.optional()
|
|
3409
3589
|
}),
|
|
3410
|
-
|
|
3411
|
-
type:
|
|
3590
|
+
z39.object({
|
|
3591
|
+
type: z39.literal("session.reply"),
|
|
3412
3592
|
op: OperationIdSchema,
|
|
3413
3593
|
id: sessionId,
|
|
3414
|
-
text:
|
|
3415
|
-
attachments:
|
|
3594
|
+
text: z39.string().max(MESSAGE_MAX),
|
|
3595
|
+
attachments: z39.array(AttachmentIdSchema).max(ATTACHMENTS_MAX).optional(),
|
|
3416
3596
|
/** The request the reply answers, or null when the phone showed none: refused if the session's request is no longer that one. */
|
|
3417
3597
|
expect: PhoneExpectSchema.nullable(),
|
|
3418
3598
|
assertion: AssertionSchema.optional()
|
|
3419
3599
|
}),
|
|
3420
3600
|
/** OMP's `ask`: the answers to every question of the dialog `requestId`, in order; `cancel` declines it. Bounds as the local `session.answer`. */
|
|
3421
|
-
|
|
3422
|
-
type:
|
|
3601
|
+
z39.object({
|
|
3602
|
+
type: z39.literal("session.answer"),
|
|
3423
3603
|
op: OperationIdSchema,
|
|
3424
3604
|
id: sessionId,
|
|
3425
|
-
requestId:
|
|
3426
|
-
answers:
|
|
3427
|
-
cancel:
|
|
3605
|
+
requestId: z39.string().min(1).max(200),
|
|
3606
|
+
answers: z39.array(z39.object({ id: z39.string().max(200), selected: z39.array(z39.string().max(2e3)).max(100), text: z39.string().max(2e4).optional() })).max(50),
|
|
3607
|
+
cancel: z39.literal(true).optional(),
|
|
3428
3608
|
expect: PhoneExpectSchema
|
|
3429
3609
|
}),
|
|
3430
|
-
|
|
3610
|
+
z39.object({ type: z39.literal("session.interrupt"), op: OperationIdSchema, id: sessionId }),
|
|
3431
3611
|
/** Ends a live session as `/exit` would, killed as a last resort; answered with its `how`. Passkey, purpose `close`, over the session. */
|
|
3432
|
-
|
|
3612
|
+
z39.object({ type: z39.literal("session.close"), op: OperationIdSchema, id: sessionId, assertion: AssertionSchema.optional() }),
|
|
3433
3613
|
/** Starts an ended session again on its conversation. Passkey, purpose `act`, over the session. */
|
|
3434
|
-
|
|
3614
|
+
z39.object({ type: z39.literal("session.resume"), op: OperationIdSchema, id: sessionId, assertion: AssertionSchema.optional() }),
|
|
3435
3615
|
/** Changes a live session's model and effort, `null` for the agent's own default; answered by `operation.result` and, when refused, `session.model.failed`. */
|
|
3436
|
-
|
|
3616
|
+
z39.object({ type: z39.literal("session.model"), op: OperationIdSchema, id: sessionId, model: ModelIdSchema.nullable(), effort: EffortSchema.nullable() }),
|
|
3437
3617
|
/** One message to several sessions (ids); answered by `operation.result` with `sent` and `refused`. */
|
|
3438
|
-
|
|
3618
|
+
z39.object({ type: z39.literal("session.broadcast"), op: OperationIdSchema, sessions: z39.array(sessionId).min(1).max(BROADCAST_SESSIONS_MAX), text: z39.string().trim().min(1).max(MESSAGE_MAX) }).strict(),
|
|
3439
3619
|
/** The models an agent offers on the PC. */
|
|
3440
|
-
|
|
3620
|
+
z39.object({ type: z39.literal("models.list"), tool: ToolSchema }),
|
|
3441
3621
|
/** The slash commands of a session's agent, for the « / » list of its field. */
|
|
3442
|
-
|
|
3622
|
+
z39.object({ type: z39.literal("session.commands"), id: sessionId }),
|
|
3443
3623
|
/** A queue row's state, for an OpenRig task card: asked while the card shows and every `RIG_ROW_REFRESH_MS` (`daemon.rigRows`). */
|
|
3444
|
-
|
|
3624
|
+
z39.object({ type: z39.literal("openrig.row"), qitem: QitemIdSchema }),
|
|
3445
3625
|
/** The phone drops its passkey from the daemon. */
|
|
3446
|
-
|
|
3626
|
+
z39.object({ type: z39.literal("device.forget"), op: OperationIdSchema }),
|
|
3447
3627
|
/** The device names itself (on the PC and in its next snapshot); applied to the sender only. */
|
|
3448
|
-
|
|
3628
|
+
z39.object({ type: z39.literal("device.rename"), op: OperationIdSchema, name: DeviceNameSchema }),
|
|
3449
3629
|
/** The device's own settings, whole (`daemon.settings`): applied to the sender only, told back in its next snapshot. */
|
|
3450
|
-
|
|
3630
|
+
z39.object({ type: z39.literal("device.prefs"), op: OperationIdSchema, prefs: z39.object({
|
|
3451
3631
|
notify: DevicePrefsSchema.shape.notify.strict(),
|
|
3452
3632
|
quietUntil: DevicePrefsSchema.shape.quietUntil,
|
|
3453
3633
|
chatTool: DevicePrefsSchema.shape.chatTool
|
|
@@ -3457,442 +3637,466 @@ var PhoneClientMessageSchema = z38.discriminatedUnion("type", [
|
|
|
3457
3637
|
* Never a folder or a rule: the daemon keeps them as they are (a deletion moves them as the desktop's does). The PC names a
|
|
3458
3638
|
* new project. A deletion carries the device's check over the project and `moveTo` (purpose `project`).
|
|
3459
3639
|
*/
|
|
3460
|
-
|
|
3461
|
-
|
|
3640
|
+
z39.object({ type: z39.literal("project.edit"), op: OperationIdSchema, id: ProjectIdSchema, name: ProjectNameSchema.optional(), color: ProjectColorSchema.optional() }).strict(),
|
|
3641
|
+
z39.object({ type: z39.literal("project.order"), op: OperationIdSchema, ids: z39.array(ProjectIdSchema).min(1).max(PHONE_PROJECTS_MAX) }).strict(),
|
|
3462
3642
|
/** Issue #2: with its first folder (`path`, of this PC) and the device's check over that name and folder (`newProjectSubject`). A
|
|
3463
3643
|
* create without it, from an older phone, is refused `folder_required`. */
|
|
3464
|
-
|
|
3465
|
-
type:
|
|
3644
|
+
z39.object({
|
|
3645
|
+
type: z39.literal("project.create"),
|
|
3466
3646
|
op: OperationIdSchema,
|
|
3467
3647
|
name: ProjectNameSchema,
|
|
3468
3648
|
color: ProjectColorSchema,
|
|
3469
3649
|
path: FolderPathSchema.optional(),
|
|
3470
3650
|
assertion: AssertionSchema.optional()
|
|
3471
3651
|
}).strict(),
|
|
3472
|
-
|
|
3652
|
+
z39.object({ type: z39.literal("project.delete"), op: OperationIdSchema, id: ProjectIdSchema, moveTo: ProjectIdSchema.nullable(), assertion: AssertionSchema.optional() }).strict(),
|
|
3473
3653
|
/**
|
|
3474
3654
|
* A project's folders (`daemon.projectFolders`): browsing this PC's folders, its recent ones, a project's folders, then adding one
|
|
3475
3655
|
* of this PC (with the device's check, purpose `folder`) or removing one. Reads are answered to the asker alone.
|
|
3476
3656
|
*/
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
|
|
3657
|
+
z39.object({ type: z39.literal("folder.list"), path: FolderPathSchema.optional() }).strict(),
|
|
3658
|
+
z39.object({ type: z39.literal("folder.recents") }).strict(),
|
|
3659
|
+
z39.object({ type: z39.literal("project.folders"), id: ProjectIdSchema }).strict(),
|
|
3660
|
+
z39.object({ type: z39.literal("project.folder.add"), op: OperationIdSchema, id: ProjectIdSchema, path: FolderPathSchema, assertion: AssertionSchema.optional() }).strict(),
|
|
3661
|
+
z39.object({ type: z39.literal("project.folder.remove"), op: OperationIdSchema, id: ProjectIdSchema, machine: MachineIdSchema, path: FolderPathSchema }).strict(),
|
|
3482
3662
|
/** « Contexte max », the PC's threshold shared by every front (`daemon.settings`): as the desktop's `context.set`. */
|
|
3483
|
-
|
|
3663
|
+
z39.object({ type: z39.literal("context.set"), op: OperationIdSchema, near: ContextPrefsSchema.shape.near }).strict(),
|
|
3484
3664
|
/** The phone's push subscription, with the VAPID key it was made with (so a key change is seen). `resolved`: its service
|
|
3485
3665
|
* worker shows a `resolved` push, which replaces a request's notification once it is answered elsewhere. */
|
|
3486
|
-
|
|
3487
|
-
|
|
3666
|
+
z39.object({ type: z39.literal("push.subscribe"), op: OperationIdSchema, subscription: PushSubscriptionSchema, key: B64U3.length(87), resolved: z39.literal(true).optional() }),
|
|
3667
|
+
z39.object({ type: z39.literal("push.unsubscribe"), op: OperationIdSchema }),
|
|
3488
3668
|
/** The phone's own chat with Ledge. */
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
|
|
3669
|
+
z39.object({ type: z39.literal("chat.ask"), qid: OperationIdSchema, text: z39.string().trim().max(MESSAGE_MAX), attachments: z39.array(AttachmentIdSchema).max(ATTACHMENTS_MAX).optional() }),
|
|
3670
|
+
z39.object({ type: z39.literal("chat.cancel"), qid: OperationIdSchema }),
|
|
3671
|
+
z39.object({ type: z39.literal("chat.reset") }),
|
|
3672
|
+
z39.object({ type: z39.literal("chat.history") }),
|
|
3493
3673
|
/** The device's conversations, and one of them (`daemon.conversations`): answered to the asker alone. */
|
|
3494
|
-
|
|
3495
|
-
|
|
3674
|
+
z39.object({ type: z39.literal("chat.conversations") }).strict(),
|
|
3675
|
+
z39.object({ type: z39.literal("chat.conversation"), id: z39.string().uuid() }).strict(),
|
|
3496
3676
|
/** An image to store, sent alone before the message that names it; no `id`, and at most `ATTACHMENT_MAX` bytes. */
|
|
3497
|
-
AttachmentPutSchema.pick({ type: true, requestId: true }).extend({ image: ImageUploadSchema.extend({ data:
|
|
3677
|
+
AttachmentPutSchema.pick({ type: true, requestId: true }).extend({ image: ImageUploadSchema.extend({ data: z39.string().min(1).max(b64Max(ATTACHMENT_MAX)) }) }),
|
|
3498
3678
|
AttachmentGetSchema.pick({ type: true, requestId: true, attachment: true, preview: true }),
|
|
3499
|
-
|
|
3679
|
+
z39.object({ type: z39.literal("chat.relay"), op: OperationIdSchema, qid: OperationIdSchema }),
|
|
3500
3680
|
/** Takes the card's queued instruction back out of the queue, as the local `session.relay.cancel`. */
|
|
3501
|
-
|
|
3502
|
-
|
|
3681
|
+
z39.object({ type: z39.literal("chat.relay.cancel"), op: OperationIdSchema, qid: OperationIdSchema }),
|
|
3682
|
+
z39.object({ type: z39.literal("chat.launch"), op: OperationIdSchema, qid: OperationIdSchema, rows: CardRowsSchema.optional(), assertion: AssertionSchema.optional() }),
|
|
3503
3683
|
/** « Nouvelle session » (M2 §9): passkey, purpose `launch`, over this very launch. Applied, its result names the new session (`id`). */
|
|
3504
|
-
|
|
3505
|
-
|
|
3684
|
+
z39.object({ type: z39.literal("session.launch"), op: OperationIdSchema, launch: PhoneLaunchSchema, assertion: AssertionSchema.optional() }).strict(),
|
|
3685
|
+
z39.object({ type: z39.literal("chat.close"), op: OperationIdSchema, qid: OperationIdSchema, rows: CardRowsSchema.optional(), assertion: AssertionSchema.optional() }),
|
|
3506
3686
|
/** A row of the turn's task card: given by Ledge. */
|
|
3507
|
-
|
|
3687
|
+
z39.object({ type: z39.literal("chat.task"), op: OperationIdSchema, qid: OperationIdSchema, row: z39.number().int().min(0).max(MAX_PROPOSALS - 1) }),
|
|
3508
3688
|
/** Rows of the turn's generic card (action registry spec §5): `confirmed` as the local `chat.act`; a row whose action asks
|
|
3509
3689
|
* for a device check (`phone`) needs one assertion, purpose `act`, over the turn. */
|
|
3510
|
-
|
|
3511
|
-
type:
|
|
3690
|
+
z39.object({
|
|
3691
|
+
type: z39.literal("chat.act"),
|
|
3512
3692
|
op: OperationIdSchema,
|
|
3513
3693
|
qid: OperationIdSchema,
|
|
3514
3694
|
rows: CardRowsSchema.optional(),
|
|
3515
|
-
confirmed:
|
|
3695
|
+
confirmed: z39.literal(true).optional(),
|
|
3516
3696
|
assertion: AssertionSchema.optional(),
|
|
3517
3697
|
/** « Refuser », as the local `chat.act`: no passkey, no confirmation. */
|
|
3518
|
-
deny:
|
|
3698
|
+
deny: z39.literal(true).optional()
|
|
3519
3699
|
}),
|
|
3520
3700
|
/** « Ignorer » the turn's cards, or `undo` (« Revoir »), as the local `chat.ignore`. */
|
|
3521
|
-
|
|
3701
|
+
z39.object({ type: z39.literal("chat.ignore"), op: OperationIdSchema, qid: OperationIdSchema, undo: z39.literal(true).optional() }),
|
|
3522
3702
|
/** The operator's point: `point.act` answers a row, `point.later` sets the point aside, `operator.read` marks events read for this device. */
|
|
3523
|
-
|
|
3524
|
-
type:
|
|
3703
|
+
z39.object({
|
|
3704
|
+
type: z39.literal("point.act"),
|
|
3525
3705
|
op: OperationIdSchema,
|
|
3526
3706
|
qid: OperationIdSchema,
|
|
3527
|
-
item:
|
|
3707
|
+
item: z39.string().min(1).max(200),
|
|
3528
3708
|
answer: PointAnswerSchema.optional(),
|
|
3529
3709
|
/** Applies the row's suggestion instead of answering it (exactly one of `answer` and `suggest`). */
|
|
3530
|
-
suggest:
|
|
3710
|
+
suggest: z39.literal(true).optional(),
|
|
3531
3711
|
/** A destructive answer says it was confirmed on the phone; the device check (`assertion`) is bound to this item and this answer. */
|
|
3532
|
-
confirmed:
|
|
3712
|
+
confirmed: z39.literal(true).optional(),
|
|
3533
3713
|
assertion: AssertionSchema.optional()
|
|
3534
3714
|
}),
|
|
3535
|
-
|
|
3536
|
-
|
|
3715
|
+
z39.object({ type: z39.literal("point.later"), op: OperationIdSchema, qid: OperationIdSchema }),
|
|
3716
|
+
z39.object({ type: z39.literal("operator.read"), op: OperationIdSchema, eventId: z39.number().int().min(0) }),
|
|
3537
3717
|
/** The user's answer to a proposal about the notes (brain spec, lot 4): a `yes` carries an assertion of purpose `note` bound to the
|
|
3538
3718
|
* task and that exact choice; a `no` needs none. */
|
|
3539
|
-
|
|
3719
|
+
z39.object({ type: z39.literal("brain.answer"), op: OperationIdSchema, task: z39.string().min(1).max(40), choice: BrainChoiceSchema, assertion: AssertionSchema.optional() }),
|
|
3540
3720
|
/** Puts a closed task Ledge gave away from « À traiter ». */
|
|
3541
|
-
|
|
3721
|
+
z39.object({ type: z39.literal("task.seen"), op: OperationIdSchema, task: z39.string().min(1).max(40) }),
|
|
3722
|
+
/** The routines (routines spec §3.7): answered by `routines`, then each change comes as `routine.changed`. */
|
|
3723
|
+
z39.object({ type: z39.literal("routine.list") }).strict(),
|
|
3724
|
+
/** One routine whole, its prompt included: answered by `routine.detail`. The phone shows it before « Activer ». */
|
|
3725
|
+
z39.object({ type: z39.literal("routine.show"), routine: RoutineIdSchema }).strict(),
|
|
3726
|
+
/** « Lancer maintenant », « Pause » / « Reprendre », and « Activer » / « Refuser » from « À toi »; answered by `operation.result`.
|
|
3727
|
+
* An `approve` names the key of the routine the phone showed (`routineKey`, refused as `stale` once it changed) and carries an
|
|
3728
|
+
* assertion of purpose `routine` bound to that routine and that key. */
|
|
3729
|
+
z39.object({
|
|
3730
|
+
type: z39.literal("routine.cmd"),
|
|
3731
|
+
op: OperationIdSchema,
|
|
3732
|
+
action: PhoneRoutineActionSchema,
|
|
3733
|
+
routine: RoutineIdSchema,
|
|
3734
|
+
routineKey: RoutineKeySchema.optional(),
|
|
3735
|
+
/** « Activer les N » / « Refuser les N » of a grouped request: the other routines, each with the key the phone showed; an approve's
|
|
3736
|
+
* one assertion covers them all. */
|
|
3737
|
+
others: z39.array(PhoneRoutineRefSchema).max(ROUTINES_ACTIVE_MAX - 1).optional(),
|
|
3738
|
+
assertion: AssertionSchema.optional()
|
|
3739
|
+
}).strict(),
|
|
3542
3740
|
/** Streams a session's pane, read-only; answered by `term.opened` or `operation.result` (rejected). `helper`: one of the
|
|
3543
3741
|
* session's subagents (`helpers[].id`), whose terminal is its parent's, read-only for good (`term.opened.readOnly`). */
|
|
3544
|
-
|
|
3742
|
+
z39.object({ type: z39.literal("term.open"), op: OperationIdSchema, id: sessionId, helper: z39.string().min(1).max(200).optional() }),
|
|
3545
3743
|
/** « Prendre la main »: passkey, purpose `terminal`, over the session; answered by `term.held` or `operation.result` (rejected). */
|
|
3546
|
-
|
|
3744
|
+
z39.object({ type: z39.literal("term.hold"), op: OperationIdSchema, tid: TerminalIdSchema, assertion: AssertionSchema.optional() }),
|
|
3547
3745
|
/** Keys to type, as xterm produced them; `n` counts from 0 for the terminal, so a duplicate is dropped and a gap seen. Refused unless held. */
|
|
3548
|
-
|
|
3746
|
+
z39.object({ type: z39.literal("term.input"), tid: TerminalIdSchema, n: z39.number().int().nonnegative(), data: z39.string().min(1).max(TERM_INPUT_MAX) }),
|
|
3549
3747
|
/** « Rendre la main »: back to read-only. */
|
|
3550
|
-
|
|
3748
|
+
z39.object({ type: z39.literal("term.release"), tid: TerminalIdSchema }),
|
|
3551
3749
|
/** The phone saw a gap in `seq`: a fresh `term.opened`, please. */
|
|
3552
|
-
|
|
3553
|
-
|
|
3750
|
+
z39.object({ type: z39.literal("term.resync"), tid: TerminalIdSchema }),
|
|
3751
|
+
z39.object({ type: z39.literal("term.close"), tid: TerminalIdSchema }),
|
|
3554
3752
|
/** Whether the phone's app is in front: a device that is visible gets no push. */
|
|
3555
|
-
|
|
3753
|
+
z39.object({ type: z39.literal("presence"), visible: z39.boolean() }),
|
|
3556
3754
|
/** « À toi » (lot 3): what OpenRig on this PC asks the person, then pushed whole when it changes (`openrig.asks`). */
|
|
3557
|
-
|
|
3755
|
+
z39.object({ type: z39.literal("openrig.asks") }),
|
|
3558
3756
|
/** The person's answer to an OpenRig row. A choice, words or a resolve carries an assertion of purpose `rig` bound to that row and that
|
|
3559
3757
|
* answer; « Vu » (`seen`) needs none. */
|
|
3560
|
-
|
|
3758
|
+
z39.object({ type: z39.literal("openrig.answer"), op: OperationIdSchema, qitemId: z39.string().min(1).max(200), answer: HumanAnswerSchema, assertion: AssertionSchema.optional() }),
|
|
3561
3759
|
/** Installs `version` on the PC, then restarts its daemon; the phone asks for its own build's version. Passkey, purpose `pc`. */
|
|
3562
|
-
|
|
3760
|
+
z39.object({ type: z39.literal("daemon.update"), ...pcOp, version: z39.string().regex(SEMVER) }).strict(),
|
|
3563
3761
|
/** Restarts the PC's daemon without installing anything. Passkey, purpose `pc`. */
|
|
3564
|
-
|
|
3762
|
+
z39.object({ type: z39.literal("daemon.restart"), ...pcOp }).strict(),
|
|
3565
3763
|
// ── Rigs and the kernel (`daemon.rigs`, docs/mobile-openrig-contract.md) ──
|
|
3566
3764
|
/** OpenRig on this PC, answered by `rigs.state`, then each change, whole, while the phone follows. */
|
|
3567
|
-
|
|
3568
|
-
|
|
3765
|
+
z39.object({ type: z39.literal("rigs.state") }).strict(),
|
|
3766
|
+
z39.object({ type: z39.literal("rigs.graph"), rig: RigNameSchema }).strict(),
|
|
3569
3767
|
/** A rig's open rows and its recently closed ones. */
|
|
3570
|
-
|
|
3768
|
+
z39.object({ type: z39.literal("rigs.queue"), rig: RigNameSchema }).strict(),
|
|
3571
3769
|
/** The queue's routing on this PC: the latest claims, handoffs, blocks and closes, every rig. */
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3770
|
+
z39.object({ type: z39.literal("rigs.routing") }).strict(),
|
|
3771
|
+
z39.object({ type: z39.literal("rigs.permissions"), rig: RigNameSchema }).strict(),
|
|
3772
|
+
z39.object({ type: z39.literal("rigs.snapshots"), rig: RigNameSchema }).strict(),
|
|
3575
3773
|
/** The goals given to the operator, answered by `rigs.goals`, then each change, whole, while the phone follows. */
|
|
3576
|
-
|
|
3774
|
+
z39.object({ type: z39.literal("rigs.goals") }).strict(),
|
|
3577
3775
|
/** An action on OpenRig, every kind the Desktop's `openrig.act` takes. One that `rigActNeedsCheck` names carries a passkey, purpose `rigs`. */
|
|
3578
|
-
|
|
3776
|
+
z39.object({ type: z39.literal("rigs.act"), op: OperationIdSchema, action: OpenRigActionSchema, assertion: AssertionSchema.optional() }).strict(),
|
|
3579
3777
|
// ── Pull and merge requests (`daemon.forge`, docs/mobile-forge-contract.md) ──
|
|
3580
3778
|
/** The requests of this PC's sessions and seats; subscribes the device to each change. */
|
|
3581
|
-
|
|
3779
|
+
z39.object({ type: z39.literal("forge.state") }).strict(),
|
|
3582
3780
|
/** A request's detail; `log`: also that job's last lines. */
|
|
3583
|
-
|
|
3781
|
+
z39.object({ type: z39.literal("forge.detail"), prId: z39.string().min(1).max(500), log: z39.string().min(1).max(40).optional() }).strict(),
|
|
3584
3782
|
/** Rerun, merge, comment, reply or resolve: every one writes on the forge, so each needs the device's check over that very action (purpose `forge`). */
|
|
3585
|
-
|
|
3783
|
+
z39.object({ type: z39.literal("forge.act"), op: OperationIdSchema, prId: z39.string().min(1).max(500), action: ForgeActionSchema, assertion: AssertionSchema.optional() }).strict(),
|
|
3586
3784
|
/** A running rig's seats per role (the Desktop's `openrig.seats`). One that removes a seat carries a passkey, purpose `rigs`. */
|
|
3587
|
-
|
|
3785
|
+
z39.object({ type: z39.literal("rigs.seats"), op: OperationIdSchema, rig: RigNameSchema, seats: RigSeatCountsSchema, delegation: z39.enum(["pairs", "all"]).optional(), assertion: AssertionSchema.optional() }).strict(),
|
|
3588
3786
|
/** A goal to the operator (the Desktop's `openrig.goal.send`); `goalId` is the phone's, the same for a retry. */
|
|
3589
|
-
|
|
3787
|
+
z39.object({ type: z39.literal("rigs.goal.send"), op: OperationIdSchema, goalId: z39.string().regex(/^[A-Za-z0-9-]{8,64}$/), text: z39.string().trim().min(1).max(8e3), folder: z39.string().min(1).max(4096).optional() }).strict(),
|
|
3590
3788
|
/** The person's words to the operator about a goal (the Desktop's `openrig.goal.reply`); `replyId` the phone's, the same for a retry. */
|
|
3591
|
-
|
|
3789
|
+
z39.object({ type: z39.literal("rigs.goal.reply"), op: OperationIdSchema, goalId: z39.string().regex(/^[A-Za-z0-9-]{8,64}$/), replyId: z39.string().regex(/^[A-Za-z0-9-]{8,64}$/), text: z39.string().trim().min(1).max(8e3) }).strict()
|
|
3592
3790
|
]);
|
|
3593
|
-
var PhoneModelChoiceSchema =
|
|
3791
|
+
var PhoneModelChoiceSchema = z39.object({
|
|
3594
3792
|
id: ModelChoiceSchema.shape.id.max(120),
|
|
3595
|
-
label:
|
|
3596
|
-
description:
|
|
3597
|
-
efforts:
|
|
3793
|
+
label: z39.string().max(80),
|
|
3794
|
+
description: z39.string().max(200).optional(),
|
|
3795
|
+
efforts: z39.array(EffortSchema).max(8).optional(),
|
|
3598
3796
|
defaultEffort: EffortSchema.optional(),
|
|
3599
|
-
isDefault:
|
|
3797
|
+
isDefault: z39.boolean().optional()
|
|
3600
3798
|
}).strict();
|
|
3601
3799
|
var PHONE_COMMANDS_MAX = 300;
|
|
3602
|
-
var PhoneSlashCommandSchema = SlashCommandSchema.extend({ description:
|
|
3800
|
+
var PhoneSlashCommandSchema = SlashCommandSchema.extend({ description: z39.string().max(200).optional() }).strict();
|
|
3603
3801
|
var PhoneHarnessUsageSchema = HarnessUsageSchema.omit({ account: true }).strict();
|
|
3604
|
-
var PhoneServerMessageSchema =
|
|
3802
|
+
var PhoneServerMessageSchema = z39.discriminatedUnion("type", [
|
|
3605
3803
|
/** This PC's harness limits (`daemon.usage`): after `snapshot.request`, then on each change, whole. `prefs.alert`: the PC's
|
|
3606
3804
|
* threshold, so the phone marks a window past it (amber, a line in « À toi ») and one reached (red). */
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
type:
|
|
3610
|
-
protocol:
|
|
3611
|
-
sessions:
|
|
3805
|
+
z39.object({ type: z39.literal("usage.state"), harnesses: z39.preprocess(dropUnknownHarnesses, z39.array(PhoneHarnessUsageSchema).max(4)), prefs: UsagePrefsSchema }),
|
|
3806
|
+
z39.object({
|
|
3807
|
+
type: z39.literal("snapshot"),
|
|
3808
|
+
protocol: z39.literal(PHONE_PROTOCOL),
|
|
3809
|
+
sessions: z39.array(PhoneSessionSchema),
|
|
3612
3810
|
capabilities: CapabilitiesByToolSchema,
|
|
3613
|
-
daemon:
|
|
3614
|
-
version:
|
|
3615
|
-
name:
|
|
3616
|
-
boot:
|
|
3811
|
+
daemon: z39.object({
|
|
3812
|
+
version: z39.string(),
|
|
3813
|
+
name: z39.string().max(40),
|
|
3814
|
+
boot: z39.string().uuid().optional(),
|
|
3617
3815
|
/** The daemon takes `session.model`. */
|
|
3618
|
-
models:
|
|
3816
|
+
models: z39.literal(true).optional(),
|
|
3619
3817
|
/** The daemon sends `session.checklist` and a session's `checklist` summary. */
|
|
3620
|
-
checklist:
|
|
3818
|
+
checklist: z39.literal(true).optional(),
|
|
3621
3819
|
/** `update`: the daemon can install a version and restart (npm, systemd); `restart`: it can restart (systemd). */
|
|
3622
|
-
update:
|
|
3623
|
-
restart:
|
|
3820
|
+
update: z39.literal(true).optional(),
|
|
3821
|
+
restart: z39.literal(true).optional(),
|
|
3624
3822
|
/** The daemon takes `session.close` and `session.resume`. */
|
|
3625
|
-
sessionClose:
|
|
3823
|
+
sessionClose: z39.literal(true).optional(),
|
|
3626
3824
|
/** The daemon streams a session's terminal (`term.open`). */
|
|
3627
|
-
terminal:
|
|
3825
|
+
terminal: z39.literal(true).optional(),
|
|
3628
3826
|
/** The PC lets a phone type into a terminal (`term.hold`): its setting is on. */
|
|
3629
|
-
terminalInput:
|
|
3827
|
+
terminalInput: z39.literal(true).optional(),
|
|
3630
3828
|
/** `term.open` takes `helper`: a subagent's terminal is its parent's, read-only for good. Absent (an older PC, which would drop
|
|
3631
3829
|
* `helper` and open the parent's pane as its own): the phone opens no subagent's terminal. */
|
|
3632
|
-
helperTerminal:
|
|
3830
|
+
helperTerminal: z39.literal(true).optional(),
|
|
3633
3831
|
/** The daemon answers `session.commands`. */
|
|
3634
|
-
commands:
|
|
3832
|
+
commands: z39.literal(true).optional(),
|
|
3635
3833
|
/** The daemon answers `openrig.row`. */
|
|
3636
|
-
rigRows:
|
|
3834
|
+
rigRows: z39.literal(true).optional(),
|
|
3637
3835
|
/** The daemon answers `openrig.asks` and `openrig.answer` (« À toi »). */
|
|
3638
|
-
openrig:
|
|
3836
|
+
openrig: z39.literal(true).optional(),
|
|
3639
3837
|
/** The daemon takes `session.broadcast` (« Écrire au groupe »). */
|
|
3640
|
-
broadcast:
|
|
3838
|
+
broadcast: z39.literal(true).optional(),
|
|
3641
3839
|
/** The daemon answers `folder.list`, `folder.recents` and `project.folders`, and takes `project.folder.add` and `.remove`. */
|
|
3642
|
-
projectFolders:
|
|
3840
|
+
projectFolders: z39.literal(true).optional(),
|
|
3643
3841
|
/** The daemon takes `project.edit`, `project.order`, `project.create` and `project.delete` (Réglages › Projets). */
|
|
3644
|
-
projectEdit:
|
|
3842
|
+
projectEdit: z39.literal(true).optional(),
|
|
3645
3843
|
/** The daemon takes `device.prefs` and `context.set` (the phone's Réglages); the device then carries its `prefs`. */
|
|
3646
|
-
settings:
|
|
3844
|
+
settings: z39.literal(true).optional(),
|
|
3647
3845
|
/** The daemon sends `usage.state` (its harnesses' limits). */
|
|
3648
|
-
usage:
|
|
3846
|
+
usage: z39.literal(true).optional(),
|
|
3649
3847
|
/** The Atelier: the snapshot carries `projects`, each session its `projectId` and `rig`, and `projects` follows each change. Absent (an older PC): no Atelier. */
|
|
3650
|
-
atelier:
|
|
3848
|
+
atelier: z39.literal(true).optional(),
|
|
3651
3849
|
/** Rigs and the kernel: the daemon answers the `rigs.*` reads and takes `rigs.act`, `rigs.seats`, `rigs.goal.send` and `.reply`. Absent (an older PC): the Rigs tab says « rien à afficher ». */
|
|
3652
|
-
rigs:
|
|
3850
|
+
rigs: z39.literal(true).optional(),
|
|
3653
3851
|
/** « Nouvelle session »: the daemon takes `session.launch` and `project.folders` carries this PC's folders' branch. Absent (an older PC): « Nouvelle » cannot start. */
|
|
3654
|
-
launch:
|
|
3852
|
+
launch: z39.literal(true).optional(),
|
|
3655
3853
|
/** Pull and merge requests: the daemon answers `forge.state` and `forge.detail`, and takes `forge.act`. Absent (an older PC): the MR/PR tab says « rien à afficher ». */
|
|
3656
|
-
forge:
|
|
3854
|
+
forge: z39.literal(true).optional(),
|
|
3657
3855
|
/** The device's conversations are kept 7 days (M3 Q33): the daemon answers `chat.conversations` and `chat.conversation`, and
|
|
3658
3856
|
* `chat.reset` puts the conversation away. Absent (an older PC): « Nouvelle conversation » forgets it. */
|
|
3659
|
-
conversations:
|
|
3857
|
+
conversations: z39.literal(true).optional()
|
|
3660
3858
|
}),
|
|
3661
3859
|
/** The user's projects (`daemon.atelier`), whole, in their order: absent from an older PC's snapshot. */
|
|
3662
|
-
projects:
|
|
3663
|
-
device:
|
|
3664
|
-
confirm:
|
|
3860
|
+
projects: z39.array(PhoneProjectSchema).max(PHONE_PROJECTS_MAX).optional(),
|
|
3861
|
+
device: z39.object({
|
|
3862
|
+
confirm: z39.boolean(),
|
|
3665
3863
|
/** Its passkey can bring it back after a reinstall: without it, « Mettre à jour la passkey ». */
|
|
3666
|
-
recover:
|
|
3667
|
-
push:
|
|
3668
|
-
chat:
|
|
3864
|
+
recover: z39.literal(true).optional(),
|
|
3865
|
+
push: z39.enum(["on", "off", "stale", "unavailable"]).optional(),
|
|
3866
|
+
chat: z39.literal(true).optional(),
|
|
3669
3867
|
contextNear: ContextPrefsSchema.shape.near.optional(),
|
|
3670
3868
|
/** This device's id (its fingerprint, as decisions name it in `by`), its kind, and the name the user gave it (absent: none given). */
|
|
3671
|
-
id:
|
|
3869
|
+
id: z39.string().optional(),
|
|
3672
3870
|
kind: DeviceKindSchema.optional(),
|
|
3673
|
-
name:
|
|
3871
|
+
name: z39.string().optional(),
|
|
3674
3872
|
/** This device's own settings (`daemon.settings`). */
|
|
3675
3873
|
prefs: DevicePrefsSchema.optional()
|
|
3676
3874
|
}).optional()
|
|
3677
3875
|
}),
|
|
3678
3876
|
/** « À toi » on this PC: the answer to `openrig.asks`, then each change, whole. */
|
|
3679
|
-
|
|
3877
|
+
z39.object({ type: z39.literal("openrig.asks"), channel: HumanChannelSchema, asks: z39.array(HumanAskSchema), partial: z39.literal(true).optional(), truncated: z39.literal(true).optional() }),
|
|
3680
3878
|
/** An answer's end, as on the desktop (`openrig.answered`), under the phone's `op`. `rejected`: the device check refused it (`reason`). */
|
|
3681
|
-
|
|
3682
|
-
type:
|
|
3879
|
+
z39.object({
|
|
3880
|
+
type: z39.literal("openrig.answered"),
|
|
3683
3881
|
op: OperationIdSchema,
|
|
3684
|
-
qitemId:
|
|
3685
|
-
ok:
|
|
3686
|
-
outcome:
|
|
3687
|
-
remaining:
|
|
3688
|
-
replyId:
|
|
3882
|
+
qitemId: z39.string(),
|
|
3883
|
+
ok: z39.boolean(),
|
|
3884
|
+
outcome: z39.enum(["recorded", "answered", "already"]).optional(),
|
|
3885
|
+
remaining: z39.array(z39.string()).optional(),
|
|
3886
|
+
replyId: z39.string().optional(),
|
|
3689
3887
|
error: HumanAnswerErrorSchema.optional(),
|
|
3690
|
-
message:
|
|
3691
|
-
rejected:
|
|
3888
|
+
message: z39.string().max(500).optional(),
|
|
3889
|
+
rejected: z39.enum(["confirm_required", "assertion_invalid", "assertion_expired", "unavailable"]).optional()
|
|
3692
3890
|
}),
|
|
3693
|
-
|
|
3694
|
-
|
|
3891
|
+
z39.object({ type: z39.literal("confirm.challenge"), purpose: ConfirmPurposeSchema, challenge: B64U3.max(64), rpId: z39.string().max(253), credentialId: B64U3.max(1366).optional(), expiresInMs: z39.number().int().positive() }),
|
|
3892
|
+
z39.object({ type: z39.literal("session.updated"), session: PhoneSessionSchema }),
|
|
3695
3893
|
/** The user's projects changed (a name, a colour, one added or removed, the order) (`daemon.atelier`): the list, whole. A session placed
|
|
3696
3894
|
* elsewhere by the change follows as its own `session.updated`, after this. */
|
|
3697
|
-
|
|
3698
|
-
|
|
3895
|
+
z39.object({ type: z39.literal("projects"), projects: z39.array(PhoneProjectSchema).max(PHONE_PROJECTS_MAX) }),
|
|
3896
|
+
z39.object({ type: z39.literal("session.removed"), id: z39.string() }),
|
|
3699
3897
|
/** A session's checklist, sent to the phone that watches it; `null`: it has none (any more). */
|
|
3700
|
-
|
|
3898
|
+
z39.object({ type: z39.literal("session.checklist"), id: z39.string(), checklist: PhoneChecklistSchema.nullable() }),
|
|
3701
3899
|
/** `pending.cut` is set when even this body was shortened. */
|
|
3702
|
-
|
|
3703
|
-
|
|
3900
|
+
z39.object({ type: z39.literal("session.pending"), id: z39.string(), pending: PhonePendingSchema }),
|
|
3901
|
+
z39.object({ type: z39.literal("session.preview"), id: z39.string(), lines: z39.array(z39.string()) }),
|
|
3704
3902
|
/** `cut`: the ids of the items shortened; `more`: older items were left out. */
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
type:
|
|
3903
|
+
z39.object({ type: z39.literal("session.thread"), id: z39.string(), items: z39.array(ThreadItemSchema), cut: z39.array(z39.string()), more: z39.boolean() }),
|
|
3904
|
+
z39.object({ type: z39.literal("session.thread.item"), id: z39.string(), item: ThreadItemSchema, cut: z39.literal(true).optional() }),
|
|
3905
|
+
z39.object({
|
|
3906
|
+
type: z39.literal("operation.result"),
|
|
3709
3907
|
op: OperationIdSchema,
|
|
3710
3908
|
status: OperationStatusSchema,
|
|
3711
3909
|
reason: OperationReasonSchema.optional(),
|
|
3712
3910
|
/** How an applied `session.close` ended the agent: `killed` when it had to be forced. */
|
|
3713
3911
|
how: CloseHowSchema.optional(),
|
|
3714
3912
|
/** An applied `session.launch`: the new session, whose thread the phone opens. */
|
|
3715
|
-
id:
|
|
3913
|
+
id: z39.string().max(200).optional(),
|
|
3716
3914
|
/** An applied `session.broadcast`: the names that got it and those that did not. */
|
|
3717
|
-
sent:
|
|
3718
|
-
refused:
|
|
3915
|
+
sent: z39.array(z39.string().max(100)).max(BROADCAST_SESSIONS_MAX).optional(),
|
|
3916
|
+
refused: z39.array(z39.object({ name: z39.string().max(100), reason: z39.string().max(200) })).max(BROADCAST_SESSIONS_MAX).optional()
|
|
3719
3917
|
}),
|
|
3720
3918
|
/** The models an agent offers; `error`: it could not be asked, `models` is then what Ledge knows without it. */
|
|
3721
|
-
|
|
3919
|
+
z39.object({ type: z39.literal("models.listing"), tool: ToolSchema, models: z39.array(PhoneModelChoiceSchema).max(40), error: z39.literal(true).optional() }),
|
|
3722
3920
|
/** A model change that was accepted and then failed (the agent could not restart). */
|
|
3723
|
-
|
|
3921
|
+
z39.object({ type: z39.literal("session.model.failed"), id: z39.string(), reason: ModelRefusalSchema }),
|
|
3724
3922
|
/** A session's slash commands; `error`: they could not be read (the agent is not listed, or did not answer in time): a command typed by hand still goes. */
|
|
3725
|
-
|
|
3923
|
+
z39.object({ type: z39.literal("session.commands.listing"), id: z39.string(), commands: z39.array(PhoneSlashCommandSchema).max(PHONE_COMMANDS_MAX), error: z39.literal(true).optional() }),
|
|
3726
3924
|
/** A queue row's state, answering `openrig.row`: `row`, or `error`. */
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3925
|
+
z39.object({ type: z39.literal("openrig.rowState"), qitem: z39.string(), row: PhoneRigRowSchema.optional(), error: PhoneRowErrorSchema.optional() }),
|
|
3926
|
+
z39.object({ type: z39.literal("chat.history"), turns: z39.array(PhoneChatTurnSchema).max(50) }),
|
|
3927
|
+
z39.object({ type: z39.literal("chat.step"), qid: OperationIdSchema, step: PhoneChatStepSchema }),
|
|
3730
3928
|
/** The whole text so far, not an increment. */
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3929
|
+
z39.object({ type: z39.literal("chat.delta"), qid: OperationIdSchema, text: z39.string().max(THREAD_TEXT_MAX) }),
|
|
3930
|
+
z39.object({ type: z39.literal("chat.done"), qid: OperationIdSchema, turn: PhoneChatTurnSchema }),
|
|
3931
|
+
z39.object({ type: z39.literal("chat.error"), qid: OperationIdSchema, code: ChatErrorCodeSchema }),
|
|
3734
3932
|
/** The current conversation's answers that read the account limits, and when (M3 Q31): a phone shows the limits under each. Sent after a
|
|
3735
3933
|
* `chat.history` or a `chat.done` that touches one, apart from the turn so that an older phone, whose turn schema is strict, loses nothing. */
|
|
3736
|
-
|
|
3934
|
+
z39.object({ type: z39.literal("chat.limits"), reads: z39.array(ChatLimitsReadSchema).max(50) }),
|
|
3737
3935
|
/** The device's conversations (M3 Q33): the current one once it has a question, and the ones put away, the most recent first. */
|
|
3738
|
-
|
|
3936
|
+
z39.object({ type: z39.literal("chat.conversations"), current: ChatConversationSummarySchema.optional(), past: z39.array(ChatConversationSummarySchema).max(200) }),
|
|
3739
3937
|
/** One conversation, read-only, as `chat.history` gives its turns (`limits` as `chat.limits`); `error`: it is no longer kept. */
|
|
3740
|
-
|
|
3741
|
-
type:
|
|
3742
|
-
id:
|
|
3743
|
-
turns:
|
|
3744
|
-
limits:
|
|
3745
|
-
error:
|
|
3938
|
+
z39.object({
|
|
3939
|
+
type: z39.literal("chat.conversation"),
|
|
3940
|
+
id: z39.string().uuid(),
|
|
3941
|
+
turns: z39.array(PhoneChatTurnSchema).max(50).optional(),
|
|
3942
|
+
limits: z39.array(ChatLimitsReadSchema).max(50).optional(),
|
|
3943
|
+
error: z39.literal("unknown").optional()
|
|
3746
3944
|
}),
|
|
3747
3945
|
/** The daemon updating or restarting itself, whoever asked: npm runs, then the service restarts (the link drops right after). */
|
|
3748
|
-
|
|
3946
|
+
z39.object({ type: z39.literal("daemon.progress"), version: z39.string().max(40), step: z39.enum(["installing", "restarting"]) }),
|
|
3749
3947
|
/** Nothing was changed. Never npm's output nor a command: both hold the PC's paths. */
|
|
3750
|
-
|
|
3948
|
+
z39.object({ type: z39.literal("daemon.failed"), version: z39.string().max(40), reason: UpdateFailureSchema }),
|
|
3751
3949
|
/** The tasks Ledge gave, open or closed lately, after each snapshot; then each change. */
|
|
3752
|
-
|
|
3753
|
-
|
|
3950
|
+
z39.object({ type: z39.literal("tasks"), tasks: z39.array(PhoneTaskSchema).max(200) }),
|
|
3951
|
+
z39.object({ type: z39.literal("task.updated"), task: PhoneTaskSchema }),
|
|
3952
|
+
/** The routines, newest first, without their prompt (the phone's list is read-only); then each change, or `removed` (its id). */
|
|
3953
|
+
// Not strict, as every routine schema: a newer PC's field never makes the list unreadable to an older phone.
|
|
3954
|
+
z39.object({ type: z39.literal("routines"), routines: z39.array(PhoneRoutineSchema).max(ROUTINES_MAX) }),
|
|
3955
|
+
z39.object({ type: z39.literal("routine.changed"), routine: PhoneRoutineSchema.optional(), removed: RoutineIdSchema.optional() }),
|
|
3956
|
+
/** The answer to `routine.show`: the routine whole, or `gone` when there is no such routine now. */
|
|
3957
|
+
z39.object({ type: z39.literal("routine.detail"), id: RoutineIdSchema, routine: PhoneRoutineDetailSchema.optional(), gone: z39.literal(true).optional() }),
|
|
3754
3958
|
AttachmentStoredSchema,
|
|
3755
3959
|
AttachmentDataSchema,
|
|
3756
3960
|
AttachmentErrorSchema,
|
|
3757
3961
|
/** A terminal's first screen (also the answer to `term.resync`, then without `op`): the pane's size, the cursor, and the `seq` the next output takes. */
|
|
3758
|
-
|
|
3759
|
-
type:
|
|
3962
|
+
z39.object({
|
|
3963
|
+
type: z39.literal("term.opened"),
|
|
3760
3964
|
op: OperationIdSchema.optional(),
|
|
3761
3965
|
tid: TerminalIdSchema,
|
|
3762
|
-
id:
|
|
3966
|
+
id: z39.string(),
|
|
3763
3967
|
cols: TermDimSchema,
|
|
3764
3968
|
rows: TermDimSchema,
|
|
3765
|
-
screen:
|
|
3766
|
-
cursor:
|
|
3767
|
-
seq:
|
|
3969
|
+
screen: z39.string().max(TERM_SCREEN_MAX),
|
|
3970
|
+
cursor: z39.object({ x: z39.number().int().nonnegative(), y: z39.number().int().nonnegative() }),
|
|
3971
|
+
seq: z39.number().int().nonnegative(),
|
|
3768
3972
|
/** Read-only for good: a subagent's page shows its parent's pane. */
|
|
3769
|
-
readOnly:
|
|
3973
|
+
readOnly: z39.literal(true).optional()
|
|
3770
3974
|
}),
|
|
3771
3975
|
/** What the pane printed since the last one; `seq` + 1 each time. */
|
|
3772
|
-
|
|
3773
|
-
|
|
3976
|
+
z39.object({ type: z39.literal("term.output"), tid: TerminalIdSchema, seq: z39.number().int().nonnegative(), data: z39.string().min(1).max(TERM_OUTPUT_MAX) }),
|
|
3977
|
+
z39.object({ type: z39.literal("term.size"), tid: TerminalIdSchema, cols: TermDimSchema, rows: TermDimSchema }),
|
|
3774
3978
|
/** The phone holds the hand until `until`, pushed back by each key (5 min), never past 30 min from the hold. */
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3979
|
+
z39.object({ type: z39.literal("term.held"), tid: TerminalIdSchema, until: z39.string().datetime() }),
|
|
3980
|
+
z39.object({ type: z39.literal("term.released"), tid: TerminalIdSchema, why: TermReleaseWhySchema }),
|
|
3981
|
+
z39.object({ type: z39.literal("term.exit"), tid: TerminalIdSchema, why: TermExitWhySchema }),
|
|
3778
3982
|
/** Never carries free text. */
|
|
3779
3983
|
/** The subfolders of `path` on this PC (home when asked without one); `parent` null at the root. */
|
|
3780
|
-
|
|
3781
|
-
type:
|
|
3984
|
+
z39.object({
|
|
3985
|
+
type: z39.literal("folder.listing"),
|
|
3782
3986
|
path: FolderPathSchema,
|
|
3783
3987
|
parent: FolderPathSchema.nullable(),
|
|
3784
|
-
entries:
|
|
3785
|
-
repos:
|
|
3786
|
-
cut:
|
|
3988
|
+
entries: z39.array(z39.string().min(1).max(255)).max(PHONE_FOLDER_ENTRIES_MAX),
|
|
3989
|
+
repos: z39.array(z39.object({ name: z39.string().min(1).max(255), branch: z39.string().max(200) })).max(PHONE_FOLDER_ENTRIES_MAX),
|
|
3990
|
+
cut: z39.literal(true).optional(),
|
|
3787
3991
|
error: PhoneFolderErrorSchema.optional()
|
|
3788
3992
|
}),
|
|
3789
|
-
|
|
3993
|
+
z39.object({ type: z39.literal("folder.recents"), paths: z39.array(FolderPathSchema).max(PHONE_RECENT_FOLDERS_MAX) }),
|
|
3790
3994
|
/** A project's folders, in its order; `gone`: no such project now. */
|
|
3791
|
-
|
|
3792
|
-
|
|
3995
|
+
z39.object({ type: z39.literal("project.folders"), id: z39.string(), folders: z39.array(PhoneFolderSchema).max(50), gone: z39.literal(true).optional() }),
|
|
3996
|
+
z39.object({ type: z39.literal("error"), code: z39.enum(["invalid", "unknown_session", "too_large"]), request: z39.string().max(40).optional() }),
|
|
3793
3997
|
// ── Rigs and the kernel (`daemon.rigs`) ──
|
|
3794
3998
|
/** `error`: OpenRig could not be read (`state` absent). */
|
|
3795
|
-
|
|
3999
|
+
z39.object({ type: z39.literal("rigs.state"), state: PhoneOpenRigStateSchema.optional(), error: PhoneRigErrorSchema.optional() }).strict(),
|
|
3796
4000
|
// ── Pull and merge requests (`daemon.forge`) ──
|
|
3797
4001
|
/** After `forge.state`, then on each change, whole. */
|
|
3798
|
-
|
|
4002
|
+
z39.object({ type: z39.literal("forge.state"), ...PhoneForgeStateSchema.shape }).strict(),
|
|
3799
4003
|
/** `cut`: the gateway left out patches, discussions or commits, or shortened texts, to fit the frame. */
|
|
3800
|
-
|
|
4004
|
+
z39.object({ type: z39.literal("forge.detail"), prId: z39.string(), detail: PrDetailSchema.optional(), cut: z39.literal(true).optional(), error: PhoneForgeErrorSchema.optional() }).strict(),
|
|
3801
4005
|
/** An action's end, under its `op` (`operation.result` says whether it ran). `command`: what ran; `message`: gh's or glab's line when `failed`. */
|
|
3802
|
-
|
|
3803
|
-
type:
|
|
4006
|
+
z39.object({
|
|
4007
|
+
type: z39.literal("forge.done"),
|
|
3804
4008
|
op: OperationIdSchema,
|
|
3805
|
-
ok:
|
|
3806
|
-
command:
|
|
4009
|
+
ok: z39.boolean(),
|
|
4010
|
+
command: z39.string().max(PHONE_FORGE_MESSAGE_MAX).optional(),
|
|
3807
4011
|
error: PhoneForgeActErrorSchema.optional(),
|
|
3808
|
-
message:
|
|
4012
|
+
message: z39.string().max(PHONE_FORGE_MESSAGE_MAX).optional(),
|
|
3809
4013
|
rejected: PhoneForgeRejectedSchema.optional()
|
|
3810
4014
|
}).strict(),
|
|
3811
|
-
|
|
4015
|
+
z39.object({ type: z39.literal("rigs.graph"), rig: z39.string(), graph: RigGraphSchema.optional(), error: PhoneRigErrorSchema.optional() }).strict(),
|
|
3812
4016
|
/** `rows`: open (pending, in-progress, blocked), newest first; `closed`: closed lately, newest first; `truncated`: older open rows may be missing. */
|
|
3813
|
-
|
|
3814
|
-
type:
|
|
3815
|
-
rig:
|
|
3816
|
-
rows:
|
|
3817
|
-
closed:
|
|
3818
|
-
truncated:
|
|
4017
|
+
z39.object({
|
|
4018
|
+
type: z39.literal("rigs.queue"),
|
|
4019
|
+
rig: z39.string(),
|
|
4020
|
+
rows: z39.array(PhoneRigQueueRowSchema).max(PHONE_RIG_ROWS_MAX),
|
|
4021
|
+
closed: z39.array(PhoneRigQueueRowSchema).max(PHONE_RIG_ROWS_MAX),
|
|
4022
|
+
truncated: z39.boolean(),
|
|
3819
4023
|
error: PhoneRigErrorSchema.optional()
|
|
3820
4024
|
}).strict(),
|
|
3821
4025
|
/** Oldest first, at most 20. */
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
4026
|
+
z39.object({ type: z39.literal("rigs.routing"), entries: z39.array(PhoneRigRoutingSchema).max(20), error: PhoneRigErrorSchema.optional() }).strict(),
|
|
4027
|
+
z39.object({ type: z39.literal("rigs.permissions"), rig: z39.string(), policy: z39.string().max(PHONE_RIG_TEXT_MAX).optional(), seats: z39.array(PhoneRigPermissionSchema).max(PHONE_RIG_SEATS_MAX), error: PhoneRigErrorSchema.optional() }).strict(),
|
|
4028
|
+
z39.object({ type: z39.literal("rigs.snapshots"), rig: z39.string(), snapshots: z39.array(RigSnapshotSchema).max(20), error: PhoneRigErrorSchema.optional() }).strict(),
|
|
4029
|
+
z39.object({ type: z39.literal("rigs.goals"), goals: z39.array(PhoneGoalSchema).max(PHONE_GOALS_MAX), partial: z39.literal(true).optional(), error: PhoneRigErrorSchema.optional() }).strict(),
|
|
3826
4030
|
/** An action's end, under its `op` (`operation.result` says whether it ran). `commands`: the `rig` commands as shown; `error`: `busy`, `not_installed`,
|
|
3827
4031
|
* `spec_unknown`, `spec_no_policy`, `spec_policy_unsupported`, or `failed` with `message`, OpenRig's last line; `completed` as the Desktop's. */
|
|
3828
|
-
|
|
3829
|
-
type:
|
|
4032
|
+
z39.object({
|
|
4033
|
+
type: z39.literal("rigs.done"),
|
|
3830
4034
|
op: OperationIdSchema,
|
|
3831
|
-
ok:
|
|
3832
|
-
commands:
|
|
3833
|
-
error:
|
|
3834
|
-
message:
|
|
3835
|
-
completed:
|
|
4035
|
+
ok: z39.boolean(),
|
|
4036
|
+
commands: z39.array(z39.string().max(PHONE_RIG_TEXT_MAX)).max(400),
|
|
4037
|
+
error: z39.string().max(40).optional(),
|
|
4038
|
+
message: z39.string().max(PHONE_RIG_TEXT_MAX).optional(),
|
|
4039
|
+
completed: z39.number().int().min(0).optional(),
|
|
3836
4040
|
rejected: PhoneRigRejectedSchema.optional()
|
|
3837
4041
|
}).strict(),
|
|
3838
4042
|
/** A change of seats ended: `added` / `removed` as `pod.member`; `error`: `rig_not_running`, `rig_root_unknown`, `busy`, or `failed` with `message`. */
|
|
3839
|
-
|
|
3840
|
-
type:
|
|
4043
|
+
z39.object({
|
|
4044
|
+
type: z39.literal("rigs.reseated"),
|
|
3841
4045
|
op: OperationIdSchema,
|
|
3842
|
-
ok:
|
|
3843
|
-
commands:
|
|
3844
|
-
added:
|
|
3845
|
-
removed:
|
|
3846
|
-
error:
|
|
3847
|
-
message:
|
|
3848
|
-
links:
|
|
3849
|
-
linksUnsupported:
|
|
4046
|
+
ok: z39.boolean(),
|
|
4047
|
+
commands: z39.array(z39.string().max(PHONE_RIG_TEXT_MAX)).max(400),
|
|
4048
|
+
added: z39.array(z39.string()).max(PHONE_RIG_SEATS_MAX),
|
|
4049
|
+
removed: z39.array(z39.string()).max(PHONE_RIG_SEATS_MAX),
|
|
4050
|
+
error: z39.string().max(40).optional(),
|
|
4051
|
+
message: z39.string().max(PHONE_RIG_TEXT_MAX).optional(),
|
|
4052
|
+
links: z39.number().int().optional(),
|
|
4053
|
+
linksUnsupported: z39.boolean().optional(),
|
|
3850
4054
|
rejected: PhoneRigRejectedSchema.optional()
|
|
3851
4055
|
}).strict(),
|
|
3852
|
-
|
|
3853
|
-
type:
|
|
4056
|
+
z39.object({
|
|
4057
|
+
type: z39.literal("rigs.goal.sent"),
|
|
3854
4058
|
op: OperationIdSchema,
|
|
3855
|
-
goalId:
|
|
3856
|
-
ok:
|
|
3857
|
-
qitemId:
|
|
4059
|
+
goalId: z39.string(),
|
|
4060
|
+
ok: z39.boolean(),
|
|
4061
|
+
qitemId: z39.string().optional(),
|
|
3858
4062
|
error: GoalErrorSchema.optional(),
|
|
3859
|
-
message:
|
|
4063
|
+
message: z39.string().max(PHONE_RIG_TEXT_MAX).optional(),
|
|
3860
4064
|
rejected: PhoneRigRejectedSchema.optional()
|
|
3861
4065
|
}).strict(),
|
|
3862
|
-
|
|
3863
|
-
type:
|
|
4066
|
+
z39.object({
|
|
4067
|
+
type: z39.literal("rigs.goal.replied"),
|
|
3864
4068
|
op: OperationIdSchema,
|
|
3865
|
-
goalId:
|
|
3866
|
-
replyId:
|
|
3867
|
-
ok:
|
|
3868
|
-
qitemId:
|
|
4069
|
+
goalId: z39.string(),
|
|
4070
|
+
replyId: z39.string(),
|
|
4071
|
+
ok: z39.boolean(),
|
|
4072
|
+
qitemId: z39.string().optional(),
|
|
3869
4073
|
error: GoalErrorSchema.optional(),
|
|
3870
|
-
message:
|
|
4074
|
+
message: z39.string().max(PHONE_RIG_TEXT_MAX).optional(),
|
|
3871
4075
|
rejected: PhoneRigRejectedSchema.optional()
|
|
3872
4076
|
}).strict()
|
|
3873
4077
|
]);
|
|
3874
4078
|
|
|
3875
4079
|
// ../../packages/protocol/src/media.ts
|
|
3876
|
-
import { z as
|
|
3877
|
-
var MediaCommandSchema =
|
|
4080
|
+
import { z as z40 } from "zod";
|
|
4081
|
+
var MediaCommandSchema = z40.enum(["previous", "play_pause", "next"]);
|
|
3878
4082
|
var ARTWORK_MAX_BYTES = 512 * 1024;
|
|
3879
|
-
var NowPlayingSchema =
|
|
4083
|
+
var NowPlayingSchema = z40.object({
|
|
3880
4084
|
/** The track's title; a session without one is not reported (nothing to show). */
|
|
3881
|
-
title:
|
|
4085
|
+
title: z40.string().min(1),
|
|
3882
4086
|
/** '' when the player gives none (a web video often has no artist). */
|
|
3883
|
-
artist:
|
|
3884
|
-
album:
|
|
4087
|
+
artist: z40.string(),
|
|
4088
|
+
album: z40.string().optional(),
|
|
3885
4089
|
/** The cover as a `data:image/…;base64,` URL; left out when the player has none, or it is over ARTWORK_MAX_BYTES. It can
|
|
3886
4090
|
* arrive in a later event than the track itself: players often publish the thumbnail a moment after the title. */
|
|
3887
|
-
artwork:
|
|
4091
|
+
artwork: z40.string().startsWith("data:image/").optional(),
|
|
3888
4092
|
/** True while it plays; a paused session is still reported (with false), `null` means no media session at all. */
|
|
3889
|
-
playing:
|
|
4093
|
+
playing: z40.boolean(),
|
|
3890
4094
|
/** What the player accepts now; a control it refuses is disabled, not hidden, at the front's choice. */
|
|
3891
|
-
can:
|
|
4095
|
+
can: z40.object({ previous: z40.boolean(), playPause: z40.boolean(), next: z40.boolean() }),
|
|
3892
4096
|
/** The player: SMTC's source app id (`Spotify.exe`, `MSEdge`, a packaged app's AUMID), and its display name when
|
|
3893
4097
|
* Windows knows one. Several players can hold a session: the one reported is the one playing (Windows' current one
|
|
3894
4098
|
* first), else Windows' current one. Commands go to that same player. */
|
|
3895
|
-
player:
|
|
4099
|
+
player: z40.object({ id: z40.string().min(1), name: z40.string().optional() })
|
|
3896
4100
|
});
|
|
3897
4101
|
var NowPlayingStateSchema = NowPlayingSchema.nullable();
|
|
3898
4102
|
|
|
@@ -3903,8 +4107,8 @@ var ConfigError = class extends Error {
|
|
|
3903
4107
|
this.name = "ConfigError";
|
|
3904
4108
|
}
|
|
3905
4109
|
};
|
|
3906
|
-
var TokensSchema =
|
|
3907
|
-
var PortSchema =
|
|
4110
|
+
var TokensSchema = z41.record(z41.string().min(1), z41.object({ accountId: z41.string().min(1), peer: RelayPeerSchema }));
|
|
4111
|
+
var PortSchema = z41.coerce.number().int().min(0).max(65535);
|
|
3908
4112
|
function required(env, name) {
|
|
3909
4113
|
const v = env[name];
|
|
3910
4114
|
if (!v) throw new ConfigError(`${name} is not set`);
|
|
@@ -4237,10 +4441,10 @@ function countedLog(log, ms) {
|
|
|
4237
4441
|
|
|
4238
4442
|
// src/routes.ts
|
|
4239
4443
|
import { createHash as createHash3, timingSafeEqual as timingSafeEqual2 } from "crypto";
|
|
4240
|
-
import { z as
|
|
4444
|
+
import { z as z43 } from "zod";
|
|
4241
4445
|
|
|
4242
4446
|
// src/github.ts
|
|
4243
|
-
import { z as
|
|
4447
|
+
import { z as z42 } from "zod";
|
|
4244
4448
|
var GitHubError = class extends Error {
|
|
4245
4449
|
code;
|
|
4246
4450
|
constructor(code) {
|
|
@@ -4249,21 +4453,21 @@ var GitHubError = class extends Error {
|
|
|
4249
4453
|
this.code = code;
|
|
4250
4454
|
}
|
|
4251
4455
|
};
|
|
4252
|
-
var DeviceStartSchema =
|
|
4253
|
-
device_code:
|
|
4254
|
-
user_code:
|
|
4255
|
-
verification_uri:
|
|
4256
|
-
expires_in:
|
|
4257
|
-
interval:
|
|
4258
|
-
});
|
|
4259
|
-
var TokenAnswerSchema =
|
|
4260
|
-
access_token:
|
|
4261
|
-
error:
|
|
4262
|
-
interval:
|
|
4263
|
-
});
|
|
4264
|
-
var UserSchema =
|
|
4265
|
-
id:
|
|
4266
|
-
login:
|
|
4456
|
+
var DeviceStartSchema = z42.object({
|
|
4457
|
+
device_code: z42.string().min(1),
|
|
4458
|
+
user_code: z42.string().min(1),
|
|
4459
|
+
verification_uri: z42.string().min(1),
|
|
4460
|
+
expires_in: z42.number().int().positive(),
|
|
4461
|
+
interval: z42.number().int().positive()
|
|
4462
|
+
});
|
|
4463
|
+
var TokenAnswerSchema = z42.object({
|
|
4464
|
+
access_token: z42.string().min(1).optional(),
|
|
4465
|
+
error: z42.string().optional(),
|
|
4466
|
+
interval: z42.number().int().positive().optional()
|
|
4467
|
+
});
|
|
4468
|
+
var UserSchema = z42.object({
|
|
4469
|
+
id: z42.number().int().nonnegative(),
|
|
4470
|
+
login: z42.string().min(1)
|
|
4267
4471
|
});
|
|
4268
4472
|
var DEVICE_GRANT = "urn:ietf:params:oauth:grant-type:device_code";
|
|
4269
4473
|
var USER_AGENT = "ledge-relay";
|
|
@@ -4518,10 +4722,10 @@ async function readJson(req, schema, max = MAX_BODY) {
|
|
|
4518
4722
|
if (!r.success) throw new Answer(400, "bad_request");
|
|
4519
4723
|
return r.data;
|
|
4520
4724
|
}
|
|
4521
|
-
var RevokeBodySchema =
|
|
4725
|
+
var RevokeBodySchema = z43.object({
|
|
4522
4726
|
peer: RelayPeerSchema.refine((p) => p !== "pc")
|
|
4523
4727
|
});
|
|
4524
|
-
var PollBodySchema =
|
|
4728
|
+
var PollBodySchema = z43.object({ deviceCode: z43.string().min(1).max(1024) });
|
|
4525
4729
|
function authRoutes(deps) {
|
|
4526
4730
|
const maxCalls = deps.maxGitHubCalls ?? DEFAULT_MAX_GITHUB_CALLS;
|
|
4527
4731
|
let inFlight = 0;
|