@paradow/ledge-relay 0.67.0 → 0.68.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 z40 } from "zod";
5
+ import { z as z41 } from "zod";
6
6
 
7
7
  // ../../packages/protocol/src/attachments.ts
8
8
  import { z } from "zod";
@@ -1722,23 +1722,43 @@ var TermOutputSchema = z16.object({ type: z16.literal("term.output"), id, shell:
1722
1722
  var TermSizeSchema = z16.object({ type: z16.literal("term.size"), id, shell: shell.optional(), cols, rows });
1723
1723
  var TermExitSchema = z16.object({ type: z16.literal("term.exit"), id, shell: shell.optional(), why: PaneExitWhySchema });
1724
1724
 
1725
+ // ../../packages/protocol/src/aside.ts
1726
+ import { z as z17 } from "zod";
1727
+ var ASIDE_QUESTION_MAX = 4e3;
1728
+ var ASIDE_ANSWER_MAX = 5e4;
1729
+ var AsideStateSchema = z17.enum(["asking", "answered", "failed"]);
1730
+ var AsideCauseSchema = z17.enum(["unsupported", "read_only", "busy", "not_empty", "no_panel", "timeout", "unreadable", "interrupted", "invalid"]).catch("invalid");
1731
+ var AsideSchema = z17.object({
1732
+ rid: z17.string().min(1).max(100),
1733
+ question: z17.string().max(ASIDE_QUESTION_MAX),
1734
+ askedAt: z17.string().datetime(),
1735
+ state: AsideStateSchema,
1736
+ /** The answer as Claude Code copies it: Markdown. */
1737
+ answer: z17.string().max(ASIDE_ANSWER_MAX).optional(),
1738
+ truncated: z17.literal(true).optional(),
1739
+ answeredAt: z17.string().datetime().optional(),
1740
+ cause: AsideCauseSchema.optional()
1741
+ });
1742
+ var SessionAsideAskSchema = z17.object({ type: z17.literal("session.aside"), id: z17.string().min(1), rid: z17.string().min(1).max(100), question: z17.string().trim().min(1).max(ASIDE_QUESTION_MAX) });
1743
+ var SessionAsideSchema = z17.object({ type: z17.literal("session.aside"), id: z17.string().min(1), aside: AsideSchema });
1744
+
1725
1745
  // ../../packages/protocol/src/machines.ts
1726
- import { z as z18 } from "zod";
1746
+ import { z as z19 } from "zod";
1727
1747
 
1728
1748
  // ../../packages/protocol/src/ssh.ts
1729
- import { z as z17 } from "zod";
1730
- var SshAliasSchema = z17.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9_.-]{0,127}$/);
1749
+ import { z as z18 } from "zod";
1750
+ var SshAliasSchema = z18.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9_.-]{0,127}$/);
1731
1751
 
1732
1752
  // ../../packages/protocol/src/machines.ts
