@agimon-ai/po-cloudflare 0.0.2-alpha.13 → 0.0.2-alpha.14

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 (86) hide show
  1. package/dist/{agent-DYFqCLl2.js → agent-DTjnYFAN.js} +1 -1
  2. package/dist/{apiContracts-CDJ9sPkE.js → apiContracts-DepyzMNr.js} +80 -80
  3. package/dist/{approval-BSX-MRTE.js → approval-Biq3NCWj.js} +2 -2
  4. package/dist/{approvalPrompt-1FPgNwMA.js → approvalPrompt-DoHlIPkU.js} +2 -2
  5. package/dist/assets/plugins/compositions.json +1 -1
  6. package/dist/{atomicJson-BF1fVXy1.js → atomicJson-DCIsEywH.js} +3 -3
  7. package/dist/{backgroundWork-BaczP3Z1.js → backgroundWork-Bswjs1av.js} +1 -1
  8. package/dist/{codemode-CZ_eYTwm.js → codemode-CgVosRtU.js} +1 -1
  9. package/dist/{contracts-CnRs-Twx.js → contracts-CylyLZC8.js} +1 -1
  10. package/dist/{domains-Bl6T2dKV.js → domains-BqChtBLN.js} +23 -5
  11. package/dist/{exports-DlcCEAe3.js → exports-DERO0cQf.js} +760 -147
  12. package/dist/{exports-CxkWsXI9.js → exports-DX8LJfSj.js} +9 -9
  13. package/dist/{extensionFile-D7wk8tFr.js → extensionFile-Ds7RCpnb.js} +1 -1
  14. package/dist/{harnessStore-flLz1I0F.js → harnessStore-BectazJQ.js} +4 -4
  15. package/dist/harnessStore-C0Zwvny8.js +1 -0
  16. package/dist/{help-DjybmnPW.js → help-Dpm82qDr.js} +2 -2
  17. package/dist/{hubChannel-Bi3PQrfD.js → hubChannel-COvmdWGO.js} +4 -2
  18. package/dist/{index.edge-CJ2TFpgF.js → index.edge-B0D_Lgbx.js} +2 -2
  19. package/dist/{index.edge-C9_xuXyy.js → index.edge-BLmsRNW8.js} +2 -2
  20. package/dist/{layeredConfig-B4s0eZ5o.js → layeredConfig-pQGjhAks.js} +92 -6
  21. package/dist/{majorModes-IygGmbb8.js → majorModes-BrL4EtzH.js} +5 -14
  22. package/dist/majorModes-WXt22_km.js +1 -0
  23. package/dist/{mcpProjection-BA6baFpi.js → mcpProjection-pbPBBuvs.js} +2 -2
  24. package/dist/{notification-bGq1frYG.js → notification-CINsJWDL.js} +7 -4
  25. package/dist/{piConfig-CcoMX-1L.js → piConfig-BDUpA6w0.js} +5 -5
  26. package/dist/piSettings-tdui0CZI.js +1 -0
  27. package/dist/{platform-CyvF7X-b.js → platform-yhQXrrM_.js} +1 -1
  28. package/dist/{platformFiles-Ccj9HCvA.js → platformFiles-DB3Cw1l_.js} +1 -1
  29. package/dist/{protocol-Q7TFrOIs.js → protocol-B6LbEIe6.js} +2 -2
  30. package/dist/{server-4CmqIbH2.js → server-2o-hl3o0.js} +55 -14
  31. package/dist/{server-DSu_uLDX.js → server-B-br6deK.js} +6 -6
  32. package/dist/{server-C9gff7gU.js → server-B2G-c0hg.js} +5 -5
  33. package/dist/{server-CIhwIcbA.js → server-B3RgnYiZ.js} +13 -4
  34. package/dist/{server-C8HyW7wN.js → server-BBNCtQtl.js} +7 -7
  35. package/dist/{server-C_34VM3M.js → server-BmIU37Ei.js} +3 -3
  36. package/dist/{server-ClsNJwdv.js → server-Bqm5R8kV.js} +13 -13
  37. package/dist/{server-Co57A8MH.js → server-Bt6Zsqo8.js} +2 -2
  38. package/dist/{server-il_s2Ycz.js → server-BvYolSs9.js} +339 -43
  39. package/dist/{server-CpJNq249.js → server-C1x2LoKK.js} +10 -10
  40. package/dist/{server-CjsKNdSN.js → server-CCwwnpH0.js} +5 -5
  41. package/dist/{server-CxGGQFJs.js → server-CRPxNGv6.js} +6 -6
  42. package/dist/{server-COE7BKSa.js → server-Ci_BGVwd.js} +3 -3
  43. package/dist/{server-CTSvwoDy.js → server-CyYesT-G.js} +9 -9
  44. package/dist/{server-ziNfBZ2M.js → server-CzJjYgVk.js} +3 -3
  45. package/dist/{server-C_3jK2WM.js → server-D9qM5XCP.js} +23 -11
  46. package/dist/{server-C82Qzoh3.js → server-DE3Gzgfb.js} +10 -10
  47. package/dist/{server-CMaTba5B.js → server-DL6UyXfJ.js} +8 -8
  48. package/dist/{server-5vLvBTTs.js → server-DPTp6GXS.js} +4 -4
  49. package/dist/{server-CcNMwEFQ.js → server-Dgn4el5K.js} +5 -5
  50. package/dist/{server-CQXqMpeC.js → server-DuDp9MhD.js} +116 -54
  51. package/dist/{server-DeSuziRK.js → server-OerXqXJT.js} +4 -4
  52. package/dist/{server-ZsazKk-n.js → server-V8W5mcGu.js} +6 -6
  53. package/dist/{server-Bm6pAAw8.js → server-_0288DYR.js} +4 -4
  54. package/dist/{server-BHhb0oir.js → server-cStfn1Yv.js} +4 -4
  55. package/dist/{serverPlugin-pCqlBqQG.js → serverPlugin-OOfjB8tm.js} +1114 -1111
  56. package/dist/{sessionConfig-DzAs6Pt-.js → sessionConfig-C-zJI72k.js} +242 -54
  57. package/dist/{validation-CkjZwpf-.js → validation-DuOGOKEi.js} +2 -2
  58. package/dist/{value-DGT5IoiK.js → value-DyVsxCwZ.js} +1 -1
  59. package/dist/{vaultSettings-BRr8n821.js → vaultSettings-BFCRCBM3.js} +1 -1
  60. package/dist/web-cN41ySs9.js +3 -0
  61. package/dist/worker.js +15822 -1103
  62. package/dist/workflow-BgwWq0nq.js +79 -0
  63. package/package.json +32 -32
  64. package/dist/contextProjection-DlB6wzhm.js +0 -209
  65. package/dist/harnessStore-Bap8lsAg.js +0 -1
  66. package/dist/majorModes-xpLK9HpD.js +0 -1
  67. package/dist/piSettings-B6fsgIBA.js +0 -1
  68. package/dist/web-Cfvbn9H1.js +0 -3
  69. package/dist/workflow-w5JPZXgc.js +0 -23
  70. /package/dist/assets/plugins/slots/{approval.8b3f37d9-CqQk6XG_.js → approval.293d9a00-CqQk6XG_.js} +0 -0
  71. /package/dist/assets/plugins/slots/{artifacts.47d00f81-D-vQ-7Iz.js → artifacts.24567664-D-vQ-7Iz.js} +0 -0
  72. /package/dist/assets/plugins/slots/{autocompact.9a92993d-B3KTYwW1.js → autocompact.dd97d013-B3KTYwW1.js} +0 -0
  73. /package/dist/assets/plugins/slots/{builtin-tools.939bbfff-CZRYQVIP.js → builtin-tools.36d7400b-CZRYQVIP.js} +0 -0
  74. /package/dist/assets/plugins/slots/{codemode.782e5bb1-Bzl_K_vt.js → codemode.8eaee717-Bzl_K_vt.js} +0 -0
  75. /package/dist/assets/plugins/slots/{domain.21790b66-CvnpuKCY.js → domain.5e95fc37-CvnpuKCY.js} +0 -0
  76. /package/dist/assets/plugins/slots/{edit.c7c85129-kaxIknZ-.js → edit.385c9aa9-kaxIknZ-.js} +0 -0
  77. /package/dist/assets/plugins/slots/{files.bbcef824-wuB8gcQA.js → files.daf34ed8-wuB8gcQA.js} +0 -0
  78. /package/dist/assets/plugins/slots/{grep.3dfd3214-3FnU8p-d.js → grep.02052cdc-3FnU8p-d.js} +0 -0
  79. /package/dist/assets/plugins/slots/{log.33bc7d38-C0PXQ0O1.js → log.a86eb6d0-C0PXQ0O1.js} +0 -0
  80. /package/dist/assets/plugins/slots/{mcp.59c68bcb-D0CkHnIw.js → mcp.974af249-D0CkHnIw.js} +0 -0
  81. /package/dist/assets/plugins/slots/{profile.ea55f5e1-BSY3iYfJ.js → profile.48851a1d-BSY3iYfJ.js} +0 -0
  82. /package/dist/assets/plugins/slots/{prompts.9957cc84-xdCkNkoA.js → prompts.723d7748-xdCkNkoA.js} +0 -0
  83. /package/dist/assets/plugins/slots/{read.30a617e7-qqaxVlEX.js → read.46bf6536-qqaxVlEX.js} +0 -0
  84. /package/dist/assets/plugins/slots/{runner.9f3559b0-DfO2Z9HG.js → runner.53e9bd76-DfO2Z9HG.js} +0 -0
  85. /package/dist/assets/plugins/slots/{skill.f506a5ea-CL_n-l4h.js → skill.086701a4-CL_n-l4h.js} +0 -0
  86. /package/dist/assets/plugins/slots/{vault.01657352-DbG3F_on.js → vault.ac9935c8-DbG3F_on.js} +0 -0
@@ -48,6 +48,39 @@ function requirePoServerScope(context) {
48
48
  return service;
49
49
  }
50
50
  //#endregion
51
+ //#region ../../core/po-core/src/schemas/platform.ts
52
+ const PO_FS_SERVICE = "po/fs";
53
+ const PO_SHELL_SERVICE = "po/shell";
54
+ const PO_SQLITE_SERVICE = "po/sqlite";
55
+ const PO_SESSION_STORAGE_SERVICE = "po/session-storage";
56
+ const PO_ISOLATE_SERVICE = "po/isolate";
57
+ const PO_NPM_SERVICE = "po/npm";
58
+ const PO_ELECTRON_SERVICE = "po/electron";
59
+ const PO_BROWSER_SERVICE = "po/browser";
60
+ const PO_PROVIDER_AUTH_SERVICE = "po/provider-auth";
61
+ function readPoFs(context) {
62
+ return context.get(PO_FS_SERVICE);
63
+ }
64
+ function requirePoFs(context) {
65
+ const service = readPoFs(context);
66
+ if (!service) throw new Error(`The '${PO_FS_SERVICE}' service is unavailable. Start a Po server first.`);
67
+ return service;
68
+ }
69
+ function requirePoSqlite(context) {
70
+ const service = context.get(PO_SQLITE_SERVICE);
71
+ if (!service) throw new Error(`The '${PO_SQLITE_SERVICE}' service is unavailable. Start a Po server first.`);
72
+ return service;
73
+ }
74
+ function readPoNpm(context) {
75
+ return context.get(PO_NPM_SERVICE);
76
+ }
77
+ function readPoBrowser(context) {
78
+ return context.get(PO_BROWSER_SERVICE);
79
+ }
80
+ function readPoIsolate(context) {
81
+ return context.get(PO_ISOLATE_SERVICE);
82
+ }
83
+ //#endregion
51
84
  //#region ../../../node_modules/.pnpm/@earendil-works+chord@1.5.0_esbuild@0.28.2/node_modules/@earendil-works/chord/dist/context/index.js
52
85
  const ABORT_SIGNAL_CONTEXT_KEY = Object.freeze({ token: Symbol("chord.abortSignal") });
53
86
  const TELEMETRY_CONTEXT_KEY = Object.freeze({ token: Symbol("chord.telemetry") });
@@ -136,247 +169,744 @@ function abortError(signal) {
136
169
  return reason instanceof Error ? reason : new DOMException("The operation was aborted", "AbortError");
137
170
  }
138
171
  //#endregion
