@skaile/workspaces 4.9.1 → 4.9.3

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 (176) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/{asset-feeds-23UCAOLX.js → asset-feeds-74HE5Q7W.js} +7 -6
  3. package/dist/asset-feeds-74HE5Q7W.js.map +1 -0
  4. package/dist/asset-manager/catalog-deployer.js +3 -2
  5. package/dist/asset-manager/index.js +6 -5
  6. package/dist/asset-manager/installer.js +4 -3
  7. package/dist/bridge/codex-app-server.js +2 -15
  8. package/dist/bridge/drivers/claude-sdk.js +5 -4
  9. package/dist/bridge/drivers/claude-sdk.js.map +1 -1
  10. package/dist/bridge/drivers/codex.js +7 -6
  11. package/dist/bridge/drivers/codex.js.map +1 -1
  12. package/dist/bridge/drivers/continue.js +5 -4
  13. package/dist/bridge/drivers/continue.js.map +1 -1
  14. package/dist/bridge/drivers/echo.js +2 -2
  15. package/dist/bridge/drivers/gemini.js +5 -5
  16. package/dist/bridge/drivers/goose.js +5 -4
  17. package/dist/bridge/drivers/goose.js.map +1 -1
  18. package/dist/bridge/drivers/omp.js +2 -2
  19. package/dist/bridge/drivers/opencode.js +5 -4
  20. package/dist/bridge/drivers/opencode.js.map +1 -1
  21. package/dist/bridge/drivers/qwen.js +5 -5
  22. package/dist/bridge/index.js +6 -5
  23. package/dist/bridge/src/codex-app-server.d.ts.map +1 -1
  24. package/dist/{chunk-45LLHKQ2.js → chunk-2HUQUTJ3.js} +3 -3
  25. package/dist/{chunk-45LLHKQ2.js.map → chunk-2HUQUTJ3.js.map} +1 -1
  26. package/dist/{chunk-6BUJARLT.js → chunk-2KVFAWUA.js} +3 -3
  27. package/dist/{chunk-6BUJARLT.js.map → chunk-2KVFAWUA.js.map} +1 -1
  28. package/dist/{chunk-FTG7CRFD.js → chunk-3HKYCT2M.js} +69 -6
  29. package/dist/chunk-3HKYCT2M.js.map +1 -0
  30. package/dist/{chunk-2PGVW3FL.js → chunk-4F2L7WPU.js} +3 -3
  31. package/dist/chunk-4F2L7WPU.js.map +1 -0
  32. package/dist/chunk-4GY63JU6.js +63 -0
  33. package/dist/chunk-4GY63JU6.js.map +1 -0
  34. package/dist/{chunk-PAYS6YCK.js → chunk-6L2WH2LS.js} +8 -8
  35. package/dist/{chunk-PAYS6YCK.js.map → chunk-6L2WH2LS.js.map} +1 -1
  36. package/dist/{chunk-HUF4ON2C.js → chunk-7LHSC2DS.js} +3 -3
  37. package/dist/{chunk-HUF4ON2C.js.map → chunk-7LHSC2DS.js.map} +1 -1
  38. package/dist/{chunk-5DHAVCKW.js → chunk-7ZWLVXQN.js} +2 -2
  39. package/dist/{chunk-5DHAVCKW.js.map → chunk-7ZWLVXQN.js.map} +1 -1
  40. package/dist/{chunk-6J3L2CZ7.js → chunk-AF3ETSXF.js} +3 -3
  41. package/dist/{chunk-6J3L2CZ7.js.map → chunk-AF3ETSXF.js.map} +1 -1
  42. package/dist/{chunk-SJYOKKYO.js → chunk-AOE4KOMJ.js} +3 -3
  43. package/dist/{chunk-SJYOKKYO.js.map → chunk-AOE4KOMJ.js.map} +1 -1
  44. package/dist/{chunk-ERYOLF7V.js → chunk-FTSXFA7P.js} +5 -5
  45. package/dist/{chunk-ERYOLF7V.js.map → chunk-FTSXFA7P.js.map} +1 -1
  46. package/dist/{chunk-5WNQPXEG.js → chunk-GFU367UH.js} +3 -59
  47. package/dist/chunk-GFU367UH.js.map +1 -0
  48. package/dist/{chunk-JBKXLCMG.js → chunk-JU736VOI.js} +7 -7
  49. package/dist/chunk-JU736VOI.js.map +1 -0
  50. package/dist/{chunk-5PF5OIQK.js → chunk-KQTMJP3X.js} +3 -3
  51. package/dist/{chunk-5PF5OIQK.js.map → chunk-KQTMJP3X.js.map} +1 -1
  52. package/dist/{chunk-WQ5BCHQS.js → chunk-LDQB5VEC.js} +2 -2
  53. package/dist/{chunk-WQ5BCHQS.js.map → chunk-LDQB5VEC.js.map} +1 -1
  54. package/dist/{chunk-QJDVOKQO.js → chunk-LMS54WVA.js} +4 -4
  55. package/dist/{chunk-QJDVOKQO.js.map → chunk-LMS54WVA.js.map} +1 -1
  56. package/dist/{chunk-2DGIAWKU.js → chunk-LN4M7WMX.js} +114 -79
  57. package/dist/chunk-LN4M7WMX.js.map +1 -0
  58. package/dist/{chunk-XHKM7OMR.js → chunk-O33RRDO5.js} +5 -5
  59. package/dist/{chunk-XHKM7OMR.js.map → chunk-O33RRDO5.js.map} +1 -1
  60. package/dist/{chunk-Q3AK4IQG.js → chunk-RL7O3OZQ.js} +5 -5
  61. package/dist/{chunk-Q3AK4IQG.js.map → chunk-RL7O3OZQ.js.map} +1 -1
  62. package/dist/{chunk-I7IWIVXY.js → chunk-S4RYZDBB.js} +3 -3
  63. package/dist/{chunk-I7IWIVXY.js.map → chunk-S4RYZDBB.js.map} +1 -1
  64. package/dist/{chunk-UJ5O5KQB.js → chunk-VLRP35H4.js} +7 -7
  65. package/dist/{chunk-UJ5O5KQB.js.map → chunk-VLRP35H4.js.map} +1 -1
  66. package/dist/{chunk-WLPL7CRM.js → chunk-WPW5XS6I.js} +2 -2
  67. package/dist/{chunk-WLPL7CRM.js.map → chunk-WPW5XS6I.js.map} +1 -1
  68. package/dist/{chunk-T4IXZOG2.js → chunk-WXECUQC6.js} +5 -5
  69. package/dist/{chunk-T4IXZOG2.js.map → chunk-WXECUQC6.js.map} +1 -1
  70. package/dist/{chunk-I7SQIWYX.js → chunk-XEWX4V7T.js} +3 -3
  71. package/dist/{chunk-I7SQIWYX.js.map → chunk-XEWX4V7T.js.map} +1 -1
  72. package/dist/{chunk-ZYAVNMKA.js → chunk-XZYZOCPK.js} +5 -5
  73. package/dist/{chunk-ZYAVNMKA.js.map → chunk-XZYZOCPK.js.map} +1 -1
  74. package/dist/{chunk-FSRWPLIQ.js → chunk-YCIW4YOT.js} +3 -3
  75. package/dist/{chunk-FSRWPLIQ.js.map → chunk-YCIW4YOT.js.map} +1 -1
  76. package/dist/{chunk-HA3XJN65.js → chunk-ZVYWMD6Q.js} +3 -3
  77. package/dist/{chunk-HA3XJN65.js.map → chunk-ZVYWMD6Q.js.map} +1 -1
  78. package/dist/cli/index.js +48 -47
  79. package/dist/cli/index.js.map +1 -1
  80. package/dist/connectors/config.js +3 -2
  81. package/dist/connectors/index.js +8 -7
  82. package/dist/core/index.js +3 -2
  83. package/dist/core/logging.js +1 -1
  84. package/dist/core/src/logging/index.d.ts +3 -1
  85. package/dist/core/src/logging/index.d.ts.map +1 -1
  86. package/dist/core/src/logging/retention.d.ts +29 -0
  87. package/dist/core/src/logging/retention.d.ts.map +1 -0
  88. package/dist/core/src/logging/sinks/sqlite-runtime.d.ts +6 -1
  89. package/dist/core/src/logging/sinks/sqlite-runtime.d.ts.map +1 -1
  90. package/dist/deploy/index.js +3 -2
  91. package/dist/deploy/index.js.map +1 -1
  92. package/dist/deploy/src/targets/process-handle.d.ts.map +1 -1
  93. package/dist/{ensure-sources-AGDLO3RW.js → ensure-sources-VTIIEJBO.js} +9 -8
  94. package/dist/ensure-sources-VTIIEJBO.js.map +1 -0
  95. package/dist/factory-assets/connectors/box.js +8 -7
  96. package/dist/factory-assets/connectors/deploy.js +8 -7
  97. package/dist/factory-assets/connectors/devserver/adapter.d.ts.map +1 -1
  98. package/dist/factory-assets/connectors/devserver.js +8 -7
  99. package/dist/factory-assets/connectors/flow/adapter.js +8 -7
  100. package/dist/factory-assets/connectors/flow/engine.js +4 -3
  101. package/dist/factory-assets/connectors/flow/run-flow.js +9 -8
  102. package/dist/factory-assets/connectors/flow.js +8 -7
  103. package/dist/factory-assets/connectors/git.js +8 -7
  104. package/dist/factory-assets/connectors/gmail.js +8 -7
  105. package/dist/factory-assets/connectors/googledrive.js +8 -7
  106. package/dist/factory-assets/connectors/local.js +8 -7
  107. package/dist/factory-assets/connectors/mattermost.js +8 -7
  108. package/dist/factory-assets/connectors/memory.js +8 -7
  109. package/dist/factory-assets/connectors/minio.js +8 -7
  110. package/dist/factory-assets/connectors/postgres.js +8 -7
  111. package/dist/factory-assets/connectors/s3.js +8 -7
  112. package/dist/factory-assets/connectors/sharepoint.js +8 -7
  113. package/dist/factory-assets/connectors/sqlite.js +8 -7
  114. package/dist/factory-assets/connectors/static-server.js +8 -7
  115. package/dist/factory-assets/connectors/tunnel.js +8 -7
  116. package/dist/factory-assets/connectors/webdav.js +8 -7
  117. package/dist/factory-assets/connectors/xstate-store.js +8 -7
  118. package/dist/factory-assets/connectors/xstate.js +8 -7
  119. package/dist/{flows-EO5CO3A3.js → flows-SYYQDDCT.js} +6 -5
  120. package/dist/{flows-EO5CO3A3.js.map → flows-SYYQDDCT.js.map} +1 -1
  121. package/dist/{helpers-4H73P3WO.js → helpers-JJ4OLUVW.js} +9 -8
  122. package/dist/{helpers-4H73P3WO.js.map → helpers-JJ4OLUVW.js.map} +1 -1
  123. package/dist/library/index.js +4 -3
  124. package/dist/library/install.js +3 -2
  125. package/dist/{library-publish-WTVCH5UI.js → library-publish-IA76SB6X.js} +13 -12
  126. package/dist/library-publish-IA76SB6X.js.map +1 -0
  127. package/dist/{open-library-KS4IT4C7.js → open-library-F24FIE65.js} +11 -10
  128. package/dist/{open-library-KS4IT4C7.js.map → open-library-F24FIE65.js.map} +1 -1
  129. package/dist/{paths-HWWTOYUY.js → paths-NHONUGUU.js} +5 -4
  130. package/dist/{paths-HWWTOYUY.js.map → paths-NHONUGUU.js.map} +1 -1
  131. package/dist/{plugin-store-VJYXFXP5.js → plugin-store-4RALGK5S.js} +5 -4
  132. package/dist/plugin-store-4RALGK5S.js.map +1 -0
  133. package/dist/{project-DWCNGU56.js → project-OGJSXBAC.js} +10 -9
  134. package/dist/{project-DWCNGU56.js.map → project-OGJSXBAC.js.map} +1 -1
  135. package/dist/resolver/index.js +3 -2
  136. package/dist/runner/index.js +14 -13
  137. package/dist/runner/src/lifecycle-handler.d.ts +2 -0
  138. package/dist/runner/src/lifecycle-handler.d.ts.map +1 -1
  139. package/dist/runner/src/logging-bootstrap.d.ts +11 -0
  140. package/dist/runner/src/logging-bootstrap.d.ts.map +1 -1
  141. package/dist/runner/src/runner-capabilities.d.ts +7 -2
  142. package/dist/runner/src/runner-capabilities.d.ts.map +1 -1
  143. package/dist/runner/src/serve.d.ts.map +1 -1
  144. package/dist/sdk/asset-manager.js +6 -5
  145. package/dist/sdk/bridge.js +6 -5
  146. package/dist/sdk/core.js +3 -2
  147. package/dist/sdk/flow.js +4 -3
  148. package/dist/sdk/index.js +14 -13
  149. package/dist/sdk/index.js.map +1 -1
  150. package/dist/sdk/resolver.js +3 -2
  151. package/dist/sdk/runner.js +14 -13
  152. package/dist/{setup-EPDRYWWI.js → setup-3IIIW3QM.js} +13 -12
  153. package/dist/setup-3IIIW3QM.js.map +1 -0
  154. package/dist/{skills-DNCI6ITW.js → skills-VUPPILR5.js} +5 -4
  155. package/dist/{skills-DNCI6ITW.js.map → skills-VUPPILR5.js.map} +1 -1
  156. package/dist/{source-7TLL7GO7.js → source-HBEZDIWE.js} +12 -11
  157. package/dist/{source-7TLL7GO7.js.map → source-HBEZDIWE.js.map} +1 -1
  158. package/dist/{source-manifest-publish-NX3JBMUT.js → source-manifest-publish-G7ZAYFMH.js} +14 -13
  159. package/dist/source-manifest-publish-G7ZAYFMH.js.map +1 -0
  160. package/dist/tui/index.js +14 -13
  161. package/dist/tui/index.js.map +1 -1
  162. package/dist/workspace-plugin/adapters/mcp.js +5 -4
  163. package/dist/workspace-plugin/adapters/omp.js +7 -7
  164. package/dist/workspace-plugin/index.js +2 -2
  165. package/package.json +2 -1
  166. package/dist/asset-feeds-23UCAOLX.js.map +0 -1
  167. package/dist/chunk-2DGIAWKU.js.map +0 -1
  168. package/dist/chunk-2PGVW3FL.js.map +0 -1
  169. package/dist/chunk-5WNQPXEG.js.map +0 -1
  170. package/dist/chunk-FTG7CRFD.js.map +0 -1
  171. package/dist/chunk-JBKXLCMG.js.map +0 -1
  172. package/dist/ensure-sources-AGDLO3RW.js.map +0 -1
  173. package/dist/library-publish-WTVCH5UI.js.map +0 -1
  174. package/dist/plugin-store-VJYXFXP5.js.map +0 -1
  175. package/dist/setup-EPDRYWWI.js.map +0 -1
  176. package/dist/source-manifest-publish-NX3JBMUT.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../cli/src/store-publisher.ts","../cli/src/commands/publish-core.ts"],"names":[],"mappings":";;;;AA+FO,SAAS,uBAAA,CACd,MAAA,GAAsB,cAAA,EAAe,EACrC,YAAY,GAAA,EACK;AAGjB,EAAA,MAAM,IAAA,GAAO,OACX,IAAA,EACA,IAAA,KACe;AACf,IAAA,MAAM,GAAA,GAAM,MAAM,aAAA,EAAc;AAChC,IAAA,OAAO,UAAA,CAAc,EAAE,GAAG,MAAA,EAAQ,GAAA,EAAI,EAAG,IAAA,EAAM,EAAE,SAAA,EAAW,GAAG,IAAA,EAAM,CAAA;AAAA,EACvE,CAAA;AACA,EAAA,OAAO;AAAA,IACL,EAAA,EAAI,MAAM,IAAA,CAAK,YAAY,CAAA;AAAA,IAC3B,UAAA,EAAY,CAAC,IAAA,KAAS,IAAA,CAAK,mBAAmB,EAAE,MAAA,EAAQ,MAAA,EAAQ,IAAA,EAAM,CAAA;AAAA,IACtE,WAAA,EAAa,MAAM,IAAA,CAAK,iBAAiB,CAAA;AAAA,IACzC,UAAA,EAAY,CAAC,EAAA,KAAO,IAAA,CAAK,CAAA,gBAAA,EAAmB,EAAE,CAAA,KAAA,CAAA,EAAS,EAAE,MAAA,EAAQ,MAAA,EAAQ,IAAA,EAAM,IAAI,CAAA;AAAA,IACnF,QAAQ,CAAC,KAAA,KAAU,IAAA,CAAK,CAAA,aAAA,EAAgB,KAAK,CAAA,CAAE,CAAA;AAAA,IAC/C,kBAAkB,CAAC,EAAA,KAAO,IAAA,CAAK,CAAA,gBAAA,EAAmB,EAAE,CAAA,WAAA,CAAa,CAAA;AAAA,IACjE,cAAc,CAAC,EAAA,KAAO,IAAA,CAAK,CAAA,eAAA,EAAkB,EAAE,CAAA,QAAA,CAAU,C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AW,OAAA,CAAQ,CAAA,EAAA,EAAK,CAAC,CAAA,CAAE,CAAA;AAC3C,EAAA,OAAO,EAAE,SAAA,EAAU;AACrB","file":"chunk-QJDVOKQO.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-publisher.ts","../cli/src/commands/publish-core.ts"],"names":[],"mappings":";;;;AA+FO,SAAS,uBAAA,CACd,MAAA,GAAsB,cAAA,EAAe,EACrC,YAAY,GAAA,EACK;AAGjB,EAAA,MAAM,IAAA,GAAO,OACX,IAAA,EACA,IAAA,KACe;AACf,IAAA,MAAM,GAAA,GAAM,MAAM,aAAA,EAAc;AAChC,IAAA,OAAO,UAAA,CAAc,EAAE,GAAG,MAAA,EAAQ,GAAA,EAAI,EAAG,IAAA,EAAM,EAAE,SAAA,EAAW,GAAG,IAAA,EAAM,CAAA;AAAA,EACvE,CAAA;AACA,EAAA,OAAO;AAAA,IACL,EAAA,EAAI,MAAM,IAAA,CAAK,YAAY,CAAA;AAAA,IAC3B,UAAA,EAAY,CAAC,IAAA,KAAS,IAAA,CAAK,mBAAmB,EAAE,MAAA,EAAQ,MAAA,EAAQ,IAAA,EAAM,CAAA;AAAA,IACtE,WAAA,EAAa,MAAM,IAAA,CAAK,iBAAiB,CAAA;AAAA,IACzC,UAAA,EAAY,CAAC,EAAA,KAAO,IAAA,CAAK,CAAA,gBAAA,EAAmB,EAAE,CAAA,KAAA,CAAA,EAAS,EAAE,MAAA,EAAQ,MAAA,EAAQ,IAAA,EAAM,IAAI,CAAA;AAAA,IACnF,QAAQ,CAAC,KAAA,KAAU,IAAA,CAAK,CAAA,aAAA,EAAgB,KAAK,CAAA,CAAE,CAAA;AAAA,IAC/C,kBAAkB,CAAC,EAAA,KAAO,IAAA,CAAK,CAAA,gBAAA,EAAmB,EAAE,CAAA,WAAA,CAAa,CAAA;AAAA,IACjE,cAAc,CAAC,EAAA,KAAO,IAAA,CAAK,CAAA,e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AAA,KAAA,MAAW,CAAA,IAAK,SAAA,EAAW,OAAA,CAAQ,CAAA,EAAA,EAAK,CAAC,CAAA,CAAE,CAAA;AAC3C,EAAA,OAAO,EAAE,SAAA,EAAU;AACrB","file":"chunk-LMS54WVA.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,39 +1,39 @@
