pi-ptc-subagents 0.1.2 → 0.1.3

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/CHANGELOG.md CHANGED
@@ -5,6 +5,34 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.1.3] - 2026-09-23
9
+
10
+ ### Added
11
+
12
+ - **PTC rows show what the program is doing while it runs.** Two partial-state
13
+ visuals on the `ptc_run_code` / `ptc_workflow` row, both absent until now:
14
+ - a **shimmer** on the call row — same text, one character at a time bright,
15
+ the highlight sweeping at 150ms — so a running row is distinguishable from a
16
+ settled one in a column (ADR-0020);
17
+ - a **sub-call tree** under it: one row per binding call the program made,
18
+ live from the moment the call is made, with its own five-state status
19
+ (`running` / `ok` / `error` / `cancelled` / `rejected`) and duration,
20
+ visible without expanding the row and capped at 32 with a `+N more` tail
21
+ (ADR-0021). A failed run shows the failure text but no sub-call tree: the
22
+ tool throws (pi's convention), and pi builds that error result with an empty
23
+ `details`, so the tracked calls are dropped with it.
24
+
25
+ ### Changed
26
+
27
+ - **Build pipeline: minify + source-map exclusion.** `pnpm run build`
28
+ (`vp pack`) now produces minified `dist/*.js` (rolldown's built-in oxc
29
+ minifier; no new dependency). The npm tarball excludes `dist/**/*.map`
30
+ via the `package.json#files` whitelist — sourcemaps stay on disk for
31
+ local stack traces, but no longer ship. Tarball shrinks from 168.7 kB
32
+ packed / 548.6 kB unpacked (v0.1.2 baseline) to 40.5 kB / 113.6 kB
33
+ (−76% / −79%); `dist/*.js` total shrinks from 161,303 B to 53,959 B
34
+ (−66.5%). All 39 public exports retain their original names. ADR-0019.
35
+
8
36
  ## [0.1.2] - 2026-09-23
9
37
 
10
38
  ### Fixed
package/dist/index.d.ts CHANGED
@@ -344,6 +344,27 @@ interface PtcErrorShape {
344
344
  message: string;
345
345
  stack?: string;
346
346
  }
347
+ /**
348
+ * One binding call the program made, as the dispatcher recorded it.
349
+ *
350
+ * Host-side only: this shape never crosses the wire — the existing `call` /
351
+ * `call-result` frames already carry every fact, and the host reconstructs the
352
+ * record at the seam where the facts are known (`SubCallTracker`,
353
+ * `src/runtime/sub-call-tracker.ts`). A snapshot reaches the renderer
354
+ * via `PtcToolDetails.subCalls`.
355
+ */
356
+ type SubCallStatus = "running" | "ok" | "error" | "cancelled" | "rejected";
357
+ interface SubCallRecord {
358
+ callId: number;
359
+ name: string;
360
+ args: unknown;
361
+ status: SubCallStatus;
362
+ startMs: number;
363
+ endMs?: number;
364
+ durationMs?: number;
365
+ resultSummary?: string;
366
+ errorMessage?: string;
367
+ }
347
368
  //#endregion
348
369
  //#region src/tools/text.d.ts
349
370
  /** Hard cap for one rendered line; longer lines are truncated with `…`. */
@@ -529,6 +550,18 @@ interface RunPtcProgramOptions {
529
550
  * `kind: workerExit`.
530
551
  */
531
552
  pool?: WorkerPool;
553
+ /**
554
+ * Called every time a sub-call starts or ends, so the caller can push a live partial result
555
+ * and have the tree visible while the run is in flight (ADR-0021 §4). Never called after the
556
+ * run settles — `finish` owns the terminal snapshot. Absent means "no live updates wanted"
557
+ * (direct library use, tests that only assert the terminal outcome).
558
+ *
559
+ * The argument is a **thunk**, not the snapshot itself: a wide `Promise.all` produces an
560
+ * event per call, and `snapshot()` copies every record. Building it eagerly would make N
561
+ * sequential calls cost O(N²) copies for pushes that the caller's throttle mostly drops.
562
+ * Call it only when a push is actually due.
563
+ */
564
+ onSubCallChange?: (snapshot: () => readonly SubCallRecord[]) => void;
532
565
  }
533
566
  /**
534
567
  * One image hoisted out of a successful binding result (DSH parity — see ADR-0014,
@@ -568,6 +601,15 @@ interface PtcRunOutcome {
568
601
  images?: PtcImage[];
569
602
  /** Failure details; absent on success. */
570
603
  error?: PtcErrorShape;
604
+ /**
605
+ * One record per binding call the program made (ADR-0021).
606
+ *
607
+ * Present only when the dispatcher tracked sub-calls for the surface in question (always,
608
+ * post-ADR-0021 — the dispatcher wires `SubCallTracker` for every run). Order is host-side
609
+ * dispatch order; the renderer reads it as a point-in-time snapshot. Absent for runs that settled
610
+ * before the tracker was constructed (the pre-`Promise` abort and pool-acquire-failed paths).
611
+ */
612
+ subCalls?: readonly SubCallRecord[];
571
613
  }
572
614
  /**
573
615
  * Run one PTC program in a fresh worker and resolve with its outcome.