139
- //#region ../../../node_modules/.pnpm/typebox@1.4.2/node_modules/typebox/build/system/memory/metrics.mjs
140
- /** TypeBox instantiation metrics */
141
- const Metrics = {
142
- assign: 0,
143
- create: 0,
144
- clone: 0,
145
- discard: 0,
146
- update: 0
172
+ //#region ../../../node_modules/.pnpm/@earendil-works+chord@1.5.0_esbuild@0.28.2/node_modules/@earendil-works/chord/dist/json.js
173
+ const DATA_DESCRIPTOR = {
174
+ value: void 0,
175
+ writable: true,
176
+ enumerable: true,
177
+ configurable: true
147
178
  };
148
- //#endregion
149
- //#region ../../../node_modules/.pnpm/typebox@1.4.2/node_modules/typebox/build/guard/unicode/unicode_segment.mjs
150
- function IsBetween(value, min, max) {
151
- return value >= min && value <= max;
179
+ /** Copy a value into an alias-free strict-JSON tree owned by the caller. */
180
+ function copyJson(value, options) {
181
+ return copy(value, void 0, options?.omitUndefinedProperties === true);
152
182
  }
153
- function IsZeroWidthJoiner(value) {
154
- return value === 8205;
183
+ function copy(value, ancestors, omitUndefinedProperties) {
184
+ if (value === null || typeof value === "string" || typeof value === "boolean") return value;
185
+ if (typeof value === "number") {
186
+ if (Number.isFinite(value)) return value;
187
+ throw new TypeError("Value contains a non-finite number and is not strict JSON");
188
+ }
189
+ if (typeof value !== "object") throw new TypeError(`Value contains a non-JSON ${typeof value}; expected strict JSON`);
190
+ const active = ancestors ?? /* @__PURE__ */ new Set();
191
+ if (active.has(value)) throw new TypeError("Value contains cycles and is not strict JSON");
192
+ active.add(value);
193
+ try {
194
+ if (Array.isArray(value)) {
195
+ if (Object.getPrototypeOf(value) !== Array.prototype || Reflect.ownKeys(value).length !== value.length + 1) throw new TypeError("Value must contain strict JSON dense plain arrays");
196
+ const result = new Array(value.length);
197
+ for (let index = 0; index < value.length; index++) {
198
+ const descriptor = Object.getOwnPropertyDescriptor(value, index);
199
+ if (descriptor === void 0 || !descriptor.enumerable || !("value" in descriptor)) throw new TypeError("Value must contain strict JSON enumerable indexed data properties");
200
+ defineData(result, String(index), copy(descriptor.value, active, omitUndefinedProperties));
201
+ }
202
+ return result;
203
+ }
204
+ const prototype = Object.getPrototypeOf(value);
205
+ if (prototype !== Object.prototype && prototype !== null) throw new TypeError("Value must contain strict JSON plain objects or arrays");
206
+ const result = Object.create(prototype);
207
+ for (const key of Reflect.ownKeys(value)) {
208
+ if (typeof key === "symbol") throw new TypeError("Value contains a symbol key and is not strict JSON");
209
+ const descriptor = Object.getOwnPropertyDescriptor(value, key);
210
+ if (!descriptor.enumerable || !("value" in descriptor)) throw new TypeError("Value must contain strict JSON enumerable data properties");
211
+ if (descriptor.value === void 0 && omitUndefinedProperties) continue;
212
+ defineData(result, key, copy(descriptor.value, active, omitUndefinedProperties));
213
+ }
214
+ return result;
215
+ } finally {
216
+ active.delete(value);
217
+ }
155
218
  }
156
- function IsRegionalIndicator(value) {
157
- return IsBetween(value, 127462, 127487);
219
+ function defineData(target, key, value) {
220
+ DATA_DESCRIPTOR.value = value;
221
+ Object.defineProperty(target, key, DATA_DESCRIPTOR);
222
+ DATA_DESCRIPTOR.value = void 0;
158
223
  }
159
- function IsVariationSelector(value) {
160
- return IsBetween(value, 65024, 65039);
224
+ //#endregion
225
+ //#region ../../../node_modules/.pnpm/@earendil-works+pi-durable@1.5.0_patch_hash=0f5e595daa4c370af407284d99d6dba48a9e21f56aa_fbb51180c4b193ec70152883060baa79/node_modules/@earendil-works/pi-durable/dist/ids.js
226
+ /** Apply an erased ID brand at a trusted numeric allocation or decoding boundary. */
227
+ function idFromNumber(value) {
228
+ return value;
161
229
  }
162
- function IsCombiningMark(value) {
163
- return IsBetween(value, 768, 879) || IsBetween(value, 6832, 6911) || IsBetween(value, 7616, 7679) || IsBetween(value, 65056, 65071);
230
+ /** Apply the erased commit-sequence brand at a trusted storage boundary. */
231
+ function seqFromNumber(value) {
232
+ return value;
164
233
  }
165
- function CodePointLength(value) {
166
- return value > 65535 ? 2 : 1;
234
+ //#endregion
235
+ //#region ../../../node_modules/.pnpm/@earendil-works+pi-durable@1.5.0_patch_hash=0f5e595daa4c370af407284d99d6dba48a9e21f56aa_fbb51180c4b193ec70152883060baa79/node_modules/@earendil-works/pi-durable/dist/documents.js
236
+ function defineDoc(definition) {
237
+ validateDefinition(definition);
238
+ return { definition };
167
239
  }
168
- function ConsumeModifiers(value, index) {
169
- while (index < value.length) {
170
- const point = value.codePointAt(index);
171
- if (IsCombiningMark(point) || IsVariationSelector(point)) index += CodePointLength(point);
172
- else break;
173
- }
174
- return index;
240
+ function defineDocFamily(definition) {
241
+ validateDefinition(definition);
242
+ return { definition };
175
243
  }
176
- function NextGraphemeClusterIndex(value, clusterStart) {
177
- const startCP = value.codePointAt(clusterStart);
178
- let clusterEnd = clusterStart + CodePointLength(startCP);
179
- clusterEnd = ConsumeModifiers(value, clusterEnd);
180
- while (clusterEnd < value.length - 1 && IsZeroWidthJoiner(value.codePointAt(clusterEnd))) {
181
- const nextCP = value.codePointAt(clusterEnd + 1);
182
- clusterEnd += 1 + CodePointLength(nextCP);
183
- clusterEnd = ConsumeModifiers(value, clusterEnd);
184
- }
185
- if (IsRegionalIndicator(startCP) && clusterEnd < value.length && IsRegionalIndicator(value.codePointAt(clusterEnd))) clusterEnd += CodePointLength(value.codePointAt(clusterEnd));
186
- return clusterEnd;
244
+ function validateDefinition(definition) {
245
+ if (!Number.isSafeInteger(definition.version) || definition.version < 1) throw new TypeError(`Document ${definition.kind} version must be a positive integer`);
187
246
  }
188
- /** Returns the number of grapheme clusters in a string */
189
- function GraphemeCount$1(value) {
190
- let count = 0, index = 0;
191
- while (index < value.length) {
192
- index = NextGraphemeClusterIndex(value, index);
193
- count++;
247
+ /** Resolve an overloaded argument list and return the index after the owner and family key. */
248
+ function resolveAddress(definition, args) {
249
+ let index = 0;
250
+ let scope;
251
+ switch (definition.scope) {
252
+ case "session":
253
+ scope = { kind: "session" };
254
+ break;
255
+ case "conversation":
256
+ scope = {
257
+ kind: "conversation",
258
+ conversationId: ownerId(args[index++], definition)
259
+ };
260
+ break;
261
+ case "task": scope = {
262
+ kind: "task",
263
+ taskId: ownerId(args[index++], definition)
264
+ };
194
265
  }
195
- return count;
266
+ const key = definition.family === true ? args[index++] : void 0;
267
+ const address = key === void 0 ? {
268
+ kind: definition.kind,
269
+ scope
270
+ } : {
271
+ kind: definition.kind,
272
+ scope,
273
+ key
274
+ };
275
+ return {
276
+ address,
277
+ id: addressId(address),
278
+ nextArgument: index
279
+ };
196
280
  }
197
- //#endregion
198
- //#region ../../../node_modules/.pnpm/typebox@1.4.2/node_modules/typebox/build/guard/unicode/unicode.mjs
199
- /** Returns the total number of Unicode code points in the string */
200
- function CodePointCount$1(value) {
201
- let result = 0, index = 0, prev = 0;
202
- while (index < value.length) {
203
- const next = value.charCodeAt(index++) >> 10;
204
- result += +((prev << 8 | next) !== 13879);
205
- prev = next;
281
+ function ownerId(value, definition) {
282
+ if (typeof value !== "number" || !Number.isSafeInteger(value)) throw new TypeError(`Document ${definition.kind} requires a ${definition.scope} ID`);
283
+ return idFromNumber(value);
284
+ }
285
+ /** Stable string identity of one logical address. */
286
+ function addressId(address) {
287
+ const owner = address.scope.kind === "session" ? null : address.scope.kind === "conversation" ? address.scope.conversationId : address.scope.taskId;
288
+ return JSON.stringify([
289
+ address.kind,
290
+ address.scope.kind,
291
+ owner,
292
+ address.key ?? null
293
+ ]);
294
+ }
295
+ /** Build the storage create record for a new incarnation at an address. */
296
+ function documentCreate(definition, address, id) {
297
+ const key = address.key === void 0 ? {} : { key: address.key };
298
+ switch (address.scope.kind) {
299
+ case "session": return {
300
+ id,
301
+ kind: address.kind,
302
+ ...key,
303
+ scope: address.scope
304
+ };
305
+ case "task": return {
306
+ id,
307
+ kind: address.kind,
308
+ ...key,
309
+ scope: address.scope
310
+ };
311
+ case "conversation": return {
312
+ id,
313
+ kind: address.kind,
314
+ ...key,
315
+ scope: address.scope,
316
+ history: definition.history,
317
+ fork: definition.fork
318
+ };
206
319
  }
207
- return result;
208
320
  }
209
- /** Returns true if the string length in Unicode code points is less than or equal to maxLength */
210
- function IsMaxLength$1(value, maxLength) {
211
- return value.length <= maxLength || value.length <= maxLength << 1 && CodePointCount$1(value) <= maxLength;
321
+ /** Reject typed access whose token disagrees with the persisted scope, history, or fork semantics. */
322
+ function checkRecordScope(definition, record) {
323
+ if (record.scope.kind !== definition.scope || record.scope.kind === "conversation" && (record.history !== definition.history || record.fork !== definition.fork)) throw new TypeError(`Document ${record.id} (${record.kind}) does not match the supplied definition semantics`);
212
324
  }
213
- /** Returns true if the string length in Unicode code points is greater than or equal to minLength */
214
- function IsMinLength$1(value, minLength) {
215
- return value.length >= minLength << 1 || value.length >= minLength && CodePointCount$1(value) >= minLength;
325
+ /** Reject typed access to a stored version the supplied definition cannot use. */
326
+ function checkRecordVersion(definition, record, version) {
327
+ if (version > definition.version) throw new Error(`Document ${record.id} (${record.kind}) has newer version ${version} than ${definition.version}`);
328
+ if (version < definition.version && definition.migrate === void 0) throw new Error(`Document ${record.id} (${record.kind}) requires migration from version ${version}`);
329
+ }
330
+ /** Validate and materialize a detached stored value for typed access. */
331
+ function materializeDocument(definition, stored) {
332
+ return materializeDocumentValue(definition, stored.record, stored.version, stored.value);
333
+ }
334
+ /** Validate and materialize one detached value before its first persisted incarnation. */
335
+ function materializeDocumentValue(definition, record, version, value) {
336
+ checkRecordScope(definition, record);
337
+ checkRecordVersion(definition, record, version);
338
+ if (version === definition.version) return value;
339
+ return copyJson(definition.migrate(value, version));
216
340
  }
217
341
  //#endregion
218
- //#region ../../../node_modules/.pnpm/typebox@1.4.2/node_modules/typebox/build/guard/guard.mjs
219
- var guard_exports = /* @__PURE__ */ __exportAll({
220
- CodePointCount: () => CodePointCount,
221
- Counted: () => Counted,
222
- Entries: () => Entries,
223
- EntriesRegExp: () => EntriesRegExp,
224
- Every: () => Every,
225
- EveryAll: () => EveryAll,
226
- GraphemeCount: () => GraphemeCount,
227
- HasPropertyKey: () => HasPropertyKey,
228
- IsArray: () => IsArray$1,
229
- IsBigInt: () => IsBigInt$1,
230
- IsBoolean: () => IsBoolean$2,
231
- IsClassInstance: () => IsClassInstance,
232
- IsConstructor: () => IsConstructor$1,
233
- IsDeepEqual: () => IsDeepEqual,
234
- IsEqual: () => IsEqual,
235
- IsFunction: () => IsFunction$1,
236
- IsGreaterEqualThan: () => IsGreaterEqualThan,
237
- IsGreaterThan: () => IsGreaterThan,
238
- IsInteger: () => IsInteger$1,
239
- IsLessEqualThan: () => IsLessEqualThan,
240
- IsLessThan: () => IsLessThan,
241
- IsMaxLength: () => IsMaxLength,
242
- IsMinLength: () => IsMinLength,
243
- IsMultipleOf: () => IsMultipleOf,
244
- IsNull: () => IsNull$1,
245
- IsNumber: () => IsNumber$2,
246
- IsObject: () => IsObject$1,
247
- IsObjectNotArray: () => IsObjectNotArray,
248
- IsString: () => IsString$2,
249
- IsSymbol: () => IsSymbol$1,
250
- IsUndefined: () => IsUndefined$1,
251
- IsUnsafePropertyKey: () => IsUnsafePropertyKey,
252
- IsValueLike: () => IsValueLike,
253
- Keys: () => Keys$1,
254
- ShiftLeft: () => ShiftLeft,
255
- Some: () => Some,
256
- SomeAll: () => SomeAll,
257
- Symbols: () => Symbols,
258
- Values: () => Values
342
+ //#region ../../core/po-core/src/services/durableSession/docs.ts
343
+ /** Public string identity belongs to Po, not the durable numeric ID namespace. */
344
+ const SessionIdentityDoc = defineDoc({
345
+ kind: "po.session.identity",
346
+ checkpointWhen: () => false,
347
+ version: 1,
348
+ scope: "session",
349
+ initial: () => ({
350
+ id: "",
351
+ createdAt: 0,
352
+ parentSessionId: ""
353
+ })
259
354
  });
260
- /** Returns true if this value is an array */
261
- function IsArray$1(value) {
262
- return Array.isArray(value);
263
- }
264
- /** Returns true if this value is bigint */
265
- function IsBigInt$1(value) {
266
- return IsEqual(typeof value, "bigint");
355
+ const SessionMetadataDoc = defineDoc({
356
+ kind: "po.session.metadata",
357
+ checkpointWhen: () => false,
358
+ version: 1,
359
+ scope: "session",
360
+ initial: () => ({
361
+ name: "",
362
+ workspaceRoot: "",
363
+ execution: "",
364
+ laneName: "main",
365
+ groups: []
366
+ })
367
+ });
368
+ const FastModeDoc = defineDoc({
369
+ kind: "po.fast-mode",
370
+ checkpointWhen: () => false,
371
+ version: 1,
372
+ scope: "session",
373
+ initial: () => ({ enabled: false })
374
+ });
375
+ const AgentLockDoc = defineDoc({
376
+ kind: "po.agent-lock",
377
+ checkpointWhen: () => false,
378
+ version: 1,
379
+ scope: "session",
380
+ initial: () => ({ locked: false })
381
+ });
382
+ const LabelsDoc = defineDoc({
383
+ kind: "po.labels",
384
+ checkpointWhen: () => false,
385
+ version: 1,
386
+ scope: "session",
387
+ initial: () => ({ labels: {} })
388
+ });
389
+ /**
390
+ * Profile identity entries of one conversation, written in the identity entry's commit, so a transcript page finds
391
+ * the avatar in effect without scanning backwards. Rewindable with `asOf` forks: a fork keeps only the identities
392
+ * written before its fork point. Sessions written before this document have no entries and show the default avatar.
393
+ */
394
+ const IdentityHistoryDoc = defineDoc({
395
+ kind: "po.identity-history",
396
+ checkpointWhen: () => false,
397
+ version: 1,
398
+ scope: "conversation",
399
+ history: "rewindable",
400
+ fork: "asOf",
401
+ initial: () => ({ items: [] })
402
+ });
403
+ //#endregion
404
+ //#region ../../../node_modules/.pnpm/@earendil-works+pi-durable@1.5.0_patch_hash=0f5e595daa4c370af407284d99d6dba48a9e21f56aa_fbb51180c4b193ec70152883060baa79/node_modules/@earendil-works/pi-durable/dist/env/index.js
405
+ function ok(value) {
406
+ return {
407
+ ok: true,
408
+ value
409
+ };
267
410
  }
268
- /** Returns true if this value is a boolean */
269
- function IsBoolean$2(value) {
270
- return IsEqual(typeof value, "boolean");
411
+ function err(error) {
412
+ return {
413
+ ok: false,
414
+ error
415
+ };
271
416
  }
272
- /** Returns true if this value is a constructor */
273
- function IsConstructor$1(value) {
274
- if (IsUndefined$1(value) || !IsFunction$1(value)) return false;
275
- const result = Function.prototype.toString.call(value);
276
- if (/^class\s/.test(result)) return true;
277
- if (/\[native code\]/.test(result)) return true;
278
- return false;
417
+ function getOrThrow(result) {
418
+ if (!result.ok) throw result.error;
419
+ return result.value;
279
420
  }
280
- /** Returns true if this value is a function */
281
- function IsFunction$1(value) {
282
- return IsEqual(typeof value, "function");
421
+ var FileError = class extends Error {
422
+ code;
423
+ path;
424
+ constructor(code, message, path, cause) {
425
+ super(message, cause === void 0 ? void 0 : { cause });
426
+ this.name = "FileError";
427
+ this.code = code;
428
+ this.path = path;
429
+ }
430
+ };
431
+ var ExecutionError = class extends Error {
432
+ code;
433
+ /** Spill file of a command that timed out or was aborted after its output crossed the spill thresholds. */
434
+ spillPath;
435
+ constructor(code, message, cause) {
436
+ super(message, cause === void 0 ? void 0 : { cause });
437
+ this.name = "ExecutionError";
438
+ this.code = code;
439
+ }
440
+ };
441
+ //#endregion
442
+ //#region ../../core/po-core/src/services/nodeHost/index.edge.ts
443
+ const EMPTY_ENVIRONMENT = Object.freeze({});
444
+ /** The edge host: one Durable Object, its virtual filesystem laid out as in po-cloudflare's DoFileSystem. */
445
+ const nodeHost = {
446
+ homeDirectory: () => "/home/po",
447
+ temporaryDirectory: () => "/tmp",
448
+ /** A Durable Object is one logical process. */
449
+ processId: () => 1,
450
+ /**
451
+ * Empty: the Worker's `process.env` holds its deployment vars and secrets, never a session's.
452
+ * Sessions receive their admitted environment explicitly.
453
+ */
454
+ environment: () => EMPTY_ENVIRONMENT,
455
+ setMode: async (_filePath, _mode) => void 0,
456
+ /** No modes on the edge, so callers skip their permission checks, as `setMode` does. */
457
+ fileMode: async (_filePath) => void 0
458
+ };
459
+ //#endregion
460
+ //#region ../../core/po-core/src/services/serialRunner/index.ts
461
+ /** Runs operations one at a time in call order; a rejection reaches its caller and never stalls the queue. */
462
+ function createSerialRunner() {
463
+ let tail = Promise.resolve();
464
+ const tails = /* @__PURE__ */ new Map();
465
+ const run = (operation) => {
466
+ const result = tail.then(operation);
467
+ tail = result.catch(() => void 0);
468
+ return result;
469
+ };
470
+ const forKey = (key) => (operation) => {
471
+ const result = (tails.get(key) ?? Promise.resolve()).then(operation);
472
+ const settled = result.catch(() => void 0);
473
+ tails.set(key, settled);
474
+ settled.then(() => {
475
+ if (tails.get(key) === settled) tails.delete(key);
476
+ });
477
+ return result;
478
+ };
479
+ return Object.assign(run, { forKey });
283
480
  }
284
- /** Returns true if this value is integer */
285
- function IsInteger$1(value) {
286
- return Number.isInteger(value);
481
+ /** Cooperating API writers share this queue, keyed by the canonical target path. Not an OS file lock. */
482
+ const fileMutationRunner = createSerialRunner();
483
+ //#endregion
484
+ //#region ../../core/po-core/src/services/piSettings/core.ts
485
+ /**
486
+ * Pi's user settings, as `po sync` maintains them.
487
+ *
488
+ * The Po package is registered globally so a plain `pi` process can find the
489
+ * lightweight package bootstrap before project resources are trusted. Sync owns
490
+ * the extension registration, ambient-discovery filter, theme resource, selected default theme, and quiet-startup keys
491
+ * while preserving every unrelated user setting.
492
+ */
493
+ const PI_CODING_AGENT_DIR_ENV = "PI_CODING_AGENT_DIR";
494
+ /** Moves Po's whole home, agent directory included, away from `~/.po`. */
495
+ const PO_HOME_ENV = "PO_HOME";
496
+ /** The agent folder inside a Po or Pi home. */
497
+ const AGENT_DIRECTORY = "agent";
498
+ const HOME_ALIAS = "~";
499
+ const HOME_ALIAS_PREFIX = "~/";
500
+ /**
501
+ * Expands `~` and resolves a relative path against home, never the cwd, so every
502
+ * Po process lands on the same directory wherever it was started.
503
+ */
504
+ function resolveConfiguredDirectory(configured, homeDirectory) {
505
+ if (configured === HOME_ALIAS) return homeDirectory;
506
+ if (configured.startsWith(HOME_ALIAS_PREFIX)) return path.join(homeDirectory, configured.slice(2));
507
+ return path.resolve(homeDirectory, configured);
287
508
  }
288
- /** Returns true if this value is null */
289
- function IsNull$1(value) {
290
- return IsEqual(value, null);
509
+ /**
510
+ * Po's home: config, workspaces, runtime registry and its Pi agent directory.
511
+ * Defaults to `~/.po`; `PO_HOME` moves all of it.
512
+ */
513
+ function poHomeDirectory(homeDirectory = nodeHost.homeDirectory(), environment = nodeHost.environment()) {
514
+ const configured = environment[PO_HOME_ENV]?.trim();
515
+ return configured ? resolveConfiguredDirectory(configured, homeDirectory) : path.join(homeDirectory, ".po");
291
516
  }
292
- /** Returns true if this value is number */
293
- function IsNumber$2(value) {
294
- return Number.isFinite(value);
517
+ /**
518
+ * The Pi agent directory Po runs with. Honors Pi's documented override; every Po
519
+ * entry point sets that override, so the default only applies to library callers.
520
+ */
521
+ function piAgentDirectory(environment = nodeHost.environment(), homeDirectory = nodeHost.homeDirectory()) {
522
+ const configured = environment[PI_CODING_AGENT_DIR_ENV]?.trim();
523
+ if (!configured) return path.join(poHomeDirectory(homeDirectory, environment), AGENT_DIRECTORY);
524
+ return resolveConfiguredDirectory(configured, homeDirectory);
295
525
  }
296
- /** Returns true if this value is an object but not an array */
297
- function IsObjectNotArray(value) {
298
- return IsObject$1(value) && !IsArray$1(value);
526
+ createSerialRunner();
527
+ //#endregion
528
+ //#region ../../core/po-core/src/services/sessionFiles/sessionDirectory.edge.ts
529
+ /** The Durable Object filesystem is already isolated to its owning session. */
530
+ async function prepareSessionDirectory(platform, directory) {
531
+ const fs = platform.env(platform.homeDirectory);
532
+ try {
533
+ getOrThrow(await fs.createDir(directory, { recursive: true }, BACKGROUND_CONTEXT));
534
+ return directory;
535
+ } finally {
536
+ await fs.cleanup(BACKGROUND_CONTEXT);
537
+ }
299
538
  }
300
- /** Returns true if this value is an object */
301
- function IsObject$1(value) {
302
- return IsEqual(typeof value, "object") && !IsNull$1(value);
303
- }
304
- /** Returns true if this value is string */
305
- function IsString$2(value) {
306
- return IsEqual(typeof value, "string");
307
- }
308
- /** Returns true if this value is symbol */
309
- function IsSymbol$1(value) {
310
- return IsEqual(typeof value, "symbol");
311
- }
312
- /** Returns true if this value is undefined */
313
- function IsUndefined$1(value) {
314
- return IsEqual(value, void 0);
315
- }
316
- function IsEqual(left, right) {
317
- return left === right;
318
- }
319
- function IsGreaterThan(left, right) {
320
- return left > right;
321
- }
322
- function IsLessThan(left, right) {
323
- return left < right;
539
+ //#endregion
540
+ //#region ../../core/po-core/src/services/sessionFiles/index.ts
541
+ const PO_SESSION_TEMP_DIR = "PO_SESSION_TEMP_DIR";
542
+ const PO_SESSION_FILES_SERVICE = "po/session-files";
543
+ /** A host-owned path, never a client-selected root or an inherited parent session path. */
544
+ function sessionTempDirectory(options) {
545
+ if (!/^[a-zA-Z0-9_-]+$/u.test(options.sessionId)) throw new Error("Invalid temporary-file session identity.");
546
+ if (!path.isAbsolute(options.temporaryDirectory)) throw new Error("The host temporary directory must be absolute.");
547
+ const namespace = createHash("sha256").update(options.homeDirectory).update("\0").update(poHomeDirectory(options.homeDirectory, options.environment)).digest("hex").slice(0, 24);
548
+ return path.join(options.temporaryDirectory, `po-${namespace}`, "sessions", options.sessionId);
324
549
  }
325
- function IsLessEqualThan(left, right) {
326
- return left <= right;
550
+ /** Both the execution host and package APIs call this with their admitted session identity. */
551
+ async function prepareSessionEnvironment(input) {
552
+ const environment = { ...input.environment };
553
+ delete environment[PO_SESSION_TEMP_DIR];
554
+ if (input.platform.temporaryDirectory === void 0) return Object.freeze(environment);
555
+ const directory = sessionTempDirectory({
556
+ sessionId: input.sessionId,
557
+ homeDirectory: input.platform.homeDirectory,
558
+ environment,
559
+ temporaryDirectory: input.platform.temporaryDirectory
560
+ });
561
+ const preparedDirectory = await prepareSessionDirectory(input.platform, directory);
562
+ return Object.freeze({
563
+ ...environment,
564
+ [PO_SESSION_TEMP_DIR]: preparedDirectory
565
+ });
327
566
  }
328
- function IsGreaterEqualThan(left, right) {
329
- return left >= right;
567
+ Object.fromEntries(Object.entries({
568
+ home: {
569
+ slot: "home",
570
+ scope: "global",
571
+ description: "Typed Home content and launch contributions.",
572
+ kind: "data"
573
+ },
574
+ homeApps: {
575
+ slot: "home-apps",
576
+ scope: "global",
577
+ description: "Plugin cards on Home. Set data.column to side for the narrow column.",
578
+ parent: "home",
579
+ kind: "component"
580
+ },
581
+ dashboardTiles: {
582
+ slot: "dashboard-tiles",
583
+ scope: "global",
584
+ description: "Host-framed body-only tiles on Home and workspace dashboards.",
585
+ kind: "component"
586
+ },
587
+ homeAttention: {
588
+ slot: "home-attention",
589
+ scope: "global",
590
+ description: "Plugin-framed Home cards for things waiting on the person.",
591
+ parent: "home",
592
+ kind: "component"
593
+ },
594
+ overlay: {
595
+ slot: "overlay",
596
+ scope: "global",
597
+ description: "Overlays above the cockpit, such as a microphone dialog.",
598
+ kind: "component"
599
+ },
600
+ rail: {
601
+ slot: "rail",
602
+ scope: "global",
603
+ description: "Navigation items in the cockpit rail.",
604
+ kind: "component"
605
+ },
606
+ context: {
607
+ slot: "context",
608
+ scope: "global",
609
+ description: "Context panels beside the session conversation.",
610
+ kind: "component"
611
+ },
612
+ selectionBar: {
613
+ slot: "selection-bar",
614
+ scope: "global",
615
+ description: "Actions for the current text selection.",
616
+ kind: "component"
617
+ },
618
+ activity: {
619
+ slot: "activity",
620
+ scope: "global",
621
+ description: "Session activity panels, with explicit child slots for activity groups.",
622
+ kind: "component"
623
+ },
624
+ activityPromo: {
625
+ slot: "activity-promo",
626
+ scope: "global",
627
+ description: "Compact actions inside the activity promo card, such as Explore.",
628
+ parent: "activity",
629
+ kind: "component"
630
+ },
631
+ composerActions: {
632
+ slot: "composer-actions",
633
+ scope: "global",
634
+ description: "Action controls beside the session composer.",
635
+ kind: "component"
636
+ },
637
+ composerMenu: {
638
+ slot: "composer-menu",
639
+ scope: "global",
640
+ description: "Items in the session composer menu.",
641
+ kind: "component"
642
+ },
643
+ dialogPrompt: {
644
+ slot: "dialog-prompt",
645
+ scope: "global",
646
+ description: "Typed data fills that claim a dialog independently of a tool card.",
647
+ kind: "data"
648
+ },
649
+ sessionMenu: {
650
+ slot: "session-menu",
651
+ scope: "global",
652
+ description: "Items in the session menu.",
653
+ kind: "component"
654
+ },
655
+ newSession: {
656
+ slot: "new-session",
657
+ scope: "global",
658
+ description: "A workspace fill replacing the host new-session dialog.",
659
+ kind: "component"
660
+ },
661
+ page: {
662
+ slot: "page",
663
+ scope: "global",
664
+ description: "A full page at /page/<fill id> in the main area beside the sidebar.",
665
+ kind: "component"
666
+ }
667
+ }).map(([key, declaration]) => [key, declaration.slot]));
668
+ //#endregion
669
+ //#region ../../../node_modules/.pnpm/typebox@1.4.2/node_modules/typebox/build/system/memory/metrics.mjs
670
+ /** TypeBox instantiation metrics */
671
+ const Metrics = {
672
+ assign: 0,
673
+ create: 0,
674
+ clone: 0,
675
+ discard: 0,
676
+ update: 0
677
+ };
678
+ //#endregion
679
+ //#region ../../../node_modules/.pnpm/typebox@1.4.2/node_modules/typebox/build/guard/unicode/unicode_segment.mjs
680
+ function IsBetween(value, min, max) {
681
+ return value >= min && value <= max;
330
682
  }
331
- function IsMultipleOf(dividend, divisor) {
332
- if (IsBigInt$1(dividend) || IsBigInt$1(divisor)) return BigInt(dividend) % BigInt(divisor) === 0n;
333
- const tolerance = 1e-10;
334
- if (!IsNumber$2(dividend)) return true;
335
- if (IsInteger$1(dividend) && 1 / divisor % 1 === 0) return true;
336
- const mod = dividend % divisor;
337
- return Math.min(Math.abs(mod), Math.abs(mod - divisor), Math.abs(mod + divisor)) < tolerance;
683
+ function IsZeroWidthJoiner(value) {
684
+ return value === 8205;
338
685
  }
339
- /** Returns true if the value appears to be an instance of a class. */
340
- function IsClassInstance(value) {
341
- if (!IsObject$1(value)) return false;
342
- const proto = globalThis.Object.getPrototypeOf(value);
343
- if (IsNull$1(proto)) return false;
344
- return IsEqual(typeof proto.constructor, "function") && !(IsEqual(proto.constructor, globalThis.Object) || IsEqual(proto.constructor.name, "Object"));
686
+ function IsRegionalIndicator(value) {
687
+ return IsBetween(value, 127462, 127487);
345
688
  }
346
- function IsValueLike(value) {
347
- return IsBigInt$1(value) || IsBoolean$2(value) || IsNull$1(value) || IsNumber$2(value) || IsString$2(value) || IsUndefined$1(value);
689
+ function IsVariationSelector(value) {
690
+ return IsBetween(value, 65024, 65039);
348
691
  }
349
- /** Returns the total number of visual grapheme clusters in the string. */
350
- function GraphemeCount(value) {
351
- return GraphemeCount$1(value);
692
+ function IsCombiningMark(value) {
693
+ return IsBetween(value, 768, 879) || IsBetween(value, 6832, 6911) || IsBetween(value, 7616, 7679) || IsBetween(value, 65056, 65071);
352
694
  }
353
- /** Returns the total number of Unicode code points in the string. */
354
- function CodePointCount(value) {
355
- return CodePointCount$1(value);
695
+ function CodePointLength(value) {
696
+ return value > 65535 ? 2 : 1;
356
697
  }
357
- /** Returns true if the string length in Unicode code points does not exceed maxLength */
358
- function IsMaxLength(value, maxLength) {
359
- return IsMaxLength$1(value, maxLength);
698
+ function ConsumeModifiers(value, index) {
699
+ while (index < value.length) {
700
+ const point = value.codePointAt(index);
701
+ if (IsCombiningMark(point) || IsVariationSelector(point)) index += CodePointLength(point);
702
+ else break;
703
+ }
704
+ return index;
360
705
  }
361
- /** Returns true if the string length in Unicode code points is at least minLength */
362
- function IsMinLength(value, minLength) {
363
- return IsMinLength$1(value, minLength);
706
+ function NextGraphemeClusterIndex(value, clusterStart) {
707
+ const startCP = value.codePointAt(clusterStart);
708
+ let clusterEnd = clusterStart + CodePointLength(startCP);
709
+ clusterEnd = ConsumeModifiers(value, clusterEnd);
710
+ while (clusterEnd < value.length - 1 && IsZeroWidthJoiner(value.codePointAt(clusterEnd))) {
711
+ const nextCP = value.codePointAt(clusterEnd + 1);
712
+ clusterEnd += 1 + CodePointLength(nextCP);
713
+ clusterEnd = ConsumeModifiers(value, clusterEnd);
714
+ }
715
+ if (IsRegionalIndicator(startCP) && clusterEnd < value.length && IsRegionalIndicator(value.codePointAt(clusterEnd))) clusterEnd += CodePointLength(value.codePointAt(clusterEnd));
716
+ return clusterEnd;
364
717
  }
365
- /** Returns true if every element from offset satisfies the callback, short-circuiting on the first failure */
366
- function Every(value, offset, callback) {
367
- return value.every((item, index) => index < offset || callback(item, index));
718
+ /** Returns the number of grapheme clusters in a string */
719
+ function GraphemeCount$1(value) {
720
+ let count = 0, index = 0;
721
+ while (index < value.length) {
722
+ index = NextGraphemeClusterIndex(value, index);
723
+ count++;
724
+ }
725
+ return count;
368
726
  }
369
- /** Returns true if every element from offset satisfies the callback, using exhaustive enumeration */
370
- function EveryAll(value, offset, callback) {
371
- let result = true;
372
- value.forEach((item, index) => {
373
- if (index >= offset && !callback(item, index)) result = false;
374
- });
727
+ //#endregion
728
+ //#region ../../../node_modules/.pnpm/typebox@1.4.2/node_modules/typebox/build/guard/unicode/unicode.mjs
729
+ /** Returns the total number of Unicode code points in the string */
730
+ function CodePointCount$1(value) {
731
+ let result = 0, index = 0, prev = 0;
732
+ while (index < value.length) {
733
+ const next = value.charCodeAt(index++) >> 10;
734
+ result += +((prev << 8 | next) !== 13879);
735
+ prev = next;
736
+ }
375
737
  return result;
376
738
  }
377
- /** Returns true if some element satisfies the callback, short-circuiting on the first success */
378
- function Some(value, callback) {
379
- return value.some((value, index) => callback(value, index));
739
+ /** Returns true if the string length in Unicode code points is less than or equal to maxLength */
740
+ function IsMaxLength$1(value, maxLength) {
741
+ return value.length <= maxLength || value.length <= maxLength << 1 && CodePointCount$1(value) <= maxLength;
742
+ }
743
+ /** Returns true if the string length in Unicode code points is greater than or equal to minLength */
744
+ function IsMinLength$1(value, minLength) {
745
+ return value.length >= minLength << 1 || value.length >= minLength && CodePointCount$1(value) >= minLength;
746
+ }
747
+ //#endregion
748
+ //#region ../../../node_modules/.pnpm/typebox@1.4.2/node_modules/typebox/build/guard/guard.mjs
749
+ var guard_exports = /* @__PURE__ */ __exportAll({
750
+ CodePointCount: () => CodePointCount,
751
+ Counted: () => Counted,
752
+ Entries: () => Entries,
753
+ EntriesRegExp: () => EntriesRegExp,
754
+ Every: () => Every,
755
+ EveryAll: () => EveryAll,
756
+ GraphemeCount: () => GraphemeCount,
757
+ HasPropertyKey: () => HasPropertyKey,
758
+ IsArray: () => IsArray$1,
759
+ IsBigInt: () => IsBigInt$1,
760
+ IsBoolean: () => IsBoolean$2,
761
+ IsClassInstance: () => IsClassInstance,
762
+ IsConstructor: () => IsConstructor$1,
763
+ IsDeepEqual: () => IsDeepEqual,
764
+ IsEqual: () => IsEqual,
765
+ IsFunction: () => IsFunction$1,
766
+ IsGreaterEqualThan: () => IsGreaterEqualThan,
767
+ IsGreaterThan: () => IsGreaterThan,
768
+ IsInteger: () => IsInteger$1,
769
+ IsLessEqualThan: () => IsLessEqualThan,
770
+ IsLessThan: () => IsLessThan,
771
+ IsMaxLength: () => IsMaxLength,
772
+ IsMinLength: () => IsMinLength,
773
+ IsMultipleOf: () => IsMultipleOf,
774
+ IsNull: () => IsNull$1,
775
+ IsNumber: () => IsNumber$2,
776
+ IsObject: () => IsObject$1,
777
+ IsObjectNotArray: () => IsObjectNotArray,
778
+ IsString: () => IsString$2,
779
+ IsSymbol: () => IsSymbol$1,
780
+ IsUndefined: () => IsUndefined$1,
781
+ IsUnsafePropertyKey: () => IsUnsafePropertyKey,
782
+ IsValueLike: () => IsValueLike,
783
+ Keys: () => Keys$1,
784
+ ShiftLeft: () => ShiftLeft,
785
+ Some: () => Some,
786
+ SomeAll: () => SomeAll,
787
+ Symbols: () => Symbols,
788
+ Values: () => Values
789
+ });
790
+ /** Returns true if this value is an array */
791
+ function IsArray$1(value) {
792
+ return Array.isArray(value);
793
+ }
794
+ /** Returns true if this value is bigint */
795
+ function IsBigInt$1(value) {
796
+ return IsEqual(typeof value, "bigint");
797
+ }
798
+ /** Returns true if this value is a boolean */
799
+ function IsBoolean$2(value) {
800
+ return IsEqual(typeof value, "boolean");
801
+ }
802
+ /** Returns true if this value is a constructor */
803
+ function IsConstructor$1(value) {
804
+ if (IsUndefined$1(value) || !IsFunction$1(value)) return false;
805
+ const result = Function.prototype.toString.call(value);
806
+ if (/^class\s/.test(result)) return true;
807
+ if (/\[native code\]/.test(result)) return true;
808
+ return false;
809
+ }
810
+ /** Returns true if this value is a function */
811
+ function IsFunction$1(value) {
812
+ return IsEqual(typeof value, "function");
813
+ }
814
+ /** Returns true if this value is integer */
815
+ function IsInteger$1(value) {
816
+ return Number.isInteger(value);
817
+ }
818
+ /** Returns true if this value is null */
819
+ function IsNull$1(value) {
820
+ return IsEqual(value, null);
821
+ }
822
+ /** Returns true if this value is number */
823
+ function IsNumber$2(value) {
824
+ return Number.isFinite(value);
825
+ }
826
+ /** Returns true if this value is an object but not an array */
827
+ function IsObjectNotArray(value) {
828
+ return IsObject$1(value) && !IsArray$1(value);
829
+ }
830
+ /** Returns true if this value is an object */
831
+ function IsObject$1(value) {
832
+ return IsEqual(typeof value, "object") && !IsNull$1(value);
833
+ }
834
+ /** Returns true if this value is string */
835
+ function IsString$2(value) {
836
+ return IsEqual(typeof value, "string");
837
+ }
838
+ /** Returns true if this value is symbol */
839
+ function IsSymbol$1(value) {
840
+ return IsEqual(typeof value, "symbol");
841
+ }
842
+ /** Returns true if this value is undefined */
843
+ function IsUndefined$1(value) {
844
+ return IsEqual(value, void 0);
845
+ }
846
+ function IsEqual(left, right) {
847
+ return left === right;
848
+ }
849
+ function IsGreaterThan(left, right) {
850
+ return left > right;
851
+ }
852
+ function IsLessThan(left, right) {
853
+ return left < right;
854
+ }
855
+ function IsLessEqualThan(left, right) {
856
+ return left <= right;
857
+ }
858
+ function IsGreaterEqualThan(left, right) {
859
+ return left >= right;
860
+ }
861
+ function IsMultipleOf(dividend, divisor) {
862
+ if (IsBigInt$1(dividend) || IsBigInt$1(divisor)) return BigInt(dividend) % BigInt(divisor) === 0n;
863
+ const tolerance = 1e-10;
864
+ if (!IsNumber$2(dividend)) return true;
865
+ if (IsInteger$1(dividend) && 1 / divisor % 1 === 0) return true;
866
+ const mod = dividend % divisor;
867
+ return Math.min(Math.abs(mod), Math.abs(mod - divisor), Math.abs(mod + divisor)) < tolerance;
868
+ }
869
+ /** Returns true if the value appears to be an instance of a class. */
870
+ function IsClassInstance(value) {
871
+ if (!IsObject$1(value)) return false;
872
+ const proto = globalThis.Object.getPrototypeOf(value);
873
+ if (IsNull$1(proto)) return false;
874
+ return IsEqual(typeof proto.constructor, "function") && !(IsEqual(proto.constructor, globalThis.Object) || IsEqual(proto.constructor.name, "Object"));
875
+ }
876
+ function IsValueLike(value) {
877
+ return IsBigInt$1(value) || IsBoolean$2(value) || IsNull$1(value) || IsNumber$2(value) || IsString$2(value) || IsUndefined$1(value);
878
+ }
879
+ /** Returns the total number of visual grapheme clusters in the string. */
880
+ function GraphemeCount(value) {
881
+ return GraphemeCount$1(value);
882
+ }
883
+ /** Returns the total number of Unicode code points in the string. */
884
+ function CodePointCount(value) {
885
+ return CodePointCount$1(value);
886
+ }
887
+ /** Returns true if the string length in Unicode code points does not exceed maxLength */
888
+ function IsMaxLength(value, maxLength) {
889
+ return IsMaxLength$1(value, maxLength);
890
+ }
891
+ /** Returns true if the string length in Unicode code points is at least minLength */
892
+ function IsMinLength(value, minLength) {
893
+ return IsMinLength$1(value, minLength);
894
+ }
895
+ /** Returns true if every element from offset satisfies the callback, short-circuiting on the first failure */
896
+ function Every(value, offset, callback) {
897
+ return value.every((item, index) => index < offset || callback(item, index));
898
+ }
899
+ /** Returns true if every element from offset satisfies the callback, using exhaustive enumeration */
900
+ function EveryAll(value, offset, callback) {
901
+ let result = true;
902
+ value.forEach((item, index) => {
903
+ if (index >= offset && !callback(item, index)) result = false;
904
+ });
905
+ return result;
906
+ }
907
+ /** Returns true if some element satisfies the callback, short-circuiting on the first success */
908
+ function Some(value, callback) {
909
+ return value.some((value, index) => callback(value, index));
380
910
  }
381
911
  /** Returns true if some element satisfies the callback, using exhaustive enumeration */
382
912
  function SomeAll(value, callback) {
@@ -3489,46 +4019,6 @@ function Priority(types) {
3489
4019
  return Sort(types);
3490
4020
  }
3491
4021
  //#endregion
3492
- //#region ../../core/po-core/src/schemas/brain.ts
3493
- /** Bound and project untrusted descriptive manifests without carrying executable fields. */
3494
- function parsePoWebBrainMetadata(value) {
3495
- const record = (input) => input !== null && typeof input === "object" && !Array.isArray(input);
3496
- const text = (input) => typeof input === "string" && input.length <= 16384;
3497
- const identity = (input) => text(input) && input.trim().length > 0;
3498
- const scope = (input) => input === "global" || input === "workspace" || input === "session";
3499
- const list = (input) => Array.isArray(input) && input.length <= 4096;
3500
- if (!record(value) || value.version !== 1 || !list(value.slots) || !list(value.fills) || !list(value.diagnostics)) return void 0;
3501
- const slots = [];
3502
- const fills = [];
3503
- for (const slot of value.slots) {
3504
- if (!record(slot) || !identity(slot.name) || !scope(slot.scope) || slot.kind !== "data" && slot.kind !== "component" || slot.description !== void 0 && !text(slot.description) || slot.parent !== void 0 && !identity(slot.parent)) return void 0;
3505
- slots.push({
3506
- name: slot.name,
3507
- scope: slot.scope,
3508
- kind: slot.kind,
3509
- ...slot.description === void 0 ? {} : { description: slot.description },
3510
- ...slot.parent === void 0 ? {} : { parent: slot.parent }
3511
- });
3512
- }
3513
- for (const fill of value.fills) {
3514
- if (!record(fill) || !identity(fill.id) || !scope(fill.scope) || fill.slot !== null && !identity(fill.slot) || fill.placement !== "verified" && fill.placement !== "unverified" || fill.placement === "verified" && fill.slot === null) return void 0;
3515
- fills.push({
3516
- id: fill.id,
3517
- scope: fill.scope,
3518
- slot: fill.slot,
3519
- placement: fill.placement
3520
- });
3521
- }
3522
- if (!value.diagnostics.every(text)) return void 0;
3523
- const metadata = {
3524
- version: 1,
3525
- slots,
3526
- fills,
3527
- diagnostics: [...value.diagnostics]
3528
- };
3529
- return new TextEncoder().encode(JSON.stringify(metadata)).byteLength <= 1048576 ? metadata : void 0;
3530
- }
3531
- //#endregion
3532
4022
  //#region ../../core/po-core/src/schemas/config.ts
3533
4023
  /**
3534
4024
  * Configuration surfaces, contributed by every extension that owns settings.
@@ -3741,247 +4231,29 @@ _Object_({
3741
4231
  sections: _Array_(ConfigSectionSchema, { maxItems: 32 })
3742
4232
  }, { additionalProperties: false });
3743
4233
  //#endregion
3744
- //#region ../../core/po-core/src/schemas/platform.ts
3745
- const PO_FS_SERVICE = "po/fs";
3746
- const PO_SHELL_SERVICE = "po/shell";
3747
- const PO_SQLITE_SERVICE = "po/sqlite";
3748
- const PO_SESSION_STORAGE_SERVICE = "po/session-storage";
3749
- const PO_ISOLATE_SERVICE = "po/isolate";
3750
- const PO_NPM_SERVICE = "po/npm";
3751
- const PO_ELECTRON_SERVICE = "po/electron";
3752
- const PO_BROWSER_SERVICE = "po/browser";
3753
- const PO_PROVIDER_AUTH_SERVICE = "po/provider-auth";
3754
- function readPoFs(context) {
3755
- return context.get(PO_FS_SERVICE);
3756
- }
3757
- function requirePoFs(context) {
3758
- const service = readPoFs(context);
3759
- if (!service) throw new Error(`The '${PO_FS_SERVICE}' service is unavailable. Start a Po server first.`);
3760
- return service;
4234
+ //#region ../../../node_modules/.pnpm/@deepseek-ai+cosmokit@1.8.6/node_modules/@deepseek-ai/cosmokit/lib/index.js
4235
+ /** Return true when a value is `null` or `undefined`. */
4236
+ function isNullable(value) {
4237
+ return value === null || value === void 0;
3761
4238
  }
3762
- function requirePoSqlite(context) {
3763
- const service = context.get(PO_SQLITE_SERVICE);
3764
- if (!service) throw new Error(`The '${PO_SQLITE_SERVICE}' service is unavailable. Start a Po server first.`);
3765
- return service;
4239
+ /** Define a non-enumerable writable property and return the object. */
4240
+ function defineProperty(object, key, value) {
4241
+ return Object.defineProperty(object, key, {
4242
+ writable: true,
4243
+ value,
4244
+ enumerable: false
4245
+ });
3766
4246
  }
3767
- function readPoNpm(context) {
3768
- return context.get(PO_NPM_SERVICE);
4247
+ /** Test values using `instanceof` with a `toStringTag` fallback. */
4248
+ function is(type, value) {
4249
+ if (arguments.length === 1) return (value) => is(type, value);
4250
+ return type in globalThis && value instanceof globalThis[type] || Object.prototype.toString.call(value).slice(8, -1) === type;
3769
4251
  }
3770
- function readPoBrowser(context) {
3771
- return context.get(PO_BROWSER_SERVICE);
4252
+ function isArrayBufferLike(value) {
4253
+ return is("ArrayBuffer", value) || is("SharedArrayBuffer", value);
3772
4254
  }
3773
- function readPoIsolate(context) {
3774
- return context.get(PO_ISOLATE_SERVICE);
3775
- }
3776
- //#endregion
3777
- //#region ../../core/po-core/src/schemas/hostServiceContracts.ts
3778
- /** Public host capabilities. Their owning scope is the actual host binding, not a new lifetime. */
3779
- const PO_HOST_SERVICE_CONTRACTS = [
3780
- {
3781
- name: PO_FS_SERVICE,
3782
- description: "Read and change files through the current host filesystem."
3783
- },
3784
- {
3785
- name: PO_SHELL_SERVICE,
3786
- description: "Run commands through the current host shell capability."
3787
- },
3788
- {
3789
- name: PO_SQLITE_SERVICE,
3790
- description: "Open SQLite databases through the current host implementation."
3791
- },
3792
- {
3793
- name: PO_CONFIG_SERVICE,
3794
- description: "Read the configuration admitted for this session."
3795
- },
3796
- {
3797
- name: PO_SESSION_STORAGE_SERVICE,
3798
- description: "Read and persist session data through the host storage."
3799
- },
3800
- {
3801
- name: PO_ISOLATE_SERVICE,
3802
- description: "Run scripts in the isolate implementation supplied by the host."
3803
- }
3804
- ];
3805
- Object.fromEntries(Object.entries({
3806
- home: {
3807
- slot: "home",
3808
- scope: "global",
3809
- description: "Typed Home content and launch contributions.",
3810
- kind: "data"
3811
- },
3812
- homeApps: {
3813
- slot: "home-apps",
3814
- scope: "global",
3815
- description: "Plugin cards on Home. Set data.column to side for the narrow column.",
3816
- parent: "home",
3817
- kind: "component"
3818
- },
3819
- dashboardTiles: {
3820
- slot: "dashboard-tiles",
3821
- scope: "global",
3822
- description: "Host-framed body-only tiles on Home and workspace dashboards.",
3823
- kind: "component"
3824
- },
3825
- homeAttention: {
3826
- slot: "home-attention",
3827
- scope: "global",
3828
- description: "Plugin-framed Home cards for things waiting on the person.",
3829
- parent: "home",
3830
- kind: "component"
3831
- },
3832
- overlay: {
3833
- slot: "overlay",
3834
- scope: "global",
3835
- description: "Overlays above the cockpit, such as a microphone dialog.",
3836
- kind: "component"
3837
- },
3838
- rail: {
3839
- slot: "rail",
3840
- scope: "global",
3841
- description: "Navigation items in the cockpit rail.",
3842
- kind: "component"
3843
- },
3844
- context: {
3845
- slot: "context",
3846
- scope: "global",
3847
- description: "Context panels beside the session conversation.",
3848
- kind: "component"
3849
- },
3850
- selectionBar: {
3851
- slot: "selection-bar",
3852
- scope: "global",
3853
- description: "Actions for the current text selection.",
3854
- kind: "component"
3855
- },
3856
- activity: {
3857
- slot: "activity",
3858
- scope: "global",
3859
- description: "Session activity panels, with explicit child slots for activity groups.",
3860
- kind: "component"
3861
- },
3862
- activityPromo: {
3863
- slot: "activity-promo",
3864
- scope: "global",
3865
- description: "Compact actions inside the activity promo card, such as Explore.",
3866
- parent: "activity",
3867
- kind: "component"
3868
- },
3869
- composerActions: {
3870
- slot: "composer-actions",
3871
- scope: "global",
3872
- description: "Action controls beside the session composer.",
3873
- kind: "component"
3874
- },
3875
- composerMenu: {
3876
- slot: "composer-menu",
3877
- scope: "global",
3878
- description: "Items in the session composer menu.",
3879
- kind: "component"
3880
- },
3881
- dialogPrompt: {
3882
- slot: "dialog-prompt",
3883
- scope: "global",
3884
- description: "Typed data fills that claim a dialog independently of a tool card.",
3885
- kind: "data"
3886
- },
3887
- sessionMenu: {
3888
- slot: "session-menu",
3889
- scope: "global",
3890
- description: "Items in the session menu.",
3891
- kind: "component"
3892
- },
3893
- newSession: {
3894
- slot: "new-session",
3895
- scope: "global",
3896
- description: "A workspace fill replacing the host new-session dialog.",
3897
- kind: "component"
3898
- },
3899
- page: {
3900
- slot: "page",
3901
- scope: "global",
3902
- description: "A full page at /page/<fill id> in the main area beside the sidebar.",
3903
- kind: "component"
3904
- }
3905
- }).map(([key, declaration]) => [key, declaration.slot]));
3906
- //#endregion
3907
- //#region ../../core/po-core/src/schemas/serverPlugin.ts
3908
- /** The host service each scope level publishes for the packages installed into it. */
3909
- const PO_SERVER_HOST_SERVICE = "po/server-host";
3910
- function readPoServerHost(context) {
3911
- return context.get(PO_SERVER_HOST_SERVICE);
3912
- }
3913
- function requirePoServerHost(context) {
3914
- const service = readPoServerHost(context);
3915
- if (!service) throw new Error("The Po server host is unavailable. Start a Po server first.");
3916
- return service;
3917
- }
3918
- /** Read pure root metadata without initializing or mounting the root. */
3919
- function composeServerProviderOverrides(...roots) {
3920
- return (context) => roots.flatMap((root) => {
3921
- if (typeof root !== "function" && typeof root !== "object" || root === null) return [];
3922
- const callback = root.providerOverrides;
3923
- return typeof callback === "function" ? callback(context) : [];
3924
- });
3925
- }
3926
- /** Capture schema inference before heterogeneous methods enter a contribution array. */
3927
- function defineServerMethod(definition, handler) {
3928
- return { register: (host) => host.registerMethod(definition, handler) };
3929
- }
3930
- //#endregion
3931
- //#region ../../core/po-core/src/schemas/globalServices.ts
3932
- const PO_GLOBAL_SERVICES_SERVICE = "po/global-services";
3933
- defineServiceContract(PO_GLOBAL_SERVICES_SERVICE, { scope: "global" });
3934
- /** Longest a package factory (server plugin apply, MCP session, Pi factory) may take. */
3935
- const LIVE_FACTORY_TIMEOUT_MS = 1e4;
3936
- /**
3937
- * Bounds one host-awaited step of package code.
3938
- *
3939
- * The abandoned promise keeps running, because a module cannot be cancelled; its late
3940
- * rejection is observed here so it never surfaces as an unhandled rejection.
3941
- */
3942
- function withTimeout(work, ms, label) {
3943
- let timer;
3944
- const timeout = new Promise((_, reject) => {
3945
- timer = setTimeout(() => reject(/* @__PURE__ */ new Error(`${label} timed out after ${String(ms)} ms`)), ms);
3946
- timer.unref?.();
3947
- });
3948
- work.catch(() => void 0);
3949
- return Promise.race([work, timeout]).finally(() => clearTimeout(timer));
3950
- }
3951
- /** Imports a live package URL under a timeout, skipping and recording poisoned URLs. */
3952
- async function guardedImport(url, importer, guard) {
3953
- if (guard.poisoned?.has(url)) throw new Error("skipped: this package content failed to load earlier and retries only after it changes");
3954
- try {
3955
- return await withTimeout(Promise.resolve().then(() => importer(url)), guard.importTimeoutMs ?? 15e3, "import");
3956
- } catch (error) {
3957
- guard.poisoned?.add(url);
3958
- throw error;
3959
- }
3960
- }
3961
- //#endregion
3962
- //#region ../../../node_modules/.pnpm/@deepseek-ai+cosmokit@1.8.6/node_modules/@deepseek-ai/cosmokit/lib/index.js
3963
- /** Return true when a value is `null` or `undefined`. */
3964
- function isNullable(value) {
3965
- return value === null || value === void 0;
3966
- }
3967
- /** Define a non-enumerable writable property and return the object. */
3968
- function defineProperty(object, key, value) {
3969
- return Object.defineProperty(object, key, {
3970
- writable: true,
3971
- value,
3972
- enumerable: false
3973
- });
3974
- }
3975
- /** Test values using `instanceof` with a `toStringTag` fallback. */
3976
- function is(type, value) {
3977
- if (arguments.length === 1) return (value) => is(type, value);
3978
- return type in globalThis && value instanceof globalThis[type] || Object.prototype.toString.call(value).slice(8, -1) === type;
3979
- }
3980
- function isArrayBufferLike(value) {
3981
- return is("ArrayBuffer", value) || is("SharedArrayBuffer", value);
3982
- }
3983
- function isArrayBufferSource(value) {
3984
- return isArrayBufferLike(value) || ArrayBuffer.isView(value);
4255
+ function isArrayBufferSource(value) {
4256
+ return isArrayBufferLike(value) || ArrayBuffer.isView(value);
3985
4257
  }
3986
4258
  /** Binary source detection and base64/hex conversion helpers. */
3987
4259
  var Binary;
@@ -5817,661 +6089,392 @@ var Context = class Context {
5817
6089
  *
5818
6090
  * @param meta — own properties (including symbol keys) to define on the child.
5819
6091
  * @returns a child context inheriting from this one.
5820
- */
5821
- extend(meta = {}) {
5822
- const shadow = Reflect.getOwnPropertyDescriptor(this, symbols.shadow)?.value;
5823
- const self = Object.create(getTraceable(this, this));
5824
- for (const prop of Reflect.ownKeys(meta)) Object.defineProperty(self, prop, Reflect.getOwnPropertyDescriptor(meta, prop));
5825
- if (!shadow) return self;
5826
- return Object.assign(Object.create(self), { [symbols.shadow]: shadow });
5827
- }
5828
- /**
5829
- * Create a child context with an independent service scope for `name`.
5830
- *
5831
- * Below the returned context, reads and writes of the service `name`
5832
- * resolve against the new label instead of the parent's, so a different
5833
- * implementation can be provided without affecting the parent scope.
5834
- * Passing the same `label` to two `isolate()` calls joins their scopes.
5835
- *
5836
- * @param name — the service name to isolate.
5837
- * @param label — scope label to join; defaults to a fresh unique symbol.
5838
- * @returns a child context whose `name` service resolves in the new scope.
5839
- */
5840
- isolate(name, label) {
5841
- const shadow = Object.create(this[symbols.isolate]);
5842
- shadow[name] = label ?? Symbol(name);
5843
- return this.extend({ [symbols.isolate]: shadow });
5844
- }
5845
- intercept(name, config) {
5846
- const intercept = Object.create(this[symbols.intercept]);
5847
- intercept[name] = config;
5848
- return this.extend({ [symbols.intercept]: intercept });
5849
- }
5850
- };
5851
- /**
5852
- * Base class for services that expose a named API on `ctx`.
5853
- *
5854
- * Subclasses call `super(ctx, name)` from their constructor. The service is
5855
- * registered immediately and is automatically removed with the owning fiber.
5856
- */
5857
- var Service = class Service {
5858
- ctx;
5859
- /** Symbol key of an instance method run after construction (class plugins). */
5860
- static init = symbols.init;
5861
- /** Symbol key of the availability predicate passed to `ctx.provide()`. */
5862
- static check = symbols.check;
5863
- /** Symbol key of the phantom intercept-config type parameter. */
5864
- static config = symbols.config;
5865
- /** Symbol key of the call body making a service callable (e.g. `ctx.logger()`). */
5866
- static invoke = symbols.invoke;
5867
- /** Symbol key of the helper deriving an extended service instance. */
5868
- static extend = symbols.extend;
5869
- /** Symbol key of the tracker metadata used for context tracing. */
5870
- static tracker = symbols.tracker;
5871
- /** Symbol key of the intercept-config resolution helper below. */
5872
- static resolveConfig = symbols.resolveConfig;
5873
- /** The service name this instance is registered under. */
5874
- name;
5875
- /**
5876
- * Register this instance as `name` in the current context.
5877
- *
5878
- * Calls `ctx.reflect.provide(name, this, this[Service.check])`, so the
5879
- * service is unregistered automatically when the owning fiber unloads.
5880
- * Services with a `[Service.invoke]` body return a callable instance.
5881
- *
5882
- * @param ctx — the context to register in (stored as `this.ctx`).
5883
- * @param name — the service name; defaults to the static `provide` field.
5884
- */
5885
- constructor(ctx, name) {
5886
- this.ctx = ctx;
5887
- name ??= this.constructor["provide"];
5888
- let self = this;
5889
- const tracker = {
5890
- associate: name,
5891
- property: "ctx"
5892
- };
5893
- if (self[symbols.invoke]) self = createCallable(name, joinPrototype(Object.getPrototypeOf(this), Function.prototype), tracker);
5894
- self.ctx = ctx;
5895
- self.name = name;
5896
- defineProperty(self, symbols.tracker, tracker);
5897
- self.ctx.reflect.provide(name, self, this[symbols.check]);
5898
- return self;
5899
- }
5900
- [symbols.filter](ctx) {
5901
- return ctx[symbols.isolate][this.name] === this.ctx[symbols.isolate][this.name];
5902
- }
5903
- [symbols.extend](props) {
5904
- let self;
5905
- if (this[Service.invoke]) self = createCallable(this.name, this, this[symbols.tracker]);
5906
- else self = Object.create(this);
5907
- return Object.assign(self, props);
5908
- }
5909
- /**
5910
- * Merge intercept config from ancestors with optional base and head values.
5911
- *
5912
- * Entries added closer to the root apply first; `base` is prepended and
5913
- * `head` appended. Uses `Config.merge` when the service declares one,
5914
- * otherwise a shallow `Object.assign`.
5915
- *
5916
- * @param base — lowest-precedence config merged before all intercepts.
5917
- * @param head — highest-precedence config merged after all intercepts.
5918
- * @returns the merged config.
5919
- */
5920
- [symbols.resolveConfig](base, head) {
5921
- let intercept = this.ctx[Context.intercept];
5922
- const configs = [];
5923
- while (this.name in intercept) {
5924
- if (Object.hasOwn(intercept, this.name)) configs.unshift(intercept[this.name]);
5925
- intercept = Object.getPrototypeOf(intercept);
5926
- }
5927
- if (base) configs.unshift(base);
5928
- if (head) configs.push(head);
5929
- if (this["Config"]?.merge) return this["Config"].merge(...configs);
5930
- else return Object.assign({}, ...configs);
5931
- }
5932
- static [Symbol.hasInstance](instance) {
5933
- if (!instance) return false;
5934
- let constructor = instance.constructor;
5935
- while (constructor) {
5936
- constructor = constructor.prototype?.constructor;
5937
- if (constructor === this) return true;
5938
- constructor &&= Object.getPrototypeOf(constructor);
5939
- }
5940
- return false;
5941
- }
5942
- };
5943
- //#endregion
5944
- //#region ../../core/po-core/src/schemas/headless.ts
5945
- /** Session-only contributions. This is not a Pi ExtensionAPI or a TUI adapter. */
5946
- const PO_HEADLESS_HOST_SERVICE = "po/headless-host";
5947
- const PO_HEADLESS_OWNER = Symbol.for("po/headless-owner");
5948
- const PROMPT_ADMISSION_ERROR = "PoHeadlessPromptAdmissionError";
5949
- /** Admission is a host boundary, not an advisory package-hook failure. */
5950
- var PoHeadlessPromptAdmissionError = class extends Error {
5951
- constructor(cause) {
5952
- super(cause instanceof Error ? cause.message : String(cause), { cause });
5953
- this.name = PROMPT_ADMISSION_ERROR;
5954
- }
5955
- };
5956
- const SESSION_SETUP_ERROR = "PoSessionSetupError";
5957
- /**
5958
- * A session cannot start until the user fixes their setup, such as configuring a model.
5959
- *
5960
- * Its message is written for the user and says what to do, so a server returns it as is
5961
- * rather than hiding it behind a generic internal error.
5962
- */
5963
- var PoSessionSetupError = class extends Error {
5964
- constructor(message) {
5965
- super(message);
5966
- this.name = SESSION_SETUP_ERROR;
5967
- }
5968
- };
5969
- /** Error identity must survive independently bundled server and extension graphs. */
5970
- function isPoHeadlessPromptAdmissionError(error) {
5971
- return error instanceof Error && error.name === PROMPT_ADMISSION_ERROR;
5972
- }
5973
- const TOOL_BUSY_ERROR = "PoHeadlessToolBusyError";
5974
- /** The tool and its hooks have not started. */
5975
- var PoHeadlessToolBusyError = class extends Error {
5976
- constructor() {
5977
- super("An operation is already running");
5978
- this.name = TOOL_BUSY_ERROR;
5979
- }
5980
- };
5981
- function readPoHeadlessOwner(context) {
5982
- return context[PO_HEADLESS_OWNER];
5983
- }
5984
- let crcTable;
5985
- function crc32(bytes, start, end) {
5986
- if (crcTable === void 0) {
5987
- crcTable = /* @__PURE__ */ new Uint32Array(256);
5988
- for (let n = 0; n < 256; n++) {
5989
- let c = n;
5990
- for (let k = 0; k < 8; k++) c = c & 1 ? 3988292384 ^ c >>> 1 : c >>> 1;
5991
- crcTable[n] = c >>> 0;
5992
- }
5993
- }
5994
- let crc = 4294967295;
5995
- for (let i = start; i < end; i++) crc = crcTable[(crc ^ bytes[i]) & 255] ^ crc >>> 8;
5996
- return (crc ^ 4294967295) >>> 0;
5997
- }
5998
- const PNG_SIGNATURE = [
5999
- 137,
6000
- 80,
6001
- 78,
6002
- 71,
6003
- 13,
6004
- 10,
6005
- 26,
6006
- 10
6007
- ];
6008
- function startsWith(bytes, prefix, offset = 0) {
6009
- return prefix.every((byte, index) => bytes[offset + index] === byte);
6010
- }
6011
- /** Why the model API would reject this image, or undefined when it looks decodable. Only png, jpeg, gif and webp are checked. */
6012
- function invalidImageReason(data, mimeType) {
6013
- let bytes;
6014
- try {
6015
- bytes = Uint8Array.from(atob(data), (char) => char.charCodeAt(0));
6016
- } catch {
6017
- return "the data is not valid base64";
6018
- }
6019
- if (mimeType === "image/png") {
6020
- if (!startsWith(bytes, PNG_SIGNATURE)) return "the data is not a PNG";
6021
- const view = new DataView(bytes.buffer);
6022
- let offset = 8;
6023
- while (offset + 12 <= bytes.length) {
6024
- const length = view.getUint32(offset);
6025
- const end = offset + 8 + length;
6026
- if (end + 4 > bytes.length) break;
6027
- if (crc32(bytes, offset + 4, end) !== view.getUint32(end)) return "a PNG chunk failed its checksum";
6028
- if (startsWith(bytes, [
6029
- 73,
6030
- 69,
6031
- 78,
6032
- 68
6033
- ], offset + 4)) return void 0;
6034
- offset = end + 4;
6035
- }
6036
- return "the PNG is truncated";
6037
- }
6038
- if (mimeType === "image/jpeg") return startsWith(bytes, [255, 216]) ? void 0 : "the data is not a JPEG";
6039
- if (mimeType === "image/gif") return startsWith(bytes, [
6040
- 71,
6041
- 73,
6042
- 70,
6043
- 56
6044
- ]) ? void 0 : "the data is not a GIF";
6045
- if (mimeType === "image/webp") return startsWith(bytes, [
6046
- 82,
6047
- 73,
6048
- 70,
6049
- 70
6050
- ]) && startsWith(bytes, [
6051
- 87,
6052
- 69,
6053
- 66,
6054
- 80
6055
- ], 8) ? void 0 : "the data is not a WebP";
6056
- }
6057
- /** Keeps valid images and swaps an undecodable one for a text note, since one bad image fails the whole turn and every later one. */
6058
- function dropInvalidImages(content) {
6059
- return content.map((part) => {
6060
- if (part.type !== "image") return part;
6061
- const reason = invalidImageReason(part.data, part.mimeType);
6062
- return reason === void 0 ? part : {
6063
- type: "text",
6064
- text: `[image omitted: ${reason}]`
6065
- };
6066
- });
6067
- }
6068
- /** Visibility controls model discovery only, never admission for external execution. */
6069
- function isPoHeadlessToolModelVisible(tool) {
6070
- const visibility = tool._meta?.ui?.visibility;
6071
- return visibility === void 0 || visibility.includes("model");
6072
- }
6073
- /** Session skill discovery tools, adapted to the size of the active catalog. */
6074
- const PO_LOAD_SKILL_TOOL = "load_skill";
6075
- const PO_SEARCH_SKILLS_TOOL = "search_skills";
6076
- function readPoHeadlessHost(context) {
6077
- return context.get(PO_HEADLESS_HOST_SERVICE);
6078
- }
6079
- //#endregion
6080
- //#region ../../../node_modules/.pnpm/@earendil-works+chord@1.5.0_esbuild@0.28.2/node_modules/@earendil-works/chord/dist/json.js
6081
- const DATA_DESCRIPTOR = {
6082
- value: void 0,
6083
- writable: true,
6084
- enumerable: true,
6085
- configurable: true
6086
- };
6087
- /** Copy a value into an alias-free strict-JSON tree owned by the caller. */
6088
- function copyJson(value, options) {
6089
- return copy(value, void 0, options?.omitUndefinedProperties === true);
6090
- }
6091
- function copy(value, ancestors, omitUndefinedProperties) {
6092
- if (value === null || typeof value === "string" || typeof value === "boolean") return value;
6093
- if (typeof value === "number") {
6094
- if (Number.isFinite(value)) return value;
6095
- throw new TypeError("Value contains a non-finite number and is not strict JSON");
6096
- }
6097
- if (typeof value !== "object") throw new TypeError(`Value contains a non-JSON ${typeof value}; expected strict JSON`);
6098
- const active = ancestors ?? /* @__PURE__ */ new Set();
6099
- if (active.has(value)) throw new TypeError("Value contains cycles and is not strict JSON");
6100
- active.add(value);
6101
- try {
6102
- if (Array.isArray(value)) {
6103
- if (Object.getPrototypeOf(value) !== Array.prototype || Reflect.ownKeys(value).length !== value.length + 1) throw new TypeError("Value must contain strict JSON dense plain arrays");
6104
- const result = new Array(value.length);
6105
- for (let index = 0; index < value.length; index++) {
6106
- const descriptor = Object.getOwnPropertyDescriptor(value, index);
6107
- if (descriptor === void 0 || !descriptor.enumerable || !("value" in descriptor)) throw new TypeError("Value must contain strict JSON enumerable indexed data properties");
6108
- defineData(result, String(index), copy(descriptor.value, active, omitUndefinedProperties));
6109
- }
6110
- return result;
6111
- }
6112
- const prototype = Object.getPrototypeOf(value);
6113
- if (prototype !== Object.prototype && prototype !== null) throw new TypeError("Value must contain strict JSON plain objects or arrays");
6114
- const result = Object.create(prototype);
6115
- for (const key of Reflect.ownKeys(value)) {
6116
- if (typeof key === "symbol") throw new TypeError("Value contains a symbol key and is not strict JSON");
6117
- const descriptor = Object.getOwnPropertyDescriptor(value, key);
6118
- if (!descriptor.enumerable || !("value" in descriptor)) throw new TypeError("Value must contain strict JSON enumerable data properties");
6119
- if (descriptor.value === void 0 && omitUndefinedProperties) continue;
6120
- defineData(result, key, copy(descriptor.value, active, omitUndefinedProperties));
6121
- }
6122
- return result;
6123
- } finally {
6124
- active.delete(value);
6125
- }
6126
- }
6127
- function defineData(target, key, value) {
6128
- DATA_DESCRIPTOR.value = value;
6129
- Object.defineProperty(target, key, DATA_DESCRIPTOR);
6130
- DATA_DESCRIPTOR.value = void 0;
6131
- }
6132
- //#endregion
6133
- //#region ../../../node_modules/.pnpm/@earendil-works+pi-durable@1.5.0_patch_hash=0f5e595daa4c370af407284d99d6dba48a9e21f56aa_fbb51180c4b193ec70152883060baa79/node_modules/@earendil-works/pi-durable/dist/ids.js
6134
- /** Apply an erased ID brand at a trusted numeric allocation or decoding boundary. */
6135
- function idFromNumber(value) {
6136
- return value;
6137
- }
6138
- /** Apply the erased commit-sequence brand at a trusted storage boundary. */
6139
- function seqFromNumber(value) {
6140
- return value;
6141
- }
6142
- //#endregion
6143
- //#region ../../../node_modules/.pnpm/@earendil-works+pi-durable@1.5.0_patch_hash=0f5e595daa4c370af407284d99d6dba48a9e21f56aa_fbb51180c4b193ec70152883060baa79/node_modules/@earendil-works/pi-durable/dist/documents.js
6144
- function defineDoc(definition) {
6145
- validateDefinition(definition);
6146
- return { definition };
6147
- }
6148
- function defineDocFamily(definition) {
6149
- validateDefinition(definition);
6150
- return { definition };
6151
- }
6152
- function validateDefinition(definition) {
6153
- if (!Number.isSafeInteger(definition.version) || definition.version < 1) throw new TypeError(`Document ${definition.kind} version must be a positive integer`);
6154
- }
6155
- /** Resolve an overloaded argument list and return the index after the owner and family key. */
6156
- function resolveAddress(definition, args) {
6157
- let index = 0;
6158
- let scope;
6159
- switch (definition.scope) {
6160
- case "session":
6161
- scope = { kind: "session" };
6162
- break;
6163
- case "conversation":
6164
- scope = {
6165
- kind: "conversation",
6166
- conversationId: ownerId(args[index++], definition)
6167
- };
6168
- break;
6169
- case "task": scope = {
6170
- kind: "task",
6171
- taskId: ownerId(args[index++], definition)
6172
- };
6173
- }
6174
- const key = definition.family === true ? args[index++] : void 0;
6175
- const address = key === void 0 ? {
6176
- kind: definition.kind,
6177
- scope
6178
- } : {
6179
- kind: definition.kind,
6180
- scope,
6181
- key
6182
- };
6183
- return {
6184
- address,
6185
- id: addressId(address),
6186
- nextArgument: index
6187
- };
6188
- }
6189
- function ownerId(value, definition) {
6190
- if (typeof value !== "number" || !Number.isSafeInteger(value)) throw new TypeError(`Document ${definition.kind} requires a ${definition.scope} ID`);
6191
- return idFromNumber(value);
6192
- }
6193
- /** Stable string identity of one logical address. */
6194
- function addressId(address) {
6195
- const owner = address.scope.kind === "session" ? null : address.scope.kind === "conversation" ? address.scope.conversationId : address.scope.taskId;
6196
- return JSON.stringify([
6197
- address.kind,
6198
- address.scope.kind,
6199
- owner,
6200
- address.key ?? null
6201
- ]);
6202
- }
6203
- /** Build the storage create record for a new incarnation at an address. */
6204
- function documentCreate(definition, address, id) {
6205
- const key = address.key === void 0 ? {} : { key: address.key };
6206
- switch (address.scope.kind) {
6207
- case "session": return {
6208
- id,
6209
- kind: address.kind,
6210
- ...key,
6211
- scope: address.scope
6212
- };
6213
- case "task": return {
6214
- id,
6215
- kind: address.kind,
6216
- ...key,
6217
- scope: address.scope
6218
- };
6219
- case "conversation": return {
6220
- id,
6221
- kind: address.kind,
6222
- ...key,
6223
- scope: address.scope,
6224
- history: definition.history,
6225
- fork: definition.fork
6226
- };
6227
- }
6228
- }
6229
- /** Reject typed access whose token disagrees with the persisted scope, history, or fork semantics. */
6230
- function checkRecordScope(definition, record) {
6231
- if (record.scope.kind !== definition.scope || record.scope.kind === "conversation" && (record.history !== definition.history || record.fork !== definition.fork)) throw new TypeError(`Document ${record.id} (${record.kind}) does not match the supplied definition semantics`);
6232
- }
6233
- /** Reject typed access to a stored version the supplied definition cannot use. */
6234
- function checkRecordVersion(definition, record, version) {
6235
- if (version > definition.version) throw new Error(`Document ${record.id} (${record.kind}) has newer version ${version} than ${definition.version}`);
6236
- if (version < definition.version && definition.migrate === void 0) throw new Error(`Document ${record.id} (${record.kind}) requires migration from version ${version}`);
6237
- }
6238
- /** Validate and materialize a detached stored value for typed access. */
6239
- function materializeDocument(definition, stored) {
6240
- return materializeDocumentValue(definition, stored.record, stored.version, stored.value);
6241
- }
6242
- /** Validate and materialize one detached value before its first persisted incarnation. */
6243
- function materializeDocumentValue(definition, record, version, value) {
6244
- checkRecordScope(definition, record);
6245
- checkRecordVersion(definition, record, version);
6246
- if (version === definition.version) return value;
6247
- return copyJson(definition.migrate(value, version));
6248
- }
6249
- //#endregion
6250
- //#region ../../core/po-core/src/services/durableSession/docs.ts
6251
- /** Public string identity belongs to Po, not the durable numeric ID namespace. */
6252
- const SessionIdentityDoc = defineDoc({
6253
- kind: "po.session.identity",
6254
- checkpointWhen: () => false,
6255
- version: 1,
6256
- scope: "session",
6257
- initial: () => ({
6258
- id: "",
6259
- createdAt: 0,
6260
- parentSessionId: ""
6261
- })
6262
- });
6263
- const SessionMetadataDoc = defineDoc({
6264
- kind: "po.session.metadata",
6265
- checkpointWhen: () => false,
6266
- version: 1,
6267
- scope: "session",
6268
- initial: () => ({
6269
- name: "",
6270
- workspaceRoot: "",
6271
- execution: "",
6272
- laneName: "main",
6273
- groups: []
6274
- })
6275
- });
6276
- const FastModeDoc = defineDoc({
6277
- kind: "po.fast-mode",
6278
- checkpointWhen: () => false,
6279
- version: 1,
6280
- scope: "session",
6281
- initial: () => ({ enabled: false })
6282
- });
6283
- const AgentLockDoc = defineDoc({
6284
- kind: "po.agent-lock",
6285
- checkpointWhen: () => false,
6286
- version: 1,
6287
- scope: "session",
6288
- initial: () => ({ locked: false })
6289
- });
6290
- const LabelsDoc = defineDoc({
6291
- kind: "po.labels",
6292
- checkpointWhen: () => false,
6293
- version: 1,
6294
- scope: "session",
6295
- initial: () => ({ labels: {} })
6296
- });
6092
+ */
6093
+ extend(meta = {}) {
6094
+ const shadow = Reflect.getOwnPropertyDescriptor(this, symbols.shadow)?.value;
6095
+ const self = Object.create(getTraceable(this, this));
6096
+ for (const prop of Reflect.ownKeys(meta)) Object.defineProperty(self, prop, Reflect.getOwnPropertyDescriptor(meta, prop));
6097
+ if (!shadow) return self;
6098
+ return Object.assign(Object.create(self), { [symbols.shadow]: shadow });
6099
+ }
6100
+ /**
6101
+ * Create a child context with an independent service scope for `name`.
6102
+ *
6103
+ * Below the returned context, reads and writes of the service `name`
6104
+ * resolve against the new label instead of the parent's, so a different
6105
+ * implementation can be provided without affecting the parent scope.
6106
+ * Passing the same `label` to two `isolate()` calls joins their scopes.
6107
+ *
6108
+ * @param name — the service name to isolate.
6109
+ * @param label — scope label to join; defaults to a fresh unique symbol.
6110
+ * @returns a child context whose `name` service resolves in the new scope.
6111
+ */
6112
+ isolate(name, label) {
6113
+ const shadow = Object.create(this[symbols.isolate]);
6114
+ shadow[name] = label ?? Symbol(name);
6115
+ return this.extend({ [symbols.isolate]: shadow });
6116
+ }
6117
+ intercept(name, config) {
6118
+ const intercept = Object.create(this[symbols.intercept]);
6119
+ intercept[name] = config;
6120
+ return this.extend({ [symbols.intercept]: intercept });
6121
+ }
6122
+ };
6297
6123
  /**
6298
- * Profile identity entries of one conversation, written in the identity entry's commit, so a transcript page finds
6299
- * the avatar in effect without scanning backwards. Rewindable with `asOf` forks: a fork keeps only the identities
6300
- * written before its fork point. Sessions written before this document have no entries and show the default avatar.
6124
+ * Base class for services that expose a named API on `ctx`.
6125
+ *
6126
+ * Subclasses call `super(ctx, name)` from their constructor. The service is
6127
+ * registered immediately and is automatically removed with the owning fiber.
6301
6128
  */
6302
- const IdentityHistoryDoc = defineDoc({
6303
- kind: "po.identity-history",
6304
- checkpointWhen: () => false,
6305
- version: 1,
6306
- scope: "conversation",
6307
- history: "rewindable",
6308
- fork: "asOf",
6309
- initial: () => ({ items: [] })
6310
- });
6311
- //#endregion
6312
- //#region ../../../node_modules/.pnpm/@earendil-works+pi-durable@1.5.0_patch_hash=0f5e595daa4c370af407284d99d6dba48a9e21f56aa_fbb51180c4b193ec70152883060baa79/node_modules/@earendil-works/pi-durable/dist/env/index.js
6313
- function ok(value) {
6314
- return {
6315
- ok: true,
6316
- value
6317
- };
6318
- }
6319
- function err(error) {
6320
- return {
6321
- ok: false,
6322
- error
6323
- };
6324
- }
6325
- function getOrThrow(result) {
6326
- if (!result.ok) throw result.error;
6327
- return result.value;
6328
- }
6329
- var FileError = class extends Error {
6330
- code;
6331
- path;
6332
- constructor(code, message, path, cause) {
6333
- super(message, cause === void 0 ? void 0 : { cause });
6334
- this.name = "FileError";
6335
- this.code = code;
6336
- this.path = path;
6129
+ var Service = class Service {
6130
+ ctx;
6131
+ /** Symbol key of an instance method run after construction (class plugins). */
6132
+ static init = symbols.init;
6133
+ /** Symbol key of the availability predicate passed to `ctx.provide()`. */
6134
+ static check = symbols.check;
6135
+ /** Symbol key of the phantom intercept-config type parameter. */
6136
+ static config = symbols.config;
6137
+ /** Symbol key of the call body making a service callable (e.g. `ctx.logger()`). */
6138
+ static invoke = symbols.invoke;
6139
+ /** Symbol key of the helper deriving an extended service instance. */
6140
+ static extend = symbols.extend;
6141
+ /** Symbol key of the tracker metadata used for context tracing. */
6142
+ static tracker = symbols.tracker;
6143
+ /** Symbol key of the intercept-config resolution helper below. */
6144
+ static resolveConfig = symbols.resolveConfig;
6145
+ /** The service name this instance is registered under. */
6146
+ name;
6147
+ /**
6148
+ * Register this instance as `name` in the current context.
6149
+ *
6150
+ * Calls `ctx.reflect.provide(name, this, this[Service.check])`, so the
6151
+ * service is unregistered automatically when the owning fiber unloads.
6152
+ * Services with a `[Service.invoke]` body return a callable instance.
6153
+ *
6154
+ * @param ctx — the context to register in (stored as `this.ctx`).
6155
+ * @param name — the service name; defaults to the static `provide` field.
6156
+ */
6157
+ constructor(ctx, name) {
6158
+ this.ctx = ctx;
6159
+ name ??= this.constructor["provide"];
6160
+ let self = this;
6161
+ const tracker = {
6162
+ associate: name,
6163
+ property: "ctx"
6164
+ };
6165
+ if (self[symbols.invoke]) self = createCallable(name, joinPrototype(Object.getPrototypeOf(this), Function.prototype), tracker);
6166
+ self.ctx = ctx;
6167
+ self.name = name;
6168
+ defineProperty(self, symbols.tracker, tracker);
6169
+ self.ctx.reflect.provide(name, self, this[symbols.check]);
6170
+ return self;
6337
6171
  }
6338
- };
6339
- var ExecutionError = class extends Error {
6340
- code;
6341
- /** Spill file of a command that timed out or was aborted after its output crossed the spill thresholds. */
6342
- spillPath;
6343
- constructor(code, message, cause) {
6344
- super(message, cause === void 0 ? void 0 : { cause });
6345
- this.name = "ExecutionError";
6346
- this.code = code;
6172
+ [symbols.filter](ctx) {
6173
+ return ctx[symbols.isolate][this.name] === this.ctx[symbols.isolate][this.name];
6174
+ }
6175
+ [symbols.extend](props) {
6176
+ let self;
6177
+ if (this[Service.invoke]) self = createCallable(this.name, this, this[symbols.tracker]);
6178
+ else self = Object.create(this);
6179
+ return Object.assign(self, props);
6347
6180
  }
6348
- };
6349
- //#endregion
6350
- //#region ../../core/po-core/src/services/nodeHost/index.edge.ts
6351
- const EMPTY_ENVIRONMENT = Object.freeze({});
6352
- /** The edge host: one Durable Object, its virtual filesystem laid out as in po-cloudflare's DoFileSystem. */
6353
- const nodeHost = {
6354
- homeDirectory: () => "/home/po",
6355
- temporaryDirectory: () => "/tmp",
6356
- /** A Durable Object is one logical process. */
6357
- processId: () => 1,
6358
6181
  /**
6359
- * Empty: the Worker's `process.env` holds its deployment vars and secrets, never a session's.
6360
- * Sessions receive their admitted environment explicitly.
6182
+ * Merge intercept config from ancestors with optional base and head values.
6183
+ *
6184
+ * Entries added closer to the root apply first; `base` is prepended and
6185
+ * `head` appended. Uses `Config.merge` when the service declares one,
6186
+ * otherwise a shallow `Object.assign`.
6187
+ *
6188
+ * @param base — lowest-precedence config merged before all intercepts.
6189
+ * @param head — highest-precedence config merged after all intercepts.
6190
+ * @returns the merged config.
6361
6191
  */
6362
- environment: () => EMPTY_ENVIRONMENT,
6363
- setMode: async (_filePath, _mode) => void 0,
6364
- /** No modes on the edge, so callers skip their permission checks, as `setMode` does. */
6365
- fileMode: async (_filePath) => void 0
6192
+ [symbols.resolveConfig](base, head) {
6193
+ let intercept = this.ctx[Context.intercept];
6194
+ const configs = [];
6195
+ while (this.name in intercept) {
6196
+ if (Object.hasOwn(intercept, this.name)) configs.unshift(intercept[this.name]);
6197
+ intercept = Object.getPrototypeOf(intercept);
6198
+ }
6199
+ if (base) configs.unshift(base);
6200
+ if (head) configs.push(head);
6201
+ if (this["Config"]?.merge) return this["Config"].merge(...configs);
6202
+ else return Object.assign({}, ...configs);
6203
+ }
6204
+ static [Symbol.hasInstance](instance) {
6205
+ if (!instance) return false;
6206
+ let constructor = instance.constructor;
6207
+ while (constructor) {
6208
+ constructor = constructor.prototype?.constructor;
6209
+ if (constructor === this) return true;
6210
+ constructor &&= Object.getPrototypeOf(constructor);
6211
+ }
6212
+ return false;
6213
+ }
6366
6214
  };
6367
6215
  //#endregion
6368
- //#region ../../core/po-core/src/services/serialRunner/index.ts
6369
- /** Runs operations one at a time in call order; a rejection reaches its caller and never stalls the queue. */
6370
- function createSerialRunner() {
6371
- let tail = Promise.resolve();
6372
- const tails = /* @__PURE__ */ new Map();
6373
- const run = (operation) => {
6374
- const result = tail.then(operation);
6375
- tail = result.catch(() => void 0);
6376
- return result;
6377
- };
6378
- const forKey = (key) => (operation) => {
6379
- const result = (tails.get(key) ?? Promise.resolve()).then(operation);
6380
- const settled = result.catch(() => void 0);
6381
- tails.set(key, settled);
6382
- settled.then(() => {
6383
- if (tails.get(key) === settled) tails.delete(key);
6216
+ //#region ../../core/po-core/src/schemas/brain.ts
6217
+ /** Bound and project untrusted descriptive manifests without carrying executable fields. */
6218
+ function parsePoWebBrainMetadata(value) {
6219
+ const record = (input) => input !== null && typeof input === "object" && !Array.isArray(input);
6220
+ const text = (input) => typeof input === "string" && input.length <= 16384;
6221
+ const identity = (input) => text(input) && input.trim().length > 0;
6222
+ const scope = (input) => input === "global" || input === "workspace" || input === "session";
6223
+ const list = (input) => Array.isArray(input) && input.length <= 4096;
6224
+ if (!record(value) || value.version !== 1 || !list(value.slots) || !list(value.fills) || !list(value.diagnostics)) return void 0;
6225
+ const slots = [];
6226
+ const fills = [];
6227
+ for (const slot of value.slots) {
6228
+ if (!record(slot) || !identity(slot.name) || !scope(slot.scope) || slot.kind !== "data" && slot.kind !== "component" || slot.description !== void 0 && !text(slot.description) || slot.parent !== void 0 && !identity(slot.parent)) return void 0;
6229
+ slots.push({
6230
+ name: slot.name,
6231
+ scope: slot.scope,
6232
+ kind: slot.kind,
6233
+ ...slot.description === void 0 ? {} : { description: slot.description },
6234
+ ...slot.parent === void 0 ? {} : { parent: slot.parent }
6384
6235
  });
6385
- return result;
6236
+ }
6237
+ for (const fill of value.fills) {
6238
+ if (!record(fill) || !identity(fill.id) || !scope(fill.scope) || fill.slot !== null && !identity(fill.slot) || fill.placement !== "verified" && fill.placement !== "unverified" || fill.placement === "verified" && fill.slot === null) return void 0;
6239
+ fills.push({
6240
+ id: fill.id,
6241
+ scope: fill.scope,
6242
+ slot: fill.slot,
6243
+ placement: fill.placement
6244
+ });
6245
+ }
6246
+ if (!value.diagnostics.every(text)) return void 0;
6247
+ const metadata = {
6248
+ version: 1,
6249
+ slots,
6250
+ fills,
6251
+ diagnostics: [...value.diagnostics]
6386
6252
  };
6387
- return Object.assign(run, { forKey });
6253
+ return new TextEncoder().encode(JSON.stringify(metadata)).byteLength <= 1048576 ? metadata : void 0;
6254
+ }
6255
+ //#endregion
6256
+ //#region ../../core/po-core/src/schemas/hostServiceContracts.ts
6257
+ /** Public host capabilities. Their owning scope is the actual host binding, not a new lifetime. */
6258
+ const PO_HOST_SERVICE_CONTRACTS = [
6259
+ {
6260
+ name: PO_FS_SERVICE,
6261
+ description: "Read and change files through the current host filesystem."
6262
+ },
6263
+ {
6264
+ name: PO_SHELL_SERVICE,
6265
+ description: "Run commands through the current host shell capability."
6266
+ },
6267
+ {
6268
+ name: PO_SQLITE_SERVICE,
6269
+ description: "Open SQLite databases through the current host implementation."
6270
+ },
6271
+ {
6272
+ name: PO_CONFIG_SERVICE,
6273
+ description: "Read the configuration admitted for this session."
6274
+ },
6275
+ {
6276
+ name: PO_SESSION_STORAGE_SERVICE,
6277
+ description: "Read and persist session data through the host storage."
6278
+ },
6279
+ {
6280
+ name: PO_ISOLATE_SERVICE,
6281
+ description: "Run scripts in the isolate implementation supplied by the host."
6282
+ }
6283
+ ];
6284
+ //#endregion
6285
+ //#region ../../core/po-core/src/schemas/serverPlugin.ts
6286
+ /** The host service each scope level publishes for the packages installed into it. */
6287
+ const PO_SERVER_HOST_SERVICE = "po/server-host";
6288
+ function readPoServerHost(context) {
6289
+ return context.get(PO_SERVER_HOST_SERVICE);
6290
+ }
6291
+ function requirePoServerHost(context) {
6292
+ const service = readPoServerHost(context);
6293
+ if (!service) throw new Error("The Po server host is unavailable. Start a Po server first.");
6294
+ return service;
6295
+ }
6296
+ /** Read pure root metadata without initializing or mounting the root. */
6297
+ function composeServerProviderOverrides(...roots) {
6298
+ return (context) => roots.flatMap((root) => {
6299
+ if (typeof root !== "function" && typeof root !== "object" || root === null) return [];
6300
+ const callback = root.providerOverrides;
6301
+ return typeof callback === "function" ? callback(context) : [];
6302
+ });
6303
+ }
6304
+ /** Capture schema inference before heterogeneous methods enter a contribution array. */
6305
+ function defineServerMethod(definition, handler) {
6306
+ return { register: (host) => host.registerMethod(definition, handler) };
6388
6307
  }
6389
- /** Cooperating API writers share this queue, keyed by the canonical target path. Not an OS file lock. */
6390
- const fileMutationRunner = createSerialRunner();
6391
6308
  //#endregion
6392
- //#region ../../core/po-core/src/services/piSettings/core.ts
6309
+ //#region ../../core/po-core/src/schemas/globalServices.ts
6310
+ const PO_GLOBAL_SERVICES_SERVICE = "po/global-services";
6311
+ defineServiceContract(PO_GLOBAL_SERVICES_SERVICE, { scope: "global" });
6312
+ /** Longest a package factory (server plugin apply, MCP session, Pi factory) may take. */
6313
+ const LIVE_FACTORY_TIMEOUT_MS = 1e4;
6393
6314
  /**
6394
- * Pi's user settings, as `po sync` maintains them.
6315
+ * Bounds one host-awaited step of package code.
6395
6316
  *
6396
- * The Po package is registered globally so a plain `pi` process can find the
6397
- * lightweight package bootstrap before project resources are trusted. Sync owns
6398
- * the extension registration, ambient-discovery filter, theme resource, selected default theme, and quiet-startup keys
6399
- * while preserving every unrelated user setting.
6400
- */
6401
- const PI_CODING_AGENT_DIR_ENV = "PI_CODING_AGENT_DIR";
6402
- /** Moves Po's whole home, agent directory included, away from `~/.po`. */
6403
- const PO_HOME_ENV = "PO_HOME";
6404
- /** The agent folder inside a Po or Pi home. */
6405
- const AGENT_DIRECTORY = "agent";
6406
- const HOME_ALIAS = "~";
6407
- const HOME_ALIAS_PREFIX = "~/";
6408
- /**
6409
- * Expands `~` and resolves a relative path against home, never the cwd, so every
6410
- * Po process lands on the same directory wherever it was started.
6317
+ * The abandoned promise keeps running, because a module cannot be cancelled; its late
6318
+ * rejection is observed here so it never surfaces as an unhandled rejection.
6411
6319
  */
6412
- function resolveConfiguredDirectory(configured, homeDirectory) {
6413
- if (configured === HOME_ALIAS) return homeDirectory;
6414
- if (configured.startsWith(HOME_ALIAS_PREFIX)) return path.join(homeDirectory, configured.slice(2));
6415
- return path.resolve(homeDirectory, configured);
6320
+ function withTimeout(work, ms, label) {
6321
+ let timer;
6322
+ const timeout = new Promise((_, reject) => {
6323
+ timer = setTimeout(() => reject(/* @__PURE__ */ new Error(`${label} timed out after ${String(ms)} ms`)), ms);
6324
+ timer.unref?.();
6325
+ });
6326
+ work.catch(() => void 0);
6327
+ return Promise.race([work, timeout]).finally(() => clearTimeout(timer));
6416
6328
  }
6417
- /**
6418
- * Po's home: config, workspaces, runtime registry and its Pi agent directory.
6419
- * Defaults to `~/.po`; `PO_HOME` moves all of it.
6420
- */
6421
- function poHomeDirectory(homeDirectory = nodeHost.homeDirectory(), environment = nodeHost.environment()) {
6422
- const configured = environment[PO_HOME_ENV]?.trim();
6423
- return configured ? resolveConfiguredDirectory(configured, homeDirectory) : path.join(homeDirectory, ".po");
6329
+ /** Imports a live package URL under a timeout, skipping and recording poisoned URLs. */
6330
+ async function guardedImport(url, importer, guard) {
6331
+ if (guard.poisoned?.has(url)) throw new Error("skipped: this package content failed to load earlier and retries only after it changes");
6332
+ try {
6333
+ return await withTimeout(Promise.resolve().then(() => importer(url)), guard.importTimeoutMs ?? 15e3, "import");
6334
+ } catch (error) {
6335
+ guard.poisoned?.add(url);
6336
+ throw error;
6337
+ }
6424
6338
  }
6339
+ //#endregion
6340
+ //#region ../../core/po-core/src/schemas/headless.ts
6341
+ /** Session-only contributions. This is not a Pi ExtensionAPI or a TUI adapter. */
6342
+ const PO_HEADLESS_HOST_SERVICE = "po/headless-host";
6343
+ const PO_HEADLESS_OWNER = Symbol.for("po/headless-owner");
6344
+ const PROMPT_ADMISSION_ERROR = "PoHeadlessPromptAdmissionError";
6345
+ /** Admission is a host boundary, not an advisory package-hook failure. */
6346
+ var PoHeadlessPromptAdmissionError = class extends Error {
6347
+ constructor(cause) {
6348
+ super(cause instanceof Error ? cause.message : String(cause), { cause });
6349
+ this.name = PROMPT_ADMISSION_ERROR;
6350
+ }
6351
+ };
6352
+ const SESSION_SETUP_ERROR = "PoSessionSetupError";
6425
6353
  /**
6426
- * The Pi agent directory Po runs with. Honors Pi's documented override; every Po
6427
- * entry point sets that override, so the default only applies to library callers.
6354
+ * A session cannot start until the user fixes their setup, such as configuring a model.
6355
+ *
6356
+ * Its message is written for the user and says what to do, so a server returns it as is
6357
+ * rather than hiding it behind a generic internal error.
6428
6358
  */
6429
- function piAgentDirectory(environment = nodeHost.environment(), homeDirectory = nodeHost.homeDirectory()) {
6430
- const configured = environment[PI_CODING_AGENT_DIR_ENV]?.trim();
6431
- if (!configured) return path.join(poHomeDirectory(homeDirectory, environment), AGENT_DIRECTORY);
6432
- return resolveConfiguredDirectory(configured, homeDirectory);
6359
+ var PoSessionSetupError = class extends Error {
6360
+ constructor(message) {
6361
+ super(message);
6362
+ this.name = SESSION_SETUP_ERROR;
6363
+ }
6364
+ };
6365
+ /** Error identity must survive independently bundled server and extension graphs. */
6366
+ function isPoHeadlessPromptAdmissionError(error) {
6367
+ return error instanceof Error && error.name === PROMPT_ADMISSION_ERROR;
6433
6368
  }
6434
- createSerialRunner();
6435
- //#endregion
6436
- //#region ../../core/po-core/src/services/sessionFiles/sessionDirectory.edge.ts
6437
- /** The Durable Object filesystem is already isolated to its owning session. */
6438
- async function prepareSessionDirectory(platform, directory) {
6439
- const fs = platform.env(platform.homeDirectory);
6440
- try {
6441
- getOrThrow(await fs.createDir(directory, { recursive: true }, BACKGROUND_CONTEXT));
6442
- return directory;
6443
- } finally {
6444
- await fs.cleanup(BACKGROUND_CONTEXT);
6369
+ const TOOL_BUSY_ERROR = "PoHeadlessToolBusyError";
6370
+ /** The tool and its hooks have not started. */
6371
+ var PoHeadlessToolBusyError = class extends Error {
6372
+ constructor() {
6373
+ super("An operation is already running");
6374
+ this.name = TOOL_BUSY_ERROR;
6445
6375
  }
6376
+ };
6377
+ function isPoHeadlessToolBusyError(error) {
6378
+ return error instanceof Error && error.name === TOOL_BUSY_ERROR;
6446
6379
  }
6447
- //#endregion
6448
- //#region ../../core/po-core/src/services/sessionFiles/index.ts
6449
- const PO_SESSION_TEMP_DIR = "PO_SESSION_TEMP_DIR";
6450
- const PO_SESSION_FILES_SERVICE = "po/session-files";
6451
- /** A host-owned path, never a client-selected root or an inherited parent session path. */
6452
- function sessionTempDirectory(options) {
6453
- if (!/^[a-zA-Z0-9_-]+$/u.test(options.sessionId)) throw new Error("Invalid temporary-file session identity.");
6454
- if (!path.isAbsolute(options.temporaryDirectory)) throw new Error("The host temporary directory must be absolute.");
6455
- const namespace = createHash("sha256").update(options.homeDirectory).update("\0").update(poHomeDirectory(options.homeDirectory, options.environment)).digest("hex").slice(0, 24);
6456
- return path.join(options.temporaryDirectory, `po-${namespace}`, "sessions", options.sessionId);
6380
+ function readPoHeadlessOwner(context) {
6381
+ return context[PO_HEADLESS_OWNER];
6457
6382
  }
6458
- /** Both the execution host and package APIs call this with their admitted session identity. */
6459
- async function prepareSessionEnvironment(input) {
6460
- const environment = { ...input.environment };
6461
- delete environment[PO_SESSION_TEMP_DIR];
6462
- if (input.platform.temporaryDirectory === void 0) return Object.freeze(environment);
6463
- const directory = sessionTempDirectory({
6464
- sessionId: input.sessionId,
6465
- homeDirectory: input.platform.homeDirectory,
6466
- environment,
6467
- temporaryDirectory: input.platform.temporaryDirectory
6468
- });
6469
- const preparedDirectory = await prepareSessionDirectory(input.platform, directory);
6470
- return Object.freeze({
6471
- ...environment,
6472
- [PO_SESSION_TEMP_DIR]: preparedDirectory
6383
+ let crcTable;
6384
+ function crc32(bytes, start, end) {
6385
+ if (crcTable === void 0) {
6386
+ crcTable = /* @__PURE__ */ new Uint32Array(256);
6387
+ for (let n = 0; n < 256; n++) {
6388
+ let c = n;
6389
+ for (let k = 0; k < 8; k++) c = c & 1 ? 3988292384 ^ c >>> 1 : c >>> 1;
6390
+ crcTable[n] = c >>> 0;
6391
+ }
6392
+ }
6393
+ let crc = 4294967295;
6394
+ for (let i = start; i < end; i++) crc = crcTable[(crc ^ bytes[i]) & 255] ^ crc >>> 8;
6395
+ return (crc ^ 4294967295) >>> 0;
6396
+ }
6397
+ const PNG_SIGNATURE = [
6398
+ 137,
6399
+ 80,
6400
+ 78,
6401
+ 71,
6402
+ 13,
6403
+ 10,
6404
+ 26,
6405
+ 10
6406
+ ];
6407
+ function startsWith(bytes, prefix, offset = 0) {
6408
+ return prefix.every((byte, index) => bytes[offset + index] === byte);
6409
+ }
6410
+ /** Why the model API would reject this image, or undefined when it looks decodable. Only png, jpeg, gif and webp are checked. */
6411
+ function invalidImageReason(data, mimeType) {
6412
+ let bytes;
6413
+ try {
6414
+ bytes = Uint8Array.from(atob(data), (char) => char.charCodeAt(0));
6415
+ } catch {
6416
+ return "the data is not valid base64";
6417
+ }
6418
+ if (mimeType === "image/png") {
6419
+ if (!startsWith(bytes, PNG_SIGNATURE)) return "the data is not a PNG";
6420
+ const view = new DataView(bytes.buffer);
6421
+ let offset = 8;
6422
+ while (offset + 12 <= bytes.length) {
6423
+ const length = view.getUint32(offset);
6424
+ const end = offset + 8 + length;
6425
+ if (end + 4 > bytes.length) break;
6426
+ if (crc32(bytes, offset + 4, end) !== view.getUint32(end)) return "a PNG chunk failed its checksum";
6427
+ if (startsWith(bytes, [
6428
+ 73,
6429
+ 69,
6430
+ 78,
6431
+ 68
6432
+ ], offset + 4)) return void 0;
6433
+ offset = end + 4;
6434
+ }
6435
+ return "the PNG is truncated";
6436
+ }
6437
+ if (mimeType === "image/jpeg") return startsWith(bytes, [255, 216]) ? void 0 : "the data is not a JPEG";
6438
+ if (mimeType === "image/gif") return startsWith(bytes, [
6439
+ 71,
6440
+ 73,
6441
+ 70,
6442
+ 56
6443
+ ]) ? void 0 : "the data is not a GIF";
6444
+ if (mimeType === "image/webp") return startsWith(bytes, [
6445
+ 82,
6446
+ 73,
6447
+ 70,
6448
+ 70
6449
+ ]) && startsWith(bytes, [
6450
+ 87,
6451
+ 69,
6452
+ 66,
6453
+ 80
6454
+ ], 8) ? void 0 : "the data is not a WebP";
6455
+ }
6456
+ /** Keeps valid images and swaps an undecodable one for a text note, since one bad image fails the whole turn and every later one. */
6457
+ function dropInvalidImages(content) {
6458
+ return content.map((part) => {
6459
+ if (part.type !== "image") return part;
6460
+ const reason = invalidImageReason(part.data, part.mimeType);
6461
+ return reason === void 0 ? part : {
6462
+ type: "text",
6463
+ text: `[image omitted: ${reason}]`
6464
+ };
6473
6465
  });
6474
6466
  }
6467
+ /** Visibility controls model discovery only, never admission for external execution. */
6468
+ function isPoHeadlessToolModelVisible(tool) {
6469
+ const visibility = tool._meta?.ui?.visibility;
6470
+ return visibility === void 0 || visibility.includes("model");
6471
+ }
6472
+ /** Session skill discovery tools, adapted to the size of the active catalog. */
6473
+ const PO_LOAD_SKILL_TOOL = "load_skill";
6474
+ const PO_SEARCH_SKILLS_TOOL = "search_skills";
6475
+ function readPoHeadlessHost(context) {
6476
+ return context.get(PO_HEADLESS_HOST_SERVICE);
6477
+ }
6475
6478
  //#endregion
6476
6479
  //#region ../../core/po-core/src/server/serverScope.ts
6477
6480
  /** What one plugin build shares in one tree: its keyed values, and what each scope running it holds. */
@@ -7283,4 +7286,4 @@ function deliver(scopes, name, args) {
7283
7286
  if (errors.length > 0) throw new AggregateError(errors, `${errors.length} scope listener(s) of '${name}' failed.`);
7284
7287
  }
7285
7288
  //#endregion
7286
- export { PO_SHELL_SERVICE as $, withoutAbortSignal as $n, IsOptional as $t, idFromNumber as A, IsLessEqualThan as An, Null as At, invalidImageReason as B, IsSymbol$1 as Bn, IsBoolean as Bt, checkRecordVersion as C, IsConstructor$1 as Cn, IsUnion as Ct, materializeDocument as D, IsGreaterEqualThan as Dn, IsNumber as Dt, documentCreate as E, IsFunction$1 as En, String$1 as Et, PO_SEARCH_SKILLS_TOOL as F, IsNull$1 as Fn, IsLiteralString as Ft, Service as G, Some as Gn, Intersect as Gt, isPoHeadlessToolModelVisible as H, IsUnsafePropertyKey as Hn, IsCodec as Ht, PoHeadlessPromptAdmissionError as I, IsNumber$2 as In, Literal as It, composeServerProviderOverrides as J, guard_exports as Jn, Unsafe as Jt, guardedImport as K, SomeAll as Kn, IsIntersect as Kt, PoHeadlessToolBusyError as L, IsObject$1 as Ln, Integer as Lt, copyJson as M, IsMaxLength as Mn, IsLiteralBigInt as Mt, PO_HEADLESS_HOST_SERVICE as N, IsMinLength as Nn, IsLiteralBoolean as Nt, materializeDocumentValue as O, IsGreaterThan as On, Number$1 as Ot, PO_LOAD_SKILL_TOOL as P, IsMultipleOf as Pn, IsLiteralNumber as Pt, PO_FS_SERVICE as Q, withTelemetry as Qn, _Object_ as Qt, PoSessionSetupError as R, IsObjectNotArray as Rn, IsInteger as Rt, checkRecordScope as S, IsClassInstance as Sn, Tuple as St, defineDocFamily as T, IsEqual as Tn, IsString as Tt, readPoHeadlessHost as U, IsValueLike as Un, Hash as Ut, isPoHeadlessPromptAdmissionError as V, IsUndefined$1 as Vn, IsBigInt as Vt, readPoHeadlessOwner as W, Keys$1 as Wn, Unreachable as Wt, requirePoServerHost as X, awaitWithContext as Xn, Unknown as Xt, defineServerMethod as Y, BACKGROUND_CONTEXT as Yn, IsCyclic as Yt, PO_BROWSER_SERVICE as Z, withAbortSignal as Zn, IsObject as Zt, IdentityHistoryDoc as _, EveryAll as _n, IsRecord as _t, piAgentDirectory as a, _Array_ as an, requirePoFs as at, SessionMetadataDoc as b, IsBigInt$1 as bn, RecordValue as bt, fileMutationRunner as c, Get as cn, Priority as ct, FileError as d, IsSet as dn, With as dt, Optional as en, PO_SERVER_SCOPE_LEVELS as er, PO_SQLITE_SERVICE as et, err as f, IsTypeArray as fn, Partial as ft, FastModeDoc as g, Every as gn, IsUndefined as gt, AgentLockDoc as h, EntriesRegExp as hn, IsVoid as ht, prepareSessionEnvironment as i, IsArray as in, requirePoServerScope as ir, readPoNpm as it, seqFromNumber as j, IsLessThan as jn, IsLiteral as jt, resolveAddress as k, IsInteger$1 as kn, IsNull as kt, nodeHost as l, IsMap as ln, Evaluate as lt, ok as m, Entries as mn, IsTemplateLiteral as mt, PO_SESSION_FILES_SERVICE as n, Ref as nn, defineServiceContract as nr, readPoFs as nt, poHomeDirectory as o, IsSchema as on, requirePoSqlite as ot, getOrThrow as p, Counted as pn, Omit as pt, PO_SERVER_HOST_SERVICE as q, Symbols as qn, IsEnum as qt, PO_SESSION_TEMP_DIR as r, ArrayOptions as rn, readPoServerScope as rr, readPoIsolate as rt, createSerialRunner as s, Assign as sn, PO_CONFIG_SERVICE as st, PoServerScope as t, IsRef as tn, PO_SERVER_SCOPE_SERVICE as tr, readPoBrowser as tt, ExecutionError as u, IsRegExp as un, Instantiate as ut, LabelsDoc as v, HasPropertyKey as vn, Record as vt, defineDoc as w, IsDeepEqual as wn, Union as wt, addressId as x, IsBoolean$2 as xn, IsTuple as xt, SessionIdentityDoc as y, IsArray$1 as yn, RecordPattern as yt, dropInvalidImages as z, IsString$2 as zn, Boolean$1 as zt };
7289
+ export { Boolean$1 as $, requirePoFs as $n, IsString$2 as $t, IsUndefined as A, checkRecordVersion as An, Every as At, String$1 as B, BACKGROUND_CONTEXT as Bn, IsFunction$1 as Bt, Evaluate as C, FastModeDoc as Cn, IsMap as Ct, Omit as D, SessionMetadataDoc as Dn, Counted as Dt, Partial as E, SessionIdentityDoc as En, IsTypeArray as Et, IsTuple as F, materializeDocumentValue as Fn, IsBoolean$2 as Ft, IsLiteral as G, PO_BROWSER_SERVICE as Gn, IsLessThan as Gt, Number$1 as H, withAbortSignal as Hn, IsGreaterThan as Ht, Tuple as I, resolveAddress as In, IsClassInstance as It, IsLiteralNumber as J, PO_SQLITE_SERVICE as Jn, IsMultipleOf as Jt, IsLiteralBigInt as K, PO_FS_SERVICE as Kn, IsMaxLength as Kt, IsUnion as L, idFromNumber as Ln, IsConstructor$1 as Lt, Record as M, defineDocFamily as Mn, HasPropertyKey as Mt, RecordPattern as N, documentCreate as Nn, IsArray$1 as Nt, IsTemplateLiteral as O, addressId as On, Entries as Ot, RecordValue as P, materializeDocument as Pn, IsBigInt$1 as Pt, IsInteger as Q, readPoNpm as Qn, IsObjectNotArray as Qt, Union as R, seqFromNumber as Rn, IsDeepEqual as Rt, Priority as S, AgentLockDoc as Sn, Get as St, With as T, LabelsDoc as Tn, IsSet as Tt, IsNull as U, withTelemetry as Un, IsInteger$1 as Ut, IsNumber as V, awaitWithContext as Vn, IsGreaterEqualThan as Vt, Null as W, withoutAbortSignal as Wn, IsLessEqualThan as Wt, Literal as X, readPoFs as Xn, IsNumber$2 as Xt, IsLiteralString as Y, readPoBrowser as Yn, IsNull$1 as Yt, Integer as Z, readPoIsolate as Zn, IsObject$1 as Zt, composeServerProviderOverrides as _, ExecutionError as _n, ArrayOptions as _t, PoHeadlessPromptAdmissionError as a, Some as an, requirePoServerScope as ar, Intersect as at, Service as b, getOrThrow as bn, IsSchema as bt, dropInvalidImages as c, guard_exports as cn, Unsafe as ct, isPoHeadlessToolBusyError as d, prepareSessionEnvironment as dn, IsObject as dt, IsSymbol$1 as en, requirePoSqlite as er, IsBoolean as et, isPoHeadlessToolModelVisible as f, piAgentDirectory as fn, _Object_ as ft, PO_SERVER_HOST_SERVICE as g, nodeHost as gn, Ref as gt, guardedImport as h, fileMutationRunner as hn, IsRef as ht, PO_SEARCH_SKILLS_TOOL as i, Keys$1 as in, readPoServerScope as ir, Unreachable as it, IsRecord as j, defineDoc as jn, EveryAll as jt, IsVoid as k, checkRecordScope as kn, EntriesRegExp as kt, invalidImageReason as l, PO_SESSION_FILES_SERVICE as ln, IsCyclic as lt, readPoHeadlessOwner as m, createSerialRunner as mn, Optional as mt, PO_HEADLESS_HOST_SERVICE as n, IsUnsafePropertyKey as nn, PO_SERVER_SCOPE_SERVICE as nr, IsCodec as nt, PoHeadlessToolBusyError as o, SomeAll as on, IsIntersect as ot, readPoHeadlessHost as p, poHomeDirectory as pn, IsOptional as pt, IsLiteralBoolean as q, PO_SHELL_SERVICE as qn, IsMinLength as qt, PO_LOAD_SKILL_TOOL as r, IsValueLike as rn, defineServiceContract as rr, Hash as rt, PoSessionSetupError as s, Symbols as sn, IsEnum as st, PoServerScope as t, IsUndefined$1 as tn, PO_SERVER_SCOPE_LEVELS as tr, IsBigInt as tt, isPoHeadlessPromptAdmissionError as u, PO_SESSION_TEMP_DIR as un, Unknown as ut, defineServerMethod as v, FileError as vn, IsArray as vt, Instantiate as w, IdentityHistoryDoc as wn, IsRegExp as wt, PO_CONFIG_SERVICE as x, ok as xn, Assign as xt, requirePoServerHost as y, err as yn, _Array_ as yt, IsString as z, copyJson as zn, IsEqual as zt };