@quandev104/pi-style 0.2.6 → 0.2.7

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.
@@ -1,6 +1,7 @@
1
1
  import { readFileSync } from "node:fs";
2
2
  import { dirname, join } from "node:path";
3
3
  import { fileURLToPath } from "node:url";
4
+ import * as piCodingAgentPackage from "@earendil-works/pi-coding-agent";
4
5
  import {
5
6
  AssistantMessageComponent,
6
7
  BashExecutionComponent,
@@ -35,7 +36,13 @@ import {
35
36
  * every other surface continues.
36
37
  */
37
38
  export const SUPPORTED_VERSION_RANGE = ">=0.83.0 <0.85.0";
38
- export const SUPPORTED_PI_VERSIONS: readonly string[] = Object.freeze(["0.83.0", "0.84.0"]);
39
+ export const SUPPORTED_PI_VERSIONS: readonly string[] = Object.freeze([
40
+ "0.83.0",
41
+ "0.84.0",
42
+ "0.84.1",
43
+ "0.84.2",
44
+ "0.84.3",
45
+ ]);
39
46
 
40
47
  /** A recorded native identity for one certified surface. */
41
48
  export interface KnownNativeIdentity {
@@ -53,6 +60,17 @@ export interface KnownNativeIdentity {
53
60
  * A matching name/arity/hash is evidence of the shipped native method, not a
54
61
  * cryptographic proof: code loaded before this module could spoof the same
55
62
  * function source. Unrecorded identities therefore fall back natively per surface.
63
+ *
64
+ * Identities are recorded per ARTIFACT FAMILY, not just per version: through Pi
65
+ * 0.84.2 the Node CLI ran the modular `dist/` build and extensions received the
66
+ * pretty-printed dist classes; 0.84.3 switches the CLI entrypoint to a minified
67
+ * bundled runtime (`dist/bundle/chunks/*`, see Pi 0.84.3 CHANGELOG "load a bundled
68
+ * runtime") whose jiti virtual-module map hands extensions the in-bundle class
69
+ * objects. Minification rewrites every method's `Function.prototype.toString()`
70
+ * text while behavior stays identical, so each surface carries BOTH the modular
71
+ * identity (0.83.0–0.84.2) and the bundled identity (0.84.3). The modular
72
+ * `dist/index.js` itself is unchanged in 0.84.3 — the switch is which class
73
+ * objects the running CLI actually serves to extensions.
56
74
  */
57
75
  export const KNOWN_NATIVE_IDENTITIES: Readonly<Record<string, readonly KnownNativeIdentity[]>> = Object.freeze({
58
76
  "native-assistant-message:render": Object.freeze([
@@ -60,7 +78,13 @@ export const KNOWN_NATIVE_IDENTITIES: Readonly<Record<string, readonly KnownNati
60
78
  name: "render",
61
79
  arity: 1,
62
80
  fingerprint: "2a39243f",
63
- versions: Object.freeze(["0.83.0", "0.84.0"]),
81
+ versions: Object.freeze(["0.83.0", "0.84.0", "0.84.1", "0.84.2"]),
82
+ }),
83
+ Object.freeze({
84
+ name: "render",
85
+ arity: 1,
86
+ fingerprint: "a9be09a3",
87
+ versions: Object.freeze(["0.84.3"]),
64
88
  }),
65
89
  ]),
66
90
  "native-assistant-message:updateContent": Object.freeze([
@@ -77,7 +101,17 @@ export const KNOWN_NATIVE_IDENTITIES: Readonly<Record<string, readonly KnownNati
77
101
  name: "updateContent",
78
102
  arity: 1,
79
103
  fingerprint: "d2114491",
80
- versions: Object.freeze(["0.84.0"]),
104
+ versions: Object.freeze(["0.84.0", "0.84.1", "0.84.2"]),
105
+ }),
106
+ // 0.84.3: the CLI loads a minified bundled runtime and extensions receive
107
+ // the in-bundle class objects, so this method's toString() is the minified
108
+ // text. See the registry docblock (artifact families) — the modular dist
109
+ // build of 0.84.3 still carries the fingerprint above.
110
+ Object.freeze({
111
+ name: "updateContent",
112
+ arity: 1,
113
+ fingerprint: "356b7e83",
114
+ versions: Object.freeze(["0.84.3"]),
81
115
  }),
82
116
  ]),
83
117
  "native-compaction-message:updateDisplay": Object.freeze([
@@ -85,7 +119,13 @@ export const KNOWN_NATIVE_IDENTITIES: Readonly<Record<string, readonly KnownNati
85
119
  name: "updateDisplay",
86
120
  arity: 0,
87
121
  fingerprint: "f8c44e78",
88
- versions: Object.freeze(["0.83.0", "0.84.0"]),
122
+ versions: Object.freeze(["0.83.0", "0.84.0", "0.84.1", "0.84.2"]),
123
+ }),
124
+ Object.freeze({
125
+ name: "updateDisplay",
126
+ arity: 0,
127
+ fingerprint: "5118a51d",
128
+ versions: Object.freeze(["0.84.3"]),
89
129
  }),
90
130
  ]),
91
131
  "native-branch-message:updateDisplay": Object.freeze([
@@ -93,7 +133,13 @@ export const KNOWN_NATIVE_IDENTITIES: Readonly<Record<string, readonly KnownNati
93
133
  name: "updateDisplay",
94
134
  arity: 0,
95
135
  fingerprint: "415d57b7",
96
- versions: Object.freeze(["0.83.0", "0.84.0"]),
136
+ versions: Object.freeze(["0.83.0", "0.84.0", "0.84.1", "0.84.2"]),
137
+ }),
138
+ Object.freeze({
139
+ name: "updateDisplay",
140
+ arity: 0,
141
+ fingerprint: "2185274e",
142
+ versions: Object.freeze(["0.84.3"]),
97
143
  }),
98
144
  ]),
