@cuna_labs/cli 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. package/dist/bin/cuna.js +15 -2
  2. package/dist/bin/cuna.js.map +1 -1
  3. package/dist/cli/command-help.js +2 -2
  4. package/dist/cli/command-help.js.map +1 -1
  5. package/dist/cli/first-line.d.ts +80 -0
  6. package/dist/cli/first-line.d.ts.map +1 -0
  7. package/dist/cli/first-line.js +119 -0
  8. package/dist/cli/first-line.js.map +1 -0
  9. package/dist/cli/help.js +1 -1
  10. package/dist/cli/process-entrypoint.d.ts +3 -0
  11. package/dist/cli/process-entrypoint.d.ts.map +1 -1
  12. package/dist/cli/process-entrypoint.js +3 -1
  13. package/dist/cli/process-entrypoint.js.map +1 -1
  14. package/dist/cli/progress-line.d.ts +78 -0
  15. package/dist/cli/progress-line.d.ts.map +1 -0
  16. package/dist/cli/progress-line.js +94 -0
  17. package/dist/cli/progress-line.js.map +1 -0
  18. package/dist/cli/recorded-launch-prompt.d.ts +83 -0
  19. package/dist/cli/recorded-launch-prompt.d.ts.map +1 -0
  20. package/dist/cli/recorded-launch-prompt.js +80 -0
  21. package/dist/cli/recorded-launch-prompt.js.map +1 -0
  22. package/dist/cli/run.d.ts +19 -0
  23. package/dist/cli/run.d.ts.map +1 -1
  24. package/dist/cli/run.js +233 -75
  25. package/dist/cli/run.js.map +1 -1
  26. package/dist/commands/commands.js +6 -4
  27. package/dist/commands/commands.js.map +1 -1
  28. package/dist/journey/account-identity.d.ts +55 -0
  29. package/dist/journey/account-identity.d.ts.map +1 -0
  30. package/dist/journey/account-identity.js +69 -0
  31. package/dist/journey/account-identity.js.map +1 -0
  32. package/dist/journey/api-effects.d.ts +9 -0
  33. package/dist/journey/api-effects.d.ts.map +1 -1
  34. package/dist/journey/api-effects.js +172 -19
  35. package/dist/journey/api-effects.js.map +1 -1
  36. package/dist/journey/index.d.ts +3 -1
  37. package/dist/journey/index.d.ts.map +1 -1
  38. package/dist/journey/index.js +2 -0
  39. package/dist/journey/index.js.map +1 -1
  40. package/dist/journey/orchestrator.d.ts +24 -0
  41. package/dist/journey/orchestrator.d.ts.map +1 -1
  42. package/dist/journey/orchestrator.js +21 -3
  43. package/dist/journey/orchestrator.js.map +1 -1
  44. package/dist/journey/provider-launch-intent.d.ts +11 -0
  45. package/dist/journey/provider-launch-intent.d.ts.map +1 -1
  46. package/dist/journey/provider-launch-intent.js +50 -15
  47. package/dist/journey/provider-launch-intent.js.map +1 -1
  48. package/dist/journey/remote-workspace.d.ts +11 -0
  49. package/dist/journey/remote-workspace.d.ts.map +1 -1
  50. package/dist/journey/remote-workspace.js +94 -14
  51. package/dist/journey/remote-workspace.js.map +1 -1
  52. package/dist/journey/root-entry.d.ts +15 -0
  53. package/dist/journey/root-entry.d.ts.map +1 -1
  54. package/dist/journey/root-entry.js +18 -6
  55. package/dist/journey/root-entry.js.map +1 -1
  56. package/dist/journey/selection.d.ts +9 -0
  57. package/dist/journey/selection.d.ts.map +1 -1
  58. package/dist/journey/selection.js +14 -2
  59. package/dist/journey/selection.js.map +1 -1
  60. package/dist/journey/session-disposition.d.ts +45 -0
  61. package/dist/journey/session-disposition.d.ts.map +1 -0
  62. package/dist/journey/session-disposition.js +7 -0
  63. package/dist/journey/session-disposition.js.map +1 -0
  64. package/dist/journey/wait-policy.d.ts +218 -0
  65. package/dist/journey/wait-policy.d.ts.map +1 -0
  66. package/dist/journey/wait-policy.js +233 -0
  67. package/dist/journey/wait-policy.js.map +1 -0
  68. package/dist/journey/workspace-effects.d.ts +7 -1
  69. package/dist/journey/workspace-effects.d.ts.map +1 -1
  70. package/dist/journey/workspace-effects.js +131 -14
  71. package/dist/journey/workspace-effects.js.map +1 -1
  72. package/dist/machines/explorer.js +2 -2
  73. package/dist/machines/explorer.js.map +1 -1
  74. package/dist/machines/machine-first.d.ts.map +1 -1
  75. package/dist/machines/machine-first.js +2 -0
  76. package/dist/machines/machine-first.js.map +1 -1
  77. package/dist/machines/session-actionability.js +10 -0
  78. package/dist/machines/session-actionability.js.map +1 -1
  79. package/dist/machines/session-visibility.d.ts +2 -0
  80. package/dist/machines/session-visibility.d.ts.map +1 -1
  81. package/dist/machines/session-visibility.js +5 -0
  82. package/dist/machines/session-visibility.js.map +1 -1
  83. package/dist/platform/process-lock.d.ts +21 -0
  84. package/dist/platform/process-lock.d.ts.map +1 -0
  85. package/dist/platform/process-lock.js +114 -0
  86. package/dist/platform/process-lock.js.map +1 -0
  87. package/dist/runtime/boundary.d.ts +2 -0
  88. package/dist/runtime/boundary.d.ts.map +1 -1
  89. package/dist/runtime/boundary.js +155 -8
  90. package/dist/runtime/boundary.js.map +1 -1
  91. package/dist/runtime/node-foreground-session.d.ts +10 -0
  92. package/dist/runtime/node-foreground-session.d.ts.map +1 -1
  93. package/dist/runtime/node-foreground-session.js +112 -4
  94. package/dist/runtime/node-foreground-session.js.map +1 -1
  95. package/dist/runtime/terminal-client-identity.d.ts +66 -0
  96. package/dist/runtime/terminal-client-identity.d.ts.map +1 -0
  97. package/dist/runtime/terminal-client-identity.js +184 -0
  98. package/dist/runtime/terminal-client-identity.js.map +1 -0
  99. package/dist/runtime/terminal-transport.js +2 -2
  100. package/dist/runtime/terminal-transport.js.map +1 -1
  101. package/dist/sync/continuous-sync-supervisor.d.ts +64 -1
  102. package/dist/sync/continuous-sync-supervisor.d.ts.map +1 -1
  103. package/dist/sync/continuous-sync-supervisor.js +247 -28
  104. package/dist/sync/continuous-sync-supervisor.js.map +1 -1
  105. package/dist/sync/journal.js +9 -39
  106. package/dist/sync/journal.js.map +1 -1
  107. package/dist/sync/workspace-sync-product-service.d.ts +83 -1
  108. package/dist/sync/workspace-sync-product-service.d.ts.map +1 -1
  109. package/dist/sync/workspace-sync-product-service.js +324 -12
  110. package/dist/sync/workspace-sync-product-service.js.map +1 -1
  111. package/dist/terminal/foreground.d.ts.map +1 -1
  112. package/dist/terminal/foreground.js +82 -15
  113. package/dist/terminal/foreground.js.map +1 -1
  114. package/dist/terminal/workbench.d.ts +7 -0
  115. package/dist/terminal/workbench.d.ts.map +1 -1
  116. package/dist/terminal/workbench.js +24 -6
  117. package/dist/terminal/workbench.js.map +1 -1
  118. package/dist/version.d.ts +1 -1
  119. package/dist/version.js +1 -1
  120. package/package.json +1 -1
