nolo-cli 0.153.2 → 0.154.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 (136) hide show
  1. package/{_executeModel-7PZNF3KM.js → _executeModel-3HHZYHHB.js} +44 -42
  2. package/accountResolver-55EDKEIK.js +1 -1
  3. package/action-GPPJC5TI.js +1 -1
  4. package/{addContentAction-BI6RDRTQ.js → addContentAction-XJQEJ4XW.js} +6 -6
  5. package/{addDialogAgentAction-4RJYUSIK.js → addDialogAgentAction-5WZX5CAY.js} +5 -5
  6. package/{agentDeleteCommand-52SBFMA4.js → agentDeleteCommand-ON2KVSJ5.js} +60 -60
  7. package/{agentEmailCommands-FLTHAK4Y.js → agentEmailCommands-2QPD5VP3.js} +63 -63
  8. package/{agentListCommands-LKFRVROH.js → agentListCommands-L33M3I6V.js} +33 -33
  9. package/{agentMachineCommands-V3E6STQ6.js → agentMachineCommands-V44DPSED.js} +30 -28
  10. package/{agentProviderCommands-MKG2OOEY.js → agentProviderCommands-CXBHNONN.js} +5 -5
  11. package/{agentPullCommand-FA43RBRU.js → agentPullCommand-GXXEDOSA.js} +4 -4
  12. package/{agentRecordCommands-KAOY56RD.js → agentRecordCommands-CKILCNQZ.js} +57 -57
  13. package/{agentRunCommand-FXAN65RN.js → agentRunCommand-6IN7NK7H.js} +59 -59
  14. package/{agentRunControl-2C5GM3BW.js → agentRunControl-XBSNHHZE.js} +7 -7
  15. package/{agentRuntimeLocal-V4URZOQL.js → agentRuntimeLocal-XCKO5FVP.js} +20 -18
  16. package/{agentSlice-LAV5TJXT.js → agentSlice-YT3VCCEW.js} +6 -6
  17. package/{appDeleteCommands-7EZRTNIP.js → appDeleteCommands-2PJFNLAJ.js} +28 -26
  18. package/{appDeployCommands-3U6MEES7.js → appDeployCommands-AZCMCMK6.js} +28 -26
  19. package/{appDeployStatusCommands-TAC6BYC6.js → appDeployStatusCommands-HSIKPVJN.js} +28 -26
  20. package/{appGetCommands-MFNPLXGO.js → appGetCommands-IUZCPAP7.js} +28 -26
  21. package/{appListCommands-QVZAUEUU.js → appListCommands-JLFVS44M.js} +28 -26
  22. package/{authCommand-NIV3DKPF.js → authCommand-3Z52KJID.js} +19 -19
  23. package/{authCommands-AMNIAKEG.js → authCommands-QOCKVPX3.js} +5 -5
  24. package/{builtinSkillRegistry-H3AY27TR.js → builtinSkillRegistry-LJV7FHNI.js} +4 -4
  25. package/{chunk-4RJJDA57.js → chunk-2ODX2C4E.js} +154 -30
  26. package/{chunk-UCLSOLX4.js → chunk-2XDQAWBM.js} +12 -12
  27. package/{chunk-XJOBYJWN.js → chunk-2ZYCNT2O.js} +72 -33
  28. package/{chunk-YIIQNHJW.js → chunk-3GTVM7NJ.js} +19 -19
  29. package/{chunk-US6MKPE7.js → chunk-3L5MSPWX.js} +1 -1
  30. package/{chunk-SGJRNVYF.js → chunk-4L4K6YR7.js} +16 -2
  31. package/{chunk-P5QACQDK.js → chunk-62TBKWTV.js} +1 -1
  32. package/{chunk-TRW43TSC.js → chunk-6EQD4AQL.js} +41 -1
  33. package/{chunk-YLMMECCH.js → chunk-6XIE5ZGI.js} +1 -1
  34. package/{chunk-J2ATF74A.js → chunk-BAWAKW7X.js} +1 -1
  35. package/{chunk-ZVQHBIWV.js → chunk-CDLP56BS.js} +7 -7
  36. package/{chunk-JPJGMOIM.js → chunk-DD2EOI6S.js} +1 -1
  37. package/{chunk-OON4OBWI.js → chunk-DLV3H464.js} +7 -7
  38. package/{chunk-RWSOTHY4.js → chunk-DT7EWFTY.js} +5 -5
  39. package/{chunk-IRTOYSA2.js → chunk-ESMZW5PE.js} +1 -1
  40. package/{chunk-V6P4AYYJ.js → chunk-EVPKKBSI.js} +13 -13
  41. package/{chunk-HB4XPBC7.js → chunk-EWO77ZGF.js} +9 -11
  42. package/{chunk-KJ7MT3UC.js → chunk-F3SOW2EU.js} +81 -1
  43. package/{chunk-T64RZQBO.js → chunk-F5WASHQA.js} +247 -132
  44. package/{chunk-WUGRUG5Z.js → chunk-FB5WLEOD.js} +12 -12
  45. package/{chunk-SOEJSA7I.js → chunk-FCUKCVKN.js} +4 -4
  46. package/{chunk-FY4SDK2E.js → chunk-FDLDMJTM.js} +1 -1
  47. package/{chunk-ICRRXBRN.js → chunk-FFHV45HO.js} +3 -3
  48. package/{chunk-BUCB3RT4.js → chunk-FZYKQFBQ.js} +3 -3
  49. package/{chunk-IE5PXKVU.js → chunk-G3VYRPTV.js} +5 -5
  50. package/{chunk-3CHPRXKY.js → chunk-HW7EBEC5.js} +26 -194
  51. package/{chunk-UFYBYB26.js → chunk-I7S63QUU.js} +1 -1
  52. package/{chunk-CON6SI7N.js → chunk-IF7V3CBU.js} +1 -1
  53. package/{chunk-RAEBIT7A.js → chunk-JDKSYQQN.js} +4 -4
  54. package/{chunk-K43ZF2C3.js → chunk-JPPQ3GUO.js} +1 -1
  55. package/{chunk-QJJQZ4EK.js → chunk-JSB2OPQT.js} +115 -119
  56. package/{chunk-M2P3OGXZ.js → chunk-JWEXJ573.js} +2 -2
  57. package/{chunk-7G4KH3C4.js → chunk-K25WQPP3.js} +220 -54
  58. package/{chunk-ZEY4NJRE.js → chunk-KABQ74UQ.js} +4 -4
  59. package/{chunk-3C2QLERX.js → chunk-KMDDG73K.js} +1 -1
  60. package/{chunk-SPKLALBU.js → chunk-MAYW6V3E.js} +1 -1
  61. package/{chunk-IPAW7XLD.js → chunk-MFVOJ6KF.js} +2 -2
  62. package/{chunk-NDZOXXIM.js → chunk-NHEWV5FD.js} +1 -1
  63. package/{chunk-QPY264HO.js → chunk-O2IWR23M.js} +1 -1
  64. package/{chunk-TFPOD4YZ.js → chunk-OLVOR45M.js} +2 -2
  65. package/{chunk-SUKSWFLP.js → chunk-PIG2IUVZ.js} +1 -1
  66. package/{chunk-AAMWEIEP.js → chunk-QA2C5NKI.js} +3 -3
  67. package/{chunk-3WIXU4XO.js → chunk-QI2WVWXV.js} +13 -1
  68. package/{chunk-VSJIIKGY.js → chunk-QXZH5UDF.js} +3 -3
  69. package/{chunk-SQ73U3BG.js → chunk-QZIOZDM6.js} +9 -9
  70. package/{chunk-MJ54WBLO.js → chunk-R2KWTENX.js} +3 -3
  71. package/{chunk-C3OK72G3.js → chunk-RIHQGFFA.js} +1 -1
  72. package/{chunk-DC3SZCRR.js → chunk-SH3XD4E2.js} +2 -2
  73. package/{chunk-MM3662RS.js → chunk-SNAWGDXT.js} +263 -4
  74. package/{chunk-JGRPBIZZ.js → chunk-SQX235S2.js} +1 -1
  75. package/chunk-TT644UJD.js +188 -0
  76. package/{chunk-IYBIRCQV.js → chunk-U34KT53V.js} +29 -11
  77. package/{chunk-ZJZGF77K.js → chunk-ULQAD7ZY.js} +18 -43
  78. package/{chunk-DJKBZYMR.js → chunk-UY73HNIN.js} +53 -49
  79. package/{chunk-I2RMFLLH.js → chunk-V7PCFWX3.js} +1 -1
  80. package/{chunk-KLA62VVE.js → chunk-VXS4YYJ2.js} +8 -8
  81. package/{chunk-JZX2XLKC.js → chunk-YCRROBDY.js} +1 -1
  82. package/{chunk-C5A3GWRG.js → chunk-YR47Y7CN.js} +6 -6
  83. package/{chunk-AXYXKGPN.js → chunk-ZAV4YVEA.js} +1 -1
  84. package/{chunk-YANF2RR4.js → chunk-ZPKUJROL.js} +1 -1
  85. package/{chunk-AWY25K65.js → chunk-ZSLIYVIQ.js} +7 -7
  86. package/{commandRegistry-BZGZP4AW.js → commandRegistry-4LWXIPNX.js} +83 -83
  87. package/{contentThunks-56AWRCC4.js → contentThunks-QBL5NK2W.js} +17 -17
  88. package/{createAgentAutomationAction-W5D4IHHK.js → createAgentAutomationAction-5UWBLR2N.js} +17 -17
  89. package/{createDialogAction-YMU646CH.js → createDialogAction-NJ2LE7KC.js} +21 -21
  90. package/{createPageAction-T4WRPDOH.js → createPageAction-7T3RINS2.js} +19 -19
  91. package/{dbSlice-DC2J53RC.js → dbSlice-6PVPY44C.js} +5 -5
  92. package/{deleteFile-KYWEMNFX.js → deleteFile-YM6NDPAR.js} +3 -3
  93. package/{dialogCommands-3T3LM566.js → dialogCommands-KMECTGCW.js} +30 -28
  94. package/{dialogSlice-Z5KOY4CC.js → dialogSlice-GQMTD4HR.js} +16 -16
  95. package/{docCreateCommands-OLNS64OJ.js → docCreateCommands-4IT5PUAL.js} +30 -28
  96. package/{docDeleteCommands-U4UOLXZQ.js → docDeleteCommands-QS66YNZV.js} +31 -29
  97. package/{docReadCommands-WUYVWGOH.js → docReadCommands-3SAI46YC.js} +30 -28
  98. package/{docStore-2EN5A7PW.js → docStore-PM5PYKPZ.js} +6 -6
  99. package/{docUpdateCommands-RKVB6XAQ.js → docUpdateCommands-OGYG5BRC.js} +30 -28
  100. package/{getPricing-TX35D7PI.js → getPricing-XQ3N3RBP.js} +2 -2
  101. package/{handleSendMessageAction-EF3LOTXW.js → handleSendMessageAction-EQ3U6K5N.js} +35 -31
  102. package/index.js +7 -7
  103. package/{localRuntimeAdapter-OAHN57AM.js → localRuntimeAdapter-MO64KEOS.js} +53 -53
  104. package/{localRuntimeAuthority-JDAD7CB6.js → localRuntimeAuthority-BPN5OAQG.js} +2 -2
  105. package/{localRuntimeDb-CVC62PM5.js → localRuntimeDb-QIVAXMUL.js} +1 -1
  106. package/{machineCommands-RTYX5UN3.js → machineCommands-7MBJJY4K.js} +60 -60
  107. package/{machineWsRunDispatch-ELDKKIHF.js → machineWsRunDispatch-T4LFRJL3.js} +55 -55
  108. package/{memberThunks-2DWKLE6W.js → memberThunks-AZINUM4S.js} +8 -8
  109. package/package.json +1 -1
  110. package/{providerPresetApply-GSJI4JBJ.js → providerPresetApply-PKUOHQJT.js} +5 -5
  111. package/{providerRegistry-TSSTPGWF.js → providerRegistry-HNQLIFN2.js} +5 -5
  112. package/{read-L7QEJETH.js → read-7JPIWRBQ.js} +3 -3
  113. package/{readDocTool-QELXV2GW.js → readDocTool-AAQTB2Y3.js} +1 -1
  114. package/{readlineWorkspace-BUEUGN7D.js → readlineWorkspace-2DR5GHLQ.js} +92 -126
  115. package/{removeDialogAgentAction-376XSUP2.js → removeDialogAgentAction-RMVRILLK.js} +6 -6
  116. package/{runAgentClientLoop-BDN5VYZN.js → runAgentClientLoop-EXIQDX7G.js} +42 -40
  117. package/{runtimeDoctorCommands-56NWKNON.js → runtimeDoctorCommands-MMCP4B4U.js} +12 -12
  118. package/{setDialogExtraReferencesAction-QBDSH63D.js → setDialogExtraReferencesAction-L3V7JTMG.js} +6 -6
  119. package/{setPrimaryDialogAgentAction-537QFGW3.js → setPrimaryDialogAgentAction-X52JQGTJ.js} +6 -6
  120. package/{settingThunks-4Z43ZSAT.js → settingThunks-N6XFWPOU.js} +5 -5
  121. package/{spaceCommands-KHCPOFEB.js → spaceCommands-WQMUCGV7.js} +27 -25
  122. package/{streamAgentChatTurn-WFNIELXS.js → streamAgentChatTurn-DI2334G3.js} +142 -81
  123. package/{switchDialogAgentAction-CSO6AKRL.js → switchDialogAgentAction-ZJ5CGU7J.js} +5 -5
  124. package/{tools-2LGM37M4.js → tools-23VQGJOX.js} +32 -32
  125. package/{tuiSummaryLlmCaller-NBEHCAFU.js → tuiSummaryLlmCaller-FESHBDTT.js} +7 -7
  126. package/{updateCommands-LXZLG44Y.js → updateCommands-ODWC7SK7.js} +5 -3
  127. package/{updateDialogTitleAction-IFC2MM4P.js → updateDialogTitleAction-AGAYHWS7.js} +17 -17
  128. package/chunk-UKZX3NHN.js +0 -48
  129. package/{agentGrantCommands-HOJ3JBBQ.js → agentGrantCommands-5DPHYEKP.js} +3 -3
  130. package/{chromeOpsCommands-3Z34RKSE.js → chromeOpsCommands-GZVVK7HU.js} +4 -4
  131. package/{chunk-2SGAI64X.js → chunk-43OFVLWJ.js} +4 -4
  132. package/{chunk-XETG4RIX.js → chunk-AETZ7AD6.js} +4 -4
  133. package/{chunk-2IXDJNZI.js → chunk-GAGGEA7D.js} +3 -3
  134. package/{memoryCommands-CUNBFRVS.js → memoryCommands-ZS3VQJAL.js} +3 -3
  135. package/{offlineMarxistsAgentCommand-2QTHJCHV.js → offlineMarxistsAgentCommand-3GLX4QQY.js} +3 -3
  136. package/{tableCommands-LBH3QPPO.js → tableCommands-IVC5S7Y3.js} +11 -11
