@skaile/workspaces 4.30.0 → 4.30.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/app-sdk/index.js +1 -1
  3. package/dist/{asset-feeds-K7N37CGF.js → asset-feeds-YB5ROSAE.js} +4 -4
  4. package/dist/{asset-feeds-K7N37CGF.js.map → asset-feeds-YB5ROSAE.js.map} +1 -1
  5. package/dist/asset-manager/index.js +1 -1
  6. package/dist/bridge/drivers/claude-sdk.js +100 -12
  7. package/dist/bridge/drivers/claude-sdk.js.map +1 -1
  8. package/dist/bridge/drivers/codex.js +3 -3
  9. package/dist/bridge/drivers/continue.js +4 -4
  10. package/dist/bridge/drivers/echo.js +3 -3
  11. package/dist/bridge/drivers/gemini.js +6 -6
  12. package/dist/bridge/drivers/goose.js +4 -4
  13. package/dist/bridge/drivers/omp.js +5 -5
  14. package/dist/bridge/drivers/opencode.js +4 -4
  15. package/dist/bridge/drivers/qwen.js +6 -6
  16. package/dist/bridge/index.js +6 -6
  17. package/dist/bridge/src/drivers/claude-sdk.d.ts +24 -0
  18. package/dist/bridge/src/drivers/claude-sdk.d.ts.map +1 -1
  19. package/dist/bridge/src/error-classifier.d.ts +13 -0
  20. package/dist/bridge/src/error-classifier.d.ts.map +1 -1
  21. package/dist/bridge/src/types.d.ts +15 -0
  22. package/dist/bridge/src/types.d.ts.map +1 -1
  23. package/dist/{chunk-RLIISQHO.js → chunk-2ICKARYU.js} +3 -3
  24. package/dist/{chunk-RLIISQHO.js.map → chunk-2ICKARYU.js.map} +1 -1
  25. package/dist/{chunk-TU2UTFVG.js → chunk-3AX5PZRA.js} +4 -4
  26. package/dist/{chunk-TU2UTFVG.js.map → chunk-3AX5PZRA.js.map} +1 -1
  27. package/dist/{chunk-MLM5JZAQ.js → chunk-3TK7CZVL.js} +3 -3
  28. package/dist/{chunk-MLM5JZAQ.js.map → chunk-3TK7CZVL.js.map} +1 -1
  29. package/dist/{chunk-MZQOSE2X.js → chunk-7HJ3YLRF.js} +3 -3
  30. package/dist/{chunk-MZQOSE2X.js.map → chunk-7HJ3YLRF.js.map} +1 -1
  31. package/dist/{chunk-KOVAB6W2.js → chunk-7VQGUNXJ.js} +2 -2
  32. package/dist/{chunk-KOVAB6W2.js.map → chunk-7VQGUNXJ.js.map} +1 -1
  33. package/dist/{chunk-324NAWHN.js → chunk-DDCRSE5P.js} +4 -4
  34. package/dist/{chunk-324NAWHN.js.map → chunk-DDCRSE5P.js.map} +1 -1
  35. package/dist/{chunk-3FVL4TBA.js → chunk-ECTQR7IM.js} +6 -6
  36. package/dist/{chunk-3FVL4TBA.js.map → chunk-ECTQR7IM.js.map} +1 -1
  37. package/dist/{chunk-RHXRXTBO.js → chunk-FAQRNZ44.js} +2 -2
  38. package/dist/{chunk-RHXRXTBO.js.map → chunk-FAQRNZ44.js.map} +1 -1
  39. package/dist/{chunk-GHLJV2FY.js → chunk-FF5L6IV3.js} +3 -3
  40. package/dist/{chunk-GHLJV2FY.js.map → chunk-FF5L6IV3.js.map} +1 -1
  41. package/dist/{chunk-3W4SDHJP.js → chunk-FRX2BO3V.js} +26 -20
  42. package/dist/chunk-FRX2BO3V.js.map +1 -0
  43. package/dist/{chunk-X22NBPTU.js → chunk-L2GKM47Q.js} +6 -6
  44. package/dist/{chunk-X22NBPTU.js.map → chunk-L2GKM47Q.js.map} +1 -1
  45. package/dist/{chunk-KKBXGPJE.js → chunk-LUC6OEWM.js} +3 -3
  46. package/dist/{chunk-KKBXGPJE.js.map → chunk-LUC6OEWM.js.map} +1 -1
  47. package/dist/{chunk-OHON7XSG.js → chunk-M42SMH7V.js} +3 -3
  48. package/dist/{chunk-OHON7XSG.js.map → chunk-M42SMH7V.js.map} +1 -1
  49. package/dist/{chunk-NQOE57Q7.js → chunk-MX7LCQUQ.js} +4 -4
  50. package/dist/{chunk-NQOE57Q7.js.map → chunk-MX7LCQUQ.js.map} +1 -1
  51. package/dist/{chunk-CYX7TIWL.js → chunk-NP3WH7JF.js} +3 -3
  52. package/dist/{chunk-CYX7TIWL.js.map → chunk-NP3WH7JF.js.map} +1 -1
  53. package/dist/{chunk-GHX6XFLY.js → chunk-NQCQTAMQ.js} +7 -7
  54. package/dist/{chunk-GHX6XFLY.js.map → chunk-NQCQTAMQ.js.map} +1 -1
  55. package/dist/{chunk-CFKJQDPA.js → chunk-PM6DO25W.js} +5 -5
  56. package/dist/{chunk-CFKJQDPA.js.map → chunk-PM6DO25W.js.map} +1 -1
  57. package/dist/{chunk-527MPCTU.js → chunk-RXTKWTZV.js} +3 -3
  58. package/dist/{chunk-527MPCTU.js.map → chunk-RXTKWTZV.js.map} +1 -1
  59. package/dist/{chunk-LIWDDZO2.js → chunk-SM3UPDXE.js} +6 -6
  60. package/dist/{chunk-LIWDDZO2.js.map → chunk-SM3UPDXE.js.map} +1 -1
  61. package/dist/{chunk-K575XNKG.js → chunk-UKIL4XH5.js} +3 -3
  62. package/dist/{chunk-K575XNKG.js.map → chunk-UKIL4XH5.js.map} +1 -1
  63. package/dist/{chunk-C5OSO7HJ.js → chunk-VYNIZDAD.js} +3 -3
  64. package/dist/{chunk-C5OSO7HJ.js.map → chunk-VYNIZDAD.js.map} +1 -1
  65. package/dist/{chunk-BGY4KTU6.js → chunk-XBSQ4KMC.js} +10 -3
  66. package/dist/chunk-XBSQ4KMC.js.map +1 -0
  67. package/dist/{chunk-HNWYNNIX.js → chunk-ZVVZ67EH.js} +2 -2
  68. package/dist/{chunk-HNWYNNIX.js.map → chunk-ZVVZ67EH.js.map} +1 -1
  69. package/dist/cli/index.js +36 -36
  70. package/dist/connectors/index.js +8 -8
  71. package/dist/connectors-shared/index.js +2 -2
  72. package/dist/{ensure-sources-OGAOMNTT.js → ensure-sources-3VOIO6IM.js} +4 -4
  73. package/dist/{ensure-sources-OGAOMNTT.js.map → ensure-sources-3VOIO6IM.js.map} +1 -1
  74. package/dist/factory-assets/connectors/box.js +8 -8
  75. package/dist/factory-assets/connectors/deploy.js +8 -8
  76. package/dist/factory-assets/connectors/devserver.js +8 -8
  77. package/dist/factory-assets/connectors/flow/adapter.js +8 -8
  78. package/dist/factory-assets/connectors/flow/run-flow.js +9 -9
  79. package/dist/factory-assets/connectors/flow.js +8 -8
  80. package/dist/factory-assets/connectors/git.js +8 -8
  81. package/dist/factory-assets/connectors/gmail.js +8 -8
  82. package/dist/factory-assets/connectors/googledrive.js +8 -8
  83. package/dist/factory-assets/connectors/local.js +8 -8
  84. package/dist/factory-assets/connectors/mattermost.js +8 -8
  85. package/dist/factory-assets/connectors/memory.js +8 -8
  86. package/dist/factory-assets/connectors/minio.js +8 -8
  87. package/dist/factory-assets/connectors/postgres.js +8 -8
  88. package/dist/factory-assets/connectors/s3.js +8 -8
  89. package/dist/factory-assets/connectors/sharepoint.js +8 -8
  90. package/dist/factory-assets/connectors/sqlite.js +8 -8
  91. package/dist/factory-assets/connectors/static-server.js +8 -8
  92. package/dist/factory-assets/connectors/tunnel.js +8 -8
  93. package/dist/factory-assets/connectors/webdav.js +8 -8
  94. package/dist/factory-assets/connectors/xstate-store.js +8 -8
  95. package/dist/factory-assets/connectors/xstate.js +8 -8
  96. package/dist/{helpers-AS2CN7BJ.js → helpers-G7AQV3NN.js} +4 -4
  97. package/dist/{helpers-AS2CN7BJ.js.map → helpers-G7AQV3NN.js.map} +1 -1
  98. package/dist/{library-publish-SXQAWWPG.js → library-publish-YOF75HVC.js} +6 -6
  99. package/dist/{library-publish-SXQAWWPG.js.map → library-publish-YOF75HVC.js.map} +1 -1
  100. package/dist/{open-library-UVAFPWK7.js → open-library-DAIEAPNR.js} +5 -5
  101. package/dist/{open-library-UVAFPWK7.js.map → open-library-DAIEAPNR.js.map} +1 -1
  102. package/dist/{project-MHUUWPCN.js → project-IKHGSG4I.js} +5 -5
  103. package/dist/{project-MHUUWPCN.js.map → project-IKHGSG4I.js.map} +1 -1
  104. package/dist/runner/index.js +12 -12
  105. package/dist/runner/src/serve.d.ts.map +1 -1
  106. package/dist/sdk/asset-manager.js +1 -1
  107. package/dist/sdk/bridge.js +6 -6
  108. package/dist/sdk/index.js +12 -12
  109. package/dist/sdk/runner.js +12 -12
  110. package/dist/sdk/session.js +2 -2
  111. package/dist/sdk/types.js +1 -1
  112. package/dist/session/index.js +2 -2
  113. package/dist/{setup-NQKJXRK5.js → setup-234UBMJX.js} +11 -11
  114. package/dist/{setup-NQKJXRK5.js.map → setup-234UBMJX.js.map} +1 -1
  115. package/dist/{source-T7DWNSDN.js → source-VAKNCLQY.js} +6 -6
  116. package/dist/{source-T7DWNSDN.js.map → source-VAKNCLQY.js.map} +1 -1
  117. package/dist/{source-manifest-publish-WBAWFUHX.js → source-manifest-publish-FEFRWILI.js} +7 -7
  118. package/dist/{source-manifest-publish-WBAWFUHX.js.map → source-manifest-publish-FEFRWILI.js.map} +1 -1
  119. package/dist/tui/index.js +12 -12
  120. package/dist/types/index.js +1 -1
  121. package/dist/types/src/events.d.ts +8 -0
  122. package/dist/types/src/events.d.ts.map +1 -1
  123. package/dist/types/src/version.d.ts +8 -1
  124. package/dist/types/src/version.d.ts.map +1 -1
  125. package/dist/workspace-plugin/adapters/mcp.js +2 -2
  126. package/dist/workspace-plugin/index.js +1 -1
  127. package/package.json +1 -1
  128. package/dist/chunk-3W4SDHJP.js.map +0 -1
  129. package/dist/chunk-BGY4KTU6.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { declaresActivityLabel, stripActivityLabel } from './chunk-NQOE57Q7.js';