1
- import { WorkspacePlugin } from './chunk-5DHAVCKW.js';
2
- import { buildWorkspaceToolDefs } from './chunk-I7SQIWYX.js';
1
+ import { WorkspacePlugin } from './chunk-7ZWLVXQN.js';
2
+ import { buildWorkspaceToolDefs } from './chunk-XEWX4V7T.js';
3
3
  import { findAiAssetsRoot } from './chunk-7IRJ4K4F.js';
4
4
  import { WebSocketServerTransport } from './chunk-73ZXUUL6.js';
5
5
  import { assembleSystemPrompt, buildCapabilitiesPromptSection } from './chunk-W3UDISS2.js';
6
- import { prepareNativePolicy, codexInstanceEnvironment, parseCodexCredential, parseCodexRefreshInput, parseCodexRefreshResult } from './chunk-45LLHKQ2.js';
7
- import { resolveFlowPath } from './chunk-T4IXZOG2.js';
6
+ import { prepareNativePolicy, codexInstanceEnvironment, parseCodexCredential, parseCodexRefreshInput, parseCodexRefreshResult } from './chunk-2HUQUTJ3.js';
7
+ import { resolveFlowPath } from './chunk-WXECUQC6.js';
8
8
  import { findAiAssetsRoot as findAiAssetsRoot$1, deployCatalogEntry, undeployCatalogEntry } from './chunk-7BUZQVRR.js';