@@ -15,7 +15,7 @@ import {
15
15
  } from "./chunk-PSCNXBYA.js";
16
16
  import {
17
17
  getModelConfig
18
- } from "./chunk-TRW43TSC.js";
18
+ } from "./chunk-6EQD4AQL.js";
19
19
  import {
20
20
  asTrimmedString
21
21
  } from "./chunk-3EUW3WEO.js";
@@ -112,6 +112,17 @@ var PARALLEL_DISPATCH_DEFAULT_RULE = [
112
112
  "\u6D3E\u53D1\u65F6\u5728\u56DE\u590D\u91CC\u5199\u51FA\u300C\u5E76\u53D1\u7EC4 / \u4E32\u884C\u7406\u7531\u300D\uFF0C\u8BA9\u7528\u6237\u4E00\u773C\u770B\u51FA\u54EA\u6761\u7EBF\u88AB\u4E32\u884C\u5316\u3001\u4F9D\u636E\u662F\u4EC0\u4E48\u3002"
113
113
  ].join("\n");
114
114
 
115
+ // packages/agent-runtime/dispatchBackendPolicy.ts
116
+ var DISPATCH_BACKEND_POLICY = [
117
+ "\u3010\u6D3E\u53D1\u843D\u70B9 \xB7 \u6267\u884C\u540E\u7AEF\u3011",
118
+ "\u6D3E\u53D1\u5B50 run \u5148\u770B**\u80FD\u529B\u6761\u4EF6**\uFF0C\u522B\u4E00\u5F8B\u52A0 `local`\uFF1A",
119
+ '\u2460 \u6709\u5BBF\u4E3B\u6267\u884C\u5668\uFF08CLI / desktop\uFF09\u4E14\u8981\u6309\u7ED9\u5B9A `cwd` \u6539\u6307\u5B9A worktree / \u76EE\u5F55 \u2192 `runtimeKey: "local"` + `allowHostWrites: true`\uFF08\u7F3A\u4E00\u5373\u62D2\uFF09\u3002',
120
+ "\u2461 \u8981\u8BBF\u95EE\u7EBF\u4E0A\u670D\u52A1\u5668\u6216\u5BBF\u4E3B\u51ED\u636E \u2192 \u9009**\u6709\u8BE5\u80FD\u529B**\u7684\u6267\u884C\u9762\uFF1A\u6709\u5BBF\u4E3B\u6267\u884C\u5668\u65F6\u7528 `local`\uFF0C\u6CA1\u6709\u65F6\u7528\u5DF2\u8FDE\u63A5\u7684\u673A\u5668 `machine:<machineId>`\u3002",
121
+ "\u670D\u52A1\u7AEF\u7684 run \u6CA1\u6709\u5BBF\u4E3B\u6267\u884C\u5668\uFF0C\u5151\u73B0\u4E0D\u4E86\u8C03\u7528\u65B9\u7684\u672C\u5730 `cwd`\uFF1A`local` \u7ED5\u4E0D\u8FC7\u53BB\uFF08`local_target_unsupported`\uFF09\uFF0C\u8981\u4E48\u8D70 `machine:<machineId>`\uFF0C\u8981\u4E48\u7701\u7565\u843D\u70B9\u3002",
122
+ "\u6C99\u76D2\u7684\u7A33\u5B9A\u8FB9\u754C\uFF1A\u4E0D\u5151\u73B0\u5BBF\u4E3B\u7EDD\u5BF9 `cwd`\u3001\u4E0D\u81EA\u52A8\u7EE7\u627F\u5BBF\u4E3B\u51ED\u636E\uFF1B\u5DE5\u5177\u4E0E\u7F51\u7EDC\u80FD\u529B\u4EE5\u5C31\u7EEA\u73AF\u5883\u4E3A\u51C6\u3002",
123
+ "\u300C\u5199\u578B\u6D3E\u53D1\u9ED8\u8BA4\u843D docker \u6C99\u76D2\u300D\u53EA\u5C5E\u4E8E CLI \u672C\u5730\u6D3E\u53D1\u901A\u9053\u8FD9\u4E00\u8303\u56F4\uFF1B\u4E0D\u5E26\u5BBF\u4E3B\u72B6\u6001\u4E0E\u5BBF\u4E3B\u51ED\u636E\u7684\u72EC\u7ACB\u4EE3\u7801\u6539\u52A8 + \u8DD1\u6D4B\u8BD5\uFF0C\u6C99\u76D2\u4ECD\u662F\u9996\u9009\uFF08\u9694\u79BB\u662F\u4FDD\u9669\uFF0C\u4E0D\u662F\u8D1F\u62C5\uFF09\u3002"
124
+ ].join("\n");
125
+
115
126
  // packages/agent-runtime/platformRiskControl.ts
