pi2dsh 0.13.3 → 0.14.0

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 (35) hide show
  1. package/README.md +2 -0
  2. package/README.zh.md +2 -0
  3. package/dist/{analyzer-DBtUYKI1.mjs → analyzer-DPZ8LzSt.mjs} +2 -2
  4. package/dist/{analyzer-DBtUYKI1.mjs.map → analyzer-DPZ8LzSt.mjs.map} +1 -1
  5. package/dist/cli.mjs +2 -2
  6. package/dist/compat/pi-ai.d.mts +1 -1
  7. package/dist/compat/pi-ai.mjs +1 -1
  8. package/dist/compat/pi-coding-agent.mjs +1 -1
  9. package/dist/{compatibility-Bz6ZXA7F.mjs → compatibility-CP2tpyhg.mjs} +13 -1
  10. package/dist/compatibility-CP2tpyhg.mjs.map +1 -0
  11. package/dist/{credentials-oauth-CAohSLcB.mjs → credentials-oauth-Didpkkjx.mjs} +3 -3
  12. package/dist/{credentials-oauth-CAohSLcB.mjs.map → credentials-oauth-Didpkkjx.mjs.map} +1 -1
  13. package/dist/credentials-oauth.mjs +1 -1
  14. package/dist/host.d.mts +3 -1
  15. package/dist/host.d.mts.map +1 -1
  16. package/dist/host.mjs +4 -3
  17. package/dist/host.mjs.map +1 -1
  18. package/dist/index.d.mts +34 -4
  19. package/dist/index.d.mts.map +1 -1
  20. package/dist/index.mjs +117 -35
  21. package/dist/index.mjs.map +1 -1
  22. package/dist/{pi-ai-Dh7HUxbt.mjs → pi-ai-DpqiLdPA.mjs} +7 -2
  23. package/dist/{pi-ai-Dh7HUxbt.mjs.map → pi-ai-DpqiLdPA.mjs.map} +1 -1
  24. package/dist/{pi-ai-CfokFhIL.d.mts → pi-ai-ZU5MelXy.d.mts} +7 -2
  25. package/dist/{pi-ai-CfokFhIL.d.mts.map → pi-ai-ZU5MelXy.d.mts.map} +1 -1
  26. package/dist/{pi-coding-agent-Cvez0jkF.mjs → pi-coding-agent-DK8hbJP5.mjs} +0 -0
  27. package/dist/{pi-coding-agent-Cvez0jkF.mjs.map → pi-coding-agent-DK8hbJP5.mjs.map} +1 -1
  28. package/dist/{runtime-Dd2KhoX-.mjs → runtime-Bb9Bfk4M.mjs} +61 -10
  29. package/dist/runtime-Bb9Bfk4M.mjs.map +1 -0
  30. package/dist/runtime.d.mts +15 -1
  31. package/dist/runtime.d.mts.map +1 -1
  32. package/dist/runtime.mjs +1 -1
  33. package/package.json +8 -6
  34. package/dist/compatibility-Bz6ZXA7F.mjs.map +0 -1
  35. package/dist/runtime-Dd2KhoX-.mjs.map +0 -1
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  import { a as PackageIdentity, i as GeneratedRuntimeManifest, n as CompatibilityLevel, o as ResolvedPiPackage, r as CompatibilityReport, s as ResourceInventory, t as CompatibilityFinding } from "./types-B9VBF8le.mjs";
3
- import { applyPiHost, applyPreparedPiHost, manifestForInstalled, preparePiHost } from "./host.mjs";
3
+ import { PreparedPiHostPackage, applyPiHost, applyPreparedPiHost, manifestForInstalled, preparePiHost } from "./host.mjs";
4
4
  import { Context } from "@deepseek-ai/cordis";
5
5
  //#region src/engine.d.ts
