@poe-platform/safe-js 0.1.608 → 0.1.610

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/dist/agent-harness-tools/execution-env.d.ts +2 -0
  2. package/dist/poe-code-config/merge-callbacks.d.ts +1 -0
  3. package/dist/process-runner/types.d.ts +2 -0
  4. package/dist/safe-js/chunks/{chunk-UGKBY5DP.js → chunk-OCDABGFC.js} +2 -2
  5. package/dist/safe-js/chunks/chunk-YPVGFXBW.js +8594 -0
  6. package/dist/safe-js/chunks/chunk-YPVGFXBW.js.map +7 -0
  7. package/dist/safe-js/chunks/{cli-runtime-VLWGT5A5.js → cli-runtime-LZP2LBNP.js} +3 -3
  8. package/dist/safe-js/chunks/{mcp-VOKLK2OR.js → mcp-R5ZZ2OSB.js} +3 -3
  9. package/dist/safe-js/cli.js +2 -2
  10. package/dist/safe-js/index.js +2 -2
  11. package/dist/toolcraft-design/command-registry.d.ts +11 -0
  12. package/dist/toolcraft-design/dashboard/dashboard.d.ts +4 -0
  13. package/dist/toolcraft-design/dashboard/index.d.ts +2 -0
  14. package/dist/toolcraft-design/dashboard/line-buffer.d.ts +9 -0
  15. package/dist/toolcraft-design/dashboard/output-preview.d.ts +9 -0
  16. package/dist/toolcraft-design/dashboard/types.d.ts +3 -1
  17. package/dist/toolcraft-design/event-groups.d.ts +19 -0
  18. package/dist/toolcraft-design/index.d.ts +6 -1
  19. package/dist/toolcraft-design/inline-notice.d.ts +14 -0
  20. package/dist/toolcraft-design/metric.d.ts +8 -0
  21. package/dist/toolcraft-design/overlay-manager.d.ts +6 -0
  22. package/dist/toolcraft-design/primitives.d.ts +12 -0
  23. package/dist/toolcraft-design/progress-group.d.ts +7 -0
  24. package/dist/toolcraft-design/render-performance.d.ts +33 -0
  25. package/dist/toolcraft-design/task-tree.d.ts +22 -0
  26. package/dist/toolcraft-design/viewport.d.ts +18 -0
  27. package/package.json +2 -2
  28. package/dist/safe-js/chunks/chunk-3XEB5VOF.js +0 -3990
  29. package/dist/safe-js/chunks/chunk-3XEB5VOF.js.map +0 -7
  30. /package/dist/safe-js/chunks/{chunk-UGKBY5DP.js.map → chunk-OCDABGFC.js.map} +0 -0
  31. /package/dist/safe-js/chunks/{cli-runtime-VLWGT5A5.js.map → cli-runtime-LZP2LBNP.js.map} +0 -0
  32. /package/dist/safe-js/chunks/{mcp-VOKLK2OR.js.map → mcp-R5ZZ2OSB.js.map} +0 -0
@@ -15,7 +15,7 @@ import {
15
15
  } from "./chunk-EWBAW6TL.js";
16
16
  import {
17
17
  parseMcpConfig
18
- } from "./chunk-3XEB5VOF.js";
18
+ } from "./chunk-YPVGFXBW.js";
19
19
  import {
20
20
  lint
21
21
  } from "./chunk-V3HUN3KA.js";
@@ -263,7 +263,7 @@ async function runScriptFile(filepath, parsed, options) {
263
263
  import("./dump-VMJ4VMRG.js"),
264
264
  import("./runtime-modules-CFVIFXKY.js"),
265
265
  import("./fs-NI2LBAR6.js"),
266
- import("./mcp-VOKLK2OR.js")
266
+ import("./mcp-R5ZZ2OSB.js")
267
267
  ]);
268
268
  const loaded = loadExecutableSource(filepath, await options.readFile(filepath, "utf8"));
