@skaile/workspaces 1.8.0 → 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/dist/app-sdk/index.js +1 -1
  3. package/dist/{asset-feeds-Y66NCOQZ.js → asset-feeds-SS336LXB.js} +4 -4
  4. package/dist/{asset-feeds-Y66NCOQZ.js.map → asset-feeds-SS336LXB.js.map} +1 -1
  5. package/dist/asset-manager/index.js +1 -1
  6. package/dist/{chunk-VBRXFLIP.js → chunk-4DFBHEXQ.js} +2 -2
  7. package/dist/{chunk-VBRXFLIP.js.map → chunk-4DFBHEXQ.js.map} +1 -1
  8. package/dist/{chunk-O3D4KYFG.js → chunk-5DC744E3.js} +3 -3
  9. package/dist/{chunk-O3D4KYFG.js.map → chunk-5DC744E3.js.map} +1 -1
  10. package/dist/{chunk-M3Y5KM6F.js → chunk-DTZ7JUZY.js} +129 -60
  11. package/dist/chunk-DTZ7JUZY.js.map +1 -0
  12. package/dist/{chunk-PP2LOT4W.js → chunk-GKPUN2YQ.js} +3 -3
  13. package/dist/{chunk-PP2LOT4W.js.map → chunk-GKPUN2YQ.js.map} +1 -1
  14. package/dist/{chunk-UPZGQZEJ.js → chunk-MW7GNYRT.js} +3 -3
  15. package/dist/{chunk-UPZGQZEJ.js.map → chunk-MW7GNYRT.js.map} +1 -1
  16. package/dist/{chunk-35OWUKOD.js → chunk-MWZGGCMF.js} +2 -2
  17. package/dist/{chunk-35OWUKOD.js.map → chunk-MWZGGCMF.js.map} +1 -1
  18. package/dist/{chunk-TITPPC54.js → chunk-OMBYBUOF.js} +3 -3
  19. package/dist/{chunk-TITPPC54.js.map → chunk-OMBYBUOF.js.map} +1 -1
  20. package/dist/{chunk-Y3UCU4ZK.js → chunk-QY47VHNI.js} +2 -2
  21. package/dist/{chunk-Y3UCU4ZK.js.map → chunk-QY47VHNI.js.map} +1 -1
  22. package/dist/{chunk-34U5UC6G.js → chunk-R5UMZEBH.js} +6 -6
  23. package/dist/{chunk-34U5UC6G.js.map → chunk-R5UMZEBH.js.map} +1 -1
  24. package/dist/{chunk-THJZ3JZE.js → chunk-TJNEKDWS.js} +6 -6
  25. package/dist/{chunk-THJZ3JZE.js.map → chunk-TJNEKDWS.js.map} +1 -1
  26. package/dist/{chunk-S74G7AZL.js → chunk-UNJGSISX.js} +3 -3
  27. package/dist/{chunk-S74G7AZL.js.map → chunk-UNJGSISX.js.map} +1 -1
  28. package/dist/{chunk-PK7Q7MC7.js → chunk-XJOPAGZX.js} +4 -4
  29. package/dist/{chunk-PK7Q7MC7.js.map → chunk-XJOPAGZX.js.map} +1 -1
  30. package/dist/cli/index.js +25 -25
  31. package/dist/connectors/index.js +1 -1
  32. package/dist/{ensure-sources-NXBYK5GP.js → ensure-sources-ELLWRQAT.js} +4 -4
  33. package/dist/{ensure-sources-NXBYK5GP.js.map → ensure-sources-ELLWRQAT.js.map} +1 -1
  34. package/dist/factory-assets/connectors/box.js +1 -1
  35. package/dist/factory-assets/connectors/deploy.js +1 -1
  36. package/dist/factory-assets/connectors/devserver.js +1 -1
  37. package/dist/factory-assets/connectors/flow/adapter.d.ts +3 -2
  38. package/dist/factory-assets/connectors/flow/adapter.d.ts.map +1 -1
  39. package/dist/factory-assets/connectors/flow/adapter.js +1 -1
  40. package/dist/factory-assets/connectors/flow/run-flow.js +2 -2
  41. package/dist/factory-assets/connectors/flow.js +1 -1
  42. package/dist/factory-assets/connectors/git.js +1 -1
  43. package/dist/factory-assets/connectors/gmail.js +1 -1
  44. package/dist/factory-assets/connectors/googledrive.js +1 -1
  45. package/dist/factory-assets/connectors/local.js +1 -1
  46. package/dist/factory-assets/connectors/mattermost.js +1 -1
  47. package/dist/factory-assets/connectors/memory.js +1 -1
  48. package/dist/factory-assets/connectors/minio.js +1 -1
  49. package/dist/factory-assets/connectors/postgres.js +1 -1
  50. package/dist/factory-assets/connectors/s3.js +1 -1
  51. package/dist/factory-assets/connectors/sharepoint.js +1 -1
  52. package/dist/factory-assets/connectors/sqlite.js +1 -1
  53. package/dist/factory-assets/connectors/static-server.js +1 -1
  54. package/dist/factory-assets/connectors/tunnel.js +1 -1
  55. package/dist/factory-assets/connectors/webdav.js +1 -1
  56. package/dist/factory-assets/connectors/xstate-store.js +1 -1
  57. package/dist/factory-assets/connectors/xstate.js +1 -1
  58. package/dist/{helpers-DN4MWOHB.js → helpers-7Y4DTFR6.js} +4 -4
  59. package/dist/{helpers-DN4MWOHB.js.map → helpers-7Y4DTFR6.js.map} +1 -1
  60. package/dist/{library-publish-TPWFSO3Q.js → library-publish-7AH63NKA.js} +6 -6
  61. package/dist/{library-publish-TPWFSO3Q.js.map → library-publish-7AH63NKA.js.map} +1 -1
  62. package/dist/{open-library-ST2VFQTK.js → open-library-J2PRSM3J.js} +5 -5
  63. package/dist/{open-library-ST2VFQTK.js.map → open-library-J2PRSM3J.js.map} +1 -1
  64. package/dist/{project-4M6QXHCH.js → project-CSNHUQFK.js} +5 -5
  65. package/dist/{project-4M6QXHCH.js.map → project-CSNHUQFK.js.map} +1 -1
  66. package/dist/runner/index.js +4 -4
  67. package/dist/runner/src/serve.d.ts +67 -4
  68. package/dist/runner/src/serve.d.ts.map +1 -1
  69. package/dist/sdk/asset-manager.js +1 -1
  70. package/dist/sdk/index.js +4 -4
  71. package/dist/sdk/runner.js +4 -4
  72. package/dist/sdk/session.js +2 -2
  73. package/dist/sdk/types.js +1 -1
  74. package/dist/session/index.js +2 -2
  75. package/dist/{source-KUWAEJOO.js → source-4YG45QO6.js} +6 -6
  76. package/dist/{source-KUWAEJOO.js.map → source-4YG45QO6.js.map} +1 -1
  77. package/dist/{source-manifest-publish-FTSKRYPI.js → source-manifest-publish-RFU4YBC6.js} +7 -7
  78. package/dist/{source-manifest-publish-FTSKRYPI.js.map → source-manifest-publish-RFU4YBC6.js.map} +1 -1
  79. package/dist/tui/index.js +4 -4
  80. package/dist/types/index.js +1 -1
  81. package/dist/types/src/flow.d.ts +26 -28
  82. package/dist/types/src/flow.d.ts.map +1 -1
  83. package/dist/types/src/index.d.ts +1 -1
  84. package/dist/types/src/index.d.ts.map +1 -1
  85. package/dist/types/src/lifecycle.d.ts +0 -8
  86. package/dist/types/src/lifecycle.d.ts.map +1 -1
  87. package/dist/types/src/version.d.ts +17 -1
  88. package/dist/types/src/version.d.ts.map +1 -1
  89. package/dist/workspace-plugin/index.js +1 -1
  90. package/package.json +1 -1
  91. package/dist/chunk-M3Y5KM6F.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { softDepName } from './chunk-Y3UCU4ZK.js';