6
6
  interface EngineConfig {
@@ -33,8 +33,38 @@ declare function discoverProfilePiPackages(profileRoot: string, options?: {
33
33
  exclude?: string[];
34
34
  warn?: (message: string) => void;
35
35
  }): Promise<DiscoveredPackage[]>;
36
- /** Discover a surface-owned, pre-publication Agent setup event from direct dependencies. */
37
- declare function discoverAgentSetupEvent(profileRoot: string): Promise<string | undefined>;
36
+ /**
37
+ * The single mount path on every DSH surface: one Pi runtime per root Agent.
38
+ *
39
+ * Pi instantiates its extensions once per session; DSH's twin of that scope is
40
+ * the Agent with its public `agent.ctx` ("contributions are agent-local,
41
+ * unwind on disposal"). Mounting is driven purely by official core seams, so
42
+ * the same semantics hold on the TUI, web, headless, ACP and config-declared
43
+ * agents alike:
44
+ *
45
+ * - `agent/created` fires on every publication path before the loop can run
46
+ * a first turn; it eagerly starts that agent's mount.
47
+ * - `system-prompt/assemble` (awaited waterfall, runs in every step's
48
+ * preStep) gates the assembly on the mount and patches the pre-waterfall
49
+ * tools snapshot from the official scoped projection `tools.schemas()` —
50
+ * stock DSH collects `assembly.tools` before dispatching the waterfall,
51
+ * so a mount that lands during the wait would otherwise miss turn one.
52
+ * - `tools/pre-execute` (awaited waterfall) closes the same window for
53
+ * direct executions that bypass assembly.
54
+ *
55
+ * `agent/session-start` deliberately is NOT the trigger: DSH documents it as a
56
+ * veto-less notification that cannot gate startup. The waterfalls above are
57
+ * the officially awaited seams, and the exact pattern of registering onto a
58
+ * foreign agent's ctx from a lifecycle event is what DSH's own schedule
59
+ * plugin ships.
60
+ *
61
+ * A mount failure never takes the Agent down: the agent keeps running as a
62
+ * plain DSH agent, the failure is reported loudly once, and only the Pi
63
+ * packages are missing — the capability-gap discipline, not a rollback.
64
+ */
65
+ declare function installAgentScopedMounts(ctx: Context, preparedPackages: Promise<readonly PreparedPiHostPackage[]>, report: {
66
+ warn(message: string): void;
67
+ }): void;
38
68
  /** Cordis plugin surface: `dsh plugin add pi2dsh` mounts this. */
39
69
  declare const name = "pi2dsh";
40
70
  declare const inject: string[];
@@ -114,5 +144,5 @@ declare function resolvePiPackage(source: string, cwd?: string): Promise<Resolve
114
144
  */
115
145
  declare function analyzePackage(pkg: ResolvedPiPackage): Promise<CompatibilityReport>;
116
146
  //#endregion
117
- export { API_RULES, CONTEXT_RULES, type CompatibilityFinding, type CompatibilityLevel, type CompatibilityReport, EVENT_RULES, type EngineConfig, type GeneratedRuntimeManifest, HOST_IMPORT_RULES, PI_AI_PACKAGES, PI_CODING_AGENT_PACKAGES, PI_TUI_PACKAGES, type PackageIdentity, type ResolvedPiPackage, type ResourceInventory, UI_CONTEXT_RULES, analyzePackage, apply, applyPiHost, applyPreparedPiHost, collectPiMcpServers, convertPiMcpConfig, discoverAgentSetupEvent, discoverProfilePiPackages, findProfileRoot, inject, manifestForInstalled, name, preparePiHost, renderMcpPatch, resolvePiPackage, ruleForApi, ruleForContextProperty, ruleForEvent, ruleForHostImport, ruleForUiContextProperty };
147
+ export { API_RULES, CONTEXT_RULES, type CompatibilityFinding, type CompatibilityLevel, type CompatibilityReport, EVENT_RULES, type EngineConfig, type GeneratedRuntimeManifest, HOST_IMPORT_RULES, PI_AI_PACKAGES, PI_CODING_AGENT_PACKAGES, PI_TUI_PACKAGES, type PackageIdentity, type ResolvedPiPackage, type ResourceInventory, UI_CONTEXT_RULES, analyzePackage, apply, applyPiHost, applyPreparedPiHost, collectPiMcpServers, convertPiMcpConfig, discoverProfilePiPackages, findProfileRoot, inject, installAgentScopedMounts, manifestForInstalled, name, preparePiHost, renderMcpPatch, resolvePiPackage, ruleForApi, ruleForContextProperty, ruleForEvent, ruleForHostImport, ruleForUiContextProperty };
118
148
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/engine.ts","../src/compatibility.ts","../src/mcp-config.ts","../src/source.ts","../src/index.ts"],"mappings":";;;;;UA6BiB;;EAEf;;EAEA;;;;;;;;EAQA,2BAA2B;;;iBAIb,gBAAgB;UAUtB;EACR;EACA;;;;;;;;iBAyBoB,0BACpB,qBACA;EAAW;EAAoB,QAAQ;IACtC,QAAQ;;iBA2CW,wBAAwB,sBAAsB;;cAsBvD;cACA;iBAES,MAAM,KAAK,SAAS,SAAQ,eAAoB;;;UCvJ5D;EACR,OAAO;EACP;;EAEA;;;;;;;;;UAUQ,oBAAoB;EAC5B;;cAQW;cAKA;cAKA;cAWA,mBAAmB,SAAS,eAAe,SAAS,eAAe;cAoNnE,eAAe,SAAS,eAAe;cA4BvC,kBAAkB,SAAS,eAAe;cA+B1C,WAAW,SAAS,eAAe;cA6InC,aAAa,SAAS,eAAe;iBAgHlC,WAAW,iBAAiB;iBAI5B,aAAa,gBAAgB;iBAO7B,kBAAkB,qBAAqB,uBAAuB;iBAS9D,uBAAuB,mBAAmB;iBAI1C,yBAAyB,mBAAmB;;;KCrkBvD,gBAAgB;UAEJ;EACf;EACA;EACA;EACA;EACA;EACA,MAAM;EACN;EACA;EACA,UAAU;EACV;;UAGe;EACf;EACA;;UAGe;EACf,SAAS;EACT,SAAS;EACT,UAAU;EACV;;iBA6Cc,oBAAoB,aAAa;EAA8B,SAAS,YAAY;EAAc;;iBAoElG,mBAAmB,aAAa,wBAA4B;;iBAsD5D,eAAe,QAAQ;;;iBC5EjB,iBAAiB,gBAAgB,eAAsB,QAAQ;;;;;;;;iBChH/D,eAAe,KAAK,oBAAoB,QAAQ"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/engine.ts","../src/compatibility.ts","../src/mcp-config.ts","../src/source.ts","../src/index.ts"],"mappings":";;;;;UA6BiB;;EAEf;;EAEA;;;;;;;;EAQA,2BAA2B;;;iBAIb,gBAAgB;UAUtB;EACR;EACA;;;;;;;;iBAyBoB,0BACpB,qBACA;EAAW;EAAoB,QAAQ;IACtC,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA6FK,yBACd,KAAK,SACL,kBAAkB,iBAAiB,0BACnC;EAAU,KAAK;;;cAmGJ;cACA;iBAES,MAAM,KAAK,SAAS,SAAQ,eAAoB;;;UCzR5D;EACR,OAAO;EACP;;EAEA;;;;;;;;;UAUQ,oBAAoB;EAC5B;;cAQW;cAKA;cAKA;cAYA,mBAAmB,SAAS,eAAe,SAAS,eAAe;cA+NnE,eAAe,SAAS,eAAe;cA4BvC,kBAAkB,SAAS,eAAe;cA+B1C,WAAW,SAAS,eAAe;cA6InC,aAAa,SAAS,eAAe;iBAgHlC,WAAW,iBAAiB;iBAI5B,aAAa,gBAAgB;iBAO7B,kBAAkB,qBAAqB,uBAAuB;iBAS9D,uBAAuB,mBAAmB;iBAI1C,yBAAyB,mBAAmB;;;KCjlBvD,gBAAgB;UAEJ;EACf;EACA;EACA;EACA;EACA;EACA,MAAM;EACN;EACA;EACA,UAAU;EACV;;UAGe;EACf;EACA;;UAGe;EACf,SAAS;EACT,SAAS;EACT,UAAU;EACV;;iBA6Cc,oBAAoB,aAAa;EAA8B,SAAS,YAAY;EAAc;;iBAoElG,mBAAmB,aAAa,wBAA4B;;iBAsD5D,eAAe,QAAQ;;;iBC5EjB,iBAAiB,gBAAgB,eAAsB,QAAQ;;;;;;;;iBChH/D,eAAe,KAAK,oBAAoB,QAAQ"}
package/dist/index.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
 
2
- import { r as registerVisionCompanions } from "./runtime-Dd2KhoX-.mjs";
2
+ import { r as registerVisionCompanions } from "./runtime-Bb9Bfk4M.mjs";
3
3
  import { t as resolvePiPackage } from "./source-0sA5z08z.mjs";
4
4
  import { applyPiHost, applyPreparedPiHost, manifestForInstalled, preparePiHost } from "./host.mjs";
5
- import { a as PI_AI_PACKAGES, c as UI_CONTEXT_RULES, d as ruleForEvent, f as ruleForHostImport, i as HOST_IMPORT_RULES, l as ruleForApi, n as CONTEXT_RULES, o as PI_CODING_AGENT_PACKAGES, p as ruleForUiContextProperty, r as EVENT_RULES, s as PI_TUI_PACKAGES, t as API_RULES, u as ruleForContextProperty } from "./compatibility-Bz6ZXA7F.mjs";
5
+ import { a as PI_AI_PACKAGES, c as UI_CONTEXT_RULES, d as ruleForEvent, f as ruleForHostImport, i as HOST_IMPORT_RULES, l as ruleForApi, n as CONTEXT_RULES, o as PI_CODING_AGENT_PACKAGES, p as ruleForUiContextProperty, r as EVENT_RULES, s as PI_TUI_PACKAGES, t as API_RULES, u as ruleForContextProperty } from "./compatibility-CP2tpyhg.mjs";
6
6
  import { n as convertPiMcpConfig, r as renderMcpPatch, t as collectPiMcpServers } from "./mcp-config-jmzbgdHa.mjs";
7
7
  import { readFile } from "node:fs/promises";
8
8
  import { existsSync } from "node:fs";
@@ -73,19 +73,98 @@ async function discoverProfilePiPackages(profileRoot, options = {}) {
73
73
  }
74
74
  return discovered;
75
75
  }