269
269
  const meta = {
@@ -682,4 +682,4 @@ export {
682
682
  exitCodeForError,
683
683
  runCli
684
684
  };
685
- //# sourceMappingURL=cli-runtime-VLWGT5A5.js.map
685
+ //# sourceMappingURL=cli-runtime-LZP2LBNP.js.map
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  makeMcpModule
3
- } from "./chunk-UGKBY5DP.js";
4
- import "./chunk-3XEB5VOF.js";
3
+ } from "./chunk-OCDABGFC.js";
4
+ import "./chunk-YPVGFXBW.js";
5
5
  import "./chunk-NRMLGDZI.js";
6
6
  import "./chunk-QY3SVPUP.js";
7
7
  import "./chunk-4YIDX44G.js";
8
8
  export {
9
9
  makeMcpModule
10
10
  };
11
- //# sourceMappingURL=mcp-VOKLK2OR.js.map
11
+ //# sourceMappingURL=mcp-R5ZZ2OSB.js.map
@@ -13,7 +13,7 @@ import path from "node:path";
13
13
  import { fileURLToPath } from "node:url";
14
14
  async function runCli(argv, options = {}) {
15
15
  if (!argv.includes("--help") && !argv.includes("-h")) {
16
- const runtime = await import("./chunks/cli-runtime-VLWGT5A5.js");
16
+ const runtime = await import("./chunks/cli-runtime-LZP2LBNP.js");
17
17
  return runtime.runCli(argv, options, createUsage());
18
18
  }
19
19
  const brokenPipe = createBrokenPipeState();
@@ -32,7 +32,7 @@ async function runCli(argv, options = {}) {
32
32
  stderr.write(`${error instanceof Error ? error.message : String(error)}
33
33
  `);
34
34
  if (brokenPipe.closed) return 0;
35
- const { exitCodeForError } = await import("./chunks/cli-runtime-VLWGT5A5.js");
35
+ const { exitCodeForError } = await import("./chunks/cli-runtime-LZP2LBNP.js");
36
36
  return exitCodeForError(error);
37
37
  }
38
38
  }
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunks/chunk-OYDR72TJ.js";
7
7
  import {
8
8
  makeMcpModule
9
- } from "./chunks/chunk-UGKBY5DP.js";
9
+ } from "./chunks/chunk-OCDABGFC.js";
10
10
  import {
11
11
  AgentSpawnError,
12
12
  EnvAccessError,
@@ -30,7 +30,7 @@ import {
30
30
  } from "./chunks/chunk-EWBAW6TL.js";
31
31
  import {
32
32
  parseMcpConfig
33
- } from "./chunks/chunk-3XEB5VOF.js";
33
+ } from "./chunks/chunk-YPVGFXBW.js";
34
34
  import {
35
35
  lint
36
36
  } from "./chunks/chunk-V3HUN3KA.js";
@@ -0,0 +1,11 @@
1
+ export interface DesignCommand {
2
+ id: string;
3
+ label: string;
4
+ keys: readonly string[];
5
+ enabled?: () => boolean;
6
+ run: () => void;
7
+ }
8
+ export declare function createCommandRegistry(commands: readonly DesignCommand[]): {
9
+ dispatch(key: string): boolean;
10
+ list(): DesignCommand[];
11
+ };
@@ -1,3 +1,4 @@
1
+ import { type RenderPerformanceSnapshot } from "../render-performance.js";
1
2
  import type { FooterHint } from "./components/footer.js";
2
3
  import type { Command, DashboardStats, OutputItem } from "./types.js";
