@mono-agent/tui 0.4.0 → 0.4.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 (124) hide show
  1. package/README.md +60 -10
  2. package/dist/bin/cli.d.ts +4 -1
  3. package/dist/bin/cli.d.ts.map +1 -1
  4. package/dist/bin/cli.js +36 -53
  5. package/dist/bin/cli.js.map +1 -1
  6. package/dist/bin/mono-agent-tui.js +21 -10
  7. package/dist/bin/mono-agent-tui.js.map +1 -1
  8. package/dist/config/pane.d.ts +9 -9
  9. package/dist/config/pane.d.ts.map +1 -1
  10. package/dist/config/pane.js +15 -196
  11. package/dist/config/pane.js.map +1 -1
  12. package/dist/data/instances.d.ts +48 -0
  13. package/dist/data/instances.d.ts.map +1 -0
  14. package/dist/data/instances.js +101 -0
  15. package/dist/data/instances.js.map +1 -0
  16. package/dist/data/replay.d.ts +68 -0
  17. package/dist/data/replay.d.ts.map +1 -0
  18. package/dist/data/replay.js +149 -0
  19. package/dist/data/replay.js.map +1 -0
  20. package/dist/index.d.ts +10 -10
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/index.js +5 -5
  23. package/dist/index.js.map +1 -1
  24. package/dist/remote/client.d.ts +44 -0
  25. package/dist/remote/client.d.ts.map +1 -0
  26. package/dist/remote/client.js +173 -0
  27. package/dist/remote/client.js.map +1 -0
  28. package/dist/runtime/start.d.ts +11 -18
  29. package/dist/runtime/start.d.ts.map +1 -1
  30. package/dist/runtime/start.js +19 -33
  31. package/dist/runtime/start.js.map +1 -1
  32. package/dist/ui/app.d.ts +142 -0
  33. package/dist/ui/app.d.ts.map +1 -0
  34. package/dist/ui/app.js +586 -0
  35. package/dist/ui/app.js.map +1 -0
  36. package/dist/ui/components/event-list.d.ts +60 -0
  37. package/dist/ui/components/event-list.d.ts.map +1 -0
  38. package/dist/ui/components/event-list.js +369 -0
  39. package/dist/ui/components/event-list.js.map +1 -0
  40. package/dist/ui/components/status-bar.d.ts +65 -0
  41. package/dist/ui/components/status-bar.d.ts.map +1 -0
  42. package/dist/ui/components/status-bar.js +126 -0
  43. package/dist/ui/components/status-bar.js.map +1 -0
  44. package/dist/ui/components/tool-panel.d.ts +30 -0
  45. package/dist/ui/components/tool-panel.d.ts.map +1 -0
  46. package/dist/ui/components/tool-panel.js +59 -0
  47. package/dist/ui/components/tool-panel.js.map +1 -0
  48. package/dist/ui/components/transcript-cells.d.ts +49 -0
  49. package/dist/ui/components/transcript-cells.d.ts.map +1 -0
  50. package/dist/ui/components/transcript-cells.js +110 -0
  51. package/dist/ui/components/transcript-cells.js.map +1 -0
  52. package/dist/ui/format.d.ts +29 -0
  53. package/dist/ui/format.d.ts.map +1 -0
  54. package/dist/ui/format.js +105 -0
  55. package/dist/ui/format.js.map +1 -0
  56. package/dist/ui/theme.d.ts +25 -0
  57. package/dist/ui/theme.d.ts.map +1 -0
  58. package/dist/ui/theme.js +62 -0
  59. package/dist/ui/theme.js.map +1 -0
  60. package/dist/ui/turn-presenter.d.ts +72 -0
  61. package/dist/ui/turn-presenter.d.ts.map +1 -0
  62. package/dist/ui/turn-presenter.js +334 -0
  63. package/dist/ui/turn-presenter.js.map +1 -0
  64. package/dist/ui/views/chat.d.ts +128 -0
  65. package/dist/ui/views/chat.d.ts.map +1 -0
  66. package/dist/ui/views/chat.js +313 -0
  67. package/dist/ui/views/chat.js.map +1 -0
  68. package/dist/ui/views/config.d.ts +23 -0
  69. package/dist/ui/views/config.d.ts.map +1 -0
  70. package/dist/ui/views/config.js +87 -0
  71. package/dist/ui/views/config.js.map +1 -0
  72. package/dist/ui/views/picker.d.ts +17 -0
  73. package/dist/ui/views/picker.d.ts.map +1 -0
  74. package/dist/ui/views/picker.js +57 -0
  75. package/dist/ui/views/picker.js.map +1 -0
  76. package/dist/ui/views/replay-detail.d.ts +60 -0
  77. package/dist/ui/views/replay-detail.d.ts.map +1 -0
  78. package/dist/ui/views/replay-detail.js +328 -0
  79. package/dist/ui/views/replay-detail.js.map +1 -0
  80. package/dist/ui/views/replay.d.ts +74 -0
  81. package/dist/ui/views/replay.d.ts.map +1 -0
  82. package/dist/ui/views/replay.js +460 -0
  83. package/dist/ui/views/replay.js.map +1 -0
  84. package/package.json +9 -12
  85. package/dist/agent/message-stream.d.ts +0 -52
  86. package/dist/agent/message-stream.d.ts.map +0 -1
  87. package/dist/agent/message-stream.js +0 -110
  88. package/dist/agent/message-stream.js.map +0 -1
  89. package/dist/components/ChatPane.d.ts +0 -20
  90. package/dist/components/ChatPane.d.ts.map +0 -1
  91. package/dist/components/ChatPane.js +0 -142
  92. package/dist/components/ChatPane.js.map +0 -1
  93. package/dist/components/ConfigPane.d.ts +0 -12
  94. package/dist/components/ConfigPane.d.ts.map +0 -1
  95. package/dist/components/ConfigPane.js +0 -70
  96. package/dist/components/ConfigPane.js.map +0 -1
  97. package/dist/components/HelpOverlay.d.ts +0 -6
  98. package/dist/components/HelpOverlay.d.ts.map +0 -1
  99. package/dist/components/HelpOverlay.js +0 -18
  100. package/dist/components/HelpOverlay.js.map +0 -1
  101. package/dist/components/HistoryPane.d.ts +0 -9
  102. package/dist/components/HistoryPane.d.ts.map +0 -1
  103. package/dist/components/HistoryPane.js +0 -125
  104. package/dist/components/HistoryPane.js.map +0 -1
  105. package/dist/components/StatusBar.d.ts +0 -10
  106. package/dist/components/StatusBar.d.ts.map +0 -1
  107. package/dist/components/StatusBar.js +0 -15
  108. package/dist/components/StatusBar.js.map +0 -1
  109. package/dist/components/TuiApp.d.ts +0 -29
  110. package/dist/components/TuiApp.d.ts.map +0 -1
  111. package/dist/components/TuiApp.js +0 -81
  112. package/dist/components/TuiApp.js.map +0 -1
  113. package/dist/components/primitives/Badge.d.ts +0 -8
  114. package/dist/components/primitives/Badge.d.ts.map +0 -1
  115. package/dist/components/primitives/Badge.js +0 -14
  116. package/dist/components/primitives/Badge.js.map +0 -1
  117. package/dist/components/primitives/Spinner.d.ts +0 -6
  118. package/dist/components/primitives/Spinner.d.ts.map +0 -1
  119. package/dist/components/primitives/Spinner.js +0 -8
  120. package/dist/components/primitives/Spinner.js.map +0 -1
  121. package/dist/components/primitives/TranscriptLine.d.ts +0 -10
  122. package/dist/components/primitives/TranscriptLine.d.ts.map +0 -1
  123. package/dist/components/primitives/TranscriptLine.js +0 -15
  124. package/dist/components/primitives/TranscriptLine.js.map +0 -1
