@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.
Files changed (94) hide show
  1. package/dist/agent-DYFqCLl2.js +6850 -0
  2. package/dist/assets/plugins/assets/base-C3j1WCCq.css +2 -0
  3. package/dist/assets/plugins/chunks/po-web-runtime-Czm_C4SJ.js +1 -0
  4. package/dist/assets/plugins/compositions.json +1 -1
  5. package/dist/assets/plugins/slots/approval.8b3f37d9-CqQk6XG_.js +2 -0
  6. package/dist/assets/plugins/slots/artifacts.47d00f81-D-vQ-7Iz.js +1 -0
  7. package/dist/assets/plugins/slots/autocompact.9a92993d-B3KTYwW1.js +1 -0
  8. package/dist/assets/plugins/slots/builtin-tools.939bbfff-CZRYQVIP.js +7 -0
  9. package/dist/assets/plugins/slots/codemode.782e5bb1-Bzl_K_vt.js +10 -0
  10. package/dist/assets/plugins/slots/domain.21790b66-CvnpuKCY.js +1 -0
  11. package/dist/assets/plugins/slots/edit.c7c85129-kaxIknZ-.js +7 -0
  12. package/dist/assets/plugins/slots/files.bbcef824-wuB8gcQA.js +2 -0
  13. package/dist/assets/plugins/slots/grep.3dfd3214-3FnU8p-d.js +1 -0
  14. package/dist/assets/plugins/slots/log.33bc7d38-C0PXQ0O1.js +4 -0
  15. package/dist/assets/plugins/slots/mcp.59c68bcb-D0CkHnIw.js +109 -0
  16. package/dist/assets/plugins/slots/{profile.ab16dcec-B5yt7eny.js → profile.ea55f5e1-BSY3iYfJ.js} +1 -1
  17. package/dist/assets/plugins/slots/prompts.9957cc84-xdCkNkoA.js +3 -0
  18. package/dist/assets/plugins/slots/read.30a617e7-qqaxVlEX.js +1 -0
  19. package/dist/assets/plugins/slots/runner.9f3559b0-DfO2Z9HG.js +8 -0
  20. package/dist/assets/plugins/slots/skill.f506a5ea-CL_n-l4h.js +4 -0
  21. package/dist/assets/plugins/slots/vault.01657352-DbG3F_on.js +1 -0
  22. package/dist/{atomicJson-C_lN9leA.js → atomicJson-BF1fVXy1.js} +1 -1
  23. package/dist/browser-BWf8OMfl.js +3 -0
  24. package/dist/childSession-Cf2-kH4O.js +22 -0
  25. package/dist/{server-D190dXDN.js → dist-B-vqs6tA.js} +1 -546
  26. package/dist/{domains-CPX1dEVa.js → domains-Bl6T2dKV.js} +2 -2
  27. package/dist/{server-C5wixba6.js → esm-BKJy3O9-.js} +3 -296
  28. package/dist/{exports-2Vv52b9v.js → exports-CxkWsXI9.js} +7 -6
  29. package/dist/{exports-BF12Ftrd.js → exports-DlcCEAe3.js} +2 -9
  30. package/dist/{extensionFile-DpVvh-ud.js → extensionFile-D7wk8tFr.js} +11 -1
  31. package/dist/harnessStore-Bap8lsAg.js +1 -0
  32. package/dist/{harnessStore-Ct329wxJ.js → harnessStore-flLz1I0F.js} +2 -2
  33. package/dist/help-DjybmnPW.js +91 -0
  34. package/dist/{hubChannel-kFgtfJnv.js → hubChannel-Bi3PQrfD.js} +3 -27
  35. package/dist/hubRevisions-58pU2dW5.js +363 -0
  36. package/dist/index.edge-C9_xuXyy.js +57 -0
  37. package/dist/{index.edge-DhV_hfZA.js → index.edge-CJ2TFpgF.js} +2 -2
  38. package/dist/index.edge-COJJ_Dv2.js +937 -0
  39. package/dist/index.edge-ChYa2LU4.js +14 -0
  40. package/dist/index.edge-ClLTmPFz.js +191 -0
  41. package/dist/{index.edge-BNElrrHY.js → index.edge-uSjRpm6Z.js} +5 -0
  42. package/dist/iso-BPQViXM8.js +10 -0
  43. package/dist/{layeredConfig-BhFC6TBD.js → layeredConfig-B4s0eZ5o.js} +11 -4
  44. package/dist/{majorModes-CZqrWarh.js → majorModes-IygGmbb8.js} +2 -2
  45. package/dist/majorModes-xpLK9HpD.js +1 -0
  46. package/dist/notification-bGq1frYG.js +99 -0
  47. package/dist/piConfig-CcoMX-1L.js +127 -0
  48. package/dist/{platformFiles-BTDsAsmT.js → platformFiles-Ccj9HCvA.js} +24 -2
  49. package/dist/pluginContributions-Be9EnCAW.js +16 -0
  50. package/dist/sealedChannel-BeWNTWys.js +27 -0
  51. package/dist/server-4CmqIbH2.js +1476 -0
  52. package/dist/{server-DesPQYzJ.js → server-5vLvBTTs.js} +1 -1
  53. package/dist/server-BHhb0oir.js +505 -0
  54. package/dist/server-Bm6pAAw8.js +935 -0
  55. package/dist/server-C82Qzoh3.js +2658 -0
  56. package/dist/server-C8HyW7wN.js +489 -0
  57. package/dist/{server-DSusAvqK.js → server-C9gff7gU.js} +1 -1
  58. package/dist/{server-CTIkoJXM.js → server-CIhwIcbA.js} +4 -4
  59. package/dist/{server-DbmCxFL-.js → server-CMaTba5B.js} +1 -1
  60. package/dist/{server-DolHpEoY.js → server-COE7BKSa.js} +1 -1
  61. package/dist/server-CQXqMpeC.js +1744 -0
  62. package/dist/{server-BG6gwBcv.js → server-CTSvwoDy.js} +5 -4
  63. package/dist/server-C_34VM3M.js +217 -0
  64. package/dist/{server-CuGXhVFA.js → server-C_3jK2WM.js} +5 -5
  65. package/dist/server-CcNMwEFQ.js +190 -0
  66. package/dist/{server-D-zQp04y.js → server-CjsKNdSN.js} +1 -1
  67. package/dist/{server-DQy8hVXg.js → server-ClsNJwdv.js} +8 -8
  68. package/dist/{server-DfBHHyQo.js → server-Co57A8MH.js} +2 -9
  69. package/dist/{server-CRtXiNBP.js → server-CpJNq249.js} +5 -5
  70. package/dist/{server-zYYAg7ki.js → server-CxGGQFJs.js} +5 -16
  71. package/dist/{server-DpVsUiA-.js → server-DSu_uLDX.js} +4 -4
  72. package/dist/server-DeSuziRK.js +680 -0
  73. package/dist/{server-BIjpcE0Y.js → server-ZsazKk-n.js} +3 -3
  74. package/dist/{server-CZoHLCxk.js → server-il_s2Ycz.js} +5 -93
  75. package/dist/server-ziNfBZ2M.js +295 -0
  76. package/dist/{sessionConfig-BLmM5XLM.js → sessionConfig-DzAs6Pt-.js} +64 -499
  77. package/dist/{notification-qvyJJ_Df.js → telemetry-Csv1ZxAn.js} +1 -99
  78. package/dist/truncate-M3KbFyVj.js +89 -0
  79. package/dist/web-Cfvbn9H1.js +3 -0
  80. package/dist/worker.js +4545 -12244
  81. package/dist/workflow-w5JPZXgc.js +23 -0
  82. package/package.json +32 -24
  83. package/dist/assets/plugins/assets/base-_m1hGahv.css +0 -2
  84. package/dist/assets/plugins/chunks/po-web-runtime-CGjOl_1I.js +0 -1
  85. package/dist/assets/plugins/slots/approval.09e72f36-BW92gZQg.js +0 -2
  86. package/dist/assets/plugins/slots/artifacts.50b639bb-B6zDJhex.js +0 -1
  87. package/dist/assets/plugins/slots/builtin-tools.75108f21-DS-dJ07p.js +0 -7
  88. package/dist/assets/plugins/slots/codemode.c58fb583--t-nrGeQ.js +0 -10
  89. package/dist/assets/plugins/slots/domain.753f9f92-DWSqP3Jw.js +0 -1
  90. package/dist/assets/plugins/slots/mcp.82cc1ff5-jPY2OCuu.js +0 -109
  91. package/dist/assets/plugins/slots/skill.62a0a1b3-GtWLT33O.js +0 -4
  92. package/dist/assets/plugins/slots/vault.3cbfcdc3-B7BKfR_H.js +0 -1
  93. package/dist/harnessStore-BDI-s999.js +0 -1
  94. package/dist/majorModes-CzAWXyaf.js +0 -1