116
127
  var PLATFORM_RISK_CONTROL_RULE = [
117
128
  "\u3010\u5E73\u53F0\u98CE\u63A7\u7EAA\u5F8B \xB7 \u7B2C\u4E09\u65B9\u7AD9\u70B9\u81EA\u52A8\u5316\u3011",
@@ -776,6 +787,7 @@ export {
776
787
  DELETE_SAFETY_RED_LINE,
777
788
  CREDENTIAL_HYGIENE_RULE,
778
789
  PARALLEL_DISPATCH_DEFAULT_RULE,
790
+ DISPATCH_BACKEND_POLICY,
779
791
  PLATFORM_RISK_CONTROL_RULE,
780
792
  isGptProModel,
781
793
  shouldBlockForGptPro,
@@ -27,11 +27,11 @@ import {
27
27
  stablePromptCacheKey,
28
28
  toOpenAiCompatibleMessages,
29
29
  toResponsesTools
30
- } from "./chunk-SGJRNVYF.js";
30
+ } from "./chunk-4L4K6YR7.js";
31
31
  import {
32
32
  isMeaningfulChatCompletionOutput,
33
33
  isMeaningfulResponsesOutput
34
- } from "./chunk-AAMWEIEP.js";
34
+ } from "./chunk-QA2C5NKI.js";
35
35
  import {
36
36
  clipCompactText
37
37
  } from "./chunk-5MMAK75Q.js";
