@skaile/workspaces 3.14.1 → 3.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (207) hide show
  1. package/CHANGELOG.md +183 -0
  2. package/dist/{asset-feeds-STHKKTW3.js → asset-feeds-6UC7CUTI.js} +12 -12
  3. package/dist/{asset-feeds-STHKKTW3.js.map → asset-feeds-6UC7CUTI.js.map} +1 -1
  4. package/dist/asset-manager/catalog-deployer.js +7 -7
  5. package/dist/asset-manager/index.js +12 -12
  6. package/dist/asset-manager/installer.js +9 -9
  7. package/dist/asset-manager/renderers.js +2 -2
  8. package/dist/bridge/drivers/claude-sdk.js +15 -12
  9. package/dist/bridge/drivers/claude-sdk.js.map +1 -1
  10. package/dist/bridge/drivers/codex.js +4 -4
  11. package/dist/bridge/drivers/continue.js +4 -4
  12. package/dist/bridge/drivers/echo.js +3 -3
  13. package/dist/bridge/drivers/gemini.js +6 -6
  14. package/dist/bridge/drivers/goose.js +4 -4
  15. package/dist/bridge/drivers/omp.js +147 -8
  16. package/dist/bridge/drivers/omp.js.map +1 -1
  17. package/dist/bridge/drivers/opencode.js +4 -4
  18. package/dist/bridge/drivers/qwen.js +6 -6
  19. package/dist/bridge/index.js +10 -10
  20. package/dist/bridge/src/drivers/claude-sdk.d.ts.map +1 -1
  21. package/dist/bridge/src/drivers/omp.d.ts +62 -0
  22. package/dist/bridge/src/drivers/omp.d.ts.map +1 -1
  23. package/dist/bridge/src/index.d.ts +1 -0
  24. package/dist/bridge/src/index.d.ts.map +1 -1
  25. package/dist/bridge/src/models.d.ts +27 -2
  26. package/dist/bridge/src/models.d.ts.map +1 -1
  27. package/dist/bridge/src/provider-endpoints.d.ts +39 -0
  28. package/dist/bridge/src/provider-endpoints.d.ts.map +1 -1
  29. package/dist/bridge/src/validation.d.ts +6 -1
  30. package/dist/bridge/src/validation.d.ts.map +1 -1
  31. package/dist/{chunk-RUFTB7QN.js → chunk-3NCGSSCU.js} +3 -3
  32. package/dist/{chunk-RUFTB7QN.js.map → chunk-3NCGSSCU.js.map} +1 -1
  33. package/dist/{chunk-4VTBZ2MF.js → chunk-3XXQPHGL.js} +4 -4
  34. package/dist/{chunk-4VTBZ2MF.js.map → chunk-3XXQPHGL.js.map} +1 -1
  35. package/dist/{chunk-3UU3D2Q3.js → chunk-5KSIVLOX.js} +5 -5
  36. package/dist/{chunk-3UU3D2Q3.js.map → chunk-5KSIVLOX.js.map} +1 -1
  37. package/dist/{chunk-HYFJPR7W.js → chunk-6HTQNNOX.js} +7 -7
  38. package/dist/{chunk-HYFJPR7W.js.map → chunk-6HTQNNOX.js.map} +1 -1
  39. package/dist/{chunk-PGUTER7Z.js → chunk-6KPCHQP5.js} +3 -3
  40. package/dist/{chunk-PGUTER7Z.js.map → chunk-6KPCHQP5.js.map} +1 -1
  41. package/dist/{chunk-GHWJHOYX.js → chunk-7BUZQVRR.js} +4 -4
  42. package/dist/{chunk-GHWJHOYX.js.map → chunk-7BUZQVRR.js.map} +1 -1
  43. package/dist/{chunk-JAHHMZWG.js → chunk-7IRJ4K4F.js} +3 -3
  44. package/dist/{chunk-JAHHMZWG.js.map → chunk-7IRJ4K4F.js.map} +1 -1
  45. package/dist/{chunk-IRORTHGA.js → chunk-AN6NAFRT.js} +21 -7
  46. package/dist/chunk-AN6NAFRT.js.map +1 -0
  47. package/dist/{chunk-OYZIURPH.js → chunk-BQMRUH7J.js} +3 -3
  48. package/dist/{chunk-OYZIURPH.js.map → chunk-BQMRUH7J.js.map} +1 -1
  49. package/dist/{chunk-GRMQBBN4.js → chunk-BUKPS4YL.js} +3 -3
  50. package/dist/{chunk-GRMQBBN4.js.map → chunk-BUKPS4YL.js.map} +1 -1
  51. package/dist/{chunk-OCLCDB7G.js → chunk-C4AP3XZB.js} +6 -6
  52. package/dist/{chunk-OCLCDB7G.js.map → chunk-C4AP3XZB.js.map} +1 -1
  53. package/dist/{chunk-AZPXCHDK.js → chunk-CIPK5JMJ.js} +5 -6
  54. package/dist/chunk-CIPK5JMJ.js.map +1 -0
  55. package/dist/{chunk-KKMRT6GU.js → chunk-CL4TYERP.js} +10 -10
  56. package/dist/{chunk-KKMRT6GU.js.map → chunk-CL4TYERP.js.map} +1 -1
  57. package/dist/{chunk-IEX5YV4R.js → chunk-DVSASEGO.js} +3 -3
  58. package/dist/{chunk-IEX5YV4R.js.map → chunk-DVSASEGO.js.map} +1 -1
  59. package/dist/{chunk-PW4SJE3X.js → chunk-DZ4UZOFB.js} +4 -4
  60. package/dist/{chunk-PW4SJE3X.js.map → chunk-DZ4UZOFB.js.map} +1 -1
  61. package/dist/{chunk-5F33LGZL.js → chunk-ER4UOIUS.js} +3 -3
  62. package/dist/{chunk-5F33LGZL.js.map → chunk-ER4UOIUS.js.map} +1 -1
  63. package/dist/{chunk-G2CXWUO5.js → chunk-FAI2SMFE.js} +4 -4
  64. package/dist/{chunk-G2CXWUO5.js.map → chunk-FAI2SMFE.js.map} +1 -1
  65. package/dist/{chunk-5Q7HA4JP.js → chunk-FTG7CRFD.js} +3 -3
  66. package/dist/{chunk-5Q7HA4JP.js.map → chunk-FTG7CRFD.js.map} +1 -1
  67. package/dist/{chunk-V34ZEXSE.js → chunk-GURXUF2J.js} +32 -7
  68. package/dist/chunk-GURXUF2J.js.map +1 -0
  69. package/dist/{chunk-Z7W4B7P2.js → chunk-GWQZ2ECO.js} +6 -6
  70. package/dist/{chunk-Z7W4B7P2.js.map → chunk-GWQZ2ECO.js.map} +1 -1
  71. package/dist/{chunk-ZPCHTTD7.js → chunk-IVWJHELM.js} +116 -29
  72. package/dist/chunk-IVWJHELM.js.map +1 -0
  73. package/dist/{chunk-2A7BV6WT.js → chunk-JNCORFRK.js} +9 -6
  74. package/dist/chunk-JNCORFRK.js.map +1 -0
  75. package/dist/{chunk-XICDQVOG.js → chunk-KLDWNSDN.js} +4 -4
  76. package/dist/{chunk-XICDQVOG.js.map → chunk-KLDWNSDN.js.map} +1 -1
  77. package/dist/{chunk-URB2QZ4W.js → chunk-MFWIWPJP.js} +8 -8
  78. package/dist/{chunk-URB2QZ4W.js.map → chunk-MFWIWPJP.js.map} +1 -1
  79. package/dist/{chunk-VQ4P7UYE.js → chunk-MKZOK4JU.js} +3 -3
  80. package/dist/{chunk-VQ4P7UYE.js.map → chunk-MKZOK4JU.js.map} +1 -1
  81. package/dist/{chunk-AONVXRAE.js → chunk-NIUG3MIH.js} +3 -3
  82. package/dist/{chunk-AONVXRAE.js.map → chunk-NIUG3MIH.js.map} +1 -1
  83. package/dist/{chunk-ZSZSDBBW.js → chunk-OGTS7QJX.js} +5 -5
  84. package/dist/{chunk-ZSZSDBBW.js.map → chunk-OGTS7QJX.js.map} +1 -1
  85. package/dist/{chunk-SH572OBN.js → chunk-OIDFK7SG.js} +4 -4
  86. package/dist/{chunk-SH572OBN.js.map → chunk-OIDFK7SG.js.map} +1 -1
  87. package/dist/{chunk-IP3GXHOB.js → chunk-OZ7UNMTK.js} +3 -3
  88. package/dist/{chunk-IP3GXHOB.js.map → chunk-OZ7UNMTK.js.map} +1 -1
  89. package/dist/{chunk-UTW6YKAC.js → chunk-PMYZRX6M.js} +3 -3
  90. package/dist/{chunk-UTW6YKAC.js.map → chunk-PMYZRX6M.js.map} +1 -1
  91. package/dist/{chunk-O7WKKINT.js → chunk-S4UA244H.js} +5 -5
  92. package/dist/{chunk-O7WKKINT.js.map → chunk-S4UA244H.js.map} +1 -1
  93. package/dist/{chunk-WAFHQDLK.js → chunk-SUPIVTLX.js} +3 -3
  94. package/dist/{chunk-WAFHQDLK.js.map → chunk-SUPIVTLX.js.map} +1 -1
  95. package/dist/{chunk-Y6JJHOLR.js → chunk-SZ7VJQK3.js} +10 -10
  96. package/dist/{chunk-Y6JJHOLR.js.map → chunk-SZ7VJQK3.js.map} +1 -1
  97. package/dist/{chunk-3A5IKBHQ.js → chunk-W4IPN3DD.js} +61 -8
  98. package/dist/chunk-W4IPN3DD.js.map +1 -0
  99. package/dist/{chunk-VW6RUT7X.js → chunk-X2665LP2.js} +8 -8
  100. package/dist/{chunk-VW6RUT7X.js.map → chunk-X2665LP2.js.map} +1 -1
  101. package/dist/{chunk-M5D2QNTY.js → chunk-ZNCZ7RUO.js} +3 -3
  102. package/dist/{chunk-M5D2QNTY.js.map → chunk-ZNCZ7RUO.js.map} +1 -1
  103. package/dist/cli/index.js +60 -56
  104. package/dist/cli/index.js.map +1 -1
  105. package/dist/cli/src/commands/serve.d.ts.map +1 -1
  106. package/dist/connectors/config.js +7 -7
  107. package/dist/connectors/index.js +13 -13
  108. package/dist/core/index.js +6 -6
  109. package/dist/core/logging.js +2 -2
  110. package/dist/core/manifest.js +2 -2
  111. package/dist/core/runtime-assets.js +4 -4
  112. package/dist/core/src/logging/index.d.ts +2 -0
  113. package/dist/core/src/logging/index.d.ts.map +1 -1
  114. package/dist/core/src/logging/log-store.d.ts.map +1 -1
  115. package/dist/core/src/logging/sinks/stdout-sink.d.ts +6 -1
  116. package/dist/core/src/logging/sinks/stdout-sink.d.ts.map +1 -1
  117. package/dist/core/src/logging/stream-health.d.ts +46 -0
  118. package/dist/core/src/logging/stream-health.d.ts.map +1 -0
  119. package/dist/core/src/settings.d.ts +12 -1
  120. package/dist/core/src/settings.d.ts.map +1 -1
  121. package/dist/core/workspace-config.js +3 -3
  122. package/dist/deploy/index.js +8 -7
  123. package/dist/deploy/index.js.map +1 -1
  124. package/dist/deploy/src/targets/process-handle.d.ts.map +1 -1
  125. package/dist/discovery/index.js +4 -4
  126. package/dist/{ensure-sources-BFVKV773.js → ensure-sources-VJZUHSFZ.js} +15 -15
  127. package/dist/{ensure-sources-BFVKV773.js.map → ensure-sources-VJZUHSFZ.js.map} +1 -1
  128. package/dist/factory-assets/connectors/box.js +13 -13
  129. package/dist/factory-assets/connectors/deploy.js +13 -13
  130. package/dist/factory-assets/connectors/devserver.js +13 -13
  131. package/dist/factory-assets/connectors/flow/adapter.js +13 -13
  132. package/dist/factory-assets/connectors/flow/engine.js +7 -7
  133. package/dist/factory-assets/connectors/flow/run-flow.js +15 -15
  134. package/dist/factory-assets/connectors/flow.js +13 -13
  135. package/dist/factory-assets/connectors/git.js +13 -13
  136. package/dist/factory-assets/connectors/gmail.js +13 -13
  137. package/dist/factory-assets/connectors/googledrive.js +13 -13
  138. package/dist/factory-assets/connectors/local.js +13 -13
  139. package/dist/factory-assets/connectors/mattermost.js +13 -13
  140. package/dist/factory-assets/connectors/memory.js +13 -13
  141. package/dist/factory-assets/connectors/minio.js +13 -13
  142. package/dist/factory-assets/connectors/postgres.js +13 -13
  143. package/dist/factory-assets/connectors/s3.js +13 -13
  144. package/dist/factory-assets/connectors/sharepoint.js +13 -13
  145. package/dist/factory-assets/connectors/sqlite.js +13 -13
  146. package/dist/factory-assets/connectors/static-server.js +13 -13
  147. package/dist/factory-assets/connectors/tunnel.js +13 -13
  148. package/dist/factory-assets/connectors/webdav.js +13 -13
  149. package/dist/factory-assets/connectors/xstate-store.js +13 -13
  150. package/dist/factory-assets/connectors/xstate.js +13 -13
  151. package/dist/flows-2SUFOVVO.js +20 -0
  152. package/dist/{flows-4R4VJ5VM.js.map → flows-2SUFOVVO.js.map} +1 -1
  153. package/dist/{helpers-CQV2V2SL.js → helpers-EEYMGGLO.js} +15 -15
  154. package/dist/{helpers-CQV2V2SL.js.map → helpers-EEYMGGLO.js.map} +1 -1
  155. package/dist/library/index.js +9 -9
  156. package/dist/library/install.js +6 -6
  157. package/dist/{library-publish-6FZCXPYU.js → library-publish-37UBVMC3.js} +19 -19
  158. package/dist/{library-publish-6FZCXPYU.js.map → library-publish-37UBVMC3.js.map} +1 -1
  159. package/dist/open-library-JYVUN4CY.js +32 -0
  160. package/dist/{open-library-4EOFZ4QD.js.map → open-library-JYVUN4CY.js.map} +1 -1
  161. package/dist/paths-4APA2PKT.js +16 -0
  162. package/dist/{paths-S7UESJKT.js.map → paths-4APA2PKT.js.map} +1 -1
  163. package/dist/{plugin-store-5SJX2PRR.js → plugin-store-JQAIKR3R.js} +8 -8
  164. package/dist/{plugin-store-5SJX2PRR.js.map → plugin-store-JQAIKR3R.js.map} +1 -1
  165. package/dist/{project-J7RSKBAU.js → project-DKQACM3N.js} +16 -16
  166. package/dist/{project-J7RSKBAU.js.map → project-DKQACM3N.js.map} +1 -1
  167. package/dist/resolver/index.js +7 -7
  168. package/dist/runner/index.js +18 -18
  169. package/dist/runner/src/process-safety-net.d.ts +61 -0
  170. package/dist/runner/src/process-safety-net.d.ts.map +1 -0
  171. package/dist/runner/src/serve.d.ts +10 -0
  172. package/dist/runner/src/serve.d.ts.map +1 -1
  173. package/dist/sdk/asset-manager.js +12 -12
  174. package/dist/sdk/bridge.js +10 -10
  175. package/dist/sdk/core.js +6 -6
  176. package/dist/sdk/flow.js +7 -7
  177. package/dist/sdk/index.js +18 -18
  178. package/dist/sdk/resolver.js +7 -7
  179. package/dist/sdk/runner.js +18 -18
  180. package/dist/{setup-OQT5YK2Q.js → setup-7FJNMKFA.js} +12 -12
  181. package/dist/{setup-OQT5YK2Q.js.map → setup-7FJNMKFA.js.map} +1 -1
  182. package/dist/skills-Q7PJVB3W.js +20 -0
  183. package/dist/{skills-OBJX3VYG.js.map → skills-Q7PJVB3W.js.map} +1 -1
  184. package/dist/{source-AJ27AS6D.js → source-CT6RH3CJ.js} +18 -18
  185. package/dist/{source-AJ27AS6D.js.map → source-CT6RH3CJ.js.map} +1 -1
  186. package/dist/{source-manifest-publish-UCA2O5UA.js → source-manifest-publish-VBENANBT.js} +20 -20
  187. package/dist/{source-manifest-publish-UCA2O5UA.js.map → source-manifest-publish-VBENANBT.js.map} +1 -1
  188. package/dist/tui/index.js +18 -18
  189. package/dist/types/manifests.js +1 -1
  190. package/dist/types/src/manifests/agent.d.ts +47 -7
  191. package/dist/types/src/manifests/agent.d.ts.map +1 -1
  192. package/dist/types/src/manifests/index.d.ts +2 -2
  193. package/dist/types/src/manifests/index.d.ts.map +1 -1
  194. package/dist/workspace-plugin/adapters/mcp.js +11 -11
  195. package/dist/workspace-plugin/adapters/omp.js +7 -7
  196. package/dist/workspace-plugin/index.js +3 -3
  197. package/package.json +2 -1
  198. package/dist/chunk-2A7BV6WT.js.map +0 -1
  199. package/dist/chunk-3A5IKBHQ.js.map +0 -1
  200. package/dist/chunk-AZPXCHDK.js.map +0 -1
  201. package/dist/chunk-IRORTHGA.js.map +0 -1
  202. package/dist/chunk-V34ZEXSE.js.map +0 -1
  203. package/dist/chunk-ZPCHTTD7.js.map +0 -1
  204. package/dist/flows-4R4VJ5VM.js +0 -20
  205. package/dist/open-library-4EOFZ4QD.js +0 -32
  206. package/dist/paths-S7UESJKT.js +0 -16
  207. package/dist/skills-OBJX3VYG.js +0 -20
