@volter-ai-dev/supercode-ui 0.1.16 → 0.1.17
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/components.mjs +19 -3
- package/conversation.mjs +19 -3
- package/core.mjs +20 -3
- package/embed.mjs +19 -3
- package/messenger.mjs +19 -3
- package/package.json +1 -1
package/components.mjs
CHANGED
|
@@ -272,6 +272,21 @@ function editPreview(args, resultText, source) {
|
|
|
272
272
|
if (patch) return patch;
|
|
273
273
|
return /^(?:diff --git|@@ |--- |\+\+\+ )/m.test(resultText ?? "") ? resultText : "";
|
|
274
274
|
}
|
|
275
|
+
function toolResultEnvelope(resultText) {
|
|
276
|
+
const match = /^Script (?:completed|failed)\r?\nWall time ([0-9.]+) seconds\r?\nOutput:\r?\n([\s\S]*)$/.exec(resultText ?? "");
|
|
277
|
+
if (!match) return { preview: resultText ?? "", value: null, durationMs: null };
|
|
278
|
+
const durationMs = Number(match[1]) * 1e3;
|
|
279
|
+
try {
|
|
280
|
+
const value = record(JSON.parse(match[2]));
|
|
281
|
+
return {
|
|
282
|
+
preview: typeof value?.output === "string" ? value.output : match[2],
|
|
283
|
+
value,
|
|
284
|
+
durationMs: Number.isFinite(durationMs) ? durationMs : null
|
|
285
|
+
};
|
|
286
|
+
} catch {
|
|
287
|
+
return { preview: match[2], value: null, durationMs: Number.isFinite(durationMs) ? durationMs : null };
|
|
288
|
+
}
|
|
289
|
+
}
|
|
275
290
|
function verificationCommand(command) {
|
|
276
291
|
let shell = "";
|
|
277
292
|
let quote = "";
|
|
@@ -336,6 +351,7 @@ function toolAction(status, category, name, tools) {
|
|
|
336
351
|
function createToolPresentation(entry) {
|
|
337
352
|
const envelope = toolEnvelope(entry);
|
|
338
353
|
const args = envelope.args;
|
|
354
|
+
const outcome = toolResultEnvelope(entry.resultText);
|
|
339
355
|
const command = firstString(args, ["command", "cmd"]) || sourceString(envelope.callSource, ["command", "cmd"]);
|
|
340
356
|
const category = classifyTool(envelope.name, command || envelope.source || entry.arguments || "");
|
|
341
357
|
const path = firstString(args, ["file_path", "target_file", "target_directory", "path"]) || sourceString(envelope.callSource, ["file_path", "target_file", "target_directory", "path"]) || patchPath(envelope.source);
|
|
@@ -347,7 +363,7 @@ function createToolPresentation(entry) {
|
|
|
347
363
|
const taskId = firstString(args, ["taskId", "task_id"]);
|
|
348
364
|
const planTarget = category === "plan" ? items.length ? `${items.length} ${items.length === 1 ? "item" : "items"}` : taskId ? `task ${taskId}` : "" : "";
|
|
349
365
|
const target = path || command || query || url || subject || background || planTarget || (envelope.tools.length > 1 ? `${envelope.tools.length} coordinated actions` : toolTarget(entry.arguments));
|
|
350
|
-
const previewSource = category === "edit" ? editPreview(args,
|
|
366
|
+
const previewSource = category === "edit" ? editPreview(args, outcome.preview, envelope.source) : outcome.preview;
|
|
351
367
|
const result = record(entry.resultContent);
|
|
352
368
|
const metadata = record(entry.metadata);
|
|
353
369
|
const resultMetadata = record(result?.metadata);
|
|
@@ -366,8 +382,8 @@ function createToolPresentation(entry) {
|
|
|
366
382
|
fields: usefulToolFields(args),
|
|
367
383
|
items,
|
|
368
384
|
tools: envelope.tools,
|
|
369
|
-
exitCode: explicitNumber([result, resultMetadata, metadata], ["exit_code", "exitCode", "pi_bash_exit_code"]),
|
|
370
|
-
durationMs: explicitNumber([result, resultMetadata, metadata], ["duration_ms", "durationMs", "elapsed_ms", "elapsedMs", "totalDurationMs"]),
|
|
385
|
+
exitCode: explicitNumber([outcome.value, result, resultMetadata, metadata], ["exit_code", "exitCode", "pi_bash_exit_code"]),
|
|
386
|
+
durationMs: explicitNumber([outcome.value, result, resultMetadata, metadata], ["duration_ms", "durationMs", "elapsed_ms", "elapsedMs", "totalDurationMs"]) ?? outcome.durationMs,
|
|
371
387
|
additions: explicitNumber([result, resultMetadata, metadata], ["additions", "lines_added"]),
|
|
372
388
|
deletions: explicitNumber([result, resultMetadata, metadata], ["deletions", "lines_removed"]),
|
|
373
389
|
matches: explicitNumber([result, resultMetadata, metadata], ["matches", "match_count", "result_count"])
|
package/conversation.mjs
CHANGED
|
@@ -258,6 +258,21 @@ function editPreview(args, resultText, source) {
|
|
|
258
258
|
if (patch) return patch;
|
|
259
259
|
return /^(?:diff --git|@@ |--- |\+\+\+ )/m.test(resultText ?? "") ? resultText : "";
|
|
260
260
|
}
|
|
261
|
+
function toolResultEnvelope(resultText) {
|
|
262
|
+
const match = /^Script (?:completed|failed)\r?\nWall time ([0-9.]+) seconds\r?\nOutput:\r?\n([\s\S]*)$/.exec(resultText ?? "");
|
|
263
|
+
if (!match) return { preview: resultText ?? "", value: null, durationMs: null };
|
|
264
|
+
const durationMs = Number(match[1]) * 1e3;
|
|
265
|
+
try {
|
|
266
|
+
const value = record(JSON.parse(match[2]));
|
|
267
|
+
return {
|
|
268
|
+
preview: typeof value?.output === "string" ? value.output : match[2],
|
|
269
|
+
value,
|
|
270
|
+
durationMs: Number.isFinite(durationMs) ? durationMs : null
|
|
271
|
+
};
|
|
272
|
+
} catch {
|
|
273
|
+
return { preview: match[2], value: null, durationMs: Number.isFinite(durationMs) ? durationMs : null };
|
|
274
|
+
}
|
|
275
|
+
}
|
|
261
276
|
function verificationCommand(command) {
|
|
262
277
|
let shell = "";
|
|
263
278
|
let quote = "";
|
|
@@ -322,6 +337,7 @@ function toolAction(status, category, name, tools) {
|
|
|
322
337
|
function createToolPresentation(entry) {
|
|
323
338
|
const envelope = toolEnvelope(entry);
|
|
324
339
|
const args = envelope.args;
|
|
340
|
+
const outcome = toolResultEnvelope(entry.resultText);
|
|
325
341
|
const command = firstString(args, ["command", "cmd"]) || sourceString(envelope.callSource, ["command", "cmd"]);
|
|
326
342
|
const category = classifyTool(envelope.name, command || envelope.source || entry.arguments || "");
|
|
327
343
|
const path = firstString(args, ["file_path", "target_file", "target_directory", "path"]) || sourceString(envelope.callSource, ["file_path", "target_file", "target_directory", "path"]) || patchPath(envelope.source);
|
|
@@ -333,7 +349,7 @@ function createToolPresentation(entry) {
|
|
|
333
349
|
const taskId = firstString(args, ["taskId", "task_id"]);
|
|
334
350
|
const planTarget = category === "plan" ? items.length ? `${items.length} ${items.length === 1 ? "item" : "items"}` : taskId ? `task ${taskId}` : "" : "";
|
|
335
351
|
const target = path || command || query || url || subject || background || planTarget || (envelope.tools.length > 1 ? `${envelope.tools.length} coordinated actions` : toolTarget(entry.arguments));
|
|
336
|
-
const previewSource = category === "edit" ? editPreview(args,
|
|
352
|
+
const previewSource = category === "edit" ? editPreview(args, outcome.preview, envelope.source) : outcome.preview;
|
|
337
353
|
const result = record(entry.resultContent);
|
|
338
354
|
const metadata = record(entry.metadata);
|
|
339
355
|
const resultMetadata = record(result?.metadata);
|
|
@@ -352,8 +368,8 @@ function createToolPresentation(entry) {
|
|
|
352
368
|
fields: usefulToolFields(args),
|
|
353
369
|
items,
|
|
354
370
|
tools: envelope.tools,
|
|
355
|
-
exitCode: explicitNumber([result, resultMetadata, metadata], ["exit_code", "exitCode", "pi_bash_exit_code"]),
|
|
356
|
-
durationMs: explicitNumber([result, resultMetadata, metadata], ["duration_ms", "durationMs", "elapsed_ms", "elapsedMs", "totalDurationMs"]),
|
|
371
|
+
exitCode: explicitNumber([outcome.value, result, resultMetadata, metadata], ["exit_code", "exitCode", "pi_bash_exit_code"]),
|
|
372
|
+
durationMs: explicitNumber([outcome.value, result, resultMetadata, metadata], ["duration_ms", "durationMs", "elapsed_ms", "elapsedMs", "totalDurationMs"]) ?? outcome.durationMs,
|
|
357
373
|
additions: explicitNumber([result, resultMetadata, metadata], ["additions", "lines_added"]),
|
|
358
374
|
deletions: explicitNumber([result, resultMetadata, metadata], ["deletions", "lines_removed"]),
|
|
359
375
|
matches: explicitNumber([result, resultMetadata, metadata], ["matches", "match_count", "result_count"])
|
package/core.mjs
CHANGED
|
@@ -259,6 +259,22 @@ function editPreview(args, resultText, source) {
|
|
|
259
259
|
return /^(?:diff --git|@@ |--- |\+\+\+ )/m.test(resultText ?? '') ? resultText : '';
|
|
260
260
|
}
|
|
261
261
|
|
|
262
|
+
function toolResultEnvelope(resultText) {
|
|
263
|
+
const match = /^Script (?:completed|failed)\r?\nWall time ([0-9.]+) seconds\r?\nOutput:\r?\n([\s\S]*)$/.exec(resultText ?? '');
|
|
264
|
+
if (!match) return { preview: resultText ?? '', value: null, durationMs: null };
|
|
265
|
+
const durationMs = Number(match[1]) * 1_000;
|
|
266
|
+
try {
|
|
267
|
+
const value = record(JSON.parse(match[2]));
|
|
268
|
+
return {
|
|
269
|
+
preview: typeof value?.output === 'string' ? value.output : match[2],
|
|
270
|
+
value,
|
|
271
|
+
durationMs: Number.isFinite(durationMs) ? durationMs : null,
|
|
272
|
+
};
|
|
273
|
+
} catch {
|
|
274
|
+
return { preview: match[2], value: null, durationMs: Number.isFinite(durationMs) ? durationMs : null };
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
262
278
|
function verificationCommand(command) {
|
|
263
279
|
let shell = '';
|
|
264
280
|
let quote = '';
|
|
@@ -310,6 +326,7 @@ function toolAction(status, category, name, tools) {
|
|
|
310
326
|
export function createToolPresentation(entry) {
|
|
311
327
|
const envelope = toolEnvelope(entry);
|
|
312
328
|
const args = envelope.args;
|
|
329
|
+
const outcome = toolResultEnvelope(entry.resultText);
|
|
313
330
|
const command = firstString(args, ['command', 'cmd']) || sourceString(envelope.callSource, ['command', 'cmd']);
|
|
314
331
|
const category = classifyTool(envelope.name, command || envelope.source || entry.arguments || '');
|
|
315
332
|
const path = firstString(args, ['file_path', 'target_file', 'target_directory', 'path']) || sourceString(envelope.callSource, ['file_path', 'target_file', 'target_directory', 'path']) || patchPath(envelope.source);
|
|
@@ -321,7 +338,7 @@ export function createToolPresentation(entry) {
|
|
|
321
338
|
const taskId = firstString(args, ['taskId', 'task_id']);
|
|
322
339
|
const planTarget = category === 'plan' ? items.length ? `${items.length} ${items.length === 1 ? 'item' : 'items'}` : taskId ? `task ${taskId}` : '' : '';
|
|
323
340
|
const target = path || command || query || url || subject || background || planTarget || (envelope.tools.length > 1 ? `${envelope.tools.length} coordinated actions` : toolTarget(entry.arguments));
|
|
324
|
-
const previewSource = category === 'edit' ? editPreview(args,
|
|
341
|
+
const previewSource = category === 'edit' ? editPreview(args, outcome.preview, envelope.source) : outcome.preview;
|
|
325
342
|
const result = record(entry.resultContent);
|
|
326
343
|
const metadata = record(entry.metadata);
|
|
327
344
|
const resultMetadata = record(result?.metadata);
|
|
@@ -340,8 +357,8 @@ export function createToolPresentation(entry) {
|
|
|
340
357
|
fields: usefulToolFields(args),
|
|
341
358
|
items,
|
|
342
359
|
tools: envelope.tools,
|
|
343
|
-
exitCode: explicitNumber([result, resultMetadata, metadata], ['exit_code', 'exitCode', 'pi_bash_exit_code']),
|
|
344
|
-
durationMs: explicitNumber([result, resultMetadata, metadata], ['duration_ms', 'durationMs', 'elapsed_ms', 'elapsedMs', 'totalDurationMs']),
|
|
360
|
+
exitCode: explicitNumber([outcome.value, result, resultMetadata, metadata], ['exit_code', 'exitCode', 'pi_bash_exit_code']),
|
|
361
|
+
durationMs: explicitNumber([outcome.value, result, resultMetadata, metadata], ['duration_ms', 'durationMs', 'elapsed_ms', 'elapsedMs', 'totalDurationMs']) ?? outcome.durationMs,
|
|
345
362
|
additions: explicitNumber([result, resultMetadata, metadata], ['additions', 'lines_added']),
|
|
346
363
|
deletions: explicitNumber([result, resultMetadata, metadata], ['deletions', 'lines_removed']),
|
|
347
364
|
matches: explicitNumber([result, resultMetadata, metadata], ['matches', 'match_count', 'result_count']),
|
package/embed.mjs
CHANGED
|
@@ -275,6 +275,21 @@ function editPreview(args, resultText, source) {
|
|
|
275
275
|
if (patch) return patch;
|
|
276
276
|
return /^(?:diff --git|@@ |--- |\+\+\+ )/m.test(resultText ?? "") ? resultText : "";
|
|
277
277
|
}
|
|
278
|
+
function toolResultEnvelope(resultText) {
|
|
279
|
+
const match = /^Script (?:completed|failed)\r?\nWall time ([0-9.]+) seconds\r?\nOutput:\r?\n([\s\S]*)$/.exec(resultText ?? "");
|
|
280
|
+
if (!match) return { preview: resultText ?? "", value: null, durationMs: null };
|
|
281
|
+
const durationMs = Number(match[1]) * 1e3;
|
|
282
|
+
try {
|
|
283
|
+
const value = record(JSON.parse(match[2]));
|
|
284
|
+
return {
|
|
285
|
+
preview: typeof value?.output === "string" ? value.output : match[2],
|
|
286
|
+
value,
|
|
287
|
+
durationMs: Number.isFinite(durationMs) ? durationMs : null
|
|
288
|
+
};
|
|
289
|
+
} catch {
|
|
290
|
+
return { preview: match[2], value: null, durationMs: Number.isFinite(durationMs) ? durationMs : null };
|
|
291
|
+
}
|
|
292
|
+
}
|
|
278
293
|
function verificationCommand(command) {
|
|
279
294
|
let shell = "";
|
|
280
295
|
let quote = "";
|
|
@@ -339,6 +354,7 @@ function toolAction(status, category, name, tools) {
|
|
|
339
354
|
function createToolPresentation(entry) {
|
|
340
355
|
const envelope = toolEnvelope(entry);
|
|
341
356
|
const args = envelope.args;
|
|
357
|
+
const outcome = toolResultEnvelope(entry.resultText);
|
|
342
358
|
const command = firstString(args, ["command", "cmd"]) || sourceString(envelope.callSource, ["command", "cmd"]);
|
|
343
359
|
const category = classifyTool(envelope.name, command || envelope.source || entry.arguments || "");
|
|
344
360
|
const path = firstString(args, ["file_path", "target_file", "target_directory", "path"]) || sourceString(envelope.callSource, ["file_path", "target_file", "target_directory", "path"]) || patchPath(envelope.source);
|
|
@@ -350,7 +366,7 @@ function createToolPresentation(entry) {
|
|
|
350
366
|
const taskId = firstString(args, ["taskId", "task_id"]);
|
|
351
367
|
const planTarget = category === "plan" ? items.length ? `${items.length} ${items.length === 1 ? "item" : "items"}` : taskId ? `task ${taskId}` : "" : "";
|
|
352
368
|
const target = path || command || query || url || subject || background || planTarget || (envelope.tools.length > 1 ? `${envelope.tools.length} coordinated actions` : toolTarget(entry.arguments));
|
|
353
|
-
const previewSource = category === "edit" ? editPreview(args,
|
|
369
|
+
const previewSource = category === "edit" ? editPreview(args, outcome.preview, envelope.source) : outcome.preview;
|
|
354
370
|
const result = record(entry.resultContent);
|
|
355
371
|
const metadata = record(entry.metadata);
|
|
356
372
|
const resultMetadata = record(result?.metadata);
|
|
@@ -369,8 +385,8 @@ function createToolPresentation(entry) {
|
|
|
369
385
|
fields: usefulToolFields(args),
|
|
370
386
|
items,
|
|
371
387
|
tools: envelope.tools,
|
|
372
|
-
exitCode: explicitNumber([result, resultMetadata, metadata], ["exit_code", "exitCode", "pi_bash_exit_code"]),
|
|
373
|
-
durationMs: explicitNumber([result, resultMetadata, metadata], ["duration_ms", "durationMs", "elapsed_ms", "elapsedMs", "totalDurationMs"]),
|
|
388
|
+
exitCode: explicitNumber([outcome.value, result, resultMetadata, metadata], ["exit_code", "exitCode", "pi_bash_exit_code"]),
|
|
389
|
+
durationMs: explicitNumber([outcome.value, result, resultMetadata, metadata], ["duration_ms", "durationMs", "elapsed_ms", "elapsedMs", "totalDurationMs"]) ?? outcome.durationMs,
|
|
374
390
|
additions: explicitNumber([result, resultMetadata, metadata], ["additions", "lines_added"]),
|
|
375
391
|
deletions: explicitNumber([result, resultMetadata, metadata], ["deletions", "lines_removed"]),
|
|
376
392
|
matches: explicitNumber([result, resultMetadata, metadata], ["matches", "match_count", "result_count"])
|
package/messenger.mjs
CHANGED
|
@@ -272,6 +272,21 @@ function editPreview(args, resultText, source) {
|
|
|
272
272
|
if (patch) return patch;
|
|
273
273
|
return /^(?:diff --git|@@ |--- |\+\+\+ )/m.test(resultText ?? "") ? resultText : "";
|
|
274
274
|
}
|
|
275
|
+
function toolResultEnvelope(resultText) {
|
|
276
|
+
const match = /^Script (?:completed|failed)\r?\nWall time ([0-9.]+) seconds\r?\nOutput:\r?\n([\s\S]*)$/.exec(resultText ?? "");
|
|
277
|
+
if (!match) return { preview: resultText ?? "", value: null, durationMs: null };
|
|
278
|
+
const durationMs = Number(match[1]) * 1e3;
|
|
279
|
+
try {
|
|
280
|
+
const value = record(JSON.parse(match[2]));
|
|
281
|
+
return {
|
|
282
|
+
preview: typeof value?.output === "string" ? value.output : match[2],
|
|
283
|
+
value,
|
|
284
|
+
durationMs: Number.isFinite(durationMs) ? durationMs : null
|
|
285
|
+
};
|
|
286
|
+
} catch {
|
|
287
|
+
return { preview: match[2], value: null, durationMs: Number.isFinite(durationMs) ? durationMs : null };
|
|
288
|
+
}
|
|
289
|
+
}
|
|
275
290
|
function verificationCommand(command) {
|
|
276
291
|
let shell = "";
|
|
277
292
|
let quote = "";
|
|
@@ -336,6 +351,7 @@ function toolAction(status, category, name, tools) {
|
|
|
336
351
|
function createToolPresentation(entry) {
|
|
337
352
|
const envelope = toolEnvelope(entry);
|
|
338
353
|
const args = envelope.args;
|
|
354
|
+
const outcome = toolResultEnvelope(entry.resultText);
|
|
339
355
|
const command = firstString(args, ["command", "cmd"]) || sourceString(envelope.callSource, ["command", "cmd"]);
|
|
340
356
|
const category = classifyTool(envelope.name, command || envelope.source || entry.arguments || "");
|
|
341
357
|
const path = firstString(args, ["file_path", "target_file", "target_directory", "path"]) || sourceString(envelope.callSource, ["file_path", "target_file", "target_directory", "path"]) || patchPath(envelope.source);
|
|
@@ -347,7 +363,7 @@ function createToolPresentation(entry) {
|
|
|
347
363
|
const taskId = firstString(args, ["taskId", "task_id"]);
|
|
348
364
|
const planTarget = category === "plan" ? items.length ? `${items.length} ${items.length === 1 ? "item" : "items"}` : taskId ? `task ${taskId}` : "" : "";
|
|
349
365
|
const target = path || command || query || url || subject || background || planTarget || (envelope.tools.length > 1 ? `${envelope.tools.length} coordinated actions` : toolTarget(entry.arguments));
|
|
350
|
-
const previewSource = category === "edit" ? editPreview(args,
|
|
366
|
+
const previewSource = category === "edit" ? editPreview(args, outcome.preview, envelope.source) : outcome.preview;
|
|
351
367
|
const result = record(entry.resultContent);
|
|
352
368
|
const metadata = record(entry.metadata);
|
|
353
369
|
const resultMetadata = record(result?.metadata);
|
|
@@ -366,8 +382,8 @@ function createToolPresentation(entry) {
|
|
|
366
382
|
fields: usefulToolFields(args),
|
|
367
383
|
items,
|
|
368
384
|
tools: envelope.tools,
|
|
369
|
-
exitCode: explicitNumber([result, resultMetadata, metadata], ["exit_code", "exitCode", "pi_bash_exit_code"]),
|
|
370
|
-
durationMs: explicitNumber([result, resultMetadata, metadata], ["duration_ms", "durationMs", "elapsed_ms", "elapsedMs", "totalDurationMs"]),
|
|
385
|
+
exitCode: explicitNumber([outcome.value, result, resultMetadata, metadata], ["exit_code", "exitCode", "pi_bash_exit_code"]),
|
|
386
|
+
durationMs: explicitNumber([outcome.value, result, resultMetadata, metadata], ["duration_ms", "durationMs", "elapsed_ms", "elapsedMs", "totalDurationMs"]) ?? outcome.durationMs,
|
|
371
387
|
additions: explicitNumber([result, resultMetadata, metadata], ["additions", "lines_added"]),
|
|
372
388
|
deletions: explicitNumber([result, resultMetadata, metadata], ["deletions", "lines_removed"]),
|
|
373
389
|
matches: explicitNumber([result, resultMetadata, metadata], ["matches", "match_count", "result_count"])
|