@@ -44,7 +44,7 @@ import {
44
44
  resolvePlatformAuthToken,
45
45
  resolvePlatformServerUrl,
46
46
  resolveProviderTransportDecision
47
- } from "./chunk-SUKSWFLP.js";
47
+ } from "./chunk-PIG2IUVZ.js";
48
48
  import {
49
49
  isRecord
50
50
  } from "./chunk-KUG52IAP.js";
@@ -2,7 +2,7 @@ import {
2
2
  clipMultilineText,
3
3
  fetchAndSerializeTable,
4
4
  waitForAbortableDelay
5
- } from "./chunk-SOEJSA7I.js";
5
+ } from "./chunk-FCUKCVKN.js";
6
6
  import {
7
7
  isGatewayHttpStatus
8
8
  } from "./chunk-NF64D32W.js";
@@ -15,30 +15,33 @@ import {
15
15
  import {
16
16
  resolvePageReadMarkdown,
17
17
  slateToSimplifiedMarkdown
18
- } from "./chunk-US6MKPE7.js";
18
+ } from "./chunk-3L5MSPWX.js";
19
19
  import {
20
20
  extractCategorizedMentions
21
21
  } from "./chunk-AGIM7IMJ.js";
22
22
  import {
23
23
  fetchAndCacheMessages
24
- } from "./chunk-T64RZQBO.js";
24
+ } from "./chunk-F5WASHQA.js";
25
25
  import {
26
26
  createSpaceKey
27
27
  } from "./chunk-UAD2WT54.js";
28
28
  import {
29
29
  read
30
- } from "./chunk-ZVQHBIWV.js";
30
+ } from "./chunk-CDLP56BS.js";
31
31
  import {
32
32
  getRuntimeServerContext
33
- } from "./chunk-2SGAI64X.js";
33
+ } from "./chunk-43OFVLWJ.js";
34
34
  import {
35
35
  extractRuntimePageCapabilities,
36
36
  resolveBuiltinSkillPage,
37
37
  resolveSkillGraphFromRoots
38
- } from "./chunk-DC3SZCRR.js";
38
+ } from "./chunk-SH3XD4E2.js";
39
39
  import {
40
40
  isAbortError
41
41
  } from "./chunk-7DPNBQSV.js";
42
+ import {
43
+ wrapHistoricalSummaryWithReplayGuard
44
+ } from "./chunk-4VJAC32I.js";
42
45
  import {
43
46
  extractCustomId
44
47
  } from "./chunk-M2EJHDJP.js";
