@runtypelabs/cli 2.59.1 → 2.59.2

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 (84) hide show
  1. package/dist/chunk-0-T9NWjH.js +3899 -0
  2. package/dist/chunk-0x7UKC1U.js +17 -0
  3. package/dist/chunk-2ySxXtcg.js +418 -0
  4. package/dist/chunk-3An_BRHv.js +501 -0
  5. package/dist/chunk-6uTxgdiY.js +16218 -0
  6. package/dist/chunk-87nRnNRG.js +1363 -0
  7. package/dist/chunk-B3wo8uRx.js +322 -0
  8. package/dist/chunk-BGp3ZdBy.js +560 -0
  9. package/dist/chunk-BJQv9Elp.js +107 -0
  10. package/dist/chunk-BOpO6xE-.js +6053 -0
  11. package/dist/chunk-BQXXCL8B.js +102 -0
  12. package/dist/chunk-BV-8isOd.js +34 -0
  13. package/dist/chunk-BVMhjGVe.js +826 -0
  14. package/dist/chunk-BW2fg46T.js +141 -0
  15. package/dist/chunk-BWJdY5Ag.js +36 -0
  16. package/dist/chunk-BYJOrLhh.js +302 -0
  17. package/dist/chunk-BYab8EVL.js +127 -0
  18. package/dist/chunk-BfEKvp7h.js +82 -0
  19. package/dist/chunk-BhgLSfH6.js +1123 -0
  20. package/dist/chunk-BirUxTtH.js +296 -0
  21. package/dist/chunk-BmB6UVZ9.js +1559 -0
  22. package/dist/chunk-BnWhIqW1.js +109 -0
  23. package/dist/chunk-Bpfnfk0t.js +123 -0
  24. package/dist/chunk-BrhgdnM3.js +108 -0
  25. package/dist/chunk-Bt0XAgX5.js +327 -0
  26. package/dist/chunk-Bu0FJr6S.js +84 -0
  27. package/dist/chunk-BvEoKpN3.js +255 -0
  28. package/dist/chunk-BxNJgYbE.js +28 -0
  29. package/dist/chunk-C1OFhd7F.js +6131 -0
  30. package/dist/chunk-C7e7WwbU.js +331 -0
  31. package/dist/chunk-CDTYP6bN.js +558 -0
  32. package/dist/chunk-CGDQoqDC.js +24 -0
  33. package/dist/chunk-CJraEBVd.js +127 -0
  34. package/dist/chunk-CQrNhOtv.js +40 -0
  35. package/dist/chunk-CW6AzBH6.js +128 -0
  36. package/dist/chunk-CXgL4w-9.js +317 -0
  37. package/dist/chunk-CZrqoPyf.js +233 -0
  38. package/dist/chunk-CcFCyqbB.js +83 -0
  39. package/dist/chunk-CdaIvO-y.js +485 -0
  40. package/dist/chunk-CehSXtgK.js +624 -0
  41. package/dist/chunk-Ciqkop65.js +218 -0
  42. package/dist/chunk-CoAWdSiE.js +43 -0
  43. package/dist/chunk-Crb4y7t4.js +830 -0
  44. package/dist/chunk-CrlqIfmb.js +337 -0
  45. package/dist/chunk-Cs4pwCQ-.js +324 -0
  46. package/dist/chunk-CwM_9y01.js +519 -0
  47. package/dist/chunk-CyRbIJg8.js +440 -0
  48. package/dist/chunk-D0OHsyMy.js +212 -0
  49. package/dist/chunk-D3y2bURs.js +1347 -0
  50. package/dist/chunk-D4_mJk03.js +2338 -0
  51. package/dist/chunk-D6C8rned.js +578 -0
  52. package/dist/chunk-D9ZbUnks.js +11 -0
  53. package/dist/chunk-DEPmLshX.js +834 -0
  54. package/dist/chunk-DFj1UPB2.js +330 -0
  55. package/dist/chunk-DGdFdZVf.js +197 -0
  56. package/dist/chunk-DGv7X9S_.js +63 -0
  57. package/dist/chunk-DJQ47WYZ.js +664 -0
  58. package/dist/chunk-DJw3O61j.js +1974 -0
  59. package/dist/chunk-DK4FbWVK.js +100 -0
  60. package/dist/chunk-DSRYhUus.js +993 -0
  61. package/dist/chunk-DajZ9Eg4.js +299 -0
  62. package/dist/chunk-Df4dunvU.js +195 -0
  63. package/dist/chunk-DjNTPhfO.js +481 -0
  64. package/dist/chunk-Dn8eaJuu.js +1042 -0
  65. package/dist/chunk-DwDWqSxM.js +637 -0
  66. package/dist/chunk-Dz7cEtxl.js +84 -0
  67. package/dist/chunk-E_0bgjrS.js +359 -0
  68. package/dist/chunk-KPYN2vUp.js +776 -0
  69. package/dist/chunk-KcqPQJBi.js +86 -0
  70. package/dist/chunk-N9H0JnoG.js +349 -0
  71. package/dist/chunk-NONFcXkn.js +728 -0
  72. package/dist/chunk-PrFjcpmH.js +256 -0
  73. package/dist/chunk-QSfNYiw9.js +11 -0
  74. package/dist/chunk-R265bzj9.js +226 -0
  75. package/dist/chunk-X9V_r6jM.js +166 -0
  76. package/dist/chunk-ZBtPUtyA.js +55 -0
  77. package/dist/chunk-ZCTfmOs7.js +4939 -0
  78. package/dist/chunk-h6oavj0t.js +97 -0
  79. package/dist/chunk-i7DwkvvD.js +42 -0
  80. package/dist/chunk-mG-4eZ6S.js +203 -0
  81. package/dist/chunk-o0ygUbCf.js +313 -0
  82. package/dist/chunk-ucu5lrDZ.js +5715 -0
  83. package/dist/index.js +11367 -73789
  84. package/package.json +4 -4