1
+ import { softDepName } from './chunk-QY47VHNI.js';
2
2
  import pc from 'picocolors';
3
3
 
4
4
  var S = {
@@ -94,5 +94,5 @@ function formatRelativeTime(date) {
94
94
  }
95
95
 
96
96
  export { KIND_COL_WIDTH, S, bareSoftDepName, colorRef, fitWidth, formatRelativeTime, formatSoftDepAddPreview, formatSoftDepHint, formatSoftDepRemovePreview, formatSoftDepSection, kindColor, kindColorPad, logErr, logInfo, logOk, logWarn };
97
- //# sourceMappingURL=chunk-O3D4KYFG.js.map
98
- //# sourceMappingURL=chunk-O3D4KYFG.js.map
97
+ //# sourceMappingURL=chunk-5DC744E3.js.map
98
+ //# sourceMappingURL=chunk-5DC744E3.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../cli/src/helpers.ts"],"names":[],"mappings":";;;AAQO,IAAM,CAAA,GAAI;AAAA,EACf,KAAA,EAAO,CAAC,CAAA,KAAc,EAAA,CAAG,KAAK,EAAA,CAAG,IAAA,CAAK,CAAC,CAAC,CAAA;AAAA,EACxC,GAAA,EAAK,CAAC,CAAA,KAAc,EAAA,CAAG,KAAK,CAAC,CAAA;AAAA,EAC7B,OAAA,EAAS,CAAC,CAAA,KAAc,EAAA,CAAG,KAAK,CAAC,CAAA;AAAA,EACjC,IAAA,EAAM,CAAC,CAAA,KAAc,EAAA,CAAG,KAAK,CAAC,CAAA;AAAA,EAC9B,GAAA,EAAK,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IAAA,CAAK,IAAI,CAAC,CAAA,2BAAA,CAA6B,CAAA;AACpF;AAOO,SAAS,0BAAA,CAA2B,MAAc,OAAA,EAA2B;AAClF,EAAA,IAAI,OAAA,CAAQ,MAAA,KAAW,CAAA,EAAG,OAAO,EAAA;AACjC,EAAA,OAAO,CAAA,CAAE,IAAI,CAAA,SAAA,EAAY,IAAI,iBAAiB,OAAA,CAAQ,IAAA,CAAK,IAAI,CAAC,CAAA,WAAA,CAAa,CAAA;AAC/E;AAGO,SAAS,mBAAmB,IAAA,EAAoB;AACrD,EAAA,MAAM,IAAA,GAAO,IAAA,CAAK,GAAA,EAAI,GAAI,KAAK,OAAA,EAAQ;AACvC,EAAA,MAAM,OAAA,GAAU,IAAA,CAAK,KAAA,CAAM,IAAA,GAAO,GAAI,CAAA;AACtC,EAAA,IAAI,OAAA,GAAU,IAAI,OAAO,UAAA;AACzB,EAAA,MAAM,OAAA,GAAU,IAAA,CAAK,KAAA,CAAM,OAAA,GAAU,EAAE,CAAA;AACvC,EAAA,IAAI,OAAA,GAAU,EAAA,EAAI,OAAO,CAAA,EAAG,OAAO,CAAA,KAAA,CAAA;AACnC,EAAA,MAAM,KAAA,GAAQ,IAAA,CAAK,KAAA,CAAM,OAAA,GAAU,EAAE,CAAA;AACrC,EAAA,IAAI,KAAA,GAAQ,EAAA,EAAI,OAAO,CAAA,EAAG,KAAK,CAAA,KAAA,CAAA;AAC/B,EAAA,MAAM,IAAA,GAAO,IAAA,CAAK,KAAA,CAAM,KAAA,GAAQ,EAAE,CAAA;AAClC,EAAA,OAAO,GAAG,IAAI,CAAA,KAAA,CAAA;AAChB","file":"chunk-O3D4KYFG.js","sourcesContent":["import { softDepName } from \"@skaile/workspaces/asset-manager\";\nimport pc from \"picocolors\";\n\n/**\n * Terminal styling helpers used across all CLI commands.\n *\n * @docLink cli/dev-guide#helpers\n */\nexport const S = {\n brand: (s: string) => pc.cyan(pc.bold(s)),\n cmd: (s: string) => pc.cyan(s),\n heading: (s: string) => pc.bold(s),\n bold: (s: string) => pc.bold(s),\n dim: (s: string) => pc.dim(s),\n ok: (s: string) => pc.green(s),\n warn: (s: string) => pc.yellow(s),\n err: (s: string) => pc.red(s),\n label: (s: string) => pc.dim(s),\n rule: (w = 40) => pc.dim(\"─\".repeat(w)),\n};\n\nconst KIND_COLORS: Record<string, (s: string) => string> = {\n skill: pc.blue,\n agent: pc.magenta,\n prompt: pc.yellow,\n flow: pc.green,\n bundle: pc.cyan,\n contract: pc.red,\n connector: pc.green,\n mount: pc.green,\n knowledge: pc.cyan,\n persona: pc.cyan,\n ruleset: pc.cyan,\n \"mcp-server\": pc.magenta,\n};\n\n/**\n * Fit a plain (ANSI-free) string into exactly `width` columns: truncate with a\n * trailing `…` when too long, pad with spaces when too short. Keeps fixed-width\n * columns from overflowing the row when a value (e.g. an asset name) is wider\n * than its budget.\n */\nexport function fitWidth(s: string, width: number): string {\n if (width <= 0) return \"\";\n if (s.length > width) return width === 1 ? \"…\" : `${s.slice(0, width - 1)}…`;\n return s.padEnd(width);\n}\n\n/** Color-code an asset kind string. */\nexport function kindColor(kind: string): string {\n const colorFn = KIND_COLORS[kind] ?? pc.dim;\n return colorFn(kind);\n}\n\n/**\n * Widest kind label (`mcp-server`); the default kind-column width fits it so\n * long kinds don't shove the rest of the row out of alignment.\n */\nexport const KIND_COL_WIDTH = 10;\n\n/**\n * Color-code an asset kind string fit to exactly `width` columns — pads short\n * kinds, truncates over-long ones (via {@link fitWidth}) so the column can never\n * overflow and break row alignment.\n */\nexport function kindColorPad(kind: string, width = KIND_COL_WIDTH): string {\n const colorFn = KIND_COLORS[kind] ?? pc.dim;\n return colorFn(fitWidth(kind, width));\n}\n\n/** Color-code a \"kind:name\" reference string. */\nexport function colorRef(ref: string): string {\n const colonIdx = ref.indexOf(\":\");\n if (colonIdx === -1) return ref;\n const kind = ref.slice(0, colonIdx);\n const rest = ref.slice(colonIdx);\n return `${kindColor(kind)}${rest}`;\n}\n\n/**\n * Print a success line prefixed with a green check mark.\n *\n * @param msg - Message to display.\n * @docLink cli/dev-guide#helpers\n */\nexport function logOk(msg: string) {\n console.log(` ${pc.green(\"✓\")} ${msg}`);\n}\n/**\n * Print an error line prefixed with a red cross to stderr.\n *\n * @param msg - Message to display.\n * @docLink cli/dev-guide#helpers\n */\nexport function logErr(msg: string) {\n console.error(` ${pc.red(\"✗\")} ${msg}`);\n}\n/**\n * Print a warning line prefixed with a yellow exclamation mark.\n *\n * @param msg - Message to display.\n * @docLink cli/dev-guide#helpers\n */\nexport function logWarn(msg: string) {\n console.log(` ${pc.yellow(\"!\")} ${msg}`);\n}\n/**\n * Print an info line prefixed with a dim dot.\n *\n * @param msg - Message to display.\n * @docLink cli/dev-guide#helpers\n */\nexport function logInfo(msg: string) {\n console.log(` ${pc.dim(\"·\")} ${msg}`);\n}\n\n/**\n * Bare asset name of a canonical soft-dep target ref (`@pub/name@ver` → `name`),\n * for compact rendering in `info` / `tree` / `why`. Delegates to the asset-manager\n * parser (the soft-dep read surface) so the two never diverge.\n */\nexport function bareSoftDepName(ref: string): string {\n return softDepName(ref);\n}\n\n/**\n * The report-only soft-dep hint line shared by the `add` no-TTY branch and the\n * `install` surface, so the two user-facing wordings can't drift. Appends a\n * runnable `skaile add` suffix only when the target has a parseable ref.\n */\nexport function formatSoftDepHint(edge: { from: string; to: string; toRef?: string }): string {\n const suffix = edge.toRef ? ` — run \\`skaile add ${edge.toRef}\\` to include it.` : \"\";\n return `${bareSoftDepName(edge.from)} references ${bareSoftDepName(edge.to)} (soft dependency)${suffix}`;\n}\n\n/**\n * Build the \"Soft dependencies (inferred)\" section for `skaile info`. Returns one\n * header line plus one line per soft-dep target, each marked `(soft)` to read\n * differently from a typed `requires`. Empty array when there are no soft deps,\n * so the caller prints nothing.\n */\nexport function formatSoftDepSection(targets: string[]): string[] {\n if (targets.length === 0) return [];\n const out = [` ${S.label(\"Soft dependencies (inferred)\")}:`];\n for (const t of targets) out.push(` ${S.dim(\"·\")} ${t} ${S.dim(\"(soft)\")}`);\n return out;\n}\n\n/**\n * Footer line previewing the soft deps that *adding* the highlighted asset would\n * reference (manage TUI). \"references\" + \"not auto-added\" makes clear the pull is\n * report-only. Empty string when there are no targets, so the caller clears.\n */\nexport function formatSoftDepAddPreview(name: string, targets: string[]): string {\n if (targets.length === 0) return \"\";\n return S.dim(`${name} references ${targets.join(\", \")} (soft dep, not auto-added)`);\n}\n\n/**\n * Footer line previewing the soft deps that *removing* the highlighted asset\n * would orphan (manage TUI) — symmetric with {@link formatSoftDepAddPreview}.\n * Empty string when nothing would be orphaned, so the caller clears.\n */\nexport function formatSoftDepRemovePreview(name: string, targets: string[]): string {\n if (targets.length === 0) return \"\";\n return S.dim(`removing ${name} would orphan ${targets.join(\", \")} (soft dep)`);\n}\n\n/** Format a Date as a human-readable relative time string (e.g. \"5m ago\"). */\nexport function formatRelativeTime(date: Date): string {\n const diff = Date.now() - date.getTime();\n const seconds = Math.floor(diff / 1000);\n if (seconds < 60) return \"just now\";\n const minutes = Math.floor(seconds / 60);\n if (minutes < 60) return `${minutes}m ago`;\n const hours = Math.floor(minutes / 60);\n if (hours < 24) return `${hours}h ago`;\n const days = Math.floor(hours / 24);\n return `${days}d ago`;\n}\n"]}
1
+ {"version":3,"sources":["../cli/src/helpers.ts"],"names":[],"mappings":";;;AAQO,IAAM,CAAA,GAAI;AAAA,EACf,KAAA,EAAO,CAAC,CAAA,KAAc,EAAA,CAAG,KAAK,EAAA,CAAG,IAAA,CAAK,CAAC,CAAC,CAAA;AAAA,EACxC,GAAA,EAAK,CAAC,CAAA,KAAc,EAAA,CAAG,KAAK,CAAC,CAAA;AAAA,EAC7B,OAAA,EAAS,CAAC,CAAA,KAAc,EAAA,CAAG,KAAK,CAAC,CAAA;AAAA,EACjC,IAAA,EAAM,CAAC,CAAA,KAAc,EAAA,CAAG,KAAK,CAAC,CAAA;AAAA,EAC9B,GAAA,EAAK,CAAC,CAAA,KAAc,EAAA,CAAG,IAAI,CAAC,CAAA;AAAA,EAC5B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O,SAAS,0BAAA,CAA2B,MAAc,OAAA,EAA2B;AAClF,EAAA,IAAI,OAAA,CAAQ,MAAA,KAAW,CAAA,EAAG,OAAO,EAAA;AACjC,EAAA,OAAO,CAAA,CAAE,IAAI,CAAA,SAAA,EAAY,IAAI,iBAAiB,OAAA,CAAQ,IAAA,CAAK,IAAI,CAAC,CAAA,WAAA,CAAa,CAAA;AAC/E;AAGO,SAAS,mBAAmB,IAAA,EAAoB;AACrD,EAAA,MAAM,IAAA,GAAO,IAAA,CAAK,GAAA,EAAI,GAAI,KAAK,OAAA,EAAQ;AACvC,EAAA,MAAM,OAAA,GAAU,IAAA,CAAK,KAAA,CAAM,IAAA,GAAO,GAAI,CAAA;AACtC,EAAA,IAAI,OAAA,GAAU,IAAI,OAAO,UAAA;AACzB,EAAA,MAAM,OAAA,GAAU,IAAA,CAAK,KAAA,CAAM,OAAA,GAAU,EAAE,CAAA;AACvC,EAAA,IAAI,OAAA,GAAU,EAAA,EAAI,OAAO,CAAA,EAAG,OAAO,CAAA,KAAA,CAAA;AACnC,EAAA,MAAM,KAAA,GAAQ,IAAA,CAAK,KAAA,CAAM,OAAA,GAAU,EAAE,CAAA;AACrC,EAAA,IAAI,KAAA,GAAQ,EAAA,EAAI,OAAO,CAAA,EAAG,KAAK,CAAA,KAAA,CAAA;AAC/B,EAAA,MAAM,IAAA,GAAO,IAAA,CAAK,KAAA,CAAM,KAAA,GAAQ,EAAE,CAAA;AAClC,EAAA,OAAO,GAAG,IAAI,CAAA,KAAA,CAAA;AAChB","file":"chunk-5DC744E3.js","sourcesContent":["import { softDepName } from \"@skaile/workspaces/asset-manager\";\nimport pc from \"picocolors\";\n\n/**\n * Terminal styling helpers used across all CLI commands.\n *\n * @docLink cli/dev-guide#helpers\n */\nexport const S = {\n brand: (s: string) => pc.cyan(pc.bold(s)),\n cmd: (s: string) => pc.cyan(s),\n heading: (s: string) => pc.bold(s),\n bold: (s: string) => pc.bold(s),\n dim: (s: string) => pc.dim(s),\n ok: (s: string) => pc.green(s),\n warn: (s: string) => pc.yellow(s),\n err: (s: string) => pc.red(s),\n label: (s: string) => pc.dim(s),\n rule: (w = 40) => pc.dim(\"─\".repeat(w)),\n};\n\nconst KIND_COLORS: Record<string, (s: string) => string> = {\n skill: pc.blue,\n agent: pc.magenta,\n prompt: pc.yellow,\n flow: pc.green,\n bundle: pc.cyan,\n contract: pc.red,\n connector: pc.green,\n mount: pc.green,\n knowledge: pc.cyan,\n persona: pc.cyan,\n ruleset: pc.cyan,\n \"mcp-server\": pc.magenta,\n};\n\n/**\n * Fit a plain (ANSI-free) string into exactly `width` columns: truncate with a\n * trailing `…` when too long, pad with spaces when too short. Keeps fixed-width\n * columns from overflowing the row when a value (e.g. an asset name) is wider\n * than its budget.\n */\nexport function fitWidth(s: string, width: number): string {\n if (width <= 0) return \"\";\n if (s.length > width) return width === 1 ? \"…\" : `${s.slice(0, width - 1)}…`;\n return s.padEnd(width);\n}\n\n/** Color-code an asset kind string. */\nexport function kindColor(kind: string): string {\n const colorFn = KIND_COLORS[kind] ?? pc.dim;\n return colorFn(kind);\n}\n\n/**\n * Widest kind label (`mcp-server`); the default kind-column width fits it so\n * long kinds don't shove the rest of the row out of alignment.\n */\nexport const KIND_COL_WIDTH = 10;\n\n/**\n * Color-code an asset kind string fit to exactly `width` columns — pads short\n * kinds, truncates over-long ones (via {@link fitWidth}) so the column can never\n * overflow and break row alignment.\n */\nexport function kindColorPad(kind: string, width = KIND_COL_WIDTH): string {\n const colorFn = KIND_COLORS[kind] ?? pc.dim;\n return colorFn(fitWidth(kind, width));\n}\n\n/** Color-code a \"kind:name\" reference string. */\nexport function colorRef(ref: string): string {\n const colonIdx = ref.indexOf(\":\");\n if (colonIdx === -1) return ref;\n const kind = ref.slice(0, colonIdx);\n const rest = ref.slice(colonIdx);\n return `${kindColor(kind)}${rest}`;\n}\n\n/**\n * Print a success line prefixed with a green check mark.\n *\n * @param msg - Message to display.\n * @docLink cli/dev-guide#helpers\n */\nexport function logOk(msg: string) {\n console.log(` ${pc.green(\"✓\")} ${msg}`);\n}\n/**\n * Print an error line prefixed with a red cross to stderr.\n *\n * @param msg - Message to display.\n * @docLink cli/dev-guide#helpers\n */\nexport function logErr(msg: string) {\n console.error(` ${pc.red(\"✗\")} ${msg}`);\n}\n/**\n * Print a warning line prefixed with a yellow exclamation mark.\n *\n * @param msg - Message to display.\n * @docLink cli/dev-guide#helpers\n */\nexport function logWarn(msg: string) {\n console.log(` ${pc.yellow(\"!\")} ${msg}`);\n}\n/**\n * Print an info line prefixed with a dim dot.\n *\n * @param msg - Message to display.\n * @docLink cli/dev-guide#helpers\n */\nexport function logInfo(msg: string) {\n console.log(` ${pc.dim(\"·\")} ${msg}`);\n}\n\n/**\n * Bare asset name of a canonical soft-dep target ref (`@pub/name@ver` → `name`),\n * for compact rendering in `info` / `tree` / `why`. Delegates to the asset-manager\n * parser (the soft-dep read surface) so the two never diverge.\n */\nexport function bareSoftDepName(ref: string): string {\n return softDepName(ref);\n}\n\n/**\n * The report-only soft-dep hint line shared by the `add` no-TTY branch and the\n * `install` surface, so the two user-facing wordings can't drift. Appends a\n * runnable `skaile add` suffix only when the target has a parseable ref.\n */\nexport function formatSoftDepHint(edge: { from: string; to: string; toRef?: string }): string {\n const suffix = edge.toRef ? ` — run \\`skaile add ${edge.toRef}\\` to include it.` : \"\";\n return `${bareSoftDepName(edge.from)} references ${bareSoftDepName(edge.to)} (soft dependency)${suffix}`;\n}\n\n/**\n * Build the \"Soft dependencies (inferred)\" section for `skaile info`. Returns one\n * header line plus one line per soft-dep target, each marked `(soft)` to read\n * differently from a typed `requires`. Empty array when there are no soft deps,\n * so the caller prints nothing.\n */\nexport function formatSoftDepSection(targets: string[]): string[] {\n if (targets.length === 0) return [];\n const out = [` ${S.label(\"Soft dependencies (inferred)\")}:`];\n for (const t of targets) out.push(` ${S.dim(\"·\")} ${t} ${S.dim(\"(soft)\")}`);\n return out;\n}\n\n/**\n * Footer line previewing the soft deps that *adding* the highlighted asset would\n * reference (manage TUI). \"references\" + \"not auto-added\" makes clear the pull is\n * report-only. Empty string when there are no targets, so the caller clears.\n */\nexport function formatSoftDepAddPreview(name: string, targets: string[]): string {\n if (targets.length === 0) return \"\";\n return S.dim(`${name} references ${targets.join(\", \")} (soft dep, not auto-added)`);\n}\n\n/**\n * Footer line previewing the soft deps that *removing* the highlighted asset\n * would orphan (manage TUI) — symmetric with {@link formatSoftDepAddPreview}.\n * Empty string when nothing would be orphaned, so the caller clears.\n */\nexport function formatSoftDepRemovePreview(name: string, targets: string[]): string {\n if (targets.length === 0) return \"\";\n return S.dim(`removing ${name} would orphan ${targets.join(\", \")} (soft dep)`);\n}\n\n/** Format a Date as a human-readable relative time string (e.g. \"5m ago\"). */\nexport function formatRelativeTime(date: Date): string {\n const diff = Date.now() - date.getTime();\n const seconds = Math.floor(diff / 1000);\n if (seconds < 60) return \"just now\";\n const minutes = Math.floor(seconds / 60);\n if (minutes < 60) return `${minutes}m ago`;\n const hours = Math.floor(minutes / 60);\n if (hours < 24) return `${hours}h ago`;\n const days = Math.floor(hours / 24);\n return `${days}d ago`;\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { WorkspacePlugin } from './chunk-35OWUKOD.js';
1
+ import { WorkspacePlugin } from './chunk-MWZGGCMF.js';
2
2
  import { WebSocketServerTransport } from './chunk-WQ7DE5UC.js';
3
3
  import { assembleSystemPrompt, buildCapabilitiesPromptSection } from './chunk-W3UDISS2.js';
4
4
  import { EventNormalizer } from './chunk-HKX5VSWQ.js';
@@ -6,10 +6,10 @@ import { SUPPORTED_CLOUDS, CLOUD_SECRET_ENV_KEYS } from './chunk-ISQWMBKD.js';
6
6
  import { classifyClaudeSdkError } from './chunk-GAH4YRCI.js';
7
7
  import { createDriver } from './chunk-TNSCHS4I.js';
8
8
  import { deployCatalogEntry, undeployCatalogEntry } from './chunk-LV2HPH3C.js';
9
- import { registerBuiltinConnectors, buildConnectorPromptSection, findMissingPackages, installNpmPackages, ConnectorManager, ConnectorStartupError, buildSdkConnectorTools } from './chunk-VBRXFLIP.js';
9
+ import { registerBuiltinConnectors, buildConnectorPromptSection, findMissingPackages, installNpmPackages, ConnectorManager, ConnectorStartupError, buildSdkConnectorTools } from './chunk-4DFBHEXQ.js';
10
10
  import { loadConnectorDeclarations, SecretProviderChain, PreMintedSecretProvider, InMemorySecretProvider, resolvedConfigToDeclarations, deriveSingleMaterializedConnectorDeclaration } from './chunk-Y6FV73IH.js';
11
11
  import { renderStimulusPrompt, buildOrchestratorPrompt } from './chunk-DEYYRFQU.js';
12
- import { PROTOCOL_VERSION } from './chunk-PK7Q7MC7.js';
12
+ import { PROTOCOL_VERSION } from './chunk-XJOPAGZX.js';
13
13
  import { resolveSettings, resolveApiKey, providerEnvKey } from './chunk-5NZ56R63.js';
14
14
  import { resolveRuntimeAssets } from './chunk-7J7LQP6T.js';
15
15
  import { resolveSkWorkspaceConfig, resolveAgentDir, cloudConfigFromProfile, stageMaterializedSkills, loadMcpServerDeclarations, COMPACTION_DEFAULTS, validateAssetRecipeAttr, deriveSingleMaterializedMcpDeclaration } from './chunk-ISA7R7PK.js';
@@ -4032,6 +4032,11 @@ function splitConnectorsForWire(manager) {
4032
4032
  }
4033
4033
  return { mounts, connectors };
4034
4034
  }
4035
+ function pickRepointedManager(next, current, disposed) {
4036
+ if (next !== null) return next;
4037
+ if (current !== null && current === disposed) return null;
4038
+ return current;
4039
+ }
4035
4040
  function buildResourcesAvailablePayload(manager, mcpManager, driverLive, bakedServerIds) {
4036
4041
  const { mounts, connectors } = splitConnectorsForWire(manager);
4037
4042
  const mcp_servers = (mcpManager?.listServers() ?? []).map((s) => ({
@@ -4152,6 +4157,50 @@ function buildConnectorTokenMediator(deps) {
4152
4157
  }
4153
4158
  };
4154
4159
  }
4160
+ function planFlowMutate(cmd, ctx) {
4161
+ const isBareFlowId = cmd.id === "flow";
4162
+ const flowIntercept = ctx.isExistingFlow || isBareFlowId;
4163
+ const payload = cmd.payload ?? {};
4164
+ if (cmd.op === "start" && flowIntercept) {
4165
+ const flowDef = payload.flow;
4166
+ const seed = payload.seed;
4167
+ if (!flowDef?.id || !seed?.runId || !seed?.startedBy) {
4168
+ return {
4169
+ kind: "reject",
4170
+ reason: "flow.start payload missing required fields (need payload.flow.id, payload.seed.runId, payload.seed.startedBy)"
4171
+ };
4172
+ }
4173
+ if (ctx.hasActiveFlow) {
4174
+ return {
4175
+ kind: "reject",
4176
+ reason: "flow.start ignored: a flow is already active (one active flow per session; cancel it first)"
4177
+ };
4178
+ }
4179
+ return { kind: "create-start", flowDef, seed };
4180
+ }
4181
+ if (cmd.op === "hydrate" && flowIntercept && !ctx.hasActiveFlow) {
4182
+ const state = payload.state;
4183
+ if (!state || typeof state !== "object" || typeof state.runId !== "string") {
4184
+ return {
4185
+ kind: "reject",
4186
+ reason: "flow.hydrate payload missing required field payload.state (FlowExecution snapshot)"
4187
+ };
4188
+ }
4189
+ const flowDef = payload.flow;
4190
+ if (!flowDef?.id) {
4191
+ return {
4192
+ kind: "reject",
4193
+ reason: "flow.hydrate cannot bootstrap a cold container without payload.flow (FlowDefinition required when no flow is active)"
4194
+ };
4195
+ }
4196
+ return { kind: "create-hydrate", flowDef, execution: state };
4197
+ }
4198
+ let dispatchId = cmd.id;
4199
+ if (!ctx.targetExists && isBareFlowId && ctx.onlyActiveConnectorId) {
4200
+ dispatchId = ctx.onlyActiveConnectorId;
4201
+ }
4202
+ return { kind: "dispatch", dispatchId };
4203
+ }
4155
4204
  async function startAgentServer(opts) {
4156
4205
  const port = opts.port ?? 8080;
4157
4206
  const sessionId = opts.sessionId ?? process.env.SKAILE_SESSION_ID ?? "session-unknown";
@@ -4767,15 +4816,7 @@ async function startAgentServer(opts) {
4767
4816
  log(
4768
4817
  `[serve] restarting driver to register flow connector tools (resume=${prevSessionId ?? "none"})`
4769
4818
  );
4770
- await agentSession.dispose();
4771
- agentSession = await createAgentSession({
4772
- ...sessionConfig,
4773
- resumeSessionId: prevSessionId
4774
- });
4775
- emitSystemPromptComposed(agentSession, sendEvent);
4776
- swapDriver();
4777
- rebuildCompactionOrchestrator();
4778
- captureBakedMcpServers();
4819
+ await recreateAgentSession({ resumeSessionId: prevSessionId });
4779
4820
  }
4780
4821
  driver.config.mcpServers = { "skaile-connectors": server };
4781
4822
  log(`[serve] rebuilt MCP connector tools for flow ${connectorId}`);
@@ -5025,23 +5066,44 @@ async function startAgentServer(opts) {
5025
5066
  capabilityRegistry.register(cap, "agent");
5026
5067
  }
5027
5068
  log("[serve] session built from session_init envelope");
5069
+ } else if ((fallbackConnectorDeclarations?.length ?? 0) > 0 && !agentSession.resourceManager) {
5070
+ log(
5071
+ `[serve] session_init: recreating eagerly-built session to apply ${fallbackConnectorDeclarations.length} wire connector declaration(s) (no disk declarations)`
5072
+ );
5073
+ return { needsWireFallbackRecreate: true };
5028
5074
  }
5075
+ return { needsWireFallbackRecreate: false };
5029
5076
  }
5030
- async function recreateSessionForInit(pendingResumeSessionId) {
5077
+ async function recreateAgentSession(overrides) {
5078
+ const disposedManager = agentSession.resourceManager;
5031
5079
  await agentSession.dispose();
5032
- agentSession = await createAgentSession({
5033
- ...sessionConfig,
5034
- ...aiProviderConfigId ? { aiProviderConfigId } : {},
5035
- ...pendingResumeSessionId ? { resumeSessionId: pendingResumeSessionId } : {}
5036
- });
5080
+ agentSession = await createAgentSession({ ...sessionConfig, ...overrides });
5037
5081
  emitSystemPromptComposed(agentSession, sendEvent);
5038
5082
  swapDriver();
5039
5083
  rebuildCompactionOrchestrator();
5040
5084
  captureBakedMcpServers();
5041
- resourceManager = agentSession.resourceManager;
5085
+ const repointed = pickRepointedManager(
5086
+ agentSession.resourceManager,
5087
+ resourceManager,
5088
+ disposedManager
5089
+ );
5090
+ if (resourceManager !== null && resourceManager !== disposedManager && repointed !== resourceManager) {
5091
+ log(
5092
+ "[serve] WARNING: recreate displaced a lazily-created sharedState resource manager \u2014 registered shared-state stores were dropped and must be re-registered"
5093
+ );
5094
+ }
5095
+ resourceManager = repointed;
5042
5096
  agentSession.startWatching();
5043
5097
  emitAvailability();
5044
5098
  }
5099
+ async function recreateSessionForInit(pendingResumeSessionId) {
5100
+ await recreateAgentSession({
5101
+ ...aiProviderConfigId ? { aiProviderConfigId } : {},
5102
+ // Conditional, unlike the skill path's unconditional pass: here an absent
5103
+ // hint must fall through to sessionConfig's, which the platform may have set.
5104
+ ...pendingResumeSessionId ? { resumeSessionId: pendingResumeSessionId } : {}
5105
+ });
5106
+ }
5045
5107
  async function applyInitSharedState(sharedState) {
5046
5108
  if (!ensureResourceManagerForSharedState()) {
5047
5109
  sendEvent({ type: "configured" });
@@ -5220,15 +5282,7 @@ async function startAgentServer(opts) {
5220
5282
  }
5221
5283
  const prevSessionId = driver.runtimeSessionId;
5222
5284
  log(`[serve] restarting driver to pick up skill changes (resume=${prevSessionId ?? "none"})`);
5223
- await agentSession.dispose();
5224
- agentSession = await createAgentSession({
5225
- ...sessionConfig,
5226
- resumeSessionId: prevSessionId
5227
- });
5228
- emitSystemPromptComposed(agentSession, sendEvent);
5229
- swapDriver();
5230
- rebuildCompactionOrchestrator();
5231
- captureBakedMcpServers();
5285
+ await recreateAgentSession({ resumeSessionId: prevSessionId });
5232
5286
  sendEvent({
5233
5287
  type: "skills_changed",
5234
5288
  skills: catalogActions.map((a) => ({
@@ -5281,7 +5335,10 @@ async function startAgentServer(opts) {
5281
5335
  capabilitySignature: computeCapabilitySignature(capabilityRegistry.list())
5282
5336
  });
5283
5337
  const buildSession = async () => {
5284
- await buildSessionFromInit(cmd.secrets, resolvedConfigToDeclarations(cmd.resolvedConfig));
5338
+ const { needsWireFallbackRecreate } = await buildSessionFromInit(
5339
+ cmd.secrets,
5340
+ resolvedConfigToDeclarations(cmd.resolvedConfig)
5341
+ );
5285
5342
  const cfg = {
5286
5343
  aiResources: cmd.resolvedConfig.aiResources,
5287
5344
  subagents: cmd.resolvedConfig.subagents,
@@ -5320,7 +5377,7 @@ async function startAgentServer(opts) {
5320
5377
  pendingResumeSessionId = cfgResumeSessionId;
5321
5378
  }
5322
5379
  }
5323
- if (pendingResumeSessionId || cfg.subagents) {
5380
+ if (pendingResumeSessionId || cfg.subagents || needsWireFallbackRecreate) {
5324
5381
  await recreateSessionForInit(pendingResumeSessionId);
5325
5382
  }
5326
5383
  if (cfg.sharedState) {
@@ -5464,36 +5521,48 @@ async function startAgentServer(opts) {
5464
5521
  if (!resourceManager) throw new Error("connector_mutate before resources ready");
5465
5522
  const targetEntry = resourceManager.has?.(cmd.id) ? resourceManager.get(cmd.id) : null;
5466
5523
  const isExistingFlow = targetEntry?.connector?.name === "flow";
5467
- const isBareFlowId = cmd.id === "flow";
5468
- if (cmd.op === "start") {
5469
- if (isExistingFlow || isBareFlowId) {
5470
- const payload = cmd.payload ?? {};
5471
- const flowDef = payload.flow;
5472
- const seed = payload.seed;
5473
- if (flowDef?.id && seed?.runId && seed?.startedBy) {
5474
- if (activeFlows.size > 0) {
5475
- serverLog.warn("connector_mutate flow.start: another flow already active", {
5476
- activeRunIds: Array.from(activeFlows.keys())
5477
- });
5478
- return;
5479
- }
5480
- const entry = await createActiveFlow(flowDef, { seed });
5481
- serverLog.info("connector_mutate flow.start", {
5482
- runId: entry.runId,
5483
- flowId: flowDef.id
5484
- });
5485
- return;
5486
- }
5524
+ const plan = planFlowMutate(cmd, {
5525
+ targetExists: !!targetEntry,
5526
+ isExistingFlow,
5527
+ hasActiveFlow: activeFlows.size > 0,
5528
+ onlyActiveConnectorId: getOnlyActiveFlow()?.connectorId ?? null
5529
+ });
5530
+ switch (plan.kind) {
5531
+ case "create-start": {
5532
+ const entry = await createActiveFlow(plan.flowDef, { seed: plan.seed });
5533
+ serverLog.info("connector_mutate flow.start", {
5534
+ runId: entry.runId,
5535
+ flowId: plan.flowDef.id
5536
+ });
5537
+ return;
5487
5538
  }
5488
- }
5489
- let dispatchId = cmd.id;
5490
- if (!targetEntry && isBareFlowId) {
5491
- const onlyActive = getOnlyActiveFlow();
5492
- if (onlyActive) {
5493
- dispatchId = onlyActive.connectorId;
5539
+ case "create-hydrate": {
5540
+ const entry = await createActiveFlow(plan.flowDef, { execution: plan.execution });
5541
+ serverLog.info("connector_mutate flow.hydrate (bootstrap)", {
5542
+ runId: entry.runId,
5543
+ flowId: plan.flowDef.id
5544
+ });
5545
+ return;
5546
+ }
5547
+ case "reject": {
5548
+ serverLog.warn("connector_mutate rejected", {
5549
+ id: cmd.id,
5550
+ op: cmd.op,
5551
+ reason: plan.reason
5552
+ });
5553
+ sendEvent({
5554
+ type: "error",
5555
+ message: `connector_mutate rejected (id=${cmd.id}, op=${cmd.op}): ${plan.reason}`,
5556
+ fatal: false,
5557
+ category: "validation"
5558
+ });
5559
+ return;
5560
+ }
5561
+ case "dispatch": {
5562
+ await resourceManager.executeOp(plan.dispatchId, cmd.op, cmd.payload ?? {});
5563
+ return;
5494
5564
  }
5495
5565
  }
5496
- await resourceManager.executeOp(dispatchId, cmd.op, cmd.payload ?? {});
5497
5566
  } catch (err) {
5498
5567
  serverLog.warn("connector_mutate failed", {
5499
5568
  id: cmd.id,
@@ -5939,6 +6008,6 @@ function touchSession(state) {
5939
6008
  return { ...state, updatedAt: (/* @__PURE__ */ new Date()).toISOString() };
5940
6009
  }
5941
6010
 
5942
- export { CLAUDE_CODE_CREDENTIALS_KEY, COMPILE_MANIFEST_FILENAME, CapabilityRegistry, DEFAULT_CAPABILITY_CALL_TIMEOUT_MS, DEFAULT_COALESCE_MS, MarkdownStreamer, PreInitRingSink, agentDefinitionExists, bootstrapCapabilityRegistry, bootstrapRunnerLogStore, buildAgentResources, buildClientCapabilityHandler, buildConnectorTokenMediator, buildContextSection, buildEnvironmentSection, buildResourcesAvailablePayload, builtinCapabilities, capabilityLogInstance, clearPreInitRingSink, clearSession, compileComposition, computeCapabilitySignature, connectorRefreshKind, createAgentSession, createSessionStimulusBus, defineCapability, deleteSession, dispatchRunnerCapabilityInvocation, emitSystemPromptComposed, ensureGitConfigInclude, extractClaudeAiOauthExpiresAt, getPreInitRingSink, handleMountResourceRequest, handleResourceRequest, installPreInitRingSink, listSessions, loadAgentManifest, loadCompileManifest, loadCompileManifestFromDir, loadSession, loadSessionById, mcpAuthSecretKey, newSession, registerCompositionCapabilities, rejectCapabilityOnApprovalDeny, resetRunnerLogStore, resolveAgentComposition, resolveAgentMixins, resolveBinding, resolveCapabilityCallTimeoutMs, resolveCapabilityResult, resolveComposition, resolveMixin, runAgentChat, saveSession, setCurrentSession, startAgentServer, touchSession, writeClaudeCodeCredentialsFile };
5943
- //# sourceMappingURL=chunk-M3Y5KM6F.js.map
5944
- //# sourceMappingURL=chunk-M3Y5KM6F.js.map
6011
+ export { CLAUDE_CODE_CREDENTIALS_KEY, COMPILE_MANIFEST_FILENAME, CapabilityRegistry, DEFAULT_CAPABILITY_CALL_TIMEOUT_MS, DEFAULT_COALESCE_MS, MarkdownStreamer, PreInitRingSink, agentDefinitionExists, bootstrapCapabilityRegistry, bootstrapRunnerLogStore, buildAgentResources, buildClientCapabilityHandler, buildConnectorTokenMediator, buildContextSection, buildEnvironmentSection, buildResourcesAvailablePayload, builtinCapabilities, capabilityLogInstance, clearPreInitRingSink, clearSession, compileComposition, computeCapabilitySignature, connectorRefreshKind, createAgentSession, createSessionStimulusBus, defineCapability, deleteSession, dispatchRunnerCapabilityInvocation, emitSystemPromptComposed, ensureGitConfigInclude, extractClaudeAiOauthExpiresAt, getPreInitRingSink, handleMountResourceRequest, handleResourceRequest, installPreInitRingSink, listSessions, loadAgentManifest, loadCompileManifest, loadCompileManifestFromDir, loadSession, loadSessionById, mcpAuthSecretKey, newSession, pickRepointedManager, planFlowMutate, registerCompositionCapabilities, rejectCapabilityOnApprovalDeny, resetRunnerLogStore, resolveAgentComposition, resolveAgentMixins, resolveBinding, resolveCapabilityCallTimeoutMs, resolveCapabilityResult, resolveComposition, resolveMixin, runAgentChat, saveSession, setCurrentSession, startAgentServer, touchSession, writeClaudeCodeCredentialsFile };
6012
+ //# sourceMappingURL=chunk-DTZ7JUZY.js.map
6013
+ //# sourceMappingURL=chunk-DTZ7JUZY.js.map