@@ -51,9 +54,6 @@ import {
51
54
  import {
52
55
  asTrimmedString
53
56
  } from "./chunk-3EUW3WEO.js";
54
- import {
55
- wrapHistoricalSummaryWithReplayGuard
56
- } from "./chunk-4VJAC32I.js";
57
57
 
58
58
  // packages/ai/chat/errorDiagnostics.ts
59
59
  var record = (value) => value !== null && typeof value === "object" && !Array.isArray(value) ? value : {};
@@ -7,7 +7,7 @@ import {
7
7
  import {
8
8
  patch,
9
9
  readAndWait
10
- } from "./chunk-ZVQHBIWV.js";
10
+ } from "./chunk-CDLP56BS.js";
11
11
  import {
12
12
  toErrorMessage
13
13
  } from "./chunk-HNMXYYJR.js";
@@ -333,7 +333,7 @@ async function saveDocState(arg, { dispatch, getState }) {
333
333
  ).unwrap();
334
334
  if (dbSpaceId) {
335
335
  try {
336
- const { updateContentTitle } = await import("./contentThunks-56AWRCC4.js");
336
+ const { updateContentTitle } = await import("./contentThunks-QBL5NK2W.js");
337
337
  await dispatch(
338
338
  updateContentTitle({
339
339
  spaceId: dbSpaceId,
@@ -372,7 +372,7 @@ async function saveDocState(arg, { dispatch, getState }) {
372
372
  }
373
373
  }
374
374
  async function createDocState(args, thunkApi) {
375
- const { createPageAction } = await import("./createPageAction-T4WRPDOH.js");
375
+ const { createPageAction } = await import("./createPageAction-7T3RINS2.js");
376
376
  return createPageAction(args, thunkApi);
377
377
  }
378
378
  function subscribe(listener) {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  readDbRecord,
3
3
  writeAgentRecord
4
- } from "./chunk-ZEY4NJRE.js";
4
+ } from "./chunk-KABQ74UQ.js";
5
5
  import {
6
6
  buildSkillSummaryMarker
7
7
  } from "./chunk-VF4K2QE6.js";
@@ -6,11 +6,11 @@ import {
6
6
  buildBuiltinObjectSkillDbKey,
7
7
  buildBuiltinObjectSkillPageContent,
8
8
  buildCodeWorkDiscipline
9
- } from "./chunk-JZX2XLKC.js";
9
+ } from "./chunk-YCRROBDY.js";
10
10
  import {
11
11
  buildSkillDocMarkdown,
12
12
  resolvePageSkillMetadata
13
- } from "./chunk-XETG4RIX.js";
13
+ } from "./chunk-AETZ7AD6.js";
14
14
  import {
15
15
  nolotusId
16
16
  } from "./chunk-Y6ORVLSS.js";
@@ -2,13 +2,13 @@ import {
2
2
  isAgentRunTerminalStatus,
3
3
  normalizeRunTitle
4
4
  } from "./chunk-PJNFNEJE.js";
5
- import {
6
- resolvePlatformAuthToken
7
- } from "./chunk-SUKSWFLP.js";
8
5
  import {
9
6
  isCompiledBinary,
10
7
  resolveCliEntrypointPath
11
8
  } from "./chunk-A7GB5UGH.js";
9
+ import {
10
+ resolvePlatformAuthToken
11
+ } from "./chunk-PIG2IUVZ.js";
12
12
 
13
13
  // packages/cli/client/originShellApprovalTransport.ts
14
14
  import { realpathSync } from "node:fs";
@@ -324,6 +324,233 @@ import { dirname, isAbsolute as isAbsolute2, join, resolve } from "node:path";
324
324
  import * as nodeFs from "node:fs";
325
325
  import { execFileSync as nodeExecFileSync, spawn as nodeSpawn } from "node:child_process";
326
326
 
327
+ // packages/cli/client/hostMemory.ts
328
+ import { readFileSync, existsSync } from "node:fs";
329
+ import { freemem as osFreemem, totalmem as osTotalmem } from "node:os";
330
+ var PROC_MEMINFO_PATH = "/proc/meminfo";
331
+ var PROC_MOUNTS_PATH = "/proc/mounts";
332
+ var DEFAULT_CGROUP2_MOUNT = "/sys/fs/cgroup";
333
+ var SANDBOX_MARKER_PATHS = ["/.dockerenv", "/run/.containerenv"];
334
+ var PROC_SELF_CGROUP_PATH = "/proc/self/cgroup";
335
+ var SANDBOX_CGROUP_PATTERN = /(docker|kubepods|instabox|containerd)/;
336
+ var MEMORY_AVAILABLE_RATIO_THRESHOLD = 0.15;
337
+ var SWAP_USED_RATIO_THRESHOLD = 0.7;
338
+ var HOST_MEMORY_PRESSURE_HINT = "\u26A0 \u5185\u5B58\u504F\u7D27\uFF0C\u5EFA\u8BAE\u91CD\u6D3B\u653E\u6C99\u76D2/\u8FDC\u7AEF\u6216\u51CF\u5C11\u5E76\u53D1";
339
+ var BYTES_PER_MB = 1024 * 1024;
340
+ function toMbFromBytes(bytes) {
341
+ return Math.round(bytes / BYTES_PER_MB);
342
+ }
343
+ function kbToMb(kb) {
344
+ return Math.round(kb / 1024);
345
+ }
346
+ function tryReadText(deps, path) {
347
+ try {
348
+ const reader = deps.readFile ?? ((p) => readFileSync(p, "utf8"));
349
+ const text = reader(path);
350
+ return typeof text === "string" ? text : null;
351
+ } catch {
352
+ return null;
353
+ }
354
+ }
355
+ function tryExists(deps, path) {
356
+ try {
357
+ const checker = deps.exists ?? ((p) => existsSync(p));
358
+ return checker(path) === true;
359
+ } catch {
360
+ return false;
361
+ }
362
+ }
363
+ function readKbValue(text, key) {
364
+ const match = new RegExp(`^${key}:\\s*(\\d+)`, "m").exec(text);
365
+ if (!match) return null;
366
+ const value = Number.parseInt(match[1], 10);
367
+ return Number.isFinite(value) ? value : null;
368
+ }
369
+ function parseProcMeminfo(text) {
370
+ if (typeof text !== "string" || text.length === 0) return null;
371
+ const totalKb = readKbValue(text, "MemTotal");
372
+ const availableKb = readKbValue(text, "MemAvailable");
373
+ if (totalKb === null || availableKb === null) return null;
374
+ if (!(totalKb > 0)) return null;
375
+ const swapTotalKb = readKbValue(text, "SwapTotal") ?? 0;
376
+ const swapFreeKb = readKbValue(text, "SwapFree") ?? 0;
377
+ return {
378
+ source: "proc-meminfo",
379
+ totalMb: kbToMb(totalKb),
380
+ availableMb: kbToMb(Math.max(0, availableKb)),
381
+ swapTotalMb: kbToMb(Math.max(0, swapTotalKb)),
382
+ swapUsedMb: kbToMb(Math.max(0, swapTotalKb - swapFreeKb)),
383
+ hostAvailableMb: null
384
+ };
385
+ }
386
+ function detectSandbox(deps = {}) {
387
+ const platform = deps.platform ?? process.platform;
388
+ if (platform !== "linux") return false;
389
+ for (const marker of SANDBOX_MARKER_PATHS) {
390
+ if (tryExists(deps, marker)) return true;
391
+ }
392
+ const selfCgroup = tryReadText(deps, PROC_SELF_CGROUP_PATH);
393
+ return selfCgroup !== null && SANDBOX_CGROUP_PATTERN.test(selfCgroup);
394
+ }
395
+ function readOsView(deps) {
396
+ const os = deps.os ?? { totalmem: osTotalmem, freemem: osFreemem };
397
+ try {
398
+ const totalMb = toMbFromBytes(os.totalmem());
399
+ const availableMb = toMbFromBytes(os.freemem());
400
+ if (!(totalMb > 0) || !Number.isFinite(availableMb)) return null;
401
+ return {
402
+ source: "os",
403
+ totalMb,
404
+ availableMb: Math.max(0, availableMb),
405
+ // os 没有可移植的 swap 口径:按契约显示 n/a,而不是编一个数字。
406
+ swapTotalMb: null,
407
+ swapUsedMb: null,
408
+ hostAvailableMb: null
409
+ };
410
+ } catch {
411
+ return null;
412
+ }
413
+ }
414
+ function readHostView(deps) {
415
+ const platform = deps.platform ?? process.platform;
416
+ if (platform === "linux") {
417
+ const text = tryReadText(deps, PROC_MEMINFO_PATH);
418
+ if (text !== null) {
419
+ const parsed = parseProcMeminfo(text);
420
+ if (parsed) return parsed;
421
+ }
422
+ }
423
+ return readOsView(deps);
424
+ }
425
+ function parseCgroup2RelativePath(text) {
426
+ for (const line of text.split("\n")) {
427
+ const trimmed = line.trim();
428
+ if (!trimmed) continue;
429
+ const parts = trimmed.split(":");
430
+ if (parts.length < 3 || parts[0] !== "0" || parts[1] !== "") continue;
431
+ const path = parts.slice(2).join(":").trim();
432
+ if (!path) continue;
433
+ return path.startsWith("/") ? path : `/${path}`;
434
+ }
435
+ return null;
436
+ }
437
+ function parseCgroup2MountPoint(mountsText) {
438
+ for (const line of mountsText.split("\n")) {
439
+ const fields = line.trim().split(/\s+/);
440
+ if (fields.length < 3) continue;
441
+ if (fields[2] !== "cgroup2") continue;
442
+ const mountPoint = fields[1].replace(/\\040/g, " ");
443
+ if (mountPoint.startsWith("/")) return mountPoint;
444
+ }
445
+ return null;
446
+ }
447
+ function cgroupAncestorDirs(mountPoint, relativePath) {
448
+ const base = mountPoint.length > 1 && mountPoint.endsWith("/") ? mountPoint.slice(0, -1) : mountPoint;
449
+ const dirs = [];
450
+ if (relativePath && relativePath !== "/") {
451
+ const rel = relativePath.startsWith("/") ? relativePath : `/${relativePath}`;
452
+ const segments = rel.split("/").filter(Boolean);
453
+ for (let depth = segments.length; depth >= 1; depth -= 1) {
454
+ dirs.push(`${base}/${segments.slice(0, depth).join("/")}`);
455
+ }
456
+ }
457
+ dirs.push(base);
458
+ return dirs;
459
+ }
460
+ function readCgroupMaxMb(deps, dir) {
461
+ const maxText = tryReadText(deps, `${dir}/memory.max`);
462
+ if (maxText === null) return null;
463
+ const maxRaw = maxText.trim();
464
+ if (maxRaw === "" || maxRaw === "max") return null;
465
+ const maxBytes = Number.parseInt(maxRaw, 10);
466
+ if (!Number.isFinite(maxBytes) || maxBytes <= 0) return null;
467
+ const totalMb = toMbFromBytes(maxBytes);
468
+ return totalMb > 0 ? totalMb : null;
469
+ }
470
+ function buildCgroupSnapshot(deps, dir, totalMb, hostView) {
471
+ const currentText = tryReadText(deps, `${dir}/memory.current`);
472
+ let usedMb = null;
473
+ if (currentText !== null) {
474
+ const currentBytes = Number.parseInt(currentText.trim(), 10);
475
+ if (Number.isFinite(currentBytes)) {
476
+ usedMb = Math.min(totalMb, Math.max(0, toMbFromBytes(currentBytes)));
477
+ }
478
+ }
479
+ return {
480
+ source: "cgroup",
481
+ totalMb,
482
+ availableMb: usedMb === null ? null : Math.max(0, totalMb - usedMb),
483
+ // swap 不是 cgroup 配额的一部分,只能借宿主视角(Linux 上就是 /proc/meminfo)。
484
+ swapTotalMb: hostView?.swapTotalMb ?? null,
485
+ swapUsedMb: hostView?.swapUsedMb ?? null,
486
+ hostAvailableMb: hostView?.availableMb ?? null
487
+ };
488
+ }
489
+ function readCgroupLimitView(deps, hostView) {
490
+ const selfCgroupText = tryReadText(deps, PROC_SELF_CGROUP_PATH) ?? "";
491
+ const relativePath = parseCgroup2RelativePath(selfCgroupText);
492
+ const mountsText = tryReadText(deps, PROC_MOUNTS_PATH) ?? "";
493
+ const mountPoint = parseCgroup2MountPoint(mountsText) ?? DEFAULT_CGROUP2_MOUNT;
494
+ let limitingDir = null;
495
+ let limitingMb = Number.POSITIVE_INFINITY;
496
+ for (const dir of cgroupAncestorDirs(mountPoint, relativePath)) {
497
+ const totalMb = readCgroupMaxMb(deps, dir);
498
+ if (totalMb === null) continue;
499
+ if (totalMb < limitingMb) {
500
+ limitingMb = totalMb;
501
+ limitingDir = dir;
502
+ }
503
+ }
504
+ if (limitingDir === null) return null;
505
+ return buildCgroupSnapshot(deps, limitingDir, limitingMb, hostView);
506
+ }
507
+ function readHostMemory(deps = {}) {
508
+ const platform = deps.platform ?? process.platform;
509
+ if (platform !== "linux") {
510
+ return readHostView(deps);
511
+ }
512
+ const hostView = readHostView(deps);
513
+ const cgroupView = readCgroupLimitView(deps, hostView);
514
+ if (!cgroupView) return hostView;
515
+ return {
516
+ ...cgroupView,
517
+ scope: detectSandbox(deps) ? "sandbox" : "cgroup-limit"
518
+ };
519
+ }
520
+ function isHostMemoryTight(mem) {
521
+ if (!(mem.totalMb > 0)) return false;
522
+ if (mem.availableMb !== null && mem.availableMb / mem.totalMb < MEMORY_AVAILABLE_RATIO_THRESHOLD) {
523
+ return true;
524
+ }
525
+ if (mem.swapTotalMb !== null && mem.swapUsedMb !== null && mem.swapTotalMb > 0 && mem.swapUsedMb / mem.swapTotalMb > SWAP_USED_RATIO_THRESHOLD) {
526
+ return true;
527
+ }
528
+ return false;
529
+ }
530
+ function formatHostMemoryMb(mb) {
531
+ const value = Math.max(0, Math.round(Number.isFinite(mb) ? mb : 0));
532
+ if (value >= 1024) return `${(value / 1024).toFixed(1)}G`;
533
+ return `${value}M`;
534
+ }
535
+ function formatSwapPart(mem) {
536
+ if (mem.swapTotalMb === null || mem.swapUsedMb === null) return "swap n/a";
537
+ return `swap ${formatHostMemoryMb(mem.swapUsedMb)}/${formatHostMemoryMb(mem.swapTotalMb)}`;
538
+ }
539
+ function formatHostMemoryLine(mem) {
540
+ const usedMb = mem.availableMb === null ? null : Math.max(0, mem.totalMb - mem.availableMb);
541
+ let line;
542
+ if (mem.source === "cgroup") {
543
+ const hostAvailable = mem.hostAvailableMb === null ? "n/a" : formatHostMemoryMb(mem.hostAvailableMb);
544
+ const prefix = (mem.scope ?? "sandbox") === "cgroup-limit" ? "[\u9650\u989D] \u672C\u8FDB\u7A0B\u5185\u5B58" : "[sandbox] \u5BB9\u5668\u5185\u5B58";
545
+ const usage = usedMb === null ? "\u5360\u7528\u672A\u77E5" : formatHostMemoryMb(usedMb);
546
+ line = `${prefix} ${usage}/${formatHostMemoryMb(mem.totalMb)} \xB7 \u5BBF\u4E3B\u53EF\u7528 ${hostAvailable}`;
547
+ } else {
548
+ const available = mem.availableMb === null ? "n/a" : formatHostMemoryMb(mem.availableMb);
549
+ line = `\u672C\u5730\u5185\u5B58 ${formatHostMemoryMb(usedMb ?? 0)}/${formatHostMemoryMb(mem.totalMb)}\uFF08\u53EF\u7528 ${available}\uFF09\xB7 ${formatSwapPart(mem)}`;
550
+ }
551
+ return isHostMemoryTight(mem) ? `${line} \xB7 ${HOST_MEMORY_PRESSURE_HINT}` : line;
552
+ }
553
+
327
554
  // packages/cli/client/localRuntimeHelpers.ts
328
555
  var REMOTE_DIALOG_SYNC_TIMEOUT_MS = 1e4;
329
556
  var remoteDialogSyncTimeoutMsForTest;
@@ -1183,6 +1410,29 @@ function buildAgentRunChildCommand(options, deps = {}) {
1183
1410
  }
1184
1411
  return { execPath, childArgs: [entrypoint, ...commandParts, ...strippedArgs] };
1185
1412
  }
1413
+ function safeReadHostMemory(reader) {
1414
+ try {
1415
+ return reader();
1416
+ } catch {
1417
+ return null;
1418
+ }
1419
+ }
1420
+ function emitHostMemoryNotice(mem, output) {
1421
+ if (!mem || !output) return void 0;
1422
+ let notice;
1423
+ try {
1424
+ notice = formatHostMemoryLine(mem);
1425
+ } catch {
1426
+ return void 0;
1427
+ }
1428
+ try {
1429
+ output.write(`${notice}
1430
+ `);
1431
+ } catch {
1432
+ return notice;
1433
+ }
1434
+ return notice;
1435
+ }
1186
1436
  async function spawnLocalBackgroundRun(input, deps = {}) {
1187
1437
  const env = deps.env ?? process.env;
1188
1438
  const homedir = deps.homedir ?? nodeHomedir;
@@ -1266,6 +1516,7 @@ async function spawnLocalBackgroundRun(input, deps = {}) {
1266
1516
  NOLO_AGENT_RUN_CHILD: "1",
1267
1517
  NOLO_AGENT_RUN_ID: runId
1268
1518
  };
1519
+ const hostMemory = safeReadHostMemory(deps.readHostMemory ?? readHostMemory);
1269
1520
  const logFd = fs.openSync(logPath, "a");
1270
1521
  const proc = spawn(execPath, childArgs, {
1271
1522
  cwd: input.cwd,
@@ -1283,6 +1534,7 @@ async function spawnLocalBackgroundRun(input, deps = {}) {
1283
1534
  proc.channel?.unref?.();
1284
1535
  }
1285
1536
  proc.unref();
1537
+ const hostMemoryNotice = emitHostMemoryNotice(hostMemory, input.output);
1286
1538
  if (typeof proc.pid === "number") {
1287
1539
  const processStartedAt = (deps.getProcessStartTime ?? defaultGetProcessStartTime)(proc.pid);
1288
1540
  withRunRecordLock(runId, deps, () => {
@@ -1292,7 +1544,14 @@ async function spawnLocalBackgroundRun(input, deps = {}) {
1292
1544
  writeRunRecord(latest, deps);
1293
1545
  });
1294
1546
  }
1295
- return { runId, pid: proc.pid, logPath, queuePath, batchId };
1547
+ return {
1548
+ runId,
1549
+ pid: proc.pid,
1550
+ logPath,
1551
+ queuePath,
1552
+ batchId,
1553
+ ...hostMemoryNotice ? { hostMemoryNotice } : {}
1554
+ };
1296
1555
  }
1297
1556
  function ackRunRecord(runId, deps = {}) {
1298
1557
  withRunRecordLock(runId, deps, () => {
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-WWC7I6TA.js";
4
4
  import {
5
5
  trimTrailingSlash
6
- } from "./chunk-SUKSWFLP.js";
6
+ } from "./chunk-PIG2IUVZ.js";
7
7
  import {
8
8
  toErrorMessage
9
9
  } from "./chunk-HNMXYYJR.js";
@@ -0,0 +1,188 @@
1
+ import {
2
+ shouldUseServerProxy
3
+ } from "./chunk-F3SOW2EU.js";
4
+ import {
5
+ ANTIGRAVITY_CLOUD_CODE_BASE_URL,
6
+ isAntigravityCloudCodeBaseUrl,
7
+ isAntigravityOAuthAgent
8
+ } from "./chunk-SQX235S2.js";
9
+ import {
10
+ isOpenAiResponsesModel,
11
+ resolvePlatformChatCompletionsEndpoint,
12
+ resolvePlatformResponsesEndpoint
13
+ } from "./chunk-V7PCFWX3.js";
14
+ import {
15
+ findModelConfig
16
+ } from "./chunk-6EQD4AQL.js";
17
+ import {
18
+ asOptionalTrimmedString
19
+ } from "./chunk-G3SUCT4W.js";
20
+ import {
21
+ asTrimmedLowercaseString
22
+ } from "./chunk-QSJ3HFEF.js";
23
+
24
+ // packages/agent-runtime/agentCallPlan.ts
25
+ var CODEX_RESPONSES_URL = "https://chatgpt.com/backend-api/codex/responses";
26
+ var CURSOR_AGENT_URL = "https://api2.cursor.sh/agent.v1.AgentService/Run";
27
+ var DEVIN_CONNECT_URL = "https://server.codeium.com/exa.api_server_pb.ApiServerService/GetChatMessage";
28
+ function resolveClientWire(plan) {
29
+ if (plan.upstreamWire === "gemini-cca") return "chat.completions";
30
+ if (plan.upstreamWire === "anthropic-messages") return "chat.completions";
31
+ if (plan.upstreamWire === "cursor-connect") return "chat.completions";
32
+ if (plan.upstreamWire === "devin-connect") return "chat.completions";
33
+ if (plan.upstreamWire === "custom-gemini") return "chat.completions";
34
+ if (plan.upstreamWire === "custom-openai-responses") return "chat.completions";
35
+ if (plan.upstreamWire === "custom-anthropic-messages") return "chat.completions";
36
+ if (plan.upstreamWire === "responses" && plan.authMethod.kind === "oauth" && plan.authMethod.ref === "chatgpt") {
37
+ return "chat.completions";
38
+ }
39
+ return plan.upstreamWire;
40
+ }
41
+ var XAI_CHAT_COMPLETIONS_URL = "https://api.x.ai/v1/chat/completions";
42
+ var ANTHROPIC_MESSAGES_URL = "https://api.anthropic.com/v1/messages";
43
+ var CODEX_REQUIRED_HEADERS = [
44
+ "chatgpt-account-id",
45
+ "OpenAI-Beta",
46
+ "originator",
47
+ "version"
48
+ ];
49
+ var ANTIGRAVITY_REQUIRED_HEADERS = [
50
+ "User-Agent"
51
+ // antigravity-specific UA (matches getAntigravityUserAgent)
52
+ ];
53
+ function agentShouldUseServerProxy(agentConfig) {
54
+ return shouldUseServerProxy(agentConfig);
55
+ }
56
+ function resolveCustomUpstreamWire(endpoint, nativeProtocol) {
57
+ const responsesEndpoint = endpoint.includes("/responses");
58
+ if (nativeProtocol === "openai-responses" && responsesEndpoint) return "responses";
59
+ if (nativeProtocol === "gemini") return "custom-gemini";
60
+ if (nativeProtocol === "openai-responses") return "custom-openai-responses";
61
+ if (nativeProtocol === "anthropic-messages") return "custom-anthropic-messages";
62
+ return responsesEndpoint ? "responses" : "chat.completions";
63
+ }
64
+ function hasOwnCustomProviderKey(agentConfig) {
65
+ const endpoint = asOptionalTrimmedString(agentConfig.customProviderUrl);
66
+ if (!endpoint) return false;
67
+ if (isAntigravityCloudCodeBaseUrl(endpoint)) return false;
68
+ return Boolean(asOptionalTrimmedString(agentConfig.apiKey));
69
+ }
70
+ function resolveAgentCallPlan(agentConfig, _env) {
71
+ const apiKeyRef = asTrimmedLowercaseString(agentConfig.apiKeyRef);
72
+ const provider = asTrimmedLowercaseString(
73
+ agentConfig.provider ?? agentConfig.apiSource
74
+ );
75
+ const ownCustomKeyWins = hasOwnCustomProviderKey(agentConfig);
76
+ const oauthApiKeyRef = ownCustomKeyWins ? "" : apiKeyRef;
77
+ if (!ownCustomKeyWins && isAntigravityOAuthAgent(agentConfig)) {
78
+ return {
79
+ authMethod: { kind: "oauth", ref: "antigravity" },
80
+ transport: "server-proxy",
81
+ upstreamWire: "gemini-cca",
82
+ endpoint: ANTIGRAVITY_CLOUD_CODE_BASE_URL,
83
+ requiredHeaders: [...ANTIGRAVITY_REQUIRED_HEADERS],
84
+ vendor: provider || "google-antigravity"
85
+ };
86
+ }
87
+ if (oauthApiKeyRef === "chatgpt") {
88
+ return {
89
+ authMethod: { kind: "oauth", ref: "chatgpt" },
90
+ transport: "server-proxy",
91
+ upstreamWire: "responses",
92
+ endpoint: CODEX_RESPONSES_URL,
93
+ requiredHeaders: [...CODEX_REQUIRED_HEADERS],
94
+ vendor: provider || "openai"
95
+ };
96
+ }
97
+ if (oauthApiKeyRef === "claude") {
98
+ return {
99
+ authMethod: { kind: "oauth", ref: "claude" },
100
+ transport: "server-proxy",
101
+ upstreamWire: "anthropic-messages",
102
+ endpoint: ANTHROPIC_MESSAGES_URL,
103
+ requiredHeaders: ["anthropic-version", "anthropic-beta"],
104
+ vendor: provider || "anthropic"
105
+ };
106
+ }
107
+ if (oauthApiKeyRef === "xai") {
108
+ return {
109
+ authMethod: { kind: "oauth", ref: "xai" },
110
+ transport: "server-proxy",
111
+ upstreamWire: "chat.completions",
112
+ endpoint: XAI_CHAT_COMPLETIONS_URL,
113
+ requiredHeaders: [],
114
+ vendor: provider || "xai"
115
+ };
116
+ }
117
+ if (oauthApiKeyRef === "cursor") {
118
+ return {
119
+ authMethod: { kind: "oauth", ref: "cursor" },
120
+ transport: "server-proxy",
121
+ upstreamWire: "cursor-connect",
122
+ endpoint: CURSOR_AGENT_URL,
123
+ requiredHeaders: [
124
+ "x-cursor-client-version",
125
+ "x-cursor-client-type",
126
+ "x-ghost-mode"
127
+ ],
128
+ vendor: provider || "cursor"
129
+ };
130
+ }
131
+ if (oauthApiKeyRef === "devin" || !ownCustomKeyWins && provider === "devin") {
132
+ return {
133
+ authMethod: { kind: "oauth", ref: "devin" },
134
+ transport: "server-proxy",
135
+ upstreamWire: "devin-connect",
136
+ endpoint: DEVIN_CONNECT_URL,
137
+ requiredHeaders: ["connect-protocol-version"],
138
+ vendor: provider || "devin"
139
+ };
140
+ }
141
+ if (agentConfig.cliProvider || agentConfig.apiSource === "cli" || provider === "cli") {
142
+ return {
143
+ authMethod: { kind: "cli", provider: agentConfig.cliProvider || provider || "codex" },
144
+ transport: "direct",
145
+ upstreamWire: "cli",
146
+ endpoint: "",
147
+ requiredHeaders: [],
148
+ vendor: provider || "cli"
149
+ };
150
+ }
151
+ if (agentConfig.customProviderUrl || agentConfig.apiSource === "custom") {
152
+ const transport2 = agentShouldUseServerProxy(agentConfig) ? "server-proxy" : "direct";
153
+ const endpoint2 = asOptionalTrimmedString(agentConfig.customProviderUrl) ?? "";
154
+ const upstreamWire2 = resolveCustomUpstreamWire(
155
+ endpoint2,
156
+ findModelConfig(provider, agentConfig.model ?? "")?.nativeProtocol
157
+ );
158
+ return {
159
+ authMethod: { kind: "custom-key" },
160
+ transport: transport2,
161
+ upstreamWire: upstreamWire2,
162
+ endpoint: endpoint2,
163
+ requiredHeaders: [],
164
+ vendor: provider || "custom"
165
+ };
166
+ }
167
+ const transport = agentShouldUseServerProxy(agentConfig) ? "server-proxy" : "direct";
168
+ const useResponses = isOpenAiResponsesModel({
169
+ provider,
170
+ model: agentConfig.model,
171
+ endpointKey: agentConfig.endpointKey
172
+ });
173
+ const upstreamWire = useResponses ? "responses" : "chat.completions";
174
+ const endpoint = upstreamWire === "responses" ? resolvePlatformResponsesEndpoint(provider, agentConfig.model) ?? "" : resolvePlatformChatCompletionsEndpoint(provider, agentConfig.model) ?? "";
175
+ return {
176
+ authMethod: { kind: "platform-key" },
177
+ transport,
178
+ upstreamWire,
179
+ endpoint,
180
+ requiredHeaders: [],
181
+ vendor: provider || "openai"
182
+ };
183
+ }
184
+
185
+ export {
186
+ resolveClientWire,
187
+ resolveAgentCallPlan
188
+ };