@agimon-ai/doompi-skill 0.0.1-alpha.36 → 0.0.1-alpha.42
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/adapters/deferredSkills.cjs.map +1 -1
- package/dist/adapters/deferredSkills.mjs.map +1 -1
- package/dist/adapters/pi/extension.d.cts +2 -2
- package/dist/adapters/pi/extension.d.cts.map +1 -1
- package/dist/adapters/pi/extension.d.mts +2 -2
- package/dist/adapters/pi/extension.d.mts.map +1 -1
- package/dist/adapters/skillCatalog.d.cts +8 -9
- package/dist/adapters/skillCatalog.d.cts.map +1 -1
- package/dist/adapters/skillCatalog.d.mts +8 -9
- package/dist/adapters/skillCatalog.d.mts.map +1 -1
- package/dist/services/skillText.d.cts +1 -2
- package/dist/services/skillText.d.cts.map +1 -1
- package/dist/services/skillText.d.mts +1 -2
- package/dist/services/skillText.d.mts.map +1 -1
- package/dist/tui/skillsOverlay.d.cts +3 -4
- package/dist/tui/skillsOverlay.d.cts.map +1 -1
- package/dist/tui/skillsOverlay.d.mts +3 -4
- package/dist/tui/skillsOverlay.d.mts.map +1 -1
- package/dist/types/skills.d.cts +5 -6
- package/dist/types/skills.d.cts.map +1 -1
- package/dist/types/skills.d.mts +5 -6
- package/dist/types/skills.d.mts.map +1 -1
- package/package.json +17 -17
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deferredSkills.cjs","names":["fileURLToPath","path","fs","pathToFileURL","#options","#promise","#loadInWorker","#failure","#load","getAgentDir","#snapshot","loadSkills","#loadOptions","Worker","formatSkillsForPrompt","stripFrontmatter"],"sources":["../../src/adapters/deferredSkills.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\nimport { fileURLToPath, pathToFileURL } from 'node:url';\nimport { Worker } from 'node:worker_threads';\nimport {\n type BuildSystemPromptOptions,\n formatSkillsForPrompt,\n getAgentDir,\n loadSkills,\n type Skill,\n stripFrontmatter,\n} from '@earendil-works/pi-coding-agent';\n\nexport interface DeferredSkillSnapshot {\n skills: Skill[];\n diagnostics: string[];\n}\n\nconst PI_PACKAGE = '@earendil-works/pi-coding-agent';\nconst PACKAGE_MANIFEST = 'package.json';\nconst SKILL_WORKER_SOURCE = `\nconst { parentPort, workerData } = require('node:worker_threads');\nvoid (async () => {\n try {\n const { loadSkills } = await import(workerData.piModuleUrl);\n parentPort.postMessage({ ok: true, result: loadSkills(workerData.loadOptions) });\n } catch (error) {\n parentPort.postMessage({ ok: false, error: error instanceof Error ? error.message : String(error) });\n }\n})();\n`;\n\nfunction installedPiModuleUrl(): string {\n const anchors = [process.argv[1], fileURLToPath(import.meta.url), path.join(process.cwd(), PACKAGE_MANIFEST)];\n for (const anchor of anchors) {\n if (!anchor) continue;\n let directory = path.dirname(path.resolve(anchor));\n while (true) {\n const packageRoot = path.join(directory, 'node_modules', PI_PACKAGE);\n const manifestPath = path.join(packageRoot, PACKAGE_MANIFEST);\n try {\n const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8')) as { main?: unknown };\n if (typeof manifest.main === 'string') {\n const entry = path.resolve(packageRoot, manifest.main);\n if (fs.existsSync(entry)) return pathToFileURL(entry).href;\n }\n } catch {\n // This anchor does not expose Pi at this level; continue up its module chain.\n }\n const parent = path.dirname(directory);\n if (parent === directory) break;\n directory = parent;\n }\n }\n throw new Error(`Cannot resolve ${PI_PACKAGE} from the DoomPi or host module trees`);\n}\n\ninterface SkillWorkerResult {\n ok: boolean;\n result?: { skills: Skill[]; diagnostics: Array<{ path?: string; message: string }> };\n error?: string;\n}\n\nexport interface DeferredSkillLoaderOptions {\n cwd: string;\n skillPaths: readonly string[];\n agentDir?: string;\n piModuleUrl?: string;\n schedule?: (load: () => void) => void;\n load?: (options: { cwd: string; agentDir: string; skillPaths: string[]; includeDefaults: boolean }) => {\n skills: Skill[];\n diagnostics: Array<{ path?: string; message: string }>;\n };\n}\n\n/**\n * One session's Doom-selected skill inventory.\n *\n * Construction is deliberately cheap. `start()` schedules the synchronous Pi\n * walker after session_start returns, while `ready()` is the single promise the\n * first input awaits before Pi expands `/skill:name`.\n */\nexport class DeferredSkillLoader {\n readonly #options: DeferredSkillLoaderOptions;\n #promise: Promise<DeferredSkillSnapshot> | undefined;\n\n constructor(options: DeferredSkillLoaderOptions) {\n this.#options = options;\n }\n\n start(): Promise<DeferredSkillSnapshot> {\n if (this.#promise) return this.#promise;\n\n if (!this.#options.schedule && !this.#options.load) {\n this.#promise = this.#loadInWorker();\n return this.#promise;\n }\n\n const schedule = this.#options.schedule ?? ((load: () => void) => setImmediate(load));\n this.#promise = new Promise((resolve) => {\n const fail = (error: unknown): void => {\n resolve(this.#failure(error));\n };\n try {\n schedule(() => {\n try {\n resolve(this.#load());\n } catch (error) {\n fail(error);\n }\n });\n } catch (error) {\n fail(error);\n }\n });\n return this.#promise;\n }\n\n ready(): Promise<DeferredSkillSnapshot> {\n return this.start();\n }\n\n #loadOptions(): { cwd: string; agentDir: string; skillPaths: string[]; includeDefaults: boolean } {\n return {\n cwd: this.#options.cwd,\n agentDir: this.#options.agentDir ?? getAgentDir(),\n skillPaths: [...this.#options.skillPaths],\n includeDefaults: false,\n };\n }\n\n #snapshot(result: {\n skills: Skill[];\n diagnostics: Array<{ path?: string; message: string }>;\n }): DeferredSkillSnapshot {\n return {\n skills: result.skills,\n diagnostics: result.diagnostics.map(\n (diagnostic) => `${diagnostic.path ?? this.#options.cwd}: ${diagnostic.message}`,\n ),\n };\n }\n\n #failure(error: unknown): DeferredSkillSnapshot {\n return {\n skills: [],\n diagnostics: [`${this.#options.cwd}: ${error instanceof Error ? error.message : String(error)}`],\n };\n }\n\n #load(): DeferredSkillSnapshot {\n return this.#snapshot((this.#options.load ?? loadSkills)(this.#loadOptions()));\n }\n\n #loadInWorker(): Promise<DeferredSkillSnapshot> {\n return new Promise((resolve) => {\n let settled = false;\n const settle = (snapshot: DeferredSkillSnapshot): void => {\n if (settled) return;\n settled = true;\n resolve(snapshot);\n };\n let worker: Worker;\n try {\n worker = new Worker(SKILL_WORKER_SOURCE, {\n eval: true,\n workerData: {\n piModuleUrl: this.#options.piModuleUrl ?? installedPiModuleUrl(),\n loadOptions: this.#loadOptions(),\n },\n });\n } catch (error) {\n settle(this.#failure(error));\n return;\n }\n worker.unref();\n worker.once('message', (message: SkillWorkerResult) => {\n if (!message.ok || !message.result) {\n settle(this.#failure(message.error ?? 'Skill worker failed'));\n return;\n }\n settle(this.#snapshot(message.result));\n });\n worker.once('error', (error) => settle(this.#failure(error)));\n worker.once('exit', (code) => {\n if (code !== 0) settle(this.#failure(`Skill worker exited with code ${code}`));\n });\n });\n }\n}\n\n/** Appends only the inventory Pi would append for these deferred skills. */\nexport function buildPromptWithDeferredSkills(\n systemPrompt: string,\n options: BuildSystemPromptOptions,\n skills: Skill[],\n): string {\n if (options.selectedTools && !options.selectedTools.includes('read')) return systemPrompt;\n return `${systemPrompt}${formatSkillsForPrompt(skills)}`;\n}\n\n/** Expands a deferred `/skill:name` before Pi consults its synchronous inventory. */\nexport function expandDeferredSkillCommand(text: string, skills: readonly Skill[]): string {\n if (!text.startsWith('/skill:')) return text;\n const spaceIndex = text.indexOf(' ');\n const skillName = spaceIndex === -1 ? text.slice(7) : text.slice(7, spaceIndex);\n const skill = skills.find((candidate) => candidate.name === skillName);\n if (!skill) return text;\n\n try {\n const args = spaceIndex === -1 ? '' : text.slice(spaceIndex + 1).trim();\n const body = stripFrontmatter(fs.readFileSync(skill.filePath, 'utf8')).trim();\n const skillBlock = `<skill name=\"${skill.name}\" location=\"${skill.filePath}\">\\nReferences are relative to ${skill.baseDir}.\\n\\n${body}\\n</skill>`;\n return args ? `${skillBlock}\\n\\n${args}` : skillBlock;\n } catch {\n // Pi uses the same literal-text fallback if a skill disappears between\n // discovery and submission; the agent can still respond to the command.\n return text;\n }\n}\n"],"mappings":"mPAkBA,MAAM,EAAa,kCACb,EAAmB,eAazB,SAAS,GAA+B,CACtC,IAAM,EAAU,CAAC,QAAQ,KAAK,IAAIA,EAAAA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adSkills","Worker","formatSkillsForPrompt","stripFrontmatter"],"sources":["../../src/adapters/deferredSkills.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\nimport { fileURLToPath, pathToFileURL } from 'node:url';\nimport { Worker } from 'node:worker_threads';\nimport {\n type BuildSystemPromptOptions,\n formatSkillsForPrompt,\n getAgentDir,\n loadSkills,\n type Skill,\n stripFrontmatter,\n} from '@earendil-works/pi-coding-agent';\n\nexport interface DeferredSkillSnapshot {\n skills: Skill[];\n diagnostics: string[];\n}\n\nconst PI_PACKAGE = '@earendil-works/pi-coding-agent';\nconst PACKAGE_MANIFEST = 'package.json';\nconst SKILL_WORKER_SOURCE = `\nconst { parentPort, workerData } = require('node:worker_threads');\nvoid (async () => {\n try {\n const { loadSkills } = await import(workerData.piModuleUrl);\n parentPort.postMessage({ ok: true, result: loadSkills(workerData.loadOptions) });\n } catch (error) {\n parentPort.postMessage({ ok: false, error: error instanceof Error ? error.message : String(error) });\n }\n})();\n`;\n\nfunction installedPiModuleUrl(): string {\n const anchors = [process.argv[1], fileURLToPath(import.meta.url), path.join(process.cwd(), PACKAGE_MANIFEST)];\n for (const anchor of anchors) {\n if (!anchor) continue;\n let directory = path.dirname(path.resolve(anchor));\n while (true) {\n const packageRoot = path.join(directory, 'node_modules', PI_PACKAGE);\n const manifestPath = path.join(packageRoot, PACKAGE_MANIFEST);\n try {\n const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8')) as { main?: unknown };\n if (typeof manifest.main === 'string') {\n const entry = path.resolve(packageRoot, manifest.main);\n if (fs.existsSync(entry)) return pathToFileURL(entry).href;\n }\n } catch {\n // This anchor does not expose Pi at this level; continue up its module chain.\n }\n const parent = path.dirname(directory);\n if (parent === directory) break;\n directory = parent;\n }\n }\n throw new Error(`Cannot resolve ${PI_PACKAGE} from the DoomPi or host module trees`);\n}\n\ninterface SkillWorkerResult {\n ok: boolean;\n result?: { skills: Skill[]; diagnostics: Array<{ path?: string; message: string }> };\n error?: string;\n}\n\nexport interface DeferredSkillLoaderOptions {\n cwd: string;\n skillPaths: readonly string[];\n agentDir?: string;\n piModuleUrl?: string;\n schedule?: (load: () => void) => void;\n load?: (options: { cwd: string; agentDir: string; skillPaths: string[]; includeDefaults: boolean }) => {\n skills: Skill[];\n diagnostics: Array<{ path?: string; message: string }>;\n };\n}\n\n/**\n * One session's Doom-selected skill inventory.\n *\n * Construction is deliberately cheap. `start()` schedules the synchronous Pi\n * walker after session_start returns, while `ready()` is the single promise the\n * first input awaits before Pi expands `/skill:name`.\n */\nexport class DeferredSkillLoader {\n readonly #options: DeferredSkillLoaderOptions;\n #promise: Promise<DeferredSkillSnapshot> | undefined;\n\n constructor(options: DeferredSkillLoaderOptions) {\n this.#options = options;\n }\n\n start(): Promise<DeferredSkillSnapshot> {\n if (this.#promise) return this.#promise;\n\n if (!this.#options.schedule && !this.#options.load) {\n this.#promise = this.#loadInWorker();\n return this.#promise;\n }\n\n const schedule = this.#options.schedule ?? ((load: () => void) => setImmediate(load));\n this.#promise = new Promise((resolve) => {\n const fail = (error: unknown): void => {\n resolve(this.#failure(error));\n };\n try {\n schedule(() => {\n try {\n resolve(this.#load());\n } catch (error) {\n fail(error);\n }\n });\n } catch (error) {\n fail(error);\n }\n });\n return this.#promise;\n }\n\n ready(): Promise<DeferredSkillSnapshot> {\n return this.start();\n }\n\n #loadOptions(): { cwd: string; agentDir: string; skillPaths: string[]; includeDefaults: boolean } {\n return {\n cwd: this.#options.cwd,\n agentDir: this.#options.agentDir ?? getAgentDir(),\n skillPaths: [...this.#options.skillPaths],\n includeDefaults: false,\n };\n }\n\n #snapshot(result: {\n skills: Skill[];\n diagnostics: Array<{ path?: string; message: string }>;\n }): DeferredSkillSnapshot {\n return {\n skills: result.skills,\n diagnostics: result.diagnostics.map(\n (diagnostic) => `${diagnostic.path ?? this.#options.cwd}: ${diagnostic.message}`,\n ),\n };\n }\n\n #failure(error: unknown): DeferredSkillSnapshot {\n return {\n skills: [],\n diagnostics: [`${this.#options.cwd}: ${error instanceof Error ? error.message : String(error)}`],\n };\n }\n\n #load(): DeferredSkillSnapshot {\n return this.#snapshot((this.#options.load ?? loadSkills)(this.#loadOptions()));\n }\n\n #loadInWorker(): Promise<DeferredSkillSnapshot> {\n return new Promise((resolve) => {\n let settled = false;\n const settle = (snapshot: DeferredSkillSnapshot): void => {\n if (settled) return;\n settled = true;\n resolve(snapshot);\n };\n let worker: Worker;\n try {\n worker = new Worker(SKILL_WORKER_SOURCE, {\n eval: true,\n workerData: {\n piModuleUrl: this.#options.piModuleUrl ?? installedPiModuleUrl(),\n loadOptions: this.#loadOptions(),\n },\n });\n } catch (error) {\n settle(this.#failure(error));\n return;\n }\n worker.unref();\n worker.once('message', (message: SkillWorkerResult) => {\n if (!message.ok || !message.result) {\n settle(this.#failure(message.error ?? 'Skill worker failed'));\n return;\n }\n settle(this.#snapshot(message.result));\n });\n worker.once('error', (error) => settle(this.#failure(error)));\n worker.once('exit', (code) => {\n if (code !== 0) settle(this.#failure(`Skill worker exited with code ${code}`));\n });\n });\n }\n}\n\n/** Appends only the inventory Pi would append for these deferred skills. */\nexport function buildPromptWithDeferredSkills(\n systemPrompt: string,\n options: BuildSystemPromptOptions,\n skills: Skill[],\n): string {\n if (options.selectedTools && !options.selectedTools.includes('read')) return systemPrompt;\n return `${systemPrompt}${formatSkillsForPrompt(skills)}`;\n}\n\n/** Expands a deferred `/skill:name` before Pi consults its synchronous inventory. */\nexport function expandDeferredSkillCommand(text: string, skills: readonly Skill[]): string {\n if (!text.startsWith('/skill:')) return text;\n const spaceIndex = text.indexOf(' ');\n const skillName = spaceIndex === -1 ? text.slice(7) : text.slice(7, spaceIndex);\n const skill = skills.find((candidate) => candidate.name === skillName);\n if (!skill) return text;\n\n try {\n const args = spaceIndex === -1 ? '' : text.slice(spaceIndex + 1).trim();\n const body = stripFrontmatter(fs.readFileSync(skill.filePath, 'utf8')).trim();\n const skillBlock = `<skill name=\"${skill.name}\" location=\"${skill.filePath}\">\\nReferences are relative to ${skill.baseDir}.\\n\\n${body}\\n</skill>`;\n return args ? `${skillBlock}\\n\\n${args}` : skillBlock;\n } catch {\n // Pi uses the same literal-text fallback if a skill disappears between\n // discovery and submission; the agent can still respond to the command.\n return text;\n }\n}\n"],"mappings":"mPAkBA,MAAM,EAAa,kCACb,EAAmB,eAazB,SAAS,GAA+B,CACtC,IAAM,EAAU,CAAC,QAAQ,KAAK,IAAIA,EAAAA,EAAAA,cAAAA,CAAAA,QAAAA,KAAAA,CAAAA,CAAAA,cAAAA,UAAAA,CAAAA,CAAAA,IAA6B,EAAGC,EAAAA,QAAK,KAAK,QAAQ,IAAI,EAAG,CAAgB,CAAC,EAC5G,IAAK,IAAM,KAAU,EAAS,CAC5B,GAAI,CAAC,EAAQ,SACb,IAAI,EAAYA,EAAAA,QAAK,QAAQA,EAAAA,QAAK,QAAQ,CAAM,CAAC,EACjD,OAAa,CACX,IAAM,EAAcA,EAAAA,QAAK,KAAK,EAAW,eAAgB,CAAU,EAC7D,EAAeA,EAAAA,QAAK,KAAK,EAAa,CAAgB,EAC5D,GAAI,CACF,IAAM,EAAW,KAAK,MAAMC,EAAAA,QAAG,aAAa,EAAc,MAAM,CAAC,EACjE,GAAI,OAAO,EAAS,MAAS,SAAU,CACrC,IAAM,EAAQD,EAAAA,QAAK,QAAQ,EAAa,EAAS,IAAI,EACrD,GAAIC,EAAAA,QAAG,WAAW,CAAK,EAAG,OAAA,EAAOC,EAAAA,cAAAA,CAAc,CAAK,CAAC,CAAC,IACxD,CACF,MAAQ,CAER,CACA,IAAM,EAASF,EAAAA,QAAK,QAAQ,CAAS,EACrC,GAAI,IAAW,EAAW,MAC1B,EAAY,CACd,CACF,CACA,MAAU,MAAM,kBAAkB,EAAW,sCAAsC,CACrF,CA2BA,IAAa,EAAb,KAAiC,CAC/B,GACA,GAEA,YAAY,EAAqC,CAC/C,KAAK,GAAW,CAClB,CAEA,OAAwC,CACtC,GAAI,KAAK,GAAU,OAAO,KAAK,GAE/B,GAAI,C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,gBAAgB,EAAM,KAAK,cAAc,EAAM,SAAS,iCAAiC,EAAM,QAAQ,OAAO,EAAK,YACtI,OAAO,EAAO,GAAG,EAAW,MAAM,IAAS,CAC7C,MAAQ,CAGN,OAAO,CACT,CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deferredSkills.mjs","names":["#options","#promise","#loadInWorker","#failure","#load","#snapshot","#loadOptions"],"sources":["../../src/adapters/deferredSkills.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\nimport { fileURLToPath, pathToFileURL } from 'node:url';\nimport { Worker } from 'node:worker_threads';\nimport {\n type BuildSystemPromptOptions,\n formatSkillsForPrompt,\n getAgentDir,\n loadSkills,\n type Skill,\n stripFrontmatter,\n} from '@earendil-works/pi-coding-agent';\n\nexport interface DeferredSkillSnapshot {\n skills: Skill[];\n diagnostics: string[];\n}\n\nconst PI_PACKAGE = '@earendil-works/pi-coding-agent';\nconst PACKAGE_MANIFEST = 'package.json';\nconst SKILL_WORKER_SOURCE = `\nconst { parentPort, workerData } = require('node:worker_threads');\nvoid (async () => {\n try {\n const { loadSkills } = await import(workerData.piModuleUrl);\n parentPort.postMessage({ ok: true, result: loadSkills(workerData.loadOptions) });\n } catch (error) {\n parentPort.postMessage({ ok: false, error: error instanceof Error ? error.message : String(error) });\n }\n})();\n`;\n\nfunction installedPiModuleUrl(): string {\n const anchors = [process.argv[1], fileURLToPath(import.meta.url), path.join(process.cwd(), PACKAGE_MANIFEST)];\n for (const anchor of anchors) {\n if (!anchor) continue;\n let directory = path.dirname(path.resolve(anchor));\n while (true) {\n const packageRoot = path.join(directory, 'node_modules', PI_PACKAGE);\n const manifestPath = path.join(packageRoot, PACKAGE_MANIFEST);\n try {\n const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8')) as { main?: unknown };\n if (typeof manifest.main === 'string') {\n const entry = path.resolve(packageRoot, manifest.main);\n if (fs.existsSync(entry)) return pathToFileURL(entry).href;\n }\n } catch {\n // This anchor does not expose Pi at this level; continue up its module chain.\n }\n const parent = path.dirname(directory);\n if (parent === directory) break;\n directory = parent;\n }\n }\n throw new Error(`Cannot resolve ${PI_PACKAGE} from the DoomPi or host module trees`);\n}\n\ninterface SkillWorkerResult {\n ok: boolean;\n result?: { skills: Skill[]; diagnostics: Array<{ path?: string; message: string }> };\n error?: string;\n}\n\nexport interface DeferredSkillLoaderOptions {\n cwd: string;\n skillPaths: readonly string[];\n agentDir?: string;\n piModuleUrl?: string;\n schedule?: (load: () => void) => void;\n load?: (options: { cwd: string; agentDir: string; skillPaths: string[]; includeDefaults: boolean }) => {\n skills: Skill[];\n diagnostics: Array<{ path?: string; message: string }>;\n };\n}\n\n/**\n * One session's Doom-selected skill inventory.\n *\n * Construction is deliberately cheap. `start()` schedules the synchronous Pi\n * walker after session_start returns, while `ready()` is the single promise the\n * first input awaits before Pi expands `/skill:name`.\n */\nexport class DeferredSkillLoader {\n readonly #options: DeferredSkillLoaderOptions;\n #promise: Promise<DeferredSkillSnapshot> | undefined;\n\n constructor(options: DeferredSkillLoaderOptions) {\n this.#options = options;\n }\n\n start(): Promise<DeferredSkillSnapshot> {\n if (this.#promise) return this.#promise;\n\n if (!this.#options.schedule && !this.#options.load) {\n this.#promise = this.#loadInWorker();\n return this.#promise;\n }\n\n const schedule = this.#options.schedule ?? ((load: () => void) => setImmediate(load));\n this.#promise = new Promise((resolve) => {\n const fail = (error: unknown): void => {\n resolve(this.#failure(error));\n };\n try {\n schedule(() => {\n try {\n resolve(this.#load());\n } catch (error) {\n fail(error);\n }\n });\n } catch (error) {\n fail(error);\n }\n });\n return this.#promise;\n }\n\n ready(): Promise<DeferredSkillSnapshot> {\n return this.start();\n }\n\n #loadOptions(): { cwd: string; agentDir: string; skillPaths: string[]; includeDefaults: boolean } {\n return {\n cwd: this.#options.cwd,\n agentDir: this.#options.agentDir ?? getAgentDir(),\n skillPaths: [...this.#options.skillPaths],\n includeDefaults: false,\n };\n }\n\n #snapshot(result: {\n skills: Skill[];\n diagnostics: Array<{ path?: string; message: string }>;\n }): DeferredSkillSnapshot {\n return {\n skills: result.skills,\n diagnostics: result.diagnostics.map(\n (diagnostic) => `${diagnostic.path ?? this.#options.cwd}: ${diagnostic.message}`,\n ),\n };\n }\n\n #failure(error: unknown): DeferredSkillSnapshot {\n return {\n skills: [],\n diagnostics: [`${this.#options.cwd}: ${error instanceof Error ? error.message : String(error)}`],\n };\n }\n\n #load(): DeferredSkillSnapshot {\n return this.#snapshot((this.#options.load ?? loadSkills)(this.#loadOptions()));\n }\n\n #loadInWorker(): Promise<DeferredSkillSnapshot> {\n return new Promise((resolve) => {\n let settled = false;\n const settle = (snapshot: DeferredSkillSnapshot): void => {\n if (settled) return;\n settled = true;\n resolve(snapshot);\n };\n let worker: Worker;\n try {\n worker = new Worker(SKILL_WORKER_SOURCE, {\n eval: true,\n workerData: {\n piModuleUrl: this.#options.piModuleUrl ?? installedPiModuleUrl(),\n loadOptions: this.#loadOptions(),\n },\n });\n } catch (error) {\n settle(this.#failure(error));\n return;\n }\n worker.unref();\n worker.once('message', (message: SkillWorkerResult) => {\n if (!message.ok || !message.result) {\n settle(this.#failure(message.error ?? 'Skill worker failed'));\n return;\n }\n settle(this.#snapshot(message.result));\n });\n worker.once('error', (error) => settle(this.#failure(error)));\n worker.once('exit', (code) => {\n if (code !== 0) settle(this.#failure(`Skill worker exited with code ${code}`));\n });\n });\n }\n}\n\n/** Appends only the inventory Pi would append for these deferred skills. */\nexport function buildPromptWithDeferredSkills(\n systemPrompt: string,\n options: BuildSystemPromptOptions,\n skills: Skill[],\n): string {\n if (options.selectedTools && !options.selectedTools.includes('read')) return systemPrompt;\n return `${systemPrompt}${formatSkillsForPrompt(skills)}`;\n}\n\n/** Expands a deferred `/skill:name` before Pi consults its synchronous inventory. */\nexport function expandDeferredSkillCommand(text: string, skills: readonly Skill[]): string {\n if (!text.startsWith('/skill:')) return text;\n const spaceIndex = text.indexOf(' ');\n const skillName = spaceIndex === -1 ? text.slice(7) : text.slice(7, spaceIndex);\n const skill = skills.find((candidate) => candidate.name === skillName);\n if (!skill) return text;\n\n try {\n const args = spaceIndex === -1 ? '' : text.slice(spaceIndex + 1).trim();\n const body = stripFrontmatter(fs.readFileSync(skill.filePath, 'utf8')).trim();\n const skillBlock = `<skill name=\"${skill.name}\" location=\"${skill.filePath}\">\\nReferences are relative to ${skill.baseDir}.\\n\\n${body}\\n</skill>`;\n return args ? `${skillBlock}\\n\\n${args}` : skillBlock;\n } catch {\n // Pi uses the same literal-text fallback if a skill disappears between\n // discovery and submission; the agent can still respond to the command.\n return text;\n }\n}\n"],"mappings":"wRAkBA,MAAM,EAAa,kCACb,EAAmB,eAazB,SAAS,GAA+B,CACtC,IAAM,EAAU,CAAC,QAAQ,KAAK,GAAI,EAAc,YAAY,GAAG,EAAG,EAAK,KAAK,QAAQ,IAAI,EAAG,CAAgB,CAAC,EAC5G,IAAK,IAAM,KAAU,EAAS,CAC5B,GAAI,CAAC,EAAQ,SACb,IAAI,EAAY,EAAK,QAAQ,EAAK,QAAQ,CAAM,CAAC,EACjD,OAAa,CACX,IAAM,EAAc,EAAK,KAAK,EAAW,eAAgB,CAAU,EAC7D,EAAe,EAAK,KAAK,EAAa,CAAgB,EAC5D,GAAI,CACF,IAAM,EAAW,KAAK,MAAM,EAAG,aAAa,EAAc,MAAM,CAAC,EACjE,GAAI,OAAO,EAAS,MAAS,SAAU,CACrC,IAAM,EAAQ,EAAK,QAAQ,EAAa,EAAS,IAAI,EACrD,GAAI,EAAG,WAAW,CAAK,EAAG,OAAO,EAAc,CAAK,CAAC,CAAC,IACxD,CACF,MAAQ,CAER,CACA,IAAM,EAAS,EAAK,QAAQ,CAAS,EACrC,GAAI,IAAW,EAAW,MAC1B,EAAY,CACd,CACF,CACA,MAAU,MAAM,kBAAkB,EAAW,sCAAsC,CACrF,CA2BA,IAAa,EAAb,KAAiC,CAC/B,GACA,GAEA,YAAY,EAAqC,CAC/C,KAAKA,GAAW,CAClB,CAEA,OAAw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B,EAAM,KAAK,cAAc,EAAM,SAAS,iCAAiC,EAAM,QAAQ,OAAO,EAAK,YACtI,OAAO,EAAO,GAAG,EAAW,MAAM,IAAS,CAC7C,MAAQ,CAGN,OAAO,CACT,CACF"}
|
|
1
|
+
{"version":3,"file":"deferredSkills.mjs","names":[],"sources":["../../src/adapters/deferredSkills.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\nimport { fileURLToPath, pathToFileURL } from 'node:url';\nimport { Worker } from 'node:worker_threads';\nimport {\n type BuildSystemPromptOptions,\n formatSkillsForPrompt,\n getAgentDir,\n loadSkills,\n type Skill,\n stripFrontmatter,\n} from '@earendil-works/pi-coding-agent';\n\nexport interface DeferredSkillSnapshot {\n skills: Skill[];\n diagnostics: string[];\n}\n\nconst PI_PACKAGE = '@earendil-works/pi-coding-agent';\nconst PACKAGE_MANIFEST = 'package.json';\nconst SKILL_WORKER_SOURCE = `\nconst { parentPort, workerData } = require('node:worker_threads');\nvoid (async () => {\n try {\n const { loadSkills } = await import(workerData.piModuleUrl);\n parentPort.postMessage({ ok: true, result: loadSkills(workerData.loadOptions) });\n } catch (error) {\n parentPort.postMessage({ ok: false, error: error instanceof Error ? error.message : String(error) });\n }\n})();\n`;\n\nfunction installedPiModuleUrl(): string {\n const anchors = [process.argv[1], fileURLToPath(import.meta.url), path.join(process.cwd(), PACKAGE_MANIFEST)];\n for (const anchor of anchors) {\n if (!anchor) continue;\n let directory = path.dirname(path.resolve(anchor));\n while (true) {\n const packageRoot = path.join(directory, 'node_modules', PI_PACKAGE);\n const manifestPath = path.join(packageRoot, PACKAGE_MANIFEST);\n try {\n const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8')) as { main?: unknown };\n if (typeof manifest.main === 'string') {\n const entry = path.resolve(packageRoot, manifest.main);\n if (fs.existsSync(entry)) return pathToFileURL(entry).href;\n }\n } catch {\n // This anchor does not expose Pi at this level; continue up its module chain.\n }\n const parent = path.dirname(directory);\n if (parent === directory) break;\n directory = parent;\n }\n }\n throw new Error(`Cannot resolve ${PI_PACKAGE} from the DoomPi or host module trees`);\n}\n\ninterface SkillWorkerResult {\n ok: boolean;\n result?: { skills: Skill[]; diagnostics: Array<{ path?: string; message: string }> };\n error?: string;\n}\n\nexport interface DeferredSkillLoaderOptions {\n cwd: string;\n skillPaths: readonly string[];\n agentDir?: string;\n piModuleUrl?: string;\n schedule?: (load: () => void) => void;\n load?: (options: { cwd: string; agentDir: string; skillPaths: string[]; includeDefaults: boolean }) => {\n skills: Skill[];\n diagnostics: Array<{ path?: string; message: string }>;\n };\n}\n\n/**\n * One session's Doom-selected skill inventory.\n *\n * Construction is deliberately cheap. `start()` schedules the synchronous Pi\n * walker after session_start returns, while `ready()` is the single promise the\n * first input awaits before Pi expands `/skill:name`.\n */\nexport class DeferredSkillLoader {\n readonly #options: DeferredSkillLoaderOptions;\n #promise: Promise<DeferredSkillSnapshot> | undefined;\n\n constructor(options: DeferredSkillLoaderOptions) {\n this.#options = options;\n }\n\n start(): Promise<DeferredSkillSnapshot> {\n if (this.#promise) return this.#promise;\n\n if (!this.#options.schedule && !this.#options.load) {\n this.#promise = this.#loadInWorker();\n return this.#promise;\n }\n\n const schedule = this.#options.schedule ?? ((load: () => void) => setImmediate(load));\n this.#promise = new Promise((resolve) => {\n const fail = (error: unknown): void => {\n resolve(this.#failure(error));\n };\n try {\n schedule(() => {\n try {\n resolve(this.#load());\n } catch (error) {\n fail(error);\n }\n });\n } catch (error) {\n fail(error);\n }\n });\n return this.#promise;\n }\n\n ready(): Promise<DeferredSkillSnapshot> {\n return this.start();\n }\n\n #loadOptions(): { cwd: string; agentDir: string; skillPaths: string[]; includeDefaults: boolean } {\n return {\n cwd: this.#options.cwd,\n agentDir: this.#options.agentDir ?? getAgentDir(),\n skillPaths: [...this.#options.skillPaths],\n includeDefaults: false,\n };\n }\n\n #snapshot(result: {\n skills: Skill[];\n diagnostics: Array<{ path?: string; message: string }>;\n }): DeferredSkillSnapshot {\n return {\n skills: result.skills,\n diagnostics: result.diagnostics.map(\n (diagnostic) => `${diagnostic.path ?? this.#options.cwd}: ${diagnostic.message}`,\n ),\n };\n }\n\n #failure(error: unknown): DeferredSkillSnapshot {\n return {\n skills: [],\n diagnostics: [`${this.#options.cwd}: ${error instanceof Error ? error.message : String(error)}`],\n };\n }\n\n #load(): DeferredSkillSnapshot {\n return this.#snapshot((this.#options.load ?? loadSkills)(this.#loadOptions()));\n }\n\n #loadInWorker(): Promise<DeferredSkillSnapshot> {\n return new Promise((resolve) => {\n let settled = false;\n const settle = (snapshot: DeferredSkillSnapshot): void => {\n if (settled) return;\n settled = true;\n resolve(snapshot);\n };\n let worker: Worker;\n try {\n worker = new Worker(SKILL_WORKER_SOURCE, {\n eval: true,\n workerData: {\n piModuleUrl: this.#options.piModuleUrl ?? installedPiModuleUrl(),\n loadOptions: this.#loadOptions(),\n },\n });\n } catch (error) {\n settle(this.#failure(error));\n return;\n }\n worker.unref();\n worker.once('message', (message: SkillWorkerResult) => {\n if (!message.ok || !message.result) {\n settle(this.#failure(message.error ?? 'Skill worker failed'));\n return;\n }\n settle(this.#snapshot(message.result));\n });\n worker.once('error', (error) => settle(this.#failure(error)));\n worker.once('exit', (code) => {\n if (code !== 0) settle(this.#failure(`Skill worker exited with code ${code}`));\n });\n });\n }\n}\n\n/** Appends only the inventory Pi would append for these deferred skills. */\nexport function buildPromptWithDeferredSkills(\n systemPrompt: string,\n options: BuildSystemPromptOptions,\n skills: Skill[],\n): string {\n if (options.selectedTools && !options.selectedTools.includes('read')) return systemPrompt;\n return `${systemPrompt}${formatSkillsForPrompt(skills)}`;\n}\n\n/** Expands a deferred `/skill:name` before Pi consults its synchronous inventory. */\nexport function expandDeferredSkillCommand(text: string, skills: readonly Skill[]): string {\n if (!text.startsWith('/skill:')) return text;\n const spaceIndex = text.indexOf(' ');\n const skillName = spaceIndex === -1 ? text.slice(7) : text.slice(7, spaceIndex);\n const skill = skills.find((candidate) => candidate.name === skillName);\n if (!skill) return text;\n\n try {\n const args = spaceIndex === -1 ? '' : text.slice(spaceIndex + 1).trim();\n const body = stripFrontmatter(fs.readFileSync(skill.filePath, 'utf8')).trim();\n const skillBlock = `<skill name=\"${skill.name}\" location=\"${skill.filePath}\">\\nReferences are relative to ${skill.baseDir}.\\n\\n${body}\\n</skill>`;\n return args ? `${skillBlock}\\n\\n${args}` : skillBlock;\n } catch {\n // Pi uses the same literal-text fallback if a skill disappears between\n // discovery and submission; the agent can still respond to the command.\n return text;\n }\n}\n"],"mappings":"wRAkBA,MAAM,EAAa,kCACb,EAAmB,eAazB,SAAS,GAA+B,CACtC,IAAM,EAAU,CAAC,QAAQ,KAAK,GAAI,EAAc,YAAY,GAAG,EAAG,EAAK,KAAK,QAAQ,IAAI,EAAG,CAAgB,CAAC,EAC5G,IAAK,IAAM,KAAU,EAAS,CAC5B,GAAI,CAAC,EAAQ,SACb,IAAI,EAAY,EAAK,QAAQ,EAAK,QAAQ,CAAM,CAAC,EACjD,OAAa,CACX,IAAM,EAAc,EAAK,KAAK,EAAW,eAAgB,CAAU,EAC7D,EAAe,EAAK,KAAK,EAAa,CAAgB,EAC5D,GAAI,CACF,IAAM,EAAW,KAAK,MAAM,EAAG,aAAa,EAAc,MAAM,CAAC,EACjE,GAAI,OAAO,EAAS,MAAS,SAAU,CACrC,IAAM,EAAQ,EAAK,QAAQ,EAAa,EAAS,IAAI,EACrD,GAAI,EAAG,WAAW,CAAK,EAAG,OAAO,EAAc,CAAK,CAAC,CAAC,IACxD,CACF,MAAQ,CAER,CACA,IAAM,EAAS,EAAK,QAAQ,CAAS,EACrC,GAAI,IAAW,EAAW,MAC1B,EAAY,CACd,CACF,CACA,MAAU,MAAM,kBAAkB,EAAW,sCAAsC,CACrF,CA2BA,IAAa,EAAb,KAAiC,CAC/B,GACA,GAEA,YAAY,EAAqC,CAC/C,KAAK,GAAW,CAClB,CAEA,OAAwC,CACtC,GAAI,KAAK,GAAU,OAAO,KAAK,GAE/B,GAAI,CAAC,KAAK,GAAS,UA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AS,CAC7C,MAAQ,CAGN,OAAO,CACT,CACF"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
2
2
|
//#region src/adapters/pi/extension.d.ts
|
|
3
3
|
/** The package's single standard Pi factory. */
|
|
4
|
-
declare function skillsExtension(pi: ExtensionAPI): Promise<void>;
|
|
4
|
+
export declare function skillsExtension(pi: ExtensionAPI): Promise<void>;
|
|
5
5
|
//#endregion
|
|
6
|
-
export { skillsExtension as default
|
|
6
|
+
export { skillsExtension as default };
|
|
7
7
|
//# sourceMappingURL=extension.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extension.d.cts","names":[],"sources":["../../../src/adapters/pi/extension.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"extension.d.cts","names":[],"sources":["../../../src/adapters/pi/extension.ts"],"mappings":";;;wBAoHsB,gBAAgB,IAAI,eAAe"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
2
2
|
//#region src/adapters/pi/extension.d.ts
|
|
3
3
|
/** The package's single standard Pi factory. */
|
|
4
|
-
declare function skillsExtension(pi: ExtensionAPI): Promise<void>;
|
|
4
|
+
export declare function skillsExtension(pi: ExtensionAPI): Promise<void>;
|
|
5
5
|
//#endregion
|
|
6
|
-
export { skillsExtension as default
|
|
6
|
+
export { skillsExtension as default };
|
|
7
7
|
//# sourceMappingURL=extension.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extension.d.mts","names":[],"sources":["../../../src/adapters/pi/extension.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"extension.d.mts","names":[],"sources":["../../../src/adapters/pi/extension.ts"],"mappings":";;;wBAoHsB,gBAAgB,IAAI,eAAe"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { SkillSourceContribution } from "@agimon-ai/doompi-extension-contracts/skills";
|
|
2
2
|
import { Skill } from "@earendil-works/pi-coding-agent";
|
|
3
3
|
//#region src/adapters/skillCatalog.d.ts
|
|
4
|
-
type SkillGroupKey = 'extensions' | 'help' | 'plugins' | 'default';
|
|
5
|
-
interface SkillEntry {
|
|
4
|
+
export type SkillGroupKey = 'extensions' | 'help' | 'plugins' | 'default';
|
|
5
|
+
export interface SkillEntry {
|
|
6
6
|
name: string;
|
|
7
7
|
description: string;
|
|
8
8
|
filePath: string;
|
|
@@ -20,16 +20,16 @@ interface SkillEntry {
|
|
|
20
20
|
*/
|
|
21
21
|
promptTokens?: number;
|
|
22
22
|
}
|
|
23
|
-
interface SkillOwnerNode {
|
|
23
|
+
export interface SkillOwnerNode {
|
|
24
24
|
owner: string;
|
|
25
25
|
skills: SkillEntry[];
|
|
26
26
|
}
|
|
27
|
-
interface SkillGroup {
|
|
27
|
+
export interface SkillGroup {
|
|
28
28
|
key: SkillGroupKey;
|
|
29
29
|
label: string;
|
|
30
30
|
owners: SkillOwnerNode[];
|
|
31
31
|
}
|
|
32
|
-
interface SkillCatalog {
|
|
32
|
+
export interface SkillCatalog {
|
|
33
33
|
groups: SkillGroup[];
|
|
34
34
|
skillCount: number;
|
|
35
35
|
/** Tokens the `<available_skills>` prompt block costs on every request. */
|
|
@@ -39,7 +39,7 @@ interface SkillCatalog {
|
|
|
39
39
|
/** Frontmatter and read failures, surfaced instead of thrown. */
|
|
40
40
|
diagnostics: string[];
|
|
41
41
|
}
|
|
42
|
-
interface SkillCatalogOptions {
|
|
42
|
+
export interface SkillCatalogOptions {
|
|
43
43
|
repoRoot: string;
|
|
44
44
|
/** Exact files the current selection resolved to, from `HarnessState.skillDirectories`. */
|
|
45
45
|
activeSkillDirectories: readonly string[];
|
|
@@ -49,7 +49,7 @@ interface SkillCatalogOptions {
|
|
|
49
49
|
/** Bounded Help activation and collision diagnostics. */
|
|
50
50
|
helpDiagnostics?: readonly string[];
|
|
51
51
|
}
|
|
52
|
-
declare function counter(): Promise<(text: string) => number>;
|
|
52
|
+
export declare function counter(): Promise<(text: string) => number>;
|
|
53
53
|
/**
|
|
54
54
|
* Every skill this session actually loaded, grouped by where it comes from,
|
|
55
55
|
* priced in tokens.
|
|
@@ -60,7 +60,6 @@ declare function counter(): Promise<(text: string) => number>;
|
|
|
60
60
|
* the always-on figure is the real prompt block rather than a reconstruction of
|
|
61
61
|
* it.
|
|
62
62
|
*/
|
|
63
|
-
declare function buildSkillCatalog(options: SkillCatalogOptions): Promise<SkillCatalog>;
|
|
63
|
+
export declare function buildSkillCatalog(options: SkillCatalogOptions): Promise<SkillCatalog>;
|
|
64
64
|
//#endregion
|
|
65
|
-
export { SkillCatalog, SkillCatalogOptions, SkillEntry, SkillGroup, SkillGroupKey, SkillOwnerNode, buildSkillCatalog, counter };
|
|
66
65
|
//# sourceMappingURL=skillCatalog.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skillCatalog.d.cts","names":[],"sources":["../../src/adapters/skillCatalog.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"skillCatalog.d.cts","names":[],"sources":["../../src/adapters/skillCatalog.ts"],"mappings":";;;YAUY;iBAEK;EACf;EACA;EACA;EACA;EACA,OAAO;;EAEP;EACA;;;;;;;;EAQA;;iBAGe;EACf;EACA,QAAQ;;iBAGO;EACf,KAAK;EACL;EACA,QAAQ;;iBAGO;EACf,QAAQ;EACR;;EAEA;;EAEA;;EAEA;;iBAGe;EACf;;EAEA;EACA,2BAA2B;;EAE3B,sBAAsB;;EAEtB;;wBAaoB,WAAW,SAAS;;;;;;;;;;;wBAkHpB,kBAAkB,SAAS,sBAAsB,QAAQ"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Skill } from "@earendil-works/pi-coding-agent";
|
|
2
2
|
import { SkillSourceContribution } from "@agimon-ai/doompi-extension-contracts/skills";
|
|
3
3
|
//#region src/adapters/skillCatalog.d.ts
|
|
4
|
-
type SkillGroupKey = 'extensions' | 'help' | 'plugins' | 'default';
|
|
5
|
-
interface SkillEntry {
|
|
4
|
+
export type SkillGroupKey = 'extensions' | 'help' | 'plugins' | 'default';
|
|
5
|
+
export interface SkillEntry {
|
|
6
6
|
name: string;
|
|
7
7
|
description: string;
|
|
8
8
|
filePath: string;
|
|
@@ -20,16 +20,16 @@ interface SkillEntry {
|
|
|
20
20
|
*/
|
|
21
21
|
promptTokens?: number;
|
|
22
22
|
}
|
|
23
|
-
interface SkillOwnerNode {
|
|
23
|
+
export interface SkillOwnerNode {
|
|
24
24
|
owner: string;
|
|
25
25
|
skills: SkillEntry[];
|
|
26
26
|
}
|
|
27
|
-
interface SkillGroup {
|
|
27
|
+
export interface SkillGroup {
|
|
28
28
|
key: SkillGroupKey;
|
|
29
29
|
label: string;
|
|
30
30
|
owners: SkillOwnerNode[];
|
|
31
31
|
}
|
|
32
|
-
interface SkillCatalog {
|
|
32
|
+
export interface SkillCatalog {
|
|
33
33
|
groups: SkillGroup[];
|
|
34
34
|
skillCount: number;
|
|
35
35
|
/** Tokens the `<available_skills>` prompt block costs on every request. */
|
|
@@ -39,7 +39,7 @@ interface SkillCatalog {
|
|
|
39
39
|
/** Frontmatter and read failures, surfaced instead of thrown. */
|
|
40
40
|
diagnostics: string[];
|
|
41
41
|
}
|
|
42
|
-
interface SkillCatalogOptions {
|
|
42
|
+
export interface SkillCatalogOptions {
|
|
43
43
|
repoRoot: string;
|
|
44
44
|
/** Exact files the current selection resolved to, from `HarnessState.skillDirectories`. */
|
|
45
45
|
activeSkillDirectories: readonly string[];
|
|
@@ -49,7 +49,7 @@ interface SkillCatalogOptions {
|
|
|
49
49
|
/** Bounded Help activation and collision diagnostics. */
|
|
50
50
|
helpDiagnostics?: readonly string[];
|
|
51
51
|
}
|
|
52
|
-
declare function counter(): Promise<(text: string) => number>;
|
|
52
|
+
export declare function counter(): Promise<(text: string) => number>;
|
|
53
53
|
/**
|
|
54
54
|
* Every skill this session actually loaded, grouped by where it comes from,
|
|
55
55
|
* priced in tokens.
|
|
@@ -60,7 +60,6 @@ declare function counter(): Promise<(text: string) => number>;
|
|
|
60
60
|
* the always-on figure is the real prompt block rather than a reconstruction of
|
|
61
61
|
* it.
|
|
62
62
|
*/
|
|
63
|
-
declare function buildSkillCatalog(options: SkillCatalogOptions): Promise<SkillCatalog>;
|
|
63
|
+
export declare function buildSkillCatalog(options: SkillCatalogOptions): Promise<SkillCatalog>;
|
|
64
64
|
//#endregion
|
|
65
|
-
export { SkillCatalog, SkillCatalogOptions, SkillEntry, SkillGroup, SkillGroupKey, SkillOwnerNode, buildSkillCatalog, counter };
|
|
66
65
|
//# sourceMappingURL=skillCatalog.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skillCatalog.d.mts","names":[],"sources":["../../src/adapters/skillCatalog.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"skillCatalog.d.mts","names":[],"sources":["../../src/adapters/skillCatalog.ts"],"mappings":";;;YAUY;iBAEK;EACf;EACA;EACA;EACA;EACA,OAAO;;EAEP;EACA;;;;;;;;EAQA;;iBAGe;EACf;EACA,QAAQ;;iBAGO;EACf,KAAK;EACL;EACA,QAAQ;;iBAGO;EACf,QAAQ;EACR;;EAEA;;EAEA;;EAEA;;iBAGe;EACf;;EAEA;EACA,2BAA2B;;EAE3B,sBAAsB;;EAEtB;;wBAaoB,WAAW,SAAS;;;;;;;;;;;wBAkHpB,kBAAkB,SAAS,sBAAsB,QAAQ"}
|
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
* false and would deliver the literal text. Leaving the command in the editor
|
|
8
8
|
* keeps the expansion and costs one keystroke.
|
|
9
9
|
*/
|
|
10
|
-
declare function skillInvocation(name: string): string;
|
|
10
|
+
export declare function skillInvocation(name: string): string;
|
|
11
11
|
//#endregion
|
|
12
|
-
export { skillInvocation };
|
|
13
12
|
//# sourceMappingURL=skillText.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skillText.d.cts","names":[],"sources":["../../src/services/skillText.ts"],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"skillText.d.cts","names":[],"sources":["../../src/services/skillText.ts"],"mappings":";;;;;;;;;wBAUgB,gBAAgB"}
|
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
* false and would deliver the literal text. Leaving the command in the editor
|
|
8
8
|
* keeps the expansion and costs one keystroke.
|
|
9
9
|
*/
|
|
10
|
-
declare function skillInvocation(name: string): string;
|
|
10
|
+
export declare function skillInvocation(name: string): string;
|
|
11
11
|
//#endregion
|
|
12
|
-
export { skillInvocation };
|
|
13
12
|
//# sourceMappingURL=skillText.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skillText.d.mts","names":[],"sources":["../../src/services/skillText.ts"],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"skillText.d.mts","names":[],"sources":["../../src/services/skillText.ts"],"mappings":";;;;;;;;;wBAUgB,gBAAgB"}
|
|
@@ -2,17 +2,16 @@ import { SkillCatalog, SkillEntry } from "../adapters/skillCatalog.cjs";
|
|
|
2
2
|
import { ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
3
3
|
import "@agimon-ai/doompi-ui/components/doomOverlay";
|
|
4
4
|
//#region src/tui/skillsOverlay.d.ts
|
|
5
|
-
type SkillsOverlayResult = {
|
|
5
|
+
export type SkillsOverlayResult = {
|
|
6
6
|
kind: 'invoke';
|
|
7
7
|
skill: SkillEntry;
|
|
8
8
|
} | undefined;
|
|
9
|
-
interface SkillsOverlayOptions {
|
|
9
|
+
export interface SkillsOverlayOptions {
|
|
10
10
|
catalog: SkillCatalog;
|
|
11
11
|
/** Repo root, so paths render relative rather than as absolute noise. */
|
|
12
12
|
repoRoot: string;
|
|
13
13
|
readFile?: (filePath: string) => string;
|
|
14
14
|
}
|
|
15
|
-
declare function openSkillsOverlay(ctx: ExtensionContext, options: SkillsOverlayOptions): Promise<SkillsOverlayResult>;
|
|
15
|
+
export declare function openSkillsOverlay(ctx: ExtensionContext, options: SkillsOverlayOptions): Promise<SkillsOverlayResult>;
|
|
16
16
|
//#endregion
|
|
17
|
-
export { SkillsOverlayOptions, SkillsOverlayResult, openSkillsOverlay };
|
|
18
17
|
//# sourceMappingURL=skillsOverlay.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skillsOverlay.d.cts","names":[],"sources":["../../src/tui/skillsOverlay.ts"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"skillsOverlay.d.cts","names":[],"sources":["../../src/tui/skillsOverlay.ts"],"mappings":";;;;YA4EY;EAAwB;EAAgB,OAAO;;iBAE1C;EACf,SAAS;;EAET;EACA,YAAY;;wBA+VQ,kBACpB,KAAK,kBACL,SAAS,uBACR,QAAQ"}
|
|
@@ -2,17 +2,16 @@ import { SkillCatalog, SkillEntry } from "../adapters/skillCatalog.mjs";
|
|
|
2
2
|
import { ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
3
3
|
import { DoomOverlay } from "@agimon-ai/doompi-ui/components/doomOverlay";
|
|
4
4
|
//#region src/tui/skillsOverlay.d.ts
|
|
5
|
-
type SkillsOverlayResult = {
|
|
5
|
+
export type SkillsOverlayResult = {
|
|
6
6
|
kind: 'invoke';
|
|
7
7
|
skill: SkillEntry;
|
|
8
8
|
} | undefined;
|
|
9
|
-
interface SkillsOverlayOptions {
|
|
9
|
+
export interface SkillsOverlayOptions {
|
|
10
10
|
catalog: SkillCatalog;
|
|
11
11
|
/** Repo root, so paths render relative rather than as absolute noise. */
|
|
12
12
|
repoRoot: string;
|
|
13
13
|
readFile?: (filePath: string) => string;
|
|
14
14
|
}
|
|
15
|
-
declare function openSkillsOverlay(ctx: ExtensionContext, options: SkillsOverlayOptions): Promise<SkillsOverlayResult>;
|
|
15
|
+
export declare function openSkillsOverlay(ctx: ExtensionContext, options: SkillsOverlayOptions): Promise<SkillsOverlayResult>;
|
|
16
16
|
//#endregion
|
|
17
|
-
export { SkillsOverlayOptions, SkillsOverlayResult, openSkillsOverlay };
|
|
18
17
|
//# sourceMappingURL=skillsOverlay.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skillsOverlay.d.mts","names":[],"sources":["../../src/tui/skillsOverlay.ts"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"skillsOverlay.d.mts","names":[],"sources":["../../src/tui/skillsOverlay.ts"],"mappings":";;;;YA4EY;EAAwB;EAAgB,OAAO;;iBAE1C;EACf,SAAS;;EAET;EACA,YAAY;;wBA+VQ,kBACpB,KAAK,kBACL,SAAS,uBACR,QAAQ"}
|
package/dist/types/skills.d.cts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
//#region src/types/skills.d.ts
|
|
2
|
-
declare const SKILLS_COMMAND = "skills";
|
|
3
|
-
declare const SKILL_INVOCATION_PREFIX = "/skill:";
|
|
4
|
-
declare const SKILL_COMMAND_PREFIX = "skill:";
|
|
5
|
-
declare const LEADER_SOURCE = "@agimon-ai/doompi-skill";
|
|
2
|
+
export declare const SKILLS_COMMAND = "skills";
|
|
3
|
+
export declare const SKILL_INVOCATION_PREFIX = "/skill:";
|
|
4
|
+
export declare const SKILL_COMMAND_PREFIX = "skill:";
|
|
5
|
+
export declare const LEADER_SOURCE = "@agimon-ai/doompi-skill";
|
|
6
6
|
/**
|
|
7
7
|
* The `SPC e s` binding.
|
|
8
8
|
*
|
|
9
9
|
* The label and order repeat the core extension group exactly; the registry
|
|
10
10
|
* rejects a contribution whose shared prefix disagrees.
|
|
11
11
|
*/
|
|
12
|
-
declare const SKILLS_LEADER_CONTRIBUTION: {
|
|
12
|
+
export declare const SKILLS_LEADER_CONTRIBUTION: {
|
|
13
13
|
source: string;
|
|
14
14
|
bindings: {
|
|
15
15
|
id: string;
|
|
@@ -29,5 +29,4 @@ declare const SKILLS_LEADER_CONTRIBUTION: {
|
|
|
29
29
|
}[];
|
|
30
30
|
};
|
|
31
31
|
//#endregion
|
|
32
|
-
export { LEADER_SOURCE, SKILLS_COMMAND, SKILLS_LEADER_CONTRIBUTION, SKILL_COMMAND_PREFIX, SKILL_INVOCATION_PREFIX };
|
|
33
32
|
//# sourceMappingURL=skills.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skills.d.cts","names":[],"sources":["../../src/types/skills.ts"],"mappings":";
|
|
1
|
+
{"version":3,"file":"skills.d.cts","names":[],"sources":["../../src/types/skills.ts"],"mappings":";qBAEa;qBACA;qBACA;qBACA;;;;;;;qBAQA"}
|
package/dist/types/skills.d.mts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
//#region src/types/skills.d.ts
|
|
2
|
-
declare const SKILLS_COMMAND = "skills";
|
|
3
|
-
declare const SKILL_INVOCATION_PREFIX = "/skill:";
|
|
4
|
-
declare const SKILL_COMMAND_PREFIX = "skill:";
|
|
5
|
-
declare const LEADER_SOURCE = "@agimon-ai/doompi-skill";
|
|
2
|
+
export declare const SKILLS_COMMAND = "skills";
|
|
3
|
+
export declare const SKILL_INVOCATION_PREFIX = "/skill:";
|
|
4
|
+
export declare const SKILL_COMMAND_PREFIX = "skill:";
|
|
5
|
+
export declare const LEADER_SOURCE = "@agimon-ai/doompi-skill";
|
|
6
6
|
/**
|
|
7
7
|
* The `SPC e s` binding.
|
|
8
8
|
*
|
|
9
9
|
* The label and order repeat the core extension group exactly; the registry
|
|
10
10
|
* rejects a contribution whose shared prefix disagrees.
|
|
11
11
|
*/
|
|
12
|
-
declare const SKILLS_LEADER_CONTRIBUTION: {
|
|
12
|
+
export declare const SKILLS_LEADER_CONTRIBUTION: {
|
|
13
13
|
source: string;
|
|
14
14
|
bindings: {
|
|
15
15
|
id: string;
|
|
@@ -29,5 +29,4 @@ declare const SKILLS_LEADER_CONTRIBUTION: {
|
|
|
29
29
|
}[];
|
|
30
30
|
};
|
|
31
31
|
//#endregion
|
|
32
|
-
export { LEADER_SOURCE, SKILLS_COMMAND, SKILLS_LEADER_CONTRIBUTION, SKILL_COMMAND_PREFIX, SKILL_INVOCATION_PREFIX };
|
|
33
32
|
//# sourceMappingURL=skills.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skills.d.mts","names":[],"sources":["../../src/types/skills.ts"],"mappings":";
|
|
1
|
+
{"version":3,"file":"skills.d.mts","names":[],"sources":["../../src/types/skills.ts"],"mappings":";qBAEa;qBACA;qBACA;qBACA;;;;;;;qBAQA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agimon-ai/doompi-skill",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.42",
|
|
4
4
|
"description": "Session skill catalogue, deferred skill discovery, and the skill browser for DoomPi.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agent-skills",
|
|
@@ -59,28 +59,28 @@
|
|
|
59
59
|
"access": "public"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@deepseek-ai/cordis": "4.0.
|
|
62
|
+
"@deepseek-ai/cordis": "4.0.2",
|
|
63
63
|
"gpt-tokenizer": "4.0.0",
|
|
64
|
-
"@agimon-ai/doompi-config": "0.0.1-alpha.
|
|
65
|
-
"@agimon-ai/doompi-
|
|
66
|
-
"@agimon-ai/doompi-
|
|
67
|
-
"@agimon-ai/doompi-
|
|
68
|
-
"@agimon-ai/doompi-
|
|
64
|
+
"@agimon-ai/doompi-config": "0.0.1-alpha.63",
|
|
65
|
+
"@agimon-ai/doompi-domain": "0.0.1-alpha.42",
|
|
66
|
+
"@agimon-ai/doompi-telemetry": "0.0.1-alpha.62",
|
|
67
|
+
"@agimon-ai/doompi-ui": "0.0.1-alpha.64",
|
|
68
|
+
"@agimon-ai/doompi-extension-contracts": "0.0.1-alpha.63"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
|
-
"@deepseek-ai/cordis": "4.0.
|
|
72
|
-
"@earendil-works/pi-coding-agent": "0.85.
|
|
73
|
-
"@earendil-works/pi-tui": "0.85.
|
|
74
|
-
"@types/node": "26.4.
|
|
75
|
-
"@vitest/coverage-v8": "
|
|
76
|
-
"tsdown": "0.
|
|
71
|
+
"@deepseek-ai/cordis": "4.0.2",
|
|
72
|
+
"@earendil-works/pi-coding-agent": "0.85.1",
|
|
73
|
+
"@earendil-works/pi-tui": "0.85.1",
|
|
74
|
+
"@types/node": "26.4.1",
|
|
75
|
+
"@vitest/coverage-v8": "5.0.0",
|
|
76
|
+
"tsdown": "0.23.0",
|
|
77
77
|
"typescript": "7.0.2",
|
|
78
|
-
"vitest": "
|
|
79
|
-
"@agimon-ai/vibe-lint-plugin-doom-extension": "0.0.1-alpha.
|
|
78
|
+
"vitest": "5.0.0",
|
|
79
|
+
"@agimon-ai/vibe-lint-plugin-doom-extension": "0.0.1-alpha.60"
|
|
80
80
|
},
|
|
81
81
|
"peerDependencies": {
|
|
82
|
-
"@earendil-works/pi-coding-agent": "0.85.
|
|
83
|
-
"@earendil-works/pi-tui": "0.85.
|
|
82
|
+
"@earendil-works/pi-coding-agent": "0.85.1",
|
|
83
|
+
"@earendil-works/pi-tui": "0.85.1"
|
|
84
84
|
},
|
|
85
85
|
"peerDependenciesMeta": {
|
|
86
86
|
"@earendil-works/pi-coding-agent": {
|