1
+ import { declaresActivityLabel, stripActivityLabel } from './chunk-MX7LCQUQ.js';
2
2
  import { randomUUID } from 'crypto';
3
3
 
4
4
  async function dispatchCapability(hooks, name, input, onBackgroundError = () => {
@@ -52,5 +52,5 @@ function filterRenderCapabilities(caps) {
52
52
  }
53
53
 
54
54
  export { dispatchCapability, filterRenderCapabilities, renderFallback };
55
- //# sourceMappingURL=chunk-GHLJV2FY.js.map
56
- //# sourceMappingURL=chunk-GHLJV2FY.js.map
55
+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cesContent":["/**\n * Capability dispatch helpers for bridge drivers.\n *\n * The runner builds a {@link BridgeCapabilityHooks} bundle from its\n * `CapabilityRegistry` and threads it through `AgentConfig.capabilities`.\n * Drivers consume the bundle via these helpers without taking a runtime\n * dependency on `@skaile/workspaces/runner` (which would create a circular dep).\n *\n * Three behaviours are layered into a single dispatch path:\n *\n * 1. **Standard tool call** — the LLM invokes a capability; the bridge calls\n * `hooks.invoke()`, awaits the result, and returns it to the LLM.\n * 2. **Fire-and-forget** — when the resolved Capability has `fireAndForget`\n * set, the bridge resolves to `{}` immediately and runs the handler in\n * the background. Background errors are logged but never surfaced to the\n * LLM since the call is already settled.\n * 3. **Render capability** — when the resolved Capability has a non-undefined\n * `render`, the bridge emits `RenderInvokedEvent` to the runner via\n * `hooks.emitRender` and (when `render.fallback` is set) a parallel text\n * event via `hooks.emitText` with simple `{{prop}}` substitution. The\n * placeholder convention follows the v2 spec — top-level keys of `props`\n * only, with optional dotted-path traversal (`{{user.name}}`). The legacy\n * AAP `{{props.x}}` form was retired in Phase 6.\n *\n * @category Capabilities\n * @since 2.0.0\n */\nimport { randomUUID } from \"node:crypto\";\nimport {\n type Capability,\n declaresActivityLabel,\n stripActivityLabel,\n} from \"@skaile/workspaces/types\";\nimport type { BridgeCapabilityHooks } from \"./types.js\";\n\n/**\n * Result of a capability dispatch returned by {@link dispatchCapability}.\n *\n * The bridge feeds `{ result }` back to the LLM tool-use response. For\n * fire-and-forget capabilities `result` is always `{}` and `background` is `true`.\n *\n * @docLink packages/bridge/concepts#capability-dispatch-result\n */\nexport interface CapabilityDispatchResult {\n /** Value returned to the LLM. `{}` for fire-and-forget capabilities. */\n result: unknown;\n /** True when the handler is still running in the background (fire-and-forget). */\n background: boolean;\n /** The per-dispatch call id minted for this invocation (see {@link dispatchCapability}). */\n callId: string;\n}\n\n/**\n * Run a capability invocation through the runner-provided hooks, applying\n * render-event emission and fire-and-forget short-circuit.\n *\n * The result is always shaped for direct return to the LLM. For\n * fire-and-forget capabilities the background promise is fired and any error\n * is logged through `onBackgroundError` (defaulting to a no-op). For all\n * other capabilities the handler is awaited; errors propagate as a rejection\n * so the driver can surface them as tool errors.\n *\n * **Dispatch call id.** Every dispatch mints a fresh `randomUUID()` and uses it\n * for `render_invoked.callId`, `hooks.invoke`'s `callId` and — for client\n * capabilities — the outbound `capability_invoked.callId`. It is deliberately\n * NOT the driver's tool-call id: those are only as unique as the model\n * provider makes them (some backends emit `call_0` on every turn), and the\n * runner's pending-call map is keyed by this id, so a late `capability_result`\n * for a timed-out call must never be able to resolve a later call that reused\n * the provider's id. Drivers map results back to their tool calls through the\n * returned value, never through this id.\n *\n * @param hooks - Capability dispatch bundle from `AgentConfig.capabilities`.\n * @param name - Registered capability name.\n * @param input - Raw tool input from the LLM.\n * @param onBackgroundError - Optional error handler for fire-and-forget failures; receives the dispatch call id.\n * @param signal - Optional abort signal forwarded to the handler.\n * @returns Resolved dispatch result with the LLM-facing value, background flag and dispatch call id.\n * @docLink packages/bridge/concepts#dispatch-capability\n */\nexport async function dispatchCapability(\n hooks: BridgeCapabilityHooks,\n name: string,\n input: unknown,\n onBackgroundError: (err: unknown, callId: string) => void = () => {},\n signal?: AbortSignal,\n): Promise<CapabilityDispatchResult> {\n signal?.throwIfAborted();\n const callId = randomUUID();\n const cap = hooks.resolve(name);\n // The advertised `activity_label` is for the UI only. Strip it before render\n // props and the handler: strict inputs would reject it and external MCP\n // passthrough would forward it. Kept when the capability declares it itself.\n if (!declaresActivityLabel(cap?.inputSchema)) input = stripActivityLabel(input);\n\n // Render emission happens before invocation so clients see the props the\n // LLM passed in even if the handler errors. The runner's gateway forwards\n // the event over the transport.\n if (cap?.render && hooks.emitRender) {\n hooks.emitRender({\n type: \"render_invoked\",\n capabilityName: name,\n props: input,\n callId,\n });\n if (cap.render.fallback && hooks.emitText) {\n const fallback = renderFallback(cap.render.fallback, input);\n hooks.emitText(fallback);\n }\n }\n\n if (cap?.fireAndForget) {\n // Resolve immediately; run handler in background.\n void hooks.invoke(name, input, signal, callId).catch((err) => onBackgroundError(err, callId));\n return { result: {}, background: true, callId };\n }\n\n const result = await hooks.invoke(name, input, signal, callId);\n return { result, background: false, callId };\n}\n\n/**\n * Substitute `{{prop}}` placeholders inside a fallback template using the\n * input record. Top-level keys of `props` resolve directly\n * (`{{name}}` → `props.name`); dotted paths traverse nested records\n * (`{{user.name}}` → `props.user.name`). Missing keys collapse to an empty\n * string; non-record inputs collapse all placeholders.\n *\n * The convention is fixed by the v2 spec (§1, `RenderSpec.fallback`). The\n * legacy AAP form `{{props.x}}` is no longer accepted — author fallbacks\n * with bare keys.\n *\n * Intentionally minimal — full template engines belong in the platform's\n * render layer, not the bridge.\n *\n * @param template - Fallback string from `RenderSpec.fallback` with `{{key}}` placeholders.\n * @param input - LLM tool input object; non-object values collapse all placeholders.\n * @returns Template with all resolvable placeholders replaced.\n * @docLink packages/bridge/concepts#render-fallback\n */\nexport function renderFallback(template: string, input: unknown): string {\n if (!input || typeof input !== \"object\") {\n return template.replace(/\\{\\{\\s*[\\w$.]+\\s*\\}\\}/g, \"\");\n }\n const props = input as Record<string, unknown>;\n return template.replace(/\\{\\{\\s*([\\w$.]+)\\s*\\}\\}/g, (_match, path: string) => {\n const value = readPath(props, path);\n return value === undefined || value === null ? \"\" : String(value);\n });\n}\n\nfunction readPath(obj: Record<string, unknown>, path: string): unknown {\n const parts = path.split(\".\");\n let current: unknown = obj;\n for (const part of parts) {\n if (current === null || current === undefined || typeof current !== \"object\") {\n return undefined;\n }\n current = (current as Record<string, unknown>)[part];\n }\n return current;\n}\n\n/**\n * Filter a capability list to those marked as render-capable (having a `render` spec).\n *\n * Used by drivers that emit a separate render manifest at registration time.\n * Currently unused in production drivers; reserved for future phases.\n *\n * @param caps - Full capability list to filter.\n * @returns Subset of capabilities with a non-undefined `render` property.\n * @docLink packages/bridge/concepts#filter-render-capabilities\n */\nexport function filterRenderCapabilities(caps: Capability[]): Capability[] {\n return caps.filter((c) => c.render !== undefined);\n}\n"]}
1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AAQ,MAAM,CAAA;AAC7D,EAAA,OAAO,EAAE,MAAA,EAAQ,UAAA,EAAY,KAAA,EAAO,MAAA,EAAO;AAC7C;AAqBO,SAAS,cAAA,CAAe,UAAkB,KAAA,EAAwB;AACvE,EAAA,IAAI,CAAC,KAAA,IAAS,OAAO,KAAA,KAAU,QAAA,EAAU;AACvC,IAAA,OAAO,QAAA,CAAS,OAAA,CAAQ,wBAAA,EAA0B,EAAE,CAAA;AAAA,EACtD;AACA,EAAA,MAAM,KAAA,GAAQ,KAAA;AACd,EAAA,OAAO,QAAA,CAAS,OAAA,CAAQ,0BAAA,EAA4B,CAAC,QAAQ,IAAA,KAAiB;AAC5E,IAAA,MAAM,KAAA,GAAQ,QAAA,CAAS,KAAA,EAAO,IAAI,CAAA;AAClC,IAAA,OAAO,UAAU,MAAA,IAAa,KAAA,KAAU,IAAA,GAAO,EAAA,GAAK,OAAO,KAAK,CAAA;AAAA,EAClE,CAAC,CAAA;AACH;AAEA,SAAS,QAAA,CAAS,KAA8B,IAAA,EAAuB;AACrE,EAAA,MAAM,KAAA,GAAQ,IAAA,CAAK,KAAA,CAAM,GAAG,CAAA;AAC5B,EAAA,IAAI,OAAA,GAAmB,GAAA;AACvB,EAAA,KAAA,MAAW,QAAQ,KAAA,EAAO;AACxB,IAAA,IAAI,YAAY,IAAA,IAAQ,OAAA,KAAY,MAAA,IAAa,OAAO,YAAY,QAAA,EAAU;AAC5E,MAAA,OAAO,MAAA;AAAA,IACT;AACA,IAAA,OAAA,GAAW,QAAoC,IAAI,CAAA;AAAA,EACrD;AACA,EAAA,OAAO,OAAA;AACT;AAYO,SAAS,yBAAyB,IAAA,EAAkC;AACzE,EAAA,OAAO,KAAK,MAAA,CAAO,CAAC,CAAA,KAAM,CAAA,CAAE,WAAW,MAAS,CAAA;AAClD","file":"chunk-FF5L6IV3.js","sourcesContent":["/**\n * Capability dispatch helpers for bridge drivers.\n *\n * The runner builds a {@link BridgeCapabilityHooks} bundle from its\n * `CapabilityRegistry` and threads it through `AgentConfig.capabilities`.\n * Drivers consume the bundle via these helpers without taking a runtime\n * dependency on `@skaile/workspaces/runner` (which would create a circular dep).\n *\n * Three behaviours are layered into a single dispatch path:\n *\n * 1. **Standard tool call** — the LLM invokes a capability; the bridge calls\n * `hooks.invoke()`, awaits the result, and returns it to the LLM.\n * 2. **Fire-and-forget** — when the resolved Capability has `fireAndForget`\n * set, the bridge resolves to `{}` immediately and runs the handler in\n * the background. Background errors are logged but never surfaced to the\n * LLM since the call is already settled.\n * 3. **Render capability** — when the resolved Capability has a non-undefined\n * `render`, the bridge emits `RenderInvokedEvent` to the runner via\n * `hooks.emitRender` and (when `render.fallback` is set) a parallel text\n * event via `hooks.emitText` with simple `{{prop}}` substitution. The\n * placeholder convention follows the v2 spec — top-level keys of `props`\n * only, with optional dotted-path traversal (`{{user.name}}`). The legacy\n * AAP `{{props.x}}` form was retired in Phase 6.\n *\n * @category Capabilities\n * @since 2.0.0\n */\nimport { randomUUID } from \"node:crypto\";\nimport {\n type Capability,\n declaresActivityLabel,\n stripActivityLabel,\n} from \"@skaile/workspaces/types\";\nimport type { BridgeCapabilityHooks } from \"./types.js\";\n\n/**\n * Result of a capability dispatch returned by {@link dispatchCapability}.\n *\n * The bridge feeds `{ result }` back to the LLM tool-use response. For\n * fire-and-forget capabilities `result` is always `{}` and `background` is `true`.\n *\n * @docLink packages/bridge/concepts#capability-dispatch-result\n */\nexport interface CapabilityDispatchResult {\n /** Value returned to the LLM. `{}` for fire-and-forget capabilities. */\n result: unknown;\n /** True when the handler is still running in the background (fire-and-forget). */\n background: boolean;\n /** The per-dispatch call id minted for this invocation (see {@link dispatchCapability}). */\n callId: string;\n}\n\n/**\n * Run a capability invocation through the runner-provided hooks, applying\n * render-event emission and fire-and-forget short-circuit.\n *\n * The result is always shaped for direct return to the LLM. For\n * fire-and-forget capabilities the background promise is fired and any error\n * is logged through `onBackgroundError` (defaulting to a no-op). For all\n * other capabilities the handler is awaited; errors propagate as a rejection\n * so the driver can surface them as tool errors.\n *\n * **Dispatch call id.** Every dispatch mints a fresh `randomUUID()` and uses it\n * for `render_invoked.callId`, `hooks.invoke`'s `callId` and — for client\n * capabilities — the outbound `capability_invoked.callId`. It is deliberately\n * NOT the driver's tool-call id: those are only as unique as the model\n * provider makes them (some backends emit `call_0` on every turn), and the\n * runner's pending-call map is keyed by this id, so a late `capability_result`\n * for a timed-out call must never be able to resolve a later call that reused\n * the provider's id. Drivers map results back to their tool calls through the\n * returned value, never through this id.\n *\n * @param hooks - Capability dispatch bundle from `AgentConfig.capabilities`.\n * @param name - Registered capability name.\n * @param input - Raw tool input from the LLM.\n * @param onBackgroundError - Optional error handler for fire-and-forget failures; receives the dispatch call id.\n * @param signal - Optional abort signal forwarded to the handler.\n * @returns Resolved dispatch result with the LLM-facing value, background flag and dispatch call id.\n * @docLink packages/bridge/concepts#dispatch-capability\n */\nexport async function dispatchCapability(\n hooks: BridgeCapabilityHooks,\n name: string,\n input: unknown,\n onBackgroundError: (err: unknown, callId: string) => void = () => {},\n signal?: AbortSignal,\n): Promise<CapabilityDispatchResult> {\n signal?.throwIfAborted();\n const callId = randomUUID();\n const cap = hooks.resolve(name);\n // The advertised `activity_label` is for the UI only. Strip it before render\n // props and the handler: strict inputs would reject it and external MCP\n // passthrough would forward it. Kept when the capability declares it itself.\n if (!declaresActivityLabel(cap?.inputSchema)) input = stripActivityLabel(input);\n\n // Render emission happens before invocation so clients see the props the\n // LLM passed in even if the handler errors. The runner's gateway forwards\n // the event over the transport.\n if (cap?.render && hooks.emitRender) {\n hooks.emitRender({\n type: \"render_invoked\",\n capabilityName: name,\n props: input,\n callId,\n });\n if (cap.render.fallback && hooks.emitText) {\n const fallback = renderFallback(cap.render.fallback, input);\n hooks.emitText(fallback);\n }\n }\n\n if (cap?.fireAndForget) {\n // Resolve immediately; run handler in background.\n void hooks.invoke(name, input, signal, callId).catch((err) => onBackgroundError(err, callId));\n return { result: {}, background: true, callId };\n }\n\n const result = await hooks.invoke(name, input, signal, callId);\n return { result, background: false, callId };\n}\n\n/**\n * Substitute `{{prop}}` placeholders inside a fallback template using the\n * input record. Top-level keys of `props` resolve directly\n * (`{{name}}` → `props.name`); dotted paths traverse nested records\n * (`{{user.name}}` → `props.user.name`). Missing keys collapse to an empty\n * string; non-record inputs collapse all placeholders.\n *\n * The convention is fixed by the v2 spec (§1, `RenderSpec.fallback`). The\n * legacy AAP form `{{props.x}}` is no longer accepted — author fallbacks\n * with bare keys.\n *\n * Intentionally minimal — full template engines belong in the platform's\n * render layer, not the bridge.\n *\n * @param template - Fallback string from `RenderSpec.fallback` with `{{key}}` placeholders.\n * @param input - LLM tool input object; non-object values collapse all placeholders.\n * @returns Template with all resolvable placeholders replaced.\n * @docLink packages/bridge/concepts#render-fallback\n */\nexport function renderFallback(template: string, input: unknown): string {\n if (!input || typeof input !== \"object\") {\n return template.replace(/\\{\\{\\s*[\\w$.]+\\s*\\}\\}/g, \"\");\n }\n const props = input as Record<string, unknown>;\n return template.replace(/\\{\\{\\s*([\\w$.]+)\\s*\\}\\}/g, (_match, path: string) => {\n const value = readPath(props, path);\n return value === undefined || value === null ? \"\" : String(value);\n });\n}\n\nfunction readPath(obj: Record<string, unknown>, path: string): unknown {\n const parts = path.split(\".\");\n let current: unknown = obj;\n for (const part of parts) {\n if (current === null || current === undefined || typeof current !== \"object\") {\n return undefined;\n }\n current = (current as Record<string, unknown>)[part];\n }\n return current;\n}\n\n/**\n * Filter a capability list to those marked as render-capable (having a `render` spec).\n *\n * Used by drivers that emit a separate render manifest at registration time.\n * Currently unused in production drivers; reserved for future phases.\n *\n * @param caps - Full capability list to filter.\n * @returns Subset of capabilities with a non-undefined `render` property.\n * @docLink packages/bridge/concepts#filter-render-capabilities\n */\nexport function filterRenderCapabilities(caps: Capability[]): Capability[] {\n return caps.filter((c) => c.render !== undefined);\n}\n"]}
@@ -1,25 +1,25 @@
1
- import { WorkspacePlugin } from './chunk-HNWYNNIX.js';
2
- import { buildWorkspaceToolDefs } from './chunk-527MPCTU.js';
1
+ import { WorkspacePlugin } from './chunk-ZVVZ67EH.js';
2
+ import { buildWorkspaceToolDefs } from './chunk-RXTKWTZV.js';
3
3
  import { findAiAssetsRoot } from './chunk-7IH3RKKK.js';
