deepline 0.3.524 → 0.3.526

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/dist/bundling-sources/sdk/src/agent-runtime.ts +98 -0
  2. package/dist/bundling-sources/sdk/src/client-core.ts +8 -0
  3. package/dist/bundling-sources/sdk/src/http-core.ts +14 -0
  4. package/dist/bundling-sources/sdk/src/plays/play-description.ts +1 -0
  5. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  6. package/dist/bundling-sources/sdk/src/types.ts +10 -0
  7. package/dist/bundling-sources/shared_libs/observability/dlq.ts +33 -5
  8. package/dist/bundling-sources/shared_libs/observability/queue-health.ts +9 -0
  9. package/dist/bundling-sources/shared_libs/observability/queue-item-connectors.ts +1 -0
  10. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +38 -0
  11. package/dist/bundling-sources/shared_libs/play-runtime/freshness-receipt-execution.ts +94 -9
  12. package/dist/bundling-sources/shared_libs/play-runtime/run-failure-class.ts +98 -0
  13. package/dist/bundling-sources/shared_libs/play-runtime/run-retry-summary.ts +202 -0
  14. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/modal.ts +60 -8
  15. package/dist/bundling-sources/shared_libs/play-runtime/runtime-telemetry.ts +112 -0
  16. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +39 -1
  17. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/durable-run-inventory.ts +2 -2
  18. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/durable-run-sql.ts +52 -5
  19. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/play-run-recovery.ts +10 -1
  20. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/run-retry-facts.ts +62 -0
  21. package/dist/cli/{auth-QXJMVLPN.mjs → auth-JATW5XZE.mjs} +5 -5
  22. package/dist/cli/auth-L2POG3LL.js +43 -0
  23. package/dist/cli/{billing-N5R4HTHT.js → billing-TSHBJIJS.js} +83 -83
  24. package/dist/cli/{billing-SNSIFM4B.mjs → billing-UT5LIESH.mjs} +8 -8
  25. package/dist/cli/{chunk-PFKWKWUJ.mjs → chunk-26ULNPQ7.mjs} +2 -2
  26. package/dist/cli/{chunk-OQ5G7RFQ.mjs → chunk-2GJW4RAQ.mjs} +70 -3
  27. package/dist/cli/{chunk-HLAFGQPV.mjs → chunk-2JNX3MDG.mjs} +5 -2
  28. package/dist/cli/{chunk-V7KUBDEB.js → chunk-3MYI3IXW.js} +144 -141
  29. package/dist/cli/{chunk-WOEPDSO3.js → chunk-3ZEV5BS5.js} +26 -26
  30. package/dist/cli/{chunk-ATATJNJ6.js → chunk-46HEYGLY.js} +9 -9
  31. package/dist/cli/{chunk-I75VRGQG.js → chunk-477PXM65.js} +22 -22
  32. package/dist/cli/{chunk-RVHUW4TN.js → chunk-5YAJGRWB.js} +17 -17
  33. package/dist/cli/{chunk-T43FF5PF.mjs → chunk-6COGHW7B.mjs} +2 -2
  34. package/dist/cli/{chunk-V4RJ57MA.js → chunk-6DHEV6IA.js} +2 -2
  35. package/dist/cli/{chunk-VHTVXS5A.js → chunk-6H56LKJB.js} +16 -16
  36. package/dist/cli/{chunk-YKFW3NNA.mjs → chunk-6JMWATX5.mjs} +5 -5
  37. package/dist/cli/{chunk-II3BJKCH.mjs → chunk-77RAGJIZ.mjs} +2 -2
  38. package/dist/cli/{chunk-ITJ7NB2D.mjs → chunk-7AOFSZJM.mjs} +3 -1
  39. package/dist/cli/{chunk-OCT4SUJA.js → chunk-7COEN3IR.js} +146 -79
  40. package/dist/cli/{chunk-XURWFEXM.mjs → chunk-7FCD34YS.mjs} +31 -17
  41. package/dist/cli/{chunk-BXVYVIMB.js → chunk-B33J4YCC.js} +3 -3
  42. package/dist/cli/{chunk-RTDX5NNN.mjs → chunk-BFH3DJYV.mjs} +84 -57
  43. package/dist/cli/{chunk-GJYLC4JB.mjs → chunk-BNH4Y35W.mjs} +2 -2
  44. package/dist/cli/{chunk-GMO3JDZA.mjs → chunk-BVITYMBK.mjs} +2 -2
  45. package/dist/cli/{chunk-7QM6DNR4.js → chunk-BYEF4RBX.js} +11 -11
  46. package/dist/cli/{chunk-536TGWR6.mjs → chunk-C3EW6I65.mjs} +2 -2
  47. package/dist/cli/{chunk-HTYT2OHB.js → chunk-CDP3LMDT.js} +6 -6
  48. package/dist/cli/{chunk-YXVYPYIP.js → chunk-CYN2AHR6.js} +10 -10
  49. package/dist/cli/{chunk-CH7JVSA7.mjs → chunk-D2XMFXFM.mjs} +8 -8
  50. package/dist/cli/{chunk-2ZWNIS54.js → chunk-D5OEUPPM.js} +269 -269
  51. package/dist/cli/{chunk-FXTV5B3D.mjs → chunk-DY2AT3JQ.mjs} +12 -12
  52. package/dist/cli/{chunk-Z4MOEQSY.js → chunk-ED2N4NRI.js} +21 -21
  53. package/dist/cli/{chunk-RIX26ZJD.mjs → chunk-EEYZLTXX.mjs} +1 -1
  54. package/dist/cli/{chunk-7E6B7VMS.js → chunk-F5KFGF45.js} +5 -5
  55. package/dist/cli/{chunk-TZTWH53O.js → chunk-FMPGWAIR.js} +1 -1
  56. package/dist/cli/{chunk-R2VZVHJP.mjs → chunk-GESIFFQX.mjs} +1 -1
  57. package/dist/cli/{chunk-YCIXY66B.mjs → chunk-HPACLONQ.mjs} +2 -2
  58. package/dist/cli/{chunk-WCVIPZWX.mjs → chunk-IMP7WR22.mjs} +5 -5
  59. package/dist/cli/{chunk-KSQXBLRW.mjs → chunk-IWLDJQGV.mjs} +3 -3
  60. package/dist/cli/{chunk-EQNAQENZ.js → chunk-J5OXJ4JI.js} +2 -2
  61. package/dist/cli/{chunk-NUC7ZVDG.mjs → chunk-MQB25LMV.mjs} +5 -5
  62. package/dist/cli/{chunk-RUULUCBP.js → chunk-O7WUATQC.js} +97 -70
  63. package/dist/cli/{chunk-NMU3VR5U.js → chunk-PMH4GLMD.js} +1 -0
  64. package/dist/cli/{chunk-S3A4IXBQ.mjs → chunk-PSX3WHIH.mjs} +1 -0
  65. package/dist/cli/{chunk-LRWDZDBS.js → chunk-RZJWHL7L.js} +5 -5
  66. package/dist/cli/{chunk-66N76YZG.js → chunk-SCLRGDF4.js} +44 -44
  67. package/dist/cli/{chunk-SMWFOGUT.js → chunk-SJ6KUCGM.js} +53 -53
  68. package/dist/cli/{chunk-PFKKZVFK.js → chunk-TBQC2XS3.js} +41 -41
  69. package/dist/cli/{chunk-2ZX7XSAQ.mjs → chunk-TCLJXJAG.mjs} +4 -4
  70. package/dist/cli/{chunk-YGOI5ZE5.mjs → chunk-TVHDWS5U.mjs} +1 -1
  71. package/dist/cli/{chunk-MW3YMPD2.mjs → chunk-TXJW6RIM.mjs} +1 -1
  72. package/dist/cli/{chunk-KKPBCB6D.mjs → chunk-U6OUX47C.mjs} +2 -2
  73. package/dist/cli/{chunk-GTGJBZVH.js → chunk-UTCGCES2.js} +7 -7
  74. package/dist/cli/{chunk-V2YIBBVT.mjs → chunk-UUIC2JFZ.mjs} +1 -1
  75. package/dist/cli/{chunk-JDIQBZ6O.js → chunk-UWCEBS7F.js} +14 -14
  76. package/dist/cli/{chunk-ANKD3AIR.js → chunk-WBY3R55B.js} +2 -2
  77. package/dist/cli/{chunk-SF4QJVBE.js → chunk-WITNIMLE.js} +3 -3
  78. package/dist/cli/{chunk-7OQGZBDG.js → chunk-WL6GAZBD.js} +31 -17
  79. package/dist/cli/{chunk-R457IMHJ.mjs → chunk-WOLY6SU4.mjs} +1 -1
  80. package/dist/cli/{chunk-3WWTBQHC.mjs → chunk-XVIMOB2U.mjs} +2 -2
  81. package/dist/cli/{chunk-NTLBZUHD.js → chunk-XYIECA7M.js} +4 -2
  82. package/dist/cli/{chunk-BXIQD2IY.mjs → chunk-Y47OCS5V.mjs} +1 -1
  83. package/dist/cli/{chunk-EO55Y4QW.mjs → chunk-YNFPZVII.mjs} +5 -5
  84. package/dist/cli/{chunk-BN5VKY4X.js → chunk-ZS2WHWWL.js} +7 -7
  85. package/dist/cli/command-docs.js +2 -2
  86. package/dist/cli/command-docs.mjs +1 -1
  87. package/dist/cli/{csv-HT2JBCW2.mjs → csv-4BLFRED6.mjs} +4 -4
  88. package/dist/cli/{csv-Q2LWKXAV.js → csv-KSJB5Z3M.js} +13 -13
  89. package/dist/cli/{db-XEV4WEE4.js → db-G7Z5CKO2.js} +28 -28
  90. package/dist/cli/{db-CS3XQ2LX.mjs → db-OVW6C3DV.mjs} +7 -7
  91. package/dist/cli/describe-KMYR2JBC.js +50 -0
  92. package/dist/cli/describe-OEFTD7WQ.mjs +50 -0
  93. package/dist/cli/describe-core.d.mts +4 -2
  94. package/dist/cli/describe-core.d.ts +4 -2
  95. package/dist/cli/describe-core.js +5 -5
  96. package/dist/cli/describe-core.mjs +4 -4
  97. package/dist/cli/{executions-L6XFG5MP.mjs → executions-7ZKQ4ZU3.mjs} +7 -7
  98. package/dist/cli/{executions-JCC34WAD.js → executions-O7USCBCW.js} +9 -9
  99. package/dist/cli/{feedback-AWBDO5I6.mjs → feedback-KUBL5E3I.mjs} +61 -13
  100. package/dist/cli/{feedback-HV2M2G7N.js → feedback-Y55WCRIQ.js} +65 -17
  101. package/dist/cli/{git-S4LRXTRX.mjs → git-C6ZAU5JA.mjs} +5 -5
  102. package/dist/cli/git-NBVQ3VGW.js +25 -0
  103. package/dist/cli/index.js +145 -145
  104. package/dist/cli/index.mjs +44 -44
  105. package/dist/cli/{legacy-noops-7MOKBL4O.mjs → legacy-noops-MUXD4HRC.mjs} +6 -6
  106. package/dist/cli/{legacy-noops-RGSZUD6V.js → legacy-noops-OVWX4KB3.js} +9 -9
  107. package/dist/cli/{monitors-XQNXDZPQ.mjs → monitors-2ZSGBY52.mjs} +8 -8
  108. package/dist/cli/{monitors-JEFM2C5W.js → monitors-3QVYGYWA.js} +101 -101
  109. package/dist/cli/{org-KTMJZGTN.mjs → org-RDSPE5FB.mjs} +7 -7
  110. package/dist/cli/{org-GYLA5V32.js → org-S6Z3SDLI.js} +87 -87
  111. package/dist/cli/{pages-WOMU2T2O.mjs → pages-K5DSMHLJ.mjs} +7 -7
  112. package/dist/cli/{pages-RY4U7OCL.js → pages-VUWF2OR7.js} +19 -19
  113. package/dist/cli/{play-KOYGGNYS.mjs → play-PZLXOYEX.mjs} +151 -102
  114. package/dist/cli/{play-2Q6MWJ3D.js → play-SQOJTUFC.js} +756 -707
  115. package/dist/cli/{providers-7YKDITJC.mjs → providers-AMIGP3D4.mjs} +7 -7
  116. package/dist/cli/{providers-HOIRHMN2.js → providers-FZBEPUOI.js} +10 -10
  117. package/dist/cli/{quickstart-RDXHSMVX.mjs → quickstart-HNOQKGOF.mjs} +4 -4
  118. package/dist/cli/{quickstart-OWCJOSQA.js → quickstart-QIHZDBGM.js} +6 -6
  119. package/dist/cli/{run-MT2ABKO5.js → run-IQGM3TO2.js} +46 -46
  120. package/dist/cli/{run-RT73NDP5.mjs → run-JDW6BDNT.mjs} +27 -27
  121. package/dist/cli/search-BNWRL3YY.js +33 -0
  122. package/dist/cli/{search-CJPKIGSA.mjs → search-DMVUKJ23.mjs} +9 -9
  123. package/dist/cli/{search-output-AREMA544.mjs → search-output-5UAPUUHH.mjs} +4 -4
  124. package/dist/cli/{search-output-OSBZ7WK6.js → search-output-UUW6UNHF.js} +6 -6
  125. package/dist/cli/{secrets-BTIY2FEJ.mjs → secrets-46KSTPFN.mjs} +7 -7
  126. package/dist/cli/{secrets-OV6KH633.js → secrets-U532KN24.js} +16 -16
  127. package/dist/cli/sessions-JZUONXH4.js +22 -0
  128. package/dist/cli/sessions-RUNWYHYX.mjs +22 -0
  129. package/dist/cli/{settings-7BQIC7QN.mjs → settings-56L3WHCY.mjs} +14 -14
  130. package/dist/cli/{settings-LBIECYDB.js → settings-O2A37FFA.js} +87 -87
  131. package/dist/cli/{setup-QZE7QR3F.js → setup-ETFSMSCH.js} +50 -50
  132. package/dist/cli/{setup-XPTSNNES.mjs → setup-Q27X6JZY.mjs} +10 -10
  133. package/dist/cli/skills-IKDJ5JDN.js +37 -0
  134. package/dist/cli/{skills-TGGKIQLT.mjs → skills-WFQRZL4D.mjs} +8 -8
  135. package/dist/cli/tools-B735AA67.js +57 -0
  136. package/dist/cli/{tools-MKIFX2TQ.mjs → tools-EV6CKJOX.mjs} +20 -20
  137. package/dist/cli/update-CNNURAM3.js +35 -0
  138. package/dist/cli/{update-5R3D3WNH.mjs → update-KIPPFVCH.mjs} +10 -10
  139. package/dist/cli/{views-VPWEINIA.js → views-DNZ2HFTA.js} +19 -19
  140. package/dist/cli/{views-VHKDHHUP.mjs → views-LMJXWD4N.mjs} +7 -7
  141. package/dist/cli/{workflow-D5DF65N6.mjs → workflow-3XKUQ73U.mjs} +8 -8
  142. package/dist/cli/{workflow-7K2VEQ4V.js → workflow-ZUDTIOK6.js} +18 -18
  143. package/dist/{client-C5_6W8yd.d.mts → client-Bd2meveV.d.mts} +1 -1
  144. package/dist/{client-iXW4TOat.d.ts → client-CBCVhL8U.d.ts} +1 -1
  145. package/dist/{client-core-Dob428Z4.d.mts → client-core-CGj8V9mw.d.mts} +67 -0
  146. package/dist/{client-core-B-GPfmaC.d.ts → client-core-CsRRWCFy.d.ts} +67 -0
  147. package/dist/index.d.mts +3 -3
  148. package/dist/index.d.ts +3 -3
  149. package/dist/index.js +10 -10
  150. package/dist/index.mjs +7 -7
  151. package/dist/install-integrity.json +121 -118
  152. package/dist/plays/play-description.d.mts +1 -1
  153. package/dist/plays/play-description.d.ts +1 -1
  154. package/dist/plays/play-description.js +2 -2
  155. package/dist/plays/play-description.mjs +1 -1
  156. package/dist/plays/run-request.d.mts +1 -1
  157. package/dist/plays/run-request.d.ts +1 -1
  158. package/dist/release.d.mts +1 -1
  159. package/dist/release.d.ts +1 -1
  160. package/dist/release.js +2 -2
  161. package/dist/release.mjs +1 -1
  162. package/dist/server.d.mts +2 -2
  163. package/dist/server.d.ts +2 -2
  164. package/dist/server.js +6 -6
  165. package/dist/server.mjs +4 -4
  166. package/package.json +1 -1
  167. package/dist/cli/auth-OKPHHMMP.js +0 -43
  168. package/dist/cli/describe-5G5NXO5E.js +0 -50
  169. package/dist/cli/describe-OUTXLDGZ.mjs +0 -50
  170. package/dist/cli/git-GDPTG52F.js +0 -25
  171. package/dist/cli/search-7VBA6IGS.js +0 -33
  172. package/dist/cli/sessions-3CO3ZFOD.mjs +0 -18
  173. package/dist/cli/sessions-B3WNEWRW.js +0 -18
  174. package/dist/cli/skills-TXBRTWEV.js +0 -37
  175. package/dist/cli/tools-RZJV4X3J.js +0 -57
  176. package/dist/cli/update-YWGGPWUA.js +0 -35
