zidane 9.1.5 → 9.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{acp-BWLdmJDt.js → acp-DMIhIsAi.js} +3 -3
- package/dist/{acp-BWLdmJDt.js.map → acp-DMIhIsAi.js.map} +1 -1
- package/dist/acp-cli.js +4 -4
- package/dist/acp.d.ts +2 -2
- package/dist/acp.js +1 -1
- package/dist/agent.d.ts +1 -1
- package/dist/{auth-store-port-DYsWAuUj.js → auth-store-port-BHEXS3VS.js} +2 -2
- package/dist/{auth-store-port-DYsWAuUj.js.map → auth-store-port-BHEXS3VS.js.map} +1 -1
- package/dist/{auto-update-restart-BLW0dTui.js → auto-update-restart-Dkdz6rq4.js} +10 -10
- package/dist/{auto-update-restart-BLW0dTui.js.map → auto-update-restart-Dkdz6rq4.js.map} +1 -1
- package/dist/{browser-entry-CHX7eDd5.d.ts → browser-entry-DP6PZ2Ar.d.ts} +4 -4
- package/dist/{browser-entry-CHX7eDd5.d.ts.map → browser-entry-DP6PZ2Ar.d.ts.map} +1 -1
- package/dist/channels.d.ts +5 -5
- package/dist/chat/browser.d.ts +3 -3
- package/dist/chat/pure.d.ts +3 -3
- package/dist/chat.d.ts +4 -4
- package/dist/chat.js +9 -9
- package/dist/{cli-shared-DyAIGvCc.js → cli-shared-VGYq10bZ.js} +3 -3
- package/dist/{cli-shared-DyAIGvCc.js.map → cli-shared-VGYq10bZ.js.map} +1 -1
- package/dist/{client-core-BdLvnaYK.d.ts → client-core-CG_5I6Ol.d.ts} +4 -4
- package/dist/{client-core-BdLvnaYK.d.ts.map → client-core-CG_5I6Ol.d.ts.map} +1 -1
- package/dist/{client-CK_UrIhx.d.ts → client-tLbAFn0W.d.ts} +2 -2
- package/dist/{client-CK_UrIhx.d.ts.map → client-tLbAFn0W.d.ts.map} +1 -1
- package/dist/{connection-loop--yxMYRBl.d.ts → connection-loop-CPeQsGRl.d.ts} +4 -4
- package/dist/{connection-loop--yxMYRBl.d.ts.map → connection-loop-CPeQsGRl.d.ts.map} +1 -1
- package/dist/contexts/daytona.d.ts +1 -1
- package/dist/contexts/e2b.d.ts +1 -1
- package/dist/{credentials-CKZXFn6X.js → credentials-Bf8Bz4X-.js} +2 -2
- package/dist/{credentials-CKZXFn6X.js.map → credentials-Bf8Bz4X-.js.map} +1 -1
- package/dist/daemon-cli.js +2 -2
- package/dist/{discovery-Cma3l0tG.js → discovery-CC6Uhvm8.js} +4 -4
- package/dist/{discovery-Cma3l0tG.js.map → discovery-CC6Uhvm8.js.map} +1 -1
- package/dist/durable/sqlite.d.ts +2 -2
- package/dist/durable.d.ts +1 -1
- package/dist/{engine-DH7FBsXF.js → engine-d8V1hEDw.js} +3 -3
- package/dist/{engine-DH7FBsXF.js.map → engine-d8V1hEDw.js.map} +1 -1
- package/dist/eval.d.ts +1 -1
- package/dist/{executor-Cj6ilahP.js → executor-C5VCLmPj.js} +2 -2
- package/dist/{executor-Cj6ilahP.js.map → executor-C5VCLmPj.js.map} +1 -1
- package/dist/extensions/testing.d.ts +1 -1
- package/dist/extensions/testing.js +2 -2
- package/dist/{extensions-client-CGL8cTfx.d.ts → extensions-client-ke2jcWfp.d.ts} +4 -4
- package/dist/{extensions-client-CGL8cTfx.d.ts.map → extensions-client-ke2jcWfp.d.ts.map} +1 -1
- package/dist/{extensions-DjEPVNyg.js → extensions-hHKXiXSo.js} +6 -6
- package/dist/{extensions-DjEPVNyg.js.map → extensions-hHKXiXSo.js.map} +1 -1
- package/dist/extensions.d.ts +1 -1
- package/dist/extensions.js +5 -5
- package/dist/{fold-rules-C6udT9hM.d.ts → fold-rules-NGK3F6IS.d.ts} +2 -2
- package/dist/{fold-rules-C6udT9hM.d.ts.map → fold-rules-NGK3F6IS.d.ts.map} +1 -1
- package/dist/{google-DJV9Hjyw.js → google-BxIUmp_8.js} +2 -2
- package/dist/{google-DJV9Hjyw.js.map → google-BxIUmp_8.js.map} +1 -1
- package/dist/headless.d.ts +1 -1
- package/dist/{host-9vLbGyJq.js → host-n1AYC9-H.js} +9 -9
- package/dist/{host-9vLbGyJq.js.map → host-n1AYC9-H.js.map} +1 -1
- package/dist/{host-signals-DMndC3WQ.js → host-signals-eQf9F1Rl.js} +5 -5
- package/dist/{host-signals-DMndC3WQ.js.map → host-signals-eQf9F1Rl.js.map} +1 -1
- package/dist/{host-version-B6zEy_l1.js → host-version-EkzK6xdV.js} +2 -2
- package/dist/{host-version-B6zEy_l1.js.map → host-version-EkzK6xdV.js.map} +1 -1
- package/dist/{index-D2HJUCR1.d.ts → index-BypbUp-D.d.ts} +4 -4
- package/dist/{index-D2HJUCR1.d.ts.map → index-BypbUp-D.d.ts.map} +1 -1
- package/dist/{index-ByR7Be4d.d.ts → index-CNq4AYES.d.ts} +37 -10
- package/dist/index-CNq4AYES.d.ts.map +1 -0
- package/dist/{index-BI6RZc60.d.ts → index-DqCio7Nd.d.ts} +7 -4
- package/dist/{index-BI6RZc60.d.ts.map → index-DqCio7Nd.d.ts.map} +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +5 -5
- package/dist/ipc/browser.d.ts +3 -3
- package/dist/ipc/remote.d.ts +6 -6
- package/dist/ipc/remote.js +3 -3
- package/dist/{ipc-DBOylNnG.js → ipc-DUqSK-SB.js} +4 -4
- package/dist/{ipc-DBOylNnG.js.map → ipc-DUqSK-SB.js.map} +1 -1
- package/dist/ipc.d.ts +10 -10
- package/dist/ipc.js +5 -5
- package/dist/{links-DMWKvAmD.js → links-DivTLyDT.js} +8 -8
- package/dist/{links-DMWKvAmD.js.map → links-DivTLyDT.js.map} +1 -1
- package/dist/{loaded-entry-CaFgDCMz.js → loaded-entry-D93ZwfH8.js} +2 -2
- package/dist/{loaded-entry-CaFgDCMz.js.map → loaded-entry-D93ZwfH8.js.map} +1 -1
- package/dist/mcp.d.ts +1 -1
- package/dist/{media-type-DDrpCEf9.d.ts → media-type-vJuUTlW5.d.ts} +2 -2
- package/dist/{media-type-DDrpCEf9.d.ts.map → media-type-vJuUTlW5.d.ts.map} +1 -1
- package/dist/{memory-CoaLfuI2.js → memory-D060YOj_.js} +27 -19
- package/dist/memory-D060YOj_.js.map +1 -0
- package/dist/output/stream-json.d.ts +1 -1
- package/dist/output/terminal.d.ts +1 -1
- package/dist/{path-display-DV6PlTOE.js → path-display-Dm4nSwwF.js} +3 -3
- package/dist/{path-display-DV6PlTOE.js.map → path-display-Dm4nSwwF.js.map} +1 -1
- package/dist/plugins.d.ts +1 -1
- package/dist/presets.d.ts +1 -1
- package/dist/{protocol-BAXNtbj5.d.ts → protocol-DlFZqIbu.d.ts} +5 -5
- package/dist/{protocol-BAXNtbj5.d.ts.map → protocol-DlFZqIbu.d.ts.map} +1 -1
- package/dist/providers/anthropic.d.ts +1 -1
- package/dist/providers/arcee.d.ts +1 -1
- package/dist/providers/baseten.d.ts +1 -1
- package/dist/providers/cerebras.d.ts +1 -1
- package/dist/providers/google.d.ts +1 -1
- package/dist/providers/google.js +1 -1
- package/dist/providers/local.d.ts +1 -1
- package/dist/providers/neuralwatt.d.ts +1 -1
- package/dist/providers/openai-compat.d.ts +1 -1
- package/dist/providers/openai.d.ts +1 -1
- package/dist/providers/openrouter.d.ts +1 -1
- package/dist/providers/xai.d.ts +1 -1
- package/dist/{providers-cSrUyM2h.js → providers-CuMn0Kkq.js} +2 -2
- package/dist/{providers-cSrUyM2h.js.map → providers-CuMn0Kkq.js.map} +1 -1
- package/dist/providers.d.ts +1 -1
- package/dist/providers.js +1 -1
- package/dist/{registry-4T13yxMT.js → registry-CGYWxMNj.js} +2 -2
- package/dist/{registry-4T13yxMT.js.map → registry-CGYWxMNj.js.map} +1 -1
- package/dist/{registry-8mnp3zJf.js → registry-DWYR40B2.js} +2 -2
- package/dist/{registry-8mnp3zJf.js.map → registry-DWYR40B2.js.map} +1 -1
- package/dist/{registry-BBzysAGz.js → registry-yhXC9O2x.js} +2 -2
- package/dist/{registry-BBzysAGz.js.map → registry-yhXC9O2x.js.map} +1 -1
- package/dist/{remote-hosts-G62uJ45a.js → remote-hosts-DpAyu0ER.js} +4 -4
- package/dist/{remote-hosts-G62uJ45a.js.map → remote-hosts-DpAyu0ER.js.map} +1 -1
- package/dist/restate.d.ts +1 -1
- package/dist/session/sqlite.d.ts +1 -1
- package/dist/session.d.ts +1 -1
- package/dist/{setting-BWlU8Liz.js → setting-wx57dbgJ.js} +2 -2
- package/dist/{setting-BWlU8Liz.js.map → setting-wx57dbgJ.js.map} +1 -1
- package/dist/{settings-keys-DpQ5m5oZ.js → settings-keys-Dmig23l3.js} +2 -2
- package/dist/{settings-keys-DpQ5m5oZ.js.map → settings-keys-Dmig23l3.js.map} +1 -1
- package/dist/skills.d.ts +1 -1
- package/dist/{sqlite-runtime-D7WG9VL_.d.ts → sqlite-runtime-D2N0m9XE.d.ts} +2 -2
- package/dist/sqlite-runtime-D2N0m9XE.d.ts.map +1 -0
- package/dist/{system-freeze-CGSHvvCg.js → system-freeze-C3g8HY4t.js} +2 -2
- package/dist/{system-freeze-CGSHvvCg.js.map → system-freeze-C3g8HY4t.js.map} +1 -1
- package/dist/tools/fetch-url.d.ts +1 -1
- package/dist/tools/web-search.d.ts +1 -1
- package/dist/tools.d.ts +1 -1
- package/dist/tui.d.ts +9 -9
- package/dist/tui.js +15 -15
- package/dist/{types-DVuB6yk8.d.ts → types-CPxqnCeG.d.ts} +2 -2
- package/dist/{types-DVuB6yk8.d.ts.map → types-CPxqnCeG.d.ts.map} +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/{version-BoECn_c8.js → version-3w8QMAyl.js} +2 -2
- package/dist/{version-BoECn_c8.js.map → version-3w8QMAyl.js.map} +1 -1
- package/dist/{wire-DYBrjw6p.js → wire-Ct6nuXL5.js} +2 -2
- package/dist/{wire-DYBrjw6p.js.map → wire-Ct6nuXL5.js.map} +1 -1
- package/dist/{ws-client-iv10YsKH.js → ws-client-DAm6UPtq.js} +2 -2
- package/dist/{ws-client-iv10YsKH.js.map → ws-client-DAm6UPtq.js.map} +1 -1
- package/dist/{ws-ByUKaCyV.js → ws-olbe6ZfF.js} +4 -4
- package/dist/{ws-ByUKaCyV.js.map → ws-olbe6ZfF.js.map} +1 -1
- package/docs/EXTENSIONS.md +1 -1
- package/package.json +1 -1
- package/dist/index-ByR7Be4d.d.ts.map +0 -1
- package/dist/memory-CoaLfuI2.js.map +0 -1
- package/dist/sqlite-runtime-D7WG9VL_.d.ts.map +0 -1
package/dist/daemon-cli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { r as fixPath, s as startIpcDaemon, t as connectInProcess } from "./memory-
|
|
2
|
+
import { r as fixPath, s as startIpcDaemon, t as connectInProcess } from "./memory-D060YOj_.js";
|
|
3
3
|
import { t as resolveStorageDirs } from "./xdg-DFSAQQG8.js";
|
|
4
|
-
import { l as defaultSocketPath } from "./settings-keys-
|
|
4
|
+
import { l as defaultSocketPath } from "./settings-keys-Dmig23l3.js";
|
|
5
5
|
import { t as cliStyle } from "./cli-style-DBEm6CyT.js";
|
|
6
6
|
import { createRequire } from "node:module";
|
|
7
7
|
import { join } from "node:path";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-BhDjJH2R.js";
|
|
2
2
|
import { h as errorMessage } from "./errors-HOFWedJs.js";
|
|
3
|
-
import { Kt as isSettingsIcon, Vt as looksLikeDefinition } from "./registry-
|
|
3
|
+
import { Kt as isSettingsIcon, Vt as looksLikeDefinition } from "./registry-DWYR40B2.js";
|
|
4
4
|
import { t as createDebugLog } from "./debug-log-DyKmu0Wv.js";
|
|
5
5
|
import { t as projectUserPaths } from "./project-user-paths-Chsi83mp.js";
|
|
6
|
-
import { t as checkZidaneVersion } from "./host-version-
|
|
6
|
+
import { t as checkZidaneVersion } from "./host-version-EkzK6xdV.js";
|
|
7
7
|
import { r as createLogger, t as consoleSink } from "./logger-BQj8QCJp.js";
|
|
8
8
|
import { a as registerExtensionApiHostModules, s as resolveExtensionHostModules } from "./host-modules-C2GGiSjg.js";
|
|
9
|
-
import { a as runtimeLoadedExtension, t as NO_DEFINITION_ERROR } from "./loaded-entry-
|
|
9
|
+
import { a as runtimeLoadedExtension, t as NO_DEFINITION_ERROR } from "./loaded-entry-D93ZwfH8.js";
|
|
10
10
|
import { createRequire } from "node:module";
|
|
11
11
|
import { basename, delimiter, dirname, join, resolve, sep } from "node:path";
|
|
12
12
|
import { lstatSync, readFileSync, readdirSync, realpathSync, rmSync, statSync } from "node:fs";
|
|
@@ -620,4 +620,4 @@ function isExtensionManifest(value) {
|
|
|
620
620
|
//#endregion
|
|
621
621
|
export { precompileExtension as _, discovery_exports as a, defineExtension as b, inlineLoadedExtension as c, parseExtensionScanPathEnv as d, readExtensionManifest as f, COMPILE_CACHE_MAX_AGE_MS as g, withTimeout as h, discoverExtensions as i, loadExtensionFolder as l, scanExtensionDirectories as m, defaultExtensionScanPaths as n, findEntryFile as o, releaseExtensionModules as p, definitionExport as r, importExtensionEntry as s, ENTRY_CANDIDATES as t, loadableExtensionDirs as u, pruneExtensionCompileCache as v, EXTENSION_API_VERSION as y };
|
|
622
622
|
|
|
623
|
-
//# sourceMappingURL=discovery-
|
|
623
|
+
//# sourceMappingURL=discovery-CC6Uhvm8.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discovery-Cma3l0tG.js","names":[],"sources":["../src/extensions/api/define.ts","../src/extensions/compile-cache.ts","../src/extensions/with-timeout.ts","../src/extensions/discovery.ts"],"sourcesContent":["/**\n * Extension API: the definition an extension module exports.\n */\n\nimport type { ExtensionContext } from './context'\nimport type { Cleanup } from './core'\nimport type { SettingsSchema } from './settings'\n\n/** The API version this runtime supports. */\nexport const EXTENSION_API_VERSION = 1\n\n/**\n * An extension. Export it as the module's default export, either through\n * `defineExtension` or as a plain object (no import needed).\n *\n * @typeParam S - The settings schema, so `ctx.settings.get` is typed.\n */\nexport interface ExtensionDefinition<S extends SettingsSchema = SettingsSchema> {\n /** Must be `1`. */\n apiVersion: 1\n /** Lowercase id, words joined by `-`. Equals the folder name for discovered extensions. Prefixes every id the extension contributes. */\n id: string\n /** Name shown in Settings. Defaults to `id`. */\n displayName?: string\n /**\n * The extension's icon in each app's vocabulary: `gui` an icon class for\n * the desktop and web apps (a Phosphor class such as `'i-ph-git-branch'`),\n * `tui` a short glyph for the terminal app. The settings sidebar draws it\n * on the extension's entry. Absent: a letter badge of the display name.\n */\n icon?: { gui?: string, tui?: string }\n /** Semver of the extension. */\n version?: string\n /** One line shown in Settings. */\n description?: string\n /**\n * Other extensions this one builds on: `{ id: semver range }`. Sets the load\n * order and gives install hints. A missing dependency never fails a load;\n * `ctx.use` reports it as inactive.\n */\n dependencies?: Readonly<Record<string, string>>\n /** Settings the extension reads. Shown in Settings even when the extension is off. */\n settings?: S\n /** Entry exporting React components for the desktop and web apps. Default `ui.tsx` when present. */\n ui?: string\n /** Entry exporting OpenTUI React components for the terminal app. Default `tui.tsx` when present. */\n tui?: string\n /**\n * Runs once per load. Register what the extension adds. May return a\n * cleanup that runs when the extension unloads. Registrations made later\n * (after an await, from a handler) work until the extension unloads.\n */\n setup: (ctx: ExtensionContext<S>) => void | Cleanup | Promise<void | Cleanup>\n}\n\n/**\n * Returns `definition` unchanged. It anchors type inference for `ctx`.\n *\n * @param definition - The extension.\n * @returns The same `definition`.\n */\nexport function defineExtension<S extends SettingsSchema = SettingsSchema>(definition: ExtensionDefinition<S>): ExtensionDefinition<S> {\n return definition\n}\n","/**\n * Compiled extension code kept on disk, for Node hosts (the desktop app):\n * they load extensions through jiti, which compiles each TypeScript file\n * with Babel on the calling thread, tens of ms per file, on every load. Bun\n * hosts import natively and never use it.\n *\n * jiti's own file cache does the keeping: one entry per source path (an edit\n * rewrites it), valid only while it ends with the hash of the source it was\n * compiled from, so a changed file is compiled again, never served stale. A\n * load and {@link precompileExtension} write the same entries (the same\n * options, {@link extensionJitiOptions}), so a host can compile on another\n * thread ahead of a load, and the load only reads.\n *\n * Entries are written for files that change; an entry not rewritten in\n * {@link COMPILE_CACHE_MAX_AGE_MS} goes ({@link pruneExtensionCompileCache}),\n * and a file still in use compiles once more.\n */\nimport type { JitiOptions } from 'jiti'\nimport type { Dirent } from 'node:fs'\nimport { readdirSync, readFileSync, realpathSync, rmSync, statSync } from 'node:fs'\nimport { join } from 'node:path'\n\n/** How old an entry may grow without being rewritten before {@link pruneExtensionCompileCache} drops it. */\nexport const COMPILE_CACHE_MAX_AGE_MS = 30 * 24 * 60 * 60 * 1000\n\n/** Files jiti always compiles: TypeScript. */\nconst COMPILED_FILE = /\\.[cm]?tsx?$/\n\n/**\n * jiti, imported by a name the Bun binary's bundler leaves alone: a Node host\n * resolves it from zidane's dependencies, the Bun binary never runs it.\n */\nexport async function loadJiti(): Promise<typeof import('jiti')> {\n const specifier = 'jiti'\n return import(specifier) as Promise<typeof import('jiti')>\n}\n\n/**\n * The jiti options every extension load and precompile share: the cache\n * entries' names depend on them, so both must use exactly these.\n *\n * @param compileCache - The cache folder; none: nothing is kept.\n */\nexport function extensionJitiOptions(compileCache: string | undefined): JitiOptions {\n return { moduleCache: true, fsCache: compileCache ?? false, interopDefault: false }\n}\n\n/**\n * The names jiti keeps a file under: the path a load is given (the entry, by\n * the scanned folder), and the real path Node's resolver gives the files it\n * imports. They differ only below a symlinked folder (macOS's `/var`).\n */\nfunction cacheNames(path: string): string[] {\n try {\n const real = realpathSync(path)\n return real === path ? [path] : [path, real]\n }\n catch {\n return [path]\n }\n}\n\n/** An extension folder's TypeScript files, `node_modules` and dot-folders left out. */\nfunction compiledFiles(dir: string): string[] {\n const files: string[] = []\n const walk = (folder: string): void => {\n let entries: Dirent[]\n try {\n entries = readdirSync(folder, { withFileTypes: true })\n }\n catch {\n return\n }\n for (const entry of entries) {\n if (entry.name === 'node_modules' || entry.name.startsWith('.'))\n continue\n const path = join(folder, entry.name)\n if (entry.isDirectory())\n walk(path)\n else if (COMPILED_FILE.test(entry.name))\n files.push(path)\n }\n }\n walk(dir)\n return files\n}\n\n/**\n * Compiles an extension folder's TypeScript into the cache, as a load would.\n * Files whose entry is current are only checked. A file that does not compile\n * is skipped (the load reports it).\n *\n * @param dir - The extension folder.\n * @param compileCache - The cache folder.\n * @returns The files checked or compiled.\n */\nexport async function precompileExtension(dir: string, compileCache: string): Promise<number> {\n const { createJiti } = await loadJiti()\n const jiti = createJiti(dir, extensionJitiOptions(compileCache))\n const files = compiledFiles(dir)\n for (const file of files) {\n let source: string\n try {\n source = readFileSync(file, 'utf8')\n }\n catch {\n continue\n }\n for (const filename of cacheNames(file)) {\n try {\n // What a load passes for a module it imports (`async`): the same entry name and content.\n jiti.transform({ filename, source, ts: true, async: true, jsx: jiti.options.jsx })\n }\n catch {\n // Not compilable: the load says why.\n }\n }\n }\n return files.length\n}\n\n/**\n * Drops the entries not rewritten in `maxAgeMs`.\n *\n * @param compileCache - The cache folder.\n * @param maxAgeMs - The age past which an entry goes.\n * @param now - The current time.\n * @returns The entries dropped.\n */\nexport function pruneExtensionCompileCache(compileCache: string, maxAgeMs = COMPILE_CACHE_MAX_AGE_MS, now = Date.now()): number {\n let names: string[]\n try {\n names = readdirSync(compileCache)\n }\n catch {\n return 0\n }\n let dropped = 0\n for (const name of names) {\n const path = join(compileCache, name)\n try {\n if (now - statSync(path).mtimeMs <= maxAgeMs)\n continue\n rmSync(path, { force: true })\n dropped += 1\n }\n catch {\n // Gone meanwhile.\n }\n }\n return dropped\n}\n","/**\n * Internal: race a promise against a timeout. Shared by the discovery\n * loader (module imports) and the registry builder (extension `setup()`).\n * The timer is always cleared so a settled promise doesn't pin the\n * event loop for the full timeout.\n */\nexport function withTimeout<T>(\n promise: Promise<T>,\n timeoutMs: number,\n message: string,\n onTimeout?: () => void,\n): Promise<T> {\n let timer: ReturnType<typeof setTimeout> | undefined\n const timeout = new Promise<never>((_, reject) => {\n timer = setTimeout(() => {\n onTimeout?.()\n reject(new Error(message))\n }, timeoutMs)\n })\n return Promise.race([promise, timeout]).finally(() => {\n if (timer)\n clearTimeout(timer)\n })\n}\n","/**\n * Extension discovery.\n *\n * Walks the standard project + user roots\n * (`{project,user}/.{agents,zidane}/extensions/<name>/`) using the\n * shared {@link projectUserPaths} convention, then dynamic-imports only\n * trusted `<name>/index.{ts,tsx,mjs,js}` files (probed in\n * that preference order — see {@link ENTRY_CANDIDATES}). The first valid\n * module per name wins — project beats user, `.agents/` beats\n * `.<prefix>/` within a single scope (see `projectUserPaths` for the\n * full order).\n *\n * Loading uses native `await import(pathToFileURL(...))` under Bun, which\n * handles `.ts`/`.tsx` and JS variants in `bun run` and in\n * `bun build --compile` binaries; Node hosts load through jiti (see\n * {@link importExtensionEntry}).\n *\n * Before each import the extension directory's module graph is EVICTED\n * from the module cache (`require.cache`: Bun's covers ESM too, jiti's\n * Node graph lives there), so\n * re-running discovery — the `/reload` command, a cwd-change rebuild, an\n * overwrite-install — loads the current on-disk code, deep imports\n * included. Module-level state resets per reload; the teardown contract\n * covers cleanup of the outgoing instance.\n *\n * Failures are isolation-first: a broken module produces a\n * {@link LoadedExtension} with `error` set instead of throwing — one\n * vibe-coded syntax error mustn't keep the TUI from booting.\n */\n\nimport type { LogSink } from '../logger'\nimport type { ExtensionDefinition } from './api/define'\nimport type { ExtensionManifest, LoadedExtension, LoadedExtensionSource } from './types'\nimport { lstatSync, readdirSync, readFileSync, realpathSync } from 'node:fs'\nimport { createRequire } from 'node:module'\nimport { basename, delimiter, dirname, resolve, sep } from 'node:path'\nimport { pathToFileURL } from 'node:url'\nimport { projectUserPaths } from '../chat/project-user-paths'\nimport { createDebugLog } from '../debug-log'\nimport { errorMessage } from '../errors'\nimport { consoleSink, createLogger } from '../logger'\nimport { EXTENSION_API_VERSION } from './api/define'\nimport { extensionJitiOptions, loadJiti } from './compile-cache'\nimport { registerExtensionApiHostModules, resolveExtensionHostModules } from './host-modules'\nimport { checkZidaneVersion } from './host-version'\nimport { NO_DEFINITION_ERROR, runtimeLoadedExtension } from './runtime/loaded-entry'\nimport { looksLikeDefinition } from './runtime/validate-definition'\nimport { isSettingsIcon } from './settings/validate'\nimport { withTimeout } from './with-timeout'\n\n/**\n * Scoped `ZIDANE_DEBUG` logger. A `const` rather than a hoisted function\n * declaration, so it must precede its call sites.\n */\nconst debugLog = createDebugLog('extensions')\n\n// ---------------------------------------------------------------------------\n// Constants\n// ---------------------------------------------------------------------------\n\n/**\n * Entry-point filenames probed inside each `<name>/` directory, in\n * preference order. Bun loads `.ts` / `.tsx` natively; `.mjs` / `.js`\n * are accepted so pre-compiled extensions (or vibe-coded JS-only ones)\n * work too. `index.js` is last because most authors will reach for\n * `.ts` first.\n */\nconst ENTRY_CANDIDATES = ['index.ts', 'index.tsx', 'index.mjs', 'index.js'] as const\n\n/** A discovered (but not yet loaded) extension entry. */\ninterface ExtensionScanEntry {\n /** Folder name — the canonical persisted extension identity. */\n name: string\n /** Absolute path to the extension directory. */\n dir: string\n /** Absolute path to the entry file picked from `ENTRY_CANDIDATES`. */\n entry: string\n /** Manifest read from the extension, when it has a valid one. */\n manifest?: ExtensionManifest\n /** Where the discovery root lives. */\n source: LoadedExtensionSource\n}\n\ninterface ExtensionScanRoot {\n path: string\n source: 'project' | 'user'\n}\n\n/**\n * One extension folder a config entry links in place (a local `source` in\n * `config.json`), scanned ahead of every root. Its scope gates it like a\n * scan root's: a `project` link loads only in a trusted project.\n */\nexport interface LinkedExtensionDir {\n /** Absolute extension folder. */\n readonly dir: string\n /** The config file that links it. */\n readonly source: 'project' | 'user'\n}\n\n// ---------------------------------------------------------------------------\n// Path resolution\n// ---------------------------------------------------------------------------\n\n/**\n * Default scan roots for extension discovery. Mirrors\n * {@link defaultSkillScanPaths} / {@link defaultMcpsConfigPaths}; the\n * subPath is `'extensions'` so each root expands to\n * `<scope>/.<convention>/extensions/`.\n *\n * @param opts - Overrides for the working directory (`cwd`), home directory (`home`) and storage prefix (`prefix`).\n */\nexport function defaultExtensionScanPaths(opts: {\n cwd?: string\n home?: string\n prefix?: string\n} = {}): ExtensionScanRoot[] {\n return projectUserPaths({ subPath: 'extensions', ...opts })\n}\n\n/**\n * Parse a platform-delimited list of additional extension scan roots.\n * Useful for local dogfooding / host-provided packages:\n *\n * ZIDANE_EXTENSION_DIRS=/repo/extensions bun run tui\n *\n * Each path is a scan ROOT whose children are extension dirs/packages\n * (`<root>/<name>/index.ts`), not a single extension directory.\n *\n * @param value - Delimited list of scan roots. Default: `ZIDANE_EXTENSION_DIRS`.\n */\nexport function parseExtensionScanPathEnv(value: string | undefined = process.env.ZIDANE_EXTENSION_DIRS): string[] {\n if (!value)\n return []\n return value.split(delimiter).map(p => p.trim()).filter(Boolean)\n}\n\n/**\n * Walk every scan root, collecting one {@link ExtensionScanEntry} per\n * `<root>/<name>/index.*` hit. First-found per `name` wins (matches the\n * project-user precedence used elsewhere — see `projectUserPaths` JSDoc).\n *\n * Non-existent roots are skipped silently. Stat errors inside a present\n * root are surfaced under `ZIDANE_DEBUG` only — they shouldn't bring\n * boot to a halt.\n *\n * @param opts - Overrides for `cwd`, `home` and `prefix`, extra scan roots in `extensionScanPaths`, and config-linked folders in `linkedExtensionDirs` (scanned first).\n */\nexport function scanExtensionDirectories(opts: {\n cwd?: string\n home?: string\n prefix?: string\n extensionScanPaths?: readonly string[]\n linkedExtensionDirs?: readonly LinkedExtensionDir[]\n} = {}): ExtensionScanEntry[] {\n const seen = new Map<string, ExtensionScanEntry>()\n for (const entry of scanAllExtensionDirectories(opts)) {\n if (!seen.has(entry.name))\n seen.set(entry.name, entry)\n }\n return [...seen.values()]\n}\n\nfunction scanAllExtensionDirectories(opts: {\n cwd?: string\n home?: string\n prefix?: string\n extensionScanPaths?: readonly string[]\n linkedExtensionDirs?: readonly LinkedExtensionDir[]\n} = {}): ExtensionScanEntry[] {\n const roots: ExtensionScanRoot[] = [\n ...(opts.extensionScanPaths ?? []).map(path => ({ path: resolve(path), source: 'user' as const })),\n ...defaultExtensionScanPaths(opts),\n ]\n const entriesOut: ExtensionScanEntry[] = []\n\n // Linked folders were named one by one in a config file: no root containment to check.\n for (const link of opts.linkedExtensionDirs ?? []) {\n const dir = resolve(link.dir)\n const entry = findEntryFile(dir)\n if (entry)\n entriesOut.push({ name: basename(dir), dir, entry, source: link.source, ...readExtensionManifest(dir) })\n }\n\n for (const root of roots) {\n try {\n // The scan root and its parent (`.zidane` / `.agents`) are part of\n // the trust boundary too — a symlinked parent would let every entry\n // resolve outside the configured roots while the per-entry lstat\n // checks below still pass.\n if (lstatSync(dirname(root.path)).isSymbolicLink())\n continue\n if (!lstatSync(root.path).isDirectory())\n continue\n }\n catch {\n continue\n }\n let realRoot: string\n try {\n realRoot = realpathSync(root.path)\n }\n catch (err) {\n debugLog(`realpath ${root.path}`, err)\n continue\n }\n let entries: string[]\n try {\n // readdir order is the filesystem's (sorted on APFS, hash or creation\n // order on ext4 / tmpfs); load order must not depend on it.\n entries = readdirSync(root.path).sort()\n }\n catch (err) {\n debugLog(`readdir ${root.path}`, err)\n continue\n }\n for (const name of entries) {\n if (name.startsWith('.'))\n continue\n const dir = resolve(root.path, name)\n try {\n // Extension roots and entry files are trust boundaries. Do not follow\n // symlinks out of the configured scan roots.\n if (!lstatSync(dir).isDirectory())\n continue\n }\n catch (err) {\n debugLog(`stat ${dir}`, err)\n continue\n }\n const entry = findEntryFile(dir)\n if (!entry)\n continue\n // Containment: the canonical entry file must stay under the\n // canonical scan root. Catches symlinks at any level the lstat\n // checks above didn't cover.\n try {\n const realEntry = realpathSync(entry)\n if (!realEntry.startsWith(realRoot + sep)) {\n debugLog(`skip ${entry}`, new Error(`resolves outside scan root ${realRoot}`))\n continue\n }\n }\n catch (err) {\n debugLog(`realpath ${entry}`, err)\n continue\n }\n entriesOut.push({ name, dir, entry, source: root.source, ...readExtensionManifest(dir) })\n }\n }\n return entriesOut\n}\n\n/**\n * Pick the first existing `index.*` file inside `dir`, or `null` if none.\n * Exported for the installer, which probes fetched trees with the same rule.\n */\nexport function findEntryFile(dir: string): string | null {\n for (const candidate of ENTRY_CANDIDATES) {\n const full = resolve(dir, candidate)\n try {\n if (lstatSync(full).isFile())\n return full\n }\n catch {\n continue\n }\n }\n return null\n}\n\n// ---------------------------------------------------------------------------\n// Loading\n// ---------------------------------------------------------------------------\n\n/**\n * Discover + load every trusted extension reachable from the default\n * scan paths — including ones the user's enable allowlist has toggled\n * OFF. Disabled extensions still import (and later run `setup()`) so\n * their config schema is browsable in Settings before enabling; the\n * allowlist gates their CONTRIBUTIONS at registry level, not their code.\n * The trust boundary stays with `trustProjectExtensions`. Returns one {@link LoadedExtension} per scan entry:\n * skipped entries have no definition, failed entries carry `error`.\n * Loaders never throw — the host can decide what to do with load errors\n * (typically: ship them to the Settings panel).\n *\n * Imports run in parallel: a slow extension can't block the rest. The\n * returned array preserves the original scan order (project-first,\n * then user) so first-found-wins precedence stays intact.\n *\n * `signal` is honored opportunistically — if the abort fires BEFORE\n * we dispatch imports, the whole set is skipped. Once `Promise.all` is\n * in flight, individual imports can't be cancelled (the module system\n * has no abort affordance).\n *\n * Project-scoped extensions execute arbitrary local code, so they're\n * skipped unless `trustProjectExtensions` resolves to `true` — either\n * via the option or the `ZIDANE_TRUST_PROJECT_EXTENSIONS=1` env var\n * fallback. User-scoped extensions always load.\n *\n * Each extension's module graph is evicted from the runtime cache\n * before import, so calling this again (e.g. `/reload`) re-evaluates\n * the current on-disk code — edits, overwrites, and updates apply\n * without a restart.\n *\n * @param opts - Scan overrides (`cwd`, `home`, `prefix`, `extensionScanPaths`), an abort `signal`, `trustProjectExtensions`, `importTimeoutMs` (default 10000) as the per-extension import limit, and the `sink` non-blocking load warnings go to (default: `warn`+ to the console, like `buildExtensionRegistry`).\n */\nexport async function discoverExtensions(opts: {\n cwd?: string\n home?: string\n prefix?: string\n extensionScanPaths?: readonly string[]\n linkedExtensionDirs?: readonly LinkedExtensionDir[]\n signal?: AbortSignal\n trustProjectExtensions?: boolean\n importTimeoutMs?: number\n sink?: LogSink\n /** Node hosts: the folder compiled extension code is kept in (`./compile-cache`). */\n compileCache?: string\n} = {}): Promise<LoadedExtension[]> {\n const entries = selectExtensionEntries(scanAllExtensionDirectories(opts), opts)\n if (opts.signal?.aborted || entries.length === 0)\n return []\n const sink = opts.sink ?? consoleSink({ minLevel: 'warn' })\n return Promise.all(entries.map((entry) => {\n if (!('entry' in entry))\n return Promise.resolve(entry)\n return loadExtensionFromDisk(entry, opts.importTimeoutMs ?? 10_000, sink, opts.compileCache)\n }))\n}\n\n/**\n * The folders {@link discoverExtensions} would import for the same options:\n * a trusted extension's, never an untrusted project's. What a host compiles\n * ahead of a load (`precompileExtension`).\n *\n * @param opts - Scan overrides and `trustProjectExtensions`, as for {@link discoverExtensions}.\n */\nexport function loadableExtensionDirs(opts: {\n cwd?: string\n home?: string\n prefix?: string\n extensionScanPaths?: readonly string[]\n linkedExtensionDirs?: readonly LinkedExtensionDir[]\n trustProjectExtensions?: boolean\n} = {}): string[] {\n return selectExtensionEntries(scanAllExtensionDirectories(opts), opts).flatMap(entry => ('entry' in entry ? [entry.dir] : []))\n}\n\nfunction selectExtensionEntries(\n entries: readonly ExtensionScanEntry[],\n opts: { trustProjectExtensions?: boolean },\n): Array<ExtensionScanEntry | LoadedExtension> {\n // Safe by default: project extensions are untrusted unless the host\n // opts in explicitly or the user sets the env var the error message\n // below points at.\n const trustProjectExtensions = opts.trustProjectExtensions\n ?? (process.env.ZIDANE_TRUST_PROJECT_EXTENSIONS === '1')\n const selected = new Map<string, ExtensionScanEntry | LoadedExtension>()\n const locked = new Set<string>()\n\n for (const entry of entries) {\n if (locked.has(entry.name))\n continue\n if (entry.source === 'project' && !trustProjectExtensions) {\n if (!selected.has(entry.name)) {\n selected.set(entry.name, {\n name: entry.name,\n dir: entry.dir,\n source: entry.source,\n ...(entry.manifest ? { manifest: entry.manifest } : {}),\n error: 'Project extensions are disabled until this project is trusted. Set ZIDANE_TRUST_PROJECT_EXTENSIONS=1 or pass trustProjectExtensions to enable them.',\n })\n }\n continue\n }\n selected.set(entry.name, entry)\n locked.add(entry.name)\n }\n\n return [...selected.values()]\n}\n\nconst requireForCache = createRequire(import.meta.url)\n\n/**\n * Bun only: monotonic import generation, appended as a query so each\n * discovery pass gets a fresh ENTRY module. The query alone is not enough: relative\n * imports resolve to plain file paths and hit the cache, which is why\n * {@link evictModuleGraph} runs first. Both together are what makes\n * `/reload` a true hot-reload (verified empirically: query-only keeps\n * deep imports stale; eviction-only keeps the entry stale).\n */\nlet importGeneration = 0\n\n/**\n * Evict everything under `dir` from the module cache. Under Bun,\n * `require.cache` deletion covers the ES registry for these keys and the\n * entry itself is refreshed by the generation query above; under Node,\n * jiti keeps the whole graph there, entry included, so eviction alone\n * refreshes it. The extension's own `node_modules` are evicted\n * too so a dependency bump applies on update without a restart.\n */\nfunction evictModuleGraph(dir: string): void {\n const cache = requireForCache.cache\n if (!cache)\n return\n // Cache keys are PHYSICAL paths — realpath the dir or the prefix match\n // silently misses through symlinks (macOS `/var` → `/private/var`).\n let physical: string\n try {\n physical = realpathSync(dir)\n }\n catch {\n physical = dir\n }\n for (const root of physical === dir ? [dir] : [dir, physical]) {\n const prefix = root.endsWith(sep) ? root : root + sep\n for (const key of Object.keys(cache)) {\n if (key.startsWith(prefix))\n delete cache[key]\n }\n }\n}\n\n/**\n * Import an extension entry fresh from disk, its relative import graph\n * included. Every import of an extension goes through here (discovery and\n * install validation), so both runtimes get the same reload semantics.\n *\n * Bun: native `import()` — `.ts`/`.tsx`, extensionless relative imports\n * and host modules (`Bun.plugin`) all resolve natively.\n *\n * Node (the Electron GUI): jiti, NOT native `import()`. Node's ESM cache\n * can't be evicted, so a cache-busting query per reload would pin every\n * generation's module graph for the life of the process. jiti evaluates\n * the graph as CJS into `require.cache`, which {@link evictModuleGraph}\n * clears — old generations become collectible once their registry is\n * disposed (asserted by test/extensions/node-reload.test.ts). Stable URLs\n * also keep the cache flat. jiti additionally gives Node full TS/TSX and\n * `./foo` → `foo.ts` resolution, and maps the host's modules\n * (`'zidane'`, …) through `virtualModules` to the LIVE instances.\n * With a `compileCache` folder, compiled files are kept there and only a\n * changed one is compiled again (`./compile-cache`); without one, every\n * load compiles.\n *\n * @param entryPath - The extension's entry file.\n * @param dir - The extension's folder, whose module graph is evicted first.\n * @param options - `compileCache`: Node hosts' compile cache folder.\n * @param options.compileCache - The folder compiled code is kept in.\n */\nexport async function importExtensionEntry(entryPath: string, dir: string, options: { compileCache?: string } = {}): Promise<unknown> {\n // Every import gets the host's zidane, whatever ran before it in this process (an install's check runs\n // where nothing may have loaded extensions yet). Idempotent and lazy.\n registerExtensionApiHostModules()\n evictModuleGraph(dir)\n if (typeof Bun !== 'undefined') {\n importGeneration += 1\n return import(`${pathToFileURL(entryPath).href}?zidane-gen=${importGeneration}`)\n }\n const [{ createJiti }, virtualModules] = await Promise.all([loadJiti(), resolveExtensionHostModules()])\n const jiti = createJiti(entryPath, { ...extensionJitiOptions(options.compileCache), virtualModules })\n return jiti.import(entryPath)\n}\n\n/**\n * Drop an extension directory's modules from the cache without importing\n * again — for a one-off import whose directory is about to move or be\n * deleted (install validation), so nothing stays pinned under that path.\n */\nexport function releaseExtensionModules(dir: string): void {\n evictModuleGraph(dir)\n}\n\n/**\n * Import + validate a single extension entry. Always returns a\n * {@link LoadedExtension} — the load error (if any) lives on the\n * returned object, never as a thrown exception.\n */\nasync function loadExtensionFromDisk(entry: ExtensionScanEntry, timeoutMs: number, sink: LogSink, compileCache?: string): Promise<LoadedExtension> {\n // Before the import: a module written against a newer zidane would fail on\n // a missing export, which says nothing about the actual problem.\n const version = checkZidaneVersion(entry.dir)\n if (version?.level === 'error') {\n return {\n name: entry.name,\n dir: entry.dir,\n source: entry.source,\n ...(entry.manifest ? { manifest: entry.manifest } : {}),\n error: version.message,\n }\n }\n const failed = (error: string): LoadedExtension => ({\n name: entry.name,\n dir: entry.dir,\n source: entry.source,\n ...(entry.manifest ? { manifest: entry.manifest } : {}),\n error,\n })\n const manifestVersion = entry.manifest?.apiVersion\n if (manifestVersion !== undefined && manifestVersion !== EXTENSION_API_VERSION)\n return failed(`Unsupported extension API version \"${manifestVersion}\". This runtime supports apiVersion 1.`)\n if (entry.manifest?.name && entry.manifest.name !== entry.name)\n return failed(`Extension manifest name mismatch: folder is \"${entry.name}\" but manifest declares \"${entry.manifest.name}\".`)\n if (version)\n createLogger(sink, { extension: entry.name }).warn(version.message)\n try {\n const mod = await withTimeout(\n importExtensionEntry(entry.entry, entry.dir, compileCache !== undefined ? { compileCache } : {}),\n timeoutMs,\n `Timed out importing ${entry.entry} after ${timeoutMs}ms. The module's top-level code may still be running; an import can't be cancelled.`,\n )\n const where = { name: entry.name, dir: entry.dir, source: entry.source, ...(entry.manifest ? { manifest: entry.manifest } : {}) }\n const exported = moduleExports(mod)\n const definition = definitionExport(exported)\n if (definition !== undefined)\n return runtimeLoadedExtension(definition, where)\n return failed(`Module at ${entry.entry} does not export an extension definition (expected \\`default\\` or named \\`extension\\` with \\`apiVersion: 1\\`).`)\n }\n catch (err) {\n return {\n name: entry.name,\n dir: entry.dir,\n source: entry.source,\n ...(entry.manifest ? { manifest: entry.manifest } : {}),\n error: `Failed to import ${entry.entry}: ${errorMessage(err)}`,\n }\n }\n}\n\n/**\n * Imports one extension folder fresh from disk, as discovery would (version\n * check, manifest, module graph evicted first). Never rejects: a folder with\n * no entry file or a module that fails to import comes back with `error`.\n * The caller decides whether the folder may load at all (trust, precedence):\n * {@link loadableExtensionDirs} answers that.\n *\n * @param dir - The extension folder.\n * @param opts - Its source, the import bound (default 10 s), the warning sink and Node's compile cache.\n * @param opts.source - Where the folder was found.\n * @param opts.importTimeoutMs - How long the import may take.\n * @param opts.sink - Where load warnings go. Default: warnings to stderr.\n * @param opts.compileCache - Node hosts: the folder compiled code is kept in.\n * @returns The loaded entry, or one carrying the error.\n */\nexport async function loadExtensionFolder(dir: string, opts: { source: LoadedExtensionSource, importTimeoutMs?: number, sink?: LogSink, compileCache?: string }): Promise<LoadedExtension> {\n const name = basename(dir)\n const entry = findEntryFile(dir)\n const manifest = readExtensionManifest(dir)\n if (!entry)\n return { name, dir, source: opts.source, ...manifest, error: `No entry file (${ENTRY_CANDIDATES.join(', ')}) in ${dir}.` }\n return loadExtensionFromDisk({ name, dir, entry, source: opts.source, ...manifest }, opts.importTimeoutMs ?? 10_000, opts.sink ?? consoleSink({ minLevel: 'warn' }), opts.compileCache)\n}\n\n/**\n * The export the runtime validates: one claiming `apiVersion: 1`, else the\n * first object (its validation then says what is missing).\n *\n * @param exported - A module's `default` and `extension` exports.\n * @returns The export, or `undefined` when none is an object.\n */\nexport function definitionExport(exported: readonly unknown[]): unknown {\n return exported.find(looksLikeDefinition) ?? exported.find(value => !!value && typeof value === 'object')\n}\n\n/** The `default` and `extension` exports of a module, in that order of preference. */\nfunction moduleExports(mod: unknown): unknown[] {\n if (!mod || typeof mod !== 'object')\n return []\n const m = mod as Record<string, unknown>\n return [m.default, m.extension].filter(value => value !== undefined)\n}\n\n/**\n * Tag an inline (host-passed) extension into the same shape disk-\n * loaded ones produce, so host-bundled extensions (e.g. those passed\n * via `RunTuiOptions.extensions`) flow through `buildExtensionRegistry`\n * identically to disk-discovered ones. The runtime validates the\n * definition and lists it inactive with what is wrong.\n *\n * @param definition - Extension definition the host built in code.\n */\nexport function inlineLoadedExtension(definition: Pick<ExtensionDefinition, 'apiVersion'> | object): LoadedExtension {\n if (definition && typeof definition === 'object')\n return runtimeLoadedExtension(definition, { source: 'inline' })\n return { name: 'unknown', source: 'inline', error: NO_DEFINITION_ERROR }\n}\n\n/**\n * Read `extension.json` (or `package.json#zidane`) as a shape-validated\n * manifest. Exported for the installer so \"what counts as a manifest\" has\n * exactly one definition — a malformed manifest is ignored identically at\n * install-validation time and at discovery time.\n */\nexport function readExtensionManifest(dir: string): { manifest?: ExtensionManifest } {\n const fromExtensionJson = readJson(resolve(dir, 'extension.json'))\n if (isExtensionManifest(fromExtensionJson))\n return { manifest: fromExtensionJson }\n const pkg = readJson(resolve(dir, 'package.json'))\n if (pkg && typeof pkg === 'object' && !Array.isArray(pkg)) {\n const manifest = (pkg as { zidane?: unknown }).zidane\n if (isExtensionManifest(manifest))\n return { manifest }\n }\n return {}\n}\n\nfunction readJson(path: string): unknown {\n try {\n return JSON.parse(readFileSync(path, 'utf8')) as unknown\n }\n catch {\n return null\n }\n}\n\nfunction isExtensionManifest(value: unknown): value is ExtensionManifest {\n if (!value || typeof value !== 'object' || Array.isArray(value))\n return false\n const v = value as Record<string, unknown>\n // `apiVersion`, when present, must be a number. We still recognize an\n // unsupported version (e.g. 1) as a manifest so the loader can surface a\n // clear \"unsupported API version\" error rather than silently ignoring it —\n // but the rest of the shape is still validated.\n if (v.apiVersion !== undefined && typeof v.apiVersion !== 'number')\n return false\n return (v.name === undefined || typeof v.name === 'string')\n && (v.displayName === undefined || typeof v.displayName === 'string')\n && (v.description === undefined || typeof v.description === 'string')\n && (v.icon === undefined || isSettingsIcon(v.icon))\n}\n\n// ---------------------------------------------------------------------------\n// Internals\n// ---------------------------------------------------------------------------\n\n/** Re-export for tests / advanced hosts that want to log the scan results before loading. */\nexport type { ExtensionScanEntry }\n/** Re-export so callers can read the canonical entry file list. */\nexport { ENTRY_CANDIDATES }\n"],"mappings":";;;;;;;;;;;;;;;AASA,MAAa,wBAAwB;;;;;;;AAoDrC,SAAgB,gBAA2D,YAA4D;CACrI,OAAO;AACT;;;;ACxCA,MAAa,2BAA2B;;AAGxC,MAAM,gBAAgB;;;;;AAMtB,eAAsB,WAA2C;CAE/D,OAAO,OAAO;AAChB;;;;;;;AAQA,SAAgB,qBAAqB,cAA+C;CAClF,OAAO;EAAE,aAAa;EAAM,SAAS,gBAAgB;EAAO,gBAAgB;CAAM;AACpF;;;;;;AAOA,SAAS,WAAW,MAAwB;CAC1C,IAAI;EACF,MAAM,OAAO,aAAa,IAAI;EAC9B,OAAO,SAAS,OAAO,CAAC,IAAI,IAAI,CAAC,MAAM,IAAI;CAC7C,QACM;EACJ,OAAO,CAAC,IAAI;CACd;AACF;;AAGA,SAAS,cAAc,KAAuB;CAC5C,MAAM,QAAkB,CAAC;CACzB,MAAM,QAAQ,WAA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C;CACnF,MAAM,oBAAoB,SAAS,QAAQ,KAAK,gBAAgB,CAAC;CACjE,IAAI,oBAAoB,iBAAiB,GACvC,OAAO,EAAE,UAAU,kBAAkB;CACvC,MAAM,MAAM,SAAS,QAAQ,KAAK,cAAc,CAAC;CACjD,IAAI,OAAO,OAAO,QAAQ,YAAY,CAAC,MAAM,QAAQ,GAAG,GAAG;EACzD,MAAM,WAAY,IAA6B;EAC/C,IAAI,oBAAoB,QAAQ,GAC9B,OAAO,EAAE,SAAS;CACtB;CACA,OAAO,CAAC;AACV;AAEA,SAAS,SAAS,MAAuB;CACvC,IAAI;EACF,OAAO,KAAK,MAAM,aAAa,MAAM,MAAM,CAAC;CAC9C,QACM;EACJ,OAAO;CACT;AACF;AAEA,SAAS,oBAAoB,OAA4C;CACvE,IAAI,CAAC,SAAS,OAAO,UAAU,YAAY,MAAM,QAAQ,KAAK,GAC5D,OAAO;CACT,MAAM,IAAI;CAKV,IAAI,EAAE,eAAe,KAAA,KAAa,OAAO,EAAE,eAAe,UACxD,OAAO;CACT,QAAQ,EAAE,SAAS,KAAA,KAAa,OAAO,EAAE,SAAS,cAC5C,EAAE,gBAAgB,KAAA,KAAa,OAAO,EAAE,gBAAgB,cACxD,EAAE,gBAAgB,KAAA,KAAa,OAAO,EAAE,gBAAgB,cACxD,EAAE,SAAS,KAAA,KAAa,eAAe,EAAE,IAAI;AACrD"}
|
|
1
|
+
{"version":3,"file":"discovery-CC6Uhvm8.js","names":[],"sources":["../src/extensions/api/define.ts","../src/extensions/compile-cache.ts","../src/extensions/with-timeout.ts","../src/extensions/discovery.ts"],"sourcesContent":["/**\n * Extension API: the definition an extension module exports.\n */\n\nimport type { ExtensionContext } from './context'\nimport type { Cleanup } from './core'\nimport type { SettingsSchema } from './settings'\n\n/** The API version this runtime supports. */\nexport const EXTENSION_API_VERSION = 1\n\n/**\n * An extension. Export it as the module's default export, either through\n * `defineExtension` or as a plain object (no import needed).\n *\n * @typeParam S - The settings schema, so `ctx.settings.get` is typed.\n */\nexport interface ExtensionDefinition<S extends SettingsSchema = SettingsSchema> {\n /** Must be `1`. */\n apiVersion: 1\n /** Lowercase id, words joined by `-`. Equals the folder name for discovered extensions. Prefixes every id the extension contributes. */\n id: string\n /** Name shown in Settings. Defaults to `id`. */\n displayName?: string\n /**\n * The extension's icon in each app's vocabulary: `gui` an icon class for\n * the desktop and web apps (a Phosphor class such as `'i-ph-git-branch'`),\n * `tui` a short glyph for the terminal app. The settings sidebar draws it\n * on the extension's entry. Absent: a letter badge of the display name.\n */\n icon?: { gui?: string, tui?: string }\n /** Semver of the extension. */\n version?: string\n /** One line shown in Settings. */\n description?: string\n /**\n * Other extensions this one builds on: `{ id: semver range }`. Sets the load\n * order and gives install hints. A missing dependency never fails a load;\n * `ctx.use` reports it as inactive.\n */\n dependencies?: Readonly<Record<string, string>>\n /** Settings the extension reads. Shown in Settings even when the extension is off. */\n settings?: S\n /** Entry exporting React components for the desktop and web apps. Default `ui.tsx` when present. */\n ui?: string\n /** Entry exporting OpenTUI React components for the terminal app. Default `tui.tsx` when present. */\n tui?: string\n /**\n * Runs once per load. Register what the extension adds. May return a\n * cleanup that runs when the extension unloads. Registrations made later\n * (after an await, from a handler) work until the extension unloads.\n */\n setup: (ctx: ExtensionContext<S>) => void | Cleanup | Promise<void | Cleanup>\n}\n\n/**\n * Returns `definition` unchanged. It anchors type inference for `ctx`.\n *\n * @param definition - The extension.\n * @returns The same `definition`.\n */\nexport function defineExtension<S extends SettingsSchema = SettingsSchema>(definition: ExtensionDefinition<S>): ExtensionDefinition<S> {\n return definition\n}\n","/**\n * Compiled extension code kept on disk, for Node hosts (the desktop app):\n * they load extensions through jiti, which compiles each TypeScript file\n * with Babel on the calling thread, tens of ms per file, on every load. Bun\n * hosts import natively and never use it.\n *\n * jiti's own file cache does the keeping: one entry per source path (an edit\n * rewrites it), valid only while it ends with the hash of the source it was\n * compiled from, so a changed file is compiled again, never served stale. A\n * load and {@link precompileExtension} write the same entries (the same\n * options, {@link extensionJitiOptions}), so a host can compile on another\n * thread ahead of a load, and the load only reads.\n *\n * Entries are written for files that change; an entry not rewritten in\n * {@link COMPILE_CACHE_MAX_AGE_MS} goes ({@link pruneExtensionCompileCache}),\n * and a file still in use compiles once more.\n */\nimport type { JitiOptions } from 'jiti'\nimport type { Dirent } from 'node:fs'\nimport { readdirSync, readFileSync, realpathSync, rmSync, statSync } from 'node:fs'\nimport { join } from 'node:path'\n\n/** How old an entry may grow without being rewritten before {@link pruneExtensionCompileCache} drops it. */\nexport const COMPILE_CACHE_MAX_AGE_MS = 30 * 24 * 60 * 60 * 1000\n\n/** Files jiti always compiles: TypeScript. */\nconst COMPILED_FILE = /\\.[cm]?tsx?$/\n\n/**\n * jiti, imported by a name the Bun binary's bundler leaves alone: a Node host\n * resolves it from zidane's dependencies, the Bun binary never runs it.\n */\nexport async function loadJiti(): Promise<typeof import('jiti')> {\n const specifier = 'jiti'\n return import(specifier) as Promise<typeof import('jiti')>\n}\n\n/**\n * The jiti options every extension load and precompile share: the cache\n * entries' names depend on them, so both must use exactly these.\n *\n * @param compileCache - The cache folder; none: nothing is kept.\n */\nexport function extensionJitiOptions(compileCache: string | undefined): JitiOptions {\n return { moduleCache: true, fsCache: compileCache ?? false, interopDefault: false }\n}\n\n/**\n * The names jiti keeps a file under: the path a load is given (the entry, by\n * the scanned folder), and the real path Node's resolver gives the files it\n * imports. They differ only below a symlinked folder (macOS's `/var`).\n */\nfunction cacheNames(path: string): string[] {\n try {\n const real = realpathSync(path)\n return real === path ? [path] : [path, real]\n }\n catch {\n return [path]\n }\n}\n\n/** An extension folder's TypeScript files, `node_modules` and dot-folders left out. */\nfunction compiledFiles(dir: string): string[] {\n const files: string[] = []\n const walk = (folder: string): void => {\n let entries: Dirent[]\n try {\n entries = readdirSync(folder, { withFileTypes: true })\n }\n catch {\n return\n }\n for (const entry of entries) {\n if (entry.name === 'node_modules' || entry.name.startsWith('.'))\n continue\n const path = join(folder, entry.name)\n if (entry.isDirectory())\n walk(path)\n else if (COMPILED_FILE.test(entry.name))\n files.push(path)\n }\n }\n walk(dir)\n return files\n}\n\n/**\n * Compiles an extension folder's TypeScript into the cache, as a load would.\n * Files whose entry is current are only checked. A file that does not compile\n * is skipped (the load reports it).\n *\n * @param dir - The extension folder.\n * @param compileCache - The cache folder.\n * @returns The files checked or compiled.\n */\nexport async function precompileExtension(dir: string, compileCache: string): Promise<number> {\n const { createJiti } = await loadJiti()\n const jiti = createJiti(dir, extensionJitiOptions(compileCache))\n const files = compiledFiles(dir)\n for (const file of files) {\n let source: string\n try {\n source = readFileSync(file, 'utf8')\n }\n catch {\n continue\n }\n for (const filename of cacheNames(file)) {\n try {\n // What a load passes for a module it imports (`async`): the same entry name and content.\n jiti.transform({ filename, source, ts: true, async: true, jsx: jiti.options.jsx })\n }\n catch {\n // Not compilable: the load says why.\n }\n }\n }\n return files.length\n}\n\n/**\n * Drops the entries not rewritten in `maxAgeMs`.\n *\n * @param compileCache - The cache folder.\n * @param maxAgeMs - The age past which an entry goes.\n * @param now - The current time.\n * @returns The entries dropped.\n */\nexport function pruneExtensionCompileCache(compileCache: string, maxAgeMs = COMPILE_CACHE_MAX_AGE_MS, now = Date.now()): number {\n let names: string[]\n try {\n names = readdirSync(compileCache)\n }\n catch {\n return 0\n }\n let dropped = 0\n for (const name of names) {\n const path = join(compileCache, name)\n try {\n if (now - statSync(path).mtimeMs <= maxAgeMs)\n continue\n rmSync(path, { force: true })\n dropped += 1\n }\n catch {\n // Gone meanwhile.\n }\n }\n return dropped\n}\n","/**\n * Internal: race a promise against a timeout. Shared by the discovery\n * loader (module imports) and the registry builder (extension `setup()`).\n * The timer is always cleared so a settled promise doesn't pin the\n * event loop for the full timeout.\n */\nexport function withTimeout<T>(\n promise: Promise<T>,\n timeoutMs: number,\n message: string,\n onTimeout?: () => void,\n): Promise<T> {\n let timer: ReturnType<typeof setTimeout> | undefined\n const timeout = new Promise<never>((_, reject) => {\n timer = setTimeout(() => {\n onTimeout?.()\n reject(new Error(message))\n }, timeoutMs)\n })\n return Promise.race([promise, timeout]).finally(() => {\n if (timer)\n clearTimeout(timer)\n })\n}\n","/**\n * Extension discovery.\n *\n * Walks the standard project + user roots\n * (`{project,user}/.{agents,zidane}/extensions/<name>/`) using the\n * shared {@link projectUserPaths} convention, then dynamic-imports only\n * trusted `<name>/index.{ts,tsx,mjs,js}` files (probed in\n * that preference order — see {@link ENTRY_CANDIDATES}). The first valid\n * module per name wins — project beats user, `.agents/` beats\n * `.<prefix>/` within a single scope (see `projectUserPaths` for the\n * full order).\n *\n * Loading uses native `await import(pathToFileURL(...))` under Bun, which\n * handles `.ts`/`.tsx` and JS variants in `bun run` and in\n * `bun build --compile` binaries; Node hosts load through jiti (see\n * {@link importExtensionEntry}).\n *\n * Before each import the extension directory's module graph is EVICTED\n * from the module cache (`require.cache`: Bun's covers ESM too, jiti's\n * Node graph lives there), so\n * re-running discovery — the `/reload` command, a cwd-change rebuild, an\n * overwrite-install — loads the current on-disk code, deep imports\n * included. Module-level state resets per reload; the teardown contract\n * covers cleanup of the outgoing instance.\n *\n * Failures are isolation-first: a broken module produces a\n * {@link LoadedExtension} with `error` set instead of throwing — one\n * vibe-coded syntax error mustn't keep the TUI from booting.\n */\n\nimport type { LogSink } from '../logger'\nimport type { ExtensionDefinition } from './api/define'\nimport type { ExtensionManifest, LoadedExtension, LoadedExtensionSource } from './types'\nimport { lstatSync, readdirSync, readFileSync, realpathSync } from 'node:fs'\nimport { createRequire } from 'node:module'\nimport { basename, delimiter, dirname, resolve, sep } from 'node:path'\nimport { pathToFileURL } from 'node:url'\nimport { projectUserPaths } from '../chat/project-user-paths'\nimport { createDebugLog } from '../debug-log'\nimport { errorMessage } from '../errors'\nimport { consoleSink, createLogger } from '../logger'\nimport { EXTENSION_API_VERSION } from './api/define'\nimport { extensionJitiOptions, loadJiti } from './compile-cache'\nimport { registerExtensionApiHostModules, resolveExtensionHostModules } from './host-modules'\nimport { checkZidaneVersion } from './host-version'\nimport { NO_DEFINITION_ERROR, runtimeLoadedExtension } from './runtime/loaded-entry'\nimport { looksLikeDefinition } from './runtime/validate-definition'\nimport { isSettingsIcon } from './settings/validate'\nimport { withTimeout } from './with-timeout'\n\n/**\n * Scoped `ZIDANE_DEBUG` logger. A `const` rather than a hoisted function\n * declaration, so it must precede its call sites.\n */\nconst debugLog = createDebugLog('extensions')\n\n// ---------------------------------------------------------------------------\n// Constants\n// ---------------------------------------------------------------------------\n\n/**\n * Entry-point filenames probed inside each `<name>/` directory, in\n * preference order. Bun loads `.ts` / `.tsx` natively; `.mjs` / `.js`\n * are accepted so pre-compiled extensions (or vibe-coded JS-only ones)\n * work too. `index.js` is last because most authors will reach for\n * `.ts` first.\n */\nconst ENTRY_CANDIDATES = ['index.ts', 'index.tsx', 'index.mjs', 'index.js'] as const\n\n/** A discovered (but not yet loaded) extension entry. */\ninterface ExtensionScanEntry {\n /** Folder name — the canonical persisted extension identity. */\n name: string\n /** Absolute path to the extension directory. */\n dir: string\n /** Absolute path to the entry file picked from `ENTRY_CANDIDATES`. */\n entry: string\n /** Manifest read from the extension, when it has a valid one. */\n manifest?: ExtensionManifest\n /** Where the discovery root lives. */\n source: LoadedExtensionSource\n}\n\ninterface ExtensionScanRoot {\n path: string\n source: 'project' | 'user'\n}\n\n/**\n * One extension folder a config entry links in place (a local `source` in\n * `config.json`), scanned ahead of every root. Its scope gates it like a\n * scan root's: a `project` link loads only in a trusted project.\n */\nexport interface LinkedExtensionDir {\n /** Absolute extension folder. */\n readonly dir: string\n /** The config file that links it. */\n readonly source: 'project' | 'user'\n}\n\n// ---------------------------------------------------------------------------\n// Path resolution\n// ---------------------------------------------------------------------------\n\n/**\n * Default scan roots for extension discovery. Mirrors\n * {@link defaultSkillScanPaths} / {@link defaultMcpsConfigPaths}; the\n * subPath is `'extensions'` so each root expands to\n * `<scope>/.<convention>/extensions/`.\n *\n * @param opts - Overrides for the working directory (`cwd`), home directory (`home`) and storage prefix (`prefix`).\n */\nexport function defaultExtensionScanPaths(opts: {\n cwd?: string\n home?: string\n prefix?: string\n} = {}): ExtensionScanRoot[] {\n return projectUserPaths({ subPath: 'extensions', ...opts })\n}\n\n/**\n * Parse a platform-delimited list of additional extension scan roots.\n * Useful for local dogfooding / host-provided packages:\n *\n * ZIDANE_EXTENSION_DIRS=/repo/extensions bun run tui\n *\n * Each path is a scan ROOT whose children are extension dirs/packages\n * (`<root>/<name>/index.ts`), not a single extension directory.\n *\n * @param value - Delimited list of scan roots. Default: `ZIDANE_EXTENSION_DIRS`.\n */\nexport function parseExtensionScanPathEnv(value: string | undefined = process.env.ZIDANE_EXTENSION_DIRS): string[] {\n if (!value)\n return []\n return value.split(delimiter).map(p => p.trim()).filter(Boolean)\n}\n\n/**\n * Walk every scan root, collecting one {@link ExtensionScanEntry} per\n * `<root>/<name>/index.*` hit. First-found per `name` wins (matches the\n * project-user precedence used elsewhere — see `projectUserPaths` JSDoc).\n *\n * Non-existent roots are skipped silently. Stat errors inside a present\n * root are surfaced under `ZIDANE_DEBUG` only — they shouldn't bring\n * boot to a halt.\n *\n * @param opts - Overrides for `cwd`, `home` and `prefix`, extra scan roots in `extensionScanPaths`, and config-linked folders in `linkedExtensionDirs` (scanned first).\n */\nexport function scanExtensionDirectories(opts: {\n cwd?: string\n home?: string\n prefix?: string\n extensionScanPaths?: readonly string[]\n linkedExtensionDirs?: readonly LinkedExtensionDir[]\n} = {}): ExtensionScanEntry[] {\n const seen = new Map<string, ExtensionScanEntry>()\n for (const entry of scanAllExtensionDirectories(opts)) {\n if (!seen.has(entry.name))\n seen.set(entry.name, entry)\n }\n return [...seen.values()]\n}\n\nfunction scanAllExtensionDirectories(opts: {\n cwd?: string\n home?: string\n prefix?: string\n extensionScanPaths?: readonly string[]\n linkedExtensionDirs?: readonly LinkedExtensionDir[]\n} = {}): ExtensionScanEntry[] {\n const roots: ExtensionScanRoot[] = [\n ...(opts.extensionScanPaths ?? []).map(path => ({ path: resolve(path), source: 'user' as const })),\n ...defaultExtensionScanPaths(opts),\n ]\n const entriesOut: ExtensionScanEntry[] = []\n\n // Linked folders were named one by one in a config file: no root containment to check.\n for (const link of opts.linkedExtensionDirs ?? []) {\n const dir = resolve(link.dir)\n const entry = findEntryFile(dir)\n if (entry)\n entriesOut.push({ name: basename(dir), dir, entry, source: link.source, ...readExtensionManifest(dir) })\n }\n\n for (const root of roots) {\n try {\n // The scan root and its parent (`.zidane` / `.agents`) are part of\n // the trust boundary too — a symlinked parent would let every entry\n // resolve outside the configured roots while the per-entry lstat\n // checks below still pass.\n if (lstatSync(dirname(root.path)).isSymbolicLink())\n continue\n if (!lstatSync(root.path).isDirectory())\n continue\n }\n catch {\n continue\n }\n let realRoot: string\n try {\n realRoot = realpathSync(root.path)\n }\n catch (err) {\n debugLog(`realpath ${root.path}`, err)\n continue\n }\n let entries: string[]\n try {\n // readdir order is the filesystem's (sorted on APFS, hash or creation\n // order on ext4 / tmpfs); load order must not depend on it.\n entries = readdirSync(root.path).sort()\n }\n catch (err) {\n debugLog(`readdir ${root.path}`, err)\n continue\n }\n for (const name of entries) {\n if (name.startsWith('.'))\n continue\n const dir = resolve(root.path, name)\n try {\n // Extension roots and entry files are trust boundaries. Do not follow\n // symlinks out of the configured scan roots.\n if (!lstatSync(dir).isDirectory())\n continue\n }\n catch (err) {\n debugLog(`stat ${dir}`, err)\n continue\n }\n const entry = findEntryFile(dir)\n if (!entry)\n continue\n // Containment: the canonical entry file must stay under the\n // canonical scan root. Catches symlinks at any level the lstat\n // checks above didn't cover.\n try {\n const realEntry = realpathSync(entry)\n if (!realEntry.startsWith(realRoot + sep)) {\n debugLog(`skip ${entry}`, new Error(`resolves outside scan root ${realRoot}`))\n continue\n }\n }\n catch (err) {\n debugLog(`realpath ${entry}`, err)\n continue\n }\n entriesOut.push({ name, dir, entry, source: root.source, ...readExtensionManifest(dir) })\n }\n }\n return entriesOut\n}\n\n/**\n * Pick the first existing `index.*` file inside `dir`, or `null` if none.\n * Exported for the installer, which probes fetched trees with the same rule.\n */\nexport function findEntryFile(dir: string): string | null {\n for (const candidate of ENTRY_CANDIDATES) {\n const full = resolve(dir, candidate)\n try {\n if (lstatSync(full).isFile())\n return full\n }\n catch {\n continue\n }\n }\n return null\n}\n\n// ---------------------------------------------------------------------------\n// Loading\n// ---------------------------------------------------------------------------\n\n/**\n * Discover + load every trusted extension reachable from the default\n * scan paths — including ones the user's enable allowlist has toggled\n * OFF. Disabled extensions still import (and later run `setup()`) so\n * their config schema is browsable in Settings before enabling; the\n * allowlist gates their CONTRIBUTIONS at registry level, not their code.\n * The trust boundary stays with `trustProjectExtensions`. Returns one {@link LoadedExtension} per scan entry:\n * skipped entries have no definition, failed entries carry `error`.\n * Loaders never throw — the host can decide what to do with load errors\n * (typically: ship them to the Settings panel).\n *\n * Imports run in parallel: a slow extension can't block the rest. The\n * returned array preserves the original scan order (project-first,\n * then user) so first-found-wins precedence stays intact.\n *\n * `signal` is honored opportunistically — if the abort fires BEFORE\n * we dispatch imports, the whole set is skipped. Once `Promise.all` is\n * in flight, individual imports can't be cancelled (the module system\n * has no abort affordance).\n *\n * Project-scoped extensions execute arbitrary local code, so they're\n * skipped unless `trustProjectExtensions` resolves to `true` — either\n * via the option or the `ZIDANE_TRUST_PROJECT_EXTENSIONS=1` env var\n * fallback. User-scoped extensions always load.\n *\n * Each extension's module graph is evicted from the runtime cache\n * before import, so calling this again (e.g. `/reload`) re-evaluates\n * the current on-disk code — edits, overwrites, and updates apply\n * without a restart.\n *\n * @param opts - Scan overrides (`cwd`, `home`, `prefix`, `extensionScanPaths`), an abort `signal`, `trustProjectExtensions`, `importTimeoutMs` (default 10000) as the per-extension import limit, and the `sink` non-blocking load warnings go to (default: `warn`+ to the console, like `buildExtensionRegistry`).\n */\nexport async function discoverExtensions(opts: {\n cwd?: string\n home?: string\n prefix?: string\n extensionScanPaths?: readonly string[]\n linkedExtensionDirs?: readonly LinkedExtensionDir[]\n signal?: AbortSignal\n trustProjectExtensions?: boolean\n importTimeoutMs?: number\n sink?: LogSink\n /** Node hosts: the folder compiled extension code is kept in (`./compile-cache`). */\n compileCache?: string\n} = {}): Promise<LoadedExtension[]> {\n const entries = selectExtensionEntries(scanAllExtensionDirectories(opts), opts)\n if (opts.signal?.aborted || entries.length === 0)\n return []\n const sink = opts.sink ?? consoleSink({ minLevel: 'warn' })\n return Promise.all(entries.map((entry) => {\n if (!('entry' in entry))\n return Promise.resolve(entry)\n return loadExtensionFromDisk(entry, opts.importTimeoutMs ?? 10_000, sink, opts.compileCache)\n }))\n}\n\n/**\n * The folders {@link discoverExtensions} would import for the same options:\n * a trusted extension's, never an untrusted project's. What a host compiles\n * ahead of a load (`precompileExtension`).\n *\n * @param opts - Scan overrides and `trustProjectExtensions`, as for {@link discoverExtensions}.\n */\nexport function loadableExtensionDirs(opts: {\n cwd?: string\n home?: string\n prefix?: string\n extensionScanPaths?: readonly string[]\n linkedExtensionDirs?: readonly LinkedExtensionDir[]\n trustProjectExtensions?: boolean\n} = {}): string[] {\n return selectExtensionEntries(scanAllExtensionDirectories(opts), opts).flatMap(entry => ('entry' in entry ? [entry.dir] : []))\n}\n\nfunction selectExtensionEntries(\n entries: readonly ExtensionScanEntry[],\n opts: { trustProjectExtensions?: boolean },\n): Array<ExtensionScanEntry | LoadedExtension> {\n // Safe by default: project extensions are untrusted unless the host\n // opts in explicitly or the user sets the env var the error message\n // below points at.\n const trustProjectExtensions = opts.trustProjectExtensions\n ?? (process.env.ZIDANE_TRUST_PROJECT_EXTENSIONS === '1')\n const selected = new Map<string, ExtensionScanEntry | LoadedExtension>()\n const locked = new Set<string>()\n\n for (const entry of entries) {\n if (locked.has(entry.name))\n continue\n if (entry.source === 'project' && !trustProjectExtensions) {\n if (!selected.has(entry.name)) {\n selected.set(entry.name, {\n name: entry.name,\n dir: entry.dir,\n source: entry.source,\n ...(entry.manifest ? { manifest: entry.manifest } : {}),\n error: 'Project extensions are disabled until this project is trusted. Set ZIDANE_TRUST_PROJECT_EXTENSIONS=1 or pass trustProjectExtensions to enable them.',\n })\n }\n continue\n }\n selected.set(entry.name, entry)\n locked.add(entry.name)\n }\n\n return [...selected.values()]\n}\n\nconst requireForCache = createRequire(import.meta.url)\n\n/**\n * Bun only: monotonic import generation, appended as a query so each\n * discovery pass gets a fresh ENTRY module. The query alone is not enough: relative\n * imports resolve to plain file paths and hit the cache, which is why\n * {@link evictModuleGraph} runs first. Both together are what makes\n * `/reload` a true hot-reload (verified empirically: query-only keeps\n * deep imports stale; eviction-only keeps the entry stale).\n */\nlet importGeneration = 0\n\n/**\n * Evict everything under `dir` from the module cache. Under Bun,\n * `require.cache` deletion covers the ES registry for these keys and the\n * entry itself is refreshed by the generation query above; under Node,\n * jiti keeps the whole graph there, entry included, so eviction alone\n * refreshes it. The extension's own `node_modules` are evicted\n * too so a dependency bump applies on update without a restart.\n */\nfunction evictModuleGraph(dir: string): void {\n const cache = requireForCache.cache\n if (!cache)\n return\n // Cache keys are PHYSICAL paths — realpath the dir or the prefix match\n // silently misses through symlinks (macOS `/var` → `/private/var`).\n let physical: string\n try {\n physical = realpathSync(dir)\n }\n catch {\n physical = dir\n }\n for (const root of physical === dir ? [dir] : [dir, physical]) {\n const prefix = root.endsWith(sep) ? root : root + sep\n for (const key of Object.keys(cache)) {\n if (key.startsWith(prefix))\n delete cache[key]\n }\n }\n}\n\n/**\n * Import an extension entry fresh from disk, its relative import graph\n * included. Every import of an extension goes through here (discovery and\n * install validation), so both runtimes get the same reload semantics.\n *\n * Bun: native `import()` — `.ts`/`.tsx`, extensionless relative imports\n * and host modules (`Bun.plugin`) all resolve natively.\n *\n * Node (the Electron GUI): jiti, NOT native `import()`. Node's ESM cache\n * can't be evicted, so a cache-busting query per reload would pin every\n * generation's module graph for the life of the process. jiti evaluates\n * the graph as CJS into `require.cache`, which {@link evictModuleGraph}\n * clears — old generations become collectible once their registry is\n * disposed (asserted by test/extensions/node-reload.test.ts). Stable URLs\n * also keep the cache flat. jiti additionally gives Node full TS/TSX and\n * `./foo` → `foo.ts` resolution, and maps the host's modules\n * (`'zidane'`, …) through `virtualModules` to the LIVE instances.\n * With a `compileCache` folder, compiled files are kept there and only a\n * changed one is compiled again (`./compile-cache`); without one, every\n * load compiles.\n *\n * @param entryPath - The extension's entry file.\n * @param dir - The extension's folder, whose module graph is evicted first.\n * @param options - `compileCache`: Node hosts' compile cache folder.\n * @param options.compileCache - The folder compiled code is kept in.\n */\nexport async function importExtensionEntry(entryPath: string, dir: string, options: { compileCache?: string } = {}): Promise<unknown> {\n // Every import gets the host's zidane, whatever ran before it in this process (an install's check runs\n // where nothing may have loaded extensions yet). Idempotent and lazy.\n registerExtensionApiHostModules()\n evictModuleGraph(dir)\n if (typeof Bun !== 'undefined') {\n importGeneration += 1\n return import(`${pathToFileURL(entryPath).href}?zidane-gen=${importGeneration}`)\n }\n const [{ createJiti }, virtualModules] = await Promise.all([loadJiti(), resolveExtensionHostModules()])\n const jiti = createJiti(entryPath, { ...extensionJitiOptions(options.compileCache), virtualModules })\n return jiti.import(entryPath)\n}\n\n/**\n * Drop an extension directory's modules from the cache without importing\n * again — for a one-off import whose directory is about to move or be\n * deleted (install validation), so nothing stays pinned under that path.\n */\nexport function releaseExtensionModules(dir: string): void {\n evictModuleGraph(dir)\n}\n\n/**\n * Import + validate a single extension entry. Always returns a\n * {@link LoadedExtension} — the load error (if any) lives on the\n * returned object, never as a thrown exception.\n */\nasync function loadExtensionFromDisk(entry: ExtensionScanEntry, timeoutMs: number, sink: LogSink, compileCache?: string): Promise<LoadedExtension> {\n // Before the import: a module written against a newer zidane would fail on\n // a missing export, which says nothing about the actual problem.\n const version = checkZidaneVersion(entry.dir)\n if (version?.level === 'error') {\n return {\n name: entry.name,\n dir: entry.dir,\n source: entry.source,\n ...(entry.manifest ? { manifest: entry.manifest } : {}),\n error: version.message,\n }\n }\n const failed = (error: string): LoadedExtension => ({\n name: entry.name,\n dir: entry.dir,\n source: entry.source,\n ...(entry.manifest ? { manifest: entry.manifest } : {}),\n error,\n })\n const manifestVersion = entry.manifest?.apiVersion\n if (manifestVersion !== undefined && manifestVersion !== EXTENSION_API_VERSION)\n return failed(`Unsupported extension API version \"${manifestVersion}\". This runtime supports apiVersion 1.`)\n if (entry.manifest?.name && entry.manifest.name !== entry.name)\n return failed(`Extension manifest name mismatch: folder is \"${entry.name}\" but manifest declares \"${entry.manifest.name}\".`)\n if (version)\n createLogger(sink, { extension: entry.name }).warn(version.message)\n try {\n const mod = await withTimeout(\n importExtensionEntry(entry.entry, entry.dir, compileCache !== undefined ? { compileCache } : {}),\n timeoutMs,\n `Timed out importing ${entry.entry} after ${timeoutMs}ms. The module's top-level code may still be running; an import can't be cancelled.`,\n )\n const where = { name: entry.name, dir: entry.dir, source: entry.source, ...(entry.manifest ? { manifest: entry.manifest } : {}) }\n const exported = moduleExports(mod)\n const definition = definitionExport(exported)\n if (definition !== undefined)\n return runtimeLoadedExtension(definition, where)\n return failed(`Module at ${entry.entry} does not export an extension definition (expected \\`default\\` or named \\`extension\\` with \\`apiVersion: 1\\`).`)\n }\n catch (err) {\n return {\n name: entry.name,\n dir: entry.dir,\n source: entry.source,\n ...(entry.manifest ? { manifest: entry.manifest } : {}),\n error: `Failed to import ${entry.entry}: ${errorMessage(err)}`,\n }\n }\n}\n\n/**\n * Imports one extension folder fresh from disk, as discovery would (version\n * check, manifest, module graph evicted first). Never rejects: a folder with\n * no entry file or a module that fails to import comes back with `error`.\n * The caller decides whether the folder may load at all (trust, precedence):\n * {@link loadableExtensionDirs} answers that.\n *\n * @param dir - The extension folder.\n * @param opts - Its source, the import bound (default 10 s), the warning sink and Node's compile cache.\n * @param opts.source - Where the folder was found.\n * @param opts.importTimeoutMs - How long the import may take.\n * @param opts.sink - Where load warnings go. Default: warnings to stderr.\n * @param opts.compileCache - Node hosts: the folder compiled code is kept in.\n * @returns The loaded entry, or one carrying the error.\n */\nexport async function loadExtensionFolder(dir: string, opts: { source: LoadedExtensionSource, importTimeoutMs?: number, sink?: LogSink, compileCache?: string }): Promise<LoadedExtension> {\n const name = basename(dir)\n const entry = findEntryFile(dir)\n const manifest = readExtensionManifest(dir)\n if (!entry)\n return { name, dir, source: opts.source, ...manifest, error: `No entry file (${ENTRY_CANDIDATES.join(', ')}) in ${dir}.` }\n return loadExtensionFromDisk({ name, dir, entry, source: opts.source, ...manifest }, opts.importTimeoutMs ?? 10_000, opts.sink ?? consoleSink({ minLevel: 'warn' }), opts.compileCache)\n}\n\n/**\n * The export the runtime validates: one claiming `apiVersion: 1`, else the\n * first object (its validation then says what is missing).\n *\n * @param exported - A module's `default` and `extension` exports.\n * @returns The export, or `undefined` when none is an object.\n */\nexport function definitionExport(exported: readonly unknown[]): unknown {\n return exported.find(looksLikeDefinition) ?? exported.find(value => !!value && typeof value === 'object')\n}\n\n/** The `default` and `extension` exports of a module, in that order of preference. */\nfunction moduleExports(mod: unknown): unknown[] {\n if (!mod || typeof mod !== 'object')\n return []\n const m = mod as Record<string, unknown>\n return [m.default, m.extension].filter(value => value !== undefined)\n}\n\n/**\n * Tag an inline (host-passed) extension into the same shape disk-\n * loaded ones produce, so host-bundled extensions (e.g. those passed\n * via `RunTuiOptions.extensions`) flow through `buildExtensionRegistry`\n * identically to disk-discovered ones. The runtime validates the\n * definition and lists it inactive with what is wrong.\n *\n * @param definition - Extension definition the host built in code.\n */\nexport function inlineLoadedExtension(definition: Pick<ExtensionDefinition, 'apiVersion'> | object): LoadedExtension {\n if (definition && typeof definition === 'object')\n return runtimeLoadedExtension(definition, { source: 'inline' })\n return { name: 'unknown', source: 'inline', error: NO_DEFINITION_ERROR }\n}\n\n/**\n * Read `extension.json` (or `package.json#zidane`) as a shape-validated\n * manifest. Exported for the installer so \"what counts as a manifest\" has\n * exactly one definition — a malformed manifest is ignored identically at\n * install-validation time and at discovery time.\n */\nexport function readExtensionManifest(dir: string): { manifest?: ExtensionManifest } {\n const fromExtensionJson = readJson(resolve(dir, 'extension.json'))\n if (isExtensionManifest(fromExtensionJson))\n return { manifest: fromExtensionJson }\n const pkg = readJson(resolve(dir, 'package.json'))\n if (pkg && typeof pkg === 'object' && !Array.isArray(pkg)) {\n const manifest = (pkg as { zidane?: unknown }).zidane\n if (isExtensionManifest(manifest))\n return { manifest }\n }\n return {}\n}\n\nfunction readJson(path: string): unknown {\n try {\n return JSON.parse(readFileSync(path, 'utf8')) as unknown\n }\n catch {\n return null\n }\n}\n\nfunction isExtensionManifest(value: unknown): value is ExtensionManifest {\n if (!value || typeof value !== 'object' || Array.isArray(value))\n return false\n const v = value as Record<string, unknown>\n // `apiVersion`, when present, must be a number. We still recognize an\n // unsupported version (e.g. 1) as a manifest so the loader can surface a\n // clear \"unsupported API version\" error rather than silently ignoring it —\n // but the rest of the shape is still validated.\n if (v.apiVersion !== undefined && typeof v.apiVersion !== 'number')\n return false\n return (v.name === undefined || typeof v.name === 'string')\n && (v.displayName === undefined || typeof v.displayName === 'string')\n && (v.description === undefined || typeof v.description === 'string')\n && (v.icon === undefined || isSettingsIcon(v.icon))\n}\n\n// ---------------------------------------------------------------------------\n// Internals\n// ---------------------------------------------------------------------------\n\n/** Re-export for tests / advanced hosts that want to log the scan results before loading. */\nexport type { ExtensionScanEntry }\n/** Re-export so callers can read the canonical entry file list. */\nexport { ENTRY_CANDIDATES }\n"],"mappings":";;;;;;;;;;;;;;;AASA,MAAa,wBAAwB;;;;;;;AAoDrC,SAAgB,gBAA2D,YAA4D;CACrI,OAAO;AACT;;;;ACxCA,MAAa,2BAA2B;;AAGxC,MAAM,gBAAgB;;;;;AAMtB,eAAsB,WAA2C;CAE/D,OAAO,OAAO;AAChB;;;;;;;AAQA,SAAgB,qBAAqB,cAA+C;CAClF,OAAO;EAAE,aAAa;EAAM,SAAS,gBAAgB;EAAO,gBAAgB;CAAM;AACpF;;;;;;AAOA,SAAS,WAAW,MAAwB;CAC1C,IAAI;EACF,MAAM,OAAO,aAAa,IAAI;EAC9B,OAAO,SAAS,OAAO,CAAC,IAAI,IAAI,CAAC,MAAM,IAAI;CAC7C,QACM;EACJ,OAAO,CAAC,IAAI;CACd;AACF;;AAGA,SAAS,cAAc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AAU,OAAO;CAAoB;AACzE;;;;;;;AAQA,SAAgB,sBAAsB,KAA+C;CACnF,MAAM,oBAAoB,SAAS,QAAQ,KAAK,gBAAgB,CAAC;CACjE,IAAI,oBAAoB,iBAAiB,GACvC,OAAO,EAAE,UAAU,kBAAkB;CACvC,MAAM,MAAM,SAAS,QAAQ,KAAK,cAAc,CAAC;CACjD,IAAI,OAAO,OAAO,QAAQ,YAAY,CAAC,MAAM,QAAQ,GAAG,GAAG;EACzD,MAAM,WAAY,IAA6B;EAC/C,IAAI,oBAAoB,QAAQ,GAC9B,OAAO,EAAE,SAAS;CACtB;CACA,OAAO,CAAC;AACV;AAEA,SAAS,SAAS,MAAuB;CACvC,IAAI;EACF,OAAO,KAAK,MAAM,aAAa,MAAM,MAAM,CAAC;CAC9C,QACM;EACJ,OAAO;CACT;AACF;AAEA,SAAS,oBAAoB,OAA4C;CACvE,IAAI,CAAC,SAAS,OAAO,UAAU,YAAY,MAAM,QAAQ,KAAK,GAC5D,OAAO;CACT,MAAM,IAAI;CAKV,IAAI,EAAE,eAAe,KAAA,KAAa,OAAO,EAAE,eAAe,UACxD,OAAO;CACT,QAAQ,EAAE,SAAS,KAAA,KAAa,OAAO,EAAE,SAAS,cAC5C,EAAE,gBAAgB,KAAA,KAAa,OAAO,EAAE,gBAAgB,cACxD,EAAE,gBAAgB,KAAA,KAAa,OAAO,EAAE,gBAAgB,cACxD,EAAE,SAAS,KAAA,KAAa,eAAe,EAAE,IAAI;AACrD"}
|
package/dist/durable/sqlite.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as SqliteDurableRuntime } from "../sqlite-runtime-
|
|
1
|
+
import { VL as DurableInspector } from "../index-DqCio7Nd.js";
|
|
2
|
+
import { t as SqliteDurableRuntime } from "../sqlite-runtime-D2N0m9XE.js";
|
|
3
3
|
//#region src/durable/sqlite.d.ts
|
|
4
4
|
/** Options of {@link createSqliteRuntime}. */
|
|
5
5
|
interface SqliteRuntimeOptions {
|
package/dist/durable.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $L as
|
|
1
|
+
import { $L as ResumableRun, BL as DurableAwakeable, CR as RunLeaseHeldError, GL as DurableQueueEntry, HL as DurableLease, JL as DurableRuntime, KL as DurableQueueStore, LL as AwakeableOptions, QL as OpenRunOptions, RL as AwakeableOutcome, SI as DurableToolDef, SR as RUN_TAKEN_OVER_MESSAGE, TR as StaleEpochError, UL as DurableMode, VL as DurableInspector, WL as DurableOptions, XL as DurableSubmissionStore, YL as DurableStores, ZL as LeaseClaim, _R as StepKey, aR as StepHandlers, bI as DurableBody, bR as parseStepKey, cR as StepLive, dR as StepRecord, eR as RunScope, fR as StepReplayPolicy, gR as MODEL_CALL, hR as StreamPartialRecord, iR as StepHandlerContext, kI as ToolPreflight, lR as StepOutcome, mR as StepStatus, nR as StepErrorRecord, oR as StepInterrupted, pR as StepRequest, qL as DurableResumeOptions, rR as StepHandler, sR as StepKind, tR as StepCompleted, uR as StepProgress, vR as StepKeyParts, wR as RunSuspendedError, xI as DurableToolContext, xR as stepKey, yR as nestedCall, zL as AwakeableRecord } from "./index-DqCio7Nd.js";
|
|
2
2
|
//#region src/durable/memory.d.ts
|
|
3
3
|
/** Read access to the stored state, for tests and the conformance suite. */
|
|
4
4
|
type MemoryDurableInspector = DurableInspector;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { i as writeJsonFileAtomic, t as OWNER_ONLY } from "./atomic-write-BewQOXlD.js";
|
|
2
2
|
import { t as projectUserPaths } from "./project-user-paths-Chsi83mp.js";
|
|
3
3
|
import { p as oauthAccountLabel } from "./cred-keys-C0KaSRp7.js";
|
|
4
|
-
import { f as readProviderCredential, m as readProviderCredentials } from "./credentials-
|
|
4
|
+
import { f as readProviderCredential, m as readProviderCredentials } from "./credentials-Bf8Bz4X-.js";
|
|
5
5
|
import { A as readProjects, p as parseMcpsFile, r as environmentCredentialsPath, s as userSystemMdPath } from "./environment-credentials-B0nivYLV.js";
|
|
6
6
|
import { d as loadState } from "./store-CjpqVefW.js";
|
|
7
7
|
import { E as DEFAULT_SETTINGS, M as settingsFromStored } from "./settings-catalog-C8uSElb9.js";
|
|
8
8
|
import { f as readEnvironmentSettings, o as settingsToWire } from "./host-scoped-settings-jlq5zWs4.js";
|
|
9
|
-
import { n as hashValue, r as isRecord, t as isSyncableSetting } from "./settings-keys-
|
|
9
|
+
import { n as hashValue, r as isRecord, t as isSyncableSetting } from "./settings-keys-Dmig23l3.js";
|
|
10
10
|
import { a as SYNC_MODES, c as fieldCategory, l as serverSyncCategories, n as SYNCABLE_ENVIRONMENT_KINDS, r as SYNC_CATEGORIES } from "./types-Skz6Z48Z.js";
|
|
11
11
|
import { basename, dirname, join, relative, sep } from "node:path";
|
|
12
12
|
import { existsSync, lstatSync, readFileSync, readdirSync, statSync, watch } from "node:fs";
|
|
@@ -829,4 +829,4 @@ function syncLocalInfo(sources) {
|
|
|
829
829
|
//#endregion
|
|
830
830
|
export { createSyncEngine as t };
|
|
831
831
|
|
|
832
|
-
//# sourceMappingURL=engine-
|
|
832
|
+
//# sourceMappingURL=engine-d8V1hEDw.js.map
|