@runtypelabs/cli 2.19.4 → 2.21.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 +287 -153
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -44228,6 +44228,135 @@ import React3 from "react";
|
|
|
44228
44228
|
import { render as render3 } from "ink";
|
|
44229
44229
|
import { useState as useState4, useEffect as useEffect5 } from "react";
|
|
44230
44230
|
import { writeFileSync } from "fs";
|
|
44231
|
+
|
|
44232
|
+
// src/lib/terminal-image.ts
|
|
44233
|
+
var ESC = "\x1B";
|
|
44234
|
+
var BEL = "\x07";
|
|
44235
|
+
var ST = `${ESC}\\`;
|
|
44236
|
+
function detectImageProtocol(env = process.env, isTTY2 = process.stdout.isTTY === true) {
|
|
44237
|
+
if (!isTTY2) return null;
|
|
44238
|
+
if (env.TERM === "xterm-kitty" || env.KITTY_WINDOW_ID || env.TERM_PROGRAM === "ghostty") {
|
|
44239
|
+
return "kitty";
|
|
44240
|
+
}
|
|
44241
|
+
if (env.TERM_PROGRAM === "iTerm.app" || env.TERM_PROGRAM === "WezTerm" || env.LC_TERMINAL === "iTerm2") {
|
|
44242
|
+
return "iterm2";
|
|
44243
|
+
}
|
|
44244
|
+
return null;
|
|
44245
|
+
}
|
|
44246
|
+
function parseImageDataUri(value) {
|
|
44247
|
+
if (typeof value !== "string" || !value.startsWith("data:")) return null;
|
|
44248
|
+
const match = value.match(/^data:([^;,]+)(?:;[^,]*)?;base64,(.+)$/s);
|
|
44249
|
+
if (!match || !match[1] || !match[2]) return null;
|
|
44250
|
+
return { mimeType: match[1], base64: match[2] };
|
|
44251
|
+
}
|
|
44252
|
+
function base64DecodedByteLength(base643) {
|
|
44253
|
+
const len = base643.length;
|
|
44254
|
+
if (len === 0) return 0;
|
|
44255
|
+
let padding = 0;
|
|
44256
|
+
if (base643.endsWith("==")) padding = 2;
|
|
44257
|
+
else if (base643.endsWith("=")) padding = 1;
|
|
44258
|
+
return Math.floor(len * 3 / 4) - padding;
|
|
44259
|
+
}
|
|
44260
|
+
function kittyImageSequence(base643) {
|
|
44261
|
+
const CHUNK = 4096;
|
|
44262
|
+
if (base643.length <= CHUNK) {
|
|
44263
|
+
return `${ESC}_Ga=T,f=100,m=0;${base643}${ST}`;
|
|
44264
|
+
}
|
|
44265
|
+
let out = "";
|
|
44266
|
+
for (let i = 0; i < base643.length; i += CHUNK) {
|
|
44267
|
+
const piece = base643.slice(i, i + CHUNK);
|
|
44268
|
+
const more = i + CHUNK < base643.length ? 1 : 0;
|
|
44269
|
+
out += i === 0 ? `${ESC}_Ga=T,f=100,m=${more};${piece}${ST}` : `${ESC}_Gm=${more};${piece}${ST}`;
|
|
44270
|
+
}
|
|
44271
|
+
return out;
|
|
44272
|
+
}
|
|
44273
|
+
function encodeInlineImage(opts) {
|
|
44274
|
+
const { base64: base643, mimeType, protocol } = opts;
|
|
44275
|
+
if (!base643) return null;
|
|
44276
|
+
if (protocol === "iterm2") {
|
|
44277
|
+
const sizeBytes = base64DecodedByteLength(base643);
|
|
44278
|
+
return `${ESC}]1337;File=inline=1;size=${sizeBytes};width=auto;height=auto;preserveAspectRatio=1:${base643}${BEL}`;
|
|
44279
|
+
}
|
|
44280
|
+
if (mimeType !== "image/png") return null;
|
|
44281
|
+
return kittyImageSequence(base643);
|
|
44282
|
+
}
|
|
44283
|
+
function renderInlineImage(value, protocol) {
|
|
44284
|
+
const parsed = parseImageDataUri(value);
|
|
44285
|
+
if (!parsed) return null;
|
|
44286
|
+
return encodeInlineImage({ base64: parsed.base64, mimeType: parsed.mimeType, protocol });
|
|
44287
|
+
}
|
|
44288
|
+
|
|
44289
|
+
// src/lib/message-content.ts
|
|
44290
|
+
function renderMessageContent(content) {
|
|
44291
|
+
if (typeof content === "string") return content;
|
|
44292
|
+
if (!Array.isArray(content)) return content == null ? "" : String(content);
|
|
44293
|
+
return content.map((part) => {
|
|
44294
|
+
if (part == null || typeof part !== "object") return part == null ? "" : String(part);
|
|
44295
|
+
const p = part;
|
|
44296
|
+
switch (p.type) {
|
|
44297
|
+
case "text":
|
|
44298
|
+
case "reasoning":
|
|
44299
|
+
return typeof p.text === "string" ? p.text : "";
|
|
44300
|
+
case "image":
|
|
44301
|
+
return `[image${"mimeType" in p && p.mimeType ? ` ${p.mimeType}` : ""}]`;
|
|
44302
|
+
case "file":
|
|
44303
|
+
return `[file${"filename" in p && p.filename ? ` ${p.filename}` : ""}${"mimeType" in p && p.mimeType ? ` (${p.mimeType})` : ""}]`;
|
|
44304
|
+
case "asset_ref":
|
|
44305
|
+
return `[attachment${"filename" in p && p.filename ? ` ${p.filename}` : ""}${"mimeType" in p && p.mimeType ? ` ${p.mimeType}` : ""}]`;
|
|
44306
|
+
default:
|
|
44307
|
+
return typeof p.type === "string" ? `[${p.type}]` : "";
|
|
44308
|
+
}
|
|
44309
|
+
}).filter((s) => s.length > 0).join(" ");
|
|
44310
|
+
}
|
|
44311
|
+
function renderMessageContentWithImages(content, protocol) {
|
|
44312
|
+
if (!Array.isArray(content)) {
|
|
44313
|
+
return { text: renderMessageContent(content), images: [] };
|
|
44314
|
+
}
|
|
44315
|
+
const inline = [];
|
|
44316
|
+
const images = [];
|
|
44317
|
+
for (const part of content) {
|
|
44318
|
+
if (part && typeof part === "object" && part.type === "image") {
|
|
44319
|
+
const image = part.image;
|
|
44320
|
+
const seq = typeof image === "string" ? renderInlineImage(image, protocol) : null;
|
|
44321
|
+
if (seq) {
|
|
44322
|
+
images.push(seq);
|
|
44323
|
+
continue;
|
|
44324
|
+
}
|
|
44325
|
+
}
|
|
44326
|
+
inline.push(renderMessageContent([part]));
|
|
44327
|
+
}
|
|
44328
|
+
return { text: inline.filter((s) => s.length > 0).join(" "), images };
|
|
44329
|
+
}
|
|
44330
|
+
|
|
44331
|
+
// src/commands/records.ts
|
|
44332
|
+
function printRecordDetail(data, imageProtocol) {
|
|
44333
|
+
console.log(` ID: ${data.id}`);
|
|
44334
|
+
console.log(` Name: ${data.name}`);
|
|
44335
|
+
console.log(` Type: ${data.type}`);
|
|
44336
|
+
if (data.metadata) {
|
|
44337
|
+
console.log(` Metadata: ${JSON.stringify(data.metadata, null, 2)}`);
|
|
44338
|
+
}
|
|
44339
|
+
const messages = data.messages ?? [];
|
|
44340
|
+
if (messages.length === 0) return;
|
|
44341
|
+
console.log(chalk6.cyan(`
|
|
44342
|
+
Messages (${messages.length}):`));
|
|
44343
|
+
for (const msg of messages) {
|
|
44344
|
+
const role = typeof msg.role === "string" ? msg.role : "message";
|
|
44345
|
+
const roleColor = role === "user" ? chalk6.blue : role === "assistant" ? chalk6.green : chalk6.gray;
|
|
44346
|
+
const rolePrefix = ` ${roleColor(role)}: `;
|
|
44347
|
+
if (imageProtocol) {
|
|
44348
|
+
const { text, images } = renderMessageContentWithImages(msg.content, imageProtocol);
|
|
44349
|
+
process.stdout.write(`${rolePrefix}${text}
|
|
44350
|
+
`);
|
|
44351
|
+
for (const seq of images) {
|
|
44352
|
+
process.stdout.write(`${seq}
|
|
44353
|
+
`);
|
|
44354
|
+
}
|
|
44355
|
+
} else {
|
|
44356
|
+
console.log(`${rolePrefix}${renderMessageContent(msg.content)}`);
|
|
44357
|
+
}
|
|
44358
|
+
}
|
|
44359
|
+
}
|
|
44231
44360
|
var recordsCommand = new Command3("records").description("Manage records");
|
|
44232
44361
|
recordsCommand.command("list").description("List all records").option("--type <type>", "Filter by record type").option("--limit <n>", "Limit number of results", "20").option("--cursor <cursor>", "Pagination cursor for the next page").option("--json", "Output as JSON").option("--tty", "Force TTY mode").option("--no-tty", "Force non-TTY mode").action(
|
|
44233
44362
|
async (options) => {
|
|
@@ -44307,45 +44436,43 @@ recordsCommand.command("list").description("List all records").option("--type <t
|
|
|
44307
44436
|
await waitUntilExit();
|
|
44308
44437
|
}
|
|
44309
44438
|
);
|
|
44310
|
-
recordsCommand.command("get <id>").description("Get record details").option("--json", "Output as JSON").option("--tty", "Force TTY mode").option("--no-tty", "Force non-TTY mode").
|
|
44311
|
-
|
|
44312
|
-
|
|
44313
|
-
|
|
44314
|
-
|
|
44315
|
-
|
|
44316
|
-
|
|
44317
|
-
|
|
44318
|
-
|
|
44319
|
-
|
|
44320
|
-
|
|
44321
|
-
|
|
44322
|
-
|
|
44323
|
-
|
|
44324
|
-
|
|
44325
|
-
|
|
44439
|
+
recordsCommand.command("get <id>").description("Get record details").option("--json", "Output as JSON").option("--tty", "Force TTY mode").option("--no-tty", "Force non-TTY mode").option("--no-images", "Disable inline image rendering even in supported terminals").action(
|
|
44440
|
+
async (id, options) => {
|
|
44441
|
+
const apiKey = await ensureAuth();
|
|
44442
|
+
if (!apiKey) return;
|
|
44443
|
+
const client = createCliClient(apiKey);
|
|
44444
|
+
const interactive = isTTY(options) && !options.json;
|
|
44445
|
+
const imageProtocol = interactive && options.images !== false ? detectImageProtocol() : null;
|
|
44446
|
+
if (!interactive || imageProtocol) {
|
|
44447
|
+
try {
|
|
44448
|
+
const data = await client.get(`/records/${id}`);
|
|
44449
|
+
if (options.json) {
|
|
44450
|
+
printJson(data);
|
|
44451
|
+
return;
|
|
44452
|
+
}
|
|
44453
|
+
printRecordDetail(data, imageProtocol);
|
|
44454
|
+
} catch (error51) {
|
|
44455
|
+
const message = error51 instanceof Error ? error51.message : "Unknown error";
|
|
44456
|
+
console.error(chalk6.red(`Failed to fetch record: ${message}`));
|
|
44457
|
+
process.exit(1);
|
|
44326
44458
|
}
|
|
44327
|
-
|
|
44328
|
-
const message = error51 instanceof Error ? error51.message : "Unknown error";
|
|
44329
|
-
console.error(chalk6.red(`Failed to fetch record: ${message}`));
|
|
44330
|
-
process.exit(1);
|
|
44459
|
+
return;
|
|
44331
44460
|
}
|
|
44332
|
-
|
|
44333
|
-
|
|
44334
|
-
|
|
44335
|
-
|
|
44336
|
-
|
|
44337
|
-
|
|
44338
|
-
|
|
44339
|
-
|
|
44340
|
-
|
|
44341
|
-
|
|
44342
|
-
|
|
44343
|
-
|
|
44344
|
-
|
|
44345
|
-
|
|
44346
|
-
|
|
44347
|
-
return React3.createElement(EntityCard, {
|
|
44348
|
-
fields: [
|
|
44461
|
+
const App = () => {
|
|
44462
|
+
const [items, setItems] = useState4(null);
|
|
44463
|
+
const [error51, setError] = useState4(null);
|
|
44464
|
+
useEffect5(() => {
|
|
44465
|
+
client.get(`/records/${id}`).then((res) => setItems([res])).catch((err) => setError(err instanceof Error ? err : new Error(String(err))));
|
|
44466
|
+
}, []);
|
|
44467
|
+
return React3.createElement(DataList, {
|
|
44468
|
+
title: "Record",
|
|
44469
|
+
items,
|
|
44470
|
+
error: error51,
|
|
44471
|
+
loading: items === null && error51 === null,
|
|
44472
|
+
renderCard: (item) => {
|
|
44473
|
+
const record2 = item;
|
|
44474
|
+
const messages = record2.messages ?? [];
|
|
44475
|
+
const fields = [
|
|
44349
44476
|
{ label: "ID", value: record2.id, color: "green" },
|
|
44350
44477
|
{ label: "Name", value: record2.name },
|
|
44351
44478
|
{ label: "Type", value: record2.type },
|
|
@@ -44353,14 +44480,21 @@ recordsCommand.command("get <id>").description("Get record details").option("--j
|
|
|
44353
44480
|
label: "Metadata",
|
|
44354
44481
|
value: record2.metadata ? JSON.stringify(record2.metadata) : null
|
|
44355
44482
|
}
|
|
44356
|
-
]
|
|
44357
|
-
|
|
44358
|
-
|
|
44359
|
-
|
|
44360
|
-
|
|
44361
|
-
|
|
44362
|
-
|
|
44363
|
-
});
|
|
44483
|
+
];
|
|
44484
|
+
if (messages.length > 0) {
|
|
44485
|
+
fields.push({
|
|
44486
|
+
label: `Messages (${messages.length})`,
|
|
44487
|
+
value: messages.map((m2) => `${m2.role ?? "message"}: ${renderMessageContent(m2.content)}`).join("\n")
|
|
44488
|
+
});
|
|
44489
|
+
}
|
|
44490
|
+
return React3.createElement(EntityCard, { fields });
|
|
44491
|
+
}
|
|
44492
|
+
});
|
|
44493
|
+
};
|
|
44494
|
+
const { waitUntilExit } = render3(React3.createElement(App));
|
|
44495
|
+
await waitUntilExit();
|
|
44496
|
+
}
|
|
44497
|
+
);
|
|
44364
44498
|
recordsCommand.command("results <id>").description("Get step-level execution results for a record").option("--flow-id <flowId>", "Filter by flow ID").option("--batch-id <batchId>", "Filter by batch ID").option("--status <status>", "Filter by status").option("--limit <n>", "Limit number of results").option("--offset <n>", "Offset for pagination").option("--json", "Output as JSON").option("--tty", "Force TTY mode").option("--no-tty", "Force non-TTY mode").action(
|
|
44365
44499
|
async (id, options) => {
|
|
44366
44500
|
const apiKey = await ensureAuth();
|
|
@@ -48784,26 +48918,45 @@ import chalk17 from "chalk";
|
|
|
48784
48918
|
import React14 from "react";
|
|
48785
48919
|
import { render as render14 } from "ink";
|
|
48786
48920
|
import { useState as useState15, useEffect as useEffect16 } from "react";
|
|
48787
|
-
function
|
|
48788
|
-
|
|
48789
|
-
|
|
48790
|
-
|
|
48791
|
-
|
|
48792
|
-
|
|
48793
|
-
|
|
48794
|
-
|
|
48795
|
-
|
|
48796
|
-
|
|
48797
|
-
|
|
48798
|
-
|
|
48799
|
-
|
|
48800
|
-
|
|
48801
|
-
|
|
48802
|
-
|
|
48803
|
-
|
|
48804
|
-
|
|
48921
|
+
function writeMessageWithImages(msg, rolePrefix, protocol) {
|
|
48922
|
+
const out = process.stdout;
|
|
48923
|
+
const { text, images } = renderMessageContentWithImages(msg.content, protocol);
|
|
48924
|
+
out.write(`${rolePrefix}${text}
|
|
48925
|
+
`);
|
|
48926
|
+
for (const seq of images) {
|
|
48927
|
+
out.write(`${seq}
|
|
48928
|
+
`);
|
|
48929
|
+
}
|
|
48930
|
+
}
|
|
48931
|
+
function printConversationDetail(data, imageProtocol) {
|
|
48932
|
+
printDetail("Conversation", [
|
|
48933
|
+
{ label: "ID", value: data.id },
|
|
48934
|
+
{ label: "Title", value: data.title },
|
|
48935
|
+
{ label: "Model", value: data.modelId },
|
|
48936
|
+
{ label: "System prompt", value: data.systemPrompt },
|
|
48937
|
+
{ label: "Owner", value: data.ownerId },
|
|
48938
|
+
{ label: "Source", value: data.source },
|
|
48939
|
+
{ label: "Created", value: data.createdAt },
|
|
48940
|
+
{ label: "Updated", value: data.updatedAt }
|
|
48941
|
+
]);
|
|
48942
|
+
const messages = data.messages ?? [];
|
|
48943
|
+
console.log(chalk17.cyan(`
|
|
48944
|
+
Messages (${messages.length}):`));
|
|
48945
|
+
if (messages.length === 0) {
|
|
48946
|
+
console.log(chalk17.gray(" No messages"));
|
|
48947
|
+
return;
|
|
48948
|
+
}
|
|
48949
|
+
for (const msg of messages) {
|
|
48950
|
+
const roleColor = msg.role === "user" ? chalk17.blue : msg.role === "assistant" ? chalk17.green : chalk17.gray;
|
|
48951
|
+
if (imageProtocol) {
|
|
48952
|
+
writeMessageWithImages(msg, ` ${roleColor(msg.role)}: `, imageProtocol);
|
|
48953
|
+
} else {
|
|
48954
|
+
console.log(` ${roleColor(msg.role)}: ${renderMessageContent(msg.content)}`);
|
|
48805
48955
|
}
|
|
48806
|
-
|
|
48956
|
+
if (msg.createdAt) {
|
|
48957
|
+
console.log(chalk17.dim(` ${msg.createdAt}`));
|
|
48958
|
+
}
|
|
48959
|
+
}
|
|
48807
48960
|
}
|
|
48808
48961
|
var conversationsCommand = new Command15("conversations").description("Manage conversations");
|
|
48809
48962
|
conversationsCommand.command("list").description("List your conversations").option("--limit <n>", "Limit results (defaults to the API page size)").option("--cursor <cursor>", "Pagination cursor for the next page").option("--json", "Output as JSON").option("--tty", "Force TTY mode").option("--no-tty", "Force non-TTY mode").action(async (options) => {
|
|
@@ -48882,99 +49035,80 @@ conversationsCommand.command("list").description("List your conversations").opti
|
|
|
48882
49035
|
const { waitUntilExit } = render14(React14.createElement(App));
|
|
48883
49036
|
await waitUntilExit();
|
|
48884
49037
|
});
|
|
48885
|
-
conversationsCommand.command("get <id>").description("Get conversation details including its messages").option("--json", "Output as JSON").option("--tty", "Force TTY mode").option("--no-tty", "Force non-TTY mode").
|
|
48886
|
-
|
|
48887
|
-
|
|
48888
|
-
|
|
48889
|
-
|
|
48890
|
-
|
|
48891
|
-
|
|
48892
|
-
|
|
48893
|
-
|
|
48894
|
-
|
|
48895
|
-
|
|
48896
|
-
|
|
48897
|
-
|
|
48898
|
-
{ label: "Title", value: data.title },
|
|
48899
|
-
{ label: "Model", value: data.modelId },
|
|
48900
|
-
{ label: "System prompt", value: data.systemPrompt },
|
|
48901
|
-
{ label: "Owner", value: data.ownerId },
|
|
48902
|
-
{ label: "Source", value: data.source },
|
|
48903
|
-
{ label: "Created", value: data.createdAt },
|
|
48904
|
-
{ label: "Updated", value: data.updatedAt }
|
|
48905
|
-
]);
|
|
48906
|
-
const messages = data.messages ?? [];
|
|
48907
|
-
console.log(chalk17.cyan(`
|
|
48908
|
-
Messages (${messages.length}):`));
|
|
48909
|
-
if (messages.length === 0) {
|
|
48910
|
-
console.log(chalk17.gray(" No messages"));
|
|
48911
|
-
} else {
|
|
48912
|
-
for (const msg of messages) {
|
|
48913
|
-
const roleColor = msg.role === "user" ? chalk17.blue : msg.role === "assistant" ? chalk17.green : chalk17.gray;
|
|
48914
|
-
console.log(` ${roleColor(msg.role)}: ${renderMessageContent(msg.content)}`);
|
|
48915
|
-
if (msg.createdAt) {
|
|
48916
|
-
console.log(chalk17.dim(` ${msg.createdAt}`));
|
|
48917
|
-
}
|
|
49038
|
+
conversationsCommand.command("get <id>").description("Get conversation details including its messages").option("--json", "Output as JSON").option("--tty", "Force TTY mode").option("--no-tty", "Force non-TTY mode").option("--no-images", "Disable inline image rendering even in supported terminals").action(
|
|
49039
|
+
async (id, options) => {
|
|
49040
|
+
const apiKey = await ensureAuth();
|
|
49041
|
+
if (!apiKey) return;
|
|
49042
|
+
const client = createCliClient(apiKey);
|
|
49043
|
+
const interactive = isTTY(options) && !options.json;
|
|
49044
|
+
const imageProtocol = interactive && options.images !== false ? detectImageProtocol() : null;
|
|
49045
|
+
if (!interactive || imageProtocol) {
|
|
49046
|
+
try {
|
|
49047
|
+
const data = await client.get(`/conversations/${id}`);
|
|
49048
|
+
if (options.json) {
|
|
49049
|
+
printJson(data);
|
|
49050
|
+
return;
|
|
48918
49051
|
}
|
|
49052
|
+
printConversationDetail(data, imageProtocol);
|
|
49053
|
+
} catch (error51) {
|
|
49054
|
+
const message = error51 instanceof Error ? error51.message : "Unknown error";
|
|
49055
|
+
console.error(chalk17.red(`Failed to fetch conversation: ${message}`));
|
|
49056
|
+
process.exit(1);
|
|
48919
49057
|
}
|
|
48920
|
-
|
|
48921
|
-
const message = error51 instanceof Error ? error51.message : "Unknown error";
|
|
48922
|
-
console.error(chalk17.red(`Failed to fetch conversation: ${message}`));
|
|
48923
|
-
process.exit(1);
|
|
49058
|
+
return;
|
|
48924
49059
|
}
|
|
48925
|
-
|
|
49060
|
+
const App = () => {
|
|
49061
|
+
const [loading, setLoading] = useState15(true);
|
|
49062
|
+
const [success2, setSuccess] = useState15(null);
|
|
49063
|
+
const [error51, setError] = useState15(null);
|
|
49064
|
+
const [resultNode, setResultNode] = useState15(void 0);
|
|
49065
|
+
useEffect16(() => {
|
|
49066
|
+
const run2 = async () => {
|
|
49067
|
+
try {
|
|
49068
|
+
const data = await client.get(`/conversations/${id}`);
|
|
49069
|
+
const messages = data.messages ?? [];
|
|
49070
|
+
const messageSummary = messages.length === 0 ? "No messages" : messages.map((m2) => `${m2.role}: ${renderMessageContent(m2.content)}`).join("\n");
|
|
49071
|
+
setResultNode(
|
|
49072
|
+
React14.createElement(EntityCard, {
|
|
49073
|
+
fields: [
|
|
49074
|
+
{ label: "ID", value: data.id, color: "green" },
|
|
49075
|
+
{ label: "Title", value: data.title },
|
|
49076
|
+
{ label: "Model", value: data.modelId },
|
|
49077
|
+
{ label: "System prompt", value: data.systemPrompt },
|
|
49078
|
+
{ label: "Owner", value: data.ownerId },
|
|
49079
|
+
{ label: "Source", value: data.source, color: "gray" },
|
|
49080
|
+
{ label: "Created", value: data.createdAt },
|
|
49081
|
+
{ label: "Updated", value: data.updatedAt },
|
|
49082
|
+
{
|
|
49083
|
+
label: `Messages (${messages.length})`,
|
|
49084
|
+
value: messageSummary
|
|
49085
|
+
}
|
|
49086
|
+
]
|
|
49087
|
+
})
|
|
49088
|
+
);
|
|
49089
|
+
setSuccess(true);
|
|
49090
|
+
setLoading(false);
|
|
49091
|
+
} catch (err) {
|
|
49092
|
+
setError(err instanceof Error ? err : new Error(String(err)));
|
|
49093
|
+
setSuccess(false);
|
|
49094
|
+
setLoading(false);
|
|
49095
|
+
}
|
|
49096
|
+
};
|
|
49097
|
+
run2();
|
|
49098
|
+
}, []);
|
|
49099
|
+
return React14.createElement(MutationResult, {
|
|
49100
|
+
loading,
|
|
49101
|
+
loadingLabel: "Fetching conversation...",
|
|
49102
|
+
success: success2,
|
|
49103
|
+
successMessage: "Conversation",
|
|
49104
|
+
error: error51,
|
|
49105
|
+
result: resultNode
|
|
49106
|
+
});
|
|
49107
|
+
};
|
|
49108
|
+
const { waitUntilExit } = render14(React14.createElement(App));
|
|
49109
|
+
await waitUntilExit();
|
|
48926
49110
|
}
|
|
48927
|
-
|
|
48928
|
-
const [loading, setLoading] = useState15(true);
|
|
48929
|
-
const [success2, setSuccess] = useState15(null);
|
|
48930
|
-
const [error51, setError] = useState15(null);
|
|
48931
|
-
const [resultNode, setResultNode] = useState15(void 0);
|
|
48932
|
-
useEffect16(() => {
|
|
48933
|
-
const run2 = async () => {
|
|
48934
|
-
try {
|
|
48935
|
-
const data = await client.get(`/conversations/${id}`);
|
|
48936
|
-
const messages = data.messages ?? [];
|
|
48937
|
-
const messageSummary = messages.length === 0 ? "No messages" : messages.map((m2) => `${m2.role}: ${renderMessageContent(m2.content)}`).join("\n");
|
|
48938
|
-
setResultNode(
|
|
48939
|
-
React14.createElement(EntityCard, {
|
|
48940
|
-
fields: [
|
|
48941
|
-
{ label: "ID", value: data.id, color: "green" },
|
|
48942
|
-
{ label: "Title", value: data.title },
|
|
48943
|
-
{ label: "Model", value: data.modelId },
|
|
48944
|
-
{ label: "System prompt", value: data.systemPrompt },
|
|
48945
|
-
{ label: "Owner", value: data.ownerId },
|
|
48946
|
-
{ label: "Source", value: data.source, color: "gray" },
|
|
48947
|
-
{ label: "Created", value: data.createdAt },
|
|
48948
|
-
{ label: "Updated", value: data.updatedAt },
|
|
48949
|
-
{
|
|
48950
|
-
label: `Messages (${messages.length})`,
|
|
48951
|
-
value: messageSummary
|
|
48952
|
-
}
|
|
48953
|
-
]
|
|
48954
|
-
})
|
|
48955
|
-
);
|
|
48956
|
-
setSuccess(true);
|
|
48957
|
-
setLoading(false);
|
|
48958
|
-
} catch (err) {
|
|
48959
|
-
setError(err instanceof Error ? err : new Error(String(err)));
|
|
48960
|
-
setSuccess(false);
|
|
48961
|
-
setLoading(false);
|
|
48962
|
-
}
|
|
48963
|
-
};
|
|
48964
|
-
run2();
|
|
48965
|
-
}, []);
|
|
48966
|
-
return React14.createElement(MutationResult, {
|
|
48967
|
-
loading,
|
|
48968
|
-
loadingLabel: "Fetching conversation...",
|
|
48969
|
-
success: success2,
|
|
48970
|
-
successMessage: "Conversation",
|
|
48971
|
-
error: error51,
|
|
48972
|
-
result: resultNode
|
|
48973
|
-
});
|
|
48974
|
-
};
|
|
48975
|
-
const { waitUntilExit } = render14(React14.createElement(App));
|
|
48976
|
-
await waitUntilExit();
|
|
48977
|
-
});
|
|
49111
|
+
);
|
|
48978
49112
|
conversationsCommand.command("delete <id>").description("Delete a conversation").option("--tty", "Force TTY mode").option("--no-tty", "Force non-TTY mode").option("--yes", "Skip confirmation").action(async (id, options) => {
|
|
48979
49113
|
const apiKey = await ensureAuth();
|
|
48980
49114
|
if (!apiKey) return;
|