@@ -1,12 +1,13 @@
1
1
  import { J as composeServerProviderOverrides, Q as PO_FS_SERVICE, Yn as BACKGROUND_CONTEXT, at as requirePoFs, et as PO_SQLITE_SERVICE, ir as requirePoServerScope, l as nodeHost, nr as defineServiceContract, o as poHomeDirectory, ot as requirePoSqlite, p as getOrThrow, s as createSerialRunner, tr as PO_SERVER_SCOPE_SERVICE } from "./serverPlugin-pCqlBqQG.js";
2
- import { a as MAX_MESSAGES_PER_KEY, d as poApiCallerFrom, n as PO_SESSION_ATTENTION_EVENT, o as infoFor, s as isSealedEnvelope } from "./hubChannel-kFgtfJnv.js";
2
+ import { l as poApiCallerFrom, n as PO_SESSION_ATTENTION_EVENT } from "./hubChannel-Bi3PQrfD.js";
3
+ import { n as infoFor, r as isSealedEnvelope, t as MAX_MESSAGES_PER_KEY } from "./sealedChannel-BeWNTWys.js";
3
4
  import { n as Check } from "./value-DGT5IoiK.js";
4
- import { n as readTextIfExists } from "./platformFiles-BTDsAsmT.js";
5
- import { c as defineRoute, f as defineServerPlugin, n as composeRootInjects, s as defineRoot, t as composeRootHooks } from "./extensionFile-DpVvh-ud.js";
5
+ import { i as readTextIfExists } from "./platformFiles-Ccj9HCvA.js";
6
+ import { c as defineRoute, n as composeRootInjects, p as defineServerPlugin, s as defineRoot, t as composeRootHooks } from "./extensionFile-D7wk8tFr.js";
6
7
  import { a as PO_BACKGROUND_WORK_SERVICE, i as PO_BACKGROUND_WORK_CHANGED_EVENT, r as BackgroundProviderWorkItemSchema } from "./backgroundWork-BaczP3Z1.js";
7
8
  import "./platform-CyvF7X-b.js";
8
- import { n as writePrivateAtomicJsonAsync } from "./atomicJson-C_lN9leA.js";
9
9
  import "./piSettings-B6fsgIBA.js";
10
+ import { n as writePrivateAtomicJsonAsync } from "./atomicJson-BF1fVXy1.js";
10
11
  import { ECDH, createCipheriv, createDecipheriv, createECDH, createHash, createHmac, hkdfSync, randomBytes, timingSafeEqual } from "node:crypto";
11
12
  import path from "node:path";
12
13
  import { clearInterval as clearInterval$1, setInterval as setInterval$1, setTimeout } from "node:timers";