@@ -1,26 +1,26 @@
1
- import { WorkspacePlugin } from './chunk-UTW6YKAC.js';
1
+ import { WorkspacePlugin } from './chunk-PMYZRX6M.js';
2
2
  import { assembleSystemPrompt, buildCapabilitiesPromptSection } from './chunk-W3UDISS2.js';
3
3
  import { WebSocketServerTransport } from './chunk-WQ7DE5UC.js';
4
- import { resolveFlowPath } from './chunk-VW6RUT7X.js';
5
- import { findAiAssetsRoot, deployCatalogEntry, undeployCatalogEntry } from './chunk-GHWJHOYX.js';
6
- import { registerBuiltinConnectors, buildConnectorPromptSection, findMissingPackages, installNpmPackages, ConnectorManager, ConnectorStartupError, buildSdkConnectorTools, driveOrchestratorTurn, SessionNodeExecutor, SessionSubpromptRunner, SessionInlineSubFlowRunner, buildSdkFlowTools } from './chunk-KKMRT6GU.js';
7
- import { loadConnectorDeclarations, SecretProviderChain, PreMintedSecretProvider, InMemorySecretProvider, resolvedConfigToDeclarations, isKnownSecretRef, deriveSingleMaterializedConnectorDeclaration } from './chunk-3UU3D2Q3.js';
8
- import { EventNormalizer } from './chunk-2A7BV6WT.js';
9
- import { SUPPORTED_CLOUDS, probeResumeTranscript, CLOUD_SECRET_ENV_KEYS } from './chunk-RUFTB7QN.js';
4
+ import { resolveFlowPath } from './chunk-X2665LP2.js';
5
+ import { findAiAssetsRoot, deployCatalogEntry, undeployCatalogEntry } from './chunk-7BUZQVRR.js';
6
+ import { registerBuiltinConnectors, buildConnectorPromptSection, findMissingPackages, installNpmPackages, ConnectorManager, ConnectorStartupError, buildSdkConnectorTools, driveOrchestratorTurn, SessionNodeExecutor, SessionSubpromptRunner, SessionInlineSubFlowRunner, buildSdkFlowTools } from './chunk-CL4TYERP.js';
7
+ import { loadConnectorDeclarations, SecretProviderChain, PreMintedSecretProvider, InMemorySecretProvider, resolvedConfigToDeclarations, isKnownSecretRef, deriveSingleMaterializedConnectorDeclaration } from './chunk-5KSIVLOX.js';
8
+ import { EventNormalizer } from './chunk-JNCORFRK.js';
9
+ import { SUPPORTED_CLOUDS, probeResumeTranscript, CLOUD_SECRET_ENV_KEYS } from './chunk-3NCGSSCU.js';
10
10
  import { classifyClaudeSdkError } from './chunk-GAH4YRCI.js';
