@agimon-ai/po-cloudflare 0.0.2-alpha.11 → 0.0.2-alpha.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-DYFqCLl2.js +6850 -0
- package/dist/assets/plugins/assets/base-C3j1WCCq.css +2 -0
- package/dist/assets/plugins/chunks/po-web-runtime-Czm_C4SJ.js +1 -0
- package/dist/assets/plugins/compositions.json +1 -1
- package/dist/assets/plugins/slots/approval.8b3f37d9-CqQk6XG_.js +2 -0
- package/dist/assets/plugins/slots/artifacts.47d00f81-D-vQ-7Iz.js +1 -0
- package/dist/assets/plugins/slots/autocompact.9a92993d-B3KTYwW1.js +1 -0
- package/dist/assets/plugins/slots/builtin-tools.939bbfff-CZRYQVIP.js +7 -0
- package/dist/assets/plugins/slots/codemode.782e5bb1-Bzl_K_vt.js +10 -0
- package/dist/assets/plugins/slots/domain.21790b66-CvnpuKCY.js +1 -0
- package/dist/assets/plugins/slots/edit.c7c85129-kaxIknZ-.js +7 -0
- package/dist/assets/plugins/slots/files.bbcef824-wuB8gcQA.js +2 -0
- package/dist/assets/plugins/slots/grep.3dfd3214-3FnU8p-d.js +1 -0
- package/dist/assets/plugins/slots/log.33bc7d38-C0PXQ0O1.js +4 -0
- package/dist/assets/plugins/slots/mcp.59c68bcb-D0CkHnIw.js +109 -0
- package/dist/assets/plugins/slots/{profile.ab16dcec-B5yt7eny.js → profile.ea55f5e1-BSY3iYfJ.js} +1 -1
- package/dist/assets/plugins/slots/prompts.9957cc84-xdCkNkoA.js +3 -0
- package/dist/assets/plugins/slots/read.30a617e7-qqaxVlEX.js +1 -0
- package/dist/assets/plugins/slots/runner.9f3559b0-DfO2Z9HG.js +8 -0
- package/dist/assets/plugins/slots/skill.f506a5ea-CL_n-l4h.js +4 -0
- package/dist/assets/plugins/slots/vault.01657352-DbG3F_on.js +1 -0
- package/dist/{atomicJson-C_lN9leA.js → atomicJson-BF1fVXy1.js} +1 -1
- package/dist/browser-BWf8OMfl.js +3 -0
- package/dist/childSession-Cf2-kH4O.js +22 -0
- package/dist/{server-D190dXDN.js → dist-B-vqs6tA.js} +1 -546
- package/dist/{domains-CPX1dEVa.js → domains-Bl6T2dKV.js} +2 -2
- package/dist/{server-C5wixba6.js → esm-BKJy3O9-.js} +3 -296
- package/dist/{exports-2Vv52b9v.js → exports-CxkWsXI9.js} +7 -6
- package/dist/{exports-BF12Ftrd.js → exports-DlcCEAe3.js} +2 -9
- package/dist/{extensionFile-DpVvh-ud.js → extensionFile-D7wk8tFr.js} +11 -1
- package/dist/harnessStore-Bap8lsAg.js +1 -0
- package/dist/{harnessStore-Ct329wxJ.js → harnessStore-flLz1I0F.js} +2 -2
- package/dist/help-DjybmnPW.js +91 -0
- package/dist/{hubChannel-kFgtfJnv.js → hubChannel-Bi3PQrfD.js} +3 -27
- package/dist/hubRevisions-58pU2dW5.js +363 -0
- package/dist/index.edge-C9_xuXyy.js +57 -0
- package/dist/{index.edge-DhV_hfZA.js → index.edge-CJ2TFpgF.js} +2 -2
- package/dist/index.edge-COJJ_Dv2.js +937 -0
- package/dist/index.edge-ChYa2LU4.js +14 -0
- package/dist/index.edge-ClLTmPFz.js +191 -0
- package/dist/{index.edge-BNElrrHY.js → index.edge-uSjRpm6Z.js} +5 -0
- package/dist/iso-BPQViXM8.js +10 -0
- package/dist/{layeredConfig-BhFC6TBD.js → layeredConfig-B4s0eZ5o.js} +11 -4
- package/dist/{majorModes-CZqrWarh.js → majorModes-IygGmbb8.js} +2 -2
- package/dist/majorModes-xpLK9HpD.js +1 -0
- package/dist/notification-bGq1frYG.js +99 -0
- package/dist/piConfig-CcoMX-1L.js +127 -0
- package/dist/{platformFiles-BTDsAsmT.js → platformFiles-Ccj9HCvA.js} +24 -2
- package/dist/pluginContributions-Be9EnCAW.js +16 -0
- package/dist/sealedChannel-BeWNTWys.js +27 -0
- package/dist/server-4CmqIbH2.js +1476 -0
- package/dist/{server-DesPQYzJ.js → server-5vLvBTTs.js} +1 -1
- package/dist/server-BHhb0oir.js +505 -0
- package/dist/server-Bm6pAAw8.js +935 -0
- package/dist/server-C82Qzoh3.js +2658 -0
- package/dist/server-C8HyW7wN.js +489 -0
- package/dist/{server-DSusAvqK.js → server-C9gff7gU.js} +1 -1
- package/dist/{server-CTIkoJXM.js → server-CIhwIcbA.js} +4 -4
- package/dist/{server-DbmCxFL-.js → server-CMaTba5B.js} +1 -1
- package/dist/{server-DolHpEoY.js → server-COE7BKSa.js} +1 -1
- package/dist/server-CQXqMpeC.js +1744 -0
- package/dist/{server-BG6gwBcv.js → server-CTSvwoDy.js} +5 -4
- package/dist/server-C_34VM3M.js +217 -0
- package/dist/{server-CuGXhVFA.js → server-C_3jK2WM.js} +5 -5
- package/dist/server-CcNMwEFQ.js +190 -0
- package/dist/{server-D-zQp04y.js → server-CjsKNdSN.js} +1 -1
- package/dist/{server-DQy8hVXg.js → server-ClsNJwdv.js} +8 -8
- package/dist/{server-DfBHHyQo.js → server-Co57A8MH.js} +2 -9
- package/dist/{server-CRtXiNBP.js → server-CpJNq249.js} +5 -5
- package/dist/{server-zYYAg7ki.js → server-CxGGQFJs.js} +5 -16
- package/dist/{server-DpVsUiA-.js → server-DSu_uLDX.js} +4 -4
- package/dist/server-DeSuziRK.js +680 -0
- package/dist/{server-BIjpcE0Y.js → server-ZsazKk-n.js} +3 -3
- package/dist/{server-CZoHLCxk.js → server-il_s2Ycz.js} +5 -93
- package/dist/server-ziNfBZ2M.js +295 -0
- package/dist/{sessionConfig-BLmM5XLM.js → sessionConfig-DzAs6Pt-.js} +64 -499
- package/dist/{notification-qvyJJ_Df.js → telemetry-Csv1ZxAn.js} +1 -99
- package/dist/truncate-M3KbFyVj.js +89 -0
- package/dist/web-Cfvbn9H1.js +3 -0
- package/dist/worker.js +4545 -12244
- package/dist/workflow-w5JPZXgc.js +23 -0
- package/package.json +32 -24
- package/dist/assets/plugins/assets/base-_m1hGahv.css +0 -2
- package/dist/assets/plugins/chunks/po-web-runtime-CGjOl_1I.js +0 -1
- package/dist/assets/plugins/slots/approval.09e72f36-BW92gZQg.js +0 -2
- package/dist/assets/plugins/slots/artifacts.50b639bb-B6zDJhex.js +0 -1
- package/dist/assets/plugins/slots/builtin-tools.75108f21-DS-dJ07p.js +0 -7
- package/dist/assets/plugins/slots/codemode.c58fb583--t-nrGeQ.js +0 -10
- package/dist/assets/plugins/slots/domain.753f9f92-DWSqP3Jw.js +0 -1
- package/dist/assets/plugins/slots/mcp.82cc1ff5-jPY2OCuu.js +0 -109
- package/dist/assets/plugins/slots/skill.62a0a1b3-GtWLT33O.js +0 -4
- package/dist/assets/plugins/slots/vault.3cbfcdc3-B7BKfR_H.js +0 -1
- package/dist/harnessStore-BDI-s999.js +0 -1
- package/dist/majorModes-CzAWXyaf.js +0 -1
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { G as Service, Yn as BACKGROUND_CONTEXT,
|
|
2
|
-
import {
|
|
3
|
-
import "./approvalPrompt-1FPgNwMA.js";
|
|
1
|
+
import { G as Service, Yn as BACKGROUND_CONTEXT, l as nodeHost, p as getOrThrow, s as createSerialRunner, st as PO_CONFIG_SERVICE } from "./serverPlugin-pCqlBqQG.js";
|
|
2
|
+
import { i as readTextIfExists, s as writeFileAtomic } from "./platformFiles-Ccj9HCvA.js";
|
|
4
3
|
import { f as PROFILE_ICON_MIME_TYPES, n as PO_CONFIG_TRANSITION_ENTRY_TYPE, s as isTimeZone, t as PO_CONFIG_ENTRY_TYPE } from "./contextProjection-DlB6wzhm.js";
|
|
5
4
|
import "./platform-CyvF7X-b.js";
|
|
6
|
-
import {
|
|
7
|
-
import { _ as
|
|
8
|
-
import "./
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import { t as
|
|
5
|
+
import { t as createDirectoryWithMode } from "./atomicJson-BF1fVXy1.js";
|
|
6
|
+
import { _ as YAMLMap, a as globalPoConfigDirectory, b as isSeq, d as configScopeOf, f as parsePoConfig, h as stringify, l as repositoryPoConfigPath, m as parseDocument, n as poConfigCandidates, o as globalPoConfigPath, p as parse, t as readPoConfigSourcesAsync, v as isMap } from "./layeredConfig-B4s0eZ5o.js";
|
|
7
|
+
import { a as defaultDomainsForMajorMode, l as readPoConfig } from "./domains-Bl6T2dKV.js";
|
|
8
|
+
import { n as defineApiRoutes, t as apiResponse } from "./hubRevisions-58pU2dW5.js";
|
|
9
|
+
import "./web-Cfvbn9H1.js";
|
|
10
|
+
import { n as savePiImageSettingsAsync, r as DEFAULT_IMAGE_MAX_DIMENSION, t as readPiImageSettings } from "./piConfig-CcoMX-1L.js";
|
|
11
|
+
import { i as MODES_FILE, r as loadMajorModesConfig, t as readMajorModesConfig } from "./majorModes-IygGmbb8.js";
|
|
12
|
+
import { t as loadHarnessStateAsync } from "./harnessStore-flLz1I0F.js";
|
|
12
13
|
import path from "node:path";
|
|
13
14
|
import { Buffer as Buffer$1 } from "node:buffer";
|
|
14
15
|
//#region ../../foundations/po-config/src/services/config/sync.edge.ts
|
|
@@ -152,364 +153,6 @@ const SELECTION_KEYS = {
|
|
|
152
153
|
domains: ["selection", "domains"],
|
|
153
154
|
profile: ["selection", "profile"]
|
|
154
155
|
};
|
|
155
|
-
/** Identity with inference, so a route table keeps its literal types. */
|
|
156
|
-
function defineApiRoutes(routes) {
|
|
157
|
-
return routes;
|
|
158
|
-
}
|
|
159
|
-
//#endregion
|
|
160
|
-
//#region ../../../node_modules/.pnpm/@tanstack+store@0.11.2/node_modules/@tanstack/store/dist/alien.js
|
|
161
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
162
|
-
function createReactiveSystem({ update, notify, unwatched }) {
|
|
163
|
-
return {
|
|
164
|
-
link,
|
|
165
|
-
unlink,
|
|
166
|
-
propagate,
|
|
167
|
-
checkDirty,
|
|
168
|
-
shallowPropagate
|
|
169
|
-
};
|
|
170
|
-
function link(dep, sub, version) {
|
|
171
|
-
const prevDep = sub.depsTail;
|
|
172
|
-
if (prevDep !== void 0 && prevDep.dep === dep) return;
|
|
173
|
-
const nextDep = prevDep !== void 0 ? prevDep.nextDep : sub.deps;
|
|
174
|
-
if (nextDep !== void 0 && nextDep.dep === dep) {
|
|
175
|
-
nextDep.version = version;
|
|
176
|
-
sub.depsTail = nextDep;
|
|
177
|
-
return;
|
|
178
|
-
}
|
|
179
|
-
const prevSub = dep.subsTail;
|
|
180
|
-
if (prevSub !== void 0 && prevSub.version === version && prevSub.sub === sub) return;
|
|
181
|
-
const newLink = sub.depsTail = dep.subsTail = {
|
|
182
|
-
version,
|
|
183
|
-
dep,
|
|
184
|
-
sub,
|
|
185
|
-
prevDep,
|
|
186
|
-
nextDep,
|
|
187
|
-
prevSub,
|
|
188
|
-
nextSub: void 0
|
|
189
|
-
};
|
|
190
|
-
if (nextDep !== void 0) nextDep.prevDep = newLink;
|
|
191
|
-
if (prevDep !== void 0) prevDep.nextDep = newLink;
|
|
192
|
-
else sub.deps = newLink;
|
|
193
|
-
if (prevSub !== void 0) prevSub.nextSub = newLink;
|
|
194
|
-
else dep.subs = newLink;
|
|
195
|
-
}
|
|
196
|
-
function unlink(link, sub = link.sub) {
|
|
197
|
-
const dep = link.dep;
|
|
198
|
-
const prevDep = link.prevDep;
|
|
199
|
-
const nextDep = link.nextDep;
|
|
200
|
-
const nextSub = link.nextSub;
|
|
201
|
-
const prevSub = link.prevSub;
|
|
202
|
-
if (nextDep !== void 0) nextDep.prevDep = prevDep;
|
|
203
|
-
else sub.depsTail = prevDep;
|
|
204
|
-
if (prevDep !== void 0) prevDep.nextDep = nextDep;
|
|
205
|
-
else sub.deps = nextDep;
|
|
206
|
-
if (nextSub !== void 0) nextSub.prevSub = prevSub;
|
|
207
|
-
else dep.subsTail = prevSub;
|
|
208
|
-
if (prevSub !== void 0) prevSub.nextSub = nextSub;
|
|
209
|
-
else if ((dep.subs = nextSub) === void 0) unwatched(dep);
|
|
210
|
-
return nextDep;
|
|
211
|
-
}
|
|
212
|
-
function propagate(link) {
|
|
213
|
-
let next = link.nextSub;
|
|
214
|
-
let stack;
|
|
215
|
-
top: do {
|
|
216
|
-
const sub = link.sub;
|
|
217
|
-
let flags = sub.flags;
|
|
218
|
-
if (!(flags & 60)) sub.flags = flags | 32;
|
|
219
|
-
else if (!(flags & 12)) flags = 0;
|
|
220
|
-
else if (!(flags & 4)) sub.flags = flags & -9 | 32;
|
|
221
|
-
else if (!(flags & 48) && isValidLink(link, sub)) {
|
|
222
|
-
sub.flags = flags | 40;
|
|
223
|
-
flags &= 1;
|
|
224
|
-
} else flags = 0;
|
|
225
|
-
if (flags & 2) notify(sub);
|
|
226
|
-
if (flags & 1) {
|
|
227
|
-
const subSubs = sub.subs;
|
|
228
|
-
if (subSubs !== void 0) {
|
|
229
|
-
const nextSub = (link = subSubs).nextSub;
|
|
230
|
-
if (nextSub !== void 0) {
|
|
231
|
-
stack = {
|
|
232
|
-
value: next,
|
|
233
|
-
prev: stack
|
|
234
|
-
};
|
|
235
|
-
next = nextSub;
|
|
236
|
-
}
|
|
237
|
-
continue;
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
if ((link = next) !== void 0) {
|
|
241
|
-
next = link.nextSub;
|
|
242
|
-
continue;
|
|
243
|
-
}
|
|
244
|
-
while (stack !== void 0) {
|
|
245
|
-
link = stack.value;
|
|
246
|
-
stack = stack.prev;
|
|
247
|
-
if (link !== void 0) {
|
|
248
|
-
next = link.nextSub;
|
|
249
|
-
continue top;
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
break;
|
|
253
|
-
} while (true);
|
|
254
|
-
}
|
|
255
|
-
function checkDirty(link, sub) {
|
|
256
|
-
let stack;
|
|
257
|
-
let checkDepth = 0;
|
|
258
|
-
let dirty = false;
|
|
259
|
-
top: do {
|
|
260
|
-
const dep = link.dep;
|
|
261
|
-
const flags = dep.flags;
|
|
262
|
-
if (sub.flags & 16) dirty = true;
|
|
263
|
-
else if ((flags & 17) === 17) {
|
|
264
|
-
if (update(dep)) {
|
|
265
|
-
const subs = dep.subs;
|
|
266
|
-
if (subs.nextSub !== void 0) shallowPropagate(subs);
|
|
267
|
-
dirty = true;
|
|
268
|
-
}
|
|
269
|
-
} else if ((flags & 33) === 33) {
|
|
270
|
-
if (link.nextSub !== void 0 || link.prevSub !== void 0) stack = {
|
|
271
|
-
value: link,
|
|
272
|
-
prev: stack
|
|
273
|
-
};
|
|
274
|
-
link = dep.deps;
|
|
275
|
-
sub = dep;
|
|
276
|
-
++checkDepth;
|
|
277
|
-
continue;
|
|
278
|
-
}
|
|
279
|
-
if (!dirty) {
|
|
280
|
-
const nextDep = link.nextDep;
|
|
281
|
-
if (nextDep !== void 0) {
|
|
282
|
-
link = nextDep;
|
|
283
|
-
continue;
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
while (checkDepth--) {
|
|
287
|
-
const firstSub = sub.subs;
|
|
288
|
-
const hasMultipleSubs = firstSub.nextSub !== void 0;
|
|
289
|
-
if (hasMultipleSubs) {
|
|
290
|
-
link = stack.value;
|
|
291
|
-
stack = stack.prev;
|
|
292
|
-
} else link = firstSub;
|
|
293
|
-
if (dirty) {
|
|
294
|
-
if (update(sub)) {
|
|
295
|
-
if (hasMultipleSubs) shallowPropagate(firstSub);
|
|
296
|
-
sub = link.sub;
|
|
297
|
-
continue;
|
|
298
|
-
}
|
|
299
|
-
dirty = false;
|
|
300
|
-
} else sub.flags &= -33;
|
|
301
|
-
sub = link.sub;
|
|
302
|
-
const nextDep = link.nextDep;
|
|
303
|
-
if (nextDep !== void 0) {
|
|
304
|
-
link = nextDep;
|
|
305
|
-
continue top;
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
return dirty;
|
|
309
|
-
} while (true);
|
|
310
|
-
}
|
|
311
|
-
function shallowPropagate(link) {
|
|
312
|
-
do {
|
|
313
|
-
const sub = link.sub;
|
|
314
|
-
const flags = sub.flags;
|
|
315
|
-
if ((flags & 48) === 32) {
|
|
316
|
-
sub.flags = flags | 16;
|
|
317
|
-
if ((flags & 6) === 2) notify(sub);
|
|
318
|
-
}
|
|
319
|
-
} while ((link = link.nextSub) !== void 0);
|
|
320
|
-
}
|
|
321
|
-
function isValidLink(checkLink, sub) {
|
|
322
|
-
let link = sub.depsTail;
|
|
323
|
-
while (link !== void 0) {
|
|
324
|
-
if (link === checkLink) return true;
|
|
325
|
-
link = link.prevDep;
|
|
326
|
-
}
|
|
327
|
-
return false;
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
//#endregion
|
|
331
|
-
//#region ../../../node_modules/.pnpm/@tanstack+store@0.11.2/node_modules/@tanstack/store/dist/atom.js
|
|
332
|
-
function toObserver(nextHandler, errorHandler, completionHandler) {
|
|
333
|
-
const isObserver = typeof nextHandler === "object";
|
|
334
|
-
const self = isObserver ? nextHandler : void 0;
|
|
335
|
-
return {
|
|
336
|
-
next: (isObserver ? nextHandler.next : nextHandler)?.bind(self),
|
|
337
|
-
error: (isObserver ? nextHandler.error : errorHandler)?.bind(self),
|
|
338
|
-
complete: (isObserver ? nextHandler.complete : completionHandler)?.bind(self)
|
|
339
|
-
};
|
|
340
|
-
}
|
|
341
|
-
const queuedEffects = [];
|
|
342
|
-
let cycle = 0;
|
|
343
|
-
const { link, unlink, propagate, checkDirty, shallowPropagate } = /* @__PURE__ */ createReactiveSystem({
|
|
344
|
-
update(atom) {
|
|
345
|
-
return atom._update();
|
|
346
|
-
},
|
|
347
|
-
notify(effect) {
|
|
348
|
-
queuedEffects[queuedEffectsLength++] = effect;
|
|
349
|
-
effect.flags &= -3;
|
|
350
|
-
},
|
|
351
|
-
unwatched(atom) {
|
|
352
|
-
if (atom.depsTail !== void 0) {
|
|
353
|
-
atom.depsTail = void 0;
|
|
354
|
-
atom.flags = 17;
|
|
355
|
-
purgeDeps(atom);
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
});
|
|
359
|
-
let notifyIndex = 0;
|
|
360
|
-
let queuedEffectsLength = 0;
|
|
361
|
-
let activeSub;
|
|
362
|
-
function purgeDeps(sub) {
|
|
363
|
-
const depsTail = sub.depsTail;
|
|
364
|
-
let dep = depsTail !== void 0 ? depsTail.nextDep : sub.deps;
|
|
365
|
-
while (dep !== void 0) dep = unlink(dep, sub);
|
|
366
|
-
}
|
|
367
|
-
function flush() {
|
|
368
|
-
while (notifyIndex < queuedEffectsLength) {
|
|
369
|
-
const effect = queuedEffects[notifyIndex];
|
|
370
|
-
queuedEffects[notifyIndex++] = void 0;
|
|
371
|
-
effect.notify();
|
|
372
|
-
}
|
|
373
|
-
notifyIndex = 0;
|
|
374
|
-
queuedEffectsLength = 0;
|
|
375
|
-
}
|
|
376
|
-
function createAtom(valueOrFn, options) {
|
|
377
|
-
const isComputed = typeof valueOrFn === "function";
|
|
378
|
-
const getter = valueOrFn;
|
|
379
|
-
const atom = {
|
|
380
|
-
_snapshot: isComputed ? void 0 : valueOrFn,
|
|
381
|
-
subs: void 0,
|
|
382
|
-
subsTail: void 0,
|
|
383
|
-
deps: void 0,
|
|
384
|
-
depsTail: void 0,
|
|
385
|
-
flags: isComputed ? 0 : 1,
|
|
386
|
-
get() {
|
|
387
|
-
if (activeSub !== void 0) link(atom, activeSub, cycle);
|
|
388
|
-
return atom._snapshot;
|
|
389
|
-
},
|
|
390
|
-
subscribe(observerOrFn) {
|
|
391
|
-
const obs = toObserver(observerOrFn);
|
|
392
|
-
const observed = { current: false };
|
|
393
|
-
const e = effect(() => {
|
|
394
|
-
atom.get();
|
|
395
|
-
if (!observed.current) observed.current = true;
|
|
396
|
-
else {
|
|
397
|
-
activeSub = void 0;
|
|
398
|
-
obs.next?.(atom._snapshot);
|
|
399
|
-
}
|
|
400
|
-
});
|
|
401
|
-
return { unsubscribe: () => {
|
|
402
|
-
e.stop();
|
|
403
|
-
} };
|
|
404
|
-
},
|
|
405
|
-
_update(getValue) {
|
|
406
|
-
const prevSub = activeSub;
|
|
407
|
-
const compare = options?.compare ?? Object.is;
|
|
408
|
-
if (isComputed) {
|
|
409
|
-
activeSub = atom;
|
|
410
|
-
++cycle;
|
|
411
|
-
atom.depsTail = void 0;
|
|
412
|
-
} else if (getValue === void 0) return false;
|
|
413
|
-
if (isComputed) atom.flags = 5;
|
|
414
|
-
try {
|
|
415
|
-
const oldValue = atom._snapshot;
|
|
416
|
-
const newValue = typeof getValue === "function" ? getValue(oldValue) : getValue === void 0 && isComputed ? getter(oldValue) : getValue;
|
|
417
|
-
if (oldValue === void 0 || !compare(oldValue, newValue)) {
|
|
418
|
-
atom._snapshot = newValue;
|
|
419
|
-
return true;
|
|
420
|
-
}
|
|
421
|
-
return false;
|
|
422
|
-
} finally {
|
|
423
|
-
activeSub = prevSub;
|
|
424
|
-
if (isComputed) atom.flags &= -5;
|
|
425
|
-
purgeDeps(atom);
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
};
|
|
429
|
-
if (isComputed) {
|
|
430
|
-
atom.flags = 17;
|
|
431
|
-
atom.get = function() {
|
|
432
|
-
const flags = atom.flags;
|
|
433
|
-
if (flags & 16 || flags & 32 && checkDirty(atom.deps, atom)) {
|
|
434
|
-
if (atom._update()) {
|
|
435
|
-
const subs = atom.subs;
|
|
436
|
-
if (subs !== void 0) shallowPropagate(subs);
|
|
437
|
-
}
|
|
438
|
-
} else if (flags & 32) atom.flags = flags & -33;
|
|
439
|
-
if (activeSub !== void 0) link(atom, activeSub, cycle);
|
|
440
|
-
return atom._snapshot;
|
|
441
|
-
};
|
|
442
|
-
} else atom.set = function(valueOrFn) {
|
|
443
|
-
if (atom._update(valueOrFn)) {
|
|
444
|
-
const subs = atom.subs;
|
|
445
|
-
if (subs !== void 0) {
|
|
446
|
-
propagate(subs);
|
|
447
|
-
shallowPropagate(subs);
|
|
448
|
-
flush();
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
};
|
|
452
|
-
return atom;
|
|
453
|
-
}
|
|
454
|
-
function effect(fn) {
|
|
455
|
-
const run = () => {
|
|
456
|
-
const prevSub = activeSub;
|
|
457
|
-
activeSub = effectObj;
|
|
458
|
-
++cycle;
|
|
459
|
-
effectObj.depsTail = void 0;
|
|
460
|
-
effectObj.flags = 6;
|
|
461
|
-
try {
|
|
462
|
-
return fn();
|
|
463
|
-
} finally {
|
|
464
|
-
activeSub = prevSub;
|
|
465
|
-
effectObj.flags &= -5;
|
|
466
|
-
purgeDeps(effectObj);
|
|
467
|
-
}
|
|
468
|
-
};
|
|
469
|
-
const effectObj = {
|
|
470
|
-
deps: void 0,
|
|
471
|
-
depsTail: void 0,
|
|
472
|
-
subs: void 0,
|
|
473
|
-
subsTail: void 0,
|
|
474
|
-
flags: 6,
|
|
475
|
-
notify() {
|
|
476
|
-
const flags = this.flags;
|
|
477
|
-
if (flags & 16 || flags & 32 && checkDirty(this.deps, this)) run();
|
|
478
|
-
else this.flags = 2;
|
|
479
|
-
},
|
|
480
|
-
stop() {
|
|
481
|
-
this.flags = 0;
|
|
482
|
-
this.depsTail = void 0;
|
|
483
|
-
purgeDeps(this);
|
|
484
|
-
}
|
|
485
|
-
};
|
|
486
|
-
run();
|
|
487
|
-
return effectObj;
|
|
488
|
-
}
|
|
489
|
-
//#endregion
|
|
490
|
-
//#region ../../../node_modules/.pnpm/@tanstack+store@0.11.2/node_modules/@tanstack/store/dist/store.js
|
|
491
|
-
var Store = class {
|
|
492
|
-
constructor(valueOrFn, actionsFactory) {
|
|
493
|
-
this.atom = createAtom(valueOrFn);
|
|
494
|
-
this.get = this.get.bind(this);
|
|
495
|
-
this.setState = this.setState.bind(this);
|
|
496
|
-
this.subscribe = this.subscribe.bind(this);
|
|
497
|
-
if (actionsFactory) this.actions = actionsFactory(this);
|
|
498
|
-
}
|
|
499
|
-
setState(updater) {
|
|
500
|
-
this.atom.set(updater);
|
|
501
|
-
}
|
|
502
|
-
get state() {
|
|
503
|
-
return this.atom.get();
|
|
504
|
-
}
|
|
505
|
-
get() {
|
|
506
|
-
return this.state;
|
|
507
|
-
}
|
|
508
|
-
subscribe(observerOrFn) {
|
|
509
|
-
return this.atom.subscribe(toObserver(observerOrFn));
|
|
510
|
-
}
|
|
511
|
-
};
|
|
512
|
-
new Store({});
|
|
513
156
|
//#endregion
|
|
514
157
|
//#region ../../foundations/po-config/src/types/apiRoutes.ts
|
|
515
158
|
/**
|
|
@@ -532,175 +175,55 @@ var apiRoutes_default = defineApiRoutes({
|
|
|
532
175
|
path: "/",
|
|
533
176
|
/** Repeatable. The page also sends `repoRoot`, which the mount ignores: it serves one repository. */
|
|
534
177
|
query: ["key"],
|
|
535
|
-
response:
|
|
178
|
+
response: /* @__PURE__ */ apiResponse()
|
|
536
179
|
},
|
|
537
180
|
value: {
|
|
538
181
|
method: "PUT",
|
|
539
182
|
path: "/value",
|
|
540
|
-
response:
|
|
183
|
+
response: /* @__PURE__ */ apiResponse()
|
|
541
184
|
},
|
|
542
185
|
repositories: {
|
|
543
186
|
method: "GET",
|
|
544
187
|
path: "/repositories",
|
|
545
|
-
response:
|
|
188
|
+
response: /* @__PURE__ */ apiResponse()
|
|
546
189
|
},
|
|
547
190
|
/** The workspace this mount was bound to; a global mount has none and answers 404. */
|
|
548
191
|
repository: {
|
|
549
192
|
method: "GET",
|
|
550
193
|
path: "/repository",
|
|
551
|
-
response:
|
|
194
|
+
response: /* @__PURE__ */ apiResponse()
|
|
552
195
|
},
|
|
553
196
|
selection: {
|
|
554
197
|
method: "PUT",
|
|
555
198
|
path: "/repository/selection",
|
|
556
|
-
response:
|
|
199
|
+
response: /* @__PURE__ */ apiResponse()
|
|
557
200
|
},
|
|
558
201
|
/** Pi's own image limits, served by the global mount only. */
|
|
559
202
|
images: {
|
|
560
203
|
method: "GET",
|
|
561
204
|
path: "/images",
|
|
562
|
-
response:
|
|
205
|
+
response: /* @__PURE__ */ apiResponse()
|
|
563
206
|
},
|
|
564
207
|
/** The same path as `images`; the method is the whole of the difference. */
|
|
565
208
|
saveImages: {
|
|
566
209
|
method: "PUT",
|
|
567
210
|
path: "/images",
|
|
568
|
-
response:
|
|
211
|
+
response: /* @__PURE__ */ apiResponse()
|
|
569
212
|
},
|
|
570
213
|
/** Your major modes from `~/.po/modes.yaml`, served by the global mount only. */
|
|
571
214
|
presets: {
|
|
572
215
|
method: "GET",
|
|
573
216
|
path: "/presets",
|
|
574
|
-
response:
|
|
217
|
+
response: /* @__PURE__ */ apiResponse()
|
|
575
218
|
},
|
|
576
219
|
/** Sets `defaultMajorMode`; the method is the whole of the difference. */
|
|
577
220
|
savePresets: {
|
|
578
221
|
method: "PUT",
|
|
579
222
|
path: "/presets",
|
|
580
|
-
response:
|
|
223
|
+
response: /* @__PURE__ */ apiResponse()
|
|
581
224
|
}
|
|
582
225
|
});
|
|
583
226
|
//#endregion
|
|
584
|
-
//#region ../../foundations/po-config/src/services/imageSettings/index.ts
|
|
585
|
-
const IMAGE_SETTINGS_KEY = "images";
|
|
586
|
-
const IMAGE_AUTO_RESIZE_KEY = "autoResize";
|
|
587
|
-
const IMAGE_MAX_DIMENSION_KEY = "maxDimension";
|
|
588
|
-
/** Pi's own cap, from its resize core; also the largest value worth writing. */
|
|
589
|
-
const DEFAULT_IMAGE_MAX_DIMENSION = 2e3;
|
|
590
|
-
function clampImageMaxDimension(value) {
|
|
591
|
-
const rounded = Math.round(value);
|
|
592
|
-
if (rounded < 256) return 256;
|
|
593
|
-
if (rounded > 2e3) return DEFAULT_IMAGE_MAX_DIMENSION;
|
|
594
|
-
return rounded;
|
|
595
|
-
}
|
|
596
|
-
function isRecord$3(value) {
|
|
597
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
598
|
-
}
|
|
599
|
-
/** Resolves the effective limits, defaulting anything absent or unusable. */
|
|
600
|
-
function parsePiImageSettings(config) {
|
|
601
|
-
const images = config[IMAGE_SETTINGS_KEY];
|
|
602
|
-
if (!isRecord$3(images)) return {
|
|
603
|
-
autoResize: true,
|
|
604
|
-
maxDimension: DEFAULT_IMAGE_MAX_DIMENSION
|
|
605
|
-
};
|
|
606
|
-
const autoResize = images[IMAGE_AUTO_RESIZE_KEY];
|
|
607
|
-
const maxDimension = images[IMAGE_MAX_DIMENSION_KEY];
|
|
608
|
-
return {
|
|
609
|
-
autoResize: typeof autoResize === "boolean" ? autoResize : true,
|
|
610
|
-
maxDimension: typeof maxDimension === "number" && Number.isFinite(maxDimension) ? clampImageMaxDimension(maxDimension) : DEFAULT_IMAGE_MAX_DIMENSION
|
|
611
|
-
};
|
|
612
|
-
}
|
|
613
|
-
/**
|
|
614
|
-
* Folds a change into the `images` object of a settings document, leaving every
|
|
615
|
-
* other key of that document, and of `images` itself, as it was.
|
|
616
|
-
*/
|
|
617
|
-
function applyPiImageSettings(config, update) {
|
|
618
|
-
const existing = config[IMAGE_SETTINGS_KEY];
|
|
619
|
-
const images = isRecord$3(existing) ? { ...existing } : {};
|
|
620
|
-
if (update.autoResize !== void 0) images[IMAGE_AUTO_RESIZE_KEY] = update.autoResize;
|
|
621
|
-
if (update.maxDimension !== void 0) images[IMAGE_MAX_DIMENSION_KEY] = clampImageMaxDimension(update.maxDimension);
|
|
622
|
-
return {
|
|
623
|
-
...config,
|
|
624
|
-
[IMAGE_SETTINGS_KEY]: images
|
|
625
|
-
};
|
|
626
|
-
}
|
|
627
|
-
//#endregion
|
|
628
|
-
//#region ../../foundations/po-config/src/services/piConfig/core.ts
|
|
629
|
-
const SETTINGS_FILE_NAME = "settings.json";
|
|
630
|
-
const CONFIG_DIR_NAME = ".pi";
|
|
631
|
-
/** An explicit home other than the real one is isolated from the process environment. */
|
|
632
|
-
function defaultAgentDirectory(homeDirectory) {
|
|
633
|
-
return piAgentDirectory(homeDirectory === nodeHost.homeDirectory() ? process.env : {}, homeDirectory);
|
|
634
|
-
}
|
|
635
|
-
function isObject(value) {
|
|
636
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
637
|
-
}
|
|
638
|
-
function mergeConfig(base, override) {
|
|
639
|
-
const result = { ...base };
|
|
640
|
-
for (const [key, value] of Object.entries(override)) {
|
|
641
|
-
const current = result[key];
|
|
642
|
-
result[key] = isObject(current) && isObject(value) ? mergeConfig(current, value) : value;
|
|
643
|
-
}
|
|
644
|
-
return result;
|
|
645
|
-
}
|
|
646
|
-
/** Parses one settings file; `undefined` text means the file is missing. */
|
|
647
|
-
function configFromText(text, filePath) {
|
|
648
|
-
if (text === void 0) return {};
|
|
649
|
-
let parsed;
|
|
650
|
-
try {
|
|
651
|
-
parsed = JSON.parse(text);
|
|
652
|
-
} catch (error) {
|
|
653
|
-
throw new Error(`Could not parse Pi settings at ${filePath}`, { cause: error });
|
|
654
|
-
}
|
|
655
|
-
if (!isObject(parsed)) throw new Error(`Pi settings at ${filePath} must be a JSON object`);
|
|
656
|
-
return parsed;
|
|
657
|
-
}
|
|
658
|
-
/**
|
|
659
|
-
* Where the image limits are read from and written to.
|
|
660
|
-
*
|
|
661
|
-
* The user layer only. Pi merges a trusted project settings.json over it, but
|
|
662
|
-
* these limits describe one machine's tolerance for image payloads rather than
|
|
663
|
-
* one repository's, and the cockpit page that writes them has no repository
|
|
664
|
-
* scope to offer. The legacy user path is still read, because a machine that
|
|
665
|
-
* has not been migrated still answers from it.
|
|
666
|
-
*/
|
|
667
|
-
function userSettingsPaths(homeDirectory) {
|
|
668
|
-
return {
|
|
669
|
-
legacy: path.join(homeDirectory, CONFIG_DIR_NAME, SETTINGS_FILE_NAME),
|
|
670
|
-
canonical: path.join(defaultAgentDirectory(homeDirectory), SETTINGS_FILE_NAME)
|
|
671
|
-
};
|
|
672
|
-
}
|
|
673
|
-
//#endregion
|
|
674
|
-
//#region ../../foundations/po-config/src/services/piConfig/index.ts
|
|
675
|
-
/** Image settings saves in this process are queued per file, so none reads a stale document. */
|
|
676
|
-
const imageSettingsWrites = createSerialRunner();
|
|
677
|
-
async function readConfig(fs, filePath, context) {
|
|
678
|
-
return configFromText(await readTextIfExists(fs, filePath, context), filePath);
|
|
679
|
-
}
|
|
680
|
-
async function readConfigPaths(fs, paths, context) {
|
|
681
|
-
return (await Promise.all(paths.map((filePath) => readConfig(fs, filePath, context)))).reduce(mergeConfig, {});
|
|
682
|
-
}
|
|
683
|
-
async function readPiImageSettings(fs, context, homeDirectory = nodeHost.homeDirectory()) {
|
|
684
|
-
const paths = userSettingsPaths(homeDirectory);
|
|
685
|
-
return parsePiImageSettings(await readConfigPaths(fs, [paths.legacy, paths.canonical], context));
|
|
686
|
-
}
|
|
687
|
-
/**
|
|
688
|
-
* Writes the changed keys back and reports the limits that now apply.
|
|
689
|
-
*
|
|
690
|
-
* Read-modify-write on Pi's own file, so a save races a concurrent Pi settings
|
|
691
|
-
* save rather than merging with it. Pi writes only the fields its UI touched,
|
|
692
|
-
* as this does, which keeps the window to the one setting being changed on
|
|
693
|
-
* both sides at once. Saves from this process are queued.
|
|
694
|
-
*/
|
|
695
|
-
async function savePiImageSettingsAsync(fs, update, context, homeDirectory = nodeHost.homeDirectory()) {
|
|
696
|
-
const paths = userSettingsPaths(homeDirectory);
|
|
697
|
-
await imageSettingsWrites.forKey(path.resolve(paths.canonical))(async () => {
|
|
698
|
-
const current = await readConfig(fs, paths.canonical, context);
|
|
699
|
-
await writePrivateAtomicJsonAsync(fs, paths.canonical, applyPiImageSettings(current, update), context);
|
|
700
|
-
});
|
|
701
|
-
return readPiImageSettings(fs, context, homeDirectory);
|
|
702
|
-
}
|
|
703
|
-
//#endregion
|
|
704
227
|
//#region ../../foundations/po-config/src/services/presets/index.ts
|
|
705
228
|
const io = BACKGROUND_CONTEXT;
|
|
706
229
|
function packageName(entry) {
|
|
@@ -942,7 +465,16 @@ const BROWSER_KEYS = /* @__PURE__ */ new Set([
|
|
|
942
465
|
"profileName",
|
|
943
466
|
"allowedOrigins",
|
|
944
467
|
"mode",
|
|
945
|
-
"proxySecret"
|
|
468
|
+
"proxySecret",
|
|
469
|
+
"geoip",
|
|
470
|
+
"timezone",
|
|
471
|
+
"locale",
|
|
472
|
+
"fingerprint"
|
|
473
|
+
]);
|
|
474
|
+
const FINGERPRINT_KEYS = /* @__PURE__ */ new Set([
|
|
475
|
+
"platform",
|
|
476
|
+
"seed",
|
|
477
|
+
"required"
|
|
946
478
|
]);
|
|
947
479
|
const PURPOSES = /* @__PURE__ */ new Set([
|
|
948
480
|
"browser",
|
|
@@ -987,16 +519,49 @@ function purposes(value, location) {
|
|
|
987
519
|
if (!Array.isArray(value) || value.length === 0 || value.some((entry) => typeof entry !== "string" || !PURPOSES.has(entry)) || new Set(value).size !== value.length) throw new Error(`${location} must list distinct purposes: browser, proxy, env or input`);
|
|
988
520
|
return Object.freeze([...value]);
|
|
989
521
|
}
|
|
522
|
+
function timezone(value, location) {
|
|
523
|
+
try {
|
|
524
|
+
if (typeof value === "string" && value.length <= 64) {
|
|
525
|
+
new Intl.DateTimeFormat("en-US", { timeZone: value });
|
|
526
|
+
return value;
|
|
527
|
+
}
|
|
528
|
+
} catch {}
|
|
529
|
+
throw new Error(`${location} must be an IANA timezone`);
|
|
530
|
+
}
|
|
531
|
+
function locale(value, location) {
|
|
532
|
+
try {
|
|
533
|
+
if (typeof value === "string" && value.length <= 35 && Intl.getCanonicalLocales(value).length === 1) return value;
|
|
534
|
+
} catch {}
|
|
535
|
+
throw new Error(`${location} must be a BCP 47 locale`);
|
|
536
|
+
}
|
|
537
|
+
function fingerprint(value, location) {
|
|
538
|
+
const entry = record(value, location, FINGERPRINT_KEYS);
|
|
539
|
+
if (entry.platform !== void 0 && entry.platform !== "windows" && entry.platform !== "macos") throw new Error(`${location}.platform must be windows or macos`);
|
|
540
|
+
if (entry.seed !== void 0 && (typeof entry.seed !== "number" || !Number.isInteger(entry.seed) || entry.seed < 1e4 || entry.seed > 99999)) throw new Error(`${location}.seed must be an integer from 10000 to 99999`);
|
|
541
|
+
if (entry.required !== void 0 && typeof entry.required !== "boolean") throw new Error(`${location}.required must be a boolean`);
|
|
542
|
+
return Object.freeze({
|
|
543
|
+
...entry.platform === void 0 ? {} : { platform: entry.platform },
|
|
544
|
+
...entry.seed === void 0 ? {} : { seed: entry.seed },
|
|
545
|
+
...entry.required === void 0 ? {} : { required: entry.required }
|
|
546
|
+
});
|
|
547
|
+
}
|
|
990
548
|
function browser(value, location) {
|
|
991
549
|
const entry = record(value, location, BROWSER_KEYS);
|
|
992
550
|
if (typeof entry.profileName !== "string" || !BROWSER_PROFILE_PATTERN.test(entry.profileName)) throw new Error(`${location}.profileName must be a safe browser profile name`);
|
|
993
551
|
if (entry.mode !== void 0 && (typeof entry.mode !== "string" || !BROWSER_MODES.has(entry.mode))) throw new Error(`${location}.mode must be playwright, extension or stealth`);
|
|
994
552
|
if (entry.proxySecret !== void 0 && (typeof entry.proxySecret !== "string" || !ALIAS_PATTERN.test(entry.proxySecret))) throw new Error(`${location}.proxySecret must be an uppercase alias name`);
|
|
553
|
+
if (entry.geoip !== void 0 && typeof entry.geoip !== "boolean") throw new Error(`${location}.geoip must be a boolean`);
|
|
554
|
+
const pinned = entry.fingerprint === void 0 ? void 0 : fingerprint(entry.fingerprint, `${location}.fingerprint`);
|
|
555
|
+
if (pinned?.required && entry.mode !== void 0 && entry.mode !== "playwright") throw new Error(`${location}.fingerprint.required needs playwright mode`);
|
|
995
556
|
return Object.freeze({
|
|
996
557
|
profileName: entry.profileName,
|
|
997
558
|
allowedOrigins: origins(entry.allowedOrigins, `${location}.allowedOrigins`),
|
|
998
559
|
...entry.mode === void 0 ? {} : { mode: entry.mode },
|
|
999
|
-
...entry.proxySecret === void 0 ? {} : { proxySecret: entry.proxySecret }
|
|
560
|
+
...entry.proxySecret === void 0 ? {} : { proxySecret: entry.proxySecret },
|
|
561
|
+
...entry.geoip === void 0 ? {} : { geoip: entry.geoip },
|
|
562
|
+
...entry.timezone === void 0 ? {} : { timezone: timezone(entry.timezone, `${location}.timezone`) },
|
|
563
|
+
...entry.locale === void 0 ? {} : { locale: locale(entry.locale, `${location}.locale`) },
|
|
564
|
+
...pinned === void 0 ? {} : { fingerprint: pinned }
|
|
1000
565
|
});
|
|
1001
566
|
}
|
|
1002
567
|
function targets(value, forInput, location) {
|
|
@@ -1958,4 +1523,4 @@ function providePoConfigContext(ctx, context, generation = `po-config:${crypto.r
|
|
|
1958
1523
|
return new PoConfigService(ctx, deepFreeze(context), loadPoConfig, generation);
|
|
1959
1524
|
}
|
|
1960
1525
|
//#endregion
|
|
1961
|
-
export { commitGlobalProfileRootAsync as a, buildPersonaPrompt as c, parseProfileBinding as d, parseProfileVaultSecrets as f, ProfileCatalogChangedError as i, loadProfiles as l, providePoConfigContext as n, loadProfilesAsync as o, createSettingsApi as r, planGlobalProfileRootAsync as s, createNativePoConfigContext as t, inlineProfile as u };
|
|
1526
|
+
export { commitGlobalProfileRootAsync as a, buildPersonaPrompt as c, parseProfileBinding as d, parseProfileVaultSecrets as f, ProfileCatalogChangedError as i, loadProfiles as l, providePoConfigContext as n, loadProfilesAsync as o, loadPoConfig as p, createSettingsApi as r, planGlobalProfileRootAsync as s, createNativePoConfigContext as t, inlineProfile as u };
|