@@ -0,0 +1,217 @@
1
+ import { Et as String, J as composeServerProviderOverrides, Ot as Number, Qt as _Object_, an as _Array_, en as Optional, zt as Boolean } from "./serverPlugin-pCqlBqQG.js";
2
+ import { c as defineRoute, d as defineServerTool, i as defineHook, n as composeRootInjects, o as defineResource, p as defineServerPlugin, r as defineChannel, s as defineRoot, t as composeRootHooks, u as defineServerCommand } from "./extensionFile-D7wk8tFr.js";
3
+ import { n as readPackageResource, t as packageResourcePath } from "./index.edge-uSjRpm6Z.js";
4
+ import { t as PO_HELP_WHEN } from "./help-DjybmnPW.js";
5
+ //#region ../../default/po-runner/src/constants/runners.ts
6
+ const RUNNER_UNAVAILABLE_MESSAGE = "Subprocess supervision is unavailable on this host.";
7
+ //#endregion
8
+ //#region ../../default/po-runner/src/schemas/bashTool.ts
9
+ /** Replaces pi's built-in `bash` tool. Descriptions are agent-facing prompt copy. */
10
+ const BashParamsSchema = _Object_({
11
+ command: _Array_(String({
12
+ minLength: 1,
13
+ maxLength: 65536
14
+ }), {
15
+ minItems: 1,
16
+ maxItems: 32,
17
+ description: "Bash commands to run in order, stopping on first failure. Use a one-item array for one command. Each command gets a full log; return all log paths and only the last executed result. Do not pipe or redirect output to a file, head, or tail. Logs are saved automatically and returned output is bounded."
18
+ }),
19
+ timeout: Optional(Number({ description: "Timeout in seconds for each command (optional, no default timeout)" })),
20
+ background: Optional(Boolean({ description: "Start the command sequence in the background immediately. Use for dev servers, watchers and other commands you already know will not finish." })),
21
+ interactive: Optional(Boolean({ description: "Run only the last command under a pseudo terminal when it needs input. Earlier commands are noninteractive. Send input to the last stage runner ID with runner.input in code mode, or po-runner input without code mode." })),
22
+ name: Optional(String({ description: "Preferred runner name if the command ends up in the background. A name in use gets a suffix." }))
23
+ });
24
+ //#endregion
25
+ //#region ../../default/po-runner/src/extensions/workspaces/sessions/(backend)/_lib/serverRoot.edge.ts
26
+ /** Workers have no subprocess supervisor. Keep the package loadable, but never claim a command ran. */
27
+ const createRunnerServerRoot = ({ signal }) => {
28
+ let disposed = false;
29
+ const refuse = (callSignal) => {
30
+ signal.throwIfAborted();
31
+ callSignal?.throwIfAborted();
32
+ if (disposed) throw new Error("Runner session is disposed.");
33
+ throw new Error(RUNNER_UNAVAILABLE_MESSAGE);
34
+ };
35
+ const tool = {
36
+ name: "bash",
37
+ label: "bash",
38
+ description: RUNNER_UNAVAILABLE_MESSAGE,
39
+ parameters: BashParamsSchema,
40
+ executionMode: "serial",
41
+ execute: async (_id, _params, callSignal) => refuse(callSignal)
42
+ };
43
+ return {
44
+ value: {
45
+ sequences: void 0,
46
+ tool,
47
+ remoteTool: tool,
48
+ command: {
49
+ name: "runners",
50
+ description: RUNNER_UNAVAILABLE_MESSAGE,
51
+ execute: async () => refuse()
52
+ },
53
+ recoverCompaction: async () => void 0
54
+ },
55
+ onStop: () => {
56
+ disposed = true;
57
+ }
58
+ };
59
+ };
60
+ //#endregion
61
+ //#region ../../default/po-runner/src/extensions/workspaces/sessions/(backend)/root.server.ts
62
+ var root_server_default = defineRoot(createRunnerServerRoot);
63
+ //#endregion
64
+ //#region ../../default/po-runner/src/constants/webRunners.ts
65
+ const RUNNER_RUNS_TYPE = "runner_runs";
66
+ //#endregion
67
+ //#region ../../default/po-runner/src/services/runnersChannel/index.ts
68
+ function runnerPayload(value) {
69
+ return typeof value === "object" && value !== null && Array.isArray(value.runs);
70
+ }
71
+ /**
72
+ * The runners data channel consumes lifecycle-owned snapshots from the session
73
+ * server. Durable registry files are read by the owning session only, never by
74
+ * this hub channel.
75
+ */
76
+ function createRunnersChannel() {
77
+ return {
78
+ frameType: RUNNER_RUNS_TYPE,
79
+ start(host) {
80
+ const latest = /* @__PURE__ */ new Map();
81
+ const subscriptions = /* @__PURE__ */ new Map();
82
+ return {
83
+ payloadFor(scope) {
84
+ const runs = latest.get(scope.sessionId);
85
+ return runs === void 0 ? void 0 : { runs };
86
+ },
87
+ sessionAdded(scope) {
88
+ subscriptions.get(scope.sessionId)?.();
89
+ latest.delete(scope.sessionId);
90
+ const unsubscribe = host.directEvents.subscribe(RUNNER_RUNS_TYPE, scope.sessionId, (payload) => {
91
+ if (!runnerPayload(payload)) return;
92
+ latest.set(scope.sessionId, payload.runs);
93
+ host.publish(scope.sessionId, payload);
94
+ }, { replayLatest: true });
95
+ subscriptions.set(scope.sessionId, unsubscribe);
96
+ },
97
+ sessionRemoved(sessionId) {
98
+ subscriptions.get(sessionId)?.();
99
+ subscriptions.delete(sessionId);
100
+ latest.delete(sessionId);
101
+ },
102
+ close() {
103
+ for (const unsubscribe of subscriptions.values()) unsubscribe();
104
+ subscriptions.clear();
105
+ latest.clear();
106
+ }
107
+ };
108
+ }
109
+ };
110
+ }
111
+ //#endregion
112
+ //#region ../../default/po-runner/src/extensions/(backend)/channel/runnerRuns.server.ts
113
+ var runnerRuns_server_default = defineChannel(function runnerRunsChannel() {
114
+ return createRunnersChannel();
115
+ });
116
+ //#endregion
117
+ //#region ../../default/po-runner/src/extensions/workspaces/sessions/(backend)/api/runner/route.server.ts
118
+ /**
119
+ * Mounts this package's HTTP API at `runner`, which the folder names.
120
+ *
121
+ * The folder is the declaration: the build reads the base path off it and hands
122
+ * the browser a client bound to the same segment, so the mount is stated once
123
+ * rather than in a constant and in four URL builders that were each free to
124
+ * drift.
125
+ */
126
+ var route_server_default = defineRoute({
127
+ basePath: "runner",
128
+ start: () => ({
129
+ fetch: () => Response.json({ error: RUNNER_UNAVAILABLE_MESSAGE }, { status: 503 }),
130
+ close: () => void 0
131
+ })
132
+ });
133
+ //#endregion
134
+ //#region ../../default/po-runner/src/extensions/workspaces/sessions/(backend)/command/runners.server.ts
135
+ var runners_server_default = defineServerCommand((context) => context.root.command);
136
+ //#endregion
137
+ //#region ../../default/po-runner/src/extensions/workspaces/sessions/(backend)/hook/session-compact.server.ts
138
+ var session_compact_server_default = defineHook(({ root }) => ({
139
+ event: "session_compact",
140
+ handle: root.recoverCompaction
141
+ }));
142
+ //#endregion
143
+ //#region ../../default/po-runner/src/extensions/workspaces/sessions/(backend)/resource/codemode-how-to-runner.server.edge.ts
144
+ var codemode_how_to_runner_server_edge_default = defineResource({
145
+ name: "codemode-how-to-runner",
146
+ description: RUNNER_UNAVAILABLE_MESSAGE,
147
+ kind: "skill",
148
+ pinned: true,
149
+ read: () => `${RUNNER_UNAVAILABLE_MESSAGE}\nBash, background jobs, PTYs and runner logs are not available in this Worker. Do not claim commands ran or invent runner IDs. Use the namespaces this session actually provides.`
150
+ });
151
+ //#endregion
152
+ //#region ../../default/po-runner/src/extensions/workspaces/sessions/(backend)/resource/help-how-to-runner.server.ts
153
+ var help_how_to_runner_server_default = defineResource({
154
+ name: "help-how-to-runner",
155
+ description: "Use Po Pi Runner to supervise shell commands, inspect durable logs, provide interactive input, and stop background runs.",
156
+ when: PO_HELP_WHEN,
157
+ kind: "skill",
158
+ path: packageResourcePath("bundle:///po-runner/src/extensions/workspaces/sessions/(backend)/resource/help-how-to-runner.server.ts", "src/prompts/help-how-to-runner/SKILL.md"),
159
+ read: () => readPackageResource("bundle:///po-runner/src/extensions/workspaces/sessions/(backend)/resource/help-how-to-runner.server.ts", "src/prompts/help-how-to-runner/SKILL.md")
160
+ });
161
+ //#endregion
162
+ //#region ../../default/po-runner/src/extensions/workspaces/sessions/(backend)/tool/bash.server.ts
163
+ var bash_server_default = defineServerTool((context) => context.root.tool);
164
+ //#endregion
165
+ //#region ../../default/po-runner/generated/server.ts
166
+ const at = (value, context) => typeof value === "function" ? value(context) : value;
167
+ /* v8 ignore next -- generated normalization branch */
168
+ const defined = (values) => values.filter((value) => value !== void 0);
169
+ const via = (identity, value) => value === void 0 ? void 0 : {
170
+ ...identity,
171
+ ...value
172
+ };
173
+ const serverPlugin = defineServerPlugin({
174
+ name: "@agimon-ai/po-runner",
175
+ providerOverrides: composeServerProviderOverrides(root_server_default),
176
+ injects: composeRootInjects({ session: [root_server_default] }),
177
+ global: (context) => ({ get channels() {
178
+ return [() => via({ frameType: "runner_runs" }, at(runnerRuns_server_default, context))];
179
+ } }),
180
+ workspace: (context) => ({ get channels() {
181
+ return defined([context.hosted("global") ? void 0 : () => via({ frameType: "runner_runs" }, at(runnerRuns_server_default, context))]);
182
+ } }),
183
+ session: async (context) => {
184
+ const scopeSession = await context.scopeRoot("session", root_server_default, context);
185
+ const contextSession = {
186
+ ...context,
187
+ root: scopeSession.value
188
+ };
189
+ return {
190
+ ...composeRootHooks(scopeSession),
191
+ get api() {
192
+ return [at(route_server_default, contextSession)];
193
+ },
194
+ get channels() {
195
+ return defined([context.hosted("global") ? void 0 : () => via({ frameType: "runner_runs" }, at(runnerRuns_server_default, context))]);
196
+ },
197
+ get commands() {
198
+ return [via({ name: "runners" }, at(runners_server_default, contextSession))];
199
+ },
200
+ get hooks() {
201
+ return [via({ event: "session_compact" }, at(session_compact_server_default, contextSession))];
202
+ },
203
+ get resources() {
204
+ return [at(codemode_how_to_runner_server_edge_default, contextSession), at(help_how_to_runner_server_default, contextSession)];
205
+ },
206
+ get tools() {
207
+ return [via({ name: "bash" }, at(bash_server_default, contextSession))];
208
+ },
209
+ services: [...scopeSession.services ?? []],
210
+ get activities() {
211
+ return [...scopeSession.activities ?? []];
212
+ }
213
+ };
214
+ }
215
+ });
216
+ //#endregion
217
+ export { serverPlugin as default, serverPlugin };
@@ -1,14 +1,14 @@
1
1
  import { At as Null, Et as String$1, I as PoHeadlessPromptAdmissionError, It as Literal, J as composeServerProviderOverrides, Q as PO_FS_SERVICE, Qt as _Object_, R as PoSessionSetupError, V as isPoHeadlessPromptAdmissionError, Yn as BACKGROUND_CONTEXT, an as _Array_, at as requirePoFs, en as Optional, et as PO_SQLITE_SERVICE, ir as requirePoServerScope, l as nodeHost, nr as defineServiceContract, o as poHomeDirectory, ot as requirePoSqlite, p as getOrThrow, s as createSerialRunner, st as PO_CONFIG_SERVICE, tr as PO_SERVER_SCOPE_SERVICE, wt as Union } from "./serverPlugin-pCqlBqQG.js";