11
- import { createDriver } from './chunk-AONVXRAE.js';
12
- import { loadFlow } from './chunk-OYZIURPH.js';
11
+ import { createDriver } from './chunk-NIUG3MIH.js';
12
+ import { loadFlow } from './chunk-BQMRUH7J.js';
13
13
  import { parseFlowDefinition } from './chunk-HY6CIKFH.js';
14
14
  import { renderStimulusPrompt } from './chunk-2D5BYAL6.js';
15
15
  import { PROTOCOL_VERSION } from './chunk-2KBA5OO2.js';
16
- import { resolveSettings, resolveApiKey, providerEnvKey } from './chunk-AZPXCHDK.js';
16
+ import { resolveSettings, resolveApiKey, providerEnvKey } from './chunk-CIPK5JMJ.js';
17
17
  import { resolveDriverPaths } from './chunk-K5GBV4SA.js';
18
- import { resolveRuntimeAssets } from './chunk-SH572OBN.js';
19
- import { resolveSkWorkspaceConfig, resolveAgentDir, cloudConfigFromProfile, stageMaterializedSkills, loadMcpServerDeclarations, COMPACTION_DEFAULTS, validateAssetRecipeAttr, deriveSingleMaterializedMcpDeclaration } from './chunk-IP3GXHOB.js';
20
- import { withFsDeadline, fsDeadlineMs, FsDeadlineError, tryWithFsDeadline } from './chunk-VQ4P7UYE.js';
18
+ import { resolveRuntimeAssets } from './chunk-OIDFK7SG.js';
19
+ import { resolveSkWorkspaceConfig, resolveAgentDir, cloudConfigFromProfile, stageMaterializedSkills, loadMcpServerDeclarations, COMPACTION_DEFAULTS, validateAssetRecipeAttr, deriveSingleMaterializedMcpDeclaration } from './chunk-OZ7UNMTK.js';
20
+ import { withFsDeadline, fsDeadlineMs, FsDeadlineError, tryWithFsDeadline } from './chunk-MKZOK4JU.js';
21
21
  import { parseAssetRef } from './chunk-GEEW6SY2.js';