package/dist/bin/cuna.js CHANGED
@@ -1,4 +1,17 @@
1
1
  #!/usr/bin/env node
2
- import { runProcessCli } from "../cli/process-entrypoint.js";
3
- process.exitCode = await runProcessCli(process.argv.slice(2), { stdin: process.stdin });
2
+ import { paintFirstLine } from "../cli/first-line.js";
3
+ // The first line is painted before the rest of the CLI is imported: loading
4
+ // that graph is most of the time before anything appears (cli/first-line.ts).
5
+ const argv = process.argv.slice(2);
6
+ const firstLine = paintFirstLine(argv, {
7
+ env: process.env,
8
+ stdinIsTTY: process.stdin.isTTY === true,
9
+ stdoutIsTTY: process.stdout.isTTY === true,
10
+ stderr: process.stderr,
11
+ });
12
+ const { runProcessCli } = await import("../cli/process-entrypoint.js");
13
+ process.exitCode = await runProcessCli(argv, {
14
+ stdin: process.stdin,
15
+ ...(firstLine === undefined ? {} : { firstLine }),
16
+ });
4
17
  //# sourceMappingURL=cuna.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"cuna.js","sourceRoot":"","sources":["../../src/bin/cuna.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D,OAAO,CAAC,QAAQ,GAAG,MAAM,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC"}
