@powerhousedao/clint 6.2.3-dev.78 → 6.2.3-dev.80

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.
@@ -1,4 +1,4 @@
1
- import { T as renderSkillTemplate } from "./src-BdwlBh04.mjs";
1
+ import { T as renderSkillTemplate } from "./src-CruuSRSC.mjs";
2
2
  import { p as slugToTitle } from "./services-9E-r0nWl.mjs";
3
3
  import fs from "node:fs";
4
4
  import path from "node:path";
@@ -290,4 +290,4 @@ async function buildSkills(options) {
290
290
  //#endregion
291
291
  export { buildSkills };
292
292
 
293
- //# sourceMappingURL=build-skills-Bp4IR8R_.mjs.map
293
+ //# sourceMappingURL=build-skills-De9EZd6U.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"build-skills-Bp4IR8R_.mjs","names":[],"sources":["../src/dev/agent-profiles.ts","../src/dev/skill-builder.ts","../src/dev/skill-copier.ts","../src/dev/build-skills.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport path from \"node:path\";\nimport { renderSkillTemplate } from \"../index.js\";\nimport type { ResolvedBuildConfig } from \"./types.js\";\n\n/**\n * Find the first existing file across multiple include directories.\n */\nfunction findInIncludes(\n includes: string[],\n subdir: string,\n filename: string,\n): string | undefined {\n for (const dir of includes) {\n const p = path.join(dir, subdir, filename);\n if (fs.existsSync(p)) return p;\n }\n return undefined;\n}\n\n/**\n * Build agent profile instructions by rendering base+specialized template pairs.\n * Writes each profile as a Markdown file in {output}/agents/{ProfileName}.md.\n *\n * @returns Number of profiles built and any warnings.\n */\nexport function buildAgentProfiles(config: ResolvedBuildConfig): {\n count: number;\n warnings: string[];\n} {\n const log = config.logger;\n const profiles = config.agentProfiles;\n if (profiles.length === 0) return { count: 0, warnings: [] };\n\n const profilesSubdir = config.subdirs?.profiles ?? \"agent-profiles\";\n\n log(\"\\n--- Building agent instructions ---\");\n\n const allWarnings: string[] = [];\n let count = 0;\n\n for (const profile of profiles) {\n // Check all section files exist before rendering\n const sectionPaths: string[] = [];\n let missing = false;\n for (const section of profile.sections) {\n const found = findInIncludes(config.include, profilesSubdir, section);\n if (!found) {\n log(` SKIP ${profile.name}: missing section ${section}`);\n missing = true;\n break;\n }\n sectionPaths.push(found);\n }\n if (missing) continue;\n\n const agentContext = { ...config.context, agentName: profile.name };\n const renderOpts = config.customHelpers\n ? { helpers: config.customHelpers }\n : undefined;\n\n const renderedSections: string[] = [];\n for (let i = 0; i < profile.sections.length; i++) {\n const raw = fs.readFileSync(sectionPaths[i], \"utf-8\");\n const result = renderSkillTemplate(raw, agentContext, renderOpts);\n for (const w of result.warnings) {\n const msg = `${profile.name}/${profile.sections[i]}: ${w}`;\n allWarnings.push(msg);\n log(` WARN ${msg}`);\n }\n renderedSections.push(result.rendered.trim());\n }\n\n const combined = renderedSections.join(\"\\n\\n\") + \"\\n\";\n for (const out of config.output) {\n const agentsDir = path.join(out, \"agent-profiles\");\n fs.mkdirSync(agentsDir, { recursive: true });\n fs.writeFileSync(\n path.join(agentsDir, `${profile.name}.md`),\n combined,\n \"utf-8\",\n );\n }\n\n log(` OK ${profile.name} → ${profile.name}.md (${combined.length} chars)`);\n count++;\n }\n\n return { count, warnings: allWarnings };\n}\n","import fs from \"node:fs\";\nimport path from \"node:path\";\nimport { renderSkillTemplate, slugToTitle } from \"../index.js\";\nimport type { ResolvedBuildConfig } from \"./types.js\";\n\n/**\n * Find the first existing directory across multiple include paths.\n */\nfunction findSubdir(includes: string[], subdir: string): string | undefined {\n for (const dir of includes) {\n const p = path.join(dir, subdir);\n if (fs.existsSync(p)) return p;\n }\n return undefined;\n}\n\n/**\n * Build SKILL.md files from Handlebars templates in skills-tpl/.\n * Each skill directory produces a SKILL.md + references/ folder.\n *\n * @returns Number of skills built and any warnings.\n */\nexport function buildSkillTemplates(config: ResolvedBuildConfig): {\n count: number;\n warnings: string[];\n} {\n const log = config.logger;\n const skillsTplSubdir = config.subdirs?.skillsTpl ?? \"skills-tpl\";\n const skillsTplDir = findSubdir(config.include, skillsTplSubdir);\n\n log(\"\\n--- Building SKILL.md files (templates) ---\");\n\n if (!skillsTplDir) {\n log(\" No skills-tpl/ directory — skipping.\");\n return { count: 0, warnings: [] };\n }\n\n const skillDirs = fs\n .readdirSync(skillsTplDir, { withFileTypes: true })\n .filter((d) => d.isDirectory())\n .map((d) => d.name)\n .sort();\n\n const allWarnings: string[] = [];\n const renderOpts = config.customHelpers\n ? { helpers: config.customHelpers }\n : undefined;\n let count = 0;\n\n for (const skillName of skillDirs) {\n const skillDir = path.join(skillsTplDir, skillName);\n\n // Preamble\n const preamblePath = path.join(skillDir, \".preamble.md\");\n const preambleRaw = fs.existsSync(preamblePath)\n ? fs.readFileSync(preamblePath, \"utf-8\").trim()\n : \"\";\n let preamble = \"\";\n if (preambleRaw) {\n const r = renderSkillTemplate(preambleRaw, config.context, renderOpts);\n preamble = r.rendered;\n for (const w of r.warnings) {\n const msg = `${skillName}/.preamble.md: ${w}`;\n allWarnings.push(msg);\n log(` WARN ${msg}`);\n }\n }\n\n // Scenario files (NN.name.md)\n const scenarioFiles = fs\n .readdirSync(skillDir)\n .filter((f) => /^\\d+\\..*\\.md$/.test(f))\n .sort();\n\n // Result file\n const resultPath = path.join(skillDir, \".result.md\");\n const hasResult = fs.existsSync(resultPath);\n\n if (!preamble && scenarioFiles.length === 0 && !hasResult) {\n log(` SKIP ${skillName}: no content files found`);\n continue;\n }\n\n // Render references into memory\n const files: Map<string, string> = new Map();\n const refLinks: string[] = [];\n\n for (const scenarioFile of scenarioFiles) {\n const content = fs\n .readFileSync(path.join(skillDir, scenarioFile), \"utf-8\")\n .trim();\n const r = renderSkillTemplate(content, config.context, renderOpts);\n for (const w of r.warnings) {\n const msg = `${skillName}/${scenarioFile}: ${w}`;\n allWarnings.push(msg);\n log(` WARN ${msg}`);\n }\n files.set(path.join(\"references\", scenarioFile), r.rendered + \"\\n\");\n const label = slugToTitle(\n scenarioFile.replace(/^\\d+\\./, \"\").replace(/\\.md$/, \"\"),\n );\n refLinks.push(\n `* **${label}** [references/${scenarioFile}](references/${scenarioFile})`,\n );\n }\n\n if (hasResult) {\n const content = fs.readFileSync(resultPath, \"utf-8\").trim();\n const r = renderSkillTemplate(content, config.context, renderOpts);\n for (const w of r.warnings) {\n const msg = `${skillName}/.result.md: ${w}`;\n allWarnings.push(msg);\n log(` WARN ${msg}`);\n }\n files.set(\n path.join(\"references\", \"expected-outcome.md\"),\n r.rendered + \"\\n\",\n );\n refLinks.push(\n `* **Expected Outcome** [references/expected-outcome.md](references/expected-outcome.md)`,\n );\n }\n\n // Build SKILL.md\n const description =\n config.skillDescriptions[skillName] ?? `${slugToTitle(skillName)} tasks`;\n\n const frontmatter = [\n \"---\",\n `name: ${skillName}`,\n `description: \"${description}\"`,\n \"metadata:\",\n \" author: Powerhouse\",\n ' version: \"1.0.0\"',\n \"---\",\n ].join(\"\\n\");\n\n const sections = [preamble];\n if (refLinks.length > 0) {\n sections.push(\"## Specific tasks\\n\\n\" + refLinks.join(\"\\n\"));\n }\n\n const skillMd =\n frontmatter + \"\\n\\n\" + sections.filter(Boolean).join(\"\\n\\n\") + \"\\n\";\n files.set(\"SKILL.md\", skillMd);\n\n // Copy .cli-docs.md if present (render through Handlebars)\n const cliDocsPath = path.join(skillDir, \".cli-docs.md\");\n if (fs.existsSync(cliDocsPath)) {\n const cliDocsRaw = fs.readFileSync(cliDocsPath, \"utf-8\").trim();\n if (cliDocsRaw) {\n const r = renderSkillTemplate(cliDocsRaw, config.context, renderOpts);\n for (const w of r.warnings) {\n const msg = `${skillName}/.cli-docs.md: ${w}`;\n allWarnings.push(msg);\n log(` WARN ${msg}`);\n }\n files.set(\".cli-docs.md\", r.rendered + \"\\n\");\n }\n }\n\n // Write to all output directories\n for (const out of config.output) {\n const outputDir = path.join(out, \"skills\", skillName);\n for (const [relPath, content] of files) {\n const fullPath = path.join(outputDir, relPath);\n fs.mkdirSync(path.dirname(fullPath), { recursive: true });\n fs.writeFileSync(fullPath, content, \"utf-8\");\n }\n }\n\n log(\n ` OK ${skillName} → SKILL.md + ${scenarioFiles.length + (hasResult ? 1 : 0)} references (${skillMd.length} chars)`,\n );\n count++;\n }\n\n return { count, warnings: allWarnings };\n}\n","import fs from \"node:fs\";\nimport path from \"node:path\";\nimport type { ResolvedBuildConfig } from \"./types.js\";\n\n/**\n * Copy external skills from skills-ext/ to the output directory without processing.\n *\n * @returns Number of skills copied.\n */\nexport function copyExternalSkills(config: ResolvedBuildConfig): number {\n const log = config.logger;\n const skillsExtSubdir = config.subdirs?.skillsExt ?? \"skills-ext\";\n\n log(\"\\n--- Copying external skills ---\");\n\n // Search all include dirs for skills-ext/\n let found = false;\n let total = 0;\n\n for (const dir of config.include) {\n const skillsExtDir = path.join(dir, skillsExtSubdir);\n if (!fs.existsSync(skillsExtDir)) continue;\n found = true;\n\n const skillDirs = fs\n .readdirSync(skillsExtDir, { withFileTypes: true })\n .filter((d) => d.isDirectory())\n .map((d) => d.name)\n .sort();\n\n for (const skillName of skillDirs) {\n const srcDir = path.join(skillsExtDir, skillName);\n for (const out of config.output) {\n fs.cpSync(srcDir, path.join(out, \"skills\", skillName), {\n recursive: true,\n });\n }\n log(` OK ${skillName} → copied as-is`);\n }\n\n total += skillDirs.length;\n }\n\n if (!found) {\n log(\" No skills-ext/ directory — skipping.\");\n }\n\n return total;\n}\n","import fs from \"node:fs\";\nimport path from \"node:path\";\nimport { buildAgentProfiles } from \"./agent-profiles.js\";\nimport { buildSkillTemplates } from \"./skill-builder.js\";\nimport { copyExternalSkills } from \"./skill-copier.js\";\nimport type { AgentProfile, ResolvedBuildConfig } from \"./types.js\";\n\n/**\n * Path-driven skill/profile compilation (ph-clint-dev's pipeline, decoupled\n * from the old BuildConfig.cli metadata coupling). Conventions:\n *\n * <skillsDir>/ include root (default: prompts/ then agents/)\n * agent-profiles/ profile section templates\n * skills-tpl/<skill>/ Handlebars skill templates → SKILL.md\n * skills-ext/<skill>/ external skills copied as-is\n * profiles.json optional [{ name, sections: [...] }]\n *\n * Output: <outDir> (default: dist/skills).\n */\nexport interface BuildSkillsOptions {\n rootDir: string;\n skillsDir?: string;\n agentsDir?: string;\n outDir?: string;\n context?: Record<string, unknown>;\n logger?: (msg: string) => void;\n}\n\nexport interface BuildSkillsResult {\n skills: number;\n profiles: number;\n copied: number;\n warnings: string[];\n outDir: string;\n}\n\nfunction firstExisting(\n rootDir: string,\n candidates: (string | undefined)[],\n): string[] {\n const dirs: string[] = [];\n for (const candidate of candidates) {\n if (!candidate) continue;\n const abs = path.resolve(rootDir, candidate);\n if (fs.existsSync(abs)) dirs.push(abs);\n }\n return dirs;\n}\n\nfunction readProfilesManifest(include: string[]): AgentProfile[] {\n for (const dir of include) {\n const manifest = path.join(dir, \"profiles.json\");\n if (fs.existsSync(manifest)) {\n try {\n return JSON.parse(fs.readFileSync(manifest, \"utf8\")) as AgentProfile[];\n } catch {\n return [];\n }\n }\n }\n return [];\n}\n\nexport async function buildSkills(\n options: BuildSkillsOptions,\n): Promise<BuildSkillsResult> {\n const log = options.logger ?? console.log;\n const include = firstExisting(options.rootDir, [\n options.skillsDir,\n options.agentsDir,\n \"prompts\",\n \"agents\",\n ]);\n const outDir = path.resolve(options.rootDir, options.outDir ?? \"dist/skills\");\n\n if (include.length === 0) {\n log(\n \"No prompt template directories found (prompts/ or agents/) — nothing to build.\",\n );\n return { skills: 0, profiles: 0, copied: 0, warnings: [], outDir };\n }\n\n const resolved: ResolvedBuildConfig = {\n include,\n output: [outDir],\n context: { builtAt: new Date().toISOString(), ...options.context },\n agentProfiles: readProfilesManifest(include),\n skillDescriptions: {},\n clean: true,\n logger: log,\n };\n\n for (const dir of resolved.output) {\n if (fs.existsSync(dir)) fs.rmSync(dir, { recursive: true });\n }\n\n const profiles = buildAgentProfiles(resolved);\n const templates = buildSkillTemplates(resolved);\n const copied = copyExternalSkills(resolved);\n\n return {\n skills: templates.count,\n profiles: profiles.count,\n copied,\n warnings: [...profiles.warnings, ...templates.warnings],\n outDir,\n };\n}\n"],"mappings":";;;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-De9EZd6U.mjs","names":[],"sources":["../src/dev/agent-profiles.ts","../src/dev/skill-builder.ts","../src/dev/skill-copier.ts","../src/dev/build-skills.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport path from \"node:path\";\nimport { renderSkillTemplate } from \"../index.js\";\nimport type { ResolvedBuildConfig } from \"./types.js\";\n\n/**\n * Find the first existing file across multiple include directories.\n */\nfunction findInIncludes(\n includes: string[],\n subdir: string,\n filename: string,\n): string | undefined {\n for (const dir of includes) {\n const p = path.join(dir, subdir, filename);\n if (fs.existsSync(p)) return p;\n }\n return undefined;\n}\n\n/**\n * Build agent profile instructions by rendering base+specialized template pairs.\n * Writes each profile as a Markdown file in {output}/agents/{ProfileName}.md.\n *\n * @returns Number of profiles built and any warnings.\n */\nexport function buildAgentProfiles(config: ResolvedBuildConfig): {\n count: number;\n warnings: string[];\n} {\n const log = config.logger;\n const profiles = config.agentProfiles;\n if (profiles.length === 0) return { count: 0, warnings: [] };\n\n const profilesSubdir = config.subdirs?.profiles ?? \"agent-profiles\";\n\n log(\"\\n--- Building agent instructions ---\");\n\n const allWarnings: string[] = [];\n let count = 0;\n\n for (const profile of profiles) {\n // Check all section files exist before rendering\n const sectionPaths: string[] = [];\n let missing = false;\n for (const section of profile.sections) {\n const found = findInIncludes(config.include, profilesSubdir, section);\n if (!found) {\n log(` SKIP ${profile.name}: missing section ${section}`);\n missing = true;\n break;\n }\n sectionPaths.push(found);\n }\n if (missing) continue;\n\n const agentContext = { ...config.context, agentName: profile.name };\n const renderOpts = config.customHelpers\n ? { helpers: config.customHelpers }\n : undefined;\n\n const renderedSections: string[] = [];\n for (let i = 0; i < profile.sections.length; i++) {\n const raw = fs.readFileSync(sectionPaths[i], \"utf-8\");\n const result = renderSkillTemplate(raw, agentContext, renderOpts);\n for (const w of result.warnings) {\n const msg = `${profile.name}/${profile.sections[i]}: ${w}`;\n allWarnings.push(msg);\n log(` WARN ${msg}`);\n }\n renderedSections.push(result.rendered.trim());\n }\n\n const combined = renderedSections.join(\"\\n\\n\") + \"\\n\";\n for (const out of config.output) {\n const agentsDir = path.join(out, \"agent-profiles\");\n fs.mkdirSync(agentsDir, { recursive: true });\n fs.writeFileSync(\n path.join(agentsDir, `${profile.name}.md`),\n combined,\n \"utf-8\",\n );\n }\n\n log(` OK ${profile.name} → ${profile.name}.md (${combined.length} chars)`);\n count++;\n }\n\n return { count, warnings: allWarnings };\n}\n","import fs from \"node:fs\";\nimport path from \"node:path\";\nimport { renderSkillTemplate, slugToTitle } from \"../index.js\";\nimport type { ResolvedBuildConfig } from \"./types.js\";\n\n/**\n * Find the first existing directory across multiple include paths.\n */\nfunction findSubdir(includes: string[], subdir: string): string | undefined {\n for (const dir of includes) {\n const p = path.join(dir, subdir);\n if (fs.existsSync(p)) return p;\n }\n return undefined;\n}\n\n/**\n * Build SKILL.md files from Handlebars templates in skills-tpl/.\n * Each skill directory produces a SKILL.md + references/ folder.\n *\n * @returns Number of skills built and any warnings.\n */\nexport function buildSkillTemplates(config: ResolvedBuildConfig): {\n count: number;\n warnings: string[];\n} {\n const log = config.logger;\n const skillsTplSubdir = config.subdirs?.skillsTpl ?? \"skills-tpl\";\n const skillsTplDir = findSubdir(config.include, skillsTplSubdir);\n\n log(\"\\n--- Building SKILL.md files (templates) ---\");\n\n if (!skillsTplDir) {\n log(\" No skills-tpl/ directory — skipping.\");\n return { count: 0, warnings: [] };\n }\n\n const skillDirs = fs\n .readdirSync(skillsTplDir, { withFileTypes: true })\n .filter((d) => d.isDirectory())\n .map((d) => d.name)\n .sort();\n\n const allWarnings: string[] = [];\n const renderOpts = config.customHelpers\n ? { helpers: config.customHelpers }\n : undefined;\n let count = 0;\n\n for (const skillName of skillDirs) {\n const skillDir = path.join(skillsTplDir, skillName);\n\n // Preamble\n const preamblePath = path.join(skillDir, \".preamble.md\");\n const preambleRaw = fs.existsSync(preamblePath)\n ? fs.readFileSync(preamblePath, \"utf-8\").trim()\n : \"\";\n let preamble = \"\";\n if (preambleRaw) {\n const r = renderSkillTemplate(preambleRaw, config.context, renderOpts);\n preamble = r.rendered;\n for (const w of r.warnings) {\n const msg = `${skillName}/.preamble.md: ${w}`;\n allWarnings.push(msg);\n log(` WARN ${msg}`);\n }\n }\n\n // Scenario files (NN.name.md)\n const scenarioFiles = fs\n .readdirSync(skillDir)\n .filter((f) => /^\\d+\\..*\\.md$/.test(f))\n .sort();\n\n // Result file\n const resultPath = path.join(skillDir, \".result.md\");\n const hasResult = fs.existsSync(resultPath);\n\n if (!preamble && scenarioFiles.length === 0 && !hasResult) {\n log(` SKIP ${skillName}: no content files found`);\n continue;\n }\n\n // Render references into memory\n const files: Map<string, string> = new Map();\n const refLinks: string[] = [];\n\n for (const scenarioFile of scenarioFiles) {\n const content = fs\n .readFileSync(path.join(skillDir, scenarioFile), \"utf-8\")\n .trim();\n const r = renderSkillTemplate(content, config.context, renderOpts);\n for (const w of r.warnings) {\n const msg = `${skillName}/${scenarioFile}: ${w}`;\n allWarnings.push(msg);\n log(` WARN ${msg}`);\n }\n files.set(path.join(\"references\", scenarioFile), r.rendered + \"\\n\");\n const label = slugToTitle(\n scenarioFile.replace(/^\\d+\\./, \"\").replace(/\\.md$/, \"\"),\n );\n refLinks.push(\n `* **${label}** [references/${scenarioFile}](references/${scenarioFile})`,\n );\n }\n\n if (hasResult) {\n const content = fs.readFileSync(resultPath, \"utf-8\").trim();\n const r = renderSkillTemplate(content, config.context, renderOpts);\n for (const w of r.warnings) {\n const msg = `${skillName}/.result.md: ${w}`;\n allWarnings.push(msg);\n log(` WARN ${msg}`);\n }\n files.set(\n path.join(\"references\", \"expected-outcome.md\"),\n r.rendered + \"\\n\",\n );\n refLinks.push(\n `* **Expected Outcome** [references/expected-outcome.md](references/expected-outcome.md)`,\n );\n }\n\n // Build SKILL.md\n const description =\n config.skillDescriptions[skillName] ?? `${slugToTitle(skillName)} tasks`;\n\n const frontmatter = [\n \"---\",\n `name: ${skillName}`,\n `description: \"${description}\"`,\n \"metadata:\",\n \" author: Powerhouse\",\n ' version: \"1.0.0\"',\n \"---\",\n ].join(\"\\n\");\n\n const sections = [preamble];\n if (refLinks.length > 0) {\n sections.push(\"## Specific tasks\\n\\n\" + refLinks.join(\"\\n\"));\n }\n\n const skillMd =\n frontmatter + \"\\n\\n\" + sections.filter(Boolean).join(\"\\n\\n\") + \"\\n\";\n files.set(\"SKILL.md\", skillMd);\n\n // Copy .cli-docs.md if present (render through Handlebars)\n const cliDocsPath = path.join(skillDir, \".cli-docs.md\");\n if (fs.existsSync(cliDocsPath)) {\n const cliDocsRaw = fs.readFileSync(cliDocsPath, \"utf-8\").trim();\n if (cliDocsRaw) {\n const r = renderSkillTemplate(cliDocsRaw, config.context, renderOpts);\n for (const w of r.warnings) {\n const msg = `${skillName}/.cli-docs.md: ${w}`;\n allWarnings.push(msg);\n log(` WARN ${msg}`);\n }\n files.set(\".cli-docs.md\", r.rendered + \"\\n\");\n }\n }\n\n // Write to all output directories\n for (const out of config.output) {\n const outputDir = path.join(out, \"skills\", skillName);\n for (const [relPath, content] of files) {\n const fullPath = path.join(outputDir, relPath);\n fs.mkdirSync(path.dirname(fullPath), { recursive: true });\n fs.writeFileSync(fullPath, content, \"utf-8\");\n }\n }\n\n log(\n ` OK ${skillName} → SKILL.md + ${scenarioFiles.length + (hasResult ? 1 : 0)} references (${skillMd.length} chars)`,\n );\n count++;\n }\n\n return { count, warnings: allWarnings };\n}\n","import fs from \"node:fs\";\nimport path from \"node:path\";\nimport type { ResolvedBuildConfig } from \"./types.js\";\n\n/**\n * Copy external skills from skills-ext/ to the output directory without processing.\n *\n * @returns Number of skills copied.\n */\nexport function copyExternalSkills(config: ResolvedBuildConfig): number {\n const log = config.logger;\n const skillsExtSubdir = config.subdirs?.skillsExt ?? \"skills-ext\";\n\n log(\"\\n--- Copying external skills ---\");\n\n // Search all include dirs for skills-ext/\n let found = false;\n let total = 0;\n\n for (const dir of config.include) {\n const skillsExtDir = path.join(dir, skillsExtSubdir);\n if (!fs.existsSync(skillsExtDir)) continue;\n found = true;\n\n const skillDirs = fs\n .readdirSync(skillsExtDir, { withFileTypes: true })\n .filter((d) => d.isDirectory())\n .map((d) => d.name)\n .sort();\n\n for (const skillName of skillDirs) {\n const srcDir = path.join(skillsExtDir, skillName);\n for (const out of config.output) {\n fs.cpSync(srcDir, path.join(out, \"skills\", skillName), {\n recursive: true,\n });\n }\n log(` OK ${skillName} → copied as-is`);\n }\n\n total += skillDirs.length;\n }\n\n if (!found) {\n log(\" No skills-ext/ directory — skipping.\");\n }\n\n return total;\n}\n","import fs from \"node:fs\";\nimport path from \"node:path\";\nimport { buildAgentProfiles } from \"./agent-profiles.js\";\nimport { buildSkillTemplates } from \"./skill-builder.js\";\nimport { copyExternalSkills } from \"./skill-copier.js\";\nimport type { AgentProfile, ResolvedBuildConfig } from \"./types.js\";\n\n/**\n * Path-driven skill/profile compilation (ph-clint-dev's pipeline, decoupled\n * from the old BuildConfig.cli metadata coupling). Conventions:\n *\n * <skillsDir>/ include root (default: prompts/ then agents/)\n * agent-profiles/ profile section templates\n * skills-tpl/<skill>/ Handlebars skill templates → SKILL.md\n * skills-ext/<skill>/ external skills copied as-is\n * profiles.json optional [{ name, sections: [...] }]\n *\n * Output: <outDir> (default: dist/skills).\n */\nexport interface BuildSkillsOptions {\n rootDir: string;\n skillsDir?: string;\n agentsDir?: string;\n outDir?: string;\n context?: Record<string, unknown>;\n logger?: (msg: string) => void;\n}\n\nexport interface BuildSkillsResult {\n skills: number;\n profiles: number;\n copied: number;\n warnings: string[];\n outDir: string;\n}\n\nfunction firstExisting(\n rootDir: string,\n candidates: (string | undefined)[],\n): string[] {\n const dirs: string[] = [];\n for (const candidate of candidates) {\n if (!candidate) continue;\n const abs = path.resolve(rootDir, candidate);\n if (fs.existsSync(abs)) dirs.push(abs);\n }\n return dirs;\n}\n\nfunction readProfilesManifest(include: string[]): AgentProfile[] {\n for (const dir of include) {\n const manifest = path.join(dir, \"profiles.json\");\n if (fs.existsSync(manifest)) {\n try {\n return JSON.parse(fs.readFileSync(manifest, \"utf8\")) as AgentProfile[];\n } catch {\n return [];\n }\n }\n }\n return [];\n}\n\nexport async function buildSkills(\n options: BuildSkillsOptions,\n): Promise<BuildSkillsResult> {\n const log = options.logger ?? console.log;\n const include = firstExisting(options.rootDir, [\n options.skillsDir,\n options.agentsDir,\n \"prompts\",\n \"agents\",\n ]);\n const outDir = path.resolve(options.rootDir, options.outDir ?? \"dist/skills\");\n\n if (include.length === 0) {\n log(\n \"No prompt template directories found (prompts/ or agents/) — nothing to build.\",\n );\n return { skills: 0, profiles: 0, copied: 0, warnings: [], outDir };\n }\n\n const resolved: ResolvedBuildConfig = {\n include,\n output: [outDir],\n context: { builtAt: new Date().toISOString(), ...options.context },\n agentProfiles: readProfilesManifest(include),\n skillDescriptions: {},\n clean: true,\n logger: log,\n };\n\n for (const dir of resolved.output) {\n if (fs.existsSync(dir)) fs.rmSync(dir, { recursive: true });\n }\n\n const profiles = buildAgentProfiles(resolved);\n const templates = buildSkillTemplates(resolved);\n const copied = copyExternalSkills(resolved);\n\n return {\n skills: templates.count,\n profiles: profiles.count,\n copied,\n warnings: [...profiles.warnings, ...templates.warnings],\n outDir,\n };\n}\n"],"mappings":";;;;;;;;AAQA,SAAS,eACP,UACA,QACA,UACoB;CACpB,KAAK,MAAM,OAAO,UAAU;EAC1B,MAAM,IAAI,KAAK,KAAK,KAAK,QAAQ,QAAQ;EACzC,IAAI,GAAG,WAAW,CAAC,GAAG,OAAO;CAC/B;AAEF;;;;;;;AAQA,SAAgB,mBAAmB,QAGjC;CACA,MAAM,MAAM,OAAO;CACnB,MAAM,WAAW,OAAO;CACxB,IAAI,SAAS,WAAW,GAAG,OAAO;EAAE,OAAO;EAAG,UAAU,CAAC;CAAE;CAE3D,MAAM,iBAAiB,OAAO,SAAS,YAAY;CAEnD,IAAI,uCAAuC;CAE3C,MAAM,cAAwB,CAAC;CAC/B,IAAI,QAAQ;CAEZ,KAAK,MAAM,WAAW,UAAU;EAE9B,MAAM,eAAyB,CAAC;EA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Q,SAAS,QAAQ,UAAU,aAAa;CAE5E,IAAI,QAAQ,WAAW,GAAG;EACxB,IACE,gFACF;EACA,OAAO;GAAE,QAAQ;GAAG,UAAU;GAAG,QAAQ;GAAG,UAAU,CAAC;GAAG;EAAO;CACnE;CAEA,MAAM,WAAgC;EACpC;EACA,QAAQ,CAAC,MAAM;EACf,SAAS;GAAE,0BAAS,IAAI,KAAK,EAAA,CAAE,YAAY;GAAG,GAAG,QAAQ;EAAQ;EACjE,eAAe,qBAAqB,OAAO;EAC3C,mBAAmB,CAAC;EACpB,OAAO;EACP,QAAQ;CACV;CAEA,KAAK,MAAM,OAAO,SAAS,QACzB,IAAI,GAAG,WAAW,GAAG,GAAG,GAAG,OAAO,KAAK,EAAE,WAAW,KAAK,CAAC;CAG5D,MAAM,WAAW,mBAAmB,QAAQ;CAC5C,MAAM,YAAY,oBAAoB,QAAQ;CAC9C,MAAM,SAAS,mBAAmB,QAAQ;CAE1C,OAAO;EACL,QAAQ,UAAU;EAClB,UAAU,SAAS;EACnB;EACA,UAAU,CAAC,GAAG,SAAS,UAAU,GAAG,UAAU,QAAQ;EACtD;CACF;AACF"}
@@ -44,8 +44,10 @@ async function ensureDrive(reactorModule, driveConfig) {
44
44
  }
45
45
  let driveId;
46
46
  if (wantedId || preferredEditor) {
47
- const doc = (await client.getDocumentModelModule(DRIVE_DOCUMENT_TYPE)).utils.createDocument();
48
- if (wantedId) doc.header.id = wantedId;
47
+ const doc = await client.newDocument(DRIVE_DOCUMENT_TYPE, wantedId ? {
48
+ signaturePolicy: "legacy",
49
+ id: wantedId
50
+ } : void 0);
49
51
  if (preferredEditor) doc.header.meta = { preferredEditor };
50
52
  driveId = (await client.create(doc)).header.id;
51
53
  } else driveId = (await client.createEmpty(DRIVE_DOCUMENT_TYPE)).header.id;
@@ -79,4 +81,4 @@ async function ensureRemoteDrive(reactorModule, url, name) {
79
81
  //#endregion
80
82
  export { drive_exports as t };
81
83
 
82
- //# sourceMappingURL=drive-CNCPoCNs.mjs.map
84
+ //# sourceMappingURL=drive-BEshRPDR.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"drive-BEshRPDR.mjs","names":[],"sources":["../src/integrations/powerhouse/drive.ts"],"sourcesContent":["/**\n * Drive management — find or create drives on startup.\n */\n\nimport type { DriveConfig, ReactorClientModule } from \"./types.js\";\n\nconst DRIVE_DOCUMENT_TYPE = \"powerhouse/document-drive\" as const;\n\n/**\n * Ensure a drive exists, matching by name. On first run, creates a new drive.\n * On subsequent runs, finds the existing one by name.\n *\n * The Reactor client has no `getDrives()` — drives are documents of type\n * `powerhouse/document-drive`. We use `reactor.findByType()` to locate\n * existing ones and `client.createEmpty()` + `client.rename()` to create.\n *\n * @param reactorModule - The full ReactorClientModule (needs .client and .reactor)\n * @param driveConfig - Optional drive name/icon configuration\n * @returns The drive ID and name\n */\nexport async function ensureDrive(\n reactorModule: ReactorClientModule,\n driveConfig?: DriveConfig,\n): Promise<{ id: string; name: string }> {\n const { client, reactor } = reactorModule;\n const driveName = driveConfig?.name ?? \"default\";\n const wantedId = driveConfig?.id;\n const preferredEditor = driveConfig?.preferredEditor;\n\n // Find existing document-drive documents\n const existing = await reactor.findByType(DRIVE_DOCUMENT_TYPE);\n if (existing?.results?.length) {\n // If a deterministic ID was requested, check if it already exists\n if (wantedId) {\n const match = existing.results.find((r) => r.header.id === wantedId);\n if (match) return { id: wantedId, name: driveName };\n }\n\n // Match by name — load each to check\n for (const result of existing.results) {\n const doc = (await client.get(result.header.id)) as any;\n const docName = doc.name ?? doc.header?.name ?? doc.state?.global?.name;\n if (docName === driveName) {\n return { id: result.header.id, name: driveName };\n }\n }\n // No name match — if default name and single drive, use it\n if (driveName === \"default\" && existing.results.length === 1) {\n return { id: existing.results[0].header.id, name: driveName };\n }\n }\n\n // Create a new drive document. Goes through the doc-build path when a\n // deterministic id or preferredEditor is set so we can populate the\n // header before persistence; falls back to createEmpty otherwise.\n let driveId: string;\n if (wantedId || preferredEditor) {\n // Only a legacy drive can take a chosen id.\n const doc = await client.newDocument(\n DRIVE_DOCUMENT_TYPE,\n wantedId ? { signaturePolicy: \"legacy\", id: wantedId } : undefined,\n );\n if (preferredEditor) doc.header.meta = { preferredEditor };\n const created = await client.create(doc);\n driveId = (created as any).header.id;\n } else {\n const drive = await client.createEmpty(DRIVE_DOCUMENT_TYPE);\n driveId = drive.header.id;\n }\n\n await client.rename(driveId, driveName);\n return { id: driveId, name: driveName };\n}\n\n/**\n * Ensure a remote drive is connected for watching.\n * Uses the reactor client's addRemoteDrive capability.\n *\n * @param reactorModule - The full ReactorClientModule\n * @param url - The Switchboard URL to sync from\n * @param name - Display name for the drive\n * @returns The drive ID and name\n */\nexport async function ensureRemoteDrive(\n reactorModule: ReactorClientModule,\n url: string,\n name: string,\n): Promise<{ id: string; name: string }> {\n const { client } = reactorModule;\n\n // addRemoteDrive is idempotent — calling again for the same URL\n // returns the existing drive\n const result = await (client as any).addRemoteDrive(url);\n const driveId = result.header?.id ?? result.id;\n\n if (name) {\n try {\n await client.rename(driveId, name);\n } catch {\n // Rename may fail for remote drives — non-fatal\n }\n }\n\n return { id: driveId, name };\n}\n"],"mappings":";;;;;;AAMA,MAAM,sBAAsB;;;;;;;;;;;;;AAc5B,eAAsB,YACpB,eACA,aACuC;CACvC,MAAM,EAAE,QAAQ,YAAY;CAC5B,MAAM,YAAY,aAAa,QAAQ;CACvC,MAAM,WAAW,aAAa;CAC9B,MAAM,kBAAkB,aAAa;CAGrC,MAAM,WAAW,MAAM,QAAQ,WAAW,mBAAmB;CAC7D,IAAI,UAAU,SAAS,QAAQ;EAE7B,IAAI,UACY;OAAA,SAAS,QAAQ,MAAM,MAAM,EAAE,OAAO,OAAO,QACnD,GAAG,OAAO;IAAE,IAAI;IAAU,MAAM;GAAU;EAAA;EAIpD,KAAK,MAAM,UAAU,SAAS,SAAS;GACrC,MAAM,MAAO,MAAM,OAAO,IAAI,OAAO,OAAO,EAAE;GAE9C,KADgB,IAAI,QAAQ,IAAI,QAAQ,QAAQ,IAAI,OAAO,QAAQ,UACnD,WACd,OAAO;IAAE,IAAI,OAAO,OAAO;IAAI,MAAM;GAAU;EAEnD;EAEA,IAAI,cAAc,aAAa,SAAS,QAAQ,WAAW,GACzD,OAAO;GAAE,IAAI,SAAS,QAAQ,EAAE,CAAC,OAAO;GAAI,MAAM;EAAU;CAEhE;CAKA,IAAI;CACJ,IAAI,YAAY,iBAAiB;EAE/B,MAAM,MAAM,MAAM,OAAO,YACvB,qBACA,WAAW;GAAE,iBAAiB;GAAU,IAAI;EAAS,IAAI,KAAA,CAC3D;EACA,IAAI,iBAAiB,IAAI,OAAO,OAAO,EAAE,gBAAgB;EAEzD,WAAW,MADW,OAAO,OAAO,GAAG,EAAA,CACZ,OAAO;CACpC,OAEE,WAAU,MADU,OAAO,YAAY,mBAAmB,EAAA,CAC1C,OAAO;CAGzB,MAAM,OAAO,OAAO,SAAS,SAAS;CACtC,OAAO;EAAE,IAAI;EAAS,MAAM;CAAU;AACxC;;;;;;;;;;AAWA,eAAsB,kBACpB,eACA,KACA,MACuC;CACvC,MAAM,EAAE,WAAW;CAInB,MAAM,SAAS,MAAO,OAAe,eAAe,GAAG;CACvD,MAAM,UAAU,OAAO,QAAQ,MAAM,OAAO;CAE5C,IAAI,MACF,IAAI;EACF,MAAM,OAAO,OAAO,SAAS,IAAI;CACnC,QAAQ,CAER;CAGF,OAAO;EAAE,IAAI;EAAS;CAAK;AAC7B"}
@@ -109,8 +109,10 @@ function createFolderOperations(client, personalDriveId, log) {
109
109
  async function createDocument(documentType, folderPath, name) {
110
110
  log?.debug(`${TAG} createDocument type=${documentType} folder="${folderPath}" name=${name ?? "(none)"}`);
111
111
  const parentFolderId = await ensureFolder(folderPath);
112
- const doc = (await client.getDocumentModelModule(documentType)).utils.createDocument();
113
- if (name) doc.header.name = name;
112
+ const doc = await client.newDocument(documentType, {
113
+ parentIdentifier: personalDriveId,
114
+ name
115
+ });
114
116
  await client.drives.addFile(personalDriveId, doc, parentFolderId);
115
117
  log?.debug(`${TAG} createDocument ${doc.header.id.slice(0, 8)}… created in folder ${parentFolderId.slice(0, 8)}…`);
116
118
  return { documentId: doc.header.id };
@@ -251,4 +253,4 @@ function createFolderCommands(folderOps) {
251
253
  //#endregion
252
254
  export { folders_exports as t };
253
255
 
254
- //# sourceMappingURL=folders-mLL9D5Ck.mjs.map
256
+ //# sourceMappingURL=folders-C-pFsTXT.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"folders-C-pFsTXT.mjs","names":[],"sources":["../src/integrations/powerhouse/folders.ts"],"sourcesContent":["/**\n * FolderOperations — programmatic API for managing documents\n * in the agent's personal drive using the drive's internal node tree.\n *\n * Folders and file references are stored as nodes in the drive document's\n * `state.global.nodes` array, managed via ADD_FOLDER and ADD_FILE operations.\n * This is distinct from the parent-child document graph (addRelationship/getOutgoingRelationships).\n *\n * Also exports `createFolderCommands()` to auto-generate CLI commands\n * that wrap the folder operations.\n */\nimport { randomUUID } from \"node:crypto\";\nimport { z } from \"zod\";\nimport type { TypedReactorClient } from \"./types.js\";\nimport type { FolderEntry, FolderOperations } from \"./types.js\";\nimport type { Command } from \"../../core/types.js\";\nimport type { Logger } from \"../../core/types.js\";\n\nconst TAG = \"[folders]\";\n\n/** Node shape from drive state.global.nodes */\ninterface DriveNode {\n id: string;\n name: string;\n kind: string;\n parentFolder?: string | null;\n documentType?: string;\n}\n\nfunction isFolder(node: DriveNode): boolean {\n return node.kind === \"folder\";\n}\n\n/**\n * Read the drive document's internal nodes array.\n */\nasync function getDriveNodes(\n client: TypedReactorClient<any>,\n driveId: string,\n): Promise<DriveNode[]> {\n const drive = (await client.get(driveId)) as any;\n return (drive?.state?.global?.nodes ?? []) as DriveNode[];\n}\n\n/**\n * Create a FolderOperations instance backed by the reactor client.\n *\n * Folders are nodes inside the drive document's `state.global.nodes` array,\n * created via `ADD_FOLDER` and `ADD_FILE` drive operations executed on the\n * personal drive. This is separate from the document relationship graph.\n */\nexport function createFolderOperations(\n client: TypedReactorClient<any>,\n personalDriveId: string,\n log?: Logger,\n): FolderOperations {\n /**\n * Lazy-load drive action creators from @powerhousedao/shared.\n * Kept lazy so that importing folders.ts doesn't pull in the entire\n * @powerhousedao/shared tree — which is an optional peer dependency\n * and won't be installed in non-Powerhouse projects.\n */\n let _driveActions: {\n addFolder: (input: {\n id: string;\n name: string;\n parentFolder: string | null;\n }) => unknown;\n addFile: (input: {\n id: string;\n name: string;\n documentType: string;\n parentFolder: string | null;\n }) => unknown;\n deleteNode: (input: { id: string }) => unknown;\n } | null = null;\n\n async function getDriveActions() {\n if (!_driveActions) {\n const mod = (await import(\"@powerhousedao/shared/document-drive\")) as any;\n _driveActions = {\n addFolder: mod.addFolder,\n addFile: mod.addFile,\n deleteNode: mod.deleteNode,\n };\n }\n return _driveActions;\n }\n\n function splitPath(folderPath: string): string[] {\n return folderPath.split(\"/\").filter(Boolean);\n }\n\n /**\n * Find a folder node by name under a given parent in the drive's nodes.\n */\n function findFolderInNodes(\n nodes: DriveNode[],\n name: string,\n parentId: string | null,\n ): DriveNode | undefined {\n return nodes.find(\n (n) =>\n isFolder(n) && n.name === name && (n.parentFolder ?? null) === parentId,\n );\n }\n\n async function ensureFolder(folderPath: string): Promise<string> {\n const segments = splitPath(folderPath);\n let parentFolderId: string | null = null;\n\n for (const segment of segments) {\n const nodes = await getDriveNodes(client, personalDriveId);\n const existing = findFolderInNodes(nodes, segment, parentFolderId);\n\n if (existing) {\n log?.debug(\n `${TAG} ensureFolder segment \"${segment}\" → exists ${existing.id.slice(0, 8)}…`,\n );\n parentFolderId = existing.id;\n continue;\n }\n\n // Create folder node inside the drive via ADD_FOLDER operation\n const folderId = randomUUID();\n log?.debug(\n `${TAG} ensureFolder creating folder \"${segment}\" (${folderId.slice(0, 8)}…) ` +\n `under ${parentFolderId?.slice(0, 8) ?? \"root\"}`,\n );\n const actions = await getDriveActions();\n await client.execute(personalDriveId, \"main\", [\n actions.addFolder({\n id: folderId,\n name: segment,\n parentFolder: parentFolderId,\n }),\n ]);\n parentFolderId = folderId;\n }\n\n return parentFolderId!;\n }\n\n async function addDocument(\n documentId: string,\n folderPath: string,\n name?: string,\n ): Promise<void> {\n log?.debug(\n `${TAG} addDocument ${documentId.slice(0, 8)}… to \"${folderPath}\" name=${name ?? \"(none)\"}`,\n );\n const folderId = await ensureFolder(folderPath);\n\n // Check if this document is already registered as a file node in the drive\n const nodes = await getDriveNodes(client, personalDriveId);\n const existingFile = nodes.find((n) => !isFolder(n) && n.id === documentId);\n if (existingFile) {\n log?.debug(\n `${TAG} addDocument ${documentId.slice(0, 8)}… already in drive as \"${existingFile.name}\"`,\n );\n return;\n }\n\n // Get the document to read its type\n const doc = (await client.get(documentId)) as any;\n const documentType =\n doc?.header?.documentType ?? doc?.documentType ?? \"unknown\";\n const displayName = name ?? doc?.header?.name ?? doc?.name ?? documentId;\n\n // Add file node to drive via ADD_FILE operation\n const actions = await getDriveActions();\n await client.execute(personalDriveId, \"main\", [\n actions.addFile({\n id: documentId,\n name: displayName,\n documentType,\n parentFolder: folderId,\n }),\n ]);\n\n // Also establish the parent-child relationship in the document graph\n await client.addRelationship(personalDriveId, documentId, \"child\");\n\n if (name) {\n await client.rename(documentId, name);\n }\n\n log?.debug(\n `${TAG} addDocument ${documentId.slice(0, 8)}… added as \"${displayName}\" in folder ${folderId.slice(0, 8)}…`,\n );\n }\n\n async function createDocument(\n documentType: string,\n folderPath: string,\n name?: string,\n ): Promise<{ documentId: string }> {\n log?.debug(\n `${TAG} createDocument type=${documentType} folder=\"${folderPath}\" name=${name ?? \"(none)\"}`,\n );\n const parentFolderId = await ensureFolder(folderPath);\n\n const doc = await client.newDocument(documentType, {\n parentIdentifier: personalDriveId,\n name,\n });\n\n await client.drives.addFile(personalDriveId, doc, parentFolderId);\n\n log?.debug(\n `${TAG} createDocument ${doc.header.id.slice(0, 8)}… created in folder ${parentFolderId.slice(0, 8)}…`,\n );\n return { documentId: doc.header.id };\n }\n\n async function removeDocument(\n documentId: string,\n _folderPath?: string,\n ): Promise<void> {\n // Remove the file node from the drive via DELETE_NODE\n const actions = await getDriveActions();\n await client.execute(personalDriveId, \"main\", [\n actions.deleteNode({ id: documentId }),\n ]);\n\n // Also remove the parent-child relationship\n await client.removeRelationship(personalDriveId, documentId, \"child\");\n }\n\n async function resolveFolder(\n folderPath: string,\n ): Promise<string | undefined> {\n const segments = splitPath(folderPath);\n const nodes = await getDriveNodes(client, personalDriveId);\n let parentFolderId: string | null = null;\n\n for (const segment of segments) {\n const match = findFolderInNodes(nodes, segment, parentFolderId);\n if (!match) return undefined;\n parentFolderId = match.id;\n }\n\n return parentFolderId ?? undefined;\n }\n\n async function getDocument(documentId: string): Promise<unknown> {\n return client.get(documentId);\n }\n\n async function listFolder(folderPath?: string): Promise<FolderEntry[]> {\n let parentFolderId: string | null = null;\n\n if (folderPath) {\n const resolved = await resolveFolder(folderPath);\n if (!resolved) return [];\n parentFolderId = resolved;\n }\n\n const nodes = await getDriveNodes(client, personalDriveId);\n const prefix = folderPath ? folderPath.replace(/\\/+$/, \"\") : \"\";\n\n return nodes\n .filter((n) => (n.parentFolder ?? null) === parentFolderId)\n .map((n) => ({\n id: n.id,\n name: n.name,\n type: isFolder(n) ? (\"folder\" as const) : (\"document\" as const),\n documentType: isFolder(n) ? undefined : n.documentType,\n path: prefix ? `${prefix}/${n.name}` : n.name,\n }));\n }\n\n async function findByType(documentType: string): Promise<FolderEntry[]> {\n const nodes = await getDriveNodes(client, personalDriveId);\n return nodes\n .filter((n) => !isFolder(n) && n.documentType === documentType)\n .map((n) => ({\n id: n.id,\n name: n.name,\n type: \"document\" as const,\n documentType: n.documentType,\n path: n.name,\n }));\n }\n\n return {\n addDocument,\n createDocument,\n removeDocument,\n getDocument,\n listFolder,\n ensureFolder,\n findByType,\n };\n}\n\n// ── Folder command schemas ────────────────────────────────────────\n\nconst addDocumentSchema = z.object({\n documentId: z.string().describe(\"Document ID to add\"),\n folderPath: z.string().describe('Folder path (e.g. \"specs/my-project\")'),\n name: z.string().optional().describe(\"Display name for the document\"),\n});\n\nconst removeDocumentSchema = z.object({\n documentId: z.string().describe(\"Document ID to remove\"),\n folderPath: z.string().optional().describe(\"Folder path to remove from\"),\n});\n\nconst getDocumentSchema = z.object({\n documentId: z.string().describe(\"Document ID to retrieve\"),\n});\n\nconst listFolderSchema = z.object({\n folderPath: z.string().optional().describe(\"Folder path (root if omitted)\"),\n});\n\n/**\n * Auto-generate CLI commands that wrap FolderOperations.\n */\nexport function createFolderCommands(folderOps: FolderOperations): Command[] {\n const addDocument: Command<typeof addDocumentSchema> = {\n id: \"folders-add-document\",\n description: \"Add a document to the personal drive at a folder path\",\n inputSchema: addDocumentSchema,\n outputSchema: z.object({ text: z.string() }),\n execute: async (input) => {\n await folderOps.addDocument(\n input.documentId,\n input.folderPath,\n input.name,\n );\n return {\n text: `Added document ${input.documentId} to ${input.folderPath}`,\n };\n },\n };\n\n const removeDocument: Command<typeof removeDocumentSchema> = {\n id: \"folders-remove-document\",\n description: \"Remove a document from the personal drive\",\n inputSchema: removeDocumentSchema,\n outputSchema: z.object({ text: z.string() }),\n execute: async (input) => {\n await folderOps.removeDocument(input.documentId, input.folderPath);\n return { text: `Removed document ${input.documentId}` };\n },\n };\n\n const getDocument: Command<typeof getDocumentSchema> = {\n id: \"folders-get-document\",\n description: \"Get a document from the personal drive\",\n inputSchema: getDocumentSchema,\n outputSchema: z.object({ text: z.string(), data: z.unknown() }),\n execute: async (input) => {\n const doc = await folderOps.getDocument(input.documentId);\n return { text: JSON.stringify(doc, null, 2), data: doc };\n },\n };\n\n const listFolder: Command<typeof listFolderSchema> = {\n id: \"folders-ls\",\n description: \"List folder contents in the personal drive\",\n inputSchema: listFolderSchema,\n outputSchema: z.object({ text: z.string(), data: z.array(z.unknown()) }),\n execute: async (input) => {\n const entries = await folderOps.listFolder(input.folderPath);\n if (entries.length === 0) {\n return { text: \"Empty folder\", data: [] };\n }\n const lines = entries.map((e) => {\n const icon = e.type === \"folder\" ? \"[dir]\" : \"[doc]\";\n const typeInfo = e.documentType ? ` (${e.documentType})` : \"\";\n return ` ${icon} ${e.name}${typeInfo} ${e.id.slice(0, 8)}...`;\n });\n return { text: lines.join(\"\\n\"), data: entries };\n },\n };\n\n return [addDocument, removeDocument, getDocument, listFolder];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAkBA,MAAM,MAAM;AAWZ,SAAS,SAAS,MAA0B;CAC1C,OAAO,KAAK,SAAS;AACvB;;;;AAKA,eAAe,cACb,QACA,SACsB;CAEtB,QAAQ,MADa,OAAO,IAAI,OAAO,EAAA,EACxB,OAAO,QAAQ,SAAS,CAAC;AAC1C;;;;;;;;AASA,SAAgB,uBACd,QACA,iBACA,KACkB;;;;;;;CAOlB,IAAI,gBAaO;CAEX,eAAe,kBAAkB;EAC/B,IAAI,CAAC,eAAe;GAClB,MAAM,MAAO,MAAM,OAAO;GAC1B,gBAAgB;IACd,WAAW,IAAI;IACf,SAAS,IAAI;IACb,YAAY,IAAI;GAClB;EACF;EACA,OAAO;CACT;CAEA,SAAS,UAAU,YAA8B;EAC/C,OAAO,WAAW,MAAM,GAAG,CAAC,CAAC,OAAO,OAAO;CAC7C;;;;CAKA,SAAS,kBACP,OACA,MACA,UACuB;EACvB,OAAO,MAAM,MACV,MACC,SAAS,CAAC,KAAK,EAAE,SAAS,SAAS,EAAE,gBAAgB,UAAU,QACnE;CACF;CAEA,eAAe,aAAa,YAAqC;EAC/D,MAAM,WAAW,UAAU,UAAU;EACrC,IAAI,iBAAgC;EAEpC,KAAK,MAAM,WAAW,UAAU;GAE9B,MAAM,WAAW,kBAAkB,MADf,cAAc,QAAQ,eAAe,GACf,SAAS,cAAc;GAEjE,IAAI,UAAU;IACZ,KAAK,MACH,GAAG,IAAI,yBAAyB,QAAQ,aAAa,SAAS,GAAG,MAAM,GAAG,CAAC,EAAE,EAC/E;IACA,iBAAiB,SAAS;IAC1B;GACF;GAGA,MAAM,WAAW,WAAW;GAC5B,KAAK,MACH,GAAG,IAAI,iCAAi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KAAK,GAAG,EAAE,OAAO,SAAS,IAAI,EAAE,GAAG,MAAM,GAAG,CAAC,EAAE;KAC7D,CACmB,CAAC,CAAC,KAAK,IAAI;KAAG,MAAM;IAAQ;GACjD;EAGyD;CAAC;AAC9D"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/core/pkg.ts","../src/core/command.ts","../src/core/errors.ts","../src/core/logger.ts","../src/core/cli.ts","../src/core/trigger.ts","../src/integrations/powerhouse/change-trigger.ts","../src/core/types-binding.ts","../src/core/schema.ts","../src/core/store.ts","../src/core/config.ts","../src/core/config-command.ts","../src/core/workdir.ts","../src/core/events.ts","../src/core/processes.ts","../src/core/services.ts","../src/core/service-command.ts","../src/core/project-mapping.ts","../src/core/preflight.ts","../src/core/help-command.ts","../src/core/init.ts","../src/core/skill-commands.ts","../src/core/templates.ts","../src/core/routine.ts","../src/core/routine-service.ts","../src/core/stream.ts","../src/core/proxy.ts","../src/interactive/types.ts","../src/interactive/session.ts","../src/interactive/router.ts","../src/interactive/completions.ts","../src/interactive/markdown.ts","../src/integrations/powerhouse/registry.ts","../src/integrations/powerhouse/ports.ts","../src/integrations/powerhouse/identity.ts","../src/integrations/powerhouse/switchboard.ts","../src/integrations/powerhouse/type-guard.ts","../src/integrations/powerhouse/index.ts","../src/core/wraps.ts","../src/core/lifecycle.ts"],"mappings":";;;;;;UAgBiB;;EAEf;;EAEA;;EAEA;;;;;;;;wBASc,gBAAgB,wBAAwB;;;;;;;wBCtBxC,cACd,eAAe,EAAE,SACjB,mBACA,UAAU,yBACV,UAAU,wBAEV,SAAS,QAAQ,QAAQ,SAAS,SAAS,KAC1C,QAAQ,QAAQ,SAAS,SAAS;;;wBCdrB,eAAe,cAAc;;;wBCc7B,aACd,QAAO,UACP,QAAO,uBAEN;;;;;;;;;;wBC0Ga,UACd,8BAA8B,wBAAwB,QACpD,0BAEF,+BAA+B,wBAAwB,QACrD,0BAEF,SAAS,WAAW,SAAS,YAAY;;;;;;;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yB,MAAM,IAAI,OAAO,EAAE;;;;;;UC4D1C,2BACf,UAAU,mBAAmB;;EAG7B,gBAAgB;;EAEhB,QAAQ;;EAER,SAAS,MACP;IAAgB;IAA8B;;;EAGhD,gBAAgB,mBAAmB;;;;;;;;;wBAUf,oBACpB,UAAU,mBAAmB,aAE7B,KAAK,oBAAoB,IACzB,SAAS,2BAA2B,KACnC,QAAQ,eAAe;;;;;;;;;;qBC/Fb,gBAAgB;;;;;;;;wBAuCb,aAAa,SAAS,oBAAoB;;;UCxCzC;;EAEf,OAAO;;;;;;EAMP,gBAAgB;;EAEhB,SAAS;;;;;;;;;;;wBAYW,cACpB,OAAO,iBACP,KAAK,uBACJ,QAAQ"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/core/pkg.ts","../src/core/command.ts","../src/core/errors.ts","../src/core/logger.ts","../src/core/cli.ts","../src/core/trigger.ts","../src/integrations/powerhouse/change-trigger.ts","../src/core/types-binding.ts","../src/core/schema.ts","../src/core/store.ts","../src/core/config.ts","../src/core/config-command.ts","../src/core/workdir.ts","../src/core/events.ts","../src/core/processes.ts","../src/core/services.ts","../src/core/service-command.ts","../src/core/project-mapping.ts","../src/core/preflight.ts","../src/core/help-command.ts","../src/core/init.ts","../src/core/skill-commands.ts","../src/core/templates.ts","../src/core/routine.ts","../src/core/routine-service.ts","../src/core/stream.ts","../src/core/proxy.ts","../src/interactive/types.ts","../src/interactive/session.ts","../src/interactive/router.ts","../src/interactive/completions.ts","../src/interactive/markdown.ts","../src/integrations/powerhouse/registry.ts","../src/integrations/powerhouse/ports.ts","../src/integrations/powerhouse/identity.ts","../src/integrations/powerhouse/switchboard.ts","../src/integrations/powerhouse/type-guard.ts","../src/integrations/powerhouse/index.ts","../src/core/wraps.ts","../src/core/lifecycle.ts"],"mappings":";;;;;;UAgBiB;;EAEf;;EAEA;;EAEA;;;;;;;;wBASc,gBAAgB,wBAAwB;;;;;;;wBCtBxC,cACd,eAAe,EAAE,SACjB,mBACA,UAA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,KAAK;EACV,cAAc;EAAmB,UAAU;;;;;;;;;;;;;;;;;;;;;wBC/ChC,gBAAgB,iBAAiB;;;UCThC;;EAEf,eAAe;;EAEf;;EAEA;;EAEA;;EAEA;;;;;;EAMA;;;;;;;;;wBAmDoB,iBACpB,SAAS,0BACR,QAAQ;;;;;;;;;;;;;;;wBClEK,UACd,UAAU,kBACV,gBAAgB,YAChB,KAAK,QAAQ,yBAAyB,MAAM,IAAI,OAAO,EAAE;;;;;;UC4D1C,2BACf,UAAU,mBAAmB;;EAG7B,gBAAgB;;EAEhB,QAAQ;;EAER,SAAS,MACP;IAAgB;IAA8B;;;EAGhD,gBAAgB,mBAAmB;;;;;;;;;wBAUf,oBACpB,UAAU,mBAAmB,aAE7B,KAAK,oBAAoB,IACzB,SAAS,2BAA2B,KACnC,QAAQ,eAAe;;;;;;;;;;qBC/Fb,gBAAgB;;;;;;;;wBAuCb,aAAa,SAAS,oBAAoB;;;UCxCzC;;EAEf,OAAO;;;;;;EAMP,gBAAgB;;EAEhB,SAAS;;;;;;;;;;;wBAYW,cACpB,OAAO,iBACP,KAAK,uBACJ,QAAQ"}
package/dist/index.mjs CHANGED
@@ -1,8 +1,8 @@
1
- import { A as generateConfigCommandHelp, B as createWorkdirStore, C as extractTemplateVars, D as installSkills, E as readSkills, F as resolveConfig, G as formatZodError, H as resolvePort, I as toUpperSnake, K as defineCommand, L as userConfigPath, M as configKeyToEnvVar, N as getMissingRequiredFields, O as createHelpCommand, P as localConfigPath, R as userStoreFolder, S as isSkillInvocation, T as renderSkillTemplate, U as resolveReactorDefaults, V as defaultPort, W as createLogger, _ as IDENTITY_WRAPS, a as getProjectMapping, b as DEFAULT_SKILL_INSTRUCTION, c as defineTrigger, d as createReplSession, f as parseReplInput, g as createRoutine, h as createRoutineServiceAdapter, i as defineRegistry, j as resolveWorkdir, k as createConfigCommand, l as defineCli, m as createCompositeServiceManager, n as isDocType, o as createTypes, p as tokenizeArgs, q as readPackageInfo, r as deterministicId, s as createDocumentChangeTrigger, t as buildDefaultReactor, u as initLifecycle, v as composeWraps, w as registerDefaultHelpers, x as createSkillCommands, y as createProcessManager, z as createMemoryWorkdirStore } from "./src-BdwlBh04.mjs";
1
+ import { A as generateConfigCommandHelp, B as createWorkdirStore, C as extractTemplateVars, D as installSkills, E as readSkills, F as resolveConfig, G as formatZodError, H as resolvePort, I as toUpperSnake, K as defineCommand, L as userConfigPath, M as configKeyToEnvVar, N as getMissingRequiredFields, O as createHelpCommand, P as localConfigPath, R as userStoreFolder, S as isSkillInvocation, T as renderSkillTemplate, U as resolveReactorDefaults, V as defaultPort, W as createLogger, _ as IDENTITY_WRAPS, a as getProjectMapping, b as DEFAULT_SKILL_INSTRUCTION, c as defineTrigger, d as createReplSession, f as parseReplInput, g as createRoutine, h as createRoutineServiceAdapter, i as defineRegistry, j as resolveWorkdir, k as createConfigCommand, l as defineCli, m as createCompositeServiceManager, n as isDocType, o as createTypes, p as tokenizeArgs, q as readPackageInfo, r as deterministicId, s as createDocumentChangeTrigger, t as buildDefaultReactor, u as initLifecycle, v as composeWraps, w as registerDefaultHelpers, x as createSkillCommands, y as createProcessManager, z as createMemoryWorkdirStore } from "./src-CruuSRSC.mjs";
2
2
  import { a as scanProjects, c as checkCommand, d as isPortFree, f as getSchemaFields, i as PROJECT_INDICATORS, l as checkPort, n as defineService, p as slugToTitle, r as resolveServiceName, t as createServiceManager, u as checkWorkdir } from "./services-9E-r0nWl.mjs";
3
3
  import { a as getGhostSuggestion, i as getCompletions, n as applyCompletion, o as formatStreamChunk, r as getCompletionSuffix, s as renderStream, t as renderMarkdown } from "./markdown-D-sP2zw_.mjs";
4
4
  import { a as captureRoutePrefix, i as buildSwitchboardRoutes, r as buildSwitchboardRouteSpecs, s as isWsEndpointType, t as buildServiceRoutes } from "./proxy-routes-DP3ztsnS.mjs";
5
5
  import { n as createServiceCommands, r as formatStatus, t as createEventBus } from "./events-BnwGFTjv.mjs";
6
6
  import { t as createProxyServer } from "./proxy-BFR8GScT.mjs";
7
- import { t as startSwitchboard } from "./switchboard-DAS-5x53.mjs";
7
+ import { t as startSwitchboard } from "./switchboard-CyvOavqL.mjs";
8
8
  export { DEFAULT_SKILL_INSTRUCTION, IDENTITY_WRAPS, PROJECT_INDICATORS, applyCompletion, buildDefaultReactor, buildServiceRoutes, buildSwitchboardRouteSpecs, buildSwitchboardRoutes, captureRoutePrefix, checkCommand, checkPort, checkWorkdir, composeWraps, configKeyToEnvVar, createCompositeServiceManager, createConfigCommand, createDocumentChangeTrigger, createEventBus, createHelpCommand, createLogger, createMemoryWorkdirStore, createProcessManager, createProxyServer, createReplSession, createRoutine, createRoutineServiceAdapter, createServiceCommands, createServiceManager, createSkillCommands, createTypes, createWorkdirStore, defaultPort, defineCli, defineCommand, defineRegistry, defineService, defineTrigger, deterministicId, extractTemplateVars, formatStatus, formatStreamChunk, formatZodError, generateConfigCommandHelp, getCompletionSuffix, getCompletions, getGhostSuggestion, getMissingRequiredFields, getProjectMapping, getSchemaFields, initLifecycle, installSkills, isDocType, isPortFree, isSkillInvocation, isWsEndpointType, localConfigPath, parseReplInput, readPackageInfo, readSkills, registerDefaultHelpers, renderMarkdown, renderSkillTemplate, renderStream, resolveConfig, resolvePort, resolveReactorDefaults, resolveServiceName, resolveWorkdir, scanProjects, slugToTitle, startSwitchboard, toUpperSnake, tokenizeArgs, userConfigPath, userStoreFolder };
@@ -95,11 +95,12 @@ export declare const declaredHostSchema: z.ZodObject<{
95
95
  dynamic: z.ZodOptional<z.ZodBoolean>;
96
96
  }, z.core.$strict>>;
97
97
  remote: z.ZodOptional<z.ZodObject<{
98
- url: import("@powerhousedao/host-core").TokenableSchema<z.ZodURL>;
98
+ url: import("@powerhousedao/host-core").TokenableSchema<z.ZodUnion<readonly [z.ZodURL, z.ZodString]>>;
99
99
  }, z.core.$strict>>;
100
100
  }, z.core.$strict>>>;
101
101
  placement: z.ZodOptional<z.ZodObject<{
102
102
  primary: z.ZodOptional<z.ZodString>;
103
+ drives: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
103
104
  }, z.core.$strict>>;
104
105
  protocol: z.ZodOptional<z.ZodObject<{
105
106
  featureFlags: z.ZodOptional<z.ZodObject<{
@@ -248,11 +249,12 @@ export declare const hostSchema: z.ZodObject<{
248
249
  dynamic: z.ZodOptional<z.ZodBoolean>;
249
250
  }, z.core.$strict>>;
250
251
  remote: z.ZodOptional<z.ZodObject<{
251
- url: import("@powerhousedao/host-core").TokenableSchema<z.ZodURL>;
252
+ url: import("@powerhousedao/host-core").TokenableSchema<z.ZodUnion<readonly [z.ZodURL, z.ZodString]>>;
252
253
  }, z.core.$strict>>;
253
254
  }, z.core.$strict>>>;
254
255
  placement: z.ZodOptional<z.ZodObject<{
255
256
  primary: z.ZodOptional<z.ZodString>;
257
+ drives: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
256
258
  }, z.core.$strict>>;
257
259
  protocol: z.ZodOptional<z.ZodObject<{
258
260
  featureFlags: z.ZodOptional<z.ZodObject<{
@@ -1 +1 @@
1
- {"version":3,"file":"clint-runner.d.mts","names":[],"sources":["../../src/runners/clint-runner.ts"],"mappings":";;;;;;;;;;;;;qBAoDa;;qBA8EA,oBAAkB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA6B,EAAA,KAAA;;;qBAG/C,YAAU,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAqB,EAAA,KAAA;;YAShC,iBAAiB,EAAE,aAAa;;YAEhC,YAAY,EAAE,cAAc;;qB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AAM,WACN,KAAK,gBACJ"}
@@ -3,10 +3,11 @@ import { RunnerContext, RunnerHandle } from "@powerhousedao/host-core";
3
3
  //#region src/runners/mastra-runner.d.ts
4
4
  /**
5
5
  * mastra-runner (P5.6): the headless agent host. Its reactor is a REMOTE
6
- * attach — a lone `remote` backend whose `remote.url` is the running
7
- * switchboard's GraphQL endpoint (typically the output token
8
- * `switchboard.endpoints.graphql`, resolved before the verb runs); it depends
9
- * on that switchboard and never starts one. `run`/`serve` expose an
6
+ * attach — a lone `remote` backend whose `remote.url` is a drive address on
7
+ * the running switchboard (typically the output token
8
+ * `switchboard.drives.powerhouse.url`, resolved before the verb runs); it
9
+ * attaches to that switchboard's GraphQL endpoint, depends on it and never
10
+ * starts one. `run`/`serve` expose an
10
11
  * OpenAI-compatible chat-completions endpoint (streaming SSE +
11
12
  * non-streaming, stateless baseline — the caller owns session state);
12
13
  * without a configured model it answers as the DEMO agent. `build` compiles
@@ -50,11 +51,12 @@ export declare const declaredHostSchema: z.ZodObject<{
50
51
  dynamic: z.ZodOptional<z.ZodBoolean>;
51
52
  }, z.core.$strict>>;
52
53
  remote: z.ZodOptional<z.ZodObject<{
53
- url: import("@powerhousedao/host-core").TokenableSchema<z.ZodURL>;
54
+ url: import("@powerhousedao/host-core").TokenableSchema<z.ZodUnion<readonly [z.ZodURL, z.ZodString]>>;
54
55
  }, z.core.$strict>>;
55
56
  }, z.core.$strict>>>;
56
57
  placement: z.ZodOptional<z.ZodObject<{
57
58
  primary: z.ZodOptional<z.ZodString>;
59
+ drives: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
58
60
  }, z.core.$strict>>;
59
61
  protocol: z.ZodOptional<z.ZodObject<{
60
62
  featureFlags: z.ZodOptional<z.ZodObject<{
@@ -155,11 +157,12 @@ export declare const hostSchema: z.ZodObject<{
155
157
  dynamic: z.ZodOptional<z.ZodBoolean>;
156
158
  }, z.core.$strict>>;
157
159
  remote: z.ZodOptional<z.ZodObject<{
158
- url: import("@powerhousedao/host-core").TokenableSchema<z.ZodURL>;
160
+ url: import("@powerhousedao/host-core").TokenableSchema<z.ZodUnion<readonly [z.ZodURL, z.ZodString]>>;
159
161
  }, z.core.$strict>>;
160
162
  }, z.core.$strict>>>;
161
163
  placement: z.ZodOptional<z.ZodObject<{
162
164
  primary: z.ZodOptional<z.ZodString>;
165
+ drives: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
163
166
  }, z.core.$strict>>;
164
167
  protocol: z.ZodOptional<z.ZodObject<{
165
168
  featureFlags: z.ZodOptional<z.ZodObject<{
@@ -1 +1 @@
1
- {"version":3,"file":"mastra-runner.d.mts","names":[],"sources":["../../src/runners/mastra-runner.ts"],"mappings":";;;;;;;;;;;;;;qBAsCa;;qBAGA;;qBA8CA,oBAAkB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA6B,EAAA,KAAA;;qBAE/C,YAAU,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAqB,EAAA,KAAA;;YAGhC,kBAAkB,EAAE,aAAa;;YAEjC,aAAa,EAAE,cAAc;YAC7B,kBAAkB,YAAY;;;qBAI7B,eAAa,EAAA;;;;;;GASxB,EAAA,KAAA;YAEU,gBAAgB,EAAE,aAAa;QAEnC;YACI;IACR;MACE,MAAM;MACN,SAAS;;;;KA8BV;EAAgB;EAAc;;;;wBAInB,mBAAmB,UAAU;YAqCjC,mBAAmB,aAAa;wBAmNtB,IACpB,MAAM,YACN,KAAK,gBACJ,QAAQ;qBAIE,cAAK;;wBAGI,MACpB,MAAM,YACN,KAAK,gBACJ"}
1
+ {"version":3,"file":"mastra-runner.d.mts","names":[],"sources":["../../src/runners/mastra-runner.ts"],"mappings":";;;;;;;;;;;;;;;qBA0Ca;;qBAGA;;qBA8CA,oBAAkB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA6B,EAAA,KAAA;;qBAE/C,YAAU,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAqB,EAAA,KAAA;;YAGhC,kBAAkB,EAAE,aAAa;;YAEjC,aAAa,EAAE,cAAc;YAC7B,kBAAkB,YAAY;;;qBAI7B,eAAa,EAAA;;;;;;GASxB,EAAA,KAAA;YAEU,gBAAgB,EAAE,aAAa;QAEnC;YACI;IACR;MACE,MAAM;MACN,SAAS;;;;KA+BV;EAAgB;EAAc;;;;wBAInB,mBAAmB,UAAU;YAqCjC,mBAAmB,aAAa;wBAmNtB,IACpB,MAAM,YACN,KAAK,gBACJ,QAAQ;qBAIE,cAAK;;wBAGI,MACpB,MAAM,YACN,KAAK,gBACJ"}
@@ -3,7 +3,7 @@ import { z } from "zod";
3
3
  import { randomUUID } from "node:crypto";
4
4
  import { createServer } from "node:http";
5
5
  import { defaultUserDataDir, probeRun, resolveUserDataPlaceholders } from "@powerhousedao/host-core";
6
- import { defineHostSchemas } from "@powerhousedao/host-core/schema";
6
+ import { defineHostSchemas, switchboardOfDrive } from "@powerhousedao/host-core/schema";
7
7
  //#region src/integrations/powerhouse/remote-reactor.ts
8
8
  /** Derive the GraphQL endpoint from the accepted url spellings. */
9
9
  function deriveGraphqlEndpoint(url) {
@@ -250,10 +250,11 @@ async function createMastraProvider(options) {
250
250
  //#region src/runners/mastra-runner.ts
251
251
  /**
252
252
  * mastra-runner (P5.6): the headless agent host. Its reactor is a REMOTE
253
- * attach — a lone `remote` backend whose `remote.url` is the running
254
- * switchboard's GraphQL endpoint (typically the output token
255
- * `switchboard.endpoints.graphql`, resolved before the verb runs); it depends
256
- * on that switchboard and never starts one. `run`/`serve` expose an
253
+ * attach — a lone `remote` backend whose `remote.url` is a drive address on
254
+ * the running switchboard (typically the output token
255
+ * `switchboard.drives.powerhouse.url`, resolved before the verb runs); it
256
+ * attaches to that switchboard's GraphQL endpoint, depends on it and never
257
+ * starts one. `run`/`serve` expose an
257
258
  * OpenAI-compatible chat-completions endpoint (streaming SSE +
258
259
  * non-streaming, stateless baseline — the caller owns session state);
259
260
  * without a configured model it answers as the DEMO agent. `build` compiles
@@ -266,8 +267,8 @@ const verbs = [
266
267
  "serve",
267
268
  "build"
268
269
  ];
269
- /** The token a host writes for the switchboard endpoint (error hints). */
270
- const REMOTE_URL_HINT = "remote: { url: switchboard.endpoints.graphql } (from ../switchboard/outputs.js), or literally { url: { $output: { host: \"switchboard\", path: [\"endpoints\", \"graphql\"] } } }";
270
+ /** The token a host writes for the switchboard's drive address (error hints). */
271
+ const REMOTE_URL_HINT = "remote: { url: switchboard.drives.<slug>.url } (from ../switchboard/outputs.js), or literally { url: { $output: { host: \"switchboard\", path: [\"drives\", \"<slug>\", \"url\"] } } }";
271
272
  /**
272
273
  * The agent host, from one definition in two forms: DECLARED (`apiKey` may
273
274
  * be a token, e.g. `{ $env: "OPENROUTER_API_KEY" }`; what host.js authors
@@ -322,15 +323,15 @@ const outputsSchema = z.strictObject({
322
323
  })
323
324
  });
324
325
  const DEFAULT_AGENT_PORT = 4910;
325
- /** The remote backend's switchboard url, as resolved before the verb. The
326
- * sibling-reference resolver (`remote: { host }`) is gone: an output token
327
- * names the endpoint the switchboard actually bound. */
326
+ /** The GraphQL endpoint of the switchboard the remote backend's drive
327
+ * address names, as resolved before the verb. */
328
328
  function remoteUrl(host) {
329
329
  const remote = Object.values(host.reactor?.backends ?? {}).find((b) => b.kind === "remote");
330
330
  if (!remote) throw new Error(`hosts/${host.name}: an agent host attaches to a RUNNING switchboard — declare a remote backend, e.g. reactor.backends.switchboard = { kind: "remote", ${REMOTE_URL_HINT} }.`);
331
331
  const url = remote.remote?.url;
332
- if (typeof url !== "string" || url.length === 0) throw new Error(`hosts/${host.name}: the remote backend needs the switchboard's GraphQL url: ${REMOTE_URL_HINT}.`);
333
- return url;
332
+ const switchboard = typeof url === "string" ? switchboardOfDrive(url) : void 0;
333
+ if (!switchboard) throw new Error(`hosts/${host.name}: the remote backend needs a drive address on the switchboard (<switchboard>/d/<slug>): ${REMOTE_URL_HINT}.`);
334
+ return switchboard.graphql;
334
335
  }
335
336
  /** Baseline stateless mapping: the last user message is the prompt (string
336
337
  * or OpenAI content-part arrays flattened to their text parts). */
@@ -500,7 +501,7 @@ const serve = run;
500
501
  /** `build` — skill + agent-profile compilation (ph-clint-dev's pipeline). */
501
502
  async function build(host, ctx) {
502
503
  const config = host.config ?? {};
503
- const { buildSkills } = await import("../build-skills-Bp4IR8R_.mjs");
504
+ const { buildSkills } = await import("../build-skills-De9EZd6U.mjs");
504
505
  const result = await buildSkills({
505
506
  rootDir: ctx.projectRoot,
506
507
  skillsDir: config.prompts?.skillsDir,