9
- import { registerBuiltinConnectors, buildConnectorPromptSection, findMissingPackages, installNpmPackages, ConnectorManager, buildSdkConnectorTools, buildLazySdkFlowTools, describeFlowOperations, buildConnectorToolDefs, buildFlowToolDefs, driveOrchestratorTurn, SessionNodeExecutor, SessionSubpromptRunner, ClassifierSubpromptRunner, SessionInlineSubFlowRunner, buildSdkFlowTools } from './chunk-JBKXLCMG.js';
9
+ import { registerBuiltinConnectors, buildConnectorPromptSection, findMissingPackages, installNpmPackages, ConnectorManager, buildSdkConnectorTools, buildLazySdkFlowTools, describeFlowOperations, buildConnectorToolDefs, buildFlowToolDefs, driveOrchestratorTurn, SessionNodeExecutor, SessionSubpromptRunner, ClassifierSubpromptRunner, SessionInlineSubFlowRunner, buildSdkFlowTools } from './chunk-JU736VOI.js';
10
10
  import { loadConnectorDeclarations, SecretProviderChain, ConnectorStartupError, PreMintedSecretProvider, InMemorySecretProvider, resolvedConfigToDeclarations, isKnownSecretRef, deriveSingleMaterializedConnectorDeclaration } from './chunk-JUZJUKWM.js';
