@paradow/ledge-relay 0.65.0 → 0.67.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.
@@ -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 z41 } from "zod";
5
+ import { z as z40 } from "zod";
6
6
 
7
7
  // ../../packages/protocol/src/attachments.ts
8
8
  import { z } from "zod";
@@ -149,6 +149,7 @@ var BackgroundCommandSchema = z4.object({
149
149
  taskId: z4.string().optional()
150
150
  });
151
151
  var TopicSourceSchema = z4.enum(["user", "pane", "prompt"]);
152
+ var SESSION_LABEL_MAX = 40;
152
153
  var SessionSchema = z4.object({
153
154
  /** Origin is annotated by the overlay, never used as an unqualified session id on the wire. */
154
155
  machineId: z4.string().optional(),
@@ -158,6 +159,9 @@ var SessionSchema = z4.object({
158
159
  offline: z4.boolean().optional(),
159
160
  id: z4.string().min(1),
160
161
  name: z4.string().min(1),
162
+ /** A nickname the person gave it (docs/mockups/ledge-sidebar-names.html, card 2): shown before its name, « KB Projet 1 (Otto) ».
163
+ * Only a label: the name stays its address for the other sessions, the tasks and the routines. */
164
+ label: z4.string().min(1).max(SESSION_LABEL_MAX).optional(),
161
165
  tool: ToolSchema,
162
166
  cwd: z4.string(),
163
167
  project: z4.string(),
@@ -1462,7 +1466,8 @@ var ChatPointSchema = z12.object({
1462
1466
  laterAt: z12.string().datetime().optional()
1463
1467
  });
1464
1468
  var OperatorNoticeSchema = z12.object({
1465
- /** `decision`: a decision a session put to the user (a task given to Ledge), said at once; its `id` is `decision:<task id>`. */
1469
+ /** `decision`: a decision a session put to the user (a task given to Ledge), said at once; its `id` is `decision:<task id>`.
1470
+ * `point`: sent only by daemons before #27 (the point left the dynamic island); kept so their notices still parse. */
1466
1471
  id: z12.string(),
1467
1472
  kind: z12.enum(["point", "rig.ask", "decision"]),
1468
1473
  qid: z12.string().optional(),
@@ -1758,22 +1763,25 @@ var IslandPrefsSchema = z19.object({
1758
1763
  * name, `#index` without one). `second`, written by older fronts, is the first monitor that is not the primary. */
1759
1764
  screen: z19.string().trim().min(1).max(200),
1760
1765
  position: z19.enum(["center", "left", "right"]),
1761
- /** A strip under a maximised window. */
1762
- discreet: z19.boolean(),
1766
+ /** Retired with the floating island (#27): it was a strip under a maximised window. Optional and never read, so a file or
1767
+ * a front that still carries it parses; still written by DEFAULT_ISLAND_PREFS because a daemon before #27 requires it in
1768
+ * `island.set`. */
1769
+ discreet: z19.boolean().optional(),
1763
1770
  islandScale: IslandScaleSchema,
1764
- panelScale: IslandScaleSchema,
1771
+ /** Retired with the floating island (#27): the island's size sizes its cards too. Optional and never read; still written by
1772
+ * DEFAULT_ISLAND_PREFS for daemons before #27, which require it. */
1773
+ panelScale: IslandScaleSchema.optional(),
1765
1774
  /** What the island shows besides asks and questions, which it always shows. */
1766
1775
  shows: z19.object({
1767
1776
  /** Allow, deny or answer in a line from the island; off, its cards only say « Open in Ledge ». */
1768
1777
  quick: z19.boolean(),
1769
- /** The 6 s bubble when an agent finishes. */
1778
+ /** The 6 s « Done » card when an agent finishes its turn. */
1770
1779
  finished: z19.boolean(),
1771
- /** An agent's sentence in a bubble. */
1772
- say: z19.boolean(),
1773
- /** The sub-agents next to their main agent. */
1774
- helpers: z19.boolean()
1780
+ /** Retired with the floating island (#27), like `helpers`: optional and never read, still written by default for older daemons. */
1781
+ say: z19.boolean().optional(),
1782
+ helpers: z19.boolean().optional()
1775
1783
  }),
1776
- /** The global shortcut that opens the island, as shown (`Ctrl Alt L`). */
1784
+ /** The global shortcut that reopens the oldest waiting request, as shown (`Ctrl Alt L`). */
1777
1785
  shortcut: z19.string().trim().min(1).max(40)
1778
1786
  });
1779
1787
 
@@ -2707,6 +2715,8 @@ var DaemonInfoSchema = z33.object({
2707
2715
  routines: z33.boolean().optional(),
2708
2716
  /** Answers a grouped `routine.cmd` (`others`) all or nothing: a client sends one only to a daemon that says it. */
2709
2717
  routineGroups: z33.boolean().optional(),
2718
+ /** Takes `session.label`: a session's nickname, kept with it. A client sends one only to a daemon that says it. */
2719
+ sessionLabel: z33.boolean().optional(),
2710
2720
  /** Its launcher answers `shell --nonce <N> <dir>` (#299): a free shell started through it gets the shell integration (OSC 633). */
2711
2721
  freeShell: z33.boolean().optional()
2712
2722
  });
@@ -3030,6 +3040,9 @@ var ClientMessageSchema = z33.discriminatedUnion("type", [
3030
3040
  z33.object({ type: z33.literal("session.delete"), id: z33.string() }),
3031
3041
  /** 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. */
3032
3042
  z33.object({ type: z33.literal("session.rename"), id: z33.string(), topic: z33.string().max(500) }),
3043
+ /** A session's nickname set from the sidebar (`sessionLabel` in the daemon's info), trimmed; empty removes it. Its name, its
3044
+ * address, does not change. */
3045
+ z33.object({ type: z33.literal("session.label"), id: z33.string(), label: z33.string().max(200) }),
3033
3046
  z33.object({ type: z33.literal("session.thread"), id: z33.string() }),
3034
3047
  z33.object({ type: z33.literal("session.register"), session: SessionSchema }),
3035
3048
  /** `agent` and `cwd` describe the session when the daemon does not know it yet (a hook from an agent started without ledge). */
@@ -3359,6 +3372,7 @@ var PHONE_RIG_NAME_MAX = 100;
3359
3372
  var PhoneSessionSchema = SwitchableSessionSchema.pick({
3360
3373
  id: true,
3361
3374
  name: true,
3375
+ label: true,
3362
3376
  tool: true,
3363
3377
  project: true,
3364
3378
  title: true,
@@ -4136,30 +4150,6 @@ var PhoneServerMessageSchema = z39.discriminatedUnion("type", [
4136
4150
  }).strict()
4137
4151
  ]);
4138
4152
 
4139
- // ../../packages/protocol/src/media.ts
4140
- import { z as z40 } from "zod";
4141
- var MediaCommandSchema = z40.enum(["previous", "play_pause", "next"]);
4142
- var ARTWORK_MAX_BYTES = 512 * 1024;
4143
- var NowPlayingSchema = z40.object({
4144
- /** The track's title; a session without one is not reported (nothing to show). */
4145
- title: z40.string().min(1),
4146
- /** '' when the player gives none (a web video often has no artist). */
4147
- artist: z40.string(),
4148
- album: z40.string().optional(),
4149
- /** The cover as a `data:image/…;base64,` URL; left out when the player has none, or it is over ARTWORK_MAX_BYTES. It can
4150
- * arrive in a later event than the track itself: players often publish the thumbnail a moment after the title. */
4151
- artwork: z40.string().startsWith("data:image/").optional(),
4152
- /** True while it plays; a paused session is still reported (with false), `null` means no media session at all. */
4153
- playing: z40.boolean(),
4154
- /** What the player accepts now; a control it refuses is disabled, not hidden, at the front's choice. */
4155
- can: z40.object({ previous: z40.boolean(), playPause: z40.boolean(), next: z40.boolean() }),
4156
- /** The player: SMTC's source app id (`Spotify.exe`, `MSEdge`, a packaged app's AUMID), and its display name when
4157
- * Windows knows one. Several players can hold a session: the one reported is the one playing (Windows' current one
4158
- * first), else Windows' current one. Commands go to that same player. */
4159
- player: z40.object({ id: z40.string().min(1), name: z40.string().optional() })
4160
- });
4161
- var NowPlayingStateSchema = NowPlayingSchema.nullable();
4162
-
4163
4153
  // src/config.ts
4164
4154
  var ConfigError = class extends Error {
4165
4155
  constructor(message) {
@@ -4167,8 +4157,8 @@ var ConfigError = class extends Error {
4167
4157
  this.name = "ConfigError";
4168
4158
  }
4169
4159
  };
4170
- var TokensSchema = z41.record(z41.string().min(1), z41.object({ accountId: z41.string().min(1), peer: RelayPeerSchema }));
4171
- var PortSchema = z41.coerce.number().int().min(0).max(65535);
4160
+ var TokensSchema = z40.record(z40.string().min(1), z40.object({ accountId: z40.string().min(1), peer: RelayPeerSchema }));
4161
+ var PortSchema = z40.coerce.number().int().min(0).max(65535);
4172
4162
  function required(env, name) {
4173
4163
  const v = env[name];
4174
4164
  if (!v) throw new ConfigError(`${name} is not set`);
@@ -4501,10 +4491,10 @@ function countedLog(log, ms) {
4501
4491
 
4502
4492
  // src/routes.ts
4503
4493
  import { createHash as createHash3, timingSafeEqual as timingSafeEqual2 } from "crypto";
4504
- import { z as z43 } from "zod";
4494
+ import { z as z42 } from "zod";
4505
4495
 
4506
4496
  // src/github.ts
4507
- import { z as z42 } from "zod";
4497
+ import { z as z41 } from "zod";
4508
4498
  var GitHubError = class extends Error {
4509
4499
  code;
4510
4500
  constructor(code) {
@@ -4513,21 +4503,21 @@ var GitHubError = class extends Error {
4513
4503
  this.code = code;
4514
4504
  }
4515
4505
  };
4516
- var DeviceStartSchema = z42.object({
4517
- device_code: z42.string().min(1),
4518
- user_code: z42.string().min(1),
4519
- verification_uri: z42.string().min(1),
4520
- expires_in: z42.number().int().positive(),
4521
- interval: z42.number().int().positive()
4522
- });
4523
- var TokenAnswerSchema = z42.object({
4524
- access_token: z42.string().min(1).optional(),
4525
- error: z42.string().optional(),
4526
- interval: z42.number().int().positive().optional()
4527
- });
4528
- var UserSchema = z42.object({
4529
- id: z42.number().int().nonnegative(),
4530
- login: z42.string().min(1)
4506
+ var DeviceStartSchema = z41.object({
4507
+ device_code: z41.string().min(1),
4508
+ user_code: z41.string().min(1),
4509
+ verification_uri: z41.string().min(1),
4510
+ expires_in: z41.number().int().positive(),
4511
+ interval: z41.number().int().positive()
4512
+ });
4513
+ var TokenAnswerSchema = z41.object({
4514
+ access_token: z41.string().min(1).optional(),
4515
+ error: z41.string().optional(),
4516
+ interval: z41.number().int().positive().optional()
4517
+ });
4518
+ var UserSchema = z41.object({
4519
+ id: z41.number().int().nonnegative(),
4520
+ login: z41.string().min(1)
4531
4521
  });
4532
4522
  var DEVICE_GRANT = "urn:ietf:params:oauth:grant-type:device_code";
4533
4523
  var USER_AGENT = "ledge-relay";
@@ -4782,10 +4772,10 @@ async function readJson(req, schema, max = MAX_BODY) {
4782
4772
  if (!r.success) throw new Answer(400, "bad_request");
4783
4773
  return r.data;
4784
4774
  }
4785
- var RevokeBodySchema = z43.object({
4775
+ var RevokeBodySchema = z42.object({
4786
4776
  peer: RelayPeerSchema.refine((p) => p !== "pc")
4787
4777
  });
4788
- var PollBodySchema = z43.object({ deviceCode: z43.string().min(1).max(1024) });
4778
+ var PollBodySchema = z42.object({ deviceCode: z42.string().min(1).max(1024) });
4789
4779
  function authRoutes(deps) {
4790
4780
  const maxCalls = deps.maxGitHubCalls ?? DEFAULT_MAX_GITHUB_CALLS;
4791
4781
  let inFlight = 0;
package/dist/cli.js CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  parsePublicUrl,
8
8
  startRelay,
9
9
  startupErrorLine
10
- } from "./chunk-ELUIOWWS.js";
10
+ } from "./chunk-XQMLJ5JA.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-ELUIOWWS.js";
5
+ } from "./chunk-XQMLJ5JA.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.65.0",
3
+ "version": "0.67.0",
4
4
  "license": "PolyForm-Noncommercial-1.0.0",
5
5
  "repository": {
6
6
  "type": "git",