pi-outpost 0.28.0 → 0.28.1

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.
@@ -14,9 +14,11 @@
14
14
  * consumed, and V8 offers no hook at an `Error`'s construction — `prepareStackTrace`
15
15
  * runs on the first read of `.stack`, which never happens.
16
16
  *
17
- * So the stack is read here, at module load, before the catch can drop it. The source
18
- * is rewritten **in memory**: nothing under `node_modules` is touched, `npm ci` has
19
- * nothing to undo, and a machine running without the flag runs the bytes it installed.
17
+ * So the stack is read here, at module load, before the catch can drop it — and put
18
+ * back where the rest of the pipeline already knows to look, as an assistant-message
19
+ * diagnostic, which is what the upstream fix would be. The source is rewritten **in
20
+ * memory**: nothing under `node_modules` is touched, `npm ci` has nothing to undo, and
21
+ * a machine running without the flag runs the bytes it installed.
20
22
  *
21
23
  * Matched on the catch's own line rather than on a filename, so it arms every provider
22
24
  * that shares it — and arms none if a future SDK rewrites that line. That silence is
@@ -36,11 +38,35 @@ const NEEDLE = "output.errorMessage = formatProviderError(normalizeProviderError
36
38
  * `turnFailureLog.ts`: every other provider failure is already legible in the red
37
39
  * bubble, and dumping 200 frames for a rate limit would bury the rare event in the
38
40
  * common ones.
41
+ *
42
+ * Two destinations, because they answer different questions. stderr is immediate and
43
+ * is what someone watching a terminal sees. The diagnostic is durable: it rides on the
44
+ * assistant message the way `pi-messages` and `openai-codex-responses` already attach
45
+ * theirs, so it reaches `censusOfTurn`, which records `diagnostics` verbatim and says
46
+ * in its own comment that this is the only object in the pipeline that ever carries a
47
+ * stack. The census and the trace then land in the same record instead of having to be
48
+ * correlated by timestamp across two streams.
49
+ *
50
+ * The shape is `createAssistantMessageDiagnostic` + `appendAssistantMessageDiagnostic`
51
+ * from pi-ai's `utils/diagnostics.js`, inlined rather than imported: this text is
52
+ * injected into a module whose imports were resolved before the rewrite, so there is
53
+ * nothing to add an import to. `details.source` says who attached it, so nobody reads
54
+ * it as something the SDK itself produced.
39
55
  */
40
56
  const PROBE = [
41
- "try { if (/maximum call stack size exceeded|call stack size exceeded|stack overflow/i.test(String(error && error.message)))",
42
- ' console.error("[pi-outpost] provider stack:\\n" + ((error && error.stack) || String(error)));',
43
- " } catch { }",
57
+ "try {",
58
+ " if (/maximum call stack size exceeded|call stack size exceeded|stack overflow/i.test(String(error && error.message))) {",
59
+ " const __piCode = error && error.code;",
60
+ " output.diagnostics = [...(output.diagnostics ?? []), {",
61
+ ' type: "provider_transport_failure", timestamp: Date.now(),',
62
+ " error: { name: (error && error.name) || undefined,",
63
+ " message: (error && error.message) || (error && error.name),",
64
+ " stack: error && error.stack,",
65
+ ' code: (typeof __piCode === "string" || typeof __piCode === "number") ? __piCode : undefined },',
66
+ ' details: { source: "pi-outpost provider stack probe" } }];',
67
+ ' console.error("[pi-outpost] provider stack:\\n" + ((error && error.stack) || String(error)));',
68
+ " }",
69
+ "} catch { }",
44
70
  ].join("");
45
71
 
46
72
  /** Set by `initialize`, which `module.register` calls with the port it was given. */
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-outpost",
3
- "version": "0.28.0",
3
+ "version": "0.28.1",
4
4
  "type": "module",
5
5
  "description": "A web interface for the pi coding agent: a browser chat UI you run with npx — no clone, no build.",
6
6
  "license": "MIT",
@@ -53,7 +53,7 @@
53
53
  "prepack": "node scripts/build.mjs"
54
54
  },
55
55
  "dependencies": {
56
- "@earendil-works/pi-coding-agent": "^0.86.1",
56
+ "@earendil-works/pi-coding-agent": "^0.87.0",
57
57
  "@fastify/static": "^10.1.2",
58
58
  "@fastify/websocket": "^11.0.2",
59
59
  "fastify": "^5.3.0",