99
145
  "native-skill-message:updateDisplay": Object.freeze([
@@ -101,7 +147,13 @@ export const KNOWN_NATIVE_IDENTITIES: Readonly<Record<string, readonly KnownNati
101
147
  name: "updateDisplay",
102
148
  arity: 0,
103
149
  fingerprint: "48099ea6",
104
- versions: Object.freeze(["0.83.0", "0.84.0"]),
150
+ versions: Object.freeze(["0.83.0", "0.84.0", "0.84.1", "0.84.2"]),
151
+ }),
152
+ Object.freeze({
153
+ name: "updateDisplay",
154
+ arity: 0,
155
+ fingerprint: "4051fd65",
156
+ versions: Object.freeze(["0.84.3"]),
105
157
  }),
106
158
  ]),
107
159
  "native-custom-message:rebuild": Object.freeze([
@@ -109,7 +161,13 @@ export const KNOWN_NATIVE_IDENTITIES: Readonly<Record<string, readonly KnownNati
109
161
  name: "rebuild",
110
162
  arity: 0,
111
163
  fingerprint: "76ae2e3a",
112
- versions: Object.freeze(["0.83.0", "0.84.0"]),
164
+ versions: Object.freeze(["0.83.0", "0.84.0", "0.84.1", "0.84.2"]),
165
+ }),
166
+ Object.freeze({
167
+ name: "rebuild",
168
+ arity: 0,
169
+ fingerprint: "b89987cc",
170
+ versions: Object.freeze(["0.84.3"]),
113
171
  }),
114
172
  ]),
115
173
  "tool-call-renderer:getCallRenderer": Object.freeze([
@@ -117,7 +175,13 @@ export const KNOWN_NATIVE_IDENTITIES: Readonly<Record<string, readonly KnownNati
117
175
  name: "getCallRenderer",
118
176
  arity: 0,
119
177
  fingerprint: "951ea0e0",
120
- versions: Object.freeze(["0.83.0", "0.84.0"]),
178
+ versions: Object.freeze(["0.83.0", "0.84.0", "0.84.1", "0.84.2"]),
179
+ }),
180
+ Object.freeze({
181
+ name: "getCallRenderer",
182
+ arity: 0,
183
+ fingerprint: "e50613b7",
184
+ versions: Object.freeze(["0.84.3"]),
121
185
  }),
122
186
  ]),
