runpane 2.4.52 → 2.4.54

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.
@@ -22,10 +22,308 @@ exports.runAgentsDoctor = runAgentsDoctor;
22
22
  const node_fs_1 = __importDefault(require("node:fs"));
23
23
  const node_process_1 = require("node:process");
24
24
  const promises_1 = require("node:readline/promises");
25
+ const boundaryDecoder_1 = require("./boundaryDecoder");
25
26
  const daemonClient_1 = require("./daemonClient");
26
27
  const contract_1 = require("./generated/contract");
28
+ const agentSchema = boundaryDecoder_1.boundary.enumeration(...contract_1.RUNPANE_CONTRACT.enums.agents);
29
+ const repoSummarySchema = boundaryDecoder_1.boundary.object({
30
+ id: boundaryDecoder_1.boundary.number,
31
+ name: boundaryDecoder_1.boundary.string,
32
+ path: boundaryDecoder_1.boundary.string,
33
+ active: boundaryDecoder_1.boundary.boolean,
34
+ environment: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.string),
35
+ sessionCount: boundaryDecoder_1.boundary.number,
36
+ });
37
+ const repoAddPreviewSchema = boundaryDecoder_1.boundary.object({
38
+ name: boundaryDecoder_1.boundary.string,
39
+ path: boundaryDecoder_1.boundary.string,
40
+ alreadyExists: boundaryDecoder_1.boundary.boolean,
41
+ wouldCreate: boundaryDecoder_1.boundary.boolean,
42
+ environment: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.string),
43
+ });
44
+ const paneSummarySchema = boundaryDecoder_1.boundary.object({
45
+ id: boundaryDecoder_1.boundary.string,
46
+ paneId: boundaryDecoder_1.boundary.string,
47
+ name: boundaryDecoder_1.boundary.string,
48
+ status: boundaryDecoder_1.boundary.string,
49
+ worktreePath: boundaryDecoder_1.boundary.string,
50
+ repoId: boundaryDecoder_1.boundary.number,
51
+ repoName: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.string),
52
+ panelCount: boundaryDecoder_1.boundary.number,
53
+ pinned: boundaryDecoder_1.boundary.boolean,
54
+ createdAt: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.string),
55
+ lastActivity: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.string),
56
+ archived: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.boolean),
57
+ });
58
+ const panelBlockedSchema = boundaryDecoder_1.boundary.object({
59
+ kind: boundaryDecoder_1.boundary.enumeration('codex-update', 'agent-prompt', 'submission_unverified', 'unknown'),
60
+ message: boundaryDecoder_1.boundary.string,
61
+ suggestedCommand: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.string),
62
+ });
63
+ const panelStateSchema = boundaryDecoder_1.boundary.object({
64
+ initialized: boundaryDecoder_1.boundary.boolean,
65
+ isAlternateScreen: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.boolean),
66
+ activityStatus: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.enumeration('active', 'idle')),
67
+ isCliReady: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.boolean),
68
+ isCliPanel: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.boolean),
69
+ agentType: boundaryDecoder_1.boundary.optional(agentSchema),
70
+ lastActivity: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.string),
71
+ });
72
+ const panelReadinessSchema = boundaryDecoder_1.boundary.object({
73
+ ok: boundaryDecoder_1.boundary.boolean,
74
+ condition: boundaryDecoder_1.boundary.string,
75
+ matched: boundaryDecoder_1.boundary.boolean,
76
+ timedOut: boundaryDecoder_1.boundary.boolean,
77
+ elapsedMs: boundaryDecoder_1.boundary.number,
78
+ state: panelStateSchema,
79
+ blocked: boundaryDecoder_1.boundary.optional(panelBlockedSchema),
80
+ nextCommand: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.string),
81
+ });
82
+ const initialInputSchema = boundaryDecoder_1.boundary.object({
83
+ delivered: boundaryDecoder_1.boundary.boolean,
84
+ submitted: boundaryDecoder_1.boundary.boolean,
85
+ inputBytes: boundaryDecoder_1.boundary.number,
86
+ strategy: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.enumeration('codex-ctrl-enter', 'enter', 'argument')),
87
+ sequenceName: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.enumeration('codex-ctrl-enter-cr', 'enter-cr', 'argument')),
88
+ verifiedSubmitted: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.boolean),
89
+ staged: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.boolean),
90
+ attempts: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.number),
91
+ sentAt: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.string),
92
+ blocked: boundaryDecoder_1.boundary.optional(panelBlockedSchema),
93
+ error: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.object({
94
+ message: boundaryDecoder_1.boundary.string,
95
+ code: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.string),
96
+ })),
97
+ nextCommand: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.string),
98
+ });
99
+ const archiveSafetySchema = boundaryDecoder_1.boundary.object({
100
+ performed: boundaryDecoder_1.boundary.boolean,
101
+ hasUncommittedChanges: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.boolean),
102
+ hasUntrackedFiles: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.boolean),
103
+ hasUpstream: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.boolean),
104
+ unpushedCommits: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.number),
105
+ });
106
+ const panelSummarySchema = boundaryDecoder_1.boundary.object({
107
+ id: boundaryDecoder_1.boundary.string,
108
+ panelId: boundaryDecoder_1.boundary.string,
109
+ paneId: boundaryDecoder_1.boundary.string,
110
+ type: boundaryDecoder_1.boundary.string,
111
+ title: boundaryDecoder_1.boundary.string,
112
+ active: boundaryDecoder_1.boundary.boolean,
113
+ initialized: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.boolean),
114
+ agentType: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.string),
115
+ isCliPanel: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.boolean),
116
+ position: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.number),
117
+ createdAt: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.string),
118
+ lastActiveAt: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.string),
119
+ });
120
+ const repoListResultSchema = boundaryDecoder_1.boundary.object({
121
+ ok: boundaryDecoder_1.boundary.literal(true),
122
+ repos: boundaryDecoder_1.boundary.array(repoSummarySchema),
123
+ });
124
+ const repoAddResultSchema = boundaryDecoder_1.boundary.object({
125
+ ok: boundaryDecoder_1.boundary.literal(true),
126
+ created: boundaryDecoder_1.boundary.boolean,
127
+ dryRun: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.boolean),
128
+ repo: boundaryDecoder_1.boundary.optional(repoSummarySchema),
129
+ preview: boundaryDecoder_1.boundary.optional(repoAddPreviewSchema),
130
+ });
131
+ const paneListResultSchema = boundaryDecoder_1.boundary.object({
132
+ ok: boundaryDecoder_1.boundary.literal(true),
133
+ repo: boundaryDecoder_1.boundary.optional(repoSummarySchema),
134
+ panes: boundaryDecoder_1.boundary.array(paneSummarySchema),
135
+ });
136
+ const paneCreateResultSchema = boundaryDecoder_1.boundary.object({
137
+ ok: boundaryDecoder_1.boundary.boolean,
138
+ repo: repoSummarySchema,
139
+ items: boundaryDecoder_1.boundary.array(boundaryDecoder_1.boundary.union(boundaryDecoder_1.boundary.object({
140
+ ok: boundaryDecoder_1.boundary.literal(true),
141
+ index: boundaryDecoder_1.boundary.number,
142
+ name: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.string),
143
+ pinned: boundaryDecoder_1.boundary.boolean,
144
+ sessionId: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.string),
145
+ panelId: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.string),
146
+ worktreePath: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.string),
147
+ nextCommand: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.string),
148
+ readiness: boundaryDecoder_1.boundary.optional(panelReadinessSchema),
149
+ initialInput: boundaryDecoder_1.boundary.optional(initialInputSchema),
150
+ }), boundaryDecoder_1.boundary.object({
151
+ ok: boundaryDecoder_1.boundary.literal(false),
152
+ index: boundaryDecoder_1.boundary.number,
153
+ name: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.string),
154
+ error: boundaryDecoder_1.boundary.object({
155
+ message: boundaryDecoder_1.boundary.string,
156
+ code: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.string),
157
+ }),
158
+ }))),
159
+ });
160
+ const paneArchiveResultSchema = boundaryDecoder_1.boundary.union(boundaryDecoder_1.boundary.object({
161
+ ok: boundaryDecoder_1.boundary.literal(false),
162
+ paneId: boundaryDecoder_1.boundary.string,
163
+ blocked: boundaryDecoder_1.boundary.object({
164
+ code: boundaryDecoder_1.boundary.enumeration('uncommitted-changes', 'unpushed-commits', 'uncommitted-and-unpushed', 'status-unknown'),
165
+ message: boundaryDecoder_1.boundary.string,
166
+ safetyCheck: archiveSafetySchema,
167
+ }),
168
+ nextCommand: boundaryDecoder_1.boundary.string,
169
+ }), boundaryDecoder_1.boundary.object({
170
+ ok: boundaryDecoder_1.boundary.boolean,
171
+ paneId: boundaryDecoder_1.boundary.string,
172
+ archived: boundaryDecoder_1.boundary.literal(true),
173
+ forced: boundaryDecoder_1.boundary.boolean,
174
+ worktreeCleanup: boundaryDecoder_1.boundary.enumeration('completed', 'failed', 'timeout', 'not-applicable'),
175
+ worktreePath: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.string),
176
+ safetyCheck: archiveSafetySchema,
177
+ }));
178
+ const panePinResultSchema = boundaryDecoder_1.boundary.object({
179
+ ok: boundaryDecoder_1.boundary.literal(true),
180
+ paneId: boundaryDecoder_1.boundary.string,
181
+ pinned: boundaryDecoder_1.boundary.boolean,
182
+ dryRun: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.literal(true)),
183
+ favoritePinnedAt: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.string),
184
+ });
185
+ const paneRenameResultSchema = boundaryDecoder_1.boundary.object({
186
+ ok: boundaryDecoder_1.boundary.literal(true),
187
+ dryRun: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.literal(true)),
188
+ pane: paneSummarySchema,
189
+ });
190
+ const panelListResultSchema = boundaryDecoder_1.boundary.object({
191
+ ok: boundaryDecoder_1.boundary.literal(true),
192
+ paneId: boundaryDecoder_1.boundary.string,
193
+ panels: boundaryDecoder_1.boundary.array(panelSummarySchema),
194
+ });
195
+ const panelCreateResultSchema = boundaryDecoder_1.boundary.object({
196
+ ok: boundaryDecoder_1.boundary.boolean,
197
+ paneId: boundaryDecoder_1.boundary.string,
198
+ panelId: boundaryDecoder_1.boundary.string,
199
+ title: boundaryDecoder_1.boundary.string,
200
+ active: boundaryDecoder_1.boundary.boolean,
201
+ focused: boundaryDecoder_1.boundary.boolean,
202
+ tool: boundaryDecoder_1.boundary.object({
203
+ title: boundaryDecoder_1.boundary.string,
204
+ command: boundaryDecoder_1.boundary.string,
205
+ agent: boundaryDecoder_1.boundary.optional(agentSchema),
206
+ }),
207
+ readiness: boundaryDecoder_1.boundary.optional(panelReadinessSchema),
208
+ initialInput: boundaryDecoder_1.boundary.optional(initialInputSchema),
209
+ nextCommand: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.string),
210
+ });
211
+ const panelOutputResultSchema = boundaryDecoder_1.boundary.object({
212
+ ok: boundaryDecoder_1.boundary.literal(true),
213
+ panelId: boundaryDecoder_1.boundary.string,
214
+ paneId: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.string),
215
+ limit: boundaryDecoder_1.boundary.number,
216
+ returnedCount: boundaryDecoder_1.boundary.number,
217
+ hasMore: boundaryDecoder_1.boundary.boolean,
218
+ outputs: boundaryDecoder_1.boundary.array(boundaryDecoder_1.boundary.object({
219
+ type: boundaryDecoder_1.boundary.string,
220
+ data: boundaryDecoder_1.boundary.json,
221
+ timestamp: boundaryDecoder_1.boundary.string,
222
+ })),
223
+ text: boundaryDecoder_1.boundary.string,
224
+ });
225
+ const panelInputResultSchema = boundaryDecoder_1.boundary.object({
226
+ ok: boundaryDecoder_1.boundary.literal(true),
227
+ panelId: boundaryDecoder_1.boundary.string,
228
+ paneId: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.string),
229
+ inputBytes: boundaryDecoder_1.boundary.number,
230
+ sentAt: boundaryDecoder_1.boundary.string,
231
+ nextCommand: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.string),
232
+ });
233
+ const panelScreenResultSchema = boundaryDecoder_1.boundary.object({
234
+ ok: boundaryDecoder_1.boundary.literal(true),
235
+ panelId: boundaryDecoder_1.boundary.string,
236
+ paneId: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.string),
237
+ source: boundaryDecoder_1.boundary.enumeration('alternateScreen', 'scrollback', 'persistedOutput', 'empty'),
238
+ limit: boundaryDecoder_1.boundary.number,
239
+ returnedLineCount: boundaryDecoder_1.boundary.number,
240
+ hasMore: boundaryDecoder_1.boundary.boolean,
241
+ text: boundaryDecoder_1.boundary.string,
242
+ state: panelStateSchema,
243
+ nextCommand: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.string),
244
+ });
245
+ const panelSubmitResultSchema = boundaryDecoder_1.boundary.object({
246
+ ok: boundaryDecoder_1.boundary.literal(true),
247
+ panelId: boundaryDecoder_1.boundary.string,
248
+ paneId: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.string),
249
+ inputBytes: boundaryDecoder_1.boundary.number,
250
+ enter: boundaryDecoder_1.boundary.literal('cr'),
251
+ sentAt: boundaryDecoder_1.boundary.string,
252
+ nextCommand: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.string),
253
+ });
254
+ const panelSubmitComposerResultSchema = boundaryDecoder_1.boundary.object({
255
+ ok: boundaryDecoder_1.boundary.boolean,
256
+ panelId: boundaryDecoder_1.boundary.string,
257
+ paneId: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.string),
258
+ inputBytes: boundaryDecoder_1.boundary.number,
259
+ strategy: boundaryDecoder_1.boundary.enumeration('codex-ctrl-enter', 'enter'),
260
+ sequenceName: boundaryDecoder_1.boundary.enumeration('codex-ctrl-enter-cr', 'enter-cr'),
261
+ verifiedSubmitted: boundaryDecoder_1.boundary.boolean,
262
+ sentAt: boundaryDecoder_1.boundary.string,
263
+ blocked: boundaryDecoder_1.boundary.optional(panelBlockedSchema),
264
+ nextCommand: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.string),
265
+ });
266
+ const panelWaitResultSchema = boundaryDecoder_1.boundary.object({
267
+ ok: boundaryDecoder_1.boundary.boolean,
268
+ condition: boundaryDecoder_1.boundary.string,
269
+ matched: boundaryDecoder_1.boundary.boolean,
270
+ timedOut: boundaryDecoder_1.boundary.boolean,
271
+ elapsedMs: boundaryDecoder_1.boundary.number,
272
+ state: panelStateSchema,
273
+ blocked: boundaryDecoder_1.boundary.optional(panelBlockedSchema),
274
+ nextCommand: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.string),
275
+ panelId: boundaryDecoder_1.boundary.string,
276
+ paneId: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.string),
277
+ screen: boundaryDecoder_1.boundary.object({
278
+ source: boundaryDecoder_1.boundary.enumeration('alternateScreen', 'scrollback', 'persistedOutput', 'empty'),
279
+ text: boundaryDecoder_1.boundary.string,
280
+ hasMore: boundaryDecoder_1.boundary.boolean,
281
+ }),
282
+ });
283
+ const agentDoctorResultSchema = boundaryDecoder_1.boundary.object({
284
+ ok: boundaryDecoder_1.boundary.boolean,
285
+ agent: agentSchema,
286
+ command: boundaryDecoder_1.boundary.string,
287
+ repo: boundaryDecoder_1.boundary.optional(repoSummarySchema),
288
+ environment: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.string),
289
+ available: boundaryDecoder_1.boundary.boolean,
290
+ executablePath: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.string),
291
+ version: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.string),
292
+ checks: boundaryDecoder_1.boundary.array(boundaryDecoder_1.boundary.object({
293
+ name: boundaryDecoder_1.boundary.string,
294
+ ok: boundaryDecoder_1.boundary.boolean,
295
+ message: boundaryDecoder_1.boundary.string,
296
+ })),
297
+ warnings: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.array(boundaryDecoder_1.boundary.string)),
298
+ });
299
+ const repoSelectorSchema = boundaryDecoder_1.boundary.union(boundaryDecoder_1.boundary.nonEmptyString, boundaryDecoder_1.boundary.object({ id: boundaryDecoder_1.boundary.number }), boundaryDecoder_1.boundary.object({ path: boundaryDecoder_1.boundary.string }), boundaryDecoder_1.boundary.object({ name: boundaryDecoder_1.boundary.string }), boundaryDecoder_1.boundary.object({ active: boundaryDecoder_1.boundary.literal(true) }));
300
+ const paneToolInputSchema = boundaryDecoder_1.boundary.object({
301
+ agent: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.string),
302
+ command: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.string),
303
+ title: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.string),
304
+ initialInput: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.string),
305
+ });
306
+ const paneCreateRequestInputSchema = boundaryDecoder_1.boundary.object({
307
+ repo: repoSelectorSchema,
308
+ panes: boundaryDecoder_1.boundary.array(boundaryDecoder_1.boundary.object({
309
+ name: boundaryDecoder_1.boundary.string,
310
+ worktreeName: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.string),
311
+ baseBranch: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.string),
312
+ sessionPrompt: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.string),
313
+ pinned: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.boolean),
314
+ tool: paneToolInputSchema,
315
+ })),
316
+ dryRun: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.boolean),
317
+ timeoutMs: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.number),
318
+ waitReady: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.boolean),
319
+ readyTimeoutMs: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.number),
320
+ concurrency: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.number),
321
+ noFocus: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.boolean),
322
+ focus: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.boolean),
323
+ source: boundaryDecoder_1.boundary.optional(boundaryDecoder_1.boundary.enumeration('user', 'agent')),
324
+ });
27
325
  async function runReposList(parsed) {
28
- const result = await (0, daemonClient_1.invokeDaemon)('runpane:repos:list', [], {
326
+ const result = await (0, daemonClient_1.invokeDaemon)('runpane:repos:list', [], repoListResultSchema, {
29
327
  paneDir: parsed.paneDir,
30
328
  });
31
329
  if (parsed.json) {
@@ -46,7 +344,7 @@ async function runReposList(parsed) {
46
344
  async function runReposAdd(parsed) {
47
345
  const request = buildRepoAddRequest(parsed);
48
346
  await confirmRepoAdd(parsed, request);
49
- const result = await (0, daemonClient_1.invokeDaemon)('runpane:repos:add', [request], {
347
+ const result = await (0, daemonClient_1.invokeDaemon)('runpane:repos:add', [request], repoAddResultSchema, {
50
348
  paneDir: parsed.paneDir,
51
349
  });
52
350
  if (parsed.json) {
@@ -60,7 +358,7 @@ async function runReposAdd(parsed) {
60
358
  async function runPanesList(parsed) {
61
359
  const result = await (0, daemonClient_1.invokeDaemon)('runpane:panes:list', [{
62
360
  repo: parsed.repo,
63
- }], {
361
+ }], paneListResultSchema, {
64
362
  paneDir: parsed.paneDir,
65
363
  });
66
364
  if (parsed.json) {
@@ -73,7 +371,7 @@ async function runPanesList(parsed) {
73
371
  async function runPanesCreate(parsed) {
74
372
  const request = await buildPaneCreateRequest(parsed);
75
373
  await confirmPaneCreate(parsed, request);
76
- const result = await (0, daemonClient_1.invokeDaemon)('runpane:panes:create', [request], {
374
+ const result = await (0, daemonClient_1.invokeDaemon)('runpane:panes:create', [request], paneCreateResultSchema, {
77
375
  paneDir: parsed.paneDir,
78
376
  timeoutMs: (parsed.timeoutMs ?? 120_000) + (parsed.readyTimeoutMs ?? 30_000) + 10_000,
79
377
  });
@@ -95,7 +393,7 @@ async function runPanesArchive(parsed) {
95
393
  source: parsed.source === 'user' || parsed.source === 'agent' ? parsed.source : undefined,
96
394
  };
97
395
  await confirmPaneArchive(parsed, request);
98
- const result = await (0, daemonClient_1.invokeDaemon)('runpane:panes:archive', [request], {
396
+ const result = await (0, daemonClient_1.invokeDaemon)('runpane:panes:archive', [request], paneArchiveResultSchema, {
99
397
  paneDir: parsed.paneDir,
100
398
  timeoutMs: 40_000,
101
399
  });
@@ -117,7 +415,7 @@ async function runPanesPin(parsed, pinned) {
117
415
  ...(parsed.dryRun ? { dryRun: true } : {}),
118
416
  };
119
417
  await confirmPanePin(parsed, request);
120
- const result = await (0, daemonClient_1.invokeDaemon)('runpane:panes:pin', [request], {
418
+ const result = await (0, daemonClient_1.invokeDaemon)('runpane:panes:pin', [request], panePinResultSchema, {
121
419
  paneDir: parsed.paneDir,
122
420
  });
123
421
  if (parsed.json) {
@@ -142,7 +440,7 @@ async function runPanesRename(parsed) {
142
440
  ...(parsed.dryRun ? { dryRun: true } : {}),
143
441
  };
144
442
  await confirmPaneRename(parsed, request);
145
- const result = await (0, daemonClient_1.invokeDaemon)('runpane:panes:rename', [request], {
443
+ const result = await (0, daemonClient_1.invokeDaemon)('runpane:panes:rename', [request], paneRenameResultSchema, {
146
444
  paneDir: parsed.paneDir,
147
445
  });
148
446
  if (parsed.json) {
@@ -159,7 +457,7 @@ async function runPanelsList(parsed) {
159
457
  }
160
458
  const result = await (0, daemonClient_1.invokeDaemon)('runpane:panels:list', [{
161
459
  paneId: parsed.paneId,
162
- }], {
460
+ }], panelListResultSchema, {
163
461
  paneDir: parsed.paneDir,
164
462
  });
165
463
  if (parsed.json) {
@@ -172,7 +470,7 @@ async function runPanelsList(parsed) {
172
470
  async function runPanelsCreate(parsed) {
173
471
  const request = await buildPanelCreateRequest(parsed);
174
472
  await confirmPanelCreate(parsed, request);
175
- const result = await (0, daemonClient_1.invokeDaemon)('runpane:panels:create', [request], {
473
+ const result = await (0, daemonClient_1.invokeDaemon)('runpane:panels:create', [request], panelCreateResultSchema, {
176
474
  paneDir: parsed.paneDir,
177
475
  timeoutMs: (parsed.readyTimeoutMs ?? 30_000) + 10_000,
178
476
  });
@@ -191,7 +489,7 @@ async function runPanelsOutput(parsed) {
191
489
  const result = await (0, daemonClient_1.invokeDaemon)('runpane:panels:output', [{
192
490
  panelId: parsed.panelId,
193
491
  limit: parsed.limit,
194
- }], {
492
+ }], panelOutputResultSchema, {
195
493
  paneDir: parsed.paneDir,
196
494
  });
197
495
  if (parsed.json) {
@@ -207,7 +505,7 @@ async function runPanelsOutput(parsed) {
207
505
  async function runPanelsInput(parsed) {
208
506
  const request = buildPanelInputRequest(parsed);
209
507
  await confirmPanelInput(parsed, request);
210
- const result = await (0, daemonClient_1.invokeDaemon)('runpane:panels:input', [request], {
508
+ const result = await (0, daemonClient_1.invokeDaemon)('runpane:panels:input', [request], panelInputResultSchema, {
211
509
  paneDir: parsed.paneDir,
212
510
  });
213
511
  if (parsed.json) {
@@ -225,7 +523,7 @@ async function runPanelsScreen(parsed) {
225
523
  const result = await (0, daemonClient_1.invokeDaemon)('runpane:panels:screen', [{
226
524
  panelId: parsed.panelId,
227
525
  limit: parsed.limit,
228
- }], {
526
+ }], panelScreenResultSchema, {
229
527
  paneDir: parsed.paneDir,
230
528
  });
231
529
  if (parsed.json) {
@@ -241,7 +539,7 @@ async function runPanelsScreen(parsed) {
241
539
  async function runPanelsSubmit(parsed) {
242
540
  const request = buildPanelInputRequest(parsed, 'submit');
243
541
  await confirmPanelInput(parsed, request, 'submit');
244
- const result = await (0, daemonClient_1.invokeDaemon)('runpane:panels:submit', [request], {
542
+ const result = await (0, daemonClient_1.invokeDaemon)('runpane:panels:submit', [request], panelSubmitResultSchema, {
245
543
  paneDir: parsed.paneDir,
246
544
  });
247
545
  if (parsed.json) {
@@ -263,7 +561,7 @@ async function runPanelsSubmitComposer(parsed) {
263
561
  const result = await (0, daemonClient_1.invokeDaemon)('runpane:panels:submit-composer', [{
264
562
  panelId: parsed.panelId,
265
563
  strategy: parsed.composerStrategy,
266
- }], {
564
+ }], panelSubmitComposerResultSchema, {
267
565
  paneDir: parsed.paneDir,
268
566
  });
269
567
  if (parsed.json) {
@@ -291,7 +589,7 @@ async function runPanelsWait(parsed) {
291
589
  contains: parsed.contains,
292
590
  timeoutMs: parsed.timeoutMs,
293
591
  intervalMs: parsed.intervalMs,
294
- }], {
592
+ }], panelWaitResultSchema, {
295
593
  paneDir: parsed.paneDir,
296
594
  timeoutMs: (parsed.timeoutMs ?? 30_000) + 5_000,
297
595
  });
@@ -309,7 +607,7 @@ async function runAgentsDoctor(parsed) {
309
607
  const result = await (0, daemonClient_1.invokeDaemon)('runpane:agents:doctor', [{
310
608
  agent: parsed.agent,
311
609
  repo: parsed.repo,
312
- }], {
610
+ }], agentDoctorResultSchema, {
313
611
  paneDir: parsed.paneDir,
314
612
  });
315
613
  if (parsed.json) {
@@ -641,8 +939,11 @@ async function askAgentChoice() {
641
939
  if (Number.isInteger(byIndex) && byIndex >= 1 && byIndex <= agents.length) {
642
940
  return agents[byIndex - 1];
643
941
  }
644
- if (agents.includes(answer)) {
645
- return answer;
942
+ try {
943
+ return (0, boundaryDecoder_1.decodeBoundary)(answer, agentSchema);
944
+ }
945
+ catch {
946
+ // Keep prompting until the user chooses a supported agent.
646
947
  }
647
948
  console.log(`Choose one of: ${agents.join(', ')}`);
648
949
  }
@@ -692,10 +993,9 @@ function printPaneListResult(result) {
692
993
  }
693
994
  function printPaneCreateResult(result) {
694
995
  for (const item of result.items) {
695
- if (item.sessionId || item.panelId) {
996
+ if (item.ok) {
696
997
  const worktree = item.worktreePath ? ` at ${item.worktreePath}` : '';
697
- const status = item.ok ? 'Created' : 'Created with follow-up needed';
698
- console.log(`${status} ${item.name ?? `pane ${item.index}`}: session ${item.sessionId ?? 'unknown'} panel ${item.panelId ?? 'unknown'}${worktree}`);
998
+ console.log(`Created ${item.name ?? `pane ${item.index}`}: session ${item.sessionId ?? 'unknown'} panel ${item.panelId ?? 'unknown'}${worktree}`);
699
999
  if (item.readiness) {
700
1000
  console.log(` Ready: ${item.readiness.ok ? 'yes' : item.readiness.timedOut ? 'timed out' : 'blocked'} after ${item.readiness.elapsedMs}ms`);
701
1001
  if (item.readiness.blocked) {
@@ -708,7 +1008,7 @@ function printPaneCreateResult(result) {
708
1008
  }
709
1009
  continue;
710
1010
  }
711
- console.error(`Failed ${item.name ?? `pane ${item.index}`}: ${item.error?.message ?? 'unknown error'}`);
1011
+ console.error(`Failed ${item.name ?? `pane ${item.index}`}: ${item.error.message}`);
712
1012
  }
713
1013
  }
714
1014
  function printPaneArchiveResult(result) {
@@ -810,92 +1110,60 @@ function printPanelListResult(result) {
810
1110
  function isInteractiveShell() {
811
1111
  return Boolean(node_process_1.stdin.isTTY && node_process_1.stdout.isTTY && !process.env.CI);
812
1112
  }
813
- function isRecord(value) {
814
- return typeof value === 'object' && value !== null && !Array.isArray(value);
815
- }
816
1113
  function parsePaneCreateRequestPayload(value) {
817
- if (!isRecord(value)) {
818
- throw new Error('--from-json payload must be an object.');
1114
+ let decoded;
1115
+ try {
1116
+ decoded = (0, boundaryDecoder_1.decodeBoundary)(value, paneCreateRequestInputSchema);
819
1117
  }
820
- const repo = value.repo;
821
- const panes = value.panes;
822
- if (!isRepoSelector(repo)) {
823
- throw new Error('--from-json payload must include a valid repo selector.');
1118
+ catch {
1119
+ throw new Error('--from-json payload must be an object.');
824
1120
  }
825
- if (!Array.isArray(panes) || panes.length === 0) {
1121
+ if (decoded.panes.length === 0) {
826
1122
  throw new Error('--from-json payload must include at least one pane.');
827
1123
  }
828
- if (value.noFocus === true && value.focus === true) {
1124
+ if (decoded.noFocus === true && decoded.focus === true) {
829
1125
  throw new Error('--from-json payload cannot include both noFocus and focus.');
830
1126
  }
831
- if (value.source !== undefined && value.source !== 'user' && value.source !== 'agent') {
832
- throw new Error('--from-json payload source must be user or agent.');
833
- }
834
1127
  return {
835
- repo,
836
- panes: panes.map(parsePaneCreateItemPayload),
837
- dryRun: typeof value.dryRun === 'boolean' ? value.dryRun : undefined,
838
- timeoutMs: typeof value.timeoutMs === 'number' ? value.timeoutMs : undefined,
839
- waitReady: typeof value.waitReady === 'boolean' ? value.waitReady : undefined,
840
- readyTimeoutMs: typeof value.readyTimeoutMs === 'number' ? value.readyTimeoutMs : undefined,
841
- concurrency: typeof value.concurrency === 'number' ? value.concurrency : undefined,
842
- noFocus: typeof value.noFocus === 'boolean' ? value.noFocus : undefined,
843
- focus: typeof value.focus === 'boolean' ? value.focus : undefined,
844
- source: value.source === 'user' || value.source === 'agent' ? value.source : undefined,
1128
+ ...decoded,
1129
+ panes: decoded.panes.map(parsePaneCreateItemPayload),
845
1130
  };
846
1131
  }
847
1132
  function parsePaneCreateItemPayload(value, index) {
848
- if (!isRecord(value)) {
849
- throw new Error(`--from-json pane ${index} must be an object.`);
850
- }
851
- if (typeof value.name !== 'string' || value.name.trim().length === 0) {
1133
+ if (value.name.trim().length === 0) {
852
1134
  throw new Error(`--from-json pane ${index} must include a name.`);
853
1135
  }
854
1136
  return {
855
1137
  name: value.name,
856
- worktreeName: optionalString(value.worktreeName),
857
- baseBranch: optionalString(value.baseBranch),
858
- sessionPrompt: optionalString(value.sessionPrompt),
859
- pinned: typeof value.pinned === 'boolean' ? value.pinned : undefined,
1138
+ worktreeName: value.worktreeName,
1139
+ baseBranch: value.baseBranch,
1140
+ sessionPrompt: value.sessionPrompt,
1141
+ pinned: value.pinned,
860
1142
  tool: parsePaneToolSpecPayload(value.tool, index),
861
1143
  };
862
1144
  }
863
1145
  function parsePaneToolSpecPayload(value, index) {
864
- if (!isRecord(value)) {
865
- throw new Error(`--from-json pane ${index} must include a tool object.`);
866
- }
867
- if (typeof value.agent === 'string') {
868
- if (!contract_1.RUNPANE_CONTRACT.enums.agents.includes(value.agent)) {
1146
+ if (value.agent !== undefined) {
1147
+ let agent;
1148
+ try {
1149
+ agent = (0, boundaryDecoder_1.decodeBoundary)(value.agent, agentSchema);
1150
+ }
1151
+ catch {
869
1152
  throw new Error(`--from-json pane ${index} includes an unsupported agent.`);
870
1153
  }
871
1154
  return {
872
- agent: value.agent,
873
- title: optionalString(value.title),
874
- initialInput: optionalString(value.initialInput),
1155
+ agent,
1156
+ title: value.title,
1157
+ initialInput: value.initialInput,
875
1158
  };
876
1159
  }
877
- if (typeof value.command === 'string' && value.command.trim().length > 0) {
1160
+ if (value.command !== undefined && value.command.trim().length > 0) {
878
1161
  return {
879
1162
  command: value.command,
880
- title: optionalString(value.title),
881
- initialInput: optionalString(value.initialInput),
1163
+ title: value.title,
1164
+ initialInput: value.initialInput,
882
1165
  };
883
1166
  }
884
1167
  throw new Error(`--from-json pane ${index} tool must include agent or command.`);
885
1168
  }
886
- function isRepoSelector(value) {
887
- if (typeof value === 'string') {
888
- return value.length > 0;
889
- }
890
- if (!isRecord(value)) {
891
- return false;
892
- }
893
- return (typeof value.id === 'number' ||
894
- typeof value.path === 'string' ||
895
- typeof value.name === 'string' ||
896
- value.active === true);
897
- }
898
- function optionalString(value) {
899
- return typeof value === 'string' ? value : undefined;
900
- }
901
1169
  //# sourceMappingURL=localControl.js.map