/** * skills-plugin — generate a per-session --plugin-dir for Sapiom's bundled skills. * * claude-code auto-discovers `/skills//SKILL.md` when launched * with `--plugin-dir `. A plugin-provided skill registers as a * PLUGIN-NAMESPACED slash command `/:` — NOT a bare * `/` (verified against claude-code 2.1.x; bare names are reserved for * personal/project skills). The plugin name comes from plugin.json ("sapiom" * here), so the sapiom-agent-authoring skill surfaces as * `/sapiom:sapiom-agent-authoring`. The skill is also exposed to the agent's * model-driven Skill tool, so it can be auto-invoked by relevance without the * user typing the command at all. * This module writes the required layout under a per-session subdirectory of * `generatedRoot` so sessions never share or race on config files. * * Source of skills: the installed @sapiom/agent-core package ships a `skills/` * directory alongside its dist. We resolve it via the package's own * package.json, then copy each `/SKILL.md` into the plugin layout. * * The copy is session-scoped and non-mutating: nothing is written to the user's * own ~/.claude or the project repository. Retention (exit-time delete + sweep) * is handled by the same mechanism that cleans up mcp-config and settings files. * * The served platform rules (SAP-3225): the bundled `sapiom-agent-authoring` * skill carries only summaries of, and pointers to, the platform rules served * at `GET /v1/agents/authoring-rules`. While generating the plugin the session * fetches that body; on success its copy of the skill drops the summaries and * carries the served body in full, so a backend edit to the rules reaches a * Studio session on its next start without a package release. On any failure * the bundled copy is used unchanged. Either way the copy ends with a * `source: served|bundled · release … · digest …` line naming which it is. * Only the session copy changes; the installed package is never touched. * * Graceful no-op: if @sapiom/agent-core's skills directory is absent or * unresolvable, the function returns undefined rather than throwing — the * session still launches normally, just without the --plugin-dir flag. */ export interface SkillsPluginOptions { /** Root directory generated configs live under. Defaults to HARNESS_PATHS.generated. */ generatedRoot?: string; /** * Sapiom environment whose API serves the platform rules. Defaults to * whatever `resolveEnvironment` picks (the credential store's current * environment, else production). */ environment?: string; } /** * `1` or `true` skips the platform-rules fetch and keeps the bundled skill: * an escape hatch for an air-gapped run, and how the test suite keeps every * session-launching spec off the network (src/test-setup.ts). */ export declare const AUTHORING_RULES_FETCH_DISABLED_ENV = "SAPIOM_AUTHORING_RULES_FETCH_DISABLED"; /** The served platform rules, footer stripped, with the stamp they were served under. */ export interface ServedAuthoringRules { body: string; release: string; digest: string; } /** * Fetch the served platform rules for `environment`. `null` when disabled, * when the environment cannot be resolved, on any fetch failure, or when the * body does not carry a complete stamp it hashes to. Accepting the served copy * drops the bundled summaries, so a truncated or unstamped body must fall back * to the bundled skill rather than replace it. The serve-time footer is * stripped: the session copy states its own source. */ export declare function fetchServedAuthoringRules(environment?: string): Promise; /** * The session copy of the authoring skill when the rules were served: the * bundled summary chapters and the stamp removed, the intro reworded, and the * served body appended under its own `# Sapiom platform rules for agent * authors` heading, then the `source: served` footer. */ export declare function inlineServedAuthoringRules(bundled: string, served: ServedAuthoringRules): string; /** The session copy of the authoring skill when the rules were not served: bundled, plus the footer. */ export declare function markBundledAuthoringRules(bundled: string): string; /** * Generate the per-session --plugin-dir for Sapiom's bundled skills. * * Creates: * //skills-plugin/ * .claude-plugin/plugin.json * skills//SKILL.md (one entry per skill in agent-core's skills/; * the authoring skill as described in the module comment) * * Returns the plugin dir path (`//skills-plugin`) * on success, or undefined when no skills are found or agent-core is not resolvable. */ export declare function generateSkillsPlugin(harnessSessionId: string, options?: SkillsPluginOptions): Promise; //# sourceMappingURL=skills-plugin.d.ts.map