76
- /** Discover a surface-owned, pre-publication Agent setup event from direct dependencies. */
77
- async function discoverAgentSetupEvent(profileRoot) {
78
- const manifest = await readProfileManifest(profileRoot);
79
- const bundles = new Set(manifest.dsh?.profile?.bundles ?? []);
80
- for (const name of Object.keys(manifest.dependencies ?? {})) {
81
- if (!bundles.has(name)) continue;
82
- const dir = resolveDependencyDir(profileRoot, name);
83
- if (dir === void 0) continue;
76
+ /**
77
+ * The single mount path on every DSH surface: one Pi runtime per root Agent.
78
+ *
79
+ * Pi instantiates its extensions once per session; DSH's twin of that scope is
80
+ * the Agent with its public `agent.ctx` ("contributions are agent-local,
81
+ * unwind on disposal"). Mounting is driven purely by official core seams, so
82
+ * the same semantics hold on the TUI, web, headless, ACP and config-declared
83
+ * agents alike:
84
+ *
85
+ * - `agent/created` fires on every publication path before the loop can run
86
+ * a first turn; it eagerly starts that agent's mount.
87
+ * - `system-prompt/assemble` (awaited waterfall, runs in every step's
88
+ * preStep) gates the assembly on the mount and patches the pre-waterfall
89
+ * tools snapshot from the official scoped projection `tools.schemas()` —
90
+ * stock DSH collects `assembly.tools` before dispatching the waterfall,
91
+ * so a mount that lands during the wait would otherwise miss turn one.
92
+ * - `tools/pre-execute` (awaited waterfall) closes the same window for
93
+ * direct executions that bypass assembly.
94
+ *
95
+ * `agent/session-start` deliberately is NOT the trigger: DSH documents it as a
96
+ * veto-less notification that cannot gate startup. The waterfalls above are
97
+ * the officially awaited seams, and the exact pattern of registering onto a
98
+ * foreign agent's ctx from a lifecycle event is what DSH's own schedule
99
+ * plugin ships.
100
+ *
101
+ * A mount failure never takes the Agent down: the agent keeps running as a
102
+ * plain DSH agent, the failure is reported loudly once, and only the Pi
103
+ * packages are missing — the capability-gap discipline, not a rollback.
104
+ */
105
+ function installAgentScopedMounts(ctx, preparedPackages, report) {
106
+ const host = ctx;
107
+ const mounts = /* @__PURE__ */ new WeakMap();
108
+ const registry = () => {
84
109
  try {
85
- const event = JSON.parse(await readFile(join(dir, "package.json"), "utf8")).dshTui?.agentSetupEvent;
86
- if (typeof event === "string" && event.length > 0) return event;
87
- } catch {}
88
- }
110
+ return host.get?.("agents");
111
+ } catch {
112
+ return;
113
+ }
114
+ };
115
+ const isRootAgent = (agent) => {
116
+ const agents = registry();
117
+ const roots = agents?.roots;
118
+ if (typeof roots !== "function") return true;
119
+ try {
120
+ return roots.call(agents).includes(agent);
121
+ } catch {
122
+ return true;
123
+ }
124
+ };
125
+ const ensureMount = (agent) => {
126
+ let mount = mounts.get(agent);
127
+ if (mount === void 0) {
128
+ const started = { ready: Promise.resolve() };
129
+ started.ready = preparedPackages.then(async (prepared) => {
130
+ if (prepared.length === 0) return;
131
+ try {
132
+ await applyPreparedPiHost(agent.ctx, prepared, agent);
133
+ } catch (error) {
134
+ started.failure = error instanceof Error ? error.message : String(error);
135
+ report.warn(`[pi2dsh engine] Pi packages failed to mount for this agent; it continues without them: ${started.failure}`);
136
+ }
137
+ });
138
+ mounts.set(agent, started);
139
+ mount = started;
140
+ }
141
+ return mount;
142
+ };
143
+ host.on("agent/created", ((payload) => {
144
+ if (isRootAgent(payload.agent)) ensureMount(payload.agent);
145
+ }));
146
+ host.on("system-prompt/assemble", (async (assembly, context, next) => {
147
+ const agent = context.agent;
148
+ if (agent !== void 0 && isRootAgent(agent)) {
149
+ await ensureMount(agent).ready;
150
+ const schemas = host.tools?.schemas;
151
+ if (typeof schemas === "function") {
152
+ const present = new Set(assembly.tools.map((tool) => tool.name));
153
+ for (const schema of schemas.call(host.tools, agent)) if (!present.has(schema.name)) assembly.tools.push(schema);
154
+ }
155
+ }
156
+ return next();
157
+ }));
158
+ host.on("tools/pre-execute", (async (exec, next) => {
159
+ if (exec.agent !== void 0 && isRootAgent(exec.agent)) await ensureMount(exec.agent).ready;
160
+ return next();
161
+ }));
162
+ preparedPackages.then(() => {
163
+ const agents = registry();
164
+ const roots = agents?.roots;
165
+ if (typeof roots !== "function") return;
166
+ for (const agent of roots.call(agents)) ensureMount(agent);
167
+ });
89
168
  }
90
169
  /** Cordis plugin surface: `dsh plugin add pi2dsh` mounts this. */
91
170
  const name = "pi2dsh";
