@paradow/ledge-relay 0.69.1 → 0.71.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -150,6 +150,17 @@ var BackgroundCommandSchema = z4.object({
150
150
  });
151
151
  var TopicSourceSchema = z4.enum(["user", "pane", "prompt"]);
152
152
  var SESSION_LABEL_MAX = 40;
153
+ var AgentWhereSchema = z4.object({
154
+ /** The agent's process: the one its terminal or pane runs. */
155
+ pid: z4.number().int().positive(),
156
+ /** Field 22 of /proc/<pid>/stat (its start in clock ticks since boot): a reused pid never matches it. */
157
+ pidStart: z4.number().int().nonnegative(),
158
+ /** Its tmux pane, when it runs in one: the server's socket path (first field of $TMUX) and the pane id ($TMUX_PANE). */
159
+ tmux: z4.object({ socket: z4.string().startsWith("/").max(1024), pane: z4.string().regex(/^%\d+$/) }).strict().optional()
160
+ }).strict();
161
+ var AdoptStepSchema = z4.enum(["attaching", "waiting", "stopping", "resuming"]);
162
+ var AdoptPathSchema = z4.enum(["pane", "resume"]);
163
+ var AdoptFailureSchema = z4.enum(["unsupported", "busy", "not_located", "no_conversation", "pane_not_found", "process_gone", "stop_failed", "resume_failed", "cancelled"]);
153
164
  var SessionSchema = z4.object({
154
165
  /** Origin is annotated by the overlay, never used as an unqualified session id on the wire. */
155
166
  machineId: z4.string().optional(),
@@ -179,6 +190,10 @@ var SessionSchema = z4.object({
179
190
  /** The OpenRig seat this agent is: its session name (`dev-build@starter`), its rig, and its role (`dev.build`) once OpenRig named it. */
180
191
  rig: z4.object({ seat: z4.string(), name: z4.string(), role: z4.string().optional() }).optional(),
181
192
  tmuxSession: z4.string().nullable(),
193
+ /** Where an agent Ledge did not launch runs (its hook's latest word): kept while it is read-only, and once its pane is adopted. */
194
+ where: AgentWhereSchema.optional(),
195
+ /** A « Rattacher à Ledge » under way: its step, its path, since when. */
196
+ adopting: z4.object({ step: AdoptStepSchema, path: AdoptPathSchema, since: z4.string().datetime() }).optional(),
182
197
  /** Left out for a tmux session. `omp-rpc`: no pane, nothing to attach to; the daemon holds the process (see `agentSessionFile`). */
183
198
  backend: BackendSchema.optional(),
184
199
  state: SessionStateSchema,
@@ -2331,7 +2346,10 @@ var ThreadItemSchema = z27.discriminatedUnion("kind", [
2331
2346
  text: z27.string(),
2332
2347
  /** An OpenRig block that is not a message: a row handed to this seat or passed by it (`handoff`, `outgoing` for its own),
2333
2348
  * a row unblocked, OpenRig's own notice, or an unreadable block; `text` is the body (unreadable: the block as is). */
2334
- rig: RigInfoSchema.optional()
2349
+ rig: RigInfoSchema.optional(),
2350
+ /** The moment the session was brought into Ledge (« Rattacher à Ledge », spec 2026-12-01 rattacher): driven in its tmux pane, or
2351
+ * resumed on the same conversation. A front that knows it says it in its own words; an older one shows `text`. */
2352
+ adopted: z27.enum(["pane", "resume"]).optional()
2335
2353
  })
2336
2354
  ]);
2337
2355
 
@@ -2744,6 +2762,8 @@ var DaemonInfoSchema = z33.object({
2744
2762
  omp: z33.boolean().optional(),
2745
2763
  /** Takes `session.model`: a live session's model and effort changed (#58, lot 2). */
2746
2764
  modelSwitch: z33.boolean().optional(),
2765
+ /** Takes `session.adopt`: « Rattacher à Ledge » (spec 2026-12-01 rattacher). */
2766
+ adopt: z33.boolean().optional(),
2747
2767
  /** Answers `session.commands`: the slash commands a session's agent offers. */
2748
2768
  commands: z33.boolean().optional(),
2749
2769
  /** Takes `approval` on an OMP `session.launch` (auto mode). */
@@ -2797,6 +2817,7 @@ var DaemonInfoSchema = z33.object({
2797
2817
  freeShell: z33.boolean().optional()
2798
2818
  });
2799
2819
  var UpdateFailureSchema = z33.enum(["git-install", "no-systemd", "sessions-at-risk", "npm-failed", "busy"]);
2820
+ var SetupFailedSchema = z33.literal(true).optional();
2800
2821
  var ServerMessageSchema = z33.discriminatedUnion("type", [
2801
2822
  BrowserLiveSchema,
2802
2823
  BrowserFrameSchema,
@@ -2858,6 +2879,8 @@ var ServerMessageSchema = z33.discriminatedUnion("type", [
2858
2879
  SessionAsideSchema,
2859
2880
  /** Answer to the requester of a `session.launch`: the session exists (its `session.updated` is broadcast as usual). */
2860
2881
  z33.object({ type: z33.literal("session.launched"), id: z33.string() }),
2882
+ /** Answer to the requester of a `session.adopt`: the session is Ledge's now; on `resume` the requester opens its terminal. */
2883
+ z33.object({ type: z33.literal("session.adopted"), id: z33.string(), path: AdoptPathSchema }),
2861
2884
  z33.object({ type: z33.literal("recents"), recents: z33.array(RecentSchema) }),
2862
2885
  /** Answer to the requester of a `folder.list` or `folder.create`: `path` resolved (`~` expanded), `parent` null at the
2863
2886
  * root, `entries` its subfolders by name (hidden ones left out). A failure keeps the asked path and says why in `error`,
@@ -2881,8 +2904,8 @@ var ServerMessageSchema = z33.discriminatedUnion("type", [
2881
2904
  z33.object({ type: z33.literal("chat.error"), qid: z33.string(), message: z33.string() }),
2882
2905
  /** The daemon updating itself: npm is running, then the service restarts (the socket closes right after). */
2883
2906
  z33.object({ type: z33.literal("update.progress"), version: z33.string(), step: z33.enum(["installing", "restarting"]) }),
2884
- /** Nothing was changed. `detail`: the useful end of npm's output; `command`: what the person can run instead. */
2885
- z33.object({ type: z33.literal("update.failed"), version: z33.string(), reason: UpdateFailureSchema, detail: z33.string().optional(), command: z33.string().optional() }),
2907
+ /** Nothing was changed, unless `setup` (the version is installed, its setup failed). `detail`: the useful end of npm's or setup's output; `command`: what the person can run instead. */
2908
+ z33.object({ type: z33.literal("update.failed"), version: z33.string(), reason: UpdateFailureSchema, detail: z33.string().optional(), command: z33.string().optional(), setup: SetupFailedSchema }),
2886
2909
  /** The shared machines list (spec 2026-10-14 §5), sent to local clients only. */
2887
2910
  z33.object({ type: z33.literal("machines"), machines: MachinesSchema }),
2888
2911
  /** The local daemon's projects and folder rules (spec 2026-10-16 build §5), sent to local clients only. */
@@ -3080,8 +3103,12 @@ var ClientMessageSchema = z33.discriminatedUnion("type", [
3080
3103
  agent: ToolSchema.optional(),
3081
3104
  cwd: z33.string().optional(),
3082
3105
  /** The OpenRig seat the agent runs in (`OPENRIG_SESSION_NAME`, `pod-member@rig`), when OpenRig launched it. */
3083
- rigSeat: RigSeatNameSchema.optional()
3106
+ rigSeat: RigSeatNameSchema.optional(),
3107
+ /** Where the agent runs, from an agent Ledge did not launch (spec 2026-12-01 rattacher §2). */
3108
+ where: AgentWhereSchema.optional()
3084
3109
  }),
3110
+ /** « Rattacher à Ledge » on a read-only session (spec 2026-12-01 rattacher §3); `cancel` withdraws one still `waiting`. */
3111
+ z33.object({ type: z33.literal("session.adopt"), id: z33.string(), cancel: z33.literal(true).optional() }),
3085
3112
  z33.object({ type: z33.literal("session.unregister"), id: z33.string(), exitCode: z33.number().int().nullable() }),
3086
3113
  z33.object({ type: z33.literal("snapshot.request") }),
3087
3114
  /** #40: the chat, its cards and the operator's point left Ledge. An older front's message still parses, by its name only, so
@@ -3381,7 +3408,27 @@ var RiskSchema = z39.enum(["low", "high"]);
3381
3408
  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
3409
  var OperationIdSchema = z39.string().uuid();
3383
3410
  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]);
3411
+ var OperationReasonSchema = z39.enum([
3412
+ ...RefusalCodeSchema.options,
3413
+ "untypable",
3414
+ "confirm_required",
3415
+ "conflict",
3416
+ "assertion_invalid",
3417
+ "assertion_expired",
3418
+ "scheduled",
3419
+ "folder_taken",
3420
+ "not_found",
3421
+ "not_pending",
3422
+ ...ModelRefusalSchema.options,
3423
+ /** « Rattacher à Ledge »'s own (AdoptFailureSchema), those the lists above do not already have. */
3424
+ "unsupported",
3425
+ "not_located",
3426
+ "pane_not_found",
3427
+ "process_gone",
3428
+ "stop_failed",
3429
+ "resume_failed",
3430
+ "cancelled"
3431
+ ]);
3385
3432
  var CapabilitiesSchema = z39.object({
3386
3433
  /** A question can be answered in free text. */
3387
3434
  freeTextAnswer: z39.boolean(),
@@ -3438,6 +3485,10 @@ var PhoneSessionSchema = SwitchableSessionSchema.pick({
3438
3485
  checklist: PhoneChecklistSummarySchema.optional(),
3439
3486
  /** Started without Ledge (`hook_only`): the phone can neither close nor resume it. */
3440
3487
  readOnly: z39.literal(true).optional(),
3488
+ /** « Rattacher à Ledge » on a read-only session: what it would do (`adoptPlan`, spec 2026-12-01 rattacher §3.3); absent, not offered. */
3489
+ adopt: z39.enum(["pane", "resume", "not_located"]).optional(),
3490
+ /** A « Rattacher à Ledge » under way: its step. */
3491
+ adopting: z39.object({ step: AdoptStepSchema }).strict().optional(),
3441
3492
  /** 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 »). */
3442
3493
  projectId: ProjectIdSchema.optional(),
3443
3494
  /** The OpenRig seat it is (`daemon.atelier`): its rig and its role once OpenRig named it. Never the seat's folder. */
@@ -3712,6 +3763,9 @@ var PhoneClientMessageSchema = z39.discriminatedUnion("type", [
3712
3763
  z39.object({ type: z39.literal("session.resume"), op: OperationIdSchema, id: sessionId, assertion: AssertionSchema.optional() }),
3713
3764
  /** 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`. */
3714
3765
  z39.object({ type: z39.literal("session.model"), op: OperationIdSchema, id: sessionId, model: ModelIdSchema.nullable(), effort: EffortSchema.nullable() }),
3766
+ /** « Rattacher à Ledge » on a read-only session (`cancel`: withdraws one still waiting); answered by `operation.result`, then
3767
+ * `session.adopted` or `session.adopt.failed`. */
3768
+ z39.object({ type: z39.literal("session.adopt"), op: OperationIdSchema, id: sessionId, cancel: z39.literal(true).optional() }),
3715
3769
  /** One message to several sessions (ids); answered by `operation.result` with `sent` and `refused`. */
3716
3770
  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(),
3717
3771
  /** The models an agent offers on the PC. */
@@ -3925,6 +3979,8 @@ var PhoneServerMessageSchema = z39.discriminatedUnion("type", [
3925
3979
  restart: z39.literal(true).optional(),
3926
3980
  /** The daemon takes `session.close` and `session.resume`. */
3927
3981
  sessionClose: z39.literal(true).optional(),
3982
+ /** The daemon takes `session.adopt` (« Rattacher à Ledge »). */
3983
+ adopt: z39.literal(true).optional(),
3928
3984
  /** The daemon streams a session's terminal (`term.open`). */
3929
3985
  terminal: z39.literal(true).optional(),
3930
3986
  /** The PC lets a phone type into a terminal (`term.hold`): its setting is on. */
@@ -4028,6 +4084,17 @@ var PhoneServerMessageSchema = z39.discriminatedUnion("type", [
4028
4084
  z39.object({ type: z39.literal("models.listing"), tool: ToolSchema, models: z39.array(PhoneModelChoiceSchema).max(40), error: z39.literal(true).optional() }),
4029
4085
  /** A model change that was accepted and then failed (the agent could not restart). */
4030
4086
  z39.object({ type: z39.literal("session.model.failed"), id: z39.string(), reason: ModelRefusalSchema }),
4087
+ /** A « Rattacher à Ledge » done: the session is Ledge's now (`resume`: it was restarted on its conversation in Ledge's tmux). */
4088
+ z39.object({ type: z39.literal("session.adopted"), id: z39.string(), path: AdoptPathSchema }),
4089
+ /** A « Rattacher à Ledge » that was accepted and then did not happen. */
4090
+ z39.object({
4091
+ type: z39.literal("session.adopt.failed"),
4092
+ id: z39.string(),
4093
+ reason: AdoptFailureSchema,
4094
+ /** `resume_failed`: the exit code of the resumed agent that quit at once (« claude a quitté au démarrage (code 1) »), when
4095
+ * known. Never the daemon's own words, which may hold a path. */
4096
+ exitCode: z39.number().int().optional()
4097
+ }),
4031
4098
  /** 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. */
4032
4099
  z39.object({ type: z39.literal("session.commands.listing"), id: z39.string(), commands: z39.array(PhoneSlashCommandSchema).max(PHONE_COMMANDS_MAX), error: z39.literal(true).optional() }),
4033
4100
  /** A queue row's state, answering `openrig.row`: `row`, or `error`. */
@@ -4053,8 +4120,8 @@ var PhoneServerMessageSchema = z39.discriminatedUnion("type", [
4053
4120
  }),
4054
4121
  /** The daemon updating or restarting itself, whoever asked: npm runs, then the service restarts (the link drops right after). */
4055
4122
  z39.object({ type: z39.literal("daemon.progress"), version: z39.string().max(40), step: z39.enum(["installing", "restarting"]) }),
4056
- /** Nothing was changed. Never npm's output nor a command: both hold the PC's paths. */
4057
- z39.object({ type: z39.literal("daemon.failed"), version: z39.string().max(40), reason: UpdateFailureSchema }),
4123
+ /** Nothing was changed, unless `setup` (the version is installed, its setup failed). Never npm's output nor a command: both hold the PC's paths. */
4124
+ z39.object({ type: z39.literal("daemon.failed"), version: z39.string().max(40), reason: UpdateFailureSchema, setup: SetupFailedSchema }),
4058
4125
  /** The tasks Ledge gave, open or closed lately, after each snapshot; then each change. */
4059
4126
  z39.object({ type: z39.literal("tasks"), tasks: z39.array(PhoneTaskSchema).max(200) }),
4060
4127
  z39.object({ type: z39.literal("task.updated"), task: PhoneTaskSchema }),
package/dist/cli.js CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  parsePublicUrl,
8
8
  startRelay,
9
9
  startupErrorLine
10
- } from "./chunk-YIXJHVVJ.js";
10
+ } from "./chunk-MDUBLNNS.js";
11
11
 
12
12
  // src/cli.ts
13
13
  import { chmodSync as chmodSync2, mkdirSync as mkdirSync2, readFileSync as readFileSync3, realpathSync } from "fs";
package/dist/main.js CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  loadConfig,
3
3
  startRelay,
4
4
  startupErrorLine
5
- } from "./chunk-YIXJHVVJ.js";
5
+ } from "./chunk-MDUBLNNS.js";
6
6
 
7
7
  // src/main.ts
8
8
  function die(msg) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paradow/ledge-relay",
3
- "version": "0.69.1",
3
+ "version": "0.71.0",
4
4
  "license": "PolyForm-Noncommercial-1.0.0",
5
5
  "repository": {
6
6
  "type": "git",