4
4
  import { WebSocketServerTransport } from './chunk-5LKOAX7I.js';
5
5
  import { assembleSystemPrompt, buildCapabilitiesPromptSection } from './chunk-W3UDISS2.js';
6
6
  import { prepareNativePolicy, codexInstanceEnvironment, parseCodexCredential, parseCodexRefreshInput, parseCodexRefreshResult } from './chunk-PE3A6FFW.js';
7
- import { resolveFlowPath } from './chunk-MZQOSE2X.js';
7
+ import { resolveFlowPath } from './chunk-7HJ3YLRF.js';
8
8
  import { findAiAssetsRoot as findAiAssetsRoot$1, deployCatalogEntry, undeployCatalogEntry } from './chunk-Q6NDQ6BH.js';
9
- import { registerBuiltinConnectors, buildConnectorPromptSection, findMissingPackages, installNpmPackages, ConnectorManager, buildSdkConnectorTools, buildLazySdkFlowTools, describeFlowOperations, buildConnectorToolDefs, buildFlowToolDefs, SessionNodeExecutor, SessionSubpromptRunner, ClassifierSubpromptRunner, SessionInlineSubFlowRunner, driveOrchestratorTurn, buildSdkFlowTools } from './chunk-GHX6XFLY.js';
9
+ import { registerBuiltinConnectors, buildConnectorPromptSection, findMissingPackages, installNpmPackages, ConnectorManager, buildSdkConnectorTools, buildLazySdkFlowTools, describeFlowOperations, buildConnectorToolDefs, buildFlowToolDefs, SessionNodeExecutor, SessionSubpromptRunner, ClassifierSubpromptRunner, SessionInlineSubFlowRunner, driveOrchestratorTurn, buildSdkFlowTools } from './chunk-NQCQTAMQ.js';
10
10
  import { loadYamlConnectorDeclarations, withMaterializedConnectorDeclarations, SecretProviderChain, ConnectorStartupError, PreMintedSecretProvider, InMemorySecretProvider, resolvedConfigToDeclarations, isKnownSecretRef, deriveSingleMaterializedConnectorDeclaration } from './chunk-2JANXYTJ.js';
