@paradow/ledge-relay 0.68.0 → 0.69.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-XNZAVWQ2.js → chunk-YIXJHVVJ.js} +1063 -1052
- package/dist/cli.js +1 -1
- package/dist/main.js +1 -1
- package/package.json +1 -1
- package/web/assets/App-BZW6ErX4.js +24 -0
- package/web/assets/{boot-BbpqdzkM.js → boot-DT5fP2iI.js} +1 -1
- package/web/assets/index-BHGZ1VXb.css +1 -0
- package/web/assets/index-Dym_JmZg.js +52 -0
- package/web/assets/label-BaxV_67E.js +1 -0
- package/web/assets/{xterm-BhZrDqc2.js → xterm-YqIFWHlk.js} +1 -1
- package/web/build.json +1 -1
- package/web/index.html +2 -2
- package/web/sw.js +1 -1
- package/web/assets/App-_yi572PP.js +0 -24
- package/web/assets/index-CzqtV0OH.js +0 -52
- package/web/assets/index-DlM6pK9t.css +0 -1
- package/web/assets/label-QUEtuA8i.js +0 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { existsSync } from "fs";
|
|
3
3
|
import { join } from "path";
|
|
4
4
|
import { createPrivateKey, createPublicKey, sign, verify } from "crypto";
|
|
5
|
-
import { z as
|
|
5
|
+
import { z as z40 } from "zod";
|
|
6
6
|
|
|
7
7
|
// ../../packages/protocol/src/attachments.ts
|
|
8
8
|
import { z } from "zod";
|
|
@@ -759,6 +759,77 @@ var OpenRigGoalRepliedSchema = z7.object({
|
|
|
759
759
|
error: GoalErrorSchema.optional(),
|
|
760
760
|
message: z7.string().optional()
|
|
761
761
|
});
|
|
762
|
+
var MissionRowStateSchema = z7.enum(["pending", "in-progress", "blocked"]);
|
|
763
|
+
var MissionChildSchema = z7.object({
|
|
764
|
+
qitemId: z7.string(),
|
|
765
|
+
title: z7.string(),
|
|
766
|
+
holder: z7.string(),
|
|
767
|
+
state: MissionRowStateSchema,
|
|
768
|
+
since: z7.string(),
|
|
769
|
+
by: z7.enum(["blocked_on", "cited", "cites_mission"])
|
|
770
|
+
});
|
|
771
|
+
var MissionWaitSchema = z7.discriminatedUnion("kind", [
|
|
772
|
+
z7.object({ kind: z7.literal("row"), qitemId: z7.string(), title: z7.string().nullable(), holder: z7.string().nullable(), state: z7.string().nullable() }),
|
|
773
|
+
z7.object({ kind: z7.literal("external"), text: z7.string() })
|
|
774
|
+
]);
|
|
775
|
+
var MissionSchema = z7.object({
|
|
776
|
+
/** The open row, at the end of the chain. */
|
|
777
|
+
qitemId: z7.string(),
|
|
778
|
+
/** The operator's own row, where the chain starts (`qitemId` when it was not handed on). */
|
|
779
|
+
rootQitemId: z7.string(),
|
|
780
|
+
rig: z7.string(),
|
|
781
|
+
state: MissionRowStateSchema,
|
|
782
|
+
/** Since when it is in that state: the open row's last change of state. */
|
|
783
|
+
since: z7.string(),
|
|
784
|
+
/** The row's summary, else its body's first line. */
|
|
785
|
+
title: z7.string(),
|
|
786
|
+
/** Who gave the open row, who holds it. */
|
|
787
|
+
from: z7.string(),
|
|
788
|
+
to: z7.string(),
|
|
789
|
+
waitsOn: MissionWaitSchema.nullable(),
|
|
790
|
+
/** The holder's last note on the open row (`rig queue update --note`, a block's note…), the queue's own notes left out. */
|
|
791
|
+
lastNote: z7.object({ at: z7.string(), by: z7.string(), text: z7.string() }).nullable(),
|
|
792
|
+
/** The rows linked to it still open, the oldest first. */
|
|
793
|
+
children: z7.array(MissionChildSchema),
|
|
794
|
+
/** The rows linked to it that ended: their count and titles, the most recent first. */
|
|
795
|
+
closed: z7.object({ count: z7.number().int().nonnegative(), titles: z7.array(z7.string()) }),
|
|
796
|
+
/** Part of this mission could not be read (its journal, a successor, the holder's rows): what is shown is what was read. */
|
|
797
|
+
partial: z7.boolean().optional()
|
|
798
|
+
});
|
|
799
|
+
var ExchangeDeliverySchema = z7.enum(["delivered", "indeterminate", "failed", "pending"]);
|
|
800
|
+
var ExchangeSchema = z7.object({
|
|
801
|
+
id: z7.string(),
|
|
802
|
+
at: z7.string(),
|
|
803
|
+
kind: z7.enum(["message", "given", "handed", "blocked", "done"]),
|
|
804
|
+
/** `blocked`: the seat that blocks, and in `to` the holder of what it waits on (empty when outside OpenRig or not read). */
|
|
805
|
+
from: z7.string(),
|
|
806
|
+
to: z7.array(z7.string()),
|
|
807
|
+
/** The rigs of its seats, for the « par rig » filter. */
|
|
808
|
+
rigs: z7.array(z7.string()),
|
|
809
|
+
text: z7.string(),
|
|
810
|
+
qitemId: z7.string().optional(),
|
|
811
|
+
delivery: ExchangeDeliverySchema.optional(),
|
|
812
|
+
urgent: z7.boolean().optional(),
|
|
813
|
+
outcome: z7.enum(["done", "canceled", "failed", "denied"]).optional()
|
|
814
|
+
});
|
|
815
|
+
var OpenRigMissionsSchema = z7.object({
|
|
816
|
+
type: z7.literal("openrig.missions"),
|
|
817
|
+
requestId: z7.string().min(1).max(100),
|
|
818
|
+
machineId: z7.string().optional(),
|
|
819
|
+
exchanges: z7.number().int().min(1).max(500).optional()
|
|
820
|
+
});
|
|
821
|
+
var OpenRigMissionsChangedSchema = z7.object({
|
|
822
|
+
type: z7.literal("openrig.missionsChanged"),
|
|
823
|
+
requestId: z7.string().optional(),
|
|
824
|
+
machineId: z7.string().optional(),
|
|
825
|
+
openrig: z7.enum(["ok", "absent", "stopped", "unreachable"]),
|
|
826
|
+
operator: z7.string().nullable(),
|
|
827
|
+
missions: z7.array(MissionSchema),
|
|
828
|
+
exchanges: z7.array(ExchangeSchema),
|
|
829
|
+
exchangesMore: z7.boolean(),
|
|
830
|
+
partial: z7.boolean().optional(),
|
|
831
|
+
error: z7.enum(["offline", "outdated"]).optional()
|
|
832
|
+
});
|
|
762
833
|
|
|
763
834
|
// ../../packages/protocol/src/report.ts
|
|
764
835
|
var ReportKindSchema = z8.enum(["bug", "feature"]);
|
|
@@ -1476,6 +1547,9 @@ var OperatorNoticeSchema = z12.object({
|
|
|
1476
1547
|
rig: z12.string().optional(),
|
|
1477
1548
|
qitem: z12.string().optional(),
|
|
1478
1549
|
options: z12.array(z12.object({ id: z12.string(), label: z12.string().max(60) })).max(3).optional(),
|
|
1550
|
+
/** The question `options` belong to (#40): an option picked is `openrig.answer`'s `choice` with this `questionId`. Absent from daemons
|
|
1551
|
+
* before #40, and when there are no options. */
|
|
1552
|
+
questionId: z12.string().optional(),
|
|
1479
1553
|
priority: z12.enum(["routine", "urgent", "critical"]),
|
|
1480
1554
|
at: z12.string().datetime()
|
|
1481
1555
|
});
|
|
@@ -1861,7 +1935,7 @@ var BROADCAST_SESSIONS_MAX = 32;
|
|
|
1861
1935
|
var BROADCAST_LABEL_MAX = 120;
|
|
1862
1936
|
|
|
1863
1937
|
// ../../packages/protocol/src/messages.ts
|
|
1864
|
-
import { z as
|
|
1938
|
+
import { z as z33 } from "zod";
|
|
1865
1939
|
|
|
1866
1940
|
// ../../packages/protocol/src/repos.ts
|
|
1867
1941
|
import { z as z22 } from "zod";
|
|
@@ -2178,104 +2252,83 @@ var OpenRigRoleDuplicatedSchema = z26.object({
|
|
|
2178
2252
|
});
|
|
2179
2253
|
var ROLE_FILE_MAX = 512 * 1024;
|
|
2180
2254
|
|
|
2181
|
-
// ../../packages/protocol/src/routing.ts
|
|
2182
|
-
import { z as z27 } from "zod";
|
|
2183
|
-
var MachineInventorySchema = z27.object({
|
|
2184
|
-
id: z27.string().min(1).max(80),
|
|
2185
|
-
label: z27.string().min(1).max(120),
|
|
2186
|
-
online: z27.boolean(),
|
|
2187
|
-
local: z27.boolean(),
|
|
2188
|
-
sessions: z27.array(z27.object({ id: z27.string(), name: z27.string(), project: z27.string(), cwd: z27.string(), topic: z27.string().optional(), state: z27.string(), readOnly: z27.boolean() })).max(500),
|
|
2189
|
-
folders: z27.array(z27.object({ project: z27.string(), cwd: z27.string() })).max(100)
|
|
2190
|
-
});
|
|
2191
|
-
var RoutingContextSchema = z27.object({
|
|
2192
|
-
machines: z27.array(MachineInventorySchema).min(1).max(20),
|
|
2193
|
-
history: z27.array(z27.object({ question: z27.string().max(2e4), answer: z27.string().max(2e4).optional(), machineId: z27.string().optional() })).max(50)
|
|
2194
|
-
});
|
|
2195
|
-
var RouteResultSchema = z27.object({
|
|
2196
|
-
/** Null means an answer or a clarification, never an implicit local destination. */
|
|
2197
|
-
machineId: z27.string().nullable(),
|
|
2198
|
-
text: z27.string().min(1).max(2e4),
|
|
2199
|
-
choices: z27.array(z27.string()).max(20).optional()
|
|
2200
|
-
});
|
|
2201
|
-
|
|
2202
2255
|
// ../../packages/protocol/src/thread.ts
|
|
2203
|
-
import { z as
|
|
2204
|
-
var ToolStatusSchema =
|
|
2205
|
-
var FileChangeSchema =
|
|
2206
|
-
var base = { id:
|
|
2207
|
-
var ThreadItemSchema =
|
|
2208
|
-
|
|
2209
|
-
|
|
2256
|
+
import { z as z27 } from "zod";
|
|
2257
|
+
var ToolStatusSchema = z27.enum(["running", "success", "failed", "unknown"]);
|
|
2258
|
+
var FileChangeSchema = z27.object({ path: z27.string().min(1), from: z27.string().min(1).optional(), change: z27.enum(["add", "edit", "delete", "write"]), diff: z27.string().optional() });
|
|
2259
|
+
var base = { id: z27.string().min(1), at: z27.string().datetime(), turn: z27.number().int().nonnegative(), helperId: z27.string().optional() };
|
|
2260
|
+
var ThreadItemSchema = z27.discriminatedUnion("kind", [
|
|
2261
|
+
z27.object({ kind: z27.literal("prompt"), ...base, text: z27.string(), images: z27.array(AttachmentRefSchema).optional() }),
|
|
2262
|
+
z27.object({ kind: z27.literal("message"), ...base, text: z27.string() }),
|
|
2210
2263
|
/** `id` is the harness's tool_use_id when it gives one, so the result updates the same row; `byClose`: a question
|
|
2211
2264
|
* dismissed by Ledge closing the session. */
|
|
2212
|
-
|
|
2213
|
-
kind:
|
|
2265
|
+
z27.object({
|
|
2266
|
+
kind: z27.literal("tool"),
|
|
2214
2267
|
...base,
|
|
2215
|
-
tool:
|
|
2216
|
-
label:
|
|
2217
|
-
input:
|
|
2218
|
-
output:
|
|
2219
|
-
error:
|
|
2268
|
+
tool: z27.string(),
|
|
2269
|
+
label: z27.string(),
|
|
2270
|
+
input: z27.string().optional(),
|
|
2271
|
+
output: z27.string().optional(),
|
|
2272
|
+
error: z27.string().optional(),
|
|
2220
2273
|
status: ToolStatusSchema,
|
|
2221
|
-
durationMs:
|
|
2222
|
-
files:
|
|
2223
|
-
byClose:
|
|
2274
|
+
durationMs: z27.number().nonnegative().optional(),
|
|
2275
|
+
files: z27.array(FileChangeSchema).default([]),
|
|
2276
|
+
byClose: z27.literal(true).optional(),
|
|
2224
2277
|
/** Images the tool returned (a browser screenshot), in order; `imagesDropped`: some were not kept. */
|
|
2225
|
-
images:
|
|
2226
|
-
imagesDropped:
|
|
2278
|
+
images: z27.array(AttachmentRefSchema).max(ATTACHMENTS_MAX).optional(),
|
|
2279
|
+
imagesDropped: z27.literal(true).optional()
|
|
2227
2280
|
}),
|
|
2228
2281
|
/** `unknown`: answered in the terminal, the daemon only saw the prompt go away; `always`: allowed and not asked again;
|
|
2229
2282
|
* `byClose`: denied by Ledge closing the session; `by`: who answered it from Ledge (the PC or a device, its name then). */
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2283
|
+
z27.object({ kind: z27.literal("permission"), ...base, tool: z27.string(), text: z27.string(), decision: z27.enum(["accept", "deny", "always", "unknown"]).optional(), byClose: z27.literal(true).optional(), by: DecidedBySchema.optional() }),
|
|
2284
|
+
z27.object({ kind: z27.literal("reply"), ...base, text: z27.string() }),
|
|
2285
|
+
z27.object({ kind: z27.literal("helper"), ...base, task: z27.string(), agentType: z27.string().optional(), state: z27.enum(["working", "exited"]) }),
|
|
2233
2286
|
/** 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. */
|
|
2234
|
-
|
|
2235
|
-
kind:
|
|
2287
|
+
z27.object({
|
|
2288
|
+
kind: z27.literal("sent"),
|
|
2236
2289
|
...base,
|
|
2237
|
-
to:
|
|
2238
|
-
peer:
|
|
2239
|
-
summary:
|
|
2240
|
-
text:
|
|
2241
|
-
status:
|
|
2242
|
-
received:
|
|
2243
|
-
via:
|
|
2290
|
+
to: z27.string(),
|
|
2291
|
+
peer: z27.string().optional(),
|
|
2292
|
+
summary: z27.string().optional(),
|
|
2293
|
+
text: z27.string(),
|
|
2294
|
+
status: z27.enum(["sending", "delivered", "read", "failed"]),
|
|
2295
|
+
received: z27.string().optional(),
|
|
2296
|
+
via: z27.literal("ledge").optional(),
|
|
2244
2297
|
/** The seat's own `rig send` (its Bash call), docs/mockups/ledge-openrig-messages.html: `rig.command` is what it ran. */
|
|
2245
2298
|
rig: RigInfoSchema.optional()
|
|
2246
2299
|
}),
|
|
2247
2300
|
/** 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. */
|
|
2248
|
-
|
|
2249
|
-
kind:
|
|
2301
|
+
z27.object({
|
|
2302
|
+
kind: z27.literal("received"),
|
|
2250
2303
|
...base,
|
|
2251
|
-
from:
|
|
2252
|
-
peer:
|
|
2253
|
-
text:
|
|
2254
|
-
sent:
|
|
2304
|
+
from: z27.string(),
|
|
2305
|
+
peer: z27.string().optional(),
|
|
2306
|
+
text: z27.string(),
|
|
2307
|
+
sent: z27.string().optional(),
|
|
2255
2308
|
/** An OpenRig `rig send` typed into this seat (`rig.kind` `message`): `from` is the envelope's sender, `text` its body. */
|
|
2256
2309
|
rig: RigInfoSchema.optional()
|
|
2257
2310
|
}),
|
|
2258
2311
|
/** An automated notice of the agent's harness about messages between sessions (Claude Code's `[Cross-session idle
|
|
2259
2312
|
* notice]` / `[Cross-session delivery notice]`): a system event, never the user's words. `name` is the session it is
|
|
2260
2313
|
* about as quoted, `peer` its Ledge session id; a delivery notice says the outcome of `count` messages to `recipients`. */
|
|
2261
|
-
|
|
2262
|
-
kind:
|
|
2314
|
+
z27.object({
|
|
2315
|
+
kind: z27.literal("notice"),
|
|
2263
2316
|
...base,
|
|
2264
|
-
notice:
|
|
2317
|
+
notice: z27.enum(["idle", "exited", "unavailable", "expired", "delivery", "other"]),
|
|
2265
2318
|
/** 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. */
|
|
2266
|
-
task:
|
|
2319
|
+
task: z27.string().optional(),
|
|
2267
2320
|
/** A task this session handed over (`outgoing`), and how (issue #92). */
|
|
2268
|
-
taskOp:
|
|
2269
|
-
outgoing:
|
|
2270
|
-
name:
|
|
2271
|
-
peer:
|
|
2272
|
-
time:
|
|
2273
|
-
summary:
|
|
2274
|
-
status:
|
|
2275
|
-
count:
|
|
2276
|
-
recipients:
|
|
2277
|
-
reason:
|
|
2278
|
-
text:
|
|
2321
|
+
taskOp: z27.enum(TRANSMISSION_OPS).optional(),
|
|
2322
|
+
outgoing: z27.literal(true).optional(),
|
|
2323
|
+
name: z27.string().optional(),
|
|
2324
|
+
peer: z27.string().optional(),
|
|
2325
|
+
time: z27.string().optional(),
|
|
2326
|
+
summary: z27.string().optional(),
|
|
2327
|
+
status: z27.enum(["held", "denied", "expired", "delivered", "refused", "dropped", "unknown"]).optional(),
|
|
2328
|
+
count: z27.number().int().positive().optional(),
|
|
2329
|
+
recipients: z27.array(z27.string()).optional(),
|
|
2330
|
+
reason: z27.string().optional(),
|
|
2331
|
+
text: z27.string(),
|
|
2279
2332
|
/** An OpenRig block that is not a message: a row handed to this seat or passed by it (`handoff`, `outgoing` for its own),
|
|
2280
2333
|
* a row unblocked, OpenRig's own notice, or an unreadable block; `text` is the body (unreadable: the block as is). */
|
|
2281
2334
|
rig: RigInfoSchema.optional()
|
|
@@ -2283,11 +2336,11 @@ var ThreadItemSchema = z28.discriminatedUnion("kind", [
|
|
|
2283
2336
|
]);
|
|
2284
2337
|
|
|
2285
2338
|
// ../../packages/protocol/src/mobile.ts
|
|
2286
|
-
import { z as
|
|
2287
|
-
var RelayUrlSchema =
|
|
2339
|
+
import { z as z28 } from "zod";
|
|
2340
|
+
var RelayUrlSchema = z28.string().transform((v, ctx) => {
|
|
2288
2341
|
const bad = () => {
|
|
2289
|
-
ctx.addIssue({ code:
|
|
2290
|
-
return
|
|
2342
|
+
ctx.addIssue({ code: z28.ZodIssueCode.custom, message: "invalid relay URL" });
|
|
2343
|
+
return z28.NEVER;
|
|
2291
2344
|
};
|
|
2292
2345
|
let u;
|
|
2293
2346
|
try {
|
|
@@ -2300,168 +2353,168 @@ var RelayUrlSchema = z29.string().transform((v, ctx) => {
|
|
|
2300
2353
|
if (u.username || u.password || u.pathname !== "/" || u.search || u.hash) return bad();
|
|
2301
2354
|
return u.origin;
|
|
2302
2355
|
});
|
|
2303
|
-
var MobileConfigSchema =
|
|
2304
|
-
var MobileLinkStateSchema =
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2356
|
+
var MobileConfigSchema = z28.object({ enabled: z28.boolean(), relayUrl: RelayUrlSchema, terminalInput: z28.boolean().optional() });
|
|
2357
|
+
var MobileLinkStateSchema = z28.discriminatedUnion("state", [
|
|
2358
|
+
z28.object({ state: z28.literal("off") }),
|
|
2359
|
+
z28.object({ state: z28.literal("connecting") }),
|
|
2360
|
+
z28.object({ state: z28.literal("online") }),
|
|
2361
|
+
z28.object({ state: z28.literal("offline"), retryAt: z28.string().datetime(), error: z28.string() }),
|
|
2362
|
+
z28.object({ state: z28.literal("signed_out"), reason: z28.enum(["other_pc", "session_invalid"]) }),
|
|
2310
2363
|
/** The mobile service did not start (a broken mobile.json, a missing key store): nothing is linked until the daemon restarts. */
|
|
2311
|
-
|
|
2364
|
+
z28.object({ state: z28.literal("unavailable"), error: z28.string().max(200) })
|
|
2312
2365
|
]);
|
|
2313
|
-
var DeviceKindSchema =
|
|
2366
|
+
var DeviceKindSchema = z28.enum(["phone", "tablet"]);
|
|
2314
2367
|
var DEVICE_NAME_MAX = 40;
|
|
2315
|
-
var DeviceNameSchema =
|
|
2316
|
-
var MobilePairingSchema =
|
|
2317
|
-
id:
|
|
2318
|
-
label:
|
|
2319
|
-
code:
|
|
2320
|
-
expiresAt:
|
|
2321
|
-
state:
|
|
2322
|
-
});
|
|
2323
|
-
var RecoveredSchema =
|
|
2324
|
-
var MobileStateSchema =
|
|
2325
|
-
enabled:
|
|
2326
|
-
relayUrl:
|
|
2327
|
-
account:
|
|
2328
|
-
signin:
|
|
2368
|
+
var DeviceNameSchema = z28.string().trim().min(1).max(DEVICE_NAME_MAX).regex(/^[^\u0000-\u001f\u007f]+$/);
|
|
2369
|
+
var MobilePairingSchema = z28.object({
|
|
2370
|
+
id: z28.string(),
|
|
2371
|
+
label: z28.string(),
|
|
2372
|
+
code: z28.string().nullable(),
|
|
2373
|
+
expiresAt: z28.string().datetime(),
|
|
2374
|
+
state: z28.enum(["waiting", "confirm", "approved", "linked", "expired", "refused"])
|
|
2375
|
+
});
|
|
2376
|
+
var RecoveredSchema = z28.object({ at: z28.string().datetime(), model: z28.string().max(40).optional(), pending: z28.literal(true).optional() });
|
|
2377
|
+
var MobileStateSchema = z28.object({
|
|
2378
|
+
enabled: z28.boolean(),
|
|
2379
|
+
relayUrl: z28.string(),
|
|
2380
|
+
account: z28.object({ login: z28.string(), accountId: z28.string() }).nullable(),
|
|
2381
|
+
signin: z28.object({ userCode: z28.string(), verificationUri: z28.string(), expiresAt: z28.string().datetime() }).nullable(),
|
|
2329
2382
|
/** The last sign-in that did not end with a session; cleared by the next one. */
|
|
2330
|
-
signinError:
|
|
2383
|
+
signinError: z28.enum(["expired", "denied", "not_allowed", "failed"]).nullable(),
|
|
2331
2384
|
link: MobileLinkStateSchema,
|
|
2332
|
-
devices:
|
|
2333
|
-
id:
|
|
2334
|
-
label:
|
|
2335
|
-
approvedAt:
|
|
2336
|
-
online:
|
|
2337
|
-
lastSeenAt:
|
|
2385
|
+
devices: z28.array(z28.object({
|
|
2386
|
+
id: z28.string(),
|
|
2387
|
+
label: z28.string(),
|
|
2388
|
+
approvedAt: z28.string(),
|
|
2389
|
+
online: z28.boolean(),
|
|
2390
|
+
lastSeenAt: z28.string().optional(),
|
|
2338
2391
|
/** Absent from an older daemon; `name` absent: the user gave none, the front derives one from the label. */
|
|
2339
2392
|
kind: DeviceKindSchema.optional(),
|
|
2340
|
-
name:
|
|
2393
|
+
name: z28.string().optional(),
|
|
2341
2394
|
/** Its passkey can bring it back after a reinstall (registered with the PC key's digest, docs/mobile-passkey-recover-contract.md). */
|
|
2342
|
-
recover:
|
|
2395
|
+
recover: z28.literal(true).optional(),
|
|
2343
2396
|
/** It came back with its passkey: when, on what it says it runs (`iPhone`, `iPad`), and `pending` until « C'était bien moi »
|
|
2344
2397
|
* (`mobile.device.ack` `recovered`). Kept after that, for the « reconnecté avec sa passkey le … » line. */
|
|
2345
2398
|
recovered: RecoveredSchema.optional(),
|
|
2346
2399
|
/** Another device tried to take its place with its passkey while it was connected; until « Compris » (`mobile.device.ack` `refused`). */
|
|
2347
|
-
refused:
|
|
2400
|
+
refused: z28.object({ at: z28.string().datetime(), model: z28.string().optional() }).optional()
|
|
2348
2401
|
})),
|
|
2349
|
-
pairings:
|
|
2402
|
+
pairings: z28.array(MobilePairingSchema),
|
|
2350
2403
|
/** « Taper dans les terminaux depuis le téléphone »: absent from an older daemon, which has no phone terminal. */
|
|
2351
|
-
terminalInput:
|
|
2404
|
+
terminalInput: z28.boolean().optional(),
|
|
2352
2405
|
/** Passkey recovery on the account: `blocked` after 3 failed verifications, until « Débloquer » (`mobile.recovery.unblock`). */
|
|
2353
|
-
recovery:
|
|
2406
|
+
recovery: z28.object({ blocked: z28.object({ since: z28.string().datetime(), failures: z28.number().int().min(0) }).optional() }).optional()
|
|
2354
2407
|
});
|
|
2355
|
-
var MobileRecoveryEventSchema =
|
|
2356
|
-
event:
|
|
2357
|
-
id:
|
|
2358
|
-
at:
|
|
2408
|
+
var MobileRecoveryEventSchema = z28.object({
|
|
2409
|
+
event: z28.enum(["recovered", "refused", "blocked"]),
|
|
2410
|
+
id: z28.string().optional(),
|
|
2411
|
+
at: z28.string().datetime()
|
|
2359
2412
|
});
|
|
2360
2413
|
|
|
2361
2414
|
// ../../packages/protocol/src/brain.ts
|
|
2362
|
-
import { z as
|
|
2363
|
-
var NoteInfoSchema =
|
|
2364
|
-
name:
|
|
2365
|
-
file:
|
|
2366
|
-
title:
|
|
2367
|
-
when:
|
|
2368
|
-
firstLine:
|
|
2369
|
-
scope:
|
|
2370
|
-
projects:
|
|
2371
|
-
modifiedAt:
|
|
2372
|
-
checkedAt:
|
|
2415
|
+
import { z as z29 } from "zod";
|
|
2416
|
+
var NoteInfoSchema = z29.object({
|
|
2417
|
+
name: z29.string(),
|
|
2418
|
+
file: z29.string(),
|
|
2419
|
+
title: z29.string(),
|
|
2420
|
+
when: z29.string().optional(),
|
|
2421
|
+
firstLine: z29.string(),
|
|
2422
|
+
scope: z29.enum(["all", "chat", "sessions"]),
|
|
2423
|
+
projects: z29.array(z29.string()),
|
|
2424
|
+
modifiedAt: z29.string(),
|
|
2425
|
+
checkedAt: z29.string().optional(),
|
|
2373
2426
|
/** Days since it was last checked or changed, past the threshold (spec §3.7). */
|
|
2374
|
-
oldDays:
|
|
2375
|
-
flag:
|
|
2427
|
+
oldDays: z29.number().int().optional(),
|
|
2428
|
+
flag: z29.object({ what: z29.string(), by: z29.string(), at: z29.string() }).optional(),
|
|
2376
2429
|
/** Lines under « ## Ajouts ». */
|
|
2377
|
-
additions:
|
|
2378
|
-
truncated:
|
|
2379
|
-
});
|
|
2380
|
-
var BrainAnswerSchema =
|
|
2381
|
-
var BrainListSchema =
|
|
2382
|
-
var BrainNoteSchema =
|
|
2383
|
-
var BrainAddSchema =
|
|
2384
|
-
type:
|
|
2385
|
-
rid:
|
|
2430
|
+
additions: z29.number().int(),
|
|
2431
|
+
truncated: z29.boolean()
|
|
2432
|
+
});
|
|
2433
|
+
var BrainAnswerSchema = z29.object({ type: z29.literal("brain.answer"), rid: z29.string().min(1).max(100), task: z29.string().min(1).max(40), choice: BrainChoiceSchema });
|
|
2434
|
+
var BrainListSchema = z29.object({ type: z29.literal("brain.list"), rid: z29.string().min(1).max(100) });
|
|
2435
|
+
var BrainNoteSchema = z29.object({ type: z29.literal("brain.note"), rid: z29.string().min(1).max(100), note: NoteNameSchema, op: z29.enum(["checked", "unflag"]) });
|
|
2436
|
+
var BrainAddSchema = z29.object({
|
|
2437
|
+
type: z29.literal("brain.add"),
|
|
2438
|
+
rid: z29.string().min(1).max(100),
|
|
2386
2439
|
note: NoteNameSchema,
|
|
2387
|
-
fact:
|
|
2388
|
-
source:
|
|
2440
|
+
fact: z29.string().trim().min(1).max(BRAIN_FACT_MAX),
|
|
2441
|
+
source: z29.string().trim().min(1).max(BRAIN_SOURCE_MAX).optional()
|
|
2389
2442
|
});
|
|
2390
|
-
var BrainResultSchema =
|
|
2391
|
-
type:
|
|
2392
|
-
rid:
|
|
2393
|
-
reason:
|
|
2443
|
+
var BrainResultSchema = z29.object({
|
|
2444
|
+
type: z29.literal("brain.result"),
|
|
2445
|
+
rid: z29.string(),
|
|
2446
|
+
reason: z29.string().optional(),
|
|
2394
2447
|
/** What came of an answer (the text its proposer is told). */
|
|
2395
|
-
result:
|
|
2396
|
-
dir:
|
|
2397
|
-
notes:
|
|
2448
|
+
result: z29.string().optional(),
|
|
2449
|
+
dir: z29.string().optional(),
|
|
2450
|
+
notes: z29.array(NoteInfoSchema).optional()
|
|
2398
2451
|
});
|
|
2399
2452
|
|
|
2400
2453
|
// ../../packages/protocol/src/usage.ts
|
|
2401
|
-
import { z as
|
|
2402
|
-
var UsageHarnessSchema =
|
|
2454
|
+
import { z as z30 } from "zod";
|
|
2455
|
+
var UsageHarnessSchema = z30.enum(["claude", "codex", "cursor"]);
|
|
2403
2456
|
var USAGE_WINDOW_KINDS = ["five_hour", "seven_day", "model", "month", "pool"];
|
|
2404
2457
|
var POOLS = ["cursor", "other"];
|
|
2405
2458
|
var poolMatchesKind = (w) => w.kind === "pool" === (w.pool !== void 0) && (w.pool === void 0 || POOLS.includes(w.pool));
|
|
2406
|
-
var UsageWindowSchema =
|
|
2407
|
-
kind:
|
|
2408
|
-
model:
|
|
2459
|
+
var UsageWindowSchema = z30.object({
|
|
2460
|
+
kind: z30.enum(USAGE_WINDOW_KINDS),
|
|
2461
|
+
model: z30.string().min(1).max(80).optional(),
|
|
2409
2462
|
/** A pool of the included usage (`kind: 'pool'`): Cursor's own models (`cursor`) or the others at API prices (`other`). */
|
|
2410
|
-
pool:
|
|
2463
|
+
pool: z30.enum(POOLS).optional(),
|
|
2411
2464
|
/** How much of it is used, in percent (rounded); 100 or more: reached. */
|
|
2412
|
-
pct:
|
|
2465
|
+
pct: z30.number().int().min(0).max(1e3),
|
|
2413
2466
|
/** When it starts again from zero; null when the harness does not say. */
|
|
2414
|
-
resetsAt:
|
|
2467
|
+
resetsAt: z30.string().datetime().nullable()
|
|
2415
2468
|
}).refine(poolMatchesKind, { message: "a pool window names its pool, and only a pool window does", path: ["pool"] });
|
|
2416
|
-
var UsageStatusSchema =
|
|
2469
|
+
var UsageStatusSchema = z30.enum(["ok", "loading", "stale", "unreachable", "expired"]);
|
|
2417
2470
|
var USAGE_ALERT_MIN = 0.5;
|
|
2418
2471
|
var USAGE_ALERT_MAX = 0.95;
|
|
2419
|
-
var UsagePrefsSchema =
|
|
2420
|
-
var HarnessUsageSchema =
|
|
2472
|
+
var UsagePrefsSchema = z30.object({ alert: z30.number().min(USAGE_ALERT_MIN).max(USAGE_ALERT_MAX) });
|
|
2473
|
+
var HarnessUsageSchema = z30.object({
|
|
2421
2474
|
harness: UsageHarnessSchema,
|
|
2422
|
-
account:
|
|
2475
|
+
account: z30.string().regex(/^[0-9a-f]{12}$/).nullable(),
|
|
2423
2476
|
status: UsageStatusSchema,
|
|
2424
2477
|
/** The last read that succeeded; null when none did. */
|
|
2425
|
-
readAt:
|
|
2478
|
+
readAt: z30.string().datetime().nullable(),
|
|
2426
2479
|
/** The 5 hours and the week first, then one window per model. Empty while loading, expired, or read more than an hour ago. */
|
|
2427
|
-
windows:
|
|
2480
|
+
windows: z30.array(UsageWindowSchema).max(20),
|
|
2428
2481
|
/**
|
|
2429
2482
|
* Why the account cannot be read now (#301), absent when it can. `local_expired`: the token on this machine is past its time, which
|
|
2430
2483
|
* the harness renews itself at its next use (Claude Code's access token is short): still signed in, so the last values are kept
|
|
2431
2484
|
* as `stale` while under an hour old, then the harness is no longer listed. `refused`: the provider refused the token (401):
|
|
2432
2485
|
* status `expired`, no window. A refusal wins over a local expiry.
|
|
2433
2486
|
*/
|
|
2434
|
-
cause:
|
|
2487
|
+
cause: z30.enum(["local_expired", "refused"]).optional()
|
|
2435
2488
|
});
|
|
2436
|
-
var UsageAlertSchema =
|
|
2437
|
-
id:
|
|
2489
|
+
var UsageAlertSchema = z30.object({
|
|
2490
|
+
id: z30.string().min(1).max(200),
|
|
2438
2491
|
harness: UsageHarnessSchema,
|
|
2439
|
-
account:
|
|
2492
|
+
account: z30.string().regex(/^[0-9a-f]{12}$/).nullable(),
|
|
2440
2493
|
window: UsageWindowSchema,
|
|
2441
|
-
level:
|
|
2442
|
-
at:
|
|
2494
|
+
level: z30.enum(["threshold", "full"]),
|
|
2495
|
+
at: z30.string().datetime()
|
|
2443
2496
|
});
|
|
2444
2497
|
var isRecord = (v) => typeof v === "object" && v !== null;
|
|
2445
2498
|
var knownHarness = (h) => UsageHarnessSchema.safeParse(h).success;
|
|
2446
2499
|
var knownKind = (k) => USAGE_WINDOW_KINDS.includes(k);
|
|
2447
2500
|
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;
|
|
2448
2501
|
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;
|
|
2449
|
-
var UsageStateMessageSchema =
|
|
2450
|
-
type:
|
|
2451
|
-
machineId:
|
|
2452
|
-
harnesses:
|
|
2453
|
-
alerts:
|
|
2502
|
+
var UsageStateMessageSchema = z30.object({
|
|
2503
|
+
type: z30.literal("usage.state"),
|
|
2504
|
+
machineId: z30.string().optional(),
|
|
2505
|
+
harnesses: z30.preprocess(dropUnknownHarnesses, z30.array(HarnessUsageSchema).max(4)),
|
|
2506
|
+
alerts: z30.preprocess(dropUnknownAlerts, z30.array(UsageAlertSchema).max(40)),
|
|
2454
2507
|
prefs: UsagePrefsSchema
|
|
2455
2508
|
});
|
|
2456
|
-
var UsageSetSchema =
|
|
2457
|
-
var UsageAckSchema =
|
|
2509
|
+
var UsageSetSchema = z30.object({ type: z30.literal("usage.set"), prefs: UsagePrefsSchema, machineId: z30.string().optional() });
|
|
2510
|
+
var UsageAckSchema = z30.object({ type: z30.literal("usage.ack"), id: z30.string().min(1).max(200), machineId: z30.string().optional() });
|
|
2458
2511
|
|
|
2459
2512
|
// ../../packages/protocol/src/forge.ts
|
|
2460
|
-
import { z as
|
|
2513
|
+
import { z as z32 } from "zod";
|
|
2461
2514
|
|
|
2462
2515
|
// ../../packages/protocol/src/refusal.ts
|
|
2463
|
-
import { z as
|
|
2464
|
-
var RefusalCodeSchema =
|
|
2516
|
+
import { z as z31 } from "zod";
|
|
2517
|
+
var RefusalCodeSchema = z31.enum([
|
|
2465
2518
|
"stale",
|
|
2466
2519
|
"read_only",
|
|
2467
2520
|
"no_prompt",
|
|
@@ -2485,265 +2538,266 @@ var RefusalCodeSchema = z32.enum([
|
|
|
2485
2538
|
|
|
2486
2539
|
// ../../packages/protocol/src/forge.ts
|
|
2487
2540
|
var FORGE_KINDS = ["github", "gitlab"];
|
|
2488
|
-
var ForgeKindSchema =
|
|
2541
|
+
var ForgeKindSchema = z32.enum(FORGE_KINDS);
|
|
2489
2542
|
var PIPE_STATUSES = ["ok", "run", "fail", "wait", "skip", "none"];
|
|
2490
|
-
var PipeStatusSchema =
|
|
2543
|
+
var PipeStatusSchema = z32.enum(PIPE_STATUSES);
|
|
2491
2544
|
var PR_STATES = ["draft", "open", "review", "merged", "closed"];
|
|
2492
|
-
var PrStateSchema =
|
|
2545
|
+
var PrStateSchema = z32.enum(PR_STATES);
|
|
2493
2546
|
var PR_ROLES = ["author", "assignee", "reviewer"];
|
|
2494
|
-
var PrRoleSchema =
|
|
2547
|
+
var PrRoleSchema = z32.enum(PR_ROLES);
|
|
2495
2548
|
var dropUnknownRoles = (raw) => Array.isArray(raw) ? raw.filter((r) => known(PR_ROLES, r)) : raw;
|
|
2496
2549
|
var FORGE_BODY_MAX = 65536;
|
|
2497
|
-
var PullRequestSchema =
|
|
2550
|
+
var PullRequestSchema = z32.object({
|
|
2498
2551
|
/** `${host}/${repo}#${number}`, stable. */
|
|
2499
|
-
id:
|
|
2552
|
+
id: z32.string().min(1),
|
|
2500
2553
|
forge: ForgeKindSchema,
|
|
2501
|
-
host:
|
|
2554
|
+
host: z32.string().min(1),
|
|
2502
2555
|
/** The repository's path: `owner/name`, or `group/sub/project`. */
|
|
2503
|
-
repo:
|
|
2504
|
-
number:
|
|
2556
|
+
repo: z32.string().min(1),
|
|
2557
|
+
number: z32.number().int().positive(),
|
|
2505
2558
|
/** As the forge shows it: `#226` (GitHub) or `!41` (GitLab). */
|
|
2506
|
-
ref:
|
|
2559
|
+
ref: z32.string(),
|
|
2507
2560
|
/** « Ouvrir sur GitHub / GitLab »: the front opens it itself (R11). */
|
|
2508
|
-
url:
|
|
2509
|
-
title:
|
|
2561
|
+
url: z32.string().url(),
|
|
2562
|
+
title: z32.string(),
|
|
2510
2563
|
state: PrStateSchema,
|
|
2511
2564
|
/** The source branch, and the branch it goes into. */
|
|
2512
|
-
branch:
|
|
2513
|
-
target:
|
|
2514
|
-
headSha:
|
|
2565
|
+
branch: z32.string(),
|
|
2566
|
+
target: z32.string(),
|
|
2567
|
+
headSha: z32.string(),
|
|
2515
2568
|
pipeline: PipeStatusSchema,
|
|
2516
2569
|
/** `required` when the forge gives it (GitLab); GitHub leaves it out. */
|
|
2517
|
-
approvals:
|
|
2570
|
+
approvals: z32.object({ given: z32.number().int().min(0), required: z32.number().int().min(0).optional() }),
|
|
2518
2571
|
/** The mockup's `ok`: all that a merge needs (R5), the pipeline set apart. */
|
|
2519
|
-
mergeable:
|
|
2572
|
+
mergeable: z32.boolean(),
|
|
2520
2573
|
/** Threads that can be resolved and are not. */
|
|
2521
|
-
openThreads:
|
|
2522
|
-
updatedAt:
|
|
2574
|
+
openThreads: z32.number().int().min(0),
|
|
2575
|
+
updatedAt: z32.string().datetime(),
|
|
2523
2576
|
/** The daemon's sessions on that branch, most recently active first (R12); the fleet qualifies them `machine:id`. */
|
|
2524
|
-
sessions:
|
|
2577
|
+
sessions: z32.array(z32.string()),
|
|
2525
2578
|
/**
|
|
2526
2579
|
* The account's roles on the request (issue #3), in the order author, assignee, reviewer; absent when it has none, and from a daemon
|
|
2527
2580
|
* older than this field.
|
|
2528
2581
|
*/
|
|
2529
|
-
roles:
|
|
2582
|
+
roles: z32.preprocess(dropUnknownRoles, z32.array(PrRoleSchema)).optional()
|
|
2530
2583
|
});
|
|
2531
|
-
var FollowedSessionSchema =
|
|
2532
|
-
var ForgeStatusSchema =
|
|
2584
|
+
var FollowedSessionSchema = z32.object({ session: z32.string(), forge: ForgeKindSchema, host: z32.string(), repo: z32.string() });
|
|
2585
|
+
var ForgeStatusSchema = z32.object({
|
|
2533
2586
|
forge: ForgeKindSchema,
|
|
2534
|
-
host:
|
|
2535
|
-
status:
|
|
2536
|
-
message:
|
|
2537
|
-
at:
|
|
2587
|
+
host: z32.string(),
|
|
2588
|
+
status: z32.enum(["ok", "missing", "unauthenticated", "error"]),
|
|
2589
|
+
message: z32.string().optional(),
|
|
2590
|
+
at: z32.string().datetime(),
|
|
2538
2591
|
/** Not `ok`: since when the forge cannot be read, whatever its messages since (« le relevé échoue depuis 10:42 »). */
|
|
2539
|
-
since:
|
|
2592
|
+
since: z32.string().datetime().optional(),
|
|
2540
2593
|
/** After a failed read (`error` mostly): when the daemon reads it again, its backoff of 2 to 10 minutes (« Nouvel essai à 10:50 »). */
|
|
2541
|
-
retryAt:
|
|
2594
|
+
retryAt: z32.string().datetime().optional(),
|
|
2542
2595
|
/** Not `ok`: when its requests, still shown, were last read; absent when they never were. */
|
|
2543
|
-
readAt:
|
|
2596
|
+
readAt: z32.string().datetime().optional()
|
|
2544
2597
|
});
|
|
2545
2598
|
var isRecord2 = (v) => typeof v === "object" && v !== null;
|
|
2546
2599
|
var known = (list, v) => typeof v === "string" && list.includes(v);
|
|
2547
2600
|
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;
|
|
2548
2601
|
var dropUnknownForges = (raw) => Array.isArray(raw) ? raw.filter((f) => isRecord2(f) && known(FORGE_KINDS, f.forge)) : raw;
|
|
2549
|
-
var ForgeStateMessageSchema =
|
|
2550
|
-
type:
|
|
2551
|
-
prs:
|
|
2552
|
-
forges:
|
|
2602
|
+
var ForgeStateMessageSchema = z32.object({
|
|
2603
|
+
type: z32.literal("forge.state"),
|
|
2604
|
+
prs: z32.preprocess(dropUnknownPrs, z32.array(PullRequestSchema)),
|
|
2605
|
+
forges: z32.preprocess(dropUnknownForges, z32.array(ForgeStatusSchema)),
|
|
2553
2606
|
/** Absent from a daemon older than this field. */
|
|
2554
|
-
followed:
|
|
2607
|
+
followed: z32.preprocess(dropUnknownForges, z32.array(FollowedSessionSchema)).optional(),
|
|
2555
2608
|
/**
|
|
2556
2609
|
* The account's own requests no session follows (issue #3): `sessions` empty, `roles` set. A request is in `prs` or here, never in
|
|
2557
2610
|
* both; a followed one carries its `roles` in `prs`. Absent from a daemon older than this field.
|
|
2558
2611
|
*/
|
|
2559
|
-
mine:
|
|
2560
|
-
machineId:
|
|
2561
|
-
});
|
|
2562
|
-
var PrJobSchema =
|
|
2563
|
-
id:
|
|
2564
|
-
name:
|
|
2565
|
-
column:
|
|
2566
|
-
columnName:
|
|
2567
|
-
status:
|
|
2568
|
-
durationS:
|
|
2569
|
-
});
|
|
2570
|
-
var PrCommentSchema =
|
|
2571
|
-
var PrThreadSchema =
|
|
2572
|
-
id:
|
|
2573
|
-
resolvable:
|
|
2574
|
-
resolved:
|
|
2575
|
-
file:
|
|
2576
|
-
line:
|
|
2577
|
-
code:
|
|
2578
|
-
comments:
|
|
2579
|
-
});
|
|
2580
|
-
var PrFileSchema =
|
|
2581
|
-
var PrReviewerSchema =
|
|
2582
|
-
var PrCommitSchema =
|
|
2583
|
-
var PrDetailSchema =
|
|
2612
|
+
mine: z32.preprocess(dropUnknownPrs, z32.array(PullRequestSchema)).optional(),
|
|
2613
|
+
machineId: z32.string().optional()
|
|
2614
|
+
});
|
|
2615
|
+
var PrJobSchema = z32.object({
|
|
2616
|
+
id: z32.string(),
|
|
2617
|
+
name: z32.string(),
|
|
2618
|
+
column: z32.number().int().min(0),
|
|
2619
|
+
columnName: z32.string(),
|
|
2620
|
+
status: z32.preprocess((s) => known(PIPE_STATUSES, s) ? s : "none", PipeStatusSchema),
|
|
2621
|
+
durationS: z32.number().min(0).optional()
|
|
2622
|
+
});
|
|
2623
|
+
var PrCommentSchema = z32.object({ id: z32.string(), author: z32.string(), at: z32.string().datetime(), body: z32.string() });
|
|
2624
|
+
var PrThreadSchema = z32.object({
|
|
2625
|
+
id: z32.string(),
|
|
2626
|
+
resolvable: z32.boolean(),
|
|
2627
|
+
resolved: z32.boolean(),
|
|
2628
|
+
file: z32.string().optional(),
|
|
2629
|
+
line: z32.number().int().optional(),
|
|
2630
|
+
code: z32.string().optional(),
|
|
2631
|
+
comments: z32.array(PrCommentSchema).min(1)
|
|
2632
|
+
});
|
|
2633
|
+
var PrFileSchema = z32.object({ path: z32.string(), added: z32.number().int().min(0), removed: z32.number().int().min(0), patch: z32.string().optional() });
|
|
2634
|
+
var PrReviewerSchema = z32.object({ name: z32.string(), state: z32.enum(["approved", "changes", "pending"]) });
|
|
2635
|
+
var PrCommitSchema = z32.object({ sha: z32.string(), title: z32.string(), author: z32.string(), at: z32.string().datetime() });
|
|
2636
|
+
var PrDetailSchema = z32.object({
|
|
2584
2637
|
pr: PullRequestSchema,
|
|
2585
|
-
description:
|
|
2586
|
-
author:
|
|
2587
|
-
reviewers:
|
|
2588
|
-
labels:
|
|
2638
|
+
description: z32.string(),
|
|
2639
|
+
author: z32.string(),
|
|
2640
|
+
reviewers: z32.array(PrReviewerSchema),
|
|
2641
|
+
labels: z32.array(z32.string()),
|
|
2589
2642
|
/** The tickets it closes, as the forge shows them (`#38`). */
|
|
2590
|
-
issues:
|
|
2591
|
-
jobs:
|
|
2643
|
+
issues: z32.array(z32.string()),
|
|
2644
|
+
jobs: z32.array(PrJobSchema),
|
|
2592
2645
|
/** A job's log when asked (`forge.detail` with `log`): its last 60 lines, no ANSI, redacted. */
|
|
2593
|
-
log:
|
|
2594
|
-
threads:
|
|
2595
|
-
files:
|
|
2596
|
-
commits:
|
|
2646
|
+
log: z32.object({ jobId: z32.string(), text: z32.string() }).optional(),
|
|
2647
|
+
threads: z32.array(PrThreadSchema),
|
|
2648
|
+
files: z32.array(PrFileSchema),
|
|
2649
|
+
commits: z32.array(PrCommitSchema),
|
|
2597
2650
|
/** The exact command a merge runs, for the front's confirmation (R5). */
|
|
2598
|
-
mergeCommand:
|
|
2651
|
+
mergeCommand: z32.string(),
|
|
2599
2652
|
/**
|
|
2600
2653
|
* Why a merge is refused now, as codes; empty: it can be merged (R5). `not_open`, `draft`, `approvals`, `changes_requested`;
|
|
2601
2654
|
* `pipeline`: the pipeline is not green (`pr.pipeline` says how); `pipeline_not_started`: no pipeline yet on the head, in a
|
|
2602
2655
|
* repository with CI or whose CI is unknown (`pr.pipeline` reads `wait`). A repository without any CI gives `none` and no code.
|
|
2603
2656
|
* A front shows a code it does not know as is.
|
|
2604
2657
|
*/
|
|
2605
|
-
mergeBlockers:
|
|
2658
|
+
mergeBlockers: z32.array(z32.string())
|
|
2606
2659
|
});
|
|
2607
|
-
var ForgeActionSchema =
|
|
2608
|
-
|
|
2660
|
+
var ForgeActionSchema = z32.discriminatedUnion("kind", [
|
|
2661
|
+
z32.object({ kind: z32.literal("rerun") }),
|
|
2609
2662
|
/** `headSha`: the head the person saw; `stale` when it has moved. */
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2663
|
+
z32.object({ kind: z32.literal("merge"), headSha: z32.string().min(1).max(64) }),
|
|
2664
|
+
z32.object({ kind: z32.literal("comment"), body: z32.string().min(1).max(FORGE_BODY_MAX) }),
|
|
2665
|
+
z32.object({ kind: z32.literal("reply"), threadId: z32.string().min(1).max(200), body: z32.string().min(1).max(FORGE_BODY_MAX) }),
|
|
2666
|
+
z32.object({ kind: z32.literal("resolve"), threadId: z32.string().min(1).max(200) })
|
|
2614
2667
|
]);
|
|
2615
|
-
var ForgeDetailSchema =
|
|
2616
|
-
var ForgeActSchema =
|
|
2617
|
-
var ForgeDetailReplySchema =
|
|
2618
|
-
var ForgeActReplySchema =
|
|
2668
|
+
var ForgeDetailSchema = z32.object({ type: z32.literal("forge.detail"), requestId: z32.string().min(1).max(100), prId: z32.string().min(1).max(500), log: z32.string().min(1).max(40).optional(), machineId: z32.string().optional() });
|
|
2669
|
+
var ForgeActSchema = z32.object({ type: z32.literal("forge.act"), requestId: z32.string().min(1).max(100), prId: z32.string().min(1).max(500), machineId: z32.string().optional(), action: ForgeActionSchema });
|
|
2670
|
+
var ForgeDetailReplySchema = z32.object({ type: z32.literal("forge.detail.reply"), requestId: z32.string(), ok: z32.boolean(), detail: PrDetailSchema.optional(), message: z32.string().optional(), code: RefusalCodeSchema.optional() });
|
|
2671
|
+
var ForgeActReplySchema = z32.object({ type: z32.literal("forge.act.reply"), requestId: z32.string(), ok: z32.boolean(), command: z32.string().optional(), message: z32.string().optional(), code: RefusalCodeSchema.optional() });
|
|
2619
2672
|
var CLOSED_KEEP_DAYS = 7;
|
|
2620
2673
|
var CLOSED_KEEP_MS = CLOSED_KEEP_DAYS * 24 * 60 * 6e4;
|
|
2621
2674
|
var PR_ROLE_FILTERS = ["all", ...PR_ROLES];
|
|
2622
2675
|
|
|
2623
2676
|
// ../../packages/protocol/src/messages.ts
|
|
2624
|
-
var SessionEventSchema =
|
|
2625
|
-
name:
|
|
2626
|
-
at:
|
|
2627
|
-
source:
|
|
2628
|
-
tool:
|
|
2629
|
-
text:
|
|
2630
|
-
options:
|
|
2677
|
+
var SessionEventSchema = z33.object({
|
|
2678
|
+
name: z33.enum(["SessionStart", "UserPromptSubmit", "PreToolUse", "PermissionRequest", "Notification", "Stop", "SessionEnd", "PaneChanged", "PaneGone", "PanePrompt", "PaneIdle", "InjectFailed", "Decided", "PostToolUse", "PostToolUseFailure", "StopFailure", "SubagentStart", "SubagentStop", "PaneTitle", "Renamed", "NativeRequest", "AgentMessage", "QueueUpdate", "PaneUnreadable", "PaneReadable"]),
|
|
2679
|
+
at: z33.string().datetime(),
|
|
2680
|
+
source: z33.enum(["hook", "pane", "daemon"]),
|
|
2681
|
+
tool: z33.string().optional(),
|
|
2682
|
+
text: z33.string().optional(),
|
|
2683
|
+
options: z33.array(z33.string()).optional(),
|
|
2631
2684
|
/** Each option's description, by index ('' when it has none); left out when no option has one. */
|
|
2632
|
-
optionDetails:
|
|
2633
|
-
kind:
|
|
2685
|
+
optionDetails: z33.array(z33.string()).optional(),
|
|
2686
|
+
kind: z33.enum(["question", "permission", "plan", "diff"]).optional(),
|
|
2634
2687
|
/** PanePrompt: what to review in full before deciding (a plan read in the terminal), when `text` is its summary. */
|
|
2635
|
-
body:
|
|
2636
|
-
exitCode:
|
|
2637
|
-
helperId:
|
|
2688
|
+
body: z33.string().optional(),
|
|
2689
|
+
exitCode: z33.number().int().nullable().optional(),
|
|
2690
|
+
helperId: z33.string().optional(),
|
|
2638
2691
|
/** The helper's description, once known (Claude Code: its `.meta.json`, written after SubagentStart). */
|
|
2639
|
-
task:
|
|
2692
|
+
task: z33.string().optional(),
|
|
2640
2693
|
/** PostToolUseFailure: the user interrupted the turn (Esc); Claude then waits for input with no Stop. */
|
|
2641
|
-
interrupt:
|
|
2694
|
+
interrupt: z33.boolean().optional(),
|
|
2642
2695
|
/** UserPromptSubmit, PostToolUse: the images the prompt or the tool result carried, by attachment id. */
|
|
2643
|
-
attachments:
|
|
2696
|
+
attachments: z33.array(AttachmentIdSchema).max(ATTACHMENTS_MAX).optional(),
|
|
2644
2697
|
/** PostToolUse: some of the result's images were not kept. */
|
|
2645
|
-
imagesDropped:
|
|
2698
|
+
imagesDropped: z33.boolean().optional(),
|
|
2646
2699
|
/** QueueUpdate: OMP's queue as it stands. */
|
|
2647
|
-
queue:
|
|
2700
|
+
queue: z33.array(z33.object({ text: z33.string(), mode: z33.enum(["steer", "follow_up"]) })).optional(),
|
|
2648
2701
|
/** AgentMessage: the harness's own message, its text so far (`streaming`) or whole. `messageId` is unique for the session's life. */
|
|
2649
|
-
messageId:
|
|
2650
|
-
streaming:
|
|
2702
|
+
messageId: z33.string().optional(),
|
|
2703
|
+
streaming: z33.boolean().optional(),
|
|
2651
2704
|
/** NativeRequest: the dialog's id, and OMP's `ask` questions when it is one. */
|
|
2652
|
-
requestId:
|
|
2653
|
-
questions:
|
|
2705
|
+
requestId: z33.string().optional(),
|
|
2706
|
+
questions: z33.array(AskQuestionSchema).optional(),
|
|
2654
2707
|
/** Stop: its text is already in the thread as AgentMessage cards, which the reply card must not repeat. */
|
|
2655
|
-
streamed:
|
|
2708
|
+
streamed: z33.boolean().optional(),
|
|
2656
2709
|
/** Native tracking (spec 2026-10-13 §2): the harness's id of the tool call, so its result lands on the same row. */
|
|
2657
|
-
toolUseId:
|
|
2710
|
+
toolUseId: z33.string().optional(),
|
|
2658
2711
|
/** The tool's input as the harness gave it, every string capped by the hook. */
|
|
2659
|
-
toolInput:
|
|
2712
|
+
toolInput: z33.record(z33.string(), z33.unknown()).optional(),
|
|
2660
2713
|
/** PostToolUse: the id the harness gave a call it left running in the background (Claude Code's `backgroundTaskId`, issue #1). */
|
|
2661
|
-
backgroundTaskId:
|
|
2714
|
+
backgroundTaskId: z33.string().optional(),
|
|
2662
2715
|
/** PostToolUse: the result as text; SubagentStop: nothing (the report travels in `text`). */
|
|
2663
|
-
output:
|
|
2664
|
-
durationMs:
|
|
2716
|
+
output: z33.string().optional(),
|
|
2717
|
+
durationMs: z33.number().nonnegative().optional(),
|
|
2665
2718
|
/** PostToolUseFailure: the harness's error message. */
|
|
2666
|
-
error:
|
|
2719
|
+
error: z33.string().optional(),
|
|
2667
2720
|
/** The session's transcript, or the helper's on SubagentStop; the daemon reads its tail for the agent's messages. */
|
|
2668
|
-
transcriptPath:
|
|
2721
|
+
transcriptPath: z33.string().optional(),
|
|
2669
2722
|
/** Decided: what was chosen when the daemon knows it. */
|
|
2670
2723
|
decision: DecisionSchema.optional(),
|
|
2671
2724
|
/** Decided: the request was refused by Ledge closing the session (its interrupt keys), not by the user's answer. */
|
|
2672
|
-
byClose:
|
|
2725
|
+
byClose: z33.literal(true).optional(),
|
|
2673
2726
|
/** Decided: who answered, when the daemon typed it (absent: answered in the terminal, or an older daemon). */
|
|
2674
2727
|
by: DecidedBySchema.optional(),
|
|
2675
2728
|
/** The agent's own session id when the hook names it, so the daemon can resume that conversation. */
|
|
2676
|
-
agentSessionId:
|
|
2729
|
+
agentSessionId: z33.string().optional()
|
|
2677
2730
|
});
|
|
2678
|
-
var RecentSchema =
|
|
2731
|
+
var RecentSchema = z33.object({ cwd: z33.string().min(1), project: z33.string().min(1), lastAt: z33.string().datetime() });
|
|
2679
2732
|
var SEMVER = /^\d+\.\d+\.\d+$/;
|
|
2680
|
-
var PingSchema =
|
|
2681
|
-
var PongSchema =
|
|
2682
|
-
var DaemonInfoSchema =
|
|
2683
|
-
version:
|
|
2684
|
-
install:
|
|
2685
|
-
systemd:
|
|
2686
|
-
manual:
|
|
2687
|
-
|
|
2688
|
-
archive: z34.boolean().optional(),
|
|
2733
|
+
var PingSchema = z33.object({ type: z33.literal("ping"), requestId: z33.string().min(1).max(100), machineId: z33.string().optional() });
|
|
2734
|
+
var PongSchema = z33.object({ type: z33.literal("pong"), requestId: z33.string(), machineId: z33.string().optional(), error: z33.enum(["offline", "outdated"]).optional() });
|
|
2735
|
+
var DaemonInfoSchema = z33.object({
|
|
2736
|
+
version: z33.string(),
|
|
2737
|
+
install: z33.enum(["npm", "git", "unknown"]),
|
|
2738
|
+
systemd: z33.boolean(),
|
|
2739
|
+
manual: z33.string().optional(),
|
|
2740
|
+
archive: z33.boolean().optional(),
|
|
2689
2741
|
/** Takes `model` and `effort` on `session.launch` and answers `models.list` (#58). */
|
|
2690
|
-
models:
|
|
2742
|
+
models: z33.boolean().optional(),
|
|
2691
2743
|
/** Drives OMP over its RPC: launching `omp` sessions is possible when the binary is there (`models.list` says so). */
|
|
2692
|
-
omp:
|
|
2744
|
+
omp: z33.boolean().optional(),
|
|
2693
2745
|
/** Takes `session.model`: a live session's model and effort changed (#58, lot 2). */
|
|
2694
|
-
modelSwitch:
|
|
2746
|
+
modelSwitch: z33.boolean().optional(),
|
|
2695
2747
|
/** Answers `session.commands`: the slash commands a session's agent offers. */
|
|
2696
|
-
commands:
|
|
2748
|
+
commands: z33.boolean().optional(),
|
|
2697
2749
|
/** Takes `approval` on an OMP `session.launch` (auto mode). */
|
|
2698
|
-
ompApproval:
|
|
2750
|
+
ompApproval: z33.boolean().optional(),
|
|
2699
2751
|
/** Its home folder, so a client shows the folders under it as `~` (absent from older daemons). */
|
|
2700
|
-
home:
|
|
2701
|
-
mobile:
|
|
2752
|
+
home: z33.string().optional(),
|
|
2753
|
+
mobile: z33.boolean().optional(),
|
|
2702
2754
|
/** Answers `openrig.status` and `openrig.act`: drives OpenRig on its machine. */
|
|
2703
|
-
openrig:
|
|
2755
|
+
openrig: z33.boolean().optional(),
|
|
2704
2756
|
/** Answers `openrig.roles`, `openrig.role` and `openrig.roleFile`: reads OpenRig's roles (agent specs). */
|
|
2705
|
-
openrigRoles:
|
|
2757
|
+
openrigRoles: z33.boolean().optional(),
|
|
2706
2758
|
/** 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):
|
|
2707
2759
|
* a client (the fleet) sends none of them to a daemon without it. */
|
|
2708
|
-
openrigRig:
|
|
2760
|
+
openrigRig: z33.boolean().optional(),
|
|
2709
2761
|
/** Takes the action `rig.policy` (lot 7c): a client (the fleet) sends it only when this is set. */
|
|
2710
|
-
openrigPolicy:
|
|
2762
|
+
openrigPolicy: z33.boolean().optional(),
|
|
2711
2763
|
/** Takes `rig.start` with `fresh` (lot 7d): a client (the fleet) sends it only when this is set. */
|
|
2712
|
-
openrigFresh:
|
|
2764
|
+
openrigFresh: z33.boolean().optional(),
|
|
2713
2765
|
/** Answers `ping` with `pong`: a client measures the round trip to this machine (lot 7d). */
|
|
2714
|
-
ping:
|
|
2766
|
+
ping: z33.boolean().optional(),
|
|
2715
2767
|
/** Answers `openrig.row`: a queue row's state, for the OpenRig task cards of a thread. */
|
|
2716
|
-
openrigRows:
|
|
2768
|
+
openrigRows: z33.boolean().optional(),
|
|
2717
2769
|
/** Answers `openrig.asks` and `openrig.answer`: what OpenRig asks the person, and their answers (« À toi »). */
|
|
2718
|
-
openrigAsks:
|
|
2770
|
+
openrigAsks: z33.boolean().optional(),
|
|
2719
2771
|
/** Answers `openrig.goal.send`, `openrig.goals` and `openrig.goal.reply`: goals given to Max (lot 2). */
|
|
2720
|
-
openrigGoals:
|
|
2772
|
+
openrigGoals: z33.boolean().optional(),
|
|
2773
|
+
/** Answers `openrig.missions`: the operator's thread's « Missions » and « Échanges » cards (#54). */
|
|
2774
|
+
openrigMissions: z33.boolean().optional(),
|
|
2721
2775
|
/** Takes `session.broadcast` (its `ledge bridge` too, on this machine): a client sends it only when this is set. */
|
|
2722
|
-
broadcast:
|
|
2776
|
+
broadcast: z33.boolean().optional(),
|
|
2723
2777
|
/** Sends `browser.live` and answers `browser.watch`, `browser.unwatch` and `browser.enable`: the agent's browser, live. */
|
|
2724
|
-
browserLive:
|
|
2778
|
+
browserLive: z33.boolean().optional(),
|
|
2725
2779
|
/** Answers `term.watch` and `term.shell`: the pane and the shells as a tmux control stream, xterm.js the only emulator. */
|
|
2726
|
-
terminalStream:
|
|
2780
|
+
terminalStream: z33.boolean().optional(),
|
|
2727
2781
|
/** Sends `usage.state` (each harness's account limits, the alerts, the threshold) and takes `usage.set` and `usage.ack`. */
|
|
2728
|
-
usage:
|
|
2782
|
+
usage: z33.boolean().optional(),
|
|
2729
2783
|
/** `term.watch` also streams an OpenRig seat (`@` in its tmux name), through a control client on the seat's own tmux server.
|
|
2730
2784
|
* Without it, a front keeps a seat on the pseudo-terminal: an older daemon answers its watch `failed`. */
|
|
2731
|
-
terminalStreamSeats:
|
|
2785
|
+
terminalStreamSeats: z33.boolean().optional(),
|
|
2732
2786
|
/** Sends `forge.state` and answers `forge.detail` and `forge.act`: the pull and merge requests of its sessions' branches (lot 8a). */
|
|
2733
|
-
forge:
|
|
2787
|
+
forge: z33.boolean().optional(),
|
|
2734
2788
|
/** Answers `routine.list`, `routine.cmd` and `routine.preview`, and sends `routine.changed` (spec 2026-11-23 routines). */
|
|
2735
|
-
routines:
|
|
2789
|
+
routines: z33.boolean().optional(),
|
|
2736
2790
|
/** Answers a grouped `routine.cmd` (`others`) all or nothing: a client sends one only to a daemon that says it. */
|
|
2737
|
-
routineGroups:
|
|
2791
|
+
routineGroups: z33.boolean().optional(),
|
|
2738
2792
|
/** Takes `session.aside` (#41): a Claude Code session's `/btw`, answered as an aside, not a thread item. */
|
|
2739
|
-
aside:
|
|
2793
|
+
aside: z33.boolean().optional(),
|
|
2740
2794
|
/** Takes `session.label`: a session's nickname, kept with it. A client sends one only to a daemon that says it. */
|
|
2741
|
-
sessionLabel:
|
|
2795
|
+
sessionLabel: z33.boolean().optional(),
|
|
2742
2796
|
/** Its launcher answers `shell --nonce <N> <dir>` (#299): a free shell started through it gets the shell integration (OSC 633). */
|
|
2743
|
-
freeShell:
|
|
2797
|
+
freeShell: z33.boolean().optional()
|
|
2744
2798
|
});
|
|
2745
|
-
var UpdateFailureSchema =
|
|
2746
|
-
var ServerMessageSchema =
|
|
2799
|
+
var UpdateFailureSchema = z33.enum(["git-install", "no-systemd", "sessions-at-risk", "npm-failed", "busy"]);
|
|
2800
|
+
var ServerMessageSchema = z33.discriminatedUnion("type", [
|
|
2747
2801
|
BrowserLiveSchema,
|
|
2748
2802
|
BrowserFrameSchema,
|
|
2749
2803
|
BrowserEnabledSchema,
|
|
@@ -2752,7 +2806,6 @@ var ServerMessageSchema = z34.discriminatedUnion("type", [
|
|
|
2752
2806
|
TermSizeSchema,
|
|
2753
2807
|
TermExitSchema,
|
|
2754
2808
|
SessionModelAcceptedSchema,
|
|
2755
|
-
z34.object({ type: z34.literal("chat.routed"), qid: z34.string(), result: RouteResultSchema }),
|
|
2756
2809
|
DocumentContentSchema,
|
|
2757
2810
|
DocumentErrorSchema,
|
|
2758
2811
|
AttachmentStoredSchema,
|
|
@@ -2781,92 +2834,80 @@ var ServerMessageSchema = z34.discriminatedUnion("type", [
|
|
|
2781
2834
|
OpenRigAnsweredSchema,
|
|
2782
2835
|
OpenRigGoalSentSchema,
|
|
2783
2836
|
OpenRigGoalsChangedSchema,
|
|
2837
|
+
OpenRigMissionsChangedSchema,
|
|
2784
2838
|
OpenRigGoalRepliedSchema,
|
|
2785
2839
|
/** `recents`: the folders of past sessions, most recent first. `launcher`: the command that runs `ledge` inside WSL
|
|
2786
2840
|
* (`[node, cli]`), so the overlay can attach a terminal to a session with `<launcher> attach <id>`. `daemon`: absent
|
|
2787
2841
|
* from daemons older than the auto-update. */
|
|
2788
|
-
|
|
2789
|
-
|
|
2842
|
+
z33.object({ type: z33.literal("snapshot"), sessions: z33.array(SessionSchema), recents: z33.array(RecentSchema).optional(), launcher: z33.array(z33.string()).optional(), daemon: DaemonInfoSchema.optional(), sshAlias: SshAliasSchema.optional() }),
|
|
2843
|
+
z33.object({ type: z33.literal("session.updated"), session: SessionSchema }),
|
|
2790
2844
|
/** OMP: the instructions taken back from its queue by an interrupt that restores it; the asker puts them back in its draft. */
|
|
2791
|
-
|
|
2792
|
-
type:
|
|
2793
|
-
id:
|
|
2794
|
-
texts:
|
|
2845
|
+
z33.object({
|
|
2846
|
+
type: z33.literal("session.queue.restored"),
|
|
2847
|
+
id: z33.string(),
|
|
2848
|
+
texts: z33.array(z33.string()),
|
|
2795
2849
|
/** The same instructions with the images they carried; `imagesDropped`: some images could not be put back. */
|
|
2796
|
-
entries:
|
|
2797
|
-
imagesDropped:
|
|
2850
|
+
entries: z33.array(z33.object({ text: z33.string(), attachments: z33.array(AttachmentIdSchema).optional() })).optional(),
|
|
2851
|
+
imagesDropped: z33.boolean().optional()
|
|
2798
2852
|
}),
|
|
2799
|
-
|
|
2800
|
-
|
|
2853
|
+
z33.object({ type: z33.literal("session.removed"), id: z33.string() }),
|
|
2854
|
+
z33.object({ type: z33.literal("session.preview"), id: z33.string(), lines: z33.array(z33.string()) }),
|
|
2801
2855
|
/** A session's thread, on request (spec 2026-10-13 §5); then each created or updated item, broadcast. */
|
|
2802
|
-
|
|
2803
|
-
|
|
2856
|
+
z33.object({ type: z33.literal("session.thread"), id: z33.string(), items: z33.array(ThreadItemSchema) }),
|
|
2857
|
+
z33.object({ type: z33.literal("session.thread.item"), id: z33.string(), item: ThreadItemSchema }),
|
|
2804
2858
|
SessionAsideSchema,
|
|
2805
2859
|
/** Answer to the requester of a `session.launch`: the session exists (its `session.updated` is broadcast as usual). */
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
z34.object({ type: z34.literal("session.closed"), qid: z34.string(), row: z34.number().int().min(0), id: z34.string(), how: z34.enum(["exit", "killed"]) }),
|
|
2809
|
-
z34.object({ type: z34.literal("recents"), recents: z34.array(RecentSchema) }),
|
|
2860
|
+
z33.object({ type: z33.literal("session.launched"), id: z33.string() }),
|
|
2861
|
+
z33.object({ type: z33.literal("recents"), recents: z33.array(RecentSchema) }),
|
|
2810
2862
|
/** Answer to the requester of a `folder.list` or `folder.create`: `path` resolved (`~` expanded), `parent` null at the
|
|
2811
2863
|
* root, `entries` its subfolders by name (hidden ones left out). A failure keeps the asked path and says why in `error`,
|
|
2812
2864
|
* never in an `error` message, which the launch form reads as a failed launch. */
|
|
2813
|
-
|
|
2814
|
-
type:
|
|
2815
|
-
path:
|
|
2816
|
-
parent:
|
|
2817
|
-
entries:
|
|
2818
|
-
error:
|
|
2865
|
+
z33.object({
|
|
2866
|
+
type: z33.literal("folder.listing"),
|
|
2867
|
+
path: z33.string(),
|
|
2868
|
+
parent: z33.string().nullable(),
|
|
2869
|
+
entries: z33.array(z33.string()),
|
|
2870
|
+
error: z33.string().optional(),
|
|
2819
2871
|
/** The request this answers, when it carried one. */
|
|
2820
|
-
requestId:
|
|
2872
|
+
requestId: z33.string().optional(),
|
|
2821
2873
|
/** Those `entries` that are Git repositories, with their branch (the short commit when HEAD is detached). */
|
|
2822
|
-
repos:
|
|
2874
|
+
repos: z33.array(z33.object({ name: z33.string(), branch: z33.string() })).optional()
|
|
2823
2875
|
}),
|
|
2824
|
-
/** The chat (spec 2026-10-11 §5): what Ledge reads, its words as they come, the final text, or why it stopped; the day's turns after each snapshot. */
|
|
2825
|
-
z34.object({ type: z34.literal("chat.step"), qid: z34.string(), step: ChatStepSchema }),
|
|
2826
|
-
z34.object({ type: z34.literal("chat.delta"), qid: z34.string(), text: z34.string() }),
|
|
2827
|
-
z34.object({ type: z34.literal("chat.done"), qid: z34.string(), text: z34.string(), at: z34.string().datetime(), proposal: ChatProposalSchema.optional(), proposals: ChatProposalsSchema.optional(), relay: ChatRelaySchema.optional(), closes: ChatClosesSchema.optional(), projectProposal: ChatProjectProposalSchema.optional(), tasks: ChatTasksSchema.optional(), actions: ChatActionsSchema.optional() }),
|
|
2828
|
-
/** What a `chat.act` applied: the rows done, and the one that failed with why (the rows after it stay proposed). */
|
|
2829
|
-
z34.object({ type: z34.literal("chat.acted"), rid: z34.string(), qid: z34.string(), done: z34.array(z34.number().int().min(0)), failed: z34.array(z34.object({
|
|
2830
|
-
row: z34.number().int().min(0),
|
|
2831
|
-
message: z34.string(),
|
|
2832
|
-
/** nothing was sent */
|
|
2833
|
-
refused: z34.literal(true).optional()
|
|
2834
|
-
})) }),
|
|
2835
2876
|
/** What an `action.run` came to: `row` the action as the daemon resolved it (its summary, its risk); `reason` why it was not
|
|
2836
2877
|
* done, with `code` (`refused`: not possible now; `agent`: a session may not run it; `confirm_required`: destructive, ask
|
|
2837
2878
|
* again; `failed`: the handler turned it down; a free string, as an `error`'s). */
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2879
|
+
z33.object({ type: z33.literal("action.result"), rid: z33.string(), action: z33.string().min(1).max(40), row: ChatActionSchema.optional(), reason: z33.string().optional(), code: z33.string().optional() }),
|
|
2880
|
+
/** #40: the chat left Ledge. An older front's `chat.ask` or `chat.route` is answered with this, so it stops waiting (D12). */
|
|
2881
|
+
z33.object({ type: z33.literal("chat.error"), qid: z33.string(), message: z33.string() }),
|
|
2841
2882
|
/** The daemon updating itself: npm is running, then the service restarts (the socket closes right after). */
|
|
2842
|
-
|
|
2883
|
+
z33.object({ type: z33.literal("update.progress"), version: z33.string(), step: z33.enum(["installing", "restarting"]) }),
|
|
2843
2884
|
/** Nothing was changed. `detail`: the useful end of npm's output; `command`: what the person can run instead. */
|
|
2844
|
-
|
|
2885
|
+
z33.object({ type: z33.literal("update.failed"), version: z33.string(), reason: UpdateFailureSchema, detail: z33.string().optional(), command: z33.string().optional() }),
|
|
2845
2886
|
/** The shared machines list (spec 2026-10-14 §5), sent to local clients only. */
|
|
2846
|
-
|
|
2887
|
+
z33.object({ type: z33.literal("machines"), machines: MachinesSchema }),
|
|
2847
2888
|
/** The local daemon's projects and folder rules (spec 2026-10-16 build §5), sent to local clients only. */
|
|
2848
|
-
|
|
2889
|
+
z33.object({ type: z33.literal("projects"), projects: ProjectsSchema }),
|
|
2849
2890
|
/** The island's settings shared by the local fronts; null until a front sets them (the island then sends its own). Local clients only. */
|
|
2850
|
-
|
|
2891
|
+
z33.object({ type: z33.literal("island"), prefs: IslandPrefsSchema.nullable() }),
|
|
2851
2892
|
/** Mobile access (lot 3), after the island in each snapshot and on every change. Local clients only. */
|
|
2852
|
-
|
|
2893
|
+
z33.object({ type: z33.literal("mobile"), state: MobileStateSchema }),
|
|
2853
2894
|
/** A passkey recovery as it happens (docs/mobile-passkey-recover-contract.md), for the local fronts' toast; the lasting trace is in `mobile`. */
|
|
2854
|
-
|
|
2895
|
+
z33.object({ type: z33.literal("mobile.recovery") }).merge(MobileRecoveryEventSchema),
|
|
2855
2896
|
/** The sessions a phone types into (« Téléphone au clavier »), after each snapshot and each change; `device` is its label. */
|
|
2856
|
-
|
|
2897
|
+
z33.object({ type: z33.literal("terminal.holders"), holds: z33.array(z33.object({ id: z33.string(), device: z33.string() })) }),
|
|
2857
2898
|
/** 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`. */
|
|
2858
|
-
|
|
2859
|
-
type:
|
|
2860
|
-
rid:
|
|
2861
|
-
outcome:
|
|
2862
|
-
reason:
|
|
2899
|
+
z33.object({
|
|
2900
|
+
type: z33.literal("message.ack"),
|
|
2901
|
+
rid: z33.string(),
|
|
2902
|
+
outcome: z33.enum(["accepted", "queued", "native", "refused"]),
|
|
2903
|
+
reason: z33.string().optional(),
|
|
2863
2904
|
/** A broadcast's per-recipient outcome, by name. */
|
|
2864
|
-
recipients:
|
|
2905
|
+
recipients: z33.object({ sent: z33.array(z33.string()), refused: z33.array(z33.object({ name: z33.string(), reason: z33.string() })) }).optional()
|
|
2865
2906
|
}),
|
|
2866
2907
|
/** The answer to a `session.broadcast`: who got it (`sent`) and who did not; `reason`: the whole broadcast was refused. */
|
|
2867
|
-
|
|
2908
|
+
z33.object({ type: z33.literal("session.broadcast.result"), rid: z33.string(), sent: z33.array(z33.object({ id: z33.string(), name: z33.string() })), refused: z33.array(z33.object({ name: z33.string(), reason: z33.string() })), reason: z33.string().optional() }),
|
|
2868
2909
|
/** The answer to a `message.read`: the body with its sender, target and time, or the refusal's `reason`. */
|
|
2869
|
-
|
|
2910
|
+
z33.object({ type: z33.literal("message.body"), id: z33.string(), from: z33.string().optional(), to: z33.string().optional(), at: z33.string().optional(), text: z33.string().optional(), reason: z33.string().optional() }),
|
|
2870
2911
|
TaskResultSchema,
|
|
2871
2912
|
ReportPreviewReplySchema,
|
|
2872
2913
|
ReportCreatedSchema,
|
|
@@ -2887,21 +2928,20 @@ var ServerMessageSchema = z34.discriminatedUnion("type", [
|
|
|
2887
2928
|
RoutineChangedSchema,
|
|
2888
2929
|
RoutinePreviewedSchema,
|
|
2889
2930
|
/** The operator's notices, broadcast on change and in the snapshot. */
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
type:
|
|
2893
|
-
message:
|
|
2894
|
-
id:
|
|
2931
|
+
z33.object({ type: z33.literal("operator.state"), notices: z33.array(OperatorNoticeSchema).max(50) }),
|
|
2932
|
+
z33.object({
|
|
2933
|
+
type: z33.literal("error"),
|
|
2934
|
+
message: z33.string(),
|
|
2935
|
+
id: z33.string().optional(),
|
|
2895
2936
|
/** Le type du message client refusé. */
|
|
2896
|
-
request:
|
|
2937
|
+
request: z33.string().optional(),
|
|
2897
2938
|
/** Ce que le front doit reconnaître au-delà du texte (NOTE_NOT_TYPED) ; une chaîne libre, qu'un front plus ancien ignore. */
|
|
2898
|
-
code:
|
|
2939
|
+
code: z33.string().optional()
|
|
2899
2940
|
})
|
|
2900
2941
|
]);
|
|
2901
2942
|
var MESSAGE_MAX = 2e4;
|
|
2902
2943
|
var SUMMARY_MAX = 500;
|
|
2903
|
-
var
|
|
2904
|
-
var ClientMessageSchema = z34.discriminatedUnion("type", [
|
|
2944
|
+
var ClientMessageSchema = z33.discriminatedUnion("type", [
|
|
2905
2945
|
BrowserWatchSchema,
|
|
2906
2946
|
BrowserUnwatchSchema,
|
|
2907
2947
|
BrowserEnableSchema,
|
|
@@ -2910,7 +2950,6 @@ var ClientMessageSchema = z34.discriminatedUnion("type", [
|
|
|
2910
2950
|
TermUnwatchSchema,
|
|
2911
2951
|
TermInputSchema,
|
|
2912
2952
|
TermResizeSchema,
|
|
2913
|
-
z34.object({ type: z34.literal("chat.route"), qid: z34.string().min(1).max(100), text: z34.string().min(1).max(2e4), tool: ToolSchema.optional(), context: RoutingContextSchema }),
|
|
2914
2953
|
DocumentReadSchema,
|
|
2915
2954
|
AttachmentPutSchema,
|
|
2916
2955
|
AttachmentCaptureSchema,
|
|
@@ -2938,199 +2977,164 @@ var ClientMessageSchema = z34.discriminatedUnion("type", [
|
|
|
2938
2977
|
OpenRigAnswerSchema,
|
|
2939
2978
|
OpenRigGoalSendSchema,
|
|
2940
2979
|
OpenRigGoalsSchema,
|
|
2980
|
+
OpenRigMissionsSchema,
|
|
2941
2981
|
OpenRigGoalReplySchema,
|
|
2942
2982
|
/** The overlay starts a session: `cwd` is a WSL path (`~` allowed), `name` a preferred bot name (the daemon picks a
|
|
2943
2983
|
* free one otherwise), `prompt` the agent's first instruction, `continue` resumes the folder's last conversation.
|
|
2944
|
-
*
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
type: z34.literal("session.launch"),
|
|
2984
|
+
* `qid` named a chat card's turn: the chat left Ledge (#40), so the daemon refuses it (an older front, D12). */
|
|
2985
|
+
z33.object({
|
|
2986
|
+
type: z33.literal("session.launch"),
|
|
2948
2987
|
tool: ToolSchema,
|
|
2949
|
-
cwd:
|
|
2950
|
-
name:
|
|
2951
|
-
prompt:
|
|
2952
|
-
continue:
|
|
2953
|
-
qid:
|
|
2954
|
-
/** With `qid`: the card's rows to launch (#24), indexes into the turn's `proposals`, each once; the first row without it. */
|
|
2955
|
-
rows: launchRows.optional(),
|
|
2988
|
+
cwd: z33.string().min(1),
|
|
2989
|
+
name: z33.string().optional(),
|
|
2990
|
+
prompt: z33.string().optional(),
|
|
2991
|
+
continue: z33.boolean().optional(),
|
|
2992
|
+
qid: z33.string().min(1).optional(),
|
|
2956
2993
|
/** Folders in addition to `cwd` (Claude: `--add-dir`); resolved like `cwd`. */
|
|
2957
|
-
dirs:
|
|
2958
|
-
/** The agent's model and effort (#58), the agent's own default when left out
|
|
2994
|
+
dirs: z33.array(z33.string().min(1)).max(20).optional(),
|
|
2995
|
+
/** The agent's model and effort (#58), the agent's own default when left out. */
|
|
2959
2996
|
model: ModelIdSchema.optional(),
|
|
2960
2997
|
effort: EffortSchema.optional(),
|
|
2961
2998
|
/** OMP only: its approval mode, `always-ask` when left out. */
|
|
2962
2999
|
approval: OmpApprovalSchema.optional(),
|
|
2963
3000
|
/** Routing by the fleet, removed before the message reaches the daemon. */
|
|
2964
|
-
machineId:
|
|
3001
|
+
machineId: z33.string().optional()
|
|
2965
3002
|
}),
|
|
2966
3003
|
/** The launch form's folder browser: list a folder's subfolders (home when no `path`), or make `name` inside `parent`
|
|
2967
3004
|
* and list it. Both are answered with a `folder.listing`. */
|
|
2968
|
-
|
|
2969
|
-
type:
|
|
2970
|
-
path:
|
|
3005
|
+
z33.object({
|
|
3006
|
+
type: z33.literal("folder.list"),
|
|
3007
|
+
path: z33.string().optional(),
|
|
2971
3008
|
/** Routing by the fleet, removed before the message reaches the daemon. */
|
|
2972
|
-
machineId:
|
|
3009
|
+
machineId: z33.string().optional(),
|
|
2973
3010
|
/** Copied into the `folder.listing` that answers; the fleet relays only that listing, from the machine asked. */
|
|
2974
|
-
requestId:
|
|
3011
|
+
requestId: z33.string().min(1).max(100).optional()
|
|
2975
3012
|
}),
|
|
2976
|
-
|
|
2977
|
-
type:
|
|
2978
|
-
parent:
|
|
2979
|
-
name:
|
|
3013
|
+
z33.object({
|
|
3014
|
+
type: z33.literal("folder.create"),
|
|
3015
|
+
parent: z33.string().min(1),
|
|
3016
|
+
name: z33.string().min(1),
|
|
2980
3017
|
/** As for `folder.list`: routing by the fleet, and the request its `folder.listing` answers. */
|
|
2981
|
-
machineId:
|
|
2982
|
-
requestId:
|
|
3018
|
+
machineId: z33.string().optional(),
|
|
3019
|
+
requestId: z33.string().min(1).max(100).optional()
|
|
2983
3020
|
}),
|
|
2984
3021
|
/** `steer`: OMP only, redirect the turn running now instead of queueing the text after it. */
|
|
2985
3022
|
/** OMP's `ask`: the answers to every question of the dialog `requestId`, in order (`selected` labels, and/or free `text`); `cancel` declines it. */
|
|
2986
|
-
|
|
3023
|
+
z33.object({ type: z33.literal("session.answer"), id: z33.string(), requestId: z33.string().min(1).max(200), answers: z33.array(z33.object({ id: z33.string(), selected: z33.array(z33.string().max(2e3)).max(100), text: z33.string().max(2e4).optional() })).max(50), cancel: z33.boolean().optional() }),
|
|
2987
3024
|
/** `by`: as session.decide's, who answers when the reply answers a request (set by the phone gateway for a device; absent, the PC). */
|
|
2988
|
-
|
|
2989
|
-
/** The chat card's instruction (spec 2026-10-12 relay §4): sent now if the session is free, else queued until it is. */
|
|
2990
|
-
z34.object({ type: z34.literal("session.relay"), qid: z34.string().min(1) }),
|
|
2991
|
-
/** Takes the card's queued instruction back out of the queue. */
|
|
2992
|
-
z34.object({ type: z34.literal("session.relay.cancel"), qid: z34.string().min(1) }),
|
|
2993
|
-
/** The chat's generic card (action registry spec §5.1): applies its rows in order (all of them without `rows`), stopping at
|
|
2994
|
-
* the first failure. `confirmed` says the front asked again; refused without it when a row is destructive. */
|
|
2995
|
-
z34.object({
|
|
2996
|
-
type: z34.literal("chat.act"),
|
|
2997
|
-
rid: z34.string().min(1).max(100),
|
|
2998
|
-
qid: z34.string().min(1),
|
|
2999
|
-
rows: launchRows.optional(),
|
|
3000
|
-
confirmed: z34.literal(true).optional(),
|
|
3001
|
-
/** « Refuser »: each row (session.decide only) answers its session's request with deny, whatever its own decision; never
|
|
3002
|
-
* confirmed, and allowed on a request shown cut. The rows become `denied`. */
|
|
3003
|
-
deny: z34.literal(true).optional()
|
|
3004
|
-
}),
|
|
3005
|
-
/** « Ignorer » the turn's cards, for every device and for Ledge (who is told at the next question); `undo` opens them
|
|
3006
|
-
* again (« Revoir »). Refused while one of them is under way. Every client gets the turn's `ignoredAt` through chat.history. */
|
|
3007
|
-
z34.object({ type: z34.literal("chat.ignore"), qid: z34.string().min(1), undo: z34.literal(true).optional() }),
|
|
3008
|
-
/** The operator's point: answer a row (`item` is its id), set the point aside, or mark events up to `eventId` read by the sender's device. */
|
|
3009
|
-
z34.object({
|
|
3010
|
-
type: z34.literal("point.act"),
|
|
3011
|
-
qid: z34.string().min(1),
|
|
3012
|
-
item: z34.string().min(1).max(200),
|
|
3013
|
-
answer: PointAnswerSchema.optional(),
|
|
3014
|
-
/** Applies the row's suggestion instead of answering it (exactly one of `answer` and `suggest`). */
|
|
3015
|
-
suggest: z34.literal(true).optional(),
|
|
3016
|
-
/** The front's confirmation of a destructive answer (an accepted request, a decision), as `chat.act` takes it. */
|
|
3017
|
-
confirmed: z34.literal(true).optional()
|
|
3018
|
-
}),
|
|
3019
|
-
z34.object({ type: z34.literal("point.later"), qid: z34.string().min(1) }),
|
|
3020
|
-
z34.object({ type: z34.literal("operator.read"), eventId: z34.number().int().min(0) }),
|
|
3025
|
+
z33.object({ type: z33.literal("session.reply"), id: z33.string(), text: z33.string(), attachments: z33.array(AttachmentIdSchema).max(ATTACHMENTS_MAX).optional(), steer: z33.boolean().optional(), by: DecidedBySchema.optional() }),
|
|
3021
3026
|
/** A registry action run outside the chat (#93, the CLI): the daemon resolves `args` as it does a generic card's row, then
|
|
3022
3027
|
* applies it through its own handler. `by` the session that asks, left out for the user; `confirmed` for a destructive one. */
|
|
3023
|
-
|
|
3024
|
-
type:
|
|
3025
|
-
rid:
|
|
3026
|
-
by:
|
|
3028
|
+
z33.object({
|
|
3029
|
+
type: z33.literal("action.run"),
|
|
3030
|
+
rid: z33.string().min(1).max(100),
|
|
3031
|
+
by: z33.string().min(1).optional(),
|
|
3027
3032
|
/** `by`'s key (LEDGE_SESSION_KEY) */
|
|
3028
|
-
key:
|
|
3033
|
+
key: z33.string().max(128).optional(),
|
|
3029
3034
|
action: ActionIdSchema,
|
|
3030
|
-
args:
|
|
3031
|
-
confirmed:
|
|
3035
|
+
args: z33.record(z33.unknown()),
|
|
3036
|
+
confirmed: z33.literal(true).optional()
|
|
3032
3037
|
}),
|
|
3033
|
-
/** The chat's close card: closes the turn's sessions, `rows` (indexes into its `closes`) or all of them. */
|
|
3034
|
-
z34.object({ type: z34.literal("session.close"), qid: z34.string().min(1), rows: launchRows.optional() }),
|
|
3035
3038
|
/** `always` and `note` only where the harness offers them (`offers`); a note goes with `deny`, for the agent to read. */
|
|
3036
|
-
|
|
3037
|
-
type:
|
|
3038
|
-
id:
|
|
3039
|
+
z33.object({
|
|
3040
|
+
type: z33.literal("session.decide"),
|
|
3041
|
+
id: z33.string(),
|
|
3039
3042
|
decision: DecisionSchema,
|
|
3040
|
-
note:
|
|
3043
|
+
note: z33.string().trim().min(1).max(NOTE_MAX).optional(),
|
|
3041
3044
|
/** 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.
|
|
3042
3045
|
* `key` (pendingKey) covers its whole content; older fronts send kind and text only. */
|
|
3043
|
-
expect: PendingSchema.pick({ kind: true, text: true }).extend({ key:
|
|
3046
|
+
expect: PendingSchema.pick({ kind: true, text: true }).extend({ key: z33.string().max(64).optional() }).optional(),
|
|
3044
3047
|
/** 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. */
|
|
3045
3048
|
by: DecidedBySchema.optional()
|
|
3046
3049
|
}),
|
|
3047
|
-
|
|
3048
|
-
|
|
3050
|
+
z33.object({ type: z33.literal("session.focus"), id: z33.string() }),
|
|
3051
|
+
z33.object({ type: z33.literal("session.kill"), id: z33.string() }),
|
|
3049
3052
|
/** `restoreQueue` (OMP): also take back what waits in its queue, returned as `session.queue.restored` to put in the draft. */
|
|
3050
|
-
|
|
3053
|
+
z33.object({ type: z33.literal("session.interrupt"), id: z33.string(), restoreQueue: z33.boolean().optional() }),
|
|
3051
3054
|
SessionAsideAskSchema,
|
|
3052
3055
|
/** Removes a finished (exited) or read-only (hook_only) session from the list; refused for a live launcher session. */
|
|
3053
|
-
|
|
3056
|
+
z33.object({ type: z33.literal("session.dismiss"), id: z33.string() }),
|
|
3054
3057
|
/** Puts a session in the archive: it leaves the live list but is kept. */
|
|
3055
|
-
|
|
3058
|
+
z33.object({ type: z33.literal("session.archive"), id: z33.string() }),
|
|
3056
3059
|
/** Takes an archived session back out of the archive, as it was. */
|
|
3057
|
-
|
|
3060
|
+
z33.object({ type: z33.literal("session.restore"), id: z33.string() }),
|
|
3058
3061
|
/** Starts the agent again on an archived session's conversation. */
|
|
3059
|
-
|
|
3062
|
+
z33.object({ type: z33.literal("session.resume"), id: z33.string() }),
|
|
3060
3063
|
/** Changes a live session's model and effort (#58, lot 2), `null` for the agent's own default: the daemon restarts the
|
|
3061
3064
|
* agent on the same conversation with them, at once when the session is free, else at its next free moment. */
|
|
3062
|
-
|
|
3065
|
+
z33.object({ type: z33.literal("session.model"), id: z33.string(), model: ModelIdSchema.nullable(), effort: EffortSchema.nullable() }),
|
|
3063
3066
|
/** Deletes a session for good, archived or not. */
|
|
3064
|
-
|
|
3067
|
+
z33.object({ type: z33.literal("session.delete"), id: z33.string() }),
|
|
3065
3068
|
/** 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. */
|
|
3066
|
-
|
|
3069
|
+
z33.object({ type: z33.literal("session.rename"), id: z33.string(), topic: z33.string().max(500) }),
|
|
3067
3070
|
/** A session's nickname set from the sidebar (`sessionLabel` in the daemon's info), trimmed; empty removes it. Its name, its
|
|
3068
3071
|
* address, does not change. */
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
+
z33.object({ type: z33.literal("session.label"), id: z33.string(), label: z33.string().max(200) }),
|
|
3073
|
+
z33.object({ type: z33.literal("session.thread"), id: z33.string() }),
|
|
3074
|
+
z33.object({ type: z33.literal("session.register"), session: SessionSchema }),
|
|
3072
3075
|
/** `agent` and `cwd` describe the session when the daemon does not know it yet (a hook from an agent started without ledge). */
|
|
3073
|
-
|
|
3074
|
-
type:
|
|
3075
|
-
id:
|
|
3076
|
+
z33.object({
|
|
3077
|
+
type: z33.literal("session.event"),
|
|
3078
|
+
id: z33.string(),
|
|
3076
3079
|
event: SessionEventSchema,
|
|
3077
3080
|
agent: ToolSchema.optional(),
|
|
3078
|
-
cwd:
|
|
3081
|
+
cwd: z33.string().optional(),
|
|
3079
3082
|
/** The OpenRig seat the agent runs in (`OPENRIG_SESSION_NAME`, `pod-member@rig`), when OpenRig launched it. */
|
|
3080
3083
|
rigSeat: RigSeatNameSchema.optional()
|
|
3081
3084
|
}),
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3085
|
+
z33.object({ type: z33.literal("session.unregister"), id: z33.string(), exitCode: z33.number().int().nullable() }),
|
|
3086
|
+
z33.object({ type: z33.literal("snapshot.request") }),
|
|
3087
|
+
/** #40: the chat, its cards and the operator's point left Ledge. An older front's message still parses, by its name only, so
|
|
3088
|
+
* the daemon refuses it by name (D12); `chat.ask` and `chat.route` keep their `qid`, answered with a `chat.error`. */
|
|
3089
|
+
z33.object({ type: z33.literal("chat.ask"), qid: z33.string().min(1).max(100) }),
|
|
3090
|
+
z33.object({ type: z33.literal("chat.route"), qid: z33.string().min(1).max(100) }),
|
|
3091
|
+
...["chat.cancel", "chat.reset", "chat.act", "chat.ignore", "point.act", "point.later", "operator.read", "session.relay", "session.relay.cancel", "session.close"].map((type) => z33.object({ type: z33.literal(type) })),
|
|
3088
3092
|
/** Installs `@paradow/ledge@version` and restarts the service (spec 2026-10-12 auto-update §6). */
|
|
3089
|
-
|
|
3093
|
+
z33.object({ type: z33.literal("update.daemon"), version: z33.string().regex(SEMVER) }),
|
|
3090
3094
|
/** Replaces the daemon's machines list (first connected front wins); refused unless valid. */
|
|
3091
|
-
|
|
3095
|
+
z33.object({ type: z33.literal("machines.set"), machines: MachinesSchema }),
|
|
3092
3096
|
/** Replaces the local daemon's projects and rules as a whole; refused unless valid. */
|
|
3093
|
-
|
|
3097
|
+
z33.object({ type: z33.literal("projects.set"), projects: ProjectsSchema }),
|
|
3094
3098
|
/** Issue #16: one project's sessions' order (its id, or NO_PROJECT ''), as session keys (placeSessions); answered by `projects`. */
|
|
3095
|
-
|
|
3099
|
+
z33.object({ type: z33.literal("sessions.order"), project: z33.string().max(64), ids: z33.array(z33.string().min(1).max(300)).max(SESSION_ORDER_MAX) }),
|
|
3096
3100
|
/** Replaces the island's settings as a whole; refused unless valid. */
|
|
3097
|
-
|
|
3101
|
+
z33.object({ type: z33.literal("island.set"), prefs: IslandPrefsSchema }),
|
|
3098
3102
|
/** Mobile access (lot 3), local fronts only. A changed `relayUrl` drops the relay session. */
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
+
z33.object({ type: z33.literal("mobile.set"), enabled: z33.boolean(), relayUrl: RelayUrlSchema }),
|
|
3104
|
+
z33.object({ type: z33.literal("mobile.signin") }),
|
|
3105
|
+
z33.object({ type: z33.literal("mobile.signin.cancel") }),
|
|
3106
|
+
z33.object({ type: z33.literal("mobile.signout") }),
|
|
3103
3107
|
/** While the link is offline: try again now. */
|
|
3104
|
-
|
|
3108
|
+
z33.object({ type: z33.literal("mobile.retry") }),
|
|
3105
3109
|
/** `replaces`: an approved device this one takes the place of (the same app reinstalled), revoked once this one is stored. */
|
|
3106
|
-
|
|
3107
|
-
|
|
3110
|
+
z33.object({ type: z33.literal("mobile.pairing.approve"), id: z33.string().min(1).max(100), replaces: z33.string().min(1).max(100).optional() }),
|
|
3111
|
+
z33.object({ type: z33.literal("mobile.pairing.deny"), id: z33.string().min(1).max(100) }),
|
|
3108
3112
|
/** `id`: the device's fingerprint. */
|
|
3109
|
-
|
|
3113
|
+
z33.object({ type: z33.literal("mobile.device.revoke"), id: z33.string().min(1).max(100) }),
|
|
3110
3114
|
/** Names a device (`id`: its fingerprint); the device sees its new name in its next snapshot. */
|
|
3111
|
-
|
|
3115
|
+
z33.object({ type: z33.literal("mobile.device.rename"), id: z33.string().min(1).max(100), name: DeviceNameSchema }),
|
|
3112
3116
|
/** « Taper dans les terminaux depuis le téléphone »; turned off, every phone loses the hand. */
|
|
3113
|
-
|
|
3117
|
+
z33.object({ type: z33.literal("mobile.terminal"), input: z33.boolean() }),
|
|
3114
3118
|
/** « C'était bien moi » (`recovered`: its notice goes, the trace stays) or « Compris » (`refused`) on a device's row. */
|
|
3115
|
-
|
|
3119
|
+
z33.object({ type: z33.literal("mobile.device.ack"), id: z33.string().min(1).max(100), what: z33.enum(["recovered", "refused"]) }),
|
|
3116
3120
|
/** « Débloquer »: passkey recovery is taken again after 3 failed verifications. */
|
|
3117
|
-
|
|
3121
|
+
z33.object({ type: z33.literal("mobile.recovery.unblock") }),
|
|
3118
3122
|
/** « Reprendre la main »: the phone typing into the session's terminal goes back to reading it. */
|
|
3119
|
-
|
|
3123
|
+
z33.object({ type: z33.literal("terminal.release"), id: z33.string().min(1) }),
|
|
3120
3124
|
/** 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. */
|
|
3121
|
-
|
|
3125
|
+
z33.object({ type: z33.literal("session.message"), rid: z33.string().min(1), from: z33.string().min(1), to: z33.string().min(1), text: z33.string().min(1).max(MESSAGE_MAX), summary: z33.string().max(SUMMARY_MAX).optional(), intercept: z33.boolean().optional() }),
|
|
3122
3126
|
/** The user writing to every session of a project, or to several sessions (ids or names). */
|
|
3123
|
-
|
|
3124
|
-
type:
|
|
3125
|
-
rid:
|
|
3126
|
-
to:
|
|
3127
|
-
text:
|
|
3128
|
-
summary:
|
|
3127
|
+
z33.object({
|
|
3128
|
+
type: z33.literal("session.broadcast"),
|
|
3129
|
+
rid: z33.string().min(1).max(100),
|
|
3130
|
+
to: z33.union([z33.object({ project: z33.string().min(1).max(80) }), z33.object({ sessions: z33.array(z33.string().min(1)).min(1).max(BROADCAST_SESSIONS_MAX) })]),
|
|
3131
|
+
text: z33.string().trim().min(1).max(MESSAGE_MAX),
|
|
3132
|
+
summary: z33.string().max(SUMMARY_MAX).optional(),
|
|
3129
3133
|
/** How the recipients are told who it went to (« (à <label>) »), instead of the names: a project the fleet turned into sessions. */
|
|
3130
|
-
label:
|
|
3134
|
+
label: z33.string().min(1).max(BROADCAST_LABEL_MAX).optional()
|
|
3131
3135
|
}),
|
|
3132
3136
|
/** `ledge read <id>`: a message's whole body, for its receiver or its sender (`by`, a session id). */
|
|
3133
|
-
|
|
3137
|
+
z33.object({ type: z33.literal("message.read"), id: z33.string().min(1).max(40), by: z33.string().min(1) }),
|
|
3134
3138
|
TaskCmdSchema,
|
|
3135
3139
|
/** Reports (issue #9): the « Signaler » form's preview, creation and an agent's report ignored; `ledge report`. */
|
|
3136
3140
|
ReportPreviewSchema,
|
|
@@ -3156,111 +3160,111 @@ var ClientMessageSchema = z34.discriminatedUnion("type", [
|
|
|
3156
3160
|
]);
|
|
3157
3161
|
|
|
3158
3162
|
// ../../packages/protocol/src/relay.ts
|
|
3159
|
-
import { z as
|
|
3163
|
+
import { z as z34 } from "zod";
|
|
3160
3164
|
var SEALED_MAX = 1048576;
|
|
3161
|
-
var RelayPeerSchema =
|
|
3162
|
-
var RelayClientMessageSchema =
|
|
3163
|
-
type:
|
|
3165
|
+
var RelayPeerSchema = z34.union([z34.literal("pc"), z34.string().regex(/^d_[A-Za-z0-9_-]{16,40}$/)]);
|
|
3166
|
+
var RelayClientMessageSchema = z34.object({
|
|
3167
|
+
type: z34.literal("send"),
|
|
3164
3168
|
to: RelayPeerSchema,
|
|
3165
|
-
body:
|
|
3169
|
+
body: z34.string().max(SEALED_MAX)
|
|
3166
3170
|
});
|
|
3167
|
-
var RelayServerMessageSchema =
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
+
var RelayServerMessageSchema = z34.discriminatedUnion("type", [
|
|
3172
|
+
z34.object({ type: z34.literal("welcome"), accountId: z34.string(), self: RelayPeerSchema, online: z34.array(RelayPeerSchema) }),
|
|
3173
|
+
z34.object({ type: z34.literal("deliver"), from: RelayPeerSchema, body: z34.string() }),
|
|
3174
|
+
z34.object({ type: z34.literal("presence"), peer: RelayPeerSchema, online: z34.boolean() }),
|
|
3171
3175
|
/**
|
|
3172
3176
|
* A frame was refused; `to` names the target when it is known.
|
|
3173
3177
|
* Contract: an error concerning a sealed body (`offline`, `too_large`, or a socket closed with 4008
|
|
3174
3178
|
* `rate_limited`) means that body was not delivered, so the sequence on that channel is lost: the
|
|
3175
3179
|
* sender must re-handshake with that peer before sending to it again.
|
|
3176
3180
|
*/
|
|
3177
|
-
|
|
3178
|
-
type:
|
|
3179
|
-
code:
|
|
3181
|
+
z34.object({
|
|
3182
|
+
type: z34.literal("error"),
|
|
3183
|
+
code: z34.enum(["bad_frame", "too_large", "bad_target", "offline", "rate_limited"]),
|
|
3180
3184
|
to: RelayPeerSchema.optional()
|
|
3181
3185
|
})
|
|
3182
3186
|
]);
|
|
3183
3187
|
var PAIR_LABEL_MAX = 40;
|
|
3184
|
-
var KeyB64 =
|
|
3185
|
-
var Nonce =
|
|
3186
|
-
var Fingerprint =
|
|
3187
|
-
var B64U =
|
|
3188
|
-
var RecoverWhySchema =
|
|
3188
|
+
var KeyB64 = z34.string().regex(/^[A-Za-z0-9_-]{87}$/);
|
|
3189
|
+
var Nonce = z34.string().regex(/^[A-Za-z0-9_-]{43}$/);
|
|
3190
|
+
var Fingerprint = z34.string().regex(/^[A-Za-z0-9_-]{22}$/);
|
|
3191
|
+
var B64U = z34.string().regex(/^[A-Za-z0-9_-]*$/);
|
|
3192
|
+
var RecoverWhySchema = z34.enum(["none", "old", "offline", "otherPc", "timeout", "revoked", "connected", "rate", "blocked", "failed"]);
|
|
3189
3193
|
var RecoverRefusalSchema = RecoverWhySchema.extract(["revoked", "connected", "rate", "blocked", "failed"]);
|
|
3190
|
-
var ModelLabel =
|
|
3191
|
-
var RecoverAssertion =
|
|
3194
|
+
var ModelLabel = z34.string().trim().min(1).max(PAIR_LABEL_MAX);
|
|
3195
|
+
var RecoverAssertion = z34.object({
|
|
3192
3196
|
id: B64U.max(1366),
|
|
3193
3197
|
clientDataJSON: B64U.max(4096),
|
|
3194
3198
|
authenticatorData: B64U.max(4096),
|
|
3195
3199
|
signature: B64U.max(1024)
|
|
3196
3200
|
}).strict();
|
|
3197
|
-
var SealedFrameSchema =
|
|
3201
|
+
var SealedFrameSchema = z34.discriminatedUnion("k", [
|
|
3198
3202
|
/** `e` is the ephemeral key, `f` the fingerprint of the sender's static key. */
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3203
|
+
z34.object({ k: z34.literal("hello"), e: KeyB64, f: Fingerprint }),
|
|
3204
|
+
z34.object({ k: z34.literal("msg"), s: z34.string() }),
|
|
3205
|
+
z34.object({ k: z34.literal("pair_commit"), c: Nonce, label: z34.string().trim().min(1).max(PAIR_LABEL_MAX) }),
|
|
3206
|
+
z34.object({ k: z34.literal("pair_offer"), pc: KeyB64, n: Nonce }),
|
|
3207
|
+
z34.object({ k: z34.literal("pair_reveal"), d: KeyB64, n: Nonce }),
|
|
3208
|
+
z34.object({ k: z34.literal("pair_ok") }),
|
|
3209
|
+
z34.object({ k: z34.literal("pair_no") }),
|
|
3210
|
+
z34.object({ k: z34.literal("denied") }),
|
|
3211
|
+
z34.object({ k: z34.literal("rekey") }),
|
|
3208
3212
|
// ── Passkey recovery after a reinstall (unsealed, like pairing: nothing in them lets the relay act) ──
|
|
3209
3213
|
/** 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. */
|
|
3210
|
-
|
|
3214
|
+
z34.object({ k: z34.literal("recover_start"), d: KeyB64, n: Nonce, model: ModelLabel.optional() }),
|
|
3211
3215
|
/** PC → phone: its key `pc`, a one-use nonce `n` (60 s), and its name (`WSL`), for the phone's screens. */
|
|
3212
|
-
|
|
3216
|
+
z34.object({ k: z34.literal("recover_offer"), pc: KeyB64, n: Nonce, name: z34.string().max(PAIR_LABEL_MAX).optional() }),
|
|
3213
3217
|
/** Phone → PC: the discoverable assertion over `recoverChallenge(pc, d, pcNonce, n)`, and its `userHandle` (« L1 » ‖ digest ‖ random). */
|
|
3214
|
-
|
|
3218
|
+
z34.object({ k: z34.literal("recover_proof"), assertion: RecoverAssertion, userHandle: B64U.max(128) }),
|
|
3215
3219
|
/** PC → phone: the device is back under its new key; `name` the one it keeps. The phone pins the PC key, then says `hello`. */
|
|
3216
|
-
|
|
3220
|
+
z34.object({ k: z34.literal("recover_ok"), name: z34.string().max(PAIR_LABEL_MAX).optional() }),
|
|
3217
3221
|
/** PC → phone: refused. `device` the device the passkey names (`revoked`, `connected`); `revokedAt` when it was revoked (ISO,
|
|
3218
3222
|
* `revoked` within 90 days); `retryInMs` until a recovery is taken again (`rate`). */
|
|
3219
|
-
|
|
3220
|
-
k:
|
|
3223
|
+
z34.object({
|
|
3224
|
+
k: z34.literal("recover_no"),
|
|
3221
3225
|
why: RecoverRefusalSchema,
|
|
3222
|
-
device:
|
|
3223
|
-
revokedAt:
|
|
3224
|
-
retryInMs:
|
|
3226
|
+
device: z34.string().max(PAIR_LABEL_MAX).optional(),
|
|
3227
|
+
revokedAt: z34.string().datetime().optional(),
|
|
3228
|
+
retryInMs: z34.number().int().min(0).optional()
|
|
3225
3229
|
})
|
|
3226
3230
|
]);
|
|
3227
3231
|
|
|
3228
3232
|
// ../../packages/protocol/src/relayAuth.ts
|
|
3229
|
-
import { z as
|
|
3233
|
+
import { z as z35 } from "zod";
|
|
3230
3234
|
var RELAY_SESSION_COOKIE = "ledge_session";
|
|
3231
3235
|
var RELAY_CLOSE_SIGNED_OUT = 4001;
|
|
3232
3236
|
var RELAY_CLOSE_REPLACED = 4e3;
|
|
3233
3237
|
var RELAY_CLOSE_RATE_LIMITED = 4008;
|
|
3234
|
-
var DeviceStartResponseSchema =
|
|
3235
|
-
deviceCode:
|
|
3236
|
-
userCode:
|
|
3237
|
-
verificationUri:
|
|
3238
|
-
expiresIn:
|
|
3239
|
-
interval:
|
|
3240
|
-
});
|
|
3241
|
-
var DevicePollResponseSchema =
|
|
3242
|
-
|
|
3243
|
-
|
|
3238
|
+
var DeviceStartResponseSchema = z35.object({
|
|
3239
|
+
deviceCode: z35.string().min(1),
|
|
3240
|
+
userCode: z35.string().min(1),
|
|
3241
|
+
verificationUri: z35.string().min(1),
|
|
3242
|
+
expiresIn: z35.number().int().positive(),
|
|
3243
|
+
interval: z35.number().int().positive()
|
|
3244
|
+
});
|
|
3245
|
+
var DevicePollResponseSchema = z35.discriminatedUnion("status", [
|
|
3246
|
+
z35.object({ status: z35.literal("pending") }),
|
|
3247
|
+
z35.object({ status: z35.literal("slow_down"), interval: z35.number().int().positive() }),
|
|
3244
3248
|
/** `token` is the relay session token, shown this once only. */
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
+
z35.object({ status: z35.literal("ok"), token: z35.string().min(1), accountId: z35.string().min(1), login: z35.string().min(1) }),
|
|
3250
|
+
z35.object({ status: z35.literal("expired") }),
|
|
3251
|
+
z35.object({ status: z35.literal("denied") }),
|
|
3252
|
+
z35.object({ status: z35.literal("not_allowed") })
|
|
3249
3253
|
]);
|
|
3250
|
-
var DeviceRevokeResponseSchema =
|
|
3251
|
-
var MeResponseSchema =
|
|
3252
|
-
accountId:
|
|
3253
|
-
login:
|
|
3254
|
+
var DeviceRevokeResponseSchema = z35.object({ revoked: z35.number().int().min(0) });
|
|
3255
|
+
var MeResponseSchema = z35.object({
|
|
3256
|
+
accountId: z35.string().min(1),
|
|
3257
|
+
login: z35.string().min(1),
|
|
3254
3258
|
peer: RelayPeerSchema,
|
|
3255
|
-
kind:
|
|
3259
|
+
kind: z35.enum(["pc", "device"])
|
|
3256
3260
|
});
|
|
3257
3261
|
|
|
3258
3262
|
// ../../packages/protocol/src/phone.ts
|
|
3259
|
-
import { z as
|
|
3263
|
+
import { z as z39 } from "zod";
|
|
3260
3264
|
|
|
3261
3265
|
// ../../packages/protocol/src/push.ts
|
|
3262
|
-
import { z as
|
|
3263
|
-
var B64U2 =
|
|
3266
|
+
import { z as z36 } from "zod";
|
|
3267
|
+
var B64U2 = z36.string().regex(/^[A-Za-z0-9_-]*$/);
|
|
3264
3268
|
var PUSH_HOSTS = ["*.push.apple.com", "fcm.googleapis.com", "updates.push.services.mozilla.com", "*.notify.windows.com"];
|
|
3265
3269
|
function pushEndpointAllowed(url2) {
|
|
3266
3270
|
let u;
|
|
@@ -3277,43 +3281,43 @@ function pushEndpointAllowed(url2) {
|
|
|
3277
3281
|
return host.length > suffix.length && host.endsWith(suffix);
|
|
3278
3282
|
});
|
|
3279
3283
|
}
|
|
3280
|
-
var PushSendSchema =
|
|
3281
|
-
endpoint:
|
|
3284
|
+
var PushSendSchema = z36.object({
|
|
3285
|
+
endpoint: z36.string().url().max(1024),
|
|
3282
3286
|
body: B64U2.max(5462),
|
|
3283
|
-
ttl:
|
|
3284
|
-
urgency:
|
|
3285
|
-
topic:
|
|
3287
|
+
ttl: z36.number().int().min(0).max(86400),
|
|
3288
|
+
urgency: z36.enum(["normal", "high"]),
|
|
3289
|
+
topic: z36.string().regex(/^[A-Za-z0-9_-]{1,32}$/)
|
|
3286
3290
|
});
|
|
3287
|
-
var PushSendResultSchema =
|
|
3288
|
-
result:
|
|
3289
|
-
status:
|
|
3291
|
+
var PushSendResultSchema = z36.object({
|
|
3292
|
+
result: z36.enum(["sent", "gone", "failed"]),
|
|
3293
|
+
status: z36.number().int().optional()
|
|
3290
3294
|
});
|
|
3291
|
-
var PushSubscriptionSchema =
|
|
3292
|
-
endpoint:
|
|
3293
|
-
keys:
|
|
3295
|
+
var PushSubscriptionSchema = z36.object({
|
|
3296
|
+
endpoint: z36.string().url().max(1024).refine(pushEndpointAllowed),
|
|
3297
|
+
keys: z36.object({ p256dh: B64U2.length(87), auth: B64U2.length(22) })
|
|
3294
3298
|
});
|
|
3295
|
-
var PushPayloadSchema =
|
|
3296
|
-
v:
|
|
3299
|
+
var PushPayloadSchema = z36.object({
|
|
3300
|
+
v: z36.literal(1),
|
|
3297
3301
|
/** `resolved`: a request or question answered (anywhere), replacing its notification under the same tag; only sent to a
|
|
3298
3302
|
* device whose subscription says its service worker knows it (`push.subscribe` `resolved`). `point`: the operator's point, one per
|
|
3299
3303
|
* paired device (the body is its lead); it replaces `finished`, which stays in the schema for older daemons but is no longer sent. */
|
|
3300
|
-
kind:
|
|
3301
|
-
title:
|
|
3304
|
+
kind: z36.enum(["request", "question", "finished", "chat", "decision", "resolved", "point"]),
|
|
3305
|
+
title: z36.string().max(80),
|
|
3302
3306
|
/**
|
|
3303
3307
|
* Who the notification is about, so the phone writes its own title in its language (Q29): the session's name for `request`,
|
|
3304
3308
|
* `question` and `resolved`, the giver's for `decision`; none for `chat`. Optional: an older daemon sends none, and an
|
|
3305
3309
|
* older phone ignores it and shows `title`.
|
|
3306
3310
|
*/
|
|
3307
|
-
name:
|
|
3308
|
-
body:
|
|
3309
|
-
url:
|
|
3310
|
-
badge:
|
|
3311
|
-
tag:
|
|
3311
|
+
name: z36.string().max(100).optional(),
|
|
3312
|
+
body: z36.string().max(120),
|
|
3313
|
+
url: z36.string().regex(/^\/#\/[A-Za-z0-9/%._~-]*$/).max(300),
|
|
3314
|
+
badge: z36.number().int().min(0).max(999),
|
|
3315
|
+
tag: z36.string().regex(/^[A-Za-z0-9_-]{1,32}$/)
|
|
3312
3316
|
});
|
|
3313
3317
|
|
|
3314
3318
|
// ../../packages/protocol/src/phoneRigs.ts
|
|
3315
|
-
import { z as
|
|
3316
|
-
var PhoneRigErrorSchema =
|
|
3319
|
+
import { z as z37 } from "zod";
|
|
3320
|
+
var PhoneRigErrorSchema = z37.enum(["unknown_rig", "not_installed", "daemon_stopped", "unavailable"]);
|
|
3317
3321
|
var PHONE_RIG_TEXT_MAX = 500;
|
|
3318
3322
|
var PHONE_RIGS_MAX = 50;
|
|
3319
3323
|
var PHONE_RIG_SEATS_MAX = 200;
|
|
@@ -3323,74 +3327,74 @@ var PHONE_GOALS_MAX = 50;
|
|
|
3323
3327
|
var PhoneRigSchema = RigSchema.omit({ specPath: true }).extend({ nodes: RigSchema.shape.nodes.max(PHONE_RIG_SEATS_MAX) });
|
|
3324
3328
|
var PhoneOpenRigStateSchema = OpenRigStateSchema.extend({
|
|
3325
3329
|
daemon: OpenRigStateSchema.shape.daemon.omit({ message: true, pid: true }),
|
|
3326
|
-
rigs:
|
|
3330
|
+
rigs: z37.array(PhoneRigSchema).max(PHONE_RIGS_MAX)
|
|
3327
3331
|
});
|
|
3328
|
-
var PhoneRigQueueRowSchema = RigRowSchema.extend({ summary:
|
|
3329
|
-
var PhoneRigRoutingSchema = RigRoutingEntrySchema.extend({ summary:
|
|
3330
|
-
var PhoneRigPermissionSchema = RigSeatPermissionSchema.extend({ summary:
|
|
3332
|
+
var PhoneRigQueueRowSchema = RigRowSchema.extend({ summary: z37.string().max(PHONE_RIG_SUMMARY_MAX).optional() });
|
|
3333
|
+
var PhoneRigRoutingSchema = RigRoutingEntrySchema.extend({ summary: z37.string().max(PHONE_RIG_SUMMARY_MAX).optional() });
|
|
3334
|
+
var PhoneRigPermissionSchema = RigSeatPermissionSchema.extend({ summary: z37.string().max(PHONE_RIG_TEXT_MAX).optional(), error: z37.string().max(PHONE_RIG_TEXT_MAX).optional() });
|
|
3331
3335
|
var PhoneGoalSchema = GoalSchema;
|
|
3332
|
-
var RigSeatCountsSchema =
|
|
3333
|
-
var PhoneRigRejectedSchema =
|
|
3336
|
+
var RigSeatCountsSchema = z37.record(RigRoleSchema, z37.number().int().min(0).max(9));
|
|
3337
|
+
var PhoneRigRejectedSchema = z37.enum(["confirm_required", "assertion_invalid", "assertion_expired", "unavailable"]);
|
|
3334
3338
|
|
|
3335
3339
|
// ../../packages/protocol/src/phoneForge.ts
|
|
3336
|
-
import { z as
|
|
3340
|
+
import { z as z38 } from "zod";
|
|
3337
3341
|
var PHONE_FORGE_PRS_MAX = 100;
|
|
3338
3342
|
var PHONE_FORGE_FOLLOWED_MAX = 200;
|
|
3339
3343
|
var PHONE_FORGE_MESSAGE_MAX = 500;
|
|
3340
3344
|
var PhoneForgeStatusSchema = ForgeStatusSchema.omit({ message: true });
|
|
3341
|
-
var PhoneForgeErrorSchema =
|
|
3342
|
-
var PhoneForgeActErrorSchema =
|
|
3343
|
-
var PhoneForgeRejectedSchema =
|
|
3344
|
-
var PhoneForgeStateSchema =
|
|
3345
|
+
var PhoneForgeErrorSchema = z38.enum(["unavailable", "failed", "too_large"]);
|
|
3346
|
+
var PhoneForgeActErrorSchema = z38.enum(["stale", "busy", "not_offered", "unavailable", "failed"]);
|
|
3347
|
+
var PhoneForgeRejectedSchema = z38.enum(["confirm_required", "assertion_invalid", "assertion_expired", "unavailable"]);
|
|
3348
|
+
var PhoneForgeStateSchema = z38.object({
|
|
3345
3349
|
/** Newest change first. A request whose forge, state or pipeline an older phone does not know is dropped, not the message. */
|
|
3346
|
-
prs:
|
|
3347
|
-
forges:
|
|
3348
|
-
followed:
|
|
3350
|
+
prs: z38.preprocess(dropUnknownPrs, z38.array(PullRequestSchema).max(PHONE_FORGE_PRS_MAX)),
|
|
3351
|
+
forges: z38.preprocess(dropUnknownForges, z38.array(PhoneForgeStatusSchema).max(20)),
|
|
3352
|
+
followed: z38.preprocess(dropUnknownForges, z38.array(FollowedSessionSchema).max(PHONE_FORGE_FOLLOWED_MAX)),
|
|
3349
3353
|
/** The account's own requests no session follows (issue #3), newest change first; absent from an older daemon. */
|
|
3350
|
-
mine:
|
|
3354
|
+
mine: z38.preprocess(dropUnknownPrs, z38.array(PullRequestSchema).max(PHONE_FORGE_PRS_MAX)).optional()
|
|
3351
3355
|
});
|
|
3352
3356
|
|
|
3353
3357
|
// ../../packages/protocol/src/phone.ts
|
|
3354
3358
|
var PHONE_ROW_SUMMARY_MAX = 200;
|
|
3355
|
-
var PhoneRigRowSchema = RigRowSchema.extend({ summary:
|
|
3356
|
-
var PhoneRowErrorSchema =
|
|
3359
|
+
var PhoneRigRowSchema = RigRowSchema.extend({ summary: z39.string().max(PHONE_ROW_SUMMARY_MAX).optional() });
|
|
3360
|
+
var PhoneRowErrorSchema = z39.enum(["not_found", "unavailable"]);
|
|
3357
3361
|
var PHONE_PROTOCOL = 1;
|
|
3358
3362
|
var utf8 = new TextEncoder();
|
|
3359
3363
|
var THREAD_TEXT_MAX = 8192;
|
|
3360
3364
|
var TOOL_TEXT_MAX = 2048;
|
|
3361
3365
|
var CHECKLIST_TASKS_MAX = 50;
|
|
3362
3366
|
var CHECKLIST_TEXT_MAX = 200;
|
|
3363
|
-
var ChecklistStatusSchema =
|
|
3364
|
-
var PhoneChecklistSchema =
|
|
3365
|
-
tasks:
|
|
3366
|
-
done:
|
|
3367
|
-
total:
|
|
3368
|
-
cut:
|
|
3369
|
-
});
|
|
3370
|
-
var PhoneChecklistSummarySchema =
|
|
3371
|
-
done:
|
|
3372
|
-
total:
|
|
3373
|
-
current:
|
|
3374
|
-
cut:
|
|
3375
|
-
});
|
|
3376
|
-
var RiskSchema =
|
|
3377
|
-
var RiskReasonSchema =
|
|
3378
|
-
var OperationIdSchema =
|
|
3379
|
-
var OperationStatusSchema =
|
|
3380
|
-
var OperationReasonSchema =
|
|
3381
|
-
var CapabilitiesSchema =
|
|
3367
|
+
var ChecklistStatusSchema = z39.enum(["pending", "in_progress", "completed"]);
|
|
3368
|
+
var PhoneChecklistSchema = z39.object({
|
|
3369
|
+
tasks: z39.array(z39.object({ text: z39.string().max(CHECKLIST_TEXT_MAX), status: ChecklistStatusSchema })).max(CHECKLIST_TASKS_MAX),
|
|
3370
|
+
done: z39.number().int().nonnegative(),
|
|
3371
|
+
total: z39.number().int().nonnegative(),
|
|
3372
|
+
cut: z39.literal(true).optional()
|
|
3373
|
+
});
|
|
3374
|
+
var PhoneChecklistSummarySchema = z39.object({
|
|
3375
|
+
done: z39.number().int().nonnegative(),
|
|
3376
|
+
total: z39.number().int().nonnegative(),
|
|
3377
|
+
current: z39.string().max(CHECKLIST_TEXT_MAX).optional(),
|
|
3378
|
+
cut: z39.literal(true).optional()
|
|
3379
|
+
});
|
|
3380
|
+
var RiskSchema = z39.enum(["low", "high"]);
|
|
3381
|
+
var RiskReasonSchema = z39.enum(["question", "read_only_command", "edit_inside_folder", "pushes", "destroys", "deploys", "publishes", "pipes_to_shell", "network", "writes_outside_folder", "sensitive_path", "unsafe_flag", "shell_syntax", "script", "plan", "unknown"]);
|
|
3382
|
+
var OperationIdSchema = z39.string().uuid();
|
|
3383
|
+
var OperationStatusSchema = z39.enum(["received", "applied", "rejected", "failed"]);
|
|
3384
|
+
var OperationReasonSchema = z39.enum([...RefusalCodeSchema.options, "untypable", "confirm_required", "conflict", "assertion_invalid", "assertion_expired", "scheduled", "folder_taken", "not_found", "not_pending", ...ModelRefusalSchema.options]);
|
|
3385
|
+
var CapabilitiesSchema = z39.object({
|
|
3382
3386
|
/** A question can be answered in free text. */
|
|
3383
|
-
freeTextAnswer:
|
|
3387
|
+
freeTextAnswer: z39.boolean(),
|
|
3384
3388
|
/** The session's accept/deny can be typed; absent = true. */
|
|
3385
|
-
decide:
|
|
3389
|
+
decide: z39.boolean().optional(),
|
|
3386
3390
|
/** OMP's dialog questions can be answered from the phone; absent = false. */
|
|
3387
|
-
questions:
|
|
3391
|
+
questions: z39.boolean().optional()
|
|
3388
3392
|
});
|
|
3389
|
-
var CapabilitiesByToolSchema =
|
|
3390
|
-
var PhonePendingSchema = PendingSchema.extend({ key:
|
|
3391
|
-
var SwitchableSessionSchema = SessionSchema.extend({ canSwitch:
|
|
3392
|
-
var PhoneProjectSchema =
|
|
3393
|
-
var PhoneSessionOrderSchema =
|
|
3393
|
+
var CapabilitiesByToolSchema = z39.object({ claude: CapabilitiesSchema, codex: CapabilitiesSchema, cursor: CapabilitiesSchema, omp: CapabilitiesSchema });
|
|
3394
|
+
var PhonePendingSchema = PendingSchema.extend({ key: z39.string().max(64), risk: RiskSchema, riskReason: RiskReasonSchema, cut: z39.literal(true).optional() });
|
|
3395
|
+
var SwitchableSessionSchema = SessionSchema.extend({ canSwitch: z39.literal(true).optional() });
|
|
3396
|
+
var PhoneProjectSchema = z39.object({ id: ProjectIdSchema, name: z39.string().max(80), color: ProjectColorSchema });
|
|
3397
|
+
var PhoneSessionOrderSchema = z39.record(z39.string().max(64), z39.array(z39.string().max(200)).max(SESSION_ORDER_MAX));
|
|
3394
3398
|
var PHONE_PROJECTS_MAX = 100;
|
|
3395
3399
|
var PHONE_RIG_NAME_MAX = 100;
|
|
3396
3400
|
var PhoneSessionSchema = SwitchableSessionSchema.pick({
|
|
@@ -3426,110 +3430,110 @@ var PhoneSessionSchema = SwitchableSessionSchema.pick({
|
|
|
3426
3430
|
closedHow: true
|
|
3427
3431
|
}).extend({
|
|
3428
3432
|
/** What it is running now (« pnpm --filter desktop test »), `doingOf` on the PC: the list row and « En cours ». Older phones drop the field. */
|
|
3429
|
-
doing:
|
|
3433
|
+
doing: z39.object({ tool: z39.string().max(DOING_TOOL_MAX), label: z39.string().max(DOING_LABEL_MAX), since: z39.string().datetime() }).optional(),
|
|
3430
3434
|
pending: PhonePendingSchema.optional(),
|
|
3431
|
-
unread:
|
|
3432
|
-
handover:
|
|
3435
|
+
unread: z39.boolean(),
|
|
3436
|
+
handover: z39.object({ state: HandoverStateSchema, toName: z39.string().max(80).optional() }).strict().optional(),
|
|
3433
3437
|
/** Absent: the agent has no checklist. */
|
|
3434
3438
|
checklist: PhoneChecklistSummarySchema.optional(),
|
|
3435
3439
|
/** Started without Ledge (`hook_only`): the phone can neither close nor resume it. */
|
|
3436
|
-
readOnly:
|
|
3440
|
+
readOnly: z39.literal(true).optional(),
|
|
3437
3441
|
/** 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 »). */
|
|
3438
3442
|
projectId: ProjectIdSchema.optional(),
|
|
3439
3443
|
/** The OpenRig seat it is (`daemon.atelier`): its rig and its role once OpenRig named it. Never the seat's folder. */
|
|
3440
|
-
rig:
|
|
3444
|
+
rig: z39.object({ name: z39.string().max(PHONE_RIG_NAME_MAX), role: z39.string().max(PHONE_RIG_NAME_MAX).optional() }).optional()
|
|
3441
3445
|
});
|
|
3442
|
-
var B64U3 =
|
|
3443
|
-
var CredentialSchema =
|
|
3446
|
+
var B64U3 = z39.string().regex(/^[A-Za-z0-9_-]*$/);
|
|
3447
|
+
var CredentialSchema = z39.object({
|
|
3444
3448
|
id: B64U3.max(1366),
|
|
3445
3449
|
publicKey: B64U3.max(2048),
|
|
3446
|
-
alg:
|
|
3450
|
+
alg: z39.union([z39.literal(-7), z39.literal(-257)]),
|
|
3447
3451
|
clientDataJSON: B64U3.max(4096),
|
|
3448
3452
|
authenticatorData: B64U3.max(4096),
|
|
3449
|
-
transports:
|
|
3453
|
+
transports: z39.array(z39.string().max(20)).max(8).optional()
|
|
3450
3454
|
});
|
|
3451
|
-
var AssertionSchema =
|
|
3455
|
+
var AssertionSchema = z39.object({
|
|
3452
3456
|
id: B64U3.max(1366),
|
|
3453
3457
|
clientDataJSON: B64U3.max(4096),
|
|
3454
3458
|
authenticatorData: B64U3.max(4096),
|
|
3455
3459
|
signature: B64U3.max(1024)
|
|
3456
3460
|
});
|
|
3457
|
-
var ConfirmPurposeSchema =
|
|
3461
|
+
var ConfirmPurposeSchema = z39.enum(["register", "decide", "launch", "close", "act", "pc", "terminal", "rig", "note", "project", "folder", "rigs", "forge", "routine", "decision"]);
|
|
3458
3462
|
var PhoneChatStepSchema = ChatStepSchema.pick({ kind: true, id: true, name: true }).strict();
|
|
3459
|
-
var PhoneChatProposalSchema =
|
|
3460
|
-
project:
|
|
3463
|
+
var PhoneChatProposalSchema = z39.object({
|
|
3464
|
+
project: z39.string().max(80),
|
|
3461
3465
|
tool: ToolSchema,
|
|
3462
|
-
prompt:
|
|
3463
|
-
launchedId:
|
|
3464
|
-
failed:
|
|
3466
|
+
prompt: z39.string().max(TOOL_TEXT_MAX).optional(),
|
|
3467
|
+
launchedId: z39.string().optional(),
|
|
3468
|
+
failed: z39.literal(true).optional()
|
|
3465
3469
|
}).strict();
|
|
3466
|
-
var PhoneChatRelaySchema =
|
|
3467
|
-
id:
|
|
3468
|
-
name:
|
|
3470
|
+
var PhoneChatRelaySchema = z39.object({
|
|
3471
|
+
id: z39.string().min(1),
|
|
3472
|
+
name: z39.string(),
|
|
3469
3473
|
tool: ToolSchema,
|
|
3470
|
-
text:
|
|
3471
|
-
status:
|
|
3472
|
-
sentAt:
|
|
3473
|
-
failed:
|
|
3474
|
+
text: z39.string().max(TOOL_TEXT_MAX),
|
|
3475
|
+
status: z39.enum(["queued", "sent"]).optional(),
|
|
3476
|
+
sentAt: z39.string().datetime().optional(),
|
|
3477
|
+
failed: z39.literal(true).optional(),
|
|
3474
3478
|
/** With `failed`: why, as the PC's code (never its text). */
|
|
3475
|
-
code:
|
|
3479
|
+
code: z39.string().max(40).optional()
|
|
3476
3480
|
}).strict();
|
|
3477
|
-
var CloseHowSchema =
|
|
3478
|
-
var PhoneChatCloseSchema =
|
|
3479
|
-
id:
|
|
3480
|
-
name:
|
|
3481
|
+
var CloseHowSchema = z39.enum(["exit", "killed"]);
|
|
3482
|
+
var PhoneChatCloseSchema = z39.object({
|
|
3483
|
+
id: z39.string().min(1),
|
|
3484
|
+
name: z39.string(),
|
|
3481
3485
|
tool: ToolSchema,
|
|
3482
3486
|
how: CloseHowSchema.optional(),
|
|
3483
|
-
closedAt:
|
|
3484
|
-
failed:
|
|
3487
|
+
closedAt: z39.string().datetime().optional(),
|
|
3488
|
+
failed: z39.literal(true).optional()
|
|
3485
3489
|
}).strict();
|
|
3486
|
-
var PhoneChatTaskSchema =
|
|
3487
|
-
to:
|
|
3488
|
-
toName:
|
|
3489
|
-
title:
|
|
3490
|
-
text:
|
|
3491
|
-
taskId:
|
|
3492
|
-
ownerName:
|
|
3493
|
-
state:
|
|
3494
|
-
failed:
|
|
3490
|
+
var PhoneChatTaskSchema = z39.object({
|
|
3491
|
+
to: z39.string().max(80),
|
|
3492
|
+
toName: z39.string().max(80).optional(),
|
|
3493
|
+
title: z39.string().max(200),
|
|
3494
|
+
text: z39.string().max(TOOL_TEXT_MAX).optional(),
|
|
3495
|
+
taskId: z39.string().max(40).optional(),
|
|
3496
|
+
ownerName: z39.string().max(80).optional(),
|
|
3497
|
+
state: z39.enum(["open", "taken", "done", "refused", "dropped"]).optional(),
|
|
3498
|
+
failed: z39.literal(true).optional()
|
|
3495
3499
|
}).strict();
|
|
3496
|
-
var PhoneChatActionSchema =
|
|
3497
|
-
action:
|
|
3498
|
-
summary:
|
|
3500
|
+
var PhoneChatActionSchema = z39.object({
|
|
3501
|
+
action: z39.string().min(1).max(40),
|
|
3502
|
+
summary: z39.string().max(300),
|
|
3499
3503
|
vars: ActionVarsSchema.optional(),
|
|
3500
|
-
detail:
|
|
3501
|
-
detailCut:
|
|
3504
|
+
detail: z39.string().max(TOOL_TEXT_MAX).optional(),
|
|
3505
|
+
detailCut: z39.literal(true).optional(),
|
|
3502
3506
|
risk: ActionRiskSchema,
|
|
3503
|
-
session:
|
|
3507
|
+
session: z39.string().max(100).optional(),
|
|
3504
3508
|
state: ChatActionStateSchema.optional(),
|
|
3505
|
-
doneAt:
|
|
3506
|
-
code:
|
|
3509
|
+
doneAt: z39.string().datetime().optional(),
|
|
3510
|
+
code: z39.string().max(40).optional()
|
|
3507
3511
|
}).strict();
|
|
3508
|
-
var PhoneTaskSchema =
|
|
3509
|
-
id:
|
|
3510
|
-
title:
|
|
3511
|
-
owner:
|
|
3512
|
-
ownerName:
|
|
3512
|
+
var PhoneTaskSchema = z39.object({
|
|
3513
|
+
id: z39.string().max(40),
|
|
3514
|
+
title: z39.string().max(200),
|
|
3515
|
+
owner: z39.string().max(100),
|
|
3516
|
+
ownerName: z39.string().max(80),
|
|
3513
3517
|
/** 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). */
|
|
3514
|
-
giver:
|
|
3515
|
-
giverName:
|
|
3516
|
-
text:
|
|
3517
|
-
state:
|
|
3518
|
-
result:
|
|
3519
|
-
cut:
|
|
3520
|
-
at:
|
|
3521
|
-
updatedAt:
|
|
3522
|
-
seen:
|
|
3518
|
+
giver: z39.string().max(100).optional(),
|
|
3519
|
+
giverName: z39.string().max(80).optional(),
|
|
3520
|
+
text: z39.string().max(TOOL_TEXT_MAX).optional(),
|
|
3521
|
+
state: z39.enum(["open", "taken", "done", "refused", "dropped"]),
|
|
3522
|
+
result: z39.string().max(TOOL_TEXT_MAX).optional(),
|
|
3523
|
+
cut: z39.literal(true).optional(),
|
|
3524
|
+
at: z39.string(),
|
|
3525
|
+
updatedAt: z39.string(),
|
|
3526
|
+
seen: z39.literal(true).optional(),
|
|
3523
3527
|
/** A proposal about the user's notes (brain spec §3.6): the phone answers it with its buttons (`brain.answer`). */
|
|
3524
3528
|
brain: BrainProposalSchema.optional(),
|
|
3525
3529
|
/** A routine's item (routines spec): an activation request the phone answers with `routine.cmd` (`approve` / `refuse`), or a failure (`run`). */
|
|
3526
3530
|
routine: TaskRoutineSchema.optional()
|
|
3527
3531
|
}).strict();
|
|
3528
|
-
var PhoneRoutineRefSchema =
|
|
3532
|
+
var PhoneRoutineRefSchema = z39.object({ routine: RoutineIdSchema, routineKey: RoutineKeySchema }).strict();
|
|
3529
3533
|
var PhoneRoutineSchema = RoutineSchema.omit({ prompt: true, target: true, runs: true, proposal: true }).extend({
|
|
3530
|
-
target: RoutineTargetSchema.extend({ cwd:
|
|
3531
|
-
cut:
|
|
3532
|
-
proposed:
|
|
3534
|
+
target: RoutineTargetSchema.extend({ cwd: z39.string().min(1).max(PHONE_ROUTINE_CWD_MAX) }),
|
|
3535
|
+
cut: z39.literal(true).optional(),
|
|
3536
|
+
proposed: z39.literal(true).optional(),
|
|
3533
3537
|
key: RoutineKeySchema
|
|
3534
3538
|
});
|
|
3535
3539
|
var PhoneRoutineDetailSchema = PhoneRoutineSchema.omit({ cut: true, proposed: true }).extend({
|
|
@@ -3538,109 +3542,111 @@ var PhoneRoutineDetailSchema = PhoneRoutineSchema.omit({ cut: true, proposed: tr
|
|
|
3538
3542
|
proposal: RoutineSchema.shape.proposal,
|
|
3539
3543
|
runs: RoutineSchema.shape.runs
|
|
3540
3544
|
});
|
|
3541
|
-
var ChatErrorCodeSchema =
|
|
3542
|
-
var ChatLimitsReadSchema =
|
|
3543
|
-
var ChatConversationSummarySchema =
|
|
3544
|
-
id:
|
|
3545
|
-
startedAt:
|
|
3546
|
-
lastAt:
|
|
3547
|
-
first:
|
|
3548
|
-
count:
|
|
3545
|
+
var ChatErrorCodeSchema = z39.enum(["busy", "timeout", "cancelled", "failed"]);
|
|
3546
|
+
var ChatLimitsReadSchema = z39.object({ qid: OperationIdSchema, at: z39.string().datetime() }).strict();
|
|
3547
|
+
var ChatConversationSummarySchema = z39.object({
|
|
3548
|
+
id: z39.string().uuid(),
|
|
3549
|
+
startedAt: z39.string().datetime(),
|
|
3550
|
+
lastAt: z39.string().datetime(),
|
|
3551
|
+
first: z39.string().max(200),
|
|
3552
|
+
count: z39.number().int().min(1)
|
|
3549
3553
|
}).strict();
|
|
3550
|
-
var PhoneChatTurnSchema =
|
|
3554
|
+
var PhoneChatTurnSchema = z39.object({
|
|
3551
3555
|
qid: OperationIdSchema,
|
|
3552
|
-
question:
|
|
3553
|
-
askedAt:
|
|
3554
|
-
steps:
|
|
3555
|
-
answer:
|
|
3556
|
-
answeredAt:
|
|
3556
|
+
question: z39.string().max(MESSAGE_MAX),
|
|
3557
|
+
askedAt: z39.string().datetime(),
|
|
3558
|
+
steps: z39.array(PhoneChatStepSchema).max(50),
|
|
3559
|
+
answer: z39.string().max(THREAD_TEXT_MAX).optional(),
|
|
3560
|
+
answeredAt: z39.string().datetime().optional(),
|
|
3557
3561
|
error: ChatErrorCodeSchema.optional(),
|
|
3558
|
-
proposals:
|
|
3562
|
+
proposals: z39.array(PhoneChatProposalSchema).max(MAX_PROPOSALS).optional(),
|
|
3559
3563
|
relay: PhoneChatRelaySchema.optional(),
|
|
3560
|
-
closes:
|
|
3561
|
-
cut:
|
|
3562
|
-
tasks:
|
|
3563
|
-
actions:
|
|
3564
|
-
ignoredAt:
|
|
3565
|
-
attachments:
|
|
3566
|
-
by:
|
|
3564
|
+
closes: z39.array(PhoneChatCloseSchema).min(1).max(MAX_PROPOSALS).optional(),
|
|
3565
|
+
cut: z39.literal(true).optional(),
|
|
3566
|
+
tasks: z39.array(PhoneChatTaskSchema).min(1).max(MAX_PROPOSALS).optional(),
|
|
3567
|
+
actions: z39.array(PhoneChatActionSchema).min(1).max(MAX_PROPOSALS).optional(),
|
|
3568
|
+
ignoredAt: z39.string().datetime().optional(),
|
|
3569
|
+
attachments: z39.array(AttachmentRefSchema).max(ATTACHMENTS_MAX).optional(),
|
|
3570
|
+
by: z39.literal("ledge").optional(),
|
|
3567
3571
|
point: ChatPointSchema.optional()
|
|
3568
3572
|
}).strict();
|
|
3569
|
-
var sessionId =
|
|
3570
|
-
var PhoneExpectSchema = PendingSchema.pick({ kind: true, text: true }).extend({ key:
|
|
3571
|
-
var CardRowsSchema =
|
|
3573
|
+
var sessionId = z39.string().min(1).max(100);
|
|
3574
|
+
var PhoneExpectSchema = PendingSchema.pick({ kind: true, text: true }).extend({ key: z39.string().min(1).max(64) });
|
|
3575
|
+
var CardRowsSchema = z39.array(z39.number().int().min(0).max(MAX_PROPOSALS - 1)).min(1).max(MAX_PROPOSALS).refine((r) => new Set(r).size === r.length, "a row twice");
|
|
3572
3576
|
var pcOp = { op: OperationIdSchema, assertion: AssertionSchema.optional() };
|
|
3573
3577
|
var PHONE_LAUNCH_FOLDERS_MAX = 20;
|
|
3574
|
-
var PhoneLaunchSchema =
|
|
3578
|
+
var PhoneLaunchSchema = z39.object({
|
|
3575
3579
|
project: ProjectIdSchema,
|
|
3576
3580
|
tool: ToolSchema,
|
|
3577
|
-
folders:
|
|
3578
|
-
prompt:
|
|
3581
|
+
folders: z39.array(FolderPathSchema).min(1).max(PHONE_LAUNCH_FOLDERS_MAX),
|
|
3582
|
+
prompt: z39.string().trim().min(1).max(MESSAGE_MAX),
|
|
3579
3583
|
model: ModelIdSchema.optional(),
|
|
3580
3584
|
effort: EffortSchema.optional(),
|
|
3581
3585
|
approval: OmpApprovalSchema.optional(),
|
|
3582
3586
|
/** Issue #15: the session's name (its address), cleaned as every name; taken: refused `name_taken`. Absent: the first free one. */
|
|
3583
|
-
name:
|
|
3587
|
+
name: z39.string().max(200).optional()
|
|
3584
3588
|
}).strict();
|
|
3585
|
-
var PcActionSchema =
|
|
3589
|
+
var PcActionSchema = z39.enum(["update", "restart"]);
|
|
3586
3590
|
var PHONE_FOLDER_ENTRIES_MAX = 500;
|
|
3587
|
-
var PhoneFolderErrorSchema =
|
|
3588
|
-
var PhoneFolderSchema =
|
|
3591
|
+
var PhoneFolderErrorSchema = z39.enum(["not_found", "not_folder", "unreadable"]);
|
|
3592
|
+
var PhoneFolderSchema = z39.object({
|
|
3589
3593
|
machine: MachineIdSchema,
|
|
3590
|
-
label:
|
|
3594
|
+
label: z39.string().max(80).optional(),
|
|
3591
3595
|
path: FolderPathSchema,
|
|
3592
|
-
exists:
|
|
3593
|
-
branch:
|
|
3596
|
+
exists: z39.boolean().optional(),
|
|
3597
|
+
branch: z39.string().max(200).nullable().optional()
|
|
3594
3598
|
});
|
|
3595
3599
|
var PHONE_RECENT_FOLDERS_MAX = 20;
|
|
3596
|
-
var TerminalIdSchema =
|
|
3600
|
+
var TerminalIdSchema = z39.string().regex(/^t_[A-Za-z0-9_-]{8,40}$/);
|
|
3597
3601
|
var TERM_INPUT_MAX = 4096;
|
|
3598
3602
|
var TERM_SCREEN_MAX = 65536;
|
|
3599
3603
|
var TERM_OUTPUT_MAX = 32768;
|
|
3600
|
-
var TermDimSchema =
|
|
3601
|
-
var TermReleaseWhySchema =
|
|
3602
|
-
var TermExitWhySchema =
|
|
3603
|
-
var DevicePrefsSchema =
|
|
3604
|
-
notify:
|
|
3604
|
+
var TermDimSchema = z39.number().int().min(1).max(1e4);
|
|
3605
|
+
var TermReleaseWhySchema = z39.enum(["asked", "pc", "idle", "expired", "background", "link"]);
|
|
3606
|
+
var TermExitWhySchema = z39.enum(["ended", "gone", "closed", "superseded", "failed"]);
|
|
3607
|
+
var DevicePrefsSchema = z39.object({
|
|
3608
|
+
notify: z39.object({
|
|
3605
3609
|
/** « Le point de Ledge » (the key keeps its first name, « Agent terminé »): the operator's point. */
|
|
3606
|
-
finished:
|
|
3610
|
+
finished: z39.boolean(),
|
|
3607
3611
|
/** « Réponse de Ledge »: the end of a question asked from this device. */
|
|
3608
|
-
chat:
|
|
3612
|
+
chat: z39.boolean(),
|
|
3609
3613
|
/** « Décision à prendre »: a session puts a decision to the user. */
|
|
3610
|
-
decision:
|
|
3614
|
+
decision: z39.boolean()
|
|
3611
3615
|
}),
|
|
3612
3616
|
/** No notification before this moment (a `resolved` still replaces one already shown); null: no pause. */
|
|
3613
|
-
quietUntil:
|
|
3617
|
+
quietUntil: z39.string().datetime().nullable(),
|
|
3614
3618
|
/** The agent of this device's chat with Ledge; null: the PC's (the one its own chat last used). */
|
|
3615
3619
|
chatTool: ToolSchema.nullable()
|
|
3616
3620
|
});
|
|
3617
|
-
var PhoneClientMessageSchema =
|
|
3618
|
-
|
|
3619
|
-
|
|
3621
|
+
var PhoneClientMessageSchema = z39.discriminatedUnion("type", [
|
|
3622
|
+
z39.object({ type: z39.literal("snapshot.request") }),
|
|
3623
|
+
z39.object({ type: z39.literal("session.thread"), id: sessionId }),
|
|
3620
3624
|
/** The session's request with its whole body (up to `PENDING_BODY_MAX`). */
|
|
3621
|
-
|
|
3625
|
+
z39.object({ type: z39.literal("session.pending"), id: sessionId }),
|
|
3622
3626
|
/** The session whose terminal the phone shows; null when it shows none. */
|
|
3623
|
-
|
|
3624
|
-
|
|
3627
|
+
z39.object({ type: z39.literal("session.watch"), id: sessionId.nullable() }),
|
|
3628
|
+
z39.object({ type: z39.literal("session.read"), id: sessionId, at: z39.string().datetime() }),
|
|
3625
3629
|
/**
|
|
3626
3630
|
* Asks for a challenge. One object for every purpose: the gateway refuses a `decide` without `id` and `expect`. A `close`
|
|
3627
3631
|
* or `act` names a turn of the chat (`qid`) or a session (`id`, for `session.close` and `session.resume`).
|
|
3628
3632
|
*/
|
|
3629
|
-
|
|
3630
|
-
type:
|
|
3633
|
+
z39.object({
|
|
3634
|
+
type: z39.literal("confirm.prepare"),
|
|
3631
3635
|
purpose: ConfirmPurposeSchema,
|
|
3632
3636
|
id: sessionId.optional(),
|
|
3633
3637
|
expect: PhoneExpectSchema.optional(),
|
|
3634
3638
|
qid: OperationIdSchema.optional(),
|
|
3635
3639
|
/** A `pc` challenge: what it is for, and for an update the version it covers. */
|
|
3636
3640
|
action: PcActionSchema.optional(),
|
|
3637
|
-
version:
|
|
3641
|
+
version: z39.string().regex(SEMVER).optional(),
|
|
3638
3642
|
/** A `rig` challenge: the OpenRig row and the exact answer it covers. */
|
|
3639
|
-
qitem:
|
|
3643
|
+
qitem: z39.string().min(1).max(200).optional(),
|
|
3640
3644
|
answer: HumanAnswerSchema.optional(),
|
|
3641
3645
|
/** A `note` challenge: the proposal (a task) and the exact choice it covers. */
|
|
3642
|
-
task:
|
|
3646
|
+
task: z39.string().min(1).max(40).optional(),
|
|
3643
3647
|
choice: BrainChoiceSchema.optional(),
|
|
3648
|
+
/** A `decision` challenge (#40): the decision (`task`) and the exact answer it covers, as `task.answer` will send it. */
|
|
3649
|
+
taskAnswer: z39.string().trim().min(1).max(TASK_TEXT_MAX).optional(),
|
|
3644
3650
|
/** A `project` challenge: the project deleted and where its agents go (null: no project). */
|
|
3645
3651
|
project: ProjectIdSchema.optional(),
|
|
3646
3652
|
moveTo: ProjectIdSchema.nullable().optional(),
|
|
@@ -3650,76 +3656,76 @@ var PhoneClientMessageSchema = z40.discriminatedUnion("type", [
|
|
|
3650
3656
|
newProject: ProjectNameSchema.optional(),
|
|
3651
3657
|
/** A `rigs` challenge: the action (`rigAct`) or the change of seats (`rigSeats`) it covers, exactly as it will be sent. */
|
|
3652
3658
|
rigAct: OpenRigActionSchema.optional(),
|
|
3653
|
-
rigSeats:
|
|
3659
|
+
rigSeats: z39.object({ rig: RigNameSchema, seats: RigSeatCountsSchema }).strict().optional(),
|
|
3654
3660
|
/** An `act` challenge for a point row (`qid` and `item`): bound to that row and to its `pointAnswer`, or to its suggestion when `suggest`. */
|
|
3655
|
-
item:
|
|
3661
|
+
item: z39.string().min(1).max(200).optional(),
|
|
3656
3662
|
pointAnswer: PointAnswerSchema.optional(),
|
|
3657
|
-
suggest:
|
|
3663
|
+
suggest: z39.literal(true).optional(),
|
|
3658
3664
|
/** A `launch` challenge without `qid`: the « Nouvelle session » it covers, exactly as it will be sent. */
|
|
3659
3665
|
launch: PhoneLaunchSchema.optional(),
|
|
3660
3666
|
/** A `forge` challenge: the request and the action it covers, exactly as they will be sent. */
|
|
3661
|
-
forge:
|
|
3667
|
+
forge: z39.object({ prId: z39.string().min(1).max(500), action: ForgeActionSchema }).strict().optional(),
|
|
3662
3668
|
/** A `routine` challenge: the pending routine its « Activer » covers, and its key as the phone showed it; `routineOthers`, the
|
|
3663
3669
|
* other routines of a grouped request « Activer les N » covers with the same check. */
|
|
3664
3670
|
routine: RoutineIdSchema.optional(),
|
|
3665
3671
|
routineKey: RoutineKeySchema.optional(),
|
|
3666
|
-
routineOthers:
|
|
3672
|
+
routineOthers: z39.array(PhoneRoutineRefSchema).max(ROUTINES_ACTIVE_MAX - 1).optional()
|
|
3667
3673
|
}),
|
|
3668
3674
|
/** `userId`: the passkey's `user.id` as the phone made it (« L1 » ‖ the PC key's digest ‖ random, docs/mobile-passkey-recover-contract.md);
|
|
3669
3675
|
* given and made for this PC, the passkey can bring the device back after a reinstall (the snapshot's `device.recover`). */
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
type:
|
|
3676
|
+
z39.object({ type: z39.literal("credential.register"), op: OperationIdSchema, credential: CredentialSchema, userId: B64U3.max(128).optional() }),
|
|
3677
|
+
z39.object({
|
|
3678
|
+
type: z39.literal("session.decide"),
|
|
3673
3679
|
op: OperationIdSchema,
|
|
3674
3680
|
id: sessionId,
|
|
3675
3681
|
decision: DecisionSchema,
|
|
3676
|
-
note:
|
|
3682
|
+
note: z39.string().trim().min(1).max(NOTE_MAX).optional(),
|
|
3677
3683
|
/** The request the phone showed: refused unless it is still the pending one. */
|
|
3678
3684
|
expect: PhoneExpectSchema,
|
|
3679
3685
|
/** The device check over the challenge of `confirm.prepare`; required by the daemon for a high-risk accept. */
|
|
3680
3686
|
assertion: AssertionSchema.optional()
|
|
3681
3687
|
}),
|
|
3682
|
-
|
|
3683
|
-
type:
|
|
3688
|
+
z39.object({
|
|
3689
|
+
type: z39.literal("session.reply"),
|
|
3684
3690
|
op: OperationIdSchema,
|
|
3685
3691
|
id: sessionId,
|
|
3686
|
-
text:
|
|
3687
|
-
attachments:
|
|
3692
|
+
text: z39.string().max(MESSAGE_MAX),
|
|
3693
|
+
attachments: z39.array(AttachmentIdSchema).max(ATTACHMENTS_MAX).optional(),
|
|
3688
3694
|
/** The request the reply answers, or null when the phone showed none: refused if the session's request is no longer that one. */
|
|
3689
3695
|
expect: PhoneExpectSchema.nullable(),
|
|
3690
3696
|
assertion: AssertionSchema.optional()
|
|
3691
3697
|
}),
|
|
3692
3698
|
/** OMP's `ask`: the answers to every question of the dialog `requestId`, in order; `cancel` declines it. Bounds as the local `session.answer`. */
|
|
3693
|
-
|
|
3694
|
-
type:
|
|
3699
|
+
z39.object({
|
|
3700
|
+
type: z39.literal("session.answer"),
|
|
3695
3701
|
op: OperationIdSchema,
|
|
3696
3702
|
id: sessionId,
|
|
3697
|
-
requestId:
|
|
3698
|
-
answers:
|
|
3699
|
-
cancel:
|
|
3703
|
+
requestId: z39.string().min(1).max(200),
|
|
3704
|
+
answers: z39.array(z39.object({ id: z39.string().max(200), selected: z39.array(z39.string().max(2e3)).max(100), text: z39.string().max(2e4).optional() })).max(50),
|
|
3705
|
+
cancel: z39.literal(true).optional(),
|
|
3700
3706
|
expect: PhoneExpectSchema
|
|
3701
3707
|
}),
|
|
3702
|
-
|
|
3708
|
+
z39.object({ type: z39.literal("session.interrupt"), op: OperationIdSchema, id: sessionId }),
|
|
3703
3709
|
/** Ends a live session as `/exit` would, killed as a last resort; answered with its `how`. Passkey, purpose `close`, over the session. */
|
|
3704
|
-
|
|
3710
|
+
z39.object({ type: z39.literal("session.close"), op: OperationIdSchema, id: sessionId, assertion: AssertionSchema.optional() }),
|
|
3705
3711
|
/** Starts an ended session again on its conversation. Passkey, purpose `act`, over the session. */
|
|
3706
|
-
|
|
3712
|
+
z39.object({ type: z39.literal("session.resume"), op: OperationIdSchema, id: sessionId, assertion: AssertionSchema.optional() }),
|
|
3707
3713
|
/** 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`. */
|
|
3708
|
-
|
|
3714
|
+
z39.object({ type: z39.literal("session.model"), op: OperationIdSchema, id: sessionId, model: ModelIdSchema.nullable(), effort: EffortSchema.nullable() }),
|
|
3709
3715
|
/** One message to several sessions (ids); answered by `operation.result` with `sent` and `refused`. */
|
|
3710
|
-
|
|
3716
|
+
z39.object({ type: z39.literal("session.broadcast"), op: OperationIdSchema, sessions: z39.array(sessionId).min(1).max(BROADCAST_SESSIONS_MAX), text: z39.string().trim().min(1).max(MESSAGE_MAX) }).strict(),
|
|
3711
3717
|
/** The models an agent offers on the PC. */
|
|
3712
|
-
|
|
3718
|
+
z39.object({ type: z39.literal("models.list"), tool: ToolSchema }),
|
|
3713
3719
|
/** The slash commands of a session's agent, for the « / » list of its field. */
|
|
3714
|
-
|
|
3720
|
+
z39.object({ type: z39.literal("session.commands"), id: sessionId }),
|
|
3715
3721
|
/** A queue row's state, for an OpenRig task card: asked while the card shows and every `RIG_ROW_REFRESH_MS` (`daemon.rigRows`). */
|
|
3716
|
-
|
|
3722
|
+
z39.object({ type: z39.literal("openrig.row"), qitem: QitemIdSchema }),
|
|
3717
3723
|
/** The phone drops its passkey from the daemon. */
|
|
3718
|
-
|
|
3724
|
+
z39.object({ type: z39.literal("device.forget"), op: OperationIdSchema }),
|
|
3719
3725
|
/** The device names itself (on the PC and in its next snapshot); applied to the sender only. */
|
|
3720
|
-
|
|
3726
|
+
z39.object({ type: z39.literal("device.rename"), op: OperationIdSchema, name: DeviceNameSchema }),
|
|
3721
3727
|
/** The device's own settings, whole (`daemon.settings`): applied to the sender only, told back in its next snapshot. */
|
|
3722
|
-
|
|
3728
|
+
z39.object({ type: z39.literal("device.prefs"), op: OperationIdSchema, prefs: z39.object({
|
|
3723
3729
|
notify: DevicePrefsSchema.shape.notify.strict(),
|
|
3724
3730
|
quietUntil: DevicePrefsSchema.shape.quietUntil,
|
|
3725
3731
|
chatTool: DevicePrefsSchema.shape.chatTool
|
|
@@ -3729,447 +3735,452 @@ var PhoneClientMessageSchema = z40.discriminatedUnion("type", [
|
|
|
3729
3735
|
* 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
|
|
3730
3736
|
* new project. A deletion carries the device's check over the project and `moveTo` (purpose `project`).
|
|
3731
3737
|
*/
|
|
3732
|
-
|
|
3733
|
-
|
|
3738
|
+
z39.object({ type: z39.literal("project.edit"), op: OperationIdSchema, id: ProjectIdSchema, name: ProjectNameSchema.optional(), color: ProjectColorSchema.optional() }).strict(),
|
|
3739
|
+
z39.object({ type: z39.literal("project.order"), op: OperationIdSchema, ids: z39.array(ProjectIdSchema).min(1).max(PHONE_PROJECTS_MAX) }).strict(),
|
|
3734
3740
|
/** Issue #16: some of a project's sessions (`project` null: « Sans projet ») in a new order, this PC's ids; the others keep their
|
|
3735
3741
|
* places (placeSessions). A session not in that project, or one gone, makes it stale. */
|
|
3736
|
-
|
|
3742
|
+
z39.object({ type: z39.literal("session.order"), op: OperationIdSchema, project: ProjectIdSchema.nullable(), ids: z39.array(z39.string().min(1).max(200)).min(1).max(SESSION_ORDER_MAX) }).strict(),
|
|
3737
3743
|
/** Issue #2: with its first folder (`path`, of this PC) and the device's check over that name and folder (`newProjectSubject`). A
|
|
3738
3744
|
* create without it, from an older phone, is refused `folder_required`. */
|
|
3739
|
-
|
|
3740
|
-
type:
|
|
3745
|
+
z39.object({
|
|
3746
|
+
type: z39.literal("project.create"),
|
|
3741
3747
|
op: OperationIdSchema,
|
|
3742
3748
|
name: ProjectNameSchema,
|
|
3743
3749
|
color: ProjectColorSchema,
|
|
3744
3750
|
path: FolderPathSchema.optional(),
|
|
3745
3751
|
assertion: AssertionSchema.optional()
|
|
3746
3752
|
}).strict(),
|
|
3747
|
-
|
|
3753
|
+
z39.object({ type: z39.literal("project.delete"), op: OperationIdSchema, id: ProjectIdSchema, moveTo: ProjectIdSchema.nullable(), assertion: AssertionSchema.optional() }).strict(),
|
|
3748
3754
|
/**
|
|
3749
3755
|
* A project's folders (`daemon.projectFolders`): browsing this PC's folders, its recent ones, a project's folders, then adding one
|
|
3750
3756
|
* of this PC (with the device's check, purpose `folder`) or removing one. Reads are answered to the asker alone.
|
|
3751
3757
|
*/
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3758
|
+
z39.object({ type: z39.literal("folder.list"), path: FolderPathSchema.optional() }).strict(),
|
|
3759
|
+
z39.object({ type: z39.literal("folder.recents") }).strict(),
|
|
3760
|
+
z39.object({ type: z39.literal("project.folders"), id: ProjectIdSchema }).strict(),
|
|
3761
|
+
z39.object({ type: z39.literal("project.folder.add"), op: OperationIdSchema, id: ProjectIdSchema, path: FolderPathSchema, assertion: AssertionSchema.optional() }).strict(),
|
|
3762
|
+
z39.object({ type: z39.literal("project.folder.remove"), op: OperationIdSchema, id: ProjectIdSchema, machine: MachineIdSchema, path: FolderPathSchema }).strict(),
|
|
3757
3763
|
/** « Contexte max », the PC's threshold shared by every front (`daemon.settings`): as the desktop's `context.set`. */
|
|
3758
|
-
|
|
3764
|
+
z39.object({ type: z39.literal("context.set"), op: OperationIdSchema, near: ContextPrefsSchema.shape.near }).strict(),
|
|
3759
3765
|
/** The phone's push subscription, with the VAPID key it was made with (so a key change is seen). `resolved`: its service
|
|
3760
3766
|
* worker shows a `resolved` push, which replaces a request's notification once it is answered elsewhere. */
|
|
3761
|
-
|
|
3762
|
-
|
|
3767
|
+
z39.object({ type: z39.literal("push.subscribe"), op: OperationIdSchema, subscription: PushSubscriptionSchema, key: B64U3.length(87), resolved: z39.literal(true).optional() }),
|
|
3768
|
+
z39.object({ type: z39.literal("push.unsubscribe"), op: OperationIdSchema }),
|
|
3763
3769
|
/** The phone's own chat with Ledge. */
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3770
|
+
z39.object({ type: z39.literal("chat.ask"), qid: OperationIdSchema, text: z39.string().trim().max(MESSAGE_MAX), attachments: z39.array(AttachmentIdSchema).max(ATTACHMENTS_MAX).optional() }),
|
|
3771
|
+
z39.object({ type: z39.literal("chat.cancel"), qid: OperationIdSchema }),
|
|
3772
|
+
z39.object({ type: z39.literal("chat.reset") }),
|
|
3773
|
+
z39.object({ type: z39.literal("chat.history") }),
|
|
3768
3774
|
/** The device's conversations, and one of them (`daemon.conversations`): answered to the asker alone. */
|
|
3769
|
-
|
|
3770
|
-
|
|
3775
|
+
z39.object({ type: z39.literal("chat.conversations") }).strict(),
|
|
3776
|
+
z39.object({ type: z39.literal("chat.conversation"), id: z39.string().uuid() }).strict(),
|
|
3771
3777
|
/** An image to store, sent alone before the message that names it; no `id`, and at most `ATTACHMENT_MAX` bytes. */
|
|
3772
|
-
AttachmentPutSchema.pick({ type: true, requestId: true }).extend({ image: ImageUploadSchema.extend({ data:
|
|
3778
|
+
AttachmentPutSchema.pick({ type: true, requestId: true }).extend({ image: ImageUploadSchema.extend({ data: z39.string().min(1).max(b64Max(ATTACHMENT_MAX)) }) }),
|
|
3773
3779
|
AttachmentGetSchema.pick({ type: true, requestId: true, attachment: true, preview: true }),
|
|
3774
|
-
|
|
3780
|
+
z39.object({ type: z39.literal("chat.relay"), op: OperationIdSchema, qid: OperationIdSchema }),
|
|
3775
3781
|
/** Takes the card's queued instruction back out of the queue, as the local `session.relay.cancel`. */
|
|
3776
|
-
|
|
3777
|
-
|
|
3782
|
+
z39.object({ type: z39.literal("chat.relay.cancel"), op: OperationIdSchema, qid: OperationIdSchema }),
|
|
3783
|
+
z39.object({ type: z39.literal("chat.launch"), op: OperationIdSchema, qid: OperationIdSchema, rows: CardRowsSchema.optional(), assertion: AssertionSchema.optional() }),
|
|
3778
3784
|
/** « Nouvelle session » (M2 §9): passkey, purpose `launch`, over this very launch. Applied, its result names the new session (`id`). */
|
|
3779
|
-
|
|
3780
|
-
|
|
3785
|
+
z39.object({ type: z39.literal("session.launch"), op: OperationIdSchema, launch: PhoneLaunchSchema, assertion: AssertionSchema.optional() }).strict(),
|
|
3786
|
+
z39.object({ type: z39.literal("chat.close"), op: OperationIdSchema, qid: OperationIdSchema, rows: CardRowsSchema.optional(), assertion: AssertionSchema.optional() }),
|
|
3781
3787
|
/** A row of the turn's task card: given by Ledge. */
|
|
3782
|
-
|
|
3788
|
+
z39.object({ type: z39.literal("chat.task"), op: OperationIdSchema, qid: OperationIdSchema, row: z39.number().int().min(0).max(MAX_PROPOSALS - 1) }),
|
|
3783
3789
|
/** Rows of the turn's generic card (action registry spec §5): `confirmed` as the local `chat.act`; a row whose action asks
|
|
3784
3790
|
* for a device check (`phone`) needs one assertion, purpose `act`, over the turn. */
|
|
3785
|
-
|
|
3786
|
-
type:
|
|
3791
|
+
z39.object({
|
|
3792
|
+
type: z39.literal("chat.act"),
|
|
3787
3793
|
op: OperationIdSchema,
|
|
3788
3794
|
qid: OperationIdSchema,
|
|
3789
3795
|
rows: CardRowsSchema.optional(),
|
|
3790
|
-
confirmed:
|
|
3796
|
+
confirmed: z39.literal(true).optional(),
|
|
3791
3797
|
assertion: AssertionSchema.optional(),
|
|
3792
3798
|
/** « Refuser », as the local `chat.act`: no passkey, no confirmation. */
|
|
3793
|
-
deny:
|
|
3799
|
+
deny: z39.literal(true).optional()
|
|
3794
3800
|
}),
|
|
3795
3801
|
/** « Ignorer » the turn's cards, or `undo` (« Revoir »), as the local `chat.ignore`. */
|
|
3796
|
-
|
|
3802
|
+
z39.object({ type: z39.literal("chat.ignore"), op: OperationIdSchema, qid: OperationIdSchema, undo: z39.literal(true).optional() }),
|
|
3797
3803
|
/** The operator's point: `point.act` answers a row, `point.later` sets the point aside, `operator.read` marks events read for this device. */
|
|
3798
|
-
|
|
3799
|
-
type:
|
|
3804
|
+
z39.object({
|
|
3805
|
+
type: z39.literal("point.act"),
|
|
3800
3806
|
op: OperationIdSchema,
|
|
3801
3807
|
qid: OperationIdSchema,
|
|
3802
|
-
item:
|
|
3808
|
+
item: z39.string().min(1).max(200),
|
|
3803
3809
|
answer: PointAnswerSchema.optional(),
|
|
3804
3810
|
/** Applies the row's suggestion instead of answering it (exactly one of `answer` and `suggest`). */
|
|
3805
|
-
suggest:
|
|
3811
|
+
suggest: z39.literal(true).optional(),
|
|
3806
3812
|
/** A destructive answer says it was confirmed on the phone; the device check (`assertion`) is bound to this item and this answer. */
|
|
3807
|
-
confirmed:
|
|
3813
|
+
confirmed: z39.literal(true).optional(),
|
|
3808
3814
|
assertion: AssertionSchema.optional()
|
|
3809
3815
|
}),
|
|
3810
|
-
|
|
3811
|
-
|
|
3816
|
+
z39.object({ type: z39.literal("point.later"), op: OperationIdSchema, qid: OperationIdSchema }),
|
|
3817
|
+
z39.object({ type: z39.literal("operator.read"), op: OperationIdSchema, eventId: z39.number().int().min(0) }),
|
|
3812
3818
|
/** 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
|
|
3813
3819
|
* task and that exact choice; a `no` needs none. */
|
|
3814
|
-
|
|
3820
|
+
z39.object({ type: z39.literal("brain.answer"), op: OperationIdSchema, task: z39.string().min(1).max(40), choice: BrainChoiceSchema, assertion: AssertionSchema.optional() }),
|
|
3821
|
+
/** The user's answer to a decision a session put to them (`ledge task give ledge`, #40): destructive, so always `confirmed`, and backed
|
|
3822
|
+
* by an assertion of purpose `decision` bound to that decision and that exact answer. Sent only to a daemon with `daemon.taskAnswer`. */
|
|
3823
|
+
z39.object({ type: z39.literal("task.answer"), op: OperationIdSchema, task: z39.string().min(1).max(40), answer: z39.string().trim().min(1).max(TASK_TEXT_MAX), confirmed: z39.literal(true), assertion: AssertionSchema.optional() }).strict(),
|
|
3815
3824
|
/** Puts a closed task Ledge gave away from « À traiter ». */
|
|
3816
|
-
|
|
3825
|
+
z39.object({ type: z39.literal("task.seen"), op: OperationIdSchema, task: z39.string().min(1).max(40) }),
|
|
3817
3826
|
/** The routines (routines spec §3.7): answered by `routines`, then each change comes as `routine.changed`. */
|
|
3818
|
-
|
|
3827
|
+
z39.object({ type: z39.literal("routine.list") }).strict(),
|
|
3819
3828
|
/** One routine whole, its prompt included: answered by `routine.detail`. The phone shows it before « Activer ». */
|
|
3820
|
-
|
|
3829
|
+
z39.object({ type: z39.literal("routine.show"), routine: RoutineIdSchema }).strict(),
|
|
3821
3830
|
/** « Lancer maintenant », « Pause » / « Reprendre », and « Activer » / « Refuser » from « À toi »; answered by `operation.result`.
|
|
3822
3831
|
* An `approve` names the key of the routine the phone showed (`routineKey`, refused as `stale` once it changed) and carries an
|
|
3823
3832
|
* assertion of purpose `routine` bound to that routine and that key. */
|
|
3824
|
-
|
|
3825
|
-
type:
|
|
3833
|
+
z39.object({
|
|
3834
|
+
type: z39.literal("routine.cmd"),
|
|
3826
3835
|
op: OperationIdSchema,
|
|
3827
3836
|
action: PhoneRoutineActionSchema,
|
|
3828
3837
|
routine: RoutineIdSchema,
|
|
3829
3838
|
routineKey: RoutineKeySchema.optional(),
|
|
3830
3839
|
/** « Activer les N » / « Refuser les N » of a grouped request: the other routines, each with the key the phone showed; an approve's
|
|
3831
3840
|
* one assertion covers them all. */
|
|
3832
|
-
others:
|
|
3841
|
+
others: z39.array(PhoneRoutineRefSchema).max(ROUTINES_ACTIVE_MAX - 1).optional(),
|
|
3833
3842
|
assertion: AssertionSchema.optional()
|
|
3834
3843
|
}).strict(),
|
|
3835
3844
|
/** Streams a session's pane, read-only; answered by `term.opened` or `operation.result` (rejected). `helper`: one of the
|
|
3836
3845
|
* session's subagents (`helpers[].id`), whose terminal is its parent's, read-only for good (`term.opened.readOnly`). */
|
|
3837
|
-
|
|
3846
|
+
z39.object({ type: z39.literal("term.open"), op: OperationIdSchema, id: sessionId, helper: z39.string().min(1).max(200).optional() }),
|
|
3838
3847
|
/** « Prendre la main »: passkey, purpose `terminal`, over the session; answered by `term.held` or `operation.result` (rejected). */
|
|
3839
|
-
|
|
3848
|
+
z39.object({ type: z39.literal("term.hold"), op: OperationIdSchema, tid: TerminalIdSchema, assertion: AssertionSchema.optional() }),
|
|
3840
3849
|
/** 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. */
|
|
3841
|
-
|
|
3850
|
+
z39.object({ type: z39.literal("term.input"), tid: TerminalIdSchema, n: z39.number().int().nonnegative(), data: z39.string().min(1).max(TERM_INPUT_MAX) }),
|
|
3842
3851
|
/** « Rendre la main »: back to read-only. */
|
|
3843
|
-
|
|
3852
|
+
z39.object({ type: z39.literal("term.release"), tid: TerminalIdSchema }),
|
|
3844
3853
|
/** The phone saw a gap in `seq`: a fresh `term.opened`, please. */
|
|
3845
|
-
|
|
3846
|
-
|
|
3854
|
+
z39.object({ type: z39.literal("term.resync"), tid: TerminalIdSchema }),
|
|
3855
|
+
z39.object({ type: z39.literal("term.close"), tid: TerminalIdSchema }),
|
|
3847
3856
|
/** Whether the phone's app is in front: a device that is visible gets no push. */
|
|
3848
|
-
|
|
3857
|
+
z39.object({ type: z39.literal("presence"), visible: z39.boolean() }),
|
|
3849
3858
|
/** « À toi » (lot 3): what OpenRig on this PC asks the person, then pushed whole when it changes (`openrig.asks`). */
|
|
3850
|
-
|
|
3859
|
+
z39.object({ type: z39.literal("openrig.asks") }),
|
|
3851
3860
|
/** 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
|
|
3852
3861
|
* answer; « Vu » (`seen`) needs none. */
|
|
3853
|
-
|
|
3862
|
+
z39.object({ type: z39.literal("openrig.answer"), op: OperationIdSchema, qitemId: z39.string().min(1).max(200), answer: HumanAnswerSchema, assertion: AssertionSchema.optional() }),
|
|
3854
3863
|
/** Installs `version` on the PC, then restarts its daemon; the phone asks for its own build's version. Passkey, purpose `pc`. */
|
|
3855
|
-
|
|
3864
|
+
z39.object({ type: z39.literal("daemon.update"), ...pcOp, version: z39.string().regex(SEMVER) }).strict(),
|
|
3856
3865
|
/** Restarts the PC's daemon without installing anything. Passkey, purpose `pc`. */
|
|
3857
|
-
|
|
3866
|
+
z39.object({ type: z39.literal("daemon.restart"), ...pcOp }).strict(),
|
|
3858
3867
|
// ── Rigs and the kernel (`daemon.rigs`, docs/mobile-openrig-contract.md) ──
|
|
3859
3868
|
/** OpenRig on this PC, answered by `rigs.state`, then each change, whole, while the phone follows. */
|
|
3860
|
-
|
|
3861
|
-
|
|
3869
|
+
z39.object({ type: z39.literal("rigs.state") }).strict(),
|
|
3870
|
+
z39.object({ type: z39.literal("rigs.graph"), rig: RigNameSchema }).strict(),
|
|
3862
3871
|
/** A rig's open rows and its recently closed ones. */
|
|
3863
|
-
|
|
3872
|
+
z39.object({ type: z39.literal("rigs.queue"), rig: RigNameSchema }).strict(),
|
|
3864
3873
|
/** The queue's routing on this PC: the latest claims, handoffs, blocks and closes, every rig. */
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
|
|
3874
|
+
z39.object({ type: z39.literal("rigs.routing") }).strict(),
|
|
3875
|
+
z39.object({ type: z39.literal("rigs.permissions"), rig: RigNameSchema }).strict(),
|
|
3876
|
+
z39.object({ type: z39.literal("rigs.snapshots"), rig: RigNameSchema }).strict(),
|
|
3868
3877
|
/** The goals given to the operator, answered by `rigs.goals`, then each change, whole, while the phone follows. */
|
|
3869
|
-
|
|
3878
|
+
z39.object({ type: z39.literal("rigs.goals") }).strict(),
|
|
3870
3879
|
/** An action on OpenRig, every kind the Desktop's `openrig.act` takes. One that `rigActNeedsCheck` names carries a passkey, purpose `rigs`. */
|
|
3871
|
-
|
|
3880
|
+
z39.object({ type: z39.literal("rigs.act"), op: OperationIdSchema, action: OpenRigActionSchema, assertion: AssertionSchema.optional() }).strict(),
|
|
3872
3881
|
// ── Pull and merge requests (`daemon.forge`, docs/mobile-forge-contract.md) ──
|
|
3873
3882
|
/** The requests of this PC's sessions and seats; subscribes the device to each change. */
|
|
3874
|
-
|
|
3883
|
+
z39.object({ type: z39.literal("forge.state") }).strict(),
|
|
3875
3884
|
/** A request's detail; `log`: also that job's last lines. */
|
|
3876
|
-
|
|
3885
|
+
z39.object({ type: z39.literal("forge.detail"), prId: z39.string().min(1).max(500), log: z39.string().min(1).max(40).optional() }).strict(),
|
|
3877
3886
|
/** 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`). */
|
|
3878
|
-
|
|
3887
|
+
z39.object({ type: z39.literal("forge.act"), op: OperationIdSchema, prId: z39.string().min(1).max(500), action: ForgeActionSchema, assertion: AssertionSchema.optional() }).strict(),
|
|
3879
3888
|
/** A running rig's seats per role (the Desktop's `openrig.seats`). One that removes a seat carries a passkey, purpose `rigs`. */
|
|
3880
|
-
|
|
3889
|
+
z39.object({ type: z39.literal("rigs.seats"), op: OperationIdSchema, rig: RigNameSchema, seats: RigSeatCountsSchema, delegation: z39.enum(["pairs", "all"]).optional(), assertion: AssertionSchema.optional() }).strict(),
|
|
3881
3890
|
/** A goal to the operator (the Desktop's `openrig.goal.send`); `goalId` is the phone's, the same for a retry. */
|
|
3882
|
-
|
|
3891
|
+
z39.object({ type: z39.literal("rigs.goal.send"), op: OperationIdSchema, goalId: z39.string().regex(/^[A-Za-z0-9-]{8,64}$/), text: z39.string().trim().min(1).max(8e3), folder: z39.string().min(1).max(4096).optional() }).strict(),
|
|
3883
3892
|
/** 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. */
|
|
3884
|
-
|
|
3893
|
+
z39.object({ type: z39.literal("rigs.goal.reply"), op: OperationIdSchema, goalId: z39.string().regex(/^[A-Za-z0-9-]{8,64}$/), replyId: z39.string().regex(/^[A-Za-z0-9-]{8,64}$/), text: z39.string().trim().min(1).max(8e3) }).strict()
|
|
3885
3894
|
]);
|
|
3886
|
-
var PhoneModelChoiceSchema =
|
|
3895
|
+
var PhoneModelChoiceSchema = z39.object({
|
|
3887
3896
|
id: ModelChoiceSchema.shape.id.max(120),
|
|
3888
|
-
label:
|
|
3889
|
-
description:
|
|
3890
|
-
efforts:
|
|
3897
|
+
label: z39.string().max(80),
|
|
3898
|
+
description: z39.string().max(200).optional(),
|
|
3899
|
+
efforts: z39.array(EffortSchema).max(8).optional(),
|
|
3891
3900
|
defaultEffort: EffortSchema.optional(),
|
|
3892
|
-
isDefault:
|
|
3901
|
+
isDefault: z39.boolean().optional()
|
|
3893
3902
|
}).strict();
|
|
3894
3903
|
var PHONE_COMMANDS_MAX = 300;
|
|
3895
|
-
var PhoneSlashCommandSchema = SlashCommandSchema.extend({ description:
|
|
3904
|
+
var PhoneSlashCommandSchema = SlashCommandSchema.extend({ description: z39.string().max(200).optional() }).strict();
|
|
3896
3905
|
var PhoneHarnessUsageSchema = HarnessUsageSchema.omit({ account: true }).strict();
|
|
3897
|
-
var PhoneServerMessageSchema =
|
|
3906
|
+
var PhoneServerMessageSchema = z39.discriminatedUnion("type", [
|
|
3898
3907
|
/** This PC's harness limits (`daemon.usage`): after `snapshot.request`, then on each change, whole. `prefs.alert`: the PC's
|
|
3899
3908
|
* threshold, so the phone marks a window past it (amber, a line in « À toi ») and one reached (red). */
|
|
3900
|
-
|
|
3901
|
-
|
|
3902
|
-
type:
|
|
3903
|
-
protocol:
|
|
3904
|
-
sessions:
|
|
3909
|
+
z39.object({ type: z39.literal("usage.state"), harnesses: z39.preprocess(dropUnknownHarnesses, z39.array(PhoneHarnessUsageSchema).max(4)), prefs: UsagePrefsSchema }),
|
|
3910
|
+
z39.object({
|
|
3911
|
+
type: z39.literal("snapshot"),
|
|
3912
|
+
protocol: z39.literal(PHONE_PROTOCOL),
|
|
3913
|
+
sessions: z39.array(PhoneSessionSchema),
|
|
3905
3914
|
capabilities: CapabilitiesByToolSchema,
|
|
3906
|
-
daemon:
|
|
3907
|
-
version:
|
|
3908
|
-
name:
|
|
3909
|
-
boot:
|
|
3915
|
+
daemon: z39.object({
|
|
3916
|
+
version: z39.string(),
|
|
3917
|
+
name: z39.string().max(40),
|
|
3918
|
+
boot: z39.string().uuid().optional(),
|
|
3910
3919
|
/** The daemon takes `session.model`. */
|
|
3911
|
-
models:
|
|
3920
|
+
models: z39.literal(true).optional(),
|
|
3912
3921
|
/** The daemon sends `session.checklist` and a session's `checklist` summary. */
|
|
3913
|
-
checklist:
|
|
3922
|
+
checklist: z39.literal(true).optional(),
|
|
3914
3923
|
/** `update`: the daemon can install a version and restart (npm, systemd); `restart`: it can restart (systemd). */
|
|
3915
|
-
update:
|
|
3916
|
-
restart:
|
|
3924
|
+
update: z39.literal(true).optional(),
|
|
3925
|
+
restart: z39.literal(true).optional(),
|
|
3917
3926
|
/** The daemon takes `session.close` and `session.resume`. */
|
|
3918
|
-
sessionClose:
|
|
3927
|
+
sessionClose: z39.literal(true).optional(),
|
|
3919
3928
|
/** The daemon streams a session's terminal (`term.open`). */
|
|
3920
|
-
terminal:
|
|
3929
|
+
terminal: z39.literal(true).optional(),
|
|
3921
3930
|
/** The PC lets a phone type into a terminal (`term.hold`): its setting is on. */
|
|
3922
|
-
terminalInput:
|
|
3931
|
+
terminalInput: z39.literal(true).optional(),
|
|
3923
3932
|
/** `term.open` takes `helper`: a subagent's terminal is its parent's, read-only for good. Absent (an older PC, which would drop
|
|
3924
3933
|
* `helper` and open the parent's pane as its own): the phone opens no subagent's terminal. */
|
|
3925
|
-
helperTerminal:
|
|
3934
|
+
helperTerminal: z39.literal(true).optional(),
|
|
3926
3935
|
/** The daemon answers `session.commands`. */
|
|
3927
|
-
commands:
|
|
3936
|
+
commands: z39.literal(true).optional(),
|
|
3928
3937
|
/** The daemon answers `openrig.row`. */
|
|
3929
|
-
rigRows:
|
|
3938
|
+
rigRows: z39.literal(true).optional(),
|
|
3930
3939
|
/** The daemon answers `openrig.asks` and `openrig.answer` (« À toi »). */
|
|
3931
|
-
openrig:
|
|
3940
|
+
openrig: z39.literal(true).optional(),
|
|
3932
3941
|
/** The daemon takes `session.broadcast` (« Écrire au groupe »). */
|
|
3933
|
-
broadcast:
|
|
3942
|
+
broadcast: z39.literal(true).optional(),
|
|
3934
3943
|
/** The daemon answers `folder.list`, `folder.recents` and `project.folders`, and takes `project.folder.add` and `.remove`. */
|
|
3935
|
-
projectFolders:
|
|
3944
|
+
projectFolders: z39.literal(true).optional(),
|
|
3936
3945
|
/** The daemon takes `project.edit`, `project.order`, `project.create` and `project.delete` (Réglages › Projets). */
|
|
3937
|
-
projectEdit:
|
|
3946
|
+
projectEdit: z39.literal(true).optional(),
|
|
3938
3947
|
/** Issue #16: the snapshot and `projects` carry `sessionOrder`, and the daemon takes `session.order`. */
|
|
3939
|
-
sessionOrder:
|
|
3948
|
+
sessionOrder: z39.literal(true).optional(),
|
|
3949
|
+
/** The daemon takes `task.answer` (#40): a decision answered from the phone, outside the chat. */
|
|
3950
|
+
taskAnswer: z39.literal(true).optional(),
|
|
3940
3951
|
/** The daemon takes `device.prefs` and `context.set` (the phone's Réglages); the device then carries its `prefs`. */
|
|
3941
|
-
settings:
|
|
3952
|
+
settings: z39.literal(true).optional(),
|
|
3942
3953
|
/** The daemon sends `usage.state` (its harnesses' limits). */
|
|
3943
|
-
usage:
|
|
3954
|
+
usage: z39.literal(true).optional(),
|
|
3944
3955
|
/** The Atelier: the snapshot carries `projects`, each session its `projectId` and `rig`, and `projects` follows each change. Absent (an older PC): no Atelier. */
|
|
3945
|
-
atelier:
|
|
3956
|
+
atelier: z39.literal(true).optional(),
|
|
3946
3957
|
/** 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 ». */
|
|
3947
|
-
rigs:
|
|
3958
|
+
rigs: z39.literal(true).optional(),
|
|
3948
3959
|
/** « Nouvelle session »: the daemon takes `session.launch` and `project.folders` carries this PC's folders' branch. Absent (an older PC): « Nouvelle » cannot start. */
|
|
3949
|
-
launch:
|
|
3960
|
+
launch: z39.literal(true).optional(),
|
|
3950
3961
|
/** 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 ». */
|
|
3951
|
-
forge:
|
|
3962
|
+
forge: z39.literal(true).optional(),
|
|
3952
3963
|
/** The device's conversations are kept 7 days (M3 Q33): the daemon answers `chat.conversations` and `chat.conversation`, and
|
|
3953
3964
|
* `chat.reset` puts the conversation away. Absent (an older PC): « Nouvelle conversation » forgets it. */
|
|
3954
|
-
conversations:
|
|
3965
|
+
conversations: z39.literal(true).optional()
|
|
3955
3966
|
}),
|
|
3956
3967
|
/** The user's projects (`daemon.atelier`), whole, in their order: absent from an older PC's snapshot. */
|
|
3957
|
-
projects:
|
|
3968
|
+
projects: z39.array(PhoneProjectSchema).max(PHONE_PROJECTS_MAX).optional(),
|
|
3958
3969
|
sessionOrder: PhoneSessionOrderSchema.optional(),
|
|
3959
|
-
device:
|
|
3960
|
-
confirm:
|
|
3970
|
+
device: z39.object({
|
|
3971
|
+
confirm: z39.boolean(),
|
|
3961
3972
|
/** Its passkey can bring it back after a reinstall: without it, « Mettre à jour la passkey ». */
|
|
3962
|
-
recover:
|
|
3963
|
-
push:
|
|
3964
|
-
chat:
|
|
3973
|
+
recover: z39.literal(true).optional(),
|
|
3974
|
+
push: z39.enum(["on", "off", "stale", "unavailable"]).optional(),
|
|
3975
|
+
chat: z39.literal(true).optional(),
|
|
3965
3976
|
contextNear: ContextPrefsSchema.shape.near.optional(),
|
|
3966
3977
|
/** This device's id (its fingerprint, as decisions name it in `by`), its kind, and the name the user gave it (absent: none given). */
|
|
3967
|
-
id:
|
|
3978
|
+
id: z39.string().optional(),
|
|
3968
3979
|
kind: DeviceKindSchema.optional(),
|
|
3969
|
-
name:
|
|
3980
|
+
name: z39.string().optional(),
|
|
3970
3981
|
/** This device's own settings (`daemon.settings`). */
|
|
3971
3982
|
prefs: DevicePrefsSchema.optional()
|
|
3972
3983
|
}).optional()
|
|
3973
3984
|
}),
|
|
3974
3985
|
/** « À toi » on this PC: the answer to `openrig.asks`, then each change, whole. */
|
|
3975
|
-
|
|
3986
|
+
z39.object({ type: z39.literal("openrig.asks"), channel: HumanChannelSchema, asks: z39.array(HumanAskSchema), partial: z39.literal(true).optional(), truncated: z39.literal(true).optional() }),
|
|
3976
3987
|
/** An answer's end, as on the desktop (`openrig.answered`), under the phone's `op`. `rejected`: the device check refused it (`reason`). */
|
|
3977
|
-
|
|
3978
|
-
type:
|
|
3988
|
+
z39.object({
|
|
3989
|
+
type: z39.literal("openrig.answered"),
|
|
3979
3990
|
op: OperationIdSchema,
|
|
3980
|
-
qitemId:
|
|
3981
|
-
ok:
|
|
3982
|
-
outcome:
|
|
3983
|
-
remaining:
|
|
3984
|
-
replyId:
|
|
3991
|
+
qitemId: z39.string(),
|
|
3992
|
+
ok: z39.boolean(),
|
|
3993
|
+
outcome: z39.enum(["recorded", "answered", "already"]).optional(),
|
|
3994
|
+
remaining: z39.array(z39.string()).optional(),
|
|
3995
|
+
replyId: z39.string().optional(),
|
|
3985
3996
|
error: HumanAnswerErrorSchema.optional(),
|
|
3986
|
-
message:
|
|
3987
|
-
rejected:
|
|
3997
|
+
message: z39.string().max(500).optional(),
|
|
3998
|
+
rejected: z39.enum(["confirm_required", "assertion_invalid", "assertion_expired", "unavailable"]).optional()
|
|
3988
3999
|
}),
|
|
3989
|
-
|
|
3990
|
-
|
|
4000
|
+
z39.object({ type: z39.literal("confirm.challenge"), purpose: ConfirmPurposeSchema, challenge: B64U3.max(64), rpId: z39.string().max(253), credentialId: B64U3.max(1366).optional(), expiresInMs: z39.number().int().positive() }),
|
|
4001
|
+
z39.object({ type: z39.literal("session.updated"), session: PhoneSessionSchema }),
|
|
3991
4002
|
/** The user's projects changed (a name, a colour, one added or removed, the order) (`daemon.atelier`): the list, whole. A session placed
|
|
3992
4003
|
* elsewhere by the change follows as its own `session.updated`, after this. */
|
|
3993
|
-
|
|
3994
|
-
|
|
4004
|
+
z39.object({ type: z39.literal("projects"), projects: z39.array(PhoneProjectSchema).max(PHONE_PROJECTS_MAX), sessionOrder: PhoneSessionOrderSchema.optional() }),
|
|
4005
|
+
z39.object({ type: z39.literal("session.removed"), id: z39.string() }),
|
|
3995
4006
|
/** A session's checklist, sent to the phone that watches it; `null`: it has none (any more). */
|
|
3996
|
-
|
|
4007
|
+
z39.object({ type: z39.literal("session.checklist"), id: z39.string(), checklist: PhoneChecklistSchema.nullable() }),
|
|
3997
4008
|
/** `pending.cut` is set when even this body was shortened. */
|
|
3998
|
-
|
|
3999
|
-
|
|
4009
|
+
z39.object({ type: z39.literal("session.pending"), id: z39.string(), pending: PhonePendingSchema }),
|
|
4010
|
+
z39.object({ type: z39.literal("session.preview"), id: z39.string(), lines: z39.array(z39.string()) }),
|
|
4000
4011
|
/** `cut`: the ids of the items shortened; `more`: older items were left out. */
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
type:
|
|
4012
|
+
z39.object({ type: z39.literal("session.thread"), id: z39.string(), items: z39.array(ThreadItemSchema), cut: z39.array(z39.string()), more: z39.boolean() }),
|
|
4013
|
+
z39.object({ type: z39.literal("session.thread.item"), id: z39.string(), item: ThreadItemSchema, cut: z39.literal(true).optional() }),
|
|
4014
|
+
z39.object({
|
|
4015
|
+
type: z39.literal("operation.result"),
|
|
4005
4016
|
op: OperationIdSchema,
|
|
4006
4017
|
status: OperationStatusSchema,
|
|
4007
4018
|
reason: OperationReasonSchema.optional(),
|
|
4008
4019
|
/** How an applied `session.close` ended the agent: `killed` when it had to be forced. */
|
|
4009
4020
|
how: CloseHowSchema.optional(),
|
|
4010
4021
|
/** An applied `session.launch`: the new session, whose thread the phone opens. */
|
|
4011
|
-
id:
|
|
4022
|
+
id: z39.string().max(200).optional(),
|
|
4012
4023
|
/** An applied `session.broadcast`: the names that got it and those that did not. */
|
|
4013
|
-
sent:
|
|
4014
|
-
refused:
|
|
4024
|
+
sent: z39.array(z39.string().max(100)).max(BROADCAST_SESSIONS_MAX).optional(),
|
|
4025
|
+
refused: z39.array(z39.object({ name: z39.string().max(100), reason: z39.string().max(200) })).max(BROADCAST_SESSIONS_MAX).optional()
|
|
4015
4026
|
}),
|
|
4016
4027
|
/** The models an agent offers; `error`: it could not be asked, `models` is then what Ledge knows without it. */
|
|
4017
|
-
|
|
4028
|
+
z39.object({ type: z39.literal("models.listing"), tool: ToolSchema, models: z39.array(PhoneModelChoiceSchema).max(40), error: z39.literal(true).optional() }),
|
|
4018
4029
|
/** A model change that was accepted and then failed (the agent could not restart). */
|
|
4019
|
-
|
|
4030
|
+
z39.object({ type: z39.literal("session.model.failed"), id: z39.string(), reason: ModelRefusalSchema }),
|
|
4020
4031
|
/** 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. */
|
|
4021
|
-
|
|
4032
|
+
z39.object({ type: z39.literal("session.commands.listing"), id: z39.string(), commands: z39.array(PhoneSlashCommandSchema).max(PHONE_COMMANDS_MAX), error: z39.literal(true).optional() }),
|
|
4022
4033
|
/** A queue row's state, answering `openrig.row`: `row`, or `error`. */
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
|
|
4034
|
+
z39.object({ type: z39.literal("openrig.rowState"), qitem: z39.string(), row: PhoneRigRowSchema.optional(), error: PhoneRowErrorSchema.optional() }),
|
|
4035
|
+
z39.object({ type: z39.literal("chat.history"), turns: z39.array(PhoneChatTurnSchema).max(50) }),
|
|
4036
|
+
z39.object({ type: z39.literal("chat.step"), qid: OperationIdSchema, step: PhoneChatStepSchema }),
|
|
4026
4037
|
/** The whole text so far, not an increment. */
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
|
|
4038
|
+
z39.object({ type: z39.literal("chat.delta"), qid: OperationIdSchema, text: z39.string().max(THREAD_TEXT_MAX) }),
|
|
4039
|
+
z39.object({ type: z39.literal("chat.done"), qid: OperationIdSchema, turn: PhoneChatTurnSchema }),
|
|
4040
|
+
z39.object({ type: z39.literal("chat.error"), qid: OperationIdSchema, code: ChatErrorCodeSchema }),
|
|
4030
4041
|
/** The current conversation's answers that read the account limits, and when (M3 Q31): a phone shows the limits under each. Sent after a
|
|
4031
4042
|
* `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. */
|
|
4032
|
-
|
|
4043
|
+
z39.object({ type: z39.literal("chat.limits"), reads: z39.array(ChatLimitsReadSchema).max(50) }),
|
|
4033
4044
|
/** The device's conversations (M3 Q33): the current one once it has a question, and the ones put away, the most recent first. */
|
|
4034
|
-
|
|
4045
|
+
z39.object({ type: z39.literal("chat.conversations"), current: ChatConversationSummarySchema.optional(), past: z39.array(ChatConversationSummarySchema).max(200) }),
|
|
4035
4046
|
/** One conversation, read-only, as `chat.history` gives its turns (`limits` as `chat.limits`); `error`: it is no longer kept. */
|
|
4036
|
-
|
|
4037
|
-
type:
|
|
4038
|
-
id:
|
|
4039
|
-
turns:
|
|
4040
|
-
limits:
|
|
4041
|
-
error:
|
|
4047
|
+
z39.object({
|
|
4048
|
+
type: z39.literal("chat.conversation"),
|
|
4049
|
+
id: z39.string().uuid(),
|
|
4050
|
+
turns: z39.array(PhoneChatTurnSchema).max(50).optional(),
|
|
4051
|
+
limits: z39.array(ChatLimitsReadSchema).max(50).optional(),
|
|
4052
|
+
error: z39.literal("unknown").optional()
|
|
4042
4053
|
}),
|
|
4043
4054
|
/** The daemon updating or restarting itself, whoever asked: npm runs, then the service restarts (the link drops right after). */
|
|
4044
|
-
|
|
4055
|
+
z39.object({ type: z39.literal("daemon.progress"), version: z39.string().max(40), step: z39.enum(["installing", "restarting"]) }),
|
|
4045
4056
|
/** Nothing was changed. Never npm's output nor a command: both hold the PC's paths. */
|
|
4046
|
-
|
|
4057
|
+
z39.object({ type: z39.literal("daemon.failed"), version: z39.string().max(40), reason: UpdateFailureSchema }),
|
|
4047
4058
|
/** The tasks Ledge gave, open or closed lately, after each snapshot; then each change. */
|
|
4048
|
-
|
|
4049
|
-
|
|
4059
|
+
z39.object({ type: z39.literal("tasks"), tasks: z39.array(PhoneTaskSchema).max(200) }),
|
|
4060
|
+
z39.object({ type: z39.literal("task.updated"), task: PhoneTaskSchema }),
|
|
4050
4061
|
/** The routines, newest first, without their prompt (the phone's list is read-only); then each change, or `removed` (its id). */
|
|
4051
4062
|
// Not strict, as every routine schema: a newer PC's field never makes the list unreadable to an older phone.
|
|
4052
|
-
|
|
4053
|
-
|
|
4063
|
+
z39.object({ type: z39.literal("routines"), routines: z39.array(PhoneRoutineSchema).max(ROUTINES_MAX) }),
|
|
4064
|
+
z39.object({ type: z39.literal("routine.changed"), routine: PhoneRoutineSchema.optional(), removed: RoutineIdSchema.optional() }),
|
|
4054
4065
|
/** The answer to `routine.show`: the routine whole, or `gone` when there is no such routine now. */
|
|
4055
|
-
|
|
4066
|
+
z39.object({ type: z39.literal("routine.detail"), id: RoutineIdSchema, routine: PhoneRoutineDetailSchema.optional(), gone: z39.literal(true).optional() }),
|
|
4056
4067
|
AttachmentStoredSchema,
|
|
4057
4068
|
AttachmentDataSchema,
|
|
4058
4069
|
AttachmentErrorSchema,
|
|
4059
4070
|
/** 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. */
|
|
4060
|
-
|
|
4061
|
-
type:
|
|
4071
|
+
z39.object({
|
|
4072
|
+
type: z39.literal("term.opened"),
|
|
4062
4073
|
op: OperationIdSchema.optional(),
|
|
4063
4074
|
tid: TerminalIdSchema,
|
|
4064
|
-
id:
|
|
4075
|
+
id: z39.string(),
|
|
4065
4076
|
cols: TermDimSchema,
|
|
4066
4077
|
rows: TermDimSchema,
|
|
4067
|
-
screen:
|
|
4068
|
-
cursor:
|
|
4069
|
-
seq:
|
|
4078
|
+
screen: z39.string().max(TERM_SCREEN_MAX),
|
|
4079
|
+
cursor: z39.object({ x: z39.number().int().nonnegative(), y: z39.number().int().nonnegative() }),
|
|
4080
|
+
seq: z39.number().int().nonnegative(),
|
|
4070
4081
|
/** Read-only for good: a subagent's page shows its parent's pane. */
|
|
4071
|
-
readOnly:
|
|
4082
|
+
readOnly: z39.literal(true).optional()
|
|
4072
4083
|
}),
|
|
4073
4084
|
/** What the pane printed since the last one; `seq` + 1 each time. */
|
|
4074
|
-
|
|
4075
|
-
|
|
4085
|
+
z39.object({ type: z39.literal("term.output"), tid: TerminalIdSchema, seq: z39.number().int().nonnegative(), data: z39.string().min(1).max(TERM_OUTPUT_MAX) }),
|
|
4086
|
+
z39.object({ type: z39.literal("term.size"), tid: TerminalIdSchema, cols: TermDimSchema, rows: TermDimSchema }),
|
|
4076
4087
|
/** The phone holds the hand until `until`, pushed back by each key (5 min), never past 30 min from the hold. */
|
|
4077
|
-
|
|
4078
|
-
|
|
4079
|
-
|
|
4088
|
+
z39.object({ type: z39.literal("term.held"), tid: TerminalIdSchema, until: z39.string().datetime() }),
|
|
4089
|
+
z39.object({ type: z39.literal("term.released"), tid: TerminalIdSchema, why: TermReleaseWhySchema }),
|
|
4090
|
+
z39.object({ type: z39.literal("term.exit"), tid: TerminalIdSchema, why: TermExitWhySchema }),
|
|
4080
4091
|
/** Never carries free text. */
|
|
4081
4092
|
/** The subfolders of `path` on this PC (home when asked without one); `parent` null at the root. */
|
|
4082
|
-
|
|
4083
|
-
type:
|
|
4093
|
+
z39.object({
|
|
4094
|
+
type: z39.literal("folder.listing"),
|
|
4084
4095
|
path: FolderPathSchema,
|
|
4085
4096
|
parent: FolderPathSchema.nullable(),
|
|
4086
|
-
entries:
|
|
4087
|
-
repos:
|
|
4088
|
-
cut:
|
|
4097
|
+
entries: z39.array(z39.string().min(1).max(255)).max(PHONE_FOLDER_ENTRIES_MAX),
|
|
4098
|
+
repos: z39.array(z39.object({ name: z39.string().min(1).max(255), branch: z39.string().max(200) })).max(PHONE_FOLDER_ENTRIES_MAX),
|
|
4099
|
+
cut: z39.literal(true).optional(),
|
|
4089
4100
|
error: PhoneFolderErrorSchema.optional()
|
|
4090
4101
|
}),
|
|
4091
|
-
|
|
4102
|
+
z39.object({ type: z39.literal("folder.recents"), paths: z39.array(FolderPathSchema).max(PHONE_RECENT_FOLDERS_MAX) }),
|
|
4092
4103
|
/** A project's folders, in its order; `gone`: no such project now. */
|
|
4093
|
-
|
|
4094
|
-
|
|
4104
|
+
z39.object({ type: z39.literal("project.folders"), id: z39.string(), folders: z39.array(PhoneFolderSchema).max(50), gone: z39.literal(true).optional() }),
|
|
4105
|
+
z39.object({ type: z39.literal("error"), code: z39.enum(["invalid", "unknown_session", "too_large"]), request: z39.string().max(40).optional() }),
|
|
4095
4106
|
// ── Rigs and the kernel (`daemon.rigs`) ──
|
|
4096
4107
|
/** `error`: OpenRig could not be read (`state` absent). */
|
|
4097
|
-
|
|
4108
|
+
z39.object({ type: z39.literal("rigs.state"), state: PhoneOpenRigStateSchema.optional(), error: PhoneRigErrorSchema.optional() }).strict(),
|
|
4098
4109
|
// ── Pull and merge requests (`daemon.forge`) ──
|
|
4099
4110
|
/** After `forge.state`, then on each change, whole. */
|
|
4100
|
-
|
|
4111
|
+
z39.object({ type: z39.literal("forge.state"), ...PhoneForgeStateSchema.shape }).strict(),
|
|
4101
4112
|
/** `cut`: the gateway left out patches, discussions or commits, or shortened texts, to fit the frame. */
|
|
4102
|
-
|
|
4113
|
+
z39.object({ type: z39.literal("forge.detail"), prId: z39.string(), detail: PrDetailSchema.optional(), cut: z39.literal(true).optional(), error: PhoneForgeErrorSchema.optional() }).strict(),
|
|
4103
4114
|
/** 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`. */
|
|
4104
|
-
|
|
4105
|
-
type:
|
|
4115
|
+
z39.object({
|
|
4116
|
+
type: z39.literal("forge.done"),
|
|
4106
4117
|
op: OperationIdSchema,
|
|
4107
|
-
ok:
|
|
4108
|
-
command:
|
|
4118
|
+
ok: z39.boolean(),
|
|
4119
|
+
command: z39.string().max(PHONE_FORGE_MESSAGE_MAX).optional(),
|
|
4109
4120
|
error: PhoneForgeActErrorSchema.optional(),
|
|
4110
|
-
message:
|
|
4121
|
+
message: z39.string().max(PHONE_FORGE_MESSAGE_MAX).optional(),
|
|
4111
4122
|
rejected: PhoneForgeRejectedSchema.optional()
|
|
4112
4123
|
}).strict(),
|
|
4113
|
-
|
|
4124
|
+
z39.object({ type: z39.literal("rigs.graph"), rig: z39.string(), graph: RigGraphSchema.optional(), error: PhoneRigErrorSchema.optional() }).strict(),
|
|
4114
4125
|
/** `rows`: open (pending, in-progress, blocked), newest first; `closed`: closed lately, newest first; `truncated`: older open rows may be missing. */
|
|
4115
|
-
|
|
4116
|
-
type:
|
|
4117
|
-
rig:
|
|
4118
|
-
rows:
|
|
4119
|
-
closed:
|
|
4120
|
-
truncated:
|
|
4126
|
+
z39.object({
|
|
4127
|
+
type: z39.literal("rigs.queue"),
|
|
4128
|
+
rig: z39.string(),
|
|
4129
|
+
rows: z39.array(PhoneRigQueueRowSchema).max(PHONE_RIG_ROWS_MAX),
|
|
4130
|
+
closed: z39.array(PhoneRigQueueRowSchema).max(PHONE_RIG_ROWS_MAX),
|
|
4131
|
+
truncated: z39.boolean(),
|
|
4121
4132
|
error: PhoneRigErrorSchema.optional()
|
|
4122
4133
|
}).strict(),
|
|
4123
4134
|
/** Oldest first, at most 20. */
|
|
4124
|
-
|
|
4125
|
-
|
|
4126
|
-
|
|
4127
|
-
|
|
4135
|
+
z39.object({ type: z39.literal("rigs.routing"), entries: z39.array(PhoneRigRoutingSchema).max(20), error: PhoneRigErrorSchema.optional() }).strict(),
|
|
4136
|
+
z39.object({ type: z39.literal("rigs.permissions"), rig: z39.string(), policy: z39.string().max(PHONE_RIG_TEXT_MAX).optional(), seats: z39.array(PhoneRigPermissionSchema).max(PHONE_RIG_SEATS_MAX), error: PhoneRigErrorSchema.optional() }).strict(),
|
|
4137
|
+
z39.object({ type: z39.literal("rigs.snapshots"), rig: z39.string(), snapshots: z39.array(RigSnapshotSchema).max(20), error: PhoneRigErrorSchema.optional() }).strict(),
|
|
4138
|
+
z39.object({ type: z39.literal("rigs.goals"), goals: z39.array(PhoneGoalSchema).max(PHONE_GOALS_MAX), partial: z39.literal(true).optional(), error: PhoneRigErrorSchema.optional() }).strict(),
|
|
4128
4139
|
/** An action's end, under its `op` (`operation.result` says whether it ran). `commands`: the `rig` commands as shown; `error`: `busy`, `not_installed`,
|
|
4129
4140
|
* `spec_unknown`, `spec_no_policy`, `spec_policy_unsupported`, or `failed` with `message`, OpenRig's last line; `completed` as the Desktop's. */
|
|
4130
|
-
|
|
4131
|
-
type:
|
|
4141
|
+
z39.object({
|
|
4142
|
+
type: z39.literal("rigs.done"),
|
|
4132
4143
|
op: OperationIdSchema,
|
|
4133
|
-
ok:
|
|
4134
|
-
commands:
|
|
4135
|
-
error:
|
|
4136
|
-
message:
|
|
4137
|
-
completed:
|
|
4144
|
+
ok: z39.boolean(),
|
|
4145
|
+
commands: z39.array(z39.string().max(PHONE_RIG_TEXT_MAX)).max(400),
|
|
4146
|
+
error: z39.string().max(40).optional(),
|
|
4147
|
+
message: z39.string().max(PHONE_RIG_TEXT_MAX).optional(),
|
|
4148
|
+
completed: z39.number().int().min(0).optional(),
|
|
4138
4149
|
rejected: PhoneRigRejectedSchema.optional()
|
|
4139
4150
|
}).strict(),
|
|
4140
4151
|
/** A change of seats ended: `added` / `removed` as `pod.member`; `error`: `rig_not_running`, `rig_root_unknown`, `busy`, or `failed` with `message`. */
|
|
4141
|
-
|
|
4142
|
-
type:
|
|
4152
|
+
z39.object({
|
|
4153
|
+
type: z39.literal("rigs.reseated"),
|
|
4143
4154
|
op: OperationIdSchema,
|
|
4144
|
-
ok:
|
|
4145
|
-
commands:
|
|
4146
|
-
added:
|
|
4147
|
-
removed:
|
|
4148
|
-
error:
|
|
4149
|
-
message:
|
|
4150
|
-
links:
|
|
4151
|
-
linksUnsupported:
|
|
4155
|
+
ok: z39.boolean(),
|
|
4156
|
+
commands: z39.array(z39.string().max(PHONE_RIG_TEXT_MAX)).max(400),
|
|
4157
|
+
added: z39.array(z39.string()).max(PHONE_RIG_SEATS_MAX),
|
|
4158
|
+
removed: z39.array(z39.string()).max(PHONE_RIG_SEATS_MAX),
|
|
4159
|
+
error: z39.string().max(40).optional(),
|
|
4160
|
+
message: z39.string().max(PHONE_RIG_TEXT_MAX).optional(),
|
|
4161
|
+
links: z39.number().int().optional(),
|
|
4162
|
+
linksUnsupported: z39.boolean().optional(),
|
|
4152
4163
|
rejected: PhoneRigRejectedSchema.optional()
|
|
4153
4164
|
}).strict(),
|
|
4154
|
-
|
|
4155
|
-
type:
|
|
4165
|
+
z39.object({
|
|
4166
|
+
type: z39.literal("rigs.goal.sent"),
|
|
4156
4167
|
op: OperationIdSchema,
|
|
4157
|
-
goalId:
|
|
4158
|
-
ok:
|
|
4159
|
-
qitemId:
|
|
4168
|
+
goalId: z39.string(),
|
|
4169
|
+
ok: z39.boolean(),
|
|
4170
|
+
qitemId: z39.string().optional(),
|
|
4160
4171
|
error: GoalErrorSchema.optional(),
|
|
4161
|
-
message:
|
|
4172
|
+
message: z39.string().max(PHONE_RIG_TEXT_MAX).optional(),
|
|
4162
4173
|
rejected: PhoneRigRejectedSchema.optional()
|
|
4163
4174
|
}).strict(),
|
|
4164
|
-
|
|
4165
|
-
type:
|
|
4175
|
+
z39.object({
|
|
4176
|
+
type: z39.literal("rigs.goal.replied"),
|
|
4166
4177
|
op: OperationIdSchema,
|
|
4167
|
-
goalId:
|
|
4168
|
-
replyId:
|
|
4169
|
-
ok:
|
|
4170
|
-
qitemId:
|
|
4178
|
+
goalId: z39.string(),
|
|
4179
|
+
replyId: z39.string(),
|
|
4180
|
+
ok: z39.boolean(),
|
|
4181
|
+
qitemId: z39.string().optional(),
|
|
4171
4182
|
error: GoalErrorSchema.optional(),
|
|
4172
|
-
message:
|
|
4183
|
+
message: z39.string().max(PHONE_RIG_TEXT_MAX).optional(),
|
|
4173
4184
|
rejected: PhoneRigRejectedSchema.optional()
|
|
4174
4185
|
}).strict()
|
|
4175
4186
|
]);
|
|
@@ -4181,8 +4192,8 @@ var ConfigError = class extends Error {
|
|
|
4181
4192
|
this.name = "ConfigError";
|
|
4182
4193
|
}
|
|
4183
4194
|
};
|
|
4184
|
-
var TokensSchema =
|
|
4185
|
-
var PortSchema =
|
|
4195
|
+
var TokensSchema = z40.record(z40.string().min(1), z40.object({ accountId: z40.string().min(1), peer: RelayPeerSchema }));
|
|
4196
|
+
var PortSchema = z40.coerce.number().int().min(0).max(65535);
|
|
4186
4197
|
function required(env, name) {
|
|
4187
4198
|
const v = env[name];
|
|
4188
4199
|
if (!v) throw new ConfigError(`${name} is not set`);
|
|
@@ -4515,10 +4526,10 @@ function countedLog(log, ms) {
|
|
|
4515
4526
|
|
|
4516
4527
|
// src/routes.ts
|
|
4517
4528
|
import { createHash as createHash3, timingSafeEqual as timingSafeEqual2 } from "crypto";
|
|
4518
|
-
import { z as
|
|
4529
|
+
import { z as z42 } from "zod";
|
|
4519
4530
|
|
|
4520
4531
|
// src/github.ts
|
|
4521
|
-
import { z as
|
|
4532
|
+
import { z as z41 } from "zod";
|
|
4522
4533
|
var GitHubError = class extends Error {
|
|
4523
4534
|
code;
|
|
4524
4535
|
constructor(code) {
|
|
@@ -4527,21 +4538,21 @@ var GitHubError = class extends Error {
|
|
|
4527
4538
|
this.code = code;
|
|
4528
4539
|
}
|
|
4529
4540
|
};
|
|
4530
|
-
var DeviceStartSchema =
|
|
4531
|
-
device_code:
|
|
4532
|
-
user_code:
|
|
4533
|
-
verification_uri:
|
|
4534
|
-
expires_in:
|
|
4535
|
-
interval:
|
|
4536
|
-
});
|
|
4537
|
-
var TokenAnswerSchema =
|
|
4538
|
-
access_token:
|
|
4539
|
-
error:
|
|
4540
|
-
interval:
|
|
4541
|
-
});
|
|
4542
|
-
var UserSchema =
|
|
4543
|
-
id:
|
|
4544
|
-
login:
|
|
4541
|
+
var DeviceStartSchema = z41.object({
|
|
4542
|
+
device_code: z41.string().min(1),
|
|
4543
|
+
user_code: z41.string().min(1),
|
|
4544
|
+
verification_uri: z41.string().min(1),
|
|
4545
|
+
expires_in: z41.number().int().positive(),
|
|
4546
|
+
interval: z41.number().int().positive()
|
|
4547
|
+
});
|
|
4548
|
+
var TokenAnswerSchema = z41.object({
|
|
4549
|
+
access_token: z41.string().min(1).optional(),
|
|
4550
|
+
error: z41.string().optional(),
|
|
4551
|
+
interval: z41.number().int().positive().optional()
|
|
4552
|
+
});
|
|
4553
|
+
var UserSchema = z41.object({
|
|
4554
|
+
id: z41.number().int().nonnegative(),
|
|
4555
|
+
login: z41.string().min(1)
|
|
4545
4556
|
});
|
|
4546
4557
|
var DEVICE_GRANT = "urn:ietf:params:oauth:grant-type:device_code";
|
|
4547
4558
|
var USER_AGENT = "ledge-relay";
|
|
@@ -4796,10 +4807,10 @@ async function readJson(req, schema, max = MAX_BODY) {
|
|
|
4796
4807
|
if (!r.success) throw new Answer(400, "bad_request");
|
|
4797
4808
|
return r.data;
|
|
4798
4809
|
}
|
|
4799
|
-
var RevokeBodySchema =
|
|
4810
|
+
var RevokeBodySchema = z42.object({
|
|
4800
4811
|
peer: RelayPeerSchema.refine((p) => p !== "pc")
|
|
4801
4812
|
});
|
|
4802
|
-
var PollBodySchema =
|
|
4813
|
+
var PollBodySchema = z42.object({ deviceCode: z42.string().min(1).max(1024) });
|
|
4803
4814
|
function authRoutes(deps) {
|
|
4804
4815
|
const maxCalls = deps.maxGitHubCalls ?? DEFAULT_MAX_GITHUB_CALLS;
|
|
4805
4816
|
let inFlight = 0;
|