11
- import { EventNormalizer } from './chunk-HA3XJN65.js';
11
+ import { EventNormalizer } from './chunk-ZVYWMD6Q.js';
12
12
  import { probeResumeTranscript } from './chunk-OUJVFZWJ.js';
13
13
  import { CodexNativeStateUnavailable } from './chunk-LOO5CB5M.js';
14
14
  import { dispatchCapability } from './chunk-3GKBSHUG.js';
15
15
  import { classifyClaudeSdkError } from './chunk-GAH4YRCI.js';
16
- import { createDriver, catalogLayer, providerCredentialEnvName, toMergedRegistry, registryCredentialEnv, AI_PROVIDER_PRESETS } from './chunk-WQ5BCHQS.js';
17
- import { loadFlow } from './chunk-SJYOKKYO.js';
16
+ import { createDriver, catalogLayer, providerCredentialEnvName, toMergedRegistry, registryCredentialEnv, AI_PROVIDER_PRESETS } from './chunk-LDQB5VEC.js';
17
+ import { loadFlow } from './chunk-AOE4KOMJ.js';
18
18
  import { parseFlowDefinition } from './chunk-REYJKU7T.js';
19
19
  import { renderStimulusPrompt } from './chunk-2D5BYAL6.js';
20
20
  import { withActivityLabelJsonSchema, TOOL_ACTIVITY_PROMPT_SECTION, SESSION_ROOT_CONNECTOR_ID, PROTOCOL_VERSION } from './chunk-QAH24E5U.js';
21
- import { resolveSettings, loadProviderRegistry } from './chunk-5WNQPXEG.js';
21
+ import { resolveSettings, loadProviderRegistry } from './chunk-GFU367UH.js';
22
22
  import { resolveRuntimeAssets } from './chunk-UM4LDXV5.js';
23
23
  import { resolveDriverPaths } from './chunk-K5GBV4SA.js';
24
24
  import { resolveSkWorkspaceConfig, resolveAgentDir, loadMcpServerDeclarations, COMPACTION_DEFAULTS, validateAssetRecipeAttr, deriveSingleMaterializedMcpDeclaration, stageMaterializedSkills, readSkillAllowList, isStagedSkillMarkerFor, unstageSkill } from './chunk-P2G6XSJ3.js';
25
25
  import { withFsDeadline, FsDeadlineError, fsDeadlineMs, tryWithFsDeadline } from './chunk-MKZOK4JU.js';
26
26
  import { parseAssetRef } from './chunk-GEEW6SY2.js';
27
- import { resolveLogStoreConfig, createLogStoreFromConfig, OnLogBridgeSink, WsLogSink } from './chunk-FTG7CRFD.js';
27
+ import { resolveLogStoreConfig, createLogStoreFromConfig, OnLogBridgeSink, WsLogSink, resolveLogsRetention, enforceLogsRetention } from './chunk-3HKYCT2M.js';
28
28
  import { registryEntries, resolveEntryBaseUrl, parseModelRef, isEntryEnabled, parseCredentialRef } from './chunk-ILG4BXYE.js';
29
- import { getLogStore, registerLogStore, resetLogStore, createLogger, isUnwritableStreamError, markStreamBroken, isBrokenPipeError } from './chunk-W4IPN3DD.js';
29
+ import { getLogStore, registerLogStore, createLogger, resetLogStore, isUnwritableStreamError, markStreamBroken, isBrokenPipeError } from './chunk-W4IPN3DD.js';
30
30
  import { __require } from './chunk-NSBPE2FW.js';
31
31
  import pc from 'picocolors';
32
+ import path5, { join, resolve, relative, sep, isAbsolute, basename, dirname } from 'path';
32
33
  import { Marked } from 'marked';
33
34
  import { markedTerminal } from 'marked-terminal';
34
35
  import fs4, { readFile, readdir, lstat, stat, rm, unlink, mkdir, writeFile, realpath, rename, readlink, mkdtemp } from 'fs/promises';