@@ -17,15 +17,17 @@ var _chunkXNYIZMNQjs = require('./chunk-XNYIZMNQ.js');
17
17
  var _chunkSQWET4SLjs = require('./chunk-SQWET4SL.js');
18
18
 
19
19
 
20
- var _chunkTZTWH53Ojs = require('./chunk-TZTWH53O.js');
20
+ var _chunkFMPGWAIRjs = require('./chunk-FMPGWAIR.js');
21
21
 
22
22
  // src/version.ts
23
- var SDK_VERSION = _chunkTZTWH53Ojs.SDK_RELEASE.version;
24
- var SDK_API_MAJOR = _chunkTZTWH53Ojs.SDK_RELEASE.contracts.api.currentMajor;
25
- var SDK_API_CONTRACT = _nullishCoalesce(_chunkTZTWH53Ojs.SDK_RELEASE.contracts.api.legacyWireIds[0], () => ( `api-v${SDK_API_MAJOR}`));
23
+ var SDK_VERSION = _chunkFMPGWAIRjs.SDK_RELEASE.version;
24
+ var SDK_API_MAJOR = _chunkFMPGWAIRjs.SDK_RELEASE.contracts.api.currentMajor;
25
+ var SDK_API_CONTRACT = _nullishCoalesce(_chunkFMPGWAIRjs.SDK_RELEASE.contracts.api.legacyWireIds[0], () => ( `api-v${SDK_API_MAJOR}`));
26
26
 
