@paradow/ledge-relay 0.67.0 → 0.69.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.
@@ -759,6 +759,77 @@ var OpenRigGoalRepliedSchema = z7.object({
759
759
  error: GoalErrorSchema.optional(),
760
760
  message: z7.string().optional()
761
761
  });
762
+ var MissionRowStateSchema = z7.enum(["pending", "in-progress", "blocked"]);
763
+ var MissionChildSchema = z7.object({
764
+ qitemId: z7.string(),
765
+ title: z7.string(),
766
+ holder: z7.string(),
767
+ state: MissionRowStateSchema,
768
+ since: z7.string(),
769
+ by: z7.enum(["blocked_on", "cited", "cites_mission"])
770
+ });
771
+ var MissionWaitSchema = z7.discriminatedUnion("kind", [
772
+ z7.object({ kind: z7.literal("row"), qitemId: z7.string(), title: z7.string().nullable(), holder: z7.string().nullable(), state: z7.string().nullable() }),
773
+ z7.object({ kind: z7.literal("external"), text: z7.string() })
774
+ ]);
775
+ var MissionSchema = z7.object({
776
+ /** The open row, at the end of the chain. */
777
+ qitemId: z7.string(),
778
+ /** The operator's own row, where the chain starts (`qitemId` when it was not handed on). */
779
+ rootQitemId: z7.string(),
780
+ rig: z7.string(),
781
+ state: MissionRowStateSchema,
782
+ /** Since when it is in that state: the open row's last change of state. */
783
+ since: z7.string(),
784
+ /** The row's summary, else its body's first line. */
785
+ title: z7.string(),
786
+ /** Who gave the open row, who holds it. */
787
+ from: z7.string(),
788
+ to: z7.string(),
789
+ waitsOn: MissionWaitSchema.nullable(),
790
+ /** The holder's last note on the open row (`rig queue update --note`, a block's note…), the queue's own notes left out. */
791
+ lastNote: z7.object({ at: z7.string(), by: z7.string(), text: z7.string() }).nullable(),
792
+ /** The rows linked to it still open, the oldest first. */
793
+ children: z7.array(MissionChildSchema),
794
+ /** The rows linked to it that ended: their count and titles, the most recent first. */
795
+ closed: z7.object({ count: z7.number().int().nonnegative(), titles: z7.array(z7.string()) }),
796
+ /** Part of this mission could not be read (its journal, a successor, the holder's rows): what is shown is what was read. */
797
+ partial: z7.boolean().optional()
798
+ });
799
+ var ExchangeDeliverySchema = z7.enum(["delivered", "indeterminate", "failed", "pending"]);
800
+ var ExchangeSchema = z7.object({
801
+ id: z7.string(),
802
+ at: z7.string(),
803
+ kind: z7.enum(["message", "given", "handed", "blocked", "done"]),
804
+ /** `blocked`: the seat that blocks, and in `to` the holder of what it waits on (empty when outside OpenRig or not read). */
805
+ from: z7.string(),
806
+ to: z7.array(z7.string()),
807
+ /** The rigs of its seats, for the « par rig » filter. */
808
+ rigs: z7.array(z7.string()),
809
+ text: z7.string(),
810
+ qitemId: z7.string().optional(),
811
+ delivery: ExchangeDeliverySchema.optional(),
812
+ urgent: z7.boolean().optional(),
813
+ outcome: z7.enum(["done", "canceled", "failed", "denied"]).optional()
814
+ });
815
+ var OpenRigMissionsSchema = z7.object({
816
+ type: z7.literal("openrig.missions"),
817
+ requestId: z7.string().min(1).max(100),
818
+ machineId: z7.string().optional(),
819
+ exchanges: z7.number().int().min(1).max(500).optional()
820
+ });
821
+ var OpenRigMissionsChangedSchema = z7.object({
822
+ type: z7.literal("openrig.missionsChanged"),
823
+ requestId: z7.string().optional(),
824
+ machineId: z7.string().optional(),
825
+ openrig: z7.enum(["ok", "absent", "stopped", "unreachable"]),
826
+ operator: z7.string().nullable(),
827
+ missions: z7.array(MissionSchema),
828
+ exchanges: z7.array(ExchangeSchema),
829
+ exchangesMore: z7.boolean(),
830
+ partial: z7.boolean().optional(),
831
+ error: z7.enum(["offline", "outdated"]).optional()
832
+ });
762
833
 
763
834
  // ../../packages/protocol/src/report.ts
764
835
  var ReportKindSchema = z8.enum(["bug", "feature"]);
@@ -1476,6 +1547,9 @@ var OperatorNoticeSchema = z12.object({
1476
1547
  rig: z12.string().optional(),
1477
1548
  qitem: z12.string().optional(),
1478
1549
  options: z12.array(z12.object({ id: z12.string(), label: z12.string().max(60) })).max(3).optional(),
1550
+ /** The question `options` belong to (#40): an option picked is `openrig.answer`'s `choice` with this `questionId`. Absent from daemons
1551
+ * before #40, and when there are no options. */
1552
+ questionId: z12.string().optional(),
1479
1553
  priority: z12.enum(["routine", "urgent", "critical"]),
1480
1554
  at: z12.string().datetime()
1481
1555
  });
@@ -1722,23 +1796,43 @@ var TermOutputSchema = z16.object({ type: z16.literal("term.output"), id, shell:
1722
1796
  var TermSizeSchema = z16.object({ type: z16.literal("term.size"), id, shell: shell.optional(), cols, rows });
1723
1797
  var TermExitSchema = z16.object({ type: z16.literal("term.exit"), id, shell: shell.optional(), why: PaneExitWhySchema });
1724
1798
 
1799
+ // ../../packages/protocol/src/aside.ts
1800
+ import { z as z17 } from "zod";
1801
+ var ASIDE_QUESTION_MAX = 4e3;
1802
+ var ASIDE_ANSWER_MAX = 5e4;
1803
+ var AsideStateSchema = z17.enum(["asking", "answered", "failed"]);
1804
+ var AsideCauseSchema = z17.enum(["unsupported", "read_only", "busy", "not_empty", "no_panel", "timeout", "unreadable", "interrupted", "invalid"]).catch("invalid");
1805
+ var AsideSchema = z17.object({
1806
+ rid: z17.string().min(1).max(100),
1807
+ question: z17.string().max(ASIDE_QUESTION_MAX),
1808
+ askedAt: z17.string().datetime(),
1809
+ state: AsideStateSchema,
1810
+ /** The answer as Claude Code copies it: Markdown. */
1811
+ answer: z17.string().max(ASIDE_ANSWER_MAX).optional(),
1812
+ truncated: z17.literal(true).optional(),
1813
+ answeredAt: z17.string().datetime().optional(),
1814
+ cause: AsideCauseSchema.optional()
1815
+ });
1816
+ 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) });
1817
+ var SessionAsideSchema = z17.object({ type: z17.literal("session.aside"), id: z17.string().min(1), aside: AsideSchema });
1818
+
1725
1819
  // ../../packages/protocol/src/machines.ts
