pi-better-background-tasks 0.2.4 → 0.2.5
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/package.json +1 -1
- package/src/tools.ts +4 -4
package/package.json
CHANGED
package/src/tools.ts
CHANGED
|
@@ -68,7 +68,7 @@ const ListParams = Type.Object({
|
|
|
68
68
|
});
|
|
69
69
|
const LogParams = Type.Object({
|
|
70
70
|
id: Type.String({ description: "Background task id." }),
|
|
71
|
-
tail_lines: Type.Optional(Type.Number({ description: "Number of trailing lines. Default
|
|
71
|
+
tail_lines: Type.Optional(Type.Number({ description: "Number of trailing lines. Default 5 for compact model ingestion. Set <=0 only when the full log is explicitly required." })),
|
|
72
72
|
});
|
|
73
73
|
|
|
74
74
|
const ActionParams = Type.Object({
|
|
@@ -168,7 +168,7 @@ export function registerTools(pi: ExtensionAPI): void {
|
|
|
168
168
|
pi.registerTool({
|
|
169
169
|
name: "bg_task_log",
|
|
170
170
|
label: "BG Log",
|
|
171
|
-
description: "Read a background task log. Default output is a compact
|
|
171
|
+
description: "Read a background task log. Default output is a compact 5-line terminal-aware tail for model ingestion. Pass tail_lines for a bounded tail; tail_lines:0 returns the retained raw log, capped at 512 KiB for safe recovery. Nonblocking.",
|
|
172
172
|
parameters: LogParams,
|
|
173
173
|
renderResult(result: unknown, options: unknown, theme: unknown) {
|
|
174
174
|
return renderBackgroundTaskLogDisplay(result, options, theme);
|
|
@@ -338,7 +338,7 @@ function formatCompactStatus(meta: BackgroundTaskMeta): string {
|
|
|
338
338
|
if (meta.lastState !== undefined) lines.push(`last state: ${oneLine(meta.lastState, 800)}`);
|
|
339
339
|
if (meta.logDiscardedBytes) lines.push(`log retention: ${meta.logDiscardedBytes} bytes discarded in ${meta.logRetentionEvents ?? 1} compaction(s).`);
|
|
340
340
|
lines.push(`log: ${meta.logPath}`);
|
|
341
|
-
lines.push(`For full metadata use bg_task_status id=${meta.id} verbose=true. For logs use bg_task_log id=${meta.id} tail_lines=
|
|
341
|
+
lines.push(`For full metadata use bg_task_status id=${meta.id} verbose=true. For logs use bg_task_log id=${meta.id} tail_lines=5, or tail_lines=0 for the retained raw log.`);
|
|
342
342
|
return lines.join("\n");
|
|
343
343
|
}
|
|
344
344
|
|
|
@@ -360,7 +360,7 @@ function oneLine(value: unknown, maxLength: number): string {
|
|
|
360
360
|
function formatLog(id: string, tailLines?: number): string {
|
|
361
361
|
const meta = readMeta(id);
|
|
362
362
|
if (!meta) return `No background task found for id ${id}.`;
|
|
363
|
-
const log = readLog(meta.logPath, tailLines ??
|
|
363
|
+
const log = readLog(meta.logPath, tailLines ?? 5);
|
|
364
364
|
const prefix = log.truncated ? `[showing tail of ${meta.logPath}]\n` : `[${meta.logPath}]\n`;
|
|
365
365
|
return prefix + (log.text || "(log is empty)");
|
|
366
366
|
}
|