22
- import { resolveLogStoreConfig, createLogStoreFromConfig, OnLogBridgeSink, WsLogSink } from './chunk-5Q7HA4JP.js';
23
- import { getLogStore, registerLogStore, resetLogStore, createLogger } from './chunk-3A5IKBHQ.js';
22
+ import { resolveLogStoreConfig, createLogStoreFromConfig, OnLogBridgeSink, WsLogSink } from './chunk-FTG7CRFD.js';
23
+ import { getLogStore, registerLogStore, resetLogStore, createLogger, isUnwritableStreamError, markStreamBroken, isBrokenPipeError } from './chunk-W4IPN3DD.js';
24
24
  import { __require } from './chunk-NSBPE2FW.js';
25
25
  import pc from 'picocolors';
26
26
  import { Marked } from 'marked';
@@ -3165,10 +3165,10 @@ var CompactionGate = class {
3165
3165
  settle(hold) {
3166
3166
  if (hold == null || !this.held.delete(hold)) return;
3167
3167
  if (this.held.size > 0) return;
3168
- const release = this.release;
3168
+ const release2 = this.release;
3169
3169
  this.opened = null;
3170
3170
  this.release = null;
3171
- release?.();
3171
+ release2?.();
3172
3172
  }
3173
3173
  /**
3174
3174
  * Wait for the driver to be free.
@@ -3873,6 +3873,91 @@ function rewriteFileChangedPath(event, cwd, mounts) {
3873
3873
  }
3874
3874
  return event;
3875
3875
  }
3876
+
3877
+ // runner/src/process-safety-net.ts
3878
+ var BROKEN_PIPE_EXIT_CODE = 141;
3879
+ function resolveOptions(opts) {
3880
+ return {
3881
+ log: opts.log,
3882
+ exit: opts.exit ?? ((code) => process.exit(code)),
3883
+ stdout: opts.stdout ?? process.stdout,
3884
+ exitOnBrokenPipe: opts.exitOnBrokenPipe ?? true
3885
+ };
3886
+ }
3887
+ function createSafetyNetHandler(opts) {
3888
+ const { exit, stdout, exitOnBrokenPipe } = resolveOptions(opts);
3889
+ let handling = false;
3890
+ const outputIsGone = () => stdout.destroyed === true || stdout.writableEnded === true;
3891
+ return (label, err) => {
3892
+ if (handling) return;
3893
+ if (exitOnBrokenPipe && (isBrokenPipeError(err) || outputIsGone())) {
3894
+ exit(BROKEN_PIPE_EXIT_CODE);
3895
+ return;
3896
+ }
3897
+ handling = true;
3898
+ try {
3899
+ opts.log(`[serve] ${label} (non-fatal): ${render(err)}`);
3900
+ } catch (logErr) {
3901
+ if (exitOnBrokenPipe && (isBrokenPipeError(logErr) || outputIsGone())) {
3902
+ exit(BROKEN_PIPE_EXIT_CODE);
3903
+ }
3904
+ } finally {
3905
+ handling = false;
3906
+ }
3907
+ };
3908
+ }
3909
+ var activeWatches = /* @__PURE__ */ new WeakMap();
3910
+ function watchOutputStream(opts) {
3911
+ const { exit, stdout, exitOnBrokenPipe } = resolveOptions({ log: () => {
3912
+ }, ...opts });
3913
+ const key = stdout;
3914
+ const existing = activeWatches.get(key);
3915
+ if (existing) {
3916
+ existing.count++;
3917
+ return releaseOnce(key);
3918
+ }
3919
+ const onStdoutError = (err) => {
3920
+ if (isUnwritableStreamError(err)) markStreamBroken(key);
3921
+ if (exitOnBrokenPipe && isBrokenPipeError(err)) exit(BROKEN_PIPE_EXIT_CODE);
3922
+ };
3923
+ stdout.on?.("error", onStdoutError);
3924
+ activeWatches.set(key, {
3925
+ count: 1,
3926
+ remove: () => stdout.off?.("error", onStdoutError)
3927
+ });
3928
+ return releaseOnce(key);
3929
+ }
3930
+ function releaseOnce(key) {
3931
+ let released = false;
3932
+ return () => {
3933
+ if (released) return;
3934
+ released = true;
3935
+ release(key);
3936
+ };
3937
+ }
3938
+ function release(key) {
3939
+ const watch = activeWatches.get(key);
3940
+ if (!watch) return;
3941
+ watch.count--;
3942
+ if (watch.count > 0) return;
3943
+ watch.remove();
3944
+ activeWatches.delete(key);
3945
+ }
3946
+ function installProcessSafetyNet(opts) {
3947
+ const handle = createSafetyNetHandler(opts);
3948
+ const onException = (err) => handle("uncaughtException", err);
3949
+ const onRejection = (reason) => handle("unhandledRejection", reason);
3950
+ process.on("uncaughtException", onException);
3951
+ process.on("unhandledRejection", onRejection);
3952
+ return () => {
3953
+ process.off("uncaughtException", onException);
3954
+ process.off("unhandledRejection", onRejection);
3955
+ };
3956
+ }
3957
+ function render(err) {
3958
+ if (err instanceof Error) return err.stack ?? err.message;
3959
+ return String(err);
3960
+ }
3876
3961
  function parseFleetHealthBody(body) {
3877
3962
  const trimmed = body.trim().toLowerCase();
3878
3963
  if (trimmed === "healthy") return "healthy";
@@ -5347,6 +5432,9 @@ async function startAgentServer(opts) {
5347
5432
  instance: sessionId
5348
5433
  });
5349
5434
  const log = (line) => serverLog.info(line);
5435
+ const exitOnBrokenPipe = opts.exitOnBrokenPipe ?? false;
5436
+ const stopOutputWatch = watchOutputStream({ exitOnBrokenPipe });
5437
+ let teardownProcessHandlers = stopOutputWatch;
5350
5438
  const profile = wsConfig.agent_config?.default;
5351
5439
  const maxTurns = wsConfig.agent?.permissions?.max_turns ?? profile?.max_turns;
5352
5440
  setupManagedGitconfig(opts.projectDir, serverLog);
@@ -6634,6 +6722,7 @@ async function startAgentServer(opts) {
6634
6722
  platformVersion: cmd.protocolVersion
6635
6723
  });
