@skaile/workspaces 5.15.0 → 5.15.1
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 +6 -0
- package/dist/{asset-feeds-LIDC7547.js → asset-feeds-FVDNQ2FM.js} +4 -4
- package/dist/{asset-feeds-LIDC7547.js.map → asset-feeds-FVDNQ2FM.js.map} +1 -1
- package/dist/asset-manager/index.js +1 -1
- package/dist/{chunk-YL23KWBX.js → chunk-354JIEIE.js} +3 -3
- package/dist/{chunk-YL23KWBX.js.map → chunk-354JIEIE.js.map} +1 -1
- package/dist/{chunk-JHP6MIW2.js → chunk-55VKZUQY.js} +7 -7
- package/dist/{chunk-JHP6MIW2.js.map → chunk-55VKZUQY.js.map} +1 -1
- package/dist/{chunk-SCUEPCSJ.js → chunk-7Y7UYNGL.js} +3 -3
- package/dist/{chunk-SCUEPCSJ.js.map → chunk-7Y7UYNGL.js.map} +1 -1
- package/dist/{chunk-QR7W5JV4.js → chunk-B6I7SF2X.js} +7 -7
- package/dist/{chunk-QR7W5JV4.js.map → chunk-B6I7SF2X.js.map} +1 -1
- package/dist/{chunk-2LTF2ZHH.js → chunk-GR7TV4XC.js} +3 -3
- package/dist/{chunk-2LTF2ZHH.js.map → chunk-GR7TV4XC.js.map} +1 -1
- package/dist/{chunk-PIDMOE7R.js → chunk-GV3MFKDV.js} +3 -3
- package/dist/{chunk-PIDMOE7R.js.map → chunk-GV3MFKDV.js.map} +1 -1
- package/dist/{chunk-SRKU7QUG.js → chunk-JJLH4TX4.js} +6 -6
- package/dist/{chunk-SRKU7QUG.js.map → chunk-JJLH4TX4.js.map} +1 -1
- package/dist/{chunk-D2MZZ2KB.js → chunk-JUHDED6J.js} +3 -3
- package/dist/{chunk-D2MZZ2KB.js.map → chunk-JUHDED6J.js.map} +1 -1
- package/dist/{chunk-DP6YRAPZ.js → chunk-MUOSKYI2.js} +49 -5
- package/dist/chunk-MUOSKYI2.js.map +1 -0
- package/dist/{chunk-KUB4HFGK.js → chunk-NHH3MRSC.js} +3 -3
- package/dist/{chunk-KUB4HFGK.js.map → chunk-NHH3MRSC.js.map} +1 -1
- package/dist/{chunk-AXNX2SKZ.js → chunk-NVBN3YOH.js} +5 -5
- package/dist/{chunk-AXNX2SKZ.js.map → chunk-NVBN3YOH.js.map} +1 -1
- package/dist/{chunk-XX4C72CC.js → chunk-R37L4BNR.js} +2 -2
- package/dist/{chunk-XX4C72CC.js.map → chunk-R37L4BNR.js.map} +1 -1
- package/dist/{chunk-74THIMZV.js → chunk-RNFHJUK7.js} +3 -3
- package/dist/{chunk-74THIMZV.js.map → chunk-RNFHJUK7.js.map} +1 -1
- package/dist/{chunk-AVUJBSFA.js → chunk-U7YMGW7M.js} +2 -2
- package/dist/{chunk-AVUJBSFA.js.map → chunk-U7YMGW7M.js.map} +1 -1
- package/dist/{chunk-I3JO3NIZ.js → chunk-VQQCA7BD.js} +3 -3
- package/dist/{chunk-I3JO3NIZ.js.map → chunk-VQQCA7BD.js.map} +1 -1
- package/dist/cli/index.js +34 -34
- package/dist/connectors/index.js +1 -1
- package/dist/{connectors-JQR5RAMC.js → connectors-TVFFE5H4.js} +4 -4
- package/dist/{connectors-JQR5RAMC.js.map → connectors-TVFFE5H4.js.map} +1 -1
- package/dist/{ensure-sources-NAGBSMJE.js → ensure-sources-N4E5EDGC.js} +4 -4
- package/dist/{ensure-sources-NAGBSMJE.js.map → ensure-sources-N4E5EDGC.js.map} +1 -1
- package/dist/factory-assets/connectors/box.js +1 -1
- package/dist/factory-assets/connectors/deploy.js +1 -1
- package/dist/factory-assets/connectors/devserver.js +1 -1
- package/dist/factory-assets/connectors/flow/adapter.js +1 -1
- package/dist/factory-assets/connectors/flow/run-flow.js +2 -2
- package/dist/factory-assets/connectors/flow.js +1 -1
- package/dist/factory-assets/connectors/git/CONNECTOR.md +1 -0
- package/dist/factory-assets/connectors/git/lifecycle.d.ts.map +1 -1
- package/dist/factory-assets/connectors/git/repo.d.ts +17 -3
- package/dist/factory-assets/connectors/git/repo.d.ts.map +1 -1
- package/dist/factory-assets/connectors/git.js +1 -1
- package/dist/factory-assets/connectors/gmail.js +1 -1
- package/dist/factory-assets/connectors/googledrive.js +1 -1
- package/dist/factory-assets/connectors/local.js +1 -1
- package/dist/factory-assets/connectors/mattermost.js +1 -1
- package/dist/factory-assets/connectors/memory.js +1 -1
- package/dist/factory-assets/connectors/minio.js +1 -1
- package/dist/factory-assets/connectors/postgres.js +1 -1
- package/dist/factory-assets/connectors/s3.js +1 -1
- package/dist/factory-assets/connectors/sharepoint.js +1 -1
- package/dist/factory-assets/connectors/sqlite.js +1 -1
- package/dist/factory-assets/connectors/static-server.js +1 -1
- package/dist/factory-assets/connectors/tunnel.js +1 -1
- package/dist/factory-assets/connectors/webdav.js +1 -1
- package/dist/factory-assets/connectors/xstate-store.js +1 -1
- package/dist/factory-assets/connectors/xstate.js +1 -1
- package/dist/{helpers-XFHJDJOA.js → helpers-PPVGVYIZ.js} +4 -4
- package/dist/{helpers-XFHJDJOA.js.map → helpers-PPVGVYIZ.js.map} +1 -1
- package/dist/{library-publish-FC3ZABR2.js → library-publish-EQFYHJ6G.js} +14 -14
- package/dist/{library-publish-FC3ZABR2.js.map → library-publish-EQFYHJ6G.js.map} +1 -1
- package/dist/{open-library-5ET7SAJC.js → open-library-JJGDEYYT.js} +5 -5
- package/dist/{open-library-5ET7SAJC.js.map → open-library-JJGDEYYT.js.map} +1 -1
- package/dist/{project-2UXHSVVA.js → project-5HW3XSOE.js} +11 -11
- package/dist/{project-2UXHSVVA.js.map → project-5HW3XSOE.js.map} +1 -1
- package/dist/runner/index.js +6 -6
- package/dist/sdk/asset-manager.js +1 -1
- package/dist/sdk/index.js +6 -6
- package/dist/sdk/runner.js +6 -6
- package/dist/{setup-IKH4R7UN.js → setup-52NDDR7C.js} +5 -5
- package/dist/{setup-IKH4R7UN.js.map → setup-52NDDR7C.js.map} +1 -1
- package/dist/{source-M6IARYNO.js → source-WKV4QFGS.js} +13 -13
- package/dist/{source-M6IARYNO.js.map → source-WKV4QFGS.js.map} +1 -1
- package/dist/{source-manifest-publish-UP2IS2QW.js → source-manifest-publish-3HAX6DPN.js} +15 -15
- package/dist/{source-manifest-publish-UP2IS2QW.js.map → source-manifest-publish-3HAX6DPN.js.map} +1 -1
- package/dist/tui/index.js +6 -6
- package/dist/workspace-plugin/adapters/mcp.js +3 -3
- package/dist/workspace-plugin/adapters/omp.js +7 -7
- package/dist/workspace-plugin/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-DP6YRAPZ.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { err, okJson, ok } from './chunk-X5YPJV4N.js';
|
|
2
|
-
import { buildConnectorListPayload } from './chunk-
|
|
2
|
+
import { buildConnectorListPayload } from './chunk-MUOSKYI2.js';
|
|
3
3
|
import { readFile } from 'fs/promises';
|
|
4
4
|
import { join } from 'path';
|
|
5
5
|
|
|
@@ -117,5 +117,5 @@ async function connectorDescribe(manager, id) {
|
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
export { connectorDescribe, connectorExec, connectorList, connectorLoadSkill, connectorRead, connectorSearch, connectorWrite, mountList, mountRead, mountStatus, mountSync };
|
|
120
|
-
//# sourceMappingURL=chunk-
|
|
121
|
-
//# sourceMappingURL=chunk-
|
|
120
|
+
//# sourceMappingURL=chunk-RNFHJUK7.js.map
|
|
121
|
+
//# sourceMappingURL=chunk-RNFHJUK7.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../workspace-plugin/src/tools/connectors.ts"],"names":[],"mappings":";;;;;AAwBA,SAAS,cAAc,OAAA,EAAiD;AACtE,EAAA,OAAO,OAAA,CACJ,gBAAe,CACf,MAAA,CAAO,CAAC,CAAA,KAA+B,OAAO,CAAA,CAAE,SAAA,KAAc,QAAQ,CAAA;AAC3E;AAaA,eAAe,YAAA,CACb,SACA,KAAA,EACoB;AAEpB,EAAA,MAAM,QAAA,GAAW,MA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AA,EACvD;AACF;AAcA,eAAsB,iBAAA,CACpB,SACA,EAAA,EACqB;AACrB,EAAA,IAAI,CAAC,OAAA,EAAS,OAAO,GAAA,CAAI,yCAAyC,CAAA;AAClE,EAAA,IAAI;AACF,IAAA,MAAM,MAAA,GAAS,QAAQ,UAAA,EAAW;AAClC,IAAA,MAAM,aAAa,MAAA,CAAO,IAAA,CAAK,CAAC,CAAA,KAAM,CAAA,CAAE,OAAO,EAAE,CAAA;AACjD,IAAA,IAAI,CAAC,UAAA,EAAY,OAAO,GAAA,CAAI,CAAA,mCAAA,EAAsC,EAAE,CAAA,CAAA,CAAG,CAAA;AACvE,IAAA,OAAO,OAAO,UAAU,CAAA;AAAA,EAC1B,SAAS,CAAA,EAAY;AACnB,IAAA,OAAO,IAAI,CAAA,YAAa,KAAA,GAAQ,EAAE,OAAA,GAAU,MAAA,CAAO,CAAC,CAAC,CAAA;AAAA,EACvD;AACF","file":"chunk-74THIMZV.js","sourcesContent":["// src/tools/connectors.ts\nimport { readFile } from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport { buildConnectorListPayload, type ConnectorManager } from \"@skaile/workspaces/connectors\";\nimport type { ToolResult } from \"../types.js\";\nimport { err, ok, okJson } from \"../types.js\";\n\n// ── Mountable-connector helpers ──────────────────────────────────────────────\n//\n// The unified ConnectorManager owns mountable (filesystem-face) connectors too.\n// A connector is mountable when its `listConnectors()` summary carries a\n// `mountPath`. The `mount*` helpers below project that subset for the legacy\n// `mount_*` tool surface.\n\n/**\n * A connector summary that carries a projected filesystem path. Unlike the raw\n * `listConnectors()` summary, `mountPath` is non-optional here — `listMountable()`\n * runtime-filters to exactly those entries before narrowing to this type.\n */\ntype MountableConnector = ReturnType<ConnectorManager[\"listConnectors\"]>[number] & {\n mountPath: string;\n};\n\n/** Return the mountable (filesystem-face) connectors from a manager. */\nfunction listMountable(manager: ConnectorManager): MountableConnector[] {\n return manager\n .listConnectors()\n .filter((c): c is MountableConnector => typeof c.mountPath === \"string\");\n}\n\n/**\n * A mountable connector as reported to the agent, with an optional `reason`.\n *\n * A fleet-managed mount whose path is gone reports `status: \"error\"` plus a\n * `reason`, even though the connector handle still reads `connected`. One whose\n * probe timed out keeps its cached status and gains a `reason` saying it is\n * unverified: a slow cloud mount is not reported dead.\n */\ntype MountView = MountableConnector & { reason?: string };\n\n/** Overlay a live re-check on the cached connect-time status where one applies. */\nasync function withLiveness(\n manager: ConnectorManager,\n mount: MountableConnector,\n): Promise<MountView> {\n // Optional call: the tool tests' manager doubles omit the method.\n const liveness = await manager.checkMountLiveness?.(mount.id);\n if (!liveness || liveness.state === \"live\") return mount;\n if (liveness.state === \"dead\") return { ...mount, status: \"error\", reason: liveness.reason };\n return { ...mount, reason: liveness.reason };\n}\n\n/**\n * List all mountable (filesystem-face) connectors declared in `skaile.yaml`\n * with their current mount status.\n *\n * @param manager - Active `ConnectorManager` or `null` when not configured.\n *\n * @docLink packages/workspace-plugin/concepts#tool-delivery\n */\nexport async function mountList(manager: ConnectorManager | null): Promise<ToolResult> {\n if (!manager) return err(\"No connectors configured in skaile.yaml\");\n try {\n return okJson(await Promise.all(listMountable(manager).map((m) => withLiveness(manager, m))));\n } catch (e: unknown) {\n return err(e instanceof Error ? e.message : String(e));\n }\n}\n\n/**\n * Sync a mountable connector — pull the latest content from its remote source.\n *\n * @param manager - Active `ConnectorManager` or `null`.\n * @param mountId - Connector ID declared in `skaile.yaml`.\n *\n * @docLink packages/workspace-plugin/concepts#tool-delivery\n */\nexport async function mountSync(\n manager: ConnectorManager | null,\n mountId: string,\n): Promise<ToolResult> {\n if (!manager) return err(\"No connectors configured in skaile.yaml\");\n try {\n const result = await manager.sync(mountId);\n return okJson(result);\n } catch (e: unknown) {\n return err(e instanceof Error ? e.message : String(e));\n }\n}\n\n/**\n * Get the current status and metadata for a single mountable connector.\n *\n * @param manager - Active `ConnectorManager` or `null`.\n * @param mountId - Connector ID declared in `skaile.yaml`.\n *\n * @docLink packages/workspace-plugin/concepts#tool-delivery\n */\nexport async function mountStatus(\n manager: ConnectorManager | null,\n mountId: string,\n): Promise<ToolResult> {\n if (!manager) return err(\"No connectors configured in skaile.yaml\");\n try {\n const mount = listMountable(manager).find((v) => v.id === mountId);\n if (!mount) return err(`Mount not found: \"${mountId}\"`);\n return okJson(await withLiveness(manager, mount));\n } catch (e: unknown) {\n return err(e instanceof Error ? e.message : String(e));\n }\n}\n\n/**\n * Read a file from within a mountable connector's projected directory by its\n * relative path.\n *\n * @param manager - Active `ConnectorManager` or `null`.\n * @param mountId - Connector ID declared in `skaile.yaml`.\n * @param filePath - Relative path within the projected mount directory.\n *\n * @docLink packages/workspace-plugin/concepts#tool-delivery\n */\nexport async function mountRead(\n manager: ConnectorManager | null,\n mountId: string,\n filePath: string,\n): Promise<ToolResult> {\n if (!manager) return err(\"No connectors configured in skaile.yaml\");\n try {\n const mount = listMountable(manager).find((v) => v.id === mountId);\n if (!mount) return err(`Mount not found: \"${mountId}\"`);\n const content = await readFile(join(mount.mountPath, filePath), \"utf-8\");\n return ok(content);\n } catch (e: unknown) {\n return err(e instanceof Error ? e.message : String(e));\n }\n}\n\n/**\n * List all connectors registered with the `ConnectorManager`.\n *\n * Returns `{ connected, failed }` — `connected` from `manager.listConnectors()`,\n * `failed` from `manager.listFailedConnectors()`. A connector that threw during\n * `connect()` never enters the active map, so it is absent from the first list\n * entirely; without the second one an agent driven through MCP or OMP has no\n * way to learn that a mount it is about to write into is dead. Returns an error\n * result when no manager is configured (i.e. `skaile.yaml` has no `connectors`\n * section).\n *\n * @param manager - Active `ConnectorManager` or `null` when not configured.\n *\n * @docLink packages/workspace-plugin/concepts#tool-delivery\n */\nexport async function connectorList(manager: ConnectorManager | null): Promise<ToolResult> {\n if (!manager) return err(\"No connectors configured in skaile.yaml\");\n try {\n // Same payload as the Claude SDK tool: per-mount health and a notice when one is not ok.\n return okJson(await buildConnectorListPayload(manager));\n } catch (e: unknown) {\n return err(e instanceof Error ? e.message : String(e));\n }\n}\n\n/**\n * Read content from a connector at the given path.\n *\n * Delegates to `manager.read(id, path)`. Returns an error result when the\n * path yields `null` (not found) or the manager is absent.\n *\n * @param manager - Active `ConnectorManager` or `null`.\n * @param id - Connector ID declared in `skaile.yaml`.\n * @param path - Resource path within the connector (connector-specific format).\n *\n * @docLink packages/workspace-plugin/concepts#tool-delivery\n */\nexport async function connectorRead(\n manager: ConnectorManager | null,\n id: string,\n path: string,\n): Promise<ToolResult> {\n if (!manager) return err(\"No connectors configured in skaile.yaml\");\n try {\n const content = await manager.read(id, path);\n if (content === null) return err(`No content at path \"${path}\" in connector \"${id}\"`);\n return okJson(content);\n } catch (e: unknown) {\n return err(e instanceof Error ? e.message : String(e));\n }\n}\n\n/**\n * Write string content to a connector at the given path.\n *\n * Delegates to `manager.write(id, path, { data: content })`.\n *\n * @param manager - Active `ConnectorManager` or `null`.\n * @param id - Connector ID declared in `skaile.yaml`.\n * @param path - Destination path within the connector.\n * @param content - String payload to write.\n *\n * @docLink packages/workspace-plugin/concepts#tool-delivery\n */\nexport async function connectorWrite(\n manager: ConnectorManager | null,\n id: string,\n path: string,\n content: string,\n): Promise<ToolResult> {\n if (!manager) return err(\"No connectors configured in skaile.yaml\");\n try {\n await manager.write(id, path, { data: content });\n return ok(`Written to \"${path}\" in connector \"${id}\"`);\n } catch (e: unknown) {\n return err(e instanceof Error ? e.message : String(e));\n }\n}\n\n/**\n * Search a connector's data using a query string.\n *\n * Delegates to `manager.search(id, query)` and returns the result set as JSON.\n *\n * @param manager - Active `ConnectorManager` or `null`.\n * @param id - Connector ID declared in `skaile.yaml`.\n * @param query - Free-text or structured query (connector-specific format).\n *\n * @docLink packages/workspace-plugin/concepts#tool-delivery\n */\nexport async function connectorSearch(\n manager: ConnectorManager | null,\n id: string,\n query: string,\n): Promise<ToolResult> {\n if (!manager) return err(\"No connectors configured in skaile.yaml\");\n try {\n const results = await manager.search(id, query);\n return okJson(results);\n } catch (e: unknown) {\n return err(e instanceof Error ? e.message : String(e));\n }\n}\n\n/**\n * Execute a named operation on a connector.\n *\n * Delegates to `manager.executeOp(id, operation, args)`. Operations and\n * their argument shapes are connector-specific; use {@link connectorDescribe}\n * to discover what operations a connector supports.\n *\n * @param manager - Active `ConnectorManager` or `null`.\n * @param id - Connector ID declared in `skaile.yaml`.\n * @param operation - Operation name (from the connector's `RuntimeSkillDescriptor`).\n * @param args - Named arguments for the operation.\n *\n * @docLink packages/workspace-plugin/concepts#tool-delivery\n */\nexport async function connectorExec(\n manager: ConnectorManager | null,\n id: string,\n operation: string,\n args: Record<string, unknown>,\n): Promise<ToolResult> {\n if (!manager) return err(\"No connectors configured in skaile.yaml\");\n try {\n const result = await manager.executeOp(id, operation, args);\n return ok(result);\n } catch (e: unknown) {\n return err(e instanceof Error ? e.message : String(e));\n }\n}\n\n/**\n * Load the rendered skill body for a connector.\n *\n * Delegates to `manager.loadSkill(id)` and returns the skill content as\n * plain text. Useful when the agent needs the connector's operations and\n * usage instructions injected as prompt context.\n *\n * @param manager - Active `ConnectorManager` or `null`.\n * @param id - Connector ID declared in `skaile.yaml`.\n *\n * @docLink packages/workspace-plugin/concepts#tool-delivery\n */\nexport async function connectorLoadSkill(\n manager: ConnectorManager | null,\n id: string,\n): Promise<ToolResult> {\n if (!manager) return err(\"No connectors configured in skaile.yaml\");\n try {\n const skill = manager.loadSkill(id);\n return ok(skill);\n } catch (e: unknown) {\n return err(e instanceof Error ? e.message : String(e));\n }\n}\n\n/**\n * Describe a connector's capabilities via its `RuntimeSkillDescriptor`.\n *\n * Finds the matching skill descriptor from `manager.listSkills()` and returns\n * it as JSON. The descriptor includes the connector's operations, argument\n * shapes, and usage instructions.\n *\n * @param manager - Active `ConnectorManager` or `null`.\n * @param id - Connector ID declared in `skaile.yaml`.\n *\n * @docLink packages/workspace-plugin/concepts#tool-delivery\n */\nexport async function connectorDescribe(\n manager: ConnectorManager | null,\n id: string,\n): Promise<ToolResult> {\n if (!manager) return err(\"No connectors configured in skaile.yaml\");\n try {\n const skills = manager.listSkills();\n const descriptor = skills.find((s) => s.id === id);\n if (!descriptor) return err(`No skill descriptor for connector \"${id}\"`);\n return okJson(descriptor);\n } catch (e: unknown) {\n return err(e instanceof Error ? e.message : String(e));\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../workspace-plugin/src/tools/connectors.ts"],"names":[],"mappings":";;;;;AAwBA,SAAS,cAAc,OAAA,EAAiD;AACtE,EAAA,OAAO,OAAA,CACJ,gBAAe,CACf,MAAA,CAAO,CAAC,CAAA,KAA+B,OAAO,CAAA,CAAE,SAAA,KAAc,QAAQ,CAAA;AAC3E;AAaA,eAAe,YAAA,CACb,SACA,KAAA,EACoB;AAEpB,EAAA,MAAM,QAAA,GAAW,MAAM,OAAA,CAAQ,kBAAA,GAAqB,MAAM,EAAE,CAAA;AAC5D,EAAA,IAAI,CAAC,QAAA,IAAY,QAAA,CAAS,KAAA,KAAU,QAAQ,OAAO,KAAA;AACnD,EAAA,IAAI,QAAA,CAAS,KAAA,KAAU,MAAA,EAAQ,OAAO,EAAE,GAAG,KAAA,EAAO,MAAA,EAAQ,OAAA,EAAS,MAAA,EAAQ,QAAA,CAAS,MAAA,EAAO;AAC3F,EAAA,OAAO,EAAE,GAAG,KAAA,EAAO,MAAA,EAAQ,SAAS,MAAA,EAAO;AAC7C;AAUA,eAAsB,UAAU,OAAA,EAAuD;AACrF,EAAA,IAAI,CAAC,OAAA,EAAS,OAAO,GAAA,CAAI,yCAAyC,CAAA;AAClE,EAAA,IAAI;AACF,IAAA,OAAO,MAAA,CAAO,MAAM,OAAA,CAAQ,GAAA,CAAI,cAAc,OAAO,CAAA,CAAE,GAAA,CAAI,CAAC,MAAM,YAAA,CAAa,OAAA,EAAS,CAAC,CAAC,CAAC,CAAC,CAAA;AAAA,EAC9F,SAAS,CAAA,EAAY;AACnB,IAAA,OAAO,IAAI,CAAA,YAAa,KAAA,GAAQ,EAAE,OAAA,GAAU,MAAA,CAAO,CAAC,CAAC,CAAA;AAAA,EACvD;AACF;AAUA,eAAsB,SAAA,C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E,OAAA,GAAU,MAAA,CAAO,CAAC,CAAC,CAAA;AAAA,EACvD;AACF;AAcA,eAAsB,kBAAA,CACpB,SACA,EAAA,EACqB;AACrB,EAAA,IAAI,CAAC,OAAA,EAAS,OAAO,GAAA,CAAI,yCAAyC,CAAA;AAClE,EAAA,IAAI;AACF,IAAA,MAAM,KAAA,GAAQ,OAAA,CAAQ,SAAA,CAAU,EAAE,CAAA;AAClC,IAAA,OAAO,GAAG,KAAK,CAAA;AAAA,EACjB,SAAS,CAAA,EAAY;AACnB,IAAA,OAAO,IAAI,CAAA,YAAa,KAAA,GAAQ,EAAE,OAAA,GAAU,MAAA,CAAO,CAAC,CAAC,CAAA;AAAA,EACvD;AACF;AAcA,eAAsB,iBAAA,CACpB,SACA,EAAA,EACqB;AACrB,EAAA,IAAI,CAAC,OAAA,EAAS,OAAO,GAAA,CAAI,yCAAyC,CAAA;AAClE,EAAA,IAAI;AACF,IAAA,MAAM,MAAA,GAAS,QAAQ,UAAA,EAAW;AAClC,IAAA,MAAM,aAAa,MAAA,CAAO,IAAA,CAAK,CAAC,CAAA,KAAM,CAAA,CAAE,OAAO,EAAE,CAAA;AACjD,IAAA,IAAI,CAAC,UAAA,EAAY,OAAO,GAAA,CAAI,CAAA,mCAAA,EAAsC,EAAE,CAAA,CAAA,CAAG,CAAA;AACvE,IAAA,OAAO,OAAO,UAAU,CAAA;AAAA,EAC1B,SAAS,CAAA,EAAY;AACnB,IAAA,OAAO,IAAI,CAAA,YAAa,KAAA,GAAQ,EAAE,OAAA,GAAU,MAAA,CAAO,CAAC,CAAC,CAAA;AAAA,EACvD;AACF","file":"chunk-RNFHJUK7.js","sourcesContent":["// src/tools/connectors.ts\nimport { readFile } from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport { buildConnectorListPayload, type ConnectorManager } from \"@skaile/workspaces/connectors\";\nimport type { ToolResult } from \"../types.js\";\nimport { err, ok, okJson } from \"../types.js\";\n\n// ── Mountable-connector helpers ──────────────────────────────────────────────\n//\n// The unified ConnectorManager owns mountable (filesystem-face) connectors too.\n// A connector is mountable when its `listConnectors()` summary carries a\n// `mountPath`. The `mount*` helpers below project that subset for the legacy\n// `mount_*` tool surface.\n\n/**\n * A connector summary that carries a projected filesystem path. Unlike the raw\n * `listConnectors()` summary, `mountPath` is non-optional here — `listMountable()`\n * runtime-filters to exactly those entries before narrowing to this type.\n */\ntype MountableConnector = ReturnType<ConnectorManager[\"listConnectors\"]>[number] & {\n mountPath: string;\n};\n\n/** Return the mountable (filesystem-face) connectors from a manager. */\nfunction listMountable(manager: ConnectorManager): MountableConnector[] {\n return manager\n .listConnectors()\n .filter((c): c is MountableConnector => typeof c.mountPath === \"string\");\n}\n\n/**\n * A mountable connector as reported to the agent, with an optional `reason`.\n *\n * A fleet-managed mount whose path is gone reports `status: \"error\"` plus a\n * `reason`, even though the connector handle still reads `connected`. One whose\n * probe timed out keeps its cached status and gains a `reason` saying it is\n * unverified: a slow cloud mount is not reported dead.\n */\ntype MountView = MountableConnector & { reason?: string };\n\n/** Overlay a live re-check on the cached connect-time status where one applies. */\nasync function withLiveness(\n manager: ConnectorManager,\n mount: MountableConnector,\n): Promise<MountView> {\n // Optional call: the tool tests' manager doubles omit the method.\n const liveness = await manager.checkMountLiveness?.(mount.id);\n if (!liveness || liveness.state === \"live\") return mount;\n if (liveness.state === \"dead\") return { ...mount, status: \"error\", reason: liveness.reason };\n return { ...mount, reason: liveness.reason };\n}\n\n/**\n * List all mountable (filesystem-face) connectors declared in `skaile.yaml`\n * with their current mount status.\n *\n * @param manager - Active `ConnectorManager` or `null` when not configured.\n *\n * @docLink packages/workspace-plugin/concepts#tool-delivery\n */\nexport async function mountList(manager: ConnectorManager | null): Promise<ToolResult> {\n if (!manager) return err(\"No connectors configured in skaile.yaml\");\n try {\n return okJson(await Promise.all(listMountable(manager).map((m) => withLiveness(manager, m))));\n } catch (e: unknown) {\n return err(e instanceof Error ? e.message : String(e));\n }\n}\n\n/**\n * Sync a mountable connector — pull the latest content from its remote source.\n *\n * @param manager - Active `ConnectorManager` or `null`.\n * @param mountId - Connector ID declared in `skaile.yaml`.\n *\n * @docLink packages/workspace-plugin/concepts#tool-delivery\n */\nexport async function mountSync(\n manager: ConnectorManager | null,\n mountId: string,\n): Promise<ToolResult> {\n if (!manager) return err(\"No connectors configured in skaile.yaml\");\n try {\n const result = await manager.sync(mountId);\n return okJson(result);\n } catch (e: unknown) {\n return err(e instanceof Error ? e.message : String(e));\n }\n}\n\n/**\n * Get the current status and metadata for a single mountable connector.\n *\n * @param manager - Active `ConnectorManager` or `null`.\n * @param mountId - Connector ID declared in `skaile.yaml`.\n *\n * @docLink packages/workspace-plugin/concepts#tool-delivery\n */\nexport async function mountStatus(\n manager: ConnectorManager | null,\n mountId: string,\n): Promise<ToolResult> {\n if (!manager) return err(\"No connectors configured in skaile.yaml\");\n try {\n const mount = listMountable(manager).find((v) => v.id === mountId);\n if (!mount) return err(`Mount not found: \"${mountId}\"`);\n return okJson(await withLiveness(manager, mount));\n } catch (e: unknown) {\n return err(e instanceof Error ? e.message : String(e));\n }\n}\n\n/**\n * Read a file from within a mountable connector's projected directory by its\n * relative path.\n *\n * @param manager - Active `ConnectorManager` or `null`.\n * @param mountId - Connector ID declared in `skaile.yaml`.\n * @param filePath - Relative path within the projected mount directory.\n *\n * @docLink packages/workspace-plugin/concepts#tool-delivery\n */\nexport async function mountRead(\n manager: ConnectorManager | null,\n mountId: string,\n filePath: string,\n): Promise<ToolResult> {\n if (!manager) return err(\"No connectors configured in skaile.yaml\");\n try {\n const mount = listMountable(manager).find((v) => v.id === mountId);\n if (!mount) return err(`Mount not found: \"${mountId}\"`);\n const content = await readFile(join(mount.mountPath, filePath), \"utf-8\");\n return ok(content);\n } catch (e: unknown) {\n return err(e instanceof Error ? e.message : String(e));\n }\n}\n\n/**\n * List all connectors registered with the `ConnectorManager`.\n *\n * Returns `{ connected, failed }` — `connected` from `manager.listConnectors()`,\n * `failed` from `manager.listFailedConnectors()`. A connector that threw during\n * `connect()` never enters the active map, so it is absent from the first list\n * entirely; without the second one an agent driven through MCP or OMP has no\n * way to learn that a mount it is about to write into is dead. Returns an error\n * result when no manager is configured (i.e. `skaile.yaml` has no `connectors`\n * section).\n *\n * @param manager - Active `ConnectorManager` or `null` when not configured.\n *\n * @docLink packages/workspace-plugin/concepts#tool-delivery\n */\nexport async function connectorList(manager: ConnectorManager | null): Promise<ToolResult> {\n if (!manager) return err(\"No connectors configured in skaile.yaml\");\n try {\n // Same payload as the Claude SDK tool: per-mount health and a notice when one is not ok.\n return okJson(await buildConnectorListPayload(manager));\n } catch (e: unknown) {\n return err(e instanceof Error ? e.message : String(e));\n }\n}\n\n/**\n * Read content from a connector at the given path.\n *\n * Delegates to `manager.read(id, path)`. Returns an error result when the\n * path yields `null` (not found) or the manager is absent.\n *\n * @param manager - Active `ConnectorManager` or `null`.\n * @param id - Connector ID declared in `skaile.yaml`.\n * @param path - Resource path within the connector (connector-specific format).\n *\n * @docLink packages/workspace-plugin/concepts#tool-delivery\n */\nexport async function connectorRead(\n manager: ConnectorManager | null,\n id: string,\n path: string,\n): Promise<ToolResult> {\n if (!manager) return err(\"No connectors configured in skaile.yaml\");\n try {\n const content = await manager.read(id, path);\n if (content === null) return err(`No content at path \"${path}\" in connector \"${id}\"`);\n return okJson(content);\n } catch (e: unknown) {\n return err(e instanceof Error ? e.message : String(e));\n }\n}\n\n/**\n * Write string content to a connector at the given path.\n *\n * Delegates to `manager.write(id, path, { data: content })`.\n *\n * @param manager - Active `ConnectorManager` or `null`.\n * @param id - Connector ID declared in `skaile.yaml`.\n * @param path - Destination path within the connector.\n * @param content - String payload to write.\n *\n * @docLink packages/workspace-plugin/concepts#tool-delivery\n */\nexport async function connectorWrite(\n manager: ConnectorManager | null,\n id: string,\n path: string,\n content: string,\n): Promise<ToolResult> {\n if (!manager) return err(\"No connectors configured in skaile.yaml\");\n try {\n await manager.write(id, path, { data: content });\n return ok(`Written to \"${path}\" in connector \"${id}\"`);\n } catch (e: unknown) {\n return err(e instanceof Error ? e.message : String(e));\n }\n}\n\n/**\n * Search a connector's data using a query string.\n *\n * Delegates to `manager.search(id, query)` and returns the result set as JSON.\n *\n * @param manager - Active `ConnectorManager` or `null`.\n * @param id - Connector ID declared in `skaile.yaml`.\n * @param query - Free-text or structured query (connector-specific format).\n *\n * @docLink packages/workspace-plugin/concepts#tool-delivery\n */\nexport async function connectorSearch(\n manager: ConnectorManager | null,\n id: string,\n query: string,\n): Promise<ToolResult> {\n if (!manager) return err(\"No connectors configured in skaile.yaml\");\n try {\n const results = await manager.search(id, query);\n return okJson(results);\n } catch (e: unknown) {\n return err(e instanceof Error ? e.message : String(e));\n }\n}\n\n/**\n * Execute a named operation on a connector.\n *\n * Delegates to `manager.executeOp(id, operation, args)`. Operations and\n * their argument shapes are connector-specific; use {@link connectorDescribe}\n * to discover what operations a connector supports.\n *\n * @param manager - Active `ConnectorManager` or `null`.\n * @param id - Connector ID declared in `skaile.yaml`.\n * @param operation - Operation name (from the connector's `RuntimeSkillDescriptor`).\n * @param args - Named arguments for the operation.\n *\n * @docLink packages/workspace-plugin/concepts#tool-delivery\n */\nexport async function connectorExec(\n manager: ConnectorManager | null,\n id: string,\n operation: string,\n args: Record<string, unknown>,\n): Promise<ToolResult> {\n if (!manager) return err(\"No connectors configured in skaile.yaml\");\n try {\n const result = await manager.executeOp(id, operation, args);\n return ok(result);\n } catch (e: unknown) {\n return err(e instanceof Error ? e.message : String(e));\n }\n}\n\n/**\n * Load the rendered skill body for a connector.\n *\n * Delegates to `manager.loadSkill(id)` and returns the skill content as\n * plain text. Useful when the agent needs the connector's operations and\n * usage instructions injected as prompt context.\n *\n * @param manager - Active `ConnectorManager` or `null`.\n * @param id - Connector ID declared in `skaile.yaml`.\n *\n * @docLink packages/workspace-plugin/concepts#tool-delivery\n */\nexport async function connectorLoadSkill(\n manager: ConnectorManager | null,\n id: string,\n): Promise<ToolResult> {\n if (!manager) return err(\"No connectors configured in skaile.yaml\");\n try {\n const skill = manager.loadSkill(id);\n return ok(skill);\n } catch (e: unknown) {\n return err(e instanceof Error ? e.message : String(e));\n }\n}\n\n/**\n * Describe a connector's capabilities via its `RuntimeSkillDescriptor`.\n *\n * Finds the matching skill descriptor from `manager.listSkills()` and returns\n * it as JSON. The descriptor includes the connector's operations, argument\n * shapes, and usage instructions.\n *\n * @param manager - Active `ConnectorManager` or `null`.\n * @param id - Connector ID declared in `skaile.yaml`.\n *\n * @docLink packages/workspace-plugin/concepts#tool-delivery\n */\nexport async function connectorDescribe(\n manager: ConnectorManager | null,\n id: string,\n): Promise<ToolResult> {\n if (!manager) return err(\"No connectors configured in skaile.yaml\");\n try {\n const skills = manager.listSkills();\n const descriptor = skills.find((s) => s.id === id);\n if (!descriptor) return err(`No skill descriptor for connector \"${id}\"`);\n return okJson(descriptor);\n } catch (e: unknown) {\n return err(e instanceof Error ? e.message : String(e));\n }\n}\n"]}
|
|
@@ -301,5 +301,5 @@ function resolveProjectDir(additionalEnvVars) {
|
|
|
301
301
|
}
|
|
302
302
|
|
|
303
303
|
export { PluginStore, WorkspacePlugin, buildClaudePluginFiles, resolveProjectDir };
|
|
304
|
-
//# sourceMappingURL=chunk-
|
|
305
|
-
//# sourceMappingURL=chunk-
|
|
304
|
+
//# sourceMappingURL=chunk-U7YMGW7M.js.map
|
|
305
|
+
//# sourceMappingURL=chunk-U7YMGW7M.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../workspace-plugin/src/adapters/claude-code.ts","../workspace-plugin/src/store.ts","../workspace-plugin/src/plugin.ts","../workspace-plugin/src/utils/project-dir.ts"],"names":["err"],"mappings":";;;;;;;AAeA,IAAM,WAAA,GAAc;AAAA,EAClB,IAAA,EAAM,QAAA;AAAA,EACN,OAAA,EAAS,OAAA;AAAA,EACT,WAAA,EAAa,yEAAA;AAAA,EACb,MAAA,EAAQ,EAAE,IAAA,EAAM,WAAA,EAAa,KAAK,8BAAA,EAA+B;AAAA,EACjE,UAAA,EAAY,yCAAA;AA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A;AAAA,EAC1C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,iBAAA,GAAmC;AACvC,IAAA,IAAA,CAAK,GAAA,CAAI,KAAK,qCAAqC,CAAA;AACnD,IAAA,MAAM,EAAE,iBAAA,EAAkB,GAAI,MAAM,OAAO,oCAAmB,CAAA;AAC9D,IAAA,MAAM,kBAAkB,IAAI,CAAA;AAAA,EAC9B;AAAA,EAEA,MAAM,eAAA,GAAsC;AAC1C,IAAA,MAAM,EAAE,eAAA,EAAgB,GAAI,MAAM,OAAO,oCAAmB,CAAA;AAC5D,IAAA,OAAO,gBAAgB,IAAI,CAAA;AAAA,EAC7B;AAAA,EAEA,MAAM,uBAAA,GAA2C;AAC/C,IAAA,MAAM,EAAE,uBAAA,EAAwB,GAAI,MAAM,OAAO,oCAAmB,CAAA;AACpE,IAAA,OAAO,uBAAA,CAAwB,KAAK,UAAU,CAAA;AAAA,EAChD;AAAA,EAEA,MAAM,kBAAA,CAAmB,KAAA,EAAe,IAAA,EAAiC;AACvE,IAAA,MAAM,EAAE,kBAAA,EAAmB,GAAI,MAAM,OAAO,oCAAmB,CAAA;AAC/D,IAAA,OAAO,kBAAA,CAAmB,IAAA,EAAM,KAAA,EAAO,IAAI,CAAA;AAAA,EAC7C;AACF;;;ACpOO,SAAS,kBAAkB,iBAAA,EAAsC;AACtE,EAAA,IAAI,OAAA,CAAQ,GAAA,CAAI,kBAAA,EAAoB,OAAO,QAAQ,GAAA,CAAI,kBAAA;AACvD,EAAA,KAAA,MAAW,GAAA,IAAO,iBAAA,IAAqB,EAAC,EAAG;AACzC,IAAA,MAAM,GAAA,GAAM,OAAA,CAAQ,GAAA,CAAI,GAAG,CAAA;AAC3B,IAAA,IAAI,KAAK,OAAO,GAAA;AAAA,EAClB;AACA,EAAA,OAAO,QAAQ,GAAA,EAAI;AACrB","file":"chunk-AVUJBSFA.js","sourcesContent":["// ── Claude Code plugin-directory generator (STATELESS) ──────────────────────\n// Generates the contents of a Claude Code plugin directory\n// (`.claude/plugins/skaile/`) as an in-memory file map. No plugin instance or\n// boot() is required — safe to call from install commands.\n//\n// The previous standalone `@skaile/workspace-plugin-claude` package shipped\n// these as static files plus loose `.mjs` hook scripts; they are now\n// CLI-owned templates. Hooks invoke the `skaile` binary directly\n// (`skaile integration hook <event>`) and MCP runs via `skaile mcp-server` — no\n// generated script files, no shebang, no runtime assumption.\n\n/**\n * The Claude Code plugin manifest. `name` is `skaile`; `hooks` and\n * `mcpServers` point at sibling files in the generated directory.\n */\nconst PLUGIN_JSON = {\n name: \"skaile\",\n version: \"0.1.0\",\n description: \"Skaile workspace — connectors, mounts, skills, flows, shared state\",\n author: { name: \"skaile-ai\", url: \"https://github.com/skaile-ai\" },\n repository: \"https://github.com/skaile-ai/workspaces\",\n keywords: [\"skaile\", \"connectors\", \"workspace\", \"ai-assets\"],\n hooks: \"./hooks/hooks.json\",\n mcpServers: \"./.mcp.json\",\n userConfig: {\n skaile_yaml_path: {\n type: \"string\",\n title: \"skaile.yaml path\",\n description: \"Override path to skaile.yaml (default: auto-detect from project root)\",\n },\n },\n};\n\n/**\n * Hook wiring. Each lifecycle event invokes the `skaile` binary directly —\n * no loose `.mjs` scripts. `skaile integration hook <event>` resolves the project\n * directory itself (`CLAUDE_PROJECT_DIR` / cwd) and always exits 0.\n */\nconst HOOKS_JSON = {\n hooks: {\n SessionStart: [\n { hooks: [{ type: \"command\", command: \"skaile integration hook session-start\" }] },\n ],\n SessionEnd: [{ hooks: [{ type: \"command\", command: \"skaile integration hook session-end\" }] }],\n UserPromptSubmit: [\n { hooks: [{ type: \"command\", command: \"skaile integration hook user-prompt-submit\" }] },\n ],\n },\n};\n\n/**\n * MCP server wiring. Spawns `skaile mcp-server` — a stdio MCP subprocess that\n * runs on plain Node (no Claude Agent SDK).\n */\nconst MCP_JSON = {\n mcpServers: {\n \"skaile-workspace\": {\n command: \"skaile\",\n args: [\"mcp-server\"],\n env: {},\n },\n },\n};\n\n/**\n * Build the Claude Code plugin directory as an in-memory file map.\n *\n * Returns `{ relativePath: contents }` for every file the installer must\n * write under `<projectDir>/.claude/plugins/skaile/`. The installer is also\n * responsible for populating `skills/` from the project's `.skaile/skills/`.\n *\n * Stateless — no plugin instance, no `boot()`. The generated artifacts carry\n * no project-specific paths: hooks and the MCP server resolve the project\n * directory themselves at runtime.\n *\n * @returns A map of plugin-relative file paths to their string contents.\n *\n * @docLink packages/workspace-plugin/concepts#adapters\n */\nexport function buildClaudePluginFiles(): Record<string, string> {\n return {\n \".claude-plugin/plugin.json\": `${JSON.stringify(PLUGIN_JSON, null, 2)}\\n`,\n \"hooks/hooks.json\": `${JSON.stringify(HOOKS_JSON, null, 2)}\\n`,\n \".mcp.json\": `${JSON.stringify(MCP_JSON, null, 2)}\\n`,\n \"skills/.gitkeep\": \"\",\n };\n}\n","import { mkdir, readFile, writeFile } from \"node:fs/promises\";\nimport { dirname } from \"node:path\";\n\ninterface Subscriber {\n regex: RegExp;\n handler: (key: string, value: unknown) => void;\n}\n\n/**\n * Disk-backed reactive key-value store for plugin state.\n *\n * Keeps an in-memory map that can be flushed to / loaded from a JSON file.\n * Supports glob-style subscriptions (`connector:*`, `*`).\n *\n * State is persisted to `<projectDir>/.skaile/plugin-state.json`.\n * The instance is available on {@link WorkspacePlugin} as the public `store`\n * field after `boot()` resolves.\n *\n * @docLink packages/workspace-plugin/concepts#plugin-store\n */\nexport class PluginStore {\n private readonly statePath: string;\n private data: Map<string, unknown> = new Map();\n private subscribers: Subscriber[] = [];\n\n constructor(statePath: string) {\n this.statePath = statePath;\n }\n\n /** Synchronous read from in-memory map. */\n get<T>(key: string): T | undefined {\n return this.data.get(key) as T | undefined;\n }\n\n /** Write to in-memory map and notify matching subscribers. */\n set<T>(key: string, value: T): void {\n this.data.set(key, value);\n this.notify(key, value);\n }\n\n /** Remove key and notify matching subscribers. */\n delete(key: string): void {\n this.data.delete(key);\n this.notify(key, undefined);\n }\n\n /**\n * Subscribe to changes matching a glob-style pattern.\n * `*` matches any sequence of characters.\n * Returns an unsubscribe function.\n */\n subscribe(pattern: string, handler: (key: string, value: unknown) => void): () => void {\n const escaped = pattern.replace(/[.+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n const regexStr = `^${escaped.replace(/\\*/g, \".*\")}$`;\n const sub: Subscriber = { regex: new RegExp(regexStr), handler };\n this.subscribers.push(sub);\n\n return () => {\n const idx = this.subscribers.indexOf(sub);\n if (idx !== -1) this.subscribers.splice(idx, 1);\n };\n }\n\n /** Rehydrate from disk JSON. Missing file = empty store (no throw). */\n async load(): Promise<void> {\n try {\n const raw = await readFile(this.statePath, \"utf-8\");\n const parsed = JSON.parse(raw);\n if (parsed && typeof parsed === \"object\" && !Array.isArray(parsed)) {\n this.data = new Map(Object.entries(parsed));\n }\n } catch (e: unknown) {\n // Missing file or invalid JSON — start with empty store\n }\n }\n\n /** Write entire store to disk as JSON. Creates parent dirs if needed. */\n async flush(): Promise<void> {\n const obj = Object.fromEntries(this.data);\n const json = JSON.stringify(obj, null, 2);\n await mkdir(dirname(this.statePath), { recursive: true });\n await writeFile(this.statePath, json, \"utf-8\");\n }\n\n private notify(key: string, value: unknown): void {\n for (const sub of this.subscribers) {\n if (sub.regex.test(key)) {\n sub.handler(key, value);\n }\n }\n }\n}\n","import { readFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport type { ConnectorManager } from \"@skaile/workspaces/connectors\";\nimport { DEFAULT_DRIVER_ID } from \"@skaile/workspaces/core/framework\";\nimport { createLogger } from \"@skaile/workspaces/core/logging\";\nimport type { Logger } from \"@skaile/workspaces/types\";\nimport { PluginStore } from \"./store.js\";\n\n/**\n * Construction options for {@link WorkspacePlugin}.\n *\n * At minimum `projectDir` must be supplied. All other fields are optional\n * and are pre-resolved by the caller when available (e.g. the runner already\n * knows `driver`/`model` from its own settings resolution).\n *\n * @docLink packages/workspace-plugin/concepts#workspaceplugin-lifecycle\n */\nexport interface WorkspacePluginOpts {\n projectDir: string;\n /**\n * Active connector manager. The unified `ConnectorManager` owns both\n * filesystem-face (mountable) and tool-face connectors.\n */\n connectorManager?: ConnectorManager;\n bootOwned?: boolean;\n onLog?: (msg: string) => void;\n /** Pre-resolved driver type (avoids needing boot() to read settings). */\n driver?: string;\n /** Pre-resolved model. */\n model?: string;\n}\n\n/**\n * Shared runtime core for the skaile workspace plugin.\n *\n * Manages the full lifecycle (`boot` → tools available → `shutdown`) and\n * surfaces workspace capabilities — mounts, connectors, flows, skills,\n * sessions, and config validation — through two adapters:\n *\n * - **MCP, in-process** (runner): call {@link buildWorkspaceMcpServer} for the\n * Claude Agent SDK server the runner embeds into its `query()` call.\n * - **MCP, stdio** (`skaile mcp-server`): call {@link runMcpServerStdio} for a\n * raw `@modelcontextprotocol/sdk` server — no Claude Agent SDK.\n * - **OMP**: call {@link buildOmpToolSet} for the 13-tool native subset and\n * {@link buildOmpExtensionSource} for the generated extension file.\n *\n * Two boot modes are supported via {@link WorkspacePluginOpts.bootOwned}:\n * - `bootOwned: false` (default) — managers injected externally by the runner.\n * - `bootOwned: true` — plugin owns the full manager lifecycle (standalone MCP\n * subprocess or OMP extension).\n *\n * @docLink packages/workspace-plugin/concepts#workspaceplugin-lifecycle\n */\nexport class WorkspacePlugin {\n readonly projectDir: string;\n connectorManager: ConnectorManager | null;\n readonly store: PluginStore;\n\n private readonly bootOwned: boolean;\n private readonly onLog: (msg: string) => void;\n private readonly log: Logger = createLogger({\n kind: \"mcp\",\n subkind: \"skaile-workspace\",\n });\n driver?: string;\n model?: string;\n\n constructor(opts: WorkspacePluginOpts) {\n this.projectDir = opts.projectDir;\n this.connectorManager = opts.connectorManager ?? null;\n this.store = new PluginStore(join(opts.projectDir, \".skaile\", \"plugin-state.json\"));\n this.bootOwned = opts.bootOwned ?? false;\n if (opts.driver) this.driver = opts.driver;\n if (opts.model) this.model = opts.model;\n this.onLog = opts.onLog ?? (() => {});\n this.log.debug(\"plugin constructed\", {\n driver: opts.driver,\n hasConnectors: !!opts.connectorManager,\n model: opts.model,\n bootOwned: this.bootOwned,\n });\n }\n\n async boot(): Promise<void> {\n if (!this.bootOwned) {\n // Managers were injected externally — resolve settings only (non-fatal)\n try {\n const { resolveSettings } = await import(\"@skaile/workspaces/core\");\n const settings = await resolveSettings(this.projectDir);\n this.driver = settings.driver ?? DEFAULT_DRIVER_ID;\n this.model = settings.model;\n } catch {\n /* non-fatal */\n }\n await this.store.load();\n return;\n }\n\n // bootOwned: we own the managers lifecycle\n try {\n const { resolveSettings } = await import(\"@skaile/workspaces/core\");\n const settings = await resolveSettings(this.projectDir);\n this.driver = settings.driver ?? DEFAULT_DRIVER_ID;\n this.model = settings.model;\n } catch {\n /* non-fatal */\n }\n\n try {\n const {\n ConnectorManager,\n loadConnectorDeclarations,\n registerBuiltinConnectors,\n createCliSecretProviderChain,\n } = await import(\"@skaile/workspaces/connectors\");\n\n registerBuiltinConnectors();\n\n const secrets = createCliSecretProviderChain();\n\n const connectorDecls = await loadConnectorDeclarations(this.projectDir);\n const cm = new ConnectorManager(this.projectDir, { secrets });\n await cm.connectAll(connectorDecls);\n this.connectorManager = cm;\n\n this.log.info(\"workspace plugin booted\", {\n connectors: connectorDecls.length,\n });\n this.onLog(`WorkspacePlugin booted: ${connectorDecls.length} connectors`);\n } catch (err) {\n this.log.warn(\"workspace plugin boot warning\", {\n error: err instanceof Error ? err.message : String(err),\n });\n this.onLog(`WorkspacePlugin boot warning: ${err}`);\n }\n\n await this.store.load();\n }\n\n async reload(): Promise<void> {\n if (!this.bootOwned) return;\n await this.shutdown();\n await this.boot();\n }\n\n async shutdown(): Promise<void> {\n this.log.info(\"workspace plugin shutdown\");\n await this.store.flush();\n if (!this.bootOwned) return;\n try {\n await (this.connectorManager as any)?.disconnectAll?.();\n } catch {\n /* best-effort */\n }\n this.connectorManager = null;\n }\n\n buildSystemPromptSection(driver?: string): string {\n const d = driver ?? this.driver ?? \"unknown\";\n // The unified ConnectorManager owns both mountable (filesystem-face) and\n // tool-face connectors. Filesystem-face connectors expose a `mountPath`.\n const all = (this.connectorManager as any)?.listConnectors?.() ?? [];\n const mounts = (all as any[]).filter((c) => typeof c.mountPath === \"string\");\n const connectors = (all as any[]).filter((c) => typeof c.mountPath !== \"string\");\n const lines = [\"## Workspace (skaile)\", \"\", `Driver: ${d}`, `Project: ${this.projectDir}`];\n if (mounts.length > 0) {\n lines.push(\"\", \"Mounts:\");\n for (const v of mounts) {\n lines.push(` · ${v.id} (${v.driver}) → ${v.mountPath ?? \"(unmounted)\"}`);\n }\n }\n if (connectors.length > 0) {\n lines.push(\"\", \"Connectors:\");\n for (const c of connectors) {\n lines.push(` · ${c.id} (${c.driver})`);\n }\n }\n lines.push(\"\", \"Use workspace_info for full details. Use workspace_validate to check health.\");\n\n for (const name of [\"SOUL.md\", \"RULES.md\"]) {\n const skaileOverride = join(this.projectDir, \".skaile\", name);\n const rootFile = join(this.projectDir, name);\n for (const candidate of [skaileOverride, rootFile]) {\n try {\n const content = readFileSync(candidate, \"utf-8\").trim();\n if (content) {\n lines.push(\"\", `## ${name.replace(\".md\", \"\")}`, \"\", content);\n break;\n }\n } catch {\n // file not found, try next\n }\n }\n }\n\n return lines.join(\"\\n\");\n }\n\n /**\n * Build the in-process Claude Agent SDK MCP server (runner embedding).\n * Returns `null` when `@anthropic-ai/claude-agent-sdk` is unavailable.\n */\n async buildWorkspaceMcpServer(): Promise<unknown | null> {\n this.log.info(\"building workspace MCP server\");\n try {\n const { buildWorkspaceMcpServer } = await import(\"./adapters/mcp.js\");\n const server = await buildWorkspaceMcpServer(this);\n if (server) this.log.info(\"workspace MCP server ready\");\n else this.log.debug(\"workspace MCP server skipped (no tools)\");\n return server;\n } catch (err) {\n this.log.error(\"workspace MCP server build failed\", err);\n throw err;\n }\n }\n\n /**\n * Build the raw `@modelcontextprotocol/sdk` stdio MCP server — no Claude\n * Agent SDK. Used by the `skaile mcp-server` subprocess. The returned\n * server is not yet connected to a transport.\n */\n async buildWorkspaceMcpStdioServer(): Promise<unknown> {\n this.log.info(\"building workspace stdio MCP server\");\n const { buildWorkspaceMcpStdioServer } = await import(\"./adapters/mcp.js\");\n return buildWorkspaceMcpStdioServer(this);\n }\n\n /**\n * Build and run the stdio MCP server: builds the raw\n * `@modelcontextprotocol/sdk` server and connects a `StdioServerTransport`.\n * Used by the `skaile mcp-server` subprocess.\n */\n async runMcpServerStdio(): Promise<void> {\n this.log.info(\"starting workspace stdio MCP server\");\n const { runMcpServerStdio } = await import(\"./adapters/mcp.js\");\n await runMcpServerStdio(this);\n }\n\n async buildOmpToolSet(): Promise<unknown[]> {\n const { buildOmpToolSet } = await import(\"./adapters/omp.js\");\n return buildOmpToolSet(this);\n }\n\n async buildOmpExtensionSource(): Promise<string> {\n const { buildOmpExtensionSource } = await import(\"./adapters/omp.js\");\n return buildOmpExtensionSource(this.projectDir);\n }\n\n async handleSlashCommand(group: string, args: string[]): Promise<string> {\n const { handleSlashCommand } = await import(\"./adapters/omp.js\");\n return handleSlashCommand(this, group, args);\n }\n}\n","// utils/project-dir.ts\n// Centralised project-directory resolution used by all plugin entry points.\n\n/**\n * Resolve the skaile project directory from environment variables.\n *\n * Resolution order:\n * 1. `SKAILE_PROJECT_DIR` (always checked first)\n * 2. Any additional env var keys supplied by the caller (in order)\n * 3. `process.cwd()` as final fallback\n *\n * @param additionalEnvVars - Optional list of extra environment variable names\n * to check before falling back to `process.cwd()`.\n * @returns Absolute path to the resolved project directory.\n *\n * @example\n * // Claude Code — also checks CLAUDE_PROJECT_DIR\n * const projectDir = resolveProjectDir([\"CLAUDE_PROJECT_DIR\"]);\n *\n * // OMP / standalone — SKAILE_PROJECT_DIR or cwd only\n * const projectDir = resolveProjectDir();\n *\n * @docLink packages/workspace-plugin/concepts#workspaceplugin-lifecycle\n */\nexport function resolveProjectDir(additionalEnvVars?: string[]): string {\n if (process.env.SKAILE_PROJECT_DIR) return process.env.SKAILE_PROJECT_DIR;\n for (const key of additionalEnvVars ?? []) {\n const val = process.env[key];\n if (val) return val;\n }\n return process.cwd();\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../workspace-plugin/src/adapters/claude-code.ts","../workspace-plugin/src/store.ts","../workspace-plugin/src/plugin.ts","../workspace-plugin/src/utils/project-dir.ts"],"names":["err"],"mappings":";;;;;;;AAeA,IAAM,WAAA,GAAc;AAAA,EAClB,IAAA,EAAM,QAAA;AAAA,EACN,OAAA,EAAS,OAAA;AAAA,EACT,WAAA,EAAa,yEAAA;AAAA,EACb,MAAA,EAAQ,EAAE,IAAA,EAAM,WAAA,EAAa,KAAK,8BAAA,EAA+B;AAAA,EACjE,UAAA,EAAY,yCAAA;AAAA,EACZ,QAAA,EAAU,CAAC,QAAA,EAAU,YAAA,EAAc,aAAa,WAAW,CAAA;AAAA,EAC3D,KAAA,EAAO,oBAAA;AAAA,EACP,UAAA,EAAY,aAAA;AAAA,EACZ,UAAA,EAAY;AAAA,IACV,gBAAA,EAAkB;AAAA,MAChB,IAAA,EAAM,QAAA;AAAA,MACN,KAAA,EAAO,kBAAA;AAAA,MACP,WAAA,EAAa;AAAA;AACf;AAEJ,CAAA;AAOA,IAAM,UAAA,GAAa;AAAA,EACjB,KAAA,EAAO;AAAA,IACL,YAAA,EAAc;AAAA,MACZ,EAAE,OAAO,CAAC,EAAE,MAAM,SAAA,EAAW,OAAA,EAAS,uCAAA,EAAyC,CAAA;AAAE,KACnF;AAAA,IACA,UAAA,EAAY,CAAC,EAAE,KAAA,EAAO,CAAC,EAAE,IAAA,EAAM,SAAA,EAAW,OAAA,EAAS,qCAAA,EAAuC,CAAA,EAAG,CAAA;AAAA,IAC7F,gBAAA,EAAkB;AAAA,MAChB,EAAE,OAAO,CAAC,EAAE,MAAM,SAAA,EAAW,OAAA,EAAS,4CAAA,EAA8C,CAAA;AAAE;AACxF;AAEJ,CAAA;AAMA,IAAM,QAAA,GAAW;AAAA,EACf,UAAA,EAAY;AAAA,IACV,kBAAA,EAAoB;AAAA,MAClB,OAAA,EAAS,QAAA;AAAA,MACT,IAAA,EAAM,CAAC,YAAY,CAAA;AAAA,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CAAI,kBAAA,EAAoB,OAAO,QAAQ,GAAA,CAAI,kBAAA;AACvD,EAAA,KAAA,MAAW,GAAA,IAAO,iBAAA,IAAqB,EAAC,EAAG;AACzC,IAAA,MAAM,GAAA,GAAM,OAAA,CAAQ,GAAA,CAAI,GAAG,CAAA;AAC3B,IAAA,IAAI,KAAK,OAAO,GAAA;AAAA,EAClB;AACA,EAAA,OAAO,QAAQ,GAAA,EAAI;AACrB","file":"chunk-U7YMGW7M.js","sourcesContent":["// ── Claude Code plugin-directory generator (STATELESS) ──────────────────────\n// Generates the contents of a Claude Code plugin directory\n// (`.claude/plugins/skaile/`) as an in-memory file map. No plugin instance or\n// boot() is required — safe to call from install commands.\n//\n// The previous standalone `@skaile/workspace-plugin-claude` package shipped\n// these as static files plus loose `.mjs` hook scripts; they are now\n// CLI-owned templates. Hooks invoke the `skaile` binary directly\n// (`skaile integration hook <event>`) and MCP runs via `skaile mcp-server` — no\n// generated script files, no shebang, no runtime assumption.\n\n/**\n * The Claude Code plugin manifest. `name` is `skaile`; `hooks` and\n * `mcpServers` point at sibling files in the generated directory.\n */\nconst PLUGIN_JSON = {\n name: \"skaile\",\n version: \"0.1.0\",\n description: \"Skaile workspace — connectors, mounts, skills, flows, shared state\",\n author: { name: \"skaile-ai\", url: \"https://github.com/skaile-ai\" },\n repository: \"https://github.com/skaile-ai/workspaces\",\n keywords: [\"skaile\", \"connectors\", \"workspace\", \"ai-assets\"],\n hooks: \"./hooks/hooks.json\",\n mcpServers: \"./.mcp.json\",\n userConfig: {\n skaile_yaml_path: {\n type: \"string\",\n title: \"skaile.yaml path\",\n description: \"Override path to skaile.yaml (default: auto-detect from project root)\",\n },\n },\n};\n\n/**\n * Hook wiring. Each lifecycle event invokes the `skaile` binary directly —\n * no loose `.mjs` scripts. `skaile integration hook <event>` resolves the project\n * directory itself (`CLAUDE_PROJECT_DIR` / cwd) and always exits 0.\n */\nconst HOOKS_JSON = {\n hooks: {\n SessionStart: [\n { hooks: [{ type: \"command\", command: \"skaile integration hook session-start\" }] },\n ],\n SessionEnd: [{ hooks: [{ type: \"command\", command: \"skaile integration hook session-end\" }] }],\n UserPromptSubmit: [\n { hooks: [{ type: \"command\", command: \"skaile integration hook user-prompt-submit\" }] },\n ],\n },\n};\n\n/**\n * MCP server wiring. Spawns `skaile mcp-server` — a stdio MCP subprocess that\n * runs on plain Node (no Claude Agent SDK).\n */\nconst MCP_JSON = {\n mcpServers: {\n \"skaile-workspace\": {\n command: \"skaile\",\n args: [\"mcp-server\"],\n env: {},\n },\n },\n};\n\n/**\n * Build the Claude Code plugin directory as an in-memory file map.\n *\n * Returns `{ relativePath: contents }` for every file the installer must\n * write under `<projectDir>/.claude/plugins/skaile/`. The installer is also\n * responsible for populating `skills/` from the project's `.skaile/skills/`.\n *\n * Stateless — no plugin instance, no `boot()`. The generated artifacts carry\n * no project-specific paths: hooks and the MCP server resolve the project\n * directory themselves at runtime.\n *\n * @returns A map of plugin-relative file paths to their string contents.\n *\n * @docLink packages/workspace-plugin/concepts#adapters\n */\nexport function buildClaudePluginFiles(): Record<string, string> {\n return {\n \".claude-plugin/plugin.json\": `${JSON.stringify(PLUGIN_JSON, null, 2)}\\n`,\n \"hooks/hooks.json\": `${JSON.stringify(HOOKS_JSON, null, 2)}\\n`,\n \".mcp.json\": `${JSON.stringify(MCP_JSON, null, 2)}\\n`,\n \"skills/.gitkeep\": \"\",\n };\n}\n","import { mkdir, readFile, writeFile } from \"node:fs/promises\";\nimport { dirname } from \"node:path\";\n\ninterface Subscriber {\n regex: RegExp;\n handler: (key: string, value: unknown) => void;\n}\n\n/**\n * Disk-backed reactive key-value store for plugin state.\n *\n * Keeps an in-memory map that can be flushed to / loaded from a JSON file.\n * Supports glob-style subscriptions (`connector:*`, `*`).\n *\n * State is persisted to `<projectDir>/.skaile/plugin-state.json`.\n * The instance is available on {@link WorkspacePlugin} as the public `store`\n * field after `boot()` resolves.\n *\n * @docLink packages/workspace-plugin/concepts#plugin-store\n */\nexport class PluginStore {\n private readonly statePath: string;\n private data: Map<string, unknown> = new Map();\n private subscribers: Subscriber[] = [];\n\n constructor(statePath: string) {\n this.statePath = statePath;\n }\n\n /** Synchronous read from in-memory map. */\n get<T>(key: string): T | undefined {\n return this.data.get(key) as T | undefined;\n }\n\n /** Write to in-memory map and notify matching subscribers. */\n set<T>(key: string, value: T): void {\n this.data.set(key, value);\n this.notify(key, value);\n }\n\n /** Remove key and notify matching subscribers. */\n delete(key: string): void {\n this.data.delete(key);\n this.notify(key, undefined);\n }\n\n /**\n * Subscribe to changes matching a glob-style pattern.\n * `*` matches any sequence of characters.\n * Returns an unsubscribe function.\n */\n subscribe(pattern: string, handler: (key: string, value: unknown) => void): () => void {\n const escaped = pattern.replace(/[.+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n const regexStr = `^${escaped.replace(/\\*/g, \".*\")}$`;\n const sub: Subscriber = { regex: new RegExp(regexStr), handler };\n this.subscribers.push(sub);\n\n return () => {\n const idx = this.subscribers.indexOf(sub);\n if (idx !== -1) this.subscribers.splice(idx, 1);\n };\n }\n\n /** Rehydrate from disk JSON. Missing file = empty store (no throw). */\n async load(): Promise<void> {\n try {\n const raw = await readFile(this.statePath, \"utf-8\");\n const parsed = JSON.parse(raw);\n if (parsed && typeof parsed === \"object\" && !Array.isArray(parsed)) {\n this.data = new Map(Object.entries(parsed));\n }\n } catch (e: unknown) {\n // Missing file or invalid JSON — start with empty store\n }\n }\n\n /** Write entire store to disk as JSON. Creates parent dirs if needed. */\n async flush(): Promise<void> {\n const obj = Object.fromEntries(this.data);\n const json = JSON.stringify(obj, null, 2);\n await mkdir(dirname(this.statePath), { recursive: true });\n await writeFile(this.statePath, json, \"utf-8\");\n }\n\n private notify(key: string, value: unknown): void {\n for (const sub of this.subscribers) {\n if (sub.regex.test(key)) {\n sub.handler(key, value);\n }\n }\n }\n}\n","import { readFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport type { ConnectorManager } from \"@skaile/workspaces/connectors\";\nimport { DEFAULT_DRIVER_ID } from \"@skaile/workspaces/core/framework\";\nimport { createLogger } from \"@skaile/workspaces/core/logging\";\nimport type { Logger } from \"@skaile/workspaces/types\";\nimport { PluginStore } from \"./store.js\";\n\n/**\n * Construction options for {@link WorkspacePlugin}.\n *\n * At minimum `projectDir` must be supplied. All other fields are optional\n * and are pre-resolved by the caller when available (e.g. the runner already\n * knows `driver`/`model` from its own settings resolution).\n *\n * @docLink packages/workspace-plugin/concepts#workspaceplugin-lifecycle\n */\nexport interface WorkspacePluginOpts {\n projectDir: string;\n /**\n * Active connector manager. The unified `ConnectorManager` owns both\n * filesystem-face (mountable) and tool-face connectors.\n */\n connectorManager?: ConnectorManager;\n bootOwned?: boolean;\n onLog?: (msg: string) => void;\n /** Pre-resolved driver type (avoids needing boot() to read settings). */\n driver?: string;\n /** Pre-resolved model. */\n model?: string;\n}\n\n/**\n * Shared runtime core for the skaile workspace plugin.\n *\n * Manages the full lifecycle (`boot` → tools available → `shutdown`) and\n * surfaces workspace capabilities — mounts, connectors, flows, skills,\n * sessions, and config validation — through two adapters:\n *\n * - **MCP, in-process** (runner): call {@link buildWorkspaceMcpServer} for the\n * Claude Agent SDK server the runner embeds into its `query()` call.\n * - **MCP, stdio** (`skaile mcp-server`): call {@link runMcpServerStdio} for a\n * raw `@modelcontextprotocol/sdk` server — no Claude Agent SDK.\n * - **OMP**: call {@link buildOmpToolSet} for the 13-tool native subset and\n * {@link buildOmpExtensionSource} for the generated extension file.\n *\n * Two boot modes are supported via {@link WorkspacePluginOpts.bootOwned}:\n * - `bootOwned: false` (default) — managers injected externally by the runner.\n * - `bootOwned: true` — plugin owns the full manager lifecycle (standalone MCP\n * subprocess or OMP extension).\n *\n * @docLink packages/workspace-plugin/concepts#workspaceplugin-lifecycle\n */\nexport class WorkspacePlugin {\n readonly projectDir: string;\n connectorManager: ConnectorManager | null;\n readonly store: PluginStore;\n\n private readonly bootOwned: boolean;\n private readonly onLog: (msg: string) => void;\n private readonly log: Logger = createLogger({\n kind: \"mcp\",\n subkind: \"skaile-workspace\",\n });\n driver?: string;\n model?: string;\n\n constructor(opts: WorkspacePluginOpts) {\n this.projectDir = opts.projectDir;\n this.connectorManager = opts.connectorManager ?? null;\n this.store = new PluginStore(join(opts.projectDir, \".skaile\", \"plugin-state.json\"));\n this.bootOwned = opts.bootOwned ?? false;\n if (opts.driver) this.driver = opts.driver;\n if (opts.model) this.model = opts.model;\n this.onLog = opts.onLog ?? (() => {});\n this.log.debug(\"plugin constructed\", {\n driver: opts.driver,\n hasConnectors: !!opts.connectorManager,\n model: opts.model,\n bootOwned: this.bootOwned,\n });\n }\n\n async boot(): Promise<void> {\n if (!this.bootOwned) {\n // Managers were injected externally — resolve settings only (non-fatal)\n try {\n const { resolveSettings } = await import(\"@skaile/workspaces/core\");\n const settings = await resolveSettings(this.projectDir);\n this.driver = settings.driver ?? DEFAULT_DRIVER_ID;\n this.model = settings.model;\n } catch {\n /* non-fatal */\n }\n await this.store.load();\n return;\n }\n\n // bootOwned: we own the managers lifecycle\n try {\n const { resolveSettings } = await import(\"@skaile/workspaces/core\");\n const settings = await resolveSettings(this.projectDir);\n this.driver = settings.driver ?? DEFAULT_DRIVER_ID;\n this.model = settings.model;\n } catch {\n /* non-fatal */\n }\n\n try {\n const {\n ConnectorManager,\n loadConnectorDeclarations,\n registerBuiltinConnectors,\n createCliSecretProviderChain,\n } = await import(\"@skaile/workspaces/connectors\");\n\n registerBuiltinConnectors();\n\n const secrets = createCliSecretProviderChain();\n\n const connectorDecls = await loadConnectorDeclarations(this.projectDir);\n const cm = new ConnectorManager(this.projectDir, { secrets });\n await cm.connectAll(connectorDecls);\n this.connectorManager = cm;\n\n this.log.info(\"workspace plugin booted\", {\n connectors: connectorDecls.length,\n });\n this.onLog(`WorkspacePlugin booted: ${connectorDecls.length} connectors`);\n } catch (err) {\n this.log.warn(\"workspace plugin boot warning\", {\n error: err instanceof Error ? err.message : String(err),\n });\n this.onLog(`WorkspacePlugin boot warning: ${err}`);\n }\n\n await this.store.load();\n }\n\n async reload(): Promise<void> {\n if (!this.bootOwned) return;\n await this.shutdown();\n await this.boot();\n }\n\n async shutdown(): Promise<void> {\n this.log.info(\"workspace plugin shutdown\");\n await this.store.flush();\n if (!this.bootOwned) return;\n try {\n await (this.connectorManager as any)?.disconnectAll?.();\n } catch {\n /* best-effort */\n }\n this.connectorManager = null;\n }\n\n buildSystemPromptSection(driver?: string): string {\n const d = driver ?? this.driver ?? \"unknown\";\n // The unified ConnectorManager owns both mountable (filesystem-face) and\n // tool-face connectors. Filesystem-face connectors expose a `mountPath`.\n const all = (this.connectorManager as any)?.listConnectors?.() ?? [];\n const mounts = (all as any[]).filter((c) => typeof c.mountPath === \"string\");\n const connectors = (all as any[]).filter((c) => typeof c.mountPath !== \"string\");\n const lines = [\"## Workspace (skaile)\", \"\", `Driver: ${d}`, `Project: ${this.projectDir}`];\n if (mounts.length > 0) {\n lines.push(\"\", \"Mounts:\");\n for (const v of mounts) {\n lines.push(` · ${v.id} (${v.driver}) → ${v.mountPath ?? \"(unmounted)\"}`);\n }\n }\n if (connectors.length > 0) {\n lines.push(\"\", \"Connectors:\");\n for (const c of connectors) {\n lines.push(` · ${c.id} (${c.driver})`);\n }\n }\n lines.push(\"\", \"Use workspace_info for full details. Use workspace_validate to check health.\");\n\n for (const name of [\"SOUL.md\", \"RULES.md\"]) {\n const skaileOverride = join(this.projectDir, \".skaile\", name);\n const rootFile = join(this.projectDir, name);\n for (const candidate of [skaileOverride, rootFile]) {\n try {\n const content = readFileSync(candidate, \"utf-8\").trim();\n if (content) {\n lines.push(\"\", `## ${name.replace(\".md\", \"\")}`, \"\", content);\n break;\n }\n } catch {\n // file not found, try next\n }\n }\n }\n\n return lines.join(\"\\n\");\n }\n\n /**\n * Build the in-process Claude Agent SDK MCP server (runner embedding).\n * Returns `null` when `@anthropic-ai/claude-agent-sdk` is unavailable.\n */\n async buildWorkspaceMcpServer(): Promise<unknown | null> {\n this.log.info(\"building workspace MCP server\");\n try {\n const { buildWorkspaceMcpServer } = await import(\"./adapters/mcp.js\");\n const server = await buildWorkspaceMcpServer(this);\n if (server) this.log.info(\"workspace MCP server ready\");\n else this.log.debug(\"workspace MCP server skipped (no tools)\");\n return server;\n } catch (err) {\n this.log.error(\"workspace MCP server build failed\", err);\n throw err;\n }\n }\n\n /**\n * Build the raw `@modelcontextprotocol/sdk` stdio MCP server — no Claude\n * Agent SDK. Used by the `skaile mcp-server` subprocess. The returned\n * server is not yet connected to a transport.\n */\n async buildWorkspaceMcpStdioServer(): Promise<unknown> {\n this.log.info(\"building workspace stdio MCP server\");\n const { buildWorkspaceMcpStdioServer } = await import(\"./adapters/mcp.js\");\n return buildWorkspaceMcpStdioServer(this);\n }\n\n /**\n * Build and run the stdio MCP server: builds the raw\n * `@modelcontextprotocol/sdk` server and connects a `StdioServerTransport`.\n * Used by the `skaile mcp-server` subprocess.\n */\n async runMcpServerStdio(): Promise<void> {\n this.log.info(\"starting workspace stdio MCP server\");\n const { runMcpServerStdio } = await import(\"./adapters/mcp.js\");\n await runMcpServerStdio(this);\n }\n\n async buildOmpToolSet(): Promise<unknown[]> {\n const { buildOmpToolSet } = await import(\"./adapters/omp.js\");\n return buildOmpToolSet(this);\n }\n\n async buildOmpExtensionSource(): Promise<string> {\n const { buildOmpExtensionSource } = await import(\"./adapters/omp.js\");\n return buildOmpExtensionSource(this.projectDir);\n }\n\n async handleSlashCommand(group: string, args: string[]): Promise<string> {\n const { handleSlashCommand } = await import(\"./adapters/omp.js\");\n return handleSlashCommand(this, group, args);\n }\n}\n","// utils/project-dir.ts\n// Centralised project-directory resolution used by all plugin entry points.\n\n/**\n * Resolve the skaile project directory from environment variables.\n *\n * Resolution order:\n * 1. `SKAILE_PROJECT_DIR` (always checked first)\n * 2. Any additional env var keys supplied by the caller (in order)\n * 3. `process.cwd()` as final fallback\n *\n * @param additionalEnvVars - Optional list of extra environment variable names\n * to check before falling back to `process.cwd()`.\n * @returns Absolute path to the resolved project directory.\n *\n * @example\n * // Claude Code — also checks CLAUDE_PROJECT_DIR\n * const projectDir = resolveProjectDir([\"CLAUDE_PROJECT_DIR\"]);\n *\n * // OMP / standalone — SKAILE_PROJECT_DIR or cwd only\n * const projectDir = resolveProjectDir();\n *\n * @docLink packages/workspace-plugin/concepts#workspaceplugin-lifecycle\n */\nexport function resolveProjectDir(additionalEnvVars?: string[]): string {\n if (process.env.SKAILE_PROJECT_DIR) return process.env.SKAILE_PROJECT_DIR;\n for (const key of additionalEnvVars ?? []) {\n const val = process.env[key];\n if (val) return val;\n }\n return process.cwd();\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getAccessToken, loadStoreAuthConfig, hasStoredAuth } from './chunk-
|
|
1
|
+
import { getAccessToken, loadStoreAuthConfig, hasStoredAuth } from './chunk-NVBN3YOH.js';
|
|
2
2
|
import { globalSettingsPath, mapLegacyFields } from './chunk-4QINFQ27.js';
|
|
3
3
|
import { existsSync, readFileSync } from 'fs';
|
|
4
4
|
|
|
@@ -60,5 +60,5 @@ function isStoreAuthenticated() {
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
export { getStoreConfig, getStoreToken, isStoreAuthenticated, storeFetch };
|
|
63
|
-
//# sourceMappingURL=chunk-
|
|
64
|
-
//# sourceMappingURL=chunk-
|
|
63
|
+
//# sourceMappingURL=chunk-VQQCA7BD.js.map
|
|
64
|
+
//# sourceMappingURL=chunk-VQQCA7BD.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../cli/src/store-client.ts"],"names":[],"mappings":";;;;AAuBO,SAAS,cAAA,GAA8B;AAC5C,EAAA,MAAM,eAAe,kBAAA,EAAmB;AACxC,EAAA,IAAI,WAAgC,EAAC;AACrC,EAAA,IAAI,UAAA,CAAW,YAAY,CAAA,EAAG;AAC5B,IAAA,IAAI;AACF,MAAA,QAAA,GAAW,gBAAgB,IAAA,CAAK,KAAA,CAAM,aAAa,YAAA,EAAc,OAAO,CAAC,CAAC,CAAA;AA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AAA,GAAM,MAAM,KAAA,CAAM,GAAA,EAAK,EAAE,GAAG,SAAA,EAAW,MAAA,EAAQ,UAAA,CAAW,MAAA,EAAQ,CAAA;AACxE,IAAA,IAAI,CAAC,IAAI,EAAA,EAAI;AACX,MAAA,MAAM,IAAA,GAAO,MAAM,GAAA,CAAI,IAAA,EAAK,CAAE,KAAA,CAAM,OAAO,EAAE,KAAA,EAAO,CAAA,KAAA,EAAQ,GAAA,CAAI,MAAM,IAAG,CAAE,CAAA;AAI3E,MAAA,MAAM,CAAA,GAAI,IAAA;AACV,MAAA,MAAM,IAAI,MAAM,CAAA,CAAE,OAAA,IAAW,EAAE,KAAA,IAAS,CAAA,iBAAA,EAAoB,GAAA,CAAI,MAAM,CAAA,CAAE,CAAA;AAAA,IAC1E;AACA,IAAA,OAAO,IAAI,IAAA,EAAK;AAAA,EAClB,CAAA,SAAE;AACA,IAAA,YAAA,CAAa,OAAO,CAAA;AAAA,EACtB;AACF;AASO,SAAS,oBAAA,GAAgC;AAC9C,EAAA,OAAO,aAAA,CAAc,qBAAqB,CAAA;AAC5C","file":"chunk-VQQCA7BD.js","sourcesContent":["import { existsSync, readFileSync } from \"node:fs\";\nimport { globalSettingsPath, mapLegacyFields } from \"@skaile/workspaces/core\";\nimport { type AuthDeps, getAccessToken, hasStoredAuth, loadStoreAuthConfig } from \"./store-auth.ts\";\n\n/**\n * Connection configuration for the AI Asset Store API. `jwt` is normally left\n * null here and filled per-call by the caller from {@link getStoreToken} (the\n * device-flow session); it stays on the type for the `{ ...config, jwt }` spread.\n *\n * @docLink cli/dev-guide#store-client\n */\nexport interface StoreConfig {\n url: string;\n jwt: string | null;\n}\n\n/**\n * Read the store API base URL (settings `storeUrl` → `SKAILE_STORE_URL` →\n * default). Auth is not read here — it lives in the device-flow session; see\n * {@link getStoreToken}.\n *\n * @docLink cli/dev-guide#store-client\n */\nexport function getStoreConfig(): StoreConfig {\n const settingsPath = globalSettingsPath();\n let settings: Record<string, any> = {};\n if (existsSync(settingsPath)) {\n try {\n settings = mapLegacyFields(JSON.parse(readFileSync(settingsPath, \"utf-8\")));\n } catch {\n settings = {};\n }\n }\n return {\n url: settings.storeUrl ?? process.env.SKAILE_STORE_URL ?? \"https://api.skaile.store\",\n jwt: null,\n };\n}\n\n/**\n * Return a valid store access token (Keycloak device-flow session, refreshed if\n * needed). Throws a \"run `skaile store login`\" error when there is no session.\n * This is the auth source for every `/api/v1/*` publisher call.\n */\nexport function getStoreToken(deps?: AuthDeps): Promise<string> {\n return getAccessToken(loadStoreAuthConfig(), deps);\n}\n\n/**\n * Make an authenticated HTTP request to the store REST API.\n *\n * @param config - Store connection config (URL + auth token).\n * @param path - API path (e.g. `/api/assets`).\n * @param opts - Optional method, body, query params, extra headers, and\n * `timeoutMs` (default 1500). Publisher calls pass a longer timeout because\n * they trigger server-side clone/sync work.\n * @returns Parsed JSON response body.\n * @docLink cli/dev-guide#store-client\n */\nexport async function storeFetch<T = any>(\n config: StoreConfig,\n path: string,\n opts?: {\n method?: string;\n body?: unknown;\n params?: Record<string, string>;\n headers?: Record<string, string>;\n timeoutMs?: number;\n },\n): Promise<T> {\n let url = `${config.url}${path}`;\n if (opts?.params) {\n const sp = new URLSearchParams(opts.params);\n url += `?${sp}`;\n }\n\n const headers: Record<string, string> = {\n \"Content-Type\": \"application/json\",\n Accept: \"application/json\",\n ...(opts?.headers ?? {}),\n };\n if (config.jwt) {\n headers.Authorization = `Bearer ${config.jwt}`;\n }\n\n const fetchOpts: RequestInit = {\n method: opts?.method ?? \"GET\",\n headers,\n };\n if (opts?.body) {\n fetchOpts.body = JSON.stringify(opts.body);\n }\n\n const controller = new AbortController();\n const timeout = setTimeout(() => controller.abort(), opts?.timeoutMs ?? 1_500);\n try {\n const res = await fetch(url, { ...fetchOpts, signal: controller.signal });\n if (!res.ok) {\n const body = await res.json().catch(() => ({ error: `HTTP ${res.status}` }));\n // Prefer the store's human-readable `message` (e.g. \"Namespace '@x' is\n // reserved … Sign in with GitHub to claim it\") over the bare `error` code\n // (`UNPROCESSABLE_CONTENT`) — the message is the actionable part.\n const b = body as { message?: string; error?: string };\n throw new Error(b.message ?? b.error ?? `Store API error: ${res.status}`);\n }\n return res.json() as Promise<T>;\n } finally {\n clearTimeout(timeout);\n }\n}\n\n/**\n * Return `true` when a store session exists (a Keycloak device-flow token cached\n * at `~/.skaile/auth.json`). Validity/refresh is resolved on use via\n * {@link getStoreToken}.\n *\n * @docLink cli/dev-guide#store-client\n */\nexport function isStoreAuthenticated(): boolean {\n return hasStoredAuth(loadStoreAuthConfig());\n}\n"]}
|
package/dist/cli/index.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { storeNotInstallableReason } from '../chunk-ESXZJP4M.js';
|
|
3
|
-
import { makeProvidersCommand, loadRegistryView, addProviderEntry, ProviderRegistryWriteError } from '../chunk-
|
|
4
|
-
import { makeInstallCommand, makeCheckCommand, makeCleanCommand, reportRewritten, reportReplaced, reportRelocked, reportMoved, reportStoreNotChecked, editedConventionFiles, REF_HINT, reportInstalledSoftDeps } from '../chunk-
|
|
3
|
+
import { makeProvidersCommand, loadRegistryView, addProviderEntry, ProviderRegistryWriteError } from '../chunk-354JIEIE.js';
|
|
4
|
+
import { makeInstallCommand, makeCheckCommand, makeCleanCommand, reportRewritten, reportReplaced, reportRelocked, reportMoved, reportStoreNotChecked, editedConventionFiles, REF_HINT, reportInstalledSoftDeps } from '../chunk-55VKZUQY.js';
|
|
5
5
|
import { createSpinner } from '../chunk-NESV47MF.js';
|
|
6
|
-
import { makeSourceCommand, syncProjectSources, divergedSourceClones } from '../chunk-
|
|
6
|
+
import { makeSourceCommand, syncProjectSources, divergedSourceClones } from '../chunk-B6I7SF2X.js';
|
|
7
7
|
import { AI_RESOURCES } from '../chunk-PV47EEHD.js';
|
|
8
|
-
import { getStoreConfig, storeFetch, isStoreAuthenticated, getStoreToken } from '../chunk-
|
|
9
|
-
import { unresolvedManifestDependencies, warnIgnoredDomainFiles, warnLegacyBundleFiles, removedDomainOption, rejectRemovedDomainOption, deviceLogin, loadStoreAuthConfig, logout, hasStoredAuth, exitOnLibrarySymlinks, resolveLibraryPublisherDetailed, getStoreIdentity, warnLibraryNameFallback, indexLibrary, requireValidPublisherOrExit, exitOnManifestPublisherProblems, registerLibraryAsset, DOMAIN_REMOVED_HINT, reportLibrarySymlinks, checkAsset, agentComposeRefAdvisories, assetEntryRef, manifestPublisherProblems, manifestRootProblems, manifestEntryNameProblems, manifestRequiresProblems, findAssetManifestFile, declaredVersion, manifestVersionMismatchMessage, exitOnManifestRootProblems, checkAssetFile, duplicateAssetMessage, readAssetBody, invalidSemverText, checkComposeKinds } from '../chunk-
|
|
10
|
-
import { openCatalogSource, LocalCatalogDisabledError, openLibraryManager, openLibrary } from '../chunk-
|
|
11
|
-
import { logErr, S, logOk, logInfo, logWarn, TARGET_DEFAULT_HINT, requireProjectConfig, deferredWarnings, logNoProject, warnLegacyClaudeCopies, kindColorPad, kindColor, colorRef, formatSoftDepSection, bareSoftDepName, formatSoftDepHint, formatRelativeTime, formatSoftDepRemovePreview, formatSoftDepAddPreview, fitWidth, KIND_COL_WIDTH } from '../chunk-
|
|
8
|
+
import { getStoreConfig, storeFetch, isStoreAuthenticated, getStoreToken } from '../chunk-VQQCA7BD.js';
|
|
9
|
+
import { unresolvedManifestDependencies, warnIgnoredDomainFiles, warnLegacyBundleFiles, removedDomainOption, rejectRemovedDomainOption, deviceLogin, loadStoreAuthConfig, logout, hasStoredAuth, exitOnLibrarySymlinks, resolveLibraryPublisherDetailed, getStoreIdentity, warnLibraryNameFallback, indexLibrary, requireValidPublisherOrExit, exitOnManifestPublisherProblems, registerLibraryAsset, DOMAIN_REMOVED_HINT, reportLibrarySymlinks, checkAsset, agentComposeRefAdvisories, assetEntryRef, manifestPublisherProblems, manifestRootProblems, manifestEntryNameProblems, manifestRequiresProblems, findAssetManifestFile, declaredVersion, manifestVersionMismatchMessage, exitOnManifestRootProblems, checkAssetFile, duplicateAssetMessage, readAssetBody, invalidSemverText, checkComposeKinds } from '../chunk-NVBN3YOH.js';
|
|
10
|
+
import { openCatalogSource, LocalCatalogDisabledError, openLibraryManager, openLibrary } from '../chunk-GR7TV4XC.js';
|
|
11
|
+
import { logErr, S, logOk, logInfo, logWarn, TARGET_DEFAULT_HINT, requireProjectConfig, deferredWarnings, logNoProject, warnLegacyClaudeCopies, kindColorPad, kindColor, colorRef, formatSoftDepSection, bareSoftDepName, formatSoftDepHint, formatRelativeTime, formatSoftDepRemovePreview, formatSoftDepAddPreview, fitWidth, KIND_COL_WIDTH } from '../chunk-GV3MFKDV.js';
|
|
12
12
|
import { getKindRegistry, getKnownKinds } from '../chunk-YUURCZWY.js';
|
|
13
13
|
import { LocalSecretsProvider } from '../chunk-ILFGVSTJ.js';
|
|
14
|
-
import { runAgentChat, isCompositionError, resolveSessionId, loadSessionById, loadSession, listSessions, setCurrentSession, deleteSession, clearSession, loadAgentManifest, hashAgentFiles, createCompositionContentSource, compileComposition, instanceForSession, resolveAgentInstance, describeComposition, MarkdownStreamer, createFinalTextFallback } from '../chunk-
|
|
15
|
-
import { buildClaudePluginFiles } from '../chunk-
|
|
16
|
-
import '../chunk-
|
|
17
|
-
import '../chunk-
|
|
14
|
+
import { runAgentChat, isCompositionError, resolveSessionId, loadSessionById, loadSession, listSessions, setCurrentSession, deleteSession, clearSession, loadAgentManifest, hashAgentFiles, createCompositionContentSource, compileComposition, instanceForSession, resolveAgentInstance, describeComposition, MarkdownStreamer, createFinalTextFallback } from '../chunk-JJLH4TX4.js';
|
|
15
|
+
import { buildClaudePluginFiles } from '../chunk-U7YMGW7M.js';
|
|
16
|
+
import '../chunk-NHH3MRSC.js';
|
|
17
|
+
import '../chunk-RNFHJUK7.js';
|
|
18
18
|
import '../chunk-54TVXZP3.js';
|
|
19
19
|
import '../chunk-R6O6YWU7.js';
|
|
20
20
|
import '../chunk-PK5XQBOC.js';
|
|
@@ -30,12 +30,12 @@ import '../chunk-32NA4TVC.js';
|
|
|
30
30
|
import '../chunk-W3UDISS2.js';
|
|
31
31
|
import '../chunk-PHRNUTSG.js';
|
|
32
32
|
import '../chunk-O673TBWJ.js';
|
|
33
|
-
import { runFlow, resumeFlow } from '../chunk-
|
|
33
|
+
import { runFlow, resumeFlow } from '../chunk-7Y7UYNGL.js';
|
|
34
34
|
import '../chunk-4R6DROGN.js';
|
|
35
35
|
import { parseSkillRequirements, validateRequirements, validateFlowVersions } from '../chunk-WXKNM2JJ.js';
|
|
36
36
|
import '../chunk-LEOXPIC6.js';
|
|
37
37
|
import '../chunk-ISHJITXJ.js';
|
|
38
|
-
import '../chunk-
|
|
38
|
+
import '../chunk-MUOSKYI2.js';
|
|
39
39
|
import '../chunk-ZIW34FGO.js';
|
|
40
40
|
import '../chunk-MKTJZLQM.js';
|
|
41
41
|
import '../chunk-PQF5QHVS.js';
|
|
@@ -56,7 +56,7 @@ import '../chunk-M3WPBTGJ.js';
|
|
|
56
56
|
import { nodeLabel, nodeSkillAsset, nodeIsInert, nodeIsOptional, nodeRunKind, flowSkillVersionPins } from '../chunk-7RGTAEG6.js';
|
|
57
57
|
import '../chunk-NUELZWCF.js';
|
|
58
58
|
import '../chunk-D5WTOVLG.js';
|
|
59
|
-
import { AssetManager, parseRefTolerant, MissingManifestError, normalizeRepoUrl, FACTORY_SOURCE_URL, parseCanonicalLockKey } from '../chunk-
|
|
59
|
+
import { AssetManager, parseRefTolerant, MissingManifestError, normalizeRepoUrl, FACTORY_SOURCE_URL, parseCanonicalLockKey } from '../chunk-R37L4BNR.js';
|
|
60
60
|
import { libraryDirMissing, missingLibraryDirMessage, cloneOrInitGitRepo, trackOriginBranch, stampManifestPublisher, isGitRepo, ensureGitRepo, conflictingAssetRoot, setManifestPublisher, LIBRARY_OWNERSHIPS, assertManifestEditable, installLibraryAsset, missingRootAssets, getStoreManifestsDir, assertValidLibraryName, syncManifestWithDisk, getDefaultValue, isSecretPlaceholder } from '../chunk-OOQ5Q75W.js';
|
|
61
61
|
import { parseManifestFile, SEMVER_RE } from '../chunk-NKDSU4Q7.js';
|
|
62
62
|
import '../chunk-KRRHADE7.js';
|
|
@@ -228,7 +228,7 @@ async function runSearch(kind, query, opts) {
|
|
|
228
228
|
}
|
|
229
229
|
}
|
|
230
230
|
async function searchIndex(query, kind) {
|
|
231
|
-
const { openLibrary: openLibrary2 } = await import('../open-library-
|
|
231
|
+
const { openLibrary: openLibrary2 } = await import('../open-library-JJGDEYYT.js');
|
|
232
232
|
const library = await openLibrary2();
|
|
233
233
|
try {
|
|
234
234
|
const { libraryDirMissing: libraryDirMissing2 } = await import('../library/index.js');
|
|
@@ -376,14 +376,14 @@ async function expandCompetingOrigins(entries, projectDir) {
|
|
|
376
376
|
}
|
|
377
377
|
async function searchLocal(query, kind, opts, showStore, airGapped) {
|
|
378
378
|
const projectDir = path41__default.resolve(opts.projectDir);
|
|
379
|
-
const { restoreSourceReaders } = await import('../source-
|
|
379
|
+
const { restoreSourceReaders } = await import('../source-WKV4QFGS.js');
|
|
380
380
|
for (const name of await restoreSourceReaders(projectDir)) {
|
|
381
381
|
logInfo(`Re-registered source "${name}" (its library entry was removed elsewhere).`);
|
|
382
382
|
}
|
|
383
383
|
const factory = await searchFactory(projectDir, query, kind);
|
|
384
384
|
let entries = unionEntries(await searchIndex(query, kind), factory);
|
|
385
385
|
if (entries.length === 0 && !query && !kind && !airGapped) {
|
|
386
|
-
const { autoSyncForSearch } = await import('../source-
|
|
386
|
+
const { autoSyncForSearch } = await import('../source-WKV4QFGS.js');
|
|
387
387
|
if (await autoSyncForSearch(projectDir)) {
|
|
388
388
|
entries = unionEntries(await searchIndex(query, kind), factory);
|
|
389
389
|
}
|
|
@@ -497,7 +497,7 @@ async function searchStore(query, kind, opts, airGapped) {
|
|
|
497
497
|
logInfo("air-gapped (cache_ttl: 0) \u2014 local sources only");
|
|
498
498
|
return;
|
|
499
499
|
}
|
|
500
|
-
const { openCatalogSource: openCatalogSource2, LocalCatalogDisabledError: LocalCatalogDisabledError2 } = await import('../open-library-
|
|
500
|
+
const { openCatalogSource: openCatalogSource2, LocalCatalogDisabledError: LocalCatalogDisabledError2 } = await import('../open-library-JJGDEYYT.js');
|
|
501
501
|
try {
|
|
502
502
|
const remote = await openCatalogSource2({ projectDir: path41__default.resolve(opts.projectDir) });
|
|
503
503
|
const assets = await remote.listAssets(kind ? { kind } : {});
|
|
@@ -977,7 +977,7 @@ async function resolveInfoEntry(am2, ref, opts) {
|
|
|
977
977
|
return { entry: match ?? deployed };
|
|
978
978
|
}
|
|
979
979
|
const lookup = opts.storeLookup ?? (async (filter) => {
|
|
980
|
-
const { resolveCatalogSource } = await import('../open-library-
|
|
980
|
+
const { resolveCatalogSource } = await import('../open-library-JJGDEYYT.js');
|
|
981
981
|
const { source, close } = await resolveCatalogSource({ projectDir: opts.projectDir });
|
|
982
982
|
try {
|
|
983
983
|
return await source.listAssets(filter);
|
|
@@ -993,7 +993,7 @@ async function resolveInfoEntry(am2, ref, opts) {
|
|
|
993
993
|
);
|
|
994
994
|
return { entry: hit ? catalogAssetToEntry(hit) : null };
|
|
995
995
|
} catch (err2) {
|
|
996
|
-
const { LocalCatalogDisabledError: LocalCatalogDisabledError2 } = await import('../open-library-
|
|
996
|
+
const { LocalCatalogDisabledError: LocalCatalogDisabledError2 } = await import('../open-library-JJGDEYYT.js');
|
|
997
997
|
const storeNote = err2 instanceof Error ? err2.message : String(err2);
|
|
998
998
|
const disabled = err2 instanceof LocalCatalogDisabledError2 || /catalog\.url/i.test(storeNote);
|
|
999
999
|
return { entry: null, storeNote, ...disabled ? { storeDisabled: true } : {} };
|
|
@@ -1650,7 +1650,7 @@ function makeCatalogCommand() {
|
|
|
1650
1650
|
return catalog;
|
|
1651
1651
|
}
|
|
1652
1652
|
async function runLocalCatalogTest(projectDir) {
|
|
1653
|
-
const { resolveCatalogSource } = await import('../open-library-
|
|
1653
|
+
const { resolveCatalogSource } = await import('../open-library-JJGDEYYT.js');
|
|
1654
1654
|
let resolved;
|
|
1655
1655
|
try {
|
|
1656
1656
|
resolved = await resolveCatalogSource({ projectDir });
|
|
@@ -4129,7 +4129,7 @@ function remoteBranches(url) {
|
|
|
4129
4129
|
return r.stdout.split("\n").map((line) => line.split(" ")[1]?.replace(/^refs\/heads\//, "")).filter((b) => !!b);
|
|
4130
4130
|
}
|
|
4131
4131
|
async function warnIfNotGithubRemote(name, url) {
|
|
4132
|
-
const { isGithubRemote, notGithubRemoteMessage } = await import('../library-publish-
|
|
4132
|
+
const { isGithubRemote, notGithubRemoteMessage } = await import('../library-publish-EQFYHJ6G.js');
|
|
4133
4133
|
if (!isGithubRemote(url)) logWarn(notGithubRemoteMessage(name, url));
|
|
4134
4134
|
}
|
|
4135
4135
|
function scaffoldLibraryFiles(dir, name) {
|
|
@@ -4813,16 +4813,16 @@ function makeLibraryCommand() {
|
|
|
4813
4813
|
"With --create-repo: create the repo private (the store only accepts public repos)"
|
|
4814
4814
|
).option("--ref <gitref>", "Git ref to ingest (default: the library branch or main)").option("--dry-run", "Print the plan; push nothing and call no store endpoint").action(
|
|
4815
4815
|
async (lib, opts) => {
|
|
4816
|
-
const { runLibraryPublish } = await import('../library-publish-
|
|
4816
|
+
const { runLibraryPublish } = await import('../library-publish-EQFYHJ6G.js');
|
|
4817
4817
|
await withStoreErrorHandling(() => runLibraryPublish(lib, opts));
|
|
4818
4818
|
}
|
|
4819
4819
|
);
|
|
4820
4820
|
cmd.command("register <lib>").description("Register the library's manifest without pushing (bytes already on github)").option("--asset <ref>", "Publish only the single asset matching this ref/name").option("--ref <gitref>", "Git ref to ingest (default: the library branch or main)").option("--dry-run", "Print the plan; call no store endpoint").action(async (lib, opts) => {
|
|
4821
|
-
const { runLibraryRegister } = await import('../library-publish-
|
|
4821
|
+
const { runLibraryRegister } = await import('../library-publish-EQFYHJ6G.js');
|
|
4822
4822
|
await withStoreErrorHandling(() => runLibraryRegister(lib, opts));
|
|
4823
4823
|
});
|
|
4824
4824
|
cmd.command("yank <lib>").description("Retract the library's published assets from the store").option("--asset <ref>", "Yank only the single asset matching this ref/name").action(async (lib, opts) => {
|
|
4825
|
-
const { runLibraryYank } = await import('../library-publish-
|
|
4825
|
+
const { runLibraryYank } = await import('../library-publish-EQFYHJ6G.js');
|
|
4826
4826
|
await withStoreErrorHandling(() => runLibraryYank(lib, opts));
|
|
4827
4827
|
});
|
|
4828
4828
|
return cmd;
|
|
@@ -5482,7 +5482,7 @@ function scheduleSoftDepPreview() {
|
|
|
5482
5482
|
}
|
|
5483
5483
|
async function loadAssets() {
|
|
5484
5484
|
softDepPreviewCache.clear();
|
|
5485
|
-
const { gatherAssetFeeds } = await import('../asset-feeds-
|
|
5485
|
+
const { gatherAssetFeeds } = await import('../asset-feeds-FVDNQ2FM.js');
|
|
5486
5486
|
const { entries, notes } = await gatherAssetFeeds(am, am.projectDir);
|
|
5487
5487
|
if (notes.length > 0) {
|
|
5488
5488
|
state.message = notes.map((n) => `[${n.feed}] ${n.message}`).join(" \u2022 ");
|
|
@@ -5686,7 +5686,7 @@ function reconcileCollapsedSets(rows) {
|
|
|
5686
5686
|
async function loadSourcesAndLibraries() {
|
|
5687
5687
|
try {
|
|
5688
5688
|
const [{ openLibraryManager: openLibraryManager2 }, { getGlobalCacheDir: getGlobalCacheDir2, globalSkaileDir: globalSkaileDir2 }] = await Promise.all([
|
|
5689
|
-
import('../open-library-
|
|
5689
|
+
import('../open-library-JJGDEYYT.js'),
|
|
5690
5690
|
import('../core/index.js')
|
|
5691
5691
|
]);
|
|
5692
5692
|
const { manager, library, close } = await openLibraryManager2();
|
|
@@ -10058,7 +10058,7 @@ function makeServeCommand() {
|
|
|
10058
10058
|
);
|
|
10059
10059
|
}
|
|
10060
10060
|
async function ensurePluginsLoadedForServe(projectDir) {
|
|
10061
|
-
const { logInfo: logInfo2, logWarn: logWarn2 } = await import('../helpers-
|
|
10061
|
+
const { logInfo: logInfo2, logWarn: logWarn2 } = await import('../helpers-PPVGVYIZ.js');
|
|
10062
10062
|
try {
|
|
10063
10063
|
const { resolveSkWorkspaceConfig: resolveSkWorkspaceConfig2 } = await import('../core/index.js');
|
|
10064
10064
|
const config = resolveSkWorkspaceConfig2(projectDir);
|
|
@@ -10077,7 +10077,7 @@ async function ensurePluginsLoadedForServe(projectDir) {
|
|
|
10077
10077
|
}
|
|
10078
10078
|
}
|
|
10079
10079
|
async function runCompileTest(opts) {
|
|
10080
|
-
const { logOk: logOk2, logErr: logErr2, logInfo: logInfo2, S: S2 } = await import('../helpers-
|
|
10080
|
+
const { logOk: logOk2, logErr: logErr2, logInfo: logInfo2, S: S2 } = await import('../helpers-PPVGVYIZ.js');
|
|
10081
10081
|
const { tmpdir } = await import('os');
|
|
10082
10082
|
const { dirname: dirname3, join: join7, resolve: resolve4 } = await import('path');
|
|
10083
10083
|
const { fileURLToPath: fileURLToPath2 } = await import('url');
|
|
@@ -11003,7 +11003,7 @@ function makeStoreCommand() {
|
|
|
11003
11003
|
"--all",
|
|
11004
11004
|
`List every match (default: ${STORE_ROW_LIMIT} rows, only what \`skaile add\` can install)`
|
|
11005
11005
|
).option("-C, --project-dir <dir>", "Project directory (catalog config overlay)", process.cwd()).action(async (query, opts) => {
|
|
11006
|
-
const { openCatalogSource: openCatalogSource2, LocalCatalogDisabledError: LocalCatalogDisabledError2 } = await import('../open-library-
|
|
11006
|
+
const { openCatalogSource: openCatalogSource2, LocalCatalogDisabledError: LocalCatalogDisabledError2 } = await import('../open-library-JJGDEYYT.js');
|
|
11007
11007
|
const { getKnownKinds: getKnownKinds2 } = await import('../open-registry-X6YQVP7V.js');
|
|
11008
11008
|
const projectDir = path41__default.resolve(opts.projectDir);
|
|
11009
11009
|
if (opts.kind && !getKnownKinds2().has(opts.kind)) {
|
|
@@ -11062,8 +11062,8 @@ function makeStoreCommand() {
|
|
|
11062
11062
|
}
|
|
11063
11063
|
});
|
|
11064
11064
|
store.command("show <ref>").description("Show a store asset's details + provenance (source, files, integrity)").option("-C, --project-dir <dir>", "Project directory (catalog config overlay)", process.cwd()).action(async (ref, opts) => {
|
|
11065
|
-
const { openCatalogSource: openCatalogSource2, LocalCatalogDisabledError: LocalCatalogDisabledError2 } = await import('../open-library-
|
|
11066
|
-
const { supportsInstallManifest } = await import('../project-
|
|
11065
|
+
const { openCatalogSource: openCatalogSource2, LocalCatalogDisabledError: LocalCatalogDisabledError2 } = await import('../open-library-JJGDEYYT.js');
|
|
11066
|
+
const { supportsInstallManifest } = await import('../project-5HW3XSOE.js');
|
|
11067
11067
|
try {
|
|
11068
11068
|
parseAssetRef(ref);
|
|
11069
11069
|
} catch (e) {
|
|
@@ -12908,7 +12908,7 @@ async function bootstrapUserConfig() {
|
|
|
12908
12908
|
}
|
|
12909
12909
|
async function hydrateInitSources(resolved, created) {
|
|
12910
12910
|
try {
|
|
12911
|
-
const { ensureSourcesCloned } = await import('../ensure-sources-
|
|
12911
|
+
const { ensureSourcesCloned } = await import('../ensure-sources-N4E5EDGC.js');
|
|
12912
12912
|
const hydrate = ensureSourcesCloned(resolved, { quiet: true });
|
|
12913
12913
|
for (const n of hydrate.cloned) created.push(`~/.skaile/cache/sources/${n}/`);
|
|
12914
12914
|
if (hydrate.failed.length > 0) {
|
|
@@ -12948,7 +12948,7 @@ function printInitSummary(resolved, projectDir, created) {
|
|
|
12948
12948
|
console.log();
|
|
12949
12949
|
}
|
|
12950
12950
|
program.command("setup").description("Interactive provider setup wizard").action(async () => {
|
|
12951
|
-
const { cmdSetup } = await import('../setup-
|
|
12951
|
+
const { cmdSetup } = await import('../setup-52NDDR7C.js');
|
|
12952
12952
|
await cmdSetup([], { projectDir: process.cwd() });
|
|
12953
12953
|
});
|
|
12954
12954
|
program.addCommand(makeInstallCommand());
|
package/dist/connectors/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { AbstractConnector, BUILTIN_CONNECTOR_CATALOG, CONNECT_FAILURE_CARRY_OVER_TTL_MS, ConnectFailureCarryOver, ConnectorManager, FlowAdapter, LogBuffer, ManagedGitconfigCollisionError, NO_ACTIVE_FLOW_ERROR, PortPool, atomicReplaceCredential, buildConnectorListPayload, buildConnectorPromptSection, buildLazyFlowToolDefs, buildLazySdkFlowTools, buildSdkConnectorTools, buildSdkFlowTools, checkFleetMountLiveness, classifyConnectError, createFsWatcher, createWorktree, defaultSpawn, ensureDirMode, ensureFleetMounted, ensureRefreshAttemptStamp, findGitRoot, findMissingPackages, getConnector, installNpmPackages, isFleetManaged, isPackageResolvable, listConnectors, listWorktrees, missingTokenMediatorMessage, registerBuiltinConnectors, removeMountBlock, removeUnavailableMountBlock, renderCredentialHelperScript, resolveAccessPolicy, tryGetConnector, worktreeRegistry, writeHelperScript, writeMountBlock, writeUnavailableMountBlock } from '../chunk-
|
|
1
|
+
export { AbstractConnector, BUILTIN_CONNECTOR_CATALOG, CONNECT_FAILURE_CARRY_OVER_TTL_MS, ConnectFailureCarryOver, ConnectorManager, FlowAdapter, LogBuffer, ManagedGitconfigCollisionError, NO_ACTIVE_FLOW_ERROR, PortPool, atomicReplaceCredential, buildConnectorListPayload, buildConnectorPromptSection, buildLazyFlowToolDefs, buildLazySdkFlowTools, buildSdkConnectorTools, buildSdkFlowTools, checkFleetMountLiveness, classifyConnectError, createFsWatcher, createWorktree, defaultSpawn, ensureDirMode, ensureFleetMounted, ensureRefreshAttemptStamp, findGitRoot, findMissingPackages, getConnector, installNpmPackages, isFleetManaged, isPackageResolvable, listConnectors, listWorktrees, missingTokenMediatorMessage, registerBuiltinConnectors, removeMountBlock, removeUnavailableMountBlock, renderCredentialHelperScript, resolveAccessPolicy, tryGetConnector, worktreeRegistry, writeHelperScript, writeMountBlock, writeUnavailableMountBlock } from '../chunk-MUOSKYI2.js';
|
|
2
2
|
export { CONNECT_ERROR_KIND_PROPERTY, ClassifiedConnectError, declaredConnectErrorKind, withConnectErrorKind } from '../chunk-ZIW34FGO.js';
|
|
3
3
|
export { ConnectorFieldMissingError, ConnectorStartupError, EnvSecretProvider, ForgeSecretProvider, InMemorySecretProvider, LegacyAuthGrammarError, LockedSecretProvider, OAuthRequiredError, PreMintedSecretProvider, SecretProviderChain, createCliSecretProviderChain, createForgeSecretProviderChain, deriveSingleMaterializedConnectorDeclaration, fromMaterializedConnectorMd, isKnownSecretRef, loadConnectorDeclarations, loadMaterializedConnectorDeclarations, loadYamlConnectorDeclarations, readUnavailableMarker, resolveAuthRef, resolveBackendAuthFor, resolvedConfigToDeclarations, withMaterializedConnectorDeclarations } from '../chunk-MKTJZLQM.js';
|
|
4
4
|
import '../chunk-PQF5QHVS.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { connectorDescribe, connectorExec, connectorList, connectorLoadSkill, connectorRead, connectorSearch, connectorWrite, mountList, mountRead, mountStatus, mountSync } from './chunk-
|
|
1
|
+
export { connectorDescribe, connectorExec, connectorList, connectorLoadSkill, connectorRead, connectorSearch, connectorWrite, mountList, mountRead, mountStatus, mountSync } from './chunk-RNFHJUK7.js';
|
|
2
2
|
import './chunk-X5YPJV4N.js';
|
|
3
|
-
import './chunk-
|
|
3
|
+
import './chunk-MUOSKYI2.js';
|
|
4
4
|
import './chunk-ZIW34FGO.js';
|
|
5
5
|
import './chunk-MKTJZLQM.js';
|
|
6
6
|
import './chunk-PQF5QHVS.js';
|
|
@@ -41,5 +41,5 @@ import './chunk-MJHSLODD.js';
|
|
|
41
41
|
import './chunk-C3CAXQMA.js';
|
|
42
42
|
import './chunk-BOFL7GIF.js';
|
|
43
43
|
import './chunk-NSBPE2FW.js';
|
|
44
|
-
//# sourceMappingURL=connectors-
|
|
45
|
-
//# sourceMappingURL=connectors-
|
|
44
|
+
//# sourceMappingURL=connectors-TVFFE5H4.js.map
|
|
45
|
+
//# sourceMappingURL=connectors-TVFFE5H4.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"connectors-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"connectors-TVFFE5H4.js"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { logErr, logOk, logInfo } from './chunk-
|
|
2
|
-
import './chunk-
|
|
1
|
+
import { logErr, logOk, logInfo } from './chunk-GV3MFKDV.js';
|
|
2
|
+
import './chunk-R37L4BNR.js';
|
|
3
3
|
import './chunk-OOQ5Q75W.js';
|
|
4
4
|
import './chunk-NKDSU4Q7.js';
|
|
5
5
|
import './chunk-KRRHADE7.js';
|
|
@@ -92,5 +92,5 @@ function ensureSourcesCloned(projectDir, opts = {}) {
|
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
export { ensureSourcesCloned };
|
|
95
|
-
//# sourceMappingURL=ensure-sources-
|
|
96
|
-
//# sourceMappingURL=ensure-sources-
|
|
95
|
+
//# sourceMappingURL=ensure-sources-N4E5EDGC.js.map
|
|
96
|
+
//# sourceMappingURL=ensure-sources-N4E5EDGC.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../cli/src/ensure-sources.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,SAAS,gBAAgB,GAAA,EAAqB;AAC5C,EAAA,OAAY,IAAA,CAAA,IAAA,CAAK,iBAAA,EAAkB,EAAG,GAAG,CAAA;AAC3C;AASA,SAAS,kBAAA,CAAmB,UAAkB,KAAA,EAAsC;AAClF,EAAA,IAAI;AACF,IAAA,OAAO,mBAAA,CAAoB,IAAA,CAAK,QAAQ,CAAA,CAAE,UAAA,EAAW;AAAA,EACvD,SAAS,GAAA,EAAK;AACZ,IAAA,IAAI,CAAC,KAAA,EAAO;AACV,MAAA,MAAA,CAAO,CAAA,eAAA,EAAkB,QAAQ,CAAA,EAAA,EAAK,GAAA,YAAe,KAAA,GAAQ,IAAI,OAAA,GAAU,MAAA,CAAO,GAAG,CAAC,CAAA,CAAE,CAAA;AAAA,IAC1F;AACA,IAAA,OAAO,IAAA;AAAA,EACT;AACF;AAMA,SAAS,kBAAA,CAAmB,KAAA,EAAoB,KAAA,EAAgB,MAAA,EAA4B;AAC1F,EA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OAAO,MAAA;AACT","file":"ensure-sources-N4E5EDGC.js","sourcesContent":["/**\n * ensure-sources.ts — hydrate the `~/.skaile/cache/sources/` clone cache from a\n * project's `skaile.yaml` `sources:` entries.\n *\n * Called by `skaile init` (idempotent: no-op when no sources declared) and\n * `skaile install` so checking out a project pulls its source clones onto\n * the local machine.\n */\n\nimport { spawnSync } from \"node:child_process\";\nimport { existsSync, mkdirSync } from \"node:fs\";\nimport * as path from \"node:path\";\nimport {\n getGlobalCacheDir,\n type SourceEntry,\n sourceCacheKey,\n sourceShortName,\n WorkspaceYamlEditor,\n} from \"@skaile/workspaces/core\";\nimport { logErr, logInfo, logOk } from \"./helpers.ts\";\n\nfunction sourceClonePath(key: string): string {\n return path.join(getGlobalCacheDir(), key);\n}\n\nexport interface EnsureResult {\n cloned: string[];\n cached: string[];\n failed: string[];\n}\n\n/** Load `sources:` from a project's `skaile.yaml`, or `null` when unavailable. */\nfunction loadProjectSources(yamlPath: string, quiet: boolean): SourceEntry[] | null {\n try {\n return WorkspaceYamlEditor.load(yamlPath).getSources();\n } catch (err) {\n if (!quiet) {\n logErr(`Could not read ${yamlPath}: ${err instanceof Error ? err.message : String(err)}`);\n }\n return null;\n }\n}\n\n/**\n * Hydrate a single source entry into `result`: skip when already cached,\n * otherwise clone and record success/failure. Mutates `result` in place.\n */\nfunction hydrateSourceEntry(entry: SourceEntry, quiet: boolean, result: EnsureResult): void {\n const key = sourceCacheKey(entry.url);\n const slug = sourceShortName(entry.url);\n const dest = sourceClonePath(key);\n if (existsSync(dest)) {\n result.cached.push(slug);\n return;\n }\n mkdirSync(path.dirname(dest), { recursive: true });\n const args = [\"clone\", entry.url, dest];\n if (entry.pin) args.splice(1, 0, \"--branch\", entry.pin);\n const clone = spawnSync(\"git\", args, { stdio: quiet ? \"pipe\" : \"inherit\" });\n if (clone.status !== 0) {\n result.failed.push(slug);\n if (quiet) {\n logErr(`git clone failed for ${entry.url}`);\n }\n return;\n }\n result.cloned.push(slug);\n}\n\n/** Log a full-hydrate summary of cloned + reused-cached entries. */\nfunction logHydrateSummary(result: EnsureResult): void {\n for (const n of result.cloned) logOk(`Cloned source \"${n}\".`);\n if (result.cached.length > 0) {\n logInfo(`Reused cached clones: ${result.cached.join(\", \")}`);\n }\n}\n\n/**\n * Walk `projectDir/skaile.yaml` `sources:` and clone any entries whose\n * clone directory does not yet exist under `~/.skaile/cache/sources/`. Existing\n * clones are left untouched — this is hydration, not sync.\n *\n * Quiet by default: when `quiet: true` the helper only prints failures.\n * On full hydrate (`quiet: false`) it logs each cloned/cached entry.\n */\nexport function ensureSourcesCloned(\n projectDir: string,\n opts: { quiet?: boolean } = {},\n): EnsureResult {\n const result: EnsureResult = { cloned: [], cached: [], failed: [] };\n const yamlPath = path.join(projectDir, \"skaile.yaml\");\n if (!existsSync(yamlPath)) return result;\n\n const quiet = opts.quiet ?? false;\n const sources = loadProjectSources(yamlPath, quiet);\n if (sources === null) return result;\n if (sources.length === 0) return result;\n\n for (const entry of sources) {\n hydrateSourceEntry(entry, quiet, result);\n }\n\n if (!quiet) {\n logHydrateSummary(result);\n }\n\n return result;\n}\n"]}
|