2
2
  import { n as Check } from "./value-DGT5IoiK.js";
3
3
  import { m as jsonApiResponses, t as defineApiContract } from "./apiContracts-CDJ9sPkE.js";
4
- import { a as writeFileAtomic, i as removePath, t as pathExists } from "./platformFiles-BTDsAsmT.js";
5
- import { c as defineRoute, f as defineServerPlugin, i as defineHook, l as defineRoutedContribution, n as composeRootInjects, o as defineResource, p as runCleanups, s as defineRoot, t as composeRootHooks } from "./extensionFile-DpVvh-ud.js";
6
- import { n as readPackageResource, t as packageResourcePath } from "./index.edge-BNElrrHY.js";
4
+ import { n as pathExists, o as removePath, s as writeFileAtomic } from "./platformFiles-Ccj9HCvA.js";
5
+ import { c as defineRoute, i as defineHook, l as defineRoutedContribution, m as runCleanups, n as composeRootInjects, o as defineResource, p as defineServerPlugin, s as defineRoot, t as composeRootHooks } from "./extensionFile-D7wk8tFr.js";
6
+ import { n as readPackageResource, t as packageResourcePath } from "./index.edge-uSjRpm6Z.js";
7
7
  import { l as readPoPersonTimeZone, o as PO_PERSON_TIME_ZONE_SERVICE, u as PO_PROFILE_IDENTITY_ENTRY_TYPE } from "./contextProjection-DlB6wzhm.js";