123
187
  "tool-result-renderer:getResultRenderer": Object.freeze([
@@ -125,7 +189,13 @@ export const KNOWN_NATIVE_IDENTITIES: Readonly<Record<string, readonly KnownNati
125
189
  name: "getResultRenderer",
126
190
  arity: 0,
127
191
  fingerprint: "8a25cd71",
128
- versions: Object.freeze(["0.83.0", "0.84.0"]),
192
+ versions: Object.freeze(["0.83.0", "0.84.0", "0.84.1", "0.84.2"]),
193
+ }),
194
+ Object.freeze({
195
+ name: "getResultRenderer",
196
+ arity: 0,
197
+ fingerprint: "28c4dc22",
198
+ versions: Object.freeze(["0.84.3"]),
129
199
  }),
130
200
  ]),
131
201
  "native-bash-execution:render": Object.freeze([
@@ -137,7 +207,13 @@ export const KNOWN_NATIVE_IDENTITIES: Readonly<Record<string, readonly KnownNati
137
207
  name: "BashExecutionComponent",
138
208
  arity: 2,
139
209
  fingerprint: "a5b5abca",
140
- versions: Object.freeze(["0.83.0", "0.84.0"]),
210
+ versions: Object.freeze(["0.83.0", "0.84.0", "0.84.1", "0.84.2"]),
211
+ }),
212
+ Object.freeze({
213
+ name: "BashExecutionComponent",
214
+ arity: 2,
215
+ fingerprint: "98d22d96",
216
+ versions: Object.freeze(["0.84.3"]),
141
217
  }),
142
218
  ]),
143
219
  });
@@ -267,8 +343,19 @@ function trustedNativeIdentity(spec: TargetSpec): unknown {
267
343
  export interface PiVersionResolution {
268
344
  resolvePackageEntry?: (packageName: string) => string;
269
345
  readFile?: (path: string) => string;
346
+ /** Test-only override for the runtime VERSION-export fallback source. */
347
+ runtimeVersion?: string;
270
348
  }
271
349
 
350
+ /**
351
+ * The running host build's own VERSION constant. Inside the packaged Pi
352
+ * process extensions are loaded through jiti, where `import.meta.resolve`
353
+ * cannot see the host package at all — this export is aliased to the exact
354
+ * host build and is the authoritative version source there. Read defensively
355
+ * through a namespace import so hosts without the export still load.
356
+ */
357
+ const RUNTIME_PI_VERSION = (piCodingAgentPackage as { readonly VERSION?: unknown }).VERSION;
358
+
272
359
  export function detectPiVersion(resolution: PiVersionResolution = {}): {
273
360
  version: string | undefined;
274
361
  diagnostic?: string;
@@ -285,6 +372,7 @@ export function detectPiVersion(resolution: PiVersionResolution = {}): {
285
372
  }
286
373
  });
287
374
  const readFile = resolution.readFile ?? ((path: string) => readFileSync(path, "utf8"));
375
+ let walkDiagnostic: string | undefined;
288
376
  try {
289
377
  const entry = resolvePackageEntry("@earendil-works/pi-coding-agent");
290
378
  let directory = dirname(entry);
@@ -301,13 +389,13 @@ export function detectPiVersion(resolution: PiVersionResolution = {}): {
301
389
  if (parent === directory) break;
302
390
  directory = parent;
303
391
  }
304
- return { version: undefined, diagnostic: "Pi package version was not found" };
392
+ walkDiagnostic = "Pi package version was not found";
305
393
  } catch (error) {
306
- return {
307
- version: undefined,
308
- diagnostic: `Pi package version detection failed: ${error instanceof Error ? error.message : String(error)}`,
309
- };
394
+ walkDiagnostic = `Pi package version detection failed: ${error instanceof Error ? error.message : String(error)}`;
310
395
  }
396
+ const runtimeVersion = resolution.runtimeVersion !== undefined ? resolution.runtimeVersion : RUNTIME_PI_VERSION;
397
+ if (typeof runtimeVersion === "string" && runtimeVersion.trim() !== "") return { version: runtimeVersion };
398
+ return { version: undefined, diagnostic: walkDiagnostic };
311
399
  }
312
400
 
313
401
  function descriptorSnapshot(descriptor: PropertyDescriptor | undefined): CompatibilityDescriptorSnapshot | undefined {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quandev104/pi-style",
3
- "version": "0.2.6",
3
+ "version": "0.2.7",
4
4
  "description": "A native-layout, cohesive visual style package for Pi.",
5
5
  "license": "MIT",
6
6
  "type": "module",