@skaile/workspaces 3.15.0 → 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 (175) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/dist/{asset-feeds-XSUE5LE6.js → asset-feeds-6UC7CUTI.js} +11 -11
  3. package/dist/{asset-feeds-XSUE5LE6.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 +10 -10
  6. package/dist/asset-manager/installer.js +7 -7
  7. package/dist/bridge/drivers/claude-sdk.js +8 -8
  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 +5 -5
  12. package/dist/bridge/drivers/goose.js +4 -4
  13. package/dist/bridge/drivers/omp.js +3 -3
  14. package/dist/bridge/drivers/opencode.js +4 -4
  15. package/dist/bridge/drivers/qwen.js +5 -5
  16. package/dist/bridge/index.js +9 -9
  17. package/dist/{chunk-RUFTB7QN.js → chunk-3NCGSSCU.js} +3 -3
  18. package/dist/{chunk-RUFTB7QN.js.map → chunk-3NCGSSCU.js.map} +1 -1
  19. package/dist/{chunk-4VTBZ2MF.js → chunk-3XXQPHGL.js} +4 -4
  20. package/dist/{chunk-4VTBZ2MF.js.map → chunk-3XXQPHGL.js.map} +1 -1
  21. package/dist/{chunk-3UU3D2Q3.js → chunk-5KSIVLOX.js} +5 -5
  22. package/dist/{chunk-3UU3D2Q3.js.map → chunk-5KSIVLOX.js.map} +1 -1
  23. package/dist/{chunk-CWTL2QWL.js → chunk-6HTQNNOX.js} +7 -7
  24. package/dist/{chunk-CWTL2QWL.js.map → chunk-6HTQNNOX.js.map} +1 -1
  25. package/dist/{chunk-FYLIY6TO.js → chunk-6KPCHQP5.js} +3 -3
  26. package/dist/{chunk-FYLIY6TO.js.map → chunk-6KPCHQP5.js.map} +1 -1
  27. package/dist/{chunk-GHWJHOYX.js → chunk-7BUZQVRR.js} +4 -4
  28. package/dist/{chunk-GHWJHOYX.js.map → chunk-7BUZQVRR.js.map} +1 -1
  29. package/dist/{chunk-JAHHMZWG.js → chunk-7IRJ4K4F.js} +3 -3
  30. package/dist/{chunk-JAHHMZWG.js.map → chunk-7IRJ4K4F.js.map} +1 -1
  31. package/dist/{chunk-QZ6XXD3A.js → chunk-BQMRUH7J.js} +3 -3
  32. package/dist/{chunk-QZ6XXD3A.js.map → chunk-BQMRUH7J.js.map} +1 -1
  33. package/dist/{chunk-O52DU5KU.js → chunk-BUKPS4YL.js} +3 -3
  34. package/dist/{chunk-O52DU5KU.js.map → chunk-BUKPS4YL.js.map} +1 -1
  35. package/dist/{chunk-Q7KWJO4J.js → chunk-C4AP3XZB.js} +5 -5
  36. package/dist/{chunk-Q7KWJO4J.js.map → chunk-C4AP3XZB.js.map} +1 -1
  37. package/dist/{chunk-F2WTSHZS.js → chunk-CIPK5JMJ.js} +4 -4
  38. package/dist/{chunk-F2WTSHZS.js.map → chunk-CIPK5JMJ.js.map} +1 -1
  39. package/dist/{chunk-MTCLDJPR.js → chunk-CL4TYERP.js} +9 -9
  40. package/dist/{chunk-MTCLDJPR.js.map → chunk-CL4TYERP.js.map} +1 -1
  41. package/dist/{chunk-PPKK5EV6.js → chunk-DZ4UZOFB.js} +3 -3
  42. package/dist/{chunk-PPKK5EV6.js.map → chunk-DZ4UZOFB.js.map} +1 -1
  43. package/dist/{chunk-LVZ5NGME.js → chunk-ER4UOIUS.js} +3 -3
  44. package/dist/{chunk-LVZ5NGME.js.map → chunk-ER4UOIUS.js.map} +1 -1
  45. package/dist/{chunk-G2CXWUO5.js → chunk-FAI2SMFE.js} +4 -4
  46. package/dist/{chunk-G2CXWUO5.js.map → chunk-FAI2SMFE.js.map} +1 -1
  47. package/dist/{chunk-5Q7HA4JP.js → chunk-FTG7CRFD.js} +3 -3
  48. package/dist/{chunk-5Q7HA4JP.js.map → chunk-FTG7CRFD.js.map} +1 -1
  49. package/dist/{chunk-TMAGWRKY.js → chunk-GWQZ2ECO.js} +6 -6
  50. package/dist/{chunk-TMAGWRKY.js.map → chunk-GWQZ2ECO.js.map} +1 -1
  51. package/dist/{chunk-5WMFU575.js → chunk-IVWJHELM.js} +116 -29
  52. package/dist/chunk-IVWJHELM.js.map +1 -0
  53. package/dist/{chunk-DTSKPMP3.js → chunk-JNCORFRK.js} +3 -3
  54. package/dist/{chunk-DTSKPMP3.js.map → chunk-JNCORFRK.js.map} +1 -1
  55. package/dist/{chunk-DWO2N72K.js → chunk-KLDWNSDN.js} +4 -4
  56. package/dist/{chunk-DWO2N72K.js.map → chunk-KLDWNSDN.js.map} +1 -1
  57. package/dist/{chunk-FI4QNNMD.js → chunk-MFWIWPJP.js} +8 -8
  58. package/dist/{chunk-FI4QNNMD.js.map → chunk-MFWIWPJP.js.map} +1 -1
  59. package/dist/{chunk-VQ4P7UYE.js → chunk-MKZOK4JU.js} +3 -3
  60. package/dist/{chunk-VQ4P7UYE.js.map → chunk-MKZOK4JU.js.map} +1 -1
  61. package/dist/{chunk-Z5ED4E57.js → chunk-NIUG3MIH.js} +3 -3
  62. package/dist/{chunk-Z5ED4E57.js.map → chunk-NIUG3MIH.js.map} +1 -1
  63. package/dist/{chunk-4OQ2HQCQ.js → chunk-OGTS7QJX.js} +4 -4
  64. package/dist/{chunk-4OQ2HQCQ.js.map → chunk-OGTS7QJX.js.map} +1 -1
  65. package/dist/{chunk-SH572OBN.js → chunk-OIDFK7SG.js} +4 -4
  66. package/dist/{chunk-SH572OBN.js.map → chunk-OIDFK7SG.js.map} +1 -1
  67. package/dist/{chunk-IP3GXHOB.js → chunk-OZ7UNMTK.js} +3 -3
  68. package/dist/{chunk-IP3GXHOB.js.map → chunk-OZ7UNMTK.js.map} +1 -1
  69. package/dist/{chunk-6YDXCJGK.js → chunk-PMYZRX6M.js} +3 -3
  70. package/dist/{chunk-6YDXCJGK.js.map → chunk-PMYZRX6M.js.map} +1 -1
  71. package/dist/{chunk-X5EYJEEQ.js → chunk-S4UA244H.js} +4 -4
  72. package/dist/{chunk-X5EYJEEQ.js.map → chunk-S4UA244H.js.map} +1 -1
  73. package/dist/{chunk-WE7ONZNB.js → chunk-SUPIVTLX.js} +3 -3
  74. package/dist/{chunk-WE7ONZNB.js.map → chunk-SUPIVTLX.js.map} +1 -1
  75. package/dist/{chunk-VFPFW67T.js → chunk-SZ7VJQK3.js} +10 -10
  76. package/dist/{chunk-VFPFW67T.js.map → chunk-SZ7VJQK3.js.map} +1 -1
  77. package/dist/{chunk-3A5IKBHQ.js → chunk-W4IPN3DD.js} +61 -8
  78. package/dist/chunk-W4IPN3DD.js.map +1 -0
  79. package/dist/{chunk-LAOS2TZU.js → chunk-X2665LP2.js} +8 -8
  80. package/dist/{chunk-LAOS2TZU.js.map → chunk-X2665LP2.js.map} +1 -1
  81. package/dist/{chunk-M5D2QNTY.js → chunk-ZNCZ7RUO.js} +3 -3
  82. package/dist/{chunk-M5D2QNTY.js.map → chunk-ZNCZ7RUO.js.map} +1 -1
  83. package/dist/cli/index.js +56 -52
  84. package/dist/cli/index.js.map +1 -1
  85. package/dist/cli/src/commands/serve.d.ts.map +1 -1
  86. package/dist/connectors/config.js +7 -7
  87. package/dist/connectors/index.js +12 -12
  88. package/dist/core/index.js +6 -6
  89. package/dist/core/logging.js +2 -2
  90. package/dist/core/manifest.js +2 -2
  91. package/dist/core/runtime-assets.js +4 -4
  92. package/dist/core/src/logging/index.d.ts +2 -0
  93. package/dist/core/src/logging/index.d.ts.map +1 -1
  94. package/dist/core/src/logging/log-store.d.ts.map +1 -1
  95. package/dist/core/src/logging/sinks/stdout-sink.d.ts +6 -1
  96. package/dist/core/src/logging/sinks/stdout-sink.d.ts.map +1 -1
  97. package/dist/core/src/logging/stream-health.d.ts +46 -0
  98. package/dist/core/src/logging/stream-health.d.ts.map +1 -0
  99. package/dist/core/workspace-config.js +3 -3
  100. package/dist/deploy/index.js +8 -7
  101. package/dist/deploy/index.js.map +1 -1
  102. package/dist/deploy/src/targets/process-handle.d.ts.map +1 -1
  103. package/dist/discovery/index.js +3 -3
  104. package/dist/{ensure-sources-SFQT5GXY.js → ensure-sources-VJZUHSFZ.js} +13 -13
  105. package/dist/{ensure-sources-SFQT5GXY.js.map → ensure-sources-VJZUHSFZ.js.map} +1 -1
  106. package/dist/factory-assets/connectors/box.js +12 -12
  107. package/dist/factory-assets/connectors/deploy.js +12 -12
  108. package/dist/factory-assets/connectors/devserver.js +12 -12
  109. package/dist/factory-assets/connectors/flow/adapter.js +12 -12
  110. package/dist/factory-assets/connectors/flow/engine.js +7 -7
  111. package/dist/factory-assets/connectors/flow/run-flow.js +14 -14
  112. package/dist/factory-assets/connectors/flow.js +12 -12
  113. package/dist/factory-assets/connectors/git.js +12 -12
  114. package/dist/factory-assets/connectors/gmail.js +12 -12
  115. package/dist/factory-assets/connectors/googledrive.js +12 -12
  116. package/dist/factory-assets/connectors/local.js +12 -12
  117. package/dist/factory-assets/connectors/mattermost.js +12 -12
  118. package/dist/factory-assets/connectors/memory.js +12 -12
  119. package/dist/factory-assets/connectors/minio.js +12 -12
  120. package/dist/factory-assets/connectors/postgres.js +12 -12
  121. package/dist/factory-assets/connectors/s3.js +12 -12
  122. package/dist/factory-assets/connectors/sharepoint.js +12 -12
  123. package/dist/factory-assets/connectors/sqlite.js +12 -12
  124. package/dist/factory-assets/connectors/static-server.js +12 -12
  125. package/dist/factory-assets/connectors/tunnel.js +12 -12
  126. package/dist/factory-assets/connectors/webdav.js +12 -12
  127. package/dist/factory-assets/connectors/xstate-store.js +12 -12
  128. package/dist/factory-assets/connectors/xstate.js +12 -12
  129. package/dist/flows-2SUFOVVO.js +20 -0
  130. package/dist/{flows-Z3DM5BHF.js.map → flows-2SUFOVVO.js.map} +1 -1
  131. package/dist/{helpers-VRQXNHFR.js → helpers-EEYMGGLO.js} +13 -13
  132. package/dist/{helpers-VRQXNHFR.js.map → helpers-EEYMGGLO.js.map} +1 -1
  133. package/dist/library/index.js +8 -8
  134. package/dist/library/install.js +6 -6
  135. package/dist/{library-publish-DV3B2ITY.js → library-publish-37UBVMC3.js} +17 -17
  136. package/dist/{library-publish-DV3B2ITY.js.map → library-publish-37UBVMC3.js.map} +1 -1
  137. package/dist/{open-library-2BXBAC6Q.js → open-library-JYVUN4CY.js} +15 -15
  138. package/dist/{open-library-2BXBAC6Q.js.map → open-library-JYVUN4CY.js.map} +1 -1
  139. package/dist/paths-4APA2PKT.js +16 -0
  140. package/dist/{paths-AI7MDPNA.js.map → paths-4APA2PKT.js.map} +1 -1
  141. package/dist/{plugin-store-OO5EZBYP.js → plugin-store-JQAIKR3R.js} +8 -8
  142. package/dist/{plugin-store-OO5EZBYP.js.map → plugin-store-JQAIKR3R.js.map} +1 -1
  143. package/dist/{project-2TYDMEZB.js → project-DKQACM3N.js} +14 -14
  144. package/dist/{project-2TYDMEZB.js.map → project-DKQACM3N.js.map} +1 -1
  145. package/dist/resolver/index.js +7 -7
  146. package/dist/runner/index.js +17 -17
  147. package/dist/runner/src/process-safety-net.d.ts +61 -0
  148. package/dist/runner/src/process-safety-net.d.ts.map +1 -0
  149. package/dist/runner/src/serve.d.ts +10 -0
  150. package/dist/runner/src/serve.d.ts.map +1 -1
  151. package/dist/sdk/asset-manager.js +10 -10
  152. package/dist/sdk/bridge.js +9 -9
  153. package/dist/sdk/core.js +6 -6
  154. package/dist/sdk/flow.js +7 -7
  155. package/dist/sdk/index.js +17 -17
  156. package/dist/sdk/resolver.js +7 -7
  157. package/dist/sdk/runner.js +17 -17
  158. package/dist/{setup-EH4TZFMN.js → setup-7FJNMKFA.js} +11 -11
  159. package/dist/{setup-EH4TZFMN.js.map → setup-7FJNMKFA.js.map} +1 -1
  160. package/dist/skills-Q7PJVB3W.js +20 -0
  161. package/dist/{skills-XZOG6ZPX.js.map → skills-Q7PJVB3W.js.map} +1 -1
  162. package/dist/{source-PVTUMNAO.js → source-CT6RH3CJ.js} +16 -16
  163. package/dist/{source-PVTUMNAO.js.map → source-CT6RH3CJ.js.map} +1 -1
  164. package/dist/{source-manifest-publish-3XYTUVQQ.js → source-manifest-publish-VBENANBT.js} +18 -18
  165. package/dist/{source-manifest-publish-3XYTUVQQ.js.map → source-manifest-publish-VBENANBT.js.map} +1 -1
  166. package/dist/tui/index.js +17 -17
  167. package/dist/workspace-plugin/adapters/mcp.js +11 -11
  168. package/dist/workspace-plugin/adapters/omp.js +7 -7
  169. package/dist/workspace-plugin/index.js +3 -3
  170. package/package.json +1 -1
  171. package/dist/chunk-3A5IKBHQ.js.map +0 -1
  172. package/dist/chunk-5WMFU575.js.map +0 -1
  173. package/dist/flows-Z3DM5BHF.js +0 -20
  174. package/dist/paths-AI7MDPNA.js +0 -16
  175. package/dist/skills-XZOG6ZPX.js +0 -20
@@ -1,26 +1,26 @@
1
- import { WorkspacePlugin } from './chunk-6YDXCJGK.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-LAOS2TZU.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-MTCLDJPR.js';
7
- import { loadConnectorDeclarations, SecretProviderChain, PreMintedSecretProvider, InMemorySecretProvider, resolvedConfigToDeclarations, isKnownSecretRef, deriveSingleMaterializedConnectorDeclaration } from './chunk-3UU3D2Q3.js';
8
- import { EventNormalizer } from './chunk-DTSKPMP3.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-Z5ED4E57.js';
12
- import { loadFlow } from './chunk-QZ6XXD3A.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-F2WTSHZS.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-5WMFU575.js.map
7343
- //# sourceMappingURL=chunk-5WMFU575.js.map
7429
+ //# sourceMappingURL=chunk-IVWJHELM.js.map
7430
+ //# sourceMappingURL=chunk-IVWJHELM.js.map