@skaile/workspaces 1.3.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +122 -0
- package/README.md +1 -1
- package/dist/app-sdk/index.d.ts +2 -0
- package/dist/app-sdk/index.js +295 -0
- package/dist/app-sdk/index.js.map +1 -0
- package/dist/app-sdk/src/app.d.ts +101 -0
- package/dist/app-sdk/src/app.d.ts.map +1 -0
- package/dist/app-sdk/src/define-app-capability.d.ts +139 -0
- package/dist/app-sdk/src/define-app-capability.d.ts.map +1 -0
- package/dist/app-sdk/src/index.d.ts +16 -0
- package/dist/app-sdk/src/index.d.ts.map +1 -0
- package/dist/app-sdk/src/logger.d.ts +26 -0
- package/dist/app-sdk/src/logger.d.ts.map +1 -0
- package/dist/app-sdk/src/transport.d.ts +84 -0
- package/dist/app-sdk/src/transport.d.ts.map +1 -0
- package/dist/app-sdk/src/ws-transport.d.ts +63 -0
- package/dist/app-sdk/src/ws-transport.d.ts.map +1 -0
- package/dist/{asset-feeds-NEZKG6YS.js → asset-feeds-NG5TKB3V.js} +8 -8
- package/dist/{asset-feeds-NEZKG6YS.js.map → asset-feeds-NG5TKB3V.js.map} +1 -1
- package/dist/asset-manager/index.js +7 -7
- package/dist/asset-manager/installer.js +6 -6
- package/dist/asset-manager/renderers.js +2 -2
- package/dist/asset-manager/src/index.d.ts +42 -6
- package/dist/asset-manager/src/index.d.ts.map +1 -1
- package/dist/bridge/drivers/claude-sdk.js +2 -2
- package/dist/bridge/drivers/codex.js +1 -1
- package/dist/bridge/drivers/continue.js +2 -2
- package/dist/bridge/drivers/echo.js +1 -1
- package/dist/bridge/drivers/gemini.js +3 -3
- package/dist/bridge/drivers/goose.js +2 -2
- package/dist/bridge/drivers/omp.js +1 -1
- package/dist/bridge/drivers/opencode.js +2 -2
- package/dist/bridge/drivers/qwen.js +3 -3
- package/dist/bridge/index.js +3 -3
- package/dist/{chunk-AZAS3FKN.js → chunk-26YCXWCU.js} +48 -2
- package/dist/chunk-26YCXWCU.js.map +1 -0
- package/dist/{chunk-SKADPHAM.js → chunk-4N5XR5DQ.js} +2 -2
- package/dist/chunk-4N5XR5DQ.js.map +1 -0
- package/dist/{chunk-RHMQPLIK.js → chunk-77OXU44H.js} +6 -6
- package/dist/{chunk-RHMQPLIK.js.map → chunk-77OXU44H.js.map} +1 -1
- package/dist/{chunk-7CNIRF42.js → chunk-AAGD2J4H.js} +20 -11
- package/dist/chunk-AAGD2J4H.js.map +1 -0
- package/dist/{chunk-BZMTR5WW.js → chunk-B6SSXVF2.js} +4 -4
- package/dist/chunk-B6SSXVF2.js.map +1 -0
- package/dist/{chunk-YOPSHV7V.js → chunk-BE5KTS2L.js} +3 -3
- package/dist/{chunk-YOPSHV7V.js.map → chunk-BE5KTS2L.js.map} +1 -1
- package/dist/{chunk-JQMIG7D3.js → chunk-BJHZHNKR.js} +3 -3
- package/dist/{chunk-JQMIG7D3.js.map → chunk-BJHZHNKR.js.map} +1 -1
- package/dist/{chunk-5XS3BFJS.js → chunk-DNFIKRO6.js} +3 -3
- package/dist/{chunk-5XS3BFJS.js.map → chunk-DNFIKRO6.js.map} +1 -1
- package/dist/{chunk-PSMW5HLX.js → chunk-GWDZW44L.js} +4 -4
- package/dist/{chunk-PSMW5HLX.js.map → chunk-GWDZW44L.js.map} +1 -1
- package/dist/{chunk-K5SD7FSF.js → chunk-HKX5VSWQ.js} +3 -3
- package/dist/{chunk-K5SD7FSF.js.map → chunk-HKX5VSWQ.js.map} +1 -1
- package/dist/{chunk-P3MJYPZE.js → chunk-HWTQ6HPO.js} +4 -4
- package/dist/{chunk-P3MJYPZE.js.map → chunk-HWTQ6HPO.js.map} +1 -1
- package/dist/{chunk-XKARS6EE.js → chunk-IEX5YV4R.js} +3 -3
- package/dist/{chunk-XKARS6EE.js.map → chunk-IEX5YV4R.js.map} +1 -1
- package/dist/{chunk-GB4SEEK4.js → chunk-IRORTHGA.js} +10 -4
- package/dist/chunk-IRORTHGA.js.map +1 -0
- package/dist/{chunk-YXEPZ7LP.js → chunk-JZPEEMIM.js} +5 -5
- package/dist/{chunk-YXEPZ7LP.js.map → chunk-JZPEEMIM.js.map} +1 -1
- package/dist/{chunk-WFEPI5LA.js → chunk-LCTRCWBK.js} +5 -5
- package/dist/{chunk-WFEPI5LA.js.map → chunk-LCTRCWBK.js.map} +1 -1
- package/dist/{chunk-QK5JDAFF.js → chunk-NKTFEV7Q.js} +4 -4
- package/dist/{chunk-QK5JDAFF.js.map → chunk-NKTFEV7Q.js.map} +1 -1
- package/dist/{chunk-ETYDLXI5.js → chunk-OSCJRUKM.js} +2 -2
- package/dist/{chunk-ETYDLXI5.js.map → chunk-OSCJRUKM.js.map} +1 -1
- package/dist/{chunk-EVZKWY5J.js → chunk-PK7Q7MC7.js} +5 -4
- package/dist/chunk-PK7Q7MC7.js.map +1 -0
- package/dist/{chunk-RYRJEVQ4.js → chunk-QM2TT2PJ.js} +19 -11
- package/dist/chunk-QM2TT2PJ.js.map +1 -0
- package/dist/{chunk-SUOGVHGJ.js → chunk-TNSCHS4I.js} +2 -2
- package/dist/{chunk-SUOGVHGJ.js.map → chunk-TNSCHS4I.js.map} +1 -1
- package/dist/{chunk-Z5Z3MYDL.js → chunk-UPZGQZEJ.js} +3 -3
- package/dist/{chunk-Z5Z3MYDL.js.map → chunk-UPZGQZEJ.js.map} +1 -1
- package/dist/{chunk-RJ3HUSBC.js → chunk-UQ5FK2AB.js} +3 -3
- package/dist/{chunk-RJ3HUSBC.js.map → chunk-UQ5FK2AB.js.map} +1 -1
- package/dist/{chunk-OBSSORCE.js → chunk-X57AMTAH.js} +72 -9
- package/dist/chunk-X57AMTAH.js.map +1 -0
- package/dist/cli/index.js +766 -185
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/src/commands/preset-apply.d.ts +59 -0
- package/dist/cli/src/commands/preset-apply.d.ts.map +1 -0
- package/dist/cli/src/commands/preset-cmd.d.ts +2 -2
- package/dist/cli/src/commands/preset-cmd.d.ts.map +1 -1
- package/dist/cli/src/commands/preset-export.d.ts +93 -0
- package/dist/cli/src/commands/preset-export.d.ts.map +1 -0
- package/dist/cli/src/commands/source.d.ts.map +1 -1
- package/dist/cli/src/commands/why.d.ts +18 -0
- package/dist/cli/src/commands/why.d.ts.map +1 -1
- package/dist/connectors/config.js +2 -2
- package/dist/connectors/index.js +4 -4
- package/dist/core/index.js +2 -2
- package/dist/core/src/workspace-yaml-editor.d.ts +14 -1
- package/dist/core/src/workspace-yaml-editor.d.ts.map +1 -1
- package/dist/deploy/index.js +2 -2
- package/dist/discovery/index.js +2 -2
- package/dist/{ensure-sources-4BAJGJRK.js → ensure-sources-CHC7X7AJ.js} +10 -10
- package/dist/{ensure-sources-4BAJGJRK.js.map → ensure-sources-CHC7X7AJ.js.map} +1 -1
- package/dist/factory-assets/connectors/box.js +4 -4
- package/dist/factory-assets/connectors/deploy.js +4 -4
- package/dist/factory-assets/connectors/devserver.js +4 -4
- package/dist/factory-assets/connectors/flow/adapter.js +4 -4
- package/dist/factory-assets/connectors/flow/engine/engine.d.ts +4 -1
- package/dist/factory-assets/connectors/flow/engine/engine.d.ts.map +1 -1
- package/dist/factory-assets/connectors/flow/engine/types.d.ts +41 -6
- package/dist/factory-assets/connectors/flow/engine/types.d.ts.map +1 -1
- package/dist/factory-assets/connectors/flow/engine.js +3 -3
- package/dist/factory-assets/connectors/flow/run-flow.js +5 -5
- package/dist/factory-assets/connectors/flow.js +4 -4
- package/dist/factory-assets/connectors/git.js +4 -4
- package/dist/factory-assets/connectors/gmail.js +4 -4
- package/dist/factory-assets/connectors/googledrive.js +4 -4
- package/dist/factory-assets/connectors/local.js +4 -4
- package/dist/factory-assets/connectors/mattermost.js +4 -4
- package/dist/factory-assets/connectors/memory.js +4 -4
- package/dist/factory-assets/connectors/minio.js +4 -4
- package/dist/factory-assets/connectors/postgres.js +4 -4
- package/dist/factory-assets/connectors/s3.js +4 -4
- package/dist/factory-assets/connectors/sharepoint.js +4 -4
- package/dist/factory-assets/connectors/sqlite.js +4 -4
- package/dist/factory-assets/connectors/static-server.js +4 -4
- package/dist/factory-assets/connectors/tunnel.js +4 -4
- package/dist/factory-assets/connectors/webdav.js +4 -4
- package/dist/factory-assets/connectors/xstate-store.js +4 -4
- package/dist/factory-assets/connectors/xstate.js +4 -4
- package/dist/factory-assets/skills/skaile-author-asset/SKILL.md +1 -1
- package/dist/factory-assets/skills/skaile-manage-workspace/SKILL.md +1 -1
- package/dist/{flows-UFCOGAAM.js → flows-CGOCUNO6.js} +4 -4
- package/dist/{flows-UFCOGAAM.js.map → flows-CGOCUNO6.js.map} +1 -1
- package/dist/{helpers-2OL4FRFB.js → helpers-GWG4CYYC.js} +10 -10
- package/dist/{helpers-2OL4FRFB.js.map → helpers-GWG4CYYC.js.map} +1 -1
- package/dist/library/index.js +6 -6
- package/dist/library/install.js +2 -2
- package/dist/{open-library-RPV2LIKL.js → open-library-37PXN6MK.js} +15 -15
- package/dist/{open-library-RPV2LIKL.js.map → open-library-37PXN6MK.js.map} +1 -1
- package/dist/{paths-ML33B5SB.js → paths-UVOHWUPY.js} +4 -4
- package/dist/{paths-ML33B5SB.js.map → paths-UVOHWUPY.js.map} +1 -1
- package/dist/{plugin-store-G4HKWCTU.js → plugin-store-EIMVEH3O.js} +4 -4
- package/dist/{plugin-store-G4HKWCTU.js.map → plugin-store-EIMVEH3O.js.map} +1 -1
- package/dist/runner/index.js +10 -10
- package/dist/runner/src/capability-registry.d.ts +15 -4
- package/dist/runner/src/capability-registry.d.ts.map +1 -1
- package/dist/sdk/asset-manager.js +7 -7
- package/dist/sdk/bridge.js +3 -3
- package/dist/sdk/core.js +2 -2
- package/dist/sdk/flow.js +3 -3
- package/dist/sdk/index.js +10 -10
- package/dist/sdk/runner.js +10 -10
- package/dist/sdk/session.js +2 -2
- package/dist/sdk/types.js +1 -1
- package/dist/session/index.js +2 -2
- package/dist/{setup-WS6PF6JQ.js → setup-DINVR6ZQ.js} +7 -7
- package/dist/{setup-WS6PF6JQ.js.map → setup-DINVR6ZQ.js.map} +1 -1
- package/dist/{source-22U5NOY4.js → source-RXAHIGMD.js} +16 -16
- package/dist/{source-22U5NOY4.js.map → source-RXAHIGMD.js.map} +1 -1
- package/dist/{store-client-YLMBH5MF.js → store-client-T3F663YG.js} +5 -5
- package/dist/{store-client-YLMBH5MF.js.map → store-client-T3F663YG.js.map} +1 -1
- package/dist/tui/index.js +10 -10
- package/dist/types/index.js +1 -1
- package/dist/types/manifests.js +1 -1
- package/dist/types/src/capabilities.d.ts +8 -2
- package/dist/types/src/capabilities.d.ts.map +1 -1
- package/dist/types/src/logging.d.ts +3 -2
- package/dist/types/src/logging.d.ts.map +1 -1
- package/dist/types/src/manifests/_shared.d.ts +4 -4
- package/dist/types/src/manifests/index.d.ts +2 -2
- package/dist/types/src/manifests/index.d.ts.map +1 -1
- package/dist/types/src/manifests/preset.d.ts +10 -0
- package/dist/types/src/manifests/preset.d.ts.map +1 -1
- package/dist/types/src/version.d.ts +11 -1
- package/dist/types/src/version.d.ts.map +1 -1
- package/dist/workspace-plugin/adapters/mcp.js +2 -2
- package/dist/workspace-plugin/adapters/omp.js +3 -3
- package/dist/workspace-plugin/index.js +1 -1
- package/package.json +7 -1
- package/dist/chunk-7CNIRF42.js.map +0 -1
- package/dist/chunk-AZAS3FKN.js.map +0 -1
- package/dist/chunk-BZMTR5WW.js.map +0 -1
- package/dist/chunk-EVZKWY5J.js.map +0 -1
- package/dist/chunk-GB4SEEK4.js.map +0 -1
- package/dist/chunk-OBSSORCE.js.map +0 -1
- package/dist/chunk-RYRJEVQ4.js.map +0 -1
- package/dist/chunk-SKADPHAM.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../types/src/mentions.ts","../types/src/reactions.ts","../types/src/capabilities.ts","../types/src/version.ts"],"names":[],"mappings":";AAmBO,IAAM,iBAAiB,CAAC,OAAA,EAAS,QAAA,EAAU,aAAA,EAAe,QAAQ,KAAK;;;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BAAA,EAA6B,CAAC,CAAA,gCAAA,CAAkC,CAAA;AAAA,EAClF;AACA,EAAA,MAAM,CAAC,GAAA,EAAK,GAAA,EAAK,GAAG,CAAA,GAAI,KAAA;AACxB,EAAA,MAAM,KAAA,GAAQ,OAAO,GAAG,CAAA;AACxB,EAAA,MAAM,KAAA,GAAQ,OAAO,GAAG,CAAA;AACxB,EAAA,MAAM,KAAA,GAAQ,OAAO,GAAG,CAAA;AACxB,EAAA,IACE,CAAC,OAAO,SAAA,CAAU,KAAK,KACvB,CAAC,MAAA,CAAO,UAAU,KAAK,CAAA,IACvB,CAAC,MAAA,CAAO,SAAA,CAAU,KAAK,CAAA,IACvB,KAAA,GAAQ,KACR,KAAA,GAAQ,CAAA,IACR,QAAQ,CAAA,EACR;AACA,IAAA,MAAM,IAAI,KAAA,CAAM,CAAA,0BAAA,EAA6B,CAAC,CAAA,4CAAA,CAA8C,CAAA;AAAA,EAC9F;AACA,EAAA,OAAO,EAAE,KAAA,EAAO,KAAA,EAAO,KAAA,EAAM;AAC/B;AAiBO,SAAS,cAAc,CAAA,EAA4B;AACxD,EAAA,OAAO,CAAA,EAAG,EAAE,KAAK,CAAA,CAAA,EAAI,EAAE,KAAK,CAAA,CAAA,EAAI,EAAE,KAAK,CAAA,CAAA;AACzC","file":"chunk-EVZKWY5J.js","sourcesContent":["/**\n * Mentions — types for @-mention support in session messages.\n *\n * A Mention records who was addressed in a message, whether a specific user\n * or a well-known group. Group mentions carry a resolved array of user IDs\n * so consumers can perform membership checks without the resolver.\n */\n\n// ---------------------------------------------------------------------------\n// Groups\n// ---------------------------------------------------------------------------\n\n/**\n * Well-known group mention targets as a `const` array.\n *\n * Use this for validation or exhaustive checks against `MentionGroup`.\n *\n * @docLink packages/types/messages#mention\n */\nexport const MENTION_GROUPS = [\"agent\", \"humans\", \"humans_here\", \"here\", \"all\"] as const;\n\n/**\n * A well-known group that can be `@`-mentioned: `'agent' | 'humans' | 'humans_here' | 'here' | 'all'`.\n *\n * @docLink packages/types/messages#mention\n */\nexport type MentionGroup = (typeof MENTION_GROUPS)[number];\n\n// ---------------------------------------------------------------------------\n// Mention discriminated union\n// ---------------------------------------------------------------------------\n\n/**\n * A parsed `@`-mention in a session message. Records who was addressed — either a\n * specific user or a well-known group — along with the source text position.\n *\n * Group mentions carry a resolved array of user IDs so consumers can perform\n * membership checks without needing the resolver.\n *\n * @docLink packages/types/messages#mention\n */\nexport type Mention =\n | {\n type: \"user\";\n userId: string;\n name: string;\n /** Position of the `@` character in the source text. */\n offset: number;\n /** Length of the full `@token` string including the `@`. */\n length: number;\n }\n | {\n type: \"group\";\n group: MentionGroup;\n /** User IDs resolved at parse time (e.g. all online users for `@here`). */\n resolved: string[];\n /** Position of the `@` character in the source text. */\n offset: number;\n /** Length of the full `@token` string including the `@`. */\n length: number;\n }\n | {\n type: \"custom\";\n /** Consumer-defined mention kind, e.g. \"assistant\". */\n kind: string;\n /** User IDs this mention resolves to (so isMentioned works); may be empty. */\n resolved: string[];\n /** Optional consumer payload, e.g. { sessionId, ownerId }. */\n data?: Record<string, unknown>;\n /** Position of the `@` character in the source text. */\n offset: number;\n /** Length of the full `@token` string including the `@`. */\n length: number;\n };\n","/**\n * Reactions -- emoji reactions on session messages.\n *\n * Any session participant (user or agent) can react to any message.\n * Reactions are persisted in a dedicated DB model and broadcast as\n * transient events for real-time updates.\n */\n\n/**\n * A single emoji reaction on a message, set by any session participant (user or agent).\n *\n * Reactions are persisted in a dedicated DB model and broadcast as transient events\n * for real-time updates.\n *\n * @docLink packages/types/messages#reaction\n */\nexport type Reaction = {\n /** Unicode emoji character (e.g. \"thumbs up\", not \":thumbsup:\"). */\n emoji: string;\n /** ID of the user (or \"agent\" for agent reactions). */\n userId: string;\n /** Display name at reaction time (avoids extra lookups for tooltip rendering). */\n userName: string;\n /** Unix epoch milliseconds. */\n timestamp: number;\n};\n\n/**\n * Quick-access emojis shown in the reaction bar picker.\n *\n * An `as const` array of eight Unicode emoji characters in display order.\n *\n * @docLink packages/types/messages#reaction\n */\nexport const QUICK_REACTIONS = [\n \"\\u{1F44D}\",\n \"\\u{1F440}\",\n \"\\u2705\",\n \"\\u2764\\uFE0F\",\n \"\\u{1F914}\",\n \"\\u{1FAE1}\",\n \"\\u{1F44F}\",\n \"\\u{1F389}\",\n] as const;\n","/**\n * Capability layer — Protocol v2's unified registry of LLM-invokable entry points.\n *\n * A {@link Capability} is a named, schema-typed entry point that the LLM can call\n * during a session. Capabilities are registered into a per-session\n * registry by either side (host platform via `side: 'client'` or runtime via\n * `side: 'agent'`) and routed by the bridge at invocation time.\n *\n * This module defines the wire types only; the runtime registry, the\n * `defineCapability` helper, and the per-handler logger live in\n * `@skaile/workspaces/runner`.\n *\n * @see {@link MessageV2} envelope that carries capability commands and events\n * @see {@link ProtocolVersion} for the version contract\n *\n * @category Capabilities\n * @since 2.0.0\n */\n\n// ---------------------------------------------------------------------------\n// Capability shape\n// ---------------------------------------------------------------------------\n\n/**\n * Visibility scope for a capability. Determines which surfaces the capability\n * appears on and which callers can invoke it.\n *\n * - `'llm'`: registered as an LLM tool, surfaced in the `<CAPABILITIES>` system\n * prompt section. The agent driver can invoke it.\n * - `'user'`: appears in user-facing surfaces — the command palette (cmdK),\n * debug menus, capability lists.\n * - `'runtime'`: invocable only by trusted runner / platform code paths. Never\n * reaches the LLM tool list. Never reaches the command palette. Used for\n * host RPCs (`host.refresh_credential`, `host.audit`, `host.notify_user`,\n * `host.persist_compaction_attempt`) and runner RPCs (`runner.add_mount`,\n * `runner.set_log_level`, `runner.lifecycle`, ...).\n *\n * Multiple audiences are allowed (e.g. `['llm', 'user']`). The default when\n * {@link Capability.audience} is omitted is `['llm', 'user']`, preserving the\n * v2.x default visibility for capabilities that haven't migrated yet.\n *\n * @category Capabilities\n * @since 3.0.0\n * @docLink packages/types/capabilities#capability-audience\n */\nexport type CapabilityAudience = \"llm\" | \"user\" | \"runtime\";\n\n/**\n * Source of truth for who registered a capability. Used for trust enforcement\n * (the bridge rejects mismatches between registering side and origin kind)\n * and for the `capability:<origin>:<name>` log taxonomy.\n *\n * Variants:\n * - `framework`: built-in (e.g. `__capabilities.list`)\n * - `client`: host platform (e.g. `platform.react`)\n * - `agent`: self-registered by the agent runtime\n * - `flow`: injected by an active flow execution\n * - `skill`: from a skill's MCP surface\n * - `mcp`: from a generic MCP server\n * - `connector`: from a connector (e.g. `postgres.query`)\n * - `mount`: surfaced by a filesystem mount\n *\n * @category Capabilities\n * @since 2.0.0\n * @docLink packages/types/capabilities#capability-origin\n */\nexport type CapabilityOrigin =\n | { kind: \"framework\" }\n | { kind: \"client\" }\n | { kind: \"agent\" }\n | { kind: \"flow\"; flowId: string }\n | { kind: \"skill\"; skillId: string }\n | { kind: \"mcp\"; serverId: string }\n | { kind: \"connector\"; connectorId: string }\n | { kind: \"mount\"; mountId: string };\n\n/**\n * Render contract for a capability that produces a UI surface when invoked.\n *\n * When the LLM invokes a capability whose `render` is set, the bridge emits\n * a {@link RenderInvokedEvent} carrying the capability name and props. The\n * client renders the configured `source` at the chosen `target`. Clients\n * without a render layer can fall back to the markdown `fallback` template.\n *\n * @category Capabilities\n * @since 2.0.0\n * @docLink packages/types/capabilities#render-spec\n */\nexport type RenderSpec = {\n /** Where the rendered component lives. */\n source: { kind: \"web-component\"; url: string; tagName: string } | { kind: \"iframe\"; url: string };\n /** Render placements supported by the component. */\n targets: (\"chat\" | \"preview\" | \"modal\" | \"input-extension\")[];\n /** Markdown template with `{{prop}}` placeholders for clients without a render layer. */\n fallback?: string;\n /** True when props may be partial during streaming. */\n streaming?: boolean;\n /** Interaction names the rendered component may fire back as state events. */\n interactions?: string[];\n};\n\n/**\n * A named, schema-typed entry point that the LLM can invoke during a session.\n *\n * Capabilities can be declared statically (via `ConfigureCommand.capabilities`)\n * or dynamically (via {@link CapabilityRegisterCommand} /\n * {@link CapabilityRegisterEvent}). They are cached for replay across\n * subscriber reconnects and session hibernation.\n *\n * @example Defining a client-side fire-and-forget tool (uses the runner's\n * `defineCapability` helper, which serializes a {@link Capability} to the wire):\n * ```ts\n * const reactTool = defineCapability({\n * name: 'platform.react',\n * description: 'Acknowledge a user message with a Unicode emoji.',\n * side: 'client',\n * origin: { kind: 'client' },\n * fireAndForget: true,\n * input: z.object({ emoji: z.string(), targetSeq: z.number().optional() }),\n * handler: async ({ emoji, targetSeq }, ctx) => { ... },\n * });\n * ```\n *\n * @see {@link RenderCapability} for capabilities that render UI components\n * @see {@link CapabilityOrigin} for who-registered-it metadata\n * @see {@link isRenderCapability} for the type-guard\n *\n * @category Capabilities\n * @since 2.0.0\n * @docLink packages/types/capabilities#capability\n */\nexport type Capability = {\n /** Unique within a session. Convention: namespaced as `<origin>.<name>` (e.g. `platform.react`, `ui.gif`). */\n name: string;\n /**\n * Human-readable label for user-facing surfaces (cmdK action palette,\n * capability menus, debug panels). Falls back to {@link Capability.name}\n * when omitted. Pure presentation — the LLM sees `name`, not `displayName`.\n */\n displayName?: string;\n /** Human/LLM-readable summary. Shown to the LLM as part of tool registration. */\n description: string;\n /** JSON Schema validating the invocation arguments. Authored as Zod, converted at register time. */\n inputSchema: Record<string, unknown>;\n /** Optional return shape. Omit for fire-and-forget effects. */\n outputSchema?: Record<string, unknown>;\n /** Where the handler runs. `client` = host platform, `agent` = runtime/skill/connector. */\n side: \"client\" | \"agent\";\n /** Discriminated tag identifying who registered the capability. Used for trust enforcement and audit. */\n origin: CapabilityOrigin;\n /** Lifetime: `session` survives the whole session, `turn` is dropped at end-of-turn. */\n scope?: \"session\" | \"turn\";\n /** When true, the bridge auto-resolves with `{}` immediately and runs the handler in the background. */\n fireAndForget?: boolean;\n /** When true, the platform shows a confirm UI before dispatch and waits for {@link CapabilityApproveCommand}. */\n requiresApproval?: boolean;\n /** Documentation hint (not enforced) describing whether this is a side-effect, render, or pure query. */\n kind?: \"effect\" | \"render\" | \"query\";\n /**\n * Whether this capability should be exposed in user-facing surfaces (cmdK\n * action palette, capability menus). When omitted, the consumer applies a\n * default per-origin via {@link isUserInvokable}.\n *\n * - `true`: surface in cmdK and capability menus.\n * - `false`: hide from user surfaces (LLM-only or low-level).\n * - `undefined`: defer to {@link isUserInvokable}'s inference rules.\n *\n * @deprecated Set {@link Capability.audience} instead. `userInvokable` is\n * kept as a read-only shim for v2.x consumers and is honoured by\n * {@link isUserInvokable} when {@link Capability.audience} is absent.\n */\n userInvokable?: boolean;\n /**\n * Audience scoping for this capability. See {@link CapabilityAudience} for\n * the meaning of each value and combinations.\n *\n * When omitted, consumers treat the capability as `['llm', 'user']` (the\n * v2.x default). Host RPCs and runner RPCs MUST set this to `['runtime']`\n * so they never leak to the LLM tool list or the user-facing surfaces.\n *\n * @category Capabilities\n * @since 3.0.0\n */\n audience?: CapabilityAudience[];\n /** Appended to the system prompt's `<CAPABILITIES>` section. Use for usage hints the LLM should always see. */\n promptFragment?: string;\n /**\n * Per-capability override for how long the runner waits on the\n * `capability_result` round-trip before timing out. When omitted the\n * runner applies its default (`DEFAULT_CAPABILITY_CALL_TIMEOUT_MS`, 60s).\n *\n * Set this for capabilities that legitimately block far longer than a\n * normal tool call — e.g. `platform.ask_session` suspends the caller's\n * turn until a peer session answers, which can take minutes.\n *\n * @category Capabilities\n * @since 3.3.0\n */\n callTimeoutMs?: number;\n /** Present iff this is a render capability — see {@link RenderCapability}. */\n render?: RenderSpec;\n};\n\n/**\n * A {@link Capability} that produces a UI surface when invoked. The narrowed\n * type guarantees `render` is set, which simplifies frontend lookup.\n *\n * @see {@link isRenderCapability}\n *\n * @category Capabilities\n * @since 2.0.0\n * @docLink packages/types/capabilities#render-capability\n */\nexport type RenderCapability = Capability & { render: NonNullable<Capability[\"render\"]> };\n\n/**\n * Type-guard for {@link RenderCapability}. Use after {@link Capability}\n * lookup to narrow the type before reading `render`.\n *\n * @example\n * ```ts\n * for (const cap of registry.list()) {\n * if (isRenderCapability(cap)) console.log(cap.render.targets);\n * }\n * ```\n *\n * @category Capabilities\n * @since 2.0.0\n * @docLink packages/types/capabilities#is-render-capability\n */\nexport function isRenderCapability(cap: Capability): cap is RenderCapability {\n return cap.render !== undefined;\n}\n\n/**\n * Decide whether a capability should be surfaced in user-facing actions\n * (cmdK action palette, capability menus).\n *\n * Resolution order (first match wins):\n *\n * 1. {@link Capability.audience} is set — return `audience.includes('user')`.\n * Capabilities scoped to `'runtime'` only never appear in user surfaces.\n * 2. {@link Capability.userInvokable} is set (v2.x shim) — return that value.\n * 3. Default per-origin inference table below.\n *\n * Default-inference rules (when both `audience` and `userInvokable` are\n * omitted):\n * | Origin | Default |\n * | ------------ | ---------------------------------------------------------------------- |\n * | `framework` | `false` (LLM discovery surfaces, e.g. `__capabilities.list`) |\n * | `client` | `false` (platform ack tools — `platform.react`, `platform.pass`) |\n * | `agent` | `false` (agent-defined; assume internal unless flagged) |\n * | `flow` | `false` (per-cap opt-in) |\n * | `connector` | `false` (low-level FS / data ops) |\n * | `mount` | `false` (low-level FS ops) |\n * | `mcp` | `true` if `kind === 'effect'`, else `false` |\n * | `skill` | `true` if `kind` ∈ {`effect`, `render`}, else `false` |\n *\n * @example\n * ```ts\n * for (const cap of capabilities.values()) {\n * if (isUserInvokable(cap)) registerCommandPaletteAction(cap);\n * }\n * ```\n *\n * @category Capabilities\n * @since 2.1.0\n * @docLink packages/types/capabilities#is-user-invokable\n */\nexport function isUserInvokable(cap: Capability): boolean {\n if (cap.audience !== undefined) {\n return cap.audience.includes(\"user\");\n }\n if (cap.userInvokable !== undefined) {\n return cap.userInvokable;\n }\n switch (cap.origin.kind) {\n case \"framework\":\n case \"client\":\n case \"agent\":\n case \"flow\":\n case \"connector\":\n case \"mount\":\n return false;\n case \"mcp\":\n return cap.kind === \"effect\";\n case \"skill\":\n return cap.kind === \"effect\" || cap.kind === \"render\";\n default:\n return false;\n }\n}\n\n// ---------------------------------------------------------------------------\n// Capability commands (client → agent)\n// ---------------------------------------------------------------------------\n\n/**\n * Register one or more capabilities mid-session (client → agent).\n *\n * The platform sends this when a new client-side tool becomes available\n * after `configure` has already returned (e.g. a user installs a new\n * extension during the session).\n *\n * @category Capabilities\n * @since 2.0.0\n * @docLink packages/types/capabilities#capability-register-command\n */\nexport type CapabilityRegisterCommand = {\n type: \"capability_register\";\n capabilities: Capability[];\n};\n\n/**\n * Deregister capabilities by name (client → agent). Names that are not\n * currently registered are ignored silently.\n *\n * @category Capabilities\n * @since 2.0.0\n * @docLink packages/types/capabilities#capability-deregister-command\n */\nexport type CapabilityDeregisterCommand = {\n type: \"capability_deregister\";\n names: string[];\n};\n\n/**\n * Return the result of a previously {@link CapabilityInvokedEvent | invoked} client-side\n * capability (client → agent). Bridges that registered the capability with\n * `fireAndForget: true` MAY skip this command; the bridge auto-resolves with `{}`.\n *\n * @category Capabilities\n * @since 2.0.0\n * @docLink packages/types/capabilities#capability-result-command\n */\nexport type CapabilityResultCommand = {\n type: \"capability_result\";\n /** Correlation token matching the {@link CapabilityInvokedEvent.callId}. */\n callId: string;\n /** Successful result payload, or an error envelope. */\n result: unknown | { error: string };\n};\n\n/**\n * Approve or reject a capability call that was invoked with\n * `requiresApproval: true` (client → agent). The platform shows a confirm\n * UI and forwards the user's decision via this command.\n *\n * @category Capabilities\n * @since 2.0.0\n * @docLink packages/types/capabilities#capability-approve-command\n */\nexport type CapabilityApproveCommand = {\n type: \"capability_approve\";\n /** Correlation token matching the {@link CapabilityInvokedEvent.callId}. */\n callId: string;\n /** User's decision. */\n decision: \"approved\" | \"rejected\";\n /** Optional rationale stored alongside the decision for audit. */\n feedback?: string;\n /** User ID of the decider (informational — framework enforces no policy). */\n decidedBy: string;\n};\n\n// ---------------------------------------------------------------------------\n// Capability events (agent → client)\n// ---------------------------------------------------------------------------\n\n/**\n * Register one or more capabilities mid-session (agent → client). Mirrors\n * {@link CapabilityRegisterCommand} for the agent-initiated direction; used\n * when the runtime adds a capability after `configure` (e.g. when a flow\n * starts and injects flow-scoped tools).\n *\n * @category Capabilities\n * @since 2.0.0\n * @docLink packages/types/capabilities#capability-register-event\n */\nexport type CapabilityRegisterEvent = {\n type: \"capability_register\";\n capabilities: Capability[];\n};\n\n/**\n * Deregister capabilities by name (agent → client).\n *\n * @category Capabilities\n * @since 2.0.0\n * @docLink packages/types/capabilities#capability-deregister-event\n */\nexport type CapabilityDeregisterEvent = {\n type: \"capability_deregister\";\n names: string[];\n};\n\n/**\n * Notify the client that a capability has been invoked by the LLM (agent →\n * client). For client-side capabilities the platform's handler runs in\n * response to this event and replies with {@link CapabilityResultCommand}.\n *\n * @category Capabilities\n * @since 2.0.0\n * @docLink packages/types/capabilities#capability-invoked-event\n */\nexport type CapabilityInvokedEvent = {\n type: \"capability_invoked\";\n /** Correlation token for the eventual {@link CapabilityResultCommand}. */\n callId: string;\n /** Name of the invoked {@link Capability}. */\n name: string;\n /** Validated input payload (already conforms to the capability's `inputSchema`). */\n input: unknown;\n /** In v2.0.0 the LLM is the only invoker. */\n invokedBy: \"agent\";\n};\n\n/**\n * Notify the client that a render capability should be drawn (agent →\n * client). Emitted alongside {@link CapabilityInvokedEvent} when the\n * invoked capability's `render` block is populated.\n *\n * Clients without a render layer can fall back to the capability's\n * `render.fallback` markdown template.\n *\n * @category Capabilities\n * @since 2.0.0\n * @docLink packages/types/capabilities#render-invoked-event\n */\nexport type RenderInvokedEvent = {\n type: \"render_invoked\";\n /** Name of the invoked render capability. */\n capabilityName: string;\n /** Props passed to the rendered component (already conforms to `inputSchema`). */\n props: unknown;\n /** Correlation token shared with the matching {@link CapabilityInvokedEvent}. */\n callId: string;\n};\n","/**\n * Protocol versioning primitives for Skaile Agent Protocol v2.\n *\n * The protocol is versioned by a structured {@link ProtocolVersion} record\n * (`major.minor.patch`). The compatibility rule applied at handshake is\n * **major-equality**: a runner emits {@link IncompatibleProtocolEvent} and\n * shuts down when its declared major does not match the platform's announced\n * major. Minor and patch differences ride through transparently because\n * unknown fields are preserved on round-trip (see `MessageMeta` round-trip\n * contract in `messaging.ts`).\n *\n * @category Protocol\n * @since 2.0.0\n */\n\n/**\n * Structured semantic version triple for the agent protocol.\n *\n * @example\n * ```ts\n * const v: ProtocolVersion = { major: 2, minor: 0, patch: 0 };\n * ```\n *\n * @category Protocol\n * @since 2.0.0\n * @docLink packages/types/protocol-v2#protocol-version\n */\nexport type ProtocolVersion = {\n /** Incremented on breaking wire-format changes (field removed, semantics changed, required field added). */\n major: number;\n /** Incremented on additive wire-format changes (new optional fields, new event types). */\n minor: number;\n /** Incremented on bug-fix or doc-only changes that do not affect the wire. */\n patch: number;\n};\n\n/**\n * The protocol version the framework currently speaks. Runners and platforms\n * compare this against the peer's announced version at session boot via\n * `SessionInitCommand.protocolVersion`.\n *\n * @example\n * ```ts\n * import { PROTOCOL_VERSION } from '@skaile/workspaces/types';\n * if (cmd.protocolVersion.major !== PROTOCOL_VERSION.major) {\n * emit({ type: 'incompatible_protocol', agentVersion: PROTOCOL_VERSION, platformVersion: cmd.protocolVersion });\n * }\n * ```\n *\n * @category Protocol\n * @since 3.0.0\n *\n * Changed in 3.3.0:\n * Additive agent-to-agent (session-to-session) communication extension.\n * `AgentEvent` gains an `a2a_message` variant carrying cross-session messages\n * (`direction`, `peerSessionId`, `peerName`, `exchangeId`, `text`). `Capability`\n * gains an optional `callTimeoutMs?: number` so a long-running capability call\n * (e.g. a 5-minute `platform.ask_session`) can exceed the default capability-call\n * timeout. Both are additive: a peer that does not understand them ignores the\n * event / falls back to the default timeout, so they ride through transparently\n * under the major-equality rule.\n *\n * Changed in 3.2.0:\n * Additive wake-time resume cascade. `AgentReconfigureOptions` gains optional\n * `resumeSessionId` and `expectedCapabilitySignature` fields driving the tier-1\n * native SDK resume path; `AgentEvent` gains `ResumeAttemptedEvent` and\n * `ResumeFailedEvent`. `FinishedEvent` gains optional `customType` /\n * `customData` for capability-routed custom payloads. All additive — clients\n * that omit the resume hint or ignore the new events keep working unchanged.\n *\n * Changed in 3.1.0:\n * Additive cost / token usage extension. `FinishedEvent` gains an optional\n * `tokens?: TokenUsage` field carrying per-turn input / output / cache-read /\n * cache-creation / reasoning token counts. `AgentDriver.getTokenUsage()` is\n * widened to return the same `TokenUsage` shape (existing consumers reading\n * `inputTokens` / `outputTokens` keep working unchanged). Drivers that do not\n * surface token usage continue to return `null` / omit the field.\n *\n * Changed in 3.0.0:\n * Major bump for the deterministic session bootstrap rewrite. `ConfigureCommandV2`,\n * `provision_secrets`, `request_access_token`, `add_resource`, `remove_resource`,\n * `set_log_level`, `state_action`, `lifecycle`, `remount_mount`, `compact`, and\n * `reconfigure_agent` are removed from the `AgentCommand` union. Their semantics\n * are reachable through:\n * - `session_init` (one deterministic envelope at session start that delivers\n * identity, resolved config, pre-minted credentials, secrets, capabilities,\n * shared state, active flows, resume hints, and logging config),\n * - `host.refresh_credential` (capability invocation that replaces the\n * refresh-on-401 path of `request_access_token`), and\n * - `runner.*` capabilities (`runner.add_mount`, `runner.add_connector`,\n * `runner.remove_resource`, `runner.update_credential`, `runner.set_log_level`,\n * `runner.set_state`, `runner.lifecycle`) invoked by the platform via the\n * bidirectional capability registry.\n *\n * Capabilities gain an `audience: ('llm' | 'user' | 'runtime')[]` field that\n * scopes visibility: host RPCs (`host.*`) and runner RPCs (`runner.*`) are\n * `['runtime']` and never reach the LLM tool list or the user-facing command\n * palette. v2.x capabilities without an explicit `audience` default to\n * `['llm', 'user']`, preserving prior behaviour.\n *\n * Spec: `_devlog/specs/2026-05-10-deterministic-session-bootstrap.md`.\n *\n * @docLink packages/types/protocol-v3#protocol-version\n */\nexport const PROTOCOL_VERSION: ProtocolVersion = { major: 3, minor: 3, patch: 0 };\n\n/**\n * String form of {@link PROTOCOL_VERSION}, kept in lock-step. Useful for\n * `package.json` version fields and HTTP `User-Agent` strings.\n *\n * @category Protocol\n * @since 3.0.0\n * @docLink packages/types/protocol-v3#protocol-version\n */\nexport const PROTOCOL_VERSION_STRING = \"3.3.0\";\n\n/**\n * Parse a `\"major.minor.patch\"` string into a {@link ProtocolVersion}.\n *\n * @param s - the version string to parse, exactly three dot-separated non-negative integers\n * @returns the parsed protocol version\n * @throws {Error} if the string is not exactly three dot-separated non-negative integers\n *\n * @example\n * ```ts\n * parseVersion('2.0.0'); // { major: 2, minor: 0, patch: 0 }\n * parseVersion('2.1'); // throws\n * ```\n *\n * @category Protocol\n * @since 2.0.0\n * @docLink packages/types/protocol-v2#parse-version\n */\nexport function parseVersion(s: string): ProtocolVersion {\n const parts = s.split(\".\");\n if (parts.length !== 3) {\n throw new Error(`Invalid ProtocolVersion: \"${s}\" (expected \"major.minor.patch\")`);\n }\n const [maj, min, pat] = parts;\n const major = Number(maj);\n const minor = Number(min);\n const patch = Number(pat);\n if (\n !Number.isInteger(major) ||\n !Number.isInteger(minor) ||\n !Number.isInteger(patch) ||\n major < 0 ||\n minor < 0 ||\n patch < 0\n ) {\n throw new Error(`Invalid ProtocolVersion: \"${s}\" (each part must be a non-negative integer)`);\n }\n return { major, minor, patch };\n}\n\n/**\n * Format a {@link ProtocolVersion} record into its `\"major.minor.patch\"` string form.\n *\n * @param v - the protocol version to format\n * @returns the dot-joined string form\n *\n * @example\n * ```ts\n * formatVersion({ major: 2, minor: 0, patch: 0 }); // '2.0.0'\n * ```\n *\n * @category Protocol\n * @since 2.0.0\n * @docLink packages/types/protocol-v2#format-version\n */\nexport function formatVersion(v: ProtocolVersion): string {\n return `${v.major}.${v.minor}.${v.patch}`;\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../types/src/manifests/_shared.ts","../types/src/manifests/agent.ts","../types/src/manifests/connector.ts","../types/src/manifests/mount.ts","../types/src/manifests/skill.ts","../types/src/manifests/contract.ts","../types/src/manifests/mcp-server.ts","../types/src/manifests/prompt.ts","../types/src/manifests/persona.ts","../types/src/manifests/preset.ts","../types/src/manifests/ruleset.ts","../types/src/manifests/index.ts"],"names":["z2","z3","z4","z5","z6","z7","z8","z9","z10","z11"],"mappings":";;;AAUO,IAAM,eAAA,GAAkB;AAAA,EAC7B,OAAA;AAAA,EACA,OAAA;AAAA,EACA,WAAA;AAAA,EACA,OAAA;AAAA,EACA,MAAA;AAAA,EACA,UAAA;AAAA,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AQ,cAAA;AAAA,EACR,YAAA,EAAc,iBAAA;AAAA,EACd,OAAA,EAAS,eAAA;AAAA,EACT,OAAA,EAAS;AACX,CAAA;AASK,SAAS,cAAA,CAAe,MAAiB,IAAA,EAAkD;AAChG,EAAA,MAAM,SAAA,GAAY,WAAW,IAAI,CAAA;AACjC,EAAA,IAAI,CAAC,SAAA,EAAW;AACd,IAAA,OAAO,EAAE,EAAA,EAAI,KAAA,EAAO,MAAA,EAAQ,CAAC,EAAE,IAAA,EAAM,MAAA,EAAQ,OAAA,EAAS,CAAA,oBAAA,EAAuB,IAAI,CAAA,CAAA,EAAI,CAAA,EAAE;AAAA,EACzF;AACA,EAAA,OAAO,UAAU,IAAI,CAAA;AACvB","file":"chunk-GB4SEEK4.js","sourcesContent":["/**\n * Shared manifest frontmatter schemas and types.\n * Common across all 11 asset kinds + Preset.\n */\nimport * as z from \"zod\";\n\n// ---------------------------------------------------------------------------\n// Asset kind enum\n// ---------------------------------------------------------------------------\n\nexport const AssetKindValues = [\n \"skill\",\n \"agent\",\n \"connector\",\n \"mount\",\n \"flow\",\n \"contract\",\n \"prompt\",\n \"mcp-server\",\n \"knowledge\",\n \"persona\",\n \"ruleset\",\n] as const;\n\nexport const AssetKindSchema = z.enum(AssetKindValues);\nexport type AssetKind = z.infer<typeof AssetKindSchema>;\n\n// ---------------------------------------------------------------------------\n// Shared metadata sub-schemas\n// ---------------------------------------------------------------------------\n\n/** Artifact dependency (requires/produces/consumes in skill metadata). */\nexport const ArtifactRefSchema = z.object({\n id: z.string().min(1),\n description: z.string().optional(),\n gate: z.enum([\"hard\", \"soft\"]).optional(),\n path: z.string().optional(),\n});\n\n/** File prerequisite for a skill. */\nexport const FilePrerequisiteSchema = z.object({\n path: z.string().min(1),\n gate: z.enum([\"hard\", \"soft\"]).optional(),\n description: z.string().optional(),\n});\n\n/** User input definition (for skill user_inputs or metadata.prerequisites.inputs_*). */\nexport const UserInputSchema = z.looseObject({\n key: z.string().min(1).optional(),\n id: z.string().min(1).optional(),\n label: z.string().optional(),\n prompt: z.string().optional(),\n type: z.string().optional(),\n required: z.boolean().optional(),\n options: z.array(z.string()).optional(),\n values: z.array(z.union([z.string(), z.number()])).optional(),\n default: z\n .union([z.string(), z.number(), z.boolean(), z.array(z.union([z.string(), z.number()]))])\n .optional(),\n hint: z.string().optional(),\n});\n\n/** Field definition for connectors/mounts. */\nexport const FieldSchema = z.object({\n key: z.string().min(1),\n label: z.string().optional(),\n required: z.boolean().optional(),\n sensitive: z.boolean().optional(),\n type: z.string().optional(),\n default: z.union([z.string(), z.number(), z.boolean()]).optional(),\n});\n\n// ---------------------------------------------------------------------------\n// Common metadata block (appears inside metadata: in most manifest kinds)\n// ---------------------------------------------------------------------------\n\nexport const CommonMetadataSchema = z.looseObject({\n version: z.string().optional(),\n author: z.string().optional(),\n tags: z.array(z.string()).optional(),\n stage: z.enum([\"alpha\", \"beta\", \"stable\", \"deprecated\"]).optional(),\n source: z.string().optional(),\n do_not_invoke: z.boolean().optional(),\n});\n\n// ---------------------------------------------------------------------------\n// Common frontmatter fields (top-level, shared across kinds)\n// ---------------------------------------------------------------------------\n\n/**\n * Fields that can appear at the top level of any manifest's frontmatter.\n * Not all are required -- each kind schema intersects with its own specifics.\n */\nexport const BaseFrontmatterSchema = z.object({\n name: z.string().min(1),\n description: z.string().min(1),\n version: z.string().optional(),\n\n // Catalog identity (populated at discovery or authoring time)\n publisher: z.string().optional(),\n category: z.string().optional(),\n license: z.string().optional(),\n keywords: z.array(z.string()).optional(),\n});\n\n// ---------------------------------------------------------------------------\n// Validation result type\n// ---------------------------------------------------------------------------\n\nexport interface ManifestValidationSuccess<T> {\n ok: true;\n data: T;\n}\n\nexport interface ManifestValidationFailure {\n ok: false;\n errors: Array<{ path: string; message: string }>;\n}\n\nexport type ManifestValidationResult<T> = ManifestValidationSuccess<T> | ManifestValidationFailure;\n\nexport function validateManifest<T>(\n schema: z.ZodType<T>,\n data: unknown,\n): ManifestValidationResult<T> {\n const result = schema.safeParse(data);\n if (result.success) {\n return { ok: true, data: result.data };\n }\n return {\n ok: false,\n errors: result.error.issues.map((issue) => ({\n path: issue.path.join(\".\"),\n message: issue.message,\n })),\n };\n}\n","import * as z from \"zod\";\nimport { type ManifestValidationResult, validateManifest } from \"./_shared.js\";\n\n// ---------------------------------------------------------------------------\n// Model identifier validation + normalization\n// ---------------------------------------------------------------------------\n\n/**\n * Anthropic model aliases recognized by Claude Code and the Claude Agent SDK.\n *\n * - `inherit` — use the parent agent's model (Claude Code only).\n * - `opus` / `sonnet` / `haiku` — auto-rolling pointer to the current top model\n * in that family. Resolved by Claude Code / the Claude SDK at runtime.\n *\n * Use these in `agent.yaml` `model.preferred` for portability across Claude\n * Code and `claude-sdk`. Use a full ID (see {@link ANTHROPIC_FULL_ID_PATTERN})\n * when you need to pin to a specific Anthropic release.\n */\nexport const ANTHROPIC_MODEL_ALIASES = [\"inherit\", \"opus\", \"sonnet\", \"haiku\"] as const;\nexport type AnthropicModelAlias = (typeof ANTHROPIC_MODEL_ALIASES)[number];\n\n/**\n * Regex matching a full Anthropic model identifier, optionally provider-prefixed.\n *\n * Accepts both the Claude 4+ \"family-first\" form and the legacy \"version-first\"\n * form used by Claude 3.x and some OpenRouter aliases.\n *\n * Examples that match (family-first):\n * - `claude-opus-4-6`\n * - `claude-sonnet-4-5`\n * - `claude-haiku-4-5-20251001`\n * - `anthropic/claude-sonnet-4.6` (OpenRouter form)\n *\n * Examples that match (version-first / legacy):\n * - `claude-3-5-sonnet-20241022`\n * - `anthropic/claude-3.7-sonnet`\n *\n * The version segment requires at least two numeric components separated by\n * `-` or `.`, so partial IDs like `claude-opus-4` (missing minor version) are\n * correctly rejected.\n */\nexport const ANTHROPIC_FULL_ID_PATTERN =\n /^(?:[a-z0-9-]+\\/)?claude-(?:(?:opus|sonnet|haiku)-\\d+(?:[-.]\\d+)+|\\d+(?:[-.]\\d+)+-(?:opus|sonnet|haiku))(?:-\\d{8})?$/;\n\n/**\n * Regex matching an Amazon Bedrock-form Anthropic model identifier: an\n * optional region/scope prefix (`us.` / `eu.` / `apac.` / `global.`), the\n * `anthropic.` vendor segment, the same family/version core as\n * {@link ANTHROPIC_FULL_ID_PATTERN}, plus Bedrock's optional\n * `-v<major>[:<minor>]` suffix.\n *\n * Examples that match:\n * - `anthropic.claude-3-5-sonnet-20241022-v2:0`\n * - `us.anthropic.claude-opus-4-6-v1:0`\n * - `anthropic.claude-sonnet-4-5-20250929-v1:0`\n *\n * Does NOT match `anthropic.gpt-4` (not a Claude family) or a bare\n * `us.claude-…` (the `anthropic.` segment is required).\n *\n * @since 1.3.0\n */\nexport const BEDROCK_MODEL_ID_PATTERN =\n /^(?:(?:us|eu|apac|global)\\.)?anthropic\\.claude-(?:(?:opus|sonnet|haiku)-\\d+(?:[-.]\\d+)+|\\d+(?:[-.]\\d+)+-(?:opus|sonnet|haiku))(?:-\\d{8})?(?:-v\\d+(?::\\d+)?)?$/;\n\n/**\n * Regex matching a Google Vertex AI publisher-form Anthropic identifier —\n * a first-party ID pinned with an `@YYYYMMDD` date suffix instead of the\n * native `-YYYYMMDD` (e.g. `claude-sonnet-4-5@20250929`).\n *\n * @since 1.3.0\n */\nexport const VERTEX_MODEL_ID_PATTERN =\n /^claude-(?:(?:opus|sonnet|haiku)-\\d+(?:[-.]\\d+)+|\\d+(?:[-.]\\d+)+-(?:opus|sonnet|haiku))@\\d{8}$/;\n\n/**\n * Zod schema accepting a Claude Code alias, a full Anthropic ID, a Bedrock-form\n * ID (see {@link BEDROCK_MODEL_ID_PATTERN}), or a Vertex `@date`-pinned ID\n * (see {@link VERTEX_MODEL_ID_PATTERN}).\n *\n * Anything else fails validation. Use {@link normalizeAnthropicModel} to coerce\n * unrecognized values to a safe alias instead of failing, and\n * {@link modelIdSchemaForCloud} for free-form IDs under `cloud: gateway`.\n */\nexport const ModelIdSchema = z.union([\n z.enum(ANTHROPIC_MODEL_ALIASES),\n z\n .string()\n .regex(\n ANTHROPIC_FULL_ID_PATTERN,\n \"Invalid Anthropic model ID. Use an alias (opus | sonnet | haiku | inherit), a full ID (e.g. claude-sonnet-4-6), a Bedrock ID (e.g. us.anthropic.claude-opus-4-6-v1:0), or a Vertex ID (e.g. claude-sonnet-4-5@20250929).\",\n ),\n z.string().regex(BEDROCK_MODEL_ID_PATTERN),\n z.string().regex(VERTEX_MODEL_ID_PATTERN),\n]);\n\n/**\n * Contextual model-ID schema: `cloud: gateway` routes through an arbitrary\n * proxy whose model namespace we cannot know, so any non-empty string is\n * accepted there; every other cloud (or none) uses {@link ModelIdSchema}.\n *\n * @since 1.3.0\n */\nexport function modelIdSchemaForCloud(cloud?: string): z.ZodType<string> {\n return cloud === \"gateway\" ? z.string().min(1) : (ModelIdSchema as z.ZodType<string>);\n}\n\n/**\n * Normalize an arbitrary model string to a safe Claude Code value.\n *\n * - If `input` is a recognized alias or a full / Bedrock-form / Vertex-form ID,\n * returns it unchanged.\n * - If `input` looks like `claude-<family>-...` but doesn't match any full-ID\n * regex (e.g. the broken `claude-opus-4`), returns the family alias.\n * - Otherwise returns `fallback` (default `\"sonnet\"` — Claude Code's default).\n *\n * Used by renderers that target Claude Code / the Claude SDK to coerce stale\n * or malformed model fields into a working alias rather than propagating a\n * silent runtime failure. All full-pattern checks run BEFORE the family\n * fallback so a valid Bedrock/Vertex ID is never downgraded to an alias.\n */\nexport function normalizeAnthropicModel(\n input: string | undefined | null,\n fallback: AnthropicModelAlias = \"sonnet\",\n): string {\n if (!input) return fallback;\n if ((ANTHROPIC_MODEL_ALIASES as readonly string[]).includes(input)) return input;\n if (ANTHROPIC_FULL_ID_PATTERN.test(input)) return input;\n if (BEDROCK_MODEL_ID_PATTERN.test(input) || VERTEX_MODEL_ID_PATTERN.test(input)) return input;\n const familyMatch = input.match(/claude-(opus|sonnet|haiku)/i);\n if (familyMatch) return familyMatch[1]!.toLowerCase() as AnthropicModelAlias;\n return fallback;\n}\n\nconst ModelConfigSchema = z.looseObject({\n preferred: ModelIdSchema.optional(),\n fallback: z.array(ModelIdSchema).optional(),\n constraints: z\n .looseObject({\n temperature: z.number().optional(),\n max_tokens: z.number().optional(),\n })\n .optional(),\n});\n\n// ---------------------------------------------------------------------------\n// Composition binding types (Task 1.7)\n// ---------------------------------------------------------------------------\n\nexport const BindingValues = [\"discoverable\", \"inline-live\", \"inline-snapshot\"] as const;\nexport const BindingSchema = z.enum(BindingValues);\nexport type Binding = z.infer<typeof BindingSchema>;\n\n/**\n * A single composition item within an agent's `composes:` field.\n *\n * - `kind`: the asset kind being composed (skill, connector, ruleset, etc.)\n * - `ref`: asset ref (e.g. '@skaile/gmail@^1')\n * - `instance`: optional Library Instance ref to reuse (e.g. 'library://personal/instances/uuid')\n * - `binding`: how the asset integrates into the agent runtime; defaults per-kind\n */\nexport const AgentComposeItemSchema = z.object({\n kind: z.string().min(1),\n ref: z.string().min(1),\n instance: z.string().optional(),\n binding: BindingSchema.optional(),\n});\n\nexport type AgentComposeItem = z.infer<typeof AgentComposeItemSchema>;\n\n// ---------------------------------------------------------------------------\n// Agent manifest\n// ---------------------------------------------------------------------------\n\nexport const AgentManifestSchema = z.looseObject({\n spec_version: z.string().optional(),\n name: z.string().min(1),\n version: z.string().optional(),\n description: z.string().min(1),\n extends: z.string().optional(),\n\n model: ModelConfigSchema.optional(),\n skills: z.array(z.string()).optional(),\n delegation: z.looseObject({ mode: z.string() }).optional(),\n runtime: z\n .looseObject({\n max_turns: z.number().optional(),\n timeout: z.number().optional(),\n })\n .optional(),\n\n author: z.string().optional(),\n license: z.string().optional(),\n tags: z.array(z.string()).optional(),\n keywords: z.array(z.string()).optional(),\n\n // v2 composition (Task 1.7)\n composes: z.array(AgentComposeItemSchema).optional(),\n\n metadata: z.record(z.string(), z.unknown()).optional(),\n});\n\nexport type AgentManifest = z.infer<typeof AgentManifestSchema>;\n\nexport function validateAgent(data: unknown): ManifestValidationResult<AgentManifest> {\n return validateManifest(AgentManifestSchema, data);\n}\n","import * as z from \"zod\";\nimport { FieldSchema, type ManifestValidationResult, validateManifest } from \"./_shared.js\";\n\nexport const ConnectorManifestSchema = z.looseObject({\n name: z.string().min(1),\n description: z.string().min(1),\n version: z.string().optional(),\n entry: z.string().min(1),\n npm_deps: z\n .object({\n required: z.array(z.string()).optional(),\n optional: z.array(z.string()).optional(),\n })\n .optional(),\n fields: z.array(FieldSchema).optional(),\n health_check: z.string().nullable().optional(),\n keywords: z.array(z.string()).optional(),\n license: z.string().optional(),\n});\n\nexport type ConnectorManifest = z.infer<typeof ConnectorManifestSchema>;\n\nexport function validateConnector(data: unknown): ManifestValidationResult<ConnectorManifest> {\n return validateManifest(ConnectorManifestSchema, data);\n}\n","import * as z from \"zod\";\nimport { FieldSchema, type ManifestValidationResult, validateManifest } from \"./_shared.js\";\n\nexport const MountManifestSchema = z.looseObject({\n name: z.string().min(1),\n description: z.string().min(1),\n version: z.string().optional(),\n entry: z.string().min(1),\n fields: z.array(FieldSchema).optional(),\n keywords: z.array(z.string()).optional(),\n license: z.string().optional(),\n});\n\nexport type MountManifest = z.infer<typeof MountManifestSchema>;\n\nexport function validateMount(data: unknown): ManifestValidationResult<MountManifest> {\n return validateManifest(MountManifestSchema, data);\n}\n","import * as z from \"zod\";\nimport {\n ArtifactRefSchema,\n CommonMetadataSchema,\n FilePrerequisiteSchema,\n type ManifestValidationResult,\n UserInputSchema,\n validateManifest,\n} from \"./_shared.js\";\n\nconst SkillMetadataSchema = CommonMetadataSchema.extend({\n parameters: z.record(z.string(), z.unknown()).optional(),\n artifacts: z\n .object({\n requires: z.array(ArtifactRefSchema).optional(),\n produces: z.array(ArtifactRefSchema).optional(),\n consumes: z.array(ArtifactRefSchema).optional(),\n })\n .optional(),\n prerequisites: z\n .object({\n files: z.array(FilePrerequisiteSchema).optional(),\n inputs_required: z.array(UserInputSchema).optional(),\n inputs_optional: z.array(UserInputSchema).optional(),\n // Parsed by the resolver's parseSkillRequirements; Zod would strip them otherwise.\n reads: z.array(z.object({ path: z.string(), description: z.string().optional() })).optional(),\n produces: z\n .array(z.object({ path: z.string(), description: z.string().optional() }))\n .optional(),\n resources: z\n .array(\n z.object({\n id: z.string(),\n operations: z.array(z.string()).optional(),\n optional: z.boolean().optional(),\n description: z.string().optional(),\n }),\n )\n .optional(),\n connectors: z\n .array(\n z.object({\n driver: z.string(),\n access: z.enum([\"read-only\", \"read-write\"]).optional(),\n }),\n )\n .optional(),\n })\n .optional(),\n produces: z.array(z.object({ path: z.string(), description: z.string().optional() })).optional(),\n});\n\nexport const SkillManifestSchema = z.looseObject({\n name: z.string().min(1),\n description: z.string().min(1),\n version: z.string().optional(),\n license: z.string().optional(),\n compatibility: z.string().optional(),\n keywords: z.array(z.string()).optional(),\n // agentskills.io standard field. Kept as `unknown` (not `string`) so a legacy\n // array form never hard-fails validateSkill — the string-typing rule is\n // advisory, owned by checkAgentSkillConformance (warn, not error).\n \"allowed-tools\": z.unknown().optional(),\n\n // Legacy fields (SKILL.md convention)\n source: z.string().optional(),\n user_inputs: z.array(UserInputSchema).optional(),\n reads_from: z.array(z.string()).optional(),\n writes_to: z.array(z.string()).optional(),\n\n metadata: SkillMetadataSchema.optional(),\n});\n\nexport type SkillManifest = z.infer<typeof SkillManifestSchema>;\n\nexport function validateSkill(data: unknown): ManifestValidationResult<SkillManifest> {\n return validateManifest(SkillManifestSchema, data);\n}\n","import * as z from \"zod\";\nimport {\n CommonMetadataSchema,\n type ManifestValidationResult,\n validateManifest,\n} from \"./_shared.js\";\n\nexport const ContractManifestSchema = z.looseObject({\n name: z.string().min(1),\n description: z.string().min(1),\n version: z.string().optional(),\n keywords: z.array(z.string()).optional(),\n license: z.string().optional(),\n metadata: CommonMetadataSchema.optional(),\n});\n\nexport type ContractManifest = z.infer<typeof ContractManifestSchema>;\n\nexport function validateContract(data: unknown): ManifestValidationResult<ContractManifest> {\n return validateManifest(ContractManifestSchema, data);\n}\n","import * as z from \"zod\";\nimport { type ManifestValidationResult, validateManifest } from \"./_shared.js\";\n\nexport const McpServerManifestSchema = z.looseObject({\n name: z.string().min(1),\n description: z.string().min(1),\n version: z.union([z.string(), z.number()]).optional(),\n // \"http\" is the runtime literal the runner honours (StreamableHTTPClientTransport);\n // \"streamable-http\" is accepted as an MCP-spec-aligned alias and normalized to\n // \"http\" in mcpDeclFromCatalogEntry. Keep both until the alias is retired.\n transport: z.enum([\"stdio\", \"sse\", \"http\", \"streamable-http\"]).optional(),\n command: z.string().optional(),\n args: z.array(z.string()).optional(),\n env: z.record(z.string(), z.string()).optional(),\n url: z.string().optional(),\n headers: z.record(z.string(), z.string()).optional(),\n keywords: z.array(z.string()).optional(),\n license: z.string().optional(),\n // Optional runnable payload fetched + sha256-verified by the platform\n // session-materializer into the asset dir at materialize time (e.g. a bundled\n // server.js shipped as a GitHub release asset). `dest` defaults to the URL\n // basename.\n payload: z\n .object({\n // https only — bare `z.string().url()` also accepts file:/data:/javascript: schemes.\n url: z\n .string()\n .url()\n .refine((u) => u.startsWith(\"https://\"), { message: \"payload url must be https\" }),\n sha256: z.string().regex(/^[a-f0-9]{64}$/),\n // Plain filename, no path separators — schema-level guard against a traversal dest.\n dest: z\n .string()\n .regex(/^[^/\\\\]+$/, { message: \"dest must be a plain filename, not a path\" })\n .optional(),\n })\n .optional(),\n});\n\nexport type McpServerManifest = z.infer<typeof McpServerManifestSchema>;\n\nexport function validateMcpServer(data: unknown): ManifestValidationResult<McpServerManifest> {\n return validateManifest(McpServerManifestSchema, data);\n}\n","import * as z from \"zod\";\nimport {\n CommonMetadataSchema,\n type ManifestValidationResult,\n validateManifest,\n} from \"./_shared.js\";\n\nexport const PromptManifestSchema = z.looseObject({\n name: z.string().min(1),\n description: z.string().min(1),\n version: z.string().optional(),\n keywords: z.array(z.string()).optional(),\n license: z.string().optional(),\n metadata: CommonMetadataSchema.optional(),\n});\n\nexport type PromptManifest = z.infer<typeof PromptManifestSchema>;\n\nexport function validatePrompt(data: unknown): ManifestValidationResult<PromptManifest> {\n return validateManifest(PromptManifestSchema, data);\n}\n","import * as z from \"zod\";\nimport {\n CommonMetadataSchema,\n type ManifestValidationResult,\n validateManifest,\n} from \"./_shared.js\";\n\nexport const PersonaManifestSchema = z.looseObject({\n name: z.string().min(1),\n description: z.string().min(1),\n version: z.string().optional(),\n keywords: z.array(z.string()).optional(),\n license: z.string().optional(),\n metadata: CommonMetadataSchema.optional(),\n});\n\nexport type PersonaManifest = z.infer<typeof PersonaManifestSchema>;\n\nexport function validatePersona(data: unknown): ManifestValidationResult<PersonaManifest> {\n return validateManifest(PersonaManifestSchema, data);\n}\n","/**\n * Polymorphic Preset manifest schema.\n *\n * A Preset is the unified composition + configuration primitive. Items can be:\n * - Asset ref (plain or with inline config + placeholders)\n * - Library Instance ref (`library://tier/instances/id`)\n * - Nested Preset ref (resolved recursively, max depth 3)\n *\n * Apply semantics derive from ref type, not an explicit mode field.\n */\nimport * as z from \"zod\";\nimport { type ManifestValidationResult, validateManifest } from \"./_shared.js\";\n\n// ---------------------------------------------------------------------------\n// Placeholder types\n// ---------------------------------------------------------------------------\n\nconst PlaceholderTypeValues = [\n \"text\",\n \"multiline\",\n \"secret\",\n \"number\",\n \"boolean\",\n \"enum\",\n \"oauth\",\n \"instance-picker\",\n] as const;\n\nexport const PlaceholderTypeSchema = z.enum(PlaceholderTypeValues);\n\nexport const PlaceholderSchema = z.object({\n key: z.string().min(1),\n prompt: z.string().optional(),\n type: PlaceholderTypeSchema.optional(),\n required: z.boolean().optional(),\n default: z.union([z.string(), z.number(), z.boolean()]).optional(),\n values: z.array(z.union([z.string(), z.number()])).optional(),\n});\n\n// ---------------------------------------------------------------------------\n// Compose item (for agents within presets)\n// ---------------------------------------------------------------------------\n\nconst ComposeRefSchema = z.object({\n kind: z.string().min(1),\n ref: z.string().min(1),\n});\n\n// ---------------------------------------------------------------------------\n// Preset item\n// ---------------------------------------------------------------------------\n\nexport const PresetItemSchema = z.looseObject({\n /** Asset ref, Library Instance ref, or nested Preset ref. */\n ref: z.string().min(1),\n /** Local item ID for cross-item references (#item-id). */\n id: z.string().optional(),\n /** Author-prefilled non-secret config values. */\n config: z.record(z.string(), z.unknown()).optional(),\n /** User/secret values prompted at install. */\n placeholders: z.array(PlaceholderSchema).optional(),\n /** How placeholder values fold into the Instance config. */\n materialize: z.record(z.string(), z.string()).optional(),\n /** Composition for agent items. */\n composes: z.array(ComposeRefSchema).optional(),\n /** Outer-Preset-author-supplied placeholder values for nested Presets. */\n inputs: z.record(z.string(), z.unknown()).optional(),\n});\n\n// ---------------------------------------------------------------------------\n// Preset-level input (rare, shared across items)\n// ---------------------------------------------------------------------------\n\nconst PresetInputSchema = z.object({\n key: z.string().min(1),\n type: PlaceholderTypeSchema.optional(),\n prompt: z.string().optional(),\n required: z.boolean().optional(),\n values: z.array(z.union([z.string(), z.number()])).optional(),\n default: z.union([z.string(), z.number(), z.boolean()]).optional(),\n});\n\n// ---------------------------------------------------------------------------\n// Preset manifest\n// ---------------------------------------------------------------------------\n\nexport const PresetManifestSchema = z.looseObject({\n publisher: z.string().optional(),\n name: z.string().min(1),\n version: z.union([z.string(), z.number()]),\n description: z.string().min(1),\n category: z.string().optional(),\n license: z.string().optional(),\n keywords: z.array(z.string()).optional(),\n\n /** 1+ polymorphic items. */\n items: z.array(PresetItemSchema).min(1),\n\n /** Preset-level inputs shared across items (rare). */\n inputs: z.array(PresetInputSchema).optional(),\n});\n\nexport type PresetManifest = z.infer<typeof PresetManifestSchema>;\nexport type PresetItem = z.infer<typeof PresetItemSchema>;\nexport type Placeholder = z.infer<typeof PlaceholderSchema>;\n\nexport function validatePreset(data: unknown): ManifestValidationResult<PresetManifest> {\n return validateManifest(PresetManifestSchema, data);\n}\n","import * as z from \"zod\";\nimport {\n CommonMetadataSchema,\n type ManifestValidationResult,\n validateManifest,\n} from \"./_shared.js\";\n\nexport const RulesetManifestSchema = z.looseObject({\n name: z.string().min(1),\n description: z.string().min(1),\n version: z.string().optional(),\n keywords: z.array(z.string()).optional(),\n license: z.string().optional(),\n metadata: CommonMetadataSchema.optional(),\n});\n\nexport type RulesetManifest = z.infer<typeof RulesetManifestSchema>;\n\nexport function validateRuleset(data: unknown): ManifestValidationResult<RulesetManifest> {\n return validateManifest(RulesetManifestSchema, data);\n}\n","/**\n * Asset manifest schemas for all 11 kinds + Preset.\n *\n * Each kind exports:\n * - <Kind>ManifestSchema (zod)\n * - <Kind>Manifest (type)\n * - validate<Kind>(data) -> ManifestValidationResult\n */\n\nexport type {\n AssetKind,\n ManifestValidationFailure,\n ManifestValidationResult,\n ManifestValidationSuccess,\n} from \"./_shared.js\";\n// Shared\nexport {\n ArtifactRefSchema,\n AssetKindSchema,\n AssetKindValues,\n BaseFrontmatterSchema,\n CommonMetadataSchema,\n FieldSchema,\n FilePrerequisiteSchema,\n UserInputSchema,\n validateManifest,\n} from \"./_shared.js\";\nexport type { AgentComposeItem, AgentManifest, AnthropicModelAlias, Binding } from \"./agent.js\";\nexport {\n AgentComposeItemSchema,\n AgentManifestSchema,\n ANTHROPIC_FULL_ID_PATTERN,\n ANTHROPIC_MODEL_ALIASES,\n BEDROCK_MODEL_ID_PATTERN,\n BindingSchema,\n BindingValues,\n ModelIdSchema,\n modelIdSchemaForCloud,\n normalizeAnthropicModel,\n validateAgent,\n VERTEX_MODEL_ID_PATTERN,\n} from \"./agent.js\";\nexport type { ConnectorManifest } from \"./connector.js\";\nexport { ConnectorManifestSchema, validateConnector } from \"./connector.js\";\nexport type { MountManifest } from \"./mount.js\";\nexport { MountManifestSchema, validateMount } from \"./mount.js\";\nexport type { SkillManifest } from \"./skill.js\";\n// Per-kind\nexport { SkillManifestSchema, validateSkill } from \"./skill.js\";\n\n// NOTE: FlowManifestSchema, FlowManifest, validateFlow live in @skaile/workspaces/factory-assets/connectors/flow/engine.\n// Import from @skaile/workspaces/factory-assets/connectors/flow/engine directly.\n\nexport type { ContractManifest } from \"./contract.js\";\nexport { ContractManifestSchema, validateContract } from \"./contract.js\";\nexport type { McpServerManifest } from \"./mcp-server.js\";\nexport { McpServerManifestSchema, validateMcpServer } from \"./mcp-server.js\";\nexport type { PromptManifest } from \"./prompt.js\";\nexport { PromptManifestSchema, validatePrompt } from \"./prompt.js\";\n\n// NOTE: KnowledgeManifestSchema, KnowledgeManifest, validateKnowledge moved to @skaile/library in 1.7.4.\n// Import from @skaile/library directly.\n\nexport type { PersonaManifest } from \"./persona.js\";\nexport { PersonaManifestSchema, validatePersona } from \"./persona.js\";\nexport type { Placeholder, PresetItem, PresetManifest } from \"./preset.js\";\n// Preset (composition entity, not an asset kind)\nexport {\n PlaceholderSchema,\n PlaceholderTypeSchema,\n PresetItemSchema,\n PresetManifestSchema,\n validatePreset,\n} from \"./preset.js\";\nexport type { RulesetManifest } from \"./ruleset.js\";\nexport { RulesetManifestSchema, validateRuleset } from \"./ruleset.js\";\n\n// ---------------------------------------------------------------------------\n// Kind-to-validator lookup\n// ---------------------------------------------------------------------------\n\nimport type { AssetKind, ManifestValidationResult } from \"./_shared.js\";\nimport { validateAgent } from \"./agent.js\";\nimport { validateConnector } from \"./connector.js\";\nimport { validateContract } from \"./contract.js\";\nimport { validateMcpServer } from \"./mcp-server.js\";\nimport { validateMount } from \"./mount.js\";\nimport { validatePersona } from \"./persona.js\";\nimport { validatePrompt } from \"./prompt.js\";\nimport { validateRuleset } from \"./ruleset.js\";\nimport { validateSkill } from \"./skill.js\";\n\n/**\n * Validators for core kinds that still live in this package.\n * flow: lives in @skaile/workspaces/factory-assets/connectors/flow/engine\n * knowledge: lives in @skaile/library\n *\n * For kinds not in this map, use the IAssetKindRegistry from @skaile/plugins.\n */\nconst validators: Partial<Record<AssetKind, (data: unknown) => ManifestValidationResult<unknown>>> =\n {\n skill: validateSkill,\n agent: validateAgent,\n connector: validateConnector,\n mount: validateMount,\n contract: validateContract,\n prompt: validatePrompt,\n \"mcp-server\": validateMcpServer,\n persona: validatePersona,\n ruleset: validateRuleset,\n };\n\n/**\n * Validate a manifest against the schema for the given asset kind.\n *\n * NOTE: flow validation lives in @skaile/workspaces/factory-assets/connectors/flow/engine. Use the\n * IAssetKindRegistry for kind-agnostic validation that includes all\n * registered providers (including extension kinds).\n */\nexport function validateByKind(kind: AssetKind, data: unknown): ManifestValidationResult<unknown> {\n const validator = validators[kind];\n if (!validator) {\n return { ok: false, errors: [{ path: \"kind\", message: `Unknown asset kind: ${kind}` }] };\n }\n return validator(data);\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../asset-manager/src/index.ts"],"names":["parseYaml","stringifyYaml"],"mappings":";;;;;;;;;;;;;;AA0FA,SAAS,iBAAiB,GAAA,EAAqB;AAC7C,EAAA,OAAO,IACJ,IAAA,EAAK,CACL,QAAQ,eAAA,EAAiB,aAAa,EACtC,OAAA,CAAQ,eAAA,EAAiB,EAAE,CAAA,CAC3B,OAAA,CAAQ,WAAW,EAAE,CAAA,CACrB,QAAQ,MAAA,EAAQ,EAAE,EAClB,WAAA,EAAY;AACjB;AAGA,IAAM,UAAA,GAAqC;AAAA,EACzC,KAAA,EAAO,UAAA;AAAA,EACP,KAAA,EAAO,UAAA;AAAA,EACP,MAAA,EAAQ,WAAA;AAAA,EACR,YAAA,EAAc,QAAA;AAAA,EACd,SAAA,EAAW,cAAA;AAAA,EACX,MAAA,EAAQ,WAAA;AAAA,EACR,QAAA,EAAU;AACZ,CAAA;AAQA,SAAS,iBAAA,CAAkB,MAAc,KAAA,EAA8C;AACrF,EAAA,MAAM,KAAA,GAAQ,WAAW,IAAI,CAAA;AAC7B,EAAA,IAAI,KAAA,EAAO;AACT,IAAA,MAAM,GAAA,GAAM,MAAM,IAAA,CAAK,CAAC,MAAM,CAAA,CAAE,QAAA,CAAS,KAAK,CAAC,CAAA;AAC/C,IAAA,IAAI,KAAK,OAAO,GAAA;AAAA,EAClB;AACA,EAAA,IAAI,IAAA,KAAS,QAAA,EAAU,OAAO,KAAA,CAAM,IAAA,CAAK,CAAC,CAAA,KAAM,CAAA,CAAE,QAAA,CAAS,YAAY,CAAC,CAAA;AACxE,EAAA,IAAI,SAAS,MAAA,EAAQ;AACnB,IAAA,OAAO,KAAA,CAAM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AO,OAAA,KAAY,MAAA,IAAa,OAAA,KAAY,MAAA,IAAa,OAAA,KAAY,OAAA;AAAA,IACvE,CAAC,CAAA;AACD,IAAA,IAAI,QAAQ,EAAA,EAAI;AACd,MAAA,GAAA,CAAI,YAAA,CAAa,MAAA,CAAO,GAAA,EAAK,CAAC,CAAA;AAC9B,MAAA,aAAA,CAAc,YAAYC,SAAA,CAAc,GAAA,EAAK,EAAE,SAAA,EAAW,GAAA,EAAK,CAAC,CAAA;AAAA,IAClE;AAAA,EACF;AAAA,EAEQ,cAAA,CAAe,MAAyB,IAAA,EAA6B;AAE3E,IAAA,MAAM,KAAA,GAAQ,SAAA,CAAU,IAAA,CAAK,UAAU,CAAA;AACvC,IAAA,IAAI,KAAA,CAAM,IAAI,CAAA,EAAG;AACf,MAAA,OAAO,WAAW,KAAA,CAAM,IAAI,CAAC,CAAA,GAAI,KAAA,CAAM,IAAI,CAAA,GAAI,IAAA;AAAA,IACjD;AAEA,IAAA,IAAI,KAAK,IAAA,EAAM;AACb,MAAA,MAAM,QAAA,GAAW,OAAA,CAAQ,IAAA,CAAK,UAAA,EAAY,KAAK,IAAI,CAAA;AACnD,MAAA,OAAO,UAAA,CAAW,QAAQ,CAAA,GAAI,QAAA,GAAW,IAAA;AAAA,IAC3C;AAGA,IAAA,MAAM,IAAA,GAAO,IAAA,CAAK,IAAA,CAAK,QAAA,EAAU,IAAI,CAAA;AACrC,IAAA,IAAI,UAAA,CAAW,IAAI,CAAA,EAAG,OAAO,IAAA;AAE7B,IAAA,MAAM,UAAA,GAAa,IAAA,CAAK,iBAAA,EAAkB,EAAG,IAAI,CAAA;AACjD,IAAA,IAAI,WAAW,IAAA,CAAK,UAAA,EAAY,MAAM,CAAC,GAAG,OAAO,UAAA;AAEjD,IAAA,OAAO,IAAA;AAAA,EACT;AACF","file":"chunk-OBSSORCE.js","sourcesContent":["/**\n * @skaile/asset-manager — programmatic AI asset management API.\n *\n * Manages project-local repositories, dependency resolution, deployment,\n * lock files, patches, and contribution workflows.\n *\n * Usage:\n * import { AssetManager } from \"@skaile/workspaces/asset-manager\"\n * const am = new AssetManager({ projectDir: \"/path/to/project\" })\n * await am.install()\n */\n\nimport { spawnSync } from \"node:child_process\";\nimport {\n existsSync,\n lstatSync,\n mkdirSync,\n readdirSync,\n readFileSync,\n rmSync,\n unlinkSync,\n writeFileSync,\n} from \"node:fs\";\nimport { dirname, join, resolve, sep } from \"node:path\";\nimport type {\n AiComponent,\n CatalogEntry,\n DriverTarget,\n LockFile,\n OverrideEntry,\n ProvenanceCandidate,\n SkWorkspaceConfig,\n SourceClone,\n SourceDeclaration,\n SourceEntry,\n StoreEntry,\n StoreFetcher,\n} from \"@skaile/workspaces/core\";\nimport {\n assetRefToStr,\n buildLockFile,\n buildProvenanceIndex,\n checkRepoStatus,\n applyPatch as coreApplyPatch,\n deployedBase,\n deployedDir,\n ensureRepo,\n extractForPatch,\n factoryAssetRoots,\n generatePatch,\n getGlobalCacheDir,\n getRepoCommit,\n globalCacheRoot,\n globalSkaileDir,\n isDeployed,\n migrateLegacyDir,\n parseAssetRef,\n parseRequires,\n readLinks,\n readLock,\n resolveAll,\n resolveAsset,\n resolveGlobalBackends,\n resolveGlobalSkWorkspaceConfig,\n resolveRuntimeAssets,\n resolveSkWorkspaceConfig,\n savePatch,\n scanRepo,\n SKAILE_YAML_DEFAULT,\n sourceCacheKey,\n sourceShortName,\n verifyLock,\n writeLock,\n} from \"@skaile/workspaces/core\";\nimport type { ResolveResult } from \"@skaile/workspaces/core\";\nimport type { AssetDefinition, AssetFetcher } from \"@skaile/workspaces/library\";\nimport type { InstallManifest } from \"@skaile/workspaces/types\";\nimport { parse as parseYaml, stringify as stringifyYaml } from \"yaml\";\nimport { commitChanges } from \"./contrib.js\";\nimport type { HistoryEntry } from \"./history.js\";\nimport { appendHistory, clearHistory, getRecentHistory } from \"./history.js\";\nimport type { DeployOptions } from \"./installer.js\";\nimport { createScaffold, deployAll, removeAsset } from \"./installer.js\";\n\n/**\n * Normalize a git remote URL to a comparable identity so the same repo declared\n * in different syntaxes (`https://…`, `git@host:…`, trailing `/`, `.git` suffix,\n * case) compares equal. Used to dedupe the implicit factory source against an\n * explicit user declaration.\n */\nfunction normalizeRepoUrl(url: string): string {\n return url\n .trim()\n .replace(/^git@([^:]+):/, \"https://$1/\") // git@host:org/repo → https://host/org/repo\n .replace(/^[a-z]+:\\/\\//i, \"\") // drop scheme\n .replace(/\\.git$/i, \"\")\n .replace(/\\/+$/, \"\")\n .toLowerCase();\n}\n\n/** Primary manifest filename for each asset kind (the deploy entry point). */\nconst MD_BY_KIND: Record<string, string> = {\n skill: \"SKILL.md\",\n agent: \"AGENT.md\",\n bundle: \"BUNDLE.md\",\n \"mcp-server\": \"MCP.md\",\n connector: \"CONNECTOR.md\",\n prompt: \"PROMPT.md\",\n contract: \"CONTRACT.md\",\n};\n\n/**\n * Pick a candidate's primary manifest file from its `files[]`. Fixed-name kinds\n * (skill/agent/contract/…) match their `MD_BY_KIND` basename; `prompt` and\n * `flow` use their `<name>.prompt.md` / `<name>.flow.{yaml,json}` suffixes\n * (these have no fixed basename, so an exact-name match alone would miss them).\n */\nfunction matchManifestPath(kind: string, paths: readonly string[]): string | undefined {\n const exact = MD_BY_KIND[kind];\n if (exact) {\n const hit = paths.find((p) => p.endsWith(exact));\n if (hit) return hit;\n }\n if (kind === \"prompt\") return paths.find((p) => p.endsWith(\".prompt.md\"));\n if (kind === \"flow\") {\n return paths.find((p) => p.endsWith(\".flow.yaml\") || p.endsWith(\".flow.json\"));\n }\n return undefined;\n}\n\n/**\n * Asset kinds that are never deployed to a driver target as files — bundles\n * resolve to their members, mcp-servers are wired at session startup, and the\n * mixin kinds are resolved at session creation. Store bytes are not staged for\n * these (mirrors the skip set in `deployAll`).\n */\nexport const NON_DEPLOYABLE_KINDS = new Set([\n \"bundle\",\n \"mcp-server\",\n \"persona\",\n \"ruleset\",\n \"knowledge\",\n]);\n\n/**\n * Longest common leading directory prefix across `paths` (slash-joined, no\n * trailing slash). Mirrors the prefix-strip `installFromManifest` flat mode\n * applies, so a staged asset's manifest can be located deterministically.\n */\nfunction commonDirPrefix(paths: readonly string[]): string {\n if (paths.length === 0) return \"\";\n const dirs = paths.map((p) => p.split(\"/\").slice(0, -1));\n let common = dirs[0]!;\n for (let i = 1; i < dirs.length && common.length > 0; i++) {\n const segs = dirs[i]!;\n let n = 0;\n while (n < common.length && n < segs.length && common[n] === segs[n]) n++;\n common = common.slice(0, n);\n }\n return common.join(\"/\");\n}\n\n/**\n * Index lock entries by their `<kind>:<name>` suffix for deployed-asset lookup.\n * Only entries whose canonical key fully parses (kind, name, publisher, version)\n * are included.\n */\nfunction indexLockByKindName(\n lock: LockFile | null,\n): Map<string, { publisher: string; version: string; url: string }> {\n const lockByKindName = new Map<string, { publisher: string; version: string; url: string }>();\n for (const [key] of Object.entries(lock?.assets ?? {})) {\n const parsed = parseCanonicalLockKey(key);\n if (parsed.kind && parsed.name && parsed.publisher && parsed.version) {\n lockByKindName.set(`${parsed.kind}:${parsed.name}`, {\n publisher: parsed.publisher,\n version: parsed.version,\n url: lock!.assets[key]!.source.url,\n });\n }\n }\n return lockByKindName;\n}\n\n/** Derive an asset's sync status from its repository's live status. */\nfunction computeSyncStatus(repoStatus: RepoStatusInfo | undefined): string {\n if (!repoStatus) return \"unknown\";\n if (repoStatus.kind === \"local\") return \"local\";\n if (repoStatus.error) return \"error\";\n if (repoStatus.upToDate) return \"synced\";\n return \"outdated\";\n}\n\n/**\n * Group overview entries by domain, sort domains alphabetically, and sort\n * entries within each domain by kind then name.\n */\nfunction groupAndSortByDomain(entries: OverviewEntry[]): Map<string, OverviewEntry[]> {\n const byDomain = new Map<string, OverviewEntry[]>();\n for (const e of entries) {\n if (!byDomain.has(e.domain)) byDomain.set(e.domain, []);\n byDomain.get(e.domain)!.push(e);\n }\n\n const sorted = new Map<string, OverviewEntry[]>();\n for (const key of [...byDomain.keys()].sort()) {\n sorted.set(\n key,\n byDomain\n .get(key)!\n .sort((a, b) =>\n a.kind !== b.kind ? a.kind.localeCompare(b.kind) : a.name.localeCompare(b.name),\n ),\n );\n }\n return sorted;\n}\n\n/**\n * Parse a canonical lock key (`<kind>:@<publisher>/<name>#<version>`) into its\n * parts. The lock key is now a canonical asset ref, so this delegates to the one\n * ref parser; `AssetRef.pin` is exposed as `version` so the callers' destructuring\n * is unchanged. Stays total — callers rely on `{}`-then-`continue`, but\n * `parseAssetRef` throws, so a malformed key is caught and returned as `{}`.\n *\n * @internal Exported for unit tests; not part of the stable public surface.\n */\nexport function parseCanonicalLockKey(key: string): {\n publisher?: string;\n kind?: string;\n name?: string;\n version?: string;\n} {\n try {\n const ref = parseAssetRef(key);\n return {\n publisher: ref.publisher,\n kind: ref.kind,\n name: ref.name,\n version: ref.pin,\n };\n } catch {\n return {};\n }\n}\n\n/**\n * Bare asset name of a soft-dep target ref (`@pub/name@ver` → `name`); splits the\n * version off the *last* `@` since the leading one is the scope sigil. The\n * present-check matches on this bare name only (under-reports — the safe direction).\n */\nexport function softDepName(ref: string): string {\n const at = ref.lastIndexOf(\"@\");\n const base = at > 0 ? ref.slice(0, at) : ref;\n const slash = base.lastIndexOf(\"/\");\n return slash >= 0 ? base.slice(slash + 1) : base;\n}\n\n/**\n * Build a **version-less** dep ref (`kind:@publisher/name`) for the `skaile add`\n * suggestion. Omits the version: a manifest-less source resolves under a content-sha\n * pin the index's frontmatter version never matches, so a pinned ref is unaddable.\n */\nfunction depRefFromDef(def: {\n kind: string;\n publisher: string;\n name: string;\n version: string;\n}): string | undefined {\n const publisher = def.publisher.replace(/^@/, \"\");\n if (!publisher) return undefined;\n return assetRefToStr({ kind: def.kind, name: def.name, publisher });\n}\n\n/**\n * Parse a ref for identity matching, tolerating a non-canonical pin. A lock ref\n * can pin a content-sha pseudo-version (`#0.0.0-sha.<hash>`) that `parseAssetRef`\n * rejects; the matchers below only need the version-agnostic `kind/publisher/name`,\n * so drop the pin and retry before giving up.\n */\nfunction parseRefLoose(ref: string): ReturnType<typeof parseAssetRef> | null {\n try {\n return parseAssetRef(ref);\n } catch {\n const hash = ref.indexOf(\"#\");\n if (hash < 0) return null;\n try {\n return parseAssetRef(ref.slice(0, hash));\n } catch {\n return null;\n }\n }\n}\n\n/**\n * Find the cached AssetDefinition(s) for an input ref. Tries an exact id match\n * first (canonical refs), then falls back to a name (+publisher/kind when the\n * ref carries them) match so `kind:name` / `kind:@pub/name` inputs resolve. The\n * fallback is version-agnostic, so a lock ref pinned at a content-sha\n * pseudo-version still matches the index def stored under a canonical semver.\n */\nfunction matchDefsForRef<T extends { id: string; kind: string; name: string; publisher: string }>(\n defs: T[],\n ref: string,\n): T[] {\n const exact = defs.filter((d) => d.id === ref);\n if (exact.length > 0) return exact;\n const parsed = parseRefLoose(ref);\n if (!parsed) return [];\n const wantPub = parsed.publisher?.replace(/^@/, \"\");\n return defs.filter(\n (d) =>\n d.name === parsed.name &&\n d.kind === parsed.kind &&\n (wantPub === undefined || d.publisher.replace(/^@/, \"\") === wantPub),\n );\n}\n\n/**\n * Reconciliation state of a declared dependency relative to the lock + disk.\n * `invalid` flags a `dependencies:` entry that isn't a parseable canonical ref —\n * surfaced (not silently dropped) so a `skaile.yaml` typo is visible.\n */\nexport type DeclaredState = \"declared\" | \"installed\" | \"drift\" | \"invalid\";\n\n/**\n * A top-level dependency declared in `skaile.yaml`, annotated with its\n * reconciliation {@link DeclaredState}. Transitive (lock-only) deps are never\n * included — {@link AssetManager.listDeclared} walks the declared set only.\n */\nexport interface DeclaredAsset {\n /** The canonical declared ref exactly as written in `skaile.yaml`. */\n ref: string;\n kind: string;\n name: string;\n state: DeclaredState;\n}\n\n/**\n * A global declared dependency from `~/.skaile/skaile.yaml`, reconciled against\n * **one** backend's global deploy dir. The same ref yields one entry per global\n * backend (see {@link AssetManager.globalState}) so an asset can read `installed`\n * for `claude-code` and `drift`/`declared` for `codex` simultaneously.\n */\nexport interface BackendDeclaredAsset extends DeclaredAsset {\n /** The global backend this state was reconciled against. */\n backend: DriverTarget;\n}\n\n/**\n * A body-link soft-dependency edge: asset `from` references target `to` in its\n * body (not its typed `requires`). `toRef` is the parseable `skaile add` ref when\n * the target is in the index, omitted otherwise. Surfaced read-only — never\n * auto-installed (see {@link AssetManager.softDepsOf} / {@link AssetManager.reportSoftDeps}).\n */\nexport interface SoftDepEdge {\n from: string;\n to: string;\n toRef?: string;\n}\n\n/**\n * A soft-dependency target that would be left orphaned by removing some assets:\n * it is still present in the project, came in as `from`'s soft dependency, and\n * nothing else still needs it (neither a soft-dep nor a typed `requires`).\n * Report-only — {@link AssetManager.orphanedSoftDepsAfterRemoving} never removes\n * it; the caller prompts (default No). `targetRef` is the parseable `skaile\n * remove` ref when the target is in the index.\n */\nexport interface OrphanedSoftDep {\n from: string;\n target: string;\n targetRef?: string;\n}\n\n/**\n * Thrown by {@link AssetManager.listDeclared} when the project has no\n * `skaile.yaml`. The CLI maps this to a `skaile init` hint.\n */\nexport class MissingManifestError extends Error {\n constructor(readonly projectDir: string) {\n super(`No skaile.yaml in ${projectDir}.`);\n this.name = \"MissingManifestError\";\n }\n}\n\nexport type { HistoryEntry } from \"./history.js\";\nexport {\n appendHistory,\n clearHistory,\n getRecentHistory,\n loadHistory,\n} from \"./history.js\";\n// Re-export sub-modules\nexport type { DeployOptions } from \"./installer.js\";\nexport { createScaffold, deployAll, removeAsset } from \"./installer.js\";\nexport type { Log } from \"./renderers.js\";\nexport { renderAgentToFramework } from \"./renderers.js\";\n// Contrib helpers (commitChanges et al.) are still used internally by the\n// patch-submit flow but are no longer part of the public API surface — the\n// `skaile repo contrib *` command tree was removed on 2026-05-12.\n\n// ── Types ────────────────────────────────────────────────────────────────────\n\n/**\n * Metadata about a repository declared in `skaile.yaml`.\n *\n * @docLink packages/asset-manager/concepts#asset-manager\n */\nexport interface RepoInfo {\n /** Repository name as declared in `skaile.yaml`. */\n name: string;\n /** How the repo is sourced: cloned from a URL, mounted from a local path, or symlinked via `skaile repo link`. */\n kind: \"local\" | \"remote\" | \"linked\";\n /** Remote URL (present when `kind === \"remote\"`). */\n url?: string;\n /** Filesystem path (present when `kind === \"local\"` or `kind === \"linked\"`). */\n path?: string;\n /** Git branch configured for this repository. */\n branch: string;\n /** Whether the repository has been cloned/resolved locally. */\n cloned: boolean;\n}\n\n/**\n * Live sync status for a repository.\n *\n * @docLink packages/asset-manager/concepts#asset-manager\n */\nexport interface RepoStatusInfo {\n /** Repository name as declared in `skaile.yaml`. */\n name: string;\n /** How the repo is sourced. */\n kind: \"local\" | \"remote\" | \"linked\";\n /** Number of commits the local clone is behind the remote. */\n behind: number;\n /** `true` when the local clone matches the remote HEAD. */\n upToDate: boolean;\n /** Error message when status check failed. */\n error?: string;\n}\n\n/**\n * Result of a full `skaile install` or `skaile add` run.\n *\n * @docLink packages/asset-manager/concepts#asset-manager\n */\nexport interface InstallResult {\n /** Asset refs (`kind:name`) successfully deployed in this run. */\n deployed: string[];\n /** Asset refs (`kind:name`) removed because they are no longer in the resolved set. */\n removed: string[];\n /** Asset refs that could not be resolved in any configured repository. */\n missing: string[];\n /** Whether `skaile.lock.yaml` was written or updated. */\n lockWritten: boolean;\n /**\n * npm packages installed as a side effect of resolving runtime asset peer\n * deps (connectors / mounts declared in skaile.yaml). Empty when nothing\n * needed installing or when the runtime-deps step was skipped.\n */\n npmInstalled?: string[];\n /**\n * npm packages that the runtime-deps step tried but failed to install.\n * Non-fatal — listed for telemetry and CLI reporting.\n */\n npmFailed?: string[];\n}\n\n/**\n * An installed asset whose source repository is behind the remote.\n *\n * @docLink packages/asset-manager/concepts#asset-manager\n */\nexport interface OutdatedEntry {\n /** Asset kind (`skill`, `agent`, `prompt`, `flow`, `contract`). */\n kind: string;\n /** Asset name as registered in the catalog. */\n name: string;\n /** Repository that provides this asset. */\n publisher: string;\n /** Version string recorded in the lock file at install time. */\n currentVersion: string;\n /** Number of commits the local repository is behind the remote. */\n behind: number;\n}\n\n/**\n * A node in the resolved dependency tree (returned by `AssetManager.tree()`).\n *\n * @docLink packages/asset-manager/concepts#asset-manager\n */\nexport interface DependencyNode {\n /** Asset ref (`kind:name`) or `\"project\"` for the root node. */\n ref: string;\n /** Transitive dependencies resolved by this node. */\n children: DependencyNode[];\n}\n\n/**\n * A missing dependency detected by `AssetManager.doctor()`.\n *\n * @docLink packages/asset-manager/concepts#asset-manager\n */\nexport interface DepIssue {\n /** Kind of the asset that has the unsatisfied requirement. */\n assetKind: string;\n /** Name of the asset that has the unsatisfied requirement. */\n assetName: string;\n /** Kind of the missing dependency. */\n depKind: string;\n /** Name of the missing dependency. */\n depName: string;\n /** `true` when the missing dependency exists in a configured repository but has not been installed. */\n inRepos: boolean;\n}\n\n/**\n * A single deployed asset shown in the workspace overview.\n *\n * @docLink packages/asset-manager/concepts#asset-manager\n */\nexport interface OverviewEntry {\n /** Asset kind (`skill`, `agent`, `prompt`, `flow`, `contract`). */\n kind: string;\n /** Asset name. */\n name: string;\n /** Domain the asset belongs to (from the lock file; `\"unknown\"` when unresolvable). */\n domain: string;\n /** Repository that provides this asset. */\n publisher: string;\n /** Version string from the lock file. */\n version: string;\n /**\n * Sync status relative to the source repository.\n * - `\"synced\"` — local clone matches remote HEAD\n * - `\"outdated\"` — local clone is behind the remote\n * - `\"local\"` — sourced from a local path, no remote to compare\n * - `\"error\"` — status check failed\n * - `\"unknown\"` — repository not found or lock entry missing\n */\n syncStatus: string;\n}\n\n/**\n * Aggregated workspace overview returned by `AssetManager.overview()`.\n *\n * @docLink packages/asset-manager/concepts#asset-manager\n */\nexport interface OverviewResult {\n /** Entries grouped by domain, sorted alphabetically. Each group is sorted by kind then name. */\n byDomain: Map<string, OverviewEntry[]>;\n /** Total number of deployed assets. */\n total: number;\n /** Sync status for each configured repository. */\n repos: RepoStatusInfo[];\n}\n\n// ── AssetManager ─────────────────────────────────────────────────────────────\n\n/**\n * Options for constructing an {@link AssetManager}.\n *\n * @docLink packages/asset-manager/concepts#asset-manager\n */\nexport interface AssetManagerOptions {\n /** Absolute or relative path to the workspace root (must contain `skaile.yaml`). */\n projectDir: string;\n /**\n * Agent framework to target for asset deployment.\n * Determines which framework directories (``.claude/``, ``.omp/``, etc.) are used.\n * Defaults to `\"claude-code\"`.\n */\n driverTarget?: DriverTarget;\n /**\n * When `true`, the manager operates in **global cross-backend** mode: config\n * SSOT, lock, cache, and history root at `~/.skaile` (not the project), the\n * `dependencies:` manifest edits target `~/.skaile/skaile.yaml`, and deploy\n * fans out to every backend in {@link backends}. When `false` (default),\n * everything is project-scoped against the single {@link driverTarget}.\n */\n global?: boolean;\n /**\n * Global-mode backend set the deploy fans out to. When omitted in global mode,\n * resolved from `~/.skaile/skaile.yaml` `global_backends:` else auto-detection\n * (`resolveGlobalBackends`). Ignored in project mode. A `--backend` filter\n * narrows this to a subset.\n */\n backends?: DriverTarget[];\n /**\n * Catalog read-protocol fetcher used to resolve store-published assets. When\n * omitted, one is built per call from the configured stores\n * (`RemoteCatalogSource`). Injected mainly by tests to stay network-free.\n */\n storeFetcher?: StoreFetcher;\n /**\n * Byte fetcher used to fetch a store asset's files at its pinned commit before\n * deploy. When omitted, the production GitHub fetcher is used. Injected by\n * tests to stay network-free.\n */\n assetFetcher?: AssetFetcher;\n /**\n * Overrides the global `catalog.url` used as a store fallback when the project\n * declares no `stores:`. Pass `\"\"` to disable the fallback entirely. When\n * omitted, the URL is read from `~/.skaile/config.yaml` (`resolveConfig`).\n */\n catalogUrl?: string;\n /**\n * Overrides the index SQLite path read by {@link AssetManager.reportSoftDeps}\n * (default `~/.skaile/index.db` via `resolveIndexPath`). Injected by tests to\n * read a seeded index without touching the user's real one.\n */\n indexPath?: string;\n}\n\n/** Canonical git URL identity for the bundled factory source. Never fetched —\n * the bytes live inside the package (`factory-assets/`); the URL is only the\n * match key the provenance walker and `candidateToCatalogEntry` key off. */\nconst FACTORY_SOURCE_URL = \"https://github.com/skaile-ai/ai-assets\";\n\n/**\n * Locate the built-in first-party skills/bundles shipped inside the package.\n *\n * Resolves through the shared {@link factoryAssetRoots} helper — the\n * `SKAILE_FACTORY_ASSETS_DIR` override layer (when set) ahead of the bundled\n * tree (in-repo source during dev, `dist/factory-assets/` after install), so a\n * container's override is honoured here identically to `serve`. Returns the\n * highest-precedence root that carries a `skaile.manifest.yaml` (the publication\n * manifest that names the source's publisher), or `null` when none qualifies —\n * the factory source is then simply not injected rather than erroring.\n */\nfunction resolveFactoryAssetsDir(): string | null {\n for (const dir of factoryAssetRoots()) {\n if (existsSync(join(dir, \"skaile.manifest.yaml\"))) return dir;\n }\n return null;\n}\n\n/** Read the declared `publisher` from a source's root `skaile.manifest.yaml`. */\nfunction readDeclaredPublisher(sourceDir: string): string | undefined {\n try {\n const raw = parseYaml(readFileSync(join(sourceDir, \"skaile.manifest.yaml\"), \"utf8\")) as {\n publisher?: unknown;\n } | null;\n return raw && typeof raw.publisher === \"string\" && raw.publisher.length > 0\n ? raw.publisher\n : undefined;\n } catch {\n return undefined;\n }\n}\n\n/**\n * The bundled factory source `{ dir, publisher }`, or `null` when no usable\n * bundle is present. Resolved once per process — the package location and the\n * bundled `skaile.manifest.yaml` are immutable for the process lifetime, so the\n * `require.resolve` + `existsSync` probes + YAML parse run a single time rather\n * than on every `loadConfig()` call. `undefined` = not yet computed.\n */\nlet factorySourceCache: { dir: string; publisher: string } | null | undefined;\n\nfunction resolveFactorySource(): { dir: string; publisher: string } | null {\n if (factorySourceCache !== undefined) return factorySourceCache;\n const dir = resolveFactoryAssetsDir();\n const publisher = dir ? readDeclaredPublisher(dir) : undefined;\n factorySourceCache = dir && publisher ? { dir, publisher } : null;\n return factorySourceCache;\n}\n\n/**\n * Programmatic API for managing AI assets in a Skaile workspace.\n *\n * `AssetManager` wraps repository management, catalog search, asset installation,\n * lock-file tracking, patch workflows, and workspace diagnostics. The CLI delegates\n * all `skaile catalog`, `skaile repo`, `skaile install`, `skaile add`, and\n * `skaile init` commands to this class.\n *\n * @example\n * ```typescript\n * import { AssetManager } from \"@skaile/workspaces/asset-manager\";\n *\n * const am = new AssetManager({ projectDir: \"/my-project\" });\n *\n * // Install all dependencies declared in skaile.yaml\n * const result = await am.install();\n * console.log(`Deployed: ${result.deployed.join(\", \")}`);\n *\n * // Add a single skill (resolves transitive deps, updates skaile.yaml)\n * const deployed = am.add(\"skill:my-skill\");\n *\n * // Search the catalog\n * const skills = am.search(\"code review\", \"skill\");\n * ```\n *\n * @docLink packages/asset-manager/concepts#asset-manager\n */\nexport class AssetManager {\n /** Resolved absolute path to the workspace root. */\n readonly projectDir: string;\n /** Agent framework driver target used for all deploy operations. */\n readonly driverTarget: DriverTarget;\n /** Whether this instance operates in global-install mode. */\n readonly global: boolean;\n /** Explicit global-backend override (global mode only); else auto-resolved. */\n private readonly backendsOverride?: DriverTarget[];\n /** Injected catalog fetcher (tests / custom); falls back to a built one. */\n private readonly injectedStoreFetcher?: StoreFetcher;\n /** Injected byte fetcher for store staging; falls back to GitHub. */\n private readonly injectedAssetFetcher?: AssetFetcher;\n /** Injected global catalog URL override for the no-project-store fallback. */\n private readonly catalogUrlOverride?: string;\n /** Injected index SQLite path override (tests); else the default index.db. */\n private readonly indexPathOverride?: string;\n\n constructor(opts: AssetManagerOptions) {\n this.projectDir = resolve(opts.projectDir);\n this.driverTarget = opts.driverTarget ?? (\"claude-code\" as DriverTarget);\n this.global = opts.global ?? false;\n this.backendsOverride = opts.backends;\n this.injectedStoreFetcher = opts.storeFetcher;\n this.injectedAssetFetcher = opts.assetFetcher;\n this.catalogUrlOverride = opts.catalogUrl;\n this.indexPathOverride = opts.indexPath;\n }\n\n /**\n * Root for this manager's **state** — config SSOT, lock, cache, history.\n * `~/.skaile` in global mode (the cross-backend SSOT), else the project dir.\n * Deploy dirs are unaffected; they come from `DRIVER_TARGETS[target]`.\n */\n private get stateRoot(): string {\n return this.global ? globalSkaileDir() : this.projectDir;\n }\n\n /**\n * The backends a global deploy fans out to: the explicit `backends` override\n * (a `--backend` filter), else `resolveGlobalBackends()`. In project mode this\n * is exactly `[driverTarget]`, so the shared fan-out loop degenerates to the\n * single-target path.\n */\n private targetBackends(): DriverTarget[] {\n if (!this.global) return [this.driverTarget];\n if (this.backendsOverride && this.backendsOverride.length > 0) return this.backendsOverride;\n return resolveGlobalBackends();\n }\n\n private get storeCacheDir(): string {\n if (this.global) return join(globalCacheRoot(), \"store\");\n return migrateLegacyDir(\n join(this.projectDir, \".skaile\", \"cache\", \"store\"),\n join(this.projectDir, \".skaile\", \"store-cache\"),\n );\n }\n\n private get reposDir(): string {\n if (this.global) return join(globalCacheRoot(), \"sources\");\n return migrateLegacyDir(\n join(this.projectDir, \".skaile\", \"cache\", \"sources\"),\n join(this.projectDir, \".skaile\", \"repos\"),\n );\n }\n\n /**\n * Project-scoped cache dirs rooted at `.skaile/cache/` (`store`, `sources`)\n * relative to `projectDir`. Reading is a side effect: it triggers lazy\n * migration of the legacy `.skaile/{store-cache,repos}` dirs.\n */\n get projectCacheDirs(): { store: string; sources: string } {\n return { store: this.storeCacheDir, sources: this.reposDir };\n }\n\n private get lockPath(): string {\n return join(this.stateRoot, \"skaile.lock.yaml\");\n }\n\n private get patchDir(): string {\n return join(this.projectDir, \".skaile\", \"patches\");\n }\n\n /** Deploy options for one backend. In global mode, `driverTarget` is the\n * fan-out target (not the constructor's `driverTarget`, which is project-only). */\n private deployOptsFor(target: DriverTarget, link?: boolean): DeployOptions {\n return { driverTarget: target, global: this.global, cwd: this.projectDir, link: link === true };\n }\n\n private loadConfig(): {\n repositories: Record<string, SourceDeclaration>;\n sources: SourceEntry[];\n stores: StoreEntry[];\n dependencies: string[];\n overrides: OverrideEntry[];\n patches: Record<string, string>;\n config: SkWorkspaceConfig;\n } {\n // resolveSkWorkspaceConfig runs the canonical normalizer and throws on\n // legacy keys (`repositories:` / `ai_resources:`) — propagate to the caller.\n // Global mode reads ONLY the user-scope SSOT (`~/.skaile/skaile.yaml`) so a\n // project's deps never leak into a global fan-out (and vice versa).\n const config = this.global\n ? resolveGlobalSkWorkspaceConfig()\n : resolveSkWorkspaceConfig(this.projectDir);\n\n const sources = config.sources ?? [];\n const stores = config.stores ?? [];\n const dependencies = config.dependencies ?? [];\n const overrides = config.overrides ?? [];\n const patches = config.patches ?? {};\n\n // Source clones live in the global clone cache (cache/sources); the slug is\n // the cache key for ensureRepo. getGlobalCacheDir() migrates legacy roots.\n const sourcesDir = getGlobalCacheDir();\n const repositories: Record<string, SourceDeclaration> = {};\n for (const s of sources) {\n const slug = sourceCacheKey(s.url);\n if (repositories[slug]) continue;\n repositories[slug] = { path: join(sourcesDir, slug), url: s.url };\n }\n\n // Implicit built-in source: the first-party assets shipped inside the\n // package (`dist/factory-assets/`). Always available, zero config — keyed by\n // its declared publisher so refs (`kind:@<publisher>/name`) and `info`\n // resolve cleanly. Skipped when the user already declares the same source\n // explicitly (avoids duplicate catalog entries) or when no bundle is present.\n const factory = resolveFactorySource();\n const factoryUrl = normalizeRepoUrl(FACTORY_SOURCE_URL);\n const alreadyDeclared = Object.values(repositories).some(\n (d) => d.url !== undefined && normalizeRepoUrl(d.url) === factoryUrl,\n );\n if (factory && !alreadyDeclared && !repositories[factory.publisher]) {\n repositories[factory.publisher] = {\n path: factory.dir,\n url: FACTORY_SOURCE_URL,\n factory: true,\n };\n }\n\n return { repositories, sources, stores, dependencies, overrides, patches, config };\n }\n\n /** Build provenance-index clones from the resolved source declarations. */\n private buildClones(repositories: Record<string, SourceDeclaration>): SourceClone[] {\n const clones: SourceClone[] = [];\n for (const [slug, decl] of Object.entries(repositories)) {\n const localPath = this.resolveRepoDir(decl, slug);\n if (!localPath || !existsSync(localPath)) continue;\n const commit = getRepoCommit(localPath) ?? \"0\".repeat(40);\n clones.push({\n localPath,\n sourceUrl: decl.url ?? localPath,\n commit,\n tag: decl.branch,\n });\n }\n return clones;\n }\n\n /**\n * Bridge a resolved {@link ProvenanceCandidate} to a {@link CatalogEntry} for\n * the deploy pipeline. `source` is the absolute path to the asset's primary\n * manifest (or its directory) inside the clone; `publisher` is set to the\n * clone slug so `deployAll`'s repositories lookup resolves local-vs-remote.\n */\n private candidateToCatalogEntry(\n c: ProvenanceCandidate,\n repositories: Record<string, SourceDeclaration>,\n ): CatalogEntry | null {\n // Find the clone slug whose declaration URL matches the candidate's source.\n let slug: string | undefined;\n let cloneDir: string | undefined;\n for (const [s, decl] of Object.entries(repositories)) {\n if (decl.url === c.sourceUrl) {\n slug = s;\n cloneDir = this.resolveRepoDir(decl, s) ?? undefined;\n break;\n }\n }\n if (!cloneDir) {\n // Unknown source — deployable store assets are routed via staged bytes\n // before reaching here, so this branch now only hits non-deployable store\n // kinds (e.g. mcp-server), which deployAll skips. Fall back to first clone.\n const first = Object.entries(repositories)[0];\n if (first) {\n slug = first[0];\n cloneDir = this.resolveRepoDir(first[1], first[0]) ?? undefined;\n }\n }\n if (!cloneDir || !slug) return null;\n\n // Resolve a concrete manifest file (suffix-aware for prompt/flow), falling\n // back to the first file — never the clone dir, which deploy can't copy as a\n // single asset (cpSync without recursive throws on a directory).\n const mdRel =\n matchManifestPath(\n c.kind,\n c.files.map((f) => f.path),\n ) ?? c.files[0]?.path;\n const source = mdRel ? join(cloneDir, mdRel) : cloneDir;\n\n const entry: CatalogEntry = {\n name: c.name,\n kind: c.kind as CatalogEntry[\"kind\"],\n description: c.description ?? \"\",\n source,\n publisher: slug,\n version: c.version,\n requires: [],\n // Manifest-declared deps are authoritative for the candidate's deps.\n dependencies: c.deps ?? [],\n metadata: c.metadata,\n };\n if (c.category != null) entry.category = c.category;\n if (c.keywords && c.keywords.length > 0) entry.keywords = c.keywords;\n if (c.license != null) entry.license = c.license;\n if (c.homepage != null) entry.homepage = c.homepage;\n return entry;\n }\n\n // ── Store fetch-then-deploy ────────────────────────────────────────────\n\n /** A candidate's stable identity key (`<publisher>/<kind>:<name>@<version>`). */\n private candidateKey(c: ProvenanceCandidate): string {\n return `${c.publisher}/${c.kind}:${c.name}@${c.version}`;\n }\n\n /**\n * Resolve `deps`, falling back to the global `catalog.url` store when the\n * project declares no store and the first pass leaves something missing.\n *\n * The first pass uses the project stores only, so locally-resolvable refs\n * never trigger a network probe. The fallback retry is best-effort: any error\n * (offline, store down) keeps the first pass's result rather than regressing.\n */\n private async resolveWithStores(\n deps: string[],\n opts: {\n provenanceIndex: ReturnType<typeof buildProvenanceIndex>;\n overrides: OverrideEntry[];\n stores: StoreEntry[];\n },\n ): Promise<ResolveResult> {\n const first = await resolveAll(deps, {\n provenanceIndex: opts.provenanceIndex,\n overrides: opts.overrides,\n stores: opts.stores,\n storeFetcher: this.storeFetcherFor(opts.stores),\n projectDir: this.projectDir,\n });\n if (first.missing.length === 0) return first;\n\n const fallback = await this.globalStoreFallback(opts.stores);\n if (fallback.length === 0) return first;\n\n const stores = [...opts.stores, ...fallback];\n try {\n const retry = await resolveAll(deps, {\n provenanceIndex: opts.provenanceIndex,\n overrides: opts.overrides,\n stores,\n storeFetcher: this.storeFetcherFor(stores),\n projectDir: this.projectDir,\n });\n // Monotone: same provenanceIndex + overrides, only more stores added —\n // resolution can gain deps but never lose one, so fewer-missing wins.\n return retry.missing.length < first.missing.length ? retry : first;\n } catch {\n return first;\n }\n }\n\n /** The catalog fetcher to use: an injected one, else built from `stores`. */\n private storeFetcherFor(stores: StoreEntry[]): StoreFetcher | undefined {\n return this.injectedStoreFetcher ?? this.buildStoreFetcher(stores);\n }\n\n /**\n * The global `catalog.url` as a single-store fallback, or `[]` when no\n * project store should be synthesized — `local` sentinel, already-declared,\n * or no URL. Honours an explicit `catalogUrl` injection (`\"\"` disables it).\n */\n private async globalStoreFallback(projectStores: StoreEntry[]): Promise<StoreEntry[]> {\n let url = this.catalogUrlOverride;\n if (url === undefined) {\n try {\n const { resolveConfig } = await import(\"@skaile/workspaces/library\");\n url = resolveConfig({ projectDir: this.projectDir }).catalog.url;\n } catch {\n return [];\n }\n }\n if (!url || url.trim().toLowerCase() === \"local\") return [];\n if (projectStores.some((s) => normalizeRepoUrl(s.url) === normalizeRepoUrl(url!))) return [];\n return [{ url }];\n }\n\n /**\n * Build deployable catalog entries from resolved candidates. Store-resolved\n * candidates (no local clone bytes) are fetched + SHA-verified into the\n * project store-cache first, then their entry points at the staged bytes so\n * the existing copy-deploy path works. Source-backed candidates keep the\n * clone-relative entry.\n */\n private async buildCatalogEntries(\n resolved: ProvenanceCandidate[],\n repositories: Record<string, SourceDeclaration>,\n ): Promise<CatalogEntry[]> {\n const staged = await this.stageStoreAssets(resolved, repositories);\n const entries: CatalogEntry[] = [];\n for (const c of resolved) {\n const stagedPath = staged.get(this.candidateKey(c));\n const entry = stagedPath\n ? this.stagedCandidateToEntry(c, stagedPath)\n : this.candidateToCatalogEntry(c, repositories);\n if (entry) entries.push(entry);\n }\n return entries;\n }\n\n /**\n * Fetch + SHA-verify the bytes of every store-resolved deployable candidate\n * into `.skaile/cache/store/`, reusing the same verified-fetch path the\n * pointer-only `library.install` uses (`installFromManifest` flat mode).\n *\n * @returns Map of candidate key → staged primary-manifest path.\n */\n private async stageStoreAssets(\n resolved: ProvenanceCandidate[],\n repositories: Record<string, SourceDeclaration>,\n ): Promise<Map<string, string>> {\n const staged = new Map<string, string>();\n let installFromManifest:\n | typeof import(\"@skaile/workspaces/library\").installFromManifest\n | undefined;\n\n for (const c of resolved) {\n if (NON_DEPLOYABLE_KINDS.has(c.kind)) continue;\n if (!c.files || c.files.length === 0 || !c.sourceUrl || !c.commit) continue;\n if (this.candidateHasLocalBytes(c, repositories)) continue;\n\n if (!installFromManifest) {\n ({ installFromManifest } = await import(\"@skaile/workspaces/library\"));\n }\n const targetDir = join(this.storeCacheDir, c.publisher, c.kind, c.name, c.version);\n // Per-file paths in c.files are attacker-controlled but validated by\n // installFromManifest before any fetch/write (rejects abs / `..`); this\n // outer guard only asserts the staging dir stays inside the cache root.\n const cacheRoot = resolve(this.storeCacheDir);\n if (!resolve(targetDir).startsWith(cacheRoot + sep)) {\n throw new Error(`unsafe store-cache path for ${this.candidateKey(c)}`);\n }\n const manifest: InstallManifest = {\n ref: `${c.kind}:@${c.publisher}/${c.name}#${c.version}`,\n source: { url: c.sourceUrl, commitSha: c.commit },\n files: c.files,\n sha256: c.sha256,\n kind: c.kind,\n // tier = catalog storage hint (S3/CDN); flat-mode verified fetch pulls\n // from source.url@commit and ignores it, so \"\" is inert.\n tier: \"\",\n };\n const { installPath } = await installFromManifest({\n manifest,\n libraryRoot: this.storeCacheDir,\n targetDir,\n fetcher: this.injectedAssetFetcher,\n });\n staged.set(this.candidateKey(c), join(installPath, this.stagedManifestRel(c)));\n }\n return staged;\n }\n\n /** Repo-relative path of a candidate's primary manifest (un-stripped). */\n private primaryManifestRel(c: ProvenanceCandidate): string | undefined {\n const paths = (c.files ?? []).map((f) => f.path);\n // Last resort: a kind with no manifest convention falls back to the first\n // file so deploy still has a concrete source rather than crashing.\n return matchManifestPath(c.kind, paths) ?? paths[0];\n }\n\n /**\n * The primary-manifest path relative to a staged asset dir. Takes the kind's\n * manifest (e.g. `SKILL.md`), then strips the same common-dir prefix\n * `installFromManifest` flat mode removed on write.\n */\n private stagedManifestRel(c: ProvenanceCandidate): string {\n const paths = (c.files ?? []).map((f) => f.path);\n const mdRel = this.primaryManifestRel(c) ?? \"\";\n const root = commonDirPrefix(paths);\n return root && mdRel.startsWith(`${root}/`) ? mdRel.slice(root.length + 1) : mdRel;\n }\n\n /**\n * `true` when a candidate's primary manifest is present on a local source\n * clone — its `sourceUrl` matches a registered source AND the manifest file\n * exists on disk at the expected path. A URL match alone is not enough: a\n * store can pin a different commit (or a subtree not bundled) of a repo that\n * is also a registered source, in which case the bytes must be fetched from\n * the store rather than read from the clone. (Only the primary manifest is\n * probed — a partially-cloned source is deployed as-is, matching the existing\n * clone-deploy path.)\n */\n private candidateHasLocalBytes(\n c: ProvenanceCandidate,\n repositories: Record<string, SourceDeclaration>,\n ): boolean {\n if (!c.sourceUrl) return false;\n const rel = this.primaryManifestRel(c);\n for (const [slug, decl] of Object.entries(repositories)) {\n if (decl.url === undefined || decl.url !== c.sourceUrl) continue;\n const dir = this.resolveRepoDir(decl, slug);\n if (!dir) continue;\n if (existsSync(rel ? join(dir, rel) : dir)) return true;\n }\n return false;\n }\n\n /** Build a copy-deploy catalog entry pointing at staged store bytes. */\n private stagedCandidateToEntry(c: ProvenanceCandidate, stagedManifestPath: string): CatalogEntry {\n const entry: CatalogEntry = {\n name: c.name,\n kind: c.kind as CatalogEntry[\"kind\"],\n description: c.description ?? \"\",\n source: stagedManifestPath,\n // Real publisher (never a clone slug) → deployAsset copies rather than\n // symlinking the ephemeral store-cache dir.\n publisher: c.publisher,\n version: c.version,\n requires: [],\n dependencies: c.deps ?? [],\n metadata: c.metadata,\n };\n if (c.category != null) entry.category = c.category;\n if (c.keywords && c.keywords.length > 0) entry.keywords = c.keywords;\n if (c.license != null) entry.license = c.license;\n if (c.homepage != null) entry.homepage = c.homepage;\n return entry;\n }\n\n // ── Install / resolve ──────────────────────────────────────────────────\n\n /**\n * Install all dependencies declared in `skaile.yaml`.\n *\n * Steps: clone/pull repositories → resolve transitive dependencies → reconcile\n * (remove stale assets) → deploy new assets → write `skaile.lock.yaml` → record history.\n *\n * @param opts - Optional installation options.\n * @param opts.locked - When `true`, restore the exact versions recorded in the existing\n * lock file instead of resolving from source. Throws if no lock file is found.\n * @param opts.link - When `true`, symlink local-path assets instead of copying them\n * (the author dev-loop). Machine-local / not for committing; a no-op for\n * store/factory sources. Defaults to copy.\n * @returns {@link InstallResult} summarising what was deployed, what was missing, and any collisions.\n */\n async install(opts?: { locked?: boolean; link?: boolean }): Promise<InstallResult> {\n const { repositories, sources, stores, dependencies, overrides, patches } = this.loadConfig();\n\n if (opts?.locked) {\n return this.installLocked(repositories, patches);\n }\n\n // 1. Ensure all source clones are present/up to date.\n const cloneError = this.ensureSourceClones(repositories, sources);\n if (cloneError) return cloneError;\n\n // 2. Build the provenance index from the clones and resolve.\n const provenanceIndex = buildProvenanceIndex(this.buildClones(repositories), {\n projectDir: this.projectDir,\n });\n const { resolved, missing, overridesApplied } = await this.resolveWithStores(dependencies, {\n provenanceIndex,\n overrides,\n stores,\n });\n\n // 3. Reconcile: remove stale assets (in old lock but not in new resolved set).\n const removed = this.reconcileRemovedAssets(resolved);\n\n // 4. Map candidates to catalog entries (fetching store bytes) and deploy.\n // Fan out to every target backend (one in project mode; the resolved\n // global set in `--global` mode) — same lock, one staged byte set.\n const entries = await this.buildCatalogEntries(resolved, repositories);\n const deployed = [\n ...new Set(\n this.targetBackends().flatMap((t) =>\n deployAll(entries, repositories, patches, this.deployOptsFor(t, opts?.link)),\n ),\n ),\n ];\n\n // 5. Write the v2 lock file.\n writeLock(this.lockPath, buildLockFile(resolved, overridesApplied));\n\n // 6. Record history.\n this.recordInstallHistory(deployed, removed);\n\n // 7. Install npm peer deps for any mount/connector declared in skaile.yaml.\n const { npmInstalled, npmFailed } = await this.installRuntimeAssetDeps();\n\n return { deployed, removed, missing, lockWritten: true, npmInstalled, npmFailed };\n }\n\n /**\n * Ensure all source clones are present/up to date. Returns an early\n * {@link InstallResult} describing the failed source on the first error, or\n * `null` when every clone succeeds.\n */\n private ensureSourceClones(\n repositories: Record<string, SourceDeclaration>,\n sources: SourceEntry[],\n ): InstallResult | null {\n const pinBySlug = new Map(sources.map((s) => [sourceCacheKey(s.url), s.pin]));\n for (const [name, decl] of Object.entries(repositories)) {\n try {\n ensureRepo(decl, name, this.reposDir, {\n projectDir: this.projectDir,\n pin: pinBySlug.get(name),\n });\n } catch (err) {\n return {\n deployed: [],\n removed: [],\n missing: [`source:${name} (${err instanceof Error ? err.message : String(err)})`],\n lockWritten: false,\n };\n }\n }\n return null;\n }\n\n /**\n * Remove stale assets — those recorded in the old lock but absent from the\n * newly resolved set. Returns the list of removed refs.\n */\n private reconcileRemovedAssets(resolved: ProvenanceCandidate[]): string[] {\n const oldLock = this.tryReadLock();\n // Must match the canonical lock-key format from buildLockFile (core/lock.ts):\n // `<kind>:@<publisher>/<name>#<version>`. A different shape here made every\n // locked asset miss the set → wrongly \"removed\" (undeployed) then redeployed.\n const resolvedRefs = new Set(\n resolved.map((c) => `${c.kind}:@${c.publisher}/${c.name}#${c.version}`),\n );\n const removed: string[] = [];\n if (oldLock) {\n for (const ref of Object.keys(oldLock.assets)) {\n if (!resolvedRefs.has(ref)) {\n const { kind, name } = parseCanonicalLockKey(ref);\n if (kind && name) {\n for (const t of this.targetBackends()) removeAsset(kind, name, this.deployOptsFor(t));\n removed.push(ref);\n }\n }\n }\n }\n return removed;\n }\n\n /** Append `add`/`remove` history entries for a completed install reconcile. */\n private recordInstallHistory(deployed: string[], removed: string[]): void {\n for (const ref of deployed) {\n appendHistory(this.projectDir, {\n ref,\n action: \"add\",\n timestamp: new Date().toISOString(),\n context: this.global ? \"global\" : \"project\",\n });\n }\n for (const ref of removed) {\n appendHistory(this.projectDir, {\n ref,\n action: \"remove\",\n timestamp: new Date().toISOString(),\n context: this.global ? \"global\" : \"project\",\n });\n }\n }\n\n /** Read the lock, returning null on a legacy v1 lock instead of throwing. */\n private tryReadLock(): LockFile | null {\n try {\n return readLock(this.lockPath);\n } catch {\n return null;\n }\n }\n\n /** Build a store fetcher from the configured stores, or undefined when none. */\n private buildStoreFetcher(stores: StoreEntry[]): StoreFetcher | undefined {\n if (stores.length === 0) return undefined;\n return {\n getInstallManifest: async (storeUrl, ref) => {\n const { RemoteCatalogSource, CatalogHttpError } = await import(\n \"@skaile/workspaces/library\"\n );\n const src = new RemoteCatalogSource({ baseUrl: storeUrl });\n try {\n const m = await src.getInstallManifest(ref);\n return {\n sourceUrl: m.source.url,\n commit: m.source.commitSha,\n sha256: m.sha256,\n files: m.files,\n };\n } catch (err) {\n if (err instanceof CatalogHttpError && err.status === 404) return null;\n throw err;\n }\n },\n getCanonicalDigest: async (storeUrl, ref) => {\n const { RemoteCatalogSource } = await import(\"@skaile/workspaces/library\");\n const src = new RemoteCatalogSource({ baseUrl: storeUrl });\n return src.getCanonicalDigest(ref);\n },\n };\n }\n\n /**\n * Resolve runtime assets and install any missing npm peer deps.\n *\n * - Required deps: installed via `bun add --optional`. Failure is recorded\n * in `npmFailed` but does not throw — install() proceeds so users get a\n * useful error message rather than a hung command.\n * - Optional deps: not installed automatically (would force every consumer\n * to pull every connector's deps). Future: add a flag to opt in.\n */\n private async installRuntimeAssetDeps(): Promise<{\n npmInstalled: string[];\n npmFailed: string[];\n }> {\n const npmInstalled: string[] = [];\n const npmFailed: string[] = [];\n let runtimeAssets: Awaited<ReturnType<typeof resolveRuntimeAssets>> | null = null;\n try {\n runtimeAssets = await resolveRuntimeAssets(this.projectDir);\n } catch {\n // Non-fatal — projects with no skaile.yaml or unresolvable factory-assets\n // simply have no runtime deps to install.\n return { npmInstalled, npmFailed };\n }\n\n const required = runtimeAssets.requiredNpmDeps.required;\n if (required.length === 0) return { npmInstalled, npmFailed };\n\n const { findMissingPackages, installNpmPackages } = await import(\n \"@skaile/workspaces/connectors\"\n );\n const missing = findMissingPackages(required, this.projectDir);\n if (missing.length === 0) return { npmInstalled, npmFailed };\n\n const result = await installNpmPackages(missing, this.projectDir);\n if (result.success) {\n npmInstalled.push(...missing);\n } else {\n npmFailed.push(...missing);\n }\n return { npmInstalled, npmFailed };\n }\n\n private installLocked(\n repositories: Record<string, SourceDeclaration>,\n patches: Record<string, string>,\n ): InstallResult {\n const lock = this.tryReadLock();\n if (!lock) {\n throw new Error(\"No lock file found. Run `skaile install` first.\");\n }\n\n // Ensure every contributing source clone exists at its pinned commit. Sources\n // are keyed by URL slug; the lock's `sources[]` carries the URL + commit.\n const declBySlug = new Map(Object.entries(repositories));\n for (const src of lock.sources) {\n const slug = sourceCacheKey(src.url);\n const decl = declBySlug.get(slug) ?? { url: src.url };\n ensureRepo(decl, slug, this.reposDir, { projectDir: this.projectDir, pin: src.commit });\n }\n\n // Resolve a source URL to its on-disk clone for verification.\n const resolveCloneDir = (sourceUrl: string): string | null => {\n const slug = sourceCacheKey(sourceUrl);\n const decl = declBySlug.get(slug) ?? { url: sourceUrl };\n return this.resolveRepoDir(decl, slug);\n };\n\n // Verify integrity against the v2 lock.\n const verification = verifyLock(lock, resolveCloneDir);\n if (!verification.ok) {\n const issues = [\n ...verification.drifted.map((r) => `drifted: ${r}`),\n ...verification.missing.map((r) => `missing: ${r}`),\n ];\n throw new Error(`Lock file verification failed:\\n ${issues.join(\"\\n \")}`);\n }\n\n // Rebuild catalog entries from the lock and deploy.\n const resolved: CatalogEntry[] = [];\n for (const [ref, entry] of Object.entries(lock.assets)) {\n const { publisher, kind, name } = parseCanonicalLockKey(ref);\n if (!publisher || !kind || !name) continue;\n const slug = sourceCacheKey(entry.source.url);\n const cloneDir = resolveCloneDir(entry.source.url) ?? join(this.reposDir, slug);\n const mdRel =\n entry.files.find((f) => /\\.(md|yaml)$/i.test(f.path))?.path ?? entry.files[0]?.path ?? \"\";\n resolved.push({\n name,\n kind: kind as CatalogEntry[\"kind\"],\n description: \"\",\n source: mdRel ? join(cloneDir, mdRel) : cloneDir,\n // Keep the publisher label slash-free (repo name), not the full cache key.\n publisher: sourceShortName(entry.source.url),\n version: entry.source.commit,\n requires: [],\n dependencies: [],\n });\n // Ensure the repositories map has an entry for deployAll's local/remote check.\n if (!repositories[slug]) repositories[slug] = { url: entry.source.url, path: cloneDir };\n }\n\n const deployed = [\n ...new Set(\n this.targetBackends().flatMap((t) =>\n deployAll(resolved, repositories, patches, this.deployOptsFor(t)),\n ),\n ),\n ];\n return { deployed, removed: [], missing: [], lockWritten: false };\n }\n\n /**\n * Add a single asset (and its transitive dependencies) to the workspace.\n *\n * Resolves `ref`, deploys the asset and all requirements, then records the ref\n * in `skaile.yaml` `dependencies` so subsequent `skaile install` runs re-deploy it.\n *\n * @param ref - Asset ref in `kind:name` or `repo/kind:name` form (e.g. `skill:my-skill`).\n * @param opts - Optional deploy options.\n * @param opts.link - When `true`, symlink local-path assets instead of copying them\n * (the author dev-loop). Machine-local / not for committing; a no-op for\n * store/factory sources. Defaults to copy.\n * @returns Array of asset refs that were deployed in this call.\n * @throws When the asset cannot be found in any configured repository.\n */\n async add(ref: string, opts?: { link?: boolean }): Promise<string[]> {\n const { repositories, stores, overrides, patches } = this.loadConfig();\n const parsed = parseAssetRef(ref);\n\n // Ensure clones.\n for (const [name, decl] of Object.entries(repositories)) {\n try {\n ensureRepo(decl, name, this.reposDir, { projectDir: this.projectDir });\n } catch {}\n }\n\n const provenanceIndex = buildProvenanceIndex(this.buildClones(repositories), {\n projectDir: this.projectDir,\n });\n const { resolved, missing } = await this.resolveWithStores([ref], {\n provenanceIndex,\n overrides,\n stores,\n });\n if (resolved.length === 0) {\n throw new Error(\n `Asset not found: ${ref}${missing.length ? ` (missing: ${missing.join(\", \")})` : \"\"}`,\n );\n }\n\n const entries = await this.buildCatalogEntries(resolved, repositories);\n const deployed = [\n ...new Set(\n this.targetBackends().flatMap((t) =>\n deployAll(entries, repositories, patches, this.deployOptsFor(t, opts?.link)),\n ),\n ),\n ];\n\n // Add to skaile.yaml dependencies (canonical ref string). Global mode routes\n // this to the user-scope SSOT (`~/.skaile/skaile.yaml`).\n this.addDependencyToConfig(ref);\n\n for (const d of deployed) {\n appendHistory(this.projectDir, {\n ref: d,\n action: \"add\",\n timestamp: new Date().toISOString(),\n context: this.global ? \"global\" : \"project\",\n });\n }\n\n return deployed;\n }\n\n /**\n * Report the body-link **soft dependencies** of the given assets that are not\n * already present in the project.\n *\n * Looks up each ref's persisted `softDeps` in the local index\n * (`~/.skaile/index.db`, populated by `skaile source sync`) and returns the\n * edges whose target is neither a declared dependency nor deployed on disk. It\n * does **not** install anything and never touches the resolver / lock /\n * reconcile path: callers surface the result as a hint, the user opts in with\n * a follow-up `skaile add`. Inspects exactly the passed `refs` — soft deps of\n * their transitively-deployed dependencies are not surfaced here.\n *\n * Opening the index runs its idempotent migrations, so this is not a pure\n * read — but it is **best-effort**: any failure (legacy/corrupt index, a\n * removed-backend guard) yields `[]`, so it can never fail a primary `add`\n * that already succeeded.\n *\n * @param refs - Asset refs to inspect (canonical, `kind:@pub/name`, or `kind:name`).\n * @returns One edge per absent soft-dep target (deduped by target). `toRef` is\n * the parseable `skaile add` ref, omitted when the target isn't in the index.\n */\n async reportSoftDeps(\n refs: string[],\n ): Promise<Array<{ from: string; to: string; toRef?: string }>> {\n if (refs.length === 0) return [];\n return this.withIndexDefs(\n (allDefs) => this.collectSoftDeps(allDefs, refs, true),\n [] as SoftDepEdge[],\n );\n }\n\n /**\n * All body-link soft dependencies of the given assets — present or not.\n *\n * Unlike {@link reportSoftDeps} (which filters to *absent* targets so it can\n * nudge a follow-up `skaile add`), this returns the asset's full inferred\n * soft-dep set for display surfaces (`skaile info` / `tree` / `why`). Read-only\n * and best-effort: any index failure yields `[]`. Targets are deduped.\n *\n * @param refs - Asset refs to inspect (canonical, `kind:@pub/name`, or `kind:name`).\n * @returns One {@link SoftDepEdge} per soft-dep target. `toRef` is the parseable\n * ref, omitted when the target isn't in the index.\n */\n async softDepsOf(refs: string[]): Promise<SoftDepEdge[]> {\n if (refs.length === 0) return [];\n return this.withIndexDefs((allDefs) => this.collectSoftDeps(allDefs, refs, false), []);\n }\n\n /**\n * Reverse lookup: refs (canonical ids) of cached assets whose persisted\n * `softDeps` include `targetRef`. Scans the whole index, not just present\n * assets. Read-only and best-effort (`[]` on any index failure).\n *\n * @param targetRef - Canonical soft-dep target ref (`<publisher>/<name>@<version>`).\n * @returns Def ids that declare `targetRef` as a soft dependency.\n */\n async softDepDependents(targetRef: string): Promise<string[]> {\n return this.withIndexDefs(\n (allDefs) => allDefs.filter((d) => d.softDeps?.includes(targetRef)).map((d) => d.id),\n [],\n );\n }\n\n /**\n * Compute which soft-dependency targets would be left **orphaned** by removing\n * `refs`: targets still present in the project that came in as one of `refs`'\n * soft dependencies and that **nothing else still needs** — neither another\n * present asset's soft-dep ({@link softDepDependents}) nor a typed `requires`.\n *\n * Pure read — never removes anything. The CLI / manage surfaces each result as\n * a prompt (default No) so the user opts in to an extra `skaile remove`. Safe to\n * call before or after the primary remove: assets being removed are excluded\n * from the \"needed by others\" scan, so a soft target referenced only by the\n * removed asset is still reported as an orphan.\n *\n * @param refs - Asset refs being removed (canonical, `kind:@pub/name`, or `kind:name`).\n * @returns One {@link OrphanedSoftDep} per orphaned target (deduped).\n */\n async orphanedSoftDepsAfterRemoving(refs: string[]): Promise<OrphanedSoftDep[]> {\n if (refs.length === 0) return [];\n return this.withIndexDefs((allDefs) => {\n const byId = new Map(allDefs.map((d) => [d.id, d]));\n const present = this.presentRefNames();\n\n // Bare names of the assets being removed — excluded from \"needed by others\".\n const removedNames = new Set<string>();\n for (const ref of refs) {\n for (const def of matchDefsForRef(allDefs, ref)) removedNames.add(def.name);\n try {\n removedNames.add(parseAssetRef(ref).name);\n } catch {}\n }\n\n // Names still needed by a *surviving* present asset (soft-dep or typed requires).\n const neededByOthers = new Set<string>();\n for (const presentRef of this.presentRefs()) {\n for (const def of matchDefsForRef(allDefs, presentRef)) {\n if (removedNames.has(def.name)) continue;\n for (const to of def.softDeps ?? []) neededByOthers.add(softDepName(to));\n // parseRequires keeps the `@pub/` scope on the name — normalize to the\n // same bare-name basis the present-check uses.\n for (const req of parseRequires(def.manifest)) neededByOthers.add(softDepName(req.name));\n }\n }\n\n // A present soft target is flagged even when directly declared in\n // skaile.yaml: with no install-provenance tracking we can't tell \"added for\n // the removed asset\" from \"wanted standalone\", so we report the fact (no\n // surviving referrer) and let the user decide — never auto-remove.\n const out: OrphanedSoftDep[] = [];\n const seen = new Set<string>();\n for (const ref of refs) {\n for (const def of matchDefsForRef(allDefs, ref)) {\n for (const to of def.softDeps ?? []) {\n const targetName = softDepName(to);\n if (!present.has(targetName)) continue; // not in the project — nothing to orphan\n if (removedNames.has(targetName)) continue; // also being removed\n if (neededByOthers.has(targetName)) continue; // something else still needs it\n if (seen.has(to)) continue;\n seen.add(to);\n const targetDef = byId.get(to);\n out.push({\n from: def.id,\n target: to,\n targetRef: targetDef ? depRefFromDef(targetDef) : undefined,\n });\n }\n }\n }\n return out;\n }, []);\n }\n\n /**\n * Open the local index, run `fn` against its cached asset defs, and close it.\n * Best-effort: no index (user never ran `source sync`), a missing file, or any\n * open/guard failure yields `fallback` — so a read surface can never throw or\n * create an empty `index.db` as a side effect.\n */\n private async withIndexDefs<T>(fn: (defs: AssetDefinition[]) => T, fallback: T): Promise<T> {\n try {\n const { LocalIndex, resolveIndexPath } = await import(\"@skaile/workspaces/library\");\n const indexPath = this.indexPathOverride ?? resolveIndexPath();\n if (!existsSync(indexPath)) return fallback;\n const index = new LocalIndex({ indexPath });\n try {\n return fn(await index.listAssetDefs());\n } finally {\n index.close();\n }\n } catch {\n return fallback;\n }\n }\n\n /**\n * Build soft-dep edges for `refs` from cached defs. With `onlyAbsent`, targets\n * already present in the project are skipped (the `reportSoftDeps` nudge); else\n * the full inferred set is returned (the `softDepsOf` display). Deduped by target.\n */\n private collectSoftDeps(\n allDefs: AssetDefinition[],\n refs: string[],\n onlyAbsent: boolean,\n ): SoftDepEdge[] {\n const present = onlyAbsent ? this.presentRefNames() : null;\n const byId = new Map(allDefs.map((d) => [d.id, d]));\n const out: SoftDepEdge[] = [];\n const seen = new Set<string>();\n for (const ref of refs) {\n for (const def of matchDefsForRef(allDefs, ref)) {\n for (const to of def.softDeps ?? []) {\n if (present?.has(softDepName(to))) continue;\n if (seen.has(to)) continue;\n seen.add(to);\n const targetDef = byId.get(to);\n out.push({ from: def.id, to, toRef: targetDef ? depRefFromDef(targetDef) : undefined });\n }\n }\n }\n return out;\n }\n\n /**\n * Names of assets already in the project — declared deps + deployed on disk.\n * Bare name only (see {@link softDepName}): a same-named asset of a different\n * publisher/kind counts as present, so the report under-reports rather than\n * nags about something already installed.\n */\n private presentRefNames(): Set<string> {\n const names = new Set<string>();\n for (const ref of this.presentRefs()) {\n try {\n names.add(parseAssetRef(ref).name);\n } catch {}\n }\n return names;\n }\n\n /**\n * Present asset refs — declared `skaile.yaml` deps (canonical refs as written)\n * plus deployed assets as `kind:name`. Used by the soft-dep present-check and\n * the orphan \"needed by others\" scan.\n */\n private presentRefs(): string[] {\n const refs: string[] = [];\n try {\n for (const ref of resolveSkWorkspaceConfig(this.projectDir).dependencies ?? [])\n refs.push(ref);\n } catch {}\n for (const e of this.listDeployed()) refs.push(`${e.kind}:${e.name}`);\n return refs;\n }\n\n /**\n * Remove a deployed asset and unregister it from `skaile.yaml`.\n *\n * @param ref - Asset ref in `kind:name` form (e.g. `skill:my-skill`).\n * @returns `true` if the asset was found and removed, `false` if it was not deployed.\n */\n remove(ref: string): boolean {\n const parsed = parseAssetRef(ref);\n // Undeploy from every target backend; \"found\" if any backend had it.\n let ok = false;\n for (const t of this.targetBackends()) {\n if (removeAsset(parsed.kind, parsed.name, this.deployOptsFor(t))) ok = true;\n }\n if (ok) {\n const depRef = `${parsed.kind}:${parsed.name}`;\n this.removeDependencyFromConfig(parsed);\n\n appendHistory(this.projectDir, {\n ref: depRef,\n action: \"remove\",\n timestamp: new Date().toISOString(),\n context: this.global ? \"global\" : \"project\",\n });\n }\n return ok;\n }\n\n // ── Query ──────────────────────────────────────────────────────────────\n\n /**\n * Search the catalog across all configured repositories.\n *\n * @param query - Substring to match against entry names and descriptions (case-insensitive).\n * Omit to return all entries.\n * @param kind - Filter by asset kind (`\"skill\"`, `\"agent\"`, `\"prompt\"`, `\"flow\"`, `\"contract\"`).\n * Omit to return all kinds.\n * @returns Array of matching {@link CatalogEntry} objects from all accessible repositories.\n */\n search(query?: string, kind?: string): CatalogEntry[] {\n const { repositories } = this.loadConfig();\n let all: CatalogEntry[] = [];\n\n for (const [name, decl] of Object.entries(repositories)) {\n const repoDir = this.resolveRepoDir(decl, name);\n if (!repoDir) continue;\n all = [...all, ...scanRepo(repoDir, name)];\n }\n\n if (kind) all = all.filter((e) => e.kind === kind);\n if (query) {\n const q = query.toLowerCase();\n all = all.filter(\n (e) => e.name.toLowerCase().includes(q) || e.description.toLowerCase().includes(q),\n );\n }\n return all;\n }\n\n /**\n * On-disk root + config slug for every declared (and the implicit factory)\n * source that has a local clone. Companion to {@link search}: callers that\n * need to relate a scanned entry back to its source root (e.g. to stamp\n * `DOMAIN.md`-derived domain grouping) can't recover the root from the flat\n * {@link CatalogEntry} list `search` returns.\n */\n searchRepoRoots(): { repoName: string; root: string }[] {\n const { repositories } = this.loadConfig();\n const out: { repoName: string; root: string }[] = [];\n for (const [name, decl] of Object.entries(repositories)) {\n const repoDir = this.resolveRepoDir(decl, name);\n if (repoDir) out.push({ repoName: name, root: repoDir });\n }\n return out;\n }\n\n /**\n * Look up a single asset's full catalog entry.\n *\n * @param ref - Asset ref in `kind:name` or `repo/kind:name` form.\n * @returns The matching {@link CatalogEntry}, or `null` when not found.\n */\n info(ref: string): CatalogEntry | null {\n const { repositories } = this.loadConfig();\n const parsed = parseAssetRef(ref);\n\n for (const [name, decl] of Object.entries(repositories)) {\n const repoDir = this.resolveRepoDir(decl, name);\n if (!repoDir) continue;\n // Match on the entry's scanned (manifest) publisher, not the repo map key\n // (= URL slug). The two are unrelated identities under canonical schema.\n const entries = scanRepo(repoDir, name);\n const match = entries.find(\n (e) =>\n e.kind === parsed.kind &&\n e.name === parsed.name &&\n (!parsed.publisher || e.publisher === parsed.publisher),\n );\n if (match) return match;\n }\n return null;\n }\n\n /**\n * List all assets currently deployed in the workspace (or global cache).\n *\n * Scans the framework deploy directories rather than the lock file, so it\n * also returns assets that were installed manually or outside of `skaile install`.\n *\n * @param kind - Filter by asset kind. Omit to return all kinds.\n * @returns Shallow {@link CatalogEntry} objects (description and version will be empty).\n */\n listDeployed(kind?: string): CatalogEntry[] {\n // Bundles are dependency groups, not deployed as files — exclude from scan\n const kinds = (\n kind ? [kind] : [\"skill\", \"agent\", \"prompt\", \"flow\", \"contract\"]\n ) as AiComponent[];\n const result: CatalogEntry[] = [];\n const seen = new Set<string>();\n for (const k of kinds) {\n try {\n const base = deployedBase(k, this.driverTarget, this.global, this.projectDir);\n if (!existsSync(base)) continue;\n for (const item of readdirSync(base, { withFileTypes: true })) {\n // Directories and symlinks use the directory name directly (skills, omp agents, etc.)\n // Files use the stem without extension (claude-code agents → .md, codex agents → .toml,\n // prompts → .prompt.md, flows → .flow.yaml/.flow.json)\n let name: string;\n if (item.isDirectory() || item.isSymbolicLink()) {\n name = item.name;\n } else if (item.isFile()) {\n name = item.name\n .replace(/\\.prompt\\.md$/, \"\")\n .replace(/\\.flow\\.(yaml|json)$/, \"\")\n .replace(/\\.bundle\\.yaml$/, \"\")\n .replace(/\\.(md|toml|yaml|json)$/, \"\");\n } else {\n continue;\n }\n const key = `${k}:${name}`;\n if (seen.has(key)) continue;\n seen.add(key);\n result.push({\n name,\n kind: k as any,\n description: \"\",\n source: join(base, item.name),\n version: \"\",\n requires: [],\n dependencies: [],\n });\n }\n } catch {}\n }\n return result;\n }\n\n /**\n * List the **declared** top-level dependencies from `skaile.yaml`, each tagged\n * with a reconciliation {@link DeclaredState}:\n *\n * - `declared` — in `skaile.yaml`, not yet resolved into the lock.\n * - `installed` — declared + locked, and (for deployable kinds) materialized on\n * disk. Non-deployable kinds ({@link NON_DEPLOYABLE_KINDS}) count as installed\n * once locked — they are wired at session start, never written to the target dir.\n * - `drift` — declared + locked but the deployed files are missing on disk.\n * - `invalid` — the `dependencies:` entry isn't a parseable canonical ref. Only\n * surfaced in the unfiltered listing (a `kind` filter can't classify it).\n *\n * Transitive (lock-only) deps are excluded by construction — only the declared\n * set is walked, so a lock entry with no matching `dependencies:` ref never shows.\n *\n * @param kind - Filter by asset kind. Omit to return all kinds.\n * @returns One {@link DeclaredAsset} per declared dep (after the optional kind filter).\n * @throws {MissingManifestError} when the project has no `skaile.yaml`.\n * @throws {Error} with a `migrate-skaile-manifest` hint on legacy `repositories:` / `ai_resources:` keys.\n */\n listDeclared(kind?: string): DeclaredAsset[] {\n if (!existsSync(join(this.projectDir, SKAILE_YAML_DEFAULT))) {\n throw new MissingManifestError(this.projectDir);\n }\n // resolveSkWorkspaceConfig runs the canonical normalizer (throws on legacy\n // keys) — used directly rather than loadConfig() to avoid the latter's\n // repositories-map build + getGlobalCacheDir() migration side effects on a read.\n const dependencies = resolveSkWorkspaceConfig(this.projectDir).dependencies ?? [];\n const lock = this.tryReadLock();\n const lockKeys = lock ? Object.keys(lock.assets).map(parseCanonicalLockKey) : [];\n\n const out: DeclaredAsset[] = [];\n for (const ref of dependencies) {\n let parsed: ReturnType<typeof parseAssetRef>;\n try {\n parsed = parseAssetRef(ref);\n } catch {\n // An unparseable ref has no kind to match a filter against; surface it\n // as `invalid` in the unfiltered listing rather than dropping it silently.\n if (!kind) out.push({ ref, kind: \"\", name: ref, state: \"invalid\" });\n continue;\n }\n if (kind && parsed.kind !== kind) continue;\n\n // A declared ref need not carry a publisher; match on kind+name and, when\n // present, the publisher — the lock key is always fully canonical.\n const locked = lockKeys.some(\n (k) =>\n k.kind === parsed.kind &&\n k.name === parsed.name &&\n (!parsed.publisher || k.publisher === parsed.publisher),\n );\n\n let state: DeclaredState;\n if (!locked) {\n state = \"declared\";\n } else if (NON_DEPLOYABLE_KINDS.has(parsed.kind)) {\n state = \"installed\";\n } else {\n const onDisk = isDeployed(\n parsed.kind as AiComponent,\n parsed.name,\n this.driverTarget,\n this.global,\n this.projectDir,\n );\n state = onDisk ? \"installed\" : \"drift\";\n }\n out.push({ ref, kind: parsed.kind, name: parsed.name, state });\n }\n return out;\n }\n\n /**\n * Per-backend reconciliation of the **global** declared deps\n * (`~/.skaile/skaile.yaml`) against each global backend's deploy dir. The\n * global twin of {@link listDeclared}: the same `declared` / `installed` /\n * `drift` / `invalid` vocabulary, but one row **per (ref, backend)** so an\n * asset can be `installed` for `claude-code` and `drift`/`declared` for\n * `codex` at once.\n *\n * Reads the SSOT + the global lock (`~/.skaile/skaile.lock.yaml`) — construct\n * the manager with `global: true`. Unlike `listDeclared`, a missing SSOT is\n * **not** an error: it yields an empty list (a fresh machine has no globals).\n *\n * @param opts.backend - Reconcile against this one backend only (the\n * `--backend` filter); omit for every backend in {@link targetBackends}.\n * @param opts.kind - Filter by asset kind.\n * @returns One {@link BackendDeclaredAsset} per declared dep × backend.\n * @throws {Error} on legacy keys in `~/.skaile/skaile.yaml` (migration hint).\n */\n globalState(opts?: { backend?: DriverTarget; kind?: string }): BackendDeclaredAsset[] {\n const dependencies = resolveGlobalSkWorkspaceConfig().dependencies ?? [];\n const lock = this.tryReadLock();\n const lockKeys = lock ? Object.keys(lock.assets).map(parseCanonicalLockKey) : [];\n const backends = opts?.backend ? [opts.backend] : this.targetBackends();\n\n const out: BackendDeclaredAsset[] = [];\n for (const ref of dependencies) {\n let parsed: ReturnType<typeof parseAssetRef>;\n try {\n parsed = parseAssetRef(ref);\n } catch {\n if (!opts?.kind) {\n for (const backend of backends)\n out.push({ ref, kind: \"\", name: ref, state: \"invalid\", backend });\n }\n continue;\n }\n if (opts?.kind && parsed.kind !== opts.kind) continue;\n\n const locked = lockKeys.some(\n (k) =>\n k.kind === parsed.kind &&\n k.name === parsed.name &&\n (!parsed.publisher || k.publisher === parsed.publisher),\n );\n\n for (const backend of backends) {\n let state: DeclaredState;\n if (!locked) {\n state = \"declared\";\n } else if (NON_DEPLOYABLE_KINDS.has(parsed.kind)) {\n state = \"installed\";\n } else {\n const onDisk = isDeployed(parsed.kind as AiComponent, parsed.name, backend, true);\n state = onDisk ? \"installed\" : \"drift\";\n }\n out.push({ ref, kind: parsed.kind, name: parsed.name, state, backend });\n }\n }\n return out;\n }\n\n /**\n * Build an aggregated workspace overview with domain grouping and sync status.\n *\n * Combines deployed assets, lock file metadata, and live repository status\n * into a single structured result. Used by `skaile status`.\n *\n * @returns {@link OverviewResult} with entries grouped by domain and per-repo sync status.\n */\n overview(): OverviewResult {\n const { repositories } = this.loadConfig();\n const lock = this.tryReadLock();\n const deployed = this.listDeployed();\n\n const repoStatuses = this.buildRepoStatuses(repositories);\n const lockByKindName = indexLockByKindName(lock);\n\n // Build entries with publisher + sync info. Domain grouping is by publisher\n // now that the lock no longer records a project-local domain.\n const entries: OverviewEntry[] = [];\n for (const d of deployed) {\n const lockEntry = lockByKindName.get(`${d.kind}:${d.name}`);\n const publisher = lockEntry?.publisher ?? \"\";\n const version = lockEntry?.version ?? \"\";\n const slug = lockEntry ? sourceCacheKey(lockEntry.url) : \"\";\n const syncStatus = slug ? computeSyncStatus(repoStatuses.get(slug)) : \"unknown\";\n const domain = publisher || \"unknown\";\n entries.push({ kind: d.kind, name: d.name, domain, publisher, version, syncStatus });\n }\n\n return {\n byDomain: groupAndSortByDomain(entries),\n total: entries.length,\n repos: [...repoStatuses.values()],\n };\n }\n\n /** Collect live sync status for every configured repository, keyed by name. */\n private buildRepoStatuses(\n repositories: Record<string, SourceDeclaration>,\n ): Map<string, RepoStatusInfo> {\n const repoStatuses = new Map<string, RepoStatusInfo>();\n for (const [name, decl] of Object.entries(repositories)) {\n const status = checkRepoStatus(decl, name, this.reposDir);\n repoStatuses.set(name, {\n name,\n kind: status.kind,\n behind: status.behind,\n upToDate: status.upToDate,\n error: status.error,\n });\n }\n return repoStatuses;\n }\n\n /**\n * Build the resolved dependency tree from the lock file.\n *\n * @returns Root {@link DependencyNode} with `ref === \"project\"` whose children\n * are the directly-declared dependencies, each with their own transitive subtrees.\n * Returns a single node with `ref === \"(no lock file)\"` when no lock exists.\n */\n tree(): DependencyNode {\n const lock = this.tryReadLock();\n if (!lock) return { ref: \"(no lock file)\", children: [] };\n\n // v2 lock no longer records per-asset parent provenance — every locked asset\n // is shown as a direct child of the project (flat tree).\n return {\n ref: \"project\",\n children: Object.keys(lock.assets).map((ref) => ({ ref, children: [] })),\n };\n }\n\n /**\n * Explain why an asset is installed by tracing its dependency chain in the lock file.\n *\n * @param ref - Asset ref in `kind:name` form.\n * @returns Chain of refs from the asset back to `\"direct (skaile.yaml)\"`, or `[]` when\n * the asset is not in the lock file.\n */\n why(ref: string): string[] {\n const lock = this.tryReadLock();\n if (!lock) return [];\n // Exact lock-key hit, else a version-agnostic match on the `kind:@pub/name`\n // prefix — the lock can pin a content-sha pseudo-version, so a bare\n // `kind:@pub/name` ref would otherwise never find its locked entry.\n const bare = (s: string) => (s.includes(\"#\") ? s.slice(0, s.indexOf(\"#\")) : s);\n const key = lock.assets[ref]\n ? ref\n : Object.keys(lock.assets).find((k) => bare(k) === bare(ref));\n if (!key) return []; // not in lock file\n // v2 lock no longer records a dep chain — every locked asset is reported as\n // directly declared. (Transitive provenance reconstruction is out of scope.)\n return [key, \"direct (skaile.yaml)\"];\n }\n\n /**\n * List installed assets whose source repository is behind the remote.\n *\n * Only remote repositories (not local paths) are checked for staleness.\n *\n * @returns Array of {@link OutdatedEntry} objects, one per asset in a repository\n * that has commits not yet pulled locally.\n */\n outdated(): OutdatedEntry[] {\n const { repositories } = this.loadConfig();\n const lock = this.tryReadLock();\n if (!lock) return [];\n\n const result: OutdatedEntry[] = [];\n for (const src of lock.sources) {\n const slug = sourceCacheKey(src.url);\n const decl = repositories[slug];\n if (!decl || decl.path) continue; // skip unknown / local sources\n const status = checkRepoStatus(decl, slug, this.reposDir);\n if (status.behind <= 0) continue;\n for (const [ref, entry] of Object.entries(lock.assets)) {\n if (entry.source.url !== src.url) continue;\n const { publisher, kind, name, version } = parseCanonicalLockKey(ref);\n if (!kind || !name) continue;\n result.push({\n kind,\n name,\n publisher: publisher ?? sourceShortName(src.url),\n currentVersion: version ?? \"\",\n behind: status.behind,\n });\n }\n }\n return result;\n }\n\n /**\n * Produce a unified diff between the deployed asset and its catalog source.\n *\n * Useful for detecting manual edits to deployed files or verifying that a patch\n * was applied correctly.\n *\n * @param ref - Asset ref in `kind:name` form.\n * @returns Unified diff string, or `null` when there are no differences or the\n * asset is not deployed/resolvable.\n */\n diff(ref: string): string | null {\n const parsed = parseAssetRef(ref);\n const entry = this.info(ref);\n if (!entry) return null;\n\n const deployedPath = join(\n deployedBase(parsed.kind as AiComponent, this.driverTarget, this.global, this.projectDir),\n parsed.name,\n );\n if (!existsSync(deployedPath) || !existsSync(entry.source)) return null;\n\n const r = spawnSync(\"diff\", [\"-ruN\", entry.source, deployedPath], { encoding: \"utf8\" });\n return r.status === 1 ? r.stdout : null;\n }\n\n // ── Lock ───────────────────────────────────────────────────────────────\n\n /**\n * Resolve all declared dependencies and write (or overwrite) `skaile.lock.yaml`.\n *\n * Performs repository sync and full dependency resolution without deploying assets.\n * Use this to regenerate the lock file after manually editing `skaile.yaml`.\n *\n * @returns The written {@link LockFile} data.\n */\n async lock(): Promise<LockFile> {\n const { repositories, stores, dependencies, overrides } = this.loadConfig();\n\n for (const [name, decl] of Object.entries(repositories)) {\n try {\n ensureRepo(decl, name, this.reposDir, { projectDir: this.projectDir });\n } catch {}\n }\n\n const provenanceIndex = buildProvenanceIndex(this.buildClones(repositories), {\n projectDir: this.projectDir,\n });\n const { resolved, overridesApplied } = await this.resolveWithStores(dependencies, {\n provenanceIndex,\n overrides,\n stores,\n });\n const lockData = buildLockFile(resolved, overridesApplied);\n writeLock(this.lockPath, lockData);\n return lockData;\n }\n\n // ── Patch workflow ─────────────────────────────────────────────────────\n\n /**\n * Extract a deployed asset into a patch working directory for editing.\n *\n * Copies the deployed asset to `.skaile/patches/<kind>-<name>/` so changes\n * can be made there and then committed as a patch file via `patchCommit`.\n *\n * @param ref - Asset ref in `kind:name` form.\n * @returns Absolute path to the patch working directory.\n * @throws When the asset cannot be found in the catalog.\n */\n patch(ref: string): string {\n const entry = this.info(ref);\n if (!entry) throw new Error(`Asset not found: ${ref}`);\n return extractForPatch(entry, this.patchDir);\n }\n\n /**\n * Generate a `.patch` file from changes made in the patch working directory.\n *\n * Diffs the patch working directory against the original catalog source and\n * writes the result to `.skaile/patches/<kind>-<name>.patch`.\n *\n * @param ref - Asset ref in `kind:name` form.\n * @returns Absolute path to the generated `.patch` file.\n * @throws When the patch working directory does not exist or no differences are found.\n */\n patchCommit(ref: string): string {\n const parsed = parseAssetRef(ref);\n const entry = this.info(ref);\n if (!entry) throw new Error(`Asset not found: ${ref}`);\n\n const patchedDir = join(this.patchDir, `${parsed.kind}-${parsed.name}`);\n if (!existsSync(patchedDir)) {\n throw new Error(`No patch working dir found. Run \\`skaile patch ${ref}\\` first.`);\n }\n\n const originalDir = dirname(entry.source);\n const content = generatePatch(originalDir, patchedDir);\n if (!content) throw new Error(\"No differences found.\");\n\n const patchFile = join(this.patchDir, `${parsed.kind}-${parsed.name}.patch`);\n savePatch(patchFile, content);\n return patchFile;\n }\n\n /**\n * Apply the committed patch file to the repository clone and open a contribution branch.\n *\n * Applies `.skaile/patches/<kind>-<name>.patch` to the repository clone, creates a\n * `patch/<kind>-<name>` branch, and stages a commit — ready to push via `contribPush`.\n *\n * @param ref - Asset ref in `kind:name` form.\n * @throws When the asset is not found, has no repository, or the patch file is missing.\n */\n patchSubmit(ref: string): void {\n const parsed = parseAssetRef(ref);\n const entry = this.info(ref);\n if (!entry?.publisher) throw new Error(`Asset not found or no publisher: ${ref}`);\n\n const { repositories } = this.loadConfig();\n const decl = repositories[entry.publisher];\n if (!decl?.url) throw new Error(\"Can only submit patches for remote sources.\");\n\n // Resolve through the same helper search/info use so patch + read agree on the clone dir.\n const repoDir = this.resolveRepoDir(decl, entry.publisher);\n if (!repoDir) throw new Error(`Repository clone not found for ${entry.publisher}.`);\n const branchName = `patch/${parsed.kind}-${parsed.name}`;\n\n // Apply patch to repo clone\n const patchFile = join(this.patchDir, `${parsed.kind}-${parsed.name}.patch`);\n if (!existsSync(patchFile)) throw new Error(\"No patch file. Run `skaile patch-commit` first.\");\n\n coreApplyPatch(repoDir, patchFile);\n commitChanges(repoDir, `fix: improve ${parsed.kind} ${parsed.name}`, branchName);\n }\n\n /**\n * Delete the patch working directory and patch file for an asset.\n *\n * @param ref - Asset ref in `kind:name` form.\n */\n patchRemove(ref: string): void {\n const parsed = parseAssetRef(ref);\n const patchFile = join(this.patchDir, `${parsed.kind}-${parsed.name}.patch`);\n const patchedDir = join(this.patchDir, `${parsed.kind}-${parsed.name}`);\n try {\n rmSync(patchFile);\n } catch {}\n try {\n rmSync(patchedDir, { recursive: true });\n } catch {}\n }\n\n // ── Doctor ─────────────────────────────────────────────────────────────\n\n /**\n * Scan deployed assets for unsatisfied transitive dependencies.\n *\n * For each deployed asset, checks that all entries in its `requires` list are\n * also deployed. Returns a list of issues with a flag indicating whether the\n * missing dependency can be resolved from a configured repository.\n *\n * @returns Array of {@link DepIssue} objects. An empty array means the workspace is healthy.\n */\n doctor(): DepIssue[] {\n const { repositories } = this.loadConfig();\n const deployed = this.listDeployed();\n const issues: DepIssue[] = [];\n\n for (const entry of deployed) {\n const full = this.info(`${entry.kind}:${entry.name}`);\n if (!full) continue;\n for (const req of full.requires) {\n if (\n !isDeployed(\n req.kind as AiComponent,\n req.name,\n this.driverTarget,\n this.global,\n this.projectDir,\n )\n ) {\n const inRepos =\n resolveAsset({ kind: req.kind, name: req.name }, repositories, this.reposDir) !== null;\n issues.push({\n assetKind: entry.kind,\n assetName: entry.name,\n depKind: req.kind,\n depName: req.name,\n inRepos,\n });\n }\n }\n }\n return issues;\n }\n\n // ── Scaffold ───────────────────────────────────────────────────────────\n\n /**\n * Create a minimal asset scaffold directory (delegates to {@link createScaffold}).\n *\n * @param name - Asset name (also used as the directory name).\n * @param kind - Asset kind: `skill` | `agent` | `bundle` | `flow` | `prompt` | `contract`.\n * @param destDir - Parent directory to create the asset in.\n * @returns `{ ok: true, path }` on success, `{ ok: false, path: errorMessage }` if the\n * directory already exists.\n */\n create(name: string, kind: string, destDir: string): { ok: boolean; path: string } {\n return createScaffold(name, kind, destDir);\n }\n\n // ── Contrib (REMOVED 2026-05-12) ───────────────────────────────────────\n //\n // The `contribChanges / contribDiff / contribCommit / contribPush /\n // contribCompare` methods were retired alongside `skaile repo contrib *`.\n // The refinement push-back workflow is being re-introduced in Phase 4 as\n // `skaile publish` + `skaile preset push` against the Library Source model.\n\n // ── History ────────────────────────────────────────────────────────────\n\n /**\n * Return recent asset action history entries, newest first.\n *\n * @param limit - Maximum number of entries to return. Defaults to `20`.\n * @returns Array of {@link HistoryEntry} objects in reverse-chronological order.\n */\n history(limit = 20): HistoryEntry[] {\n return getRecentHistory(this.projectDir, limit);\n }\n\n /**\n * Erase all asset action history for this workspace.\n */\n clearHistory(): void {\n clearHistory(this.projectDir);\n }\n\n // ── Clean ───────────────────────────────────────────────────────────────\n\n /**\n * Remove deployed assets tracked by the lock file and report unmanaged ones.\n *\n * With `opts.all`, also deletes `.skaile/history.yaml`, `.skaile/patches/`,\n * `.skaile/cache/sources/`, and `skaile.lock.yaml` — effectively resetting the\n * workspace to a pre-install state.\n *\n * @param opts - Optional cleanup options.\n * @param opts.all - When `true`, remove all Skaile-managed state in addition to deployed assets.\n * @returns Object with `removed` (successfully cleaned refs), `skipped` (with reasons),\n * and `unmanaged` (deployed assets not in the lock file).\n */\n clean(opts?: { all?: boolean }): {\n removed: string[];\n skipped: Array<{ ref: string; reason: string }>;\n unmanaged: string[];\n } {\n const lock = this.tryReadLock();\n const skipped: Array<{ ref: string; reason: string }> = [];\n\n const removed = this.cleanLockedDeployedAssets(lock);\n const unmanaged = this.collectUnmanagedAssets(lock);\n\n if (opts?.all) this.removeAllManagedState();\n\n return { removed, skipped, unmanaged };\n }\n\n /**\n * Remove the deployed dir of every asset tracked by the lock; missing dirs\n * still count as removed. Returns the list of cleaned refs.\n */\n private cleanLockedDeployedAssets(lock: LockFile | null): string[] {\n const removed: string[] = [];\n if (!lock) return removed;\n for (const ref of Object.keys(lock.assets)) {\n const { kind, name } = parseCanonicalLockKey(ref);\n if (!kind || !name) continue;\n const dest = deployedDir(\n kind as AiComponent,\n name,\n this.driverTarget,\n this.global,\n this.projectDir,\n );\n\n try {\n const stat = lstatSync(dest);\n if (stat.isSymbolicLink()) unlinkSync(dest);\n else rmSync(dest, { recursive: true, force: true });\n removed.push(ref);\n } catch {\n // Already gone — count as removed\n removed.push(ref);\n }\n }\n return removed;\n }\n\n /**\n * Report deployed assets not tracked by the lock file. Deployed assets are\n * keyed by <kind>:<name>; lock canonical refs are mapped to that shape.\n */\n private collectUnmanagedAssets(lock: LockFile | null): string[] {\n const lockRefs = lock\n ? new Set(\n Object.keys(lock.assets).map((r) => {\n const p = parseCanonicalLockKey(r);\n return p.kind && p.name ? `${p.kind}:${p.name}` : r;\n }),\n )\n : new Set<string>();\n const unmanaged: string[] = [];\n const allDeployed = this.listDeployed();\n for (const d of allDeployed) {\n const ref = `${d.kind}:${d.name}`;\n if (!lockRefs.has(ref)) {\n unmanaged.push(ref);\n }\n }\n return unmanaged;\n }\n\n /** Delete all Skaile-managed state: history file, patches/, cache/sources/, lock. */\n private removeAllManagedState(): void {\n // Delete history file\n const historyFile = join(this.projectDir, \".skaile\", \"history.yaml\");\n try {\n unlinkSync(historyFile);\n } catch {}\n\n // Remove patches dir\n try {\n rmSync(this.patchDir, { recursive: true, force: true });\n } catch {}\n\n // Remove repos dir\n try {\n rmSync(this.reposDir, { recursive: true, force: true });\n } catch {}\n\n // Remove lock file\n try {\n unlinkSync(this.lockPath);\n } catch {}\n }\n\n // ── Helpers ────────────────────────────────────────────────────────────\n\n /**\n * Add a dependency ref to the manifest `dependencies:` if not already present.\n * Project mode edits `<projectDir>/skaile.yaml`; global mode edits the\n * user-scope SSOT `~/.skaile/skaile.yaml`, **bootstrapping** the file (and its\n * parent dir) when absent so `skaile add --global` works on a fresh machine.\n */\n private addDependencyToConfig(ref: string): void {\n const configPath = join(this.stateRoot, \"skaile.yaml\");\n if (!existsSync(configPath)) {\n if (!this.global) return; // project mode never bootstraps a manifest\n mkdirSync(this.stateRoot, { recursive: true });\n writeFileSync(configPath, stringifyYaml({ dependencies: [ref] }, { lineWidth: 120 }));\n return;\n }\n const raw = parseYaml(readFileSync(configPath, \"utf8\")) ?? {};\n if (!raw.dependencies) raw.dependencies = [];\n if (!raw.dependencies.includes(ref)) {\n raw.dependencies.push(ref);\n writeFileSync(configPath, stringifyYaml(raw, { lineWidth: 120 }));\n }\n }\n\n /**\n * Remove a dependency ref from the manifest `dependencies:`. Targets the same\n * file as {@link addDependencyToConfig} (`~/.skaile/skaile.yaml` in global mode).\n */\n private removeDependencyFromConfig(target: {\n kind: string;\n name: string;\n publisher?: string;\n }): void {\n const configPath = join(this.stateRoot, \"skaile.yaml\");\n if (!existsSync(configPath)) return;\n const raw = parseYaml(readFileSync(configPath, \"utf8\")) ?? {};\n if (!Array.isArray(raw.dependencies)) return;\n // Match by parsed identity, not by an exact string: `add` stores deps\n // publisher-qualified (`skill:@pub/name`) while a remove caller only knows\n // `kind:name`, so an `indexOf` of the bare key never matched. When both\n // sides carry a publisher they must agree; otherwise fall back to kind+name.\n const wantPub = target.publisher?.replace(/^@/, \"\");\n const idx = raw.dependencies.findIndex((dep: unknown) => {\n if (typeof dep !== \"string\") return false;\n const p = parseRefLoose(dep);\n if (!p || p.kind !== target.kind || p.name !== target.name) return false;\n const havePub = p.publisher?.replace(/^@/, \"\");\n return wantPub === undefined || havePub === undefined || havePub === wantPub;\n });\n if (idx !== -1) {\n raw.dependencies.splice(idx, 1);\n writeFileSync(configPath, stringifyYaml(raw, { lineWidth: 120 }));\n }\n }\n\n private resolveRepoDir(decl: SourceDeclaration, name: string): string | null {\n // Check links first\n const links = readLinks(this.projectDir);\n if (links[name]) {\n return existsSync(links[name]) ? links[name] : null;\n }\n\n if (decl.path) {\n const resolved = resolve(this.projectDir, decl.path);\n return existsSync(resolved) ? resolved : null;\n }\n\n // Check project-local symlink, then global cache\n const dest = join(this.reposDir, name);\n if (existsSync(dest)) return dest;\n\n const globalDest = join(getGlobalCacheDir(), name);\n if (existsSync(join(globalDest, \".git\"))) return globalDest;\n\n return null;\n }\n}\n\n// ── Agent install (renders GitAgent packages to framework-native files) ──\n\nexport { installAgent } from \"./install-agent.js\";\n\n// ── Renderers ─────────────────────────────────────────────────────────────\n\nexport type { AgentRenderer, AgentRenderInput, AgentRenderResult } from \"./renderers.js\";\nexport {\n AGENT_RENDERERS,\n claudeCodeRenderer,\n codexRenderer,\n driverTargetSupportsAgents,\n ompRenderer,\n} from \"./renderers.js\";\n\n// ── Fragments ─────────────────────────────────────────────────────────────\n\nexport type {\n AbilityRef,\n ConnectorRef,\n ContractRef,\n FragmentContext,\n FragmentId,\n} from \"./fragments.js\";\nexport { BUILT_IN_FRAGMENTS, loadPromptExtensions, resolveFragments } from \"./fragments.js\";\n"]}
|