@runtypelabs/cli 2.3.0 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +602 -124
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -10905,7 +10905,8 @@ var require_builtin_tools_registry = __commonJS({
|
|
|
10905
10905
|
KNOWLEDGE_RETRIEVAL: "knowledge_retrieval",
|
|
10906
10906
|
TEXT_TO_SPEECH: "text_to_speech",
|
|
10907
10907
|
VOICE_PROCESSING: "voice_processing",
|
|
10908
|
-
THIRD_PARTY_API: "third_party_api"
|
|
10908
|
+
THIRD_PARTY_API: "third_party_api",
|
|
10909
|
+
ARTIFACT: "artifact"
|
|
10909
10910
|
};
|
|
10910
10911
|
exports.BuiltInToolIdPrefix = {
|
|
10911
10912
|
BUILTIN: "builtin",
|
|
@@ -11387,6 +11388,57 @@ var require_builtin_tools_registry = __commonJS({
|
|
|
11387
11388
|
platformKeySupport: true,
|
|
11388
11389
|
marginPercent: 20,
|
|
11389
11390
|
hidden: true
|
|
11391
|
+
},
|
|
11392
|
+
// Artifact-emit tools (auto-injected at runtime when ArtifactConfig is enabled)
|
|
11393
|
+
{
|
|
11394
|
+
id: "emit_artifact_markdown",
|
|
11395
|
+
name: "Emit Artifact (Markdown)",
|
|
11396
|
+
description: "Stream markdown content to the artifact channel on supported clients.",
|
|
11397
|
+
category: exports.BuiltInToolCategory.ARTIFACT,
|
|
11398
|
+
providers: [exports.BuiltInToolProvider.MULTI],
|
|
11399
|
+
parametersSchema: {
|
|
11400
|
+
type: "object",
|
|
11401
|
+
properties: {
|
|
11402
|
+
title: {
|
|
11403
|
+
type: "string",
|
|
11404
|
+
description: "Optional title for the artifact"
|
|
11405
|
+
},
|
|
11406
|
+
markdown: {
|
|
11407
|
+
type: "string",
|
|
11408
|
+
description: "Markdown content to render"
|
|
11409
|
+
}
|
|
11410
|
+
},
|
|
11411
|
+
required: ["markdown"]
|
|
11412
|
+
},
|
|
11413
|
+
executionHint: "platform",
|
|
11414
|
+
hidden: true
|
|
11415
|
+
},
|
|
11416
|
+
{
|
|
11417
|
+
id: "emit_artifact_component",
|
|
11418
|
+
name: "Emit Artifact (Component)",
|
|
11419
|
+
description: "Emit a named component reference with props to the artifact channel. The client renders it using its registered component library.",
|
|
11420
|
+
category: exports.BuiltInToolCategory.ARTIFACT,
|
|
11421
|
+
providers: [exports.BuiltInToolProvider.MULTI],
|
|
11422
|
+
parametersSchema: {
|
|
11423
|
+
type: "object",
|
|
11424
|
+
properties: {
|
|
11425
|
+
title: {
|
|
11426
|
+
type: "string",
|
|
11427
|
+
description: "Optional title for the artifact"
|
|
11428
|
+
},
|
|
11429
|
+
component: {
|
|
11430
|
+
type: "string",
|
|
11431
|
+
description: "Name of a component registered in the client-side component registry"
|
|
11432
|
+
},
|
|
11433
|
+
props: {
|
|
11434
|
+
type: "object",
|
|
11435
|
+
description: "Props object passed to the component renderer"
|
|
11436
|
+
}
|
|
11437
|
+
},
|
|
11438
|
+
required: ["component"]
|
|
11439
|
+
},
|
|
11440
|
+
executionHint: "platform",
|
|
11441
|
+
hidden: true
|
|
11390
11442
|
}
|
|
11391
11443
|
];
|
|
11392
11444
|
exports.BUILTIN_TOOLS_REGISTRY = [
|
|
@@ -15290,8 +15342,8 @@ var require_provider_routing = __commonJS({
|
|
|
15290
15342
|
});
|
|
15291
15343
|
|
|
15292
15344
|
// src/index.ts
|
|
15293
|
-
import { Command as
|
|
15294
|
-
import
|
|
15345
|
+
import { Command as Command20 } from "commander";
|
|
15346
|
+
import chalk27 from "chalk";
|
|
15295
15347
|
import { config as loadEnv } from "dotenv";
|
|
15296
15348
|
|
|
15297
15349
|
// src/commands/auth.ts
|
|
@@ -31044,14 +31096,439 @@ apiKeysCommand.command("analytics").description("Show API key usage analytics").
|
|
|
31044
31096
|
await waitUntilExit();
|
|
31045
31097
|
});
|
|
31046
31098
|
|
|
31047
|
-
// src/commands/
|
|
31099
|
+
// src/commands/client-tokens.ts
|
|
31048
31100
|
import { Command as Command16 } from "commander";
|
|
31049
31101
|
import chalk22 from "chalk";
|
|
31050
31102
|
import React15 from "react";
|
|
31051
31103
|
import { render as render15 } from "ink";
|
|
31052
31104
|
import { useState as useState29, useEffect as useEffect26 } from "react";
|
|
31053
31105
|
import { Text as Text32 } from "ink";
|
|
31054
|
-
var
|
|
31106
|
+
var clientTokensCommand = new Command16("client-tokens").description(
|
|
31107
|
+
"Manage client tokens for Persona widget embedding"
|
|
31108
|
+
);
|
|
31109
|
+
clientTokensCommand.command("list").description("List your client tokens").option("--json", "Output as JSON").option("--tty", "Force TTY mode").option("--no-tty", "Force non-TTY mode").action(async (options) => {
|
|
31110
|
+
const apiKey = await ensureAuth();
|
|
31111
|
+
if (!apiKey) return;
|
|
31112
|
+
const client = new ApiClient(apiKey);
|
|
31113
|
+
if (!isTTY(options) || options.json) {
|
|
31114
|
+
try {
|
|
31115
|
+
const data = await client.get("/client-tokens");
|
|
31116
|
+
const tokens = data.clientTokens ?? [];
|
|
31117
|
+
if (options.json) {
|
|
31118
|
+
printJson(data);
|
|
31119
|
+
} else {
|
|
31120
|
+
if (tokens.length === 0) {
|
|
31121
|
+
console.log(chalk22.gray("No client tokens found"));
|
|
31122
|
+
return;
|
|
31123
|
+
}
|
|
31124
|
+
console.log(chalk22.cyan("Your Client Tokens:"));
|
|
31125
|
+
for (const token of tokens) {
|
|
31126
|
+
const env = token.environment === "live" ? chalk22.green("live") : chalk22.yellow("test");
|
|
31127
|
+
const active = token.isActive ? "" : chalk22.red(" (inactive)");
|
|
31128
|
+
const origins = chalk22.gray(` origins: ${(token.allowedOrigins || []).join(", ")}`);
|
|
31129
|
+
console.log(` ${chalk22.green(token.id)} ${token.name} [${env}]${active}${origins}`);
|
|
31130
|
+
}
|
|
31131
|
+
console.log(chalk22.dim(`
|
|
31132
|
+
Total: ${tokens.length} tokens`));
|
|
31133
|
+
}
|
|
31134
|
+
} catch (error) {
|
|
31135
|
+
const message = error instanceof Error ? error.message : "Unknown error";
|
|
31136
|
+
console.error(chalk22.red("Failed to fetch client tokens"));
|
|
31137
|
+
console.error(chalk22.red(message));
|
|
31138
|
+
process.exit(1);
|
|
31139
|
+
}
|
|
31140
|
+
return;
|
|
31141
|
+
}
|
|
31142
|
+
const App = () => {
|
|
31143
|
+
const [loading, setLoading] = useState29(true);
|
|
31144
|
+
const [items, setItems] = useState29(null);
|
|
31145
|
+
const [total, setTotal] = useState29(void 0);
|
|
31146
|
+
const [error, setError] = useState29(null);
|
|
31147
|
+
useEffect26(() => {
|
|
31148
|
+
const run = async () => {
|
|
31149
|
+
try {
|
|
31150
|
+
const data = await client.get("/client-tokens");
|
|
31151
|
+
const tokens = data.clientTokens ?? [];
|
|
31152
|
+
setItems(tokens);
|
|
31153
|
+
setTotal(tokens.length);
|
|
31154
|
+
setLoading(false);
|
|
31155
|
+
} catch (err) {
|
|
31156
|
+
setError(err instanceof Error ? err : new Error(String(err)));
|
|
31157
|
+
setLoading(false);
|
|
31158
|
+
}
|
|
31159
|
+
};
|
|
31160
|
+
run();
|
|
31161
|
+
}, []);
|
|
31162
|
+
return React15.createElement(DataList, {
|
|
31163
|
+
title: "Your Client Tokens",
|
|
31164
|
+
items,
|
|
31165
|
+
error,
|
|
31166
|
+
loading,
|
|
31167
|
+
total,
|
|
31168
|
+
emptyMessage: "No client tokens found",
|
|
31169
|
+
renderCard: (item) => {
|
|
31170
|
+
const t = item;
|
|
31171
|
+
const env = t.environment === "live" ? "live" : "test";
|
|
31172
|
+
const active = t.isActive ? "" : " (inactive)";
|
|
31173
|
+
return React15.createElement(Text32, null, ` ${t.id} ${t.name} [${env}]${active}`);
|
|
31174
|
+
}
|
|
31175
|
+
});
|
|
31176
|
+
};
|
|
31177
|
+
const { waitUntilExit } = render15(React15.createElement(App));
|
|
31178
|
+
await waitUntilExit();
|
|
31179
|
+
});
|
|
31180
|
+
clientTokensCommand.command("get <id>").description("Get client token details").option("--json", "Output as JSON").option("--tty", "Force TTY mode").option("--no-tty", "Force non-TTY mode").action(async (id, options) => {
|
|
31181
|
+
const apiKey = await ensureAuth();
|
|
31182
|
+
if (!apiKey) return;
|
|
31183
|
+
const client = new ApiClient(apiKey);
|
|
31184
|
+
if (!isTTY(options) || options.json) {
|
|
31185
|
+
try {
|
|
31186
|
+
const data = await client.get(`/client-tokens/${id}`);
|
|
31187
|
+
const token = data.clientToken;
|
|
31188
|
+
if (options.json) {
|
|
31189
|
+
printJson(data);
|
|
31190
|
+
} else {
|
|
31191
|
+
printDetail("Client Token", [
|
|
31192
|
+
{ label: "ID", value: token.id },
|
|
31193
|
+
{ label: "Name", value: token.name },
|
|
31194
|
+
{ label: "Environment", value: token.environment },
|
|
31195
|
+
{ label: "Active", value: token.isActive },
|
|
31196
|
+
{ label: "Token Value", value: token.tokenValue },
|
|
31197
|
+
{ label: "Flow IDs", value: (token.flowIds || []).join(", ") || null },
|
|
31198
|
+
{ label: "Default Flow ID", value: token.defaultFlowId },
|
|
31199
|
+
{ label: "Agent IDs", value: (token.agentIds || []).join(", ") || null },
|
|
31200
|
+
{ label: "Allowed Origins", value: (token.allowedOrigins || []).join(", ") },
|
|
31201
|
+
{ label: "Rate Limit/min", value: token.rateLimitPerMinute },
|
|
31202
|
+
{ label: "Rate Limit/hr", value: token.rateLimitPerHour },
|
|
31203
|
+
{ label: "Max Messages/Session", value: token.maxMessagesPerSession },
|
|
31204
|
+
{ label: "Session Timeout (min)", value: token.sessionIdleTimeoutMinutes },
|
|
31205
|
+
{ label: "Conversations", value: token.conversationCount },
|
|
31206
|
+
{ label: "Last Used", value: token.lastUsedAt },
|
|
31207
|
+
{ label: "Created", value: token.createdAt }
|
|
31208
|
+
]);
|
|
31209
|
+
}
|
|
31210
|
+
} catch (error) {
|
|
31211
|
+
const message = error instanceof Error ? error.message : "Unknown error";
|
|
31212
|
+
console.error(chalk22.red("Failed to fetch client token"));
|
|
31213
|
+
console.error(chalk22.red(message));
|
|
31214
|
+
process.exit(1);
|
|
31215
|
+
}
|
|
31216
|
+
return;
|
|
31217
|
+
}
|
|
31218
|
+
const App = () => {
|
|
31219
|
+
const [loading, setLoading] = useState29(true);
|
|
31220
|
+
const [success, setSuccess] = useState29(null);
|
|
31221
|
+
const [error, setError] = useState29(null);
|
|
31222
|
+
const [resultNode, setResultNode] = useState29(void 0);
|
|
31223
|
+
useEffect26(() => {
|
|
31224
|
+
const run = async () => {
|
|
31225
|
+
try {
|
|
31226
|
+
const data = await client.get(
|
|
31227
|
+
`/client-tokens/${id}`
|
|
31228
|
+
);
|
|
31229
|
+
const token = data.clientToken;
|
|
31230
|
+
setResultNode(
|
|
31231
|
+
React15.createElement(EntityCard, {
|
|
31232
|
+
fields: [
|
|
31233
|
+
{ label: "ID", value: token.id },
|
|
31234
|
+
{ label: "Name", value: token.name },
|
|
31235
|
+
{ label: "Environment", value: token.environment },
|
|
31236
|
+
{ label: "Active", value: String(token.isActive) },
|
|
31237
|
+
{ label: "Token Value", value: token.tokenValue },
|
|
31238
|
+
{ label: "Flow IDs", value: (token.flowIds || []).join(", ") || null },
|
|
31239
|
+
{ label: "Agent IDs", value: (token.agentIds || []).join(", ") || null },
|
|
31240
|
+
{ label: "Allowed Origins", value: (token.allowedOrigins || []).join(", ") },
|
|
31241
|
+
{ label: "Last Used", value: token.lastUsedAt },
|
|
31242
|
+
{ label: "Created", value: token.createdAt }
|
|
31243
|
+
]
|
|
31244
|
+
})
|
|
31245
|
+
);
|
|
31246
|
+
setSuccess(true);
|
|
31247
|
+
setLoading(false);
|
|
31248
|
+
} catch (err) {
|
|
31249
|
+
setError(err instanceof Error ? err : new Error(String(err)));
|
|
31250
|
+
setSuccess(false);
|
|
31251
|
+
setLoading(false);
|
|
31252
|
+
}
|
|
31253
|
+
};
|
|
31254
|
+
run();
|
|
31255
|
+
}, []);
|
|
31256
|
+
return React15.createElement(MutationResult, {
|
|
31257
|
+
loading,
|
|
31258
|
+
loadingLabel: "Fetching client token...",
|
|
31259
|
+
success,
|
|
31260
|
+
successMessage: "Client Token",
|
|
31261
|
+
error,
|
|
31262
|
+
result: resultNode
|
|
31263
|
+
});
|
|
31264
|
+
};
|
|
31265
|
+
const { waitUntilExit } = render15(React15.createElement(App));
|
|
31266
|
+
await waitUntilExit();
|
|
31267
|
+
});
|
|
31268
|
+
clientTokensCommand.command("create").description("Create a new client token").requiredOption("-n, --name <name>", "Token name").option("--origins <origins...>", "Allowed origins (e.g. https://example.com). Defaults to * (all origins)").option("--environment <env>", "Token environment: test or live", "test").option("--flow-ids <ids...>", "Flow IDs to associate").option("--default-flow-id <id>", "Default flow ID (required when flow-ids provided)").option("--agent-ids <ids...>", "Agent IDs to associate").option("--rate-limit-per-minute <n>", "Rate limit per minute", "10").option("--rate-limit-per-hour <n>", "Rate limit per hour", "100").option("--max-messages <n>", "Max messages per session", "100").option("--session-timeout <n>", "Session idle timeout in minutes", "30").option("--json", "Output as JSON").option("--tty", "Force TTY mode").option("--no-tty", "Force non-TTY mode").action(
|
|
31269
|
+
async (options) => {
|
|
31270
|
+
const flowIds = options.flowIds || [];
|
|
31271
|
+
const agentIds = options.agentIds || [];
|
|
31272
|
+
if (flowIds.length === 0 && agentIds.length === 0) {
|
|
31273
|
+
console.error(chalk22.red("Error: At least one --flow-ids or --agent-ids is required"));
|
|
31274
|
+
process.exit(1);
|
|
31275
|
+
}
|
|
31276
|
+
if (flowIds.length > 0 && !options.defaultFlowId) {
|
|
31277
|
+
console.error(chalk22.red("Error: --default-flow-id is required when --flow-ids is provided"));
|
|
31278
|
+
process.exit(1);
|
|
31279
|
+
}
|
|
31280
|
+
if (!["test", "live"].includes(options.environment)) {
|
|
31281
|
+
console.error(chalk22.red('Error: --environment must be "test" or "live"'));
|
|
31282
|
+
process.exit(1);
|
|
31283
|
+
}
|
|
31284
|
+
const apiKey = await ensureAuth();
|
|
31285
|
+
if (!apiKey) return;
|
|
31286
|
+
const client = new ApiClient(apiKey);
|
|
31287
|
+
const body = {
|
|
31288
|
+
name: options.name,
|
|
31289
|
+
flowIds,
|
|
31290
|
+
defaultFlowId: options.defaultFlowId,
|
|
31291
|
+
agentIds,
|
|
31292
|
+
allowedOrigins: options.origins || ["*"],
|
|
31293
|
+
environment: options.environment,
|
|
31294
|
+
rateLimitPerMinute: parseInt(options.rateLimitPerMinute, 10),
|
|
31295
|
+
rateLimitPerHour: parseInt(options.rateLimitPerHour, 10),
|
|
31296
|
+
maxMessagesPerSession: parseInt(options.maxMessages, 10),
|
|
31297
|
+
sessionIdleTimeoutMinutes: parseInt(options.sessionTimeout, 10)
|
|
31298
|
+
};
|
|
31299
|
+
if (!isTTY(options) || options.json) {
|
|
31300
|
+
try {
|
|
31301
|
+
const data = await client.post("/client-tokens", body);
|
|
31302
|
+
if (options.json) {
|
|
31303
|
+
printJson(data);
|
|
31304
|
+
} else {
|
|
31305
|
+
const token = data.clientToken;
|
|
31306
|
+
console.log(chalk22.green("Client token created"));
|
|
31307
|
+
console.log(` ID: ${chalk22.green(token.id)}`);
|
|
31308
|
+
console.log(` Name: ${token.name}`);
|
|
31309
|
+
console.log(` Environment: ${token.environment}`);
|
|
31310
|
+
console.log(` Token: ${chalk22.yellow(data.token)}`);
|
|
31311
|
+
if (data.warnings?.length > 0) {
|
|
31312
|
+
console.log("");
|
|
31313
|
+
for (const w of data.warnings) {
|
|
31314
|
+
console.log(chalk22.yellow(` \u26A0 ${w.message}`));
|
|
31315
|
+
}
|
|
31316
|
+
}
|
|
31317
|
+
}
|
|
31318
|
+
} catch (error) {
|
|
31319
|
+
const message = error instanceof Error ? error.message : "Unknown error";
|
|
31320
|
+
console.error(chalk22.red("Failed to create client token"));
|
|
31321
|
+
console.error(chalk22.red(message));
|
|
31322
|
+
process.exit(1);
|
|
31323
|
+
}
|
|
31324
|
+
return;
|
|
31325
|
+
}
|
|
31326
|
+
const App = () => {
|
|
31327
|
+
const [loading, setLoading] = useState29(true);
|
|
31328
|
+
const [success, setSuccess] = useState29(null);
|
|
31329
|
+
const [error, setError] = useState29(null);
|
|
31330
|
+
const [resultNode, setResultNode] = useState29(void 0);
|
|
31331
|
+
useEffect26(() => {
|
|
31332
|
+
const run = async () => {
|
|
31333
|
+
try {
|
|
31334
|
+
const data = await client.post("/client-tokens", body);
|
|
31335
|
+
const fields = [
|
|
31336
|
+
{ label: "ID", value: data.clientToken.id, color: "green" },
|
|
31337
|
+
{ label: "Name", value: data.clientToken.name },
|
|
31338
|
+
{ label: "Environment", value: data.clientToken.environment },
|
|
31339
|
+
{ label: "Token", value: data.token, color: "yellow" }
|
|
31340
|
+
];
|
|
31341
|
+
if (data.warnings?.length > 0) {
|
|
31342
|
+
for (const w of data.warnings) {
|
|
31343
|
+
fields.push({ label: "Warning", value: w.message, color: "yellow" });
|
|
31344
|
+
}
|
|
31345
|
+
}
|
|
31346
|
+
setResultNode(React15.createElement(EntityCard, { fields }));
|
|
31347
|
+
setSuccess(true);
|
|
31348
|
+
setLoading(false);
|
|
31349
|
+
} catch (err) {
|
|
31350
|
+
setError(err instanceof Error ? err : new Error(String(err)));
|
|
31351
|
+
setSuccess(false);
|
|
31352
|
+
setLoading(false);
|
|
31353
|
+
}
|
|
31354
|
+
};
|
|
31355
|
+
run();
|
|
31356
|
+
}, []);
|
|
31357
|
+
return React15.createElement(MutationResult, {
|
|
31358
|
+
loading,
|
|
31359
|
+
loadingLabel: "Creating client token...",
|
|
31360
|
+
success,
|
|
31361
|
+
successMessage: "Client token created",
|
|
31362
|
+
error,
|
|
31363
|
+
result: resultNode
|
|
31364
|
+
});
|
|
31365
|
+
};
|
|
31366
|
+
const { waitUntilExit } = render15(React15.createElement(App));
|
|
31367
|
+
await waitUntilExit();
|
|
31368
|
+
}
|
|
31369
|
+
);
|
|
31370
|
+
clientTokensCommand.command("delete <id>").description("Delete a client token").option("--tty", "Force TTY mode").option("--no-tty", "Force non-TTY mode").option("--yes", "Skip confirmation").action(async (id, options) => {
|
|
31371
|
+
const apiKey = await ensureAuth();
|
|
31372
|
+
if (!apiKey) return;
|
|
31373
|
+
const client = new ApiClient(apiKey);
|
|
31374
|
+
if (!isTTY(options)) {
|
|
31375
|
+
try {
|
|
31376
|
+
await client.delete(`/client-tokens/${id}`);
|
|
31377
|
+
console.log(chalk22.green("Client token deleted"));
|
|
31378
|
+
} catch (error) {
|
|
31379
|
+
const message = error instanceof Error ? error.message : "Unknown error";
|
|
31380
|
+
console.error(chalk22.red("Failed to delete client token"));
|
|
31381
|
+
console.error(chalk22.red(message));
|
|
31382
|
+
process.exit(1);
|
|
31383
|
+
}
|
|
31384
|
+
return;
|
|
31385
|
+
}
|
|
31386
|
+
if (options.yes) {
|
|
31387
|
+
const App = () => {
|
|
31388
|
+
const [loading, setLoading] = useState29(true);
|
|
31389
|
+
const [success, setSuccess] = useState29(null);
|
|
31390
|
+
const [error, setError] = useState29(null);
|
|
31391
|
+
useEffect26(() => {
|
|
31392
|
+
const run = async () => {
|
|
31393
|
+
try {
|
|
31394
|
+
await client.delete(`/client-tokens/${id}`);
|
|
31395
|
+
setSuccess(true);
|
|
31396
|
+
setLoading(false);
|
|
31397
|
+
} catch (err) {
|
|
31398
|
+
setError(err instanceof Error ? err : new Error(String(err)));
|
|
31399
|
+
setSuccess(false);
|
|
31400
|
+
setLoading(false);
|
|
31401
|
+
}
|
|
31402
|
+
};
|
|
31403
|
+
run();
|
|
31404
|
+
}, []);
|
|
31405
|
+
return React15.createElement(MutationResult, {
|
|
31406
|
+
loading,
|
|
31407
|
+
loadingLabel: "Deleting client token...",
|
|
31408
|
+
success,
|
|
31409
|
+
successMessage: "Client token deleted",
|
|
31410
|
+
error
|
|
31411
|
+
});
|
|
31412
|
+
};
|
|
31413
|
+
const { waitUntilExit: waitUntilExit2 } = render15(React15.createElement(App));
|
|
31414
|
+
await waitUntilExit2();
|
|
31415
|
+
return;
|
|
31416
|
+
}
|
|
31417
|
+
const confirmed = await new Promise((resolve8) => {
|
|
31418
|
+
const { unmount } = render15(
|
|
31419
|
+
React15.createElement(ConfirmPrompt, {
|
|
31420
|
+
message: `Delete client token ${id}?`,
|
|
31421
|
+
defaultValue: false,
|
|
31422
|
+
onConfirm: (result) => {
|
|
31423
|
+
resolve8(result);
|
|
31424
|
+
unmount();
|
|
31425
|
+
}
|
|
31426
|
+
})
|
|
31427
|
+
);
|
|
31428
|
+
});
|
|
31429
|
+
if (!confirmed) return;
|
|
31430
|
+
const DeleteApp = () => {
|
|
31431
|
+
const [loading, setLoading] = useState29(true);
|
|
31432
|
+
const [success, setSuccess] = useState29(null);
|
|
31433
|
+
const [error, setError] = useState29(null);
|
|
31434
|
+
useEffect26(() => {
|
|
31435
|
+
const run = async () => {
|
|
31436
|
+
try {
|
|
31437
|
+
await client.delete(`/client-tokens/${id}`);
|
|
31438
|
+
setSuccess(true);
|
|
31439
|
+
setLoading(false);
|
|
31440
|
+
} catch (err) {
|
|
31441
|
+
setError(err instanceof Error ? err : new Error(String(err)));
|
|
31442
|
+
setSuccess(false);
|
|
31443
|
+
setLoading(false);
|
|
31444
|
+
}
|
|
31445
|
+
};
|
|
31446
|
+
run();
|
|
31447
|
+
}, []);
|
|
31448
|
+
return React15.createElement(MutationResult, {
|
|
31449
|
+
loading,
|
|
31450
|
+
loadingLabel: "Deleting client token...",
|
|
31451
|
+
success,
|
|
31452
|
+
successMessage: "Client token deleted",
|
|
31453
|
+
error
|
|
31454
|
+
});
|
|
31455
|
+
};
|
|
31456
|
+
const { waitUntilExit } = render15(React15.createElement(DeleteApp));
|
|
31457
|
+
await waitUntilExit();
|
|
31458
|
+
});
|
|
31459
|
+
clientTokensCommand.command("regenerate <id>").description("Regenerate a client token (invalidates the old token)").option("--json", "Output as JSON").option("--tty", "Force TTY mode").option("--no-tty", "Force non-TTY mode").action(async (id, options) => {
|
|
31460
|
+
const apiKey = await ensureAuth();
|
|
31461
|
+
if (!apiKey) return;
|
|
31462
|
+
const client = new ApiClient(apiKey);
|
|
31463
|
+
if (!isTTY(options) || options.json) {
|
|
31464
|
+
try {
|
|
31465
|
+
const data = await client.post(`/client-tokens/${id}/regenerate`);
|
|
31466
|
+
if (options.json) {
|
|
31467
|
+
printJson(data);
|
|
31468
|
+
} else {
|
|
31469
|
+
console.log(chalk22.green("Client token regenerated"));
|
|
31470
|
+
console.log(` New Token: ${chalk22.yellow(data.token)}`);
|
|
31471
|
+
console.log(chalk22.gray(" Previous token is now invalid. Update your client-side code."));
|
|
31472
|
+
}
|
|
31473
|
+
} catch (error) {
|
|
31474
|
+
const message = error instanceof Error ? error.message : "Unknown error";
|
|
31475
|
+
console.error(chalk22.red("Failed to regenerate client token"));
|
|
31476
|
+
console.error(chalk22.red(message));
|
|
31477
|
+
process.exit(1);
|
|
31478
|
+
}
|
|
31479
|
+
return;
|
|
31480
|
+
}
|
|
31481
|
+
const App = () => {
|
|
31482
|
+
const [loading, setLoading] = useState29(true);
|
|
31483
|
+
const [success, setSuccess] = useState29(null);
|
|
31484
|
+
const [error, setError] = useState29(null);
|
|
31485
|
+
const [resultNode, setResultNode] = useState29(void 0);
|
|
31486
|
+
useEffect26(() => {
|
|
31487
|
+
const run = async () => {
|
|
31488
|
+
try {
|
|
31489
|
+
const data = await client.post(`/client-tokens/${id}/regenerate`);
|
|
31490
|
+
setResultNode(
|
|
31491
|
+
React15.createElement(EntityCard, {
|
|
31492
|
+
fields: [
|
|
31493
|
+
{ label: "New Token", value: data.token, color: "yellow" },
|
|
31494
|
+
{
|
|
31495
|
+
label: "Note",
|
|
31496
|
+
value: "Previous token is now invalid. Update your client-side code."
|
|
31497
|
+
}
|
|
31498
|
+
]
|
|
31499
|
+
})
|
|
31500
|
+
);
|
|
31501
|
+
setSuccess(true);
|
|
31502
|
+
setLoading(false);
|
|
31503
|
+
} catch (err) {
|
|
31504
|
+
setError(err instanceof Error ? err : new Error(String(err)));
|
|
31505
|
+
setSuccess(false);
|
|
31506
|
+
setLoading(false);
|
|
31507
|
+
}
|
|
31508
|
+
};
|
|
31509
|
+
run();
|
|
31510
|
+
}, []);
|
|
31511
|
+
return React15.createElement(MutationResult, {
|
|
31512
|
+
loading,
|
|
31513
|
+
loadingLabel: "Regenerating client token...",
|
|
31514
|
+
success,
|
|
31515
|
+
successMessage: "Client token regenerated",
|
|
31516
|
+
error,
|
|
31517
|
+
result: resultNode
|
|
31518
|
+
});
|
|
31519
|
+
};
|
|
31520
|
+
const { waitUntilExit } = render15(React15.createElement(App));
|
|
31521
|
+
await waitUntilExit();
|
|
31522
|
+
});
|
|
31523
|
+
|
|
31524
|
+
// src/commands/analytics.ts
|
|
31525
|
+
import { Command as Command17 } from "commander";
|
|
31526
|
+
import chalk23 from "chalk";
|
|
31527
|
+
import React16 from "react";
|
|
31528
|
+
import { render as render16 } from "ink";
|
|
31529
|
+
import { useState as useState30, useEffect as useEffect27 } from "react";
|
|
31530
|
+
import { Text as Text33 } from "ink";
|
|
31531
|
+
var analyticsCommand = new Command17("analytics").description("View analytics and execution results");
|
|
31055
31532
|
analyticsCommand.command("stats").description("Show account statistics").option("--json", "Output as JSON").option("--tty", "Force TTY mode").option("--no-tty", "Force non-TTY mode").action(async (options) => {
|
|
31056
31533
|
const apiKey = await ensureAuth();
|
|
31057
31534
|
if (!apiKey) return;
|
|
@@ -31071,22 +31548,22 @@ analyticsCommand.command("stats").description("Show account statistics").option(
|
|
|
31071
31548
|
}
|
|
31072
31549
|
} catch (error) {
|
|
31073
31550
|
const message = error instanceof Error ? error.message : "Unknown error";
|
|
31074
|
-
console.error(
|
|
31075
|
-
console.error(
|
|
31551
|
+
console.error(chalk23.red("Failed to fetch stats"));
|
|
31552
|
+
console.error(chalk23.red(message));
|
|
31076
31553
|
process.exit(1);
|
|
31077
31554
|
}
|
|
31078
31555
|
return;
|
|
31079
31556
|
}
|
|
31080
31557
|
const App = () => {
|
|
31081
|
-
const [loading, setLoading] =
|
|
31082
|
-
const [success, setSuccess] =
|
|
31083
|
-
const [error, setError] =
|
|
31084
|
-
const [resultNode, setResultNode] =
|
|
31085
|
-
|
|
31558
|
+
const [loading, setLoading] = useState30(true);
|
|
31559
|
+
const [success, setSuccess] = useState30(null);
|
|
31560
|
+
const [error, setError] = useState30(null);
|
|
31561
|
+
const [resultNode, setResultNode] = useState30(void 0);
|
|
31562
|
+
useEffect27(() => {
|
|
31086
31563
|
const run = async () => {
|
|
31087
31564
|
try {
|
|
31088
31565
|
const data = await client.get("/analytics/stats");
|
|
31089
|
-
setResultNode(
|
|
31566
|
+
setResultNode(React16.createElement(EntityCard, {
|
|
31090
31567
|
fields: [
|
|
31091
31568
|
{ label: "Flows", value: data.flows },
|
|
31092
31569
|
{ label: "Prompts", value: data.prompts },
|
|
@@ -31104,7 +31581,7 @@ analyticsCommand.command("stats").description("Show account statistics").option(
|
|
|
31104
31581
|
};
|
|
31105
31582
|
run();
|
|
31106
31583
|
}, []);
|
|
31107
|
-
return
|
|
31584
|
+
return React16.createElement(MutationResult, {
|
|
31108
31585
|
loading,
|
|
31109
31586
|
loadingLabel: "Fetching stats...",
|
|
31110
31587
|
success,
|
|
@@ -31113,7 +31590,7 @@ analyticsCommand.command("stats").description("Show account statistics").option(
|
|
|
31113
31590
|
result: resultNode
|
|
31114
31591
|
});
|
|
31115
31592
|
};
|
|
31116
|
-
const { waitUntilExit } =
|
|
31593
|
+
const { waitUntilExit } = render16(React16.createElement(App));
|
|
31117
31594
|
await waitUntilExit();
|
|
31118
31595
|
});
|
|
31119
31596
|
analyticsCommand.command("results").description("List execution results").option("--flow <id>", "Filter by flow ID").option("--record <id>", "Filter by record ID").option("--status <status>", "Filter by status").option("--limit <n>", "Limit results", "20").option("--json", "Output as JSON").option("--tty", "Force TTY mode").option("--no-tty", "Force non-TTY mode").action(
|
|
@@ -31136,37 +31613,37 @@ analyticsCommand.command("results").description("List execution results").option
|
|
|
31136
31613
|
} else {
|
|
31137
31614
|
const results = data.data ?? [];
|
|
31138
31615
|
if (results.length === 0) {
|
|
31139
|
-
console.log(
|
|
31616
|
+
console.log(chalk23.gray("No results found"));
|
|
31140
31617
|
return;
|
|
31141
31618
|
}
|
|
31142
|
-
console.log(
|
|
31619
|
+
console.log(chalk23.cyan("Execution Results:"));
|
|
31143
31620
|
for (const result of results) {
|
|
31144
31621
|
const statusColor = result.status === "completed" ? "green" : "red";
|
|
31145
|
-
const date = result.createdAt ?
|
|
31622
|
+
const date = result.createdAt ? chalk23.gray(` ${result.createdAt}`) : "";
|
|
31146
31623
|
console.log(
|
|
31147
|
-
` ${
|
|
31624
|
+
` ${chalk23.green(result.id)} ${chalk23[statusColor](`[${result.status}]`)} flow=${chalk23.gray(result.flowId)} record=${chalk23.gray(result.recordId)}${date}`
|
|
31148
31625
|
);
|
|
31149
31626
|
}
|
|
31150
31627
|
const total = getTotalCount(data.pagination);
|
|
31151
31628
|
if (total !== void 0) {
|
|
31152
|
-
console.log(
|
|
31629
|
+
console.log(chalk23.dim(`
|
|
31153
31630
|
Total: ${total} results`));
|
|
31154
31631
|
}
|
|
31155
31632
|
}
|
|
31156
31633
|
} catch (error) {
|
|
31157
31634
|
const message = error instanceof Error ? error.message : "Unknown error";
|
|
31158
|
-
console.error(
|
|
31159
|
-
console.error(
|
|
31635
|
+
console.error(chalk23.red("Failed to fetch results"));
|
|
31636
|
+
console.error(chalk23.red(message));
|
|
31160
31637
|
process.exit(1);
|
|
31161
31638
|
}
|
|
31162
31639
|
return;
|
|
31163
31640
|
}
|
|
31164
31641
|
const App = () => {
|
|
31165
|
-
const [loading, setLoading] =
|
|
31166
|
-
const [items, setItems] =
|
|
31167
|
-
const [total, setTotal] =
|
|
31168
|
-
const [error, setError] =
|
|
31169
|
-
|
|
31642
|
+
const [loading, setLoading] = useState30(true);
|
|
31643
|
+
const [items, setItems] = useState30(null);
|
|
31644
|
+
const [total, setTotal] = useState30(void 0);
|
|
31645
|
+
const [error, setError] = useState30(null);
|
|
31646
|
+
useEffect27(() => {
|
|
31170
31647
|
const run = async () => {
|
|
31171
31648
|
try {
|
|
31172
31649
|
const data = await client.get(
|
|
@@ -31183,7 +31660,7 @@ analyticsCommand.command("results").description("List execution results").option
|
|
|
31183
31660
|
};
|
|
31184
31661
|
run();
|
|
31185
31662
|
}, []);
|
|
31186
|
-
return
|
|
31663
|
+
return React16.createElement(DataList, {
|
|
31187
31664
|
title: "Execution Results",
|
|
31188
31665
|
items,
|
|
31189
31666
|
error,
|
|
@@ -31193,27 +31670,27 @@ analyticsCommand.command("results").description("List execution results").option
|
|
|
31193
31670
|
renderCard: (item) => {
|
|
31194
31671
|
const r = item;
|
|
31195
31672
|
const statusColor = r.status === "completed" ? "green" : "red";
|
|
31196
|
-
return
|
|
31197
|
-
|
|
31673
|
+
return React16.createElement(
|
|
31674
|
+
Text33,
|
|
31198
31675
|
{ color: statusColor },
|
|
31199
31676
|
` ${r.id} [${r.status}] flow=${r.flowId} record=${r.recordId}${r.createdAt ? ` ${r.createdAt}` : ""}`
|
|
31200
31677
|
);
|
|
31201
31678
|
}
|
|
31202
31679
|
});
|
|
31203
31680
|
};
|
|
31204
|
-
const { waitUntilExit } =
|
|
31681
|
+
const { waitUntilExit } = render16(React16.createElement(App));
|
|
31205
31682
|
await waitUntilExit();
|
|
31206
31683
|
}
|
|
31207
31684
|
);
|
|
31208
31685
|
|
|
31209
31686
|
// src/commands/billing.ts
|
|
31210
|
-
import { Command as
|
|
31211
|
-
import
|
|
31212
|
-
import
|
|
31213
|
-
import { render as
|
|
31214
|
-
import { useState as
|
|
31687
|
+
import { Command as Command18 } from "commander";
|
|
31688
|
+
import chalk24 from "chalk";
|
|
31689
|
+
import React17 from "react";
|
|
31690
|
+
import { render as render17 } from "ink";
|
|
31691
|
+
import { useState as useState31, useEffect as useEffect28 } from "react";
|
|
31215
31692
|
import open5 from "open";
|
|
31216
|
-
var billingCommand = new
|
|
31693
|
+
var billingCommand = new Command18("billing").description("View billing and subscription info");
|
|
31217
31694
|
billingCommand.command("status").description("Show current plan and usage").option("--json", "Output as JSON").option("--tty", "Force TTY mode").option("--no-tty", "Force non-TTY mode").action(async (options) => {
|
|
31218
31695
|
const apiKey = await ensureAuth();
|
|
31219
31696
|
if (!apiKey) return;
|
|
@@ -31250,18 +31727,18 @@ billingCommand.command("status").description("Show current plan and usage").opti
|
|
|
31250
31727
|
}
|
|
31251
31728
|
} catch (error) {
|
|
31252
31729
|
const message = error instanceof Error ? error.message : "Unknown error";
|
|
31253
|
-
console.error(
|
|
31254
|
-
console.error(
|
|
31730
|
+
console.error(chalk24.red("Failed to fetch billing status"));
|
|
31731
|
+
console.error(chalk24.red(message));
|
|
31255
31732
|
process.exit(1);
|
|
31256
31733
|
}
|
|
31257
31734
|
return;
|
|
31258
31735
|
}
|
|
31259
31736
|
const App = () => {
|
|
31260
|
-
const [loading, setLoading] =
|
|
31261
|
-
const [success, setSuccess] =
|
|
31262
|
-
const [error, setError] =
|
|
31263
|
-
const [resultNode, setResultNode] =
|
|
31264
|
-
|
|
31737
|
+
const [loading, setLoading] = useState31(true);
|
|
31738
|
+
const [success, setSuccess] = useState31(null);
|
|
31739
|
+
const [error, setError] = useState31(null);
|
|
31740
|
+
const [resultNode, setResultNode] = useState31(void 0);
|
|
31741
|
+
useEffect28(() => {
|
|
31265
31742
|
const run = async () => {
|
|
31266
31743
|
try {
|
|
31267
31744
|
const data = await client.get("/billing/status");
|
|
@@ -31282,7 +31759,7 @@ billingCommand.command("status").description("Show current plan and usage").opti
|
|
|
31282
31759
|
if (data.limits.monthlyLimit) fields.push({ label: "Monthly limit", value: data.limits.monthlyLimit });
|
|
31283
31760
|
if (data.limits.rateLimit) fields.push({ label: "Rate limit", value: data.limits.rateLimit });
|
|
31284
31761
|
}
|
|
31285
|
-
setResultNode(
|
|
31762
|
+
setResultNode(React17.createElement(EntityCard, { fields }));
|
|
31286
31763
|
setSuccess(true);
|
|
31287
31764
|
setLoading(false);
|
|
31288
31765
|
} catch (err) {
|
|
@@ -31293,7 +31770,7 @@ billingCommand.command("status").description("Show current plan and usage").opti
|
|
|
31293
31770
|
};
|
|
31294
31771
|
run();
|
|
31295
31772
|
}, []);
|
|
31296
|
-
return
|
|
31773
|
+
return React17.createElement(MutationResult, {
|
|
31297
31774
|
loading,
|
|
31298
31775
|
loadingLabel: "Fetching billing status...",
|
|
31299
31776
|
success,
|
|
@@ -31302,7 +31779,7 @@ billingCommand.command("status").description("Show current plan and usage").opti
|
|
|
31302
31779
|
result: resultNode
|
|
31303
31780
|
});
|
|
31304
31781
|
};
|
|
31305
|
-
const { waitUntilExit } =
|
|
31782
|
+
const { waitUntilExit } = render17(React17.createElement(App));
|
|
31306
31783
|
await waitUntilExit();
|
|
31307
31784
|
});
|
|
31308
31785
|
billingCommand.command("portal").description("Open the billing portal in your browser").option("--tty", "Force TTY mode").option("--no-tty", "Force non-TTY mode").action(async (options) => {
|
|
@@ -31321,18 +31798,18 @@ billingCommand.command("portal").description("Open the billing portal in your br
|
|
|
31321
31798
|
}
|
|
31322
31799
|
} catch (error) {
|
|
31323
31800
|
const message = error instanceof Error ? error.message : "Unknown error";
|
|
31324
|
-
console.error(
|
|
31325
|
-
console.error(
|
|
31801
|
+
console.error(chalk24.red("Failed to open billing portal"));
|
|
31802
|
+
console.error(chalk24.red(message));
|
|
31326
31803
|
process.exit(1);
|
|
31327
31804
|
}
|
|
31328
31805
|
return;
|
|
31329
31806
|
}
|
|
31330
31807
|
const App = () => {
|
|
31331
|
-
const [loading, setLoading] =
|
|
31332
|
-
const [success, setSuccess] =
|
|
31333
|
-
const [error, setError] =
|
|
31334
|
-
const [msg, setMsg] =
|
|
31335
|
-
|
|
31808
|
+
const [loading, setLoading] = useState31(true);
|
|
31809
|
+
const [success, setSuccess] = useState31(null);
|
|
31810
|
+
const [error, setError] = useState31(null);
|
|
31811
|
+
const [msg, setMsg] = useState31("Opening billing portal...");
|
|
31812
|
+
useEffect28(() => {
|
|
31336
31813
|
const run = async () => {
|
|
31337
31814
|
try {
|
|
31338
31815
|
const data = await client.post("/billing/portal");
|
|
@@ -31353,7 +31830,7 @@ billingCommand.command("portal").description("Open the billing portal in your br
|
|
|
31353
31830
|
};
|
|
31354
31831
|
run();
|
|
31355
31832
|
}, []);
|
|
31356
|
-
return
|
|
31833
|
+
return React17.createElement(MutationResult, {
|
|
31357
31834
|
loading,
|
|
31358
31835
|
loadingLabel: "Generating portal link...",
|
|
31359
31836
|
success,
|
|
@@ -31361,7 +31838,7 @@ billingCommand.command("portal").description("Open the billing portal in your br
|
|
|
31361
31838
|
error
|
|
31362
31839
|
});
|
|
31363
31840
|
};
|
|
31364
|
-
const { waitUntilExit } =
|
|
31841
|
+
const { waitUntilExit } = render17(React17.createElement(App));
|
|
31365
31842
|
await waitUntilExit();
|
|
31366
31843
|
});
|
|
31367
31844
|
billingCommand.command("refresh").description("Refresh plan data from billing provider").option("--tty", "Force TTY mode").option("--no-tty", "Force non-TTY mode").action(async (options) => {
|
|
@@ -31371,20 +31848,20 @@ billingCommand.command("refresh").description("Refresh plan data from billing pr
|
|
|
31371
31848
|
if (!isTTY(options)) {
|
|
31372
31849
|
try {
|
|
31373
31850
|
await client.post("/billing/refresh");
|
|
31374
|
-
console.log(
|
|
31851
|
+
console.log(chalk24.green("Plan data refreshed"));
|
|
31375
31852
|
} catch (error) {
|
|
31376
31853
|
const message = error instanceof Error ? error.message : "Unknown error";
|
|
31377
|
-
console.error(
|
|
31378
|
-
console.error(
|
|
31854
|
+
console.error(chalk24.red("Failed to refresh plan data"));
|
|
31855
|
+
console.error(chalk24.red(message));
|
|
31379
31856
|
process.exit(1);
|
|
31380
31857
|
}
|
|
31381
31858
|
return;
|
|
31382
31859
|
}
|
|
31383
31860
|
const App = () => {
|
|
31384
|
-
const [loading, setLoading] =
|
|
31385
|
-
const [success, setSuccess] =
|
|
31386
|
-
const [error, setError] =
|
|
31387
|
-
|
|
31861
|
+
const [loading, setLoading] = useState31(true);
|
|
31862
|
+
const [success, setSuccess] = useState31(null);
|
|
31863
|
+
const [error, setError] = useState31(null);
|
|
31864
|
+
useEffect28(() => {
|
|
31388
31865
|
const run = async () => {
|
|
31389
31866
|
try {
|
|
31390
31867
|
await client.post("/billing/refresh");
|
|
@@ -31398,7 +31875,7 @@ billingCommand.command("refresh").description("Refresh plan data from billing pr
|
|
|
31398
31875
|
};
|
|
31399
31876
|
run();
|
|
31400
31877
|
}, []);
|
|
31401
|
-
return
|
|
31878
|
+
return React17.createElement(MutationResult, {
|
|
31402
31879
|
loading,
|
|
31403
31880
|
loadingLabel: "Refreshing plan data...",
|
|
31404
31881
|
success,
|
|
@@ -31406,18 +31883,18 @@ billingCommand.command("refresh").description("Refresh plan data from billing pr
|
|
|
31406
31883
|
error
|
|
31407
31884
|
});
|
|
31408
31885
|
};
|
|
31409
|
-
const { waitUntilExit } =
|
|
31886
|
+
const { waitUntilExit } = render17(React17.createElement(App));
|
|
31410
31887
|
await waitUntilExit();
|
|
31411
31888
|
});
|
|
31412
31889
|
|
|
31413
31890
|
// src/commands/flow-versions.ts
|
|
31414
|
-
import { Command as
|
|
31415
|
-
import
|
|
31416
|
-
import
|
|
31417
|
-
import { render as
|
|
31418
|
-
import { useState as
|
|
31419
|
-
import { Text as
|
|
31420
|
-
var flowVersionsCommand = new
|
|
31891
|
+
import { Command as Command19 } from "commander";
|
|
31892
|
+
import chalk25 from "chalk";
|
|
31893
|
+
import React18 from "react";
|
|
31894
|
+
import { render as render18 } from "ink";
|
|
31895
|
+
import { useState as useState32, useEffect as useEffect29 } from "react";
|
|
31896
|
+
import { Text as Text34 } from "ink";
|
|
31897
|
+
var flowVersionsCommand = new Command19("flow-versions").description(
|
|
31421
31898
|
"Manage flow versions"
|
|
31422
31899
|
);
|
|
31423
31900
|
flowVersionsCommand.command("list <flowId>").description("List all versions for a flow").option("--json", "Output as JSON").option("--tty", "Force TTY mode").option("--no-tty", "Force non-TTY mode").action(async (flowId, options) => {
|
|
@@ -31432,30 +31909,30 @@ flowVersionsCommand.command("list <flowId>").description("List all versions for
|
|
|
31432
31909
|
} else {
|
|
31433
31910
|
const versions = data.data ?? [];
|
|
31434
31911
|
if (versions.length === 0) {
|
|
31435
|
-
console.log(
|
|
31912
|
+
console.log(chalk25.gray("No versions found"));
|
|
31436
31913
|
return;
|
|
31437
31914
|
}
|
|
31438
|
-
console.log(
|
|
31915
|
+
console.log(chalk25.cyan(`Versions for flow ${flowId}:`));
|
|
31439
31916
|
for (const v of versions) {
|
|
31440
|
-
const publishedTag = v.published ?
|
|
31917
|
+
const publishedTag = v.published ? chalk25.green(" [published]") : "";
|
|
31441
31918
|
const versionNum = v.version !== void 0 ? `v${v.version}` : v.id;
|
|
31442
|
-
const date = v.createdAt ?
|
|
31443
|
-
console.log(` ${
|
|
31919
|
+
const date = v.createdAt ? chalk25.gray(` ${v.createdAt}`) : "";
|
|
31920
|
+
console.log(` ${chalk25.green(v.id)} ${versionNum}${publishedTag}${date}`);
|
|
31444
31921
|
}
|
|
31445
31922
|
}
|
|
31446
31923
|
} catch (error) {
|
|
31447
31924
|
const message = error instanceof Error ? error.message : "Unknown error";
|
|
31448
|
-
console.error(
|
|
31449
|
-
console.error(
|
|
31925
|
+
console.error(chalk25.red("Failed to fetch versions"));
|
|
31926
|
+
console.error(chalk25.red(message));
|
|
31450
31927
|
process.exit(1);
|
|
31451
31928
|
}
|
|
31452
31929
|
return;
|
|
31453
31930
|
}
|
|
31454
31931
|
const App = () => {
|
|
31455
|
-
const [loading, setLoading] =
|
|
31456
|
-
const [items, setItems] =
|
|
31457
|
-
const [error, setError] =
|
|
31458
|
-
|
|
31932
|
+
const [loading, setLoading] = useState32(true);
|
|
31933
|
+
const [items, setItems] = useState32(null);
|
|
31934
|
+
const [error, setError] = useState32(null);
|
|
31935
|
+
useEffect29(() => {
|
|
31459
31936
|
const run = async () => {
|
|
31460
31937
|
try {
|
|
31461
31938
|
const data = await client.get(`/flow-versions/${flowId}`);
|
|
@@ -31468,7 +31945,7 @@ flowVersionsCommand.command("list <flowId>").description("List all versions for
|
|
|
31468
31945
|
};
|
|
31469
31946
|
run();
|
|
31470
31947
|
}, []);
|
|
31471
|
-
return
|
|
31948
|
+
return React18.createElement(DataList, {
|
|
31472
31949
|
title: `Versions for flow ${flowId}`,
|
|
31473
31950
|
items,
|
|
31474
31951
|
error,
|
|
@@ -31478,11 +31955,11 @@ flowVersionsCommand.command("list <flowId>").description("List all versions for
|
|
|
31478
31955
|
const v = item;
|
|
31479
31956
|
const publishedTag = v.published ? " [published]" : "";
|
|
31480
31957
|
const versionNum = v.version !== void 0 ? `v${v.version}` : v.id;
|
|
31481
|
-
return
|
|
31958
|
+
return React18.createElement(Text34, null, ` ${v.id} ${versionNum}${publishedTag}${v.createdAt ? ` ${v.createdAt}` : ""}`);
|
|
31482
31959
|
}
|
|
31483
31960
|
});
|
|
31484
31961
|
};
|
|
31485
|
-
const { waitUntilExit } =
|
|
31962
|
+
const { waitUntilExit } = render18(React18.createElement(App));
|
|
31486
31963
|
await waitUntilExit();
|
|
31487
31964
|
});
|
|
31488
31965
|
flowVersionsCommand.command("get <flowId> <versionId>").description("Get a specific version").option("--json", "Output as JSON").option("--tty", "Force TTY mode").option("--no-tty", "Force non-TTY mode").action(async (flowId, versionId, options) => {
|
|
@@ -31506,22 +31983,22 @@ flowVersionsCommand.command("get <flowId> <versionId>").description("Get a speci
|
|
|
31506
31983
|
}
|
|
31507
31984
|
} catch (error) {
|
|
31508
31985
|
const message = error instanceof Error ? error.message : "Unknown error";
|
|
31509
|
-
console.error(
|
|
31510
|
-
console.error(
|
|
31986
|
+
console.error(chalk25.red("Failed to fetch version"));
|
|
31987
|
+
console.error(chalk25.red(message));
|
|
31511
31988
|
process.exit(1);
|
|
31512
31989
|
}
|
|
31513
31990
|
return;
|
|
31514
31991
|
}
|
|
31515
31992
|
const App = () => {
|
|
31516
|
-
const [loading, setLoading] =
|
|
31517
|
-
const [success, setSuccess] =
|
|
31518
|
-
const [error, setError] =
|
|
31519
|
-
const [resultNode, setResultNode] =
|
|
31520
|
-
|
|
31993
|
+
const [loading, setLoading] = useState32(true);
|
|
31994
|
+
const [success, setSuccess] = useState32(null);
|
|
31995
|
+
const [error, setError] = useState32(null);
|
|
31996
|
+
const [resultNode, setResultNode] = useState32(void 0);
|
|
31997
|
+
useEffect29(() => {
|
|
31521
31998
|
const run = async () => {
|
|
31522
31999
|
try {
|
|
31523
32000
|
const data = await client.get(`/flow-versions/${flowId}/${versionId}`);
|
|
31524
|
-
setResultNode(
|
|
32001
|
+
setResultNode(React18.createElement(EntityCard, {
|
|
31525
32002
|
fields: [
|
|
31526
32003
|
{ label: "ID", value: data.id },
|
|
31527
32004
|
{ label: "Flow ID", value: data.flowId },
|
|
@@ -31541,7 +32018,7 @@ flowVersionsCommand.command("get <flowId> <versionId>").description("Get a speci
|
|
|
31541
32018
|
};
|
|
31542
32019
|
run();
|
|
31543
32020
|
}, []);
|
|
31544
|
-
return
|
|
32021
|
+
return React18.createElement(MutationResult, {
|
|
31545
32022
|
loading,
|
|
31546
32023
|
loadingLabel: "Fetching version...",
|
|
31547
32024
|
success,
|
|
@@ -31550,7 +32027,7 @@ flowVersionsCommand.command("get <flowId> <versionId>").description("Get a speci
|
|
|
31550
32027
|
result: resultNode
|
|
31551
32028
|
});
|
|
31552
32029
|
};
|
|
31553
|
-
const { waitUntilExit } =
|
|
32030
|
+
const { waitUntilExit } = render18(React18.createElement(App));
|
|
31554
32031
|
await waitUntilExit();
|
|
31555
32032
|
});
|
|
31556
32033
|
flowVersionsCommand.command("published <flowId>").description("Get the published version for a flow").option("--json", "Output as JSON").option("--tty", "Force TTY mode").option("--no-tty", "Force non-TTY mode").action(async (flowId, options) => {
|
|
@@ -31572,22 +32049,22 @@ flowVersionsCommand.command("published <flowId>").description("Get the published
|
|
|
31572
32049
|
}
|
|
31573
32050
|
} catch (error) {
|
|
31574
32051
|
const message = error instanceof Error ? error.message : "Unknown error";
|
|
31575
|
-
console.error(
|
|
31576
|
-
console.error(
|
|
32052
|
+
console.error(chalk25.red("Failed to fetch published version"));
|
|
32053
|
+
console.error(chalk25.red(message));
|
|
31577
32054
|
process.exit(1);
|
|
31578
32055
|
}
|
|
31579
32056
|
return;
|
|
31580
32057
|
}
|
|
31581
32058
|
const App = () => {
|
|
31582
|
-
const [loading, setLoading] =
|
|
31583
|
-
const [success, setSuccess] =
|
|
31584
|
-
const [error, setError] =
|
|
31585
|
-
const [resultNode, setResultNode] =
|
|
31586
|
-
|
|
32059
|
+
const [loading, setLoading] = useState32(true);
|
|
32060
|
+
const [success, setSuccess] = useState32(null);
|
|
32061
|
+
const [error, setError] = useState32(null);
|
|
32062
|
+
const [resultNode, setResultNode] = useState32(void 0);
|
|
32063
|
+
useEffect29(() => {
|
|
31587
32064
|
const run = async () => {
|
|
31588
32065
|
try {
|
|
31589
32066
|
const data = await client.get(`/flow-versions/${flowId}/published`);
|
|
31590
|
-
setResultNode(
|
|
32067
|
+
setResultNode(React18.createElement(EntityCard, {
|
|
31591
32068
|
fields: [
|
|
31592
32069
|
{ label: "ID", value: data.id },
|
|
31593
32070
|
{ label: "Version", value: data.version },
|
|
@@ -31605,7 +32082,7 @@ flowVersionsCommand.command("published <flowId>").description("Get the published
|
|
|
31605
32082
|
};
|
|
31606
32083
|
run();
|
|
31607
32084
|
}, []);
|
|
31608
|
-
return
|
|
32085
|
+
return React18.createElement(MutationResult, {
|
|
31609
32086
|
loading,
|
|
31610
32087
|
loadingLabel: "Fetching published version...",
|
|
31611
32088
|
success,
|
|
@@ -31614,7 +32091,7 @@ flowVersionsCommand.command("published <flowId>").description("Get the published
|
|
|
31614
32091
|
result: resultNode
|
|
31615
32092
|
});
|
|
31616
32093
|
};
|
|
31617
|
-
const { waitUntilExit } =
|
|
32094
|
+
const { waitUntilExit } = render18(React18.createElement(App));
|
|
31618
32095
|
await waitUntilExit();
|
|
31619
32096
|
});
|
|
31620
32097
|
flowVersionsCommand.command("publish <flowId>").description("Publish a version").requiredOption("-v, --version <versionId>", "Version ID to publish").option("--tty", "Force TTY mode").option("--no-tty", "Force non-TTY mode").action(async (flowId, options) => {
|
|
@@ -31626,20 +32103,20 @@ flowVersionsCommand.command("publish <flowId>").description("Publish a version")
|
|
|
31626
32103
|
await client.post(`/flow-versions/${flowId}/publish`, {
|
|
31627
32104
|
versionId: options.version
|
|
31628
32105
|
});
|
|
31629
|
-
console.log(
|
|
32106
|
+
console.log(chalk25.green("Version published"));
|
|
31630
32107
|
} catch (error) {
|
|
31631
32108
|
const message = error instanceof Error ? error.message : "Unknown error";
|
|
31632
|
-
console.error(
|
|
31633
|
-
console.error(
|
|
32109
|
+
console.error(chalk25.red("Failed to publish version"));
|
|
32110
|
+
console.error(chalk25.red(message));
|
|
31634
32111
|
process.exit(1);
|
|
31635
32112
|
}
|
|
31636
32113
|
return;
|
|
31637
32114
|
}
|
|
31638
32115
|
const App = () => {
|
|
31639
|
-
const [loading, setLoading] =
|
|
31640
|
-
const [success, setSuccess] =
|
|
31641
|
-
const [error, setError] =
|
|
31642
|
-
|
|
32116
|
+
const [loading, setLoading] = useState32(true);
|
|
32117
|
+
const [success, setSuccess] = useState32(null);
|
|
32118
|
+
const [error, setError] = useState32(null);
|
|
32119
|
+
useEffect29(() => {
|
|
31643
32120
|
const run = async () => {
|
|
31644
32121
|
try {
|
|
31645
32122
|
await client.post(`/flow-versions/${flowId}/publish`, {
|
|
@@ -31655,7 +32132,7 @@ flowVersionsCommand.command("publish <flowId>").description("Publish a version")
|
|
|
31655
32132
|
};
|
|
31656
32133
|
run();
|
|
31657
32134
|
}, []);
|
|
31658
|
-
return
|
|
32135
|
+
return React18.createElement(MutationResult, {
|
|
31659
32136
|
loading,
|
|
31660
32137
|
loadingLabel: "Publishing version...",
|
|
31661
32138
|
success,
|
|
@@ -31663,7 +32140,7 @@ flowVersionsCommand.command("publish <flowId>").description("Publish a version")
|
|
|
31663
32140
|
error
|
|
31664
32141
|
});
|
|
31665
32142
|
};
|
|
31666
|
-
const { waitUntilExit } =
|
|
32143
|
+
const { waitUntilExit } = render18(React18.createElement(App));
|
|
31667
32144
|
await waitUntilExit();
|
|
31668
32145
|
});
|
|
31669
32146
|
|
|
@@ -31671,7 +32148,7 @@ flowVersionsCommand.command("publish <flowId>").description("Publish a version")
|
|
|
31671
32148
|
init_credential_store();
|
|
31672
32149
|
|
|
31673
32150
|
// src/lib/update-check.ts
|
|
31674
|
-
import
|
|
32151
|
+
import chalk26 from "chalk";
|
|
31675
32152
|
import Conf3 from "conf";
|
|
31676
32153
|
var UPDATE_CHECK_INTERVAL_MS = 12 * 60 * 60 * 1e3;
|
|
31677
32154
|
var UPDATE_NOTIFY_INTERVAL_MS = 24 * 60 * 60 * 1e3;
|
|
@@ -31765,7 +32242,7 @@ function notifyFromCachedCliUpdate(args, options = {}) {
|
|
|
31765
32242
|
console.error(message);
|
|
31766
32243
|
});
|
|
31767
32244
|
notify(
|
|
31768
|
-
`${
|
|
32245
|
+
`${chalk26.yellow("Update available:")} ${chalk26.red(currentVersion)} ${chalk26.gray("->")} ${chalk26.green(latestVersion)} ${chalk26.gray(`(${getUpgradeCommand()})`)}`
|
|
31769
32246
|
);
|
|
31770
32247
|
store.set("lastNotifiedAt", now.toISOString());
|
|
31771
32248
|
store.set("lastNotifiedVersion", latestVersion);
|
|
@@ -31807,7 +32284,7 @@ function maybeNotifyAboutCliUpdate(args, options = {}) {
|
|
|
31807
32284
|
// src/index.ts
|
|
31808
32285
|
loadEnv();
|
|
31809
32286
|
setCliTitle();
|
|
31810
|
-
var program = new
|
|
32287
|
+
var program = new Command20();
|
|
31811
32288
|
program.name("runtype").description("CLI for Runtype AI Platform").version(getCliVersion()).option("-v, --verbose", "Enable verbose output").option("--api-url <url>", "Override API URL").option("--json", "Output in JSON format");
|
|
31812
32289
|
program.addCommand(initCommand);
|
|
31813
32290
|
program.addCommand(loginCommand);
|
|
@@ -31824,6 +32301,7 @@ program.addCommand(modelsCommand);
|
|
|
31824
32301
|
program.addCommand(schedulesCommand);
|
|
31825
32302
|
program.addCommand(evalCommand);
|
|
31826
32303
|
program.addCommand(apiKeysCommand);
|
|
32304
|
+
program.addCommand(clientTokensCommand);
|
|
31827
32305
|
program.addCommand(analyticsCommand);
|
|
31828
32306
|
program.addCommand(billingCommand);
|
|
31829
32307
|
program.addCommand(flowVersionsCommand);
|
|
@@ -31841,15 +32319,15 @@ try {
|
|
|
31841
32319
|
} catch (error) {
|
|
31842
32320
|
const commanderError = error;
|
|
31843
32321
|
if (commanderError.code === "commander.missingArgument") {
|
|
31844
|
-
console.error(
|
|
32322
|
+
console.error(chalk27.red(`Error: ${commanderError.message}`));
|
|
31845
32323
|
process.exit(1);
|
|
31846
32324
|
} else if (commanderError.code === "commander.unknownOption") {
|
|
31847
|
-
console.error(
|
|
32325
|
+
console.error(chalk27.red(`Error: ${commanderError.message}`));
|
|
31848
32326
|
process.exit(1);
|
|
31849
32327
|
} else if (commanderError.code === "commander.help" || commanderError.code === "commander.version") {
|
|
31850
32328
|
process.exit(0);
|
|
31851
32329
|
} else {
|
|
31852
|
-
console.error(
|
|
32330
|
+
console.error(chalk27.red("An unexpected error occurred:"));
|
|
31853
32331
|
console.error(error);
|
|
31854
32332
|
process.exit(1);
|
|
31855
32333
|
}
|
|
@@ -31858,12 +32336,12 @@ async function handleNoCommand() {
|
|
|
31858
32336
|
const store = new CredentialStore();
|
|
31859
32337
|
const hasCredentials = await store.hasCredentials();
|
|
31860
32338
|
if (!hasCredentials) {
|
|
31861
|
-
console.log(
|
|
32339
|
+
console.log(chalk27.cyan("\nWelcome to Runtype CLI!\n"));
|
|
31862
32340
|
console.log("It looks like this is your first time. Run the setup wizard:");
|
|
31863
|
-
console.log(` ${
|
|
32341
|
+
console.log(` ${chalk27.green("runtype init")}
|
|
31864
32342
|
`);
|
|
31865
32343
|
console.log("Or see all available commands:");
|
|
31866
|
-
console.log(` ${
|
|
32344
|
+
console.log(` ${chalk27.green("runtype --help")}
|
|
31867
32345
|
`);
|
|
31868
32346
|
} else {
|
|
31869
32347
|
try {
|