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