8
8
  import "./platform-CyvF7X-b.js";
9
9
  import "./piSettings-B6fsgIBA.js";
10
- import { a as commitGlobalProfileRootAsync, c as buildPersonaPrompt, d as parseProfileBinding, f as parseProfileVaultSecrets, i as ProfileCatalogChangedError, l as loadProfiles, o as loadProfilesAsync, s as planGlobalProfileRootAsync, u as inlineProfile } from "./sessionConfig-BLmM5XLM.js";
11
- import "./exports-2Vv52b9v.js";
10
+ import { a as commitGlobalProfileRootAsync, c as buildPersonaPrompt, d as parseProfileBinding, f as parseProfileVaultSecrets, i as ProfileCatalogChangedError, l as loadProfiles, o as loadProfilesAsync, s as planGlobalProfileRootAsync, u as inlineProfile } from "./sessionConfig-DzAs6Pt-.js";
11
+ import "./exports-CxkWsXI9.js";
12
12
  import { i as readPoCodemode, n as PO_CODEMODE_SERVICE } from "./codemode-CZ_eYTwm.js";
13
13
  import path from "node:path";
14
14
  //#region ../../foundations/po-profile/src/constants/profileMemory.ts
@@ -0,0 +1,190 @@
1
+ import { Et as String, Lt as Integer, Q as PO_FS_SERVICE, Qt as _Object_, Yn as BACKGROUND_CONTEXT, Zn as withAbortSignal, at as requirePoFs, en as Optional } from "./serverPlugin-pCqlBqQG.js";
2
+ import { r as readBoundedFile, t as FileTooLargeError } from "./platformFiles-Ccj9HCvA.js";
3
+ import { d as defineServerTool, p as defineServerPlugin } from "./extensionFile-D7wk8tFr.js";
4
+ import { n as formatDimensionNote, r as resizeImage } from "./index.edge-COJJ_Dv2.js";
5
+ import "./platform-CyvF7X-b.js";
6
+ import { t as readPiImageSettings } from "./piConfig-CcoMX-1L.js";
7
+ import { a as decodeUtf8, c as formatFileHeader, i as computeFileTag, l as formatTaggedLine, o as displayPath, p as splitLines, r as resolveReadInputPath, t as isWritableFile } from "./index.edge-ClLTmPFz.js";
8
+ import { i as truncateLine, n as formatSize, r as truncateHead, t as DEFAULT_MAX_BYTES } from "./truncate-M3KbFyVj.js";
9
+ //#region ../../default/po-read/src/schemas/readTool.ts
10
+ const ReadParamsSchema = _Object_({
11
+ path: String({ description: "Path to the file to read." }),
12
+ offset: Optional(Integer({
13
+ minimum: 1,
14
+ description: "One-based line offset."
15
+ })),
16
+ limit: Optional(Integer({
17
+ minimum: 1,
18
+ description: "Maximum number of lines to return."
19
+ }))
20
+ });
21
+ //#endregion
22
+ //#region ../../default/po-read/src/services/readHost/index.edge.ts
23
+ const resizeOperations = {
24
+ resize: resizeImage,
25
+ formatDimensionNote
26
+ };
27
+ function readImageLimits(filesystem, context) {
28
+ return readPiImageSettings(filesystem, context);
29
+ }
30
+ //#endregion
31
+ //#region ../../default/po-read/src/services/readImage/index.ts
32
+ const OMITTED_NOTE = "[Image omitted: could not be resized below the inline image size limit.]";
33
+ async function applyImageLimits(content, limits, operations) {
34
+ if (!limits.autoResize || !content.some((part) => part.type === "image")) return content;
35
+ const resolved = [];
36
+ for (const part of content) {
37
+ if (part.type !== "image") {
38
+ resolved.push(part);
39
+ continue;
40
+ }
41
+ const resized = await operations.resize(Buffer.from(part.data, "base64"), part.mimeType, {
42
+ maxWidth: limits.maxDimension,
43
+ maxHeight: limits.maxDimension
44
+ });
45
+ if (!resized) {
46
+ resolved.push({
47
+ type: "text",
48
+ text: OMITTED_NOTE
49
+ });
50
+ continue;
51
+ }
52
+ resolved.push({
53
+ type: "image",
54
+ data: resized.data,
55
+ mimeType: resized.mimeType
56
+ });
57
+ const note = operations.formatDimensionNote(resized);
58
+ if (note) resolved.push({
59
+ type: "text",
60
+ text: note
61
+ });
62
+ }
63
+ return resolved;
64
+ }
65
+ //#endregion
66
+ //#region ../../default/po-read/src/services/readTool/index.ts
67
+ function assertNotAborted(signal) {
68
+ if (signal?.aborted) throw new Error("Operation aborted");
69
+ }
70
+ function isImagePath(filePath) {
71
+ const extension = filePath.toLowerCase().match(/\.([a-z0-9]+)$/u)?.[1];
72
+ if (!extension) return void 0;
73
+ return {
74
+ avif: "image/avif",
75
+ gif: "image/gif",
76
+ jpeg: "image/jpeg",
77
+ jpg: "image/jpeg",
78
+ png: "image/png",
79
+ webp: "image/webp"
80
+ }[extension];
81
+ }
82
+ async function executeHeadlessRead(params, cwd, signal, filesystem) {
83
+ assertNotAborted(signal);
84
+ const absolutePath = await resolveReadInputPath(params.path, cwd);
85
+ const context = signal ? withAbortSignal(signal, BACKGROUND_CONTEXT) : BACKGROUND_CONTEXT;
86
+ let bytes;
87
+ try {
88
+ bytes = Buffer.from(await readBoundedFile(filesystem, absolutePath, 8388608, context));
89
+ } catch (error) {
90
+ if (error instanceof FileTooLargeError) throw new Error("File is over 8 MiB, hashline read refuses; use runner log tools for logs.", { cause: error });
91
+ throw error;
92
+ }
93
+ assertNotAborted(signal);
94
+ const mimeType = isImagePath(absolutePath);
95
+ if (mimeType) return { content: await applyImageLimits([{
96
+ type: "text",
97
+ text: `Read image file ${displayPath(absolutePath, cwd)} [${mimeType}]`
98
+ }, {
99
+ type: "image",
100
+ data: bytes.toString("base64"),
101
+ mimeType
102
+ }], await readImageLimits(filesystem, context), resizeOperations) };
103
+ if (!await isWritableFile(absolutePath)) return { content: [{
104
+ type: "text",
105
+ text: decodeUtf8(bytes, displayPath(absolutePath, cwd))
106
+ }] };
107
+ return createTaggedReadResult(bytes, displayPath(absolutePath, cwd), params);
108
+ }
109
+ function createTaggedReadResult(bytes, path, params) {
110
+ const lines = splitLines(decodeUtf8(bytes, path));
111
+ const startIndex = params.offset === void 0 ? 0 : params.offset - 1;
112
+ if (startIndex >= lines.length) throw new Error(`Offset ${params.offset} is beyond end of file (${lines.length} lines total).`);
113
+ const endIndex = params.limit === void 0 ? lines.length : Math.min(lines.length, startIndex + params.limit);
114
+ const selected = lines.slice(startIndex, endIndex);
115
+ const header = formatFileHeader(path, computeFileTag(bytes));
116
+ const compactedLines = [];
117
+ const headerBytes = Buffer.byteLength(header, "utf8") + 1;
118
+ const tagged = selected.map((line, index) => {
119
+ const lineNumber = startIndex + index + 1;
120
+ const full = formatTaggedLine(line, lineNumber);
121
+ if (Buffer.byteLength(full, "utf8") <= 51200 - headerBytes) return full;
122
+ compactedLines.push(lineNumber);
123
+ return formatTaggedLine(truncateLine(line).text, lineNumber, "", line);
124
+ });
125
+ const truncation = truncateHead([header, ...tagged].join("\n"));
126
+ let text = truncation.content;
127
+ let details;
128
+ if (truncation.truncated) {
129
+ const shownLines = Math.max(0, truncation.outputLines - 1);
130
+ const nextOffset = startIndex + shownLines + 1;
131
+ const reason = truncation.truncatedBy === "bytes" ? `, ${formatSize(DEFAULT_MAX_BYTES)} limit` : "";
132
+ text += `\n\n[Showing ${shownLines} anchored lines${reason}. Use offset=${nextOffset} to continue.]`;
133
+ details = { truncation };
134
+ } else {
135
+ const notices = [];
136
+ if (compactedLines.length > 0) notices.push(`Lines ${compactedLines.join(", ")} shown compactly. Their anchors hash the full original lines`);
137
+ if (endIndex < lines.length) notices.push(`${lines.length - endIndex} more lines in file. Use offset=${endIndex + 1} to continue`);
138
+ if (notices.length > 0) text += `\n\n[${notices.join(". ")}.]`;
139
+ }
140
+ return {
141
+ content: [{
142
+ type: "text",
143
+ text
144
+ }],
145
+ details
146
+ };
147
+ }
148
+ function createHeadlessReadTool(filesystem) {
149
+ return {
150
+ name: "read",
151
+ label: "read",
152
+ description: "Read a writable text file with an exact-byte file tag and stable line anchors. Non-writable files and images return native-compatible content. Files over 8 MiB are refused. Text is truncated to 50.0KB.",
153
+ promptSnippet: "Read file contents with snapshot-bound line anchors",
154
+ promptGuidelines: ["Use read before edit. When hashline metadata is present, preserve the @file hash and anchors such as 5#abc exactly.", "Continue large reads with offset until the required anchored lines are visible."],
155
+ parameters: ReadParamsSchema,
156
+ executionMode: "parallel",
157
+ execute: async (_toolCallId, params, signal, _onUpdate, context) => executeHeadlessRead(params, context.cwd, signal, typeof filesystem === "function" ? filesystem() : filesystem)
158
+ };
159
+ }
160
+ //#endregion
161
+ //#region ../../default/po-read/src/extensions/workspaces/sessions/(backend)/tool/read.server.ts
162
+ var read_server_default = defineServerTool(({ context }) => {
163
+ let filesystem;
164
+ context.inject([PO_FS_SERVICE], (scoped) => {
165
+ const bound = requirePoFs(scoped);
166
+ filesystem = bound;
167
+ return () => {
168
+ if (filesystem === bound) filesystem = void 0;
169
+ };
170
+ });
171
+ return createHeadlessReadTool(() => {
172
+ if (!filesystem) throw new Error("Read filesystem service is unavailable.");
173
+ return filesystem;
174
+ });
175
+ });
176
+ //#endregion
177
+ //#region ../../default/po-read/generated/server.ts
178
+ const at = (value, context) => typeof value === "function" ? value(context) : value;
179
+ const via = (identity, value) => value === void 0 ? void 0 : {
180
+ ...identity,
181
+ ...value
182
+ };
183
+ const serverPlugin = defineServerPlugin({
184
+ name: "@agimon-ai/po-read",
185
+ session: (context) => ({ get tools() {
186
+ return [via({ name: "read" }, at(read_server_default, context))];
187
+ } })
188
+ });
189
+ //#endregion
190
+ export { serverPlugin as default, serverPlugin };
@@ -1,5 +1,5 @@
1
1
  import { J as composeServerProviderOverrides, Q as PO_FS_SERVICE, Yn as BACKGROUND_CONTEXT, at as requirePoFs, et as PO_SQLITE_SERVICE, ir as requirePoServerScope, l as nodeHost, o as poHomeDirectory, ot as requirePoSqlite, p as getOrThrow, tr as PO_SERVER_SCOPE_SERVICE } from "./serverPlugin-pCqlBqQG.js";