1726
- import { z as z18 } from "zod";
1820
+ import { z as z19 } from "zod";
1727
1821
 
1728
1822
  // ../../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}$/);
1823
+ import { z as z18 } from "zod";
1824
+ var SshAliasSchema = z18.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9_.-]{0,127}$/);
1731
1825
 
1732
1826
  // ../../packages/protocol/src/machines.ts
1733
- var MachineIdSchema = z18.string().regex(/^[a-zA-Z0-9_-]{1,64}$/);
1734
- var MachineSchema = z18.object({
1827
+ var MachineIdSchema = z19.string().regex(/^[a-zA-Z0-9_-]{1,64}$/);
1828
+ var MachineSchema = z19.object({
1735
1829
  id: MachineIdSchema,
1736
- label: z18.string().trim().min(1).max(80),
1830
+ label: z19.string().trim().min(1).max(80),
1737
1831
  ssh: SshAliasSchema.optional(),
1738
1832
  /** 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()
1833
+ disabled: z19.boolean().optional()
1740
1834
  });
1741
- var MachinesSchema = z18.array(MachineSchema).min(1).max(20).superRefine((list, ctx) => {
1835
+ var MachinesSchema = z19.array(MachineSchema).min(1).max(20).superRefine((list, ctx) => {
1742
1836
  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
1837
  const ids = /* @__PURE__ */ new Set(), aliases = /* @__PURE__ */ new Set();
1744
1838
  list.forEach((m, i) => {
@@ -1754,57 +1848,57 @@ var MachinesSchema = z18.array(MachineSchema).min(1).max(20).superRefine((list,
1754
1848
  });
1755
1849
 
1756
1850
  // ../../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({
1851
+ import { z as z20 } from "zod";
1852
+ var IslandScaleSchema = z20.union([z20.literal("auto"), z20.literal(1), z20.literal(1.25), z20.literal(1.5), z20.literal(2)]);
1853
+ var IslandPrefsSchema = z20.object({
1760
1854
  /** Shown at the top of the screen; hidden, Desktop still notifies. */
1761
- visible: z19.boolean(),
1855
+ visible: z20.boolean(),
1762
1856
  /** `primary` (whichever it is after a reconfiguration), or a monitor's id as the shell lists it (`list_monitors`: the OS
1763
1857
  * 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"]),
1858
+ screen: z20.string().trim().min(1).max(200),
1859
+ position: z20.enum(["center", "left", "right"]),
1766
1860
  /** Retired with the floating island (#27): it was a strip under a maximised window. Optional and never read, so a file or
1767
1861
  * a front that still carries it parses; still written by DEFAULT_ISLAND_PREFS because a daemon before #27 requires it in
1768
1862
  * `island.set`. */
1769
- discreet: z19.boolean().optional(),
1863
+ discreet: z20.boolean().optional(),
1770
1864
  islandScale: IslandScaleSchema,
1771
1865
  /** Retired with the floating island (#27): the island's size sizes its cards too. Optional and never read; still written by
1772
1866
  * DEFAULT_ISLAND_PREFS for daemons before #27, which require it. */
1773
1867
  panelScale: IslandScaleSchema.optional(),
1774
1868
  /** What the island shows besides asks and questions, which it always shows. */
1775
- shows: z19.object({
1869
+ shows: z20.object({
1776
1870
  /** Allow, deny or answer in a line from the island; off, its cards only say « Open in Ledge ». */
1777
- quick: z19.boolean(),
1871
+ quick: z20.boolean(),
1778
1872
  /** The 6 s « Done » card when an agent finishes its turn. */
1779
- finished: z19.boolean(),
1873
+ finished: z20.boolean(),
1780
1874
  /** 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()
1875
+ say: z20.boolean().optional(),
1876
+ helpers: z20.boolean().optional()
1783
1877
  }),
1784
1878
  /** The global shortcut that reopens the oldest waiting request, as shown (`Ctrl Alt L`). */
1785
- shortcut: z19.string().trim().min(1).max(40)
1879
+ shortcut: z20.string().trim().min(1).max(40)
1786
1880
  });
1787
1881
 
1788
1882
  // ../../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}$/);
1883
+ import { z as z21 } from "zod";
1884
+ var ProjectColorSchema = z21.enum(["blue", "green", "amber", "violet", "teal", "pink", "red", "slate"]);
1885
+ var ProjectIdSchema = z21.string().regex(/^[a-z0-9][a-z0-9-]{0,63}$/);
1792
1886
  function normalizePath(raw) {
1793
1887
  const p = raw.trim().replace(/\/+/g, "/");
1794
1888
  return p.length > 1 && p.endsWith("/") ? p.slice(0, -1) : p;
1795
1889
  }
1796
- var PathSchema = z20.string().max(4096).refine((p) => p.startsWith("/") && p === normalizePath(p), "an absolute, normalized path");
1890
+ var PathSchema = z21.string().max(4096).refine((p) => p.startsWith("/") && p === normalizePath(p), "an absolute, normalized path");
1797
1891
  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({
1892
+ var RepoSchema = z21.object({ machine: MachineIdSchema, path: PathSchema });
1893
+ var ProjectNameSchema = z21.string().trim().min(1).max(80);
1894
+ var ProjectSchema = z21.object({
1801
1895
  id: ProjectIdSchema,
1802
1896
  name: ProjectNameSchema,
1803
1897
  color: ProjectColorSchema,
1804
- description: z20.string().max(500).default(""),
1805
- repos: z20.array(RepoSchema).max(50)
1898
+ description: z21.string().max(500).default(""),
1899
+ repos: z21.array(RepoSchema).max(50)
1806
1900
  });
1807
- var RuleSchema = z20.object({ machine: MachineIdSchema, path: PathSchema, project: ProjectIdSchema });
1901
+ var RuleSchema = z21.object({ machine: MachineIdSchema, path: PathSchema, project: ProjectIdSchema });
1808
1902
  function projectsProblems(p) {
1809
1903
  const out = [];
1810
1904
  const ids = /* @__PURE__ */ new Set(), names = /* @__PURE__ */ new Set(), repos = /* @__PURE__ */ new Set(), rules = /* @__PURE__ */ new Set();
@@ -1831,8 +1925,8 @@ ${rule.path}`;
1831
1925
  return out;
1832
1926
  }
1833
1927
  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) => {
1928
+ var SessionOrderSchema = z21.record(z21.string().max(64), z21.array(z21.string().min(1).max(300)).max(SESSION_ORDER_MAX));
1929
+ var ProjectsSchema = z21.object({ projects: z21.array(ProjectSchema).max(100), rules: z21.array(RuleSchema).max(1e3), order: SessionOrderSchema.optional() }).superRefine((p, ctx) => {
1836
1930
  for (const problem of projectsProblems(p)) ctx.addIssue({ code: "custom", message: problem.code, path: problem.path });
1837
1931
  });
1838
1932
 
@@ -1844,341 +1938,320 @@ var BROADCAST_LABEL_MAX = 120;
1844
1938
  import { z as z33 } from "zod";
1845
1939
 
1846
1940
  // ../../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) });
1941
+ import { z as z22 } from "zod";
1942
+ var ReposInspectSchema = z22.object({
1943
+ type: z22.literal("repos.inspect"),
1944
+ requestId: z22.string().min(1).max(100),
1945
+ paths: z22.array(z22.string().min(1)).min(1).max(50),
1946
+ machineId: z22.string().optional()
1947
+ });
1948
+ var RepoInfoSchema = z22.object({ path: z22.string(), exists: z22.boolean(), branch: z22.string().nullable() });
1949
+ var ReposInfoSchema = z22.object({ type: z22.literal("repos.info"), requestId: z22.string(), repos: z22.array(RepoInfoSchema) });
1856
1950
 
1857
1951
  // ../../packages/protocol/src/commands.ts
1858
- import { z as z22 } from "zod";
1859
- var SlashSourceSchema = z22.enum(["builtin", "project", "user", "plugin", "extension"]);
1952
+ import { z as z23 } from "zod";
1953
+ var SlashSourceSchema = z23.enum(["builtin", "project", "user", "plugin", "extension"]);
1860
1954
  var SLASH_COMMANDS_MAX = 400;
1861
1955
  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(),
1956
+ var SlashCommandSchema = z23.object({
1957
+ name: z23.string().min(1).max(200),
1958
+ description: z23.string().max(SLASH_DESCRIPTION_MAX).optional(),
1959
+ argumentHint: z23.string().max(200).optional(),
1960
+ aliases: z23.array(z23.string().min(1).max(200)).max(10).optional(),
1867
1961
  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(),
1962
+ blocked: z23.enum(["panel", "close"]).optional(),
1963
+ bare: z23.literal("panel").optional()
1964
+ });
1965
+ var SessionCommandsSchema = z23.object({ type: z23.literal("session.commands"), requestId: z23.string().min(1).max(100), id: z23.string() });
1966
+ var SessionCommandsListingSchema = z23.object({
1967
+ type: z23.literal("session.commands.listing"),
1968
+ requestId: z23.string(),
1969
+ id: z23.string(),
1876
1970
  tool: ToolSchema.optional(),
1877
- commands: z22.array(SlashCommandSchema).max(SLASH_COMMANDS_MAX),
1878
- error: z22.string().max(200).optional()
1971
+ commands: z23.array(SlashCommandSchema).max(SLASH_COMMANDS_MAX),
1972
+ error: z23.string().max(200).optional()
1879
1973
  });
1880
1974
 
1881
1975
  // ../../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() });
1976
+ import { z as z24 } from "zod";
1977
+ var ReposScanSchema = z24.object({ type: z24.literal("repos.scan"), requestId: z24.string().min(1).max(100), machineId: z24.string().optional() });
1978
+ var FoundRepoSchema = z24.object({ path: z24.string(), branch: z24.string().nullable(), remote: z24.string().optional(), manifest: z24.string().max(200).optional() });
1979
+ 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
1980
 
1887
1981
  // ../../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");
1982
+ import { z as z25 } from "zod";
1983
+ var QitemIdSchema = z25.string().regex(/^qitem-[A-Za-z0-9-]{1,120}$/, "not a qitem");
1890
1984
  var QITEM = "qitem-[A-Za-z0-9-]+";
1891
- var RigKindSchema = z24.enum(["message", "handoff", "unblocked", "openrig", "unreadable"]);
1892
- var RigInfoSchema = z24.object({
1985
+ var RigKindSchema = z25.enum(["message", "handoff", "unblocked", "openrig", "unreadable"]);
1986
+ var RigInfoSchema = z25.object({
1893
1987
  kind: RigKindSchema,
1894
1988
  /** The envelope's From, as written (`pilot-lead@ledge-dev-2`, `daemon@kernel`, `ledge@external`, `<unknown sender>`).
1895
1989
  * 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(),
1990
+ from: z25.string().optional(),
1897
1991
  /** The envelope's To, as written (a seat, a list `a, b`, or `broadcast to <rig> (n seats)`); on an outgoing item, the
1898
1992
  * destination the command named. */
1899
- to: z24.string().optional(),
1993
+ to: z25.string().optional(),
1900
1994
  /** The envelope's `Sent:` stamp as an ISO time (OpenRig gives no year: the year of receipt, or the year before when
1901
1995
  * that would put it in the future). Absent when the envelope has no `Sent:` line. */
1902
- sentAt: z24.string().datetime().optional(),
1996
+ sentAt: z25.string().datetime().optional(),
1903
1997
  /** The sender's generation (8 hex), when the stamp carries one. */
1904
- gen: z24.string().optional(),
1998
+ gen: z25.string().optional(),
1905
1999
  /** The row the item is about. `handoff`: the row handed (outgoing: the new row, when the command's output names it);
1906
2000
  * `unblocked`: the parked row now pending; `openrig`: the row it names (a stuck sweep: the stalled row). */
1907
2001
  qitem: QitemIdSchema.optional(),
1908
2002
  /** `handoff`: the row's summary as OpenRig carried it (one line, at most 120 characters, `…` when cut). */
1909
- summary: z24.string().optional(),
2003
+ summary: z25.string().optional(),
1910
2004
  /** `unblocked`: the row whose closing unblocked it. */
1911
2005
  blocker: QitemIdSchema.optional(),
1912
2006
  /** `openrig`: the recovery row OpenRig opened for it (a stuck sweep comes as a handoff of a `qitem-recovery-…` row). */
1913
2007
  recovery: QitemIdSchema.optional(),
1914
2008
  /** `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(),
2009
+ alert: z25.enum(["stalled", "custody"]).optional(),
1916
2010
  /** `openrig` with an alert: how long, in minutes, as OpenRig said. */
1917
- minutes: z24.number().int().nonnegative().optional(),
2011
+ minutes: z25.number().int().nonnegative().optional(),
1918
2012
  /** The seat's own command (an outgoing `sent` or `handoff`): the Bash command, as run. */
1919
- command: z24.string().optional(),
2013
+ command: z25.string().optional(),
1920
2014
  /** OpenRig said the delivery may repeat (`Recovered queue notification`). */
1921
- recovered: z24.literal(true).optional(),
2015
+ recovered: z25.literal(true).optional(),
1922
2016
  /** 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(),
2017
+ count: z25.number().int().min(2).optional(),
1924
2018
  /** Blocks pasted together in one prompt: the prompt's id, this block's place and how many there were. The front shows
1925
2019
  * 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(),
2020
+ packet: z25.object({ id: z25.string().min(1), index: z25.number().int().nonnegative(), count: z25.number().int().min(2) }).optional(),
1927
2021
  /** The block exactly as received (every delivery, separated by a blank line, when `count` is set); outgoing: the command
1928
2022
  * and what it printed. Always there. */
1929
- raw: z24.string()
2023
+ raw: z25.string()
1930
2024
  });
1931
2025
  var HANDOFF = new RegExp(`^Queue handoff: (${QITEM}) - check your queue\\.(?: Summary: (.*))?$`);
1932
2026
  var BLOCKER = new RegExp(`^Blocker (${QITEM}) resolved; parked qitem (${QITEM}) is pending\\.`);
1933
2027
  var STALLED = new RegExp(`^Stuck sweep: \\S+ on (${QITEM}) \\((\\d+) min\\)`);
1934
2028
  var CUSTODY = new RegExp(`^Custody not checked\\b.*?(?:for |of )(${QITEM}).*?\\((\\d+) min\\)`);
1935
- var RigRowSchema = z24.object({
2029
+ var RigRowSchema = z25.object({
1936
2030
  id: QitemIdSchema,
1937
- state: z24.string().min(1),
1938
- summary: z24.string().optional(),
2031
+ state: z25.string().min(1),
2032
+ summary: z25.string().optional(),
1939
2033
  /** Who made it and who holds it (seats). */
1940
- from: z24.string(),
1941
- to: z24.string(),
2034
+ from: z25.string(),
2035
+ to: z25.string(),
1942
2036
  /** `handed-off`: the seat it went to. */
1943
- handedOffTo: z24.string().optional(),
2037
+ handedOffTo: z25.string().optional(),
1944
2038
  /** `blocked`: the row it waits on. */
1945
- blockedOn: z24.string().optional(),
1946
- createdAt: z24.string(),
1947
- claimedAt: z24.string().optional(),
1948
- updatedAt: z24.string(),
2039
+ blockedOn: z25.string().optional(),
2040
+ createdAt: z25.string(),
2041
+ claimedAt: z25.string().optional(),
2042
+ updatedAt: z25.string(),
1949
2043
  /** When Ledge read it. */
1950
- at: z24.string(),
2044
+ at: z25.string(),
1951
2045
  /** 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(),
2046
+ needsInput: z25.object({ count: z25.number().int().min(1), reason: z25.string().nullable() }).optional()
2047
+ });
2048
+ var OpenRigRowSchema = z25.object({ type: z25.literal("openrig.row"), requestId: z25.string().min(1).max(100), qitem: QitemIdSchema, machineId: z25.string().optional() });
2049
+ var OpenRigRowStateSchema = z25.object({
2050
+ type: z25.literal("openrig.rowState"),
2051
+ requestId: z25.string(),
2052
+ machineId: z25.string().optional(),
2053
+ qitem: z25.string(),
1960
2054
  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()
2055
+ error: z25.string().optional()
2056
+ });
2057
+ var OpenRigQueueSchema = z25.object({ type: z25.literal("openrig.queue"), requestId: z25.string().min(1).max(100), machineId: z25.string().optional(), rig: RigNameSchema });
2058
+ var OpenRigQueueStateSchema = z25.object({
2059
+ type: z25.literal("openrig.queueState"),
2060
+ requestId: z25.string(),
2061
+ machineId: z25.string().optional(),
2062
+ rig: z25.string(),
2063
+ rows: z25.array(RigRowSchema),
2064
+ truncated: z25.boolean(),
2065
+ error: z25.string().optional()
1972
2066
  });
1973
2067
 
1974
2068
  // ../../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() })
2069
+ import { z as z26 } from "zod";
2070
+ var RoleUnknownWhySchema = z26.enum(["resolved_at_launch", "not_exposed", "unreadable", "ambiguous", "not_found", "missing_from_guidance"]);
2071
+ var RoleFromSchema = z26.enum(["import", "defaults", "profile", "rig", "pod", "member", "launch", "openrig", "plugin", "seat"]);
2072
+ var OriginSchema = z26.discriminatedUnion("kind", [
2073
+ z26.object({ kind: z26.literal("here"), key: z26.string().optional() }),
2074
+ z26.object({ kind: z26.literal("inherited"), from: RoleFromSchema, ref: z26.string().optional(), key: z26.string().optional(), path: z26.string().optional() }),
2075
+ z26.object({ kind: z26.literal("absent") }),
2076
+ z26.object({ kind: z26.literal("unknown"), why: RoleUnknownWhySchema, detail: z26.string().optional() })
1983
2077
  ]);
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({
2078
+ var SourcedStringSchema = z26.object({ value: z26.string().nullable(), origin: OriginSchema });
2079
+ var RoleResourceCategorySchema = z26.enum(["skill", "guidance", "plugin", "subagent", "runtime_resource"]);
2080
+ var RoleResourceSchema = z26.object({
1987
2081
  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(),
2082
+ id: z26.string(),
2083
+ path: z26.string().optional(),
2084
+ absolutePath: z26.string().optional(),
2085
+ runtime: z26.string().optional(),
2086
+ type: z26.string().optional(),
2087
+ target: z26.string().optional(),
2088
+ plugin: z26.object({ version: z26.string().optional(), skills: z26.array(z26.string()), hooks: z26.number().int().min(0) }).optional(),
1995
2089
  origin: OriginSchema
1996
2090
  });
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(),
2091
+ var RoleUsesListSchema = z26.object({ declared: z26.boolean(), key: z26.string(), items: z26.array(RoleResourceSchema) });
2092
+ var StartupLayerSchema = z26.enum(["agent", "profile", "culture", "rig", "pod", "member", "openrig", "seat", "unknown"]);
2093
+ var StartupEntrySchema = z26.object({
2094
+ kind: z26.enum(["file", "action"]),
2095
+ path: z26.string().optional(),
2096
+ absolutePath: z26.string().optional(),
2097
+ size: z26.number().int().min(0).optional(),
2098
+ value: z26.string().optional(),
2099
+ builtin: z26.string().optional(),
2006
2100
  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()),
2101
+ layerInferred: z26.boolean(),
2102
+ delivery: z26.string(),
2103
+ into: z26.string().optional(),
2104
+ delivered: z26.boolean().optional(),
2105
+ required: z26.boolean().optional(),
2106
+ orientation: z26.string().optional(),
2107
+ appliesOn: z26.array(z26.string()),
2014
2108
  origin: OriginSchema
2015
2109
  });
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()),
2110
+ var RoleFileErrorSchema = z26.object({ kind: z26.enum(["missing", "invalid"]), message: z26.string(), line: z26.number().int().optional(), col: z26.number().int().optional() });
2111
+ var RoleSummarySchema = z26.object({
2112
+ id: z26.string(),
2113
+ name: z26.string(),
2114
+ version: z26.string().optional(),
2115
+ description: z26.string().optional(),
2116
+ source: z26.enum(["builtin", "user"]),
2117
+ path: z26.string(),
2118
+ runtime: z26.string().optional(),
2119
+ importOnly: z26.boolean(),
2120
+ seats: z26.number().int().min(0),
2121
+ running: z26.number().int().min(0),
2122
+ skills: z26.array(z26.string()),
2123
+ startupFiles: z26.array(z26.string()),
2030
2124
  /** 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(),
2125
+ seatRefs: z26.array(z26.object({ rig: z26.string(), logicalId: z26.string(), session: z26.string().optional() })),
2126
+ error: z26.enum(["missing", "invalid"]).optional()
2127
+ });
2128
+ var RoleImportSchema = z26.object({
2129
+ ref: z26.string(),
2130
+ key: z26.string(),
2131
+ name: z26.string().optional(),
2132
+ path: z26.string().optional(),
2133
+ version: z26.string().optional(),
2134
+ resolved: z26.boolean(),
2135
+ error: z26.string().optional()
2136
+ });
2137
+ var RoleProfileSchema = z26.object({
2138
+ name: z26.string(),
2139
+ description: z26.string().optional(),
2046
2140
  runtime: SourcedStringSchema,
2047
2141
  model: SourcedStringSchema,
2048
2142
  effort: SourcedStringSchema,
2049
- uses: z25.object({ skills: RoleUsesListSchema, guidance: RoleUsesListSchema, subagents: RoleUsesListSchema, plugins: RoleUsesListSchema, runtimeResources: RoleUsesListSchema }),
2143
+ uses: z26.object({ skills: RoleUsesListSchema, guidance: RoleUsesListSchema, subagents: RoleUsesListSchema, plugins: RoleUsesListSchema, runtimeResources: RoleUsesListSchema }),
2050
2144
  /** 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(),
2145
+ startup: z26.array(StartupEntrySchema)
2146
+ });
2147
+ var RoleSeatSchema = z26.object({
2148
+ rig: z26.string(),
2149
+ rigId: z26.string(),
2150
+ rigSpecPath: z26.string().optional(),
2151
+ composed: z26.boolean(),
2152
+ logicalId: z26.string(),
2153
+ session: z26.string().optional(),
2154
+ label: z26.string().optional(),
2155
+ profile: z26.string(),
2156
+ running: z26.boolean(),
2157
+ activity: z26.string(),
2064
2158
  runtime: SourcedStringSchema,
2065
2159
  model: SourcedStringSchema,
2066
2160
  effort: SourcedStringSchema,
2067
2161
  cwd: SourcedStringSchema,
2068
2162
  cultureFile: SourcedStringSchema,
2069
- member: z25.string().optional(),
2070
- memberStartup: z25.array(StartupEntrySchema),
2163
+ member: z26.string().optional(),
2164
+ memberStartup: z26.array(StartupEntrySchema),
2071
2165
  /** The Role tab of this seat: its role guidance (`role.md`), then the startup files of its own (member layer), in delivery
2072
2166
  * 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),
2167
+ roleDocs: z26.array(StartupEntrySchema),
2168
+ live: z26.object({
2169
+ resolvedSpec: z26.object({ name: z26.string().optional(), version: z26.string().optional(), hash: z26.string().optional() }),
2170
+ resources: z26.array(RoleResourceSchema),
2077
2171
  /** In the order OpenRig returns them. */
2078
- startup: z25.array(StartupEntrySchema),
2172
+ startup: z26.array(StartupEntrySchema),
2079
2173
  /** `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()
2174
+ skills: z26.array(z26.object({ id: z26.string(), trigger: z26.string().optional() })).optional()
2081
2175
  }).optional()
2082
2176
  });
2083
- var RoleUnavailableSchema = z25.enum(["harness_prompt", "effective_settings", "delivered_content", "harness_own_files"]);
2084
- var RoleDetailSchema = z25.object({
2177
+ var RoleUnavailableSchema = z26.enum(["harness_prompt", "effective_settings", "delivered_content", "harness_own_files"]);
2178
+ var RoleDetailSchema = z26.object({
2085
2179
  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() }))
2180
+ file: z26.object({
2181
+ path: z26.string(),
2182
+ relativePath: z26.string().optional(),
2183
+ modifiedAt: z26.string().optional(),
2184
+ copies: z26.array(z26.object({ kind: z26.literal("repo"), path: z26.string(), identical: z26.boolean(), modifiedAt: z26.string().optional() }))
2091
2185
  }),
2092
2186
  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),
2187
+ role: z26.object({ path: z26.string(), absolutePath: z26.string(), origin: OriginSchema }).nullable(),
2188
+ defaults: z26.object({ runtime: SourcedStringSchema, model: SourcedStringSchema, effort: SourcedStringSchema }),
2189
+ imports: z26.array(RoleImportSchema),
2190
+ importedBy: z26.array(z26.string()),
2191
+ profiles: z26.array(RoleProfileSchema),
2098
2192
  /** 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(),
2193
+ resources: z26.array(RoleResourceSchema),
2194
+ seats: z26.array(RoleSeatSchema),
2195
+ unavailable: z26.array(RoleUnavailableSchema),
2196
+ warnings: z26.array(z26.string()),
2197
+ openrigVersion: z26.string().optional()
2198
+ });
2199
+ var RoleErrorSchema = z26.string();
2200
+ var LibraryIdSchema = z26.string().min(1).max(200).regex(/^[A-Za-z0-9][A-Za-z0-9._:-]*$/, "not a library id");
2201
+ var OpenRigRolesSchema = z26.object({ type: z26.literal("openrig.roles"), requestId: z26.string().min(1).max(100), machineId: z26.string().optional() });
2202
+ var OpenRigRoleListSchema = z26.object({
2203
+ type: z26.literal("openrig.roleList"),
2204
+ requestId: z26.string(),
2205
+ machineId: z26.string().optional(),
2206
+ roles: z26.array(RoleSummarySchema),
2207
+ openrigVersion: z26.string().optional(),
2114
2208
  error: RoleErrorSchema.optional()
2115
2209
  });
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(),
2210
+ var OpenRigRoleSchema = z26.object({ type: z26.literal("openrig.role"), requestId: z26.string().min(1).max(100), machineId: z26.string().optional(), roleId: LibraryIdSchema });
2211
+ var OpenRigRoleDetailSchema = z26.object({
2212
+ type: z26.literal("openrig.roleDetail"),
2213
+ requestId: z26.string(),
2214
+ machineId: z26.string().optional(),
2215
+ roleId: z26.string(),
2122
2216
  role: RoleDetailSchema.optional(),
2123
2217
  error: RoleErrorSchema.optional()
2124
2218
  });
2125
- var OpenRigRoleFileSchema = z25.object({
2126
- type: z25.literal("openrig.roleFile"),
2127
- requestId: z25.string().min(1).max(100),
2128
- machineId: z25.string().optional(),
2219
+ var OpenRigRoleFileSchema = z26.object({
2220
+ type: z26.literal("openrig.roleFile"),
2221
+ requestId: z26.string().min(1).max(100),
2222
+ machineId: z26.string().optional(),
2129
2223
  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(),
2224
+ path: z26.string().min(1).max(4096)
2225
+ });
2226
+ var OpenRigRoleFileContentSchema = z26.object({
2227
+ type: z26.literal("openrig.roleFileContent"),
2228
+ requestId: z26.string(),
2229
+ machineId: z26.string().optional(),
2230
+ roleId: z26.string(),
2231
+ path: z26.string(),
2232
+ content: z26.string().optional(),
2233
+ size: z26.number().int().min(0).optional(),
2234
+ truncated: z26.boolean().optional(),
2141
2235
  error: RoleErrorSchema.optional()
2142
2236
  });
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(),
2237
+ var OpenRigRoleDuplicateSchema = z26.object({
2238
+ type: z26.literal("openrig.role.duplicate"),
2239
+ requestId: z26.string().min(1).max(100),
2240
+ machineId: z26.string().optional(),
2147
2241
  roleId: LibraryIdSchema,
2148
2242
  name: RigNameSchema
2149
2243
  });
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(),
2244
+ var OpenRigRoleDuplicatedSchema = z26.object({
2245
+ type: z26.literal("openrig.roleDuplicated"),
2246
+ requestId: z26.string(),
2247
+ machineId: z26.string().optional(),
2248
+ ok: z26.boolean(),
2249
+ roleId: z26.string().optional(),
2250
+ path: z26.string().optional(),
2157
2251
  error: RoleErrorSchema.optional()
2158
2252
  });
2159
2253
  var ROLE_FILE_MAX = 512 * 1024;
2160
2254
 
2161
- // ../../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({
2176
- /** 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()
2180
- });
2181
-
2182
2255
  // ../../packages/protocol/src/thread.ts
2183
2256
  import { z as z27 } from "zod";
2184
2257
  var ToolStatusSchema = z27.enum(["running", "success", "failed", "unknown"]);
@@ -2664,7 +2737,6 @@ var DaemonInfoSchema = z33.object({
2664
2737
  install: z33.enum(["npm", "git", "unknown"]),
2665
2738
  systemd: z33.boolean(),
2666
2739
  manual: z33.string().optional(),
2667
- routing: z33.boolean().optional(),
2668
2740
  archive: z33.boolean().optional(),
2669
2741
  /** Takes `model` and `effort` on `session.launch` and answers `models.list` (#58). */
2670
2742
  models: z33.boolean().optional(),
@@ -2698,6 +2770,8 @@ var DaemonInfoSchema = z33.object({
2698
2770
  openrigAsks: z33.boolean().optional(),
2699
2771
  /** Answers `openrig.goal.send`, `openrig.goals` and `openrig.goal.reply`: goals given to Max (lot 2). */
2700
2772
  openrigGoals: z33.boolean().optional(),
2773
+ /** Answers `openrig.missions`: the operator's thread's « Missions » and « Échanges » cards (#54). */
2774
+ openrigMissions: z33.boolean().optional(),
2701
2775
  /** Takes `session.broadcast` (its `ledge bridge` too, on this machine): a client sends it only when this is set. */
2702
2776
  broadcast: z33.boolean().optional(),
2703
2777
  /** Sends `browser.live` and answers `browser.watch`, `browser.unwatch` and `browser.enable`: the agent's browser, live. */
@@ -2715,6 +2789,8 @@ var DaemonInfoSchema = z33.object({
2715
2789
  routines: z33.boolean().optional(),
2716
2790
  /** Answers a grouped `routine.cmd` (`others`) all or nothing: a client sends one only to a daemon that says it. */
2717
2791
  routineGroups: z33.boolean().optional(),
2792
+ /** Takes `session.aside` (#41): a Claude Code session's `/btw`, answered as an aside, not a thread item. */
2793
+ aside: z33.boolean().optional(),
2718
2794
  /** Takes `session.label`: a session's nickname, kept with it. A client sends one only to a daemon that says it. */
2719
2795
  sessionLabel: z33.boolean().optional(),
2720
2796
  /** Its launcher answers `shell --nonce <N> <dir>` (#299): a free shell started through it gets the shell integration (OSC 633). */
@@ -2730,7 +2806,6 @@ var ServerMessageSchema = z33.discriminatedUnion("type", [
2730
2806
  TermSizeSchema,
2731
2807
  TermExitSchema,
2732
2808
  SessionModelAcceptedSchema,
2733
- z33.object({ type: z33.literal("chat.routed"), qid: z33.string(), result: RouteResultSchema }),
2734
2809
  DocumentContentSchema,
2735
2810
  DocumentErrorSchema,
2736
2811
  AttachmentStoredSchema,
@@ -2759,6 +2834,7 @@ var ServerMessageSchema = z33.discriminatedUnion("type", [
2759
2834
  OpenRigAnsweredSchema,
2760
2835
  OpenRigGoalSentSchema,
2761
2836
  OpenRigGoalsChangedSchema,
2837
+ OpenRigMissionsChangedSchema,
2762
2838
  OpenRigGoalRepliedSchema,
2763
2839
  /** `recents`: the folders of past sessions, most recent first. `launcher`: the command that runs `ledge` inside WSL
2764
2840
  * (`[node, cli]`), so the overlay can attach a terminal to a session with `<launcher> attach <id>`. `daemon`: absent
@@ -2779,10 +2855,9 @@ var ServerMessageSchema = z33.discriminatedUnion("type", [
2779
2855
  /** A session's thread, on request (spec 2026-10-13 §5); then each created or updated item, broadcast. */
2780
2856
  z33.object({ type: z33.literal("session.thread"), id: z33.string(), items: z33.array(ThreadItemSchema) }),
2781
2857
  z33.object({ type: z33.literal("session.thread.item"), id: z33.string(), item: ThreadItemSchema }),
2858
+ SessionAsideSchema,
2782
2859
  /** Answer to the requester of a `session.launch`: the session exists (its `session.updated` is broadcast as usual). */
2783
2860
  z33.object({ type: z33.literal("session.launched"), id: z33.string() }),
2784
- /** 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
2861
  z33.object({ type: z33.literal("recents"), recents: z33.array(RecentSchema) }),
2787
2862
  /** Answer to the requester of a `folder.list` or `folder.create`: `path` resolved (`~` expanded), `parent` null at the
2788
2863
  * root, `entries` its subfolders by name (hidden ones left out). A failure keeps the asked path and says why in `error`,
@@ -2798,23 +2873,12 @@ var ServerMessageSchema = z33.discriminatedUnion("type", [
2798
2873
  /** Those `entries` that are Git repositories, with their branch (the short commit when HEAD is detached). */
2799
2874
  repos: z33.array(z33.object({ name: z33.string(), branch: z33.string() })).optional()
2800
2875
  }),
2801
- /** 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() }),
2805
- /** 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(),
2809
- /** nothing was sent */
2810
- refused: z33.literal(true).optional()
2811
- })) }),
2812
2876
  /** What an `action.run` came to: `row` the action as the daemon resolved it (its summary, its risk); `reason` why it was not
2813
2877
  * done, with `code` (`refused`: not possible now; `agent`: a session may not run it; `confirm_required`: destructive, ask
2814
2878
  * again; `failed`: the handler turned it down; a free string, as an `error`'s). */
2815
2879
  z33.object({ type: z33.literal("action.result"), rid: z33.string(), action: z33.string().min(1).max(40), row: ChatActionSchema.optional(), reason: z33.string().optional(), code: z33.string().optional() }),
2880
+ /** #40: the chat left Ledge. An older front's `chat.ask` or `chat.route` is answered with this, so it stops waiting (D12). */
2816
2881
  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) }),
2818
2882
  /** The daemon updating itself: npm is running, then the service restarts (the socket closes right after). */
2819
2883
  z33.object({ type: z33.literal("update.progress"), version: z33.string(), step: z33.enum(["installing", "restarting"]) }),
2820
2884
  /** Nothing was changed. `detail`: the useful end of npm's output; `command`: what the person can run instead. */
@@ -2877,7 +2941,6 @@ var ServerMessageSchema = z33.discriminatedUnion("type", [
2877
2941
  ]);
2878
2942
  var MESSAGE_MAX = 2e4;
2879
2943
  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
2944
  var ClientMessageSchema = z33.discriminatedUnion("type", [
2882
2945
  BrowserWatchSchema,
2883
2946
  BrowserUnwatchSchema,
@@ -2887,7 +2950,6 @@ var ClientMessageSchema = z33.discriminatedUnion("type", [
2887
2950
  TermUnwatchSchema,
2888
2951
  TermInputSchema,
2889
2952
  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 }),
2891
2953
  DocumentReadSchema,
2892
2954
  AttachmentPutSchema,
2893
2955
  AttachmentCaptureSchema,
@@ -2915,11 +2977,11 @@ var ClientMessageSchema = z33.discriminatedUnion("type", [
2915
2977
  OpenRigAnswerSchema,
2916
2978
  OpenRigGoalSendSchema,
2917
2979
  OpenRigGoalsSchema,
2980
+ OpenRigMissionsSchema,
2918
2981
  OpenRigGoalReplySchema,
2919
2982
  /** The overlay starts a session: `cwd` is a WSL path (`~` allowed), `name` a preferred bot name (the daemon picks a
2920
2983
  * free one otherwise), `prompt` the agent's first instruction, `continue` resumes the folder's last conversation.
2921
- * With `qid` it is the chat card of that turn: the daemon launches the turn's proposal and ignores the other fields
2922
- * but `rows`, `model` and `effort`. */
2984
+ * `qid` named a chat card's turn: the chat left Ledge (#40), so the daemon refuses it (an older front, D12). */
2923
2985
  z33.object({
2924
2986
  type: z33.literal("session.launch"),
2925
2987
  tool: ToolSchema,
@@ -2928,11 +2990,9 @@ var ClientMessageSchema = z33.discriminatedUnion("type", [
2928
2990
  prompt: z33.string().optional(),
2929
2991
  continue: z33.boolean().optional(),
2930
2992
  qid: z33.string().min(1).optional(),
2931
- /** With `qid`: the card's rows to launch (#24), indexes into the turn's `proposals`, each once; the first row without it. */
2932
- rows: launchRows.optional(),
2933
2993
  /** Folders in addition to `cwd` (Claude: `--add-dir`); resolved like `cwd`. */
2934
2994
  dirs: z33.array(z33.string().min(1)).max(20).optional(),
2935
- /** The agent's model and effort (#58), the agent's own default when left out; with `qid`, for every row launched. */
2995
+ /** The agent's model and effort (#58), the agent's own default when left out. */
2936
2996
  model: ModelIdSchema.optional(),
2937
2997
  effort: EffortSchema.optional(),
2938
2998
  /** OMP only: its approval mode, `always-ask` when left out. */
@@ -2963,38 +3023,6 @@ var ClientMessageSchema = z33.discriminatedUnion("type", [
2963
3023
  z33.object({ type: z33.literal("session.answer"), id: z33.string(), requestId: z33.string().min(1).max(200), answers: z33.array(z33.object({ id: z33.string(), selected: z33.array(z33.string().max(2e3)).max(100), text: z33.string().max(2e4).optional() })).max(50), cancel: z33.boolean().optional() }),
2964
3024
  /** `by`: as session.decide's, who answers when the reply answers a request (set by the phone gateway for a device; absent, the PC). */
2965
3025
  z33.object({ type: z33.literal("session.reply"), id: z33.string(), text: z33.string(), attachments: z33.array(AttachmentIdSchema).max(ATTACHMENTS_MAX).optional(), steer: z33.boolean().optional(), by: DecidedBySchema.optional() }),
2966
- /** 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) }),
2968
- /** 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) }),
2970
- /** The chat's generic card (action registry spec §5.1): applies its rows in order (all of them without `rows`), stopping at
2971
- * 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),
2976
- rows: launchRows.optional(),
2977
- confirmed: z33.literal(true).optional(),
2978
- /** « Refuser »: each row (session.decide only) answers its session's request with deny, whatever its own decision; never
2979
- * confirmed, and allowed on a request shown cut. The rows become `denied`. */
2980
- deny: z33.literal(true).optional()
2981
- }),
2982
- /** « Ignorer » the turn's cards, for every device and for Ledge (who is told at the next question); `undo` opens them
2983
- * 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() }),
2985
- /** 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),
2990
- answer: PointAnswerSchema.optional(),
2991
- /** Applies the row's suggestion instead of answering it (exactly one of `answer` and `suggest`). */
2992
- suggest: z33.literal(true).optional(),
2993
- /** The front's confirmation of a destructive answer (an accepted request, a decision), as `chat.act` takes it. */
2994
- confirmed: z33.literal(true).optional()
2995
- }),
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) }),
2998
3026
  /** A registry action run outside the chat (#93, the CLI): the daemon resolves `args` as it does a generic card's row, then
2999
3027
  * applies it through its own handler. `by` the session that asks, left out for the user; `confirmed` for a destructive one. */
3000
3028
  z33.object({
@@ -3007,8 +3035,6 @@ var ClientMessageSchema = z33.discriminatedUnion("type", [
3007
3035
  args: z33.record(z33.unknown()),
3008
3036
  confirmed: z33.literal(true).optional()
3009
3037
  }),
3010
- /** 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() }),
3012
3038
  /** `always` and `note` only where the harness offers them (`offers`); a note goes with `deny`, for the agent to read. */
3013
3039
  z33.object({
3014
3040
  type: z33.literal("session.decide"),
@@ -3025,6 +3051,7 @@ var ClientMessageSchema = z33.discriminatedUnion("type", [
3025
3051
  z33.object({ type: z33.literal("session.kill"), id: z33.string() }),
3026
3052
  /** `restoreQueue` (OMP): also take back what waits in its queue, returned as `session.queue.restored` to put in the draft. */
3027
3053
  z33.object({ type: z33.literal("session.interrupt"), id: z33.string(), restoreQueue: z33.boolean().optional() }),
3054
+ SessionAsideAskSchema,
3028
3055
  /** Removes a finished (exited) or read-only (hook_only) session from the list; refused for a live launcher session. */
3029
3056
  z33.object({ type: z33.literal("session.dismiss"), id: z33.string() }),
3030
3057
  /** Puts a session in the archive: it leaves the live list but is kept. */
@@ -3057,10 +3084,11 @@ var ClientMessageSchema = z33.discriminatedUnion("type", [
3057
3084
  }),
3058
3085
  z33.object({ type: z33.literal("session.unregister"), id: z33.string(), exitCode: z33.number().int().nullable() }),
3059
3086
  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) }),
3062
- /** 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
+ /** #40: the chat, its cards and the operator's point left Ledge. An older front's message still parses, by its name only, so
3088
+ * the daemon refuses it by name (D12); `chat.ask` and `chat.route` keep their `qid`, answered with a `chat.error`. */
3089
+ z33.object({ type: z33.literal("chat.ask"), qid: z33.string().min(1).max(100) }),
3090
+ z33.object({ type: z33.literal("chat.route"), qid: z33.string().min(1).max(100) }),
3091
+ ...["chat.cancel", "chat.reset", "chat.act", "chat.ignore", "point.act", "point.later", "operator.read", "session.relay", "session.relay.cancel", "session.close"].map((type) => z33.object({ type: z33.literal(type) })),
3064
3092
  /** Installs `@paradow/ledge@version` and restarts the service (spec 2026-10-12 auto-update §6). */
3065
3093
  z33.object({ type: z33.literal("update.daemon"), version: z33.string().regex(SEMVER) }),
3066
3094
  /** Replaces the daemon's machines list (first connected front wins); refused unless valid. */
@@ -3430,7 +3458,7 @@ var AssertionSchema = z39.object({
3430
3458
  authenticatorData: B64U3.max(4096),
3431
3459
  signature: B64U3.max(1024)
3432
3460
  });
3433
- var ConfirmPurposeSchema = z39.enum(["register", "decide", "launch", "close", "act", "pc", "terminal", "rig", "note", "project", "folder", "rigs", "forge", "routine"]);
3461
+ var ConfirmPurposeSchema = z39.enum(["register", "decide", "launch", "close", "act", "pc", "terminal", "rig", "note", "project", "folder", "rigs", "forge", "routine", "decision"]);
3434
3462
  var PhoneChatStepSchema = ChatStepSchema.pick({ kind: true, id: true, name: true }).strict();
3435
3463
  var PhoneChatProposalSchema = z39.object({
3436
3464
  project: z39.string().max(80),
@@ -3617,6 +3645,8 @@ var PhoneClientMessageSchema = z39.discriminatedUnion("type", [
3617
3645
  /** A `note` challenge: the proposal (a task) and the exact choice it covers. */
3618
3646
  task: z39.string().min(1).max(40).optional(),
3619
3647
  choice: BrainChoiceSchema.optional(),
3648
+ /** A `decision` challenge (#40): the decision (`task`) and the exact answer it covers, as `task.answer` will send it. */
3649
+ taskAnswer: z39.string().trim().min(1).max(TASK_TEXT_MAX).optional(),
3620
3650
  /** A `project` challenge: the project deleted and where its agents go (null: no project). */
3621
3651
  project: ProjectIdSchema.optional(),
3622
3652
  moveTo: ProjectIdSchema.nullable().optional(),
@@ -3788,6 +3818,9 @@ var PhoneClientMessageSchema = z39.discriminatedUnion("type", [
3788
3818
  /** The user's answer to a proposal about the notes (brain spec, lot 4): a `yes` carries an assertion of purpose `note` bound to the
3789
3819
  * task and that exact choice; a `no` needs none. */
3790
3820
  z39.object({ type: z39.literal("brain.answer"), op: OperationIdSchema, task: z39.string().min(1).max(40), choice: BrainChoiceSchema, assertion: AssertionSchema.optional() }),
3821
+ /** The user's answer to a decision a session put to them (`ledge task give ledge`, #40): destructive, so always `confirmed`, and backed
3822
+ * by an assertion of purpose `decision` bound to that decision and that exact answer. Sent only to a daemon with `daemon.taskAnswer`. */
3823
+ z39.object({ type: z39.literal("task.answer"), op: OperationIdSchema, task: z39.string().min(1).max(40), answer: z39.string().trim().min(1).max(TASK_TEXT_MAX), confirmed: z39.literal(true), assertion: AssertionSchema.optional() }).strict(),
3791
3824
  /** Puts a closed task Ledge gave away from « À traiter ». */
3792
3825
  z39.object({ type: z39.literal("task.seen"), op: OperationIdSchema, task: z39.string().min(1).max(40) }),
3793
3826
  /** The routines (routines spec §3.7): answered by `routines`, then each change comes as `routine.changed`. */
@@ -3913,6 +3946,8 @@ var PhoneServerMessageSchema = z39.discriminatedUnion("type", [
3913
3946
  projectEdit: z39.literal(true).optional(),
3914
3947
  /** Issue #16: the snapshot and `projects` carry `sessionOrder`, and the daemon takes `session.order`. */
3915
3948
  sessionOrder: z39.literal(true).optional(),
3949
+ /** The daemon takes `task.answer` (#40): a decision answered from the phone, outside the chat. */
3950
+ taskAnswer: z39.literal(true).optional(),
3916
3951
  /** The daemon takes `device.prefs` and `context.set` (the phone's Réglages); the device then carries its `prefs`. */
3917
3952
  settings: z39.literal(true).optional(),
3918
3953
  /** The daemon sends `usage.state` (its harnesses' limits). */