35
36
  import { createHash, randomBytes, timingSafeEqual, randomUUID } from 'crypto';
36
- import path4, { join, resolve, relative, sep, isAbsolute, basename, dirname } from 'path';
37
37
  import { existsSync, lstatSync, realpathSync, readFileSync, mkdirSync, writeFileSync, watch, chmodSync, accessSync, constants } from 'fs';
38
38
  import { homedir } from 'os';
39
39
  import * as z7 from 'zod';
@@ -51,7 +51,6 @@ import { getDefaultEnvironment, StdioClientTransport } from '@modelcontextprotoc
51
51
  import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
52
52
  import mime from 'mime';
53
53
 
54
- // runner/src/logging-bootstrap.ts
55
54
  var PreInitRingSink = class {
56
55
  ring = [];
57
56
  cap;
@@ -131,14 +130,34 @@ function bootstrapRunnerLogStore(opts) {
131
130
  currentSessionId = opts.sessionId;
132
131
  const preInit = getPreInitRingSink();
133
132
  if (preInit) preInit.clear();
133
+ const retention = opts.enforceRetention && cfg.mode === "persistent" && cfg.workspacePath ? scheduleRetention(cfg) : void 0;
134
134
  return {
135
135
  store,
136
136
  dispose: () => {
137
137
  disposeStore(store);
138
138
  currentSessionId = null;
139
- }
139
+ },
140
+ ...retention ? { retention } : {}
140
141
  };
141
142
  }