1
+ {"version":3,"file":"cuna.js","sourceRoot":"","sources":["../../src/bin/cuna.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,4EAA4E;AAC5E,8EAA8E;AAC9E,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACnC,MAAM,SAAS,GAAG,cAAc,CAAC,IAAI,EAAE;IACrC,GAAG,EAAE,OAAO,CAAC,GAAG;IAChB,UAAU,EAAE,OAAO,CAAC,KAAK,CAAC,KAAK,KAAK,IAAI;IACxC,WAAW,EAAE,OAAO,CAAC,MAAM,CAAC,KAAK,KAAK,IAAI;IAC1C,MAAM,EAAE,OAAO,CAAC,MAAM;CACvB,CAAC,CAAC;AACH,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,MAAM,CAAC,8BAA8B,CAAC,CAAC;AACvE,OAAO,CAAC,QAAQ,GAAG,MAAM,aAAa,CAAC,IAAI,EAAE;IAC3C,KAAK,EAAE,OAAO,CAAC,KAAK;IACpB,GAAG,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC;CAClD,CAAC,CAAC"}
@@ -86,8 +86,8 @@ const COMMAND_HELP = Object.freeze({
86
86
  "machines resume": topic("Usage:\n cuna machines resume MACHINE_ID --yes", "Resume one machine when server-advertised.\n\nRequired:\n --yes Confirm this mutating operation"),
87
87
  "machines stop": topic("Usage:\n cuna machines stop MACHINE_ID --yes", "Stop one machine when server-advertised.\n\nRequired:\n --yes Confirm this mutating operation"),
88
88
  "machines update-supervisor": topic("Usage:\n cuna machines update-supervisor MACHINE_ID --yes", [
89
- "Update the terminal supervisor on one stopped OpenCode machine when Cuna",
90
- "reports that exact prerequisite.",
89
+ "Recover the terminal supervisor on one stopped machine.",
90
+ "Cuna verifies eligibility and active-session blockers before updating.",
91
91
  "",
92
92
  "Cuna never stops the machine or terminates AgentSessions for this action.",
93
93
  "End only the sessions you intend to end, stop the Machine yourself, then run it.",
@@ -1 +1 @@
1
- {"version":3,"file":"command-help.js","sourceRoot":"","sources":["../../src/cli/command-help.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,M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
6
+ * takes about 11 ms; everything before it is Node loading the static import
7
+ * graph behind `cli/run.ts`, about 2.2 MB in 138 files, ~98% of the time to the
8
+ * first line. The same unchanged build painted at 499 ms on a quiet host and at
9
+ * 1 391 ms on a loaded one, so no change inside that graph can hold the line
10
+ * down. `bin/cuna.ts` therefore imports only this module (and the small ones it
11
+ * needs), paints here, and only then loads the rest.
12
+ *
13
+ * WHAT IT MAY PAINT, EXACTLY. Only the row `runCli` would itself paint first,
14
+ * decided by the same calls in the same order: the `Starting Cuna` row for an
15
+ * interactive bare `cuna`, and the `Preparing …` row for `cuna claude`, `codex`
16
+ * or `opencode` once `assertRegisteredCliRoute` and
17
+ * `preflightAgentJourneyInvocation` accept the arguments. Nothing is painted
18
+ * unless stdin, stdout and stderr are all terminals and `--json` is absent, so a
19
+ * redirected or structured invocation writes exactly what it wrote before.
20
+ *
21
+ * HOW IT IS HANDED OVER. The paint site in `cli/run.ts` that would have drawn
22
+ * this row `claim`s it and continues from frame 1 without drawing frame 0
23
+ * again. If `runCli` fails before that site, its error path `release`s the row
24
+ * first, so the error is not written onto the end of it.
25
+ */
26
+ export declare const ROOT_FIRST_LINE_LABEL = "Starting Cuna";
27
+ export declare function agentDisplayName(agent: string): string;
28
+ export declare function journeyPreparationLabel(agent: string): string;
29
+ export interface FirstLineDecision {
30
+ readonly kind: "root" | "journey";
31
+ readonly label: string;
32
+ readonly color: boolean;
33
+ }
34
+ /** What a paint site needs to continue a row it did not draw. */
35
+ export interface PaintedFirstLine {
36
+ readonly paintedAt: number;
37
+ readonly columns: number;
38
+ readonly cells: number;
39
+ }
40
+ export interface FirstLine {
41
+ /**
42
+ * Hand the painted row to the paint site that would have drawn `expected`.
43
+ * Answers once: a different row, colour or stream releases it instead, and so
44
+ * does every later call, so a nested `runCli` can never take it a second time.
45
+ */
46
+ claim(expected: FirstLineDecision & {
47
+ readonly stream: Writable;
48
+ }): PaintedFirstLine | undefined;
49
+ /** Clear the row unless a paint site already took it. Safe to call again. */
50
+ release(): void;
51
+ }
52
+ /**
53
+ * The row `runCli` will paint first for this invocation, or `undefined` when it
54
+ * would paint nothing first or something this module cannot prove.
55
+ */
56
+ export declare function firstLineFor(argv: readonly string[], context: {
57
+ readonly env: NodeJS.ProcessEnv;
58
+ readonly stdinIsTTY: boolean;
59
+ readonly stdoutIsTTY: boolean;
60
+ readonly stderrIsTTY: boolean;
61
+ }): FirstLineDecision | undefined;
62
+ /** Frame 0 of the row, exactly as `startInlineProgress` would paint it. */
63
+ export declare function firstLineFrame(label: string, color: boolean, columns: number): {
64
+ readonly bytes: string;
65
+ readonly cells: number;
66
+ };
67
+ /**
68
+ * Paint the first line if this invocation has one, and return the handle that
69
+ * gives it to `runCli`.
70
+ */
71
+ export declare function paintFirstLine(argv: readonly string[], host: {
72
+ readonly env: NodeJS.ProcessEnv;
73
+ readonly stdinIsTTY: boolean;
74
+ readonly stdoutIsTTY: boolean;
75
+ readonly stderr: Writable & {
76
+ readonly isTTY?: boolean;
77
+ };
78
+ readonly now?: () => number;
79
+ }): FirstLine | undefined;
80
+ //# sourceMappingURL=first-line.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"first-line.d.ts","sourceRoot":"","sources":["../../src/cli/first-line.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAU5C;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,eAAO,MAAM,qBAAqB,kBAAkB,CAAC;AAErD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAKtD;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAI7D;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB;AAED,iEAAiE;AACjE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KAAE,CAAC;IACzD,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CAC7B,GACA,SAAS,GAAG,SAAS,CA+BvB"}
@@ -0,0 +1,119 @@
1
+ import { assertRegisteredCliRoute, booleanOption, parseArgv } from "./parser.js";
2
+ import { preflightAgentJourneyInvocation } from "../journey/intent.js";
3
+ import { composeInlineProgressLine, inlineProgressColumns, renderInlineProgressFrame, } from "./progress-line.js";
4
+ import { terminalCellWidth } from "../terminal/cell-width.js";
5
+ /**
6
+ * THE FIRST TRUTHFUL LINE, PAINTED BEFORE THE CLI'S CODE HAS LOADED.
7
+ *
8
+ * WHY THIS FILE EXISTS. Measured 2026-09-22: from `runCli` to the first paint
9
+ * takes about 11 ms; everything before it is Node loading the static import
10
+ * graph behind `cli/run.ts`, about 2.2 MB in 138 files, ~98% of the time to the
11
+ * first line. The same unchanged build painted at 499 ms on a quiet host and at
12
+ * 1 391 ms on a loaded one, so no change inside that graph can hold the line
13
+ * down. `bin/cuna.ts` therefore imports only this module (and the small ones it
14
+ * needs), paints here, and only then loads the rest.
15
+ *
16
+ * WHAT IT MAY PAINT, EXACTLY. Only the row `runCli` would itself paint first,
17
+ * decided by the same calls in the same order: the `Starting Cuna` row for an
18
+ * interactive bare `cuna`, and the `Preparing …` row for `cuna claude`, `codex`
19
+ * or `opencode` once `assertRegisteredCliRoute` and
20
+ * `preflightAgentJourneyInvocation` accept the arguments. Nothing is painted
21
+ * unless stdin, stdout and stderr are all terminals and `--json` is absent, so a
22
+ * redirected or structured invocation writes exactly what it wrote before.
23
+ *
24
+ * HOW IT IS HANDED OVER. The paint site in `cli/run.ts` that would have drawn
25
+ * this row `claim`s it and continues from frame 1 without drawing frame 0
26
+ * again. If `runCli` fails before that site, its error path `release`s the row
27
+ * first, so the error is not written onto the end of it.
28
+ */
29
+ export const ROOT_FIRST_LINE_LABEL = "Starting Cuna";
30
+ export function agentDisplayName(agent) {
31
+ return agent === "claude-code" ? "Claude Code"
32
+ : agent === "codex" ? "Codex"
33
+ : agent === "opencode" ? "OpenCode"
34
+ : "OpenClaw";
35
+ }
36
+ export function journeyPreparationLabel(agent) {
37
+ return agent === "opencode"
38
+ ? "Preparing OpenCode — use /connect in its terminal"
39
+ : `Preparing ${agentDisplayName(agent)}`;
40
+ }
41
+ /**
42
+ * The row `runCli` will paint first for this invocation, or `undefined` when it
43
+ * would paint nothing first or something this module cannot prove.
44
+ */
45
+ export function firstLineFor(argv, context) {
46
+ if (!context.stdinIsTTY || !context.stdoutIsTTY || !context.stderrIsTTY)
47
+ return undefined;
48
+ if (argv.includes("--json"))
49
+ return undefined;
50
+ try {
51
+ const parsed = parseArgv(argv);
52
+ if (parsed.command === "help" || parsed.command === "version" ||
53
+ booleanOption(parsed, "help") || booleanOption(parsed, "version"))
54
+ return undefined;
55
+ const color = !booleanOption(parsed, "no-color") && !Object.hasOwn(context.env, "NO_COLOR");
56
+ if (parsed.command === undefined) {
57
+ // `runCli` refuses any other option on a bare invocation before it paints.
58
+ const allowed = new Set(["help", "version", "json", "no-color"]);
59
+ if (Object.keys(parsed.options).some((name) => !allowed.has(name)))
60
+ return undefined;
61
+ return Object.freeze({ kind: "root", label: ROOT_FIRST_LINE_LABEL, color });
62
+ }
63
+ if (parsed.command !== "claude" && parsed.command !== "codex" && parsed.command !== "opencode")
64
+ return undefined;
65
+ assertRegisteredCliRoute(parsed);
66
+ const intent = preflightAgentJourneyInvocation(parsed);
67
+ return Object.freeze({ kind: "journey", label: journeyPreparationLabel(intent.agent), color });
68
+ }
69
+ catch {
70
+ // Every refusal here is `runCli`'s to render, in its own words.
71
+ return undefined;
72
+ }
73
+ }
74
+ /** Frame 0 of the row, exactly as `startInlineProgress` would paint it. */
75
+ export function firstLineFrame(label, color, columns) {
76
+ const { headline, trailer } = composeInlineProgressLine({ label, labelElapsedMs: 0, totalElapsedMs: 0 });
77
+ const { styled, fitted } = renderInlineProgressFrame({ headline, trailer, frame: 0, columns, color });
78
+ return Object.freeze({ bytes: `\r\u001b[2K${styled}`, cells: terminalCellWidth(fitted) });
79
+ }
80
+ /**
81
+ * Paint the first line if this invocation has one, and return the handle that
82
+ * gives it to `runCli`.
83
+ */
84
+ export function paintFirstLine(argv, host) {
85
+ const decision = firstLineFor(argv, {
86
+ env: host.env,
87
+ stdinIsTTY: host.stdinIsTTY,
88
+ stdoutIsTTY: host.stdoutIsTTY,
89
+ stderrIsTTY: host.stderr.isTTY === true,
90
+ });
91
+ if (decision === undefined)
92
+ return undefined;
93
+ const columns = inlineProgressColumns(host.stderr);
94
+ const frame = firstLineFrame(decision.label, decision.color, columns);
95
+ const paintedAt = (host.now ?? Date.now)();
96
+ host.stderr.write(frame.bytes);
97
+ let open = true;
98
+ const release = () => {
99
+ if (!open)
100
+ return;
101
+ open = false;
102
+ host.stderr.write("\r\u001b[2K");
103
+ };
104
+ return Object.freeze({
105
+ claim(expected) {
106
+ if (!open)
107
+ return undefined;
108
+ if (expected.stream !== host.stderr || expected.kind !== decision.kind ||
109
+ expected.label !== decision.label || expected.color !== decision.color) {
110
+ release();
111
+ return undefined;
112
+ }
113
+ open = false;
114
+ return Object.freeze({ paintedAt, columns, cells: frame.cells });
115
+ },
116
+ release,
117
+ });
118
+ }
119
+ //# sourceMappingURL=first-line.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"first-line.js","sourceRoot":"","sources":["../../src/cli/first-line.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACjF,OAAO,EAAE,+BAA+B,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,EACL,yBAAyB,EACzB,qBAAqB,EACrB,yBAAyB,GAC1B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAE9D;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,MAAM,CAAC,MAAM,qBAAqB,GAAG,eAAe,CAAC;AAErD,MAAM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,QAAQ,CAAC,KAAK,KAAK,QAAQ,CAAC,KAAK,IAAI,QAAQ,CAAC,KAAK,KAAK,QAAQ,CAAC,KAAK,EAAE,CAAC;gBACzE,OAAO,EAAE,CAAC;gBACV,OAAO,SAAS,CAAC;YACnB,CAAC;YACD,IAAI,GAAG,KAAK,CAAC;YACb,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC;QACnE,CAAC;QACD,OAAO;KACR,CAAC,CAAC;AACL,CAAC"}
package/dist/cli/help.js CHANGED
@@ -137,7 +137,7 @@ Available now:
137
137
  machines list List owned Cuna machines
138
138
  machines create [options] Create a machine when server-advertised
139
139
  machines start|pause|resume|stop ID Change lifecycle when server-advertised
140
- machines update-supervisor ID Update a stopped OpenCode terminal supervisor
140
+ machines update-supervisor ID Recover a stopped machine's terminal supervisor
141
141
  machines live-update-supervisor ID Update a running terminal supervisor in place;
142
142
  reports one custody line per AgentSession
143
143
  machines live-update-status ID Read what one in-place update did; sends nothing
@@ -1,4 +1,5 @@
1
1
  import { runCli } from "./run.js";
2
+ import type { FirstLine } from "./first-line.js";
2
3
  type SupportedProcessSignal = "SIGINT" | "SIGTERM" | "SIGHUP";
3
4
  export interface ProcessSignalHost {
4
5
  once(signal: SupportedProcessSignal, listener: () => void): unknown;
@@ -13,6 +14,8 @@ export declare function runProcessCli(argv: readonly string[], input?: {
13
14
  /** The real process stdin, supplied only by the executable entrypoint. */
14
15
  readonly stdin?: ProcessInputHost;
15
16
  readonly run?: typeof runCli;
17
+ /** The row the executable painted before this module loaded; see `cli/first-line.ts`. */
18
+ readonly firstLine?: FirstLine;
16
19
  }): Promise<number>;
17
20
  export {};
18
21
  //# sourceMappingURL=process-entrypoint.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"process-entrypoint.d.ts","sourceRoot":"","sources":["../../src/cli/process-entrypoint.ts"],"names":[],"mappings":"AAAA,OAA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,IAAI,OAAO,CAAC;CACpB;AAED,wBAAsB,aAAa,CACjC,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,KAAK,GAAE;IACL,QAAQ,CAAC,IAAI,CAAC,EAAE,iBAAiB,CAAC;IAClC,0EAA0E;IAC1E,QAAQ,CAAC,KAAK,CAAC,EAAE,gBAAgB,CAAC;IAClC,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAO,MAAM,CAAC;IAC7B,yFAAyF;IACzF,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC;CAC3B,GACL,OAAO,CAAC,MAAM,CAAC,CAwBjB"}
@@ -10,9 +10,11 @@ export async function runProcessCli(argv, input = {}) {
10
10
  host.once("SIGTERM", terminate);
11
11
  host.once("SIGHUP", hangup);
12
12
  try {
13
- return await run(argv, { signal: controller.signal });
13
+ return await run(argv, { signal: controller.signal, ...(input.firstLine === undefined ? {} : { firstLine: input.firstLine }) });
14
14
  }
15
15
  finally {
16
+ // A row nothing took over must not outlive the command on the prompt line.
17
+ input.firstLine?.release();
16
18
  host.removeListener("SIGINT", interrupt);
17
19
  host.removeListener("SIGTERM", terminate);
18
20
  host.removeListener("SIGHUP", hangup);
@@ -1 +1 @@
1
- {"version":3,"file":"process-entrypoint.js","sourceRoot":"","sources":["../../src/cli/process-entrypoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAclC,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,IAAuB,EACvB,QAKI,EAAE;IAEN,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,IAAI,OAAO,CAAC;IACnC,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,IAAI,MAAM,CAAC;IAChC,MAAM,UAAU,GAAG,IAAI,eAAe,EAAE,CAAC;IACzC,MAAM,SAAS,GAAG,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC,CAAC;IACvF,MA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 +1,78 @@
1
+ import type { Writable } from "node:stream";
2
+ import { type JourneyWait } from "../journey/wait-policy.js";
3
+ import type { JourneyAgentSessionDisposition } from "../journey/orchestrator.js";
4
+ /**
5
+ * What the one inline progress row SAYS, separated from how it is painted.
6
+ *
7
+ * WHY IT IS ITS OWN FILE. The paint loop owns cursor control, terminal width,
8
+ * colour and a 90 ms timer; none of that can be asserted without a real clock
9
+ * and a real TTY, and the defect being repaired here is entirely about words.
10
+ * Measured 2026-09-22 (`prds/cuna-cli-latency-before-20260922.md` § 3): the row
11
+ * repainted every 90 ms for 61 259 ms while saying the same eleven words, so
12
+ * every byte-level liveness check passed and the screen was still frozen to a
13
+ * reader. Keeping the sentence testable is the only way that stays fixed.
14
+ */
15
+ /**
16
+ * When the elapsed counter joins the label.
17
+ *
18
+ * DERIVATION. The goal's own silence threshold is 2 000 ms, and the measured
19
+ * dwell floor worth reporting was `Preparing Claude Code` at 2.0–3.7 s in
20
+ * all five runs (§ 3, finding 4). Below this a step is finishing normally and
21
+ * a counter is noise; above it, the number is the only evidence a person has.
22
+ */
23
+ export declare const INLINE_DWELL_HINT_MS = 2000;
24
+ /**
25
+ * When the Ctrl-C affordance joins the line. Unchanged from the behaviour this
26
+ * replaces, and deliberately measured against the WHOLE command rather than
27
+ * the current step: the affordance is about this process, and resetting it on
28
+ * every phase change would hide it from exactly the long journeys that need it.
29
+ */
30
+ export declare const INLINE_CANCEL_HINT_MS = 12000;
31
+ export interface InlineProgressLineInput {
32
+ readonly label: string;
33
+ /** Present while a declared wait owns the row; it supplies its own sentence. */
34
+ readonly waiting?: JourneyWait | undefined;
35
+ /** How long the CURRENT label has been on screen, not the whole command. */
36
+ readonly labelElapsedMs: number;
37
+ readonly totalElapsedMs: number;
38
+ }
39
+ export interface InlineProgressLine {
40
+ /** The bright half: the step, or the wait that replaced it. */
41
+ readonly headline: string;
42
+ /** The dim half: elapsed seconds and the cancel affordance. */
43
+ readonly trailer: string;
44
+ }
45
+ export declare function composeInlineProgressLine(input: InlineProgressLineInput): InlineProgressLine;
46
+ /**
47
+ * One painted frame of the row, as the bytes after `\r\x1b[2K`.
48
+ *
49
+ * Here rather than inside the paint loop because two writers must produce the
50
+ * same frame: `cli/first-line.ts` paints frame 0 before the CLI's modules have
51
+ * loaded, and the loop in `cli/run.ts` takes the row over from frame 1. Two
52
+ * spellings of one frame would show as a flicker at the handover.
53
+ */
54
+ export declare function renderInlineProgressFrame(input: {
55
+ readonly headline: string;
56
+ readonly trailer: string;
57
+ readonly frame: number;
58
+ readonly columns: number;
59
+ readonly color: boolean;
60
+ }): {
61
+ readonly styled: string;
62
+ readonly fitted: string;
63
+ };
64
+ export declare function inlineProgressColumns(stream: Writable): number;
65
+ /**
66
+ * The one durable line that says which AgentSession this journey settled on.
67
+ *
68
+ * Measured 2026-09-22 (§ 2, finding (ii)): no such line existed. The CLI
69
+ * printed the intent `Creating Claude Code session` and never a completion, so
70
+ * the row `00b6d65a` was created at t+11 446 ms while the screen still read
71
+ * `Starting Claude Code`, and nothing named it for the rest of the run; the
72
+ * only thing resembling a reuse statement was a QUESTION. The id is shown as
73
+ * an 8-character prefix, the truncation `runtime/owner-grants-screen.ts`
74
+ * already uses when it puts a resource id on screen, so it can never read as a
75
+ * whole identifier.
76
+ */
77
+ export declare function agentSessionDispositionLine(event: JourneyAgentSessionDisposition): string;
78
+ //# sourceMappingURL=progress-line.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"progress-line.d.ts","sourceRoot":"","sources":["../../src/cli/progress-line.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAmB,KAAK,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAC9E,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,4BAA4B,CAAC;AAGjF;;;;;;;;;;GAUG;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,OAAQ,CAAC;AAE1C;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,QAAS,CAAC;AAE5C,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,gFAAgF;IAChF,QAAQ,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;IAC3C,4EAA4E;IAC5E,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;CACjC;AAED,MAAM,WAAW,kBAAkB;IACjC,+DAA+D;IAC/D,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,+DAA+D;IAC/D,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,uBAAuB,GAAG,kBAAkB,CAU5F;AAKD;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE;IAC/C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB,GAAG;IAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CASvD;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,QAAQ,GAAG,MAAM,CAkB9D;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,8BAA8B,GAAG,MAAM,CAEzF"}
@@ -0,0 +1,94 @@
1
+ import { journeyWaitLine } from "../journey/wait-policy.js";
2
+ import { truncateTerminalLine } from "../terminal/cell-width.js";
3
+ /**
4
+ * What the one inline progress row SAYS, separated from how it is painted.
5
+ *
6
+ * WHY IT IS ITS OWN FILE. The paint loop owns cursor control, terminal width,
7
+ * colour and a 90 ms timer; none of that can be asserted without a real clock
8
+ * and a real TTY, and the defect being repaired here is entirely about words.
9
+ * Measured 2026-09-22 (`prds/cuna-cli-latency-before-20260922.md` § 3): the row
10
+ * repainted every 90 ms for 61 259 ms while saying the same eleven words, so
11
+ * every byte-level liveness check passed and the screen was still frozen to a
12
+ * reader. Keeping the sentence testable is the only way that stays fixed.
13
+ */
14
+ /**
15
+ * When the elapsed counter joins the label.
16
+ *
17
+ * DERIVATION. The goal's own silence threshold is 2 000 ms, and the measured
18
+ * dwell floor worth reporting was `Preparing Claude Code` at 2.0–3.7 s in
19
+ * all five runs (§ 3, finding 4). Below this a step is finishing normally and
20
+ * a counter is noise; above it, the number is the only evidence a person has.
21
+ */
22
+ export const INLINE_DWELL_HINT_MS = 2_000;
23
+ /**
24
+ * When the Ctrl-C affordance joins the line. Unchanged from the behaviour this
25
+ * replaces, and deliberately measured against the WHOLE command rather than
26
+ * the current step: the affordance is about this process, and resetting it on
27
+ * every phase change would hide it from exactly the long journeys that need it.
28
+ */
29
+ export const INLINE_CANCEL_HINT_MS = 12_000;
30
+ export function composeInlineProgressLine(input) {
31
+ const headline = input.waiting === undefined ? input.label : journeyWaitLine(input.waiting);
32
+ // A wait headline already carries its own seconds AND its deadline, which is
33
+ // strictly more than the counter would add. Two elapsed figures on one row
34
+ // is the kind of thing a reader has to stop and reconcile.
35
+ const dwellHint = input.waiting === undefined && input.labelElapsedMs >= INLINE_DWELL_HINT_MS
36
+ ? ` · ${Math.floor(input.labelElapsedMs / 1_000)}s`
37
+ : "";
38
+ const cancelHint = input.totalElapsedMs >= INLINE_CANCEL_HINT_MS ? " — Ctrl-C cancels" : "";
39
+ return Object.freeze({ headline, trailer: `${dwellHint}${cancelHint}` });
40
+ }
41
+ const INLINE_PROGRESS_SPINNER = Object.freeze(["◐", "◓", "◑", "◒"]);
42
+ const INLINE_PROGRESS_BARS = Object.freeze(["━╺━━━━", "━━╺━━━", "━━━╺━━", "━━━━╺━", "━━━━━╺", "━━━━╸━", "━━━╸━━", "━━╸━━━"]);
43
+ /**
44
+ * One painted frame of the row, as the bytes after `\r\x1b[2K`.
45
+ *
46
+ * Here rather than inside the paint loop because two writers must produce the
47
+ * same frame: `cli/first-line.ts` paints frame 0 before the CLI's modules have
48
+ * loaded, and the loop in `cli/run.ts` takes the row over from frame 1. Two
49
+ * spellings of one frame would show as a flicker at the handover.
50
+ */
51
+ export function renderInlineProgressFrame(input) {
52
+ const spinner = INLINE_PROGRESS_SPINNER[input.frame % INLINE_PROGRESS_SPINNER.length];
53
+ const bar = INLINE_PROGRESS_BARS[input.frame % INLINE_PROGRESS_BARS.length];
54
+ const text = `◆ CUNA ${spinner} ${input.headline}${input.trailer} ${bar}`;
55
+ const fitted = truncateTerminalLine(text, input.columns - 1);
56
+ const styled = input.color && fitted === text
57
+ ? `\u001b[38;5;202m\u001b[1m◆ CUNA\u001b[0m \u001b[38;5;202m${spinner}\u001b[0m \u001b[38;5;255m\u001b[1m${input.headline}\u001b[0m\u001b[38;5;245m${input.trailer}\u001b[0m \u001b[38;5;208m${bar}\u001b[0m`
58
+ : input.color ? `\u001b[38;5;255m${fitted}\u001b[0m` : fitted;
59
+ return Object.freeze({ styled, fitted });
60
+ }
61
+ export function inlineProgressColumns(stream) {
62
+ const tty = stream;
63
+ // Node 24 on Windows can retain stale public columns after ConPTY resize.
64
+ // Read this stream's native TTY observation without changing its prototype
65
+ // or cached fields. This guarded private API depends on the supported Node
66
+ // engine; absent/failed/malformed observations retain the ordinary fallback.
67
+ if (process.platform === "win32" && typeof tty._handle?.getWindowSize === "function") {
68
+ try {
69
+ const size = [];
70
+ if (tty._handle.getWindowSize(size) === 0 && size.length === 2 &&
71
+ Number.isSafeInteger(size[0]) && size[0] >= 2 && size[0] <= 4096 &&
72
+ Number.isSafeInteger(size[1]) && size[1] >= 1 && size[1] <= 4096)
73
+ return size[0];
74
+ }
75
+ catch { /* An unavailable native observation does not break progress. */ }
76
+ }
77
+ return Number.isSafeInteger(tty.columns) && tty.columns >= 2 && tty.columns <= 4096 ? tty.columns : 80;
78
+ }
79
+ /**
80
+ * The one durable line that says which AgentSession this journey settled on.
81
+ *
82
+ * Measured 2026-09-22 (§ 2, finding (ii)): no such line existed. The CLI
83
+ * printed the intent `Creating Claude Code session` and never a completion, so
84
+ * the row `00b6d65a` was created at t+11 446 ms while the screen still read
85
+ * `Starting Claude Code`, and nothing named it for the rest of the run; the
86
+ * only thing resembling a reuse statement was a QUESTION. The id is shown as
87
+ * an 8-character prefix, the truncation `runtime/owner-grants-screen.ts`
88
+ * already uses when it puts a resource id on screen, so it can never read as a
89
+ * whole identifier.
90
+ */
91
+ export function agentSessionDispositionLine(event) {
92
+ return `AgentSession ${event.agentSessionId.slice(0, 8)} · ${event.disposition}`;
93
+ }
94
+ //# sourceMappingURL=progress-line.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"progress-line.js","sourceRoot":"","sources":["../../src/cli/progress-line.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAoB,MAAM,2BAA2B,CAAC;AAE9E,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE;;;;;;;;;;GAUG;AAEH;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,CAAC;AAE1C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAC;AAkB5C,MAAM,UAAU,yBAAyB,CAAC,KAA8B;IACtE,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,eAAe,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC5F,6EAA6E;IAC7E,2EAA2E;IAC3E,2DAA2D;IAC3D,MAAM,SAAS,GAAG,KAAK,CAAC,OAAO,KAAK,SAAS,IAAI,KAAK,CAAC,cAAc,IAAI,oBAAoB;QAC3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CAAC,CAAC,EAAE,CAAC;AAC5G,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,2BAA2B,CAAC,KAAqC;IAC/E,OAAO,gBAAgB,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,MAAM,KAAK,CAAC,WAAW,EAAE,CAAC;AACnF,CAAC"}
@@ -0,0 +1,83 @@
1
+ /**
2
+ * THE ONE QUESTION THE CLI ASKS MID-JOURNEY, AND WHAT THE SCREEN OWES THE
3
+ * PERSON THE MOMENT THEY ANSWER IT.
4
+ *
5
+ * WHY THIS IS A MODULE AND NOT FOUR LINES IN `run.ts`. Measured 2026-09-22
6
+ * (`prds/cuna-cli-latency-before-20260922.md` § 3, finding 1): after this
7
+ * answer was accepted, the terminal went BYTE-silent — no output at all, not a
8
+ * repeating spinner — for 2 317 ms, 3 864 ms and 18 314 ms in three of five
9
+ * runs. The screen froze on the person's own keystroke, which is the worst
10
+ * shape a stall can take, because the last thing they did is the thing that
11
+ * appears to have broken it.
12
+ *
13
+ * The cause was structural: the question gave the progress row up in order to
14
+ * be readable, and nothing took the row back until the next remote step
15
+ * happened to report. Whatever that step cost was silence. So the repair is not
16
+ * "make the next step faster" — it is that the answer itself is an event worth
17
+ * rendering, and it is rendered from the branch that was actually taken rather
18
+ * than from the question that was asked.
19
+ *
20
+ * Keeping it here rather than inline is what makes that assertable: `run.ts`
21
+ * reaches this code only through a real TTY, a real `process.stdin` and a
22
+ * 90 ms paint timer, none of which can express the defect, which was entirely
23
+ * about WHEN a line appears relative to an answer.
24
+ */
25
+ /**
26
+ * Asked verbatim, and quoted verbatim in the measurement, so the two can be
27
+ * compared without guessing which build produced a transcript.
28
+ */
29
+ export declare const RECORDED_LAUNCH_QUESTION = "A previous launch is recorded. Create another session? [y/N; No resumes the recorded launch] ";
30
+ /**
31
+ * How long the screen may stay unchanged after the answer is accepted.
32
+ *
33
+ * DERIVATION. Not a tuning knob: it is the bound this module exists to hold,
34
+ * and it is deliberately far below the 2 000 ms threshold the measurement used
35
+ * to call a stall a stall, because a stall that begins on the person's own
36
+ * keypress reads as a crash rather than as waiting. The measured worst case was
37
+ * 18 314 ms, which is 36 times this.
38
+ */
39
+ export declare const RECORDED_LAUNCH_ACKNOWLEDGEMENT_BUDGET_MS = 500;
40
+ /**
41
+ * What answers the recorded-launch question for a folder journey.
42
+ * `--new-session` is that answer already given on the command line, so it is
43
+ * not asked again: asking let a No, or a slow answer, override the flag (qa6
44
+ * witness 2026-09-22). Without the flag the person is asked.
45
+ */
46
+ export declare function recordedLaunchConfirmation<S>(newSessionFlag: boolean, ask: (signal: S) => Promise<boolean>): (signal: S) => Promise<boolean>;
47
+ /** Only an explicit yes creates; anything else, including empty, resumes. */
48
+ export declare function recordedLaunchWantsNewSession(answer: string): boolean;
49
+ /**
50
+ * What the screen says next, named for the branch that was taken rather than
51
+ * for the question that was asked.
52
+ *
53
+ * `No` resumes a launch that already exists, and calling that "Creating" would
54
+ * be the CLI announcing work it is not about to do — which is the same defect
55
+ * as the silence, one layer up: a screen that does not describe what is
56
+ * happening.
57
+ */
58
+ export declare function recordedLaunchAcknowledgement(wantsNewSession: boolean, createLabel: string): string;
59
+ export interface RecordedLaunchPromptInput {
60
+ /**
61
+ * Asks the question and resolves with the raw answer. It MUST complete its
62
+ * own teardown before resolving: the acknowledgement writes to the same
63
+ * stream, and a line painted underneath a live readline fights it for the
64
+ * cursor.
65
+ */
66
+ readonly ask: (question: string) => Promise<string>;
67
+ /** Puts the acknowledgement on screen. Called before this function resolves. */
68
+ readonly acknowledge: (line: string) => void;
69
+ /** What the create branch is called, e.g. `Creating Claude Code session`. */
70
+ readonly createLabel: string;
71
+ }
72
+ /**
73
+ * Ask the recorded-launch question and answer the screen at once.
74
+ *
75
+ * THE BOUND THIS GIVES, STATED EXACTLY. `acknowledge` is called synchronously
76
+ * between the answer arriving and this function resolving, so no remote work
77
+ * can be dispatched in between — not because a timer says so, but because
78
+ * there is nowhere for it to go. The caller therefore cannot reintroduce the
79
+ * measured silence by being slow; it can only reintroduce it by writing
80
+ * nothing, which is what `acknowledge` exists to prevent.
81
+ */
82
+ export declare function askRecordedLaunch(input: RecordedLaunchPromptInput): Promise<boolean>;
83
+ //# sourceMappingURL=recorded-launch-prompt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recorded-launch-prompt.d.ts","sourceRoot":"","sources":["../../src/cli/recorded-launch-prompt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH;;;GAGG;AACH,eAAO,MAAM,wBAAwB,kGAC4D,CAAC;AAElG;;;;;;;;GAQG;AACH,eAAO,MAAM,yCAAyC,MAAM,CAAC;AAE7D;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,CAAC,EAC1C,cAAc,EAAE,OAAO,EACvB,GAAG,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,OAAO,CAAC,OAAO,CAAC,GACnC,CAAC,MAAM,EAAE,CAAC,KAAK,OAAO,CAAC,OAAO,CAAC,CAEjC;AAED,6EAA6E;AAC7E,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAErE;AAED;;;;;;;;GAQG;AACH,wBAAgB,6BAA6B,CAAC,eAAe,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAEnG;AAED,MAAM,WAAW,yBAAyB;IACxC;;;;;OAKG;IACH,QAAQ,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACpD,gFAAgF;IAChF,QAAQ,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7C,6EAA6E;IAC7E,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED;;;;;;;;;GASG;AACH,wBAAsB,iBAAiB,CAAC,KAAK,EAAE,yBAAyB,GAAG,OAAO,CAAC,OAAO,CAAC,CAI1F"}