11
- import { EventNormalizer } from './chunk-CFKJQDPA.js';
11
+ import { EventNormalizer } from './chunk-PM6DO25W.js';
12
12
  import { probeResumeTranscript, transcriptStoreForRuntime } from './chunk-6S5KL76M.js';
13
13
  import { scopeReconfigureModel } from './chunk-TJRNJVGU.js';
14
14
  import { CodexNativeStateUnavailable } from './chunk-LOO5CB5M.js';
15
- import { dispatchCapability } from './chunk-GHLJV2FY.js';
16
- import { classifyClaudeSdkError } from './chunk-BGY4KTU6.js';
15
+ import { dispatchCapability } from './chunk-FF5L6IV3.js';
16
+ import { classifyClaudeSdkError } from './chunk-XBSQ4KMC.js';
17
17
  import { agentExecRequested } from './chunk-YROR332M.js';
18
- import { toAgentEffort, createDriver, catalogLayer, providerCredentialEnvName, toMergedRegistry, registryCredentialEnv, AI_PROVIDER_PRESETS, AgentDriver } from './chunk-RHXRXTBO.js';
18
+ import { toAgentEffort, createDriver, catalogLayer, providerCredentialEnvName, toMergedRegistry, registryCredentialEnv, AI_PROVIDER_PRESETS, AgentDriver } from './chunk-FAQRNZ44.js';
19
19
  import { loadFlow } from './chunk-YVWUHPQW.js';