2
- import { f as defineServerPlugin, n as composeRootInjects, s as defineRoot, t as composeRootHooks } from "./extensionFile-DpVvh-ud.js";
2
+ import { n as composeRootInjects, p as defineServerPlugin, s as defineRoot, t as composeRootHooks } from "./extensionFile-D7wk8tFr.js";
3
3
  import "./platform-CyvF7X-b.js";
4
4
  import { t as applySqliteMigrations } from "./migrations-5gbLIQIc.js";
5
5
  import "./piSettings-B6fsgIBA.js";
@@ -1,17 +1,17 @@
1
1
  import { Et as String$1, It as Literal, J as composeServerProviderOverrides, Lt as Integer, Qt as _Object_, Xt as Unknown, Yn as BACKGROUND_CONTEXT, Zn as withAbortSignal, an as _Array_, at as requirePoFs, en as Optional, l as nodeHost, nt as readPoFs, o as poHomeDirectory, p as getOrThrow, wt as Union, zt as Boolean$1 } from "./serverPlugin-pCqlBqQG.js";
2
2
  import "./value-DGT5IoiK.js";
3
- import { a as writeFileAtomic, i as removePath } from "./platformFiles-BTDsAsmT.js";
4
- import { c as defineRoute, f as defineServerPlugin, l as defineRoutedContribution, n as composeRootInjects, o as defineResource, s as defineRoot, t as composeRootHooks } from "./extensionFile-DpVvh-ud.js";
5
- import { n as readPackageResource, t as packageResourcePath } from "./index.edge-BNElrrHY.js";
3
+ import { o as removePath, s as writeFileAtomic } from "./platformFiles-Ccj9HCvA.js";
4
+ import { c as defineRoute, l as defineRoutedContribution, n as composeRootInjects, o as defineResource, p as defineServerPlugin, s as defineRoot, t as composeRootHooks } from "./extensionFile-D7wk8tFr.js";
5
+ import { n as readPackageResource, t as packageResourcePath } from "./index.edge-uSjRpm6Z.js";
6
6
  import "./platform-CyvF7X-b.js";