143
+ function scheduleRetention(cfg) {
144
+ const dbPath = path5.join(cfg.workspacePath, ".skaile", "logs.db");
145
+ const policy = resolveLogsRetention(cfg.retention);
146
+ const log = createLogger({ kind: "runner", subkind: "logging", instance: cfg.sessionId });
147
+ return new Promise((resolve4) => setImmediate(resolve4)).then(() => enforceLogsRetention(dbPath, policy)).then(
148
+ (result) => {
149
+ if (result.deletedByAge + result.deletedByCount > 0) {
150
+ log.info("logs.db retention trimmed rows", { ...result, ...policy });
151
+ }
152
+ },
153
+ (err) => {
154
+ log.warn("logs.db retention failed; continuing without trim", {
155
+ error: err instanceof Error ? err.message : String(err),
156
+ ...policy
157
+ });
158
+ }
159
+ );
160
+ }
142
161
  function resetRunnerLogStore() {
143
162
  const s = getLogStore();
144
163
  if (s) disposeStore(s);
@@ -246,7 +265,7 @@ function defineCapability(args) {
246
265
  }
247
266
  async function resolveMixin(ref, defaultKind, agentDir, repos) {
248
267
  if (ref.startsWith(".") || ref.startsWith("/")) {
249
- const absPath = ref.startsWith("/") ? ref : path4.join(agentDir, ref);
268
+ const absPath = ref.startsWith("/") ? ref : path5.join(agentDir, ref);
250
269
  if (defaultKind === "knowledge") {
251
270
  return loadKnowledgeDir(absPath);
252
271
  }
@@ -258,7 +277,7 @@ async function resolveMixin(ref, defaultKind, agentDir, repos) {
258
277
  const entry = findInRepos(repos, kind, name, repoQualifier);
259
278
  if (!entry) return null;
260
279
  if (entry.kind === "knowledge") {
261
- return loadKnowledgeDir(path4.dirname(entry.source));
280
+ return loadKnowledgeDir(path5.dirname(entry.source));
262
281
  }
263
282
  const raw = await readFileSafe(entry.source);
264
283
  if (!raw) return null;
@@ -321,7 +340,7 @@ async function loadKnowledgeDir(dir) {
321
340
  return null;
322
341
  }
323
342
  const priorityMap = {};
324
- const indexContent = await readFileSafe(path4.join(dir, "index.yaml"));
343
+ const indexContent = await readFileSafe(path5.join(dir, "index.yaml"));
325
344
  if (indexContent) {
326
345
  const pathMatches = [...indexContent.matchAll(/path:\s*(\S+)/g)];
327
346
  const priorityMatches = [...indexContent.matchAll(/priority:\s*(\d+)/g)];
@@ -336,7 +355,7 @@ async function loadKnowledgeDir(dir) {
336
355
  entries.map(async (filename) => ({
337
356
  filename,
338
357
  priority: priorityMap[filename] ?? 99,
339
- content: (await readFileSafe(path4.join(dir, filename))).trim()
358
+ content: (await readFileSafe(path5.join(dir, filename))).trim()
340
359
  }))
341
360
  );
342
361
  const sorted = docs.filter((d) => d.content).sort((a, b) => a.priority - b.priority || a.filename.localeCompare(b.filename));
@@ -370,7 +389,7 @@ function resolveBinding(item) {
370
389
  var COMPILE_MANIFEST_FILENAME = "compile_manifest.json";
371
390
  async function compileComposition(opts) {
372
391
  const { agentDir, items, loadContent, resolveVersion } = opts;
373
- const manifestPath = path4.join(agentDir, COMPILE_MANIFEST_FILENAME);
392
+ const manifestPath = path5.join(agentDir, COMPILE_MANIFEST_FILENAME);
374
393
  const warnings = [];
375
394
  const existing = await loadCompileManifest(manifestPath);
376
395
  const nextVersion = (existing?.prompt_version ?? 0) + 1;
@@ -422,7 +441,7 @@ async function loadCompileManifest(manifestPath) {
422
441
  }
423
442
  }
424
443
  async function loadCompileManifestFromDir(agentDir) {
425
- return loadCompileManifest(path4.join(agentDir, COMPILE_MANIFEST_FILENAME));
444
+ return loadCompileManifest(path5.join(agentDir, COMPILE_MANIFEST_FILENAME));
426
445
  }
427
446
  async function resolveComposition(opts) {
428
447
  const { items, library, compileManifest, loadContent } = opts;
@@ -981,20 +1000,20 @@ function registerCodexToolDefinitions(registry, namespace, tools) {
981
1000
  };
982
1001
  }
983
1002
  function contains(root, target) {
984
- const path5 = relative(root, target);
985
- return path5 === "" || !path5.startsWith("..") && !isAbsolute(path5);
1003
+ const path6 = relative(root, target);
1004
+ return path6 === "" || !path6.startsWith("..") && !isAbsolute(path6);
986
1005
  }
987
- async function canonical(path5) {
1006
+ async function canonical(path6) {
988
1007
  try {
989
- return await realpath(path5);
1008
+ return await realpath(path6);
990
1009
  } catch (error) {
991
1010
  if (error.code !== "ENOENT") throw error;
992
- const parent = dirname(path5);
993
- if (parent === path5) throw error;
994
- return resolve(await canonical(parent), relative(parent, path5));
1011
+ const parent = dirname(path6);
1012
+ if (parent === path6) throw error;
1013
+ return resolve(await canonical(parent), relative(parent, path6));
995
1014
  }
996
1015
  }
997
- async function assertScopedTree(path5, root) {
1016
+ async function assertScopedTree(path6, root) {
998
1017
  let remaining = 1e4;
999
1018
  async function visit(entry) {
1000
1019
  if (--remaining < 0) throw new Error("CODEX_RESOURCE_SCOPE_INVALID");
@@ -1010,7 +1029,7 @@ async function assertScopedTree(path5, root) {
1010
1029
  if (stat3.isDirectory())
1011
1030
  for (const child of await readdir(entry)) await visit(join(entry, child));
1012
1031
  }
1013
- await visit(path5);
1032
+ await visit(path6);
1014
1033
  }
1015
1034
  async function registerCodexResourceTools(options) {
1016
1035
  const project = await realpath(options.projectDir);
@@ -1098,14 +1117,14 @@ function registerCodexFlowTools(registry, manager, connectorId) {
1098
1117
  }
1099
1118
  async function agentDefinitionExists(agentDir) {
1100
1119
  try {
1101
- await fs4.access(path4.join(agentDir, "agent.yaml"));
1120
+ await fs4.access(path5.join(agentDir, "agent.yaml"));
1102
1121
  return true;
1103
1122
  } catch {
1104
1123
  return false;
1105
1124
  }
1106
1125
  }
1107
1126
  async function loadAgentManifest(agentDir) {
1108
- const agentYamlPath = path4.join(agentDir, "agent.yaml");
1127
+ const agentYamlPath = path5.join(agentDir, "agent.yaml");
1109
1128
  let content;
1110
1129
  try {
1111
1130
  content = await fs4.readFile(agentYamlPath, "utf-8");
@@ -1127,8 +1146,8 @@ var DEFAULT_MAX_DIRS = 256;
1127
1146
  function isStructuralAction(action) {
1128
1147
  return action === "create" || action === "delete";
1129
1148
  }
1130
- function parentDirOf(path5) {
1131
- return path5.includes("/") ? path5.slice(0, path5.lastIndexOf("/")) : "";
1149
+ function parentDirOf(path6) {
1150
+ return path6.includes("/") ? path6.slice(0, path6.lastIndexOf("/")) : "";
1132
1151
  }
1133
1152
  var FileChangedCoalescer = class {
1134
1153
  windowMs;
@@ -1259,22 +1278,22 @@ function recipeMapPath() {
1259
1278
  var recipeMapMemo = null;
1260
1279
  var recipeMapInFlight = null;
1261
1280
  async function loadRecipeMap() {
1262
- const path5 = recipeMapPath();
1281
+ const path6 = recipeMapPath();
1263
1282
  const mtimeMs = await tryWithFsDeadline(
1264
- `stat ${path5}`,
1265
- async () => (await stat(path5)).mtimeMs,
1283
+ `stat ${path6}`,
1284
+ async () => (await stat(path6)).mtimeMs,
1266
1285
  null
1267
1286
  );
1268
1287
  if (mtimeMs === null) {
1269
- recipeMapMemo = { path: path5, mtimeMs: -1, map: null };
1288
+ recipeMapMemo = { path: path6, mtimeMs: -1, map: null };
1270
1289
  return null;
1271
1290
  }
1272
- if (recipeMapMemo && recipeMapMemo.path === path5 && recipeMapMemo.mtimeMs === mtimeMs) {
1291
+ if (recipeMapMemo && recipeMapMemo.path === path6 && recipeMapMemo.mtimeMs === mtimeMs) {
1273
1292
  return recipeMapMemo.map;
1274
1293
  }
1275
- const key = `${path5}:${mtimeMs}`;
1294
+ const key = `${path6}:${mtimeMs}`;
1276
1295
  if (recipeMapInFlight?.key === key) return recipeMapInFlight.promise;
1277
- const promise = readRecipeMap(path5, mtimeMs);
1296
+ const promise = readRecipeMap(path6, mtimeMs);
1278
1297
  recipeMapInFlight = { key, promise };
1279
1298
  try {
1280
1299
  return await promise;
@@ -1282,21 +1301,21 @@ async function loadRecipeMap() {
1282
1301
  if (recipeMapInFlight?.key === key) recipeMapInFlight = null;
1283
1302
  }
1284
1303
  }
1285
- async function readRecipeMap(path5, mtimeMs) {
1304
+ async function readRecipeMap(path6, mtimeMs) {
1286
1305
  let map = null;
1287
1306
  try {
1288
1307
  const parsed = JSON.parse(
1289
- await withFsDeadline(`readFile ${path5}`, () => readFile(path5, "utf8"))
1308
+ await withFsDeadline(`readFile ${path6}`, () => readFile(path6, "utf8"))
1290
1309
  );
1291
1310
  map = parsed && typeof parsed === "object" ? parsed : null;
1292
1311
  } catch (err) {
1293
1312
  createLogger({ kind: "mcp", subkind: "recipe-resolve" }).warn(
1294
1313
  "recipe map malformed \u2014 falling back to nix path-info",
1295
- { path: path5, error: err instanceof Error ? err.message : String(err) }
1314
+ { path: path6, error: err instanceof Error ? err.message : String(err) }
1296
1315
  );
1297
1316
  map = null;
1298
1317
  }
1299
- recipeMapMemo = { path: path5, mtimeMs, map };
1318
+ recipeMapMemo = { path: path6, mtimeMs, map };
1300
1319
  return map;
1301
1320
  }
1302
1321
  var MapRecipeProducer = class {
@@ -3185,31 +3204,31 @@ function errorResponse(command, resourceId, err) {
3185
3204
  };
3186
3205
  }
3187
3206
  async function handleResourceRequest(command, manager, emit) {
3188
- const { requestId, connectorId, operation, path: path5, options, content } = command;
3207
+ const { requestId, connectorId, operation, path: path6, options, content } = command;
3189
3208
  try {
3190
3209
  let data;
3191
3210
  switch (operation) {
3192
3211
  case "list":
3193
3212
  data = await manager.list(
3194
3213
  connectorId,
3195
- path5,
3214
+ path6,
3196
3215
  options
3197
3216
  );
3198
3217
  break;
3199
3218
  case "read":
3200
- data = await manager.read(connectorId, path5);
3219
+ data = await manager.read(connectorId, path6);
3201
3220
  break;
3202
3221
  case "write":
3203
- await manager.write(connectorId, path5, content);
3222
+ await manager.write(connectorId, path6, content);
3204
3223
  data = true;
3205
3224
  break;
3206
3225
  case "delete":
3207
- data = await manager.delete(connectorId, path5);
3226
+ data = await manager.delete(connectorId, path6);
3208
3227
  break;
3209
3228
  case "search":
3210
3229
  data = await manager.search(
3211
3230
  connectorId,
3212
- path5,
3231
+ path6,
3213
3232
  options
3214
3233
  );
3215
3234
  break;
@@ -4281,17 +4300,17 @@ function createCoalescedTask(lock, fn) {
4281
4300
  }
4282
4301
  async function recordStagedSkills(staged, projectDir, skillsDir, names, timeoutMs) {
4283
4302
  for (const name of names) {
4284
- const path5 = join(projectDir, skillsDir, name);
4285
- const st = await tryWithFsDeadline(`lstat ${path5}`, () => lstat(path5), null, timeoutMs);
4303
+ const path6 = join(projectDir, skillsDir, name);
4304
+ const st = await tryWithFsDeadline(`lstat ${path6}`, () => lstat(path6), null, timeoutMs);
4286
4305
  staged.set(
4287
4306
  name,
4288
- st?.isDirectory() && st.birthtimeMs > 0 ? { path: path5, dev: st.dev, ino: st.ino, birthtimeMs: st.birthtimeMs } : null
4307
+ st?.isDirectory() && st.birthtimeMs > 0 ? { path: path6, dev: st.dev, ino: st.ino, birthtimeMs: st.birthtimeMs } : null
4289
4308
  );
4290
4309
  }
4291
4310
  }
4292
- async function isStillOurs(record2, path5, timeoutMs) {
4293
- if (!record2 || record2.path !== path5) return false;
4294
- const st = await tryWithFsDeadline(`lstat ${path5}`, () => lstat(path5), null, timeoutMs);
4311
+ async function isStillOurs(record2, path6, timeoutMs) {
4312
+ if (!record2 || record2.path !== path6) return false;
4313
+ const st = await tryWithFsDeadline(`lstat ${path6}`, () => lstat(path6), null, timeoutMs);
4295
4314
  return st?.isDirectory() === true && st.dev === record2.dev && st.ino === record2.ino && st.birthtimeMs === record2.birthtimeMs;
4296
4315
  }
4297
4316
  async function attachStagedSkill(deps, name) {
@@ -4355,9 +4374,9 @@ async function detachStagedSkill(deps, name) {
4355
4374
  };
4356
4375
  }
4357
4376
  }
4358
- async function pathState(path5) {
4377
+ async function pathState(path6) {
4359
4378
  try {
4360
- await withFsDeadline(`lstat ${path5}`, () => lstat(path5));
4379
+ await withFsDeadline(`lstat ${path6}`, () => lstat(path6));
4361
4380
  return "present";
4362
4381
  } catch (err) {
4363
4382
  return err?.code === "ENOENT" ? "absent" : "unknown";
@@ -5363,13 +5382,20 @@ function readCurrentClaudeAccessToken(home) {
5363
5382
  function raiseHookFailures(phase, results, log) {
5364
5383
  const failed = results.filter((r) => !r.ok);
5365
5384
  if (failed.length === 0) return;
5385
+ const cause = (f) => redactUrlAuth(f.error ?? "unknown error");
5366
5386
  for (const f of failed) {
5367
- log(`[lifecycle] ${phase}: connector "${f.id}" failed \u2014 ${f.error ?? "unknown error"}`);
5387
+ log(`[lifecycle] ${phase}: connector "${f.id}" failed \u2014 ${cause(f)}`);
5368
5388
  }
5369
5389
  throw new Error(
5370
- `${failed.length} connector(s) failed to ${phase}: ${failed.map((f) => `${f.id}: ${f.error ?? "unknown error"}`).join("; ")}`
5390
+ `${failed.length} connector(s) failed to ${phase}: ${failed.map((f) => `${f.id}: ${cause(f)}`).join("; ")}`
5371
5391
  );
5372
5392
  }
5393
+ function redactUrlAuth(text2) {
5394
+ return text2.replace(/\/\/[^/\s]*@/g, "//***@");
5395
+ }
5396
+ function replyResults(results) {
5397
+ return results.map((r) => r.detail ? { ...r, detail: redactUrlAuth(r.detail) } : r);
5398
+ }
5373
5399
  function buildLifecycleHandler(deps) {
5374
5400
  const { getCompactionOrchestrator, getResourceManager, log } = deps;
5375
5401
  return async ({ phase }) => {
@@ -5378,22 +5404,29 @@ function buildLifecycleHandler(deps) {
5378
5404
  const orchestrator = getCompactionOrchestrator();
5379
5405
  if (orchestrator) await orchestrator.compact("manual");
5380
5406
  else log("[lifecycle] compact: no compaction orchestrator \u2014 skipped");
5381
- break;
5407
+ return { ok: true };
5382
5408
  }
5383
5409
  case "hibernate": {
5384
5410
  const manager = getResourceManager();
5385
- if (manager) raiseHookFailures("hibernate", await manager.hibernateAll(), log);
5386
- else log("[lifecycle] hibernate: no resource manager \u2014 skipped");
5387
- break;
5411
+ if (!manager) {
5412
+ log("[lifecycle] hibernate: no resource manager \u2014 skipped");
5413
+ return { ok: true };
5414
+ }
5415
+ const results = await manager.hibernateAll();
5416
+ raiseHookFailures("hibernate", results, log);
5417
+ return { ok: true, results: replyResults(results) };
5388
5418
  }
5389
5419
  case "close": {
5390
5420
  const manager = getResourceManager();
5391
- if (manager) raiseHookFailures("close", await manager.closeAll(), log);
5392
- else log("[lifecycle] close: no resource manager \u2014 skipped");
5393
- break;
5421
+ if (!manager) {
5422
+ log("[lifecycle] close: no resource manager \u2014 skipped");
5423
+ return { ok: true };
5424
+ }
5425
+ const results = await manager.closeAll();
5426
+ raiseHookFailures("close", results, log);
5427
+ return { ok: true, results: replyResults(results) };
5394
5428
  }
5395
5429
  }
5396
- return { ok: true };
5397
5430
  };
5398
5431
  }
5399
5432
  function asDeclaration(declaration) {
@@ -6210,8 +6243,8 @@ async function buildStoreSnapshotReplay(manager, activeFlows) {
6210
6243
  }
6211
6244
  async function guardClaudeAiConnectors(home, serverLog) {
6212
6245
  try {
6213
- const path5 = await ensureClaudeSettingsDisablesConnectors(home);
6214
- serverLog.info("claude.ai connectors disabled in user settings", { path: path5 });
6246
+ const path6 = await ensureClaudeSettingsDisablesConnectors(home);
6247
+ serverLog.info("claude.ai connectors disabled in user settings", { path: path6 });
6215
6248
  } catch (err) {
6216
6249
  serverLog.warn(
6217
6250
  "failed to disable claude.ai connectors in user settings \u2014 relying on env only",
@@ -6775,7 +6808,9 @@ async function startAgentServer(opts) {
6775
6808
  sessionId,
6776
6809
  projectDir: opts.projectDir,
6777
6810
  yamlBlock: wsConfig.logging,
6778
- onLog: opts.onLog
6811
+ onLog: opts.onLog,
6812
+ // Broker mode has no host-side trim of this file; see logging-bootstrap.ts.
6813
+ enforceRetention: true
6779
6814
  });
6780
6815
  const serverLog = createLogger({
6781
6816
  kind: "runner",
@@ -9009,16 +9044,16 @@ var SESSIONS_SUBDIR = "sessions";
9009
9044
  var CURRENT_FILE = "current";
9010
9045
  var LEGACY_FILE = "session.json";
9011
9046
  function sessionsDir(projectDir) {
9012
- return path4.join(projectDir, SESSION_DIR, SESSIONS_SUBDIR);
9047
+ return path5.join(projectDir, SESSION_DIR, SESSIONS_SUBDIR);
9013
9048
  }
9014
9049
  function sessionFilePath(projectDir, runId) {
9015
- return path4.join(sessionsDir(projectDir), `${runId}.json`);
9050
+ return path5.join(sessionsDir(projectDir), `${runId}.json`);
9016
9051
  }
9017
9052
  function currentPointerPath(projectDir) {
9018
- return path4.join(projectDir, SESSION_DIR, CURRENT_FILE);
9053
+ return path5.join(projectDir, SESSION_DIR, CURRENT_FILE);
9019
9054
  }
9020
9055
  function legacySessionPath(projectDir) {
9021
- return path4.join(projectDir, SESSION_DIR, LEGACY_FILE);
9056
+ return path5.join(projectDir, SESSION_DIR, LEGACY_FILE);
9022
9057
  }
9023
9058
  async function migrateLegacySession(projectDir) {
9024
9059
  const legacyPath = legacySessionPath(projectDir);
@@ -9063,7 +9098,7 @@ async function listSessions(projectDir) {
9063
9098
  for (const file of files) {
9064
9099
  if (!file.endsWith(".json")) continue;
9065
9100
  try {
9066
- const raw = await fs4.readFile(path4.join(dir, file), "utf-8");
9101
+ const raw = await fs4.readFile(path5.join(dir, file), "utf-8");
9067
9102
  sessions.push(JSON.parse(raw));
9068
9103
  } catch {
9069
9104
  }
@@ -9087,7 +9122,7 @@ async function saveSession(projectDir, state, setCurrent = true) {
9087
9122
  async function setCurrentSession(projectDir, runId) {
9088
9123
  const exists = await loadSessionById(projectDir, runId);
9089
9124
  if (!exists) throw new Error(`Session not found: ${runId}`);
9090
- await fs4.mkdir(path4.join(projectDir, SESSION_DIR), { recursive: true });
9125
+ await fs4.mkdir(path5.join(projectDir, SESSION_DIR), { recursive: true });
9091
9126
  await fs4.writeFile(currentPointerPath(projectDir), runId, "utf-8");
9092
9127
  }
9093
9128
  async function deleteSession(projectDir, runId) {
@@ -9118,5 +9153,5 @@ function touchSession(state) {
9118
9153
  }
9119
9154
 
9120
9155
  export { CLAUDE_CODE_CREDENTIALS_KEY, COMPILE_MANIFEST_FILENAME, CapabilityRegistry, DEFAULT_CAPABILITY_CALL_TIMEOUT_MS, DEFAULT_COALESCE_MS, DEFAULT_FLOW_MUTATE_CONNECTOR_WAIT_MS, MOUNT_LIST_MAX_DEPTH, MOUNT_LIST_MAX_ENTRIES, MOUNT_READ_DEADLINE_FACTOR, MOUNT_STAT_BUDGET_MS, MOUNT_STAT_MAX_ENTRIES, MOUNT_TREE_OP_DEADLINE_FACTOR, MarkdownStreamer, PreInitRingSink, ResourceOperationError, SESSION_ROOT_WRITABLE_DIRS, SESSION_ROOT_WRITABLE_FILES, agentDefinitionExists, bootstrapCapabilityRegistry, bootstrapRunnerLogStore, buildAgentResources, buildClientCapabilityHandler, buildConnectorTokenMediator, buildContextSection, buildEnvironmentSection, buildResourcesAvailablePayload, buildStoreSnapshotReplay, builtinCapabilities, capabilityLogInstance, clearPreInitRingSink, clearSession, compileComposition, computeCapabilitySignature, computeDirectoryTotals, connectorRefreshKind, createAgentSession, createFlowConnectorReadiness, createManagedCodexSubpromptDriver, createSessionStimulusBus, defineCapability, deleteSession, dispatchResourceRequest, dispatchRunnerCapabilityInvocation, emitSystemPromptComposed, ensureClaudeSettingsDisablesConnectors, ensureGitConfigInclude, executeConnectorMutate, extractClaudeAiOauthExpiresAt, flowStartNeedsDriverRestart, getPreInitRingSink, handleMountResourceRequest, handleResourceRequest, handleSessionRootResourceRequest, hasNonTerminalFlow, hostOpResumeStimulus, installPreInitRingSink, isSessionRootPathAllowed, isTerminalFlowStatus, listSessions, loadAgentManifest, loadCompileManifest, loadCompileManifestFromDir, loadManagedCodexHostConfig, loadSession, loadSessionById, mcpAuthSecretKey, newSession, nulTailPaddingLength, pickFlowToolTarget, pickRepointedManager, planFlowMutate, prepareCodexTools, reconcilePendingDecisions, registerActiveFlow, registerCompositionCapabilities, rejectCapabilityOnApprovalDeny, resetRunnerLogStore, resolveAgentComposition, resolveAgentMixins, resolveBinding, resolveCapabilityCallTimeoutMs, resolveCapabilityResult, resolveComposition, resolveFlowMutateConnectorWaitMs, resolveMixin, runAgentChat, saveSession, setCurrentSession, setUpFlowConnector, startAgentServer, stimulusFromMetas, supportsLiveToolUpdates, touchSession, validateInputResponse, writeClaudeCodeCredentialsFile };
9121
- //# sourceMappingURL=chunk-2DGIAWKU.js.map
9122
- //# sourceMappingURL=chunk-2DGIAWKU.js.map
9156
+ //# sourceMappingURL=chunk-LN4M7WMX.js.map
9157
+ //# sourceMappingURL=chunk-LN4M7WMX.js.map