20
20
  import { parseFlowDefinition } from './chunk-DIQDYNXZ.js';
21
21
  import { renderStimulusPrompt } from './chunk-K3IBZ2UZ.js';
22
- import { withActivityLabelJsonSchema, TOOL_ACTIVITY_PROMPT_SECTION, SESSION_ROOT_CONNECTOR_ID, PROTOCOL_VERSION } from './chunk-NQOE57Q7.js';
22
+ import { withActivityLabelJsonSchema, TOOL_ACTIVITY_PROMPT_SECTION, SESSION_ROOT_CONNECTOR_ID, PROTOCOL_VERSION } from './chunk-MX7LCQUQ.js';
23
23
  import { resolveSettings, loadProviderRegistry } from './chunk-UWU572Q6.js';
24
24
  import { resolveRuntimeAssets } from './chunk-5RHPNNWP.js';
25
25
  import { resolveDriverPaths } from './chunk-K5GBV4SA.js';
@@ -8053,16 +8053,20 @@ async function executeConnectorMutate(cmd, deps) {
8053
8053
  acked = true;
8054
8054
  deps.sendEvent({ type: "connector_mutate_response", requestId: cmd.requestId, ...r });
8055
8055
  };
8056
- try {
8057
- await deps.sessionReady;
8058
- } catch (err) {
8059
- const message = `Session not available: ${err.message}`;
8060
- deps.sendEvent({ type: "error", message, fatal: true });
8061
- respond({ ok: false, code: "session_unavailable", error: message });
8062
- return;
8063
- }
8056
+ const sessionAvailable = async () => {
8057
+ try {
8058
+ await deps.sessionReady;
8059
+ return true;
8060
+ } catch (err) {
8061
+ const message = `Session not available: ${err.message}`;
8062
+ deps.sendEvent({ type: "error", message, fatal: true });
8063
+ respond({ ok: false, code: "session_unavailable", error: message });
8064
+ return false;
8065
+ }
8066
+ };
8064
8067
  if (!deps.initBuildHold) {
8065
- await applyConnectorMutate(cmd, deps, respond, deps.connectorWaitMs);
8068
+ if (await sessionAvailable())
8069
+ await applyConnectorMutate(cmd, deps, respond, deps.connectorWaitMs);
8066
8070
  return;
8067
8071
  }