@@ -0,0 +1,637 @@
1
+ #!/usr/bin/env node
2
+ import { b as CredentialStore } from "./index.js";
3
+ import { S as selectAccountId, p as buildDashboardUrl } from "./chunk-ucu5lrDZ.js";
4
+ import { s as getDashboardUrl, t as ApiKeyManager } from "./chunk-BW2fg46T.js";
5
+ import { n as browserLogin, r as orgMismatchWarning } from "./chunk-BnWhIqW1.js";
6
+ import { n as validateQuickStartUrl, t as createQuickStartProduct } from "./chunk-i7DwkvvD.js";
7
+ import { useCallback, useEffect, useState } from "react";
8
+ import { Box, Text, useApp, useInput } from "ink";
9
+ import TextInput from "ink-text-input";
10
+ import SelectInput from "ink-select-input";
11
+ import { Spinner, theme } from "@runtypelabs/ink-components";
12
+ import { jsx, jsxs } from "react/jsx-runtime";
13
+ // src/ink/init/WizardStep.tsx
14
+ function WizardStep({ stepNumber, totalSteps, title, children }) {
15
+ return /* @__PURE__ */ jsxs(Box, {
16
+ flexDirection: "column",
17
+ children: [
18
+ /* @__PURE__ */ jsxs(Text, {
19
+ dimColor: true,
20
+ children: [
21
+ "Step ",
22
+ stepNumber,
23
+ " of ",
24
+ totalSteps
25
+ ]
26
+ }),
27
+ /* @__PURE__ */ jsx(Text, {
28
+ color: theme.primary,
29
+ bold: true,
30
+ children: title
31
+ }),
32
+ /* @__PURE__ */ jsx(Box, {
33
+ marginTop: 1,
34
+ children
35
+ }),
36
+ stepNumber > 1 && /* @__PURE__ */ jsxs(Text, {
37
+ dimColor: true,
38
+ children: ["\n", "Escape: back"]
39
+ })
40
+ ]
41
+ });
42
+ }
43
+ // src/ink/init/StepSummary.tsx
44
+ function StepSummary({ answers }) {
45
+ if (answers.length === 0) return null;
46
+ return /* @__PURE__ */ jsx(Box, {
47
+ flexDirection: "column",
48
+ marginBottom: 1,
49
+ borderStyle: "single",
50
+ borderTop: true,
51
+ borderBottom: false,
52
+ borderLeft: false,
53
+ borderRight: false,
54
+ borderColor: theme.muted,
55
+ children: answers.map((answer, index) => /* @__PURE__ */ jsxs(Text, {
56
+ dimColor: true,
57
+ children: [
58
+ answer.label,
59
+ ": ",
60
+ answer.value
61
+ ]
62
+ }, index))
63
+ });
64
+ }
65
+ // src/ink/init/InitApp.tsx
66
+ const TOTAL_VISIBLE_STEPS = 3;
67
+ function getStepNumber(step) {
68
+ if (step <= 1) return 1;
69
+ if (step <= 5) return 2;
70
+ return 3;
71
+ }
72
+ function InitApp({ apiUrl, onComplete }) {
73
+ const { exit } = useApp();
74
+ const [state, setState] = useState({
75
+ step: 0,
76
+ apiKey: null,
77
+ urlInput: "",
78
+ productChoice: null,
79
+ agentCard: null,
80
+ templateId: null,
81
+ productName: "",
82
+ error: null,
83
+ loading: true,
84
+ loadingLabel: "Checking credentials...",
85
+ complete: false,
86
+ createdProductId: null,
87
+ account: void 0
88
+ });
89
+ const getSummary = useCallback(() => {
90
+ const answers = [];
91
+ if (state.apiKey) answers.push({
92
+ label: "Auth",
93
+ value: "Signed in (" + state.apiKey.substring(0, 10) + "...)"
94
+ });
95
+ if (state.productChoice) answers.push({
96
+ label: "Product",
97
+ value: state.productChoice === "url" ? "Import A2A agent" : "Skip"
98
+ });
99
+ if (state.agentCard) answers.push({
100
+ label: "Agent",
101
+ value: state.agentCard.name
102
+ });
103
+ return answers;
104
+ }, [
105
+ state.apiKey,
106
+ state.productChoice,
107
+ state.agentCard
108
+ ]);
109
+ useEffect(() => {
110
+ if (state.step !== 0) return void 0;
111
+ const checkAndAuth = async () => {
112
+ const store = new CredentialStore();
113
+ const existingKey = await store.getApiKey();
114
+ let storedKeyNotice = null;
115
+ if (existingKey) {
116
+ const apiKeyManager = new ApiKeyManager();
117
+ try {
118
+ if (await apiKeyManager.validateApiKey(existingKey, apiUrl)) {
119
+ const existingCreds = await store.getCredentials();
120
+ setState((prev) => ({
121
+ ...prev,
122
+ apiKey: existingKey,
123
+ account: selectAccountId({
124
+ userId: existingCreds?.userId,
125
+ organizationId: existingCreds?.orgId
126
+ }),
127
+ step: 2,
128
+ loading: false
129
+ }));
130
+ return;
131
+ }
132
+ } catch (err) {
133
+ storedKeyNotice = err instanceof Error ? err.message : String(err);
134
+ }
135
+ }
136
+ setState((prev) => ({
137
+ ...prev,
138
+ step: 1,
139
+ loading: true,
140
+ loadingLabel: storedKeyNotice ? `${storedKeyNotice} Opening browser to sign in instead...` : "Opening browser to sign in..."
141
+ }));
142
+ try {
143
+ const login = await browserLogin({
144
+ apiUrl,
145
+ onProgress: (label) => setState((s) => ({
146
+ ...s,
147
+ loadingLabel: label
148
+ }))
149
+ });
150
+ const mismatch = orgMismatchWarning(login);
151
+ if (mismatch) throw new Error(mismatch);
152
+ const { apiKey: key, userId, orgId } = login;
153
+ setState((s) => ({
154
+ ...s,
155
+ apiKey: key,
156
+ account: selectAccountId({
157
+ userId,
158
+ organizationId: orgId
159
+ }),
160
+ step: 2,
161
+ loading: false
162
+ }));
163
+ } catch (err) {
164
+ const message = err instanceof Error ? err.message : "Authentication failed";
165
+ setState((s) => ({
166
+ ...s,
167
+ error: message,
168
+ loading: false,
169
+ step: 1
170
+ }));
171
+ }
172
+ };
173
+ checkAndAuth();
174
+ }, [state.step, apiUrl]);
175
+ useInput((_input, key) => {
176
+ if (key.escape && !state.loading && !state.complete) setState((prev) => {
177
+ if (prev.step <= 2) return prev;
178
+ let prevStep = prev.step - 1;
179
+ if (prevStep === 1) prevStep = 2;
180
+ if (prevStep === 6) prevStep = 5;
181
+ return {
182
+ ...prev,
183
+ step: prevStep,
184
+ error: null
185
+ };
186
+ });
187
+ }, { isActive: !state.loading && !state.complete });
188
+ const handleProductChoice = useCallback((item) => {
189
+ const choice = item.value;
190
+ setState((prev) => ({
191
+ ...prev,
192
+ productChoice: choice
193
+ }));
194
+ if (choice === "skip") {
195
+ setState((prev) => ({
196
+ ...prev,
197
+ step: 7,
198
+ complete: true
199
+ }));
200
+ return;
201
+ }
202
+ setState((prev) => ({
203
+ ...prev,
204
+ step: 3
205
+ }));
206
+ }, []);
207
+ const handleUrlSubmit = useCallback((value) => {
208
+ if (!value.trim()) {
209
+ setState((prev) => ({
210
+ ...prev,
211
+ error: "URL is required"
212
+ }));
213
+ return;
214
+ }
215
+ try {
216
+ new URL(value.trim());
217
+ } catch {
218
+ setState((prev) => ({
219
+ ...prev,
220
+ error: "Please enter a valid URL"
221
+ }));
222
+ return;
223
+ }
224
+ setState((prev) => ({
225
+ ...prev,
226
+ loading: true,
227
+ loadingLabel: "Validating URL...",
228
+ error: null
229
+ }));
230
+ const validateUrl = async () => {
231
+ try {
232
+ const result = await validateQuickStartUrl(value.trim(), apiUrl);
233
+ if (!result.valid) {
234
+ setState((s) => ({
235
+ ...s,
236
+ error: result.error || "Validation failed",
237
+ loading: false
238
+ }));
239
+ return;
240
+ }
241
+ setState((s) => ({
242
+ ...s,
243
+ agentCard: result.agentCard || null,
244
+ templateId: result.templateId || null,
245
+ productName: result.agentCard?.name || "",
246
+ step: 4,
247
+ loading: false
248
+ }));
249
+ } catch (err) {
250
+ const message = err instanceof Error ? err.message : "Validation failed";
251
+ setState((s) => ({
252
+ ...s,
253
+ error: message,
254
+ loading: false
255
+ }));
256
+ }
257
+ };
258
+ validateUrl();
259
+ }, [apiUrl]);
260
+ const handleConfirmCreate = useCallback((confirmed) => {
261
+ if (!confirmed) {
262
+ setState((prev) => ({
263
+ ...prev,
264
+ step: 7,
265
+ complete: true
266
+ }));
267
+ return;
268
+ }
269
+ setState((prev) => ({
270
+ ...prev,
271
+ step: 5
272
+ }));
273
+ }, []);
274
+ const handleProductNameSubmit = useCallback((value) => {
275
+ const name = value.trim() || state.agentCard?.name || "My Product";
276
+ setState((prev) => ({
277
+ ...prev,
278
+ productName: name,
279
+ step: 6,
280
+ loading: true,
281
+ loadingLabel: "Creating product...",
282
+ error: null
283
+ }));
284
+ const createProduct = async () => {
285
+ try {
286
+ if (!state.apiKey || !state.templateId || !state.agentCard) throw new Error("Missing product setup details");
287
+ const result = await createQuickStartProduct(state.apiKey, {
288
+ templateId: state.templateId,
289
+ agentCard: state.agentCard,
290
+ productName: name,
291
+ sourceUrl: state.urlInput || state.agentCard.url
292
+ }, apiUrl);
293
+ if (!result.success) {
294
+ setState((s) => ({
295
+ ...s,
296
+ error: result.error || "Failed to create product",
297
+ loading: false,
298
+ step: 5
299
+ }));
300
+ return;
301
+ }
302
+ setState((s) => ({
303
+ ...s,
304
+ createdProductId: result.product?.id || null,
305
+ step: 7,
306
+ loading: false,
307
+ complete: true
308
+ }));
309
+ } catch (err) {
310
+ const message = err instanceof Error ? err.message : "Creation failed";
311
+ setState((s) => ({
312
+ ...s,
313
+ error: message,
314
+ loading: false,
315
+ step: 5
316
+ }));
317
+ }
318
+ };
319
+ createProduct();
320
+ }, [
321
+ apiUrl,
322
+ state.apiKey,
323
+ state.agentCard,
324
+ state.templateId,
325
+ state.urlInput
326
+ ]);
327
+ useEffect(() => {
328
+ if (!state.complete) return void 0;
329
+ const timer = setTimeout(() => {
330
+ onComplete();
331
+ exit();
332
+ }, 100);
333
+ return () => clearTimeout(timer);
334
+ }, [
335
+ state.complete,
336
+ onComplete,
337
+ exit
338
+ ]);
339
+ if (state.loading) return /* @__PURE__ */ jsxs(Box, {
340
+ flexDirection: "column",
341
+ children: [state.step <= 1 && /* @__PURE__ */ jsxs(Text, {
342
+ color: theme.primary,
343
+ bold: true,
344
+ children: [
345
+ "\n",
346
+ "Welcome to Runtype!",
347
+ "\n"
348
+ ]
349
+ }), /* @__PURE__ */ jsx(Spinner, { label: state.loadingLabel })]
350
+ });
351
+ const summary = getSummary();
352
+ if (state.step === 1) return /* @__PURE__ */ jsxs(Box, {
353
+ flexDirection: "column",
354
+ children: [/* @__PURE__ */ jsxs(Text, {
355
+ color: theme.primary,
356
+ bold: true,
357
+ children: [
358
+ "\n",
359
+ "Welcome to Runtype!",
360
+ "\n"
361
+ ]
362
+ }), /* @__PURE__ */ jsx(WizardStep, {
363
+ stepNumber: getStepNumber(1),
364
+ totalSteps: TOTAL_VISIBLE_STEPS,
365
+ title: "Sign in",
366
+ children: /* @__PURE__ */ jsxs(Box, {
367
+ flexDirection: "column",
368
+ children: [state.error && /* @__PURE__ */ jsx(Text, {
369
+ color: theme.error,
370
+ children: state.error
371
+ }), /* @__PURE__ */ jsxs(Text, {
372
+ dimColor: true,
373
+ children: [
374
+ "Authentication failed. Run ",
375
+ /* @__PURE__ */ jsx(Text, {
376
+ color: theme.primary,
377
+ children: "runtype auth login"
378
+ }),
379
+ " to try again, or use ",
380
+ /* @__PURE__ */ jsxs(Text, {
381
+ color: theme.primary,
382
+ children: ["runtype init --api-key ", "<key>"]
383
+ }),
384
+ " ",
385
+ "to authenticate with an API key."
386
+ ]
387
+ })]
388
+ })
389
+ })]
390
+ });
391
+ if (state.step === 2) return /* @__PURE__ */ jsxs(Box, {
392
+ flexDirection: "column",
393
+ children: [summary.length > 0 && /* @__PURE__ */ jsx(StepSummary, { answers: summary }), /* @__PURE__ */ jsx(WizardStep, {
394
+ stepNumber: getStepNumber(2),
395
+ totalSteps: TOTAL_VISIBLE_STEPS,
396
+ title: "What would you like to do?",
397
+ children: /* @__PURE__ */ jsx(SelectInput, {
398
+ items: [{
399
+ label: "Import A2A agent URL",
400
+ value: "url"
401
+ }, {
402
+ label: "Skip for now",
403
+ value: "skip"
404
+ }],
405
+ onSelect: handleProductChoice
406
+ })
407
+ })]
408
+ });
409
+ if (state.step === 3) return /* @__PURE__ */ jsxs(Box, {
410
+ flexDirection: "column",
411
+ children: [summary.length > 0 && /* @__PURE__ */ jsx(StepSummary, { answers: summary }), /* @__PURE__ */ jsx(WizardStep, {
412
+ stepNumber: getStepNumber(3),
413
+ totalSteps: TOTAL_VISIBLE_STEPS,
414
+ title: "Enter the agent URL",
415
+ children: /* @__PURE__ */ jsxs(Box, {
416
+ flexDirection: "column",
417
+ children: [state.error && /* @__PURE__ */ jsx(Text, {
418
+ color: theme.error,
419
+ children: state.error
420
+ }), state.loading ? /* @__PURE__ */ jsx(Spinner, { label: state.loadingLabel }) : /* @__PURE__ */ jsxs(Box, { children: [/* @__PURE__ */ jsx(Text, {
421
+ color: theme.muted,
422
+ children: "> "
423
+ }), /* @__PURE__ */ jsx(TextInput, {
424
+ value: state.urlInput,
425
+ onChange: (value) => setState((prev) => ({
426
+ ...prev,
427
+ urlInput: value,
428
+ error: null
429
+ })),
430
+ onSubmit: handleUrlSubmit,
431
+ placeholder: "https://..."
432
+ })] })]
433
+ })
434
+ })]
435
+ });
436
+ if (state.step === 4 && state.agentCard) return /* @__PURE__ */ jsxs(Box, {
437
+ flexDirection: "column",
438
+ children: [summary.length > 0 && /* @__PURE__ */ jsx(StepSummary, { answers: summary }), /* @__PURE__ */ jsx(WizardStep, {
439
+ stepNumber: getStepNumber(4),
440
+ totalSteps: TOTAL_VISIBLE_STEPS,
441
+ title: "Agent Detected",
442
+ children: /* @__PURE__ */ jsxs(Box, {
443
+ flexDirection: "column",
444
+ children: [
445
+ /* @__PURE__ */ jsxs(Text, { children: [
446
+ " ",
447
+ "Name: ",
448
+ /* @__PURE__ */ jsx(Text, {
449
+ bold: true,
450
+ children: state.agentCard.name
451
+ })
452
+ ] }),
453
+ state.agentCard.description && /* @__PURE__ */ jsxs(Text, {
454
+ dimColor: true,
455
+ children: [
456
+ " ",
457
+ "Description: ",
458
+ state.agentCard.description
459
+ ]
460
+ }),
461
+ /* @__PURE__ */ jsxs(Text, {
462
+ dimColor: true,
463
+ children: [
464
+ " ",
465
+ "URL: ",
466
+ state.agentCard.url
467
+ ]
468
+ }),
469
+ state.agentCard.skills && state.agentCard.skills.length > 0 && /* @__PURE__ */ jsxs(Box, {
470
+ flexDirection: "column",
471
+ marginTop: 1,
472
+ children: [/* @__PURE__ */ jsxs(Text, { children: [" ", "Skills:"] }), state.agentCard.skills.map((skill, i) => /* @__PURE__ */ jsxs(Text, {
473
+ dimColor: true,
474
+ children: [
475
+ " ",
476
+ skill.name,
477
+ skill.description ? ` - ${skill.description}` : ""
478
+ ]
479
+ }, i))]
480
+ }),
481
+ /* @__PURE__ */ jsx(Box, {
482
+ marginTop: 1,
483
+ children: /* @__PURE__ */ jsxs(Text, { children: ["Create this product? ", /* @__PURE__ */ jsx(Text, {
484
+ color: theme.muted,
485
+ children: "(y/N)"
486
+ })] })
487
+ }),
488
+ /* @__PURE__ */ jsx(ConfirmInput, { onConfirm: handleConfirmCreate })
489
+ ]
490
+ })
491
+ })]
492
+ });
493
+ if (state.step === 5) return /* @__PURE__ */ jsxs(Box, {
494
+ flexDirection: "column",
495
+ children: [summary.length > 0 && /* @__PURE__ */ jsx(StepSummary, { answers: summary }), /* @__PURE__ */ jsx(WizardStep, {
496
+ stepNumber: getStepNumber(5),
497
+ totalSteps: TOTAL_VISIBLE_STEPS,
498
+ title: "Product name",
499
+ children: /* @__PURE__ */ jsxs(Box, {
500
+ flexDirection: "column",
501
+ children: [state.error && /* @__PURE__ */ jsx(Text, {
502
+ color: theme.error,
503
+ children: state.error
504
+ }), /* @__PURE__ */ jsxs(Box, { children: [/* @__PURE__ */ jsx(Text, {
505
+ color: theme.muted,
506
+ children: "> "
507
+ }), /* @__PURE__ */ jsx(TextInput, {
508
+ value: state.productName,
509
+ onChange: (value) => setState((prev) => ({
510
+ ...prev,
511
+ productName: value,
512
+ error: null
513
+ })),
514
+ onSubmit: handleProductNameSubmit,
515
+ placeholder: state.agentCard?.name || "My Product"
516
+ })] })]
517
+ })
518
+ })]
519
+ });
520
+ if (state.step === 6) return /* @__PURE__ */ jsx(Spinner, { label: state.loadingLabel });
521
+ if (state.step === 7) {
522
+ const dashboardUrl = getDashboardUrl();
523
+ const productDashboardUrl = state.createdProductId ? buildDashboardUrl({
524
+ baseUrl: dashboardUrl,
525
+ path: `/products/${state.createdProductId}`,
526
+ account: state.account
527
+ }) : "";
528
+ return /* @__PURE__ */ jsxs(Box, {
529
+ flexDirection: "column",
530
+ children: [state.createdProductId ? /* @__PURE__ */ jsxs(Box, {
531
+ flexDirection: "column",
532
+ children: [
533
+ /* @__PURE__ */ jsxs(Text, {
534
+ color: theme.success,
535
+ bold: true,
536
+ children: ["✓", " Setup complete!"]
537
+ }),
538
+ /* @__PURE__ */ jsxs(Text, { children: [
539
+ " ",
540
+ "Product ID: ",
541
+ state.createdProductId
542
+ ] }),
543
+ /* @__PURE__ */ jsxs(Text, { children: [
544
+ " ",
545
+ "Dashboard: ",
546
+ productDashboardUrl
547
+ ] })
548
+ ]
549
+ }) : /* @__PURE__ */ jsxs(Text, {
550
+ color: theme.success,
551
+ bold: true,
552
+ children: ["✓", " Authentication complete!"]
553
+ }), /* @__PURE__ */ jsxs(Box, {
554
+ flexDirection: "column",
555
+ marginTop: 1,
556
+ children: [
557
+ /* @__PURE__ */ jsx(Text, {
558
+ color: theme.primary,
559
+ children: "What you can do next:"
560
+ }),
561
+ /* @__PURE__ */ jsxs(Text, { children: [
562
+ " ",
563
+ /* @__PURE__ */ jsx(Text, {
564
+ color: theme.success,
565
+ children: "runtype products init"
566
+ }),
567
+ " ",
568
+ "Create a product from an agent URL"
569
+ ] }),
570
+ /* @__PURE__ */ jsxs(Text, { children: [
571
+ " ",
572
+ /* @__PURE__ */ jsx(Text, {
573
+ color: theme.success,
574
+ children: "runtype flows list"
575
+ }),
576
+ " ",
577
+ "List your flows"
578
+ ] }),
579
+ /* @__PURE__ */ jsxs(Text, { children: [
580
+ " ",
581
+ /* @__PURE__ */ jsxs(Text, {
582
+ color: theme.success,
583
+ children: ["runtype dispatch -f ", "<id>"]
584
+ }),
585
+ " ",
586
+ "Execute a flow"
587
+ ] }),
588
+ /* @__PURE__ */ jsxs(Text, { children: [
589
+ " ",
590
+ /* @__PURE__ */ jsx(Text, {
591
+ color: theme.success,
592
+ children: "runtype agents list"
593
+ }),
594
+ " ",
595
+ "List your agents"
596
+ ] }),
597
+ /* @__PURE__ */ jsxs(Text, { children: [
598
+ " ",
599
+ /* @__PURE__ */ jsx(Text, {
600
+ color: theme.success,
601
+ children: "runtype models list"
602
+ }),
603
+ " ",
604
+ "View enabled models"
605
+ ] }),
606
+ /* @__PURE__ */ jsxs(Text, { children: [
607
+ " ",
608
+ /* @__PURE__ */ jsx(Text, {
609
+ color: theme.success,
610
+ children: "runtype --help"
611
+ }),
612
+ " ",
613
+ "See all available commands"
614
+ ] })
615
+ ]
616
+ })]
617
+ });
618
+ }
619
+ return null;
620
+ }
621
+ function ConfirmInput({ onConfirm }) {
622
+ const [answered, setAnswered] = useState(false);
623
+ useInput((input) => {
624
+ if (answered) return;
625
+ const lower = input.toLowerCase();
626
+ if (lower === "y") {
627
+ setAnswered(true);
628
+ onConfirm(true);
629
+ } else if (lower === "n") {
630
+ setAnswered(true);
631
+ onConfirm(false);
632
+ }
633
+ }, { isActive: !answered });
634
+ return null;
635
+ }
636
+ export { InitApp };
637
+