@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
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { a as piAgentDirectory, l as nodeHost, s as createSerialRunner } from "./serverPlugin-pCqlBqQG.js";
|
|
2
|
+
import { i as readTextIfExists } from "./platformFiles-Ccj9HCvA.js";
|
|
3
|
+
import "./platform-CyvF7X-b.js";
|
|
4
|
+
import "./piSettings-B6fsgIBA.js";
|
|
5
|
+
import { n as writePrivateAtomicJsonAsync } from "./atomicJson-BF1fVXy1.js";
|
|
6
|
+
import path from "node:path";
|
|
7
|
+
//#region ../../foundations/po-config/src/services/imageSettings/index.ts
|
|
8
|
+
const IMAGE_SETTINGS_KEY = "images";
|
|
9
|
+
const IMAGE_AUTO_RESIZE_KEY = "autoResize";
|
|
10
|
+
const IMAGE_MAX_DIMENSION_KEY = "maxDimension";
|
|
11
|
+
/** Pi's own cap, from its resize core; also the largest value worth writing. */
|
|
12
|
+
const DEFAULT_IMAGE_MAX_DIMENSION = 2e3;
|
|
13
|
+
function clampImageMaxDimension(value) {
|
|
14
|
+
const rounded = Math.round(value);
|
|
15
|
+
if (rounded < 256) return 256;
|
|
16
|
+
if (rounded > 2e3) return DEFAULT_IMAGE_MAX_DIMENSION;
|
|
17
|
+
return rounded;
|
|
18
|
+
}
|
|
19
|
+
function isRecord(value) {
|
|
20
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
21
|
+
}
|
|
22
|
+
/** Resolves the effective limits, defaulting anything absent or unusable. */
|
|
23
|
+
function parsePiImageSettings(config) {
|
|
24
|
+
const images = config[IMAGE_SETTINGS_KEY];
|
|
25
|
+
if (!isRecord(images)) return {
|
|
26
|
+
autoResize: true,
|
|
27
|
+
maxDimension: DEFAULT_IMAGE_MAX_DIMENSION
|
|
28
|
+
};
|
|
29
|
+
const autoResize = images[IMAGE_AUTO_RESIZE_KEY];
|
|
30
|
+
const maxDimension = images[IMAGE_MAX_DIMENSION_KEY];
|
|
31
|
+
return {
|
|
32
|
+
autoResize: typeof autoResize === "boolean" ? autoResize : true,
|
|
33
|
+
maxDimension: typeof maxDimension === "number" && Number.isFinite(maxDimension) ? clampImageMaxDimension(maxDimension) : DEFAULT_IMAGE_MAX_DIMENSION
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Folds a change into the `images` object of a settings document, leaving every
|
|
38
|
+
* other key of that document, and of `images` itself, as it was.
|
|
39
|
+
*/
|
|
40
|
+
function applyPiImageSettings(config, update) {
|
|
41
|
+
const existing = config[IMAGE_SETTINGS_KEY];
|
|
42
|
+
const images = isRecord(existing) ? { ...existing } : {};
|
|
43
|
+
if (update.autoResize !== void 0) images[IMAGE_AUTO_RESIZE_KEY] = update.autoResize;
|
|
44
|
+
if (update.maxDimension !== void 0) images[IMAGE_MAX_DIMENSION_KEY] = clampImageMaxDimension(update.maxDimension);
|
|
45
|
+
return {
|
|
46
|
+
...config,
|
|
47
|
+
[IMAGE_SETTINGS_KEY]: images
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
//#endregion
|
|
51
|
+
//#region ../../foundations/po-config/src/services/piConfig/core.ts
|
|
52
|
+
const SETTINGS_FILE_NAME = "settings.json";
|
|
53
|
+
const CONFIG_DIR_NAME = ".pi";
|
|
54
|
+
/** An explicit home other than the real one is isolated from the process environment. */
|
|
55
|
+
function defaultAgentDirectory(homeDirectory) {
|
|
56
|
+
return piAgentDirectory(homeDirectory === nodeHost.homeDirectory() ? process.env : {}, homeDirectory);
|
|
57
|
+
}
|
|
58
|
+
function isObject(value) {
|
|
59
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
60
|
+
}
|
|
61
|
+
function mergeConfig(base, override) {
|
|
62
|
+
const result = { ...base };
|
|
63
|
+
for (const [key, value] of Object.entries(override)) {
|
|
64
|
+
const current = result[key];
|
|
65
|
+
result[key] = isObject(current) && isObject(value) ? mergeConfig(current, value) : value;
|
|
66
|
+
}
|
|
67
|
+
return result;
|
|
68
|
+
}
|
|
69
|
+
/** Parses one settings file; `undefined` text means the file is missing. */
|
|
70
|
+
function configFromText(text, filePath) {
|
|
71
|
+
if (text === void 0) return {};
|
|
72
|
+
let parsed;
|
|
73
|
+
try {
|
|
74
|
+
parsed = JSON.parse(text);
|
|
75
|
+
} catch (error) {
|
|
76
|
+
throw new Error(`Could not parse Pi settings at ${filePath}`, { cause: error });
|
|
77
|
+
}
|
|
78
|
+
if (!isObject(parsed)) throw new Error(`Pi settings at ${filePath} must be a JSON object`);
|
|
79
|
+
return parsed;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Where the image limits are read from and written to.
|
|
83
|
+
*
|
|
84
|
+
* The user layer only. Pi merges a trusted project settings.json over it, but
|
|
85
|
+
* these limits describe one machine's tolerance for image payloads rather than
|
|
86
|
+
* one repository's, and the cockpit page that writes them has no repository
|
|
87
|
+
* scope to offer. The legacy user path is still read, because a machine that
|
|
88
|
+
* has not been migrated still answers from it.
|
|
89
|
+
*/
|
|
90
|
+
function userSettingsPaths(homeDirectory) {
|
|
91
|
+
return {
|
|
92
|
+
legacy: path.join(homeDirectory, CONFIG_DIR_NAME, SETTINGS_FILE_NAME),
|
|
93
|
+
canonical: path.join(defaultAgentDirectory(homeDirectory), SETTINGS_FILE_NAME)
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
//#endregion
|
|
97
|
+
//#region ../../foundations/po-config/src/services/piConfig/index.ts
|
|
98
|
+
/** Image settings saves in this process are queued per file, so none reads a stale document. */
|
|
99
|
+
const imageSettingsWrites = createSerialRunner();
|
|
100
|
+
async function readConfig(fs, filePath, context) {
|
|
101
|
+
return configFromText(await readTextIfExists(fs, filePath, context), filePath);
|
|
102
|
+
}
|
|
103
|
+
async function readConfigPaths(fs, paths, context) {
|
|
104
|
+
return (await Promise.all(paths.map((filePath) => readConfig(fs, filePath, context)))).reduce(mergeConfig, {});
|
|
105
|
+
}
|
|
106
|
+
async function readPiImageSettings(fs, context, homeDirectory = nodeHost.homeDirectory()) {
|
|
107
|
+
const paths = userSettingsPaths(homeDirectory);
|
|
108
|
+
return parsePiImageSettings(await readConfigPaths(fs, [paths.legacy, paths.canonical], context));
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Writes the changed keys back and reports the limits that now apply.
|
|
112
|
+
*
|
|
113
|
+
* Read-modify-write on Pi's own file, so a save races a concurrent Pi settings
|
|
114
|
+
* save rather than merging with it. Pi writes only the fields its UI touched,
|
|
115
|
+
* as this does, which keeps the window to the one setting being changed on
|
|
116
|
+
* both sides at once. Saves from this process are queued.
|
|
117
|
+
*/
|
|
118
|
+
async function savePiImageSettingsAsync(fs, update, context, homeDirectory = nodeHost.homeDirectory()) {
|
|
119
|
+
const paths = userSettingsPaths(homeDirectory);
|
|
120
|
+
await imageSettingsWrites.forKey(path.resolve(paths.canonical))(async () => {
|
|
121
|
+
const current = await readConfig(fs, paths.canonical, context);
|
|
122
|
+
await writePrivateAtomicJsonAsync(fs, paths.canonical, applyPiImageSettings(current, update), context);
|
|
123
|
+
});
|
|
124
|
+
return readPiImageSettings(fs, context, homeDirectory);
|
|
125
|
+
}
|
|
126
|
+
//#endregion
|
|
127
|
+
export { savePiImageSettingsAsync as n, DEFAULT_IMAGE_MAX_DIMENSION as r, readPiImageSettings as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { p as getOrThrow } from "./serverPlugin-pCqlBqQG.js";
|
|
1
|
+
import { Yn as BACKGROUND_CONTEXT, p as getOrThrow } from "./serverPlugin-pCqlBqQG.js";
|
|
2
2
|
import { randomUUID } from "node:crypto";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
//#region ../../core/po-core/src/services/platformFiles/index.ts
|
|
@@ -7,6 +7,28 @@ let largestTranscriptEntryBytes = 0;
|
|
|
7
7
|
function recordTranscriptProjection(bytes) {
|
|
8
8
|
if (Number.isSafeInteger(bytes) && bytes > 0) largestTranscriptEntryBytes = Math.max(largestTranscriptEntryBytes, bytes);
|
|
9
9
|
}
|
|
10
|
+
var FileTooLargeError = class extends Error {
|
|
11
|
+
constructor(filePath, maxBytes) {
|
|
12
|
+
super(`File exceeds ${maxBytes} byte read limit: ${filePath}`);
|
|
13
|
+
this.name = "FileTooLargeError";
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
/** Bounds allocation even when a file grows between stat and read. */
|
|
17
|
+
async function readBoundedFile(fs, filePath, maxBytes, context) {
|
|
18
|
+
if (!Number.isSafeInteger(maxBytes) || maxBytes < 0) throw new RangeError("Invalid read limit.");
|
|
19
|
+
const reader = getOrThrow(await fs.openBinaryReader(filePath, {}, context));
|
|
20
|
+
try {
|
|
21
|
+
const info = getOrThrow(await reader.info(context));
|
|
22
|
+
if (info.size > maxBytes) throw new FileTooLargeError(filePath, maxBytes);
|
|
23
|
+
const data = getOrThrow(await reader.read(0, info.size, context));
|
|
24
|
+
const after = getOrThrow(await reader.info(context));
|
|
25
|
+
if (after.size > maxBytes) throw new FileTooLargeError(filePath, maxBytes);
|
|
26
|
+
if (data.length !== info.size || after.size !== info.size || after.mtimeMs !== info.mtimeMs) throw new Error(`File changed during access: ${filePath}`);
|
|
27
|
+
return data;
|
|
28
|
+
} finally {
|
|
29
|
+
await reader.close(BACKGROUND_CONTEXT);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
10
32
|
/** File text, or undefined when the file does not exist. Every other failure throws. */
|
|
11
33
|
async function readTextIfExists(fs, filePath, context) {
|
|
12
34
|
const result = await fs.readTextFile(filePath, context);
|
|
@@ -39,4 +61,4 @@ async function writeFileAtomic(fs, filePath, content, context) {
|
|
|
39
61
|
}
|
|
40
62
|
}
|
|
41
63
|
//#endregion
|
|
42
|
-
export {
|
|
64
|
+
export { recordTranscriptProjection as a, readTextIfExists as i, pathExists as n, removePath as o, readBoundedFile as r, writeFileAtomic as s, FileTooLargeError as t };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region ../../core/po-core/src/schemas/pluginContributions.ts
|
|
2
|
+
/** Preserve schema inference at the declaration, before heterogeneous composition. */
|
|
3
|
+
function defineTool(tool) {
|
|
4
|
+
return {
|
|
5
|
+
...tool,
|
|
6
|
+
kind: "tool"
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
function defineCommand(command) {
|
|
10
|
+
return {
|
|
11
|
+
...command,
|
|
12
|
+
kind: "command"
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
export { defineTool as n, defineCommand as t };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rekey well before the counter could wrap.
|
|
3
|
+
*
|
|
4
|
+
* A repeated nonce under one AES-GCM key is catastrophic, not merely weak: it
|
|
5
|
+
* leaks the XOR of two plaintexts and the authentication subkey. The counter is
|
|
6
|
+
* 64 bits, so this bound is nowhere near it; the point is that the bound exists
|
|
7
|
+
* and is enforced rather than assumed.
|
|
8
|
+
*/
|
|
9
|
+
const MAX_MESSAGES_PER_KEY = 2 ** 32;
|
|
10
|
+
/**
|
|
11
|
+
* HKDF info strings, one per direction.
|
|
12
|
+
*
|
|
13
|
+
* Separate keys per direction, not one shared key, so a message the server sent
|
|
14
|
+
* can never be replayed back at it as though the client had sent it.
|
|
15
|
+
*/
|
|
16
|
+
const CLIENT_TO_SERVER_INFO = "po/sealed/c2s/v1";
|
|
17
|
+
const SERVER_TO_CLIENT_INFO = "po/sealed/s2c/v1";
|
|
18
|
+
function infoFor(direction) {
|
|
19
|
+
return direction === "c2s" ? CLIENT_TO_SERVER_INFO : SERVER_TO_CLIENT_INFO;
|
|
20
|
+
}
|
|
21
|
+
function isSealedEnvelope(value) {
|
|
22
|
+
if (typeof value !== "object" || value === null) return false;
|
|
23
|
+
const candidate = value;
|
|
24
|
+
return candidate.v === 1 && typeof candidate.n === "string" && typeof candidate.c === "string";
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
export { infoFor as n, isSealedEnvelope as r, MAX_MESSAGES_PER_KEY as t };
|