8068
8072
  await deps.initBuildHold.run(
@@ -8088,6 +8092,7 @@ async function executeConnectorMutate(cmd, deps) {
8088
8092
  });
8089
8093
  return;
8090
8094
  case "ready":
8095
+ if (!await sessionAvailable()) return;
8091
8096
  await applyConnectorMutate(
8092
8097
  cmd,
8093
8098
  deps,
@@ -8516,6 +8521,7 @@ async function startAgentServer(opts) {
8516
8521
  ...observation.limitType ? { limitType: observation.limitType } : {},
8517
8522
  ...typeof observation.utilization === "number" ? { utilization: observation.utilization } : {},
8518
8523
  ...typeof observation.resetsAt === "number" ? { resetsAt: observation.resetsAt } : {},
8524
+ ...observation.cause ? { cause: observation.cause } : {},
8519
8525
  observedAt: (/* @__PURE__ */ new Date()).toISOString()
8520
8526
  });
8521
8527
  };
@@ -10862,5 +10868,5 @@ function touchSession(state) {
10862
10868
  }
10863
10869
 
10864
10870
  export { CLAUDE_CODE_CREDENTIALS_KEY, COMPILE_MANIFEST_FILENAME, CONNECTOR_MUTATE_NOT_READY, 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, WS_AUTH_TOKEN_ENV, WS_AUTH_TOKEN_FILE_ENV, 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, flowRunDrivesTurns, flowStartNeedsDriverRestart, getPreInitRingSink, handleMountResourceRequest, handleResourceRequest, handleSessionRootResourceRequest, hasNonTerminalFlow, hostOpResumeStimulus, installPreInitRingSink, isSessionRootPathAllowed, isTerminalFlowStatus, listSessions, loadAgentManifest, loadCompileManifest, loadCompileManifestFromDir, loadManagedCodexHostConfig, loadSession, loadSessionById, mcpAuthSecretKey, newSession, nulTailPaddingLength, pickChatFlowTarget, pickFlowToolTarget, pickRepointedManager, planFlowMutate, prepareCodexTools, reconcilePendingDecisions, recreateKeepingLiveFlows, registerActiveFlow, registerCompositionCapabilities, rejectCapabilityOnApprovalDeny, rejectPendingCapabilityCallsOnDisconnect, resetRunnerLogStore, resolveAgentComposition, resolveAgentMixins, resolveBinding, resolveCapabilityCallTimeoutMs, resolveCapabilityResult, resolveComposition, resolveFlowMutateConnectorWaitMs, resolveMixin, restoredRunHasWorkToResume, runAgentChat, saveSession, setCurrentSession, setUpFlowConnector, startAgentServer, stimulusFromMetas, supportsLiveToolUpdates, takeRunnerWsAuthToken, toActiveFlowTarget, touchSession, validateInputResponse, writeClaudeCodeCredentialsFile };
10865
- //# sourceMappingURL=chunk-3W4SDHJP.js.map
10866
- //# sourceMappingURL=chunk-3W4SDHJP.js.map
10871
+ //# sourceMappingURL=chunk-FRX2BO3V.js.map
10872
+ //# sourceMappingURL=chunk-FRX2BO3V.js.map