@@ -108,14 +187,13 @@ async function apply(ctx, config = {}) {
108
187
  const baseUrl = ctx.baseUrl;
109
188
  const profileRoot = (baseUrl !== void 0 ? findProfileRoot(fileURLToPath(new URL(".", baseUrl))) : void 0) ?? findProfileRoot(dirname(fileURLToPath(import.meta.url)));
110
189
  if (profileRoot === void 0) throw new Error("pi2dsh engine: no DSH profile root (cordis.yml + package.json) above the installed engine — is pi2dsh installed via `dsh plugin add pi2dsh`?");
111
- const packages = Array.isArray(config.packages) && config.packages.length > 0 ? config.packages.map((name) => ({ name })) : await discoverProfilePiPackages(profileRoot, {
112
- ...Array.isArray(config.exclude) ? { exclude: config.exclude } : {},
113
- warn
114
- });
190
+ let resolvePrepared;
191
+ installAgentScopedMounts(ctx, new Promise((resolve) => {
192
+ resolvePrepared = resolve;
193
+ }), { warn });
115
194
  registerVisionCompanions(ctx, config.visionCompanions);
116
- let prepared;
117
- if (packages.length === 0) {
118
- prepared = [{
195
+ try {
196
+ await applyPreparedPiHost(ctx, [{
119
197
  name: "pi2dsh-builtins",
120
198
  rootUrl: new URL(".", import.meta.url),
121
199
  manifest: {
@@ -129,20 +207,24 @@ async function apply(ctx, config = {}) {
129
207
  skillDirs: [],
130
208
  prompts: []
131
209
  }
132
- }];
133
- info("[pi2dsh engine] no Pi packages installed in this profile yet — add one with: dsh plugin --profile <p> add <pi-package>");
134
- } else {
210
+ }]);
211
+ const packages = Array.isArray(config.packages) && config.packages.length > 0 ? config.packages.map((name) => ({ name })) : await discoverProfilePiPackages(profileRoot, {
212
+ ...Array.isArray(config.exclude) ? { exclude: config.exclude } : {},
213
+ warn
214
+ });
215
+ if (packages.length === 0) {
216
+ info("[pi2dsh engine] no Pi packages installed in this profile yet — add one with: dsh plugin --profile <p> add <pi-package>");
217
+ resolvePrepared([]);
218
+ return;
219
+ }
135
220
  info(`[pi2dsh engine] preparing ${packages.length} Pi package(s): ${packages.map((pkg) => pkg.name).join(", ")}`);
136
- prepared = await preparePiHost({ packages: packages.map((pkg) => ({ name: pkg.name })) }, join(profileRoot, "package.json"));
221
+ const prepared = await preparePiHost({ packages: packages.map((pkg) => ({ name: pkg.name })) }, join(profileRoot, "package.json"));
222
+ await applyPreparedPiHost(ctx, prepared, void 0, { hostAnchor: true });
223
+ resolvePrepared(prepared);
224
+ } catch (error) {
225
+ resolvePrepared([]);
226
+ throw error;
137
227
  }
138
- const agentSetupEvent = await discoverAgentSetupEvent(profileRoot);
139
- if (agentSetupEvent === void 0) {
140
- await applyPreparedPiHost(ctx, prepared);
141
- return;
142
- }
143
- ctx.on(agentSetupEvent, async ({ agent, agentCtx }) => {
144
- await applyPreparedPiHost(agentCtx, prepared, agent);
145
- });
146
228
  }
147
229
  //#endregion
148
230
  //#region src/index.ts
@@ -152,10 +234,10 @@ async function apply(ctx, config = {}) {
152
234
  * @returns the compatibility report.
153
235
  */
154
236
  async function analyzePackage(pkg) {
155
- const { analyzePackage: run } = await import("./analyzer-DBtUYKI1.mjs");
237
+ const { analyzePackage: run } = await import("./analyzer-DPZ8LzSt.mjs");
156
238
  return run(pkg);
157
239
  }
158
240
  //#endregion
159
- export { API_RULES, CONTEXT_RULES, EVENT_RULES, HOST_IMPORT_RULES, PI_AI_PACKAGES, PI_CODING_AGENT_PACKAGES, PI_TUI_PACKAGES, UI_CONTEXT_RULES, analyzePackage, apply, applyPiHost, applyPreparedPiHost, collectPiMcpServers, convertPiMcpConfig, discoverAgentSetupEvent, discoverProfilePiPackages, findProfileRoot, inject, manifestForInstalled, name, preparePiHost, renderMcpPatch, resolvePiPackage, ruleForApi, ruleForContextProperty, ruleForEvent, ruleForHostImport, ruleForUiContextProperty };
241
+ export { API_RULES, CONTEXT_RULES, EVENT_RULES, HOST_IMPORT_RULES, PI_AI_PACKAGES, PI_CODING_AGENT_PACKAGES, PI_TUI_PACKAGES, UI_CONTEXT_RULES, analyzePackage, apply, applyPiHost, applyPreparedPiHost, collectPiMcpServers, convertPiMcpConfig, discoverProfilePiPackages, findProfileRoot, inject, installAgentScopedMounts, manifestForInstalled, name, preparePiHost, renderMcpPatch, resolvePiPackage, ruleForApi, ruleForContextProperty, ruleForEvent, ruleForHostImport, ruleForUiContextProperty };
160
242
 
161
243
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../src/engine.ts","../src/index.ts"],"sourcesContent":["// The pi2dsh engine: ONE installed copy of the bridge that mounts every Pi\n// package the user has added to their DSH profile.\n//\n// dsh plugin --profile p add pi2dsh ← the engine (this plugin)\n// dsh plugin --profile p add @kassing/pi-vision ← plain npm dependency\n// dsh plugin --profile p add pi-vision-tool ← plain npm dependency\n//\n// DSH's plugin manager records only packages that declare `dsh.bundle` as\n// profile layers; everything else stays an ordinary dependency (\"a plain\n// library is fine\"). The engine reads the profile manifest's DIRECT\n// dependencies — every entry there was an explicit `dsh plugin add` — and\n// mounts each package that identifies as a Pi package, all through one\n// bridge instance: one model ledger, one command space, one upgrade unit.\n//\n// Discovery is manifest-driven, never a node_modules scan (the lesson from\n// Prettier 3 dropping directory-based plugin discovery): the dependency list\n// is the user's explicit intent, and package identification uses the same\n// Pi markers `resolvePiPackage` has always used (the `pi` manifest field,\n// with Pi's directory conventions as fallback).\n\nimport { readFile } from 'node:fs/promises'\nimport { existsSync } from 'node:fs'\nimport { dirname, join } from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport type { Context } from '@deepseek-ai/cordis'\nimport { applyPreparedPiHost, preparePiHost, type PreparedPiHostPackage } from './host.js'\nimport { registerVisionCompanions } from './runtime.js'\nimport { resolvePiPackage } from './source.js'\n\nexport interface EngineConfig {\n /** Mount exactly these packages (skips discovery). */\n packages?: string[]\n /** Never mount these packages even when discovered. */\n exclude?: string[]\n /**\n * Image-admission companion routes. Default: AUTOMATIC — every text-only\n * llm route gets a \\`<route>-vision\\` companion that admits pasted images\n * (a mounted vision extension analyzes them; without one the image is\n * materialized to a file any image-capable tool can read). \\`false\\`\n * turns companions off; an explicit \\`{ <route>: [modelIds] }\\` narrows.\n */\n visionCompanions?: false | Record<string, readonly string[]>\n}\n\n/** Locate the DSH profile root: the nearest ancestor holding cordis.yml. */\nexport function findProfileRoot(start: string): string | undefined {\n let dir = start\n for (;;) {\n if (existsSync(join(dir, 'cordis.yml')) && existsSync(join(dir, 'package.json'))) return dir\n const parent = dirname(dir)\n if (parent === dir) return undefined\n dir = parent\n }\n}\n\ninterface DiscoveredPackage {\n name: string\n dir: string\n}\n\ninterface ProfileManifest {\n dependencies?: Record<string, string>\n dsh?: { profile?: { bundles?: string[] } }\n}\n\nasync function readProfileManifest(profileRoot: string): Promise<ProfileManifest> {\n return JSON.parse(await readFile(join(profileRoot, 'package.json'), 'utf8')) as ProfileManifest\n}\n\nfunction resolveDependencyDir(profileRoot: string, name: string): string | undefined {\n // Direct dependencies of the profile live under its node_modules by name\n // (pnpm links them there); resolving by path needs no exports gymnastics.\n const dir = join(profileRoot, 'node_modules', name)\n return existsSync(join(dir, 'package.json')) ? dir : undefined\n}\n\n/**\n * The profile's direct dependencies that identify as Pi packages: not the\n * engine itself, not a `dsh.bundle` (those are DSH plugins, not Pi\n * packages), carrying either Pi's `pi` manifest field or extension sources\n * under Pi's directory conventions.\n */\nexport async function discoverProfilePiPackages(\n profileRoot: string,\n options: { exclude?: string[], warn?: (message: string) => void } = {},\n): Promise<DiscoveredPackage[]> {\n const warn = options.warn ?? (() => {})\n const excluded = new Set(options.exclude ?? [])\n const manifest = await readProfileManifest(profileRoot)\n const discovered: DiscoveredPackage[] = []\n for (const name of Object.keys(manifest.dependencies ?? {})) {\n if (name === 'pi2dsh' || excluded.has(name)) continue\n const dir = resolveDependencyDir(profileRoot, name)\n if (dir === undefined) {\n warn(`[pi2dsh engine] dependency ${JSON.stringify(name)} is not installed under the profile; skipping`)\n continue\n }\n let packageJson: Record<string, unknown>\n try {\n packageJson = JSON.parse(await readFile(join(dir, 'package.json'), 'utf8')) as Record<string, unknown>\n } catch (error) {\n warn(`[pi2dsh engine] cannot read ${name}/package.json (${error instanceof Error ? error.message : String(error)}); skipping`)\n continue\n }\n // A dsh.bundle-declaring package is a DSH plugin layer, never a Pi package.\n if ((packageJson.dsh as { bundle?: unknown } | undefined)?.bundle !== undefined) continue\n if (packageJson.pi !== undefined && typeof packageJson.pi === 'object') {\n discovered.push({ name, dir })\n continue\n }\n // No `pi` field: fall back to Pi's directory conventions via the same\n // resolver every other mount path uses (a package with zero extension\n // sources is a plain library and stays unmounted).\n try {\n const pkg = await resolvePiPackage(dir)\n try {\n if (pkg.resources.extensions.length > 0) discovered.push({ name, dir })\n } finally {\n await pkg.dispose()\n }\n } catch {\n // Not resolvable as a Pi package — a plain library.\n }\n }\n return discovered\n}\n\n/** Discover a surface-owned, pre-publication Agent setup event from direct dependencies. */\nexport async function discoverAgentSetupEvent(profileRoot: string): Promise<string | undefined> {\n const manifest = await readProfileManifest(profileRoot)\n const bundles = new Set(manifest.dsh?.profile?.bundles ?? [])\n for (const name of Object.keys(manifest.dependencies ?? {})) {\n if (!bundles.has(name)) continue\n const dir = resolveDependencyDir(profileRoot, name)\n if (dir === undefined) continue\n try {\n const dependency = JSON.parse(await readFile(join(dir, 'package.json'), 'utf8')) as {\n dshTui?: { agentSetupEvent?: unknown }\n }\n const event = dependency.dshTui?.agentSetupEvent\n if (typeof event === 'string' && event.length > 0) return event\n } catch {\n // Package discovery already reports unreadable direct dependencies. A\n // surface capability probe only decides between scoped and legacy mount.\n }\n }\n return undefined\n}\n\n/** Cordis plugin surface: `dsh plugin add pi2dsh` mounts this. */\nexport const name = 'pi2dsh'\nexport const inject = ['tools', 'systemPrompt', 'commands', 'skills']\n\nexport async function apply(ctx: Context, config: EngineConfig = {}): Promise<void> {\n // Same emission as the runtime's logger helper: the cordis logger AND the\n // console — profile logger levels must never hide what the engine mounted.\n const log = (ctx as unknown as { logger?: { info?(m: string): void, warn?(m: string): void } }).logger\n const warn = (message: string): void => { log?.warn?.(message); console.warn(message) }\n const info = (message: string): void => { log?.info?.(message); console.log(message) }\n\n // The loader resolves plugins against the profile's baseUrl; that IS the\n // profile root. The ancestor walk from the installed engine is the\n // fallback for compositions without a loader (tests, hand-built hosts).\n const baseUrl = (ctx as unknown as { baseUrl?: string }).baseUrl\n const profileRoot = (baseUrl !== undefined ? findProfileRoot(fileURLToPath(new URL('.', baseUrl))) : undefined)\n ?? findProfileRoot(dirname(fileURLToPath(import.meta.url)))\n if (profileRoot === undefined) {\n throw new Error('pi2dsh engine: no DSH profile root (cordis.yml + package.json) above the installed engine — is pi2dsh installed via `dsh plugin add pi2dsh`?')\n }\n\n const packages = Array.isArray(config.packages) && config.packages.length > 0\n ? config.packages.map(name => ({ name }))\n : await discoverProfilePiPackages(profileRoot, {\n ...(Array.isArray(config.exclude) ? { exclude: config.exclude } : {}),\n warn,\n })\n registerVisionCompanions(ctx, config.visionCompanions)\n let prepared: PreparedPiHostPackage[]\n if (packages.length === 0) {\n // The host itself owns Pi's built-in provider directory and `/login`.\n // Mount an empty internal package so those host-level capabilities exist\n // even before the user installs their first community Pi package. Calling\n // registerVisionCompanions alone here left a fresh engine unable to run\n // `/login openai-codex`: DSH treated the unknown slash line as a model\n // prompt and failed on the unrelated default provider credential.\n prepared = [{\n name: 'pi2dsh-builtins',\n rootUrl: new URL('.', import.meta.url),\n manifest: {\n schemaVersion: 1,\n package: { name: 'pi2dsh-builtins', version: '0.0.0', source: 'engine' },\n extensions: [],\n skillDirs: [],\n prompts: [],\n },\n }]\n info('[pi2dsh engine] no Pi packages installed in this profile yet — add one with: dsh plugin --profile <p> add <pi-package>')\n } else {\n info(`[pi2dsh engine] preparing ${packages.length} Pi package(s): ${packages.map(pkg => pkg.name).join(', ')}`)\n prepared = await preparePiHost(\n { packages: packages.map(pkg => ({ name: pkg.name })) },\n join(profileRoot, 'package.json'),\n )\n }\n\n const agentSetupEvent = await discoverAgentSetupEvent(profileRoot)\n if (agentSetupEvent === undefined) {\n // Web, headless and older TUI surfaces do not expose a pre-publication\n // contributor seam. Preserve pi2dsh's established host-scoped behavior on\n // those products; the per-Agent path below is an additive surface\n // capability, never a regression for existing profiles.\n await applyPreparedPiHost(ctx, prepared)\n return\n }\n\n // dsh-TUI runs this serial event from its existing agents.create/resume\n // setup callback, after preset composition and before DSH publishes the\n // Agent. Every Agent therefore receives fresh Pi extension instances and\n // owns their effects through its agentCtx; stock DSH Core needs no patch.\n ;(ctx as unknown as {\n on(name: string, listener: (payload: { agent: Record<string, unknown>, agentCtx: Context }) => Promise<void>): () => void\n }).on(agentSetupEvent, async ({ agent, agentCtx }) => {\n await applyPreparedPiHost(agentCtx, prepared, agent)\n })\n}\n","// Engine surface: `dsh plugin add pi2dsh` resolves this entry as a cordis\n// plugin (named exports, no default — a default export would make the\n// loader discard the function-plugin namespace).\nexport { apply, inject, name, discoverAgentSetupEvent, discoverProfilePiPackages, findProfileRoot, type EngineConfig } from './engine.js'\n\n// The CLI-only analysis surface loads lazily: its static-analysis dependency\n// (the 23 MB typescript compiler, an optional peer) must never be pulled\n// into a profile that installs the ENGINE. The dynamic import below keeps\n// the analyzer in its own chunk, off the engine's load path.\nimport type { CompatibilityReport, ResolvedPiPackage } from './types.js'\n\n/**\n * Static compatibility analysis of one resolved Pi package (CLI `inspect`).\n * @param pkg - the resolved package.\n * @returns the compatibility report.\n */\nexport async function analyzePackage(pkg: ResolvedPiPackage): Promise<CompatibilityReport> {\n const { analyzePackage: run } = await import('./analyzer.js')\n return run(pkg)\n}\n\nexport {\n API_RULES,\n CONTEXT_RULES,\n EVENT_RULES,\n HOST_IMPORT_RULES,\n PI_AI_PACKAGES,\n PI_CODING_AGENT_PACKAGES,\n PI_TUI_PACKAGES,\n UI_CONTEXT_RULES,\n ruleForApi,\n ruleForContextProperty,\n ruleForEvent,\n ruleForHostImport,\n ruleForUiContextProperty,\n} from './compatibility.js'\nexport { applyPiHost, applyPreparedPiHost, manifestForInstalled, preparePiHost } from './host.js'\nexport { collectPiMcpServers, convertPiMcpConfig, renderMcpPatch } from './mcp-config.js'\nexport { resolvePiPackage } from './source.js'\nexport type * from './types.js'\n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EAAE,gBAAgB,QAAQ,MAAM,OAAO;CAC7C,OAAO,IAAI,GAAG;AAChB"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/engine.ts","../src/index.ts"],"sourcesContent":["// The pi2dsh engine: ONE installed copy of the bridge that mounts every Pi\n// package the user has added to their DSH profile.\n//\n// dsh plugin --profile p add pi2dsh ← the engine (this plugin)\n// dsh plugin --profile p add @kassing/pi-vision ← plain npm dependency\n// dsh plugin --profile p add pi-vision-tool ← plain npm dependency\n//\n// DSH's plugin manager records only packages that declare `dsh.bundle` as\n// profile layers; everything else stays an ordinary dependency (\"a plain\n// library is fine\"). The engine reads the profile manifest's DIRECT\n// dependencies — every entry there was an explicit `dsh plugin add` — and\n// mounts each package that identifies as a Pi package, all through one\n// bridge instance: one model ledger, one command space, one upgrade unit.\n//\n// Discovery is manifest-driven, never a node_modules scan (the lesson from\n// Prettier 3 dropping directory-based plugin discovery): the dependency list\n// is the user's explicit intent, and package identification uses the same\n// Pi markers `resolvePiPackage` has always used (the `pi` manifest field,\n// with Pi's directory conventions as fallback).\n\nimport { readFile } from 'node:fs/promises'\nimport { existsSync } from 'node:fs'\nimport { dirname, join } from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport type { Context } from '@deepseek-ai/cordis'\nimport { applyPreparedPiHost, preparePiHost, type PreparedPiHostPackage } from './host.js'\nimport { registerVisionCompanions } from './runtime.js'\nimport { resolvePiPackage } from './source.js'\n\nexport interface EngineConfig {\n /** Mount exactly these packages (skips discovery). */\n packages?: string[]\n /** Never mount these packages even when discovered. */\n exclude?: string[]\n /**\n * Image-admission companion routes. Default: AUTOMATIC — every text-only\n * llm route gets a \\`<route>-vision\\` companion that admits pasted images\n * (a mounted vision extension analyzes them; without one the image is\n * materialized to a file any image-capable tool can read). \\`false\\`\n * turns companions off; an explicit \\`{ <route>: [modelIds] }\\` narrows.\n */\n visionCompanions?: false | Record<string, readonly string[]>\n}\n\n/** Locate the DSH profile root: the nearest ancestor holding cordis.yml. */\nexport function findProfileRoot(start: string): string | undefined {\n let dir = start\n for (;;) {\n if (existsSync(join(dir, 'cordis.yml')) && existsSync(join(dir, 'package.json'))) return dir\n const parent = dirname(dir)\n if (parent === dir) return undefined\n dir = parent\n }\n}\n\ninterface DiscoveredPackage {\n name: string\n dir: string\n}\n\ninterface ProfileManifest {\n dependencies?: Record<string, string>\n dsh?: { profile?: { bundles?: string[] } }\n}\n\nasync function readProfileManifest(profileRoot: string): Promise<ProfileManifest> {\n return JSON.parse(await readFile(join(profileRoot, 'package.json'), 'utf8')) as ProfileManifest\n}\n\nfunction resolveDependencyDir(profileRoot: string, name: string): string | undefined {\n // Direct dependencies of the profile live under its node_modules by name\n // (pnpm links them there); resolving by path needs no exports gymnastics.\n const dir = join(profileRoot, 'node_modules', name)\n return existsSync(join(dir, 'package.json')) ? dir : undefined\n}\n\n/**\n * The profile's direct dependencies that identify as Pi packages: not the\n * engine itself, not a `dsh.bundle` (those are DSH plugins, not Pi\n * packages), carrying either Pi's `pi` manifest field or extension sources\n * under Pi's directory conventions.\n */\nexport async function discoverProfilePiPackages(\n profileRoot: string,\n options: { exclude?: string[], warn?: (message: string) => void } = {},\n): Promise<DiscoveredPackage[]> {\n const warn = options.warn ?? (() => {})\n const excluded = new Set(options.exclude ?? [])\n const manifest = await readProfileManifest(profileRoot)\n const discovered: DiscoveredPackage[] = []\n for (const name of Object.keys(manifest.dependencies ?? {})) {\n if (name === 'pi2dsh' || excluded.has(name)) continue\n const dir = resolveDependencyDir(profileRoot, name)\n if (dir === undefined) {\n warn(`[pi2dsh engine] dependency ${JSON.stringify(name)} is not installed under the profile; skipping`)\n continue\n }\n let packageJson: Record<string, unknown>\n try {\n packageJson = JSON.parse(await readFile(join(dir, 'package.json'), 'utf8')) as Record<string, unknown>\n } catch (error) {\n warn(`[pi2dsh engine] cannot read ${name}/package.json (${error instanceof Error ? error.message : String(error)}); skipping`)\n continue\n }\n // A dsh.bundle-declaring package is a DSH plugin layer, never a Pi package.\n if ((packageJson.dsh as { bundle?: unknown } | undefined)?.bundle !== undefined) continue\n if (packageJson.pi !== undefined && typeof packageJson.pi === 'object') {\n discovered.push({ name, dir })\n continue\n }\n // No `pi` field: fall back to Pi's directory conventions via the same\n // resolver every other mount path uses (a package with zero extension\n // sources is a plain library and stays unmounted).\n try {\n const pkg = await resolvePiPackage(dir)\n try {\n if (pkg.resources.extensions.length > 0) discovered.push({ name, dir })\n } finally {\n await pkg.dispose()\n }\n } catch {\n // Not resolvable as a Pi package — a plain library.\n }\n }\n return discovered\n}\n\ninterface AgentScopedMount {\n ready: Promise<void>\n /** Set when the mount failed; the agent then runs as a plain DSH agent. */\n failure?: string\n}\n\n/** The loose shapes of the official DSH seams this file consumes. */\ninterface AgentLike {\n ctx: Context\n}\ninterface EngineHostContext {\n /** Un-injected reflection access (the ctx.get('loader') idiom): the engine\n * must not hard-depend on the agent registry — compositions without one\n * (bare test hosts) simply have no agents to mount for. */\n get?(name: string): unknown\n tools?: { schemas?(scope: unknown): Array<{ name: string }> }\n on(name: string, listener: (...args: never[]) => unknown): () => void\n}\ninterface AgentRegistryLike {\n roots?(): AgentLike[]\n}\n\n/**\n * The single mount path on every DSH surface: one Pi runtime per root Agent.\n *\n * Pi instantiates its extensions once per session; DSH's twin of that scope is\n * the Agent with its public `agent.ctx` (\"contributions are agent-local,\n * unwind on disposal\"). Mounting is driven purely by official core seams, so\n * the same semantics hold on the TUI, web, headless, ACP and config-declared\n * agents alike:\n *\n * - `agent/created` fires on every publication path before the loop can run\n * a first turn; it eagerly starts that agent's mount.\n * - `system-prompt/assemble` (awaited waterfall, runs in every step's\n * preStep) gates the assembly on the mount and patches the pre-waterfall\n * tools snapshot from the official scoped projection `tools.schemas()` —\n * stock DSH collects `assembly.tools` before dispatching the waterfall,\n * so a mount that lands during the wait would otherwise miss turn one.\n * - `tools/pre-execute` (awaited waterfall) closes the same window for\n * direct executions that bypass assembly.\n *\n * `agent/session-start` deliberately is NOT the trigger: DSH documents it as a\n * veto-less notification that cannot gate startup. The waterfalls above are\n * the officially awaited seams, and the exact pattern of registering onto a\n * foreign agent's ctx from a lifecycle event is what DSH's own schedule\n * plugin ships.\n *\n * A mount failure never takes the Agent down: the agent keeps running as a\n * plain DSH agent, the failure is reported loudly once, and only the Pi\n * packages are missing — the capability-gap discipline, not a rollback.\n */\nexport function installAgentScopedMounts(\n ctx: Context,\n preparedPackages: Promise<readonly PreparedPiHostPackage[]>,\n report: { warn(message: string): void },\n): void {\n const host = ctx as unknown as EngineHostContext\n const mounts = new WeakMap<object, AgentScopedMount>()\n\n const registry = (): AgentRegistryLike | undefined => {\n try {\n return host.get?.('agents') as AgentRegistryLike | undefined\n } catch {\n return undefined\n }\n }\n\n const isRootAgent = (agent: object): boolean => {\n // Subagents keep Pi's own sub-session semantics through the session\n // bridge; only runtime roots receive a Pi runtime (the same distinction\n // DSH's schedule plugin draws via agents.roots()).\n const agents = registry()\n const roots = agents?.roots\n if (typeof roots !== 'function') return true\n try {\n return (roots.call(agents) as unknown[]).includes(agent)\n } catch {\n return true\n }\n }\n\n const ensureMount = (agent: AgentLike): AgentScopedMount => {\n let mount = mounts.get(agent)\n if (mount === undefined) {\n const started: AgentScopedMount = { ready: Promise.resolve() }\n started.ready = preparedPackages.then(async prepared => {\n if (prepared.length === 0) return\n try {\n await applyPreparedPiHost(agent.ctx, prepared, agent as unknown as Record<string, unknown>)\n } catch (error) {\n // Loud, once per agent; the gates resolve so the plain DSH agent\n // keeps working. Faking success is forbidden — the message names\n // what is missing.\n started.failure = error instanceof Error ? error.message : String(error)\n report.warn(`[pi2dsh engine] Pi packages failed to mount for this agent; it continues without them: ${started.failure}`)\n }\n })\n mounts.set(agent, started)\n mount = started\n }\n return mount\n }\n\n // Eager start on publication. `agent/created` reaches host-level listeners\n // on every create/resume/config path, before the loop can open a turn.\n host.on('agent/created', ((payload: { agent: AgentLike }) => {\n if (isRootAgent(payload.agent)) ensureMount(payload.agent)\n }) as never)\n\n // Correctness boundary #1: no prompt assembly for a root agent proceeds\n // before its Pi runtime is mounted, and the tools snapshot taken before\n // this waterfall is reconciled against the official scoped projection.\n host.on('system-prompt/assemble', (async (\n assembly: { tools: Array<{ name: string }> },\n context: { agent?: AgentLike },\n next: () => Promise<unknown>,\n ) => {\n const agent = context.agent\n if (agent !== undefined && isRootAgent(agent)) {\n await ensureMount(agent).ready\n const schemas = host.tools?.schemas\n if (typeof schemas === 'function') {\n const present = new Set(assembly.tools.map(tool => tool.name))\n for (const schema of schemas.call(host.tools, agent)) {\n if (!present.has(schema.name)) assembly.tools.push(schema)\n }\n }\n }\n return next()\n }) as never)\n\n // Correctness boundary #2: tool execution for a root agent waits for the\n // same mount (serially awaited by the tool runtime before dispatch).\n host.on('tools/pre-execute', (async (\n exec: { agent?: AgentLike },\n next: () => Promise<unknown>,\n ) => {\n if (exec.agent !== undefined && isRootAgent(exec.agent)) await ensureMount(exec.agent).ready\n return next()\n }) as never)\n\n // Backfill: agents published before this plugin finished loading (a surface\n // that skips the official await-the-loader pattern DSH's headless runner\n // uses). Their next assembly still passes the gates above.\n void preparedPackages.then(() => {\n const agents = registry()\n const roots = agents?.roots\n if (typeof roots !== 'function') return\n for (const agent of roots.call(agents)) ensureMount(agent)\n })\n}\n\n/** Cordis plugin surface: `dsh plugin add pi2dsh` mounts this. */\nexport const name = 'pi2dsh'\nexport const inject = ['tools', 'systemPrompt', 'commands', 'skills']\n\nexport async function apply(ctx: Context, config: EngineConfig = {}): Promise<void> {\n // Same emission as the runtime's logger helper: the cordis logger AND the\n // console — profile logger levels must never hide what the engine mounted.\n const log = (ctx as unknown as { logger?: { info?(m: string): void, warn?(m: string): void } }).logger\n const warn = (message: string): void => { log?.warn?.(message); console.warn(message) }\n const info = (message: string): void => { log?.info?.(message); console.log(message) }\n\n // The loader resolves plugins against the profile's baseUrl; that IS the\n // profile root. The ancestor walk from the installed engine is the\n // fallback for compositions without a loader (tests, hand-built hosts).\n const baseUrl = (ctx as unknown as { baseUrl?: string }).baseUrl\n const profileRoot = (baseUrl !== undefined ? findProfileRoot(fileURLToPath(new URL('.', baseUrl))) : undefined)\n ?? findProfileRoot(dirname(fileURLToPath(import.meta.url)))\n if (profileRoot === undefined) {\n throw new Error('pi2dsh engine: no DSH profile root (cordis.yml + package.json) above the installed engine — is pi2dsh installed via `dsh plugin add pi2dsh`?')\n }\n\n // The single mount path, before any await: gates and lifecycle listeners\n // must exist the moment a surface can publish its first Agent. Package\n // preparation resolves behind this promise; the gates hold each agent's\n // first assembly until its own mount lands.\n let resolvePrepared!: (prepared: readonly PreparedPiHostPackage[]) => void\n const preparedPackages = new Promise<readonly PreparedPiHostPackage[]>(resolve => {\n resolvePrepared = resolve\n })\n installAgentScopedMounts(ctx, preparedPackages, { warn })\n\n registerVisionCompanions(ctx, config.visionCompanions)\n\n try {\n // The host half, mounted exactly once regardless of packages or agents:\n // Pi's built-in provider directory, `/login`, and credential recovery.\n // Without it a fresh engine cannot run `/login openai-codex`: DSH treats\n // the unknown slash line as a model prompt and fails on the unrelated\n // default provider credential. Community packages join the same\n // SharedHostState (keyed on ctx.root), so host-level resources stay\n // single-instance no matter which agent scope mounts them.\n await applyPreparedPiHost(ctx, [{\n name: 'pi2dsh-builtins',\n rootUrl: new URL('.', import.meta.url),\n manifest: {\n schemaVersion: 1,\n package: { name: 'pi2dsh-builtins', version: '0.0.0', source: 'engine' },\n extensions: [],\n skillDirs: [],\n prompts: [],\n },\n }])\n\n const packages = Array.isArray(config.packages) && config.packages.length > 0\n ? config.packages.map(name => ({ name }))\n : await discoverProfilePiPackages(profileRoot, {\n ...(Array.isArray(config.exclude) ? { exclude: config.exclude } : {}),\n warn,\n })\n if (packages.length === 0) {\n info('[pi2dsh engine] no Pi packages installed in this profile yet — add one with: dsh plugin --profile <p> add <pi-package>')\n resolvePrepared([])\n return\n }\n info(`[pi2dsh engine] preparing ${packages.length} Pi package(s): ${packages.map(pkg => pkg.name).join(', ')}`)\n const prepared = await preparePiHost(\n { packages: packages.map(pkg => ({ name: pkg.name })) },\n join(profileRoot, 'package.json'),\n )\n // Host anchors, before the per-Agent gates open: every package's\n // HOST-level contributions (provider routes, OAuth accounts, /login,\n // credential recovery, companions, skills) exist from engine apply — a\n // surface with zero live Agents (web at boot) still advertises them, the\n // first Agent's model resolution finds its routes, and routes survive\n // Agent churn. Anchors serve no Agent; sessions belong to the per-Agent\n // instances the gates mount.\n await applyPreparedPiHost(ctx, prepared, undefined, { hostAnchor: true })\n resolvePrepared(prepared)\n } catch (error) {\n // The gates must never hang on a failed preparation; agents keep running\n // as plain DSH agents while the engine failure propagates loudly.\n resolvePrepared([])\n throw error\n }\n}\n","// Engine surface: `dsh plugin add pi2dsh` resolves this entry as a cordis\n// plugin (named exports, no default — a default export would make the\n// loader discard the function-plugin namespace).\nexport { apply, inject, name, discoverProfilePiPackages, findProfileRoot, installAgentScopedMounts, type EngineConfig } from './engine.js'\n\n// The CLI-only analysis surface loads lazily: its static-analysis dependency\n// (the 23 MB typescript compiler, an optional peer) must never be pulled\n// into a profile that installs the ENGINE. The dynamic import below keeps\n// the analyzer in its own chunk, off the engine's load path.\nimport type { CompatibilityReport, ResolvedPiPackage } from './types.js'\n\n/**\n * Static compatibility analysis of one resolved Pi package (CLI `inspect`).\n * @param pkg - the resolved package.\n * @returns the compatibility report.\n */\nexport async function analyzePackage(pkg: ResolvedPiPackage): Promise<CompatibilityReport> {\n const { analyzePackage: run } = await import('./analyzer.js')\n return run(pkg)\n}\n\nexport {\n API_RULES,\n CONTEXT_RULES,\n EVENT_RULES,\n HOST_IMPORT_RULES,\n PI_AI_PACKAGES,\n PI_CODING_AGENT_PACKAGES,\n PI_TUI_PACKAGES,\n UI_CONTEXT_RULES,\n ruleForApi,\n ruleForContextProperty,\n ruleForEvent,\n ruleForHostImport,\n ruleForUiContextProperty,\n} from './compatibility.js'\nexport { applyPiHost, applyPreparedPiHost, manifestForInstalled, preparePiHost } from './host.js'\nexport { collectPiMcpServers, convertPiMcpConfig, renderMcpPatch } from './mcp-config.js'\nexport { resolvePi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KAAK,UAAU,KAAA,GAAW,EAAE,YAAY,KAAK,CAAC;EACxE,gBAAgB,QAAQ;CAC1B,SAAS,OAAO;EAGd,gBAAgB,CAAC,CAAC;EAClB,MAAM;CACR;AACF;;;;;;;;AC3VA,eAAsB,eAAe,KAAsD;CACzF,MAAM,EAAE,gBAAgB,QAAQ,MAAM,OAAO;CAC7C,OAAO,IAAI,GAAG;AAChB"}
@@ -3046,7 +3046,12 @@ const bedrockConverseStreamApi = () => lazyApi(async () => await importNodeOnlyA
3046
3046
  const piMessagesApi = () => lazyApi(() => import("./pi-messages-D61G2tgs.mjs"));
3047
3047
  //#endregion
3048
3048
  //#region src/compat/pi-ai.ts
3049
- /** Pi's standard stored-key → ordered environment fallback auth helper. */
3049
+ /**
3050
+ * Pi's standard stored-key → ordered environment fallback auth helper.
3051
+ * Semantics copied unchanged from Pi 0.84.1
3052
+ * (`packages/ai/src/auth/helpers.ts`, commit
3053
+ * 6f707eb36064e82af9c1320a7634f4dfad21049b).
3054
+ */
3050
3055
  function envApiKeyAuth(name, envVars) {
3051
3056
  return {
3052
3057
  name,
@@ -3236,4 +3241,4 @@ function StringEnum(values, options = {}) {
3236
3241
  //#endregion
3237
3242
  export { isContextOverflow as $, stream as A, openAICompletionsApi as B, loadAnthropicOAuth as C, modelsAreEqual as D, loadOpenAICodexOAuth as E, googleVertexApi as F, openaiCodexOAuth as G, kimiCodingOAuth as H, googleGenerativeAIApi as I, ModelsError as J, generatePKCE as K, azureOpenAIResponsesApi as L, piMessagesApi as M, bedrockConverseStreamApi as N, registerApiProvider as O, mistralConversationsApi as P, AssistantMessageEventStream as Q, openAICodexResponsesApi as R, getSupportedThinkingLevels as S, loadKimiCodingOAuth as T, githubCopilotOAuth as U, anthropicMessagesApi as V, anthropicOAuth as W, lazyApi$1 as X, createProvider as Y, lazyStream$1 as Z, getBuiltinProviders as _, __runWithPiAiLlmBridge as a, getProvider as b, builtinProviders as c, contentText as d, isRecoverableLength as et, envApiKeyAuth as f, getBuiltinModels as g, getBuiltinModel as h, __getPiAiLlmBridge as i, unregisterApiProviders as j, registerProvider as k, clampThinkingLevel as l, getApiProviders as m, Type$1 as n, retryAssistantCall as nt, __runWithPiAiRuntime as o, getApiProvider as p, pollOAuthDeviceCodeFlow as q, __createPiAiRuntimeRegistry as r, uuidv7 as rt, __setPiAiLlmBridge as s, StringEnum as t, isRetryableAssistantError as tt, complete as u, getModel as v, loadGitHubCopilotOAuth as w, getProviders as x, getModels as y, openAIResponsesApi as z };
3238
3243
 
3239
- //# sourceMappingURL=pi-ai-Dh7HUxbt.mjs.map
3244
+ //# sourceMappingURL=pi-ai-DpqiLdPA.mjs.map