pi2dsh 0.16.2 → 0.17.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.
- package/README.md +3 -1
- package/README.zh.md +3 -1
- package/dist/{analyzer-B-b4C_5O.mjs → analyzer-BgkCub5L.mjs} +2 -2
- package/dist/{analyzer-B-b4C_5O.mjs.map → analyzer-BgkCub5L.mjs.map} +1 -1
- package/dist/cli.mjs +2 -2
- package/dist/host.mjs +1 -1
- package/dist/index.mjs +3 -3
- package/dist/{mcp-config-BNL_uhE8.mjs → mcp-config-DoufpLUI.mjs} +2 -2
- package/dist/mcp-config-DoufpLUI.mjs.map +1 -0
- package/dist/{runtime-t-5iWtFO.mjs → runtime-DE2dU1cA.mjs} +78 -23
- package/dist/runtime-DE2dU1cA.mjs.map +1 -0
- package/dist/runtime.d.mts +42 -2
- package/dist/runtime.d.mts.map +1 -1
- package/dist/runtime.mjs +1 -1
- package/package.json +1 -1
- package/dist/mcp-config-BNL_uhE8.mjs.map +0 -1
- package/dist/runtime-t-5iWtFO.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -158,6 +158,7 @@ it work. **This is the list to trust.**
|
|
|
158
158
|
| [`pi-btw`](https://www.npmjs.com/package/pi-btw) | `/btw <question>` as a real child session in DSH's subagent UI; `/btw-inject`; `/btw --save`; main thread stays clean | CLI + web | [`side-conversation`](examples/side-conversation/) |
|
|
159
159
|
| [`pi-powerline-footer`](https://www.npmjs.com/package/pi-powerline-footer) | A terminal status line — model, thinking level, project, context usage — drawn into DSH's widget dock, colour included | web | [`presentation-surfaces`](examples/presentation-surfaces/) |
|
|
160
160
|
| [`pi-mcp-adapter`](https://www.npmjs.com/package/pi-mcp-adapter) | Full-screen manager in dsh-TUI; stdio/Streamable HTTP/SSE; discovery, direct/proxy/scripted calls, resources, prompts, images, structured content, MCP Apps, approval, elicitation, sampling, cancellation and restart through DSH runtimes; native `/mcp` preserved beside `/pi-mcp` | dsh-TUI | [`tui-mcp`](examples/tui-mcp/) · [evidence matrix](docs/mcp-compatibility.md) |
|
|
161
|
+
| [`@tintinweb/pi-subagents`](https://www.npmjs.com/package/@tintinweb/pi-subagents) | The model delegates to autonomous subagents: spawn (with real host-native tools), background + completion notify, mid-run steer, wait-for-result, resume with memory, stop that stays stopped, `/pi-agents` manager, and cross-restart reopen by archive identity — every child a native DSH session | CLI + dsh-TUI | [`subagents`](examples/subagents/) · [acceptance report](community/subagents-acceptance-report.md) |
|
|
161
162
|
| [`pi-provider-alibaba`](https://www.npmjs.com/package/pi-provider-alibaba) | Alibaba Token Plan (CN) with its plan-specific key: live catalog, cold-start dynamic model, complete tool loop and restart. The package also declares Coding/API routes, but each requires its own non-interchangeable credential | CLI + web | [`alibaba-token-plan`](examples/alibaba-token-plan/) |
|
|
162
163
|
| [`pi-vision-tool`](https://www.npmjs.com/package/pi-vision-tool) | Tool registration through a JSON-Schema shape DSH had to convert (`anyOf` → `oneOf`) | CLI + web | — |
|
|
163
164
|
| [`pi-approval-guardian`](https://www.npmjs.com/package/pi-approval-guardian) | Every tool call reviewed by a second model before execution; allow and deny both observed | CLI (bare env) | — |
|
|
@@ -195,7 +196,7 @@ useful.
|
|
|
195
196
|
| **MCP** | `pi-mcp-adapter` · `pi-mcp-extension` |
|
|
196
197
|
| **Web search & fetch** | `pi-web-access` · `pi-deepseek-search` · `pi-web-search` · `@ollama/pi-web-search` · `@juicesharp/rpiv-web-tools` |
|
|
197
198
|
| **Code navigation & editing** | `pi-lens` (ast-grep) · `@narumitw/pi-lsp` · `pi-readseek` · `@ff-labs/pi-fff` · `pi-landstrip` · `pi-hashline-edit-pro`¹ |
|
|
198
|
-
| **Subagents & background work** | `@
|
|
199
|
+
| **Subagents & background work** | `@gotgenes/pi-subagents` · `pi-background-tasks`² · `@mjasnikovs/pi-task` |
|
|
199
200
|
| **Memory** | `pi-hermes-memory` · `pi-goosedump` |
|
|
200
201
|
| **Planning & goals** | `@narumitw/pi-goal` · `pi-goal-list-loop-audit` · `@narumitw/pi-plan-mode` · `@juicesharp/rpiv-todo` |
|
|
201
202
|
| **Asking you / approvals** | `@juicesharp/rpiv-ask-user-question` · `pi-ask-user` · `@gotgenes/pi-permission-system` · `@juicesharp/rpiv-advisor` |
|
|
@@ -420,6 +421,7 @@ in one has actually been executed against a real DSH loop before landing.
|
|
|
420
421
|
| [`alibaba-token-plan`](examples/alibaba-token-plan/) | Use Alibaba Cloud Model Studio Plan routes through the original Pi provider; dynamic DeepSeek model, tool loop and restart included |
|
|
421
422
|
| [`custom-gateways`](examples/custom-gateways/) | Add any OpenAI-compatible gateway the official DSH way, and every Pi plugin sees it |
|
|
422
423
|
| [`tui-mcp`](examples/tui-mcp/) | Keep dsh-TUI's native `/mcp`, add the Pi ecosystem manager as `/pi-mcp`, and exercise its complete host-influenced MCP surface through DSH runtimes |
|
|
424
|
+
| [`subagents`](examples/subagents/) | The model runs a small team: delegate, background, steer mid-run, collect, resume with memory, stop for real, manage via `/pi-agents`, reopen across restarts |
|
|
423
425
|
|
|
424
426
|
## Other tools
|
|
425
427
|
|
package/README.zh.md
CHANGED
|
@@ -139,6 +139,7 @@ DSH 模型运行时的 sampling、取消与会话重启。完整证据矩阵:
|
|
|
139
139
|
| [`pi-btw`](https://www.npmjs.com/package/pi-btw) | `/btw <问题>` 跑成 DSH 子代理界面里的真子会话;`/btw-inject`;`/btw --save`;主会话保持干净 | CLI + Web | [`side-conversation`](examples/side-conversation/) |
|
|
140
140
|
| [`pi-powerline-footer`](https://www.npmjs.com/package/pi-powerline-footer) | 终端状态条(模型、思考档位、项目、上下文用量)画进 DSH 的 widget dock,带颜色 | Web | [`presentation-surfaces`](examples/presentation-surfaces/) |
|
|
141
141
|
| [`pi-mcp-adapter`](https://www.npmjs.com/package/pi-mcp-adapter) | 完整管理界面画进 dsh-TUI;stdio/Streamable HTTP/SSE;发现、直连/代理/脚本调用、resources、prompts、图片、结构化内容、MCP Apps、审批、elicitation、sampling、取消与重启全部穿过 DSH 运行时;原生 `/mcp` 与 `/pi-mcp` 共存 | dsh-TUI | [`tui-mcp`](examples/tui-mcp/) · [证据矩阵](docs/mcp-compatibility.md) |
|
|
142
|
+
| [`@tintinweb/pi-subagents`](https://www.npmjs.com/package/@tintinweb/pi-subagents) | 模型自己带团队:派子代理(真宿主原生工具)、后台跑+完成通知、运行中转向、等结果、带记忆续命、真停得住的打断、`/pi-agents` 管理面、跨重启按归档身份重开——每个子代理都是原生 DSH 会话 | CLI + dsh-TUI | [`subagents`](examples/subagents/) · [验收报告](community/subagents-acceptance-report.md) |
|
|
142
143
|
| [`pi-provider-alibaba`](https://www.npmjs.com/package/pi-provider-alibaba) | 阿里云 Token Plan(中国区)专属 key:实时目录、冷启动动态模型、完整工具闭环与重启均已实测;包也声明 Coding/API 路由,但必须分别使用不可混用的专属凭证 | CLI + Web | [`alibaba-token-plan`](examples/alibaba-token-plan/) |
|
|
143
144
|
| [`pi-vision-tool`](https://www.npmjs.com/package/pi-vision-tool) | 工具注册,且带一个 DSH 需要转换的 JSON Schema 形状(`anyOf` → `oneOf`) | CLI + Web | — |
|
|
144
145
|
| [`pi-approval-guardian`](https://www.npmjs.com/package/pi-approval-guardian) | 每次工具调用先由第二个模型审批;放行与拒绝两条路都看到了 | CLI(裸环境) | — |
|
|
@@ -169,7 +170,7 @@ Pi 目录里**月下载量前 50 的包**,每个都在真实 DSH 运行时里
|
|
|
169
170
|
| **MCP** | `pi-mcp-adapter` · `pi-mcp-extension` |
|
|
170
171
|
| **联网搜索与抓取** | `pi-web-access` · `pi-deepseek-search` · `pi-web-search` · `@ollama/pi-web-search` · `@juicesharp/rpiv-web-tools` |
|
|
171
172
|
| **代码导航与编辑** | `pi-lens`(ast-grep)· `@narumitw/pi-lsp` · `pi-readseek` · `@ff-labs/pi-fff` · `pi-landstrip` · `pi-hashline-edit-pro`¹ |
|
|
172
|
-
| **子代理与后台任务** | `@
|
|
173
|
+
| **子代理与后台任务** | `@gotgenes/pi-subagents` · `pi-background-tasks`² · `@mjasnikovs/pi-task` |
|
|
173
174
|
| **记忆** | `pi-hermes-memory` · `pi-goosedump` |
|
|
174
175
|
| **计划与目标** | `@narumitw/pi-goal` · `pi-goal-list-loop-audit` · `@narumitw/pi-plan-mode` · `@juicesharp/rpiv-todo` |
|
|
175
176
|
| **问你 / 审批** | `@juicesharp/rpiv-ask-user-question` · `pi-ask-user` · `@gotgenes/pi-permission-system` · `@juicesharp/rpiv-advisor` |
|
|
@@ -358,6 +359,7 @@ loop 上实际跑过才会进来。
|
|
|
358
359
|
| [`alibaba-token-plan`](examples/alibaba-token-plan/) | 通过原版 Pi provider 使用阿里云百炼 Plan;包含动态 DeepSeek 模型、工具闭环与重启验证 |
|
|
359
360
|
| [`custom-gateways`](examples/custom-gateways/) | 按 DSH 官方方式接任何 OpenAI 兼容网关,每个 Pi 插件都能看到它 |
|
|
360
361
|
| [`tui-mcp`](examples/tui-mcp/) | 保留 dsh-TUI 原生 `/mcp`,把 Pi 生态管理面作为 `/pi-mcp` 加进来,并让完整的宿主相关 MCP 功能面穿过 DSH 运行时 |
|
|
362
|
+
| [`subagents`](examples/subagents/) | 模型自己带小团队:派单、后台、中途转向、收结果、带记忆续命、真停得住、`/pi-agents` 管理、跨重启重开 |
|
|
361
363
|
|
|
362
364
|
## 其它工具
|
|
363
365
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { c as PI_AI_PACKAGES, f as ruleForApi, g as ruleForUiContextProperty, h as ruleForHostImport, l as PI_CODING_AGENT_PACKAGES, m as ruleForEvent, p as ruleForContextProperty, u as PI_TUI_PACKAGES } from "./mcp-config-
|
|
2
|
+
import { c as PI_AI_PACKAGES, f as ruleForApi, g as ruleForUiContextProperty, h as ruleForHostImport, l as PI_CODING_AGENT_PACKAGES, m as ruleForEvent, p as ruleForContextProperty, u as PI_TUI_PACKAGES } from "./mcp-config-DoufpLUI.mjs";
|
|
3
3
|
import { builtinModules } from "node:module";
|
|
4
4
|
import { lstat, readFile, readdir, stat } from "node:fs/promises";
|
|
5
5
|
import { basename, dirname, extname, join, relative, resolve } from "node:path";
|
|
@@ -623,4 +623,4 @@ async function analyzePackage(pkg) {
|
|
|
623
623
|
//#endregion
|
|
624
624
|
export { analyzePackage };
|
|
625
625
|
|
|
626
|
-
//# sourceMappingURL=analyzer-
|
|
626
|
+
//# sourceMappingURL=analyzer-BgkCub5L.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analyzer-B-b4C_5O.mjs","names":[],"sources":["../src/module-graph.ts","../src/analyzer.ts"],"sourcesContent":["import { builtinModules } from 'node:module'\nimport { lstat, readFile, readdir, stat } from 'node:fs/promises'\nimport { dirname, extname, join, relative, resolve } from 'node:path'\nimport ts from 'typescript'\n\nexport const SCRIPT_EXTENSIONS = new Set(['.ts', '.tsx', '.mts', '.cts', '.js', '.jsx', '.mjs', '.cjs'])\nconst MODULE_EXTENSIONS = ['.ts', '.tsx', '.mts', '.cts', '.js', '.jsx', '.mjs', '.cjs', '.json']\n\ninterface LocalReference {\n kind: 'module' | 'asset'\n specifier: string\n // A lazy reference is only evaluated when some feature runs, never while the\n // extension entry loads: dynamic import()/require() inside a function body,\n // or worker/data assets spawned on demand. Pi's loader therefore succeeds\n // even when a lazy target is unresolvable; problems on lazy paths surface\n // (identically under Pi and pi2dsh) only if that feature is used.\n lazy: boolean\n}\n\nexport interface LocalClosureIssue {\n file: string\n kind: LocalReference['kind']\n specifier: string\n detail: string\n lazy: boolean\n}\n\nexport interface LocalClosure {\n files: string[]\n // Files whose module-level code executes the moment the extension entry\n // loads (transitive non-lazy module edges from the entries).\n loadTimeFiles: Set<string>\n issues: LocalClosureIssue[]\n}\n\nexport function sourceKind(path: string): ts.ScriptKind {\n if (path.endsWith('.js') || path.endsWith('.mjs') || path.endsWith('.cjs')) return ts.ScriptKind.JS\n if (path.endsWith('.jsx')) return ts.ScriptKind.JSX\n if (path.endsWith('.tsx')) return ts.ScriptKind.TSX\n return ts.ScriptKind.TS\n}\n\nfunction literalModule(node: ts.Expression | undefined): string | undefined {\n return node !== undefined && (ts.isStringLiteral(node) || ts.isNoSubstitutionTemplateLiteral(node)) ? node.text : undefined\n}\n\nfunction isImportMetaUrl(node: ts.Expression | undefined): boolean {\n return node !== undefined && ts.isPropertyAccessExpression(node) && node.name.text === 'url'\n && ts.isMetaProperty(node.expression) && node.expression.keywordToken === ts.SyntaxKind.ImportKeyword\n}\n\nfunction localReferences(path: string, text: string): LocalReference[] {\n const source = ts.createSourceFile(path, text, ts.ScriptTarget.Latest, true, sourceKind(path))\n const values = new Map<string, LocalReference>()\n const createRequireNames = new Set<string>(['createRequire'])\n const requireNames = new Set<string>(['require'])\n const add = (kind: LocalReference['kind'], specifier: string, lazy: boolean): void => {\n // '#'-prefixed specifiers are Node subpath imports resolved through the\n // package's own `imports` map — package-local, not external dependencies.\n if (!specifier.startsWith('.') && !specifier.startsWith('#')) return\n const key = `${kind}:${specifier}`\n const existing = values.get(key)\n // A specifier reached both statically and lazily executes at load time.\n if (existing === undefined) values.set(key, { kind, specifier, lazy })\n else if (existing.lazy && !lazy) existing.lazy = false\n }\n function collectRequireAliases(node: ts.Node): void {\n if (ts.isImportDeclaration(node) && ts.isStringLiteral(node.moduleSpecifier)\n && (node.moduleSpecifier.text === 'node:module' || node.moduleSpecifier.text === 'module')\n && node.importClause?.namedBindings !== undefined && ts.isNamedImports(node.importClause.namedBindings)) {\n for (const element of node.importClause.namedBindings.elements) {\n if ((element.propertyName?.text ?? element.name.text) === 'createRequire') createRequireNames.add(element.name.text)\n }\n } else if (ts.isVariableDeclaration(node) && ts.isIdentifier(node.name)\n && node.initializer !== undefined && ts.isCallExpression(node.initializer)\n && ts.isIdentifier(node.initializer.expression) && createRequireNames.has(node.initializer.expression.text)) {\n requireNames.add(node.name.text)\n }\n ts.forEachChild(node, collectRequireAliases)\n }\n collectRequireAliases(source)\n function visit(node: ts.Node): void {\n if ((ts.isImportDeclaration(node) || ts.isExportDeclaration(node)) && node.moduleSpecifier !== undefined\n && ts.isStringLiteral(node.moduleSpecifier)) {\n add('module', node.moduleSpecifier.text, false)\n } else if (ts.isImportEqualsDeclaration(node) && ts.isExternalModuleReference(node.moduleReference)\n && ts.isStringLiteral(node.moduleReference.expression)) {\n add('module', node.moduleReference.expression.text, false)\n } else if (ts.isCallExpression(node) && node.arguments.length > 0\n && ((node.expression.kind === ts.SyntaxKind.ImportKeyword)\n || (ts.isIdentifier(node.expression) && requireNames.has(node.expression.text)))) {\n const specifier = literalModule(node.arguments[0])\n if (specifier !== undefined) add('module', specifier, insideFunctionBody(node))\n } else if (ts.isNewExpression(node) && ts.isIdentifier(node.expression) && node.expression.text === 'URL'\n && isImportMetaUrl(node.arguments?.[1])) {\n const specifier = literalModule(node.arguments?.[0])\n if (specifier !== undefined) add('asset', specifier, false)\n }\n ts.forEachChild(node, visit)\n }\n visit(source)\n return [...values.values()]\n}\n\nfunction externalPackage(specifier: string): string | undefined {\n // `bun:*` counts as a host builtin, not an npm dependency: Pi's official\n // distribution is a Bun-compiled binary, so ecosystem packages gate these\n // requires behind runtime detection and take their declared Node fallback\n // (better-sqlite3, node:sqlite) everywhere else.\n if (specifier.startsWith('.') || specifier.startsWith('/') || specifier.startsWith('#')\n || specifier.startsWith('node:') || specifier.startsWith('bun:')\n || builtinModules.includes(specifier)) return undefined\n const parts = specifier.split('/')\n return specifier.startsWith('@') ? parts.slice(0, 2).join('/') : parts[0]\n}\n\nfunction insideTry(node: ts.Node): boolean {\n let current: ts.Node | undefined = node.parent\n while (current !== undefined) {\n if (ts.isTryStatement(current)) return true\n // Stop at function boundaries: a try in an outer function does not guard\n // an import inside a nested callback executed later.\n if (ts.isFunctionLike(current)) {\n // ...unless the whole function body IS awaited inside the try; keeping\n // this conservative check simple errs toward reporting the dependency.\n return false\n }\n current = current.parent\n }\n return false\n}\n\n// Inside any function body means the expression does not run while the module\n// itself loads — it runs when (if ever) that function is called.\nfunction insideFunctionBody(node: ts.Node): boolean {\n let current: ts.Node | undefined = node.parent\n while (current !== undefined) {\n if (ts.isFunctionLike(current)) return true\n current = current.parent\n }\n return false\n}\n\nexport interface RuntimeDependencyUse {\n name: string\n // true when every use sits on a lazy path (dynamic import/require inside a\n // function body): the module loads fine without the dependency, exactly as\n // under Pi, and only the feature that calls it needs the install.\n lazy: boolean\n}\n\nexport function runtimeExternalPackages(path: string, text: string): RuntimeDependencyUse[] {\n const source = ts.createSourceFile(path, text, ts.ScriptTarget.Latest, true, sourceKind(path))\n const packages = new Map<string, RuntimeDependencyUse>()\n const createRequireNames = new Set<string>(['createRequire'])\n const requireNames = new Set<string>(['require'])\n const add = (specifier: string, lazy: boolean): void => {\n const name = externalPackage(specifier)\n if (name === undefined || name.length === 0) return\n const existing = packages.get(name)\n if (existing === undefined) packages.set(name, { name, lazy })\n else if (existing.lazy && !lazy) existing.lazy = false\n }\n function collectRequireAliases(node: ts.Node): void {\n if (ts.isImportDeclaration(node) && ts.isStringLiteral(node.moduleSpecifier)\n && (node.moduleSpecifier.text === 'node:module' || node.moduleSpecifier.text === 'module')\n && node.importClause?.namedBindings !== undefined && ts.isNamedImports(node.importClause.namedBindings)) {\n for (const element of node.importClause.namedBindings.elements) {\n if ((element.propertyName?.text ?? element.name.text) === 'createRequire') createRequireNames.add(element.name.text)\n }\n } else if (ts.isVariableDeclaration(node) && ts.isIdentifier(node.name)\n && node.initializer !== undefined && ts.isCallExpression(node.initializer)\n && ts.isIdentifier(node.initializer.expression) && createRequireNames.has(node.initializer.expression.text)) {\n requireNames.add(node.name.text)\n }\n ts.forEachChild(node, collectRequireAliases)\n }\n collectRequireAliases(source)\n function visit(node: ts.Node): void {\n if (ts.isImportDeclaration(node) && ts.isStringLiteral(node.moduleSpecifier)) {\n const clause = node.importClause\n const named = clause?.namedBindings\n const namedImportsAreTypeOnly = named !== undefined && ts.isNamedImports(named)\n && named.elements.length > 0 && named.elements.every(element => element.isTypeOnly)\n if (clause === undefined || (!clause.isTypeOnly && (clause.name !== undefined || !namedImportsAreTypeOnly))) {\n add(node.moduleSpecifier.text, false)\n }\n } else if (ts.isExportDeclaration(node) && !node.isTypeOnly\n && node.moduleSpecifier !== undefined && ts.isStringLiteral(node.moduleSpecifier)) {\n add(node.moduleSpecifier.text, false)\n } else if (ts.isImportEqualsDeclaration(node) && !node.isTypeOnly\n && ts.isExternalModuleReference(node.moduleReference) && ts.isStringLiteral(node.moduleReference.expression)) {\n add(node.moduleReference.expression.text, false)\n } else if (ts.isCallExpression(node) && node.arguments.length > 0\n && ((node.expression.kind === ts.SyntaxKind.ImportKeyword)\n || (ts.isIdentifier(node.expression) && requireNames.has(node.expression.text)))) {\n // A dynamic import/require wrapped in try/catch is the ecosystem's\n // optional-dependency idiom (e.g. pi-harness-runtime's \"// Dynamic\n // import for Playwright (optional dependency)\") — its absence is a\n // designed degradation, not an undeclared runtime requirement.\n if (!insideTry(node)) {\n const specifier = literalModule(node.arguments[0])\n if (specifier !== undefined) add(specifier, insideFunctionBody(node))\n }\n }\n ts.forEachChild(node, visit)\n }\n visit(source)\n return [...packages.values()]\n}\n\nfunction inside(rootDir: string, path: string): boolean {\n const pathRelative = relative(rootDir, path)\n return pathRelative === '' || (pathRelative !== '..' && !pathRelative.startsWith(`..${process.platform === 'win32' ? '\\\\' : '/'}`))\n}\n\nfunction sourceAlternates(base: string): string[] {\n const extension = extname(base)\n const stem = extension.length > 0 ? base.slice(0, -extension.length) : base\n if (extension === '.js') return [`${stem}.ts`, `${stem}.tsx`]\n if (extension === '.mjs') return [`${stem}.mts`, `${stem}.ts`]\n if (extension === '.cjs') return [`${stem}.cts`, `${stem}.ts`]\n if (extension === '.jsx') return [`${stem}.tsx`, `${stem}.ts`]\n return []\n}\n\nasync function isFile(path: string): Promise<boolean> {\n try {\n return (await stat(path)).isFile()\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === 'ENOENT') return false\n throw error\n }\n}\n\nfunction subpathImportTarget(rootDir: string, specifier: string, importsMap: Record<string, unknown>): string | undefined {\n const conditionValue = (value: unknown): string | undefined => {\n if (typeof value === 'string') return value\n if (typeof value !== 'object' || value === null) return undefined\n const record = value as Record<string, unknown>\n for (const condition of ['import', 'node', 'default']) {\n const candidate = conditionValue(record[condition])\n if (candidate !== undefined) return candidate\n }\n return undefined\n }\n const direct = conditionValue(importsMap[specifier])\n if (direct !== undefined) return resolve(rootDir, direct)\n for (const [pattern, value] of Object.entries(importsMap)) {\n const star = pattern.indexOf('*')\n if (star === -1) continue\n const prefix = pattern.slice(0, star)\n const suffix = pattern.slice(star + 1)\n if (!specifier.startsWith(prefix) || !specifier.endsWith(suffix)) continue\n const wildcard = specifier.slice(prefix.length, specifier.length - suffix.length)\n const target = conditionValue(value)\n if (target !== undefined) return resolve(rootDir, target.replace('*', wildcard))\n }\n return undefined\n}\n\nasync function packageImportsMap(rootDir: string): Promise<Record<string, unknown>> {\n try {\n const parsed = JSON.parse(await readFile(join(rootDir, 'package.json'), 'utf8')) as { imports?: unknown }\n return typeof parsed.imports === 'object' && parsed.imports !== null ? parsed.imports as Record<string, unknown> : {}\n } catch {\n return {}\n }\n}\n\nasync function resolveModule(fromFile: string, specifier: string, rootDir: string, importsMap: Record<string, unknown>): Promise<string> {\n if (specifier.startsWith('#')) {\n const target = subpathImportTarget(rootDir, specifier, importsMap)\n if (target === undefined) {\n throw new Error(`cannot resolve subpath import ${JSON.stringify(specifier)} through the package \"imports\" map`)\n }\n return resolveModule(fromFile, relative(dirname(fromFile), target).startsWith('.')\n ? relative(dirname(fromFile), target)\n : `./${relative(dirname(fromFile), target)}`, rootDir, importsMap)\n }\n const base = resolve(dirname(fromFile), specifier)\n const candidates = [\n base,\n ...sourceAlternates(base),\n ...(extname(base) === '' ? MODULE_EXTENSIONS.map(extension => `${base}${extension}`) : []),\n ...MODULE_EXTENSIONS.map(extension => join(base, `index${extension}`)),\n ]\n for (const candidate of [...new Set(candidates)]) {\n if (!inside(rootDir, candidate)) throw new Error(`extension import escapes the Pi package: ${specifier} from ${fromFile}`)\n if (await isFile(candidate)) return candidate\n }\n throw new Error(`cannot resolve local extension import ${JSON.stringify(specifier)} from ${fromFile}`)\n}\n\nasync function expandAsset(path: string, rootDir: string): Promise<string[]> {\n if (!inside(rootDir, path)) throw new Error(`extension asset escapes the Pi package: ${path}`)\n let info\n try {\n info = await lstat(path)\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code !== 'ENOENT') throw error\n // A `new URL('./worker.js', import.meta.url)` asset may only exist in its\n // TypeScript source form before the package builds; track the source.\n for (const alternate of sourceAlternates(path)) {\n if (await isFile(alternate)) return [alternate]\n }\n throw error\n }\n if (info.isSymbolicLink()) throw new Error(`refusing to copy symbolic link from Pi package: ${path}`)\n if (info.isFile()) return [path]\n if (!info.isDirectory()) return []\n const output: string[] = []\n for (const entry of await readdir(path)) output.push(...await expandAsset(join(path, entry), rootDir))\n return output\n}\n\nexport async function collectLocalClosure(rootDir: string, entries: readonly string[]): Promise<LocalClosure> {\n const importsMap = await packageImportsMap(rootDir)\n const graph = new Map<string, Array<{ lazy: boolean, targets: string[] }>>()\n const issues: LocalClosureIssue[] = []\n const queue = entries.map(path => resolve(path))\n // Pass 1: the full local reference graph, lazy edges included, so the\n // snapshot carries every file any feature could ever load.\n while (queue.length > 0) {\n const source = queue.shift() as string\n if (graph.has(source)) continue\n if (!inside(rootDir, source)) throw new Error(`extension source escapes the Pi package: ${source}`)\n const info = await lstat(source)\n if (info.isSymbolicLink()) throw new Error(`refusing to copy symbolic link from Pi package: ${source}`)\n if (!info.isFile()) throw new Error(`extension closure contains a non-file path: ${source}`)\n const edges: Array<{ lazy: boolean, targets: string[] }> = []\n graph.set(source, edges)\n if (!SCRIPT_EXTENSIONS.has(extname(source))) continue\n const text = await readFile(source, 'utf8')\n for (const reference of localReferences(source, text)) {\n // Worker/data assets never execute while the entry loads; the feature\n // that spawns them does, so their whole subtree is a lazy path.\n const lazy = reference.lazy || reference.kind === 'asset'\n try {\n const targets = reference.kind === 'module'\n ? [await resolveModule(source, reference.specifier, rootDir, importsMap)]\n : await expandAsset(resolve(dirname(source), reference.specifier), rootDir)\n edges.push({ lazy, targets })\n queue.push(...targets)\n } catch (error) {\n issues.push({\n file: source,\n kind: reference.kind,\n specifier: reference.specifier,\n detail: error instanceof Error ? error.message : String(error),\n lazy,\n })\n }\n }\n }\n // Pass 2: load-time reachability across non-lazy module edges only. This is\n // the set whose problems actually break `pi` (and pi2dsh) at extension load;\n // everything else fails at feature-use time, identically under both hosts.\n const loadTimeFiles = new Set<string>()\n const loadQueue = entries.map(path => resolve(path)).filter(path => graph.has(path))\n while (loadQueue.length > 0) {\n const source = loadQueue.shift() as string\n if (loadTimeFiles.has(source)) continue\n loadTimeFiles.add(source)\n for (const edge of graph.get(source) ?? []) {\n if (edge.lazy) continue\n for (const target of edge.targets) {\n if (!loadTimeFiles.has(target)) loadQueue.push(target)\n }\n }\n }\n // An issue found inside a file that itself only loads lazily cannot break\n // extension load either, however the reference is written.\n for (const issue of issues) {\n if (!loadTimeFiles.has(issue.file)) issue.lazy = true\n }\n return { files: [...graph.keys()].sort(), loadTimeFiles, issues }\n}\n","import { readFile } from 'node:fs/promises'\nimport { basename, extname, relative } from 'node:path'\nimport ts from 'typescript'\nimport {\n PI_CODING_AGENT_PACKAGES,\n PI_AI_PACKAGES,\n PI_TUI_PACKAGES,\n ruleForApi,\n ruleForContextProperty,\n ruleForEvent,\n ruleForHostImport,\n ruleForUiContextProperty,\n} from './compatibility.js'\nimport { collectLocalClosure, runtimeExternalPackages, SCRIPT_EXTENSIONS, sourceKind } from './module-graph.js'\nimport type {\n CompatibilityFinding,\n CompatibilityLevel,\n CompatibilityReport,\n ResolvedPiPackage,\n} from './types.js'\n\nfunction literalText(node: ts.Node | undefined): string | undefined {\n return node !== undefined && (ts.isStringLiteral(node) || ts.isNoSubstitutionTemplateLiteral(node))\n ? node.text\n : undefined\n}\n\nfunction hasModifier(node: ts.Node, kind: ts.SyntaxKind): boolean {\n return ts.canHaveModifiers(node) && ts.getModifiers(node)?.some(modifier => modifier.kind === kind) === true\n}\n\nfunction parameterIdentifier(node: ts.SignatureDeclarationBase): string | undefined {\n const parameter = node.parameters[0]\n return parameter !== undefined && ts.isIdentifier(parameter.name) ? parameter.name.text : undefined\n}\n\nfunction extensionApiReceivers(source: ts.SourceFile): Set<string> {\n const receivers = new Set<string>()\n const functions = new Map<string, ts.FunctionLikeDeclarationBase>()\n\n function index(node: ts.Node): void {\n if (ts.isFunctionDeclaration(node) && node.name !== undefined) functions.set(node.name.text, node)\n if (ts.isVariableDeclaration(node) && ts.isIdentifier(node.name)\n && node.initializer !== undefined\n && (ts.isArrowFunction(node.initializer) || ts.isFunctionExpression(node.initializer))) {\n functions.set(node.name.text, node.initializer)\n }\n if (ts.isParameter(node) && node.type !== undefined\n && /(?:^|\\.)ExtensionAPI\\b/u.test(node.type.getText(source)) && ts.isIdentifier(node.name)) {\n receivers.add(node.name.text)\n }\n // Published Pi packages commonly ship JavaScript with type annotations\n // erased. `pi` is the documented ExtensionAPI parameter name throughout\n // the ecosystem, including helper functions reached from the entry point.\n if (ts.isParameter(node) && ts.isIdentifier(node.name)\n && /^(?:pi|extensionApi)$/iu.test(node.name.text)) {\n receivers.add(node.name.text)\n }\n ts.forEachChild(node, index)\n }\n index(source)\n\n for (const statement of source.statements) {\n if (ts.isFunctionDeclaration(statement)\n && hasModifier(statement, ts.SyntaxKind.ExportKeyword)\n && hasModifier(statement, ts.SyntaxKind.DefaultKeyword)) {\n const name = parameterIdentifier(statement)\n if (name !== undefined) receivers.add(name)\n }\n if (ts.isExportAssignment(statement)) {\n const expression = statement.expression\n if (ts.isArrowFunction(expression) || ts.isFunctionExpression(expression)) {\n const name = parameterIdentifier(expression)\n if (name !== undefined) receivers.add(name)\n } else if (ts.isIdentifier(expression)) {\n const candidate = functions.get(expression.text)\n if (candidate !== undefined) {\n const name = parameterIdentifier(candidate)\n if (name !== undefined) receivers.add(name)\n }\n }\n }\n if (ts.isExportDeclaration(statement) && statement.moduleSpecifier === undefined\n && statement.exportClause !== undefined && ts.isNamedExports(statement.exportClause)) {\n for (const element of statement.exportClause.elements) {\n if (element.name.text !== 'default' || element.propertyName === undefined || !ts.isIdentifier(element.propertyName)) continue\n const candidate = functions.get(element.propertyName.text)\n if (candidate !== undefined) {\n const name = parameterIdentifier(candidate)\n if (name !== undefined) receivers.add(name)\n }\n }\n }\n }\n return receivers\n}\n\nfunction extensionApiProperties(source: ts.SourceFile, receivers: ReadonlySet<string>): Set<string> {\n const properties = new Set<string>()\n function visit(node: ts.Node): void {\n if ((ts.isPropertyDeclaration(node) || ts.isParameter(node)) && ts.isIdentifier(node.name)) {\n const typed = node.type !== undefined && /(?:^|\\.)(?:Pi)?ExtensionAPI\\b/u.test(node.type.getText(source))\n if (typed || /^(?:pi|extensionApi)$/iu.test(node.name.text)) properties.add(node.name.text)\n } else if (ts.isBinaryExpression(node) && node.operatorToken.kind === ts.SyntaxKind.EqualsToken\n && ts.isPropertyAccessExpression(node.left) && node.left.expression.kind === ts.SyntaxKind.ThisKeyword\n && ts.isIdentifier(node.right) && receivers.has(node.right.text)) {\n properties.add(node.left.name.text)\n }\n ts.forEachChild(node, visit)\n }\n visit(source)\n return properties\n}\n\nfunction enclosingFunctionName(node: ts.ParameterDeclaration): string | undefined {\n const parent = node.parent\n if (ts.isMethodDeclaration(parent) && parent.name !== undefined) return parent.name.getText()\n if ((ts.isArrowFunction(parent) || ts.isFunctionExpression(parent)) && ts.isPropertyAssignment(parent.parent)) {\n return parent.parent.name.getText()\n }\n return undefined\n}\n\nfunction extensionContextReceivers(source: ts.SourceFile): Set<string> {\n const receivers = new Set<string>()\n function visit(node: ts.Node): void {\n if (ts.isParameter(node) && ts.isIdentifier(node.name)) {\n const typedContext = node.type !== undefined\n && /(?:^|\\.)(?:Extension|ExtensionCommand|ToolExecution)Context\\b/u.test(node.type.getText(source))\n const conventionalHandlerContext = /^(?:ctx|context)$/iu.test(node.name.text)\n && /^(?:execute|handler)$/u.test(enclosingFunctionName(node) ?? '')\n if (typedContext || conventionalHandlerContext) receivers.add(node.name.text)\n }\n ts.forEachChild(node, visit)\n }\n visit(source)\n return receivers\n}\n\n// The three Pi packages whose named exports the shim audit tracks.\nconst PI_SHIMMED_PACKAGES = new Set<string>([\n ...PI_CODING_AGENT_PACKAGES,\n ...PI_TUI_PACKAGES,\n ...PI_AI_PACKAGES,\n])\n\n// Everything Pi's loader provides to extensions without a declaration —\n// exempt from the undeclared-runtime-dependency fatal, and (for typebox) not\n// subject to per-symbol shim auditing.\nconst PI_HOST_PACKAGES = new Set<string>([\n ...PI_SHIMMED_PACKAGES,\n 'typebox',\n '@sinclair/typebox',\n])\n\nfunction dependencyNames(packageJson: Record<string, unknown>): Set<string> {\n const names = new Set<string>()\n for (const field of ['dependencies', 'optionalDependencies', 'peerDependencies']) {\n const value = packageJson[field]\n if (typeof value !== 'object' || value === null || Array.isArray(value)) continue\n for (const [name, specifier] of Object.entries(value)) {\n if (typeof specifier === 'string') names.add(name)\n }\n }\n return names\n}\n\nfunction pushFinding(\n findings: CompatibilityFinding[],\n rootDir: string,\n file: string,\n source: ts.SourceFile,\n node: ts.Node,\n capability: string,\n level: CompatibilityLevel,\n detail: string,\n): void {\n const position = source.getLineAndCharacterOfPosition(node.getStart(source))\n findings.push({\n capability,\n level,\n file: relative(rootDir, file).replaceAll('\\\\', '/'),\n line: position.line + 1,\n detail,\n })\n}\n\nasync function analyzeExtension(rootDir: string, file: string): Promise<CompatibilityFinding[]> {\n const text = await readFile(file, 'utf8')\n const source = ts.createSourceFile(file, text, ts.ScriptTarget.Latest, true, sourceKind(file))\n const findings: CompatibilityFinding[] = []\n const receivers = extensionApiReceivers(source)\n const apiProperties = extensionApiProperties(source, receivers)\n const contextReceivers = extensionContextReceivers(source)\n const methodAliases = new Map<string, string>()\n const eventBusAliases = new Set<string>()\n const uiAliases = new Set<string>()\n\n function reportHostImport(packageName: string, importedName: string, node: ts.Node): void {\n const matched = ruleForHostImport(packageName, importedName)\n if (matched === undefined) {\n pushFinding(\n findings, rootDir, file, source, node, `host-import(${packageName}:${importedName})`, 'unsupported',\n `The pi2dsh host shim does not export ${JSON.stringify(importedName)} from ${JSON.stringify(packageName)}.`,\n )\n return\n }\n pushFinding(\n findings, rootDir, file, source, node, `host-import(${packageName}:${importedName})`, matched.level, matched.detail,\n )\n }\n\n for (const statement of source.statements) {\n if (ts.isImportDeclaration(statement) && ts.isStringLiteral(statement.moduleSpecifier)\n && PI_SHIMMED_PACKAGES.has(statement.moduleSpecifier.text)) {\n const packageName = statement.moduleSpecifier.text\n const clause = statement.importClause\n if (clause === undefined) {\n reportHostImport(packageName, '<side-effect>', statement)\n continue\n }\n if (clause.isTypeOnly) continue\n if (clause.name !== undefined) reportHostImport(packageName, 'default', clause.name)\n if (clause.namedBindings !== undefined && ts.isNamespaceImport(clause.namedBindings)) {\n reportHostImport(packageName, '*', clause.namedBindings)\n } else if (clause.namedBindings !== undefined) {\n for (const element of clause.namedBindings.elements) {\n if (!element.isTypeOnly) reportHostImport(packageName, element.propertyName?.text ?? element.name.text, element)\n }\n }\n } else if (ts.isExportDeclaration(statement) && !statement.isTypeOnly\n && statement.moduleSpecifier !== undefined && ts.isStringLiteral(statement.moduleSpecifier)\n && PI_HOST_PACKAGES.has(statement.moduleSpecifier.text)) {\n const packageName = statement.moduleSpecifier.text\n if (statement.exportClause === undefined || ts.isNamespaceExport(statement.exportClause)) {\n reportHostImport(packageName, '*', statement)\n } else {\n for (const element of statement.exportClause.elements) {\n if (!element.isTypeOnly) reportHostImport(packageName, element.propertyName?.text ?? element.name.text, element)\n }\n }\n } else if (ts.isImportEqualsDeclaration(statement) && !statement.isTypeOnly\n && ts.isExternalModuleReference(statement.moduleReference)\n && ts.isStringLiteral(statement.moduleReference.expression)\n && PI_HOST_PACKAGES.has(statement.moduleReference.expression.text)) {\n reportHostImport(statement.moduleReference.expression.text, '*', statement)\n }\n }\n\n const declarations: ts.VariableDeclaration[] = []\n const isApiReceiver = (node: ts.Expression): boolean => ts.isIdentifier(node) && receivers.has(node.text)\n || (ts.isPropertyAccessExpression(node) && node.expression.kind === ts.SyntaxKind.ThisKeyword\n && apiProperties.has(node.name.text))\n function collectDeclarations(node: ts.Node): void {\n if (ts.isVariableDeclaration(node)) declarations.push(node)\n ts.forEachChild(node, collectDeclarations)\n }\n collectDeclarations(source)\n\n for (let pass = 0; pass < declarations.length + 1; pass += 1) {\n let changed = false\n for (const declaration of declarations) {\n const initializer = declaration.initializer\n if (initializer === undefined) continue\n if (ts.isIdentifier(declaration.name) && isApiReceiver(initializer)) {\n if (!receivers.has(declaration.name.text)) {\n receivers.add(declaration.name.text)\n changed = true\n }\n }\n if (ts.isIdentifier(declaration.name) && ts.isIdentifier(initializer) && contextReceivers.has(initializer.text)) {\n if (!contextReceivers.has(declaration.name.text)) {\n contextReceivers.add(declaration.name.text)\n changed = true\n }\n }\n if (ts.isIdentifier(declaration.name) && ts.isPropertyAccessExpression(initializer)\n && initializer.name.text === 'ui' && ts.isIdentifier(initializer.expression)\n && contextReceivers.has(initializer.expression.text) && !uiAliases.has(declaration.name.text)) {\n uiAliases.add(declaration.name.text)\n changed = true\n }\n if (ts.isIdentifier(declaration.name) && ts.isPropertyAccessExpression(initializer)\n && isApiReceiver(initializer.expression)) {\n if (initializer.name.text === 'events') {\n if (!eventBusAliases.has(declaration.name.text)) {\n eventBusAliases.add(declaration.name.text)\n changed = true\n }\n } else if (!methodAliases.has(declaration.name.text)) {\n methodAliases.set(declaration.name.text, initializer.name.text)\n changed = true\n }\n }\n if (ts.isObjectBindingPattern(declaration.name) && isApiReceiver(initializer)) {\n for (const element of declaration.name.elements) {\n if (!ts.isIdentifier(element.name)) continue\n const method = element.propertyName !== undefined && ts.isIdentifier(element.propertyName)\n ? element.propertyName.text\n : element.name.text\n if (method === 'events') {\n if (!eventBusAliases.has(element.name.text)) {\n eventBusAliases.add(element.name.text)\n changed = true\n }\n } else if (!methodAliases.has(element.name.text)) {\n methodAliases.set(element.name.text, method)\n changed = true\n }\n }\n }\n }\n if (!changed) break\n }\n\n function reportMethod(method: string, args: ts.NodeArray<ts.Expression>, node: ts.Node): void {\n if (method === 'on') {\n const event = literalText(args[0])\n if (event === undefined) {\n pushFinding(\n findings, rootDir, file, source, node, 'on(<dynamic>)', 'unsupported',\n 'Dynamic event names cannot be audited or mapped safely.',\n )\n } else {\n const rule = ruleForEvent(event)\n pushFinding(findings, rootDir, file, source, node, `on(${event})`, rule.level, rule.detail)\n }\n return\n }\n const rule = ruleForApi(method)\n if (rule === undefined) {\n pushFinding(\n findings, rootDir, file, source, node, method, 'unsupported',\n `Unknown ExtensionAPI method ${JSON.stringify(method)} cannot be audited or mapped safely.`,\n )\n return\n }\n pushFinding(findings, rootDir, file, source, node, method, rule.level, rule.detail)\n }\n\n function reportEventBus(method: string, node: ts.Node): void {\n const rule = ruleForApi('events')\n if ((method === 'on' || method === 'emit') && rule !== undefined) {\n pushFinding(findings, rootDir, file, source, node, `events.${method}`, rule.level, rule.detail)\n } else {\n pushFinding(\n findings, rootDir, file, source, node, `events.${method}`, 'unsupported',\n `Unknown Pi event-bus method ${JSON.stringify(method)} cannot be mapped safely.`,\n )\n }\n }\n\n function reportContext(property: string, node: ts.Node): void {\n const matched = ruleForContextProperty(property)\n if (matched === undefined) {\n pushFinding(\n findings, rootDir, file, source, node, `ctx.${property}`, 'unsupported',\n `Unknown Pi extension-context property ${JSON.stringify(property)} cannot be audited or mapped safely.`,\n )\n } else {\n pushFinding(findings, rootDir, file, source, node, `ctx.${property}`, matched.level, matched.detail)\n }\n }\n\n function reportUiContext(property: string, node: ts.Node): void {\n const matched = ruleForUiContextProperty(property)\n if (matched === undefined) {\n pushFinding(\n findings, rootDir, file, source, node, `ctx.ui.${property}`, 'unsupported',\n `Unknown Pi UI-context property ${JSON.stringify(property)} cannot be audited or mapped safely.`,\n )\n } else {\n pushFinding(findings, rootDir, file, source, node, `ctx.ui.${property}`, matched.level, matched.detail)\n }\n }\n\n function visit(node: ts.Node): void {\n if (ts.isCallExpression(node) && ts.isIdentifier(node.expression)) {\n const method = methodAliases.get(node.expression.text)\n if (method !== undefined) reportMethod(method, node.arguments, node)\n } else if (ts.isCallExpression(node) && ts.isPropertyAccessExpression(node.expression)) {\n const target = node.expression.expression\n if (isApiReceiver(target)) {\n reportMethod(node.expression.name.text, node.arguments, node)\n } else if (ts.isIdentifier(target) && eventBusAliases.has(target.text)) {\n reportEventBus(node.expression.name.text, node)\n } else if (ts.isPropertyAccessExpression(target)\n && target.name.text === 'events'\n && isApiReceiver(target.expression)) {\n reportEventBus(node.expression.name.text, node)\n }\n } else if (ts.isCallExpression(node) && ts.isElementAccessExpression(node.expression)\n && isApiReceiver(node.expression.expression)) {\n const method = literalText(node.expression.argumentExpression)\n if (method === undefined) {\n pushFinding(\n findings, rootDir, file, source, node, '<dynamic-api-method>', 'unsupported',\n 'Dynamic ExtensionAPI method access cannot be audited or mapped safely.',\n )\n } else {\n reportMethod(method, node.arguments, node)\n }\n }\n if (ts.isPropertyAccessExpression(node)) {\n const target = node.expression\n if (ts.isPropertyAccessExpression(target) && target.name.text === 'ui'\n && ts.isIdentifier(target.expression) && contextReceivers.has(target.expression.text)) {\n reportUiContext(node.name.text, node)\n } else if (ts.isIdentifier(target) && uiAliases.has(target.text)) {\n reportUiContext(node.name.text, node)\n } else if (ts.isIdentifier(target) && contextReceivers.has(target.text) && node.name.text !== 'ui') {\n reportContext(node.name.text, node)\n }\n } else if (ts.isElementAccessExpression(node) && ts.isIdentifier(node.expression)\n && contextReceivers.has(node.expression.text)) {\n const property = literalText(node.argumentExpression)\n if (property === undefined) {\n pushFinding(\n findings, rootDir, file, source, node, 'ctx.<dynamic>', 'unsupported',\n 'Dynamic Pi extension-context access cannot be audited or mapped safely.',\n )\n } else if (property !== 'ui') {\n reportContext(property, node)\n }\n }\n ts.forEachChild(node, visit)\n }\n\n visit(source)\n return findings\n}\n\nexport async function analyzePackage(pkg: ResolvedPiPackage): Promise<CompatibilityReport> {\n const extensionClosure = await collectLocalClosure(pkg.rootDir, pkg.resources.extensions)\n const findings = (await Promise.all(\n extensionClosure.files.filter(file => SCRIPT_EXTENSIONS.has(extname(file)))\n .map(file => analyzeExtension(pkg.rootDir, file)),\n )).flat()\n\n if (pkg.resources.extensions.length > 0 && findings.length === 0) {\n findings.push({\n capability: 'static-audit',\n level: 'unsupported',\n file: pkg.resources.extensions.map(file => relative(pkg.rootDir, file).replaceAll('\\\\', '/')).join(', '),\n line: 1,\n detail: 'No ExtensionAPI use was statically proven across the local module closure; conversion fails closed instead of claiming compatibility.',\n })\n }\n for (const issue of extensionClosure.issues) {\n // Only a break on the load-time path blocks the package: Pi's own loader\n // fails the same lazy references at feature-use time, and the snapshot\n // preserves the published file layout, so behavior matches Pi exactly.\n const lazyIssue = issue.lazy || issue.kind === 'asset'\n findings.push({\n capability: `${issue.kind}(${issue.specifier})`,\n level: lazyIssue ? 'partial' : 'fatal',\n file: relative(pkg.rootDir, issue.file).replaceAll('\\\\', '/'),\n line: 1,\n detail: lazyIssue\n ? `Unresolved reference on a lazy path: ${issue.detail}. Extension load is unaffected; if the feature that evaluates it runs, it fails the same way under Pi (published file layout is preserved).`\n : `The local extension closure is incomplete: ${issue.detail}`,\n })\n }\n\n const declaredDependencies = dependencyNames(pkg.packageJson)\n for (const file of extensionClosure.files.filter(candidate => SCRIPT_EXTENSIONS.has(extname(candidate)))) {\n const text = await readFile(file, 'utf8')\n const lazyFile = !extensionClosure.loadTimeFiles.has(file)\n for (const use of runtimeExternalPackages(file, text)) {\n if (PI_HOST_PACKAGES.has(use.name) || declaredDependencies.has(use.name)) continue\n // Undeclared imports only crash extension load when they execute at load\n // time. On lazy paths (function-body dynamic imports, or files that are\n // themselves only lazily reachable) Pi degrades per-feature; mirror that.\n const lazyUse = use.lazy || lazyFile\n findings.push({\n capability: lazyUse ? `optional-lazy-dependency(${use.name})` : `undeclared-runtime-dependency(${use.name})`,\n level: lazyUse ? 'partial' : 'fatal',\n file: relative(pkg.rootDir, file).replaceAll('\\\\', '/'),\n line: 1,\n detail: lazyUse\n ? `The extension imports ${JSON.stringify(use.name)} only on a lazily-evaluated path without declaring it; the feature that needs it asks for the module at call time, exactly as under Pi (install ${use.name} to use that feature).`\n : `The extension imports ${JSON.stringify(use.name)} at load time, but the Pi package does not declare it as a dependency.`,\n })\n }\n }\n\n const resourceFinding = (file: string, capability: string, level: CompatibilityLevel, detail: string): CompatibilityFinding => ({\n capability,\n level,\n file: relative(pkg.rootDir, file).replaceAll('\\\\', '/'),\n line: 1,\n detail,\n })\n for (const file of pkg.resources.skills.filter(path => basename(path) === 'SKILL.md' || path.endsWith('.md'))) {\n findings.push(resourceFinding(file, 'skill', 'full', 'Copied as a DSH filesystem skill with its resource directory intact.'))\n }\n for (const file of pkg.resources.prompts) {\n findings.push(resourceFinding(file, 'prompt', 'full', 'Registered as a DSH slash command with Pi-compatible argument expansion.'))\n }\n for (const file of pkg.resources.themes) {\n findings.push(resourceFinding(file, 'theme', 'unsupported', 'Pi terminal themes have no effect in DSH Web or headless surfaces.'))\n }\n findings.sort((left, right) => left.file.localeCompare(right.file) || left.line - right.line || left.capability.localeCompare(right.capability))\n\n const summary: Record<CompatibilityLevel, number> = { full: 0, partial: 0, unsupported: 0, fatal: 0 }\n for (const finding of findings) summary[finding.level] += 1\n // Static analysis screens; it does not certify. Only fatal findings block a\n // bundle (it cannot be built or trusted). Everything else installs: verify\n // real behavior with the black-box run instead of trusting this verdict.\n const verdict = summary.fatal > 0 ? 'blocked' : summary.partial > 0 || summary.unsupported > 0 ? 'review' : 'ready'\n\n return {\n schemaVersion: 1,\n package: pkg.identity,\n verdict,\n summary,\n resources: {\n extensions: pkg.resources.extensions.map(file => relative(pkg.rootDir, file).replaceAll('\\\\', '/')),\n skills: pkg.resources.skills.map(file => relative(pkg.rootDir, file).replaceAll('\\\\', '/')),\n prompts: pkg.resources.prompts.map(file => relative(pkg.rootDir, file).replaceAll('\\\\', '/')),\n themes: pkg.resources.themes.map(file => relative(pkg.rootDir, file).replaceAll('\\\\', '/')),\n },\n findings,\n }\n}\n"],"mappings":";;;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1F,SAAS,IAAI,UAAU,QAAQ,KAAI,SAAQ,SAAS,IAAI,SAAS,IAAI,CAAC,CAAC,WAAW,MAAM,GAAG,CAAC;GAC5F,QAAQ,IAAI,UAAU,OAAO,KAAI,SAAQ,SAAS,IAAI,SAAS,IAAI,CAAC,CAAC,WAAW,MAAM,GAAG,CAAC;EAC5F;EACA;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"analyzer-BgkCub5L.mjs","names":[],"sources":["../src/module-graph.ts","../src/analyzer.ts"],"sourcesContent":["import { builtinModules } from 'node:module'\nimport { lstat, readFile, readdir, stat } from 'node:fs/promises'\nimport { dirname, extname, join, relative, resolve } from 'node:path'\nimport ts from 'typescript'\n\nexport const SCRIPT_EXTENSIONS = new Set(['.ts', '.tsx', '.mts', '.cts', '.js', '.jsx', '.mjs', '.cjs'])\nconst MODULE_EXTENSIONS = ['.ts', '.tsx', '.mts', '.cts', '.js', '.jsx', '.mjs', '.cjs', '.json']\n\ninterface LocalReference {\n kind: 'module' | 'asset'\n specifier: string\n // A lazy reference is only evaluated when some feature runs, never while the\n // extension entry loads: dynamic import()/require() inside a function body,\n // or worker/data assets spawned on demand. Pi's loader therefore succeeds\n // even when a lazy target is unresolvable; problems on lazy paths surface\n // (identically under Pi and pi2dsh) only if that feature is used.\n lazy: boolean\n}\n\nexport interface LocalClosureIssue {\n file: string\n kind: LocalReference['kind']\n specifier: string\n detail: string\n lazy: boolean\n}\n\nexport interface LocalClosure {\n files: string[]\n // Files whose module-level code executes the moment the extension entry\n // loads (transitive non-lazy module edges from the entries).\n loadTimeFiles: Set<string>\n issues: LocalClosureIssue[]\n}\n\nexport function sourceKind(path: string): ts.ScriptKind {\n if (path.endsWith('.js') || path.endsWith('.mjs') || path.endsWith('.cjs')) return ts.ScriptKind.JS\n if (path.endsWith('.jsx')) return ts.ScriptKind.JSX\n if (path.endsWith('.tsx')) return ts.ScriptKind.TSX\n return ts.ScriptKind.TS\n}\n\nfunction literalModule(node: ts.Expression | undefined): string | undefined {\n return node !== undefined && (ts.isStringLiteral(node) || ts.isNoSubstitutionTemplateLiteral(node)) ? node.text : undefined\n}\n\nfunction isImportMetaUrl(node: ts.Expression | undefined): boolean {\n return node !== undefined && ts.isPropertyAccessExpression(node) && node.name.text === 'url'\n && ts.isMetaProperty(node.expression) && node.expression.keywordToken === ts.SyntaxKind.ImportKeyword\n}\n\nfunction localReferences(path: string, text: string): LocalReference[] {\n const source = ts.createSourceFile(path, text, ts.ScriptTarget.Latest, true, sourceKind(path))\n const values = new Map<string, LocalReference>()\n const createRequireNames = new Set<string>(['createRequire'])\n const requireNames = new Set<string>(['require'])\n const add = (kind: LocalReference['kind'], specifier: string, lazy: boolean): void => {\n // '#'-prefixed specifiers are Node subpath imports resolved through the\n // package's own `imports` map — package-local, not external dependencies.\n if (!specifier.startsWith('.') && !specifier.startsWith('#')) return\n const key = `${kind}:${specifier}`\n const existing = values.get(key)\n // A specifier reached both statically and lazily executes at load time.\n if (existing === undefined) values.set(key, { kind, specifier, lazy })\n else if (existing.lazy && !lazy) existing.lazy = false\n }\n function collectRequireAliases(node: ts.Node): void {\n if (ts.isImportDeclaration(node) && ts.isStringLiteral(node.moduleSpecifier)\n && (node.moduleSpecifier.text === 'node:module' || node.moduleSpecifier.text === 'module')\n && node.importClause?.namedBindings !== undefined && ts.isNamedImports(node.importClause.namedBindings)) {\n for (const element of node.importClause.namedBindings.elements) {\n if ((element.propertyName?.text ?? element.name.text) === 'createRequire') createRequireNames.add(element.name.text)\n }\n } else if (ts.isVariableDeclaration(node) && ts.isIdentifier(node.name)\n && node.initializer !== undefined && ts.isCallExpression(node.initializer)\n && ts.isIdentifier(node.initializer.expression) && createRequireNames.has(node.initializer.expression.text)) {\n requireNames.add(node.name.text)\n }\n ts.forEachChild(node, collectRequireAliases)\n }\n collectRequireAliases(source)\n function visit(node: ts.Node): void {\n if ((ts.isImportDeclaration(node) || ts.isExportDeclaration(node)) && node.moduleSpecifier !== undefined\n && ts.isStringLiteral(node.moduleSpecifier)) {\n add('module', node.moduleSpecifier.text, false)\n } else if (ts.isImportEqualsDeclaration(node) && ts.isExternalModuleReference(node.moduleReference)\n && ts.isStringLiteral(node.moduleReference.expression)) {\n add('module', node.moduleReference.expression.text, false)\n } else if (ts.isCallExpression(node) && node.arguments.length > 0\n && ((node.expression.kind === ts.SyntaxKind.ImportKeyword)\n || (ts.isIdentifier(node.expression) && requireNames.has(node.expression.text)))) {\n const specifier = literalModule(node.arguments[0])\n if (specifier !== undefined) add('module', specifier, insideFunctionBody(node))\n } else if (ts.isNewExpression(node) && ts.isIdentifier(node.expression) && node.expression.text === 'URL'\n && isImportMetaUrl(node.arguments?.[1])) {\n const specifier = literalModule(node.arguments?.[0])\n if (specifier !== undefined) add('asset', specifier, false)\n }\n ts.forEachChild(node, visit)\n }\n visit(source)\n return [...values.values()]\n}\n\nfunction externalPackage(specifier: string): string | undefined {\n // `bun:*` counts as a host builtin, not an npm dependency: Pi's official\n // distribution is a Bun-compiled binary, so ecosystem packages gate these\n // requires behind runtime detection and take their declared Node fallback\n // (better-sqlite3, node:sqlite) everywhere else.\n if (specifier.startsWith('.') || specifier.startsWith('/') || specifier.startsWith('#')\n || specifier.startsWith('node:') || specifier.startsWith('bun:')\n || builtinModules.includes(specifier)) return undefined\n const parts = specifier.split('/')\n return specifier.startsWith('@') ? parts.slice(0, 2).join('/') : parts[0]\n}\n\nfunction insideTry(node: ts.Node): boolean {\n let current: ts.Node | undefined = node.parent\n while (current !== undefined) {\n if (ts.isTryStatement(current)) return true\n // Stop at function boundaries: a try in an outer function does not guard\n // an import inside a nested callback executed later.\n if (ts.isFunctionLike(current)) {\n // ...unless the whole function body IS awaited inside the try; keeping\n // this conservative check simple errs toward reporting the dependency.\n return false\n }\n current = current.parent\n }\n return false\n}\n\n// Inside any function body means the expression does not run while the module\n// itself loads — it runs when (if ever) that function is called.\nfunction insideFunctionBody(node: ts.Node): boolean {\n let current: ts.Node | undefined = node.parent\n while (current !== undefined) {\n if (ts.isFunctionLike(current)) return true\n current = current.parent\n }\n return false\n}\n\nexport interface RuntimeDependencyUse {\n name: string\n // true when every use sits on a lazy path (dynamic import/require inside a\n // function body): the module loads fine without the dependency, exactly as\n // under Pi, and only the feature that calls it needs the install.\n lazy: boolean\n}\n\nexport function runtimeExternalPackages(path: string, text: string): RuntimeDependencyUse[] {\n const source = ts.createSourceFile(path, text, ts.ScriptTarget.Latest, true, sourceKind(path))\n const packages = new Map<string, RuntimeDependencyUse>()\n const createRequireNames = new Set<string>(['createRequire'])\n const requireNames = new Set<string>(['require'])\n const add = (specifier: string, lazy: boolean): void => {\n const name = externalPackage(specifier)\n if (name === undefined || name.length === 0) return\n const existing = packages.get(name)\n if (existing === undefined) packages.set(name, { name, lazy })\n else if (existing.lazy && !lazy) existing.lazy = false\n }\n function collectRequireAliases(node: ts.Node): void {\n if (ts.isImportDeclaration(node) && ts.isStringLiteral(node.moduleSpecifier)\n && (node.moduleSpecifier.text === 'node:module' || node.moduleSpecifier.text === 'module')\n && node.importClause?.namedBindings !== undefined && ts.isNamedImports(node.importClause.namedBindings)) {\n for (const element of node.importClause.namedBindings.elements) {\n if ((element.propertyName?.text ?? element.name.text) === 'createRequire') createRequireNames.add(element.name.text)\n }\n } else if (ts.isVariableDeclaration(node) && ts.isIdentifier(node.name)\n && node.initializer !== undefined && ts.isCallExpression(node.initializer)\n && ts.isIdentifier(node.initializer.expression) && createRequireNames.has(node.initializer.expression.text)) {\n requireNames.add(node.name.text)\n }\n ts.forEachChild(node, collectRequireAliases)\n }\n collectRequireAliases(source)\n function visit(node: ts.Node): void {\n if (ts.isImportDeclaration(node) && ts.isStringLiteral(node.moduleSpecifier)) {\n const clause = node.importClause\n const named = clause?.namedBindings\n const namedImportsAreTypeOnly = named !== undefined && ts.isNamedImports(named)\n && named.elements.length > 0 && named.elements.every(element => element.isTypeOnly)\n if (clause === undefined || (!clause.isTypeOnly && (clause.name !== undefined || !namedImportsAreTypeOnly))) {\n add(node.moduleSpecifier.text, false)\n }\n } else if (ts.isExportDeclaration(node) && !node.isTypeOnly\n && node.moduleSpecifier !== undefined && ts.isStringLiteral(node.moduleSpecifier)) {\n add(node.moduleSpecifier.text, false)\n } else if (ts.isImportEqualsDeclaration(node) && !node.isTypeOnly\n && ts.isExternalModuleReference(node.moduleReference) && ts.isStringLiteral(node.moduleReference.expression)) {\n add(node.moduleReference.expression.text, false)\n } else if (ts.isCallExpression(node) && node.arguments.length > 0\n && ((node.expression.kind === ts.SyntaxKind.ImportKeyword)\n || (ts.isIdentifier(node.expression) && requireNames.has(node.expression.text)))) {\n // A dynamic import/require wrapped in try/catch is the ecosystem's\n // optional-dependency idiom (e.g. pi-harness-runtime's \"// Dynamic\n // import for Playwright (optional dependency)\") — its absence is a\n // designed degradation, not an undeclared runtime requirement.\n if (!insideTry(node)) {\n const specifier = literalModule(node.arguments[0])\n if (specifier !== undefined) add(specifier, insideFunctionBody(node))\n }\n }\n ts.forEachChild(node, visit)\n }\n visit(source)\n return [...packages.values()]\n}\n\nfunction inside(rootDir: string, path: string): boolean {\n const pathRelative = relative(rootDir, path)\n return pathRelative === '' || (pathRelative !== '..' && !pathRelative.startsWith(`..${process.platform === 'win32' ? '\\\\' : '/'}`))\n}\n\nfunction sourceAlternates(base: string): string[] {\n const extension = extname(base)\n const stem = extension.length > 0 ? base.slice(0, -extension.length) : base\n if (extension === '.js') return [`${stem}.ts`, `${stem}.tsx`]\n if (extension === '.mjs') return [`${stem}.mts`, `${stem}.ts`]\n if (extension === '.cjs') return [`${stem}.cts`, `${stem}.ts`]\n if (extension === '.jsx') return [`${stem}.tsx`, `${stem}.ts`]\n return []\n}\n\nasync function isFile(path: string): Promise<boolean> {\n try {\n return (await stat(path)).isFile()\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === 'ENOENT') return false\n throw error\n }\n}\n\nfunction subpathImportTarget(rootDir: string, specifier: string, importsMap: Record<string, unknown>): string | undefined {\n const conditionValue = (value: unknown): string | undefined => {\n if (typeof value === 'string') return value\n if (typeof value !== 'object' || value === null) return undefined\n const record = value as Record<string, unknown>\n for (const condition of ['import', 'node', 'default']) {\n const candidate = conditionValue(record[condition])\n if (candidate !== undefined) return candidate\n }\n return undefined\n }\n const direct = conditionValue(importsMap[specifier])\n if (direct !== undefined) return resolve(rootDir, direct)\n for (const [pattern, value] of Object.entries(importsMap)) {\n const star = pattern.indexOf('*')\n if (star === -1) continue\n const prefix = pattern.slice(0, star)\n const suffix = pattern.slice(star + 1)\n if (!specifier.startsWith(prefix) || !specifier.endsWith(suffix)) continue\n const wildcard = specifier.slice(prefix.length, specifier.length - suffix.length)\n const target = conditionValue(value)\n if (target !== undefined) return resolve(rootDir, target.replace('*', wildcard))\n }\n return undefined\n}\n\nasync function packageImportsMap(rootDir: string): Promise<Record<string, unknown>> {\n try {\n const parsed = JSON.parse(await readFile(join(rootDir, 'package.json'), 'utf8')) as { imports?: unknown }\n return typeof parsed.imports === 'object' && parsed.imports !== null ? parsed.imports as Record<string, unknown> : {}\n } catch {\n return {}\n }\n}\n\nasync function resolveModule(fromFile: string, specifier: string, rootDir: string, importsMap: Record<string, unknown>): Promise<string> {\n if (specifier.startsWith('#')) {\n const target = subpathImportTarget(rootDir, specifier, importsMap)\n if (target === undefined) {\n throw new Error(`cannot resolve subpath import ${JSON.stringify(specifier)} through the package \"imports\" map`)\n }\n return resolveModule(fromFile, relative(dirname(fromFile), target).startsWith('.')\n ? relative(dirname(fromFile), target)\n : `./${relative(dirname(fromFile), target)}`, rootDir, importsMap)\n }\n const base = resolve(dirname(fromFile), specifier)\n const candidates = [\n base,\n ...sourceAlternates(base),\n ...(extname(base) === '' ? MODULE_EXTENSIONS.map(extension => `${base}${extension}`) : []),\n ...MODULE_EXTENSIONS.map(extension => join(base, `index${extension}`)),\n ]\n for (const candidate of [...new Set(candidates)]) {\n if (!inside(rootDir, candidate)) throw new Error(`extension import escapes the Pi package: ${specifier} from ${fromFile}`)\n if (await isFile(candidate)) return candidate\n }\n throw new Error(`cannot resolve local extension import ${JSON.stringify(specifier)} from ${fromFile}`)\n}\n\nasync function expandAsset(path: string, rootDir: string): Promise<string[]> {\n if (!inside(rootDir, path)) throw new Error(`extension asset escapes the Pi package: ${path}`)\n let info\n try {\n info = await lstat(path)\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code !== 'ENOENT') throw error\n // A `new URL('./worker.js', import.meta.url)` asset may only exist in its\n // TypeScript source form before the package builds; track the source.\n for (const alternate of sourceAlternates(path)) {\n if (await isFile(alternate)) return [alternate]\n }\n throw error\n }\n if (info.isSymbolicLink()) throw new Error(`refusing to copy symbolic link from Pi package: ${path}`)\n if (info.isFile()) return [path]\n if (!info.isDirectory()) return []\n const output: string[] = []\n for (const entry of await readdir(path)) output.push(...await expandAsset(join(path, entry), rootDir))\n return output\n}\n\nexport async function collectLocalClosure(rootDir: string, entries: readonly string[]): Promise<LocalClosure> {\n const importsMap = await packageImportsMap(rootDir)\n const graph = new Map<string, Array<{ lazy: boolean, targets: string[] }>>()\n const issues: LocalClosureIssue[] = []\n const queue = entries.map(path => resolve(path))\n // Pass 1: the full local reference graph, lazy edges included, so the\n // snapshot carries every file any feature could ever load.\n while (queue.length > 0) {\n const source = queue.shift() as string\n if (graph.has(source)) continue\n if (!inside(rootDir, source)) throw new Error(`extension source escapes the Pi package: ${source}`)\n const info = await lstat(source)\n if (info.isSymbolicLink()) throw new Error(`refusing to copy symbolic link from Pi package: ${source}`)\n if (!info.isFile()) throw new Error(`extension closure contains a non-file path: ${source}`)\n const edges: Array<{ lazy: boolean, targets: string[] }> = []\n graph.set(source, edges)\n if (!SCRIPT_EXTENSIONS.has(extname(source))) continue\n const text = await readFile(source, 'utf8')\n for (const reference of localReferences(source, text)) {\n // Worker/data assets never execute while the entry loads; the feature\n // that spawns them does, so their whole subtree is a lazy path.\n const lazy = reference.lazy || reference.kind === 'asset'\n try {\n const targets = reference.kind === 'module'\n ? [await resolveModule(source, reference.specifier, rootDir, importsMap)]\n : await expandAsset(resolve(dirname(source), reference.specifier), rootDir)\n edges.push({ lazy, targets })\n queue.push(...targets)\n } catch (error) {\n issues.push({\n file: source,\n kind: reference.kind,\n specifier: reference.specifier,\n detail: error instanceof Error ? error.message : String(error),\n lazy,\n })\n }\n }\n }\n // Pass 2: load-time reachability across non-lazy module edges only. This is\n // the set whose problems actually break `pi` (and pi2dsh) at extension load;\n // everything else fails at feature-use time, identically under both hosts.\n const loadTimeFiles = new Set<string>()\n const loadQueue = entries.map(path => resolve(path)).filter(path => graph.has(path))\n while (loadQueue.length > 0) {\n const source = loadQueue.shift() as string\n if (loadTimeFiles.has(source)) continue\n loadTimeFiles.add(source)\n for (const edge of graph.get(source) ?? []) {\n if (edge.lazy) continue\n for (const target of edge.targets) {\n if (!loadTimeFiles.has(target)) loadQueue.push(target)\n }\n }\n }\n // An issue found inside a file that itself only loads lazily cannot break\n // extension load either, however the reference is written.\n for (const issue of issues) {\n if (!loadTimeFiles.has(issue.file)) issue.lazy = true\n }\n return { files: [...graph.keys()].sort(), loadTimeFiles, issues }\n}\n","import { readFile } from 'node:fs/promises'\nimport { basename, extname, relative } from 'node:path'\nimport ts from 'typescript'\nimport {\n PI_CODING_AGENT_PACKAGES,\n PI_AI_PACKAGES,\n PI_TUI_PACKAGES,\n ruleForApi,\n ruleForContextProperty,\n ruleForEvent,\n ruleForHostImport,\n ruleForUiContextProperty,\n} from './compatibility.js'\nimport { collectLocalClosure, runtimeExternalPackages, SCRIPT_EXTENSIONS, sourceKind } from './module-graph.js'\nimport type {\n CompatibilityFinding,\n CompatibilityLevel,\n CompatibilityReport,\n ResolvedPiPackage,\n} from './types.js'\n\nfunction literalText(node: ts.Node | undefined): string | undefined {\n return node !== undefined && (ts.isStringLiteral(node) || ts.isNoSubstitutionTemplateLiteral(node))\n ? node.text\n : undefined\n}\n\nfunction hasModifier(node: ts.Node, kind: ts.SyntaxKind): boolean {\n return ts.canHaveModifiers(node) && ts.getModifiers(node)?.some(modifier => modifier.kind === kind) === true\n}\n\nfunction parameterIdentifier(node: ts.SignatureDeclarationBase): string | undefined {\n const parameter = node.parameters[0]\n return parameter !== undefined && ts.isIdentifier(parameter.name) ? parameter.name.text : undefined\n}\n\nfunction extensionApiReceivers(source: ts.SourceFile): Set<string> {\n const receivers = new Set<string>()\n const functions = new Map<string, ts.FunctionLikeDeclarationBase>()\n\n function index(node: ts.Node): void {\n if (ts.isFunctionDeclaration(node) && node.name !== undefined) functions.set(node.name.text, node)\n if (ts.isVariableDeclaration(node) && ts.isIdentifier(node.name)\n && node.initializer !== undefined\n && (ts.isArrowFunction(node.initializer) || ts.isFunctionExpression(node.initializer))) {\n functions.set(node.name.text, node.initializer)\n }\n if (ts.isParameter(node) && node.type !== undefined\n && /(?:^|\\.)ExtensionAPI\\b/u.test(node.type.getText(source)) && ts.isIdentifier(node.name)) {\n receivers.add(node.name.text)\n }\n // Published Pi packages commonly ship JavaScript with type annotations\n // erased. `pi` is the documented ExtensionAPI parameter name throughout\n // the ecosystem, including helper functions reached from the entry point.\n if (ts.isParameter(node) && ts.isIdentifier(node.name)\n && /^(?:pi|extensionApi)$/iu.test(node.name.text)) {\n receivers.add(node.name.text)\n }\n ts.forEachChild(node, index)\n }\n index(source)\n\n for (const statement of source.statements) {\n if (ts.isFunctionDeclaration(statement)\n && hasModifier(statement, ts.SyntaxKind.ExportKeyword)\n && hasModifier(statement, ts.SyntaxKind.DefaultKeyword)) {\n const name = parameterIdentifier(statement)\n if (name !== undefined) receivers.add(name)\n }\n if (ts.isExportAssignment(statement)) {\n const expression = statement.expression\n if (ts.isArrowFunction(expression) || ts.isFunctionExpression(expression)) {\n const name = parameterIdentifier(expression)\n if (name !== undefined) receivers.add(name)\n } else if (ts.isIdentifier(expression)) {\n const candidate = functions.get(expression.text)\n if (candidate !== undefined) {\n const name = parameterIdentifier(candidate)\n if (name !== undefined) receivers.add(name)\n }\n }\n }\n if (ts.isExportDeclaration(statement) && statement.moduleSpecifier === undefined\n && statement.exportClause !== undefined && ts.isNamedExports(statement.exportClause)) {\n for (const element of statement.exportClause.elements) {\n if (element.name.text !== 'default' || element.propertyName === undefined || !ts.isIdentifier(element.propertyName)) continue\n const candidate = functions.get(element.propertyName.text)\n if (candidate !== undefined) {\n const name = parameterIdentifier(candidate)\n if (name !== undefined) receivers.add(name)\n }\n }\n }\n }\n return receivers\n}\n\nfunction extensionApiProperties(source: ts.SourceFile, receivers: ReadonlySet<string>): Set<string> {\n const properties = new Set<string>()\n function visit(node: ts.Node): void {\n if ((ts.isPropertyDeclaration(node) || ts.isParameter(node)) && ts.isIdentifier(node.name)) {\n const typed = node.type !== undefined && /(?:^|\\.)(?:Pi)?ExtensionAPI\\b/u.test(node.type.getText(source))\n if (typed || /^(?:pi|extensionApi)$/iu.test(node.name.text)) properties.add(node.name.text)\n } else if (ts.isBinaryExpression(node) && node.operatorToken.kind === ts.SyntaxKind.EqualsToken\n && ts.isPropertyAccessExpression(node.left) && node.left.expression.kind === ts.SyntaxKind.ThisKeyword\n && ts.isIdentifier(node.right) && receivers.has(node.right.text)) {\n properties.add(node.left.name.text)\n }\n ts.forEachChild(node, visit)\n }\n visit(source)\n return properties\n}\n\nfunction enclosingFunctionName(node: ts.ParameterDeclaration): string | undefined {\n const parent = node.parent\n if (ts.isMethodDeclaration(parent) && parent.name !== undefined) return parent.name.getText()\n if ((ts.isArrowFunction(parent) || ts.isFunctionExpression(parent)) && ts.isPropertyAssignment(parent.parent)) {\n return parent.parent.name.getText()\n }\n return undefined\n}\n\nfunction extensionContextReceivers(source: ts.SourceFile): Set<string> {\n const receivers = new Set<string>()\n function visit(node: ts.Node): void {\n if (ts.isParameter(node) && ts.isIdentifier(node.name)) {\n const typedContext = node.type !== undefined\n && /(?:^|\\.)(?:Extension|ExtensionCommand|ToolExecution)Context\\b/u.test(node.type.getText(source))\n const conventionalHandlerContext = /^(?:ctx|context)$/iu.test(node.name.text)\n && /^(?:execute|handler)$/u.test(enclosingFunctionName(node) ?? '')\n if (typedContext || conventionalHandlerContext) receivers.add(node.name.text)\n }\n ts.forEachChild(node, visit)\n }\n visit(source)\n return receivers\n}\n\n// The three Pi packages whose named exports the shim audit tracks.\nconst PI_SHIMMED_PACKAGES = new Set<string>([\n ...PI_CODING_AGENT_PACKAGES,\n ...PI_TUI_PACKAGES,\n ...PI_AI_PACKAGES,\n])\n\n// Everything Pi's loader provides to extensions without a declaration —\n// exempt from the undeclared-runtime-dependency fatal, and (for typebox) not\n// subject to per-symbol shim auditing.\nconst PI_HOST_PACKAGES = new Set<string>([\n ...PI_SHIMMED_PACKAGES,\n 'typebox',\n '@sinclair/typebox',\n])\n\nfunction dependencyNames(packageJson: Record<string, unknown>): Set<string> {\n const names = new Set<string>()\n for (const field of ['dependencies', 'optionalDependencies', 'peerDependencies']) {\n const value = packageJson[field]\n if (typeof value !== 'object' || value === null || Array.isArray(value)) continue\n for (const [name, specifier] of Object.entries(value)) {\n if (typeof specifier === 'string') names.add(name)\n }\n }\n return names\n}\n\nfunction pushFinding(\n findings: CompatibilityFinding[],\n rootDir: string,\n file: string,\n source: ts.SourceFile,\n node: ts.Node,\n capability: string,\n level: CompatibilityLevel,\n detail: string,\n): void {\n const position = source.getLineAndCharacterOfPosition(node.getStart(source))\n findings.push({\n capability,\n level,\n file: relative(rootDir, file).replaceAll('\\\\', '/'),\n line: position.line + 1,\n detail,\n })\n}\n\nasync function analyzeExtension(rootDir: string, file: string): Promise<CompatibilityFinding[]> {\n const text = await readFile(file, 'utf8')\n const source = ts.createSourceFile(file, text, ts.ScriptTarget.Latest, true, sourceKind(file))\n const findings: CompatibilityFinding[] = []\n const receivers = extensionApiReceivers(source)\n const apiProperties = extensionApiProperties(source, receivers)\n const contextReceivers = extensionContextReceivers(source)\n const methodAliases = new Map<string, string>()\n const eventBusAliases = new Set<string>()\n const uiAliases = new Set<string>()\n\n function reportHostImport(packageName: string, importedName: string, node: ts.Node): void {\n const matched = ruleForHostImport(packageName, importedName)\n if (matched === undefined) {\n pushFinding(\n findings, rootDir, file, source, node, `host-import(${packageName}:${importedName})`, 'unsupported',\n `The pi2dsh host shim does not export ${JSON.stringify(importedName)} from ${JSON.stringify(packageName)}.`,\n )\n return\n }\n pushFinding(\n findings, rootDir, file, source, node, `host-import(${packageName}:${importedName})`, matched.level, matched.detail,\n )\n }\n\n for (const statement of source.statements) {\n if (ts.isImportDeclaration(statement) && ts.isStringLiteral(statement.moduleSpecifier)\n && PI_SHIMMED_PACKAGES.has(statement.moduleSpecifier.text)) {\n const packageName = statement.moduleSpecifier.text\n const clause = statement.importClause\n if (clause === undefined) {\n reportHostImport(packageName, '<side-effect>', statement)\n continue\n }\n if (clause.isTypeOnly) continue\n if (clause.name !== undefined) reportHostImport(packageName, 'default', clause.name)\n if (clause.namedBindings !== undefined && ts.isNamespaceImport(clause.namedBindings)) {\n reportHostImport(packageName, '*', clause.namedBindings)\n } else if (clause.namedBindings !== undefined) {\n for (const element of clause.namedBindings.elements) {\n if (!element.isTypeOnly) reportHostImport(packageName, element.propertyName?.text ?? element.name.text, element)\n }\n }\n } else if (ts.isExportDeclaration(statement) && !statement.isTypeOnly\n && statement.moduleSpecifier !== undefined && ts.isStringLiteral(statement.moduleSpecifier)\n && PI_HOST_PACKAGES.has(statement.moduleSpecifier.text)) {\n const packageName = statement.moduleSpecifier.text\n if (statement.exportClause === undefined || ts.isNamespaceExport(statement.exportClause)) {\n reportHostImport(packageName, '*', statement)\n } else {\n for (const element of statement.exportClause.elements) {\n if (!element.isTypeOnly) reportHostImport(packageName, element.propertyName?.text ?? element.name.text, element)\n }\n }\n } else if (ts.isImportEqualsDeclaration(statement) && !statement.isTypeOnly\n && ts.isExternalModuleReference(statement.moduleReference)\n && ts.isStringLiteral(statement.moduleReference.expression)\n && PI_HOST_PACKAGES.has(statement.moduleReference.expression.text)) {\n reportHostImport(statement.moduleReference.expression.text, '*', statement)\n }\n }\n\n const declarations: ts.VariableDeclaration[] = []\n const isApiReceiver = (node: ts.Expression): boolean => ts.isIdentifier(node) && receivers.has(node.text)\n || (ts.isPropertyAccessExpression(node) && node.expression.kind === ts.SyntaxKind.ThisKeyword\n && apiProperties.has(node.name.text))\n function collectDeclarations(node: ts.Node): void {\n if (ts.isVariableDeclaration(node)) declarations.push(node)\n ts.forEachChild(node, collectDeclarations)\n }\n collectDeclarations(source)\n\n for (let pass = 0; pass < declarations.length + 1; pass += 1) {\n let changed = false\n for (const declaration of declarations) {\n const initializer = declaration.initializer\n if (initializer === undefined) continue\n if (ts.isIdentifier(declaration.name) && isApiReceiver(initializer)) {\n if (!receivers.has(declaration.name.text)) {\n receivers.add(declaration.name.text)\n changed = true\n }\n }\n if (ts.isIdentifier(declaration.name) && ts.isIdentifier(initializer) && contextReceivers.has(initializer.text)) {\n if (!contextReceivers.has(declaration.name.text)) {\n contextReceivers.add(declaration.name.text)\n changed = true\n }\n }\n if (ts.isIdentifier(declaration.name) && ts.isPropertyAccessExpression(initializer)\n && initializer.name.text === 'ui' && ts.isIdentifier(initializer.expression)\n && contextReceivers.has(initializer.expression.text) && !uiAliases.has(declaration.name.text)) {\n uiAliases.add(declaration.name.text)\n changed = true\n }\n if (ts.isIdentifier(declaration.name) && ts.isPropertyAccessExpression(initializer)\n && isApiReceiver(initializer.expression)) {\n if (initializer.name.text === 'events') {\n if (!eventBusAliases.has(declaration.name.text)) {\n eventBusAliases.add(declaration.name.text)\n changed = true\n }\n } else if (!methodAliases.has(declaration.name.text)) {\n methodAliases.set(declaration.name.text, initializer.name.text)\n changed = true\n }\n }\n if (ts.isObjectBindingPattern(declaration.name) && isApiReceiver(initializer)) {\n for (const element of declaration.name.elements) {\n if (!ts.isIdentifier(element.name)) continue\n const method = element.propertyName !== undefined && ts.isIdentifier(element.propertyName)\n ? element.propertyName.text\n : element.name.text\n if (method === 'events') {\n if (!eventBusAliases.has(element.name.text)) {\n eventBusAliases.add(element.name.text)\n changed = true\n }\n } else if (!methodAliases.has(element.name.text)) {\n methodAliases.set(element.name.text, method)\n changed = true\n }\n }\n }\n }\n if (!changed) break\n }\n\n function reportMethod(method: string, args: ts.NodeArray<ts.Expression>, node: ts.Node): void {\n if (method === 'on') {\n const event = literalText(args[0])\n if (event === undefined) {\n pushFinding(\n findings, rootDir, file, source, node, 'on(<dynamic>)', 'unsupported',\n 'Dynamic event names cannot be audited or mapped safely.',\n )\n } else {\n const rule = ruleForEvent(event)\n pushFinding(findings, rootDir, file, source, node, `on(${event})`, rule.level, rule.detail)\n }\n return\n }\n const rule = ruleForApi(method)\n if (rule === undefined) {\n pushFinding(\n findings, rootDir, file, source, node, method, 'unsupported',\n `Unknown ExtensionAPI method ${JSON.stringify(method)} cannot be audited or mapped safely.`,\n )\n return\n }\n pushFinding(findings, rootDir, file, source, node, method, rule.level, rule.detail)\n }\n\n function reportEventBus(method: string, node: ts.Node): void {\n const rule = ruleForApi('events')\n if ((method === 'on' || method === 'emit') && rule !== undefined) {\n pushFinding(findings, rootDir, file, source, node, `events.${method}`, rule.level, rule.detail)\n } else {\n pushFinding(\n findings, rootDir, file, source, node, `events.${method}`, 'unsupported',\n `Unknown Pi event-bus method ${JSON.stringify(method)} cannot be mapped safely.`,\n )\n }\n }\n\n function reportContext(property: string, node: ts.Node): void {\n const matched = ruleForContextProperty(property)\n if (matched === undefined) {\n pushFinding(\n findings, rootDir, file, source, node, `ctx.${property}`, 'unsupported',\n `Unknown Pi extension-context property ${JSON.stringify(property)} cannot be audited or mapped safely.`,\n )\n } else {\n pushFinding(findings, rootDir, file, source, node, `ctx.${property}`, matched.level, matched.detail)\n }\n }\n\n function reportUiContext(property: string, node: ts.Node): void {\n const matched = ruleForUiContextProperty(property)\n if (matched === undefined) {\n pushFinding(\n findings, rootDir, file, source, node, `ctx.ui.${property}`, 'unsupported',\n `Unknown Pi UI-context property ${JSON.stringify(property)} cannot be audited or mapped safely.`,\n )\n } else {\n pushFinding(findings, rootDir, file, source, node, `ctx.ui.${property}`, matched.level, matched.detail)\n }\n }\n\n function visit(node: ts.Node): void {\n if (ts.isCallExpression(node) && ts.isIdentifier(node.expression)) {\n const method = methodAliases.get(node.expression.text)\n if (method !== undefined) reportMethod(method, node.arguments, node)\n } else if (ts.isCallExpression(node) && ts.isPropertyAccessExpression(node.expression)) {\n const target = node.expression.expression\n if (isApiReceiver(target)) {\n reportMethod(node.expression.name.text, node.arguments, node)\n } else if (ts.isIdentifier(target) && eventBusAliases.has(target.text)) {\n reportEventBus(node.expression.name.text, node)\n } else if (ts.isPropertyAccessExpression(target)\n && target.name.text === 'events'\n && isApiReceiver(target.expression)) {\n reportEventBus(node.expression.name.text, node)\n }\n } else if (ts.isCallExpression(node) && ts.isElementAccessExpression(node.expression)\n && isApiReceiver(node.expression.expression)) {\n const method = literalText(node.expression.argumentExpression)\n if (method === undefined) {\n pushFinding(\n findings, rootDir, file, source, node, '<dynamic-api-method>', 'unsupported',\n 'Dynamic ExtensionAPI method access cannot be audited or mapped safely.',\n )\n } else {\n reportMethod(method, node.arguments, node)\n }\n }\n if (ts.isPropertyAccessExpression(node)) {\n const target = node.expression\n if (ts.isPropertyAccessExpression(target) && target.name.text === 'ui'\n && ts.isIdentifier(target.expression) && contextReceivers.has(target.expression.text)) {\n reportUiContext(node.name.text, node)\n } else if (ts.isIdentifier(target) && uiAliases.has(target.text)) {\n reportUiContext(node.name.text, node)\n } else if (ts.isIdentifier(target) && contextReceivers.has(target.text) && node.name.text !== 'ui') {\n reportContext(node.name.text, node)\n }\n } else if (ts.isElementAccessExpression(node) && ts.isIdentifier(node.expression)\n && contextReceivers.has(node.expression.text)) {\n const property = literalText(node.argumentExpression)\n if (property === undefined) {\n pushFinding(\n findings, rootDir, file, source, node, 'ctx.<dynamic>', 'unsupported',\n 'Dynamic Pi extension-context access cannot be audited or mapped safely.',\n )\n } else if (property !== 'ui') {\n reportContext(property, node)\n }\n }\n ts.forEachChild(node, visit)\n }\n\n visit(source)\n return findings\n}\n\nexport async function analyzePackage(pkg: ResolvedPiPackage): Promise<CompatibilityReport> {\n const extensionClosure = await collectLocalClosure(pkg.rootDir, pkg.resources.extensions)\n const findings = (await Promise.all(\n extensionClosure.files.filter(file => SCRIPT_EXTENSIONS.has(extname(file)))\n .map(file => analyzeExtension(pkg.rootDir, file)),\n )).flat()\n\n if (pkg.resources.extensions.length > 0 && findings.length === 0) {\n findings.push({\n capability: 'static-audit',\n level: 'unsupported',\n file: pkg.resources.extensions.map(file => relative(pkg.rootDir, file).replaceAll('\\\\', '/')).join(', '),\n line: 1,\n detail: 'No ExtensionAPI use was statically proven across the local module closure; conversion fails closed instead of claiming compatibility.',\n })\n }\n for (const issue of extensionClosure.issues) {\n // Only a break on the load-time path blocks the package: Pi's own loader\n // fails the same lazy references at feature-use time, and the snapshot\n // preserves the published file layout, so behavior matches Pi exactly.\n const lazyIssue = issue.lazy || issue.kind === 'asset'\n findings.push({\n capability: `${issue.kind}(${issue.specifier})`,\n level: lazyIssue ? 'partial' : 'fatal',\n file: relative(pkg.rootDir, issue.file).replaceAll('\\\\', '/'),\n line: 1,\n detail: lazyIssue\n ? `Unresolved reference on a lazy path: ${issue.detail}. Extension load is unaffected; if the feature that evaluates it runs, it fails the same way under Pi (published file layout is preserved).`\n : `The local extension closure is incomplete: ${issue.detail}`,\n })\n }\n\n const declaredDependencies = dependencyNames(pkg.packageJson)\n for (const file of extensionClosure.files.filter(candidate => SCRIPT_EXTENSIONS.has(extname(candidate)))) {\n const text = await readFile(file, 'utf8')\n const lazyFile = !extensionClosure.loadTimeFiles.has(file)\n for (const use of runtimeExternalPackages(file, text)) {\n if (PI_HOST_PACKAGES.has(use.name) || declaredDependencies.has(use.name)) continue\n // Undeclared imports only crash extension load when they execute at load\n // time. On lazy paths (function-body dynamic imports, or files that are\n // themselves only lazily reachable) Pi degrades per-feature; mirror that.\n const lazyUse = use.lazy || lazyFile\n findings.push({\n capability: lazyUse ? `optional-lazy-dependency(${use.name})` : `undeclared-runtime-dependency(${use.name})`,\n level: lazyUse ? 'partial' : 'fatal',\n file: relative(pkg.rootDir, file).replaceAll('\\\\', '/'),\n line: 1,\n detail: lazyUse\n ? `The extension imports ${JSON.stringify(use.name)} only on a lazily-evaluated path without declaring it; the feature that needs it asks for the module at call time, exactly as under Pi (install ${use.name} to use that feature).`\n : `The extension imports ${JSON.stringify(use.name)} at load time, but the Pi package does not declare it as a dependency.`,\n })\n }\n }\n\n const resourceFinding = (file: string, capability: string, level: CompatibilityLevel, detail: string): CompatibilityFinding => ({\n capability,\n level,\n file: relative(pkg.rootDir, file).replaceAll('\\\\', '/'),\n line: 1,\n detail,\n })\n for (const file of pkg.resources.skills.filter(path => basename(path) === 'SKILL.md' || path.endsWith('.md'))) {\n findings.push(resourceFinding(file, 'skill', 'full', 'Copied as a DSH filesystem skill with its resource directory intact.'))\n }\n for (const file of pkg.resources.prompts) {\n findings.push(resourceFinding(file, 'prompt', 'full', 'Registered as a DSH slash command with Pi-compatible argument expansion.'))\n }\n for (const file of pkg.resources.themes) {\n findings.push(resourceFinding(file, 'theme', 'unsupported', 'Pi terminal themes have no effect in DSH Web or headless surfaces.'))\n }\n findings.sort((left, right) => left.file.localeCompare(right.file) || left.line - right.line || left.capability.localeCompare(right.capability))\n\n const summary: Record<CompatibilityLevel, number> = { full: 0, partial: 0, unsupported: 0, fatal: 0 }\n for (const finding of findings) summary[finding.level] += 1\n // Static analysis screens; it does not certify. Only fatal findings block a\n // bundle (it cannot be built or trusted). Everything else installs: verify\n // real behavior with the black-box run instead of trusting this verdict.\n const verdict = summary.fatal > 0 ? 'blocked' : summary.partial > 0 || summary.unsupported > 0 ? 'review' : 'ready'\n\n return {\n schemaVersion: 1,\n package: pkg.identity,\n verdict,\n summary,\n resources: {\n extensions: pkg.resources.extensions.map(file => relative(pkg.rootDir, file).replaceAll('\\\\', '/')),\n skills: pkg.resources.skills.map(file => relative(pkg.rootDir, file).replaceAll('\\\\', '/')),\n prompts: pkg.resources.prompts.map(file => relative(pkg.rootDir, file).replaceAll('\\\\', '/')),\n themes: pkg.resources.themes.map(file => relative(pkg.rootDir, file).replaceAll('\\\\', '/')),\n },\n findings,\n }\n}\n"],"mappings":";;;;;;;AAKA,MAAa,oCAAoB,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Q,KAAI,SAAQ,SAAS,IAAI,SAAS,IAAI,CAAC,CAAC,WAAW,MAAM,GAAG,CAAC;GAC5F,QAAQ,IAAI,UAAU,OAAO,KAAI,SAAQ,SAAS,IAAI,SAAS,IAAI,CAAC,CAAC,WAAW,MAAM,GAAG,CAAC;EAC5F;EACA;CACF;AACF"}
|
package/dist/cli.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { t as resolvePiPackage } from "./source-0sA5z08z.mjs";
|
|
3
|
-
import { a as CONTEXT_RULES, d as UI_CONTEXT_RULES, i as API_RULES, n as convertPiMcpConfig, o as EVENT_RULES, r as renderMcpPatch, s as HOST_IMPORT_RULES } from "./mcp-config-
|
|
3
|
+
import { a as CONTEXT_RULES, d as UI_CONTEXT_RULES, i as API_RULES, n as convertPiMcpConfig, o as EVENT_RULES, r as renderMcpPatch, s as HOST_IMPORT_RULES } from "./mcp-config-DoufpLUI.mjs";
|
|
4
4
|
import { writeFileSync } from "node:fs";
|
|
5
5
|
import { parseArgs } from "node:util";
|
|
6
6
|
//#region src/cli.ts
|
|
@@ -75,7 +75,7 @@ async function main() {
|
|
|
75
75
|
if (command !== "inspect" || source === void 0) throw new Error(`invalid command\n\n${usage()}`);
|
|
76
76
|
const pkg = await resolvePiPackage(source);
|
|
77
77
|
try {
|
|
78
|
-
const { analyzePackage } = await import("./analyzer-
|
|
78
|
+
const { analyzePackage } = await import("./analyzer-BgkCub5L.mjs");
|
|
79
79
|
const report = await analyzePackage(pkg);
|
|
80
80
|
console.log(parsed.values.json ? JSON.stringify(report, null, 2) : reportText(report));
|
|
81
81
|
if (report.verdict === "blocked") process.exitCode = 2;
|
package/dist/host.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { a as registerVisionCompanions, t as applyPiPackage } from "./runtime-
|
|
2
|
+
import { a as registerVisionCompanions, t as applyPiPackage } from "./runtime-DE2dU1cA.mjs";
|
|
3
3
|
import { t as resolvePiPackage } from "./source-0sA5z08z.mjs";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
import { readFile } from "node:fs/promises";
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
|
|
2
|
-
import { a as registerVisionCompanions } from "./runtime-
|
|
2
|
+
import { a as registerVisionCompanions } from "./runtime-DE2dU1cA.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 CONTEXT_RULES, c as PI_AI_PACKAGES, d as UI_CONTEXT_RULES, f as ruleForApi, g as ruleForUiContextProperty, h as ruleForHostImport, i as API_RULES, l as PI_CODING_AGENT_PACKAGES, m as ruleForEvent, n as convertPiMcpConfig, o as EVENT_RULES, p as ruleForContextProperty, r as renderMcpPatch, s as HOST_IMPORT_RULES, t as collectPiMcpServers, u as PI_TUI_PACKAGES } from "./mcp-config-
|
|
5
|
+
import { a as CONTEXT_RULES, c as PI_AI_PACKAGES, d as UI_CONTEXT_RULES, f as ruleForApi, g as ruleForUiContextProperty, h as ruleForHostImport, i as API_RULES, l as PI_CODING_AGENT_PACKAGES, m as ruleForEvent, n as convertPiMcpConfig, o as EVENT_RULES, p as ruleForContextProperty, r as renderMcpPatch, s as HOST_IMPORT_RULES, t as collectPiMcpServers, u as PI_TUI_PACKAGES } from "./mcp-config-DoufpLUI.mjs";
|
|
6
6
|
import { readFile } from "node:fs/promises";
|
|
7
7
|
import { existsSync } from "node:fs";
|
|
8
8
|
import { dirname, join } from "node:path";
|
|
@@ -233,7 +233,7 @@ async function apply(ctx, config = {}) {
|
|
|
233
233
|
* @returns the compatibility report.
|
|
234
234
|
*/
|
|
235
235
|
async function analyzePackage(pkg) {
|
|
236
|
-
const { analyzePackage: run } = await import("./analyzer-
|
|
236
|
+
const { analyzePackage: run } = await import("./analyzer-BgkCub5L.mjs");
|
|
237
237
|
return run(pkg);
|
|
238
238
|
}
|
|
239
239
|
//#endregion
|
|
@@ -91,7 +91,7 @@ const HOST_IMPORT_RULES = Object.freeze({
|
|
|
91
91
|
DefaultResourceLoader: rule("partial", "A headless resource loader honoring overrides, with empty discovery sets."),
|
|
92
92
|
DefaultPackageManager: rule("unsupported", "Installing packages is owned by the DSH host and its security gates (dsh plugin add/remove behind pnpm's build-script approval). Importing it is flagged at mount time (startup check); constructing it throws a structured PiCapabilityError, and doing so during entry setup marks the package unusable."),
|
|
93
93
|
ModelRuntime: rule("unsupported", "Standalone model stacks are owned by the DSH host llm configuration; packages read the ONE directory through ctx.modelRegistry. Importing it is flagged at mount time (startup check); constructing it throws a structured PiCapabilityError, and doing so during entry setup marks the package unusable."),
|
|
94
|
-
createAgentSession: rule("partial", "Bridged to a genuine DSH child agent through ctx.agents with the creator-exclusive setup contribution. Child tools join a preset composition in the roster's official preference order — inherit the parent's standing composition (composeFrom), else mount the roster default — which is what keeps children tooled on roster-owned surfaces (dsh-tui disables host-layer tool rows); rosterless deployments compose from the host rows as before. The Pi tools allowlist/excludeTools become official scoped restrictions, customTools register in the child scope, delegation policy travels the official way, and the child's model
|
|
94
|
+
createAgentSession: rule("partial", "Bridged to a genuine DSH child agent through ctx.agents with the creator-exclusive setup contribution. Child tools join a preset composition in the roster's official preference order — inherit the parent's standing composition (composeFrom), else mount the roster default — which is what keeps children tooled on roster-owned surfaces (dsh-tui disables host-layer tool rows); rosterless deployments compose from the host rows as before. The Pi tools allowlist/excludeTools become official scoped restrictions, customTools register in the child scope, delegation policy travels the official way, and the child's model resolves in three tiers — the explicit Pi model on the options, else the caller's LIVE route read from its durable session log's last request/header (so a mid-session /model switch in the DSH UI is inherited, proven live on the stock TUI), else the creation-time snapshot; a truly modelless child fails its first {{model}}-keyed prompt assembly. A per-child thinkingLevel becomes the child's own reasoningEffort through the official agent/request waterfall (never leaking to siblings or the parent). session.subscribe projects tool_execution_start/end from the durable log (tool-use accounting works), steer() and followUp() are async per Pi's AgentSession face (consumers chain .catch on the returned promise; steer interrupts, followUp queues behind the running turn), and abort() follows Pi's contract: the child turn is cancelled AND post-abort wakes (a late tool result reaching quiescence) are re-cancelled on every opening event until the next explicit prompt(). The child exposes session.sessionManager (readonly projection) whose getSessionFile() names a durable archive (`<id>.jsonl`) — handing a SessionManager opened FROM such an archive back to createAgentSession reopens the SAME persisted DSH session through the registry's official resume seam, across process restarts (pi-subagents' tombstone resurrect shape). Compositions without a loop factory fail explicitly."),
|
|
95
95
|
createCodingTools: rule("full", "Pi's exact tool set composed from the vendored built-in constructors."),
|
|
96
96
|
createReadOnlyTools: rule("full", "Pi's exact read-only tool set composed from the vendored built-in constructors."),
|
|
97
97
|
createBashTool: rule("full", VENDORED_TOOL),
|
|
@@ -776,4 +776,4 @@ function renderMcpPatch(result) {
|
|
|
776
776
|
//#endregion
|
|
777
777
|
export { CONTEXT_RULES as a, PI_AI_PACKAGES as c, UI_CONTEXT_RULES as d, ruleForApi as f, ruleForUiContextProperty as g, ruleForHostImport as h, API_RULES as i, PI_CODING_AGENT_PACKAGES as l, ruleForEvent as m, convertPiMcpConfig as n, EVENT_RULES as o, ruleForContextProperty as p, renderMcpPatch as r, HOST_IMPORT_RULES as s, collectPiMcpServers as t, PI_TUI_PACKAGES as u };
|
|
778
778
|
|
|
779
|
-
//# sourceMappingURL=mcp-config-
|
|
779
|
+
//# sourceMappingURL=mcp-config-DoufpLUI.mjs.map
|