@skaile/workspaces 3.26.0 → 3.27.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.
Files changed (148) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/dist/app-sdk/index.js +1 -1
  3. package/dist/{asset-feeds-ISSC2HYE.js → asset-feeds-QF7LGRUX.js} +4 -4
  4. package/dist/{asset-feeds-ISSC2HYE.js.map → asset-feeds-QF7LGRUX.js.map} +1 -1
  5. package/dist/asset-manager/index.js +1 -1
  6. package/dist/bridge/drivers/claude-sdk.js +3 -3
  7. package/dist/bridge/drivers/codex.js +1 -1
  8. package/dist/bridge/drivers/continue.js +2 -2
  9. package/dist/bridge/drivers/echo.js +3 -3
  10. package/dist/bridge/drivers/gemini.js +3 -3
  11. package/dist/bridge/drivers/goose.js +2 -2
  12. package/dist/bridge/drivers/omp.js +1 -1
  13. package/dist/bridge/drivers/opencode.js +2 -2
  14. package/dist/bridge/drivers/qwen.js +3 -3
  15. package/dist/bridge/index.js +4 -4
  16. package/dist/{chunk-ALSDJ6F4.js → chunk-2BK4N3FS.js} +2 -2
  17. package/dist/{chunk-ALSDJ6F4.js.map → chunk-2BK4N3FS.js.map} +1 -1
  18. package/dist/{chunk-3DOLXE4Z.js → chunk-3U3ZKYR7.js} +3 -3
  19. package/dist/{chunk-3DOLXE4Z.js.map → chunk-3U3ZKYR7.js.map} +1 -1
  20. package/dist/{chunk-CP62G5PK.js → chunk-53ORCYPJ.js} +347 -16
  21. package/dist/chunk-53ORCYPJ.js.map +1 -0
  22. package/dist/{chunk-U2QALNKX.js → chunk-72DG6GSB.js} +4 -4
  23. package/dist/{chunk-U2QALNKX.js.map → chunk-72DG6GSB.js.map} +1 -1
  24. package/dist/{chunk-EKFFTOQJ.js → chunk-773WLEXL.js} +2 -2
  25. package/dist/{chunk-EKFFTOQJ.js.map → chunk-773WLEXL.js.map} +1 -1
  26. package/dist/{chunk-A565EFTW.js → chunk-A3HTL7XV.js} +3 -3
  27. package/dist/{chunk-A565EFTW.js.map → chunk-A3HTL7XV.js.map} +1 -1
  28. package/dist/{chunk-DGPCBJNQ.js → chunk-AQW4BWNR.js} +2 -2
  29. package/dist/{chunk-DGPCBJNQ.js.map → chunk-AQW4BWNR.js.map} +1 -1
  30. package/dist/{chunk-NRKEZBVP.js → chunk-EB72L5ZL.js} +220 -12
  31. package/dist/chunk-EB72L5ZL.js.map +1 -0
  32. package/dist/{chunk-S3Z5KF6R.js → chunk-FACPWN6P.js} +4 -4
  33. package/dist/{chunk-S3Z5KF6R.js.map → chunk-FACPWN6P.js.map} +1 -1
  34. package/dist/{chunk-KFH5GCDB.js → chunk-FFE7YLYO.js} +4 -4
  35. package/dist/{chunk-KFH5GCDB.js.map → chunk-FFE7YLYO.js.map} +1 -1
  36. package/dist/{chunk-XHPWI6XF.js → chunk-FYIHH56K.js} +4 -4
  37. package/dist/{chunk-XHPWI6XF.js.map → chunk-FYIHH56K.js.map} +1 -1
  38. package/dist/{chunk-UOERRCR3.js → chunk-J3IXRPZB.js} +6 -6
  39. package/dist/{chunk-UOERRCR3.js.map → chunk-J3IXRPZB.js.map} +1 -1
  40. package/dist/{chunk-W5LPG3X6.js → chunk-JMYOJ3PA.js} +5 -3
  41. package/dist/chunk-JMYOJ3PA.js.map +1 -0
  42. package/dist/{chunk-2FDKUKDE.js → chunk-M6VQU5TS.js} +3 -3
  43. package/dist/{chunk-2FDKUKDE.js.map → chunk-M6VQU5TS.js.map} +1 -1
  44. package/dist/{chunk-NQG77HXO.js → chunk-MQASB52N.js} +3 -3
  45. package/dist/{chunk-NQG77HXO.js.map → chunk-MQASB52N.js.map} +1 -1
  46. package/dist/{chunk-Q6SWQEF7.js → chunk-QSPCI4W2.js} +34 -13
  47. package/dist/chunk-QSPCI4W2.js.map +1 -0
  48. package/dist/{chunk-YCMHWNZA.js → chunk-TIOT3ZOQ.js} +3 -3
  49. package/dist/{chunk-YCMHWNZA.js.map → chunk-TIOT3ZOQ.js.map} +1 -1
  50. package/dist/{chunk-5SXY4B65.js → chunk-UL4LD7KD.js} +3 -3
  51. package/dist/{chunk-5SXY4B65.js.map → chunk-UL4LD7KD.js.map} +1 -1
  52. package/dist/{chunk-GLOHIJ7B.js → chunk-VN7DELUT.js} +3 -3
  53. package/dist/{chunk-GLOHIJ7B.js.map → chunk-VN7DELUT.js.map} +1 -1
  54. package/dist/{chunk-UQTPSVJV.js → chunk-WJVBJAM5.js} +6 -6
  55. package/dist/{chunk-UQTPSVJV.js.map → chunk-WJVBJAM5.js.map} +1 -1
  56. package/dist/{chunk-AY4OKT3U.js → chunk-WWGU3REE.js} +2 -2
  57. package/dist/{chunk-AY4OKT3U.js.map → chunk-WWGU3REE.js.map} +1 -1
  58. package/dist/{chunk-RPE5VYB6.js → chunk-XMULHVKX.js} +4 -4
  59. package/dist/{chunk-RPE5VYB6.js.map → chunk-XMULHVKX.js.map} +1 -1
  60. package/dist/{chunk-XGO6CP5S.js → chunk-ZEXYTJ6Y.js} +4 -4
  61. package/dist/{chunk-XGO6CP5S.js.map → chunk-ZEXYTJ6Y.js.map} +1 -1
  62. package/dist/cli/index.js +37 -37
  63. package/dist/connectors/index.js +8 -8
  64. package/dist/{ensure-sources-YH6X5XI4.js → ensure-sources-GEJGBQIP.js} +4 -4
  65. package/dist/{ensure-sources-YH6X5XI4.js.map → ensure-sources-GEJGBQIP.js.map} +1 -1
  66. package/dist/factory-assets/connectors/box.js +8 -8
  67. package/dist/factory-assets/connectors/deploy.js +8 -8
  68. package/dist/factory-assets/connectors/devserver.js +8 -8
  69. package/dist/factory-assets/connectors/flow/adapter.d.ts.map +1 -1
  70. package/dist/factory-assets/connectors/flow/adapter.js +8 -8
  71. package/dist/factory-assets/connectors/flow/classifier-subprompt-runner.d.ts +40 -0
  72. package/dist/factory-assets/connectors/flow/classifier-subprompt-runner.d.ts.map +1 -0
  73. package/dist/factory-assets/connectors/flow/contract/classifier.d.ts +60 -0
  74. package/dist/factory-assets/connectors/flow/contract/classifier.d.ts.map +1 -0
  75. package/dist/factory-assets/connectors/flow/contract/expression.d.ts +22 -0
  76. package/dist/factory-assets/connectors/flow/contract/expression.d.ts.map +1 -1
  77. package/dist/factory-assets/connectors/flow/contract/index.d.ts +2 -1
  78. package/dist/factory-assets/connectors/flow/contract/index.d.ts.map +1 -1
  79. package/dist/factory-assets/connectors/flow/contract/schema.d.ts.map +1 -1
  80. package/dist/factory-assets/connectors/flow/contract.js +3 -3
  81. package/dist/factory-assets/connectors/flow/engine/engine.d.ts.map +1 -1
  82. package/dist/factory-assets/connectors/flow/engine/router-settlement.d.ts +9 -1
  83. package/dist/factory-assets/connectors/flow/engine/router-settlement.d.ts.map +1 -1
  84. package/dist/factory-assets/connectors/flow/engine.js +2 -2
  85. package/dist/factory-assets/connectors/flow/index.d.ts +1 -0
  86. package/dist/factory-assets/connectors/flow/index.d.ts.map +1 -1
  87. package/dist/factory-assets/connectors/flow/run-flow.js +9 -9
  88. package/dist/factory-assets/connectors/flow/subprompt-runner.d.ts +7 -0
  89. package/dist/factory-assets/connectors/flow/subprompt-runner.d.ts.map +1 -1
  90. package/dist/factory-assets/connectors/flow.js +8 -8
  91. package/dist/factory-assets/connectors/git.js +8 -8
  92. package/dist/factory-assets/connectors/gmail.js +8 -8
  93. package/dist/factory-assets/connectors/googledrive.js +8 -8
  94. package/dist/factory-assets/connectors/local.js +8 -8
  95. package/dist/factory-assets/connectors/mattermost.js +8 -8
  96. package/dist/factory-assets/connectors/memory.js +8 -8
  97. package/dist/factory-assets/connectors/minio.js +8 -8
  98. package/dist/factory-assets/connectors/postgres.js +8 -8
  99. package/dist/factory-assets/connectors/s3.js +8 -8
  100. package/dist/factory-assets/connectors/sharepoint.js +8 -8
  101. package/dist/factory-assets/connectors/sqlite.js +8 -8
  102. package/dist/factory-assets/connectors/static-server.js +8 -8
  103. package/dist/factory-assets/connectors/tunnel.js +8 -8
  104. package/dist/factory-assets/connectors/webdav.js +8 -8
  105. package/dist/factory-assets/connectors/xstate-store.js +8 -8
  106. package/dist/factory-assets/connectors/xstate.js +8 -8
  107. package/dist/{flows-4DYGXE4A.js → flows-MI2VM5JZ.js} +3 -3
  108. package/dist/{flows-4DYGXE4A.js.map → flows-MI2VM5JZ.js.map} +1 -1
  109. package/dist/{helpers-EJEK6NN6.js → helpers-DXZOHX25.js} +4 -4
  110. package/dist/{helpers-EJEK6NN6.js.map → helpers-DXZOHX25.js.map} +1 -1
  111. package/dist/{library-publish-66FHWXAA.js → library-publish-CUPDG5NI.js} +8 -8
  112. package/dist/{library-publish-66FHWXAA.js.map → library-publish-CUPDG5NI.js.map} +1 -1
  113. package/dist/{open-library-4W2UGVJN.js → open-library-32XAI2LH.js} +7 -7
  114. package/dist/{open-library-4W2UGVJN.js.map → open-library-32XAI2LH.js.map} +1 -1
  115. package/dist/{project-6OECVELE.js → project-RRHUCVXW.js} +5 -5
  116. package/dist/{project-6OECVELE.js.map → project-RRHUCVXW.js.map} +1 -1
  117. package/dist/runner/index.js +14 -14
  118. package/dist/runner/src/serve.d.ts.map +1 -1
  119. package/dist/sdk/asset-manager.js +1 -1
  120. package/dist/sdk/bridge.js +4 -4
  121. package/dist/sdk/flow.js +2 -2
  122. package/dist/sdk/index.js +14 -14
  123. package/dist/sdk/runner.js +14 -14
  124. package/dist/sdk/session.js +2 -2
  125. package/dist/sdk/types.js +1 -1
  126. package/dist/session/index.js +2 -2
  127. package/dist/{setup-6IEVFDWB.js → setup-CIRH5BYB.js} +6 -6
  128. package/dist/{setup-6IEVFDWB.js.map → setup-CIRH5BYB.js.map} +1 -1
  129. package/dist/{source-HJQNRGTP.js → source-RHQLCTWA.js} +8 -8
  130. package/dist/{source-HJQNRGTP.js.map → source-RHQLCTWA.js.map} +1 -1
  131. package/dist/{source-manifest-publish-VU4BGFDU.js → source-manifest-publish-DXMCSKU7.js} +9 -9
  132. package/dist/{source-manifest-publish-VU4BGFDU.js.map → source-manifest-publish-DXMCSKU7.js.map} +1 -1
  133. package/dist/tui/index.js +14 -14
  134. package/dist/types/index.js +1 -1
  135. package/dist/types/src/flow.d.ts +99 -0
  136. package/dist/types/src/flow.d.ts.map +1 -1
  137. package/dist/types/src/index.d.ts +1 -1
  138. package/dist/types/src/index.d.ts.map +1 -1
  139. package/dist/types/src/version.d.ts +8 -1
  140. package/dist/types/src/version.d.ts.map +1 -1
  141. package/dist/workspace-plugin/adapters/mcp.js +3 -3
  142. package/dist/workspace-plugin/adapters/omp.js +3 -3
  143. package/dist/workspace-plugin/index.js +1 -1
  144. package/package.json +1 -1
  145. package/dist/chunk-CP62G5PK.js.map +0 -1
  146. package/dist/chunk-NRKEZBVP.js.map +0 -1
  147. package/dist/chunk-Q6SWQEF7.js.map +0 -1
  148. package/dist/chunk-W5LPG3X6.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { InputSchema } from './chunk-CP62G5PK.js';
1
+ import { InputSchema } from './chunk-53ORCYPJ.js';
2
2
 
3
3
  // factory-assets/connectors/flow/contract/input-schema.ts
4
4
  var INPUT_SCHEMA_SHAPES_HINT = "{ kind: 'text', multiline? }, { kind: 'choice', options: [{ id, label, description? }], multiple? }, { kind: 'form', fields: [{ id, label, type: text|textarea|number|choice|file|date|boolean, required?, options?, accept? }] }, or { kind: 'file', accept?, maxSize?, multiple? }";
@@ -189,5 +189,5 @@ function describe(value) {
189
189
  }
190
190
 
191
191
  export { INPUT_SCHEMA_SHAPES_HINT, coerceInputSchema };