3
4
  export type DashboardOptions = {
@@ -8,6 +9,8 @@ export type DashboardOptions = {
8
9
  hints?: FooterHint[];
9
10
  stdin?: NodeJS.ReadStream;
10
11
  stdout?: NodeJS.WriteStream;
12
+ /** Observe bounded performance snapshots without forcing idle repaints. */
13
+ onPerformance?: (stats: RenderPerformanceSnapshot) => void;
11
14
  };
12
15
  export type Dashboard = {
13
16
  start(): void;
@@ -16,5 +19,6 @@ export type Dashboard = {
16
19
  updateStats(stats: Partial<DashboardStats>): void;
17
20
  onCommand(handler: (cmd: Command) => void): void;
18
21
  destroy(): void;
22
+ getPerformance(): RenderPerformanceSnapshot;
19
23
  };
20
24
  export declare function createDashboard(opts?: DashboardOptions): Dashboard;
@@ -1,4 +1,6 @@
1
1
  export { createDashboard } from "./dashboard.js";
2
+ export { createDashboardLineBuffer, createStreamingDashboardLineBuffer } from "./line-buffer.js";
3
+ export { limitOutputPreview, createOutputPreviewBuffer } from "./output-preview.js";
2
4
  export { shouldUseInteractiveDashboard } from "./should-use-dashboard.js";
3
5
  export type { Dashboard, DashboardOptions } from "./dashboard.js";
4
6
  export { renderDashboardSnapshot } from "./snapshot.js";
@@ -0,0 +1,9 @@
1
+ export declare function createDashboardLineBuffer(emit: (line: string) => void): {
2
+ push(chunk: string): void;
3
+ flush(): void;
4
+ preview(): string;
5
+ };
6
+ export declare function createStreamingDashboardLineBuffer(emit: (line: string, id: string) => void): {
7
+ push(chunk: string): void;
8
+ flush(): void;
9
+ };
@@ -0,0 +1,9 @@
1
+ export declare const MAX_OUTPUT_PREVIEW_CHARS = 16384;
2
+ export declare const OUTPUT_TRUNCATION_NOTICE = "[Output truncated: showing latest text]\n";
3
+ export declare function retainOutputTail(text: string, maxChars: number): string;
4
+ export declare function limitOutputPreview(text: string): string;
5
+ /** Keep live deltas bounded without rebuilding the complete preview for every delta. */
6
+ export declare function createOutputPreviewBuffer(): {
7
+ push(text: string): void;
8
+ text(): string;
9
+ };
@@ -1,5 +1,7 @@
1
1
  export type OutputItemKind = "info" | "success" | "error" | "tool" | "status";
2
2
  export type OutputItem = {
3
+ /** Reusing an id replaces its retained preview in place, without changing held history. */
4
+ id?: string;
3
5
  kind: OutputItemKind;
4
6
  text: string;
5
7
  ts: number;
@@ -13,7 +15,7 @@ export type DashboardStats = {
13
15
  elapsedMs: number;
14
16
  currentAction?: string;
15
17
  };
16
- export type Command = "quit" | "forceQuit" | "edit" | "pause" | "retry" | "view-log";
18
+ export type Command = "quit" | "forceQuit" | "edit" | "pause" | "retry" | "view-log" | "scroll-up" | "scroll-down" | "page-up" | "page-down" | "follow" | "render-stats";
17
19
  export type DashboardState = {
18
20
  output: OutputItem[];
19
21
  stats: DashboardStats;
@@ -0,0 +1,19 @@
1
+ export interface GroupEvent {
2
+ id: string;
3
+ text: string;
4
+ error?: boolean;
5
+ }
6
+ export interface EventGroupRow extends GroupEvent {
7
+ groupId: string;
8
+ header?: boolean;
9
+ expanded?: boolean;
10
+ }
11
+ export declare function createEventGroups({ capacity, children }: {
12
+ capacity: number;
13
+ children: number;
14
+ }): {
15
+ append(groupId: string, event: GroupEvent): void;
16
+ toggle(groupId: string): void;
17
+ rows(offset: number, height: number): EventGroupRow[];
18
+ };
19
+ export declare function renderEventGroupRows(rows: readonly EventGroupRow[], width: number): string[];
@@ -34,7 +34,7 @@ export type { RenderTemplateOptions, TemplateEscape } from "./components/templat
34
34
  export { openExternal } from "./components/browser.js";
35
35
  export * as acp from "./acp/index.js";
36
36
  export * as dashboard from "./dashboard/index.js";
37
- export { createDashboard, shouldUseInteractiveDashboard } from "./dashboard/index.js";
37
+ export { createDashboard, createDashboardLineBuffer, createStreamingDashboardLineBuffer, shouldUseInteractiveDashboard } from "./dashboard/index.js";
38
38
  export type { Dashboard, DashboardOptions } from "./dashboard/index.js";
39
39
  export * as explorer from "./explorer/index.js";
40
40
  export { runExplorer, singleDetail, normalizeExplorerConfig } from "./explorer/index.js";
@@ -60,3 +60,8 @@ export { Screen } from "./screen/screen.js";
60
60
  export type { Cell as ScreenCell, ScreenSize, ScreenSurface } from "./screen/screen.js";
61
61
  export { packStyle, styleToSgrDelta } from "./screen/style.js";
62
62
  export type { PackedStyle } from "./screen/style.js";
63
+ export { createRenderPerformanceMonitor, formatRenderPerformance } from "./render-performance.js";
64
+ export type { RenderPerformanceSnapshot, RenderPercentiles } from "./render-performance.js";
65
+ export { createViewport, selectViewportTail } from "./viewport.js";
66
+ export { createNotices, createCommandRegistry, createOverlayManager, createEventGroups, createTaskTree, renderTaskRows, renderEventGroupRows, renderProgressGroup, createMetric, renderNotice } from "./primitives.js";
67
+ export type { DesignCommand, GroupEvent, EventGroupRow, TaskNode, ProgressItem, InlineNotice } from "./primitives.js";
@@ -0,0 +1,14 @@
1
+ export interface InlineNotice {
2
+ level: "info" | "success" | "warning" | "error";
3
+ text: string;
4
+ }
5
+ export declare function renderNotice(notice: InlineNotice, width: number): string;
6
+ /** Notices expire during reads, so an idle terminal needs no repaint timer. */
7
+ export declare function createNotices({ capacity, now }: {
8
+ capacity: number;
9
+ now?: () => number;
10
+ }): {
11
+ put(id: string, notice: InlineNotice, durationMs?: number): void;
12
+ dismiss(id: string): void;
13
+ list(): InlineNotice[];
14
+ };
@@ -0,0 +1,8 @@
1
+ export declare function createMetric({ capacity, unit }: {
2
+ capacity: number;
3
+ unit: string;
4
+ }): {
5
+ push(value: number | null): void;
6
+ samples(): (number | null)[];
7
+ render(width: number): string;
8
+ };
@@ -0,0 +1,6 @@
1
+ export declare function createOverlayManager(initialFocus: string): {
2
+ open(focus: string): AbortSignal;
3
+ close(): boolean;
4
+ focus(): string;
5
+ dispose(): void;
6
+ };
@@ -0,0 +1,12 @@
1
+ export { createCommandRegistry } from "./command-registry.js";
2
+ export type { DesignCommand } from "./command-registry.js";
3
+ export { createOverlayManager } from "./overlay-manager.js";
4
+ export { createEventGroups, renderEventGroupRows } from "./event-groups.js";
5
+ export type { GroupEvent, EventGroupRow } from "./event-groups.js";
6
+ export { createTaskTree, renderTaskRows } from "./task-tree.js";
7
+ export type { TaskNode } from "./task-tree.js";
8
+ export { renderProgressGroup } from "./progress-group.js";
9
+ export type { ProgressItem } from "./progress-group.js";
10
+ export { createMetric } from "./metric.js";
11
+ export { renderNotice, createNotices } from "./inline-notice.js";
12
+ export type { InlineNotice } from "./inline-notice.js";
@@ -0,0 +1,7 @@
1
+ export interface ProgressItem {
2
+ label: string;
3
+ completed?: number;
4
+ total?: number;
5
+ status?: "running" | "success" | "error";
6
+ }
7
+ export declare function renderProgressGroup(items: readonly ProgressItem[], width: number): string[];
@@ -0,0 +1,33 @@
1
+ export interface RenderPercentiles {
2
+ p50: number;
3
+ p95: number;
4
+ max: number;
5
+ }
6
+ export interface RenderPerformanceSnapshot {
7
+ /** Rolling one-second repaint dispatch rate, with 10ms bucket resolution. */
8
+ fps: number;
9
+ frames: number;
10
+ renders: number;
11
+ requests: number;
12
+ coalesced: number;
13
+ changedCells: number;
14
+ sampleCount: number;
15
+ /** Paints exceeding the 60Hz frame budget (16.67ms), cumulative. */
16
+ slowFrames: number;
17
+ longestRenderMs: number;
18
+ renderMs: RenderPercentiles;
19
+ /** Time from oldest pending input to flush enqueue; terminal presentation is not observable. */
20
+ inputMs: RenderPercentiles;
21
+ }
22
+ export declare function createRenderPerformanceMonitor(options?: {
23
+ now?: () => number;
24
+ sampleSize?: number;
25
+ }): {
26
+ request(kind: "input" | "update" | "resize"): void;
27
+ begin(): number;
28
+ end(startedAt: number, frame: {
29
+ changedCells: number;
30
+ }): void;
31
+ snapshot(): RenderPerformanceSnapshot;
32
+ };
33
+ export declare function formatRenderPerformance(stats: RenderPerformanceSnapshot, width: number): string;
@@ -0,0 +1,22 @@
1
+ export interface TaskNode {
2
+ id: string;
3
+ parentId?: string;
4
+ label: string;
5
+ status: "pending" | "running" | "success" | "error";
6
+ durationMs?: number;
7
+ }
8
+ export declare function createTaskTree({ capacity }?: {
9
+ capacity?: number;
10
+ }): {
11
+ upsert(node: TaskNode): void;
12
+ remove(id: string): void;
13
+ toggle(id: string): void;
14
+ rows(offset: number, height: number): (TaskNode & {
15
+ depth: number;
16
+ collapsed: boolean;
17
+ })[];
18
+ };
19
+ export declare function renderTaskRows(rows: readonly (TaskNode & {
20
+ depth: number;
21
+ collapsed: boolean;
22
+ })[], width: number): string[];
@@ -0,0 +1,18 @@
1
+ /** Select wrapped rows from the tail, retaining only one viewport of rows. */
2
+ export declare function selectViewportTail<T, R>(items: readonly T[], height: number, offset: number, renderRows: (item: T) => readonly R[]): {
3
+ rows: R[];
4
+ offset: number;
5
+ };
6
+ export declare function createViewport<T extends {
7
+ id: string;
8
+ }>({ capacity }: {
9
+ capacity: number;
10
+ }): {
11
+ append(item: T): void;
12
+ scroll(delta: number): void;
13
+ items(): readonly T[];
14
+ offset(): number;
15
+ unseen(): number;
16
+ find(predicate: (item: T) => boolean): number;
17
+ follow(): void;
18
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@poe-platform/safe-js",
3
- "version": "0.1.608",
3
+ "version": "0.1.610",
4
4
  "description": "Budgeted JavaScript interpreter with explicit host capabilities and resumable execution",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -68,7 +68,7 @@
68
68
  "access": "public"
69
69
  },
70
70
  "dependencies": {
71
- "@poe-platform/safe-fs": "0.1.608",
71
+ "@poe-platform/safe-fs": "0.1.610",
72
72
  "temporal-polyfill": "1.0.4",
73
73
  "@petamoriken/float16": "^3.9.3",
74
74
  "@formatjs/intl-localematcher": "0.8.13",