1733
- var MachineIdSchema = z18.string().regex(/^[a-zA-Z0-9_-]{1,64}$/);
1734
- var MachineSchema = z18.object({
1753
+ var MachineIdSchema = z19.string().regex(/^[a-zA-Z0-9_-]{1,64}$/);
1754
+ var MachineSchema = z19.object({
1735
1755
  id: MachineIdSchema,
1736
- label: z18.string().trim().min(1).max(80),
1756
+ label: z19.string().trim().min(1).max(80),
1737
1757
  ssh: SshAliasSchema.optional(),
1738
1758
  /** Kept in the list but never connected to: no peer, no retry, no session shown until it is enabled again. */
1739
- disabled: z18.boolean().optional()
1759
+ disabled: z19.boolean().optional()
1740
1760
  });
1741
- var MachinesSchema = z18.array(MachineSchema).min(1).max(20).superRefine((list, ctx) => {
1761
+ var MachinesSchema = z19.array(MachineSchema).min(1).max(20).superRefine((list, ctx) => {
1742
1762
  if (list[0]?.id !== "local" || list[0].ssh !== void 0) ctx.addIssue({ code: "custom", message: "the first machine is local, without ssh", path: [0] });
1743
1763
  const ids = /* @__PURE__ */ new Set(), aliases = /* @__PURE__ */ new Set();
1744
1764
  list.forEach((m, i) => {
@@ -1754,57 +1774,57 @@ var MachinesSchema = z18.array(MachineSchema).min(1).max(20).superRefine((list,
1754
1774
  });
1755
1775
 
1756
1776
  // ../../packages/protocol/src/island.ts
1757
- import { z as z19 } from "zod";
1758
- var IslandScaleSchema = z19.union([z19.literal("auto"), z19.literal(1), z19.literal(1.25), z19.literal(1.5), z19.literal(2)]);
1759
- var IslandPrefsSchema = z19.object({
1777
+ import { z as z20 } from "zod";
1778
+ var IslandScaleSchema = z20.union([z20.literal("auto"), z20.literal(1), z20.literal(1.25), z20.literal(1.5), z20.literal(2)]);
1779
+ var IslandPrefsSchema = z20.object({
1760
1780
  /** Shown at the top of the screen; hidden, Desktop still notifies. */
1761
- visible: z19.boolean(),
1781
+ visible: z20.boolean(),
1762
1782
  /** `primary` (whichever it is after a reconfiguration), or a monitor's id as the shell lists it (`list_monitors`: the OS
1763
1783
  * name, `#index` without one). `second`, written by older fronts, is the first monitor that is not the primary. */
1764
- screen: z19.string().trim().min(1).max(200),
1765
- position: z19.enum(["center", "left", "right"]),
1784
+ screen: z20.string().trim().min(1).max(200),
1785
+ position: z20.enum(["center", "left", "right"]),
1766
1786
  /** Retired with the floating island (#27): it was a strip under a maximised window. Optional and never read, so a file or
1767
1787
  * a front that still carries it parses; still written by DEFAULT_ISLAND_PREFS because a daemon before #27 requires it in
1768
1788
  * `island.set`. */
1769
- discreet: z19.boolean().optional(),
1789
+ discreet: z20.boolean().optional(),
1770
1790
  islandScale: IslandScaleSchema,
1771
1791
  /** Retired with the floating island (#27): the island's size sizes its cards too. Optional and never read; still written by
1772
1792
  * DEFAULT_ISLAND_PREFS for daemons before #27, which require it. */
1773
1793
  panelScale: IslandScaleSchema.optional(),
1774
1794
  /** What the island shows besides asks and questions, which it always shows. */
1775
- shows: z19.object({
1795
+ shows: z20.object({
1776
1796
  /** Allow, deny or answer in a line from the island; off, its cards only say « Open in Ledge ». */
1777
- quick: z19.boolean(),
1797
+ quick: z20.boolean(),
1778
1798
  /** The 6 s « Done » card when an agent finishes its turn. */
1779
- finished: z19.boolean(),
1799
+ finished: z20.boolean(),
1780
1800
  /** 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()
1801
+ say: z20.boolean().optional(),
1802
+ helpers: z20.boolean().optional()
1783
1803
  }),
1784
1804
  /** The global shortcut that reopens the oldest waiting request, as shown (`Ctrl Alt L`). */
1785
- shortcut: z19.string().trim().min(1).max(40)
1805
+ shortcut: z20.string().trim().min(1).max(40)
1786
1806
  });
1787
1807
 
1788
1808
  // ../../packages/protocol/src/projects.ts
1789
- import { z as z20 } from "zod";
1790
- var ProjectColorSchema = z20.enum(["blue", "green", "amber", "violet", "teal", "pink", "red", "slate"]);
1791
- var ProjectIdSchema = z20.string().regex(/^[a-z0-9][a-z0-9-]{0,63}$/);
1809
+ import { z as z21 } from "zod";
1810
+ var ProjectColorSchema = z21.enum(["blue", "green", "amber", "violet", "teal", "pink", "red", "slate"]);
1811
+ var ProjectIdSchema = z21.string().regex(/^[a-z0-9][a-z0-9-]{0,63}$/);
1792
1812
  function normalizePath(raw) {
1793
1813
  const p = raw.trim().replace(/\/+/g, "/");
1794
1814
  return p.length > 1 && p.endsWith("/") ? p.slice(0, -1) : p;
1795
1815
  }
1796
- var PathSchema = z20.string().max(4096).refine((p) => p.startsWith("/") && p === normalizePath(p), "an absolute, normalized path");
1816
+ var PathSchema = z21.string().max(4096).refine((p) => p.startsWith("/") && p === normalizePath(p), "an absolute, normalized path");
1797
1817
  var FolderPathSchema = PathSchema;
1798
- var RepoSchema = z20.object({ machine: MachineIdSchema, path: PathSchema });
1799
- var ProjectNameSchema = z20.string().trim().min(1).max(80);
1800
- var ProjectSchema = z20.object({
1818
+ var RepoSchema = z21.object({ machine: MachineIdSchema, path: PathSchema });
1819
+ var ProjectNameSchema = z21.string().trim().min(1).max(80);
1820
+ var ProjectSchema = z21.object({
1801
1821
  id: ProjectIdSchema,
1802
1822
  name: ProjectNameSchema,
1803
1823
  color: ProjectColorSchema,
1804
- description: z20.string().max(500).default(""),
1805
- repos: z20.array(RepoSchema).max(50)
1824
+ description: z21.string().max(500).default(""),
1825
+ repos: z21.array(RepoSchema).max(50)
1806
1826
  });
1807
- var RuleSchema = z20.object({ machine: MachineIdSchema, path: PathSchema, project: ProjectIdSchema });
1827
+ var RuleSchema = z21.object({ machine: MachineIdSchema, path: PathSchema, project: ProjectIdSchema });
1808
1828
  function projectsProblems(p) {
1809
1829
  const out = [];
1810
1830
  const ids = /* @__PURE__ */ new Set(), names = /* @__PURE__ */ new Set(), repos = /* @__PURE__ */ new Set(), rules = /* @__PURE__ */ new Set();
@@ -1831,8 +1851,8 @@ ${rule.path}`;
1831
1851
  return out;
1832
1852
  }
1833
1853
  var SESSION_ORDER_MAX = 500;
1834
- var SessionOrderSchema = z20.record(z20.string().max(64), z20.array(z20.string().min(1).max(300)).max(SESSION_ORDER_MAX));
1835
- var ProjectsSchema = z20.object({ projects: z20.array(ProjectSchema).max(100), rules: z20.array(RuleSchema).max(1e3), order: SessionOrderSchema.optional() }).superRefine((p, ctx) => {
1854
+ var SessionOrderSchema = z21.record(z21.string().max(64), z21.array(z21.string().min(1).max(300)).max(SESSION_ORDER_MAX));
1855
+ var ProjectsSchema = z21.object({ projects: z21.array(ProjectSchema).max(100), rules: z21.array(RuleSchema).max(1e3), order: SessionOrderSchema.optional() }).superRefine((p, ctx) => {
1836
1856
  for (const problem of projectsProblems(p)) ctx.addIssue({ code: "custom", message: problem.code, path: problem.path });
1837
1857
  });
1838
1858
 
@@ -1841,421 +1861,421 @@ var BROADCAST_SESSIONS_MAX = 32;
1841
1861
  var BROADCAST_LABEL_MAX = 120;
1842
1862
 
1843
1863
  // ../../packages/protocol/src/messages.ts
1844
- import { z as z33 } from "zod";
1864
+ import { z as z34 } from "zod";
1845
1865
 
1846
1866
  // ../../packages/protocol/src/repos.ts
1847
- import { z as z21 } from "zod";
1848
- var ReposInspectSchema = z21.object({
1849
- type: z21.literal("repos.inspect"),
1850
- requestId: z21.string().min(1).max(100),
1851
- paths: z21.array(z21.string().min(1)).min(1).max(50),
1852
- machineId: z21.string().optional()
1853
- });
1854
- var RepoInfoSchema = z21.object({ path: z21.string(), exists: z21.boolean(), branch: z21.string().nullable() });
1855
- var ReposInfoSchema = z21.object({ type: z21.literal("repos.info"), requestId: z21.string(), repos: z21.array(RepoInfoSchema) });
1867
+ import { z as z22 } from "zod";
1868
+ var ReposInspectSchema = z22.object({
1869
+ type: z22.literal("repos.inspect"),
1870
+ requestId: z22.string().min(1).max(100),
1871
+ paths: z22.array(z22.string().min(1)).min(1).max(50),
1872
+ machineId: z22.string().optional()
1873
+ });
1874
+ var RepoInfoSchema = z22.object({ path: z22.string(), exists: z22.boolean(), branch: z22.string().nullable() });
1875
+ var ReposInfoSchema = z22.object({ type: z22.literal("repos.info"), requestId: z22.string(), repos: z22.array(RepoInfoSchema) });
1856
1876
 
1857
1877
  // ../../packages/protocol/src/commands.ts
1858
- import { z as z22 } from "zod";
1859
- var SlashSourceSchema = z22.enum(["builtin", "project", "user", "plugin", "extension"]);
1878
+ import { z as z23 } from "zod";
1879
+ var SlashSourceSchema = z23.enum(["builtin", "project", "user", "plugin", "extension"]);
1860
1880
  var SLASH_COMMANDS_MAX = 400;
1861
1881
  var SLASH_DESCRIPTION_MAX = 300;
1862
- var SlashCommandSchema = z22.object({
1863
- name: z22.string().min(1).max(200),
1864
- description: z22.string().max(SLASH_DESCRIPTION_MAX).optional(),
1865
- argumentHint: z22.string().max(200).optional(),
1866
- aliases: z22.array(z22.string().min(1).max(200)).max(10).optional(),
1882
+ var SlashCommandSchema = z23.object({
1883
+ name: z23.string().min(1).max(200),
1884
+ description: z23.string().max(SLASH_DESCRIPTION_MAX).optional(),
1885
+ argumentHint: z23.string().max(200).optional(),
1886
+ aliases: z23.array(z23.string().min(1).max(200)).max(10).optional(),
1867
1887
  source: SlashSourceSchema,
1868
- blocked: z22.enum(["panel", "close"]).optional(),
1869
- bare: z22.literal("panel").optional()
1870
- });
1871
- var SessionCommandsSchema = z22.object({ type: z22.literal("session.commands"), requestId: z22.string().min(1).max(100), id: z22.string() });
1872
- var SessionCommandsListingSchema = z22.object({
1873
- type: z22.literal("session.commands.listing"),
1874
- requestId: z22.string(),
1875
- id: z22.string(),
1888
+ blocked: z23.enum(["panel", "close"]).optional(),
1889
+ bare: z23.literal("panel").optional()
1890
+ });
1891
+ var SessionCommandsSchema = z23.object({ type: z23.literal("session.commands"), requestId: z23.string().min(1).max(100), id: z23.string() });
1892
+ var SessionCommandsListingSchema = z23.object({
1893
+ type: z23.literal("session.commands.listing"),
1894
+ requestId: z23.string(),
1895
+ id: z23.string(),
1876
1896
  tool: ToolSchema.optional(),
1877
- commands: z22.array(SlashCommandSchema).max(SLASH_COMMANDS_MAX),
1878
- error: z22.string().max(200).optional()
1897
+ commands: z23.array(SlashCommandSchema).max(SLASH_COMMANDS_MAX),
1898
+ error: z23.string().max(200).optional()
1879
1899
  });
1880
1900
 
1881
1901
  // ../../packages/protocol/src/scan.ts
1882
- import { z as z23 } from "zod";
1883
- var ReposScanSchema = z23.object({ type: z23.literal("repos.scan"), requestId: z23.string().min(1).max(100), machineId: z23.string().optional() });
1884
- var FoundRepoSchema = z23.object({ path: z23.string(), branch: z23.string().nullable(), remote: z23.string().optional(), manifest: z23.string().max(200).optional() });
1885
- var ReposFoundSchema = z23.object({ type: z23.literal("repos.found"), requestId: z23.string(), repos: z23.array(FoundRepoSchema).max(500), truncated: z23.boolean(), error: z23.string().optional() });
1902
+ import { z as z24 } from "zod";
1903
+ var ReposScanSchema = z24.object({ type: z24.literal("repos.scan"), requestId: z24.string().min(1).max(100), machineId: z24.string().optional() });
1904
+ var FoundRepoSchema = z24.object({ path: z24.string(), branch: z24.string().nullable(), remote: z24.string().optional(), manifest: z24.string().max(200).optional() });
1905
+ var ReposFoundSchema = z24.object({ type: z24.literal("repos.found"), requestId: z24.string(), repos: z24.array(FoundRepoSchema).max(500), truncated: z24.boolean(), error: z24.string().optional() });
1886
1906
 
1887
1907
  // ../../packages/protocol/src/rigMessages.ts
1888
- import { z as z24 } from "zod";
1889
- var QitemIdSchema = z24.string().regex(/^qitem-[A-Za-z0-9-]{1,120}$/, "not a qitem");
1908
+ import { z as z25 } from "zod";
1909
+ var QitemIdSchema = z25.string().regex(/^qitem-[A-Za-z0-9-]{1,120}$/, "not a qitem");
1890
1910
  var QITEM = "qitem-[A-Za-z0-9-]+";
1891
- var RigKindSchema = z24.enum(["message", "handoff", "unblocked", "openrig", "unreadable"]);
1892
- var RigInfoSchema = z24.object({
1911
+ var RigKindSchema = z25.enum(["message", "handoff", "unblocked", "openrig", "unreadable"]);
1912
+ var RigInfoSchema = z25.object({
1893
1913
  kind: RigKindSchema,
1894
1914
  /** The envelope's From, as written (`pilot-lead@ledge-dev-2`, `daemon@kernel`, `ledge@external`, `<unknown sender>`).
1895
1915
  * On the seat's own `sent`: absent (it is the seat). The item's `peer` is the Ledge session of that seat, when known. */
1896
- from: z24.string().optional(),
1916
+ from: z25.string().optional(),
1897
1917
  /** The envelope's To, as written (a seat, a list `a, b`, or `broadcast to <rig> (n seats)`); on an outgoing item, the
1898
1918
  * destination the command named. */
1899
- to: z24.string().optional(),
1919
+ to: z25.string().optional(),
1900
1920
  /** The envelope's `Sent:` stamp as an ISO time (OpenRig gives no year: the year of receipt, or the year before when
1901
1921
  * that would put it in the future). Absent when the envelope has no `Sent:` line. */
1902
- sentAt: z24.string().datetime().optional(),
1922
+ sentAt: z25.string().datetime().optional(),
1903
1923
  /** The sender's generation (8 hex), when the stamp carries one. */
1904
- gen: z24.string().optional(),
1924
+ gen: z25.string().optional(),
1905
1925
  /** The row the item is about. `handoff`: the row handed (outgoing: the new row, when the command's output names it);
1906
1926
  * `unblocked`: the parked row now pending; `openrig`: the row it names (a stuck sweep: the stalled row). */
1907
1927
  qitem: QitemIdSchema.optional(),
1908
1928
  /** `handoff`: the row's summary as OpenRig carried it (one line, at most 120 characters, `…` when cut). */
1909
- summary: z24.string().optional(),
1929
+ summary: z25.string().optional(),
1910
1930
  /** `unblocked`: the row whose closing unblocked it. */
1911
1931
  blocker: QitemIdSchema.optional(),
1912
1932
  /** `openrig`: the recovery row OpenRig opened for it (a stuck sweep comes as a handoff of a `qitem-recovery-…` row). */
1913
1933
  recovery: QitemIdSchema.optional(),
1914
1934
  /** `openrig`: `stalled` a stuck sweep (a seat that does not move: amber), `custody` a custody check; else absent. */
1915
- alert: z24.enum(["stalled", "custody"]).optional(),
1935
+ alert: z25.enum(["stalled", "custody"]).optional(),
1916
1936
  /** `openrig` with an alert: how long, in minutes, as OpenRig said. */
1917
- minutes: z24.number().int().nonnegative().optional(),
1937
+ minutes: z25.number().int().nonnegative().optional(),
1918
1938
  /** The seat's own command (an outgoing `sent` or `handoff`): the Bash command, as run. */
1919
- command: z24.string().optional(),
1939
+ command: z25.string().optional(),
1920
1940
  /** OpenRig said the delivery may repeat (`Recovered queue notification`). */
1921
- recovered: z24.literal(true).optional(),
1941
+ recovered: z25.literal(true).optional(),
1922
1942
  /** Received that many times (2 or more): the same block came again, and this item stands for all of them. */
1923
- count: z24.number().int().min(2).optional(),
1943
+ count: z25.number().int().min(2).optional(),
1924
1944
  /** Blocks pasted together in one prompt: the prompt's id, this block's place and how many there were. The front shows
1925
1945
  * one raw for the packet, the raws of its items joined. */
1926
- packet: z24.object({ id: z24.string().min(1), index: z24.number().int().nonnegative(), count: z24.number().int().min(2) }).optional(),
1946
+ packet: z25.object({ id: z25.string().min(1), index: z25.number().int().nonnegative(), count: z25.number().int().min(2) }).optional(),
1927
1947
  /** The block exactly as received (every delivery, separated by a blank line, when `count` is set); outgoing: the command
1928
1948
  * and what it printed. Always there. */
1929
- raw: z24.string()
1949
+ raw: z25.string()
1930
1950
  });
1931
1951
  var HANDOFF = new RegExp(`^Queue handoff: (${QITEM}) - check your queue\\.(?: Summary: (.*))?$`);
1932
1952
  var BLOCKER = new RegExp(`^Blocker (${QITEM}) resolved; parked qitem (${QITEM}) is pending\\.`);
1933
1953
  var STALLED = new RegExp(`^Stuck sweep: \\S+ on (${QITEM}) \\((\\d+) min\\)`);
1934
1954
  var CUSTODY = new RegExp(`^Custody not checked\\b.*?(?:for |of )(${QITEM}).*?\\((\\d+) min\\)`);
1935
- var RigRowSchema = z24.object({
1955
+ var RigRowSchema = z25.object({
1936
1956
  id: QitemIdSchema,
1937
- state: z24.string().min(1),
1938
- summary: z24.string().optional(),
1957
+ state: z25.string().min(1),
1958
+ summary: z25.string().optional(),
1939
1959
  /** Who made it and who holds it (seats). */
1940
- from: z24.string(),
1941
- to: z24.string(),
1960
+ from: z25.string(),
1961
+ to: z25.string(),
1942
1962
  /** `handed-off`: the seat it went to. */
1943
- handedOffTo: z24.string().optional(),
1963
+ handedOffTo: z25.string().optional(),
1944
1964
  /** `blocked`: the row it waits on. */
1945
- blockedOn: z24.string().optional(),
1946
- createdAt: z24.string(),
1947
- claimedAt: z24.string().optional(),
1948
- updatedAt: z24.string(),
1965
+ blockedOn: z25.string().optional(),
1966
+ createdAt: z25.string(),
1967
+ claimedAt: z25.string().optional(),
1968
+ updatedAt: z25.string(),
1949
1969
  /** When Ledge read it. */
1950
- at: z24.string(),
1970
+ at: z25.string(),
1951
1971
  /** The request waits on a prompt (`waiting.liveness.needsInput`): how many, and why (`permission_prompt`…). Only set when `count` > 0. */
1952
- needsInput: z24.object({ count: z24.number().int().min(1), reason: z24.string().nullable() }).optional()
1953
- });
1954
- var OpenRigRowSchema = z24.object({ type: z24.literal("openrig.row"), requestId: z24.string().min(1).max(100), qitem: QitemIdSchema, machineId: z24.string().optional() });
1955
- var OpenRigRowStateSchema = z24.object({
1956
- type: z24.literal("openrig.rowState"),
1957
- requestId: z24.string(),
1958
- machineId: z24.string().optional(),
1959
- qitem: z24.string(),
1972
+ needsInput: z25.object({ count: z25.number().int().min(1), reason: z25.string().nullable() }).optional()
1973
+ });
1974
+ var OpenRigRowSchema = z25.object({ type: z25.literal("openrig.row"), requestId: z25.string().min(1).max(100), qitem: QitemIdSchema, machineId: z25.string().optional() });
1975
+ var OpenRigRowStateSchema = z25.object({
1976
+ type: z25.literal("openrig.rowState"),
1977
+ requestId: z25.string(),
1978
+ machineId: z25.string().optional(),
1979
+ qitem: z25.string(),
1960
1980
  row: RigRowSchema.optional(),
1961
- error: z24.string().optional()
1962
- });
1963
- var OpenRigQueueSchema = z24.object({ type: z24.literal("openrig.queue"), requestId: z24.string().min(1).max(100), machineId: z24.string().optional(), rig: RigNameSchema });
1964
- var OpenRigQueueStateSchema = z24.object({
1965
- type: z24.literal("openrig.queueState"),
1966
- requestId: z24.string(),
1967
- machineId: z24.string().optional(),
1968
- rig: z24.string(),
1969
- rows: z24.array(RigRowSchema),
1970
- truncated: z24.boolean(),
1971
- error: z24.string().optional()
1981
+ error: z25.string().optional()
1982
+ });
1983
+ var OpenRigQueueSchema = z25.object({ type: z25.literal("openrig.queue"), requestId: z25.string().min(1).max(100), machineId: z25.string().optional(), rig: RigNameSchema });
1984
+ var OpenRigQueueStateSchema = z25.object({
1985
+ type: z25.literal("openrig.queueState"),
1986
+ requestId: z25.string(),
1987
+ machineId: z25.string().optional(),
1988
+ rig: z25.string(),
1989
+ rows: z25.array(RigRowSchema),
1990
+ truncated: z25.boolean(),
1991
+ error: z25.string().optional()
1972
1992
  });
1973
1993
 
1974
1994
  // ../../packages/protocol/src/openrigRoles.ts
1975
- import { z as z25 } from "zod";
1976
- var RoleUnknownWhySchema = z25.enum(["resolved_at_launch", "not_exposed", "unreadable", "ambiguous", "not_found", "missing_from_guidance"]);
1977
- var RoleFromSchema = z25.enum(["import", "defaults", "profile", "rig", "pod", "member", "launch", "openrig", "plugin", "seat"]);
1978
- var OriginSchema = z25.discriminatedUnion("kind", [
1979
- z25.object({ kind: z25.literal("here"), key: z25.string().optional() }),
1980
- z25.object({ kind: z25.literal("inherited"), from: RoleFromSchema, ref: z25.string().optional(), key: z25.string().optional(), path: z25.string().optional() }),
1981
- z25.object({ kind: z25.literal("absent") }),
1982
- z25.object({ kind: z25.literal("unknown"), why: RoleUnknownWhySchema, detail: z25.string().optional() })
1995
+ import { z as z26 } from "zod";
1996
+ var RoleUnknownWhySchema = z26.enum(["resolved_at_launch", "not_exposed", "unreadable", "ambiguous", "not_found", "missing_from_guidance"]);
1997
+ var RoleFromSchema = z26.enum(["import", "defaults", "profile", "rig", "pod", "member", "launch", "openrig", "plugin", "seat"]);
1998
+ var OriginSchema = z26.discriminatedUnion("kind", [
1999
+ z26.object({ kind: z26.literal("here"), key: z26.string().optional() }),
2000
+ z26.object({ kind: z26.literal("inherited"), from: RoleFromSchema, ref: z26.string().optional(), key: z26.string().optional(), path: z26.string().optional() }),
2001
+ z26.object({ kind: z26.literal("absent") }),
2002
+ z26.object({ kind: z26.literal("unknown"), why: RoleUnknownWhySchema, detail: z26.string().optional() })
1983
2003
  ]);
1984
- var SourcedStringSchema = z25.object({ value: z25.string().nullable(), origin: OriginSchema });
1985
- var RoleResourceCategorySchema = z25.enum(["skill", "guidance", "plugin", "subagent", "runtime_resource"]);
1986
- var RoleResourceSchema = z25.object({
2004
+ var SourcedStringSchema = z26.object({ value: z26.string().nullable(), origin: OriginSchema });
2005
+ var RoleResourceCategorySchema = z26.enum(["skill", "guidance", "plugin", "subagent", "runtime_resource"]);
2006
+ var RoleResourceSchema = z26.object({
1987
2007
  category: RoleResourceCategorySchema,
1988
- id: z25.string(),
1989
- path: z25.string().optional(),
1990
- absolutePath: z25.string().optional(),
1991
- runtime: z25.string().optional(),
1992
- type: z25.string().optional(),
1993
- target: z25.string().optional(),
1994
- plugin: z25.object({ version: z25.string().optional(), skills: z25.array(z25.string()), hooks: z25.number().int().min(0) }).optional(),
2008
+ id: z26.string(),
2009
+ path: z26.string().optional(),
2010
+ absolutePath: z26.string().optional(),
2011
+ runtime: z26.string().optional(),
2012
+ type: z26.string().optional(),
2013
+ target: z26.string().optional(),
2014
+ plugin: z26.object({ version: z26.string().optional(), skills: z26.array(z26.string()), hooks: z26.number().int().min(0) }).optional(),
1995
2015
  origin: OriginSchema
1996
2016
  });
1997
- var RoleUsesListSchema = z25.object({ declared: z25.boolean(), key: z25.string(), items: z25.array(RoleResourceSchema) });
1998
- var StartupLayerSchema = z25.enum(["agent", "profile", "culture", "rig", "pod", "member", "openrig", "seat", "unknown"]);
1999
- var StartupEntrySchema = z25.object({
2000
- kind: z25.enum(["file", "action"]),
2001
- path: z25.string().optional(),
2002
- absolutePath: z25.string().optional(),
2003
- size: z25.number().int().min(0).optional(),
2004
- value: z25.string().optional(),
2005
- builtin: z25.string().optional(),
2017
+ var RoleUsesListSchema = z26.object({ declared: z26.boolean(), key: z26.string(), items: z26.array(RoleResourceSchema) });
2018
+ var StartupLayerSchema = z26.enum(["agent", "profile", "culture", "rig", "pod", "member", "openrig", "seat", "unknown"]);
2019
+ var StartupEntrySchema = z26.object({
2020
+ kind: z26.enum(["file", "action"]),
2021
+ path: z26.string().optional(),
2022
+ absolutePath: z26.string().optional(),
2023
+ size: z26.number().int().min(0).optional(),
2024
+ value: z26.string().optional(),
2025
+ builtin: z26.string().optional(),
2006
2026
  layer: StartupLayerSchema,
2007
- layerInferred: z25.boolean(),
2008
- delivery: z25.string(),
2009
- into: z25.string().optional(),
2010
- delivered: z25.boolean().optional(),
2011
- required: z25.boolean().optional(),
2012
- orientation: z25.string().optional(),
2013
- appliesOn: z25.array(z25.string()),
2027
+ layerInferred: z26.boolean(),
2028
+ delivery: z26.string(),
2029
+ into: z26.string().optional(),
2030
+ delivered: z26.boolean().optional(),
2031
+ required: z26.boolean().optional(),
2032
+ orientation: z26.string().optional(),
2033
+ appliesOn: z26.array(z26.string()),
2014
2034
  origin: OriginSchema
2015
2035
  });
2016
- var RoleFileErrorSchema = z25.object({ kind: z25.enum(["missing", "invalid"]), message: z25.string(), line: z25.number().int().optional(), col: z25.number().int().optional() });
2017
- var RoleSummarySchema = z25.object({
2018
- id: z25.string(),
2019
- name: z25.string(),
2020
- version: z25.string().optional(),
2021
- description: z25.string().optional(),
2022
- source: z25.enum(["builtin", "user"]),
2023
- path: z25.string(),
2024
- runtime: z25.string().optional(),
2025
- importOnly: z25.boolean(),
2026
- seats: z25.number().int().min(0),
2027
- running: z25.number().int().min(0),
2028
- skills: z25.array(z25.string()),
2029
- startupFiles: z25.array(z25.string()),
2036
+ var RoleFileErrorSchema = z26.object({ kind: z26.enum(["missing", "invalid"]), message: z26.string(), line: z26.number().int().optional(), col: z26.number().int().optional() });
2037
+ var RoleSummarySchema = z26.object({
2038
+ id: z26.string(),
2039
+ name: z26.string(),
2040
+ version: z26.string().optional(),
2041
+ description: z26.string().optional(),
2042
+ source: z26.enum(["builtin", "user"]),
2043
+ path: z26.string(),
2044
+ runtime: z26.string().optional(),
2045
+ importOnly: z26.boolean(),
2046
+ seats: z26.number().int().min(0),
2047
+ running: z26.number().int().min(0),
2048
+ skills: z26.array(z26.string()),
2049
+ startupFiles: z26.array(z26.string()),
2030
2050
  /** The seats that run it, so a seat of the Rigs page opens its role « seen from » it (`openrig.role` with `id`, then the seat by `rig` + `logicalId`). */
2031
- seatRefs: z25.array(z25.object({ rig: z25.string(), logicalId: z25.string(), session: z25.string().optional() })),
2032
- error: z25.enum(["missing", "invalid"]).optional()
2033
- });
2034
- var RoleImportSchema = z25.object({
2035
- ref: z25.string(),
2036
- key: z25.string(),
2037
- name: z25.string().optional(),
2038
- path: z25.string().optional(),
2039
- version: z25.string().optional(),
2040
- resolved: z25.boolean(),
2041
- error: z25.string().optional()
2042
- });
2043
- var RoleProfileSchema = z25.object({
2044
- name: z25.string(),
2045
- description: z25.string().optional(),
2051
+ seatRefs: z26.array(z26.object({ rig: z26.string(), logicalId: z26.string(), session: z26.string().optional() })),
2052
+ error: z26.enum(["missing", "invalid"]).optional()
2053
+ });
2054
+ var RoleImportSchema = z26.object({
2055
+ ref: z26.string(),
2056
+ key: z26.string(),
2057
+ name: z26.string().optional(),
2058
+ path: z26.string().optional(),
2059
+ version: z26.string().optional(),
2060
+ resolved: z26.boolean(),
2061
+ error: z26.string().optional()
2062
+ });
2063
+ var RoleProfileSchema = z26.object({
2064
+ name: z26.string(),
2065
+ description: z26.string().optional(),
2046
2066
  runtime: SourcedStringSchema,
2047
2067
  model: SourcedStringSchema,
2048
2068
  effort: SourcedStringSchema,
2049
- uses: z25.object({ skills: RoleUsesListSchema, guidance: RoleUsesListSchema, subagents: RoleUsesListSchema, plugins: RoleUsesListSchema, runtimeResources: RoleUsesListSchema }),
2069
+ uses: z26.object({ skills: RoleUsesListSchema, guidance: RoleUsesListSchema, subagents: RoleUsesListSchema, plugins: RoleUsesListSchema, runtimeResources: RoleUsesListSchema }),
2050
2070
  /** The role's share of the startup: agent then profile files and actions, in that order. */
2051
- startup: z25.array(StartupEntrySchema)
2052
- });
2053
- var RoleSeatSchema = z25.object({
2054
- rig: z25.string(),
2055
- rigId: z25.string(),
2056
- rigSpecPath: z25.string().optional(),
2057
- composed: z25.boolean(),
2058
- logicalId: z25.string(),
2059
- session: z25.string().optional(),
2060
- label: z25.string().optional(),
2061
- profile: z25.string(),
2062
- running: z25.boolean(),
2063
- activity: z25.string(),
2071
+ startup: z26.array(StartupEntrySchema)
2072
+ });
2073
+ var RoleSeatSchema = z26.object({
2074
+ rig: z26.string(),
2075
+ rigId: z26.string(),
2076
+ rigSpecPath: z26.string().optional(),
2077
+ composed: z26.boolean(),
2078
+ logicalId: z26.string(),
2079
+ session: z26.string().optional(),
2080
+ label: z26.string().optional(),
2081
+ profile: z26.string(),
2082
+ running: z26.boolean(),
2083
+ activity: z26.string(),
2064
2084
  runtime: SourcedStringSchema,
2065
2085
  model: SourcedStringSchema,
2066
2086
  effort: SourcedStringSchema,
2067
2087
  cwd: SourcedStringSchema,
2068
2088
  cultureFile: SourcedStringSchema,
2069
- member: z25.string().optional(),
2070
- memberStartup: z25.array(StartupEntrySchema),
2089
+ member: z26.string().optional(),
2090
+ memberStartup: z26.array(StartupEntrySchema),
2071
2091
  /** The Role tab of this seat: its role guidance (`role.md`), then the startup files of its own (member layer), in delivery
2072
2092
  * order — OpenRig's when the seat was launched, else the spec's. */
2073
- roleDocs: z25.array(StartupEntrySchema),
2074
- live: z25.object({
2075
- resolvedSpec: z25.object({ name: z25.string().optional(), version: z25.string().optional(), hash: z25.string().optional() }),
2076
- resources: z25.array(RoleResourceSchema),
2093
+ roleDocs: z26.array(StartupEntrySchema),
2094
+ live: z26.object({
2095
+ resolvedSpec: z26.object({ name: z26.string().optional(), version: z26.string().optional(), hash: z26.string().optional() }),
2096
+ resources: z26.array(RoleResourceSchema),
2077
2097
  /** In the order OpenRig returns them. */
2078
- startup: z25.array(StartupEntrySchema),
2098
+ startup: z26.array(StartupEntrySchema),
2079
2099
  /** `rig skill loadout --seat`: the skills projected for this seat; absent when it could not be read. */
2080
- skills: z25.array(z25.object({ id: z25.string(), trigger: z25.string().optional() })).optional()
2100
+ skills: z26.array(z26.object({ id: z26.string(), trigger: z26.string().optional() })).optional()
2081
2101
  }).optional()
2082
2102
  });
2083
- var RoleUnavailableSchema = z25.enum(["harness_prompt", "effective_settings", "delivered_content", "harness_own_files"]);
2084
- var RoleDetailSchema = z25.object({
2103
+ var RoleUnavailableSchema = z26.enum(["harness_prompt", "effective_settings", "delivered_content", "harness_own_files"]);
2104
+ var RoleDetailSchema = z26.object({
2085
2105
  summary: RoleSummarySchema,
2086
- file: z25.object({
2087
- path: z25.string(),
2088
- relativePath: z25.string().optional(),
2089
- modifiedAt: z25.string().optional(),
2090
- copies: z25.array(z25.object({ kind: z25.literal("repo"), path: z25.string(), identical: z25.boolean(), modifiedAt: z25.string().optional() }))
2106
+ file: z26.object({
2107
+ path: z26.string(),
2108
+ relativePath: z26.string().optional(),
2109
+ modifiedAt: z26.string().optional(),
2110
+ copies: z26.array(z26.object({ kind: z26.literal("repo"), path: z26.string(), identical: z26.boolean(), modifiedAt: z26.string().optional() }))
2091
2111
  }),
2092
2112
  error: RoleFileErrorSchema.optional(),
2093
- role: z25.object({ path: z25.string(), absolutePath: z25.string(), origin: OriginSchema }).nullable(),
2094
- defaults: z25.object({ runtime: SourcedStringSchema, model: SourcedStringSchema, effort: SourcedStringSchema }),
2095
- imports: z25.array(RoleImportSchema),
2096
- importedBy: z25.array(z25.string()),
2097
- profiles: z25.array(RoleProfileSchema),
2113
+ role: z26.object({ path: z26.string(), absolutePath: z26.string(), origin: OriginSchema }).nullable(),
2114
+ defaults: z26.object({ runtime: SourcedStringSchema, model: SourcedStringSchema, effort: SourcedStringSchema }),
2115
+ imports: z26.array(RoleImportSchema),
2116
+ importedBy: z26.array(z26.string()),
2117
+ profiles: z26.array(RoleProfileSchema),
2098
2118
  /** What the file declares in `resources`. */
2099
- resources: z25.array(RoleResourceSchema),
2100
- seats: z25.array(RoleSeatSchema),
2101
- unavailable: z25.array(RoleUnavailableSchema),
2102
- warnings: z25.array(z25.string()),
2103
- openrigVersion: z25.string().optional()
2104
- });
2105
- var RoleErrorSchema = z25.string();
2106
- var LibraryIdSchema = z25.string().min(1).max(200).regex(/^[A-Za-z0-9][A-Za-z0-9._:-]*$/, "not a library id");
2107
- var OpenRigRolesSchema = z25.object({ type: z25.literal("openrig.roles"), requestId: z25.string().min(1).max(100), machineId: z25.string().optional() });
2108
- var OpenRigRoleListSchema = z25.object({
2109
- type: z25.literal("openrig.roleList"),
2110
- requestId: z25.string(),
2111
- machineId: z25.string().optional(),
2112
- roles: z25.array(RoleSummarySchema),
2113
- openrigVersion: z25.string().optional(),
2119
+ resources: z26.array(RoleResourceSchema),
2120
+ seats: z26.array(RoleSeatSchema),
2121
+ unavailable: z26.array(RoleUnavailableSchema),
2122
+ warnings: z26.array(z26.string()),
2123
+ openrigVersion: z26.string().optional()
2124
+ });
2125
+ var RoleErrorSchema = z26.string();
2126
+ var LibraryIdSchema = z26.string().min(1).max(200).regex(/^[A-Za-z0-9][A-Za-z0-9._:-]*$/, "not a library id");
2127
+ var OpenRigRolesSchema = z26.object({ type: z26.literal("openrig.roles"), requestId: z26.string().min(1).max(100), machineId: z26.string().optional() });
2128
+ var OpenRigRoleListSchema = z26.object({
2129
+ type: z26.literal("openrig.roleList"),
2130
+ requestId: z26.string(),
2131
+ machineId: z26.string().optional(),
2132
+ roles: z26.array(RoleSummarySchema),
2133
+ openrigVersion: z26.string().optional(),
2114
2134
  error: RoleErrorSchema.optional()
2115
2135
  });
2116
- var OpenRigRoleSchema = z25.object({ type: z25.literal("openrig.role"), requestId: z25.string().min(1).max(100), machineId: z25.string().optional(), roleId: LibraryIdSchema });
2117
- var OpenRigRoleDetailSchema = z25.object({
2118
- type: z25.literal("openrig.roleDetail"),
2119
- requestId: z25.string(),
2120
- machineId: z25.string().optional(),
2121
- roleId: z25.string(),
2136
+ var OpenRigRoleSchema = z26.object({ type: z26.literal("openrig.role"), requestId: z26.string().min(1).max(100), machineId: z26.string().optional(), roleId: LibraryIdSchema });
2137
+ var OpenRigRoleDetailSchema = z26.object({
2138
+ type: z26.literal("openrig.roleDetail"),
2139
+ requestId: z26.string(),
2140
+ machineId: z26.string().optional(),
2141
+ roleId: z26.string(),
2122
2142
  role: RoleDetailSchema.optional(),
2123
2143
  error: RoleErrorSchema.optional()
2124
2144
  });
2125
- var OpenRigRoleFileSchema = z25.object({
2126
- type: z25.literal("openrig.roleFile"),
2127
- requestId: z25.string().min(1).max(100),
2128
- machineId: z25.string().optional(),
2145
+ var OpenRigRoleFileSchema = z26.object({
2146
+ type: z26.literal("openrig.roleFile"),
2147
+ requestId: z26.string().min(1).max(100),
2148
+ machineId: z26.string().optional(),
2129
2149
  roleId: LibraryIdSchema,
2130
- path: z25.string().min(1).max(4096)
2131
- });
2132
- var OpenRigRoleFileContentSchema = z25.object({
2133
- type: z25.literal("openrig.roleFileContent"),
2134
- requestId: z25.string(),
2135
- machineId: z25.string().optional(),
2136
- roleId: z25.string(),
2137
- path: z25.string(),
2138
- content: z25.string().optional(),
2139
- size: z25.number().int().min(0).optional(),
2140
- truncated: z25.boolean().optional(),
2150
+ path: z26.string().min(1).max(4096)
2151
+ });
2152
+ var OpenRigRoleFileContentSchema = z26.object({
2153
+ type: z26.literal("openrig.roleFileContent"),
2154
+ requestId: z26.string(),
2155
+ machineId: z26.string().optional(),
2156
+ roleId: z26.string(),
2157
+ path: z26.string(),
2158
+ content: z26.string().optional(),
2159
+ size: z26.number().int().min(0).optional(),
2160
+ truncated: z26.boolean().optional(),
2141
2161
  error: RoleErrorSchema.optional()
2142
2162
  });
2143
- var OpenRigRoleDuplicateSchema = z25.object({
2144
- type: z25.literal("openrig.role.duplicate"),
2145
- requestId: z25.string().min(1).max(100),
2146
- machineId: z25.string().optional(),
2163
+ var OpenRigRoleDuplicateSchema = z26.object({
2164
+ type: z26.literal("openrig.role.duplicate"),
2165
+ requestId: z26.string().min(1).max(100),
2166
+ machineId: z26.string().optional(),
2147
2167
  roleId: LibraryIdSchema,
2148
2168
  name: RigNameSchema
2149
2169
  });
2150
- var OpenRigRoleDuplicatedSchema = z25.object({
2151
- type: z25.literal("openrig.roleDuplicated"),
2152
- requestId: z25.string(),
2153
- machineId: z25.string().optional(),
2154
- ok: z25.boolean(),
2155
- roleId: z25.string().optional(),
2156
- path: z25.string().optional(),
2170
+ var OpenRigRoleDuplicatedSchema = z26.object({
2171
+ type: z26.literal("openrig.roleDuplicated"),
2172
+ requestId: z26.string(),
2173
+ machineId: z26.string().optional(),
2174
+ ok: z26.boolean(),
2175
+ roleId: z26.string().optional(),
2176
+ path: z26.string().optional(),
2157
2177
  error: RoleErrorSchema.optional()
2158
2178
  });
2159
2179
  var ROLE_FILE_MAX = 512 * 1024;
2160
2180
 
2161
2181
  // ../../packages/protocol/src/routing.ts
2162
- import { z as z26 } from "zod";
2163
- var MachineInventorySchema = z26.object({
2164
- id: z26.string().min(1).max(80),
2165
- label: z26.string().min(1).max(120),
2166
- online: z26.boolean(),
2167
- local: z26.boolean(),
2168
- sessions: z26.array(z26.object({ id: z26.string(), name: z26.string(), project: z26.string(), cwd: z26.string(), topic: z26.string().optional(), state: z26.string(), readOnly: z26.boolean() })).max(500),
2169
- folders: z26.array(z26.object({ project: z26.string(), cwd: z26.string() })).max(100)
2170
- });
2171
- var RoutingContextSchema = z26.object({
2172
- machines: z26.array(MachineInventorySchema).min(1).max(20),
2173
- history: z26.array(z26.object({ question: z26.string().max(2e4), answer: z26.string().max(2e4).optional(), machineId: z26.string().optional() })).max(50)
2174
- });
2175
- var RouteResultSchema = z26.object({
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({
2176
2196
  /** Null means an answer or a clarification, never an implicit local destination. */
2177
- machineId: z26.string().nullable(),
2178
- text: z26.string().min(1).max(2e4),
2179
- choices: z26.array(z26.string()).max(20).optional()
2197
+ machineId: z27.string().nullable(),
2198
+ text: z27.string().min(1).max(2e4),
2199
+ choices: z27.array(z27.string()).max(20).optional()
2180
2200
  });
2181
2201
 
2182
2202
  // ../../packages/protocol/src/thread.ts
2183
- import { z as z27 } from "zod";
2184
- var ToolStatusSchema = z27.enum(["running", "success", "failed", "unknown"]);
2185
- 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() });
2186
- var base = { id: z27.string().min(1), at: z27.string().datetime(), turn: z27.number().int().nonnegative(), helperId: z27.string().optional() };
2187
- var ThreadItemSchema = z27.discriminatedUnion("kind", [
2188
- z27.object({ kind: z27.literal("prompt"), ...base, text: z27.string(), images: z27.array(AttachmentRefSchema).optional() }),
2189
- z27.object({ kind: z27.literal("message"), ...base, text: z27.string() }),
2203
+ import { z as z28 } from "zod";
2204
+ var ToolStatusSchema = z28.enum(["running", "success", "failed", "unknown"]);
2205
+ var FileChangeSchema = z28.object({ path: z28.string().min(1), from: z28.string().min(1).optional(), change: z28.enum(["add", "edit", "delete", "write"]), diff: z28.string().optional() });
2206
+ var base = { id: z28.string().min(1), at: z28.string().datetime(), turn: z28.number().int().nonnegative(), helperId: z28.string().optional() };
2207
+ var ThreadItemSchema = z28.discriminatedUnion("kind", [
2208
+ z28.object({ kind: z28.literal("prompt"), ...base, text: z28.string(), images: z28.array(AttachmentRefSchema).optional() }),
2209
+ z28.object({ kind: z28.literal("message"), ...base, text: z28.string() }),
2190
2210
  /** `id` is the harness's tool_use_id when it gives one, so the result updates the same row; `byClose`: a question
2191
2211
  * dismissed by Ledge closing the session. */
2192
- z27.object({
2193
- kind: z27.literal("tool"),
2212
+ z28.object({
2213
+ kind: z28.literal("tool"),
2194
2214
  ...base,
2195
- tool: z27.string(),
2196
- label: z27.string(),
2197
- input: z27.string().optional(),
2198
- output: z27.string().optional(),
2199
- error: z27.string().optional(),
2215
+ tool: z28.string(),
2216
+ label: z28.string(),
2217
+ input: z28.string().optional(),
2218
+ output: z28.string().optional(),
2219
+ error: z28.string().optional(),
2200
2220
  status: ToolStatusSchema,
2201
- durationMs: z27.number().nonnegative().optional(),
2202
- files: z27.array(FileChangeSchema).default([]),
2203
- byClose: z27.literal(true).optional(),
2221
+ durationMs: z28.number().nonnegative().optional(),
2222
+ files: z28.array(FileChangeSchema).default([]),
2223
+ byClose: z28.literal(true).optional(),
2204
2224
  /** Images the tool returned (a browser screenshot), in order; `imagesDropped`: some were not kept. */
2205
- images: z27.array(AttachmentRefSchema).max(ATTACHMENTS_MAX).optional(),
2206
- imagesDropped: z27.literal(true).optional()
2225
+ images: z28.array(AttachmentRefSchema).max(ATTACHMENTS_MAX).optional(),
2226
+ imagesDropped: z28.literal(true).optional()
2207
2227
  }),
2208
2228
  /** `unknown`: answered in the terminal, the daemon only saw the prompt go away; `always`: allowed and not asked again;
2209
2229
  * `byClose`: denied by Ledge closing the session; `by`: who answered it from Ledge (the PC or a device, its name then). */
2210
- 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() }),
2211
- z27.object({ kind: z27.literal("reply"), ...base, text: z27.string() }),
2212
- z27.object({ kind: z27.literal("helper"), ...base, task: z27.string(), agentType: z27.string().optional(), state: z27.enum(["working", "exited"]) }),
2230
+ z28.object({ kind: z28.literal("permission"), ...base, tool: z28.string(), text: z28.string(), decision: z28.enum(["accept", "deny", "always", "unknown"]).optional(), byClose: z28.literal(true).optional(), by: DecidedBySchema.optional() }),
2231
+ z28.object({ kind: z28.literal("reply"), ...base, text: z28.string() }),
2232
+ z28.object({ kind: z28.literal("helper"), ...base, task: z28.string(), agentType: z28.string().optional(), state: z28.enum(["working", "exited"]) }),
2213
2233
  /** 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. */
2214
- z27.object({
2215
- kind: z27.literal("sent"),
2234
+ z28.object({
2235
+ kind: z28.literal("sent"),
2216
2236
  ...base,
2217
- to: z27.string(),
2218
- peer: z27.string().optional(),
2219
- summary: z27.string().optional(),
2220
- text: z27.string(),
2221
- status: z27.enum(["sending", "delivered", "read", "failed"]),
2222
- received: z27.string().optional(),
2223
- via: z27.literal("ledge").optional(),
2237
+ to: z28.string(),
2238
+ peer: z28.string().optional(),
2239
+ summary: z28.string().optional(),
2240
+ text: z28.string(),
2241
+ status: z28.enum(["sending", "delivered", "read", "failed"]),
2242
+ received: z28.string().optional(),
2243
+ via: z28.literal("ledge").optional(),
2224
2244
  /** The seat's own `rig send` (its Bash call), docs/mockups/ledge-openrig-messages.html: `rig.command` is what it ran. */
2225
2245
  rig: RigInfoSchema.optional()
2226
2246
  }),
2227
2247
  /** 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. */
2228
- z27.object({
2229
- kind: z27.literal("received"),
2248
+ z28.object({
2249
+ kind: z28.literal("received"),
2230
2250
  ...base,
2231
- from: z27.string(),
2232
- peer: z27.string().optional(),
2233
- text: z27.string(),
2234
- sent: z27.string().optional(),
2251
+ from: z28.string(),
2252
+ peer: z28.string().optional(),
2253
+ text: z28.string(),
2254
+ sent: z28.string().optional(),
2235
2255
  /** An OpenRig `rig send` typed into this seat (`rig.kind` `message`): `from` is the envelope's sender, `text` its body. */
2236
2256
  rig: RigInfoSchema.optional()
2237
2257
  }),
2238
2258
  /** An automated notice of the agent's harness about messages between sessions (Claude Code's `[Cross-session idle
2239
2259
  * notice]` / `[Cross-session delivery notice]`): a system event, never the user's words. `name` is the session it is
2240
2260
  * about as quoted, `peer` its Ledge session id; a delivery notice says the outcome of `count` messages to `recipients`. */
2241
- z27.object({
2242
- kind: z27.literal("notice"),
2261
+ z28.object({
2262
+ kind: z28.literal("notice"),
2243
2263
  ...base,
2244
- notice: z27.enum(["idle", "exited", "unavailable", "expired", "delivery", "other"]),
2264
+ notice: z28.enum(["idle", "exited", "unavailable", "expired", "delivery", "other"]),
2245
2265
  /** 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. */
2246
- task: z27.string().optional(),
2266
+ task: z28.string().optional(),
2247
2267
  /** A task this session handed over (`outgoing`), and how (issue #92). */
2248
- taskOp: z27.enum(TRANSMISSION_OPS).optional(),
2249
- outgoing: z27.literal(true).optional(),
2250
- name: z27.string().optional(),
2251
- peer: z27.string().optional(),
2252
- time: z27.string().optional(),
2253
- summary: z27.string().optional(),
2254
- status: z27.enum(["held", "denied", "expired", "delivered", "refused", "dropped", "unknown"]).optional(),
2255
- count: z27.number().int().positive().optional(),
2256
- recipients: z27.array(z27.string()).optional(),
2257
- reason: z27.string().optional(),
2258
- text: z27.string(),
2268
+ taskOp: z28.enum(TRANSMISSION_OPS).optional(),
2269
+ outgoing: z28.literal(true).optional(),
2270
+ name: z28.string().optional(),
2271
+ peer: z28.string().optional(),
2272
+ time: z28.string().optional(),
2273
+ summary: z28.string().optional(),
2274
+ status: z28.enum(["held", "denied", "expired", "delivered", "refused", "dropped", "unknown"]).optional(),
2275
+ count: z28.number().int().positive().optional(),
2276
+ recipients: z28.array(z28.string()).optional(),
2277
+ reason: z28.string().optional(),
2278
+ text: z28.string(),
2259
2279
  /** An OpenRig block that is not a message: a row handed to this seat or passed by it (`handoff`, `outgoing` for its own),
2260
2280
  * a row unblocked, OpenRig's own notice, or an unreadable block; `text` is the body (unreadable: the block as is). */
2261
2281
  rig: RigInfoSchema.optional()
@@ -2263,11 +2283,11 @@ var ThreadItemSchema = z27.discriminatedUnion("kind", [
2263
2283
  ]);
2264
2284
 
2265
2285
  // ../../packages/protocol/src/mobile.ts
2266
- import { z as z28 } from "zod";
2267
- var RelayUrlSchema = z28.string().transform((v, ctx) => {
2286
+ import { z as z29 } from "zod";
2287
+ var RelayUrlSchema = z29.string().transform((v, ctx) => {
2268
2288
  const bad = () => {
2269
- ctx.addIssue({ code: z28.ZodIssueCode.custom, message: "invalid relay URL" });
2270
- return z28.NEVER;
2289
+ ctx.addIssue({ code: z29.ZodIssueCode.custom, message: "invalid relay URL" });
2290
+ return z29.NEVER;
2271
2291
  };
2272
2292
  let u;
2273
2293
  try {
@@ -2280,168 +2300,168 @@ var RelayUrlSchema = z28.string().transform((v, ctx) => {
2280
2300
  if (u.username || u.password || u.pathname !== "/" || u.search || u.hash) return bad();
2281
2301
  return u.origin;
2282
2302
  });
2283
- var MobileConfigSchema = z28.object({ enabled: z28.boolean(), relayUrl: RelayUrlSchema, terminalInput: z28.boolean().optional() });
2284
- var MobileLinkStateSchema = z28.discriminatedUnion("state", [
2285
- z28.object({ state: z28.literal("off") }),
2286
- z28.object({ state: z28.literal("connecting") }),
2287
- z28.object({ state: z28.literal("online") }),
2288
- z28.object({ state: z28.literal("offline"), retryAt: z28.string().datetime(), error: z28.string() }),
2289
- z28.object({ state: z28.literal("signed_out"), reason: z28.enum(["other_pc", "session_invalid"]) }),
2303
+ var MobileConfigSchema = z29.object({ enabled: z29.boolean(), relayUrl: RelayUrlSchema, terminalInput: z29.boolean().optional() });
2304
+ var MobileLinkStateSchema = z29.discriminatedUnion("state", [
2305
+ z29.object({ state: z29.literal("off") }),
2306
+ z29.object({ state: z29.literal("connecting") }),
2307
+ z29.object({ state: z29.literal("online") }),
2308
+ z29.object({ state: z29.literal("offline"), retryAt: z29.string().datetime(), error: z29.string() }),
2309
+ z29.object({ state: z29.literal("signed_out"), reason: z29.enum(["other_pc", "session_invalid"]) }),
2290
2310
  /** The mobile service did not start (a broken mobile.json, a missing key store): nothing is linked until the daemon restarts. */
2291
- z28.object({ state: z28.literal("unavailable"), error: z28.string().max(200) })
2311
+ z29.object({ state: z29.literal("unavailable"), error: z29.string().max(200) })
2292
2312
  ]);
2293
- var DeviceKindSchema = z28.enum(["phone", "tablet"]);
2313
+ var DeviceKindSchema = z29.enum(["phone", "tablet"]);
2294
2314
  var DEVICE_NAME_MAX = 40;
2295
- var DeviceNameSchema = z28.string().trim().min(1).max(DEVICE_NAME_MAX).regex(/^[^\u0000-\u001f\u007f]+$/);
2296
- var MobilePairingSchema = z28.object({
2297
- id: z28.string(),
2298
- label: z28.string(),
2299
- code: z28.string().nullable(),
2300
- expiresAt: z28.string().datetime(),
2301
- state: z28.enum(["waiting", "confirm", "approved", "linked", "expired", "refused"])
2302
- });
2303
- var RecoveredSchema = z28.object({ at: z28.string().datetime(), model: z28.string().max(40).optional(), pending: z28.literal(true).optional() });
2304
- var MobileStateSchema = z28.object({
2305
- enabled: z28.boolean(),
2306
- relayUrl: z28.string(),
2307
- account: z28.object({ login: z28.string(), accountId: z28.string() }).nullable(),
2308
- signin: z28.object({ userCode: z28.string(), verificationUri: z28.string(), expiresAt: z28.string().datetime() }).nullable(),
2315
+ var DeviceNameSchema = z29.string().trim().min(1).max(DEVICE_NAME_MAX).regex(/^[^\u0000-\u001f\u007f]+$/);
2316
+ var MobilePairingSchema = z29.object({
2317
+ id: z29.string(),
2318
+ label: z29.string(),
2319
+ code: z29.string().nullable(),
2320
+ expiresAt: z29.string().datetime(),
2321
+ state: z29.enum(["waiting", "confirm", "approved", "linked", "expired", "refused"])
2322
+ });
2323
+ var RecoveredSchema = z29.object({ at: z29.string().datetime(), model: z29.string().max(40).optional(), pending: z29.literal(true).optional() });
2324
+ var MobileStateSchema = z29.object({
2325
+ enabled: z29.boolean(),
2326
+ relayUrl: z29.string(),
2327
+ account: z29.object({ login: z29.string(), accountId: z29.string() }).nullable(),
2328
+ signin: z29.object({ userCode: z29.string(), verificationUri: z29.string(), expiresAt: z29.string().datetime() }).nullable(),
2309
2329
  /** The last sign-in that did not end with a session; cleared by the next one. */
2310
- signinError: z28.enum(["expired", "denied", "not_allowed", "failed"]).nullable(),
2330
+ signinError: z29.enum(["expired", "denied", "not_allowed", "failed"]).nullable(),
2311
2331
  link: MobileLinkStateSchema,
2312
- devices: z28.array(z28.object({
2313
- id: z28.string(),
2314
- label: z28.string(),
2315
- approvedAt: z28.string(),
2316
- online: z28.boolean(),
2317
- lastSeenAt: z28.string().optional(),
2332
+ devices: z29.array(z29.object({
2333
+ id: z29.string(),
2334
+ label: z29.string(),
2335
+ approvedAt: z29.string(),
2336
+ online: z29.boolean(),
2337
+ lastSeenAt: z29.string().optional(),
2318
2338
  /** Absent from an older daemon; `name` absent: the user gave none, the front derives one from the label. */
2319
2339
  kind: DeviceKindSchema.optional(),
2320
- name: z28.string().optional(),
2340
+ name: z29.string().optional(),
2321
2341
  /** Its passkey can bring it back after a reinstall (registered with the PC key's digest, docs/mobile-passkey-recover-contract.md). */
2322
- recover: z28.literal(true).optional(),
2342
+ recover: z29.literal(true).optional(),
2323
2343
  /** It came back with its passkey: when, on what it says it runs (`iPhone`, `iPad`), and `pending` until « C'était bien moi »
2324
2344
  * (`mobile.device.ack` `recovered`). Kept after that, for the « reconnecté avec sa passkey le … » line. */
2325
2345
  recovered: RecoveredSchema.optional(),
2326
2346
  /** Another device tried to take its place with its passkey while it was connected; until « Compris » (`mobile.device.ack` `refused`). */
2327
- refused: z28.object({ at: z28.string().datetime(), model: z28.string().optional() }).optional()
2347
+ refused: z29.object({ at: z29.string().datetime(), model: z29.string().optional() }).optional()
2328
2348
  })),
2329
- pairings: z28.array(MobilePairingSchema),
2349
+ pairings: z29.array(MobilePairingSchema),
2330
2350
  /** « Taper dans les terminaux depuis le téléphone »: absent from an older daemon, which has no phone terminal. */
2331
- terminalInput: z28.boolean().optional(),
2351
+ terminalInput: z29.boolean().optional(),
2332
2352
  /** Passkey recovery on the account: `blocked` after 3 failed verifications, until « Débloquer » (`mobile.recovery.unblock`). */
2333
- recovery: z28.object({ blocked: z28.object({ since: z28.string().datetime(), failures: z28.number().int().min(0) }).optional() }).optional()
2353
+ recovery: z29.object({ blocked: z29.object({ since: z29.string().datetime(), failures: z29.number().int().min(0) }).optional() }).optional()
2334
2354
  });
2335
- var MobileRecoveryEventSchema = z28.object({
2336
- event: z28.enum(["recovered", "refused", "blocked"]),
2337
- id: z28.string().optional(),
2338
- at: z28.string().datetime()
2355
+ var MobileRecoveryEventSchema = z29.object({
2356
+ event: z29.enum(["recovered", "refused", "blocked"]),
2357
+ id: z29.string().optional(),
2358
+ at: z29.string().datetime()
2339
2359
  });
2340
2360
 
2341
2361
  // ../../packages/protocol/src/brain.ts
2342
- import { z as z29 } from "zod";
2343
- var NoteInfoSchema = z29.object({
2344
- name: z29.string(),
2345
- file: z29.string(),
2346
- title: z29.string(),
2347
- when: z29.string().optional(),
2348
- firstLine: z29.string(),
2349
- scope: z29.enum(["all", "chat", "sessions"]),
2350
- projects: z29.array(z29.string()),
2351
- modifiedAt: z29.string(),
2352
- checkedAt: z29.string().optional(),
2362
+ import { z as z30 } from "zod";
2363
+ var NoteInfoSchema = z30.object({
2364
+ name: z30.string(),
2365
+ file: z30.string(),
2366
+ title: z30.string(),
2367
+ when: z30.string().optional(),
2368
+ firstLine: z30.string(),
2369
+ scope: z30.enum(["all", "chat", "sessions"]),
2370
+ projects: z30.array(z30.string()),
2371
+ modifiedAt: z30.string(),
2372
+ checkedAt: z30.string().optional(),
2353
2373
  /** Days since it was last checked or changed, past the threshold (spec §3.7). */
2354
- oldDays: z29.number().int().optional(),
2355
- flag: z29.object({ what: z29.string(), by: z29.string(), at: z29.string() }).optional(),
2374
+ oldDays: z30.number().int().optional(),
2375
+ flag: z30.object({ what: z30.string(), by: z30.string(), at: z30.string() }).optional(),
2356
2376
  /** Lines under « ## Ajouts ». */
2357
- additions: z29.number().int(),
2358
- truncated: z29.boolean()
2359
- });
2360
- 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 });
2361
- var BrainListSchema = z29.object({ type: z29.literal("brain.list"), rid: z29.string().min(1).max(100) });
2362
- var BrainNoteSchema = z29.object({ type: z29.literal("brain.note"), rid: z29.string().min(1).max(100), note: NoteNameSchema, op: z29.enum(["checked", "unflag"]) });
2363
- var BrainAddSchema = z29.object({
2364
- type: z29.literal("brain.add"),
2365
- rid: z29.string().min(1).max(100),
2377
+ additions: z30.number().int(),
2378
+ truncated: z30.boolean()
2379
+ });
2380
+ var BrainAnswerSchema = z30.object({ type: z30.literal("brain.answer"), rid: z30.string().min(1).max(100), task: z30.string().min(1).max(40), choice: BrainChoiceSchema });
2381
+ var BrainListSchema = z30.object({ type: z30.literal("brain.list"), rid: z30.string().min(1).max(100) });
2382
+ var BrainNoteSchema = z30.object({ type: z30.literal("brain.note"), rid: z30.string().min(1).max(100), note: NoteNameSchema, op: z30.enum(["checked", "unflag"]) });
2383
+ var BrainAddSchema = z30.object({
2384
+ type: z30.literal("brain.add"),
2385
+ rid: z30.string().min(1).max(100),
2366
2386
  note: NoteNameSchema,
2367
- fact: z29.string().trim().min(1).max(BRAIN_FACT_MAX),
2368
- source: z29.string().trim().min(1).max(BRAIN_SOURCE_MAX).optional()
2387
+ fact: z30.string().trim().min(1).max(BRAIN_FACT_MAX),
2388
+ source: z30.string().trim().min(1).max(BRAIN_SOURCE_MAX).optional()
2369
2389
  });
2370
- var BrainResultSchema = z29.object({
2371
- type: z29.literal("brain.result"),
2372
- rid: z29.string(),
2373
- reason: z29.string().optional(),
2390
+ var BrainResultSchema = z30.object({
2391
+ type: z30.literal("brain.result"),
2392
+ rid: z30.string(),
2393
+ reason: z30.string().optional(),
2374
2394
  /** What came of an answer (the text its proposer is told). */
2375
- result: z29.string().optional(),
2376
- dir: z29.string().optional(),
2377
- notes: z29.array(NoteInfoSchema).optional()
2395
+ result: z30.string().optional(),
2396
+ dir: z30.string().optional(),
2397
+ notes: z30.array(NoteInfoSchema).optional()
2378
2398
  });
2379
2399
 
2380
2400
  // ../../packages/protocol/src/usage.ts
2381
- import { z as z30 } from "zod";
2382
- var UsageHarnessSchema = z30.enum(["claude", "codex", "cursor"]);
2401
+ import { z as z31 } from "zod";
2402
+ var UsageHarnessSchema = z31.enum(["claude", "codex", "cursor"]);
2383
2403
  var USAGE_WINDOW_KINDS = ["five_hour", "seven_day", "model", "month", "pool"];
2384
2404
  var POOLS = ["cursor", "other"];
2385
2405
  var poolMatchesKind = (w) => w.kind === "pool" === (w.pool !== void 0) && (w.pool === void 0 || POOLS.includes(w.pool));
2386
- var UsageWindowSchema = z30.object({
2387
- kind: z30.enum(USAGE_WINDOW_KINDS),
2388
- model: z30.string().min(1).max(80).optional(),
2406
+ var UsageWindowSchema = z31.object({
2407
+ kind: z31.enum(USAGE_WINDOW_KINDS),
2408
+ model: z31.string().min(1).max(80).optional(),
2389
2409
  /** A pool of the included usage (`kind: 'pool'`): Cursor's own models (`cursor`) or the others at API prices (`other`). */
2390
- pool: z30.enum(POOLS).optional(),
2410
+ pool: z31.enum(POOLS).optional(),
2391
2411
  /** How much of it is used, in percent (rounded); 100 or more: reached. */
2392
- pct: z30.number().int().min(0).max(1e3),
2412
+ pct: z31.number().int().min(0).max(1e3),
2393
2413
  /** When it starts again from zero; null when the harness does not say. */
2394
- resetsAt: z30.string().datetime().nullable()
2414
+ resetsAt: z31.string().datetime().nullable()
2395
2415
  }).refine(poolMatchesKind, { message: "a pool window names its pool, and only a pool window does", path: ["pool"] });
2396
- var UsageStatusSchema = z30.enum(["ok", "loading", "stale", "unreachable", "expired"]);
2416
+ var UsageStatusSchema = z31.enum(["ok", "loading", "stale", "unreachable", "expired"]);
2397
2417
  var USAGE_ALERT_MIN = 0.5;
2398
2418
  var USAGE_ALERT_MAX = 0.95;
2399
- var UsagePrefsSchema = z30.object({ alert: z30.number().min(USAGE_ALERT_MIN).max(USAGE_ALERT_MAX) });
2400
- var HarnessUsageSchema = z30.object({
2419
+ var UsagePrefsSchema = z31.object({ alert: z31.number().min(USAGE_ALERT_MIN).max(USAGE_ALERT_MAX) });
2420
+ var HarnessUsageSchema = z31.object({
2401
2421
  harness: UsageHarnessSchema,
2402
- account: z30.string().regex(/^[0-9a-f]{12}$/).nullable(),
2422
+ account: z31.string().regex(/^[0-9a-f]{12}$/).nullable(),
2403
2423
  status: UsageStatusSchema,
2404
2424
  /** The last read that succeeded; null when none did. */
2405
- readAt: z30.string().datetime().nullable(),
2425
+ readAt: z31.string().datetime().nullable(),
2406
2426
  /** The 5 hours and the week first, then one window per model. Empty while loading, expired, or read more than an hour ago. */
2407
- windows: z30.array(UsageWindowSchema).max(20),
2427
+ windows: z31.array(UsageWindowSchema).max(20),
2408
2428
  /**
2409
2429
  * Why the account cannot be read now (#301), absent when it can. `local_expired`: the token on this machine is past its time, which
2410
2430
  * the harness renews itself at its next use (Claude Code's access token is short): still signed in, so the last values are kept
2411
2431
  * as `stale` while under an hour old, then the harness is no longer listed. `refused`: the provider refused the token (401):
2412
2432
  * status `expired`, no window. A refusal wins over a local expiry.
2413
2433
  */
2414
- cause: z30.enum(["local_expired", "refused"]).optional()
2434
+ cause: z31.enum(["local_expired", "refused"]).optional()
2415
2435
  });
2416
- var UsageAlertSchema = z30.object({
2417
- id: z30.string().min(1).max(200),
2436
+ var UsageAlertSchema = z31.object({
2437
+ id: z31.string().min(1).max(200),
2418
2438
  harness: UsageHarnessSchema,
2419
- account: z30.string().regex(/^[0-9a-f]{12}$/).nullable(),
2439
+ account: z31.string().regex(/^[0-9a-f]{12}$/).nullable(),
2420
2440
  window: UsageWindowSchema,
2421
- level: z30.enum(["threshold", "full"]),
2422
- at: z30.string().datetime()
2441
+ level: z31.enum(["threshold", "full"]),
2442
+ at: z31.string().datetime()
2423
2443
  });
2424
2444
  var isRecord = (v) => typeof v === "object" && v !== null;
2425
2445
  var knownHarness = (h) => UsageHarnessSchema.safeParse(h).success;
2426
2446
  var knownKind = (k) => USAGE_WINDOW_KINDS.includes(k);
2427
2447
  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;
2428
2448
  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;
2429
- var UsageStateMessageSchema = z30.object({
2430
- type: z30.literal("usage.state"),
2431
- machineId: z30.string().optional(),
2432
- harnesses: z30.preprocess(dropUnknownHarnesses, z30.array(HarnessUsageSchema).max(4)),
2433
- alerts: z30.preprocess(dropUnknownAlerts, z30.array(UsageAlertSchema).max(40)),
2449
+ var UsageStateMessageSchema = z31.object({
2450
+ type: z31.literal("usage.state"),
2451
+ machineId: z31.string().optional(),
2452
+ harnesses: z31.preprocess(dropUnknownHarnesses, z31.array(HarnessUsageSchema).max(4)),
2453
+ alerts: z31.preprocess(dropUnknownAlerts, z31.array(UsageAlertSchema).max(40)),
2434
2454
  prefs: UsagePrefsSchema
2435
2455
  });
2436
- var UsageSetSchema = z30.object({ type: z30.literal("usage.set"), prefs: UsagePrefsSchema, machineId: z30.string().optional() });
2437
- var UsageAckSchema = z30.object({ type: z30.literal("usage.ack"), id: z30.string().min(1).max(200), machineId: z30.string().optional() });
2456
+ var UsageSetSchema = z31.object({ type: z31.literal("usage.set"), prefs: UsagePrefsSchema, machineId: z31.string().optional() });
2457
+ var UsageAckSchema = z31.object({ type: z31.literal("usage.ack"), id: z31.string().min(1).max(200), machineId: z31.string().optional() });
2438
2458
 
2439
2459
  // ../../packages/protocol/src/forge.ts
2440
- import { z as z32 } from "zod";
2460
+ import { z as z33 } from "zod";
2441
2461
 
2442
2462
  // ../../packages/protocol/src/refusal.ts
2443
- import { z as z31 } from "zod";
2444
- var RefusalCodeSchema = z31.enum([
2463
+ import { z as z32 } from "zod";
2464
+ var RefusalCodeSchema = z32.enum([
2445
2465
  "stale",
2446
2466
  "read_only",
2447
2467
  "no_prompt",
@@ -2465,263 +2485,265 @@ var RefusalCodeSchema = z31.enum([
2465
2485
 
2466
2486
  // ../../packages/protocol/src/forge.ts
2467
2487
  var FORGE_KINDS = ["github", "gitlab"];
2468
- var ForgeKindSchema = z32.enum(FORGE_KINDS);
2488
+ var ForgeKindSchema = z33.enum(FORGE_KINDS);
2469
2489
  var PIPE_STATUSES = ["ok", "run", "fail", "wait", "skip", "none"];
2470
- var PipeStatusSchema = z32.enum(PIPE_STATUSES);
2490
+ var PipeStatusSchema = z33.enum(PIPE_STATUSES);
2471
2491
  var PR_STATES = ["draft", "open", "review", "merged", "closed"];
2472
- var PrStateSchema = z32.enum(PR_STATES);
2492
+ var PrStateSchema = z33.enum(PR_STATES);
2473
2493
  var PR_ROLES = ["author", "assignee", "reviewer"];
2474
- var PrRoleSchema = z32.enum(PR_ROLES);
2494
+ var PrRoleSchema = z33.enum(PR_ROLES);
2475
2495
  var dropUnknownRoles = (raw) => Array.isArray(raw) ? raw.filter((r) => known(PR_ROLES, r)) : raw;
2476
2496
  var FORGE_BODY_MAX = 65536;
2477
- var PullRequestSchema = z32.object({
2497
+ var PullRequestSchema = z33.object({
2478
2498
  /** `${host}/${repo}#${number}`, stable. */
2479
- id: z32.string().min(1),
2499
+ id: z33.string().min(1),
2480
2500
  forge: ForgeKindSchema,
2481
- host: z32.string().min(1),
2501
+ host: z33.string().min(1),
2482
2502
  /** The repository's path: `owner/name`, or `group/sub/project`. */
2483
- repo: z32.string().min(1),
2484
- number: z32.number().int().positive(),
2503
+ repo: z33.string().min(1),
2504
+ number: z33.number().int().positive(),
2485
2505
  /** As the forge shows it: `#226` (GitHub) or `!41` (GitLab). */
2486
- ref: z32.string(),
2506
+ ref: z33.string(),
2487
2507
  /** « Ouvrir sur GitHub / GitLab »: the front opens it itself (R11). */
2488
- url: z32.string().url(),
2489
- title: z32.string(),
2508
+ url: z33.string().url(),
2509
+ title: z33.string(),
2490
2510
  state: PrStateSchema,
2491
2511
  /** The source branch, and the branch it goes into. */
2492
- branch: z32.string(),
2493
- target: z32.string(),
2494
- headSha: z32.string(),
2512
+ branch: z33.string(),
2513
+ target: z33.string(),
2514
+ headSha: z33.string(),
2495
2515
  pipeline: PipeStatusSchema,
2496
2516
  /** `required` when the forge gives it (GitLab); GitHub leaves it out. */
2497
- approvals: z32.object({ given: z32.number().int().min(0), required: z32.number().int().min(0).optional() }),
2517
+ approvals: z33.object({ given: z33.number().int().min(0), required: z33.number().int().min(0).optional() }),
2498
2518
  /** The mockup's `ok`: all that a merge needs (R5), the pipeline set apart. */
2499
- mergeable: z32.boolean(),
2519
+ mergeable: z33.boolean(),
2500
2520
  /** Threads that can be resolved and are not. */
2501
- openThreads: z32.number().int().min(0),
2502
- updatedAt: z32.string().datetime(),
2521
+ openThreads: z33.number().int().min(0),
2522
+ updatedAt: z33.string().datetime(),
2503
2523
  /** The daemon's sessions on that branch, most recently active first (R12); the fleet qualifies them `machine:id`. */
2504
- sessions: z32.array(z32.string()),
2524
+ sessions: z33.array(z33.string()),
2505
2525
  /**
2506
2526
  * The account's roles on the request (issue #3), in the order author, assignee, reviewer; absent when it has none, and from a daemon
2507
2527
  * older than this field.
2508
2528
  */
2509
- roles: z32.preprocess(dropUnknownRoles, z32.array(PrRoleSchema)).optional()
2529
+ roles: z33.preprocess(dropUnknownRoles, z33.array(PrRoleSchema)).optional()
2510
2530
  });
2511
- var FollowedSessionSchema = z32.object({ session: z32.string(), forge: ForgeKindSchema, host: z32.string(), repo: z32.string() });
2512
- var ForgeStatusSchema = z32.object({
2531
+ var FollowedSessionSchema = z33.object({ session: z33.string(), forge: ForgeKindSchema, host: z33.string(), repo: z33.string() });
2532
+ var ForgeStatusSchema = z33.object({
2513
2533
  forge: ForgeKindSchema,
2514
- host: z32.string(),
2515
- status: z32.enum(["ok", "missing", "unauthenticated", "error"]),
2516
- message: z32.string().optional(),
2517
- at: z32.string().datetime(),
2534
+ host: z33.string(),
2535
+ status: z33.enum(["ok", "missing", "unauthenticated", "error"]),
2536
+ message: z33.string().optional(),
2537
+ at: z33.string().datetime(),
2518
2538
  /** Not `ok`: since when the forge cannot be read, whatever its messages since (« le relevé échoue depuis 10:42 »). */
2519
- since: z32.string().datetime().optional(),
2539
+ since: z33.string().datetime().optional(),
2520
2540
  /** After a failed read (`error` mostly): when the daemon reads it again, its backoff of 2 to 10 minutes (« Nouvel essai à 10:50 »). */
2521
- retryAt: z32.string().datetime().optional(),
2541
+ retryAt: z33.string().datetime().optional(),
2522
2542
  /** Not `ok`: when its requests, still shown, were last read; absent when they never were. */
2523
- readAt: z32.string().datetime().optional()
2543
+ readAt: z33.string().datetime().optional()
2524
2544
  });
2525
2545
  var isRecord2 = (v) => typeof v === "object" && v !== null;
2526
2546
  var known = (list, v) => typeof v === "string" && list.includes(v);
2527
2547
  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;
2528
2548
  var dropUnknownForges = (raw) => Array.isArray(raw) ? raw.filter((f) => isRecord2(f) && known(FORGE_KINDS, f.forge)) : raw;
2529
- var ForgeStateMessageSchema = z32.object({
2530
- type: z32.literal("forge.state"),
2531
- prs: z32.preprocess(dropUnknownPrs, z32.array(PullRequestSchema)),
2532
- forges: z32.preprocess(dropUnknownForges, z32.array(ForgeStatusSchema)),
2549
+ var ForgeStateMessageSchema = z33.object({
2550
+ type: z33.literal("forge.state"),
2551
+ prs: z33.preprocess(dropUnknownPrs, z33.array(PullRequestSchema)),
2552
+ forges: z33.preprocess(dropUnknownForges, z33.array(ForgeStatusSchema)),
2533
2553
  /** Absent from a daemon older than this field. */
2534
- followed: z32.preprocess(dropUnknownForges, z32.array(FollowedSessionSchema)).optional(),
2554
+ followed: z33.preprocess(dropUnknownForges, z33.array(FollowedSessionSchema)).optional(),
2535
2555
  /**
2536
2556
  * The account's own requests no session follows (issue #3): `sessions` empty, `roles` set. A request is in `prs` or here, never in
2537
2557
  * both; a followed one carries its `roles` in `prs`. Absent from a daemon older than this field.
2538
2558
  */
2539
- mine: z32.preprocess(dropUnknownPrs, z32.array(PullRequestSchema)).optional(),
2540
- machineId: z32.string().optional()
2541
- });
2542
- var PrJobSchema = z32.object({
2543
- id: z32.string(),
2544
- name: z32.string(),
2545
- column: z32.number().int().min(0),
2546
- columnName: z32.string(),
2547
- status: z32.preprocess((s) => known(PIPE_STATUSES, s) ? s : "none", PipeStatusSchema),
2548
- durationS: z32.number().min(0).optional()
2549
- });
2550
- var PrCommentSchema = z32.object({ id: z32.string(), author: z32.string(), at: z32.string().datetime(), body: z32.string() });
2551
- var PrThreadSchema = z32.object({
2552
- id: z32.string(),
2553
- resolvable: z32.boolean(),
2554
- resolved: z32.boolean(),
2555
- file: z32.string().optional(),
2556
- line: z32.number().int().optional(),
2557
- code: z32.string().optional(),
2558
- comments: z32.array(PrCommentSchema).min(1)
2559
- });
2560
- var PrFileSchema = z32.object({ path: z32.string(), added: z32.number().int().min(0), removed: z32.number().int().min(0), patch: z32.string().optional() });
2561
- var PrReviewerSchema = z32.object({ name: z32.string(), state: z32.enum(["approved", "changes", "pending"]) });
2562
- var PrCommitSchema = z32.object({ sha: z32.string(), title: z32.string(), author: z32.string(), at: z32.string().datetime() });
2563
- var PrDetailSchema = z32.object({
2559
+ mine: z33.preprocess(dropUnknownPrs, z33.array(PullRequestSchema)).optional(),
2560
+ machineId: z33.string().optional()
2561
+ });
2562
+ var PrJobSchema = z33.object({
2563
+ id: z33.string(),
2564
+ name: z33.string(),
2565
+ column: z33.number().int().min(0),
2566
+ columnName: z33.string(),
2567
+ status: z33.preprocess((s) => known(PIPE_STATUSES, s) ? s : "none", PipeStatusSchema),
2568
+ durationS: z33.number().min(0).optional()
2569
+ });
2570
+ var PrCommentSchema = z33.object({ id: z33.string(), author: z33.string(), at: z33.string().datetime(), body: z33.string() });
2571
+ var PrThreadSchema = z33.object({
2572
+ id: z33.string(),
2573
+ resolvable: z33.boolean(),
2574
+ resolved: z33.boolean(),
2575
+ file: z33.string().optional(),
2576
+ line: z33.number().int().optional(),
2577
+ code: z33.string().optional(),
2578
+ comments: z33.array(PrCommentSchema).min(1)
2579
+ });
2580
+ var PrFileSchema = z33.object({ path: z33.string(), added: z33.number().int().min(0), removed: z33.number().int().min(0), patch: z33.string().optional() });
2581
+ var PrReviewerSchema = z33.object({ name: z33.string(), state: z33.enum(["approved", "changes", "pending"]) });
2582
+ var PrCommitSchema = z33.object({ sha: z33.string(), title: z33.string(), author: z33.string(), at: z33.string().datetime() });
2583
+ var PrDetailSchema = z33.object({
2564
2584
  pr: PullRequestSchema,
2565
- description: z32.string(),
2566
- author: z32.string(),
2567
- reviewers: z32.array(PrReviewerSchema),
2568
- labels: z32.array(z32.string()),
2585
+ description: z33.string(),
2586
+ author: z33.string(),
2587
+ reviewers: z33.array(PrReviewerSchema),
2588
+ labels: z33.array(z33.string()),
2569
2589
  /** The tickets it closes, as the forge shows them (`#38`). */
2570
- issues: z32.array(z32.string()),
2571
- jobs: z32.array(PrJobSchema),
2590
+ issues: z33.array(z33.string()),
2591
+ jobs: z33.array(PrJobSchema),
2572
2592
  /** A job's log when asked (`forge.detail` with `log`): its last 60 lines, no ANSI, redacted. */
2573
- log: z32.object({ jobId: z32.string(), text: z32.string() }).optional(),
2574
- threads: z32.array(PrThreadSchema),
2575
- files: z32.array(PrFileSchema),
2576
- commits: z32.array(PrCommitSchema),
2593
+ log: z33.object({ jobId: z33.string(), text: z33.string() }).optional(),
2594
+ threads: z33.array(PrThreadSchema),
2595
+ files: z33.array(PrFileSchema),
2596
+ commits: z33.array(PrCommitSchema),
2577
2597
  /** The exact command a merge runs, for the front's confirmation (R5). */
2578
- mergeCommand: z32.string(),
2598
+ mergeCommand: z33.string(),
2579
2599
  /**
2580
2600
  * Why a merge is refused now, as codes; empty: it can be merged (R5). `not_open`, `draft`, `approvals`, `changes_requested`;
2581
2601
  * `pipeline`: the pipeline is not green (`pr.pipeline` says how); `pipeline_not_started`: no pipeline yet on the head, in a
2582
2602
  * repository with CI or whose CI is unknown (`pr.pipeline` reads `wait`). A repository without any CI gives `none` and no code.
2583
2603
  * A front shows a code it does not know as is.
2584
2604
  */
2585
- mergeBlockers: z32.array(z32.string())
2605
+ mergeBlockers: z33.array(z33.string())
2586
2606
  });
2587
- var ForgeActionSchema = z32.discriminatedUnion("kind", [
2588
- z32.object({ kind: z32.literal("rerun") }),
2607
+ var ForgeActionSchema = z33.discriminatedUnion("kind", [
2608
+ z33.object({ kind: z33.literal("rerun") }),
2589
2609
  /** `headSha`: the head the person saw; `stale` when it has moved. */
2590
- z32.object({ kind: z32.literal("merge"), headSha: z32.string().min(1).max(64) }),
2591
- z32.object({ kind: z32.literal("comment"), body: z32.string().min(1).max(FORGE_BODY_MAX) }),
2592
- z32.object({ kind: z32.literal("reply"), threadId: z32.string().min(1).max(200), body: z32.string().min(1).max(FORGE_BODY_MAX) }),
2593
- z32.object({ kind: z32.literal("resolve"), threadId: z32.string().min(1).max(200) })
2610
+ z33.object({ kind: z33.literal("merge"), headSha: z33.string().min(1).max(64) }),
2611
+ z33.object({ kind: z33.literal("comment"), body: z33.string().min(1).max(FORGE_BODY_MAX) }),
2612
+ z33.object({ kind: z33.literal("reply"), threadId: z33.string().min(1).max(200), body: z33.string().min(1).max(FORGE_BODY_MAX) }),
2613
+ z33.object({ kind: z33.literal("resolve"), threadId: z33.string().min(1).max(200) })
2594
2614
  ]);
2595
- 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() });
2596
- 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 });
2597
- 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() });
2598
- 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() });
2615
+ var ForgeDetailSchema = z33.object({ type: z33.literal("forge.detail"), requestId: z33.string().min(1).max(100), prId: z33.string().min(1).max(500), log: z33.string().min(1).max(40).optional(), machineId: z33.string().optional() });
2616
+ var ForgeActSchema = z33.object({ type: z33.literal("forge.act"), requestId: z33.string().min(1).max(100), prId: z33.string().min(1).max(500), machineId: z33.string().optional(), action: ForgeActionSchema });
2617
+ var ForgeDetailReplySchema = z33.object({ type: z33.literal("forge.detail.reply"), requestId: z33.string(), ok: z33.boolean(), detail: PrDetailSchema.optional(), message: z33.string().optional(), code: RefusalCodeSchema.optional() });
2618
+ var ForgeActReplySchema = z33.object({ type: z33.literal("forge.act.reply"), requestId: z33.string(), ok: z33.boolean(), command: z33.string().optional(), message: z33.string().optional(), code: RefusalCodeSchema.optional() });
2599
2619
  var CLOSED_KEEP_DAYS = 7;
2600
2620
  var CLOSED_KEEP_MS = CLOSED_KEEP_DAYS * 24 * 60 * 6e4;
2601
2621
  var PR_ROLE_FILTERS = ["all", ...PR_ROLES];
2602
2622
 
2603
2623
  // ../../packages/protocol/src/messages.ts
2604
- var SessionEventSchema = z33.object({
2605
- 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"]),
2606
- at: z33.string().datetime(),
2607
- source: z33.enum(["hook", "pane", "daemon"]),
2608
- tool: z33.string().optional(),
2609
- text: z33.string().optional(),
2610
- options: z33.array(z33.string()).optional(),
2624
+ var SessionEventSchema = z34.object({
2625
+ name: z34.enum(["SessionStart", "UserPromptSubmit", "PreToolUse", "PermissionRequest", "Notification", "Stop", "SessionEnd", "PaneChanged", "PaneGone", "PanePrompt", "PaneIdle", "InjectFailed", "Decided", "PostToolUse", "PostToolUseFailure", "StopFailure", "SubagentStart", "SubagentStop", "PaneTitle", "Renamed", "NativeRequest", "AgentMessage", "QueueUpdate", "PaneUnreadable", "PaneReadable"]),
2626
+ at: z34.string().datetime(),
2627
+ source: z34.enum(["hook", "pane", "daemon"]),
2628
+ tool: z34.string().optional(),
2629
+ text: z34.string().optional(),
2630
+ options: z34.array(z34.string()).optional(),
2611
2631
  /** Each option's description, by index ('' when it has none); left out when no option has one. */
2612
- optionDetails: z33.array(z33.string()).optional(),
2613
- kind: z33.enum(["question", "permission", "plan", "diff"]).optional(),
2632
+ optionDetails: z34.array(z34.string()).optional(),
2633
+ kind: z34.enum(["question", "permission", "plan", "diff"]).optional(),
2614
2634
  /** PanePrompt: what to review in full before deciding (a plan read in the terminal), when `text` is its summary. */
2615
- body: z33.string().optional(),
2616
- exitCode: z33.number().int().nullable().optional(),
2617
- helperId: z33.string().optional(),
2635
+ body: z34.string().optional(),
2636
+ exitCode: z34.number().int().nullable().optional(),
2637
+ helperId: z34.string().optional(),
2618
2638
  /** The helper's description, once known (Claude Code: its `.meta.json`, written after SubagentStart). */
2619
- task: z33.string().optional(),
2639
+ task: z34.string().optional(),
2620
2640
  /** PostToolUseFailure: the user interrupted the turn (Esc); Claude then waits for input with no Stop. */
2621
- interrupt: z33.boolean().optional(),
2641
+ interrupt: z34.boolean().optional(),
2622
2642
  /** UserPromptSubmit, PostToolUse: the images the prompt or the tool result carried, by attachment id. */
2623
- attachments: z33.array(AttachmentIdSchema).max(ATTACHMENTS_MAX).optional(),
2643
+ attachments: z34.array(AttachmentIdSchema).max(ATTACHMENTS_MAX).optional(),
2624
2644
  /** PostToolUse: some of the result's images were not kept. */
2625
- imagesDropped: z33.boolean().optional(),
2645
+ imagesDropped: z34.boolean().optional(),
2626
2646
  /** QueueUpdate: OMP's queue as it stands. */
2627
- queue: z33.array(z33.object({ text: z33.string(), mode: z33.enum(["steer", "follow_up"]) })).optional(),
2647
+ queue: z34.array(z34.object({ text: z34.string(), mode: z34.enum(["steer", "follow_up"]) })).optional(),
2628
2648
  /** AgentMessage: the harness's own message, its text so far (`streaming`) or whole. `messageId` is unique for the session's life. */
2629
- messageId: z33.string().optional(),
2630
- streaming: z33.boolean().optional(),
2649
+ messageId: z34.string().optional(),
2650
+ streaming: z34.boolean().optional(),
2631
2651
  /** NativeRequest: the dialog's id, and OMP's `ask` questions when it is one. */
2632
- requestId: z33.string().optional(),
2633
- questions: z33.array(AskQuestionSchema).optional(),
2652
+ requestId: z34.string().optional(),
2653
+ questions: z34.array(AskQuestionSchema).optional(),
2634
2654
  /** Stop: its text is already in the thread as AgentMessage cards, which the reply card must not repeat. */
2635
- streamed: z33.boolean().optional(),
2655
+ streamed: z34.boolean().optional(),
2636
2656
  /** Native tracking (spec 2026-10-13 §2): the harness's id of the tool call, so its result lands on the same row. */
2637
- toolUseId: z33.string().optional(),
2657
+ toolUseId: z34.string().optional(),
2638
2658
  /** The tool's input as the harness gave it, every string capped by the hook. */
2639
- toolInput: z33.record(z33.string(), z33.unknown()).optional(),
2659
+ toolInput: z34.record(z34.string(), z34.unknown()).optional(),
2640
2660
  /** PostToolUse: the id the harness gave a call it left running in the background (Claude Code's `backgroundTaskId`, issue #1). */
2641
- backgroundTaskId: z33.string().optional(),
2661
+ backgroundTaskId: z34.string().optional(),
2642
2662
  /** PostToolUse: the result as text; SubagentStop: nothing (the report travels in `text`). */
2643
- output: z33.string().optional(),
2644
- durationMs: z33.number().nonnegative().optional(),
2663
+ output: z34.string().optional(),
2664
+ durationMs: z34.number().nonnegative().optional(),
2645
2665
  /** PostToolUseFailure: the harness's error message. */
2646
- error: z33.string().optional(),
2666
+ error: z34.string().optional(),
2647
2667
  /** The session's transcript, or the helper's on SubagentStop; the daemon reads its tail for the agent's messages. */
2648
- transcriptPath: z33.string().optional(),
2668
+ transcriptPath: z34.string().optional(),
2649
2669
  /** Decided: what was chosen when the daemon knows it. */
2650
2670
  decision: DecisionSchema.optional(),
2651
2671
  /** Decided: the request was refused by Ledge closing the session (its interrupt keys), not by the user's answer. */
2652
- byClose: z33.literal(true).optional(),
2672
+ byClose: z34.literal(true).optional(),
2653
2673
  /** Decided: who answered, when the daemon typed it (absent: answered in the terminal, or an older daemon). */
2654
2674
  by: DecidedBySchema.optional(),
2655
2675
  /** The agent's own session id when the hook names it, so the daemon can resume that conversation. */
2656
- agentSessionId: z33.string().optional()
2676
+ agentSessionId: z34.string().optional()
2657
2677
  });
2658
- var RecentSchema = z33.object({ cwd: z33.string().min(1), project: z33.string().min(1), lastAt: z33.string().datetime() });
2678
+ var RecentSchema = z34.object({ cwd: z34.string().min(1), project: z34.string().min(1), lastAt: z34.string().datetime() });
2659
2679
  var SEMVER = /^\d+\.\d+\.\d+$/;
2660
- var PingSchema = z33.object({ type: z33.literal("ping"), requestId: z33.string().min(1).max(100), machineId: z33.string().optional() });
2661
- var PongSchema = z33.object({ type: z33.literal("pong"), requestId: z33.string(), machineId: z33.string().optional(), error: z33.enum(["offline", "outdated"]).optional() });
2662
- var DaemonInfoSchema = z33.object({
2663
- version: z33.string(),
2664
- install: z33.enum(["npm", "git", "unknown"]),
2665
- systemd: z33.boolean(),
2666
- manual: z33.string().optional(),
2667
- routing: z33.boolean().optional(),
2668
- archive: z33.boolean().optional(),
2680
+ var PingSchema = z34.object({ type: z34.literal("ping"), requestId: z34.string().min(1).max(100), machineId: z34.string().optional() });
2681
+ var PongSchema = z34.object({ type: z34.literal("pong"), requestId: z34.string(), machineId: z34.string().optional(), error: z34.enum(["offline", "outdated"]).optional() });
2682
+ var DaemonInfoSchema = z34.object({
2683
+ version: z34.string(),
2684
+ install: z34.enum(["npm", "git", "unknown"]),
2685
+ systemd: z34.boolean(),
2686
+ manual: z34.string().optional(),
2687
+ routing: z34.boolean().optional(),
2688
+ archive: z34.boolean().optional(),
2669
2689
  /** Takes `model` and `effort` on `session.launch` and answers `models.list` (#58). */
2670
- models: z33.boolean().optional(),
2690
+ models: z34.boolean().optional(),
2671
2691
  /** Drives OMP over its RPC: launching `omp` sessions is possible when the binary is there (`models.list` says so). */
2672
- omp: z33.boolean().optional(),
2692
+ omp: z34.boolean().optional(),
2673
2693
  /** Takes `session.model`: a live session's model and effort changed (#58, lot 2). */
2674
- modelSwitch: z33.boolean().optional(),
2694
+ modelSwitch: z34.boolean().optional(),
2675
2695
  /** Answers `session.commands`: the slash commands a session's agent offers. */
2676
- commands: z33.boolean().optional(),
2696
+ commands: z34.boolean().optional(),
2677
2697
  /** Takes `approval` on an OMP `session.launch` (auto mode). */
2678
- ompApproval: z33.boolean().optional(),
2698
+ ompApproval: z34.boolean().optional(),
2679
2699
  /** Its home folder, so a client shows the folders under it as `~` (absent from older daemons). */
2680
- home: z33.string().optional(),
2681
- mobile: z33.boolean().optional(),
2700
+ home: z34.string().optional(),
2701
+ mobile: z34.boolean().optional(),
2682
2702
  /** Answers `openrig.status` and `openrig.act`: drives OpenRig on its machine. */
2683
- openrig: z33.boolean().optional(),
2703
+ openrig: z34.boolean().optional(),
2684
2704
  /** Answers `openrig.roles`, `openrig.role` and `openrig.roleFile`: reads OpenRig's roles (agent specs). */
2685
- openrigRoles: z33.boolean().optional(),
2705
+ openrigRoles: z34.boolean().optional(),
2686
2706
  /** 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):
2687
2707
  * a client (the fleet) sends none of them to a daemon without it. */
2688
- openrigRig: z33.boolean().optional(),
2708
+ openrigRig: z34.boolean().optional(),
2689
2709
  /** Takes the action `rig.policy` (lot 7c): a client (the fleet) sends it only when this is set. */
2690
- openrigPolicy: z33.boolean().optional(),
2710
+ openrigPolicy: z34.boolean().optional(),
2691
2711
  /** Takes `rig.start` with `fresh` (lot 7d): a client (the fleet) sends it only when this is set. */
2692
- openrigFresh: z33.boolean().optional(),
2712
+ openrigFresh: z34.boolean().optional(),
2693
2713
  /** Answers `ping` with `pong`: a client measures the round trip to this machine (lot 7d). */
2694
- ping: z33.boolean().optional(),
2714
+ ping: z34.boolean().optional(),
2695
2715
  /** Answers `openrig.row`: a queue row's state, for the OpenRig task cards of a thread. */
2696
- openrigRows: z33.boolean().optional(),
2716
+ openrigRows: z34.boolean().optional(),
2697
2717
  /** Answers `openrig.asks` and `openrig.answer`: what OpenRig asks the person, and their answers (« À toi »). */
2698
- openrigAsks: z33.boolean().optional(),
2718
+ openrigAsks: z34.boolean().optional(),
2699
2719
  /** Answers `openrig.goal.send`, `openrig.goals` and `openrig.goal.reply`: goals given to Max (lot 2). */
2700
- openrigGoals: z33.boolean().optional(),
2720
+ openrigGoals: z34.boolean().optional(),
2701
2721
  /** Takes `session.broadcast` (its `ledge bridge` too, on this machine): a client sends it only when this is set. */
2702
- broadcast: z33.boolean().optional(),
2722
+ broadcast: z34.boolean().optional(),
2703
2723
  /** Sends `browser.live` and answers `browser.watch`, `browser.unwatch` and `browser.enable`: the agent's browser, live. */
2704
- browserLive: z33.boolean().optional(),
2724
+ browserLive: z34.boolean().optional(),
2705
2725
  /** Answers `term.watch` and `term.shell`: the pane and the shells as a tmux control stream, xterm.js the only emulator. */
2706
- terminalStream: z33.boolean().optional(),
2726
+ terminalStream: z34.boolean().optional(),
2707
2727
  /** Sends `usage.state` (each harness's account limits, the alerts, the threshold) and takes `usage.set` and `usage.ack`. */
2708
- usage: z33.boolean().optional(),
2728
+ usage: z34.boolean().optional(),
2709
2729
  /** `term.watch` also streams an OpenRig seat (`@` in its tmux name), through a control client on the seat's own tmux server.
2710
2730
  * Without it, a front keeps a seat on the pseudo-terminal: an older daemon answers its watch `failed`. */
2711
- terminalStreamSeats: z33.boolean().optional(),
2731
+ terminalStreamSeats: z34.boolean().optional(),
2712
2732
  /** Sends `forge.state` and answers `forge.detail` and `forge.act`: the pull and merge requests of its sessions' branches (lot 8a). */
2713
- forge: z33.boolean().optional(),
2733
+ forge: z34.boolean().optional(),
2714
2734
  /** Answers `routine.list`, `routine.cmd` and `routine.preview`, and sends `routine.changed` (spec 2026-11-23 routines). */
2715
- routines: z33.boolean().optional(),
2735
+ routines: z34.boolean().optional(),
2716
2736
  /** Answers a grouped `routine.cmd` (`others`) all or nothing: a client sends one only to a daemon that says it. */
2717
- routineGroups: z33.boolean().optional(),
2737
+ routineGroups: z34.boolean().optional(),
2738
+ /** Takes `session.aside` (#41): a Claude Code session's `/btw`, answered as an aside, not a thread item. */
2739
+ aside: z34.boolean().optional(),
2718
2740
  /** 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(),
2741
+ sessionLabel: z34.boolean().optional(),
2720
2742
  /** Its launcher answers `shell --nonce <N> <dir>` (#299): a free shell started through it gets the shell integration (OSC 633). */
2721
- freeShell: z33.boolean().optional()
2743
+ freeShell: z34.boolean().optional()
2722
2744
  });
2723
- var UpdateFailureSchema = z33.enum(["git-install", "no-systemd", "sessions-at-risk", "npm-failed", "busy"]);
2724
- var ServerMessageSchema = z33.discriminatedUnion("type", [
2745
+ var UpdateFailureSchema = z34.enum(["git-install", "no-systemd", "sessions-at-risk", "npm-failed", "busy"]);
2746
+ var ServerMessageSchema = z34.discriminatedUnion("type", [
2725
2747
  BrowserLiveSchema,
2726
2748
  BrowserFrameSchema,
2727
2749
  BrowserEnabledSchema,
@@ -2730,7 +2752,7 @@ var ServerMessageSchema = z33.discriminatedUnion("type", [
2730
2752
  TermSizeSchema,
2731
2753
  TermExitSchema,
2732
2754
  SessionModelAcceptedSchema,
2733
- z33.object({ type: z33.literal("chat.routed"), qid: z33.string(), result: RouteResultSchema }),
2755
+ z34.object({ type: z34.literal("chat.routed"), qid: z34.string(), result: RouteResultSchema }),
2734
2756
  DocumentContentSchema,
2735
2757
  DocumentErrorSchema,
2736
2758
  AttachmentStoredSchema,
@@ -2763,87 +2785,88 @@ var ServerMessageSchema = z33.discriminatedUnion("type", [
2763
2785
  /** `recents`: the folders of past sessions, most recent first. `launcher`: the command that runs `ledge` inside WSL
2764
2786
  * (`[node, cli]`), so the overlay can attach a terminal to a session with `<launcher> attach <id>`. `daemon`: absent
2765
2787
  * from daemons older than the auto-update. */
2766
- 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() }),
2767
- z33.object({ type: z33.literal("session.updated"), session: SessionSchema }),
2788
+ z34.object({ type: z34.literal("snapshot"), sessions: z34.array(SessionSchema), recents: z34.array(RecentSchema).optional(), launcher: z34.array(z34.string()).optional(), daemon: DaemonInfoSchema.optional(), sshAlias: SshAliasSchema.optional() }),
2789
+ z34.object({ type: z34.literal("session.updated"), session: SessionSchema }),
2768
2790
  /** OMP: the instructions taken back from its queue by an interrupt that restores it; the asker puts them back in its draft. */
2769
- z33.object({
2770
- type: z33.literal("session.queue.restored"),
2771
- id: z33.string(),
2772
- texts: z33.array(z33.string()),
2791
+ z34.object({
2792
+ type: z34.literal("session.queue.restored"),
2793
+ id: z34.string(),
2794
+ texts: z34.array(z34.string()),
2773
2795
  /** The same instructions with the images they carried; `imagesDropped`: some images could not be put back. */
2774
- entries: z33.array(z33.object({ text: z33.string(), attachments: z33.array(AttachmentIdSchema).optional() })).optional(),
2775
- imagesDropped: z33.boolean().optional()
2796
+ entries: z34.array(z34.object({ text: z34.string(), attachments: z34.array(AttachmentIdSchema).optional() })).optional(),
2797
+ imagesDropped: z34.boolean().optional()
2776
2798
  }),
2777
- z33.object({ type: z33.literal("session.removed"), id: z33.string() }),
2778
- z33.object({ type: z33.literal("session.preview"), id: z33.string(), lines: z33.array(z33.string()) }),
2799
+ z34.object({ type: z34.literal("session.removed"), id: z34.string() }),
2800
+ z34.object({ type: z34.literal("session.preview"), id: z34.string(), lines: z34.array(z34.string()) }),
2779
2801
  /** A session's thread, on request (spec 2026-10-13 §5); then each created or updated item, broadcast. */
2780
- z33.object({ type: z33.literal("session.thread"), id: z33.string(), items: z33.array(ThreadItemSchema) }),
2781
- z33.object({ type: z33.literal("session.thread.item"), id: z33.string(), item: ThreadItemSchema }),
2802
+ z34.object({ type: z34.literal("session.thread"), id: z34.string(), items: z34.array(ThreadItemSchema) }),
2803
+ z34.object({ type: z34.literal("session.thread.item"), id: z34.string(), item: ThreadItemSchema }),
2804
+ SessionAsideSchema,
2782
2805
  /** Answer to the requester of a `session.launch`: the session exists (its `session.updated` is broadcast as usual). */
2783
- z33.object({ type: z33.literal("session.launched"), id: z33.string() }),
2806
+ z34.object({ type: z34.literal("session.launched"), id: z34.string() }),
2784
2807
  /** Answer to the requester of a `session.close`, once per row closed: the session `id` and how it ended. */
2785
- z33.object({ type: z33.literal("session.closed"), qid: z33.string(), row: z33.number().int().min(0), id: z33.string(), how: z33.enum(["exit", "killed"]) }),
2786
- z33.object({ type: z33.literal("recents"), recents: z33.array(RecentSchema) }),
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) }),
2787
2810
  /** Answer to the requester of a `folder.list` or `folder.create`: `path` resolved (`~` expanded), `parent` null at the
2788
2811
  * root, `entries` its subfolders by name (hidden ones left out). A failure keeps the asked path and says why in `error`,
2789
2812
  * never in an `error` message, which the launch form reads as a failed launch. */
2790
- z33.object({
2791
- type: z33.literal("folder.listing"),
2792
- path: z33.string(),
2793
- parent: z33.string().nullable(),
2794
- entries: z33.array(z33.string()),
2795
- error: z33.string().optional(),
2813
+ z34.object({
2814
+ type: z34.literal("folder.listing"),
2815
+ path: z34.string(),
2816
+ parent: z34.string().nullable(),
2817
+ entries: z34.array(z34.string()),
2818
+ error: z34.string().optional(),
2796
2819
  /** The request this answers, when it carried one. */
2797
- requestId: z33.string().optional(),
2820
+ requestId: z34.string().optional(),
2798
2821
  /** Those `entries` that are Git repositories, with their branch (the short commit when HEAD is detached). */
2799
- repos: z33.array(z33.object({ name: z33.string(), branch: z33.string() })).optional()
2822
+ repos: z34.array(z34.object({ name: z34.string(), branch: z34.string() })).optional()
2800
2823
  }),
2801
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. */
2802
- z33.object({ type: z33.literal("chat.step"), qid: z33.string(), step: ChatStepSchema }),
2803
- z33.object({ type: z33.literal("chat.delta"), qid: z33.string(), text: z33.string() }),
2804
- z33.object({ type: z33.literal("chat.done"), qid: z33.string(), text: z33.string(), at: z33.string().datetime(), proposal: ChatProposalSchema.optional(), proposals: ChatProposalsSchema.optional(), relay: ChatRelaySchema.optional(), closes: ChatClosesSchema.optional(), projectProposal: ChatProjectProposalSchema.optional(), tasks: ChatTasksSchema.optional(), actions: ChatActionsSchema.optional() }),
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() }),
2805
2828
  /** What a `chat.act` applied: the rows done, and the one that failed with why (the rows after it stay proposed). */
2806
- z33.object({ type: z33.literal("chat.acted"), rid: z33.string(), qid: z33.string(), done: z33.array(z33.number().int().min(0)), failed: z33.array(z33.object({
2807
- row: z33.number().int().min(0),
2808
- message: z33.string(),
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(),
2809
2832
  /** nothing was sent */
2810
- refused: z33.literal(true).optional()
2833
+ refused: z34.literal(true).optional()
2811
2834
  })) }),
2812
2835
  /** What an `action.run` came to: `row` the action as the daemon resolved it (its summary, its risk); `reason` why it was not
2813
2836
  * done, with `code` (`refused`: not possible now; `agent`: a session may not run it; `confirm_required`: destructive, ask
2814
2837
  * again; `failed`: the handler turned it down; a free string, as an `error`'s). */
2815
- 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() }),
2816
- z33.object({ type: z33.literal("chat.error"), qid: z33.string(), message: z33.string() }),
2817
- z33.object({ type: z33.literal("chat.history"), turns: z33.array(ChatTurnSchema) }),
2838
+ z34.object({ type: z34.literal("action.result"), rid: z34.string(), action: z34.string().min(1).max(40), row: ChatActionSchema.optional(), reason: z34.string().optional(), code: z34.string().optional() }),
2839
+ z34.object({ type: z34.literal("chat.error"), qid: z34.string(), message: z34.string() }),
2840
+ z34.object({ type: z34.literal("chat.history"), turns: z34.array(ChatTurnSchema) }),
2818
2841
  /** The daemon updating itself: npm is running, then the service restarts (the socket closes right after). */
2819
- z33.object({ type: z33.literal("update.progress"), version: z33.string(), step: z33.enum(["installing", "restarting"]) }),
2842
+ z34.object({ type: z34.literal("update.progress"), version: z34.string(), step: z34.enum(["installing", "restarting"]) }),
2820
2843
  /** Nothing was changed. `detail`: the useful end of npm's output; `command`: what the person can run instead. */
2821
- z33.object({ type: z33.literal("update.failed"), version: z33.string(), reason: UpdateFailureSchema, detail: z33.string().optional(), command: z33.string().optional() }),
2844
+ z34.object({ type: z34.literal("update.failed"), version: z34.string(), reason: UpdateFailureSchema, detail: z34.string().optional(), command: z34.string().optional() }),
2822
2845
  /** The shared machines list (spec 2026-10-14 §5), sent to local clients only. */
2823
- z33.object({ type: z33.literal("machines"), machines: MachinesSchema }),
2846
+ z34.object({ type: z34.literal("machines"), machines: MachinesSchema }),
2824
2847
  /** The local daemon's projects and folder rules (spec 2026-10-16 build §5), sent to local clients only. */
2825
- z33.object({ type: z33.literal("projects"), projects: ProjectsSchema }),
2848
+ z34.object({ type: z34.literal("projects"), projects: ProjectsSchema }),
2826
2849
  /** The island's settings shared by the local fronts; null until a front sets them (the island then sends its own). Local clients only. */
2827
- z33.object({ type: z33.literal("island"), prefs: IslandPrefsSchema.nullable() }),
2850
+ z34.object({ type: z34.literal("island"), prefs: IslandPrefsSchema.nullable() }),
2828
2851
  /** Mobile access (lot 3), after the island in each snapshot and on every change. Local clients only. */
2829
- z33.object({ type: z33.literal("mobile"), state: MobileStateSchema }),
2852
+ z34.object({ type: z34.literal("mobile"), state: MobileStateSchema }),
2830
2853
  /** A passkey recovery as it happens (docs/mobile-passkey-recover-contract.md), for the local fronts' toast; the lasting trace is in `mobile`. */
2831
- z33.object({ type: z33.literal("mobile.recovery") }).merge(MobileRecoveryEventSchema),
2854
+ z34.object({ type: z34.literal("mobile.recovery") }).merge(MobileRecoveryEventSchema),
2832
2855
  /** The sessions a phone types into (« Téléphone au clavier »), after each snapshot and each change; `device` is its label. */
2833
- z33.object({ type: z33.literal("terminal.holders"), holds: z33.array(z33.object({ id: z33.string(), device: z33.string() })) }),
2856
+ z34.object({ type: z34.literal("terminal.holders"), holds: z34.array(z34.object({ id: z34.string(), device: z34.string() })) }),
2834
2857
  /** 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`. */
2835
- z33.object({
2836
- type: z33.literal("message.ack"),
2837
- rid: z33.string(),
2838
- outcome: z33.enum(["accepted", "queued", "native", "refused"]),
2839
- reason: z33.string().optional(),
2858
+ z34.object({
2859
+ type: z34.literal("message.ack"),
2860
+ rid: z34.string(),
2861
+ outcome: z34.enum(["accepted", "queued", "native", "refused"]),
2862
+ reason: z34.string().optional(),
2840
2863
  /** A broadcast's per-recipient outcome, by name. */
2841
- recipients: z33.object({ sent: z33.array(z33.string()), refused: z33.array(z33.object({ name: z33.string(), reason: z33.string() })) }).optional()
2864
+ recipients: z34.object({ sent: z34.array(z34.string()), refused: z34.array(z34.object({ name: z34.string(), reason: z34.string() })) }).optional()
2842
2865
  }),
2843
2866
  /** The answer to a `session.broadcast`: who got it (`sent`) and who did not; `reason`: the whole broadcast was refused. */
2844
- 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() }),
2867
+ z34.object({ type: z34.literal("session.broadcast.result"), rid: z34.string(), sent: z34.array(z34.object({ id: z34.string(), name: z34.string() })), refused: z34.array(z34.object({ name: z34.string(), reason: z34.string() })), reason: z34.string().optional() }),
2845
2868
  /** The answer to a `message.read`: the body with its sender, target and time, or the refusal's `reason`. */
2846
- 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() }),
2869
+ z34.object({ type: z34.literal("message.body"), id: z34.string(), from: z34.string().optional(), to: z34.string().optional(), at: z34.string().optional(), text: z34.string().optional(), reason: z34.string().optional() }),
2847
2870
  TaskResultSchema,
2848
2871
  ReportPreviewReplySchema,
2849
2872
  ReportCreatedSchema,
@@ -2864,21 +2887,21 @@ var ServerMessageSchema = z33.discriminatedUnion("type", [
2864
2887
  RoutineChangedSchema,
2865
2888
  RoutinePreviewedSchema,
2866
2889
  /** The operator's notices, broadcast on change and in the snapshot. */
2867
- z33.object({ type: z33.literal("operator.state"), notices: z33.array(OperatorNoticeSchema).max(50) }),
2868
- z33.object({
2869
- type: z33.literal("error"),
2870
- message: z33.string(),
2871
- id: z33.string().optional(),
2890
+ z34.object({ type: z34.literal("operator.state"), notices: z34.array(OperatorNoticeSchema).max(50) }),
2891
+ z34.object({
2892
+ type: z34.literal("error"),
2893
+ message: z34.string(),
2894
+ id: z34.string().optional(),
2872
2895
  /** Le type du message client refusé. */
2873
- request: z33.string().optional(),
2896
+ request: z34.string().optional(),
2874
2897
  /** Ce que le front doit reconnaître au-delà du texte (NOTE_NOT_TYPED) ; une chaîne libre, qu'un front plus ancien ignore. */
2875
- code: z33.string().optional()
2898
+ code: z34.string().optional()
2876
2899
  })
2877
2900
  ]);
2878
2901
  var MESSAGE_MAX = 2e4;
2879
2902
  var SUMMARY_MAX = 500;
2880
- var launchRows = z33.array(z33.number().int().min(0).max(MAX_PROPOSALS - 1)).min(1).max(MAX_PROPOSALS).refine((r) => new Set(r).size === r.length, "a row twice");
2881
- var ClientMessageSchema = z33.discriminatedUnion("type", [
2903
+ var launchRows = z34.array(z34.number().int().min(0).max(MAX_PROPOSALS - 1)).min(1).max(MAX_PROPOSALS).refine((r) => new Set(r).size === r.length, "a row twice");
2904
+ var ClientMessageSchema = z34.discriminatedUnion("type", [
2882
2905
  BrowserWatchSchema,
2883
2906
  BrowserUnwatchSchema,
2884
2907
  BrowserEnableSchema,
@@ -2887,7 +2910,7 @@ var ClientMessageSchema = z33.discriminatedUnion("type", [
2887
2910
  TermUnwatchSchema,
2888
2911
  TermInputSchema,
2889
2912
  TermResizeSchema,
2890
- z33.object({ type: z33.literal("chat.route"), qid: z33.string().min(1).max(100), text: z33.string().min(1).max(2e4), tool: ToolSchema.optional(), context: RoutingContextSchema }),
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 }),
2891
2914
  DocumentReadSchema,
2892
2915
  AttachmentPutSchema,
2893
2916
  AttachmentCaptureSchema,
@@ -2920,193 +2943,194 @@ var ClientMessageSchema = z33.discriminatedUnion("type", [
2920
2943
  * free one otherwise), `prompt` the agent's first instruction, `continue` resumes the folder's last conversation.
2921
2944
  * With `qid` it is the chat card of that turn: the daemon launches the turn's proposal and ignores the other fields
2922
2945
  * but `rows`, `model` and `effort`. */
2923
- z33.object({
2924
- type: z33.literal("session.launch"),
2946
+ z34.object({
2947
+ type: z34.literal("session.launch"),
2925
2948
  tool: ToolSchema,
2926
- cwd: z33.string().min(1),
2927
- name: z33.string().optional(),
2928
- prompt: z33.string().optional(),
2929
- continue: z33.boolean().optional(),
2930
- qid: z33.string().min(1).optional(),
2949
+ cwd: z34.string().min(1),
2950
+ name: z34.string().optional(),
2951
+ prompt: z34.string().optional(),
2952
+ continue: z34.boolean().optional(),
2953
+ qid: z34.string().min(1).optional(),
2931
2954
  /** With `qid`: the card's rows to launch (#24), indexes into the turn's `proposals`, each once; the first row without it. */
2932
2955
  rows: launchRows.optional(),
2933
2956
  /** Folders in addition to `cwd` (Claude: `--add-dir`); resolved like `cwd`. */
2934
- dirs: z33.array(z33.string().min(1)).max(20).optional(),
2957
+ dirs: z34.array(z34.string().min(1)).max(20).optional(),
2935
2958
  /** The agent's model and effort (#58), the agent's own default when left out; with `qid`, for every row launched. */
2936
2959
  model: ModelIdSchema.optional(),
2937
2960
  effort: EffortSchema.optional(),
2938
2961
  /** OMP only: its approval mode, `always-ask` when left out. */
2939
2962
  approval: OmpApprovalSchema.optional(),
2940
2963
  /** Routing by the fleet, removed before the message reaches the daemon. */
2941
- machineId: z33.string().optional()
2964
+ machineId: z34.string().optional()
2942
2965
  }),
2943
2966
  /** The launch form's folder browser: list a folder's subfolders (home when no `path`), or make `name` inside `parent`
2944
2967
  * and list it. Both are answered with a `folder.listing`. */
2945
- z33.object({
2946
- type: z33.literal("folder.list"),
2947
- path: z33.string().optional(),
2968
+ z34.object({
2969
+ type: z34.literal("folder.list"),
2970
+ path: z34.string().optional(),
2948
2971
  /** Routing by the fleet, removed before the message reaches the daemon. */
2949
- machineId: z33.string().optional(),
2972
+ machineId: z34.string().optional(),
2950
2973
  /** Copied into the `folder.listing` that answers; the fleet relays only that listing, from the machine asked. */
2951
- requestId: z33.string().min(1).max(100).optional()
2974
+ requestId: z34.string().min(1).max(100).optional()
2952
2975
  }),
2953
- z33.object({
2954
- type: z33.literal("folder.create"),
2955
- parent: z33.string().min(1),
2956
- name: z33.string().min(1),
2976
+ z34.object({
2977
+ type: z34.literal("folder.create"),
2978
+ parent: z34.string().min(1),
2979
+ name: z34.string().min(1),
2957
2980
  /** As for `folder.list`: routing by the fleet, and the request its `folder.listing` answers. */
2958
- machineId: z33.string().optional(),
2959
- requestId: z33.string().min(1).max(100).optional()
2981
+ machineId: z34.string().optional(),
2982
+ requestId: z34.string().min(1).max(100).optional()
2960
2983
  }),
2961
2984
  /** `steer`: OMP only, redirect the turn running now instead of queueing the text after it. */
2962
2985
  /** OMP's `ask`: the answers to every question of the dialog `requestId`, in order (`selected` labels, and/or free `text`); `cancel` declines it. */
2963
- 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() }),
2986
+ z34.object({ type: z34.literal("session.answer"), id: z34.string(), requestId: z34.string().min(1).max(200), answers: z34.array(z34.object({ id: z34.string(), selected: z34.array(z34.string().max(2e3)).max(100), text: z34.string().max(2e4).optional() })).max(50), cancel: z34.boolean().optional() }),
2964
2987
  /** `by`: as session.decide's, who answers when the reply answers a request (set by the phone gateway for a device; absent, the PC). */
2965
- 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() }),
2988
+ z34.object({ type: z34.literal("session.reply"), id: z34.string(), text: z34.string(), attachments: z34.array(AttachmentIdSchema).max(ATTACHMENTS_MAX).optional(), steer: z34.boolean().optional(), by: DecidedBySchema.optional() }),
2966
2989
  /** The chat card's instruction (spec 2026-10-12 relay §4): sent now if the session is free, else queued until it is. */
2967
- z33.object({ type: z33.literal("session.relay"), qid: z33.string().min(1) }),
2990
+ z34.object({ type: z34.literal("session.relay"), qid: z34.string().min(1) }),
2968
2991
  /** Takes the card's queued instruction back out of the queue. */
2969
- z33.object({ type: z33.literal("session.relay.cancel"), qid: z33.string().min(1) }),
2992
+ z34.object({ type: z34.literal("session.relay.cancel"), qid: z34.string().min(1) }),
2970
2993
  /** The chat's generic card (action registry spec §5.1): applies its rows in order (all of them without `rows`), stopping at
2971
2994
  * the first failure. `confirmed` says the front asked again; refused without it when a row is destructive. */
2972
- z33.object({
2973
- type: z33.literal("chat.act"),
2974
- rid: z33.string().min(1).max(100),
2975
- qid: z33.string().min(1),
2995
+ z34.object({
2996
+ type: z34.literal("chat.act"),
2997
+ rid: z34.string().min(1).max(100),
2998
+ qid: z34.string().min(1),
2976
2999
  rows: launchRows.optional(),
2977
- confirmed: z33.literal(true).optional(),
3000
+ confirmed: z34.literal(true).optional(),
2978
3001
  /** « Refuser »: each row (session.decide only) answers its session's request with deny, whatever its own decision; never
2979
3002
  * confirmed, and allowed on a request shown cut. The rows become `denied`. */
2980
- deny: z33.literal(true).optional()
3003
+ deny: z34.literal(true).optional()
2981
3004
  }),
2982
3005
  /** « Ignorer » the turn's cards, for every device and for Ledge (who is told at the next question); `undo` opens them
2983
3006
  * again (« Revoir »). Refused while one of them is under way. Every client gets the turn's `ignoredAt` through chat.history. */
2984
- z33.object({ type: z33.literal("chat.ignore"), qid: z33.string().min(1), undo: z33.literal(true).optional() }),
3007
+ z34.object({ type: z34.literal("chat.ignore"), qid: z34.string().min(1), undo: z34.literal(true).optional() }),
2985
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. */
2986
- z33.object({
2987
- type: z33.literal("point.act"),
2988
- qid: z33.string().min(1),
2989
- item: z33.string().min(1).max(200),
3009
+ z34.object({
3010
+ type: z34.literal("point.act"),
3011
+ qid: z34.string().min(1),
3012
+ item: z34.string().min(1).max(200),
2990
3013
  answer: PointAnswerSchema.optional(),
2991
3014
  /** Applies the row's suggestion instead of answering it (exactly one of `answer` and `suggest`). */
2992
- suggest: z33.literal(true).optional(),
3015
+ suggest: z34.literal(true).optional(),
2993
3016
  /** The front's confirmation of a destructive answer (an accepted request, a decision), as `chat.act` takes it. */
2994
- confirmed: z33.literal(true).optional()
3017
+ confirmed: z34.literal(true).optional()
2995
3018
  }),
2996
- z33.object({ type: z33.literal("point.later"), qid: z33.string().min(1) }),
2997
- z33.object({ type: z33.literal("operator.read"), eventId: z33.number().int().min(0) }),
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) }),
2998
3021
  /** A registry action run outside the chat (#93, the CLI): the daemon resolves `args` as it does a generic card's row, then
2999
3022
  * applies it through its own handler. `by` the session that asks, left out for the user; `confirmed` for a destructive one. */
3000
- z33.object({
3001
- type: z33.literal("action.run"),
3002
- rid: z33.string().min(1).max(100),
3003
- by: z33.string().min(1).optional(),
3023
+ z34.object({
3024
+ type: z34.literal("action.run"),
3025
+ rid: z34.string().min(1).max(100),
3026
+ by: z34.string().min(1).optional(),
3004
3027
  /** `by`'s key (LEDGE_SESSION_KEY) */
3005
- key: z33.string().max(128).optional(),
3028
+ key: z34.string().max(128).optional(),
3006
3029
  action: ActionIdSchema,
3007
- args: z33.record(z33.unknown()),
3008
- confirmed: z33.literal(true).optional()
3030
+ args: z34.record(z34.unknown()),
3031
+ confirmed: z34.literal(true).optional()
3009
3032
  }),
3010
3033
  /** The chat's close card: closes the turn's sessions, `rows` (indexes into its `closes`) or all of them. */
3011
- z33.object({ type: z33.literal("session.close"), qid: z33.string().min(1), rows: launchRows.optional() }),
3034
+ z34.object({ type: z34.literal("session.close"), qid: z34.string().min(1), rows: launchRows.optional() }),
3012
3035
  /** `always` and `note` only where the harness offers them (`offers`); a note goes with `deny`, for the agent to read. */
3013
- z33.object({
3014
- type: z33.literal("session.decide"),
3015
- id: z33.string(),
3036
+ z34.object({
3037
+ type: z34.literal("session.decide"),
3038
+ id: z34.string(),
3016
3039
  decision: DecisionSchema,
3017
- note: z33.string().trim().min(1).max(NOTE_MAX).optional(),
3040
+ note: z34.string().trim().min(1).max(NOTE_MAX).optional(),
3018
3041
  /** 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.
3019
3042
  * `key` (pendingKey) covers its whole content; older fronts send kind and text only. */
3020
- expect: PendingSchema.pick({ kind: true, text: true }).extend({ key: z33.string().max(64).optional() }).optional(),
3043
+ expect: PendingSchema.pick({ kind: true, text: true }).extend({ key: z34.string().max(64).optional() }).optional(),
3021
3044
  /** 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. */
3022
3045
  by: DecidedBySchema.optional()
3023
3046
  }),
3024
- z33.object({ type: z33.literal("session.focus"), id: z33.string() }),
3025
- z33.object({ type: z33.literal("session.kill"), id: z33.string() }),
3047
+ z34.object({ type: z34.literal("session.focus"), id: z34.string() }),
3048
+ z34.object({ type: z34.literal("session.kill"), id: z34.string() }),
3026
3049
  /** `restoreQueue` (OMP): also take back what waits in its queue, returned as `session.queue.restored` to put in the draft. */
3027
- z33.object({ type: z33.literal("session.interrupt"), id: z33.string(), restoreQueue: z33.boolean().optional() }),
3050
+ z34.object({ type: z34.literal("session.interrupt"), id: z34.string(), restoreQueue: z34.boolean().optional() }),
3051
+ SessionAsideAskSchema,
3028
3052
  /** Removes a finished (exited) or read-only (hook_only) session from the list; refused for a live launcher session. */
3029
- z33.object({ type: z33.literal("session.dismiss"), id: z33.string() }),
3053
+ z34.object({ type: z34.literal("session.dismiss"), id: z34.string() }),
3030
3054
  /** Puts a session in the archive: it leaves the live list but is kept. */
3031
- z33.object({ type: z33.literal("session.archive"), id: z33.string() }),
3055
+ z34.object({ type: z34.literal("session.archive"), id: z34.string() }),
3032
3056
  /** Takes an archived session back out of the archive, as it was. */
3033
- z33.object({ type: z33.literal("session.restore"), id: z33.string() }),
3057
+ z34.object({ type: z34.literal("session.restore"), id: z34.string() }),
3034
3058
  /** Starts the agent again on an archived session's conversation. */
3035
- z33.object({ type: z33.literal("session.resume"), id: z33.string() }),
3059
+ z34.object({ type: z34.literal("session.resume"), id: z34.string() }),
3036
3060
  /** Changes a live session's model and effort (#58, lot 2), `null` for the agent's own default: the daemon restarts the
3037
3061
  * agent on the same conversation with them, at once when the session is free, else at its next free moment. */
3038
- z33.object({ type: z33.literal("session.model"), id: z33.string(), model: ModelIdSchema.nullable(), effort: EffortSchema.nullable() }),
3062
+ z34.object({ type: z34.literal("session.model"), id: z34.string(), model: ModelIdSchema.nullable(), effort: EffortSchema.nullable() }),
3039
3063
  /** Deletes a session for good, archived or not. */
3040
- z33.object({ type: z33.literal("session.delete"), id: z33.string() }),
3064
+ z34.object({ type: z34.literal("session.delete"), id: z34.string() }),
3041
3065
  /** 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. */
3042
- z33.object({ type: z33.literal("session.rename"), id: z33.string(), topic: z33.string().max(500) }),
3066
+ z34.object({ type: z34.literal("session.rename"), id: z34.string(), topic: z34.string().max(500) }),
3043
3067
  /** A session's nickname set from the sidebar (`sessionLabel` in the daemon's info), trimmed; empty removes it. Its name, its
3044
3068
  * address, does not change. */
3045
- z33.object({ type: z33.literal("session.label"), id: z33.string(), label: z33.string().max(200) }),
3046
- z33.object({ type: z33.literal("session.thread"), id: z33.string() }),
3047
- z33.object({ type: z33.literal("session.register"), session: SessionSchema }),
3069
+ z34.object({ type: z34.literal("session.label"), id: z34.string(), label: z34.string().max(200) }),
3070
+ z34.object({ type: z34.literal("session.thread"), id: z34.string() }),
3071
+ z34.object({ type: z34.literal("session.register"), session: SessionSchema }),
3048
3072
  /** `agent` and `cwd` describe the session when the daemon does not know it yet (a hook from an agent started without ledge). */
3049
- z33.object({
3050
- type: z33.literal("session.event"),
3051
- id: z33.string(),
3073
+ z34.object({
3074
+ type: z34.literal("session.event"),
3075
+ id: z34.string(),
3052
3076
  event: SessionEventSchema,
3053
3077
  agent: ToolSchema.optional(),
3054
- cwd: z33.string().optional(),
3078
+ cwd: z34.string().optional(),
3055
3079
  /** The OpenRig seat the agent runs in (`OPENRIG_SESSION_NAME`, `pod-member@rig`), when OpenRig launched it. */
3056
3080
  rigSeat: RigSeatNameSchema.optional()
3057
3081
  }),
3058
- z33.object({ type: z33.literal("session.unregister"), id: z33.string(), exitCode: z33.number().int().nullable() }),
3059
- z33.object({ type: z33.literal("snapshot.request") }),
3060
- z33.object({ type: z33.literal("chat.ask"), qid: z33.string().min(1), text: z33.string(), images: z33.array(ImageUploadSchema).max(ATTACHMENTS_MAX).optional(), tool: ToolSchema.optional() }),
3061
- z33.object({ type: z33.literal("chat.cancel"), qid: z33.string().min(1) }),
3082
+ z34.object({ type: z34.literal("session.unregister"), id: z34.string(), exitCode: z34.number().int().nullable() }),
3083
+ z34.object({ type: z34.literal("snapshot.request") }),
3084
+ z34.object({ type: z34.literal("chat.ask"), qid: z34.string().min(1), text: z34.string(), images: z34.array(ImageUploadSchema).max(ATTACHMENTS_MAX).optional(), tool: ToolSchema.optional() }),
3085
+ z34.object({ type: z34.literal("chat.cancel"), qid: z34.string().min(1) }),
3062
3086
  /** Starts a new conversation with Ledge: the day's turns are cleared and the next question opens a new harness session. */
3063
- z33.object({ type: z33.literal("chat.reset") }),
3087
+ z34.object({ type: z34.literal("chat.reset") }),
3064
3088
  /** Installs `@paradow/ledge@version` and restarts the service (spec 2026-10-12 auto-update §6). */
3065
- z33.object({ type: z33.literal("update.daemon"), version: z33.string().regex(SEMVER) }),
3089
+ z34.object({ type: z34.literal("update.daemon"), version: z34.string().regex(SEMVER) }),
3066
3090
  /** Replaces the daemon's machines list (first connected front wins); refused unless valid. */
3067
- z33.object({ type: z33.literal("machines.set"), machines: MachinesSchema }),
3091
+ z34.object({ type: z34.literal("machines.set"), machines: MachinesSchema }),
3068
3092
  /** Replaces the local daemon's projects and rules as a whole; refused unless valid. */
3069
- z33.object({ type: z33.literal("projects.set"), projects: ProjectsSchema }),
3093
+ z34.object({ type: z34.literal("projects.set"), projects: ProjectsSchema }),
3070
3094
  /** Issue #16: one project's sessions' order (its id, or NO_PROJECT ''), as session keys (placeSessions); answered by `projects`. */
3071
- 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) }),
3095
+ z34.object({ type: z34.literal("sessions.order"), project: z34.string().max(64), ids: z34.array(z34.string().min(1).max(300)).max(SESSION_ORDER_MAX) }),
3072
3096
  /** Replaces the island's settings as a whole; refused unless valid. */
3073
- z33.object({ type: z33.literal("island.set"), prefs: IslandPrefsSchema }),
3097
+ z34.object({ type: z34.literal("island.set"), prefs: IslandPrefsSchema }),
3074
3098
  /** Mobile access (lot 3), local fronts only. A changed `relayUrl` drops the relay session. */
3075
- z33.object({ type: z33.literal("mobile.set"), enabled: z33.boolean(), relayUrl: RelayUrlSchema }),
3076
- z33.object({ type: z33.literal("mobile.signin") }),
3077
- z33.object({ type: z33.literal("mobile.signin.cancel") }),
3078
- z33.object({ type: z33.literal("mobile.signout") }),
3099
+ z34.object({ type: z34.literal("mobile.set"), enabled: z34.boolean(), relayUrl: RelayUrlSchema }),
3100
+ z34.object({ type: z34.literal("mobile.signin") }),
3101
+ z34.object({ type: z34.literal("mobile.signin.cancel") }),
3102
+ z34.object({ type: z34.literal("mobile.signout") }),
3079
3103
  /** While the link is offline: try again now. */
3080
- z33.object({ type: z33.literal("mobile.retry") }),
3104
+ z34.object({ type: z34.literal("mobile.retry") }),
3081
3105
  /** `replaces`: an approved device this one takes the place of (the same app reinstalled), revoked once this one is stored. */
3082
- z33.object({ type: z33.literal("mobile.pairing.approve"), id: z33.string().min(1).max(100), replaces: z33.string().min(1).max(100).optional() }),
3083
- z33.object({ type: z33.literal("mobile.pairing.deny"), id: z33.string().min(1).max(100) }),
3106
+ z34.object({ type: z34.literal("mobile.pairing.approve"), id: z34.string().min(1).max(100), replaces: z34.string().min(1).max(100).optional() }),
3107
+ z34.object({ type: z34.literal("mobile.pairing.deny"), id: z34.string().min(1).max(100) }),
3084
3108
  /** `id`: the device's fingerprint. */
3085
- z33.object({ type: z33.literal("mobile.device.revoke"), id: z33.string().min(1).max(100) }),
3109
+ z34.object({ type: z34.literal("mobile.device.revoke"), id: z34.string().min(1).max(100) }),
3086
3110
  /** Names a device (`id`: its fingerprint); the device sees its new name in its next snapshot. */
3087
- z33.object({ type: z33.literal("mobile.device.rename"), id: z33.string().min(1).max(100), name: DeviceNameSchema }),
3111
+ z34.object({ type: z34.literal("mobile.device.rename"), id: z34.string().min(1).max(100), name: DeviceNameSchema }),
3088
3112
  /** « Taper dans les terminaux depuis le téléphone »; turned off, every phone loses the hand. */
3089
- z33.object({ type: z33.literal("mobile.terminal"), input: z33.boolean() }),
3113
+ z34.object({ type: z34.literal("mobile.terminal"), input: z34.boolean() }),
3090
3114
  /** « C'était bien moi » (`recovered`: its notice goes, the trace stays) or « Compris » (`refused`) on a device's row. */
3091
- z33.object({ type: z33.literal("mobile.device.ack"), id: z33.string().min(1).max(100), what: z33.enum(["recovered", "refused"]) }),
3115
+ z34.object({ type: z34.literal("mobile.device.ack"), id: z34.string().min(1).max(100), what: z34.enum(["recovered", "refused"]) }),
3092
3116
  /** « Débloquer »: passkey recovery is taken again after 3 failed verifications. */
3093
- z33.object({ type: z33.literal("mobile.recovery.unblock") }),
3117
+ z34.object({ type: z34.literal("mobile.recovery.unblock") }),
3094
3118
  /** « Reprendre la main »: the phone typing into the session's terminal goes back to reading it. */
3095
- z33.object({ type: z33.literal("terminal.release"), id: z33.string().min(1) }),
3119
+ z34.object({ type: z34.literal("terminal.release"), id: z34.string().min(1) }),
3096
3120
  /** 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. */
3097
- 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() }),
3121
+ z34.object({ type: z34.literal("session.message"), rid: z34.string().min(1), from: z34.string().min(1), to: z34.string().min(1), text: z34.string().min(1).max(MESSAGE_MAX), summary: z34.string().max(SUMMARY_MAX).optional(), intercept: z34.boolean().optional() }),
3098
3122
  /** The user writing to every session of a project, or to several sessions (ids or names). */
3099
- z33.object({
3100
- type: z33.literal("session.broadcast"),
3101
- rid: z33.string().min(1).max(100),
3102
- 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) })]),
3103
- text: z33.string().trim().min(1).max(MESSAGE_MAX),
3104
- summary: z33.string().max(SUMMARY_MAX).optional(),
3123
+ z34.object({
3124
+ type: z34.literal("session.broadcast"),
3125
+ rid: z34.string().min(1).max(100),
3126
+ to: z34.union([z34.object({ project: z34.string().min(1).max(80) }), z34.object({ sessions: z34.array(z34.string().min(1)).min(1).max(BROADCAST_SESSIONS_MAX) })]),
3127
+ text: z34.string().trim().min(1).max(MESSAGE_MAX),
3128
+ summary: z34.string().max(SUMMARY_MAX).optional(),
3105
3129
  /** How the recipients are told who it went to (« (à <label>) »), instead of the names: a project the fleet turned into sessions. */
3106
- label: z33.string().min(1).max(BROADCAST_LABEL_MAX).optional()
3130
+ label: z34.string().min(1).max(BROADCAST_LABEL_MAX).optional()
3107
3131
  }),
3108
3132
  /** `ledge read <id>`: a message's whole body, for its receiver or its sender (`by`, a session id). */
3109
- z33.object({ type: z33.literal("message.read"), id: z33.string().min(1).max(40), by: z33.string().min(1) }),
3133
+ z34.object({ type: z34.literal("message.read"), id: z34.string().min(1).max(40), by: z34.string().min(1) }),
3110
3134
  TaskCmdSchema,
3111
3135
  /** Reports (issue #9): the « Signaler » form's preview, creation and an agent's report ignored; `ledge report`. */
3112
3136
  ReportPreviewSchema,
@@ -3132,111 +3156,111 @@ var ClientMessageSchema = z33.discriminatedUnion("type", [
3132
3156
  ]);
3133
3157
 
3134
3158
  // ../../packages/protocol/src/relay.ts
3135
- import { z as z34 } from "zod";
3159
+ import { z as z35 } from "zod";
3136
3160
  var SEALED_MAX = 1048576;
3137
- var RelayPeerSchema = z34.union([z34.literal("pc"), z34.string().regex(/^d_[A-Za-z0-9_-]{16,40}$/)]);
3138
- var RelayClientMessageSchema = z34.object({
3139
- type: z34.literal("send"),
3161
+ var RelayPeerSchema = z35.union([z35.literal("pc"), z35.string().regex(/^d_[A-Za-z0-9_-]{16,40}$/)]);
3162
+ var RelayClientMessageSchema = z35.object({
3163
+ type: z35.literal("send"),
3140
3164
  to: RelayPeerSchema,
3141
- body: z34.string().max(SEALED_MAX)
3165
+ body: z35.string().max(SEALED_MAX)
3142
3166
  });
3143
- var RelayServerMessageSchema = z34.discriminatedUnion("type", [
3144
- z34.object({ type: z34.literal("welcome"), accountId: z34.string(), self: RelayPeerSchema, online: z34.array(RelayPeerSchema) }),
3145
- z34.object({ type: z34.literal("deliver"), from: RelayPeerSchema, body: z34.string() }),
3146
- z34.object({ type: z34.literal("presence"), peer: RelayPeerSchema, online: z34.boolean() }),
3167
+ var RelayServerMessageSchema = z35.discriminatedUnion("type", [
3168
+ z35.object({ type: z35.literal("welcome"), accountId: z35.string(), self: RelayPeerSchema, online: z35.array(RelayPeerSchema) }),
3169
+ z35.object({ type: z35.literal("deliver"), from: RelayPeerSchema, body: z35.string() }),
3170
+ z35.object({ type: z35.literal("presence"), peer: RelayPeerSchema, online: z35.boolean() }),
3147
3171
  /**
3148
3172
  * A frame was refused; `to` names the target when it is known.
3149
3173
  * Contract: an error concerning a sealed body (`offline`, `too_large`, or a socket closed with 4008
3150
3174
  * `rate_limited`) means that body was not delivered, so the sequence on that channel is lost: the
3151
3175
  * sender must re-handshake with that peer before sending to it again.
3152
3176
  */
3153
- z34.object({
3154
- type: z34.literal("error"),
3155
- code: z34.enum(["bad_frame", "too_large", "bad_target", "offline", "rate_limited"]),
3177
+ z35.object({
3178
+ type: z35.literal("error"),
3179
+ code: z35.enum(["bad_frame", "too_large", "bad_target", "offline", "rate_limited"]),
3156
3180
  to: RelayPeerSchema.optional()
3157
3181
  })
3158
3182
  ]);
3159
3183
  var PAIR_LABEL_MAX = 40;
3160
- var KeyB64 = z34.string().regex(/^[A-Za-z0-9_-]{87}$/);
3161
- var Nonce = z34.string().regex(/^[A-Za-z0-9_-]{43}$/);
3162
- var Fingerprint = z34.string().regex(/^[A-Za-z0-9_-]{22}$/);
3163
- var B64U = z34.string().regex(/^[A-Za-z0-9_-]*$/);
3164
- var RecoverWhySchema = z34.enum(["none", "old", "offline", "otherPc", "timeout", "revoked", "connected", "rate", "blocked", "failed"]);
3184
+ var KeyB64 = z35.string().regex(/^[A-Za-z0-9_-]{87}$/);
3185
+ var Nonce = z35.string().regex(/^[A-Za-z0-9_-]{43}$/);
3186
+ var Fingerprint = z35.string().regex(/^[A-Za-z0-9_-]{22}$/);
3187
+ var B64U = z35.string().regex(/^[A-Za-z0-9_-]*$/);
3188
+ var RecoverWhySchema = z35.enum(["none", "old", "offline", "otherPc", "timeout", "revoked", "connected", "rate", "blocked", "failed"]);
3165
3189
  var RecoverRefusalSchema = RecoverWhySchema.extract(["revoked", "connected", "rate", "blocked", "failed"]);
3166
- var ModelLabel = z34.string().trim().min(1).max(PAIR_LABEL_MAX);
3167
- var RecoverAssertion = z34.object({
3190
+ var ModelLabel = z35.string().trim().min(1).max(PAIR_LABEL_MAX);
3191
+ var RecoverAssertion = z35.object({
3168
3192
  id: B64U.max(1366),
3169
3193
  clientDataJSON: B64U.max(4096),
3170
3194
  authenticatorData: B64U.max(4096),
3171
3195
  signature: B64U.max(1024)
3172
3196
  }).strict();
3173
- var SealedFrameSchema = z34.discriminatedUnion("k", [
3197
+ var SealedFrameSchema = z35.discriminatedUnion("k", [
3174
3198
  /** `e` is the ephemeral key, `f` the fingerprint of the sender's static key. */
3175
- z34.object({ k: z34.literal("hello"), e: KeyB64, f: Fingerprint }),
3176
- z34.object({ k: z34.literal("msg"), s: z34.string() }),
3177
- z34.object({ k: z34.literal("pair_commit"), c: Nonce, label: z34.string().trim().min(1).max(PAIR_LABEL_MAX) }),
3178
- z34.object({ k: z34.literal("pair_offer"), pc: KeyB64, n: Nonce }),
3179
- z34.object({ k: z34.literal("pair_reveal"), d: KeyB64, n: Nonce }),
3180
- z34.object({ k: z34.literal("pair_ok") }),
3181
- z34.object({ k: z34.literal("pair_no") }),
3182
- z34.object({ k: z34.literal("denied") }),
3183
- z34.object({ k: z34.literal("rekey") }),
3199
+ z35.object({ k: z35.literal("hello"), e: KeyB64, f: Fingerprint }),
3200
+ z35.object({ k: z35.literal("msg"), s: z35.string() }),
3201
+ z35.object({ k: z35.literal("pair_commit"), c: Nonce, label: z35.string().trim().min(1).max(PAIR_LABEL_MAX) }),
3202
+ z35.object({ k: z35.literal("pair_offer"), pc: KeyB64, n: Nonce }),
3203
+ z35.object({ k: z35.literal("pair_reveal"), d: KeyB64, n: Nonce }),
3204
+ z35.object({ k: z35.literal("pair_ok") }),
3205
+ z35.object({ k: z35.literal("pair_no") }),
3206
+ z35.object({ k: z35.literal("denied") }),
3207
+ z35.object({ k: z35.literal("rekey") }),
3184
3208
  // ── Passkey recovery after a reinstall (unsealed, like pairing: nothing in them lets the relay act) ──
3185
3209
  /** 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. */
3186
- z34.object({ k: z34.literal("recover_start"), d: KeyB64, n: Nonce, model: ModelLabel.optional() }),
3210
+ z35.object({ k: z35.literal("recover_start"), d: KeyB64, n: Nonce, model: ModelLabel.optional() }),
3187
3211
  /** PC → phone: its key `pc`, a one-use nonce `n` (60 s), and its name (`WSL`), for the phone's screens. */
3188
- z34.object({ k: z34.literal("recover_offer"), pc: KeyB64, n: Nonce, name: z34.string().max(PAIR_LABEL_MAX).optional() }),
3212
+ z35.object({ k: z35.literal("recover_offer"), pc: KeyB64, n: Nonce, name: z35.string().max(PAIR_LABEL_MAX).optional() }),
3189
3213
  /** Phone → PC: the discoverable assertion over `recoverChallenge(pc, d, pcNonce, n)`, and its `userHandle` (« L1 » ‖ digest ‖ random). */
3190
- z34.object({ k: z34.literal("recover_proof"), assertion: RecoverAssertion, userHandle: B64U.max(128) }),
3214
+ z35.object({ k: z35.literal("recover_proof"), assertion: RecoverAssertion, userHandle: B64U.max(128) }),
3191
3215
  /** PC → phone: the device is back under its new key; `name` the one it keeps. The phone pins the PC key, then says `hello`. */
3192
- z34.object({ k: z34.literal("recover_ok"), name: z34.string().max(PAIR_LABEL_MAX).optional() }),
3216
+ z35.object({ k: z35.literal("recover_ok"), name: z35.string().max(PAIR_LABEL_MAX).optional() }),
3193
3217
  /** PC → phone: refused. `device` the device the passkey names (`revoked`, `connected`); `revokedAt` when it was revoked (ISO,
3194
3218
  * `revoked` within 90 days); `retryInMs` until a recovery is taken again (`rate`). */
3195
- z34.object({
3196
- k: z34.literal("recover_no"),
3219
+ z35.object({
3220
+ k: z35.literal("recover_no"),
3197
3221
  why: RecoverRefusalSchema,
3198
- device: z34.string().max(PAIR_LABEL_MAX).optional(),
3199
- revokedAt: z34.string().datetime().optional(),
3200
- retryInMs: z34.number().int().min(0).optional()
3222
+ device: z35.string().max(PAIR_LABEL_MAX).optional(),
3223
+ revokedAt: z35.string().datetime().optional(),
3224
+ retryInMs: z35.number().int().min(0).optional()
3201
3225
  })
3202
3226
  ]);
3203
3227
 
3204
3228
  // ../../packages/protocol/src/relayAuth.ts
3205
- import { z as z35 } from "zod";
3229
+ import { z as z36 } from "zod";
3206
3230
  var RELAY_SESSION_COOKIE = "ledge_session";
3207
3231
  var RELAY_CLOSE_SIGNED_OUT = 4001;
3208
3232
  var RELAY_CLOSE_REPLACED = 4e3;
3209
3233
  var RELAY_CLOSE_RATE_LIMITED = 4008;
3210
- var DeviceStartResponseSchema = z35.object({
3211
- deviceCode: z35.string().min(1),
3212
- userCode: z35.string().min(1),
3213
- verificationUri: z35.string().min(1),
3214
- expiresIn: z35.number().int().positive(),
3215
- interval: z35.number().int().positive()
3216
- });
3217
- var DevicePollResponseSchema = z35.discriminatedUnion("status", [
3218
- z35.object({ status: z35.literal("pending") }),
3219
- z35.object({ status: z35.literal("slow_down"), interval: z35.number().int().positive() }),
3234
+ var DeviceStartResponseSchema = z36.object({
3235
+ deviceCode: z36.string().min(1),
3236
+ userCode: z36.string().min(1),
3237
+ verificationUri: z36.string().min(1),
3238
+ expiresIn: z36.number().int().positive(),
3239
+ interval: z36.number().int().positive()
3240
+ });
3241
+ var DevicePollResponseSchema = z36.discriminatedUnion("status", [
3242
+ z36.object({ status: z36.literal("pending") }),
3243
+ z36.object({ status: z36.literal("slow_down"), interval: z36.number().int().positive() }),
3220
3244
  /** `token` is the relay session token, shown this once only. */
3221
- z35.object({ status: z35.literal("ok"), token: z35.string().min(1), accountId: z35.string().min(1), login: z35.string().min(1) }),
3222
- z35.object({ status: z35.literal("expired") }),
3223
- z35.object({ status: z35.literal("denied") }),
3224
- z35.object({ status: z35.literal("not_allowed") })
3245
+ z36.object({ status: z36.literal("ok"), token: z36.string().min(1), accountId: z36.string().min(1), login: z36.string().min(1) }),
3246
+ z36.object({ status: z36.literal("expired") }),
3247
+ z36.object({ status: z36.literal("denied") }),
3248
+ z36.object({ status: z36.literal("not_allowed") })
3225
3249
  ]);
3226
- var DeviceRevokeResponseSchema = z35.object({ revoked: z35.number().int().min(0) });
3227
- var MeResponseSchema = z35.object({
3228
- accountId: z35.string().min(1),
3229
- login: z35.string().min(1),
3250
+ var DeviceRevokeResponseSchema = z36.object({ revoked: z36.number().int().min(0) });
3251
+ var MeResponseSchema = z36.object({
3252
+ accountId: z36.string().min(1),
3253
+ login: z36.string().min(1),
3230
3254
  peer: RelayPeerSchema,
3231
- kind: z35.enum(["pc", "device"])
3255
+ kind: z36.enum(["pc", "device"])
3232
3256
  });
3233
3257
 
3234
3258
  // ../../packages/protocol/src/phone.ts
3235
- import { z as z39 } from "zod";
3259
+ import { z as z40 } from "zod";
3236
3260
 
3237
3261
  // ../../packages/protocol/src/push.ts
3238
- import { z as z36 } from "zod";
3239
- var B64U2 = z36.string().regex(/^[A-Za-z0-9_-]*$/);
3262
+ import { z as z37 } from "zod";
3263
+ var B64U2 = z37.string().regex(/^[A-Za-z0-9_-]*$/);
3240
3264
  var PUSH_HOSTS = ["*.push.apple.com", "fcm.googleapis.com", "updates.push.services.mozilla.com", "*.notify.windows.com"];
3241
3265
  function pushEndpointAllowed(url2) {
3242
3266
  let u;
@@ -3253,43 +3277,43 @@ function pushEndpointAllowed(url2) {
3253
3277
  return host.length > suffix.length && host.endsWith(suffix);
3254
3278
  });
3255
3279
  }
3256
- var PushSendSchema = z36.object({
3257
- endpoint: z36.string().url().max(1024),
3280
+ var PushSendSchema = z37.object({
3281
+ endpoint: z37.string().url().max(1024),
3258
3282
  body: B64U2.max(5462),
3259
- ttl: z36.number().int().min(0).max(86400),
3260
- urgency: z36.enum(["normal", "high"]),
3261
- topic: z36.string().regex(/^[A-Za-z0-9_-]{1,32}$/)
3283
+ ttl: z37.number().int().min(0).max(86400),
3284
+ urgency: z37.enum(["normal", "high"]),
3285
+ topic: z37.string().regex(/^[A-Za-z0-9_-]{1,32}$/)
3262
3286
  });
3263
- var PushSendResultSchema = z36.object({
3264
- result: z36.enum(["sent", "gone", "failed"]),
3265
- status: z36.number().int().optional()
3287
+ var PushSendResultSchema = z37.object({
3288
+ result: z37.enum(["sent", "gone", "failed"]),
3289
+ status: z37.number().int().optional()
3266
3290
  });
3267
- var PushSubscriptionSchema = z36.object({
3268
- endpoint: z36.string().url().max(1024).refine(pushEndpointAllowed),
3269
- keys: z36.object({ p256dh: B64U2.length(87), auth: B64U2.length(22) })
3291
+ var PushSubscriptionSchema = z37.object({
3292
+ endpoint: z37.string().url().max(1024).refine(pushEndpointAllowed),
3293
+ keys: z37.object({ p256dh: B64U2.length(87), auth: B64U2.length(22) })
3270
3294
  });
3271
- var PushPayloadSchema = z36.object({
3272
- v: z36.literal(1),
3295
+ var PushPayloadSchema = z37.object({
3296
+ v: z37.literal(1),
3273
3297
  /** `resolved`: a request or question answered (anywhere), replacing its notification under the same tag; only sent to a
3274
3298
  * device whose subscription says its service worker knows it (`push.subscribe` `resolved`). `point`: the operator's point, one per
3275
3299
  * paired device (the body is its lead); it replaces `finished`, which stays in the schema for older daemons but is no longer sent. */
3276
- kind: z36.enum(["request", "question", "finished", "chat", "decision", "resolved", "point"]),
3277
- title: z36.string().max(80),
3300
+ kind: z37.enum(["request", "question", "finished", "chat", "decision", "resolved", "point"]),
3301
+ title: z37.string().max(80),
3278
3302
  /**
3279
3303
  * Who the notification is about, so the phone writes its own title in its language (Q29): the session's name for `request`,
3280
3304
  * `question` and `resolved`, the giver's for `decision`; none for `chat`. Optional: an older daemon sends none, and an
3281
3305
  * older phone ignores it and shows `title`.
3282
3306
  */
3283
- name: z36.string().max(100).optional(),
3284
- body: z36.string().max(120),
3285
- url: z36.string().regex(/^\/#\/[A-Za-z0-9/%._~-]*$/).max(300),
3286
- badge: z36.number().int().min(0).max(999),
3287
- tag: z36.string().regex(/^[A-Za-z0-9_-]{1,32}$/)
3307
+ name: z37.string().max(100).optional(),
3308
+ body: z37.string().max(120),
3309
+ url: z37.string().regex(/^\/#\/[A-Za-z0-9/%._~-]*$/).max(300),
3310
+ badge: z37.number().int().min(0).max(999),
3311
+ tag: z37.string().regex(/^[A-Za-z0-9_-]{1,32}$/)
3288
3312
  });
3289
3313
 
3290
3314
  // ../../packages/protocol/src/phoneRigs.ts
3291
- import { z as z37 } from "zod";
3292
- var PhoneRigErrorSchema = z37.enum(["unknown_rig", "not_installed", "daemon_stopped", "unavailable"]);
3315
+ import { z as z38 } from "zod";
3316
+ var PhoneRigErrorSchema = z38.enum(["unknown_rig", "not_installed", "daemon_stopped", "unavailable"]);
3293
3317
  var PHONE_RIG_TEXT_MAX = 500;
3294
3318
  var PHONE_RIGS_MAX = 50;
3295
3319
  var PHONE_RIG_SEATS_MAX = 200;
@@ -3299,74 +3323,74 @@ var PHONE_GOALS_MAX = 50;
3299
3323
  var PhoneRigSchema = RigSchema.omit({ specPath: true }).extend({ nodes: RigSchema.shape.nodes.max(PHONE_RIG_SEATS_MAX) });
3300
3324
  var PhoneOpenRigStateSchema = OpenRigStateSchema.extend({
3301
3325
  daemon: OpenRigStateSchema.shape.daemon.omit({ message: true, pid: true }),
3302
- rigs: z37.array(PhoneRigSchema).max(PHONE_RIGS_MAX)
3326
+ rigs: z38.array(PhoneRigSchema).max(PHONE_RIGS_MAX)
3303
3327
  });
3304
- var PhoneRigQueueRowSchema = RigRowSchema.extend({ summary: z37.string().max(PHONE_RIG_SUMMARY_MAX).optional() });
3305
- var PhoneRigRoutingSchema = RigRoutingEntrySchema.extend({ summary: z37.string().max(PHONE_RIG_SUMMARY_MAX).optional() });
3306
- var PhoneRigPermissionSchema = RigSeatPermissionSchema.extend({ summary: z37.string().max(PHONE_RIG_TEXT_MAX).optional(), error: z37.string().max(PHONE_RIG_TEXT_MAX).optional() });
3328
+ var PhoneRigQueueRowSchema = RigRowSchema.extend({ summary: z38.string().max(PHONE_RIG_SUMMARY_MAX).optional() });
3329
+ var PhoneRigRoutingSchema = RigRoutingEntrySchema.extend({ summary: z38.string().max(PHONE_RIG_SUMMARY_MAX).optional() });
3330
+ var PhoneRigPermissionSchema = RigSeatPermissionSchema.extend({ summary: z38.string().max(PHONE_RIG_TEXT_MAX).optional(), error: z38.string().max(PHONE_RIG_TEXT_MAX).optional() });
3307
3331
  var PhoneGoalSchema = GoalSchema;
3308
- var RigSeatCountsSchema = z37.record(RigRoleSchema, z37.number().int().min(0).max(9));
3309
- var PhoneRigRejectedSchema = z37.enum(["confirm_required", "assertion_invalid", "assertion_expired", "unavailable"]);
3332
+ var RigSeatCountsSchema = z38.record(RigRoleSchema, z38.number().int().min(0).max(9));
3333
+ var PhoneRigRejectedSchema = z38.enum(["confirm_required", "assertion_invalid", "assertion_expired", "unavailable"]);
3310
3334
 
3311
3335
  // ../../packages/protocol/src/phoneForge.ts
3312
- import { z as z38 } from "zod";
3336
+ import { z as z39 } from "zod";
3313
3337
  var PHONE_FORGE_PRS_MAX = 100;
3314
3338
  var PHONE_FORGE_FOLLOWED_MAX = 200;
3315
3339
  var PHONE_FORGE_MESSAGE_MAX = 500;
3316
3340
  var PhoneForgeStatusSchema = ForgeStatusSchema.omit({ message: true });
3317
- var PhoneForgeErrorSchema = z38.enum(["unavailable", "failed", "too_large"]);
3318
- var PhoneForgeActErrorSchema = z38.enum(["stale", "busy", "not_offered", "unavailable", "failed"]);
3319
- var PhoneForgeRejectedSchema = z38.enum(["confirm_required", "assertion_invalid", "assertion_expired", "unavailable"]);
3320
- var PhoneForgeStateSchema = z38.object({
3341
+ var PhoneForgeErrorSchema = z39.enum(["unavailable", "failed", "too_large"]);
3342
+ var PhoneForgeActErrorSchema = z39.enum(["stale", "busy", "not_offered", "unavailable", "failed"]);
3343
+ var PhoneForgeRejectedSchema = z39.enum(["confirm_required", "assertion_invalid", "assertion_expired", "unavailable"]);
3344
+ var PhoneForgeStateSchema = z39.object({
3321
3345
  /** Newest change first. A request whose forge, state or pipeline an older phone does not know is dropped, not the message. */
3322
- prs: z38.preprocess(dropUnknownPrs, z38.array(PullRequestSchema).max(PHONE_FORGE_PRS_MAX)),
3323
- forges: z38.preprocess(dropUnknownForges, z38.array(PhoneForgeStatusSchema).max(20)),
3324
- followed: z38.preprocess(dropUnknownForges, z38.array(FollowedSessionSchema).max(PHONE_FORGE_FOLLOWED_MAX)),
3346
+ prs: z39.preprocess(dropUnknownPrs, z39.array(PullRequestSchema).max(PHONE_FORGE_PRS_MAX)),
3347
+ forges: z39.preprocess(dropUnknownForges, z39.array(PhoneForgeStatusSchema).max(20)),
3348
+ followed: z39.preprocess(dropUnknownForges, z39.array(FollowedSessionSchema).max(PHONE_FORGE_FOLLOWED_MAX)),
3325
3349
  /** The account's own requests no session follows (issue #3), newest change first; absent from an older daemon. */
3326
- mine: z38.preprocess(dropUnknownPrs, z38.array(PullRequestSchema).max(PHONE_FORGE_PRS_MAX)).optional()
3350
+ mine: z39.preprocess(dropUnknownPrs, z39.array(PullRequestSchema).max(PHONE_FORGE_PRS_MAX)).optional()
3327
3351
  });
3328
3352
 
3329
3353
  // ../../packages/protocol/src/phone.ts
3330
3354
  var PHONE_ROW_SUMMARY_MAX = 200;
3331
- var PhoneRigRowSchema = RigRowSchema.extend({ summary: z39.string().max(PHONE_ROW_SUMMARY_MAX).optional() });
3332
- var PhoneRowErrorSchema = z39.enum(["not_found", "unavailable"]);
3355
+ var PhoneRigRowSchema = RigRowSchema.extend({ summary: z40.string().max(PHONE_ROW_SUMMARY_MAX).optional() });
3356
+ var PhoneRowErrorSchema = z40.enum(["not_found", "unavailable"]);
3333
3357
  var PHONE_PROTOCOL = 1;
3334
3358
  var utf8 = new TextEncoder();
3335
3359
  var THREAD_TEXT_MAX = 8192;
3336
3360
  var TOOL_TEXT_MAX = 2048;
3337
3361
  var CHECKLIST_TASKS_MAX = 50;
3338
3362
  var CHECKLIST_TEXT_MAX = 200;
3339
- var ChecklistStatusSchema = z39.enum(["pending", "in_progress", "completed"]);
3340
- var PhoneChecklistSchema = z39.object({
3341
- tasks: z39.array(z39.object({ text: z39.string().max(CHECKLIST_TEXT_MAX), status: ChecklistStatusSchema })).max(CHECKLIST_TASKS_MAX),
3342
- done: z39.number().int().nonnegative(),
3343
- total: z39.number().int().nonnegative(),
3344
- cut: z39.literal(true).optional()
3345
- });
3346
- var PhoneChecklistSummarySchema = z39.object({
3347
- done: z39.number().int().nonnegative(),
3348
- total: z39.number().int().nonnegative(),
3349
- current: z39.string().max(CHECKLIST_TEXT_MAX).optional(),
3350
- cut: z39.literal(true).optional()
3351
- });
3352
- var RiskSchema = z39.enum(["low", "high"]);
3353
- 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"]);
3354
- var OperationIdSchema = z39.string().uuid();
3355
- var OperationStatusSchema = z39.enum(["received", "applied", "rejected", "failed"]);
3356
- var OperationReasonSchema = z39.enum([...RefusalCodeSchema.options, "untypable", "confirm_required", "conflict", "assertion_invalid", "assertion_expired", "scheduled", "folder_taken", "not_found", "not_pending", ...ModelRefusalSchema.options]);
3357
- var CapabilitiesSchema = z39.object({
3363
+ var ChecklistStatusSchema = z40.enum(["pending", "in_progress", "completed"]);
3364
+ var PhoneChecklistSchema = z40.object({
3365
+ tasks: z40.array(z40.object({ text: z40.string().max(CHECKLIST_TEXT_MAX), status: ChecklistStatusSchema })).max(CHECKLIST_TASKS_MAX),
3366
+ done: z40.number().int().nonnegative(),
3367
+ total: z40.number().int().nonnegative(),
3368
+ cut: z40.literal(true).optional()
3369
+ });
3370
+ var PhoneChecklistSummarySchema = z40.object({
3371
+ done: z40.number().int().nonnegative(),
3372
+ total: z40.number().int().nonnegative(),
3373
+ current: z40.string().max(CHECKLIST_TEXT_MAX).optional(),
3374
+ cut: z40.literal(true).optional()
3375
+ });
3376
+ var RiskSchema = z40.enum(["low", "high"]);
3377
+ var RiskReasonSchema = z40.enum(["question", "read_only_command", "edit_inside_folder", "pushes", "destroys", "deploys", "publishes", "pipes_to_shell", "network", "writes_outside_folder", "sensitive_path", "unsafe_flag", "shell_syntax", "script", "plan", "unknown"]);
3378
+ var OperationIdSchema = z40.string().uuid();
3379
+ var OperationStatusSchema = z40.enum(["received", "applied", "rejected", "failed"]);
3380
+ var OperationReasonSchema = z40.enum([...RefusalCodeSchema.options, "untypable", "confirm_required", "conflict", "assertion_invalid", "assertion_expired", "scheduled", "folder_taken", "not_found", "not_pending", ...ModelRefusalSchema.options]);
3381
+ var CapabilitiesSchema = z40.object({
3358
3382
  /** A question can be answered in free text. */
3359
- freeTextAnswer: z39.boolean(),
3383
+ freeTextAnswer: z40.boolean(),
3360
3384
  /** The session's accept/deny can be typed; absent = true. */
3361
- decide: z39.boolean().optional(),
3385
+ decide: z40.boolean().optional(),
3362
3386
  /** OMP's dialog questions can be answered from the phone; absent = false. */
3363
- questions: z39.boolean().optional()
3387
+ questions: z40.boolean().optional()
3364
3388
  });
3365
- var CapabilitiesByToolSchema = z39.object({ claude: CapabilitiesSchema, codex: CapabilitiesSchema, cursor: CapabilitiesSchema, omp: CapabilitiesSchema });
3366
- var PhonePendingSchema = PendingSchema.extend({ key: z39.string().max(64), risk: RiskSchema, riskReason: RiskReasonSchema, cut: z39.literal(true).optional() });
3367
- var SwitchableSessionSchema = SessionSchema.extend({ canSwitch: z39.literal(true).optional() });
3368
- var PhoneProjectSchema = z39.object({ id: ProjectIdSchema, name: z39.string().max(80), color: ProjectColorSchema });
3369
- var PhoneSessionOrderSchema = z39.record(z39.string().max(64), z39.array(z39.string().max(200)).max(SESSION_ORDER_MAX));
3389
+ var CapabilitiesByToolSchema = z40.object({ claude: CapabilitiesSchema, codex: CapabilitiesSchema, cursor: CapabilitiesSchema, omp: CapabilitiesSchema });
3390
+ var PhonePendingSchema = PendingSchema.extend({ key: z40.string().max(64), risk: RiskSchema, riskReason: RiskReasonSchema, cut: z40.literal(true).optional() });
3391
+ var SwitchableSessionSchema = SessionSchema.extend({ canSwitch: z40.literal(true).optional() });
3392
+ var PhoneProjectSchema = z40.object({ id: ProjectIdSchema, name: z40.string().max(80), color: ProjectColorSchema });
3393
+ var PhoneSessionOrderSchema = z40.record(z40.string().max(64), z40.array(z40.string().max(200)).max(SESSION_ORDER_MAX));
3370
3394
  var PHONE_PROJECTS_MAX = 100;
3371
3395
  var PHONE_RIG_NAME_MAX = 100;
3372
3396
  var PhoneSessionSchema = SwitchableSessionSchema.pick({
@@ -3402,110 +3426,110 @@ var PhoneSessionSchema = SwitchableSessionSchema.pick({
3402
3426
  closedHow: true
3403
3427
  }).extend({
3404
3428
  /** What it is running now (« pnpm --filter desktop test »), `doingOf` on the PC: the list row and « En cours ». Older phones drop the field. */
3405
- doing: z39.object({ tool: z39.string().max(DOING_TOOL_MAX), label: z39.string().max(DOING_LABEL_MAX), since: z39.string().datetime() }).optional(),
3429
+ doing: z40.object({ tool: z40.string().max(DOING_TOOL_MAX), label: z40.string().max(DOING_LABEL_MAX), since: z40.string().datetime() }).optional(),
3406
3430
  pending: PhonePendingSchema.optional(),
3407
- unread: z39.boolean(),
3408
- handover: z39.object({ state: HandoverStateSchema, toName: z39.string().max(80).optional() }).strict().optional(),
3431
+ unread: z40.boolean(),
3432
+ handover: z40.object({ state: HandoverStateSchema, toName: z40.string().max(80).optional() }).strict().optional(),
3409
3433
  /** Absent: the agent has no checklist. */
3410
3434
  checklist: PhoneChecklistSummarySchema.optional(),
3411
3435
  /** Started without Ledge (`hook_only`): the phone can neither close nor resume it. */
3412
- readOnly: z39.literal(true).optional(),
3436
+ readOnly: z40.literal(true).optional(),
3413
3437
  /** 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 »). */
3414
3438
  projectId: ProjectIdSchema.optional(),
3415
3439
  /** The OpenRig seat it is (`daemon.atelier`): its rig and its role once OpenRig named it. Never the seat's folder. */
3416
- rig: z39.object({ name: z39.string().max(PHONE_RIG_NAME_MAX), role: z39.string().max(PHONE_RIG_NAME_MAX).optional() }).optional()
3440
+ rig: z40.object({ name: z40.string().max(PHONE_RIG_NAME_MAX), role: z40.string().max(PHONE_RIG_NAME_MAX).optional() }).optional()
3417
3441
  });
3418
- var B64U3 = z39.string().regex(/^[A-Za-z0-9_-]*$/);
3419
- var CredentialSchema = z39.object({
3442
+ var B64U3 = z40.string().regex(/^[A-Za-z0-9_-]*$/);
3443
+ var CredentialSchema = z40.object({
3420
3444
  id: B64U3.max(1366),
3421
3445
  publicKey: B64U3.max(2048),
3422
- alg: z39.union([z39.literal(-7), z39.literal(-257)]),
3446
+ alg: z40.union([z40.literal(-7), z40.literal(-257)]),
3423
3447
  clientDataJSON: B64U3.max(4096),
3424
3448
  authenticatorData: B64U3.max(4096),
3425
- transports: z39.array(z39.string().max(20)).max(8).optional()
3449
+ transports: z40.array(z40.string().max(20)).max(8).optional()
3426
3450
  });
3427
- var AssertionSchema = z39.object({
3451
+ var AssertionSchema = z40.object({
3428
3452
  id: B64U3.max(1366),
3429
3453
  clientDataJSON: B64U3.max(4096),
3430
3454
  authenticatorData: B64U3.max(4096),
3431
3455
  signature: B64U3.max(1024)
3432
3456
  });
3433
- var ConfirmPurposeSchema = z39.enum(["register", "decide", "launch", "close", "act", "pc", "terminal", "rig", "note", "project", "folder", "rigs", "forge", "routine"]);
3457
+ var ConfirmPurposeSchema = z40.enum(["register", "decide", "launch", "close", "act", "pc", "terminal", "rig", "note", "project", "folder", "rigs", "forge", "routine"]);
3434
3458
  var PhoneChatStepSchema = ChatStepSchema.pick({ kind: true, id: true, name: true }).strict();
3435
- var PhoneChatProposalSchema = z39.object({
3436
- project: z39.string().max(80),
3459
+ var PhoneChatProposalSchema = z40.object({
3460
+ project: z40.string().max(80),
3437
3461
  tool: ToolSchema,
3438
- prompt: z39.string().max(TOOL_TEXT_MAX).optional(),
3439
- launchedId: z39.string().optional(),
3440
- failed: z39.literal(true).optional()
3462
+ prompt: z40.string().max(TOOL_TEXT_MAX).optional(),
3463
+ launchedId: z40.string().optional(),
3464
+ failed: z40.literal(true).optional()
3441
3465
  }).strict();
3442
- var PhoneChatRelaySchema = z39.object({
3443
- id: z39.string().min(1),
3444
- name: z39.string(),
3466
+ var PhoneChatRelaySchema = z40.object({
3467
+ id: z40.string().min(1),
3468
+ name: z40.string(),
3445
3469
  tool: ToolSchema,
3446
- text: z39.string().max(TOOL_TEXT_MAX),
3447
- status: z39.enum(["queued", "sent"]).optional(),
3448
- sentAt: z39.string().datetime().optional(),
3449
- failed: z39.literal(true).optional(),
3470
+ text: z40.string().max(TOOL_TEXT_MAX),
3471
+ status: z40.enum(["queued", "sent"]).optional(),
3472
+ sentAt: z40.string().datetime().optional(),
3473
+ failed: z40.literal(true).optional(),
3450
3474
  /** With `failed`: why, as the PC's code (never its text). */
3451
- code: z39.string().max(40).optional()
3475
+ code: z40.string().max(40).optional()
3452
3476
  }).strict();
3453
- var CloseHowSchema = z39.enum(["exit", "killed"]);
3454
- var PhoneChatCloseSchema = z39.object({
3455
- id: z39.string().min(1),
3456
- name: z39.string(),
3477
+ var CloseHowSchema = z40.enum(["exit", "killed"]);
3478
+ var PhoneChatCloseSchema = z40.object({
3479
+ id: z40.string().min(1),
3480
+ name: z40.string(),
3457
3481
  tool: ToolSchema,
3458
3482
  how: CloseHowSchema.optional(),
3459
- closedAt: z39.string().datetime().optional(),
3460
- failed: z39.literal(true).optional()
3483
+ closedAt: z40.string().datetime().optional(),
3484
+ failed: z40.literal(true).optional()
3461
3485
  }).strict();
3462
- var PhoneChatTaskSchema = z39.object({
3463
- to: z39.string().max(80),
3464
- toName: z39.string().max(80).optional(),
3465
- title: z39.string().max(200),
3466
- text: z39.string().max(TOOL_TEXT_MAX).optional(),
3467
- taskId: z39.string().max(40).optional(),
3468
- ownerName: z39.string().max(80).optional(),
3469
- state: z39.enum(["open", "taken", "done", "refused", "dropped"]).optional(),
3470
- failed: z39.literal(true).optional()
3486
+ var PhoneChatTaskSchema = z40.object({
3487
+ to: z40.string().max(80),
3488
+ toName: z40.string().max(80).optional(),
3489
+ title: z40.string().max(200),
3490
+ text: z40.string().max(TOOL_TEXT_MAX).optional(),
3491
+ taskId: z40.string().max(40).optional(),
3492
+ ownerName: z40.string().max(80).optional(),
3493
+ state: z40.enum(["open", "taken", "done", "refused", "dropped"]).optional(),
3494
+ failed: z40.literal(true).optional()
3471
3495
  }).strict();
3472
- var PhoneChatActionSchema = z39.object({
3473
- action: z39.string().min(1).max(40),
3474
- summary: z39.string().max(300),
3496
+ var PhoneChatActionSchema = z40.object({
3497
+ action: z40.string().min(1).max(40),
3498
+ summary: z40.string().max(300),
3475
3499
  vars: ActionVarsSchema.optional(),
3476
- detail: z39.string().max(TOOL_TEXT_MAX).optional(),
3477
- detailCut: z39.literal(true).optional(),
3500
+ detail: z40.string().max(TOOL_TEXT_MAX).optional(),
3501
+ detailCut: z40.literal(true).optional(),
3478
3502
  risk: ActionRiskSchema,
3479
- session: z39.string().max(100).optional(),
3503
+ session: z40.string().max(100).optional(),
3480
3504
  state: ChatActionStateSchema.optional(),
3481
- doneAt: z39.string().datetime().optional(),
3482
- code: z39.string().max(40).optional()
3505
+ doneAt: z40.string().datetime().optional(),
3506
+ code: z40.string().max(40).optional()
3483
3507
  }).strict();
3484
- var PhoneTaskSchema = z39.object({
3485
- id: z39.string().max(40),
3486
- title: z39.string().max(200),
3487
- owner: z39.string().max(100),
3488
- ownerName: z39.string().max(80),
3508
+ var PhoneTaskSchema = z40.object({
3509
+ id: z40.string().max(40),
3510
+ title: z40.string().max(200),
3511
+ owner: z40.string().max(100),
3512
+ ownerName: z40.string().max(80),
3489
3513
  /** 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). */
3490
- giver: z39.string().max(100).optional(),
3491
- giverName: z39.string().max(80).optional(),
3492
- text: z39.string().max(TOOL_TEXT_MAX).optional(),
3493
- state: z39.enum(["open", "taken", "done", "refused", "dropped"]),
3494
- result: z39.string().max(TOOL_TEXT_MAX).optional(),
3495
- cut: z39.literal(true).optional(),
3496
- at: z39.string(),
3497
- updatedAt: z39.string(),
3498
- seen: z39.literal(true).optional(),
3514
+ giver: z40.string().max(100).optional(),
3515
+ giverName: z40.string().max(80).optional(),
3516
+ text: z40.string().max(TOOL_TEXT_MAX).optional(),
3517
+ state: z40.enum(["open", "taken", "done", "refused", "dropped"]),
3518
+ result: z40.string().max(TOOL_TEXT_MAX).optional(),
3519
+ cut: z40.literal(true).optional(),
3520
+ at: z40.string(),
3521
+ updatedAt: z40.string(),
3522
+ seen: z40.literal(true).optional(),
3499
3523
  /** A proposal about the user's notes (brain spec §3.6): the phone answers it with its buttons (`brain.answer`). */
3500
3524
  brain: BrainProposalSchema.optional(),
3501
3525
  /** A routine's item (routines spec): an activation request the phone answers with `routine.cmd` (`approve` / `refuse`), or a failure (`run`). */
3502
3526
  routine: TaskRoutineSchema.optional()
3503
3527
  }).strict();
3504
- var PhoneRoutineRefSchema = z39.object({ routine: RoutineIdSchema, routineKey: RoutineKeySchema }).strict();
3528
+ var PhoneRoutineRefSchema = z40.object({ routine: RoutineIdSchema, routineKey: RoutineKeySchema }).strict();
3505
3529
  var PhoneRoutineSchema = RoutineSchema.omit({ prompt: true, target: true, runs: true, proposal: true }).extend({
3506
- target: RoutineTargetSchema.extend({ cwd: z39.string().min(1).max(PHONE_ROUTINE_CWD_MAX) }),
3507
- cut: z39.literal(true).optional(),
3508
- proposed: z39.literal(true).optional(),
3530
+ target: RoutineTargetSchema.extend({ cwd: z40.string().min(1).max(PHONE_ROUTINE_CWD_MAX) }),
3531
+ cut: z40.literal(true).optional(),
3532
+ proposed: z40.literal(true).optional(),
3509
3533
  key: RoutineKeySchema
3510
3534
  });
3511
3535
  var PhoneRoutineDetailSchema = PhoneRoutineSchema.omit({ cut: true, proposed: true }).extend({
@@ -3514,108 +3538,108 @@ var PhoneRoutineDetailSchema = PhoneRoutineSchema.omit({ cut: true, proposed: tr
3514
3538
  proposal: RoutineSchema.shape.proposal,
3515
3539
  runs: RoutineSchema.shape.runs
3516
3540
  });
3517
- var ChatErrorCodeSchema = z39.enum(["busy", "timeout", "cancelled", "failed"]);
3518
- var ChatLimitsReadSchema = z39.object({ qid: OperationIdSchema, at: z39.string().datetime() }).strict();
3519
- var ChatConversationSummarySchema = z39.object({
3520
- id: z39.string().uuid(),
3521
- startedAt: z39.string().datetime(),
3522
- lastAt: z39.string().datetime(),
3523
- first: z39.string().max(200),
3524
- count: z39.number().int().min(1)
3541
+ var ChatErrorCodeSchema = z40.enum(["busy", "timeout", "cancelled", "failed"]);
3542
+ var ChatLimitsReadSchema = z40.object({ qid: OperationIdSchema, at: z40.string().datetime() }).strict();
3543
+ var ChatConversationSummarySchema = z40.object({
3544
+ id: z40.string().uuid(),
3545
+ startedAt: z40.string().datetime(),
3546
+ lastAt: z40.string().datetime(),
3547
+ first: z40.string().max(200),
3548
+ count: z40.number().int().min(1)
3525
3549
  }).strict();
3526
- var PhoneChatTurnSchema = z39.object({
3550
+ var PhoneChatTurnSchema = z40.object({
3527
3551
  qid: OperationIdSchema,
3528
- question: z39.string().max(MESSAGE_MAX),
3529
- askedAt: z39.string().datetime(),
3530
- steps: z39.array(PhoneChatStepSchema).max(50),
3531
- answer: z39.string().max(THREAD_TEXT_MAX).optional(),
3532
- answeredAt: z39.string().datetime().optional(),
3552
+ question: z40.string().max(MESSAGE_MAX),
3553
+ askedAt: z40.string().datetime(),
3554
+ steps: z40.array(PhoneChatStepSchema).max(50),
3555
+ answer: z40.string().max(THREAD_TEXT_MAX).optional(),
3556
+ answeredAt: z40.string().datetime().optional(),
3533
3557
  error: ChatErrorCodeSchema.optional(),
3534
- proposals: z39.array(PhoneChatProposalSchema).max(MAX_PROPOSALS).optional(),
3558
+ proposals: z40.array(PhoneChatProposalSchema).max(MAX_PROPOSALS).optional(),
3535
3559
  relay: PhoneChatRelaySchema.optional(),
3536
- closes: z39.array(PhoneChatCloseSchema).min(1).max(MAX_PROPOSALS).optional(),
3537
- cut: z39.literal(true).optional(),
3538
- tasks: z39.array(PhoneChatTaskSchema).min(1).max(MAX_PROPOSALS).optional(),
3539
- actions: z39.array(PhoneChatActionSchema).min(1).max(MAX_PROPOSALS).optional(),
3540
- ignoredAt: z39.string().datetime().optional(),
3541
- attachments: z39.array(AttachmentRefSchema).max(ATTACHMENTS_MAX).optional(),
3542
- by: z39.literal("ledge").optional(),
3560
+ closes: z40.array(PhoneChatCloseSchema).min(1).max(MAX_PROPOSALS).optional(),
3561
+ cut: z40.literal(true).optional(),
3562
+ tasks: z40.array(PhoneChatTaskSchema).min(1).max(MAX_PROPOSALS).optional(),
3563
+ actions: z40.array(PhoneChatActionSchema).min(1).max(MAX_PROPOSALS).optional(),
3564
+ ignoredAt: z40.string().datetime().optional(),
3565
+ attachments: z40.array(AttachmentRefSchema).max(ATTACHMENTS_MAX).optional(),
3566
+ by: z40.literal("ledge").optional(),
3543
3567
  point: ChatPointSchema.optional()
3544
3568
  }).strict();
3545
- var sessionId = z39.string().min(1).max(100);
3546
- var PhoneExpectSchema = PendingSchema.pick({ kind: true, text: true }).extend({ key: z39.string().min(1).max(64) });
3547
- 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");
3569
+ var sessionId = z40.string().min(1).max(100);
3570
+ var PhoneExpectSchema = PendingSchema.pick({ kind: true, text: true }).extend({ key: z40.string().min(1).max(64) });
3571
+ var CardRowsSchema = z40.array(z40.number().int().min(0).max(MAX_PROPOSALS - 1)).min(1).max(MAX_PROPOSALS).refine((r) => new Set(r).size === r.length, "a row twice");
3548
3572
  var pcOp = { op: OperationIdSchema, assertion: AssertionSchema.optional() };
3549
3573
  var PHONE_LAUNCH_FOLDERS_MAX = 20;
3550
- var PhoneLaunchSchema = z39.object({
3574
+ var PhoneLaunchSchema = z40.object({
3551
3575
  project: ProjectIdSchema,
3552
3576
  tool: ToolSchema,
3553
- folders: z39.array(FolderPathSchema).min(1).max(PHONE_LAUNCH_FOLDERS_MAX),
3554
- prompt: z39.string().trim().min(1).max(MESSAGE_MAX),
3577
+ folders: z40.array(FolderPathSchema).min(1).max(PHONE_LAUNCH_FOLDERS_MAX),
3578
+ prompt: z40.string().trim().min(1).max(MESSAGE_MAX),
3555
3579
  model: ModelIdSchema.optional(),
3556
3580
  effort: EffortSchema.optional(),
3557
3581
  approval: OmpApprovalSchema.optional(),
3558
3582
  /** Issue #15: the session's name (its address), cleaned as every name; taken: refused `name_taken`. Absent: the first free one. */
3559
- name: z39.string().max(200).optional()
3583
+ name: z40.string().max(200).optional()
3560
3584
  }).strict();
3561
- var PcActionSchema = z39.enum(["update", "restart"]);
3585
+ var PcActionSchema = z40.enum(["update", "restart"]);
3562
3586
  var PHONE_FOLDER_ENTRIES_MAX = 500;
3563
- var PhoneFolderErrorSchema = z39.enum(["not_found", "not_folder", "unreadable"]);
3564
- var PhoneFolderSchema = z39.object({
3587
+ var PhoneFolderErrorSchema = z40.enum(["not_found", "not_folder", "unreadable"]);
3588
+ var PhoneFolderSchema = z40.object({
3565
3589
  machine: MachineIdSchema,
3566
- label: z39.string().max(80).optional(),
3590
+ label: z40.string().max(80).optional(),
3567
3591
  path: FolderPathSchema,
3568
- exists: z39.boolean().optional(),
3569
- branch: z39.string().max(200).nullable().optional()
3592
+ exists: z40.boolean().optional(),
3593
+ branch: z40.string().max(200).nullable().optional()
3570
3594
  });
3571
3595
  var PHONE_RECENT_FOLDERS_MAX = 20;
3572
- var TerminalIdSchema = z39.string().regex(/^t_[A-Za-z0-9_-]{8,40}$/);
3596
+ var TerminalIdSchema = z40.string().regex(/^t_[A-Za-z0-9_-]{8,40}$/);
3573
3597
  var TERM_INPUT_MAX = 4096;
3574
3598
  var TERM_SCREEN_MAX = 65536;
3575
3599
  var TERM_OUTPUT_MAX = 32768;
3576
- var TermDimSchema = z39.number().int().min(1).max(1e4);
3577
- var TermReleaseWhySchema = z39.enum(["asked", "pc", "idle", "expired", "background", "link"]);
3578
- var TermExitWhySchema = z39.enum(["ended", "gone", "closed", "superseded", "failed"]);
3579
- var DevicePrefsSchema = z39.object({
3580
- notify: z39.object({
3600
+ var TermDimSchema = z40.number().int().min(1).max(1e4);
3601
+ var TermReleaseWhySchema = z40.enum(["asked", "pc", "idle", "expired", "background", "link"]);
3602
+ var TermExitWhySchema = z40.enum(["ended", "gone", "closed", "superseded", "failed"]);
3603
+ var DevicePrefsSchema = z40.object({
3604
+ notify: z40.object({
3581
3605
  /** « Le point de Ledge » (the key keeps its first name, « Agent terminé »): the operator's point. */
3582
- finished: z39.boolean(),
3606
+ finished: z40.boolean(),
3583
3607
  /** « Réponse de Ledge »: the end of a question asked from this device. */
3584
- chat: z39.boolean(),
3608
+ chat: z40.boolean(),
3585
3609
  /** « Décision à prendre »: a session puts a decision to the user. */
3586
- decision: z39.boolean()
3610
+ decision: z40.boolean()
3587
3611
  }),
3588
3612
  /** No notification before this moment (a `resolved` still replaces one already shown); null: no pause. */
3589
- quietUntil: z39.string().datetime().nullable(),
3613
+ quietUntil: z40.string().datetime().nullable(),
3590
3614
  /** The agent of this device's chat with Ledge; null: the PC's (the one its own chat last used). */
3591
3615
  chatTool: ToolSchema.nullable()
3592
3616
  });
3593
- var PhoneClientMessageSchema = z39.discriminatedUnion("type", [
3594
- z39.object({ type: z39.literal("snapshot.request") }),
3595
- z39.object({ type: z39.literal("session.thread"), id: sessionId }),
3617
+ var PhoneClientMessageSchema = z40.discriminatedUnion("type", [
3618
+ z40.object({ type: z40.literal("snapshot.request") }),
3619
+ z40.object({ type: z40.literal("session.thread"), id: sessionId }),
3596
3620
  /** The session's request with its whole body (up to `PENDING_BODY_MAX`). */
3597
- z39.object({ type: z39.literal("session.pending"), id: sessionId }),
3621
+ z40.object({ type: z40.literal("session.pending"), id: sessionId }),
3598
3622
  /** The session whose terminal the phone shows; null when it shows none. */
3599
- z39.object({ type: z39.literal("session.watch"), id: sessionId.nullable() }),
3600
- z39.object({ type: z39.literal("session.read"), id: sessionId, at: z39.string().datetime() }),
3623
+ z40.object({ type: z40.literal("session.watch"), id: sessionId.nullable() }),
3624
+ z40.object({ type: z40.literal("session.read"), id: sessionId, at: z40.string().datetime() }),
3601
3625
  /**
3602
3626
  * Asks for a challenge. One object for every purpose: the gateway refuses a `decide` without `id` and `expect`. A `close`
3603
3627
  * or `act` names a turn of the chat (`qid`) or a session (`id`, for `session.close` and `session.resume`).
3604
3628
  */
3605
- z39.object({
3606
- type: z39.literal("confirm.prepare"),
3629
+ z40.object({
3630
+ type: z40.literal("confirm.prepare"),
3607
3631
  purpose: ConfirmPurposeSchema,
3608
3632
  id: sessionId.optional(),
3609
3633
  expect: PhoneExpectSchema.optional(),
3610
3634
  qid: OperationIdSchema.optional(),
3611
3635
  /** A `pc` challenge: what it is for, and for an update the version it covers. */
3612
3636
  action: PcActionSchema.optional(),
3613
- version: z39.string().regex(SEMVER).optional(),
3637
+ version: z40.string().regex(SEMVER).optional(),
3614
3638
  /** A `rig` challenge: the OpenRig row and the exact answer it covers. */
3615
- qitem: z39.string().min(1).max(200).optional(),
3639
+ qitem: z40.string().min(1).max(200).optional(),
3616
3640
  answer: HumanAnswerSchema.optional(),
3617
3641
  /** A `note` challenge: the proposal (a task) and the exact choice it covers. */
3618
- task: z39.string().min(1).max(40).optional(),
3642
+ task: z40.string().min(1).max(40).optional(),
3619
3643
  choice: BrainChoiceSchema.optional(),
3620
3644
  /** A `project` challenge: the project deleted and where its agents go (null: no project). */
3621
3645
  project: ProjectIdSchema.optional(),
@@ -3626,76 +3650,76 @@ var PhoneClientMessageSchema = z39.discriminatedUnion("type", [
3626
3650
  newProject: ProjectNameSchema.optional(),
3627
3651
  /** A `rigs` challenge: the action (`rigAct`) or the change of seats (`rigSeats`) it covers, exactly as it will be sent. */
3628
3652
  rigAct: OpenRigActionSchema.optional(),
3629
- rigSeats: z39.object({ rig: RigNameSchema, seats: RigSeatCountsSchema }).strict().optional(),
3653
+ rigSeats: z40.object({ rig: RigNameSchema, seats: RigSeatCountsSchema }).strict().optional(),
3630
3654
  /** An `act` challenge for a point row (`qid` and `item`): bound to that row and to its `pointAnswer`, or to its suggestion when `suggest`. */
3631
- item: z39.string().min(1).max(200).optional(),
3655
+ item: z40.string().min(1).max(200).optional(),
3632
3656
  pointAnswer: PointAnswerSchema.optional(),
3633
- suggest: z39.literal(true).optional(),
3657
+ suggest: z40.literal(true).optional(),
3634
3658
  /** A `launch` challenge without `qid`: the « Nouvelle session » it covers, exactly as it will be sent. */
3635
3659
  launch: PhoneLaunchSchema.optional(),
3636
3660
  /** A `forge` challenge: the request and the action it covers, exactly as they will be sent. */
3637
- forge: z39.object({ prId: z39.string().min(1).max(500), action: ForgeActionSchema }).strict().optional(),
3661
+ forge: z40.object({ prId: z40.string().min(1).max(500), action: ForgeActionSchema }).strict().optional(),
3638
3662
  /** A `routine` challenge: the pending routine its « Activer » covers, and its key as the phone showed it; `routineOthers`, the
3639
3663
  * other routines of a grouped request « Activer les N » covers with the same check. */
3640
3664
  routine: RoutineIdSchema.optional(),
3641
3665
  routineKey: RoutineKeySchema.optional(),
3642
- routineOthers: z39.array(PhoneRoutineRefSchema).max(ROUTINES_ACTIVE_MAX - 1).optional()
3666
+ routineOthers: z40.array(PhoneRoutineRefSchema).max(ROUTINES_ACTIVE_MAX - 1).optional()
3643
3667
  }),
3644
3668
  /** `userId`: the passkey's `user.id` as the phone made it (« L1 » ‖ the PC key's digest ‖ random, docs/mobile-passkey-recover-contract.md);
3645
3669
  * given and made for this PC, the passkey can bring the device back after a reinstall (the snapshot's `device.recover`). */
3646
- z39.object({ type: z39.literal("credential.register"), op: OperationIdSchema, credential: CredentialSchema, userId: B64U3.max(128).optional() }),
3647
- z39.object({
3648
- type: z39.literal("session.decide"),
3670
+ z40.object({ type: z40.literal("credential.register"), op: OperationIdSchema, credential: CredentialSchema, userId: B64U3.max(128).optional() }),
3671
+ z40.object({
3672
+ type: z40.literal("session.decide"),
3649
3673
  op: OperationIdSchema,
3650
3674
  id: sessionId,
3651
3675
  decision: DecisionSchema,
3652
- note: z39.string().trim().min(1).max(NOTE_MAX).optional(),
3676
+ note: z40.string().trim().min(1).max(NOTE_MAX).optional(),
3653
3677
  /** The request the phone showed: refused unless it is still the pending one. */
3654
3678
  expect: PhoneExpectSchema,
3655
3679
  /** The device check over the challenge of `confirm.prepare`; required by the daemon for a high-risk accept. */
3656
3680
  assertion: AssertionSchema.optional()
3657
3681
  }),
3658
- z39.object({
3659
- type: z39.literal("session.reply"),
3682
+ z40.object({
3683
+ type: z40.literal("session.reply"),
3660
3684
  op: OperationIdSchema,
3661
3685
  id: sessionId,
3662
- text: z39.string().max(MESSAGE_MAX),
3663
- attachments: z39.array(AttachmentIdSchema).max(ATTACHMENTS_MAX).optional(),
3686
+ text: z40.string().max(MESSAGE_MAX),
3687
+ attachments: z40.array(AttachmentIdSchema).max(ATTACHMENTS_MAX).optional(),
3664
3688
  /** The request the reply answers, or null when the phone showed none: refused if the session's request is no longer that one. */
3665
3689
  expect: PhoneExpectSchema.nullable(),
3666
3690
  assertion: AssertionSchema.optional()
3667
3691
  }),
3668
3692
  /** OMP's `ask`: the answers to every question of the dialog `requestId`, in order; `cancel` declines it. Bounds as the local `session.answer`. */
3669
- z39.object({
3670
- type: z39.literal("session.answer"),
3693
+ z40.object({
3694
+ type: z40.literal("session.answer"),
3671
3695
  op: OperationIdSchema,
3672
3696
  id: sessionId,
3673
- requestId: z39.string().min(1).max(200),
3674
- 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),
3675
- cancel: z39.literal(true).optional(),
3697
+ requestId: z40.string().min(1).max(200),
3698
+ answers: z40.array(z40.object({ id: z40.string().max(200), selected: z40.array(z40.string().max(2e3)).max(100), text: z40.string().max(2e4).optional() })).max(50),
3699
+ cancel: z40.literal(true).optional(),
3676
3700
  expect: PhoneExpectSchema
3677
3701
  }),
3678
- z39.object({ type: z39.literal("session.interrupt"), op: OperationIdSchema, id: sessionId }),
3702
+ z40.object({ type: z40.literal("session.interrupt"), op: OperationIdSchema, id: sessionId }),
3679
3703
  /** Ends a live session as `/exit` would, killed as a last resort; answered with its `how`. Passkey, purpose `close`, over the session. */
3680
- z39.object({ type: z39.literal("session.close"), op: OperationIdSchema, id: sessionId, assertion: AssertionSchema.optional() }),
3704
+ z40.object({ type: z40.literal("session.close"), op: OperationIdSchema, id: sessionId, assertion: AssertionSchema.optional() }),
3681
3705
  /** Starts an ended session again on its conversation. Passkey, purpose `act`, over the session. */
3682
- z39.object({ type: z39.literal("session.resume"), op: OperationIdSchema, id: sessionId, assertion: AssertionSchema.optional() }),
3706
+ z40.object({ type: z40.literal("session.resume"), op: OperationIdSchema, id: sessionId, assertion: AssertionSchema.optional() }),
3683
3707
  /** 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`. */
3684
- z39.object({ type: z39.literal("session.model"), op: OperationIdSchema, id: sessionId, model: ModelIdSchema.nullable(), effort: EffortSchema.nullable() }),
3708
+ z40.object({ type: z40.literal("session.model"), op: OperationIdSchema, id: sessionId, model: ModelIdSchema.nullable(), effort: EffortSchema.nullable() }),
3685
3709
  /** One message to several sessions (ids); answered by `operation.result` with `sent` and `refused`. */
3686
- 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(),
3710
+ z40.object({ type: z40.literal("session.broadcast"), op: OperationIdSchema, sessions: z40.array(sessionId).min(1).max(BROADCAST_SESSIONS_MAX), text: z40.string().trim().min(1).max(MESSAGE_MAX) }).strict(),
3687
3711
  /** The models an agent offers on the PC. */
3688
- z39.object({ type: z39.literal("models.list"), tool: ToolSchema }),
3712
+ z40.object({ type: z40.literal("models.list"), tool: ToolSchema }),
3689
3713
  /** The slash commands of a session's agent, for the « / » list of its field. */
3690
- z39.object({ type: z39.literal("session.commands"), id: sessionId }),
3714
+ z40.object({ type: z40.literal("session.commands"), id: sessionId }),
3691
3715
  /** A queue row's state, for an OpenRig task card: asked while the card shows and every `RIG_ROW_REFRESH_MS` (`daemon.rigRows`). */
3692
- z39.object({ type: z39.literal("openrig.row"), qitem: QitemIdSchema }),
3716
+ z40.object({ type: z40.literal("openrig.row"), qitem: QitemIdSchema }),
3693
3717
  /** The phone drops its passkey from the daemon. */
3694
- z39.object({ type: z39.literal("device.forget"), op: OperationIdSchema }),
3718
+ z40.object({ type: z40.literal("device.forget"), op: OperationIdSchema }),
3695
3719
  /** The device names itself (on the PC and in its next snapshot); applied to the sender only. */
3696
- z39.object({ type: z39.literal("device.rename"), op: OperationIdSchema, name: DeviceNameSchema }),
3720
+ z40.object({ type: z40.literal("device.rename"), op: OperationIdSchema, name: DeviceNameSchema }),
3697
3721
  /** The device's own settings, whole (`daemon.settings`): applied to the sender only, told back in its next snapshot. */
3698
- z39.object({ type: z39.literal("device.prefs"), op: OperationIdSchema, prefs: z39.object({
3722
+ z40.object({ type: z40.literal("device.prefs"), op: OperationIdSchema, prefs: z40.object({
3699
3723
  notify: DevicePrefsSchema.shape.notify.strict(),
3700
3724
  quietUntil: DevicePrefsSchema.shape.quietUntil,
3701
3725
  chatTool: DevicePrefsSchema.shape.chatTool
@@ -3705,447 +3729,447 @@ var PhoneClientMessageSchema = z39.discriminatedUnion("type", [
3705
3729
  * 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
3706
3730
  * new project. A deletion carries the device's check over the project and `moveTo` (purpose `project`).
3707
3731
  */
3708
- z39.object({ type: z39.literal("project.edit"), op: OperationIdSchema, id: ProjectIdSchema, name: ProjectNameSchema.optional(), color: ProjectColorSchema.optional() }).strict(),
3709
- z39.object({ type: z39.literal("project.order"), op: OperationIdSchema, ids: z39.array(ProjectIdSchema).min(1).max(PHONE_PROJECTS_MAX) }).strict(),
3732
+ z40.object({ type: z40.literal("project.edit"), op: OperationIdSchema, id: ProjectIdSchema, name: ProjectNameSchema.optional(), color: ProjectColorSchema.optional() }).strict(),
3733
+ z40.object({ type: z40.literal("project.order"), op: OperationIdSchema, ids: z40.array(ProjectIdSchema).min(1).max(PHONE_PROJECTS_MAX) }).strict(),
3710
3734
  /** Issue #16: some of a project's sessions (`project` null: « Sans projet ») in a new order, this PC's ids; the others keep their
3711
3735
  * places (placeSessions). A session not in that project, or one gone, makes it stale. */
3712
- 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(),
3736
+ z40.object({ type: z40.literal("session.order"), op: OperationIdSchema, project: ProjectIdSchema.nullable(), ids: z40.array(z40.string().min(1).max(200)).min(1).max(SESSION_ORDER_MAX) }).strict(),
3713
3737
  /** Issue #2: with its first folder (`path`, of this PC) and the device's check over that name and folder (`newProjectSubject`). A
3714
3738
  * create without it, from an older phone, is refused `folder_required`. */
3715
- z39.object({
3716
- type: z39.literal("project.create"),
3739
+ z40.object({
3740
+ type: z40.literal("project.create"),
3717
3741
  op: OperationIdSchema,
3718
3742
  name: ProjectNameSchema,
3719
3743
  color: ProjectColorSchema,
3720
3744
  path: FolderPathSchema.optional(),
3721
3745
  assertion: AssertionSchema.optional()
3722
3746
  }).strict(),
3723
- z39.object({ type: z39.literal("project.delete"), op: OperationIdSchema, id: ProjectIdSchema, moveTo: ProjectIdSchema.nullable(), assertion: AssertionSchema.optional() }).strict(),
3747
+ z40.object({ type: z40.literal("project.delete"), op: OperationIdSchema, id: ProjectIdSchema, moveTo: ProjectIdSchema.nullable(), assertion: AssertionSchema.optional() }).strict(),
3724
3748
  /**
3725
3749
  * A project's folders (`daemon.projectFolders`): browsing this PC's folders, its recent ones, a project's folders, then adding one
3726
3750
  * of this PC (with the device's check, purpose `folder`) or removing one. Reads are answered to the asker alone.
3727
3751
  */
3728
- z39.object({ type: z39.literal("folder.list"), path: FolderPathSchema.optional() }).strict(),
3729
- z39.object({ type: z39.literal("folder.recents") }).strict(),
3730
- z39.object({ type: z39.literal("project.folders"), id: ProjectIdSchema }).strict(),
3731
- z39.object({ type: z39.literal("project.folder.add"), op: OperationIdSchema, id: ProjectIdSchema, path: FolderPathSchema, assertion: AssertionSchema.optional() }).strict(),
3732
- z39.object({ type: z39.literal("project.folder.remove"), op: OperationIdSchema, id: ProjectIdSchema, machine: MachineIdSchema, path: FolderPathSchema }).strict(),
3752
+ z40.object({ type: z40.literal("folder.list"), path: FolderPathSchema.optional() }).strict(),
3753
+ z40.object({ type: z40.literal("folder.recents") }).strict(),
3754
+ z40.object({ type: z40.literal("project.folders"), id: ProjectIdSchema }).strict(),
3755
+ z40.object({ type: z40.literal("project.folder.add"), op: OperationIdSchema, id: ProjectIdSchema, path: FolderPathSchema, assertion: AssertionSchema.optional() }).strict(),
3756
+ z40.object({ type: z40.literal("project.folder.remove"), op: OperationIdSchema, id: ProjectIdSchema, machine: MachineIdSchema, path: FolderPathSchema }).strict(),
3733
3757
  /** « Contexte max », the PC's threshold shared by every front (`daemon.settings`): as the desktop's `context.set`. */
3734
- z39.object({ type: z39.literal("context.set"), op: OperationIdSchema, near: ContextPrefsSchema.shape.near }).strict(),
3758
+ z40.object({ type: z40.literal("context.set"), op: OperationIdSchema, near: ContextPrefsSchema.shape.near }).strict(),
3735
3759
  /** The phone's push subscription, with the VAPID key it was made with (so a key change is seen). `resolved`: its service
3736
3760
  * worker shows a `resolved` push, which replaces a request's notification once it is answered elsewhere. */
3737
- z39.object({ type: z39.literal("push.subscribe"), op: OperationIdSchema, subscription: PushSubscriptionSchema, key: B64U3.length(87), resolved: z39.literal(true).optional() }),
3738
- z39.object({ type: z39.literal("push.unsubscribe"), op: OperationIdSchema }),
3761
+ z40.object({ type: z40.literal("push.subscribe"), op: OperationIdSchema, subscription: PushSubscriptionSchema, key: B64U3.length(87), resolved: z40.literal(true).optional() }),
3762
+ z40.object({ type: z40.literal("push.unsubscribe"), op: OperationIdSchema }),
3739
3763
  /** The phone's own chat with Ledge. */
3740
- z39.object({ type: z39.literal("chat.ask"), qid: OperationIdSchema, text: z39.string().trim().max(MESSAGE_MAX), attachments: z39.array(AttachmentIdSchema).max(ATTACHMENTS_MAX).optional() }),
3741
- z39.object({ type: z39.literal("chat.cancel"), qid: OperationIdSchema }),
3742
- z39.object({ type: z39.literal("chat.reset") }),
3743
- z39.object({ type: z39.literal("chat.history") }),
3764
+ z40.object({ type: z40.literal("chat.ask"), qid: OperationIdSchema, text: z40.string().trim().max(MESSAGE_MAX), attachments: z40.array(AttachmentIdSchema).max(ATTACHMENTS_MAX).optional() }),
3765
+ z40.object({ type: z40.literal("chat.cancel"), qid: OperationIdSchema }),
3766
+ z40.object({ type: z40.literal("chat.reset") }),
3767
+ z40.object({ type: z40.literal("chat.history") }),
3744
3768
  /** The device's conversations, and one of them (`daemon.conversations`): answered to the asker alone. */
3745
- z39.object({ type: z39.literal("chat.conversations") }).strict(),
3746
- z39.object({ type: z39.literal("chat.conversation"), id: z39.string().uuid() }).strict(),
3769
+ z40.object({ type: z40.literal("chat.conversations") }).strict(),
3770
+ z40.object({ type: z40.literal("chat.conversation"), id: z40.string().uuid() }).strict(),
3747
3771
  /** An image to store, sent alone before the message that names it; no `id`, and at most `ATTACHMENT_MAX` bytes. */
3748
- AttachmentPutSchema.pick({ type: true, requestId: true }).extend({ image: ImageUploadSchema.extend({ data: z39.string().min(1).max(b64Max(ATTACHMENT_MAX)) }) }),
3772
+ AttachmentPutSchema.pick({ type: true, requestId: true }).extend({ image: ImageUploadSchema.extend({ data: z40.string().min(1).max(b64Max(ATTACHMENT_MAX)) }) }),
3749
3773
  AttachmentGetSchema.pick({ type: true, requestId: true, attachment: true, preview: true }),
3750
- z39.object({ type: z39.literal("chat.relay"), op: OperationIdSchema, qid: OperationIdSchema }),
3774
+ z40.object({ type: z40.literal("chat.relay"), op: OperationIdSchema, qid: OperationIdSchema }),
3751
3775
  /** Takes the card's queued instruction back out of the queue, as the local `session.relay.cancel`. */
3752
- z39.object({ type: z39.literal("chat.relay.cancel"), op: OperationIdSchema, qid: OperationIdSchema }),
3753
- z39.object({ type: z39.literal("chat.launch"), op: OperationIdSchema, qid: OperationIdSchema, rows: CardRowsSchema.optional(), assertion: AssertionSchema.optional() }),
3776
+ z40.object({ type: z40.literal("chat.relay.cancel"), op: OperationIdSchema, qid: OperationIdSchema }),
3777
+ z40.object({ type: z40.literal("chat.launch"), op: OperationIdSchema, qid: OperationIdSchema, rows: CardRowsSchema.optional(), assertion: AssertionSchema.optional() }),
3754
3778
  /** « Nouvelle session » (M2 §9): passkey, purpose `launch`, over this very launch. Applied, its result names the new session (`id`). */
3755
- z39.object({ type: z39.literal("session.launch"), op: OperationIdSchema, launch: PhoneLaunchSchema, assertion: AssertionSchema.optional() }).strict(),
3756
- z39.object({ type: z39.literal("chat.close"), op: OperationIdSchema, qid: OperationIdSchema, rows: CardRowsSchema.optional(), assertion: AssertionSchema.optional() }),
3779
+ z40.object({ type: z40.literal("session.launch"), op: OperationIdSchema, launch: PhoneLaunchSchema, assertion: AssertionSchema.optional() }).strict(),
3780
+ z40.object({ type: z40.literal("chat.close"), op: OperationIdSchema, qid: OperationIdSchema, rows: CardRowsSchema.optional(), assertion: AssertionSchema.optional() }),
3757
3781
  /** A row of the turn's task card: given by Ledge. */
3758
- z39.object({ type: z39.literal("chat.task"), op: OperationIdSchema, qid: OperationIdSchema, row: z39.number().int().min(0).max(MAX_PROPOSALS - 1) }),
3782
+ z40.object({ type: z40.literal("chat.task"), op: OperationIdSchema, qid: OperationIdSchema, row: z40.number().int().min(0).max(MAX_PROPOSALS - 1) }),
3759
3783
  /** Rows of the turn's generic card (action registry spec §5): `confirmed` as the local `chat.act`; a row whose action asks
3760
3784
  * for a device check (`phone`) needs one assertion, purpose `act`, over the turn. */
3761
- z39.object({
3762
- type: z39.literal("chat.act"),
3785
+ z40.object({
3786
+ type: z40.literal("chat.act"),
3763
3787
  op: OperationIdSchema,
3764
3788
  qid: OperationIdSchema,
3765
3789
  rows: CardRowsSchema.optional(),
3766
- confirmed: z39.literal(true).optional(),
3790
+ confirmed: z40.literal(true).optional(),
3767
3791
  assertion: AssertionSchema.optional(),
3768
3792
  /** « Refuser », as the local `chat.act`: no passkey, no confirmation. */
3769
- deny: z39.literal(true).optional()
3793
+ deny: z40.literal(true).optional()
3770
3794
  }),
3771
3795
  /** « Ignorer » the turn's cards, or `undo` (« Revoir »), as the local `chat.ignore`. */
3772
- z39.object({ type: z39.literal("chat.ignore"), op: OperationIdSchema, qid: OperationIdSchema, undo: z39.literal(true).optional() }),
3796
+ z40.object({ type: z40.literal("chat.ignore"), op: OperationIdSchema, qid: OperationIdSchema, undo: z40.literal(true).optional() }),
3773
3797
  /** The operator's point: `point.act` answers a row, `point.later` sets the point aside, `operator.read` marks events read for this device. */
3774
- z39.object({
3775
- type: z39.literal("point.act"),
3798
+ z40.object({
3799
+ type: z40.literal("point.act"),
3776
3800
  op: OperationIdSchema,
3777
3801
  qid: OperationIdSchema,
3778
- item: z39.string().min(1).max(200),
3802
+ item: z40.string().min(1).max(200),
3779
3803
  answer: PointAnswerSchema.optional(),
3780
3804
  /** Applies the row's suggestion instead of answering it (exactly one of `answer` and `suggest`). */
3781
- suggest: z39.literal(true).optional(),
3805
+ suggest: z40.literal(true).optional(),
3782
3806
  /** A destructive answer says it was confirmed on the phone; the device check (`assertion`) is bound to this item and this answer. */
3783
- confirmed: z39.literal(true).optional(),
3807
+ confirmed: z40.literal(true).optional(),
3784
3808
  assertion: AssertionSchema.optional()
3785
3809
  }),
3786
- z39.object({ type: z39.literal("point.later"), op: OperationIdSchema, qid: OperationIdSchema }),
3787
- z39.object({ type: z39.literal("operator.read"), op: OperationIdSchema, eventId: z39.number().int().min(0) }),
3810
+ z40.object({ type: z40.literal("point.later"), op: OperationIdSchema, qid: OperationIdSchema }),
3811
+ z40.object({ type: z40.literal("operator.read"), op: OperationIdSchema, eventId: z40.number().int().min(0) }),
3788
3812
  /** 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
3789
3813
  * task and that exact choice; a `no` needs none. */
3790
- z39.object({ type: z39.literal("brain.answer"), op: OperationIdSchema, task: z39.string().min(1).max(40), choice: BrainChoiceSchema, assertion: AssertionSchema.optional() }),
3814
+ z40.object({ type: z40.literal("brain.answer"), op: OperationIdSchema, task: z40.string().min(1).max(40), choice: BrainChoiceSchema, assertion: AssertionSchema.optional() }),
3791
3815
  /** Puts a closed task Ledge gave away from « À traiter ». */
3792
- z39.object({ type: z39.literal("task.seen"), op: OperationIdSchema, task: z39.string().min(1).max(40) }),
3816
+ z40.object({ type: z40.literal("task.seen"), op: OperationIdSchema, task: z40.string().min(1).max(40) }),
3793
3817
  /** The routines (routines spec §3.7): answered by `routines`, then each change comes as `routine.changed`. */
3794
- z39.object({ type: z39.literal("routine.list") }).strict(),
3818
+ z40.object({ type: z40.literal("routine.list") }).strict(),
3795
3819
  /** One routine whole, its prompt included: answered by `routine.detail`. The phone shows it before « Activer ». */
3796
- z39.object({ type: z39.literal("routine.show"), routine: RoutineIdSchema }).strict(),
3820
+ z40.object({ type: z40.literal("routine.show"), routine: RoutineIdSchema }).strict(),
3797
3821
  /** « Lancer maintenant », « Pause » / « Reprendre », and « Activer » / « Refuser » from « À toi »; answered by `operation.result`.
3798
3822
  * An `approve` names the key of the routine the phone showed (`routineKey`, refused as `stale` once it changed) and carries an
3799
3823
  * assertion of purpose `routine` bound to that routine and that key. */
3800
- z39.object({
3801
- type: z39.literal("routine.cmd"),
3824
+ z40.object({
3825
+ type: z40.literal("routine.cmd"),
3802
3826
  op: OperationIdSchema,
3803
3827
  action: PhoneRoutineActionSchema,
3804
3828
  routine: RoutineIdSchema,
3805
3829
  routineKey: RoutineKeySchema.optional(),
3806
3830
  /** « Activer les N » / « Refuser les N » of a grouped request: the other routines, each with the key the phone showed; an approve's
3807
3831
  * one assertion covers them all. */
3808
- others: z39.array(PhoneRoutineRefSchema).max(ROUTINES_ACTIVE_MAX - 1).optional(),
3832
+ others: z40.array(PhoneRoutineRefSchema).max(ROUTINES_ACTIVE_MAX - 1).optional(),
3809
3833
  assertion: AssertionSchema.optional()
3810
3834
  }).strict(),
3811
3835
  /** Streams a session's pane, read-only; answered by `term.opened` or `operation.result` (rejected). `helper`: one of the
3812
3836
  * session's subagents (`helpers[].id`), whose terminal is its parent's, read-only for good (`term.opened.readOnly`). */
3813
- z39.object({ type: z39.literal("term.open"), op: OperationIdSchema, id: sessionId, helper: z39.string().min(1).max(200).optional() }),
3837
+ z40.object({ type: z40.literal("term.open"), op: OperationIdSchema, id: sessionId, helper: z40.string().min(1).max(200).optional() }),
3814
3838
  /** « Prendre la main »: passkey, purpose `terminal`, over the session; answered by `term.held` or `operation.result` (rejected). */
3815
- z39.object({ type: z39.literal("term.hold"), op: OperationIdSchema, tid: TerminalIdSchema, assertion: AssertionSchema.optional() }),
3839
+ z40.object({ type: z40.literal("term.hold"), op: OperationIdSchema, tid: TerminalIdSchema, assertion: AssertionSchema.optional() }),
3816
3840
  /** 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. */
3817
- z39.object({ type: z39.literal("term.input"), tid: TerminalIdSchema, n: z39.number().int().nonnegative(), data: z39.string().min(1).max(TERM_INPUT_MAX) }),
3841
+ z40.object({ type: z40.literal("term.input"), tid: TerminalIdSchema, n: z40.number().int().nonnegative(), data: z40.string().min(1).max(TERM_INPUT_MAX) }),
3818
3842
  /** « Rendre la main »: back to read-only. */
3819
- z39.object({ type: z39.literal("term.release"), tid: TerminalIdSchema }),
3843
+ z40.object({ type: z40.literal("term.release"), tid: TerminalIdSchema }),
3820
3844
  /** The phone saw a gap in `seq`: a fresh `term.opened`, please. */
3821
- z39.object({ type: z39.literal("term.resync"), tid: TerminalIdSchema }),
3822
- z39.object({ type: z39.literal("term.close"), tid: TerminalIdSchema }),
3845
+ z40.object({ type: z40.literal("term.resync"), tid: TerminalIdSchema }),
3846
+ z40.object({ type: z40.literal("term.close"), tid: TerminalIdSchema }),
3823
3847
  /** Whether the phone's app is in front: a device that is visible gets no push. */
3824
- z39.object({ type: z39.literal("presence"), visible: z39.boolean() }),
3848
+ z40.object({ type: z40.literal("presence"), visible: z40.boolean() }),
3825
3849
  /** « À toi » (lot 3): what OpenRig on this PC asks the person, then pushed whole when it changes (`openrig.asks`). */
3826
- z39.object({ type: z39.literal("openrig.asks") }),
3850
+ z40.object({ type: z40.literal("openrig.asks") }),
3827
3851
  /** 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
3828
3852
  * answer; « Vu » (`seen`) needs none. */
3829
- z39.object({ type: z39.literal("openrig.answer"), op: OperationIdSchema, qitemId: z39.string().min(1).max(200), answer: HumanAnswerSchema, assertion: AssertionSchema.optional() }),
3853
+ z40.object({ type: z40.literal("openrig.answer"), op: OperationIdSchema, qitemId: z40.string().min(1).max(200), answer: HumanAnswerSchema, assertion: AssertionSchema.optional() }),
3830
3854
  /** Installs `version` on the PC, then restarts its daemon; the phone asks for its own build's version. Passkey, purpose `pc`. */
3831
- z39.object({ type: z39.literal("daemon.update"), ...pcOp, version: z39.string().regex(SEMVER) }).strict(),
3855
+ z40.object({ type: z40.literal("daemon.update"), ...pcOp, version: z40.string().regex(SEMVER) }).strict(),
3832
3856
  /** Restarts the PC's daemon without installing anything. Passkey, purpose `pc`. */
3833
- z39.object({ type: z39.literal("daemon.restart"), ...pcOp }).strict(),
3857
+ z40.object({ type: z40.literal("daemon.restart"), ...pcOp }).strict(),
3834
3858
  // ── Rigs and the kernel (`daemon.rigs`, docs/mobile-openrig-contract.md) ──
3835
3859
  /** OpenRig on this PC, answered by `rigs.state`, then each change, whole, while the phone follows. */
3836
- z39.object({ type: z39.literal("rigs.state") }).strict(),
3837
- z39.object({ type: z39.literal("rigs.graph"), rig: RigNameSchema }).strict(),
3860
+ z40.object({ type: z40.literal("rigs.state") }).strict(),
3861
+ z40.object({ type: z40.literal("rigs.graph"), rig: RigNameSchema }).strict(),
3838
3862
  /** A rig's open rows and its recently closed ones. */
3839
- z39.object({ type: z39.literal("rigs.queue"), rig: RigNameSchema }).strict(),
3863
+ z40.object({ type: z40.literal("rigs.queue"), rig: RigNameSchema }).strict(),
3840
3864
  /** The queue's routing on this PC: the latest claims, handoffs, blocks and closes, every rig. */
3841
- z39.object({ type: z39.literal("rigs.routing") }).strict(),
3842
- z39.object({ type: z39.literal("rigs.permissions"), rig: RigNameSchema }).strict(),
3843
- z39.object({ type: z39.literal("rigs.snapshots"), rig: RigNameSchema }).strict(),
3865
+ z40.object({ type: z40.literal("rigs.routing") }).strict(),
3866
+ z40.object({ type: z40.literal("rigs.permissions"), rig: RigNameSchema }).strict(),
3867
+ z40.object({ type: z40.literal("rigs.snapshots"), rig: RigNameSchema }).strict(),
3844
3868
  /** The goals given to the operator, answered by `rigs.goals`, then each change, whole, while the phone follows. */
3845
- z39.object({ type: z39.literal("rigs.goals") }).strict(),
3869
+ z40.object({ type: z40.literal("rigs.goals") }).strict(),
3846
3870
  /** An action on OpenRig, every kind the Desktop's `openrig.act` takes. One that `rigActNeedsCheck` names carries a passkey, purpose `rigs`. */
3847
- z39.object({ type: z39.literal("rigs.act"), op: OperationIdSchema, action: OpenRigActionSchema, assertion: AssertionSchema.optional() }).strict(),
3871
+ z40.object({ type: z40.literal("rigs.act"), op: OperationIdSchema, action: OpenRigActionSchema, assertion: AssertionSchema.optional() }).strict(),
3848
3872
  // ── Pull and merge requests (`daemon.forge`, docs/mobile-forge-contract.md) ──
3849
3873
  /** The requests of this PC's sessions and seats; subscribes the device to each change. */
3850
- z39.object({ type: z39.literal("forge.state") }).strict(),
3874
+ z40.object({ type: z40.literal("forge.state") }).strict(),
3851
3875
  /** A request's detail; `log`: also that job's last lines. */
3852
- z39.object({ type: z39.literal("forge.detail"), prId: z39.string().min(1).max(500), log: z39.string().min(1).max(40).optional() }).strict(),
3876
+ z40.object({ type: z40.literal("forge.detail"), prId: z40.string().min(1).max(500), log: z40.string().min(1).max(40).optional() }).strict(),
3853
3877
  /** 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`). */
3854
- z39.object({ type: z39.literal("forge.act"), op: OperationIdSchema, prId: z39.string().min(1).max(500), action: ForgeActionSchema, assertion: AssertionSchema.optional() }).strict(),
3878
+ z40.object({ type: z40.literal("forge.act"), op: OperationIdSchema, prId: z40.string().min(1).max(500), action: ForgeActionSchema, assertion: AssertionSchema.optional() }).strict(),
3855
3879
  /** A running rig's seats per role (the Desktop's `openrig.seats`). One that removes a seat carries a passkey, purpose `rigs`. */
3856
- z39.object({ type: z39.literal("rigs.seats"), op: OperationIdSchema, rig: RigNameSchema, seats: RigSeatCountsSchema, delegation: z39.enum(["pairs", "all"]).optional(), assertion: AssertionSchema.optional() }).strict(),
3880
+ z40.object({ type: z40.literal("rigs.seats"), op: OperationIdSchema, rig: RigNameSchema, seats: RigSeatCountsSchema, delegation: z40.enum(["pairs", "all"]).optional(), assertion: AssertionSchema.optional() }).strict(),
3857
3881
  /** A goal to the operator (the Desktop's `openrig.goal.send`); `goalId` is the phone's, the same for a retry. */
3858
- 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(),
3882
+ z40.object({ type: z40.literal("rigs.goal.send"), op: OperationIdSchema, goalId: z40.string().regex(/^[A-Za-z0-9-]{8,64}$/), text: z40.string().trim().min(1).max(8e3), folder: z40.string().min(1).max(4096).optional() }).strict(),
3859
3883
  /** 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. */
3860
- 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()
3884
+ z40.object({ type: z40.literal("rigs.goal.reply"), op: OperationIdSchema, goalId: z40.string().regex(/^[A-Za-z0-9-]{8,64}$/), replyId: z40.string().regex(/^[A-Za-z0-9-]{8,64}$/), text: z40.string().trim().min(1).max(8e3) }).strict()
3861
3885
  ]);
3862
- var PhoneModelChoiceSchema = z39.object({
3886
+ var PhoneModelChoiceSchema = z40.object({
3863
3887
  id: ModelChoiceSchema.shape.id.max(120),
3864
- label: z39.string().max(80),
3865
- description: z39.string().max(200).optional(),
3866
- efforts: z39.array(EffortSchema).max(8).optional(),
3888
+ label: z40.string().max(80),
3889
+ description: z40.string().max(200).optional(),
3890
+ efforts: z40.array(EffortSchema).max(8).optional(),
3867
3891
  defaultEffort: EffortSchema.optional(),
3868
- isDefault: z39.boolean().optional()
3892
+ isDefault: z40.boolean().optional()
3869
3893
  }).strict();
3870
3894
  var PHONE_COMMANDS_MAX = 300;
3871
- var PhoneSlashCommandSchema = SlashCommandSchema.extend({ description: z39.string().max(200).optional() }).strict();
3895
+ var PhoneSlashCommandSchema = SlashCommandSchema.extend({ description: z40.string().max(200).optional() }).strict();
3872
3896
  var PhoneHarnessUsageSchema = HarnessUsageSchema.omit({ account: true }).strict();
3873
- var PhoneServerMessageSchema = z39.discriminatedUnion("type", [
3897
+ var PhoneServerMessageSchema = z40.discriminatedUnion("type", [
3874
3898
  /** This PC's harness limits (`daemon.usage`): after `snapshot.request`, then on each change, whole. `prefs.alert`: the PC's
3875
3899
  * threshold, so the phone marks a window past it (amber, a line in « À toi ») and one reached (red). */
3876
- z39.object({ type: z39.literal("usage.state"), harnesses: z39.preprocess(dropUnknownHarnesses, z39.array(PhoneHarnessUsageSchema).max(4)), prefs: UsagePrefsSchema }),
3877
- z39.object({
3878
- type: z39.literal("snapshot"),
3879
- protocol: z39.literal(PHONE_PROTOCOL),
3880
- sessions: z39.array(PhoneSessionSchema),
3900
+ z40.object({ type: z40.literal("usage.state"), harnesses: z40.preprocess(dropUnknownHarnesses, z40.array(PhoneHarnessUsageSchema).max(4)), prefs: UsagePrefsSchema }),
3901
+ z40.object({
3902
+ type: z40.literal("snapshot"),
3903
+ protocol: z40.literal(PHONE_PROTOCOL),
3904
+ sessions: z40.array(PhoneSessionSchema),
3881
3905
  capabilities: CapabilitiesByToolSchema,
3882
- daemon: z39.object({
3883
- version: z39.string(),
3884
- name: z39.string().max(40),
3885
- boot: z39.string().uuid().optional(),
3906
+ daemon: z40.object({
3907
+ version: z40.string(),
3908
+ name: z40.string().max(40),
3909
+ boot: z40.string().uuid().optional(),
3886
3910
  /** The daemon takes `session.model`. */
3887
- models: z39.literal(true).optional(),
3911
+ models: z40.literal(true).optional(),
3888
3912
  /** The daemon sends `session.checklist` and a session's `checklist` summary. */
3889
- checklist: z39.literal(true).optional(),
3913
+ checklist: z40.literal(true).optional(),
3890
3914
  /** `update`: the daemon can install a version and restart (npm, systemd); `restart`: it can restart (systemd). */
3891
- update: z39.literal(true).optional(),
3892
- restart: z39.literal(true).optional(),
3915
+ update: z40.literal(true).optional(),
3916
+ restart: z40.literal(true).optional(),
3893
3917
  /** The daemon takes `session.close` and `session.resume`. */
3894
- sessionClose: z39.literal(true).optional(),
3918
+ sessionClose: z40.literal(true).optional(),
3895
3919
  /** The daemon streams a session's terminal (`term.open`). */
3896
- terminal: z39.literal(true).optional(),
3920
+ terminal: z40.literal(true).optional(),
3897
3921
  /** The PC lets a phone type into a terminal (`term.hold`): its setting is on. */
3898
- terminalInput: z39.literal(true).optional(),
3922
+ terminalInput: z40.literal(true).optional(),
3899
3923
  /** `term.open` takes `helper`: a subagent's terminal is its parent's, read-only for good. Absent (an older PC, which would drop
3900
3924
  * `helper` and open the parent's pane as its own): the phone opens no subagent's terminal. */
3901
- helperTerminal: z39.literal(true).optional(),
3925
+ helperTerminal: z40.literal(true).optional(),
3902
3926
  /** The daemon answers `session.commands`. */
3903
- commands: z39.literal(true).optional(),
3927
+ commands: z40.literal(true).optional(),
3904
3928
  /** The daemon answers `openrig.row`. */
3905
- rigRows: z39.literal(true).optional(),
3929
+ rigRows: z40.literal(true).optional(),
3906
3930
  /** The daemon answers `openrig.asks` and `openrig.answer` (« À toi »). */
3907
- openrig: z39.literal(true).optional(),
3931
+ openrig: z40.literal(true).optional(),
3908
3932
  /** The daemon takes `session.broadcast` (« Écrire au groupe »). */
3909
- broadcast: z39.literal(true).optional(),
3933
+ broadcast: z40.literal(true).optional(),
3910
3934
  /** The daemon answers `folder.list`, `folder.recents` and `project.folders`, and takes `project.folder.add` and `.remove`. */
3911
- projectFolders: z39.literal(true).optional(),
3935
+ projectFolders: z40.literal(true).optional(),
3912
3936
  /** The daemon takes `project.edit`, `project.order`, `project.create` and `project.delete` (Réglages › Projets). */
3913
- projectEdit: z39.literal(true).optional(),
3937
+ projectEdit: z40.literal(true).optional(),
3914
3938
  /** Issue #16: the snapshot and `projects` carry `sessionOrder`, and the daemon takes `session.order`. */
3915
- sessionOrder: z39.literal(true).optional(),
3939
+ sessionOrder: z40.literal(true).optional(),
3916
3940
  /** The daemon takes `device.prefs` and `context.set` (the phone's Réglages); the device then carries its `prefs`. */
3917
- settings: z39.literal(true).optional(),
3941
+ settings: z40.literal(true).optional(),
3918
3942
  /** The daemon sends `usage.state` (its harnesses' limits). */
3919
- usage: z39.literal(true).optional(),
3943
+ usage: z40.literal(true).optional(),
3920
3944
  /** The Atelier: the snapshot carries `projects`, each session its `projectId` and `rig`, and `projects` follows each change. Absent (an older PC): no Atelier. */
3921
- atelier: z39.literal(true).optional(),
3945
+ atelier: z40.literal(true).optional(),
3922
3946
  /** 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 ». */
3923
- rigs: z39.literal(true).optional(),
3947
+ rigs: z40.literal(true).optional(),
3924
3948
  /** « Nouvelle session »: the daemon takes `session.launch` and `project.folders` carries this PC's folders' branch. Absent (an older PC): « Nouvelle » cannot start. */
3925
- launch: z39.literal(true).optional(),
3949
+ launch: z40.literal(true).optional(),
3926
3950
  /** 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 ». */
3927
- forge: z39.literal(true).optional(),
3951
+ forge: z40.literal(true).optional(),
3928
3952
  /** The device's conversations are kept 7 days (M3 Q33): the daemon answers `chat.conversations` and `chat.conversation`, and
3929
3953
  * `chat.reset` puts the conversation away. Absent (an older PC): « Nouvelle conversation » forgets it. */
3930
- conversations: z39.literal(true).optional()
3954
+ conversations: z40.literal(true).optional()
3931
3955
  }),
3932
3956
  /** The user's projects (`daemon.atelier`), whole, in their order: absent from an older PC's snapshot. */
3933
- projects: z39.array(PhoneProjectSchema).max(PHONE_PROJECTS_MAX).optional(),
3957
+ projects: z40.array(PhoneProjectSchema).max(PHONE_PROJECTS_MAX).optional(),
3934
3958
  sessionOrder: PhoneSessionOrderSchema.optional(),
3935
- device: z39.object({
3936
- confirm: z39.boolean(),
3959
+ device: z40.object({
3960
+ confirm: z40.boolean(),
3937
3961
  /** Its passkey can bring it back after a reinstall: without it, « Mettre à jour la passkey ». */
3938
- recover: z39.literal(true).optional(),
3939
- push: z39.enum(["on", "off", "stale", "unavailable"]).optional(),
3940
- chat: z39.literal(true).optional(),
3962
+ recover: z40.literal(true).optional(),
3963
+ push: z40.enum(["on", "off", "stale", "unavailable"]).optional(),
3964
+ chat: z40.literal(true).optional(),
3941
3965
  contextNear: ContextPrefsSchema.shape.near.optional(),
3942
3966
  /** This device's id (its fingerprint, as decisions name it in `by`), its kind, and the name the user gave it (absent: none given). */
3943
- id: z39.string().optional(),
3967
+ id: z40.string().optional(),
3944
3968
  kind: DeviceKindSchema.optional(),
3945
- name: z39.string().optional(),
3969
+ name: z40.string().optional(),
3946
3970
  /** This device's own settings (`daemon.settings`). */
3947
3971
  prefs: DevicePrefsSchema.optional()
3948
3972
  }).optional()
3949
3973
  }),
3950
3974
  /** « À toi » on this PC: the answer to `openrig.asks`, then each change, whole. */
3951
- z39.object({ type: z39.literal("openrig.asks"), channel: HumanChannelSchema, asks: z39.array(HumanAskSchema), partial: z39.literal(true).optional(), truncated: z39.literal(true).optional() }),
3975
+ z40.object({ type: z40.literal("openrig.asks"), channel: HumanChannelSchema, asks: z40.array(HumanAskSchema), partial: z40.literal(true).optional(), truncated: z40.literal(true).optional() }),
3952
3976
  /** An answer's end, as on the desktop (`openrig.answered`), under the phone's `op`. `rejected`: the device check refused it (`reason`). */
3953
- z39.object({
3954
- type: z39.literal("openrig.answered"),
3977
+ z40.object({
3978
+ type: z40.literal("openrig.answered"),
3955
3979
  op: OperationIdSchema,
3956
- qitemId: z39.string(),
3957
- ok: z39.boolean(),
3958
- outcome: z39.enum(["recorded", "answered", "already"]).optional(),
3959
- remaining: z39.array(z39.string()).optional(),
3960
- replyId: z39.string().optional(),
3980
+ qitemId: z40.string(),
3981
+ ok: z40.boolean(),
3982
+ outcome: z40.enum(["recorded", "answered", "already"]).optional(),
3983
+ remaining: z40.array(z40.string()).optional(),
3984
+ replyId: z40.string().optional(),
3961
3985
  error: HumanAnswerErrorSchema.optional(),
3962
- message: z39.string().max(500).optional(),
3963
- rejected: z39.enum(["confirm_required", "assertion_invalid", "assertion_expired", "unavailable"]).optional()
3986
+ message: z40.string().max(500).optional(),
3987
+ rejected: z40.enum(["confirm_required", "assertion_invalid", "assertion_expired", "unavailable"]).optional()
3964
3988
  }),
3965
- 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() }),
3966
- z39.object({ type: z39.literal("session.updated"), session: PhoneSessionSchema }),
3989
+ z40.object({ type: z40.literal("confirm.challenge"), purpose: ConfirmPurposeSchema, challenge: B64U3.max(64), rpId: z40.string().max(253), credentialId: B64U3.max(1366).optional(), expiresInMs: z40.number().int().positive() }),
3990
+ z40.object({ type: z40.literal("session.updated"), session: PhoneSessionSchema }),
3967
3991
  /** The user's projects changed (a name, a colour, one added or removed, the order) (`daemon.atelier`): the list, whole. A session placed
3968
3992
  * elsewhere by the change follows as its own `session.updated`, after this. */
3969
- z39.object({ type: z39.literal("projects"), projects: z39.array(PhoneProjectSchema).max(PHONE_PROJECTS_MAX), sessionOrder: PhoneSessionOrderSchema.optional() }),
3970
- z39.object({ type: z39.literal("session.removed"), id: z39.string() }),
3993
+ z40.object({ type: z40.literal("projects"), projects: z40.array(PhoneProjectSchema).max(PHONE_PROJECTS_MAX), sessionOrder: PhoneSessionOrderSchema.optional() }),
3994
+ z40.object({ type: z40.literal("session.removed"), id: z40.string() }),
3971
3995
  /** A session's checklist, sent to the phone that watches it; `null`: it has none (any more). */
3972
- z39.object({ type: z39.literal("session.checklist"), id: z39.string(), checklist: PhoneChecklistSchema.nullable() }),
3996
+ z40.object({ type: z40.literal("session.checklist"), id: z40.string(), checklist: PhoneChecklistSchema.nullable() }),
3973
3997
  /** `pending.cut` is set when even this body was shortened. */
3974
- z39.object({ type: z39.literal("session.pending"), id: z39.string(), pending: PhonePendingSchema }),
3975
- z39.object({ type: z39.literal("session.preview"), id: z39.string(), lines: z39.array(z39.string()) }),
3998
+ z40.object({ type: z40.literal("session.pending"), id: z40.string(), pending: PhonePendingSchema }),
3999
+ z40.object({ type: z40.literal("session.preview"), id: z40.string(), lines: z40.array(z40.string()) }),
3976
4000
  /** `cut`: the ids of the items shortened; `more`: older items were left out. */
3977
- z39.object({ type: z39.literal("session.thread"), id: z39.string(), items: z39.array(ThreadItemSchema), cut: z39.array(z39.string()), more: z39.boolean() }),
3978
- z39.object({ type: z39.literal("session.thread.item"), id: z39.string(), item: ThreadItemSchema, cut: z39.literal(true).optional() }),
3979
- z39.object({
3980
- type: z39.literal("operation.result"),
4001
+ z40.object({ type: z40.literal("session.thread"), id: z40.string(), items: z40.array(ThreadItemSchema), cut: z40.array(z40.string()), more: z40.boolean() }),
4002
+ z40.object({ type: z40.literal("session.thread.item"), id: z40.string(), item: ThreadItemSchema, cut: z40.literal(true).optional() }),
4003
+ z40.object({
4004
+ type: z40.literal("operation.result"),
3981
4005
  op: OperationIdSchema,
3982
4006
  status: OperationStatusSchema,
3983
4007
  reason: OperationReasonSchema.optional(),
3984
4008
  /** How an applied `session.close` ended the agent: `killed` when it had to be forced. */
3985
4009
  how: CloseHowSchema.optional(),
3986
4010
  /** An applied `session.launch`: the new session, whose thread the phone opens. */
3987
- id: z39.string().max(200).optional(),
4011
+ id: z40.string().max(200).optional(),
3988
4012
  /** An applied `session.broadcast`: the names that got it and those that did not. */
3989
- sent: z39.array(z39.string().max(100)).max(BROADCAST_SESSIONS_MAX).optional(),
3990
- refused: z39.array(z39.object({ name: z39.string().max(100), reason: z39.string().max(200) })).max(BROADCAST_SESSIONS_MAX).optional()
4013
+ sent: z40.array(z40.string().max(100)).max(BROADCAST_SESSIONS_MAX).optional(),
4014
+ refused: z40.array(z40.object({ name: z40.string().max(100), reason: z40.string().max(200) })).max(BROADCAST_SESSIONS_MAX).optional()
3991
4015
  }),
3992
4016
  /** The models an agent offers; `error`: it could not be asked, `models` is then what Ledge knows without it. */
3993
- z39.object({ type: z39.literal("models.listing"), tool: ToolSchema, models: z39.array(PhoneModelChoiceSchema).max(40), error: z39.literal(true).optional() }),
4017
+ z40.object({ type: z40.literal("models.listing"), tool: ToolSchema, models: z40.array(PhoneModelChoiceSchema).max(40), error: z40.literal(true).optional() }),
3994
4018
  /** A model change that was accepted and then failed (the agent could not restart). */
3995
- z39.object({ type: z39.literal("session.model.failed"), id: z39.string(), reason: ModelRefusalSchema }),
4019
+ z40.object({ type: z40.literal("session.model.failed"), id: z40.string(), reason: ModelRefusalSchema }),
3996
4020
  /** 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. */
3997
- z39.object({ type: z39.literal("session.commands.listing"), id: z39.string(), commands: z39.array(PhoneSlashCommandSchema).max(PHONE_COMMANDS_MAX), error: z39.literal(true).optional() }),
4021
+ z40.object({ type: z40.literal("session.commands.listing"), id: z40.string(), commands: z40.array(PhoneSlashCommandSchema).max(PHONE_COMMANDS_MAX), error: z40.literal(true).optional() }),
3998
4022
  /** A queue row's state, answering `openrig.row`: `row`, or `error`. */
3999
- z39.object({ type: z39.literal("openrig.rowState"), qitem: z39.string(), row: PhoneRigRowSchema.optional(), error: PhoneRowErrorSchema.optional() }),
4000
- z39.object({ type: z39.literal("chat.history"), turns: z39.array(PhoneChatTurnSchema).max(50) }),
4001
- z39.object({ type: z39.literal("chat.step"), qid: OperationIdSchema, step: PhoneChatStepSchema }),
4023
+ z40.object({ type: z40.literal("openrig.rowState"), qitem: z40.string(), row: PhoneRigRowSchema.optional(), error: PhoneRowErrorSchema.optional() }),
4024
+ z40.object({ type: z40.literal("chat.history"), turns: z40.array(PhoneChatTurnSchema).max(50) }),
4025
+ z40.object({ type: z40.literal("chat.step"), qid: OperationIdSchema, step: PhoneChatStepSchema }),
4002
4026
  /** The whole text so far, not an increment. */
4003
- z39.object({ type: z39.literal("chat.delta"), qid: OperationIdSchema, text: z39.string().max(THREAD_TEXT_MAX) }),
4004
- z39.object({ type: z39.literal("chat.done"), qid: OperationIdSchema, turn: PhoneChatTurnSchema }),
4005
- z39.object({ type: z39.literal("chat.error"), qid: OperationIdSchema, code: ChatErrorCodeSchema }),
4027
+ z40.object({ type: z40.literal("chat.delta"), qid: OperationIdSchema, text: z40.string().max(THREAD_TEXT_MAX) }),
4028
+ z40.object({ type: z40.literal("chat.done"), qid: OperationIdSchema, turn: PhoneChatTurnSchema }),
4029
+ z40.object({ type: z40.literal("chat.error"), qid: OperationIdSchema, code: ChatErrorCodeSchema }),
4006
4030
  /** The current conversation's answers that read the account limits, and when (M3 Q31): a phone shows the limits under each. Sent after a
4007
4031
  * `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. */
4008
- z39.object({ type: z39.literal("chat.limits"), reads: z39.array(ChatLimitsReadSchema).max(50) }),
4032
+ z40.object({ type: z40.literal("chat.limits"), reads: z40.array(ChatLimitsReadSchema).max(50) }),
4009
4033
  /** The device's conversations (M3 Q33): the current one once it has a question, and the ones put away, the most recent first. */
4010
- z39.object({ type: z39.literal("chat.conversations"), current: ChatConversationSummarySchema.optional(), past: z39.array(ChatConversationSummarySchema).max(200) }),
4034
+ z40.object({ type: z40.literal("chat.conversations"), current: ChatConversationSummarySchema.optional(), past: z40.array(ChatConversationSummarySchema).max(200) }),
4011
4035
  /** One conversation, read-only, as `chat.history` gives its turns (`limits` as `chat.limits`); `error`: it is no longer kept. */
4012
- z39.object({
4013
- type: z39.literal("chat.conversation"),
4014
- id: z39.string().uuid(),
4015
- turns: z39.array(PhoneChatTurnSchema).max(50).optional(),
4016
- limits: z39.array(ChatLimitsReadSchema).max(50).optional(),
4017
- error: z39.literal("unknown").optional()
4036
+ z40.object({
4037
+ type: z40.literal("chat.conversation"),
4038
+ id: z40.string().uuid(),
4039
+ turns: z40.array(PhoneChatTurnSchema).max(50).optional(),
4040
+ limits: z40.array(ChatLimitsReadSchema).max(50).optional(),
4041
+ error: z40.literal("unknown").optional()
4018
4042
  }),
4019
4043
  /** The daemon updating or restarting itself, whoever asked: npm runs, then the service restarts (the link drops right after). */
4020
- z39.object({ type: z39.literal("daemon.progress"), version: z39.string().max(40), step: z39.enum(["installing", "restarting"]) }),
4044
+ z40.object({ type: z40.literal("daemon.progress"), version: z40.string().max(40), step: z40.enum(["installing", "restarting"]) }),
4021
4045
  /** Nothing was changed. Never npm's output nor a command: both hold the PC's paths. */
4022
- z39.object({ type: z39.literal("daemon.failed"), version: z39.string().max(40), reason: UpdateFailureSchema }),
4046
+ z40.object({ type: z40.literal("daemon.failed"), version: z40.string().max(40), reason: UpdateFailureSchema }),
4023
4047
  /** The tasks Ledge gave, open or closed lately, after each snapshot; then each change. */
4024
- z39.object({ type: z39.literal("tasks"), tasks: z39.array(PhoneTaskSchema).max(200) }),
4025
- z39.object({ type: z39.literal("task.updated"), task: PhoneTaskSchema }),
4048
+ z40.object({ type: z40.literal("tasks"), tasks: z40.array(PhoneTaskSchema).max(200) }),
4049
+ z40.object({ type: z40.literal("task.updated"), task: PhoneTaskSchema }),
4026
4050
  /** The routines, newest first, without their prompt (the phone's list is read-only); then each change, or `removed` (its id). */
4027
4051
  // Not strict, as every routine schema: a newer PC's field never makes the list unreadable to an older phone.
4028
- z39.object({ type: z39.literal("routines"), routines: z39.array(PhoneRoutineSchema).max(ROUTINES_MAX) }),
4029
- z39.object({ type: z39.literal("routine.changed"), routine: PhoneRoutineSchema.optional(), removed: RoutineIdSchema.optional() }),
4052
+ z40.object({ type: z40.literal("routines"), routines: z40.array(PhoneRoutineSchema).max(ROUTINES_MAX) }),
4053
+ z40.object({ type: z40.literal("routine.changed"), routine: PhoneRoutineSchema.optional(), removed: RoutineIdSchema.optional() }),
4030
4054
  /** The answer to `routine.show`: the routine whole, or `gone` when there is no such routine now. */
4031
- z39.object({ type: z39.literal("routine.detail"), id: RoutineIdSchema, routine: PhoneRoutineDetailSchema.optional(), gone: z39.literal(true).optional() }),
4055
+ z40.object({ type: z40.literal("routine.detail"), id: RoutineIdSchema, routine: PhoneRoutineDetailSchema.optional(), gone: z40.literal(true).optional() }),
4032
4056
  AttachmentStoredSchema,
4033
4057
  AttachmentDataSchema,
4034
4058
  AttachmentErrorSchema,
4035
4059
  /** 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. */
4036
- z39.object({
4037
- type: z39.literal("term.opened"),
4060
+ z40.object({
4061
+ type: z40.literal("term.opened"),
4038
4062
  op: OperationIdSchema.optional(),
4039
4063
  tid: TerminalIdSchema,
4040
- id: z39.string(),
4064
+ id: z40.string(),
4041
4065
  cols: TermDimSchema,
4042
4066
  rows: TermDimSchema,
4043
- screen: z39.string().max(TERM_SCREEN_MAX),
4044
- cursor: z39.object({ x: z39.number().int().nonnegative(), y: z39.number().int().nonnegative() }),
4045
- seq: z39.number().int().nonnegative(),
4067
+ screen: z40.string().max(TERM_SCREEN_MAX),
4068
+ cursor: z40.object({ x: z40.number().int().nonnegative(), y: z40.number().int().nonnegative() }),
4069
+ seq: z40.number().int().nonnegative(),
4046
4070
  /** Read-only for good: a subagent's page shows its parent's pane. */
4047
- readOnly: z39.literal(true).optional()
4071
+ readOnly: z40.literal(true).optional()
4048
4072
  }),
4049
4073
  /** What the pane printed since the last one; `seq` + 1 each time. */
4050
- z39.object({ type: z39.literal("term.output"), tid: TerminalIdSchema, seq: z39.number().int().nonnegative(), data: z39.string().min(1).max(TERM_OUTPUT_MAX) }),
4051
- z39.object({ type: z39.literal("term.size"), tid: TerminalIdSchema, cols: TermDimSchema, rows: TermDimSchema }),
4074
+ z40.object({ type: z40.literal("term.output"), tid: TerminalIdSchema, seq: z40.number().int().nonnegative(), data: z40.string().min(1).max(TERM_OUTPUT_MAX) }),
4075
+ z40.object({ type: z40.literal("term.size"), tid: TerminalIdSchema, cols: TermDimSchema, rows: TermDimSchema }),
4052
4076
  /** The phone holds the hand until `until`, pushed back by each key (5 min), never past 30 min from the hold. */
4053
- z39.object({ type: z39.literal("term.held"), tid: TerminalIdSchema, until: z39.string().datetime() }),
4054
- z39.object({ type: z39.literal("term.released"), tid: TerminalIdSchema, why: TermReleaseWhySchema }),
4055
- z39.object({ type: z39.literal("term.exit"), tid: TerminalIdSchema, why: TermExitWhySchema }),
4077
+ z40.object({ type: z40.literal("term.held"), tid: TerminalIdSchema, until: z40.string().datetime() }),
4078
+ z40.object({ type: z40.literal("term.released"), tid: TerminalIdSchema, why: TermReleaseWhySchema }),
4079
+ z40.object({ type: z40.literal("term.exit"), tid: TerminalIdSchema, why: TermExitWhySchema }),
4056
4080
  /** Never carries free text. */
4057
4081
  /** The subfolders of `path` on this PC (home when asked without one); `parent` null at the root. */
4058
- z39.object({
4059
- type: z39.literal("folder.listing"),
4082
+ z40.object({
4083
+ type: z40.literal("folder.listing"),
4060
4084
  path: FolderPathSchema,
4061
4085
  parent: FolderPathSchema.nullable(),
4062
- entries: z39.array(z39.string().min(1).max(255)).max(PHONE_FOLDER_ENTRIES_MAX),
4063
- repos: z39.array(z39.object({ name: z39.string().min(1).max(255), branch: z39.string().max(200) })).max(PHONE_FOLDER_ENTRIES_MAX),
4064
- cut: z39.literal(true).optional(),
4086
+ entries: z40.array(z40.string().min(1).max(255)).max(PHONE_FOLDER_ENTRIES_MAX),
4087
+ repos: z40.array(z40.object({ name: z40.string().min(1).max(255), branch: z40.string().max(200) })).max(PHONE_FOLDER_ENTRIES_MAX),
4088
+ cut: z40.literal(true).optional(),
4065
4089
  error: PhoneFolderErrorSchema.optional()
4066
4090
  }),
4067
- z39.object({ type: z39.literal("folder.recents"), paths: z39.array(FolderPathSchema).max(PHONE_RECENT_FOLDERS_MAX) }),
4091
+ z40.object({ type: z40.literal("folder.recents"), paths: z40.array(FolderPathSchema).max(PHONE_RECENT_FOLDERS_MAX) }),
4068
4092
  /** A project's folders, in its order; `gone`: no such project now. */
4069
- z39.object({ type: z39.literal("project.folders"), id: z39.string(), folders: z39.array(PhoneFolderSchema).max(50), gone: z39.literal(true).optional() }),
4070
- z39.object({ type: z39.literal("error"), code: z39.enum(["invalid", "unknown_session", "too_large"]), request: z39.string().max(40).optional() }),
4093
+ z40.object({ type: z40.literal("project.folders"), id: z40.string(), folders: z40.array(PhoneFolderSchema).max(50), gone: z40.literal(true).optional() }),
4094
+ z40.object({ type: z40.literal("error"), code: z40.enum(["invalid", "unknown_session", "too_large"]), request: z40.string().max(40).optional() }),
4071
4095
  // ── Rigs and the kernel (`daemon.rigs`) ──
4072
4096
  /** `error`: OpenRig could not be read (`state` absent). */
4073
- z39.object({ type: z39.literal("rigs.state"), state: PhoneOpenRigStateSchema.optional(), error: PhoneRigErrorSchema.optional() }).strict(),
4097
+ z40.object({ type: z40.literal("rigs.state"), state: PhoneOpenRigStateSchema.optional(), error: PhoneRigErrorSchema.optional() }).strict(),
4074
4098
  // ── Pull and merge requests (`daemon.forge`) ──
4075
4099
  /** After `forge.state`, then on each change, whole. */
4076
- z39.object({ type: z39.literal("forge.state"), ...PhoneForgeStateSchema.shape }).strict(),
4100
+ z40.object({ type: z40.literal("forge.state"), ...PhoneForgeStateSchema.shape }).strict(),
4077
4101
  /** `cut`: the gateway left out patches, discussions or commits, or shortened texts, to fit the frame. */
4078
- z39.object({ type: z39.literal("forge.detail"), prId: z39.string(), detail: PrDetailSchema.optional(), cut: z39.literal(true).optional(), error: PhoneForgeErrorSchema.optional() }).strict(),
4102
+ z40.object({ type: z40.literal("forge.detail"), prId: z40.string(), detail: PrDetailSchema.optional(), cut: z40.literal(true).optional(), error: PhoneForgeErrorSchema.optional() }).strict(),
4079
4103
  /** 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`. */
4080
- z39.object({
4081
- type: z39.literal("forge.done"),
4104
+ z40.object({
4105
+ type: z40.literal("forge.done"),
4082
4106
  op: OperationIdSchema,
4083
- ok: z39.boolean(),
4084
- command: z39.string().max(PHONE_FORGE_MESSAGE_MAX).optional(),
4107
+ ok: z40.boolean(),
4108
+ command: z40.string().max(PHONE_FORGE_MESSAGE_MAX).optional(),
4085
4109
  error: PhoneForgeActErrorSchema.optional(),
4086
- message: z39.string().max(PHONE_FORGE_MESSAGE_MAX).optional(),
4110
+ message: z40.string().max(PHONE_FORGE_MESSAGE_MAX).optional(),
4087
4111
  rejected: PhoneForgeRejectedSchema.optional()
4088
4112
  }).strict(),
4089
- z39.object({ type: z39.literal("rigs.graph"), rig: z39.string(), graph: RigGraphSchema.optional(), error: PhoneRigErrorSchema.optional() }).strict(),
4113
+ z40.object({ type: z40.literal("rigs.graph"), rig: z40.string(), graph: RigGraphSchema.optional(), error: PhoneRigErrorSchema.optional() }).strict(),
4090
4114
  /** `rows`: open (pending, in-progress, blocked), newest first; `closed`: closed lately, newest first; `truncated`: older open rows may be missing. */
4091
- z39.object({
4092
- type: z39.literal("rigs.queue"),
4093
- rig: z39.string(),
4094
- rows: z39.array(PhoneRigQueueRowSchema).max(PHONE_RIG_ROWS_MAX),
4095
- closed: z39.array(PhoneRigQueueRowSchema).max(PHONE_RIG_ROWS_MAX),
4096
- truncated: z39.boolean(),
4115
+ z40.object({
4116
+ type: z40.literal("rigs.queue"),
4117
+ rig: z40.string(),
4118
+ rows: z40.array(PhoneRigQueueRowSchema).max(PHONE_RIG_ROWS_MAX),
4119
+ closed: z40.array(PhoneRigQueueRowSchema).max(PHONE_RIG_ROWS_MAX),
4120
+ truncated: z40.boolean(),
4097
4121
  error: PhoneRigErrorSchema.optional()
4098
4122
  }).strict(),
4099
4123
  /** Oldest first, at most 20. */
4100
- z39.object({ type: z39.literal("rigs.routing"), entries: z39.array(PhoneRigRoutingSchema).max(20), error: PhoneRigErrorSchema.optional() }).strict(),
4101
- 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(),
4102
- z39.object({ type: z39.literal("rigs.snapshots"), rig: z39.string(), snapshots: z39.array(RigSnapshotSchema).max(20), error: PhoneRigErrorSchema.optional() }).strict(),
4103
- z39.object({ type: z39.literal("rigs.goals"), goals: z39.array(PhoneGoalSchema).max(PHONE_GOALS_MAX), partial: z39.literal(true).optional(), error: PhoneRigErrorSchema.optional() }).strict(),
4124
+ z40.object({ type: z40.literal("rigs.routing"), entries: z40.array(PhoneRigRoutingSchema).max(20), error: PhoneRigErrorSchema.optional() }).strict(),
4125
+ z40.object({ type: z40.literal("rigs.permissions"), rig: z40.string(), policy: z40.string().max(PHONE_RIG_TEXT_MAX).optional(), seats: z40.array(PhoneRigPermissionSchema).max(PHONE_RIG_SEATS_MAX), error: PhoneRigErrorSchema.optional() }).strict(),
4126
+ z40.object({ type: z40.literal("rigs.snapshots"), rig: z40.string(), snapshots: z40.array(RigSnapshotSchema).max(20), error: PhoneRigErrorSchema.optional() }).strict(),
4127
+ z40.object({ type: z40.literal("rigs.goals"), goals: z40.array(PhoneGoalSchema).max(PHONE_GOALS_MAX), partial: z40.literal(true).optional(), error: PhoneRigErrorSchema.optional() }).strict(),
4104
4128
  /** An action's end, under its `op` (`operation.result` says whether it ran). `commands`: the `rig` commands as shown; `error`: `busy`, `not_installed`,
4105
4129
  * `spec_unknown`, `spec_no_policy`, `spec_policy_unsupported`, or `failed` with `message`, OpenRig's last line; `completed` as the Desktop's. */
4106
- z39.object({
4107
- type: z39.literal("rigs.done"),
4130
+ z40.object({
4131
+ type: z40.literal("rigs.done"),
4108
4132
  op: OperationIdSchema,
4109
- ok: z39.boolean(),
4110
- commands: z39.array(z39.string().max(PHONE_RIG_TEXT_MAX)).max(400),
4111
- error: z39.string().max(40).optional(),
4112
- message: z39.string().max(PHONE_RIG_TEXT_MAX).optional(),
4113
- completed: z39.number().int().min(0).optional(),
4133
+ ok: z40.boolean(),
4134
+ commands: z40.array(z40.string().max(PHONE_RIG_TEXT_MAX)).max(400),
4135
+ error: z40.string().max(40).optional(),
4136
+ message: z40.string().max(PHONE_RIG_TEXT_MAX).optional(),
4137
+ completed: z40.number().int().min(0).optional(),
4114
4138
  rejected: PhoneRigRejectedSchema.optional()
4115
4139
  }).strict(),
4116
4140
  /** A change of seats ended: `added` / `removed` as `pod.member`; `error`: `rig_not_running`, `rig_root_unknown`, `busy`, or `failed` with `message`. */
4117
- z39.object({
4118
- type: z39.literal("rigs.reseated"),
4141
+ z40.object({
4142
+ type: z40.literal("rigs.reseated"),
4119
4143
  op: OperationIdSchema,
4120
- ok: z39.boolean(),
4121
- commands: z39.array(z39.string().max(PHONE_RIG_TEXT_MAX)).max(400),
4122
- added: z39.array(z39.string()).max(PHONE_RIG_SEATS_MAX),
4123
- removed: z39.array(z39.string()).max(PHONE_RIG_SEATS_MAX),
4124
- error: z39.string().max(40).optional(),
4125
- message: z39.string().max(PHONE_RIG_TEXT_MAX).optional(),
4126
- links: z39.number().int().optional(),
4127
- linksUnsupported: z39.boolean().optional(),
4144
+ ok: z40.boolean(),
4145
+ commands: z40.array(z40.string().max(PHONE_RIG_TEXT_MAX)).max(400),
4146
+ added: z40.array(z40.string()).max(PHONE_RIG_SEATS_MAX),
4147
+ removed: z40.array(z40.string()).max(PHONE_RIG_SEATS_MAX),
4148
+ error: z40.string().max(40).optional(),
4149
+ message: z40.string().max(PHONE_RIG_TEXT_MAX).optional(),
4150
+ links: z40.number().int().optional(),
4151
+ linksUnsupported: z40.boolean().optional(),
4128
4152
  rejected: PhoneRigRejectedSchema.optional()
4129
4153
  }).strict(),
4130
- z39.object({
4131
- type: z39.literal("rigs.goal.sent"),
4154
+ z40.object({
4155
+ type: z40.literal("rigs.goal.sent"),
4132
4156
  op: OperationIdSchema,
4133
- goalId: z39.string(),
4134
- ok: z39.boolean(),
4135
- qitemId: z39.string().optional(),
4157
+ goalId: z40.string(),
4158
+ ok: z40.boolean(),
4159
+ qitemId: z40.string().optional(),
4136
4160
  error: GoalErrorSchema.optional(),
4137
- message: z39.string().max(PHONE_RIG_TEXT_MAX).optional(),
4161
+ message: z40.string().max(PHONE_RIG_TEXT_MAX).optional(),
4138
4162
  rejected: PhoneRigRejectedSchema.optional()
4139
4163
  }).strict(),
4140
- z39.object({
4141
- type: z39.literal("rigs.goal.replied"),
4164
+ z40.object({
4165
+ type: z40.literal("rigs.goal.replied"),
4142
4166
  op: OperationIdSchema,
4143
- goalId: z39.string(),
4144
- replyId: z39.string(),
4145
- ok: z39.boolean(),
4146
- qitemId: z39.string().optional(),
4167
+ goalId: z40.string(),
4168
+ replyId: z40.string(),
4169
+ ok: z40.boolean(),
4170
+ qitemId: z40.string().optional(),
4147
4171
  error: GoalErrorSchema.optional(),
4148
- message: z39.string().max(PHONE_RIG_TEXT_MAX).optional(),
4172
+ message: z40.string().max(PHONE_RIG_TEXT_MAX).optional(),
4149
4173
  rejected: PhoneRigRejectedSchema.optional()
4150
4174
  }).strict()
4151
4175
  ]);
@@ -4157,8 +4181,8 @@ var ConfigError = class extends Error {
4157
4181
  this.name = "ConfigError";
4158
4182
  }
4159
4183
  };
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);
4184
+ var TokensSchema = z41.record(z41.string().min(1), z41.object({ accountId: z41.string().min(1), peer: RelayPeerSchema }));
4185
+ var PortSchema = z41.coerce.number().int().min(0).max(65535);
4162
4186
  function required(env, name) {
4163
4187
  const v = env[name];
4164
4188
  if (!v) throw new ConfigError(`${name} is not set`);
@@ -4491,10 +4515,10 @@ function countedLog(log, ms) {
4491
4515
 
4492
4516
  // src/routes.ts
4493
4517
  import { createHash as createHash3, timingSafeEqual as timingSafeEqual2 } from "crypto";
4494
- import { z as z42 } from "zod";
4518
+ import { z as z43 } from "zod";
4495
4519
 
4496
4520
  // src/github.ts
4497
- import { z as z41 } from "zod";
4521
+ import { z as z42 } from "zod";
4498
4522
  var GitHubError = class extends Error {
4499
4523
  code;
4500
4524
  constructor(code) {
@@ -4503,21 +4527,21 @@ var GitHubError = class extends Error {
4503
4527
  this.code = code;
4504
4528
  }
4505
4529
  };
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)
4530
+ var DeviceStartSchema = z42.object({
4531
+ device_code: z42.string().min(1),
4532
+ user_code: z42.string().min(1),
4533
+ verification_uri: z42.string().min(1),
4534
+ expires_in: z42.number().int().positive(),
4535
+ interval: z42.number().int().positive()
4536
+ });
4537
+ var TokenAnswerSchema = z42.object({
4538
+ access_token: z42.string().min(1).optional(),
4539
+ error: z42.string().optional(),
4540
+ interval: z42.number().int().positive().optional()
4541
+ });
4542
+ var UserSchema = z42.object({
4543
+ id: z42.number().int().nonnegative(),
4544
+ login: z42.string().min(1)
4521
4545
  });
4522
4546
  var DEVICE_GRANT = "urn:ietf:params:oauth:grant-type:device_code";
4523
4547
  var USER_AGENT = "ledge-relay";
@@ -4772,10 +4796,10 @@ async function readJson(req, schema, max = MAX_BODY) {
4772
4796
  if (!r.success) throw new Answer(400, "bad_request");
4773
4797
  return r.data;
4774
4798
  }
4775
- var RevokeBodySchema = z42.object({
4799
+ var RevokeBodySchema = z43.object({
4776
4800
  peer: RelayPeerSchema.refine((p) => p !== "pc")
4777
4801
  });
4778
- var PollBodySchema = z42.object({ deviceCode: z42.string().min(1).max(1024) });
4802
+ var PollBodySchema = z43.object({ deviceCode: z43.string().min(1).max(1024) });
4779
4803
  function authRoutes(deps) {
4780
4804
  const maxCalls = deps.maxGitHubCalls ?? DEFAULT_MAX_GITHUB_CALLS;
4781
4805
  let inFlight = 0;