7
- import { _ as isMap, a as globalPoConfigDirectory, h as Document, p as parseDocument, v as isScalar, y as isSeq } from "./layeredConfig-BhFC6TBD.js";
8
7
  import "./piSettings-B6fsgIBA.js";
9
- import { c as pluginDirectoryForSource, n as loadDomainsAsync, o as expandDomainNames, r as resolvePluginEntriesAsync, t as listDomainNamesAsync } from "./domains-CPX1dEVa.js";
10
- import { t as loadHarnessStateAsync } from "./harnessStore-Ct329wxJ.js";
8
+ import { a as globalPoConfigDirectory, b as isSeq, g as Document, m as parseDocument, v as isMap, y as isScalar } from "./layeredConfig-B4s0eZ5o.js";
9
+ import { c as pluginDirectoryForSource, n as loadDomainsAsync, o as expandDomainNames, r as resolvePluginEntriesAsync, t as listDomainNamesAsync } from "./domains-Bl6T2dKV.js";
10
+ import { t as loadHarnessStateAsync } from "./harnessStore-flLz1I0F.js";
11
11
  import { i as readPoCodemode, n as PO_CODEMODE_SERVICE } from "./codemode-CZ_eYTwm.js";
12
- import "./harnessStore-BDI-s999.js";
12
+ import "./harnessStore-Bap8lsAg.js";
13
13
  import { r as PO_USER_MCP_CONFIG_FILE, t as PO_MCP_PROJECTION_RESOLVER_SERVICE } from "./mcpProjection-BA6baFpi.js";
14
- import { i as materializePluginEntries, n as skillName, r as splitFrontmatter, t as stageMcpResources } from "./index.edge-DhV_hfZA.js";
14
+ import { i as materializePluginEntries, n as skillName, r as splitFrontmatter, t as stageMcpResources } from "./index.edge-CJ2TFpgF.js";
15
15
  import path from "node:path";
16
16
  //#region ../../foundations/po-domain/src/services/mcpFilter/core.ts
17
17
  /**
@@ -1,13 +1,6 @@
1
1
  import "./serverPlugin-pCqlBqQG.js";
2
- import { f as defineServerPlugin, u as defineServerCommand } from "./extensionFile-DpVvh-ud.js";
3
- //#region ../../core/po-core/src/schemas/pluginContributions.ts
4
- function defineCommand(command) {
5
- return {
6
- ...command,
7
- kind: "command"
8
- };
9
- }
10
- //#endregion
2
+ import { t as defineCommand } from "./pluginContributions-Be9EnCAW.js";
3
+ import { p as defineServerPlugin, u as defineServerCommand } from "./extensionFile-D7wk8tFr.js";
11
4
  //#region ../../foundations/po-notification/src/extensions/workspaces/sessions/(backend)/_lib/notificationCommand.ts
12
5
  const notificationCommand = defineCommand({
13
6
  name: "notify",
@@ -1,14 +1,14 @@
1
1
  import { $ as PO_SHELL_SERVICE, B as invalidImageReason, Et as String$1, J as composeServerProviderOverrides, Lt as Integer, Qt as _Object_, U as readPoHeadlessHost, Yn as BACKGROUND_CONTEXT, Z as PO_BROWSER_SERVICE, Zn as withAbortSignal, en as Optional, ir as requirePoServerScope, it as readPoNpm, n as PO_SESSION_FILES_SERVICE, nr as defineServiceContract, nt as readPoFs, p as getOrThrow, rt as readPoIsolate, st as PO_CONFIG_SERVICE, tr as PO_SERVER_SCOPE_SERVICE, tt as readPoBrowser } from "./serverPlugin-pCqlBqQG.js";
2
2
  import { i as Errors, n as Check, r as Check$1 } from "./value-DGT5IoiK.js";
3
- import { d as defineServerTool, f as defineServerPlugin, n as composeRootInjects, o as defineResource, s as defineRoot, t as composeRootHooks } from "./extensionFile-DpVvh-ud.js";
4
- import { n as readPackageResource, t as packageResourcePath } from "./index.edge-BNElrrHY.js";
3
+ import { d as defineServerTool, n as composeRootInjects, o as defineResource, p as defineServerPlugin, s as defineRoot, t as composeRootHooks } from "./extensionFile-D7wk8tFr.js";
4
+ import { n as readPackageResource, t as packageResourcePath } from "./index.edge-uSjRpm6Z.js";
5
5
  import { i as isUnattended, n as gateApproval, o as PO_APPROVAL_SERVICE, s as readPoApproval, t as ApprovalPendingError } from "./approval-BSX-MRTE.js";
6
6
  import { a as PO_BACKGROUND_WORK_SERVICE, c as readPoBackgroundWorkService } from "./backgroundWork-BaczP3Z1.js";
7
7
  import "./platform-CyvF7X-b.js";
8
- import { n as readPackageConfigurations, t as readMajorModesConfig } from "./majorModes-CZqrWarh.js";
9
- import "./exports-2Vv52b9v.js";
8
+ import { n as readPackageConfigurations, t as readMajorModesConfig } from "./majorModes-IygGmbb8.js";
9
+ import "./exports-CxkWsXI9.js";
10
10
  import { r as assertCodemodeNamespaceName, t as PO_CODEMODE_CONTRACT } from "./codemode-CZ_eYTwm.js";
11
- import "./majorModes-CzAWXyaf.js";
11
+ import "./majorModes-xpLK9HpD.js";
12
12
  //#endregion
13
13
  //#region ../../../node_modules/.pnpm/typebox@1.4.2/node_modules/typebox/build/schema/meta/meta.mjs
14
14
  /** A collection of all meta schemas. */