27
27
  // src/agent-runtime.ts
28
+ var _fs = require('fs');
28
29
  var _os = require('os');
30
+ var _path = require('path');
29
31
  var EXPLICIT_AGENT_RUNTIMES = /* @__PURE__ */ new Set([
30
32
  "claude_code",
31
33
  "claude_cowork",
@@ -65,12 +67,67 @@ function agentSessionIdFromEnvironment(env = process.env, agentRuntime) {
65
67
  }
66
68
  return null;
67
69
  }
70
+ var SESSION_UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
71
+ function isAgentSessionId(value) {
72
+ return SESSION_UUID_RE.test(value);
73
+ }
74
+ function coworkSessionHome(env = process.env, cwd = process.cwd()) {
75
+ const home = _optionalChain([env, 'access', _16 => _16.HOME, 'optionalAccess', _17 => _17.trim, 'call', _18 => _18()]) || _os.homedir.call(void 0, );
76
+ const path = home === "/sessions" ? cwd : home;
77
+ return _nullishCoalesce(_optionalChain([path, 'access', _19 => _19.match, 'call', _20 => _20(/^\/sessions\/(?!\.\.?(?:\/|$))[^/]+/), 'optionalAccess', _21 => _21[0]]), () => ( null));
78
+ }
79
+ function claudeProjectsRoots(env = process.env, cwd = process.cwd()) {
80
+ const roots = [];
81
+ const configDir = _optionalChain([env, 'access', _22 => _22.CLAUDE_CONFIG_DIR, 'optionalAccess', _23 => _23.trim, 'call', _24 => _24()]);
82
+ if (configDir) roots.push(_path.join.call(void 0, configDir, "projects"));
83
+ const coworkHome = coworkSessionHome(env, cwd);
84
+ if (coworkHome) roots.push(coworkProjectsRoot(coworkHome));
85
+ roots.push(_path.join.call(void 0, _optionalChain([env, 'access', _25 => _25.HOME, 'optionalAccess', _26 => _26.trim, 'call', _27 => _27()]) || _os.homedir.call(void 0, ), ".claude", "projects"));
86
+ return [...new Set(roots)];
87
+ }
88
+ function coworkProjectsRoot(coworkHome) {
89
+ return _path.join.call(void 0, coworkHome, "mnt", ".claude", "projects");
90
+ }
91
+ function coworkTranscriptFromEnvironment(env = process.env, cwd = process.cwd()) {
92
+ const coworkHome = coworkSessionHome(env, cwd);
93
+ if (!coworkHome) return null;
94
+ const root = coworkProjectsRoot(coworkHome);
95
+ let newest = null;
96
+ for (const project of readDirectoryNames(root)) {
97
+ for (const fileName of readDirectoryNames(_path.join.call(void 0, root, project))) {
98
+ const sessionId = _path.basename.call(void 0, fileName, ".jsonl");
99
+ if (!fileName.endsWith(".jsonl") || !SESSION_UUID_RE.test(sessionId)) {
100
+ continue;
101
+ }
102
+ const filePath = _path.join.call(void 0, root, project, fileName);
103
+ let mtimeMs;
104
+ try {
105
+ const stat = _fs.statSync.call(void 0, filePath);
106
+ if (!stat.isFile()) continue;
107
+ mtimeMs = stat.mtimeMs;
108
+ } catch (e) {
109
+ continue;
110
+ }
111
+ if (!newest || mtimeMs > newest.mtimeMs) {
112
+ newest = { sessionId, filePath, mtimeMs };
113
+ }
114
+ }
115
+ }
116
+ return newest ? { sessionId: newest.sessionId, filePath: newest.filePath } : null;
117
+ }
118
+ function readDirectoryNames(dir) {
119
+ try {
120
+ return _fs.readdirSync.call(void 0, dir);
121
+ } catch (e2) {
122
+ return [];
123
+ }
124
+ }
68
125
  function isCoworkLikeSandbox() {
69
126
  const pluginMode = truthyEnv("DEEPLINE_PLUGIN_MODE");
70
127
  const claudeRemote = truthyEnv("CLAUDE_CODE_REMOTE");
71
- const projectDir = Boolean(_optionalChain([process, 'access', _16 => _16.env, 'access', _17 => _17.CLAUDE_PROJECT_DIR, 'optionalAccess', _18 => _18.trim, 'call', _19 => _19()]));
72
- const pluginRoot = Boolean(_optionalChain([process, 'access', _20 => _20.env, 'access', _21 => _21.DEEPLINE_PLUGIN_ROOT, 'optionalAccess', _22 => _22.trim, 'call', _23 => _23()]));
73
- const home = _optionalChain([process, 'access', _24 => _24.env, 'access', _25 => _25.HOME, 'optionalAccess', _26 => _26.trim, 'call', _27 => _27()]) || _os.homedir.call(void 0, );
128
+ const projectDir = Boolean(_optionalChain([process, 'access', _28 => _28.env, 'access', _29 => _29.CLAUDE_PROJECT_DIR, 'optionalAccess', _30 => _30.trim, 'call', _31 => _31()]));
129
+ const pluginRoot = Boolean(_optionalChain([process, 'access', _32 => _32.env, 'access', _33 => _33.DEEPLINE_PLUGIN_ROOT, 'optionalAccess', _34 => _34.trim, 'call', _35 => _35()]));
130
+ const home = _optionalChain([process, 'access', _36 => _36.env, 'access', _37 => _37.HOME, 'optionalAccess', _38 => _38.trim, 'call', _39 => _39()]) || _os.homedir.call(void 0, );
74
131
  const sessionHome = home === "/sessions" || home.startsWith("/sessions/");
75
132
  return claudeRemote || sessionHome || (pluginMode || pluginRoot) && projectDir;
76
133
  }
@@ -78,22 +135,22 @@ function detectAgentRuntime(options = {}) {
78
135
  const env = _nullishCoalesce(options.env, () => ( process.env));
79
136
  const explicit = normalizeAgentRuntime(env.DEEPLINE_AGENT_RUNTIME);
80
137
  if (explicit) return explicit;
81
- if (_optionalChain([env, 'access', _28 => _28.CODEX_THREAD_ID, 'optionalAccess', _29 => _29.trim, 'call', _30 => _30()])) return "codex";
138
+ if (_optionalChain([env, 'access', _40 => _40.CODEX_THREAD_ID, 'optionalAccess', _41 => _41.trim, 'call', _42 => _42()])) return "codex";
82
139
  if (options.detectCowork !== false && isCoworkLikeSandbox()) {
83
140
  return "claude_cowork";
84
141
  }
85
- if (_optionalChain([env, 'access', _31 => _31.CLAUDECODE, 'optionalAccess', _32 => _32.trim, 'call', _33 => _33()]) === "1") return "claude_code";
86
- if (_optionalChain([env, 'access', _34 => _34.CLINE_ACTIVE, 'optionalAccess', _35 => _35.trim, 'call', _36 => _36(), 'access', _37 => _37.toLowerCase, 'call', _38 => _38()]) === "true") return "cline";
87
- if (_optionalChain([env, 'access', _39 => _39.CURSOR_TRACE_ID, 'optionalAccess', _40 => _40.trim, 'call', _41 => _41()]) || _optionalChain([env, 'access', _42 => _42.CURSOR_AGENT, 'optionalAccess', _43 => _43.trim, 'call', _44 => _44()])) {
142
+ if (_optionalChain([env, 'access', _43 => _43.CLAUDECODE, 'optionalAccess', _44 => _44.trim, 'call', _45 => _45()]) === "1") return "claude_code";
143
+ if (_optionalChain([env, 'access', _46 => _46.CLINE_ACTIVE, 'optionalAccess', _47 => _47.trim, 'call', _48 => _48(), 'access', _49 => _49.toLowerCase, 'call', _50 => _50()]) === "true") return "cline";
144
+ if (_optionalChain([env, 'access', _51 => _51.CURSOR_TRACE_ID, 'optionalAccess', _52 => _52.trim, 'call', _53 => _53()]) || _optionalChain([env, 'access', _54 => _54.CURSOR_AGENT, 'optionalAccess', _55 => _55.trim, 'call', _56 => _56()])) {
88
145
  return "cursor";
89
146
  }
90
- if (_optionalChain([env, 'access', _45 => _45.WINDSURF, 'optionalAccess', _46 => _46.trim, 'call', _47 => _47()]) || _optionalChain([env, 'access', _48 => _48.CASCADE, 'optionalAccess', _49 => _49.trim, 'call', _50 => _50()])) {
147
+ if (_optionalChain([env, 'access', _57 => _57.WINDSURF, 'optionalAccess', _58 => _58.trim, 'call', _59 => _59()]) || _optionalChain([env, 'access', _60 => _60.CASCADE, 'optionalAccess', _61 => _61.trim, 'call', _62 => _62()])) {
91
148
  return "windsurf";
92
149
  }
93
- if (_optionalChain([env, 'access', _51 => _51.ANTIGRAVITY, 'optionalAccess', _52 => _52.trim, 'call', _53 => _53()]) || _optionalChain([env, 'access', _54 => _54.ANTIGRAVITY_CLI, 'optionalAccess', _55 => _55.trim, 'call', _56 => _56()]) || _optionalChain([env, 'access', _57 => _57.ANTIGRAVITY_AGENT, 'optionalAccess', _58 => _58.trim, 'call', _59 => _59()]) || _optionalChain([env, 'access', _60 => _60.ANTIGRAVITY_WORKSPACE, 'optionalAccess', _61 => _61.trim, 'call', _62 => _62()])) {
150
+ if (_optionalChain([env, 'access', _63 => _63.ANTIGRAVITY, 'optionalAccess', _64 => _64.trim, 'call', _65 => _65()]) || _optionalChain([env, 'access', _66 => _66.ANTIGRAVITY_CLI, 'optionalAccess', _67 => _67.trim, 'call', _68 => _68()]) || _optionalChain([env, 'access', _69 => _69.ANTIGRAVITY_AGENT, 'optionalAccess', _70 => _70.trim, 'call', _71 => _71()]) || _optionalChain([env, 'access', _72 => _72.ANTIGRAVITY_WORKSPACE, 'optionalAccess', _73 => _73.trim, 'call', _74 => _74()])) {
94
151
  return "antigravity";
95
152
  }
96
- if (_optionalChain([env, 'access', _63 => _63.GEMINI_CLI, 'optionalAccess', _64 => _64.trim, 'call', _65 => _65()]) || _optionalChain([env, 'access', _66 => _66.GEMINI_CLI_VERSION, 'optionalAccess', _67 => _67.trim, 'call', _68 => _68()]) || _optionalChain([env, 'access', _69 => _69.GEMINI_SANDBOX, 'optionalAccess', _70 => _70.trim, 'call', _71 => _71()]) || _optionalChain([env, 'access', _72 => _72.GEMINI_CONFIG_DIR, 'optionalAccess', _73 => _73.trim, 'call', _74 => _74()])) {
153
+ if (_optionalChain([env, 'access', _75 => _75.GEMINI_CLI, 'optionalAccess', _76 => _76.trim, 'call', _77 => _77()]) || _optionalChain([env, 'access', _78 => _78.GEMINI_CLI_VERSION, 'optionalAccess', _79 => _79.trim, 'call', _80 => _80()]) || _optionalChain([env, 'access', _81 => _81.GEMINI_SANDBOX, 'optionalAccess', _82 => _82.trim, 'call', _83 => _83()]) || _optionalChain([env, 'access', _84 => _84.GEMINI_CONFIG_DIR, 'optionalAccess', _85 => _85.trim, 'call', _86 => _86()])) {
97
154
  return "gemini";
98
155
  }
99
156
  return _nullishCoalesce(options.defaultRuntime, () => ( "unknown"));
@@ -108,7 +165,7 @@ var fetchWithDeploymentProtection = (input, init) => {
108
165
  const headers = new Headers(
109
166
  input instanceof Request ? input.headers : void 0
110
167
  );
111
- new Headers(_optionalChain([init, 'optionalAccess', _75 => _75.headers])).forEach((value, name) => headers.set(name, value));
168
+ new Headers(_optionalChain([init, 'optionalAccess', _87 => _87.headers])).forEach((value, name) => headers.set(name, value));
112
169
  for (const [name, value] of Object.entries(deploymentProtectionHeaders())) {
113
170
  headers.set(name, value);
114
171
  }
@@ -153,6 +210,11 @@ var COWORK_NETWORK_HINT = "Claude Cowork appears to be running Deepline in a net
153
210
  var REQUEST_TIMEOUT_MARKER = Symbol("deeplineRequestTimeout");
154
211
  var REQUEST_ABORT_MARKER = Symbol("deeplineRequestAbort");
155
212
  var MAX_AUTOMATIC_RETRY_WAIT_MS = 3e4;
213
+ function deploymentProtectionRedirect(headers) {
214
+ return Object.keys(headers).some(
215
+ (name) => name.toLowerCase() === "x-vercel-protection-bypass"
216
+ ) ? "manual" : void 0;
217
+ }
156
218
  function requestCancelledError(signal) {
157
219
  const error = withErrorCause(new Error("Request aborted"), signal.reason);
158
220
  error[REQUEST_ABORT_MARKER] = true;
@@ -197,7 +259,7 @@ function withErrorCause(error, cause) {
197
259
  }
198
260
  function mapNetworkError(baseUrl, error, targetLabel) {
199
261
  const tagged = error;
200
- const timeoutMs = _optionalChain([tagged, 'optionalAccess', _76 => _76[REQUEST_TIMEOUT_MARKER]]);
262
+ const timeoutMs = _optionalChain([tagged, 'optionalAccess', _88 => _88[REQUEST_TIMEOUT_MARKER]]);
201
263
  if (typeof timeoutMs === "number") {
202
264
  return {
203
265
  message: `Request to ${targetLabel} timed out after ${timeoutMs}ms while waiting for a response.`,
@@ -205,7 +267,7 @@ function mapNetworkError(baseUrl, error, targetLabel) {
205
267
  details: { timeoutMs, target: targetLabel }
206
268
  };
207
269
  }
208
- if (_optionalChain([tagged, 'optionalAccess', _77 => _77[REQUEST_ABORT_MARKER]])) {
270
+ if (_optionalChain([tagged, 'optionalAccess', _89 => _89[REQUEST_ABORT_MARKER]])) {
209
271
  return {
210
272
  message: `Request to ${targetLabel} was aborted before it completed.`,
211
273
  code: "NETWORK_ABORTED"
@@ -247,14 +309,14 @@ function isLoopbackHost(hostname) {
247
309
  return hostname === "localhost" || hostname === "[::1]" || hostname.startsWith("127.") || hostname.endsWith(".localhost");
248
310
  }
249
311
  function connectionFailureMessage(baseUrl, error) {
250
- if (!_optionalChain([error, 'optionalAccess', _78 => _78.message])) {
312
+ if (!_optionalChain([error, 'optionalAccess', _90 => _90.message])) {
251
313
  return `Unable to connect to ${baseUrl}. Is the computer able to access the url?`;
252
314
  }
253
315
  const causeCode = networkCauseCode(error);
254
316
  let hostname = "";
255
317
  try {
256
318
  hostname = new URL(baseUrl).hostname;
257
- } catch (e) {
319
+ } catch (e3) {
258
320
  }
259
321
  const blocked = hostname !== "" && !isLoopbackHost(hostname) && causeCode !== void 0 && (BLOCKED_EGRESS_CAUSE_CODES.has(causeCode) || causeCode === "ECONNREFUSED");
260
322
  const causeMessage = error.cause instanceof Error ? error.cause.message.slice(0, 200) : "";
@@ -280,7 +342,7 @@ function networkDiagnosticUrl(value) {
280
342
  const url = new URL(value);
281
343
  if (url.protocol !== "https:" && url.protocol !== "http:") return void 0;
282
344
  return `${url.origin}${url.pathname}`;
283
- } catch (e2) {
345
+ } catch (e4) {
284
346
  return void 0;
285
347
  }
286
348
  }
@@ -311,9 +373,9 @@ var HttpClient = class {
311
373
  if (explicit) return explicit;
312
374
  try {
313
375
  return this.cleanDiagnosticHeader(
314
- _optionalChain([this, 'access', _79 => _79.readLocalSkillsVersion, 'optionalCall', _80 => _80(this.config.baseUrl)])
376
+ _optionalChain([this, 'access', _91 => _91.readLocalSkillsVersion, 'optionalCall', _92 => _92(this.config.baseUrl)])
315
377
  );
316
- } catch (e3) {
378
+ } catch (e5) {
317
379
  return null;
318
380
  }
319
381
  }
@@ -349,15 +411,15 @@ var HttpClient = class {
349
411
  const coordinatorInternalToken = env.DEEPLINE_INTERNAL_TOKEN;
350
412
  const absurdReleaseOverride = env.DEEPLINE_ABSURD_RELEASE;
351
413
  const preferredReceiptGatewayMachineId = env.DEEPLINE_PREFERRED_RECEIPT_GATEWAY_MACHINE_ID;
352
- if (_optionalChain([coordinatorUrl, 'optionalAccess', _81 => _81.trim, 'call', _82 => _82()])) {
414
+ if (_optionalChain([coordinatorUrl, 'optionalAccess', _93 => _93.trim, 'call', _94 => _94()])) {
353
415
  headers[COORDINATOR_URL_OVERRIDE_HEADER] = coordinatorUrl.trim();
354
416
  }
355
417
  const workerCallbackUrl = env.DEEPLINE_WORKER_CALLBACK_URL;
356
- if (_optionalChain([workerCallbackUrl, 'optionalAccess', _83 => _83.trim, 'call', _84 => _84()])) {
418
+ if (_optionalChain([workerCallbackUrl, 'optionalAccess', _95 => _95.trim, 'call', _96 => _96()])) {
357
419
  headers[WORKER_CALLBACK_URL_OVERRIDE_HEADER] = workerCallbackUrl.trim();
358
420
  }
359
421
  const runtimeSchedulerSchema = env.DEEPLINE_RUNTIME_SCHEDULER_SCHEMA;
360
- if (_optionalChain([runtimeSchedulerSchema, 'optionalAccess', _85 => _85.trim, 'call', _86 => _86()])) {
422
+ if (_optionalChain([runtimeSchedulerSchema, 'optionalAccess', _97 => _97.trim, 'call', _98 => _98()])) {
361
423
  headers[RUNTIME_SCHEDULER_SCHEMA_OVERRIDE_HEADER] = runtimeSchedulerSchema.trim();
362
424
  }
363
425
  const syntheticRun = env.DEEPLINE_SYNTHETIC_RUN;
@@ -365,21 +427,21 @@ var HttpClient = class {
365
427
  headers[SYNTHETIC_RUN_HEADER] = "1";
366
428
  }
367
429
  const runtimeTestFault = env.DEEPLINE_TEST_RUNTIME_FAULT;
368
- if (_optionalChain([runtimeTestFault, 'optionalAccess', _87 => _87.trim, 'call', _88 => _88()])) {
430
+ if (_optionalChain([runtimeTestFault, 'optionalAccess', _99 => _99.trim, 'call', _100 => _100()])) {
369
431
  headers[PLAY_RUNTIME_TEST_FAULT_HEADER] = runtimeTestFault.trim();
370
432
  }
371
- const retainedReceivers = _optionalChain([env, 'access', _89 => _89.DEEPLINE_RUNTIME_RETAINED_PIPELINE_RECEIVERS, 'optionalAccess', _90 => _90.trim, 'call', _91 => _91()]);
372
- if (retainedReceivers && _optionalChain([coordinatorInternalToken, 'optionalAccess', _92 => _92.trim, 'call', _93 => _93()])) {
433
+ const retainedReceivers = _optionalChain([env, 'access', _101 => _101.DEEPLINE_RUNTIME_RETAINED_PIPELINE_RECEIVERS, 'optionalAccess', _102 => _102.trim, 'call', _103 => _103()]);
434
+ if (retainedReceivers && _optionalChain([coordinatorInternalToken, 'optionalAccess', _104 => _104.trim, 'call', _105 => _105()])) {
373
435
  headers[RETAINED_PIPELINE_RECEIVERS_HEADER] = retainedReceivers;
374
436
  headers[COORDINATOR_INTERNAL_TOKEN_HEADER] = coordinatorInternalToken.trim();
375
437
  }
376
- if (_optionalChain([absurdReleaseOverride, 'optionalAccess', _94 => _94.trim, 'call', _95 => _95()]) && _optionalChain([coordinatorInternalToken, 'optionalAccess', _96 => _96.trim, 'call', _97 => _97()])) {
438
+ if (_optionalChain([absurdReleaseOverride, 'optionalAccess', _106 => _106.trim, 'call', _107 => _107()]) && _optionalChain([coordinatorInternalToken, 'optionalAccess', _108 => _108.trim, 'call', _109 => _109()])) {
377
439
  headers[ABSURD_RELEASE_OVERRIDE_HEADER] = absurdReleaseOverride.trim();
378
440
  }
379
- if (_optionalChain([preferredReceiptGatewayMachineId, 'optionalAccess', _98 => _98.trim, 'call', _99 => _99()]) && _optionalChain([coordinatorInternalToken, 'optionalAccess', _100 => _100.trim, 'call', _101 => _101()])) {
441
+ if (_optionalChain([preferredReceiptGatewayMachineId, 'optionalAccess', _110 => _110.trim, 'call', _111 => _111()]) && _optionalChain([coordinatorInternalToken, 'optionalAccess', _112 => _112.trim, 'call', _113 => _113()])) {
380
442
  headers[PREFERRED_RECEIPT_GATEWAY_MACHINE_ID_HEADER] = preferredReceiptGatewayMachineId.trim();
381
443
  }
382
- if (_optionalChain([coordinatorInternalToken, 'optionalAccess', _102 => _102.trim, 'call', _103 => _103()]) && (_optionalChain([coordinatorUrl, 'optionalAccess', _104 => _104.trim, 'call', _105 => _105()]) || _optionalChain([workerCallbackUrl, 'optionalAccess', _106 => _106.trim, 'call', _107 => _107()]) || _optionalChain([runtimeTestFault, 'optionalAccess', _108 => _108.trim, 'call', _109 => _109()]) || _optionalChain([absurdReleaseOverride, 'optionalAccess', _110 => _110.trim, 'call', _111 => _111()]) || _optionalChain([preferredReceiptGatewayMachineId, 'optionalAccess', _112 => _112.trim, 'call', _113 => _113()]))) {
444
+ if (_optionalChain([coordinatorInternalToken, 'optionalAccess', _114 => _114.trim, 'call', _115 => _115()]) && (_optionalChain([coordinatorUrl, 'optionalAccess', _116 => _116.trim, 'call', _117 => _117()]) || _optionalChain([workerCallbackUrl, 'optionalAccess', _118 => _118.trim, 'call', _119 => _119()]) || _optionalChain([runtimeTestFault, 'optionalAccess', _120 => _120.trim, 'call', _121 => _121()]) || _optionalChain([absurdReleaseOverride, 'optionalAccess', _122 => _122.trim, 'call', _123 => _123()]) || _optionalChain([preferredReceiptGatewayMachineId, 'optionalAccess', _124 => _124.trim, 'call', _125 => _125()]))) {
383
445
  headers[COORDINATOR_INTERNAL_TOKEN_HEADER] = coordinatorInternalToken.trim();
384
446
  }
385
447
  return applyExplicitHeaders(
@@ -404,23 +466,23 @@ var HttpClient = class {
404
466
  async request(path, options) {
405
467
  const baseUrl = this.config.baseUrl;
406
468
  const url = `${baseUrl}${path}`;
407
- const method = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _114 => _114.method]), () => ( "GET"));
469
+ const method = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _126 => _126.method]), () => ( "GET"));
408
470
  const requestStartedAt = Date.now();
409
471
  let fetchAttempts = 0;
410
472
  let lastRequestUrl = url;
411
473
  let networkFailedAt;
412
474
  let networkPhase = "before_request";
413
- const headers = this.authHeaders(_optionalChain([options, 'optionalAccess', _115 => _115.headers]));
414
- if (_optionalChain([options, 'optionalAccess', _116 => _116.body]) !== void 0) {
475
+ const headers = this.authHeaders(_optionalChain([options, 'optionalAccess', _127 => _127.headers]));
476
+ if (_optionalChain([options, 'optionalAccess', _128 => _128.body]) !== void 0) {
415
477
  applyExplicitHeaders(headers, { "Content-Type": "application/json" });
416
478
  }
417
479
  let lastError = null;
418
- const candidateUrls = _optionalChain([options, 'optionalAccess', _117 => _117.exactUrlOnly]) ? [url] : buildCandidateUrls(url);
480
+ const candidateUrls = _optionalChain([options, 'optionalAccess', _129 => _129.exactUrlOnly]) ? [url] : buildCandidateUrls(url);
419
481
  let retryAfterDelayMs = null;
420
482
  let totalRetryWaitMs = 0;
421
- let maxRetries = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _118 => _118.maxRetries]), () => ( this.config.maxRetries));
483
+ let maxRetries = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _130 => _130.maxRetries]), () => ( this.config.maxRetries));
422
484
  requestAttempts: for (let attempt = 0; attempt <= maxRetries; attempt++) {
423
- if (_optionalChain([options, 'optionalAccess', _119 => _119.signal, 'optionalAccess', _120 => _120.aborted])) {
485
+ if (_optionalChain([options, 'optionalAccess', _131 => _131.signal, 'optionalAccess', _132 => _132.aborted])) {
424
486
  lastError = requestCancelledError(options.signal);
425
487
  networkFailedAt = Date.now();
426
488
  break;
@@ -435,7 +497,7 @@ var HttpClient = class {
435
497
  totalRetryWaitMs += delayMs;
436
498
  networkPhase = "retry_wait";
437
499
  try {
438
- await sleep(delayMs, _optionalChain([options, 'optionalAccess', _121 => _121.signal]));
500
+ await sleep(delayMs, _optionalChain([options, 'optionalAccess', _133 => _133.signal]));
439
501
  } catch (error) {
440
502
  lastError = error instanceof Error ? error : new Error(String(error));
441
503
  networkFailedAt = Date.now();
@@ -443,25 +505,25 @@ var HttpClient = class {
443
505
  }
444
506
  }
445
507
  for (const candidateUrl of candidateUrls) {
446
- if (_optionalChain([options, 'optionalAccess', _122 => _122.signal, 'optionalAccess', _123 => _123.aborted])) {
508
+ if (_optionalChain([options, 'optionalAccess', _134 => _134.signal, 'optionalAccess', _135 => _135.aborted])) {
447
509
  lastError = requestCancelledError(options.signal);
448
510
  networkFailedAt = Date.now();
449
511
  break requestAttempts;
450
512
  }
451
513
  const controller = new AbortController();
452
- const timeoutMs = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _124 => _124.timeout]), () => ( this.config.timeout));
514
+ const timeoutMs = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _136 => _136.timeout]), () => ( this.config.timeout));
453
515
  let requestTimedOut = false;
454
516
  const timeoutId = setTimeout(() => {
455
517
  requestTimedOut = true;
456
518
  controller.abort();
457
519
  }, timeoutMs);
458
520
  const abortRequest = () => controller.abort();
459
- _optionalChain([options, 'optionalAccess', _125 => _125.signal, 'optionalAccess', _126 => _126.addEventListener, 'call', _127 => _127("abort", abortRequest, {
521
+ _optionalChain([options, 'optionalAccess', _137 => _137.signal, 'optionalAccess', _138 => _138.addEventListener, 'call', _139 => _139("abort", abortRequest, {
460
522
  once: true
461
523
  })]);
462
524
  networkPhase = "before_request";
463
525
  try {
464
- const requestBody = _optionalChain([options, 'optionalAccess', _128 => _128.formData]) !== void 0 ? typeof options.formData === "function" ? options.formData() : options.formData : _optionalChain([options, 'optionalAccess', _129 => _129.body]) !== void 0 ? JSON.stringify(options.body) : void 0;
526
+ const requestBody = _optionalChain([options, 'optionalAccess', _140 => _140.formData]) !== void 0 ? typeof options.formData === "function" ? options.formData() : options.formData : _optionalChain([options, 'optionalAccess', _141 => _141.body]) !== void 0 ? JSON.stringify(options.body) : void 0;
465
527
  fetchAttempts += 1;
466
528
  lastRequestUrl = candidateUrl;
467
529
  networkPhase = "awaiting_headers";
@@ -469,11 +531,12 @@ var HttpClient = class {
469
531
  method,
470
532
  headers,
471
533
  body: requestBody,
472
- signal: controller.signal
534
+ signal: controller.signal,
535
+ redirect: deploymentProtectionRedirect(headers)
473
536
  });
474
537
  networkPhase = "reading_body";
475
- _optionalChain([options, 'optionalAccess', _130 => _130.onResponse, 'optionalCall', _131 => _131(response)]);
476
- if (response.status === 404 && _optionalChain([options, 'optionalAccess', _132 => _132.allowNotFound])) {
538
+ _optionalChain([options, 'optionalAccess', _142 => _142.onResponse, 'optionalCall', _143 => _143(response)]);
539
+ if (response.status === 404 && _optionalChain([options, 'optionalAccess', _144 => _144.allowNotFound])) {
477
540
  clearTimeout(timeoutId);
478
541
  return null;
479
542
  }
@@ -481,18 +544,18 @@ var HttpClient = class {
481
544
  const receivedAtMs = Date.now();
482
545
  clearTimeout(timeoutId);
483
546
  const parsed = parseResponseBody(body);
484
- _optionalChain([options, 'optionalAccess', _133 => _133.onResponseBody, 'optionalCall', _134 => _134({
547
+ _optionalChain([options, 'optionalAccess', _145 => _145.onResponseBody, 'optionalCall', _146 => _146({
485
548
  receivedAtMs,
486
549
  httpStatus: response.status,
487
550
  body: parsed
488
551
  })]);
489
- const responseRetryAllowed = _optionalChain([options, 'optionalAccess', _135 => _135.retryFromExecutePolicy]) !== true || parseExecuteRetryPolicy(
552
+ const responseRetryAllowed = _optionalChain([options, 'optionalAccess', _147 => _147.retryFromExecutePolicy]) !== true || parseExecuteRetryPolicy(
490
553
  response.headers.get(EXECUTE_RETRY_POLICY_HEADER)
491
554
  ) === "transient-http-safe";
492
- if (_optionalChain([options, 'optionalAccess', _136 => _136.retryFromExecutePolicy]) === true && responseRetryAllowed && options.executePolicyMaxRetries !== void 0) {
555
+ if (_optionalChain([options, 'optionalAccess', _148 => _148.retryFromExecutePolicy]) === true && responseRetryAllowed && options.executePolicyMaxRetries !== void 0) {
493
556
  maxRetries = options.executePolicyMaxRetries;
494
557
  }
495
- const structuredToolError = _optionalChain([options, 'optionalAccess', _137 => _137.toolId]) && !response.ok ? _chunkSQWET4SLjs.deserializeToolExecutionFailure.call(void 0,
558
+ const structuredToolError = _optionalChain([options, 'optionalAccess', _149 => _149.toolId]) && !response.ok ? _chunkSQWET4SLjs.deserializeToolExecutionFailure.call(void 0,
496
559
  _chunkXNYIZMNQjs.apiErrorMessage.call(void 0, parsed, response.status),
497
560
  isRecord(parsed) ? parsed.tool_error : null,
498
561
  _chunkSQWET4SLjs.TOOL_EXECUTION_ERROR_SCHEMA_VERSION
@@ -514,7 +577,7 @@ var HttpClient = class {
514
577
  throw _chunkSQWET4SLjs.attachToolUpstreamResponse.call(void 0, structuredToolError, parsed);
515
578
  }
516
579
  if (response.status === 429) {
517
- if (_optionalChain([options, 'optionalAccess', _138 => _138.preserveRateLimitResponse]) && isMonitorRateLimitEnvelope(parsed)) {
580
+ if (_optionalChain([options, 'optionalAccess', _150 => _150.preserveRateLimitResponse]) && isMonitorRateLimitEnvelope(parsed)) {
518
581
  throw new (0, _chunkSQWET4SLjs.DeeplineError)(
519
582
  _chunkXNYIZMNQjs.apiErrorMessage.call(void 0, parsed, response.status),
520
583
  response.status,
@@ -528,13 +591,13 @@ var HttpClient = class {
528
591
  retryAfterDelayMs = retryAfter;
529
592
  break;
530
593
  }
531
- throw _optionalChain([options, 'optionalAccess', _139 => _139.toolId]) ? _chunkSQWET4SLjs.attachToolUpstreamResponse.call(void 0, lastError, parsed) : lastError;
594
+ throw _optionalChain([options, 'optionalAccess', _151 => _151.toolId]) ? _chunkSQWET4SLjs.attachToolUpstreamResponse.call(void 0, lastError, parsed) : lastError;
532
595
  }
533
596
  if (response.status === 401 && !isProviderOriginatedHttpError(parsed)) {
534
597
  throw new (0, _chunkT2N3B7IQjs.AuthError)(_chunkXNYIZMNQjs.apiErrorMessage.call(void 0, parsed, response.status));
535
598
  }
536
599
  if (!response.ok) {
537
- const retryableApiError = _optionalChain([options, 'optionalAccess', _140 => _140.retryApiErrors]) === true && responseRetryAllowed && isRetryableApiErrorResponse(response.status);
600
+ const retryableApiError = _optionalChain([options, 'optionalAccess', _152 => _152.retryApiErrors]) === true && responseRetryAllowed && isRetryableApiErrorResponse(response.status);
538
601
  const htmlError = detectHtmlErrorBody(
539
602
  body,
540
603
  response.headers.get("content-type")
@@ -566,7 +629,7 @@ var HttpClient = class {
566
629
  retryAfterDelayMs = parseOptionalRetryAfter(response);
567
630
  break;
568
631
  }
569
- throw _optionalChain([options, 'optionalAccess', _141 => _141.toolId]) ? _chunkSQWET4SLjs.attachToolUpstreamResponse.call(void 0, lastError, parsed) : lastError;
632
+ throw _optionalChain([options, 'optionalAccess', _153 => _153.toolId]) ? _chunkSQWET4SLjs.attachToolUpstreamResponse.call(void 0, lastError, parsed) : lastError;
570
633
  }
571
634
  if (typeof parsed === "string") {
572
635
  const interstitial = detectHtmlErrorBody(
@@ -586,7 +649,7 @@ var HttpClient = class {
586
649
  } catch (error) {
587
650
  clearTimeout(timeoutId);
588
651
  networkFailedAt = Date.now();
589
- if (_optionalChain([options, 'optionalAccess', _142 => _142.signal, 'optionalAccess', _143 => _143.aborted])) {
652
+ if (_optionalChain([options, 'optionalAccess', _154 => _154.signal, 'optionalAccess', _155 => _155.aborted])) {
590
653
  lastError = requestCancelledError(options.signal);
591
654
  break requestAttempts;
592
655
  }
@@ -601,12 +664,12 @@ var HttpClient = class {
601
664
  timeoutMs,
602
665
  timedOut: requestTimedOut
603
666
  });
604
- if (_optionalChain([options, 'optionalAccess', _144 => _144.retryFromExecutePolicy]) && options.retryAmbiguousDelivery !== true) {
667
+ if (_optionalChain([options, 'optionalAccess', _156 => _156.retryFromExecutePolicy]) && options.retryAmbiguousDelivery !== true) {
605
668
  break requestAttempts;
606
669
  }
607
670
  } finally {
608
671
  clearTimeout(timeoutId);
609
- _optionalChain([options, 'optionalAccess', _145 => _145.signal, 'optionalAccess', _146 => _146.removeEventListener, 'call', _147 => _147("abort", abortRequest)]);
672
+ _optionalChain([options, 'optionalAccess', _157 => _157.signal, 'optionalAccess', _158 => _158.removeEventListener, 'call', _159 => _159("abort", abortRequest)]);
610
673
  }
611
674
  }
612
675
  if (attempt < maxRetries) continue;
@@ -633,7 +696,7 @@ var HttpClient = class {
633
696
  phase: networkPhase
634
697
  }
635
698
  };
636
- if (_optionalChain([options, 'optionalAccess', _148 => _148.toolId])) {
699
+ if (_optionalChain([options, 'optionalAccess', _160 => _160.toolId])) {
637
700
  const code = mappedNetworkError.code;
638
701
  throw withErrorCause(
639
702
  new (0, _chunkSQWET4SLjs.ToolExecutionError)(
@@ -685,25 +748,26 @@ var HttpClient = class {
685
748
  }
686
749
  async *streamSse(path, options) {
687
750
  const url = `${this.config.baseUrl}${path}`;
688
- const method = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _149 => _149.method]), () => ( "GET"));
751
+ const method = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _161 => _161.method]), () => ( "GET"));
689
752
  const headers = this.authHeaders({
690
753
  Accept: "text/event-stream",
691
- ..._optionalChain([options, 'optionalAccess', _150 => _150.headers])
754
+ ..._optionalChain([options, 'optionalAccess', _162 => _162.headers])
692
755
  });
693
- if (_optionalChain([options, 'optionalAccess', _151 => _151.body]) !== void 0) {
756
+ if (_optionalChain([options, 'optionalAccess', _163 => _163.body]) !== void 0) {
694
757
  applyExplicitHeaders(headers, { "Content-Type": "application/json" });
695
758
  }
696
759
  let lastError = null;
697
- const candidateUrls = _optionalChain([options, 'optionalAccess', _152 => _152.exactUrlOnly]) ? [url] : buildCandidateUrls(url);
760
+ const candidateUrls = _optionalChain([options, 'optionalAccess', _164 => _164.exactUrlOnly]) ? [url] : buildCandidateUrls(url);
698
761
  for (const candidateUrl of candidateUrls) {
699
762
  try {
700
763
  const response = await fetch(candidateUrl, {
701
764
  method,
702
765
  headers,
703
- body: _optionalChain([options, 'optionalAccess', _153 => _153.body]) !== void 0 ? JSON.stringify(options.body) : void 0,
704
- signal: _optionalChain([options, 'optionalAccess', _154 => _154.signal])
766
+ body: _optionalChain([options, 'optionalAccess', _165 => _165.body]) !== void 0 ? JSON.stringify(options.body) : void 0,
767
+ signal: _optionalChain([options, 'optionalAccess', _166 => _166.signal]),
768
+ redirect: deploymentProtectionRedirect(headers)
705
769
  });
706
- _optionalChain([options, 'optionalAccess', _155 => _155.onResponse, 'optionalCall', _156 => _156(response)]);
770
+ _optionalChain([options, 'optionalAccess', _167 => _167.onResponse, 'optionalCall', _168 => _168(response)]);
707
771
  if (!response.ok) {
708
772
  const body = await response.text();
709
773
  const parsed = parseResponseBody(body);
@@ -743,7 +807,7 @@ var HttpClient = class {
743
807
  throw error;
744
808
  }
745
809
  const normalized = error instanceof Error ? error : new Error(String(error));
746
- if (isAbortLikeError(normalized) && _optionalChain([options, 'optionalAccess', _157 => _157.signal, 'optionalAccess', _158 => _158.aborted])) {
810
+ if (isAbortLikeError(normalized) && _optionalChain([options, 'optionalAccess', _169 => _169.signal, 'optionalAccess', _170 => _170.aborted])) {
747
811
  throw new (0, _chunkSQWET4SLjs.DeeplineError)(
748
812
  `Stream from ${this.config.baseUrl} was aborted by the caller.`,
749
813
  void 0,
@@ -764,7 +828,7 @@ var HttpClient = class {
764
828
  }
765
829
  throw new (0, _chunkSQWET4SLjs.DeeplineError)(
766
830
  withCoworkNetworkHint(
767
- _optionalChain([lastError, 'optionalAccess', _159 => _159.message]) ? `Unable to stream from ${this.config.baseUrl}. ${lastError.message}` : `Unable to stream from ${this.config.baseUrl}.`
831
+ _optionalChain([lastError, 'optionalAccess', _171 => _171.message]) ? `Unable to stream from ${this.config.baseUrl}. ${lastError.message}` : `Unable to stream from ${this.config.baseUrl}.`
768
832
  )
769
833
  );
770
834
  }
@@ -820,21 +884,21 @@ var HttpClient = class {
820
884
  function parseResponseBody(body) {
821
885
  try {
822
886
  return JSON.parse(body);
823
- } catch (e4) {
887
+ } catch (e6) {
824
888
  return body;
825
889
  }
826
890
  }
827
891
  function isProviderOriginatedHttpError(parsed) {
828
892
  const response = asRecord(parsed);
829
- const error = asRecord(_optionalChain([response, 'optionalAccess', _160 => _160.error]));
830
- const failureOrigin = _nullishCoalesce(_optionalChain([error, 'optionalAccess', _161 => _161.failure_origin]), () => ( _optionalChain([response, 'optionalAccess', _162 => _162.failure_origin])));
831
- const code = _nullishCoalesce(_optionalChain([error, 'optionalAccess', _163 => _163.code]), () => ( _optionalChain([response, 'optionalAccess', _164 => _164.code])));
893
+ const error = asRecord(_optionalChain([response, 'optionalAccess', _172 => _172.error]));
894
+ const failureOrigin = _nullishCoalesce(_optionalChain([error, 'optionalAccess', _173 => _173.failure_origin]), () => ( _optionalChain([response, 'optionalAccess', _174 => _174.failure_origin])));
895
+ const code = _nullishCoalesce(_optionalChain([error, 'optionalAccess', _175 => _175.code]), () => ( _optionalChain([response, 'optionalAccess', _176 => _176.code])));
832
896
  return failureOrigin === "provider" || code === "UPSTREAM_BLOCKED";
833
897
  }
834
898
  function isMonitorRateLimitEnvelope(parsed) {
835
899
  const response = asRecord(parsed);
836
- const error = asRecord(_optionalChain([response, 'optionalAccess', _165 => _165.error]));
837
- return (_optionalChain([error, 'optionalAccess', _166 => _166.code]) === "monitor_upstream_rate_limited" || _optionalChain([error, 'optionalAccess', _167 => _167.code]) === "monitor_preview_rate_limited") && typeof error.message === "string";
900
+ const error = asRecord(_optionalChain([response, 'optionalAccess', _177 => _177.error]));
901
+ return (_optionalChain([error, 'optionalAccess', _178 => _178.code]) === "monitor_upstream_rate_limited" || _optionalChain([error, 'optionalAccess', _179 => _179.code]) === "monitor_preview_rate_limited") && typeof error.message === "string";
838
902
  }
839
903
  function asRecord(value) {
840
904
  return typeof value === "object" && value !== null ? value : null;
@@ -850,7 +914,7 @@ function detectHtmlErrorBody(body, contentType) {
850
914
  return null;
851
915
  }
852
916
  const titleMatch = trimmed.match(/<title[^>]*>([\s\S]*?)<\/title>/i);
853
- const title = _optionalChain([titleMatch, 'optionalAccess', _168 => _168[1], 'optionalAccess', _169 => _169.replace, 'call', _170 => _170(/\s+/g, " "), 'access', _171 => _171.trim, 'call', _172 => _172()]) || void 0;
917
+ const title = _optionalChain([titleMatch, 'optionalAccess', _180 => _180[1], 'optionalAccess', _181 => _181.replace, 'call', _182 => _182(/\s+/g, " "), 'access', _183 => _183.trim, 'call', _184 => _184()]) || void 0;
854
918
  const workerThrewException = /worker threw exception/i.test(trimmed);
855
919
  return {
856
920
  title,
@@ -890,7 +954,7 @@ function buildCandidateUrls(url) {
890
954
  candidates.push(loopback.toString());
891
955
  }
892
956
  return [...new Set(candidates)];
893
- } catch (e5) {
957
+ } catch (e7) {
894
958
  return [url];
895
959
  }
896
960
  }
@@ -934,20 +998,20 @@ function decodeSseFrame(frame) {
934
998
  }
935
999
  function sleep(ms, signal) {
936
1000
  return new Promise((resolve, reject) => {
937
- if (_optionalChain([signal, 'optionalAccess', _173 => _173.aborted])) {
1001
+ if (_optionalChain([signal, 'optionalAccess', _185 => _185.aborted])) {
938
1002
  reject(requestCancelledError(signal));
939
1003
  return;
940
1004
  }
941
1005
  const timeoutId = setTimeout(() => {
942
- _optionalChain([signal, 'optionalAccess', _174 => _174.removeEventListener, 'call', _175 => _175("abort", abort)]);
1006
+ _optionalChain([signal, 'optionalAccess', _186 => _186.removeEventListener, 'call', _187 => _187("abort", abort)]);
943
1007
  resolve();
944
1008
  }, ms);
945
1009
  const abort = () => {
946
1010
  clearTimeout(timeoutId);
947
- _optionalChain([signal, 'optionalAccess', _176 => _176.removeEventListener, 'call', _177 => _177("abort", abort)]);
1011
+ _optionalChain([signal, 'optionalAccess', _188 => _188.removeEventListener, 'call', _189 => _189("abort", abort)]);
948
1012
  reject(requestCancelledError(signal));
949
1013
  };
950
- _optionalChain([signal, 'optionalAccess', _178 => _178.addEventListener, 'call', _179 => _179("abort", abort, { once: true })]);
1014
+ _optionalChain([signal, 'optionalAccess', _190 => _190.addEventListener, 'call', _191 => _191("abort", abort, { once: true })]);
951
1015
  });
952
1016
  }
953
1017
  function withCoworkNetworkHint(message) {
@@ -973,4 +1037,7 @@ ${COWORK_NETWORK_HINT}`;
973
1037
 
974
1038
 
975
1039
 
976
- exports.ATOMIC_TOOL_EXECUTE_SUPPORTED_HEADER = ATOMIC_TOOL_EXECUTE_SUPPORTED_HEADER; exports.SDK_VERSION = SDK_VERSION; exports.SDK_API_MAJOR = SDK_API_MAJOR; exports.SDK_API_CONTRACT = SDK_API_CONTRACT; exports.COORDINATOR_INTERNAL_TOKEN_HEADER = COORDINATOR_INTERNAL_TOKEN_HEADER; exports.RUNTIME_ENVIRONMENT_TOKEN_HEADER = RUNTIME_ENVIRONMENT_TOKEN_HEADER; exports.RETAINED_PIPELINE_RECEIVERS_HEADER = RETAINED_PIPELINE_RECEIVERS_HEADER; exports.agentSessionIdFromEnvironment = agentSessionIdFromEnvironment; exports.detectAgentRuntime = detectAgentRuntime; exports.deploymentProtectionHeaders = deploymentProtectionHeaders; exports.fetchWithDeploymentProtection = fetchWithDeploymentProtection; exports.networkCauseCode = networkCauseCode; exports.connectionFailureMessage = connectionFailureMessage; exports.HttpClient = HttpClient;
1040
+
1041
+
1042
+
1043
+ exports.ATOMIC_TOOL_EXECUTE_SUPPORTED_HEADER = ATOMIC_TOOL_EXECUTE_SUPPORTED_HEADER; exports.SDK_VERSION = SDK_VERSION; exports.SDK_API_MAJOR = SDK_API_MAJOR; exports.SDK_API_CONTRACT = SDK_API_CONTRACT; exports.COORDINATOR_INTERNAL_TOKEN_HEADER = COORDINATOR_INTERNAL_TOKEN_HEADER; exports.RUNTIME_ENVIRONMENT_TOKEN_HEADER = RUNTIME_ENVIRONMENT_TOKEN_HEADER; exports.RETAINED_PIPELINE_RECEIVERS_HEADER = RETAINED_PIPELINE_RECEIVERS_HEADER; exports.agentSessionIdFromEnvironment = agentSessionIdFromEnvironment; exports.isAgentSessionId = isAgentSessionId; exports.claudeProjectsRoots = claudeProjectsRoots; exports.coworkTranscriptFromEnvironment = coworkTranscriptFromEnvironment; exports.detectAgentRuntime = detectAgentRuntime; exports.deploymentProtectionHeaders = deploymentProtectionHeaders; exports.fetchWithDeploymentProtection = fetchWithDeploymentProtection; exports.networkCauseCode = networkCauseCode; exports.connectionFailureMessage = connectionFailureMessage; exports.HttpClient = HttpClient;