6636
6724
  await cleanup();
6725
+ teardownProcessHandlers();
6637
6726
  disposeLogStore();
6638
6727
  return;
6639
6728
  }
@@ -6647,6 +6736,7 @@ async function startAgentServer(opts) {
6647
6736
  receivedContainerId: cmd.identity.containerId
6648
6737
  });
6649
6738
  await cleanup();
6739
+ teardownProcessHandlers();
6650
6740
  disposeLogStore();
6651
6741
  return;
6652
6742
  }
@@ -6985,6 +7075,7 @@ async function startAgentServer(opts) {
6985
7075
  log("[serve] shutdown requested");
6986
7076
  await cleanup();
6987
7077
  await transport.close();
7078
+ teardownProcessHandlers();
6988
7079
  disposeLogStore();
6989
7080
  process.exit(0);
6990
7081
  }
@@ -7178,16 +7269,11 @@ async function startAgentServer(opts) {
7178
7269
  log(`[serve] project=${opts.projectDir}`);
7179
7270
  installProcessHandlers();
7180
7271
  function installProcessHandlers() {
7181
- process.on("uncaughtException", (err) => {
7182
- log(
7183
- `[serve] uncaughtException (non-fatal): ${err instanceof Error ? err.stack ?? err.message : String(err)}`
7184
- );
7185
- });
7186
- process.on("unhandledRejection", (reason) => {
7187
- log(
7188
- `[serve] unhandledRejection (non-fatal): ${reason instanceof Error ? reason.stack ?? reason.message : String(reason)}`
7189
- );
7190
- });
7272
+ const stopSafetyNet = installProcessSafetyNet({ log, exitOnBrokenPipe });
7273
+ teardownProcessHandlers = () => {
7274
+ stopSafetyNet();
7275
+ stopOutputWatch();
7276
+ };
7191
7277
  const GRACEFUL_SHUTDOWN_TIMEOUT_MS = 5e3;
7192
7278
  let shuttingDown = false;
7193
7279
  async function initiateShutdown(signal) {
@@ -7214,6 +7300,7 @@ async function startAgentServer(opts) {
7214
7300
  }
7215
7301
  clearTimeout(forceExitTimer);
7216
7302
  log("[serve] shutdown complete");
7303
+ teardownProcessHandlers();
7217
7304
  disposeLogStore();
7218
7305
  process.exit(0);
7219
7306
  }
@@ -7339,5 +7426,5 @@ function touchSession(state) {
7339
7426
  }
7340
7427
 
7341
7428
  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_TREE_OP_DEADLINE_FACTOR, MarkdownStreamer, PreInitRingSink, agentDefinitionExists, bootstrapCapabilityRegistry, bootstrapRunnerLogStore, buildAgentResources, buildClientCapabilityHandler, buildConnectorTokenMediator, buildContextSection, buildEnvironmentSection, buildResourcesAvailablePayload, buildStoreSnapshotReplay, builtinCapabilities, capabilityLogInstance, clearPreInitRingSink, clearSession, compileComposition, computeCapabilitySignature, connectorRefreshKind, createAgentSession, createFlowConnectorReadiness, createSessionStimulusBus, defineCapability, deleteSession, dispatchRunnerCapabilityInvocation, emitSystemPromptComposed, ensureClaudeSettingsDisablesConnectors, ensureGitConfigInclude, executeConnectorMutate, extractClaudeAiOauthExpiresAt, getPreInitRingSink, handleMountResourceRequest, handleResourceRequest, hasNonTerminalFlow, hostOpResumeStimulus, installPreInitRingSink, isTerminalFlowStatus, listSessions, loadAgentManifest, loadCompileManifest, loadCompileManifestFromDir, loadSession, loadSessionById, mcpAuthSecretKey, newSession, nulTailPaddingLength, pickRepointedManager, planFlowMutate, reconcilePendingDecisions, registerActiveFlow, registerCompositionCapabilities, rejectCapabilityOnApprovalDeny, resetRunnerLogStore, resolveAgentComposition, resolveAgentMixins, resolveBinding, resolveCapabilityCallTimeoutMs, resolveCapabilityResult, resolveComposition, resolveFlowMutateConnectorWaitMs, resolveMixin, runAgentChat, saveSession, setCurrentSession, setUpFlowConnector, startAgentServer, stimulusFromMetas, touchSession, validateInputResponse, writeClaudeCodeCredentialsFile };
7342
- //# sourceMappingURL=chunk-ZPCHTTD7.js.map
7343
- //# sourceMappingURL=chunk-ZPCHTTD7.js.map
7429
+ //# sourceMappingURL=chunk-IVWJHELM.js.map
7430
+ //# sourceMappingURL=chunk-IVWJHELM.js.map