@@ -0,0 +1,173 @@
1
+ import { AgentResponseCancelledError, frameFeedingMessageStream, parseAgentStreamFrame, } from "@mono-agent/agent-contracts";
2
+ export class RemoteAgentResponderError extends Error {
3
+ code;
4
+ constructor(message, code) {
5
+ super(message);
6
+ this.name = "RemoteAgentResponderError";
7
+ if (code !== undefined) {
8
+ this.code = code;
9
+ }
10
+ }
11
+ }
12
+ /**
13
+ * AgentResponder over the operator-adapter TUI NDJSON wire: one POST per turn, each
14
+ * received frame replayed onto the local AgentMessageStream in order. Because
15
+ * it implements the same contract as an in-process responder, every UI surface
16
+ * works identically in embedded (`--responder`) and remote (`mono-agent tui`)
17
+ * modes.
18
+ */
19
+ export class RemoteAgentResponder {
20
+ baseUrl;
21
+ apiKey;
22
+ fetchImpl;
23
+ constructor(options) {
24
+ this.baseUrl = options.baseUrl.replace(/\/+$/u, "");
25
+ this.apiKey = options.apiKey;
26
+ this.fetchImpl = options.fetchImpl ?? fetch;
27
+ }
28
+ headers(json) {
29
+ return {
30
+ ...(json ? { "content-type": "application/json" } : {}),
31
+ ...(this.apiKey === undefined ? {} : { authorization: `Bearer ${this.apiKey}` }),
32
+ };
33
+ }
34
+ /** Probe GET /v1/info; throws RemoteAgentResponderError when unreachable/unauthorized. */
35
+ async info() {
36
+ const response = await this.request(`${this.baseUrl}/v1/info`, { headers: this.headers(false) });
37
+ const body = (await response.json());
38
+ const { effort, models, modelOptions, ...rest } = body;
39
+ const parsedModelOptions = parseModelOptions(modelOptions);
40
+ return {
41
+ ...rest,
42
+ // Older agents may omit `effort` entirely, or send a malformed value; either
43
+ // way tolerate it and just leave `effort` unset rather than surfacing garbage.
44
+ ...(typeof effort === "string" ? { effort } : {}),
45
+ // Older agents omit `models`; only surface a well-formed array of strings so
46
+ // the model picker never renders garbage entries.
47
+ ...(Array.isArray(models) && models.every((entry) => typeof entry === "string")
48
+ ? { models }
49
+ : {}),
50
+ // Older agents omit `modelOptions` entirely; a newer agent sends it keyed by
51
+ // the same ref strings as `models`. Parsed defensively per-entry so one
52
+ // malformed entry never poisons the well-formed rest.
53
+ ...(parsedModelOptions === undefined ? {} : { modelOptions: parsedModelOptions }),
54
+ };
55
+ }
56
+ async respond(request, stream) {
57
+ const response = await this.request(`${this.baseUrl}/v1/turns`, {
58
+ method: "POST",
59
+ headers: this.headers(true),
60
+ body: JSON.stringify({
61
+ conversationId: request.conversationId,
62
+ text: request.text,
63
+ ...(request.metadata === undefined ? {} : { metadata: request.metadata }),
64
+ }),
65
+ // Aborting tears down the socket; the adapter aborts the in-flight turn.
66
+ signal: request.abortSignal,
67
+ });
68
+ if (response.body === null) {
69
+ throw new RemoteAgentResponderError("Agent returned an empty stream body.");
70
+ }
71
+ const feed = frameFeedingMessageStream(stream);
72
+ const reader = response.body.getReader();
73
+ const decoder = new TextDecoder();
74
+ let buffered = "";
75
+ try {
76
+ for (;;) {
77
+ const { done, value } = await reader.read();
78
+ buffered += done ? decoder.decode() : decoder.decode(value, { stream: true });
79
+ const lines = buffered.split("\n");
80
+ buffered = lines.pop() ?? "";
81
+ for (const line of lines) {
82
+ if (line.length === 0) {
83
+ continue;
84
+ }
85
+ const frame = parseAgentStreamFrame(line);
86
+ if (frame.kind === "finish") {
87
+ return {
88
+ ...(frame.finalText === undefined ? {} : { text: frame.finalText }),
89
+ ...(frame.metadata === undefined ? {} : { metadata: frame.metadata }),
90
+ };
91
+ }
92
+ if (frame.kind === "error") {
93
+ if (frame.cancelled === true) {
94
+ throw new AgentResponseCancelledError(frame.message);
95
+ }
96
+ throw new RemoteAgentResponderError(frame.message, frame.code);
97
+ }
98
+ await feed(frame);
99
+ }
100
+ if (done) {
101
+ break;
102
+ }
103
+ }
104
+ }
105
+ catch (error) {
106
+ if (request.abortSignal.aborted && !(error instanceof AgentResponseCancelledError)) {
107
+ throw new AgentResponseCancelledError();
108
+ }
109
+ throw error;
110
+ }
111
+ finally {
112
+ // Idempotent; also tears the socket down on early return/throw.
113
+ await reader.cancel().catch(() => undefined);
114
+ }
115
+ throw new RemoteAgentResponderError("Stream ended without a finish or error frame.");
116
+ }
117
+ cancel(conversationId) {
118
+ // Fire-and-forget: cancellation is best-effort and must never block the UI.
119
+ void this.fetchImpl(`${this.baseUrl}/v1/conversations/${encodeURIComponent(conversationId)}/cancel`, {
120
+ method: "POST",
121
+ headers: this.headers(false),
122
+ }).catch(() => undefined);
123
+ }
124
+ async request(url, init) {
125
+ let response;
126
+ try {
127
+ response = await this.fetchImpl(url, init);
128
+ }
129
+ catch (error) {
130
+ if (init?.signal !== undefined && init.signal.aborted) {
131
+ throw new AgentResponseCancelledError();
132
+ }
133
+ throw new RemoteAgentResponderError(`Agent is unreachable at ${this.baseUrl} (${error instanceof Error ? error.message : String(error)}).`, "unreachable");
134
+ }
135
+ if (!response.ok && response.headers.get("content-type")?.includes("application/x-ndjson") !== true) {
136
+ const detail = await response.text().catch(() => "");
137
+ throw new RemoteAgentResponderError(`Agent responded ${response.status} at ${url}${detail.length > 0 ? `: ${detail.slice(0, 300)}` : "."}`, response.status === 401 ? "unauthorized" : "http_error");
138
+ }
139
+ return response;
140
+ }
141
+ }
142
+ /**
143
+ * Defensively parses `/v1/info`'s `modelOptions` field: tolerates absence (an
144
+ * older agent), a non-record payload, and per-entry shape mismatches — a
145
+ * malformed entry is dropped rather than surfacing garbage or throwing. Never
146
+ * returns an empty record; an all-malformed payload degrades to `undefined`,
147
+ * same as an agent that never sent the field.
148
+ */
149
+ function parseModelOptions(value) {
150
+ if (typeof value !== "object" || value === null || Array.isArray(value)) {
151
+ return undefined;
152
+ }
153
+ const result = {};
154
+ for (const [ref, raw] of Object.entries(value)) {
155
+ if (typeof raw !== "object" || raw === null || Array.isArray(raw)) {
156
+ continue;
157
+ }
158
+ const entry = raw;
159
+ const parsedEntry = {
160
+ ...(Array.isArray(entry.effortLevels) && entry.effortLevels.every((level) => typeof level === "string")
161
+ ? { effortLevels: entry.effortLevels }
162
+ : {}),
163
+ ...(typeof entry.reasoning === "boolean" ? { reasoning: entry.reasoning } : {}),
164
+ ...(typeof entry.reasoningMode === "string" ? { reasoningMode: entry.reasoningMode } : {}),
165
+ ...(typeof entry.label === "string" ? { label: entry.label } : {}),
166
+ };
167
+ if (Object.keys(parsedEntry).length > 0) {
168
+ result[ref] = parsedEntry;
169
+ }
170
+ }
171
+ return Object.keys(result).length > 0 ? result : undefined;
172
+ }
173
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/remote/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,2BAA2B,EAC3B,yBAAyB,EACzB,qBAAqB,GAKtB,MAAM,6BAA6B,CAAC;AASrC,MAAM,OAAO,yBAA0B,SAAQ,KAAK;IACzC,IAAI,CAAU;IAEvB,YAAY,OAAe,EAAE,IAAa;QACxC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,2BAA2B,CAAC;QACxC,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACvB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACnB,CAAC;IACH,CAAC;CACF;AAED;;;;;;GAMG;AACH,MAAM,OAAO,oBAAoB;IACd,OAAO,CAAS;IAChB,MAAM,CAAqB;IAC3B,SAAS,CAAe;IAEzC,YAAY,OAAoC;QAC9C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QACpD,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC7B,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,KAAK,CAAC;IAC9C,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K,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,KAAK,EAAmB,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC;gBACtH,CAAC,CAAC,EAAE,YAAY,EAAE,KAAK,CAAC,YAAY,EAAE;gBACtC,CAAC,CAAC,EAAE,CAAC;YACP,GAAG,CAAC,OAAO,KAAK,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC/E,GAAG,CAAC,OAAO,KAAK,CAAC,aAAa,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,KAAK,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC1F,GAAG,CAAC,OAAO,KAAK,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACnE,CAAC;QACF,IAAI,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACxC,MAAM,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC;QAC5B,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;AAC7D,CAAC"}
@@ -1,27 +1,20 @@
1
- import { type TuiAppProps } from "../components/TuiApp.js";
2
- export interface StartMonoAgentTuiOptions extends TuiAppProps {
3
- readonly stdout?: NodeJS.WriteStream;
4
- readonly stdin?: NodeJS.ReadStream;
5
- readonly stderr?: NodeJS.WriteStream;
6
- readonly debug?: boolean;
7
- /**
8
- * Forwarded to ink's `render({ patchConsole })`. Defaults to `false` so the
9
- * TUI does not silently swallow host `console.*` output; set it to `true`
10
- * to let Ink intercept and redraw console writes above the app.
11
- */
12
- readonly patchConsole?: boolean;
1
+ import type { Terminal } from "@earendil-works/pi-tui";
2
+ import type { MonoAgentTuiAppOptions } from "../ui/app.js";
3
+ export interface StartMonoAgentTuiOptions extends Omit<MonoAgentTuiAppOptions, "terminal"> {
4
+ /** Test seam: inject a Terminal implementation; defaults to the real TTY. */
5
+ readonly terminal?: Terminal;
13
6
  }
14
7
  export interface StartMonoAgentTuiHandle {
15
- /** Resolves once the Ink app unmounts (user quit or programmatic stop). */
8
+ /** Resolves once the app exits (user quit or programmatic stop). */
16
9
  waitUntilExit(): Promise<void>;
17
- /** Unmount the app and restore the TTY. Idempotent. */
10
+ /** Stop the app and restore the TTY. Idempotent. */
18
11
  stop(): Promise<void>;
19
12
  }
20
13
  /**
21
- * Mount the TUI against the live TTY (or the provided stdin/stdout pair).
22
- *
23
- * Hosts that already manage Ink should embed `<TuiApp />` directly; this
24
- * convenience function wires `ink.render` for the common case.
14
+ * Start the pi-tui operator console. Exactly one connection mode applies:
15
+ * `responder` (in-process/embedded), `connection` (direct remote endpoint), or
16
+ * `discovery` (open on the agent picker). Replay/config views activate when
17
+ * `instance`/`config` provide data roots.
25
18
  */
26
19
  export declare function startMonoAgentTui(options: StartMonoAgentTuiOptions): StartMonoAgentTuiHandle;
27
20
  //# sourceMappingURL=start.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../../src/runtime/start.ts"],"names":[],"mappings":"AAGA,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEnE,MAAM,WAAW,wBAAyB,SAAQ,WAAW;IAC3D,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,WAAW,CAAC;IACrC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACnC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,WAAW,CAAC;IACrC,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IACzB;;;;OAIG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC;CACjC;AAED,MAAM,WAAW,uBAAuB;IACtC,2EAA2E;IAC3E,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/B,uDAAuD;IACvD,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACvB;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,wBAAwB,GAChC,uBAAuB,CAgDzB"}
1
+ {"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../../src/runtime/start.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAGvD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAE3D,MAAM,WAAW,wBAAyB,SAAQ,IAAI,CAAC,sBAAsB,EAAE,UAAU,CAAC;IACxF,6EAA6E;IAC7E,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC;CAC9B;AAED,MAAM,WAAW,uBAAuB;IACtC,oEAAoE;IACpE,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/B,oDAAoD;IACpD,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACvB;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,wBAAwB,GAAG,uBAAuB,CA4B5F"}
@@ -1,45 +1,31 @@
1
- import React from "react";
2
- import { render } from "ink";
3
- import { TuiApp } from "../components/TuiApp.js";
1
+ import { ProcessTerminal } from "@earendil-works/pi-tui";
2
+ import { MonoAgentTuiApp } from "../ui/app.js";
4
3
  /**
5
- * Mount the TUI against the live TTY (or the provided stdin/stdout pair).
6
- *
7
- * Hosts that already manage Ink should embed `<TuiApp />` directly; this
8
- * convenience function wires `ink.render` for the common case.
4
+ * Start the pi-tui operator console. Exactly one connection mode applies:
5
+ * `responder` (in-process/embedded), `connection` (direct remote endpoint), or
6
+ * `discovery` (open on the agent picker). Replay/config views activate when
7
+ * `instance`/`config` provide data roots.
9
8
  */
10
9
  export function startMonoAgentTui(options) {
11
- const { stdout, stdin, stderr, debug, patchConsole = false, ...appProps } = options;
12
- const stdinTarget = stdin ?? process.stdin;
13
- if (stdin === undefined &&
14
- typeof stdinTarget.isTTY === "boolean" &&
15
- stdinTarget.isTTY === false) {
16
- throw new Error("startMonoAgentTui requires a TTY stdin. Pipe a stdin manually for non-TTY use.");
10
+ const modes = [options.responder, options.connection, options.discovery].filter((mode) => mode !== undefined).length;
11
+ if (modes !== 1) {
12
+ throw new Error("startMonoAgentTui requires exactly one of `responder`, `connection`, or `discovery`.");
17
13
  }
18
- const instance = render(React.createElement(TuiApp, appProps), {
19
- stdout: stdout ?? process.stdout,
20
- stdin: stdinTarget,
21
- stderr: stderr ?? process.stderr,
22
- debug: debug ?? false,
23
- patchConsole,
24
- exitOnCtrlC: appProps.exitOnCtrlC ?? true,
14
+ if (options.terminal === undefined && process.stdin.isTTY !== true) {
15
+ throw new Error("startMonoAgentTui requires a TTY stdin. Pass a terminal manually for non-TTY use.");
16
+ }
17
+ const { terminal, ...appOptions } = options;
18
+ const app = new MonoAgentTuiApp({
19
+ ...appOptions,
20
+ terminal: terminal ?? new ProcessTerminal(),
25
21
  });
26
- let stopped = false;
22
+ app.start();
27
23
  return {
28
24
  async waitUntilExit() {
29
- await instance.waitUntilExit();
25
+ await app.waitUntilExit();
30
26
  },
31
27
  async stop() {
32
- if (stopped) {
33
- return;
34
- }
35
- stopped = true;
36
- instance.unmount();
37
- try {
38
- await instance.waitUntilExit();
39
- }
40
- catch {
41
- // ignore
42
- }
28
+ app.stop();
43
29
  },
44
30
  };
45
31
  }
@@ -1 +1 @@
1
- {"version":3,"file":"start.js","sourceRoot":"","sources":["../../src/runtime/start.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,M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,CAAC"}
1
+ {"version":3,"file":"start.js","sourceRoot":"","sources":["../../src/runtime/start.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAGzD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAe/C;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAiC;IACjE,MAAM,KAAK,GAAG,CAAC,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC,MAAM,CAC7E,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,SAAS,CAC7B,CAAC,MAAM,CAAC;IACT,IAAI,KAAK,KAAK,CAAC,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CACb,sFAAsF,CACvF,CAAC;IACJ,CAAC;IACD,IAAI,OAAO,CAAC,QAAQ,KAAK,SAAS,IAAI,OAAO,CAAC,KAAK,CAAC,KAAK,KAAK,IAAI,EAAE,CAAC;QACnE,MAAM,IAAI,KAAK,CAAC,mFAAmF,CAAC,CAAC;IACvG,CAAC;IAED,MAAM,EAAE,QAAQ,EAAE,GAAG,UAAU,EAAE,GAAG,OAAO,CAAC;IAC5C,MAAM,GAAG,GAAG,IAAI,eAAe,CAAC;QAC9B,GAAG,UAAU;QACb,QAAQ,EAAE,QAAQ,IAAI,IAAI,eAAe,EAAE;KAC5C,CAAC,CAAC;IACH,GAAG,CAAC,KAAK,EAAE,CAAC;IAEZ,OAAO;QACL,KAAK,CAAC,aAAa;YACjB,MAAM,GAAG,CAAC,aAAa,EAAE,CAAC;QAC5B,CAAC;QACD,KAAK,CAAC,IAAI;YACR,GAAG,CAAC,IAAI,EAAE,CAAC;QACb,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,142 @@
1
+ import { TUI } from "@earendil-works/pi-tui";
2
+ import type { Terminal } from "@earendil-works/pi-tui";
3
+ import type { AgentResponder } from "@mono-agent/agent-contracts";
4
+ import type { TuiHistoryStore } from "../agent/history.js";
5
+ export type TuiViewId = "chat" | "picker" | "replay" | "config";
6
+ export interface TuiAppLogger {
7
+ debug?(message: string, metadata?: Record<string, unknown>): void;
8
+ info?(message: string, metadata?: Record<string, unknown>): void;
9
+ warn?(message: string, metadata?: Record<string, unknown>): void;
10
+ error?(message: string, metadata?: Record<string, unknown>): void;
11
+ }
12
+ export interface MonoAgentTuiAppOptions {
13
+ readonly terminal: Terminal;
14
+ /** In-process responder (embedded mode); mutually exclusive with connection/discovery. */
15
+ readonly responder?: AgentResponder;
16
+ /** Direct remote connection (from `mono-agent tui` after resolution). */
17
+ readonly connection?: {
18
+ readonly baseUrl: string;
19
+ readonly apiKey?: string;
20
+ };
21
+ /** Discovery mode: open on the instance picker over these registries (`registryDirs` union beats the single `registryDir`). */
22
+ readonly discovery?: {
23
+ readonly registryDir?: string;
24
+ readonly registryDirs?: readonly string[];
25
+ readonly staleAfterMs?: number;
26
+ };
27
+ /** Identity + data roots of the selected instance (replay/config views). */
28
+ readonly instance?: {
29
+ readonly label?: string;
30
+ readonly artifactDir?: string;
31
+ readonly configPath?: string;
32
+ };
33
+ readonly conversationId?: string;
34
+ readonly title?: string;
35
+ readonly subtitle?: string;
36
+ readonly initialStatusText?: string;
37
+ readonly history?: TuiHistoryStore;
38
+ readonly config?: {
39
+ readonly path: string;
40
+ readonly cwd: string;
41
+ readonly env: Record<string, string | undefined>;
42
+ };
43
+ readonly logger?: TuiAppLogger;
44
+ readonly env?: Record<string, string | undefined>;
45
+ /** Test seam: coalescing window for streamed markdown; 0 = synchronous. */
46
+ readonly flushIntervalMs?: number;
47
+ }
48
+ /**
49
+ * Root controller: owns the pi-tui instance, the view stack, connection state,
50
+ * and global keys (view cycling, cancel, quit, thinking toggle, help).
51
+ */
52
+ export declare class MonoAgentTuiApp {
53
+ readonly tui: TUI;
54
+ private readonly options;
55
+ private readonly header;
56
+ private readonly viewHost;
57
+ private readonly statusBar;
58
+ private readonly chat;
59
+ private readonly picker;
60
+ private readonly replay;
61
+ private readonly config;
62
+ private view;
63
+ private helpVisible;
64
+ private helpHandle;
65
+ /** Candidate models advertised by the connected agent's `/v1/info` (primary first, then fallbacks). */
66
+ private availableModels;
67
+ /** Per-model effort/reasoning/mode/label options from `/v1/info` (keyed by model ref); drives the model-aware effort picker + `/model` row annotations. */
68
+ private modelOptions;
69
+ /** The connected agent's own default model ref (from `/v1/info`) — the effort picker's effective model when no `/model` override is active. */
70
+ private agentModel;
71
+ /** The single open picker overlay (model or effort); only one at a time. */
72
+ private activePicker;
73
+ private ctrlCArmedAt;
74
+ private exitResolve;
75
+ private readonly exitPromise;
76
+ private stopped;
77
+ constructor(options: MonoAgentTuiAppOptions);
78
+ start(): void;
79
+ waitUntilExit(): Promise<void>;
80
+ stop(): void;
81
+ showView(view: TuiViewId): void;
82
+ private wireInitialMode;
83
+ private refreshInstances;
84
+ private connectTo;
85
+ /**
86
+ * Apply a `/v1/info` snapshot's model/effort to the status bar. Unlike the
87
+ * per-turn finish-metadata correction in ChatView (a delta that never
88
+ * clears), `info` is a full snapshot of the *newly selected agent* — an
89
+ * absent `effort` here means this agent genuinely has none configured, so
90
+ * clearing is correct: otherwise a stale effort from a previously
91
+ * connected agent would misattribute to this one.
92
+ */
93
+ private applyAgentInfo;
94
+ private applyStaticIdentity;
95
+ private updateHeader;
96
+ private handleGlobalInput;
97
+ /**
98
+ * Tab/`?` act as global shortcuts (view cycling, help) everywhere except
99
+ * chat with unsubmitted editor text -- there they pass through to the
100
+ * editor instead (autocomplete completion / literal `?`). Shared by both
101
+ * keys so the "empty editor" exception can't drift out of sync between them.
102
+ */
103
+ private globalShortcutsAllowedInChat;
104
+ private cycleView;
105
+ private handleSlashCommand;
106
+ private showHelp;
107
+ private hideHelp;
108
+ /**
109
+ * `/model` — with an argument, set (or, for `default`, clear) the session
110
+ * model override directly; with no argument, open the picker overlay. An
111
+ * override to a different model runs each turn as a fresh provider session.
112
+ */
113
+ private handleModelCommand;
114
+ private showModelPicker;
115
+ /**
116
+ * `/effort` — with an argument, set (or, for `default`, clear) the session
117
+ * effort override directly; with no argument, open the model-aware picker.
118
+ */
119
+ private handleEffortCommand;
120
+ /**
121
+ * Model-aware effort picker: the effective model is the `/model` override if
122
+ * set, else the agent's default. The rows depend on that model's advertised
123
+ * `reasoningMode`:
124
+ * - `reasoning: false` / mode `"none"` / empty `effortLevels` → no adjustable
125
+ * effort, so we surface a persistent notice instead of an empty picker.
126
+ * - mode `"toggle"` (binary-thinking local models, e.g. Ollama qwen3.6) → a
127
+ * two-row on/off picker; graded levels would misrepresent the model.
128
+ * - mode `"effort"` with `effortLevels` → those graded levels (local models).
129
+ * - no mode / no levels (cloud models) → the global {@link EFFORT_LEVELS} enum.
130
+ */
131
+ private showEffortPicker;
132
+ /**
133
+ * Open a modal select overlay (the model and effort pickers share this).
134
+ * `onChoose` handles the picked item; the overlay always closes afterward.
135
+ * nonCapturing keeps input routed through the global listener (which drives
136
+ * the list explicitly and swallows the rest), so the overlay never contends
137
+ * for focus with the chat editor underneath it.
138
+ */
139
+ private openPickerOverlay;
140
+ private closePicker;
141
+ }
142
+ //# sourceMappingURL=app.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../src/ui/app.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2C,GAAG,EAAE,MAAM,wBAAwB,CAAC;AACtF,OAAO,KAAK,EAAsD,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAC3G,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAGlE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAW3D,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAEhE,MAAM,WAAW,YAAY;IAC3B,KAAK,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,M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