192
- //# sourceMappingURL=chunk-YCMHWNZA.js.map
193
- //# sourceMappingURL=chunk-YCMHWNZA.js.map
192
+ //# sourceMappingURL=chunk-TIOT3ZOQ.js.map
193
+ //# sourceMappingURL=chunk-TIOT3ZOQ.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../factory-assets/connectors/flow/contract/input-schema.ts"],"names":[],"mappings":";;;AAwBO,IAAM,wBAAA,GACX;AAYF,IAAM,WAAA,GAAc,CAAC,MAAA,EAAQ,QAAA,EAAU,QAAQ,MAAM,CAAA;AAkB9C,SAAS,kBAAkB,KAA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OAAO,GAAA,KAAQ,EAAA,GAAK,MAAA,CAAO,OAAO,CAAA,GAAI,GAAG,GAAG,CAAA,CAAA,EAAI,MAAA,CAAO,OAAO,CAAC,CAAA,CAAA;AAAA,IACjE,GAAG,EAAE,CAAA;AACL,IAAA,OAAO,GAAG,IAAA,KAAS,EAAA,GAAK,WAAW,IAAI,CAAA,EAAA,EAAK,MAAM,OAAO,CAAA,CAAA;AAAA,EAC3D,CAAC,CAAA;AACH;AAEA,SAAS,cAAc,KAAA,EAAkD;AACvE,EAAA,OAAO,OAAO,UAAU,QAAA,IAAY,KAAA,KAAU,QAAQ,CAAC,KAAA,CAAM,QAAQ,KAAK,CAAA;AAC5E;AAEA,SAAS,SAAS,KAAA,EAAwB;AACxC,EAAA,IAAI,KAAA,KAAU,QAAW,OAAO,SAAA;AAChC,EAAA,IAAI,KAAA,KAAU,MAAM,OAAO,MAAA;AAC3B,EAAA,IAAI,KAAA,CAAM,OAAA,CAAQ,KAAK,CAAA,EAAG,OAAO,UAAA;AACjC,EAAA,IAAI,OAAO,UAAU,QAAA,EAAU,OAAO,cAAc,IAAA,CAAK,SAAA,CAAU,KAAK,CAAC,CAAA,CAAA;AACzE,EAAA,IAAI,OAAO,KAAA,KAAU,QAAA,EAAU,OAAO,WAAA;AACtC,EAAA,OAAO,GAAG,OAAO,KAAK,CAAA,CAAA,EAAI,MAAA,CAAO,KAAK,CAAC,CAAA,CAAA;AACzC","file":"chunk-YCMHWNZA.js","sourcesContent":["/**\n * Coercion of an agent-supplied `request_input` schema onto the flow contract.\n *\n * `request_input` used to cast whatever the agent passed straight into\n * `InputSchema`, so a choice gate could be persisted with option ids no host\n * could render — a run parked forever on a question no human could answer.\n * This module tolerates the shapes agents actually reach for (a bare string per\n * option, an option with a label and no id) and refuses the rest, because a\n * refusal the agent can read and retry beats a stored gate nobody can answer.\n *\n * Exported because hosts normalize the same payloads when they read a stored\n * gate; one shared rule is what keeps the write and read sides in agreement.\n */\n\nimport type { InputSchema } from \"@skaile/workspaces/types\";\nimport type * as z from \"zod\";\nimport { InputSchema as InputSchemaContract } from \"./schema.js\";\n\n/**\n * The shapes `request_input` accepts, phrased for an agent retrying a refused\n * call. Every optional key the contract admits is listed, because validation is\n * strict: an agent refused for one unknown key would otherwise read a key it\n * omitted here as illegal too.\n */\nexport const INPUT_SCHEMA_SHAPES_HINT =\n \"{ kind: 'text', multiline? }, { kind: 'choice', options: [{ id, label, description? }], multiple? }, { kind: 'form', fields: [{ id, label, type: text|textarea|number|choice|file|date|boolean, required?, options?, accept? }] }, or { kind: 'file', accept?, maxSize?, multiple? }\";\n\n/**\n * Outcome of {@link coerceInputSchema}: either a schema in the contract shape,\n * or the reasons it was refused — one entry per problem, each naming its path,\n * closed by a final entry naming the accepted shapes. The hint travels with the\n * issues so every caller's refusal is actionable without re-appending it.\n */\nexport type InputSchemaCoercion =\n | { ok: true; schema: InputSchema }\n | { ok: false; issues: string[] };\n\nconst KNOWN_KINDS = [\"text\", \"choice\", \"form\", \"file\"] as const;\n\n/** A coerced option or form field, and whether its id was derived from its label. */\ntype Prepared = { entry: Record<string, unknown>; derivedId: boolean };\n\n/**\n * Brings an untrusted `request_input` schema into the `InputSchema` contract.\n *\n * Tolerated: a JSON string wrapper, a choice option given as a bare string, and\n * an option or form field whose id is missing but whose label can supply one.\n * Refused: an unknown `kind`, an option or field that carries no usable label, a\n * duplicate explicit id, an id or label of the wrong type, and a choice or form\n * with nothing to answer — anything a host could not turn into an answerable\n * control. Options are never dropped: every unusable one produces an issue.\n *\n * @param value Raw `schema` argument as the agent supplied it.\n * @returns The contract-shaped schema, or the issues that make it unanswerable.\n */\nexport function coerceInputSchema(value: unknown): InputSchemaCoercion {\n let candidate: unknown = value;\n if (typeof candidate === \"string\") {\n try {\n candidate = JSON.parse(candidate);\n } catch {\n // A free-text box is still answerable, so an unparseable string keeps the\n // fallback it has always had rather than failing the agent's turn.\n return { ok: true, schema: { kind: \"text\" } };\n }\n }\n if (candidate === null || typeof candidate !== \"object\") {\n return { ok: true, schema: { kind: \"text\" } };\n }\n if (Array.isArray(candidate)) {\n return refuse([\n \"schema: expected an object with a `kind`, got an array — a bare option list needs { kind: 'choice', options: [...] }\",\n ]);\n }\n\n const raw = candidate as Record<string, unknown>;\n const kind = raw.kind;\n // An unknown kind is refused rather than degraded to text: text would discard\n // the agent's intent and hand the user a box the flow cannot consume.\n if (typeof kind !== \"string\" || !KNOWN_KINDS.some((known) => known === kind)) {\n return refuse([\n `schema.kind: expected one of ${KNOWN_KINDS.join(\", \")}, got ${describe(kind)}`,\n ]);\n }\n\n const issues: string[] = [];\n const prepared =\n kind === \"choice\"\n ? prepareChoice(raw, issues)\n : kind === \"form\"\n ? prepareForm(raw, issues)\n : raw;\n if (issues.length > 0) return refuse(issues);\n\n const parsed = InputSchemaContract.safeParse(prepared);\n if (!parsed.success) return refuse(formatIssues(parsed.error.issues));\n return { ok: true, schema: parsed.data };\n}\n\n/** Closes a refusal with the accepted shapes, so no caller has to know to add them. */\nfunction refuse(issues: string[]): InputSchemaCoercion {\n return { ok: false, issues: [...issues, `valid shapes: ${INPUT_SCHEMA_SHAPES_HINT}`] };\n}\n\nfunction prepareChoice(raw: Record<string, unknown>, issues: string[]): Record<string, unknown> {\n const options = raw.options;\n if (!Array.isArray(options)) {\n issues.push(`options: expected an array of choices, got ${describe(options)}`);\n return raw;\n }\n if (options.length === 0) {\n issues.push(\n \"options: expected at least one choice — a choice gate with none cannot be answered\",\n );\n return raw;\n }\n return { ...raw, options: coerceChoices(options, \"options\", issues) };\n}\n\nfunction prepareForm(raw: Record<string, unknown>, issues: string[]): Record<string, unknown> {\n const fields = raw.fields;\n if (!Array.isArray(fields)) {\n issues.push(`fields: expected an array of form fields, got ${describe(fields)}`);\n return raw;\n }\n // A form with no fields is as unanswerable as a choice with no options.\n if (fields.length === 0) {\n issues.push(\"fields: expected at least one field — a form gate with none cannot be answered\");\n return raw;\n }\n const prepared = fields.map((field, index) => coerceField(field, `fields[${index}]`, issues));\n return { ...raw, fields: settleIds(prepared, \"fields\", issues) };\n}\n\nfunction coerceChoices(\n options: unknown[],\n path: string,\n issues: string[],\n): Record<string, unknown>[] {\n const prepared = options.map((option, index) =>\n coerceChoice(option, `${path}[${index}]`, issues),\n );\n return settleIds(prepared, path, issues);\n}\n\nfunction coerceChoice(option: unknown, at: string, issues: string[]): Prepared | undefined {\n if (typeof option === \"string\") {\n const label = option.trim();\n if (label === \"\") {\n issues.push(`${at}: expected a non-empty string`);\n return undefined;\n }\n return { entry: { id: label, label }, derivedId: true };\n }\n if (!isPlainObject(option)) {\n issues.push(\n `${at}: expected a string or an object with { id, label }, got ${describe(option)}`,\n );\n return undefined;\n }\n const identity = coerceIdentity(option, at, issues);\n if (!identity) return undefined;\n const entry: Record<string, unknown> = { ...option, id: identity.id, label: identity.label };\n const { description } = entry;\n // An absent, null, or blank description carries nothing; the contract admits\n // only a non-empty string, and anything else stays for it to reject.\n if (\n description === null ||\n description === undefined ||\n (typeof description === \"string\" && description.trim() === \"\")\n ) {\n delete entry.description;\n }\n return { entry, derivedId: identity.derivedId };\n}\n\nfunction coerceField(field: unknown, at: string, issues: string[]): Prepared | undefined {\n if (!isPlainObject(field)) {\n issues.push(`${at}: expected an object with { id, label, type }, got ${describe(field)}`);\n return undefined;\n }\n const identity = coerceIdentity(field, at, issues);\n if (!identity) return undefined;\n const entry: Record<string, unknown> = { ...field, id: identity.id, label: identity.label };\n const options = field.options;\n // A select with nothing to select is the same unrenderable control a choice\n // gate with no options is, one level down.\n if (field.type === \"choice\" && (!Array.isArray(options) || options.length === 0)) {\n issues.push(\n `${at}.options: expected at least one choice — a choice field with none cannot be answered`,\n );\n return undefined;\n }\n if (Array.isArray(options)) {\n entry.options = coerceChoices(options, `${at}.options`, issues);\n }\n return { entry, derivedId: identity.derivedId };\n}\n\n/**\n * Resolves the `id`/`label` pair of an option or field, letting either supply\n * the other. An id or label of the wrong type is refused rather than replaced:\n * silently swapping in a different id is the failure this module exists to stop\n * — an agent that branches on the id it wrote would never see the substitution.\n */\nfunction coerceIdentity(\n raw: Record<string, unknown>,\n at: string,\n issues: string[],\n): { id: string; label: string; derivedId: boolean } | undefined {\n const id = explicitText(raw.id, at, \"id\", issues);\n const label = explicitText(raw.label, at, \"label\", issues);\n if (!id.ok || !label.ok) return undefined;\n const text = label.value ?? id.value;\n if (text === undefined) {\n issues.push(`${at}: expected a non-empty \\`label\\`, got ${describe(raw.label)}`);\n return undefined;\n }\n return { id: id.value ?? text, label: text, derivedId: id.value === undefined };\n}\n\n/**\n * An explicit `id`/`label`, or `undefined` when the agent supplied nothing to\n * carry (absent, null, or blank). Any other type is intent in the wrong shape,\n * so it is reported instead of dropped.\n */\nfunction explicitText(\n value: unknown,\n at: string,\n key: \"id\" | \"label\",\n issues: string[],\n): { ok: true; value: string | undefined } | { ok: false } {\n if (value === undefined || value === null) return { ok: true, value: undefined };\n if (typeof value !== \"string\") {\n issues.push(`${at}.${key}: expected a non-empty string, got ${describe(value)}`);\n return { ok: false };\n }\n const trimmed = value.trim();\n return { ok: true, value: trimmed === \"\" ? undefined : trimmed };\n}\n\n/**\n * Settles ids across a list of options or fields. Every explicit id is reserved\n * before any derived one is filled in, so a collision's verdict cannot depend on\n * which side of it came first — and a refusal never names an id the agent did\n * not write.\n */\nfunction settleIds(\n prepared: (Prepared | undefined)[],\n path: string,\n issues: string[],\n): Record<string, unknown>[] {\n const used = new Set<string>();\n const reserved = prepared.map((item, index) => {\n if (!item || item.derivedId) return item;\n const id = String(item.entry.id);\n if (used.has(id)) {\n issues.push(\n `${path}[${index}]: duplicate id \"${id}\" — ids must be unique or a host cannot tell the answers apart`,\n );\n return undefined;\n }\n used.add(id);\n return item;\n });\n\n const settled: Record<string, unknown>[] = [];\n reserved.forEach((item, index) => {\n if (!item) return;\n if (item.derivedId) item.entry.id = uniqueId(String(item.entry.id), index, used);\n used.add(String(item.entry.id));\n settled.push(item.entry);\n });\n return settled;\n}\n\nfunction uniqueId(base: string, index: number, used: Set<string>): string {\n if (!used.has(base)) return base;\n // Two options can legitimately share a label; the index disambiguates the id\n // derived from it so the answer stays unambiguous.\n let attempt = index;\n let candidate = `${base}-${attempt}`;\n while (used.has(candidate)) {\n attempt += 1;\n candidate = `${base}-${attempt}`;\n }\n return candidate;\n}\n\nfunction formatIssues(issues: readonly z.core.$ZodIssue[]): string[] {\n return issues.map((issue) => {\n const path = issue.path.reduce<string>((acc, segment) => {\n if (typeof segment === \"number\") return `${acc}[${segment}]`;\n return acc === \"\" ? String(segment) : `${acc}.${String(segment)}`;\n }, \"\");\n return `${path === \"\" ? \"schema\" : path}: ${issue.message}`;\n });\n}\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction describe(value: unknown): string {\n if (value === undefined) return \"nothing\";\n if (value === null) return \"null\";\n if (Array.isArray(value)) return \"an array\";\n if (typeof value === \"string\") return `the string ${JSON.stringify(value)}`;\n if (typeof value === \"object\") return \"an object\";\n return `${typeof value} ${String(value)}`;\n}\n"]}
1
+ {"version":3,"sources":["../factory-assets/connectors/flow/contract/input-schema.ts"],"names":[],"mappings":";;;AAwBO,IAAM,wBAAA,GACX;AAYF,IAAM,WAAA,GAAc,CAAC,MAAA,EAAQ,QAAA,EAAU,QAAQ,MAAM,CAAA;AAkB9C,SAAS,kBAAkB,KAAA,EAAqC;AACrE,EAAA,IAAI,SAAA,GAAqB,KAAA;AACzB,EAAA,IAAI,OAAO,cAAc,QAAA,EAAU;AACjC,IAAA,IAAI;AACF,MAAA,SAAA,GAAY,IAAA,CAAK,MAAM,SAAS,CAAA;AAAA,IAClC,CAAA,CAAA,MAAQ;AAGN,MAAA,OAAO,EAAE,EAAA,EAAI,IAAA,EAAM,QAAQ,EAAE,IAAA,EAAM,QAAO,EAAE;AAAA,IAC9C;AAAA,EACF;AACA,EAAA,IAAI,SAAA,KAAc,IAAA,IAAQ,OAAO,SAAA,KAAc,QAAA,EAAU;AACvD,IAAA,OAAO,EAAE,EAA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AAQ,KAAK,CAAA;AAC5E;AAEA,SAAS,SAAS,KAAA,EAAwB;AACxC,EAAA,IAAI,KAAA,KAAU,QAAW,OAAO,SAAA;AAChC,EAAA,IAAI,KAAA,KAAU,MAAM,OAAO,MAAA;AAC3B,EAAA,IAAI,KAAA,CAAM,OAAA,CAAQ,KAAK,CAAA,EAAG,OAAO,UAAA;AACjC,EAAA,IAAI,OAAO,UAAU,QAAA,EAAU,OAAO,cAAc,IAAA,CAAK,SAAA,CAAU,KAAK,CAAC,CAAA,CAAA;AACzE,EAAA,IAAI,OAAO,KAAA,KAAU,QAAA,EAAU,OAAO,WAAA;AACtC,EAAA,OAAO,GAAG,OAAO,KAAK,CAAA,CAAA,EAAI,MAAA,CAAO,KAAK,CAAC,CAAA,CAAA;AACzC","file":"chunk-TIOT3ZOQ.js","sourcesContent":["/**\n * Coercion of an agent-supplied `request_input` schema onto the flow contract.\n *\n * `request_input` used to cast whatever the agent passed straight into\n * `InputSchema`, so a choice gate could be persisted with option ids no host\n * could render — a run parked forever on a question no human could answer.\n * This module tolerates the shapes agents actually reach for (a bare string per\n * option, an option with a label and no id) and refuses the rest, because a\n * refusal the agent can read and retry beats a stored gate nobody can answer.\n *\n * Exported because hosts normalize the same payloads when they read a stored\n * gate; one shared rule is what keeps the write and read sides in agreement.\n */\n\nimport type { InputSchema } from \"@skaile/workspaces/types\";\nimport type * as z from \"zod\";\nimport { InputSchema as InputSchemaContract } from \"./schema.js\";\n\n/**\n * The shapes `request_input` accepts, phrased for an agent retrying a refused\n * call. Every optional key the contract admits is listed, because validation is\n * strict: an agent refused for one unknown key would otherwise read a key it\n * omitted here as illegal too.\n */\nexport const INPUT_SCHEMA_SHAPES_HINT =\n \"{ kind: 'text', multiline? }, { kind: 'choice', options: [{ id, label, description? }], multiple? }, { kind: 'form', fields: [{ id, label, type: text|textarea|number|choice|file|date|boolean, required?, options?, accept? }] }, or { kind: 'file', accept?, maxSize?, multiple? }\";\n\n/**\n * Outcome of {@link coerceInputSchema}: either a schema in the contract shape,\n * or the reasons it was refused — one entry per problem, each naming its path,\n * closed by a final entry naming the accepted shapes. The hint travels with the\n * issues so every caller's refusal is actionable without re-appending it.\n */\nexport type InputSchemaCoercion =\n | { ok: true; schema: InputSchema }\n | { ok: false; issues: string[] };\n\nconst KNOWN_KINDS = [\"text\", \"choice\", \"form\", \"file\"] as const;\n\n/** A coerced option or form field, and whether its id was derived from its label. */\ntype Prepared = { entry: Record<string, unknown>; derivedId: boolean };\n\n/**\n * Brings an untrusted `request_input` schema into the `InputSchema` contract.\n *\n * Tolerated: a JSON string wrapper, a choice option given as a bare string, and\n * an option or form field whose id is missing but whose label can supply one.\n * Refused: an unknown `kind`, an option or field that carries no usable label, a\n * duplicate explicit id, an id or label of the wrong type, and a choice or form\n * with nothing to answer — anything a host could not turn into an answerable\n * control. Options are never dropped: every unusable one produces an issue.\n *\n * @param value Raw `schema` argument as the agent supplied it.\n * @returns The contract-shaped schema, or the issues that make it unanswerable.\n */\nexport function coerceInputSchema(value: unknown): InputSchemaCoercion {\n let candidate: unknown = value;\n if (typeof candidate === \"string\") {\n try {\n candidate = JSON.parse(candidate);\n } catch {\n // A free-text box is still answerable, so an unparseable string keeps the\n // fallback it has always had rather than failing the agent's turn.\n return { ok: true, schema: { kind: \"text\" } };\n }\n }\n if (candidate === null || typeof candidate !== \"object\") {\n return { ok: true, schema: { kind: \"text\" } };\n }\n if (Array.isArray(candidate)) {\n return refuse([\n \"schema: expected an object with a `kind`, got an array — a bare option list needs { kind: 'choice', options: [...] }\",\n ]);\n }\n\n const raw = candidate as Record<string, unknown>;\n const kind = raw.kind;\n // An unknown kind is refused rather than degraded to text: text would discard\n // the agent's intent and hand the user a box the flow cannot consume.\n if (typeof kind !== \"string\" || !KNOWN_KINDS.some((known) => known === kind)) {\n return refuse([\n `schema.kind: expected one of ${KNOWN_KINDS.join(\", \")}, got ${describe(kind)}`,\n ]);\n }\n\n const issues: string[] = [];\n const prepared =\n kind === \"choice\"\n ? prepareChoice(raw, issues)\n : kind === \"form\"\n ? prepareForm(raw, issues)\n : raw;\n if (issues.length > 0) return refuse(issues);\n\n const parsed = InputSchemaContract.safeParse(prepared);\n if (!parsed.success) return refuse(formatIssues(parsed.error.issues));\n return { ok: true, schema: parsed.data };\n}\n\n/** Closes a refusal with the accepted shapes, so no caller has to know to add them. */\nfunction refuse(issues: string[]): InputSchemaCoercion {\n return { ok: false, issues: [...issues, `valid shapes: ${INPUT_SCHEMA_SHAPES_HINT}`] };\n}\n\nfunction prepareChoice(raw: Record<string, unknown>, issues: string[]): Record<string, unknown> {\n const options = raw.options;\n if (!Array.isArray(options)) {\n issues.push(`options: expected an array of choices, got ${describe(options)}`);\n return raw;\n }\n if (options.length === 0) {\n issues.push(\n \"options: expected at least one choice — a choice gate with none cannot be answered\",\n );\n return raw;\n }\n return { ...raw, options: coerceChoices(options, \"options\", issues) };\n}\n\nfunction prepareForm(raw: Record<string, unknown>, issues: string[]): Record<string, unknown> {\n const fields = raw.fields;\n if (!Array.isArray(fields)) {\n issues.push(`fields: expected an array of form fields, got ${describe(fields)}`);\n return raw;\n }\n // A form with no fields is as unanswerable as a choice with no options.\n if (fields.length === 0) {\n issues.push(\"fields: expected at least one field — a form gate with none cannot be answered\");\n return raw;\n }\n const prepared = fields.map((field, index) => coerceField(field, `fields[${index}]`, issues));\n return { ...raw, fields: settleIds(prepared, \"fields\", issues) };\n}\n\nfunction coerceChoices(\n options: unknown[],\n path: string,\n issues: string[],\n): Record<string, unknown>[] {\n const prepared = options.map((option, index) =>\n coerceChoice(option, `${path}[${index}]`, issues),\n );\n return settleIds(prepared, path, issues);\n}\n\nfunction coerceChoice(option: unknown, at: string, issues: string[]): Prepared | undefined {\n if (typeof option === \"string\") {\n const label = option.trim();\n if (label === \"\") {\n issues.push(`${at}: expected a non-empty string`);\n return undefined;\n }\n return { entry: { id: label, label }, derivedId: true };\n }\n if (!isPlainObject(option)) {\n issues.push(\n `${at}: expected a string or an object with { id, label }, got ${describe(option)}`,\n );\n return undefined;\n }\n const identity = coerceIdentity(option, at, issues);\n if (!identity) return undefined;\n const entry: Record<string, unknown> = { ...option, id: identity.id, label: identity.label };\n const { description } = entry;\n // An absent, null, or blank description carries nothing; the contract admits\n // only a non-empty string, and anything else stays for it to reject.\n if (\n description === null ||\n description === undefined ||\n (typeof description === \"string\" && description.trim() === \"\")\n ) {\n delete entry.description;\n }\n return { entry, derivedId: identity.derivedId };\n}\n\nfunction coerceField(field: unknown, at: string, issues: string[]): Prepared | undefined {\n if (!isPlainObject(field)) {\n issues.push(`${at}: expected an object with { id, label, type }, got ${describe(field)}`);\n return undefined;\n }\n const identity = coerceIdentity(field, at, issues);\n if (!identity) return undefined;\n const entry: Record<string, unknown> = { ...field, id: identity.id, label: identity.label };\n const options = field.options;\n // A select with nothing to select is the same unrenderable control a choice\n // gate with no options is, one level down.\n if (field.type === \"choice\" && (!Array.isArray(options) || options.length === 0)) {\n issues.push(\n `${at}.options: expected at least one choice — a choice field with none cannot be answered`,\n );\n return undefined;\n }\n if (Array.isArray(options)) {\n entry.options = coerceChoices(options, `${at}.options`, issues);\n }\n return { entry, derivedId: identity.derivedId };\n}\n\n/**\n * Resolves the `id`/`label` pair of an option or field, letting either supply\n * the other. An id or label of the wrong type is refused rather than replaced:\n * silently swapping in a different id is the failure this module exists to stop\n * — an agent that branches on the id it wrote would never see the substitution.\n */\nfunction coerceIdentity(\n raw: Record<string, unknown>,\n at: string,\n issues: string[],\n): { id: string; label: string; derivedId: boolean } | undefined {\n const id = explicitText(raw.id, at, \"id\", issues);\n const label = explicitText(raw.label, at, \"label\", issues);\n if (!id.ok || !label.ok) return undefined;\n const text = label.value ?? id.value;\n if (text === undefined) {\n issues.push(`${at}: expected a non-empty \\`label\\`, got ${describe(raw.label)}`);\n return undefined;\n }\n return { id: id.value ?? text, label: text, derivedId: id.value === undefined };\n}\n\n/**\n * An explicit `id`/`label`, or `undefined` when the agent supplied nothing to\n * carry (absent, null, or blank). Any other type is intent in the wrong shape,\n * so it is reported instead of dropped.\n */\nfunction explicitText(\n value: unknown,\n at: string,\n key: \"id\" | \"label\",\n issues: string[],\n): { ok: true; value: string | undefined } | { ok: false } {\n if (value === undefined || value === null) return { ok: true, value: undefined };\n if (typeof value !== \"string\") {\n issues.push(`${at}.${key}: expected a non-empty string, got ${describe(value)}`);\n return { ok: false };\n }\n const trimmed = value.trim();\n return { ok: true, value: trimmed === \"\" ? undefined : trimmed };\n}\n\n/**\n * Settles ids across a list of options or fields. Every explicit id is reserved\n * before any derived one is filled in, so a collision's verdict cannot depend on\n * which side of it came first — and a refusal never names an id the agent did\n * not write.\n */\nfunction settleIds(\n prepared: (Prepared | undefined)[],\n path: string,\n issues: string[],\n): Record<string, unknown>[] {\n const used = new Set<string>();\n const reserved = prepared.map((item, index) => {\n if (!item || item.derivedId) return item;\n const id = String(item.entry.id);\n if (used.has(id)) {\n issues.push(\n `${path}[${index}]: duplicate id \"${id}\" — ids must be unique or a host cannot tell the answers apart`,\n );\n return undefined;\n }\n used.add(id);\n return item;\n });\n\n const settled: Record<string, unknown>[] = [];\n reserved.forEach((item, index) => {\n if (!item) return;\n if (item.derivedId) item.entry.id = uniqueId(String(item.entry.id), index, used);\n used.add(String(item.entry.id));\n settled.push(item.entry);\n });\n return settled;\n}\n\nfunction uniqueId(base: string, index: number, used: Set<string>): string {\n if (!used.has(base)) return base;\n // Two options can legitimately share a label; the index disambiguates the id\n // derived from it so the answer stays unambiguous.\n let attempt = index;\n let candidate = `${base}-${attempt}`;\n while (used.has(candidate)) {\n attempt += 1;\n candidate = `${base}-${attempt}`;\n }\n return candidate;\n}\n\nfunction formatIssues(issues: readonly z.core.$ZodIssue[]): string[] {\n return issues.map((issue) => {\n const path = issue.path.reduce<string>((acc, segment) => {\n if (typeof segment === \"number\") return `${acc}[${segment}]`;\n return acc === \"\" ? String(segment) : `${acc}.${String(segment)}`;\n }, \"\");\n return `${path === \"\" ? \"schema\" : path}: ${issue.message}`;\n });\n}\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction describe(value: unknown): string {\n if (value === undefined) return \"nothing\";\n if (value === null) return \"null\";\n if (Array.isArray(value)) return \"an array\";\n if (typeof value === \"string\") return `the string ${JSON.stringify(value)}`;\n if (typeof value === \"object\") return \"an object\";\n return `${typeof value} ${String(value)}`;\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { declaresActivityLabel, stripActivityLabel } from './chunk-U2QALNKX.js';
1
+ import { declaresActivityLabel, stripActivityLabel } from './chunk-72DG6GSB.js';
2
2
 
3
3
  // bridge/src/capability-dispatch.ts
4
4
  async function dispatchCapability(hooks, callId, name, input, onBackgroundError = () => {
@@ -51,5 +51,5 @@ function filterRenderCapabilities(caps) {
51
51
  }
52
52
 
53
53
  export { dispatchCapability, filterRenderCapabilities, renderFallback };
54
- //# sourceMappingURL=chunk-5SXY4B65.js.map
55
- //# sourceMappingURL=chunk-5SXY4B65.js.map
54
+ //# sourceMappingURL=chunk-UL4LD7KD.js.map
55
+ //# sourceMappingURL=chunk-UL4LD7KD.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../bridge/src/capability-dispatch.ts"],"names":[],"mappings":";;;AAmEA,eAAsB,mBACpB,KAAA,EACA,MAAA,EACA,IAAA,EACA,KAAA,EACA,oBAA4C,MAAM;AAAC,CAAA,EACnD,MAAA,EACmC;AACnC,EAAA,MAAA,EAAQ,cAAA,EAAe;AACvB,EAAA,MAAM,GAAA,GAAM,KAAA,CAAM,OAAA,CAAQ,IAAI,CAAA;AAI9B,EAAA,IAAI,CAAC,qBAAA,CAAsB,GAAA,EAAK,WAAW,CAAA,EAAG,KAAA,GAAQ,mBAAmB,KAAK,CAAA;AAK9E,EAAA,IAAI,GAAA,EAAK,MAAA,IAAU,KAAA,CAAM,UAAA,EAAY;AACnC,IAAA,KAAA,CAAM,UAAA,CAAW;AAAA,MACf,IAAA,EAAM,gBAAA;AAAA,MACN,cAAA,EAAgB,I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AA,CAAK,KAAA,CAAM,GAAG,CAAA;AAC5B,EAAA,IAAI,OAAA,GAAmB,GAAA;AACvB,EAAA,KAAA,MAAW,QAAQ,KAAA,EAAO;AACxB,IAAA,IAAI,YAAY,IAAA,IAAQ,OAAA,KAAY,MAAA,IAAa,OAAO,YAAY,QAAA,EAAU;AAC5E,MAAA,OAAO,MAAA;AAAA,IACT;AACA,IAAA,OAAA,GAAW,QAAoC,IAAI,CAAA;AAAA,EACrD;AACA,EAAA,OAAO,OAAA;AACT;AAYO,SAAS,yBAAyB,IAAA,EAAkC;AACzE,EAAA,OAAO,KAAK,MAAA,CAAO,CAAC,CAAA,KAAM,CAAA,CAAE,WAAW,MAAS,CAAA;AAClD","file":"chunk-5SXY4B65.js","sourcesContent":["/**\n * Capability dispatch helpers for bridge drivers.\n *\n * The runner builds a {@link BridgeCapabilityHooks} bundle from its\n * `CapabilityRegistry` and threads it through `AgentConfig.capabilities`.\n * Drivers consume the bundle via these helpers without taking a runtime\n * dependency on `@skaile/workspaces/runner` (which would create a circular dep).\n *\n * Three behaviours are layered into a single dispatch path:\n *\n * 1. **Standard tool call** — the LLM invokes a capability; the bridge calls\n * `hooks.invoke()`, awaits the result, and returns it to the LLM.\n * 2. **Fire-and-forget** — when the resolved Capability has `fireAndForget`\n * set, the bridge resolves to `{}` immediately and runs the handler in\n * the background. Background errors are logged but never surfaced to the\n * LLM since the call is already settled.\n * 3. **Render capability** — when the resolved Capability has a non-undefined\n * `render`, the bridge emits `RenderInvokedEvent` to the runner via\n * `hooks.emitRender` and (when `render.fallback` is set) a parallel text\n * event via `hooks.emitText` with simple `{{prop}}` substitution. The\n * placeholder convention follows the v2 spec — top-level keys of `props`\n * only, with optional dotted-path traversal (`{{user.name}}`). The legacy\n * AAP `{{props.x}}` form was retired in Phase 6.\n *\n * @category Capabilities\n * @since 2.0.0\n */\nimport {\n type Capability,\n declaresActivityLabel,\n stripActivityLabel,\n} from \"@skaile/workspaces/types\";\nimport type { BridgeCapabilityHooks } from \"./types.js\";\n\n/**\n * Result of a capability dispatch returned by {@link dispatchCapability}.\n *\n * The bridge feeds `{ result }` back to the LLM tool-use response. For\n * fire-and-forget capabilities `result` is always `{}` and `background` is `true`.\n *\n * @docLink packages/bridge/concepts#capability-dispatch-result\n */\nexport interface CapabilityDispatchResult {\n /** Value returned to the LLM. `{}` for fire-and-forget capabilities. */\n result: unknown;\n /** True when the handler is still running in the background (fire-and-forget). */\n background: boolean;\n}\n\n/**\n * Run a capability invocation through the runner-provided hooks, applying\n * render-event emission and fire-and-forget short-circuit.\n *\n * The result is always shaped for direct return to the LLM. For\n * fire-and-forget capabilities the background promise is fired and any error\n * is logged through `onBackgroundError` (defaulting to a no-op). For all\n * other capabilities the handler is awaited; errors propagate as a rejection\n * so the driver can surface them as tool errors.\n *\n * @param hooks - Capability dispatch bundle from `AgentConfig.capabilities`.\n * @param callId - Correlation ID for the tool-use invocation (used in render events).\n * @param name - Registered capability name.\n * @param input - Raw tool input from the LLM.\n * @param onBackgroundError - Optional error handler for fire-and-forget failures.\n * @returns Resolved dispatch result with the LLM-facing value and background flag.\n * @docLink packages/bridge/concepts#dispatch-capability\n */\nexport async function dispatchCapability(\n hooks: BridgeCapabilityHooks,\n callId: string,\n name: string,\n input: unknown,\n onBackgroundError: (err: unknown) => void = () => {},\n signal?: AbortSignal,\n): Promise<CapabilityDispatchResult> {\n signal?.throwIfAborted();\n const cap = hooks.resolve(name);\n // The advertised `activity_label` is for the UI only. Strip it before render\n // props and the handler: strict inputs would reject it and external MCP\n // passthrough would forward it. Kept when the capability declares it itself.\n if (!declaresActivityLabel(cap?.inputSchema)) input = stripActivityLabel(input);\n\n // Render emission happens before invocation so clients see the props the\n // LLM passed in even if the handler errors. The runner's gateway forwards\n // the event over the transport.\n if (cap?.render && hooks.emitRender) {\n hooks.emitRender({\n type: \"render_invoked\",\n capabilityName: name,\n props: input,\n callId,\n });\n if (cap.render.fallback && hooks.emitText) {\n const fallback = renderFallback(cap.render.fallback, input);\n hooks.emitText(fallback);\n }\n }\n\n if (cap?.fireAndForget) {\n // Resolve immediately; run handler in background.\n void hooks.invoke(name, input, signal).catch(onBackgroundError);\n return { result: {}, background: true };\n }\n\n const result = await hooks.invoke(name, input, signal);\n return { result, background: false };\n}\n\n/**\n * Substitute `{{prop}}` placeholders inside a fallback template using the\n * input record. Top-level keys of `props` resolve directly\n * (`{{name}}` → `props.name`); dotted paths traverse nested records\n * (`{{user.name}}` → `props.user.name`). Missing keys collapse to an empty\n * string; non-record inputs collapse all placeholders.\n *\n * The convention is fixed by the v2 spec (§1, `RenderSpec.fallback`). The\n * legacy AAP form `{{props.x}}` is no longer accepted — author fallbacks\n * with bare keys.\n *\n * Intentionally minimal — full template engines belong in the platform's\n * render layer, not the bridge.\n *\n * @param template - Fallback string from `RenderSpec.fallback` with `{{key}}` placeholders.\n * @param input - LLM tool input object; non-object values collapse all placeholders.\n * @returns Template with all resolvable placeholders replaced.\n * @docLink packages/bridge/concepts#render-fallback\n */\nexport function renderFallback(template: string, input: unknown): string {\n if (!input || typeof input !== \"object\") {\n return template.replace(/\\{\\{\\s*[\\w$.]+\\s*\\}\\}/g, \"\");\n }\n const props = input as Record<string, unknown>;\n return template.replace(/\\{\\{\\s*([\\w$.]+)\\s*\\}\\}/g, (_match, path: string) => {\n const value = readPath(props, path);\n return value === undefined || value === null ? \"\" : String(value);\n });\n}\n\nfunction readPath(obj: Record<string, unknown>, path: string): unknown {\n const parts = path.split(\".\");\n let current: unknown = obj;\n for (const part of parts) {\n if (current === null || current === undefined || typeof current !== \"object\") {\n return undefined;\n }\n current = (current as Record<string, unknown>)[part];\n }\n return current;\n}\n\n/**\n * Filter a capability list to those marked as render-capable (having a `render` spec).\n *\n * Used by drivers that emit a separate render manifest at registration time.\n * Currently unused in production drivers; reserved for future phases.\n *\n * @param caps - Full capability list to filter.\n * @returns Subset of capabilities with a non-undefined `render` property.\n * @docLink packages/bridge/concepts#filter-render-capabilities\n */\nexport function filterRenderCapabilities(caps: Capability[]): Capability[] {\n return caps.filter((c) => c.render !== undefined);\n}\n"]}
1
+ {"version":3,"sources":["../bridge/src/capability-dispatch.ts"],"names":[],"mappings":";;;AAmEA,eAAsB,mBACpB,KAAA,EACA,MAAA,EACA,IAAA,EACA,KAAA,EACA,oBAA4C,MAAM;AAAC,CAAA,EACnD,MAAA,EACmC;AACnC,EAAA,MAAA,EAAQ,cAAA,EAAe;AACvB,EAAA,MAAM,GAAA,GAAM,KAAA,CAAM,OAAA,CAAQ,IAAI,CAAA;AAI9B,EAAA,IAAI,CAAC,qBAAA,CAAsB,GAAA,EAAK,WAAW,CAAA,EAAG,KAAA,GAAQ,mBAAmB,KAAK,CAAA;AAK9E,EAAA,IAAI,GAAA,EAAK,MAAA,IAAU,KAAA,CAAM,UAAA,EAAY;AACnC,IAAA,KAAA,CAAM,UAAA,CAAW;AAAA,MACf,IAAA,EAAM,gBAAA;AAAA,MACN,cAAA,EAAgB,IAAA;AAAA,MAChB,KAAA,EAAO,KAAA;AAAA,MACP;AAAA,KACD,CAAA;AACD,IAAA,IAAI,GAAA,CAAI,MAAA,CAAO,QAAA,IAAY,KAAA,CAAM,QAAA,EAAU;AACzC,MAAA,MAAM,QAAA,GAAW,cAAA,CAAe,GAAA,CAAI,MAAA,CAAO,UAAU,KAAK,CAAA;AAC1D,MAAA,KAAA,CAAM,SAAS,QAAQ,CAAA;AAAA,IACzB;AAAA,EACF;AAEA,EAAA,IAAI,KAAK,aAAA,EAAe;AAEtB,IAAA,KAAK,MAAM,MAAA,CAAO,IAAA,EAAM,OAAO,MAAM,CAAA,CAAE,MAAM,iBAAiB,CAAA;AAC9D,IAAA,OAAO,EAAE,MAAA,EAAQ,EAAC,EAAG,YAAY,IAAA,EAAK;AAAA,EACxC;AAEA,EAAA,MAAM,SAAS,MAAM,KAAA,CAAM,MAAA,CAAO,IAAA,EAAM,OAAO,MAAM,CAAA;AACrD,EAAA,OAAO,EAAE,MAAA,EAAQ,UAAA,EAAY,KAAA,EAAM;AACrC;AAqBO,SAAS,cAAA,CAAe,UAAkB,KAAA,EAAwB;AACvE,EAAA,IAAI,CAAC,KAAA,IAAS,OAAO,KAAA,KAAU,QAAA,EAAU;AACvC,IAAA,OAAO,QAAA,CAAS,OAAA,CAAQ,wBAAA,EAA0B,EAAE,CAAA;AAAA,EACtD;AACA,EAAA,MAAM,KAAA,GAAQ,KAAA;AACd,EAAA,OAAO,QAAA,CAAS,OAAA,CAAQ,0BAAA,EAA4B,CAAC,QAAQ,IAAA,KAAiB;AAC5E,IAAA,MAAM,KAAA,GAAQ,QAAA,CAAS,KAAA,EAAO,IAAI,CAAA;AAClC,IAAA,OAAO,UAAU,MAAA,IAAa,KAAA,KAAU,IAAA,GAAO,EAAA,GAAK,OAAO,KAAK,CAAA;AAAA,EAClE,CAAC,CAAA;AACH;AAEA,SAAS,QAAA,CAAS,KAA8B,IAAA,EAAuB;AACrE,EAAA,MAAM,KAAA,GAAQ,IAAA,CAAK,KAAA,CAAM,GAAG,CAAA;AAC5B,EAAA,IAAI,OAAA,GAAmB,GAAA;AACvB,EAAA,KAAA,MAAW,QAAQ,KAAA,EAAO;AACxB,IAAA,IAAI,YAAY,IAAA,IAAQ,OAAA,KAAY,MAAA,IAAa,OAAO,YAAY,QAAA,EAAU;AAC5E,MAAA,OAAO,MAAA;AAAA,IACT;AACA,IAAA,OAAA,GAAW,QAAoC,IAAI,CAAA;AAAA,EACrD;AACA,EAAA,OAAO,OAAA;AACT;AAYO,SAAS,yBAAyB,IAAA,EAAkC;AACzE,EAAA,OAAO,KAAK,MAAA,CAAO,CAAC,CAAA,KAAM,CAAA,CAAE,WAAW,MAAS,CAAA;AAClD","file":"chunk-UL4LD7KD.js","sourcesContent":["/**\n * Capability dispatch helpers for bridge drivers.\n *\n * The runner builds a {@link BridgeCapabilityHooks} bundle from its\n * `CapabilityRegistry` and threads it through `AgentConfig.capabilities`.\n * Drivers consume the bundle via these helpers without taking a runtime\n * dependency on `@skaile/workspaces/runner` (which would create a circular dep).\n *\n * Three behaviours are layered into a single dispatch path:\n *\n * 1. **Standard tool call** — the LLM invokes a capability; the bridge calls\n * `hooks.invoke()`, awaits the result, and returns it to the LLM.\n * 2. **Fire-and-forget** — when the resolved Capability has `fireAndForget`\n * set, the bridge resolves to `{}` immediately and runs the handler in\n * the background. Background errors are logged but never surfaced to the\n * LLM since the call is already settled.\n * 3. **Render capability** — when the resolved Capability has a non-undefined\n * `render`, the bridge emits `RenderInvokedEvent` to the runner via\n * `hooks.emitRender` and (when `render.fallback` is set) a parallel text\n * event via `hooks.emitText` with simple `{{prop}}` substitution. The\n * placeholder convention follows the v2 spec — top-level keys of `props`\n * only, with optional dotted-path traversal (`{{user.name}}`). The legacy\n * AAP `{{props.x}}` form was retired in Phase 6.\n *\n * @category Capabilities\n * @since 2.0.0\n */\nimport {\n type Capability,\n declaresActivityLabel,\n stripActivityLabel,\n} from \"@skaile/workspaces/types\";\nimport type { BridgeCapabilityHooks } from \"./types.js\";\n\n/**\n * Result of a capability dispatch returned by {@link dispatchCapability}.\n *\n * The bridge feeds `{ result }` back to the LLM tool-use response. For\n * fire-and-forget capabilities `result` is always `{}` and `background` is `true`.\n *\n * @docLink packages/bridge/concepts#capability-dispatch-result\n */\nexport interface CapabilityDispatchResult {\n /** Value returned to the LLM. `{}` for fire-and-forget capabilities. */\n result: unknown;\n /** True when the handler is still running in the background (fire-and-forget). */\n background: boolean;\n}\n\n/**\n * Run a capability invocation through the runner-provided hooks, applying\n * render-event emission and fire-and-forget short-circuit.\n *\n * The result is always shaped for direct return to the LLM. For\n * fire-and-forget capabilities the background promise is fired and any error\n * is logged through `onBackgroundError` (defaulting to a no-op). For all\n * other capabilities the handler is awaited; errors propagate as a rejection\n * so the driver can surface them as tool errors.\n *\n * @param hooks - Capability dispatch bundle from `AgentConfig.capabilities`.\n * @param callId - Correlation ID for the tool-use invocation (used in render events).\n * @param name - Registered capability name.\n * @param input - Raw tool input from the LLM.\n * @param onBackgroundError - Optional error handler for fire-and-forget failures.\n * @returns Resolved dispatch result with the LLM-facing value and background flag.\n * @docLink packages/bridge/concepts#dispatch-capability\n */\nexport async function dispatchCapability(\n hooks: BridgeCapabilityHooks,\n callId: string,\n name: string,\n input: unknown,\n onBackgroundError: (err: unknown) => void = () => {},\n signal?: AbortSignal,\n): Promise<CapabilityDispatchResult> {\n signal?.throwIfAborted();\n const cap = hooks.resolve(name);\n // The advertised `activity_label` is for the UI only. Strip it before render\n // props and the handler: strict inputs would reject it and external MCP\n // passthrough would forward it. Kept when the capability declares it itself.\n if (!declaresActivityLabel(cap?.inputSchema)) input = stripActivityLabel(input);\n\n // Render emission happens before invocation so clients see the props the\n // LLM passed in even if the handler errors. The runner's gateway forwards\n // the event over the transport.\n if (cap?.render && hooks.emitRender) {\n hooks.emitRender({\n type: \"render_invoked\",\n capabilityName: name,\n props: input,\n callId,\n });\n if (cap.render.fallback && hooks.emitText) {\n const fallback = renderFallback(cap.render.fallback, input);\n hooks.emitText(fallback);\n }\n }\n\n if (cap?.fireAndForget) {\n // Resolve immediately; run handler in background.\n void hooks.invoke(name, input, signal).catch(onBackgroundError);\n return { result: {}, background: true };\n }\n\n const result = await hooks.invoke(name, input, signal);\n return { result, background: false };\n}\n\n/**\n * Substitute `{{prop}}` placeholders inside a fallback template using the\n * input record. Top-level keys of `props` resolve directly\n * (`{{name}}` → `props.name`); dotted paths traverse nested records\n * (`{{user.name}}` → `props.user.name`). Missing keys collapse to an empty\n * string; non-record inputs collapse all placeholders.\n *\n * The convention is fixed by the v2 spec (§1, `RenderSpec.fallback`). The\n * legacy AAP form `{{props.x}}` is no longer accepted — author fallbacks\n * with bare keys.\n *\n * Intentionally minimal — full template engines belong in the platform's\n * render layer, not the bridge.\n *\n * @param template - Fallback string from `RenderSpec.fallback` with `{{key}}` placeholders.\n * @param input - LLM tool input object; non-object values collapse all placeholders.\n * @returns Template with all resolvable placeholders replaced.\n * @docLink packages/bridge/concepts#render-fallback\n */\nexport function renderFallback(template: string, input: unknown): string {\n if (!input || typeof input !== \"object\") {\n return template.replace(/\\{\\{\\s*[\\w$.]+\\s*\\}\\}/g, \"\");\n }\n const props = input as Record<string, unknown>;\n return template.replace(/\\{\\{\\s*([\\w$.]+)\\s*\\}\\}/g, (_match, path: string) => {\n const value = readPath(props, path);\n return value === undefined || value === null ? \"\" : String(value);\n });\n}\n\nfunction readPath(obj: Record<string, unknown>, path: string): unknown {\n const parts = path.split(\".\");\n let current: unknown = obj;\n for (const part of parts) {\n if (current === null || current === undefined || typeof current !== \"object\") {\n return undefined;\n }\n current = (current as Record<string, unknown>)[part];\n }\n return current;\n}\n\n/**\n * Filter a capability list to those marked as render-capable (having a `render` spec).\n *\n * Used by drivers that emit a separate render manifest at registration time.\n * Currently unused in production drivers; reserved for future phases.\n *\n * @param caps - Full capability list to filter.\n * @returns Subset of capabilities with a non-undefined `render` property.\n * @docLink packages/bridge/concepts#filter-render-capabilities\n */\nexport function filterRenderCapabilities(caps: Capability[]): Capability[] {\n return caps.filter((c) => c.render !== undefined);\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import { getStoreConfig, getStoreToken, storeFetch } from './chunk-6H6HLMWG.js';
2
- import { S, logErr, logWarn, logOk, logInfo } from './chunk-A565EFTW.js';
2
+ import { S, logErr, logWarn, logOk, logInfo } from './chunk-A3HTL7XV.js';
3
3
 
4
4
  // cli/src/store-publisher.ts
5
5
  function makeHttpPublisherClient(config = getStoreConfig(), timeoutMs = 2e4) {
@@ -154,5 +154,5 @@ async function publishToStore(opts) {
154
154
  }
155
155
 
156
156
  export { bareName, formatNamespaceAvailability, makeHttpPublisherClient, preflightNamespace, publishToStore, refFor };
157
- //# sourceMappingURL=chunk-GLOHIJ7B.js.map
158
- //# sourceMappingURL=chunk-GLOHIJ7B.js.map
157
+ //# sourceMappingURL=chunk-VN7DELUT.js.map
158
+ //# sourceMappingURL=chunk-VN7DELUT.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../cli/src/store-publisher.ts","../cli/src/commands/publish-core.ts"],"names":[],"m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,MAAA,CAAO,KAAA,IAAS,EAAC,EAC5B,MAAA,CAAO,CAAC,CAAA,KAAM,CAAA,CAAE,WAAW,QAAQ,CAAA,CACnC,IAAI,CAAC,CAAA,KAAM,EAAE,KAAK,CAAA,CAClB,OAAO,OAAO,CAAA;AACjB,UAAA,OAAA;AAAA,YACE,cAAc,CAAA,CAAE,IAAI,CAAA,CAAA,EAAI,CAAA,CAAE,IAAI,CAAA,kBAAA,EAAqB,MAAA,CAAO,MAAM,CAAA,CAAA,CAAA,IAC7D,KAAK,MAAA,GAAS,CAAA,EAAA,EAAK,KAAK,IAAA,CAAK,IAAI,CAAC,CAAA,CAAA,GAAK,EAAA;AAAA,WAC5C;AACA,UAAA;AAAA,QACF;AAAA,MACF;AACA,MAAA,SAAA,CAAU,IAAA,CAAK,MAAA,CAAO,CAAA,CAAE,IAAA,EAAM,OAAA,CAAQ,SAAA,CAAU,kBAAA,EAAoB,CAAA,CAAE,IAAA,EAAM,CAAA,CAAE,OAAO,CAAC,CAAA;AAAA,IACxF,SAAS,GAAA,EAAK;AACZ,MAAA,OAAA;AAAA,QACE,CAAA,kBAAA,EAAqB,CAAA,CAAE,IAAI,CAAA,CAAA,EAAI,CAAA,CAAE,IAAI,CAAA,EAAA,EAAK,GAAA,YAAe,KAAA,GAAQ,GAAA,CAAI,OAAA,GAAU,MAAA,CAAO,GAAG,CAAC,CAAA;AAAA,OAC5F;AAAA,IACF;AAAA,EACF;AAEA,EAAA,KAAA,CAAM,CAAA,UAAA,EAAa,SAAA,CAAU,MAAM,CAAA,UAAA,CAAY,CAAA;AAC/C,EAAA,KAAA,MAAW,CAAA,IAAK,SAAA,EAAW,OAAA,CAAQ,CAAA,EAAA,EAAK,CAAC,CAAA,CAAE,CAAA;AAC3C,EAAA,OAAO,EAAE,SAAA,EAAU;AACrB","file":"chunk-GLOHIJ7B.js","sourcesContent":["/**\n * Typed REST client for the AI Asset Store **publisher** surface — the\n * curator-publish flow (`skaile source manifest publish` / `yank`). Thin\n * wrappers over {@link storeFetch}; every method maps 1:1 to an `/api/v1/…`\n * endpoint. The {@link PublisherClient} interface is injectable so the\n * orchestration in `commands/source-manifest-publish.ts` can be unit-tested\n * against a fake without a live store.\n *\n * @docLink cli/dev-guide#store-publisher\n */\n\nimport { getStoreConfig, getStoreToken, type StoreConfig, storeFetch } from \"./store-client.ts\";\n\n/**\n * The publisher REST surface used by the curator-publish flow. Kept minimal —\n * only the endpoints `runPublish` / `runYank` actually call. Response shapes\n * are narrowed to the fields the orchestration reads (the server returns more).\n */\nexport interface PublisherClient {\n /**\n * Identity of the caller. `username` is the Keycloak login (personal-tier\n * namespace); `githubLogin` is the verified GitHub handle when connected —\n * the namespace to publish under when it differs from the login.\n */\n me(): Promise<{ username: string; githubLogin?: string | null }>;\n /** Register (or re-register) a source; returns the created/existing row id. */\n sourcesAdd(body: {\n url: string;\n ref: string;\n sidecarUrl?: string;\n sidecarRef?: string;\n /**\n * Target publisher namespace (the manifest's `publisher`). When it differs\n * from the caller's login username, the store resolves the CLAIMED Publisher\n * for it (the store must already have the claim). Omitted → the store\n * defaults to `@<username>` (personal).\n */\n namespace?: string;\n }): Promise<{ id: string }>;\n /** List sources — used to recover an id when `sourcesAdd` rejects a dup url. */\n sourcesList(): Promise<Array<{ id: string; url: string }>>;\n /** Kick off a source sync; returns the async job id to poll. */\n sourceSync(id: string): Promise<{ jobId: string }>;\n /** Poll a job's terminal status + per-item results. */\n jobGet(\n jobId: string,\n ): Promise<{ status: string; items?: Array<{ label: string; status: string; error?: string }> }>;\n /** Discovered publishable candidates for a synced source. */\n sourceCandidates(id: string): Promise<\n Array<{\n id: string;\n name: string;\n version: string;\n kind: string;\n published: boolean;\n assetRoot: string;\n }>\n >;\n /** Per-asset preview — the discovered file set + resolved candidate metadata. */\n assetPreview(id: string): Promise<{\n discoveredFiles: string[];\n candidate: { name: string; version: string; kind: string; publisherNamespace: string };\n }>;\n /**\n * Publish one asset. `dryRun` returns the would-be `{ manifest }` without\n * launching a job; the normal path returns `{ jobId }`.\n */\n assetPublish(\n id: string,\n body: { ref: string; files: string[] },\n dryRun?: boolean,\n ): Promise<{ jobId?: string; manifest?: unknown }>;\n /** Retract a published asset. Response body is ignored. */\n assetUnpublish(id: string): Promise<unknown>;\n /**\n * Read-only \"can I publish under `@<ns>` right now, and if not, what's the\n * path?\" probe. Backs the `publish --dry-run` namespace status line; its\n * `message` is store-authored and meant to be surfaced verbatim.\n */\n namespaceAvailability(ns: string): Promise<{\n namespace: string;\n status: \"owned-by-you\" | \"claimable-by-you\" | \"reserved\" | \"available\";\n claimMethod?: string;\n message: string;\n }>;\n}\n\n/**\n * Construct the real HTTP-backed {@link PublisherClient}. Every call carries a\n * longer timeout than the default store client because publish/sync trigger\n * server-side clone work.\n *\n * @param config - Store connection config; defaults to {@link getStoreConfig}.\n * @param timeoutMs - Per-request abort timeout (default 20s).\n */\nexport function makeHttpPublisherClient(\n config: StoreConfig = getStoreConfig(),\n timeoutMs = 20_000,\n): PublisherClient {\n // Acquire a fresh Keycloak token per call (device-flow session in\n // ~/.skaile/auth.json, refreshed on demand) rather than a static config.jwt.\n const call = async <T>(\n path: string,\n opts?: { method?: string; body?: unknown; params?: Record<string, string> },\n ): Promise<T> => {\n const jwt = await getStoreToken();\n return storeFetch<T>({ ...config, jwt }, path, { timeoutMs, ...opts });\n };\n return {\n me: () => call(\"/api/v1/me\"),\n sourcesAdd: (body) => call(\"/api/v1/sources\", { method: \"POST\", body }),\n sourcesList: () => call(\"/api/v1/sources\"),\n sourceSync: (id) => call(`/api/v1/sources/${id}/sync`, { method: \"POST\", body: {} }),\n jobGet: (jobId) => call(`/api/v1/jobs/${jobId}`),\n sourceCandidates: (id) => call(`/api/v1/sources/${id}/candidates`),\n assetPreview: (id) => call(`/api/v1/assets/${id}/preview`),\n assetPublish: (id, body, dryRun) =>\n call(`/api/v1/assets/${id}/publish`, {\n method: \"POST\",\n body,\n ...(dryRun ? { params: { dryRun: \"1\" } } : {}),\n }),\n assetUnpublish: (id) => call(`/api/v1/assets/${id}/unpublish`, { method: \"POST\", body: {} }),\n namespaceAvailability: (ns) =>\n call(`/api/v1/namespaces/${encodeURIComponent(ns)}/availability`),\n };\n}\n","/**\n * Shared store-interaction core for the two publish front-ends — the curator\n * sidecar flow (`source manifest publish`) and the first-party library flow\n * (`library publish`). Both differ only in their git side-effects + how they\n * resolve the source repo; the store orchestration below (register → sync →\n * candidates → per-asset preview+publish) is identical.\n *\n * The store REST surface is reached through the injectable {@link PublisherClient}\n * so the orchestration stays unit/integration-testable without a live store.\n *\n * @docLink cli/commands/source#manifest-publish\n */\n\nimport type { SkPublishManifest } from \"@skaile/workspaces/core\";\nimport { logErr, logInfo, logOk, logWarn, S } from \"../helpers.ts\";\nimport type { PublisherClient } from \"../store-publisher.ts\";\n\n/**\n * One-line rendering of a namespace-availability probe for a `--dry-run` plan.\n * The `message` is store-authored (identical to what a real publish would echo)\n * — we only prepend a status glyph so the reader sees green/amber/red at a\n * glance without the CLI re-deriving any authorization logic.\n */\nexport function formatNamespaceAvailability(a: {\n status: \"owned-by-you\" | \"claimable-by-you\" | \"reserved\" | \"available\";\n message: string;\n}): string {\n switch (a.status) {\n case \"owned-by-you\":\n case \"available\":\n return `${S.ok(\"✓\")} ${a.message}`;\n case \"claimable-by-you\":\n return `${S.warn(\"!\")} ${a.message}`;\n default:\n return `${S.err(\"✗\")} ${a.message}`;\n }\n}\n\n/**\n * Preflight the target namespace against the store's availability probe BEFORE a\n * publish does any irreversible work (a public git push). Returns `{ ok: false }`\n * with a guided message for `reserved` (not yours) and `claimable-by-you` (must\n * claim first) — the two states a real publish would reject — so the caller can\n * abort with actionable guidance instead of a raw 422 after pushing bytes.\n *\n * The probe is advisory: any failure (offline, older store) returns `{ ok: true }`\n * so the store stays the authority and a valid publish is never blocked.\n */\nexport async function preflightNamespace(\n client: PublisherClient,\n namespace: string,\n): Promise<{ ok: boolean; message?: string }> {\n let a: Awaited<ReturnType<PublisherClient[\"namespaceAvailability\"]>>;\n try {\n a = await client.namespaceAvailability(namespace);\n } catch {\n return { ok: true };\n }\n switch (a.status) {\n case \"owned-by-you\":\n case \"available\":\n return { ok: true };\n case \"claimable-by-you\":\n return {\n ok: false,\n message:\n `@${namespace} isn't yours yet — claim it in the store first` +\n `${a.claimMethod ? ` (${a.claimMethod})` : \"\"}, then re-run. ${a.message}`,\n };\n default: // reserved, or any unrecognized future status (fail safe → block)\n return { ok: false, message: `Cannot publish under @${namespace} — ${a.message}` };\n }\n}\n\n/** One candidate row shape the matcher operates on (kind + name are the key). */\ninterface CandidateLike {\n kind: string;\n name: string;\n}\n\n/**\n * Keep only candidates whose `(kind, name)` pair is declared in the manifest.\n * The backend may merge extra assets from the base repo into the candidate\n * list; a publish only touches what the manifest curated/declared.\n */\nexport function matchCandidatesToManifest<T extends CandidateLike>(\n candidates: T[],\n manifest: SkPublishManifest,\n): T[] {\n const wanted = new Set((manifest.assets ?? []).map((a) => `${a.kind}:${a.name}`));\n return candidates.filter((c) => wanted.has(`${c.kind}:${c.name}`));\n}\n\n/** A canonical ref string `kind:@publisher/name[#version]` for reporting. */\nexport function refFor(kind: string, publisher: string, name: string, version?: string): string {\n const base = `${kind}:@${publisher}/${name}`;\n return version ? `${base}#${version}` : base;\n}\n\n/** The bare asset name from a `kind:@publisher/name#version` ref or a plain name. */\nexport function bareName(ref: string): string {\n const afterKind = ref.includes(\":\") ? ref.slice(ref.indexOf(\":\") + 1) : ref;\n const afterScope = afterKind.includes(\"/\")\n ? afterKind.slice(afterKind.indexOf(\"/\") + 1)\n : afterKind;\n return afterScope.split(\"#\")[0];\n}\n\n/**\n * Poll a job until it leaves `running` or the deadline passes. Returns the last\n * observed state — the caller MUST treat a still-`running` result as a timeout\n * (not success), since it means the deadline was hit before the job finished.\n */\nexport async function pollJob(\n client: PublisherClient,\n jobId: string,\n intervalMs = 1_500,\n timeoutMs = 60_000,\n): Promise<{ status: string; items?: Array<{ label: string; status: string; error?: string }> }> {\n const deadline = Date.now() + timeoutMs;\n let job = await client.jobGet(jobId);\n while (job.status === \"running\" && Date.now() < deadline) {\n await new Promise((r) => setTimeout(r, intervalMs));\n job = await client.jobGet(jobId);\n }\n return job;\n}\n\n/**\n * True when a `sourcesAdd` rejection is a duplicate-URL conflict (the source is\n * already registered) — the only error the publish flow recovers from by looking\n * the existing row up. Every other failure (auth, 5xx, network) must propagate.\n */\nexport function isDupSourceError(err: unknown): boolean {\n const msg = (err instanceof Error ? err.message : String(err)).toLowerCase();\n return /\\b409\\b|conflict|duplicate|already exists|already registered|unique/.test(msg);\n}\n\n/**\n * Register + sync the source, then publish its curated/declared candidates —\n * the store-side steps shared by both publish front-ends. Git side-effects (the\n * sidecar push, or the library commit+push) happen in the caller *before* this;\n * this function is purely store interaction.\n *\n * The sidecar front-end passes `sidecar` (so `sourcesAdd` carries the sidecar\n * pin); the library front-end omits it (the source repo IS the manifest host).\n * `assetName`, when set, narrows publication to the single candidate of that\n * name. Fatal store states (`sourcesAdd` non-dup failure) surface; sync failures\n * and empty candidate sets `process.exit(1)` with the same messages as before.\n */\nexport async function publishToStore(opts: {\n sourceUrl: string;\n ref: string;\n sidecar?: { url: string; ref: string };\n manifest: SkPublishManifest;\n assetName?: string;\n client: PublisherClient;\n}): Promise<{ published: string[] }> {\n const { sourceUrl, ref, sidecar, manifest, assetName, client: pub } = opts;\n\n let sourceId: string;\n try {\n const added = await pub.sourcesAdd({\n url: sourceUrl,\n ref,\n ...(sidecar ? { sidecarUrl: sidecar.url, sidecarRef: sidecar.ref } : {}),\n // Publish under the manifest's declared namespace; the store resolves a\n // claimed Publisher when it differs from the caller's login, else defaults\n // to `@<username>`. Omitted when the manifest carries no publisher.\n ...(manifest.publisher ? { namespace: manifest.publisher } : {}),\n });\n sourceId = added.id;\n } catch (err) {\n // Only a duplicate-url conflict is recoverable (source already registered);\n // auth/5xx/network failures must surface, not silently reuse a stale row.\n if (!isDupSourceError(err)) throw err;\n const rows = await pub.sourcesList();\n const found = rows.find((r) => r.url === sourceUrl);\n if (!found) {\n throw new Error(\n `Source ${sourceUrl} looked already-registered but no owned row matched: ` +\n `${err instanceof Error ? err.message : String(err)}`,\n );\n }\n sourceId = found.id;\n }\n\n const { jobId } = await pub.sourceSync(sourceId);\n const job = await pollJob(pub, jobId);\n if (job.status === \"failed\" || job.status === \"cancelled\") {\n const failed = (job.items ?? []).filter((i) => i.status === \"failed\");\n for (const i of failed) logErr(`sync: ${i.label}: ${i.error ?? \"failed\"}`);\n logErr(`Source sync ${job.status}.`);\n process.exit(1);\n }\n // A still-`running` job means the poll deadline was hit — do NOT proceed on an\n // unfinished sync (it would read incomplete candidates).\n if (job.status === \"running\") {\n logErr(\"Source sync timed out before completing — re-run `publish`, or check the store.\");\n process.exit(1);\n }\n\n let candidates = matchCandidatesToManifest(await pub.sourceCandidates(sourceId), manifest);\n if (assetName) candidates = candidates.filter((c) => c.name === assetName);\n if (candidates.length === 0) {\n logWarn(\"No candidates discovered — check the manifest and the source ref.\");\n process.exit(1);\n }\n\n const published: string[] = [];\n for (const c of candidates) {\n try {\n const preview = await pub.assetPreview(c.id);\n const res = await pub.assetPublish(c.id, { ref, files: preview.discoveredFiles });\n // Publish is async — wait for the job so we only report refs that actually\n // landed, not ones whose import is still in flight or about to fail.\n if (res.jobId) {\n const pubJob = await pollJob(pub, res.jobId);\n if (pubJob.status !== \"succeeded\") {\n const errs = (pubJob.items ?? [])\n .filter((i) => i.status === \"failed\")\n .map((i) => i.error)\n .filter(Boolean);\n logWarn(\n `Publish of ${c.kind}:${c.name} did not succeed (${pubJob.status})` +\n (errs.length ? `: ${errs.join(\"; \")}` : \"\"),\n );\n continue;\n }\n }\n published.push(refFor(c.kind, preview.candidate.publisherNamespace, c.name, c.version));\n } catch (err) {\n logWarn(\n `Failed to publish ${c.kind}:${c.name}: ${err instanceof Error ? err.message : String(err)}`,\n );\n }\n }\n\n logOk(`Published ${published.length} asset(s):`);\n for (const r of published) logInfo(` ${r}`);\n return { published };\n}\n"]}
1
+ {"version":3,"sources":["../cli/src/store-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ator-publish flow (`skaile source manifest publish` / `yank`). Thin\n * wrappers over {@link storeFetch}; every method maps 1:1 to an `/api/v1/…`\n * endpoint. The {@link PublisherClient} interface is injectable so the\n * orchestration in `commands/source-manifest-publish.ts` can be unit-tested\n * against a fake without a live store.\n *\n * @docLink cli/dev-guide#store-publisher\n */\n\nimport { getStoreConfig, getStoreToken, type StoreConfig, storeFetch } from \"./store-client.ts\";\n\n/**\n * The publisher REST surface used by the curator-publish flow. Kept minimal —\n * only the endpoints `runPublish` / `runYank` actually call. Response shapes\n * are narrowed to the fields the orchestration reads (the server returns more).\n */\nexport interface PublisherClient {\n /**\n * Identity of the caller. `username` is the Keycloak login (personal-tier\n * namespace); `githubLogin` is the verified GitHub handle when connected —\n * the namespace to publish under when it differs from the login.\n */\n me(): Promise<{ username: string; githubLogin?: string | null }>;\n /** Register (or re-register) a source; returns the created/existing row id. */\n sourcesAdd(body: {\n url: string;\n ref: string;\n sidecarUrl?: string;\n sidecarRef?: string;\n /**\n * Target publisher namespace (the manifest's `publisher`). When it differs\n * from the caller's login username, the store resolves the CLAIMED Publisher\n * for it (the store must already have the claim). Omitted → the store\n * defaults to `@<username>` (personal).\n */\n namespace?: string;\n }): Promise<{ id: string }>;\n /** List sources — used to recover an id when `sourcesAdd` rejects a dup url. */\n sourcesList(): Promise<Array<{ id: string; url: string }>>;\n /** Kick off a source sync; returns the async job id to poll. */\n sourceSync(id: string): Promise<{ jobId: string }>;\n /** Poll a job's terminal status + per-item results. */\n jobGet(\n jobId: string,\n ): Promise<{ status: string; items?: Array<{ label: string; status: string; error?: string }> }>;\n /** Discovered publishable candidates for a synced source. */\n sourceCandidates(id: string): Promise<\n Array<{\n id: string;\n name: string;\n version: string;\n kind: string;\n published: boolean;\n assetRoot: string;\n }>\n >;\n /** Per-asset preview — the discovered file set + resolved candidate metadata. */\n assetPreview(id: string): Promise<{\n discoveredFiles: string[];\n candidate: { name: string; version: string; kind: string; publisherNamespace: string };\n }>;\n /**\n * Publish one asset. `dryRun` returns the would-be `{ manifest }` without\n * launching a job; the normal path returns `{ jobId }`.\n */\n assetPublish(\n id: string,\n body: { ref: string; files: string[] },\n dryRun?: boolean,\n ): Promise<{ jobId?: string; manifest?: unknown }>;\n /** Retract a published asset. Response body is ignored. */\n assetUnpublish(id: string): Promise<unknown>;\n /**\n * Read-only \"can I publish under `@<ns>` right now, and if not, what's the\n * path?\" probe. Backs the `publish --dry-run` namespace status line; its\n * `message` is store-authored and meant to be surfaced verbatim.\n */\n namespaceAvailability(ns: string): Promise<{\n namespace: string;\n status: \"owned-by-you\" | \"claimable-by-you\" | \"reserved\" | \"available\";\n claimMethod?: string;\n message: string;\n }>;\n}\n\n/**\n * Construct the real HTTP-backed {@link PublisherClient}. Every call carries a\n * longer timeout than the default store client because publish/sync trigger\n * server-side clone work.\n *\n * @param config - Store connection config; defaults to {@link getStoreConfig}.\n * @param timeoutMs - Per-request abort timeout (default 20s).\n */\nexport function makeHttpPublisherClient(\n config: StoreConfig = getStoreConfig(),\n timeoutMs = 20_000,\n): PublisherClient {\n // Acquire a fresh Keycloak token per call (device-flow session in\n // ~/.skaile/auth.json, refreshed on demand) rather than a static config.jwt.\n const call = async <T>(\n path: string,\n opts?: { method?: string; body?: unknown; params?: Record<string, string> },\n ): Promise<T> => {\n const jwt = await getStoreToken();\n return storeFetch<T>({ ...config, jwt }, path, { timeoutMs, ...opts });\n };\n return {\n me: () => call(\"/api/v1/me\"),\n sourcesAdd: (body) => call(\"/api/v1/sources\", { method: \"POST\", body }),\n sourcesList: () => call(\"/api/v1/sources\"),\n sourceSync: (id) => call(`/api/v1/sources/${id}/sync`, { method: \"POST\", body: {} }),\n jobGet: (jobId) => call(`/api/v1/jobs/${jobId}`),\n sourceCandidates: (id) => call(`/api/v1/sources/${id}/candidates`),\n assetPreview: (id) => call(`/api/v1/assets/${id}/preview`),\n assetPublish: (id, body, dryRun) =>\n call(`/api/v1/assets/${id}/publish`, {\n method: \"POST\",\n body,\n ...(dryRun ? { params: { dryRun: \"1\" } } : {}),\n }),\n assetUnpublish: (id) => call(`/api/v1/assets/${id}/unpublish`, { method: \"POST\", body: {} }),\n namespaceAvailability: (ns) =>\n call(`/api/v1/namespaces/${encodeURIComponent(ns)}/availability`),\n };\n}\n","/**\n * Shared store-interaction core for the two publish front-ends — the curator\n * sidecar flow (`source manifest publish`) and the first-party library flow\n * (`library publish`). Both differ only in their git side-effects + how they\n * resolve the source repo; the store orchestration below (register → sync →\n * candidates → per-asset preview+publish) is identical.\n *\n * The store REST surface is reached through the injectable {@link PublisherClient}\n * so the orchestration stays unit/integration-testable without a live store.\n *\n * @docLink cli/commands/source#manifest-publish\n */\n\nimport type { SkPublishManifest } from \"@skaile/workspaces/core\";\nimport { logErr, logInfo, logOk, logWarn, S } from \"../helpers.ts\";\nimport type { PublisherClient } from \"../store-publisher.ts\";\n\n/**\n * One-line rendering of a namespace-availability probe for a `--dry-run` plan.\n * The `message` is store-authored (identical to what a real publish would echo)\n * — we only prepend a status glyph so the reader sees green/amber/red at a\n * glance without the CLI re-deriving any authorization logic.\n */\nexport function formatNamespaceAvailability(a: {\n status: \"owned-by-you\" | \"claimable-by-you\" | \"reserved\" | \"available\";\n message: string;\n}): string {\n switch (a.status) {\n case \"owned-by-you\":\n case \"available\":\n return `${S.ok(\"✓\")} ${a.message}`;\n case \"claimable-by-you\":\n return `${S.warn(\"!\")} ${a.message}`;\n default:\n return `${S.err(\"✗\")} ${a.message}`;\n }\n}\n\n/**\n * Preflight the target namespace against the store's availability probe BEFORE a\n * publish does any irreversible work (a public git push). Returns `{ ok: false }`\n * with a guided message for `reserved` (not yours) and `claimable-by-you` (must\n * claim first) — the two states a real publish would reject — so the caller can\n * abort with actionable guidance instead of a raw 422 after pushing bytes.\n *\n * The probe is advisory: any failure (offline, older store) returns `{ ok: true }`\n * so the store stays the authority and a valid publish is never blocked.\n */\nexport async function preflightNamespace(\n client: PublisherClient,\n namespace: string,\n): Promise<{ ok: boolean; message?: string }> {\n let a: Awaited<ReturnType<PublisherClient[\"namespaceAvailability\"]>>;\n try {\n a = await client.namespaceAvailability(namespace);\n } catch {\n return { ok: true };\n }\n switch (a.status) {\n case \"owned-by-you\":\n case \"available\":\n return { ok: true };\n case \"claimable-by-you\":\n return {\n ok: false,\n message:\n `@${namespace} isn't yours yet — claim it in the store first` +\n `${a.claimMethod ? ` (${a.claimMethod})` : \"\"}, then re-run. ${a.message}`,\n };\n default: // reserved, or any unrecognized future status (fail safe → block)\n return { ok: false, message: `Cannot publish under @${namespace} — ${a.message}` };\n }\n}\n\n/** One candidate row shape the matcher operates on (kind + name are the key). */\ninterface CandidateLike {\n kind: string;\n name: string;\n}\n\n/**\n * Keep only candidates whose `(kind, name)` pair is declared in the manifest.\n * The backend may merge extra assets from the base repo into the candidate\n * list; a publish only touches what the manifest curated/declared.\n */\nexport function matchCandidatesToManifest<T extends CandidateLike>(\n candidates: T[],\n manifest: SkPublishManifest,\n): T[] {\n const wanted = new Set((manifest.assets ?? []).map((a) => `${a.kind}:${a.name}`));\n return candidates.filter((c) => wanted.has(`${c.kind}:${c.name}`));\n}\n\n/** A canonical ref string `kind:@publisher/name[#version]` for reporting. */\nexport function refFor(kind: string, publisher: string, name: string, version?: string): string {\n const base = `${kind}:@${publisher}/${name}`;\n return version ? `${base}#${version}` : base;\n}\n\n/** The bare asset name from a `kind:@publisher/name#version` ref or a plain name. */\nexport function bareName(ref: string): string {\n const afterKind = ref.includes(\":\") ? ref.slice(ref.indexOf(\":\") + 1) : ref;\n const afterScope = afterKind.includes(\"/\")\n ? afterKind.slice(afterKind.indexOf(\"/\") + 1)\n : afterKind;\n return afterScope.split(\"#\")[0];\n}\n\n/**\n * Poll a job until it leaves `running` or the deadline passes. Returns the last\n * observed state — the caller MUST treat a still-`running` result as a timeout\n * (not success), since it means the deadline was hit before the job finished.\n */\nexport async function pollJob(\n client: PublisherClient,\n jobId: string,\n intervalMs = 1_500,\n timeoutMs = 60_000,\n): Promise<{ status: string; items?: Array<{ label: string; status: string; error?: string }> }> {\n const deadline = Date.now() + timeoutMs;\n let job = await client.jobGet(jobId);\n while (job.status === \"running\" && Date.now() < deadline) {\n await new Promise((r) => setTimeout(r, intervalMs));\n job = await client.jobGet(jobId);\n }\n return job;\n}\n\n/**\n * True when a `sourcesAdd` rejection is a duplicate-URL conflict (the source is\n * already registered) — the only error the publish flow recovers from by looking\n * the existing row up. Every other failure (auth, 5xx, network) must propagate.\n */\nexport function isDupSourceError(err: unknown): boolean {\n const msg = (err instanceof Error ? err.message : String(err)).toLowerCase();\n return /\\b409\\b|conflict|duplicate|already exists|already registered|unique/.test(msg);\n}\n\n/**\n * Register + sync the source, then publish its curated/declared candidates —\n * the store-side steps shared by both publish front-ends. Git side-effects (the\n * sidecar push, or the library commit+push) happen in the caller *before* this;\n * this function is purely store interaction.\n *\n * The sidecar front-end passes `sidecar` (so `sourcesAdd` carries the sidecar\n * pin); the library front-end omits it (the source repo IS the manifest host).\n * `assetName`, when set, narrows publication to the single candidate of that\n * name. Fatal store states (`sourcesAdd` non-dup failure) surface; sync failures\n * and empty candidate sets `process.exit(1)` with the same messages as before.\n */\nexport async function publishToStore(opts: {\n sourceUrl: string;\n ref: string;\n sidecar?: { url: string; ref: string };\n manifest: SkPublishManifest;\n assetName?: string;\n client: PublisherClient;\n}): Promise<{ published: string[] }> {\n const { sourceUrl, ref, sidecar, manifest, assetName, client: pub } = opts;\n\n let sourceId: string;\n try {\n const added = await pub.sourcesAdd({\n url: sourceUrl,\n ref,\n ...(sidecar ? { sidecarUrl: sidecar.url, sidecarRef: sidecar.ref } : {}),\n // Publish under the manifest's declared namespace; the store resolves a\n // claimed Publisher when it differs from the caller's login, else defaults\n // to `@<username>`. Omitted when the manifest carries no publisher.\n ...(manifest.publisher ? { namespace: manifest.publisher } : {}),\n });\n sourceId = added.id;\n } catch (err) {\n // Only a duplicate-url conflict is recoverable (source already registered);\n // auth/5xx/network failures must surface, not silently reuse a stale row.\n if (!isDupSourceError(err)) throw err;\n const rows = await pub.sourcesList();\n const found = rows.find((r) => r.url === sourceUrl);\n if (!found) {\n throw new Error(\n `Source ${sourceUrl} looked already-registered but no owned row matched: ` +\n `${err instanceof Error ? err.message : String(err)}`,\n );\n }\n sourceId = found.id;\n }\n\n const { jobId } = await pub.sourceSync(sourceId);\n const job = await pollJob(pub, jobId);\n if (job.status === \"failed\" || job.status === \"cancelled\") {\n const failed = (job.items ?? []).filter((i) => i.status === \"failed\");\n for (const i of failed) logErr(`sync: ${i.label}: ${i.error ?? \"failed\"}`);\n logErr(`Source sync ${job.status}.`);\n process.exit(1);\n }\n // A still-`running` job means the poll deadline was hit — do NOT proceed on an\n // unfinished sync (it would read incomplete candidates).\n if (job.status === \"running\") {\n logErr(\"Source sync timed out before completing — re-run `publish`, or check the store.\");\n process.exit(1);\n }\n\n let candidates = matchCandidatesToManifest(await pub.sourceCandidates(sourceId), manifest);\n if (assetName) candidates = candidates.filter((c) => c.name === assetName);\n if (candidates.length === 0) {\n logWarn(\"No candidates discovered — check the manifest and the source ref.\");\n process.exit(1);\n }\n\n const published: string[] = [];\n for (const c of candidates) {\n try {\n const preview = await pub.assetPreview(c.id);\n const res = await pub.assetPublish(c.id, { ref, files: preview.discoveredFiles });\n // Publish is async — wait for the job so we only report refs that actually\n // landed, not ones whose import is still in flight or about to fail.\n if (res.jobId) {\n const pubJob = await pollJob(pub, res.jobId);\n if (pubJob.status !== \"succeeded\") {\n const errs = (pubJob.items ?? [])\n .filter((i) => i.status === \"failed\")\n .map((i) => i.error)\n .filter(Boolean);\n logWarn(\n `Publish of ${c.kind}:${c.name} did not succeed (${pubJob.status})` +\n (errs.length ? `: ${errs.join(\"; \")}` : \"\"),\n );\n continue;\n }\n }\n published.push(refFor(c.kind, preview.candidate.publisherNamespace, c.name, c.version));\n } catch (err) {\n logWarn(\n `Failed to publish ${c.kind}:${c.name}: ${err instanceof Error ? err.message : String(err)}`,\n );\n }\n }\n\n logOk(`Published ${published.length} asset(s):`);\n for (const r of published) logInfo(` ${r}`);\n return { published };\n}\n"]}
@@ -1,5 +1,5 @@
1
- import { logErr, logOk, colorRef, logInfo, S, logWarn, formatSoftDepHint } from './chunk-A565EFTW.js';
2
- import { AssetManager } from './chunk-AY4OKT3U.js';
1
+ import { logErr, logOk, colorRef, logInfo, S, logWarn, formatSoftDepHint } from './chunk-A3HTL7XV.js';
2
+ import { AssetManager } from './chunk-WWGU3REE.js';
3
3
  import { readLock } from './chunk-HSRHO7SK.js';
4
4
  import { SUPPORTED_DRIVER_TARGETS } from './chunk-MENCWIHW.js';
5
5
  import { parseAssetRef } from './chunk-GEEW6SY2.js';
@@ -82,7 +82,7 @@ async function runRefInstall(ref, opts) {
82
82
  const spinner2 = p.spinner();
83
83
  spinner2.start(`Installing ${ref}`);
84
84
  try {
85
- const { openCatalogSource, openLibrary } = await import('./open-library-4W2UGVJN.js');
85
+ const { openCatalogSource, openLibrary } = await import('./open-library-32XAI2LH.js');
86
86
  const catalog = await openCatalogSource({ projectDir: path.resolve(opts.projectDir) });
87
87
  if (!supportsInstallManifest(catalog)) {
88
88
  throw new Error(
@@ -122,7 +122,7 @@ async function runYamlInstall(opts) {
122
122
  return;
123
123
  }
124
124
  try {
125
- const { ensureSourcesCloned } = await import('./ensure-sources-YH6X5XI4.js');
125
+ const { ensureSourcesCloned } = await import('./ensure-sources-GEJGBQIP.js');
126
126
  const hydrate = ensureSourcesCloned(projectDir, { quiet: true });
127
127
  if (hydrate.cloned.length > 0) {
128
128
  logOk(`Cloned source(s): ${hydrate.cloned.join(", ")}`);
@@ -288,5 +288,5 @@ function makeCleanCommand() {
288
288
  }
289
289
 
290
290
  export { makeCheckCommand, makeCleanCommand, makeInstallCommand, reportInstalledSoftDeps, runPointerOnlyInstall, supportsInstallManifest };
291
- //# sourceMappingURL=chunk-UQTPSVJV.js.map
292
- //# sourceMappingURL=chunk-UQTPSVJV.js.map
291
+ //# sourceMappingURL=chunk-WJVBJAM5.js.map
292
+ //# sourceMappingURL=chunk-WJVBJAM5.js.map
@@ -1 +1 @@
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E,GAAA,EAAK,IAAA,CAAK,KAAK,CAAA;AAEzC,IAAA,OAAA,CAAQ,GAAA,EAAI;AACZ,IAAA,KAAA,MAAW,CAAA,IAAK,OAAO,OAAA,EAAS;AAC9B,MAAA,KAAA,CAAM,CAAA,QAAA,EAAW,CAAC,CAAA,CAAE,CAAA;AAAA,IACtB;AACA,IAAA,KAAA,MAAW,CAAA,IAAK,OAAO,OAAA,EAAS;AAC9B,MAAA,OAAA,CAAQ,WAAW,CAAA,CAAE,GAAG,CAAA,EAAA,EAAK,CAAA,CAAE,MAAM,CAAA,CAAE,CAAA;AAAA,IACzC;AACA,IAAA,IAAI,MAAA,CAAO,SAAA,CAAU,MAAA,GAAS,CAAA,EAAG;AAC/B,MAAA,OAAA,CAAQ,GAAA,EAAI;AACZ,MAAA,OAAA,CAAQ,CAAA,KAAA,EAAQ,MAAA,CAAO,SAAA,CAAU,MAAM,CAAA,oBAAA,CAAsB,CAAA;AAC7D,MAAA,KAAA,MAAW,CAAA,IAAK,OAAO,SAAA,EAAW;AAChC,QAAA,OAAA,CAAQ,IAAI,CAAA,IAAA,EAAO,CAAA,CAAE,GAAA,CAAI,CAAC,CAAC,CAAA,CAAE,CAAA;AAAA,MAC/B;AAAA,IACF;AACA,IAAA,IAAI,KAAK,GAAA,EAAK;AACZ,MAAA,OAAA,CAAQ,GAAA,EAAI;AACZ,MAAA,KAAA,CAAM,sBAAsB,CAAA;AAAA,IAC9B;AAAA,EACF,CAAC,CAAA;AACL","file":"chunk-UQTPSVJV.js","sourcesContent":["import path from \"node:path\";\nimport * as p from \"@clack/prompts\";\nimport { AssetManager } from \"@skaile/workspaces/asset-manager\";\nimport {\n type DriverTarget,\n parseAssetRef,\n readLock,\n SUPPORTED_DRIVER_TARGETS,\n} from \"@skaile/workspaces/core\";\nimport type { InstallManifest } from \"@skaile/workspaces/types\";\nimport { Command } from \"commander\";\nimport { colorRef, formatSoftDepHint, logErr, logInfo, logOk, logWarn, S } from \"../helpers.ts\";\n\n/**\n * Canonical asset-ref shape accepted by `skaile install <ref>`:\n * `kind:@<publisher>/<name>#<version>` (the `#` version sigil). Validated via\n * `parseAssetRef` so the CLI shares the single canonical grammar; the legacy\n * trailing-`@version` shape is rejected.\n */\nconst REF_HINT = \"kind:@<publisher>/<name>#<version> (e.g. skill:@skaile/use-exa#1.0.0)\";\n\n/** True when `ref` parses as a canonical asset ref. */\nfunction isValidAssetRef(ref: string): boolean {\n try {\n parseAssetRef(ref);\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Minimal catalog-source surface the pointer-only install path needs.\n * `RemoteCatalogSource` satisfies this — narrowing keeps {@link runPointerOnlyInstall}\n * testable with a hand-rolled stub.\n */\nexport interface InstallManifestSource {\n getInstallManifest(ref: string): Promise<InstallManifest>;\n}\n\n/**\n * Capability check: is this catalog source able to serve install manifests?\n *\n * `openCatalogSource` returns a `RemoteCatalogSource | RestCatalogSource`.\n * Only the tRPC-framed `RemoteCatalogSource` implements `getInstallManifest`;\n * the REST-framed `RestCatalogSource` (the default for any catalog URL other\n * than `https://skaile.store`) does not. Calling it unconditionally would be a\n * runtime `TypeError`, so the pointer-only install path must capability-detect\n * first and fail with a clear, actionable message.\n */\nexport function supportsInstallManifest(source: unknown): source is InstallManifestSource {\n return (\n typeof (source as { getInstallManifest?: unknown } | null | undefined)?.getInstallManifest ===\n \"function\"\n );\n}\n\n/**\n * Minimal library surface the pointer-only install path needs.\n * `LocalIndex` satisfies this.\n */\nexport interface InstallLibrary {\n install(manifest: InstallManifest): Promise<{ installPath: string }>;\n}\n\n/**\n * Result of a pointer-only catalog install.\n */\nexport interface PointerOnlyInstallResult {\n /** Absolute path the verified asset bytes were written to. */\n installPath: string;\n /** The pinned upstream commit SHA the asset was fetched at. */\n commitSha: string;\n /** Number of files in the install manifest. */\n fileCount: number;\n}\n\n/**\n * Pointer-only catalog install — the `skaile install <ref>` code path.\n *\n * 1. Resolves the pointer-only {@link InstallManifest} from the Catalog.\n * 2. Hands it to the library, which fetches each file's bytes directly from\n * the upstream repo at the pinned commit, verifies every per-file SHA256\n * plus the composite SHA256, and only then writes the verified files.\n *\n * Both dependencies are injected so the function is unit-testable without a\n * network round-trip. In production the CLI passes a `RemoteCatalogSource`\n * and a `LocalIndex`.\n *\n * @param ref - Asset ref (`<publisher>/<name>@<version>`, optional leading `@`).\n * @param deps - Injected catalog source + library.\n * @returns The install path, pinned commit SHA, and file count.\n * @throws When the ref is malformed, the manifest cannot be resolved, or any\n * hash verification fails. The underlying error message is surfaced as-is.\n */\nexport async function runPointerOnlyInstall(\n ref: string,\n deps: { catalog: InstallManifestSource; library: InstallLibrary },\n): Promise<PointerOnlyInstallResult> {\n let requested: ReturnType<typeof parseAssetRef>;\n try {\n requested = parseAssetRef(ref);\n } catch (e) {\n throw new Error(\n `malformed asset ref '${ref}' — expected ${REF_HINT}: ${e instanceof Error ? e.message : String(e)}`,\n );\n }\n const manifest = await deps.catalog.getInstallManifest(ref);\n // [M1] Identity check: the catalog must not install a different asset than\n // requested. Compare the PARSED refs (kind/publisher/name/pin) so equivalent\n // spellings (optional `kind:`, default `skill`) are treated as the same ref.\n const got = parseAssetRef(manifest.ref);\n if (\n got.kind !== requested.kind ||\n got.publisher !== requested.publisher ||\n got.name !== requested.name ||\n got.pin !== requested.pin\n ) {\n throw new Error(\n `catalog identity mismatch: requested '${ref}' but the catalog returned a manifest for '${manifest.ref}'`,\n );\n }\n const { installPath } = await deps.library.install(manifest);\n return {\n installPath,\n commitSha: manifest.source.commitSha,\n fileCount: manifest.files.length,\n };\n}\n\n/**\n * Creates the `skaile install` command.\n *\n * Two modes, selected by argument shape:\n *\n * - `skaile install` (no positional arg) — reads `skaile.yaml` and deploys all\n * declared assets (and their transitive dependencies) to the configured\n * driver target directory. Supports `--locked` for CI-mode install from a\n * lock file.\n * - `skaile install <publisher>/<name>@<version>` — pointer-only catalog\n * install: resolves the pointer-only install manifest from the configured\n * Catalog, fetches each file's bytes directly from the upstream repo at the\n * pinned commit, verifies every per-file + the composite SHA256, then writes\n * the verified files into the local Library.\n *\n * @returns Configured {@link Command} ready for `program.addCommand()`.\n * @docLink cli/commands/project#make-install-command\n */\nexport function makeInstallCommand(): Command {\n return new Command(\"install\")\n .description(`Install dependencies from skaile.yaml, or a single asset by ref (${REF_HINT})`)\n .argument(\"[ref]\", `Asset ref to install from the Catalog (${REF_HINT})`)\n .option(\"--locked\", \"Install from lock file (CI mode — fails on drift)\")\n .option(\"--project-dir <path>\", \"Project directory\", process.cwd())\n .option(\"--target <agent>\", \"Agent framework\", \"claude-code\")\n .option(\n \"--global\",\n \"Install the global SSOT (~/.skaile/skaile.yaml), fanning out to every global backend\",\n )\n .option(\n \"--backend <ids>\",\n \"Comma-separated global backends to install into (default: all resolved); implies --global\",\n )\n .option(\n \"--link\",\n \"symlink local-path assets instead of copying (dev loop; machine-local, not for committing)\",\n )\n .action(runInstallCommand);\n}\n\n/** Options shape accepted by the `skaile install` command action. */\ninterface InstallCommandOptions {\n locked?: boolean;\n projectDir: string;\n target: string;\n global?: boolean;\n backend?: string;\n link?: boolean;\n}\n\n/**\n * Parse a `--backend a,b` value into validated {@link DriverTarget}s, exiting on\n * an unknown id. Returns `undefined` when the flag is absent (resolve the full\n * global set instead).\n */\nfunction parseBackendFilter(raw: string | undefined): DriverTarget[] | undefined {\n if (!raw) return undefined;\n const ids = raw\n .split(\",\")\n .map((s) => s.trim())\n .filter(Boolean);\n const out: DriverTarget[] = [];\n for (const id of ids) {\n if (!(SUPPORTED_DRIVER_TARGETS as string[]).includes(id)) {\n logErr(`unknown backend '${id}' — expected one of: ${SUPPORTED_DRIVER_TARGETS.join(\", \")}`);\n process.exit(1);\n }\n out.push(id as DriverTarget);\n }\n return out.length > 0 ? out : undefined;\n}\n\n/**\n * `skaile install` action body. Dispatches by argument shape:\n * a positional `ref` selects pointer-only catalog install, otherwise the\n * legacy `skaile.yaml` install path runs.\n */\nasync function runInstallCommand(\n ref: string | undefined,\n opts: InstallCommandOptions,\n): Promise<void> {\n // ── Pointer-only catalog install: `skaile install <ref>` ──────────────\n if (ref !== undefined) {\n await runRefInstall(ref, opts);\n return;\n }\n\n // ── Legacy install: `skaile install` reads skaile.yaml ────────────────\n await runYamlInstall(opts);\n}\n\n/** Pointer-only catalog install path for `skaile install <ref>`. */\nasync function runRefInstall(ref: string, opts: InstallCommandOptions): Promise<void> {\n if (!isValidAssetRef(ref)) {\n logErr(`malformed asset ref '${ref}' — expected ${REF_HINT}`);\n process.exit(1);\n }\n const spinner = p.spinner();\n spinner.start(`Installing ${ref}`);\n try {\n const { openCatalogSource, openLibrary } = await import(\"../open-library.ts\");\n const catalog = await openCatalogSource({ projectDir: path.resolve(opts.projectDir) });\n // [H2] REST-framed catalogs (the default for any catalog URL other\n // than https://skaile.store) cannot serve install manifests. Detect\n // and fail clearly rather than throwing a runtime TypeError.\n if (!supportsInstallManifest(catalog)) {\n throw new Error(\n \"pointer-only install (skaile install <ref>) requires a tRPC-framed Catalog. \" +\n \"The configured catalog uses REST framing, which does not serve install \" +\n \"manifests. Set catalog.url to https://skaile.store, or catalog.framing: trpc, \" +\n \"in ~/.skaile/config.yaml.\",\n );\n }\n const library = await openLibrary();\n try {\n const result = await runPointerOnlyInstall(ref, { catalog, library });\n spinner.stop(\"Done\");\n logOk(`Installed ${colorRef(ref)}`);\n logInfo(`Path: ${S.dim(result.installPath)}`);\n logInfo(`Commit: ${S.dim(result.commitSha)}`);\n logInfo(`Files: ${S.dim(String(result.fileCount))}`);\n logInfo(\n S.dim(`Installed globally (see Path above) — use \\`skaile add ${ref}\\` to deploy into this project.`),\n );\n } finally {\n library.close();\n }\n } catch (err) {\n spinner.stop(\"Failed\");\n const msg = err instanceof Error ? err.message : String(err);\n if (/unreachable/i.test(msg)) {\n logErr(`asset uninstallable — source commit no longer available (${msg})`);\n } else {\n logErr(msg);\n }\n process.exit(1);\n }\n}\n\n/** Legacy install path for bare `skaile install` (reads skaile.yaml). */\nasync function runYamlInstall(opts: InstallCommandOptions): Promise<void> {\n const projectDir = path.resolve(opts.projectDir);\n\n const backends = parseBackendFilter(opts.backend);\n // `--backend` implies `--global`.\n if (opts.global || backends) {\n await runGlobalInstall(opts, backends);\n return;\n }\n\n // Hydrate sources declared in skaile.yaml before resolving assets, so\n // freshly checked-out projects pull their source clones automatically.\n try {\n const { ensureSourcesCloned } = await import(\"../ensure-sources.ts\");\n const hydrate = ensureSourcesCloned(projectDir, { quiet: true });\n if (hydrate.cloned.length > 0) {\n logOk(`Cloned source(s): ${hydrate.cloned.join(\", \")}`);\n }\n if (hydrate.failed.length > 0) {\n logErr(`Failed to clone source(s): ${hydrate.failed.join(\", \")}`);\n }\n } catch (err) {\n logWarn(`source hydration skipped: ${err instanceof Error ? err.message : String(err)}`);\n }\n\n const am = new AssetManager({\n projectDir,\n driverTarget: opts.target as DriverTarget,\n });\n const spinner = p.spinner();\n spinner.start(opts.locked ? \"Installing from lock file\" : \"Installing dependencies\");\n try {\n const result = await am.install({ locked: opts.locked, link: opts.link });\n spinner.stop(\"Done\");\n if (result.deployed.length > 0) {\n for (const d of result.deployed) logOk(d);\n }\n if (result.removed.length > 0) {\n for (const r of result.removed) logWarn(`Removed: ${r}`);\n }\n if (result.deployed.length === 0 && result.removed.length === 0) {\n logInfo(\"Nothing to install (already up to date).\");\n }\n if (result.missing.length > 0) {\n for (const m of result.missing) logErr(`Missing: ${m}`);\n // Partial-miss must fail the process — CI can't otherwise distinguish a\n // clean install from \"half the assets never resolved\".\n process.exitCode = 1;\n }\n if (result.lockWritten) {\n logInfo(`Lock file written: ${S.dim(\"skaile.lock.yaml\")}`);\n }\n // Report-only: surface soft deps the declared assets reference but aren't\n // present. Never a prompt — install is a batch/CI path. Skipped under\n // --locked: that mode is \"restore exactly\", so an `add` nudge would jar.\n if (!opts.locked) await reportInstalledSoftDeps(am);\n } catch (err) {\n spinner.stop(\"Failed\");\n logErr(String(err));\n process.exit(1);\n }\n}\n\n/**\n * Report (never prompt) the body-link soft deps that the declared assets\n * reference but that aren't in the project — the `install` counterpart to the\n * `add`-time soft-dep surface. `install` is a batch/CI path (often non-TTY), so\n * it only ever prints a hint: pulling stays an explicit `skaile add`. Best-effort\n * — `reportSoftDeps` swallows any index failure and returns `[]`.\n */\nexport async function reportInstalledSoftDeps(\n am: Pick<AssetManager, \"listDeclared\" | \"reportSoftDeps\">,\n onHint: (line: string) => void = (l) => logInfo(S.dim(l)),\n): Promise<void> {\n try {\n const declared = (await am.listDeclared()).map((d) => d.ref);\n if (declared.length === 0) return;\n const edges = await am.reportSoftDeps(declared);\n for (const edge of edges) onHint(formatSoftDepHint(edge));\n } catch {\n // Best-effort: a soft-dep report must never fail an install that succeeded.\n }\n}\n\n/**\n * Global cross-backend install: deploy every dep declared in the global SSOT\n * (`~/.skaile/skaile.yaml`) into each resolved global backend's dir under `~`,\n * write the global lock (`~/.skaile/skaile.lock.yaml`), then print per-backend\n * state. `backends` is the `--backend` filter (omit for the full resolved set).\n */\nasync function runGlobalInstall(\n opts: InstallCommandOptions,\n backends: DriverTarget[] | undefined,\n): Promise<void> {\n const am = new AssetManager({\n projectDir: path.resolve(opts.projectDir),\n global: true,\n backends,\n });\n const spinner = p.spinner();\n spinner.start(\"Installing global dependencies\");\n try {\n const result = await am.install({ locked: opts.locked, link: opts.link });\n spinner.stop(\"Done\");\n if (result.deployed.length > 0) for (const d of result.deployed) logOk(d);\n if (result.removed.length > 0) for (const r of result.removed) logWarn(`Removed: ${r}`);\n if (result.deployed.length === 0 && result.removed.length === 0)\n logInfo(\"Nothing to install (already up to date).\");\n if (result.missing.length > 0) {\n for (const m of result.missing) logErr(`Missing: ${m}`);\n process.exitCode = 1;\n }\n if (result.lockWritten) logInfo(`Global lock written: ${S.dim(\"~/.skaile/skaile.lock.yaml\")}`);\n\n // Per-backend reconciliation summary so a partial fan-out is visible.\n const state = am.globalState({});\n const byBackend = new Map<string, number>();\n for (const s of state)\n if (s.state === \"installed\") byBackend.set(s.backend, (byBackend.get(s.backend) ?? 0) + 1);\n for (const [backend, n] of byBackend) logInfo(`${backend}: ${n} installed`);\n } catch (err) {\n spinner.stop(\"Failed\");\n logErr(String(err));\n process.exit(1);\n }\n}\n\n/**\n * Creates the `skaile check` command.\n *\n * Scans all deployed assets for unmet dependency requirements **and** the\n * declared set for deps that resolved into the lock but never materialized, and\n * exits with code 1 if either is found. `doctor()` alone only walks *deployed*\n * assets' `requires`, so a declared dep whose bytes never landed (e.g. a\n * store-sourced `mcp-server`) used to report \"satisfied\" (#462).\n *\n * @returns Configured {@link Command} ready for `program.addCommand()`.\n * @docLink cli/commands/project#make-check-command\n */\nexport function makeCheckCommand(): Command {\n return new Command(\"check\")\n .description(\"Check for unmet requirements\")\n .option(\"--project-dir <path>\", \"Project directory\", process.cwd())\n .action(async (opts) => {\n const am = new AssetManager({ projectDir: path.resolve(opts.projectDir) });\n const issues = await am.doctor();\n // A project with no (or an unreadable) skaile.yaml has no declared set to\n // reconcile — treat it as drift-free so `check` behaves as it always has.\n let drifted: Awaited<ReturnType<typeof am.listDeclared>> = [];\n try {\n drifted = (await am.listDeclared()).filter((d) => d.state === \"drift\");\n } catch {\n // ignored — doctor() below is still authoritative for deployed assets.\n }\n if (issues.length === 0 && drifted.length === 0) {\n logOk(\"All dependencies satisfied.\");\n } else {\n for (const i of issues) {\n logErr(\n `${i.assetKind}:${i.assetName} requires ${i.depKind}:${i.depName} (${i.inRepos ? \"fixable\" : \"not found\"})`,\n );\n }\n for (const d of drifted) {\n logErr(`${d.ref} is declared and locked but not materialized — run \\`skaile install\\``);\n }\n process.exit(1);\n }\n });\n}\n\n/**\n * Creates the `skaile clean` command.\n *\n * Removes all skaile-managed assets tracked in `skaile.lock.yaml` from the\n * workspace. With `--all` also removes history, patches, repos, and the lock\n * file itself. Preserves unmanaged (manually placed) assets.\n *\n * @returns Configured {@link Command} ready for `program.addCommand()`.\n * @docLink cli/commands/project#make-clean-command\n */\nexport function makeCleanCommand(): Command {\n return new Command(\"clean\")\n .description(\"Remove all skaile-managed assets from the workspace\")\n .option(\"--all\", \"Full reset: also remove history, patches, repos, and lock file\")\n .option(\"--dry-run\", \"Show what would be removed without doing it\")\n .option(\"-y, --yes\", \"Skip confirmation prompt\")\n .option(\"--project-dir <path>\", \"Project directory\", process.cwd())\n .option(\"--target <agent>\", \"Agent framework\", \"claude-code\")\n .action(async (opts) => {\n const am = new AssetManager({\n projectDir: path.resolve(opts.projectDir),\n driverTarget: opts.target as DriverTarget,\n });\n\n // Preview: load lock file to show what will be cleaned\n const lock = readLock(path.resolve(opts.projectDir, \"skaile.lock.yaml\"));\n\n if (!lock || Object.keys(lock.assets).length === 0) {\n logInfo(\"Nothing to clean (no skaile-managed assets found).\");\n return;\n }\n\n const assetRefs = Object.keys(lock.assets);\n console.log();\n console.log(` ${S.heading(\"Assets to remove:\")} ${S.dim(`(${assetRefs.length})`)}`);\n for (const ref of assetRefs) {\n console.log(` ${colorRef(ref)}`);\n }\n\n if (opts.all) {\n console.log();\n console.log(` ${S.heading(\"Also removing:\")}`);\n console.log(` ${S.dim(\".skaile/history.yaml\")}`);\n console.log(` ${S.dim(\".skaile/patches/\")}`);\n console.log(` ${S.dim(\"skaile.lock.yaml\")}`);\n }\n\n if (opts.dryRun) {\n console.log();\n logInfo(\"Dry run — no changes made.\");\n return;\n }\n\n if (!opts.yes) {\n const confirm = await p.confirm({ message: \"Proceed?\" });\n if (p.isCancel(confirm) || !confirm) {\n logInfo(\"Cancelled.\");\n return;\n }\n }\n\n const result = am.clean({ all: opts.all });\n\n console.log();\n for (const r of result.removed) {\n logOk(`Removed ${r}`);\n }\n for (const s of result.skipped) {\n logWarn(`Skipped ${s.ref}: ${s.reason}`);\n }\n if (result.unmanaged.length > 0) {\n console.log();\n logInfo(`Kept ${result.unmanaged.length} unmanaged asset(s):`);\n for (const u of result.unmanaged) {\n console.log(` ${S.dim(u)}`);\n }\n }\n if (opts.all) {\n console.log();\n logOk(\"Full reset complete.\");\n }\n });\n}\n"]}
1
+ {"version":3,"sources":["../cli/src/commands/project.ts"],"names":["spinner","confirm"],"m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AAA,CAAQ,GAAA,EAAI;AACZ,IAAA,KAAA,MAAW,CAAA,IAAK,OAAO,OAAA,EAAS;AAC9B,MAAA,KAAA,CAAM,CAAA,QAAA,EAAW,CAAC,CAAA,CAAE,CAAA;AAAA,IACtB;AACA,IAAA,KAAA,MAAW,CAAA,IAAK,OAAO,OAAA,EAAS;AAC9B,MAAA,OAAA,CAAQ,WAAW,CAAA,CAAE,GAAG,CAAA,EAAA,EAAK,CAAA,CAAE,MAAM,CAAA,CAAE,CAAA;AAAA,IACzC;AACA,IAAA,IAAI,MAAA,CAAO,SAAA,CAAU,MAAA,GAAS,CAAA,EAAG;AAC/B,MAAA,OAAA,CAAQ,GAAA,EAAI;AACZ,MAAA,OAAA,CAAQ,CAAA,KAAA,EAAQ,MAAA,CAAO,SAAA,CAAU,MAAM,CAAA,oBAAA,CAAsB,CAAA;AAC7D,MAAA,KAAA,MAAW,CAAA,IAAK,OAAO,SAAA,EAAW;AAChC,QAAA,OAAA,CAAQ,IAAI,CAAA,IAAA,EAAO,CAAA,CAAE,GAAA,CAAI,CAAC,CAAC,CAAA,CAAE,CAAA;AAAA,MAC/B;AAAA,IACF;AACA,IAAA,IAAI,KAAK,GAAA,EAAK;AACZ,MAAA,OAAA,CAAQ,GAAA,EAAI;AACZ,MAAA,KAAA,CAAM,sBAAsB,CAAA;AAAA,IAC9B;AAAA,EACF,CAAC,CAAA;AACL","file":"chunk-WJVBJAM5.js","sourcesContent":["import path from \"node:path\";\nimport * as p from \"@clack/prompts\";\nimport { AssetManager } from \"@skaile/workspaces/asset-manager\";\nimport {\n type DriverTarget,\n parseAssetRef,\n readLock,\n SUPPORTED_DRIVER_TARGETS,\n} from \"@skaile/workspaces/core\";\nimport type { InstallManifest } from \"@skaile/workspaces/types\";\nimport { Command } from \"commander\";\nimport { colorRef, formatSoftDepHint, logErr, logInfo, logOk, logWarn, S } from \"../helpers.ts\";\n\n/**\n * Canonical asset-ref shape accepted by `skaile install <ref>`:\n * `kind:@<publisher>/<name>#<version>` (the `#` version sigil). Validated via\n * `parseAssetRef` so the CLI shares the single canonical grammar; the legacy\n * trailing-`@version` shape is rejected.\n */\nconst REF_HINT = \"kind:@<publisher>/<name>#<version> (e.g. skill:@skaile/use-exa#1.0.0)\";\n\n/** True when `ref` parses as a canonical asset ref. */\nfunction isValidAssetRef(ref: string): boolean {\n try {\n parseAssetRef(ref);\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Minimal catalog-source surface the pointer-only install path needs.\n * `RemoteCatalogSource` satisfies this — narrowing keeps {@link runPointerOnlyInstall}\n * testable with a hand-rolled stub.\n */\nexport interface InstallManifestSource {\n getInstallManifest(ref: string): Promise<InstallManifest>;\n}\n\n/**\n * Capability check: is this catalog source able to serve install manifests?\n *\n * `openCatalogSource` returns a `RemoteCatalogSource | RestCatalogSource`.\n * Only the tRPC-framed `RemoteCatalogSource` implements `getInstallManifest`;\n * the REST-framed `RestCatalogSource` (the default for any catalog URL other\n * than `https://skaile.store`) does not. Calling it unconditionally would be a\n * runtime `TypeError`, so the pointer-only install path must capability-detect\n * first and fail with a clear, actionable message.\n */\nexport function supportsInstallManifest(source: unknown): source is InstallManifestSource {\n return (\n typeof (source as { getInstallManifest?: unknown } | null | undefined)?.getInstallManifest ===\n \"function\"\n );\n}\n\n/**\n * Minimal library surface the pointer-only install path needs.\n * `LocalIndex` satisfies this.\n */\nexport interface InstallLibrary {\n install(manifest: InstallManifest): Promise<{ installPath: string }>;\n}\n\n/**\n * Result of a pointer-only catalog install.\n */\nexport interface PointerOnlyInstallResult {\n /** Absolute path the verified asset bytes were written to. */\n installPath: string;\n /** The pinned upstream commit SHA the asset was fetched at. */\n commitSha: string;\n /** Number of files in the install manifest. */\n fileCount: number;\n}\n\n/**\n * Pointer-only catalog install — the `skaile install <ref>` code path.\n *\n * 1. Resolves the pointer-only {@link InstallManifest} from the Catalog.\n * 2. Hands it to the library, which fetches each file's bytes directly from\n * the upstream repo at the pinned commit, verifies every per-file SHA256\n * plus the composite SHA256, and only then writes the verified files.\n *\n * Both dependencies are injected so the function is unit-testable without a\n * network round-trip. In production the CLI passes a `RemoteCatalogSource`\n * and a `LocalIndex`.\n *\n * @param ref - Asset ref (`<publisher>/<name>@<version>`, optional leading `@`).\n * @param deps - Injected catalog source + library.\n * @returns The install path, pinned commit SHA, and file count.\n * @throws When the ref is malformed, the manifest cannot be resolved, or any\n * hash verification fails. The underlying error message is surfaced as-is.\n */\nexport async function runPointerOnlyInstall(\n ref: string,\n deps: { catalog: InstallManifestSource; library: InstallLibrary },\n): Promise<PointerOnlyInstallResult> {\n let requested: ReturnType<typeof parseAssetRef>;\n try {\n requested = parseAssetRef(ref);\n } catch (e) {\n throw new Error(\n `malformed asset ref '${ref}' — expected ${REF_HINT}: ${e instanceof Error ? e.message : String(e)}`,\n );\n }\n const manifest = await deps.catalog.getInstallManifest(ref);\n // [M1] Identity check: the catalog must not install a different asset than\n // requested. Compare the PARSED refs (kind/publisher/name/pin) so equivalent\n // spellings (optional `kind:`, default `skill`) are treated as the same ref.\n const got = parseAssetRef(manifest.ref);\n if (\n got.kind !== requested.kind ||\n got.publisher !== requested.publisher ||\n got.name !== requested.name ||\n got.pin !== requested.pin\n ) {\n throw new Error(\n `catalog identity mismatch: requested '${ref}' but the catalog returned a manifest for '${manifest.ref}'`,\n );\n }\n const { installPath } = await deps.library.install(manifest);\n return {\n installPath,\n commitSha: manifest.source.commitSha,\n fileCount: manifest.files.length,\n };\n}\n\n/**\n * Creates the `skaile install` command.\n *\n * Two modes, selected by argument shape:\n *\n * - `skaile install` (no positional arg) — reads `skaile.yaml` and deploys all\n * declared assets (and their transitive dependencies) to the configured\n * driver target directory. Supports `--locked` for CI-mode install from a\n * lock file.\n * - `skaile install <publisher>/<name>@<version>` — pointer-only catalog\n * install: resolves the pointer-only install manifest from the configured\n * Catalog, fetches each file's bytes directly from the upstream repo at the\n * pinned commit, verifies every per-file + the composite SHA256, then writes\n * the verified files into the local Library.\n *\n * @returns Configured {@link Command} ready for `program.addCommand()`.\n * @docLink cli/commands/project#make-install-command\n */\nexport function makeInstallCommand(): Command {\n return new Command(\"install\")\n .description(`Install dependencies from skaile.yaml, or a single asset by ref (${REF_HINT})`)\n .argument(\"[ref]\", `Asset ref to install from the Catalog (${REF_HINT})`)\n .option(\"--locked\", \"Install from lock file (CI mode — fails on drift)\")\n .option(\"--project-dir <path>\", \"Project directory\", process.cwd())\n .option(\"--target <agent>\", \"Agent framework\", \"claude-code\")\n .option(\n \"--global\",\n \"Install the global SSOT (~/.skaile/skaile.yaml), fanning out to every global backend\",\n )\n .option(\n \"--backend <ids>\",\n \"Comma-separated global backends to install into (default: all resolved); implies --global\",\n )\n .option(\n \"--link\",\n \"symlink local-path assets instead of copying (dev loop; machine-local, not for committing)\",\n )\n .action(runInstallCommand);\n}\n\n/** Options shape accepted by the `skaile install` command action. */\ninterface InstallCommandOptions {\n locked?: boolean;\n projectDir: string;\n target: string;\n global?: boolean;\n backend?: string;\n link?: boolean;\n}\n\n/**\n * Parse a `--backend a,b` value into validated {@link DriverTarget}s, exiting on\n * an unknown id. Returns `undefined` when the flag is absent (resolve the full\n * global set instead).\n */\nfunction parseBackendFilter(raw: string | undefined): DriverTarget[] | undefined {\n if (!raw) return undefined;\n const ids = raw\n .split(\",\")\n .map((s) => s.trim())\n .filter(Boolean);\n const out: DriverTarget[] = [];\n for (const id of ids) {\n if (!(SUPPORTED_DRIVER_TARGETS as string[]).includes(id)) {\n logErr(`unknown backend '${id}' — expected one of: ${SUPPORTED_DRIVER_TARGETS.join(\", \")}`);\n process.exit(1);\n }\n out.push(id as DriverTarget);\n }\n return out.length > 0 ? out : undefined;\n}\n\n/**\n * `skaile install` action body. Dispatches by argument shape:\n * a positional `ref` selects pointer-only catalog install, otherwise the\n * legacy `skaile.yaml` install path runs.\n */\nasync function runInstallCommand(\n ref: string | undefined,\n opts: InstallCommandOptions,\n): Promise<void> {\n // ── Pointer-only catalog install: `skaile install <ref>` ──────────────\n if (ref !== undefined) {\n await runRefInstall(ref, opts);\n return;\n }\n\n // ── Legacy install: `skaile install` reads skaile.yaml ────────────────\n await runYamlInstall(opts);\n}\n\n/** Pointer-only catalog install path for `skaile install <ref>`. */\nasync function runRefInstall(ref: string, opts: InstallCommandOptions): Promise<void> {\n if (!isValidAssetRef(ref)) {\n logErr(`malformed asset ref '${ref}' — expected ${REF_HINT}`);\n process.exit(1);\n }\n const spinner = p.spinner();\n spinner.start(`Installing ${ref}`);\n try {\n const { openCatalogSource, openLibrary } = await import(\"../open-library.ts\");\n const catalog = await openCatalogSource({ projectDir: path.resolve(opts.projectDir) });\n // [H2] REST-framed catalogs (the default for any catalog URL other\n // than https://skaile.store) cannot serve install manifests. Detect\n // and fail clearly rather than throwing a runtime TypeError.\n if (!supportsInstallManifest(catalog)) {\n throw new Error(\n \"pointer-only install (skaile install <ref>) requires a tRPC-framed Catalog. \" +\n \"The configured catalog uses REST framing, which does not serve install \" +\n \"manifests. Set catalog.url to https://skaile.store, or catalog.framing: trpc, \" +\n \"in ~/.skaile/config.yaml.\",\n );\n }\n const library = await openLibrary();\n try {\n const result = await runPointerOnlyInstall(ref, { catalog, library });\n spinner.stop(\"Done\");\n logOk(`Installed ${colorRef(ref)}`);\n logInfo(`Path: ${S.dim(result.installPath)}`);\n logInfo(`Commit: ${S.dim(result.commitSha)}`);\n logInfo(`Files: ${S.dim(String(result.fileCount))}`);\n logInfo(\n S.dim(`Installed globally (see Path above) — use \\`skaile add ${ref}\\` to deploy into this project.`),\n );\n } finally {\n library.close();\n }\n } catch (err) {\n spinner.stop(\"Failed\");\n const msg = err instanceof Error ? err.message : String(err);\n if (/unreachable/i.test(msg)) {\n logErr(`asset uninstallable — source commit no longer available (${msg})`);\n } else {\n logErr(msg);\n }\n process.exit(1);\n }\n}\n\n/** Legacy install path for bare `skaile install` (reads skaile.yaml). */\nasync function runYamlInstall(opts: InstallCommandOptions): Promise<void> {\n const projectDir = path.resolve(opts.projectDir);\n\n const backends = parseBackendFilter(opts.backend);\n // `--backend` implies `--global`.\n if (opts.global || backends) {\n await runGlobalInstall(opts, backends);\n return;\n }\n\n // Hydrate sources declared in skaile.yaml before resolving assets, so\n // freshly checked-out projects pull their source clones automatically.\n try {\n const { ensureSourcesCloned } = await import(\"../ensure-sources.ts\");\n const hydrate = ensureSourcesCloned(projectDir, { quiet: true });\n if (hydrate.cloned.length > 0) {\n logOk(`Cloned source(s): ${hydrate.cloned.join(\", \")}`);\n }\n if (hydrate.failed.length > 0) {\n logErr(`Failed to clone source(s): ${hydrate.failed.join(\", \")}`);\n }\n } catch (err) {\n logWarn(`source hydration skipped: ${err instanceof Error ? err.message : String(err)}`);\n }\n\n const am = new AssetManager({\n projectDir,\n driverTarget: opts.target as DriverTarget,\n });\n const spinner = p.spinner();\n spinner.start(opts.locked ? \"Installing from lock file\" : \"Installing dependencies\");\n try {\n const result = await am.install({ locked: opts.locked, link: opts.link });\n spinner.stop(\"Done\");\n if (result.deployed.length > 0) {\n for (const d of result.deployed) logOk(d);\n }\n if (result.removed.length > 0) {\n for (const r of result.removed) logWarn(`Removed: ${r}`);\n }\n if (result.deployed.length === 0 && result.removed.length === 0) {\n logInfo(\"Nothing to install (already up to date).\");\n }\n if (result.missing.length > 0) {\n for (const m of result.missing) logErr(`Missing: ${m}`);\n // Partial-miss must fail the process — CI can't otherwise distinguish a\n // clean install from \"half the assets never resolved\".\n process.exitCode = 1;\n }\n if (result.lockWritten) {\n logInfo(`Lock file written: ${S.dim(\"skaile.lock.yaml\")}`);\n }\n // Report-only: surface soft deps the declared assets reference but aren't\n // present. Never a prompt — install is a batch/CI path. Skipped under\n // --locked: that mode is \"restore exactly\", so an `add` nudge would jar.\n if (!opts.locked) await reportInstalledSoftDeps(am);\n } catch (err) {\n spinner.stop(\"Failed\");\n logErr(String(err));\n process.exit(1);\n }\n}\n\n/**\n * Report (never prompt) the body-link soft deps that the declared assets\n * reference but that aren't in the project — the `install` counterpart to the\n * `add`-time soft-dep surface. `install` is a batch/CI path (often non-TTY), so\n * it only ever prints a hint: pulling stays an explicit `skaile add`. Best-effort\n * — `reportSoftDeps` swallows any index failure and returns `[]`.\n */\nexport async function reportInstalledSoftDeps(\n am: Pick<AssetManager, \"listDeclared\" | \"reportSoftDeps\">,\n onHint: (line: string) => void = (l) => logInfo(S.dim(l)),\n): Promise<void> {\n try {\n const declared = (await am.listDeclared()).map((d) => d.ref);\n if (declared.length === 0) return;\n const edges = await am.reportSoftDeps(declared);\n for (const edge of edges) onHint(formatSoftDepHint(edge));\n } catch {\n // Best-effort: a soft-dep report must never fail an install that succeeded.\n }\n}\n\n/**\n * Global cross-backend install: deploy every dep declared in the global SSOT\n * (`~/.skaile/skaile.yaml`) into each resolved global backend's dir under `~`,\n * write the global lock (`~/.skaile/skaile.lock.yaml`), then print per-backend\n * state. `backends` is the `--backend` filter (omit for the full resolved set).\n */\nasync function runGlobalInstall(\n opts: InstallCommandOptions,\n backends: DriverTarget[] | undefined,\n): Promise<void> {\n const am = new AssetManager({\n projectDir: path.resolve(opts.projectDir),\n global: true,\n backends,\n });\n const spinner = p.spinner();\n spinner.start(\"Installing global dependencies\");\n try {\n const result = await am.install({ locked: opts.locked, link: opts.link });\n spinner.stop(\"Done\");\n if (result.deployed.length > 0) for (const d of result.deployed) logOk(d);\n if (result.removed.length > 0) for (const r of result.removed) logWarn(`Removed: ${r}`);\n if (result.deployed.length === 0 && result.removed.length === 0)\n logInfo(\"Nothing to install (already up to date).\");\n if (result.missing.length > 0) {\n for (const m of result.missing) logErr(`Missing: ${m}`);\n process.exitCode = 1;\n }\n if (result.lockWritten) logInfo(`Global lock written: ${S.dim(\"~/.skaile/skaile.lock.yaml\")}`);\n\n // Per-backend reconciliation summary so a partial fan-out is visible.\n const state = am.globalState({});\n const byBackend = new Map<string, number>();\n for (const s of state)\n if (s.state === \"installed\") byBackend.set(s.backend, (byBackend.get(s.backend) ?? 0) + 1);\n for (const [backend, n] of byBackend) logInfo(`${backend}: ${n} installed`);\n } catch (err) {\n spinner.stop(\"Failed\");\n logErr(String(err));\n process.exit(1);\n }\n}\n\n/**\n * Creates the `skaile check` command.\n *\n * Scans all deployed assets for unmet dependency requirements **and** the\n * declared set for deps that resolved into the lock but never materialized, and\n * exits with code 1 if either is found. `doctor()` alone only walks *deployed*\n * assets' `requires`, so a declared dep whose bytes never landed (e.g. a\n * store-sourced `mcp-server`) used to report \"satisfied\" (#462).\n *\n * @returns Configured {@link Command} ready for `program.addCommand()`.\n * @docLink cli/commands/project#make-check-command\n */\nexport function makeCheckCommand(): Command {\n return new Command(\"check\")\n .description(\"Check for unmet requirements\")\n .option(\"--project-dir <path>\", \"Project directory\", process.cwd())\n .action(async (opts) => {\n const am = new AssetManager({ projectDir: path.resolve(opts.projectDir) });\n const issues = await am.doctor();\n // A project with no (or an unreadable) skaile.yaml has no declared set to\n // reconcile — treat it as drift-free so `check` behaves as it always has.\n let drifted: Awaited<ReturnType<typeof am.listDeclared>> = [];\n try {\n drifted = (await am.listDeclared()).filter((d) => d.state === \"drift\");\n } catch {\n // ignored — doctor() below is still authoritative for deployed assets.\n }\n if (issues.length === 0 && drifted.length === 0) {\n logOk(\"All dependencies satisfied.\");\n } else {\n for (const i of issues) {\n logErr(\n `${i.assetKind}:${i.assetName} requires ${i.depKind}:${i.depName} (${i.inRepos ? \"fixable\" : \"not found\"})`,\n );\n }\n for (const d of drifted) {\n logErr(`${d.ref} is declared and locked but not materialized — run \\`skaile install\\``);\n }\n process.exit(1);\n }\n });\n}\n\n/**\n * Creates the `skaile clean` command.\n *\n * Removes all skaile-managed assets tracked in `skaile.lock.yaml` from the\n * workspace. With `--all` also removes history, patches, repos, and the lock\n * file itself. Preserves unmanaged (manually placed) assets.\n *\n * @returns Configured {@link Command} ready for `program.addCommand()`.\n * @docLink cli/commands/project#make-clean-command\n */\nexport function makeCleanCommand(): Command {\n return new Command(\"clean\")\n .description(\"Remove all skaile-managed assets from the workspace\")\n .option(\"--all\", \"Full reset: also remove history, patches, repos, and lock file\")\n .option(\"--dry-run\", \"Show what would be removed without doing it\")\n .option(\"-y, --yes\", \"Skip confirmation prompt\")\n .option(\"--project-dir <path>\", \"Project directory\", process.cwd())\n .option(\"--target <agent>\", \"Agent framework\", \"claude-code\")\n .action(async (opts) => {\n const am = new AssetManager({\n projectDir: path.resolve(opts.projectDir),\n driverTarget: opts.target as DriverTarget,\n });\n\n // Preview: load lock file to show what will be cleaned\n const lock = readLock(path.resolve(opts.projectDir, \"skaile.lock.yaml\"));\n\n if (!lock || Object.keys(lock.assets).length === 0) {\n logInfo(\"Nothing to clean (no skaile-managed assets found).\");\n return;\n }\n\n const assetRefs = Object.keys(lock.assets);\n console.log();\n console.log(` ${S.heading(\"Assets to remove:\")} ${S.dim(`(${assetRefs.length})`)}`);\n for (const ref of assetRefs) {\n console.log(` ${colorRef(ref)}`);\n }\n\n if (opts.all) {\n console.log();\n console.log(` ${S.heading(\"Also removing:\")}`);\n console.log(` ${S.dim(\".skaile/history.yaml\")}`);\n console.log(` ${S.dim(\".skaile/patches/\")}`);\n console.log(` ${S.dim(\"skaile.lock.yaml\")}`);\n }\n\n if (opts.dryRun) {\n console.log();\n logInfo(\"Dry run — no changes made.\");\n return;\n }\n\n if (!opts.yes) {\n const confirm = await p.confirm({ message: \"Proceed?\" });\n if (p.isCancel(confirm) || !confirm) {\n logInfo(\"Cancelled.\");\n return;\n }\n }\n\n const result = am.clean({ all: opts.all });\n\n console.log();\n for (const r of result.removed) {\n logOk(`Removed ${r}`);\n }\n for (const s of result.skipped) {\n logWarn(`Skipped ${s.ref}: ${s.reason}`);\n }\n if (result.unmanaged.length > 0) {\n console.log();\n logInfo(`Kept ${result.unmanaged.length} unmanaged asset(s):`);\n for (const u of result.unmanaged) {\n console.log(` ${S.dim(u)}`);\n }\n }\n if (opts.all) {\n console.log();\n logOk(\"Full reset complete.\");\n }\n });\n}\n"]}
@@ -2096,5 +2096,5 @@ var AssetManager = class {
2096
2096
  };
2097
2097
 
2098
2098
  export { AssetManager, FACTORY_SOURCE_URL, MissingManifestError, NON_DEPLOYABLE_KINDS, normalizeRepoUrl, parseCanonicalLockKey, parseRefTolerant, renderMcpServerConfig, softDepName };
2099
- //# sourceMappingURL=chunk-AY4OKT3U.js.map
2100
- //# sourceMappingURL=chunk-AY4OKT3U.js.map
2099
+ //# sourceMappingURL=chunk-WWGU3REE.js.map
2100
+ //# sourceMappingURL=chunk-WWGU3REE.js.map