@@ -1,9 +1,10 @@
1
1
  import { J as composeServerProviderOverrides, Yn as BACKGROUND_CONTEXT, Zn as withAbortSignal, at as requirePoFs } from "./serverPlugin-pCqlBqQG.js";
2
- import { f as defineServerPlugin, l as defineRoutedContribution, n as composeRootInjects, o as defineResource, s as defineRoot, t as composeRootHooks } from "./extensionFile-DpVvh-ud.js";
3
- import { n as readPackageResource, t as packageResourcePath } from "./index.edge-BNElrrHY.js";
4
- import { a as readPoNotificationService, n as createPoTelemetryService } from "./notification-qvyJJ_Df.js";
2
+ import { l as defineRoutedContribution, n as composeRootInjects, o as defineResource, p as defineServerPlugin, s as defineRoot, t as composeRootHooks } from "./extensionFile-D7wk8tFr.js";
3
+ import { n as readPackageResource, t as packageResourcePath } from "./index.edge-uSjRpm6Z.js";
4
+ import { r as readPoNotificationService } from "./notification-bGq1frYG.js";
5
5
  import "./platform-CyvF7X-b.js";
6
- import { n as providePoConfigContext, r as createSettingsApi, t as createNativePoConfigContext } from "./sessionConfig-BLmM5XLM.js";
6
+ import { t as createPoTelemetry } from "./index.edge-ChYa2LU4.js";
7
+ import { n as providePoConfigContext, r as createSettingsApi, t as createNativePoConfigContext } from "./sessionConfig-DzAs6Pt-.js";
7
8
  import { a as createPoMcpProjectionService, i as createDisabledPoMcpProjection, n as PO_MCP_PROJECTION_SERVICE, o as isPoMcpProjection } from "./mcpProjection-BA6baFpi.js";
8
9
  //#region ../../core/po-core/src/schemas/readiness.ts
9
10
  /** Cordis service name for session-scoped package initialization. */
@@ -238,18 +239,6 @@ function createPoReadinessCoordinator(options = {}) {
238
239
  });
239
240
  }
240
241
  //#endregion
241
- //#region ../../core/po-core/src/services/poTelemetry/index.edge.ts
242
- function createPoTelemetry(options) {
243
- if (options.telemetryFactory && options.endpointResolver) return createPoTelemetryService(options);
244
- return createPoTelemetryService({
245
- ...options,
246
- env: {
247
- ...options.env,
248
- AGENT_TELEMETRY_DISABLED: "1"
249
- }
250
- });
251
- }
252
- //#endregion
253
242
  //#region ../../foundations/po-config/src/constants/config.ts
254
243
  const PACKAGE_SOURCE = "@agimon-ai/po-config";
255
244
  const CONFIG_HELP_SKILL = {
@@ -1,10 +1,10 @@
1
1
  import { Et as String$1, J as composeServerProviderOverrides, Qt as _Object_, Yn as BACKGROUND_CONTEXT, Zn as withAbortSignal, at as requirePoFs, en as Optional, l as nodeHost, p as getOrThrow } from "./serverPlugin-pCqlBqQG.js";
2
- import { f as defineServerPlugin, l as defineRoutedContribution, n as composeRootInjects, s as defineRoot, t as composeRootHooks } from "./extensionFile-DpVvh-ud.js";
3
- import { n as readPackageResource, t as packageResourcePath } from "./index.edge-BNElrrHY.js";
2
+ import { l as defineRoutedContribution, n as composeRootInjects, p as defineServerPlugin, s as defineRoot, t as composeRootHooks } from "./extensionFile-D7wk8tFr.js";
3
+ import { n as readPackageResource, t as packageResourcePath } from "./index.edge-uSjRpm6Z.js";
4
4
  import "./platform-CyvF7X-b.js";
5
- import { i as resolveSharedSkillsAsync, r as resolvePluginEntriesAsync, t as listDomainNamesAsync } from "./domains-CPX1dEVa.js";
5
+ import { i as resolveSharedSkillsAsync, r as resolvePluginEntriesAsync, t as listDomainNamesAsync } from "./domains-Bl6T2dKV.js";
6
6
  import { t as readHarnessState } from "./harnessState-gmzJcPGt.js";
7
- import { i as materializePluginEntries, n as skillName, r as splitFrontmatter } from "./index.edge-DhV_hfZA.js";
7
+ import { i as materializePluginEntries, n as skillName, r as splitFrontmatter } from "./index.edge-CJ2TFpgF.js";
8
8
  import path from "node:path";
9
9
  //#region ../../foundations/po-skill/src/constants/skillInventory.ts
10
10
  /**