nolo-cli 0.156.0-alpha.3 → 0.156.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 (164) hide show
  1. package/{_executeModel-5WS2PA62.js → _executeModel-3FMHTHSS.js} +55 -55
  2. package/{accountResolver-7RYB4D2P.js → accountResolver-55EDKEIK.js} +1 -1
  3. package/{action-ZJYUBXFC.js → action-GPPJC5TI.js} +5 -5
  4. package/{addContentAction-TVHB4526.js → addContentAction-XJQEJ4XW.js} +8 -8
  5. package/{addDialogAgentAction-FDPBU6K6.js → addDialogAgentAction-5WZX5CAY.js} +7 -7
  6. package/{agentDeleteCommand-MDC7OS3I.js → agentDeleteCommand-VRHLJZKX.js} +75 -76
  7. package/{agentEmailCommands-WN4EOPKQ.js → agentEmailCommands-YGBQXOL3.js} +78 -79
  8. package/{agentListCommands-G36AMSBR.js → agentListCommands-GOCGOQUB.js} +36 -36
  9. package/{agentMachineCommands-63GXO27A.js → agentMachineCommands-FBAWZYHI.js} +35 -32
  10. package/{agentProviderCommands-X2HQE6HY.js → agentProviderCommands-CXBHNONN.js} +5 -5
  11. package/{agentPullCommand-FA43RBRU.js → agentPullCommand-GXXEDOSA.js} +4 -4
  12. package/{agentRecordCommands-X4WJRHDW.js → agentRecordCommands-KAK2G56H.js} +72 -73
  13. package/{agentRunCommand-4YMIVVHF.js → agentRunCommand-62P3AGJA.js} +75 -75
  14. package/{agentRunControl-2C5GM3BW.js → agentRunControl-XBSNHHZE.js} +7 -7
  15. package/{agentRuntimeLocal-Q7ZOMZC7.js → agentRuntimeLocal-J6I63NZC.js} +21 -19
  16. package/{agentSlice-E3XS5FTQ.js → agentSlice-IZFU3WWH.js} +8 -8
  17. package/{appDeleteCommands-MMWT54BR.js → appDeleteCommands-KKLAK2UR.js} +31 -29
  18. package/{appDeployCommands-OIFXVDOF.js → appDeployCommands-PXWK4FAX.js} +31 -29
  19. package/{appDeployStatusCommands-OTXMSDFB.js → appDeployStatusCommands-3NGWDZTX.js} +31 -29
  20. package/{appGetCommands-JPY36ANL.js → appGetCommands-APWYPEO3.js} +31 -29
  21. package/{appListCommands-IHJGN36O.js → appListCommands-OP7IRALO.js} +31 -29
  22. package/{authCommand-J3XILHWW.js → authCommand-3Z52KJID.js} +22 -302
  23. package/{authCommands-77CHYBGF.js → authCommands-QOCKVPX3.js} +5 -5
  24. package/{builtinSkillRegistry-A6VSPJEJ.js → builtinSkillRegistry-LJV7FHNI.js} +4 -4
  25. package/{chromeCommands-OBBNJCLS.js → chromeCommands-IY4NVSXZ.js} +17 -10
  26. package/{chunk-SW4S4XYB.js → chunk-2AB2HA4M.js} +84 -34
  27. package/{chunk-H4KACZMG.js → chunk-2QQ7D3P5.js} +271 -138
  28. package/{chunk-C5VPAHIU.js → chunk-32ZKZET7.js} +1 -1
  29. package/{chunk-FPWT3RH2.js → chunk-36IWXF25.js} +22 -22
  30. package/{chunk-XPWGOTBQ.js → chunk-3L2WKC3W.js} +1 -8
  31. package/{chunk-3XZKV7QQ.js → chunk-3L5MSPWX.js} +1 -1
  32. package/{chunk-QLQ573SU.js → chunk-3M52COK5.js} +120 -0
  33. package/{chunk-Z6KQDSZW.js → chunk-43OFVLWJ.js} +6 -6
  34. package/{chunk-7A4LJCDR.js → chunk-4FDDVVCE.js} +5 -5
  35. package/{chunk-TJ2VPCBE.js → chunk-4JCAW7TO.js} +2 -2
  36. package/{chunk-6TF64IF2.js → chunk-4L4K6YR7.js} +16 -2
  37. package/{chunk-ZG73GDYU.js → chunk-5E5VB7PS.js} +332 -59
  38. package/{chunk-HKT6QXP3.js → chunk-5IKRTRRR.js} +5 -5
  39. package/{chunk-P5QACQDK.js → chunk-62TBKWTV.js} +1 -1
  40. package/{chunk-TRW43TSC.js → chunk-6EQD4AQL.js} +41 -1
  41. package/{chunk-RUNKPFM5.js → chunk-6QIBWOPT.js} +12 -8
  42. package/{chunk-YLMMECCH.js → chunk-6XIE5ZGI.js} +1 -1
  43. package/{chunk-7GC3EKUG.js → chunk-7PDNSQZC.js} +3 -3
  44. package/{chunk-DW7MGLMG.js → chunk-7YQQXP42.js} +35 -207
  45. package/{chunk-WZ6OU4NX.js → chunk-BAWAKW7X.js} +2 -2
  46. package/{chunk-UUPR3TD7.js → chunk-BL4HFN6L.js} +2 -4
  47. package/{chunk-2GGXHQIW.js → chunk-BLVSFYQ3.js} +4 -2
  48. package/{chunk-HP6O6LTV.js → chunk-CDLP56BS.js} +9 -9
  49. package/{chunk-4LRK5Q2Z.js → chunk-CI6YDDL2.js} +18 -17
  50. package/{chunk-5MM7NNO6.js → chunk-CNWKLQRL.js} +8 -3
  51. package/{chunk-UTIMX333.js → chunk-DJ2BOPJY.js} +1 -1
  52. package/{chunk-36OMEXXR.js → chunk-DLV3H464.js} +8 -8
  53. package/{chunk-X5SUT4CN.js → chunk-EDJND3FK.js} +6 -6
  54. package/{chunk-CE7PIHQD.js → chunk-ESMZW5PE.js} +3 -3
  55. package/{chunk-PSJWPSKS.js → chunk-EWO77ZGF.js} +9 -43
  56. package/{chunk-ZWG3C7VI.js → chunk-F3SOW2EU.js} +81 -1
  57. package/{chunk-FY4SDK2E.js → chunk-FDLDMJTM.js} +1 -1
  58. package/chunk-FTHF2P2I.js +2685 -0
  59. package/{chunk-7KYVUFDG.js → chunk-G3VYRPTV.js} +5 -267
  60. package/{chunk-NQ64VVAI.js → chunk-GXZZOTDM.js} +826 -689
  61. package/{chunk-6MJNEXUU.js → chunk-HGDKT2D6.js} +4 -0
  62. package/{chunk-6KVZAZJA.js → chunk-HRZW3SQN.js} +7 -7
  63. package/{chunk-B2EGWZJG.js → chunk-I7S63QUU.js} +1 -1
  64. package/{chunk-ROPSATAB.js → chunk-IF7V3CBU.js} +1 -1
  65. package/{chunk-T6CBQ6BN.js → chunk-INFHX73M.js} +1 -1
  66. package/{chunk-YBNHPX4S.js → chunk-IW64YHXL.js} +155 -31
  67. package/{chunk-VSOWPETY.js → chunk-JIAZK434.js} +10 -10
  68. package/{chunk-K43ZF2C3.js → chunk-JPPQ3GUO.js} +1 -1
  69. package/{chunk-TZTWMGE3.js → chunk-JWEXJ573.js} +3 -3
  70. package/{chunk-OH2M7WEU.js → chunk-K3N2DWLT.js} +3 -3
  71. package/{chunk-I2ZMGXXF.js → chunk-KFHREHUQ.js} +1 -1
  72. package/{chunk-3C2QLERX.js → chunk-KMDDG73K.js} +1 -1
  73. package/{chunk-EM3YOZJ4.js → chunk-L2JMH4I5.js} +3 -3
  74. package/{chunk-D4OWHT5Y.js → chunk-MAYW6V3E.js} +2 -2
  75. package/{chunk-IPAW7XLD.js → chunk-MFVOJ6KF.js} +2 -2
  76. package/{chunk-CBHGZRCE.js → chunk-MYOH447Z.js} +1 -1
  77. package/{chunk-6MPAEODB.js → chunk-NHEWV5FD.js} +17 -3
  78. package/{chunk-SUKSWFLP.js → chunk-PIG2IUVZ.js} +1 -1
  79. package/{chunk-WP6RXNE6.js → chunk-PNACBSRF.js} +134 -126
  80. package/{chunk-SEJ5OS6F.js → chunk-PXYBUFDB.js} +4 -0
  81. package/{chunk-SKPPKHD3.js → chunk-Q5LVXPGT.js} +2 -2
  82. package/{chunk-2MTE2PEH.js → chunk-QA2C5NKI.js} +5 -739
  83. package/{chunk-XFKZ3MCV.js → chunk-QFL42TMV.js} +251 -77
  84. package/{chunk-L6EQV5OC.js → chunk-QXZH5UDF.js} +3 -3
  85. package/{chunk-TNIX77YM.js → chunk-R5GO3YZP.js} +34 -1
  86. package/{chunk-4Z245KOA.js → chunk-SH3XD4E2.js} +8 -4
  87. package/{chunk-MM3662RS.js → chunk-SNAWGDXT.js} +263 -4
  88. package/{chunk-JGRPBIZZ.js → chunk-SQX235S2.js} +1 -1
  89. package/chunk-TT644UJD.js +188 -0
  90. package/{chunk-IYBIRCQV.js → chunk-U34KT53V.js} +29 -11
  91. package/{chunk-KOB75UNU.js → chunk-U5U4WAFS.js} +19 -3
  92. package/{chunk-ANJTRG52.js → chunk-ULQAD7ZY.js} +18 -43
  93. package/{chunk-FDT27L7S.js → chunk-UUPXTEZA.js} +19 -17
  94. package/{chunk-QDA4Y5O6.js → chunk-V67W64OY.js} +21 -17
  95. package/{chunk-I2RMFLLH.js → chunk-V7PCFWX3.js} +1 -1
  96. package/{chunk-HXHSTRGH.js → chunk-VYNMQ6HW.js} +0 -27
  97. package/{chunk-G47IPDOK.js → chunk-W7FGZRLK.js} +1 -1
  98. package/{chunk-7BSQK2UC.js → chunk-WRCZXJ4N.js} +2 -2
  99. package/{chunk-KX6LPG7W.js → chunk-WYJTNSVL.js} +9 -9
  100. package/chunk-Y5GCAMGP.js +9 -0
  101. package/{chunk-JZX2XLKC.js → chunk-YCRROBDY.js} +1 -1
  102. package/{chunk-SCJD2PNK.js → chunk-YPG7TUQD.js} +3 -3
  103. package/{chunk-YANF2RR4.js → chunk-ZPKUJROL.js} +1 -1
  104. package/{chunk-TYND6RDQ.js → chunk-ZZDVBZOP.js} +74 -3
  105. package/{commandRegistry-NE2JOCQT.js → commandRegistry-2DDDET7G.js} +88 -96
  106. package/{contentThunks-B3FRQGP7.js → contentThunks-5DNEHJ2Z.js} +21 -21
  107. package/{createAgentAutomationAction-T2YFJ6MY.js → createAgentAutomationAction-4SUS2EFX.js} +21 -21
  108. package/{createDialogAction-2NFGFBXW.js → createDialogAction-JSFXX6JE.js} +25 -25
  109. package/{createPageAction-LDAVZDN7.js → createPageAction-37HHOXZ2.js} +24 -25
  110. package/{dbSlice-5QGKMQLO.js → dbSlice-6PVPY44C.js} +7 -7
  111. package/{deleteFile-EW6QNRRT.js → deleteFile-YM6NDPAR.js} +5 -5
  112. package/{dialogCommands-H3K7PTF6.js → dialogCommands-ZJRMCP4S.js} +35 -32
  113. package/{dialogSlice-64S3J6CP.js → dialogSlice-2Z66AWEW.js} +20 -20
  114. package/{dist-NJC2W7I4.js → dist-Q2JSMAKA.js} +7 -361
  115. package/{docCreateCommands-KP64KMVL.js → docCreateCommands-KQHQNLRX.js} +32 -30
  116. package/{docDeleteCommands-C3F4SZSR.js → docDeleteCommands-O3DWFX2W.js} +33 -31
  117. package/{docReadCommands-7H6BDOUR.js → docReadCommands-2U2BUONC.js} +32 -30
  118. package/{docStore-NIP7OO4I.js → docStore-XMTUF3GX.js} +8 -8
  119. package/{docUpdateCommands-JDW4BRBH.js → docUpdateCommands-MF3C52XI.js} +32 -30
  120. package/{getPricing-TX35D7PI.js → getPricing-XQ3N3RBP.js} +2 -2
  121. package/{handleSendMessageAction-TOKA7ED7.js → handleSendMessageAction-4VFVXTF2.js} +43 -39
  122. package/index.js +8 -8
  123. package/{localRuntimeAdapter-OPPDLUG3.js → localRuntimeAdapter-KKIVRYVN.js} +70 -69
  124. package/{localRuntimeAuthority-JDAD7CB6.js → localRuntimeAuthority-BPN5OAQG.js} +2 -2
  125. package/{localRuntimeDb-CVC62PM5.js → localRuntimeDb-QIVAXMUL.js} +1 -1
  126. package/{machineCommands-OPLQR7XY.js → machineCommands-UHQVCOD3.js} +80 -79
  127. package/{machineWsRunDispatch-PTS42QDK.js → machineWsRunDispatch-TX4X7TOJ.js} +70 -71
  128. package/{memberThunks-KRV5YXOB.js → memberThunks-AZINUM4S.js} +10 -10
  129. package/package.json +6 -2
  130. package/{profileConfig-ZGOFORWV.js → profileConfig-KN3N2BLF.js} +7 -1
  131. package/{providerPresetApply-CRZFMQD5.js → providerPresetApply-PKUOHQJT.js} +5 -5
  132. package/{providerRegistry-7IS43D3X.js → providerRegistry-HNQLIFN2.js} +5 -5
  133. package/{read-5KAZHHDM.js → read-7JPIWRBQ.js} +5 -5
  134. package/{readDocTool-5QO34OSX.js → readDocTool-AAQTB2Y3.js} +1 -1
  135. package/{readlineWorkspace-3XC7SEMZ.js → readlineWorkspace-BFVB2ON5.js} +375 -200
  136. package/{removeDialogAgentAction-6X63HMI3.js → removeDialogAgentAction-RMVRILLK.js} +9 -9
  137. package/{runAgentClientLoop-5QIGEALK.js → runAgentClientLoop-HHLHNMBE.js} +59 -54
  138. package/{runtimeDoctorCommands-56NWKNON.js → runtimeDoctorCommands-MMCP4B4U.js} +12 -12
  139. package/{secretCommands-ZXZRLR3R.js → secretCommands-DNY56NSU.js} +11 -1
  140. package/{setDialogExtraReferencesAction-4MAYKKYW.js → setDialogExtraReferencesAction-L3V7JTMG.js} +8 -8
  141. package/{setPrimaryDialogAgentAction-EGBAMREH.js → setPrimaryDialogAgentAction-X52JQGTJ.js} +9 -9
  142. package/settingThunks-N6XFWPOU.js +923 -0
  143. package/{spaceCommands-JQN7D4FE.js → spaceCommands-NDPGHDMD.js} +29 -27
  144. package/{streamAgentChatTurn-456DWXNY.js → streamAgentChatTurn-KNPOLET7.js} +154 -95
  145. package/{switchDialogAgentAction-YBKTD6DO.js → switchDialogAgentAction-ZJ5CGU7J.js} +7 -7
  146. package/{tableCommands-U3QDY4L6.js → tableCommands-IVC5S7Y3.js} +11 -11
  147. package/{toolApiClient-7WSJJJBV.js → toolApiClient-HGNO53TC.js} +2 -2
  148. package/{tools-IWNXKK4Y.js → tools-ULA7XJQT.js} +43 -44
  149. package/{tuiSummaryLlmCaller-KLK6K3Q3.js → tuiSummaryLlmCaller-FESHBDTT.js} +7 -7
  150. package/{updateCommands-NQXAGFM7.js → updateCommands-FJHGWD3Q.js} +5 -3
  151. package/{updateDialogTitleAction-SX53FZWO.js → updateDialogTitleAction-VUIVBDAS.js} +21 -21
  152. package/{workloadLifecycle-36DXRZKU.js → workloadLifecycle-6O6PMISX.js} +2 -2
  153. package/chunk-IA7TRNNR.js +0 -11
  154. package/chunk-UKZX3NHN.js +0 -48
  155. package/chunk-VAZHH6FO.js +0 -7012
  156. package/chunk-W4S6OTSC.js +0 -35
  157. package/clipboardy-GCO3GT3I.js +0 -11793
  158. package/settingThunks-FTDRZNSJ.js +0 -1371
  159. package/{agentGrantCommands-HOJ3JBBQ.js → agentGrantCommands-5DPHYEKP.js} +3 -3
  160. package/{chromeOpsCommands-3Z34RKSE.js → chromeOpsCommands-GZVVK7HU.js} +4 -4
  161. package/{chunk-XETG4RIX.js → chunk-AETZ7AD6.js} +4 -4
  162. package/{chunk-2IXDJNZI.js → chunk-GAGGEA7D.js} +3 -3
  163. package/{memoryCommands-CUNBFRVS.js → memoryCommands-ZS3VQJAL.js} +3 -3
  164. package/{offlineMarxistsAgentCommand-2QTHJCHV.js → offlineMarxistsAgentCommand-3GLX4QQY.js} +3 -3
@@ -27,11 +27,11 @@ import {
27
27
  stablePromptCacheKey,
28
28
  toOpenAiCompatibleMessages,
29
29
  toResponsesTools
30
- } from "./chunk-6TF64IF2.js";
30
+ } from "./chunk-4L4K6YR7.js";
31
31
  import {
32
32
  isMeaningfulChatCompletionOutput,
33
33
  isMeaningfulResponsesOutput
34
- } from "./chunk-2MTE2PEH.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";
@@ -34,6 +34,10 @@ function canonicalizeNoloServerUrl(value) {
34
34
  }
35
35
 
36
36
  // packages/cli/client/profileConfig.ts
37
+ var PERMISSION_GRANT_KINDS = ["local", "remote"];
38
+ function permissionGrantList(grants) {
39
+ return PERMISSION_GRANT_KINDS.filter((kind) => grants?.[kind] === true);
40
+ }
37
41
  var normalizeProfileServerUrl = canonicalizeNoloServerUrl;
38
42
  function isProtectedHomeProfileWrite(path) {
39
43
  if (process.env.NODE_ENV !== "test") return false;
@@ -129,7 +133,11 @@ function buildEnvFromProfile(config) {
129
133
  ...getProfileTokens(config)[0] ? { AUTH_TOKEN: getProfileTokens(config)[0] } : {},
130
134
  ...profile.agentKey ? { NOLO_AGENT: profile.agentKey } : {},
131
135
  ...profile.agentName ? { NOLO_AGENT_NAME: profile.agentName } : {},
132
- ...profile.locale ? { NOLO_LANG: profile.locale } : {}
136
+ ...profile.locale ? { NOLO_LANG: profile.locale } : {},
137
+ ...(() => {
138
+ const granted = permissionGrantList(profile.permissionGrants);
139
+ return granted.length > 0 ? { NOLO_PERMISSION_GRANTS: granted.join(",") } : {};
140
+ })()
133
141
  };
134
142
  }
135
143
  function buildCliRuntimeEnv(processEnv, config) {
@@ -164,6 +172,28 @@ function saveProfileLocale(locale, path = getDefaultProfileConfigPath()) {
164
172
  `, "utf8");
165
173
  return config;
166
174
  }
175
+ function saveProfilePermissionGrant(kind, value, path = getDefaultProfileConfigPath()) {
176
+ if (isProtectedHomeProfileWrite(path)) return null;
177
+ const config = loadProfileConfig(path);
178
+ if (!config) return null;
179
+ const profile = config.profiles[config.currentProfile];
180
+ if (!profile) return null;
181
+ const grants = { ...profile.permissionGrants ?? {} };
182
+ if (value === true) {
183
+ grants[kind] = true;
184
+ } else {
185
+ delete grants[kind];
186
+ }
187
+ if (permissionGrantList(grants).length > 0) {
188
+ profile.permissionGrants = grants;
189
+ } else {
190
+ delete profile.permissionGrants;
191
+ }
192
+ mkdirSync(dirname(path), { recursive: true });
193
+ writeFileSync(path, `${JSON.stringify(config, null, 2)}
194
+ `, "utf8");
195
+ return config;
196
+ }
167
197
  function getAgentSelectionAuditPath(configPath = getDefaultProfileConfigPath()) {
168
198
  return join(dirname(configPath), "agent-selection.log");
169
199
  }
@@ -308,6 +338,8 @@ function saveProfileOAuthSync(provider, sync, path = getDefaultProfileConfigPath
308
338
  }
309
339
 
310
340
  export {
341
+ PERMISSION_GRANT_KINDS,
342
+ permissionGrantList,
311
343
  normalizeProfileServerUrl,
312
344
  isProtectedHomeProfileWrite,
313
345
  getDefaultProfileConfigPath,
@@ -320,6 +352,7 @@ export {
320
352
  buildCliRuntimeEnv,
321
353
  getCurrentProfile,
322
354
  saveProfileLocale,
355
+ saveProfilePermissionGrant,
323
356
  getAgentSelectionAuditPath,
324
357
  redactArgvSecrets,
325
358
  appendAgentSelectionAudit,
@@ -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";
@@ -1295,7 +1295,7 @@ var SECRETS_MANAGER_SKILL_DEFINITIONS = {
1295
1295
  1. **\u7EDD\u5BF9\u5B58\u50A8\u8DEF\u5F84**\uFF1A\`$NOLO_HOME/credentials/secrets.json\`\uFF08\u672A\u8BBE \`NOLO_HOME\` \u65F6\u56DE\u843D \`~/.nolo/credentials/secrets.json\`\uFF09\uFF0C\u6743\u9650\u4E25\u683C\u9501\u5B9A\u4E3A \`0600\`\uFF0C\u7236\u76EE\u5F55 \`0700\`\u3002
1296
1296
  2. **\u7981\u6B62\u56DE\u663E\u539F\u5219**\uFF1A
1297
1297
  - Agent \u65E0\u8BBA\u5728\u4EFB\u4F55\u60C5\u51B5\u4E0B\uFF0C**\u7EDD\u4E0D\u5728\u5BF9\u8BDD\u6D88\u606F\u3001\u65E5\u5FD7\u6216\u62A5\u544A\u4E2D\u6253\u5370\u4EFB\u4F55\u5BC6\u94A5\u660E\u6587**\uFF1B
1298
- - \u67E5\u770B\u5DF2\u4FDD\u5B58\u7684\u51ED\u636E\u4E00\u5F8B\u4F7F\u7528 \`nolo secret list\`\uFF08\u4EC5\u8F93\u51FA\u51ED\u636E\u540D\u79F0\uFF0C\u4E0D\u8F93\u51FA\u5185\u5BB9\uFF09\uFF1B
1298
+ - \u67E5\u770B\u5DF2\u4FDD\u5B58\u7684\u51ED\u636E\u4E00\u5F8B\u4F7F\u7528 \`nolo secret list\`\uFF08\u4EBA\u7C7B\u53EF\u8BFB\uFF09\u6216 \`nolo secret list --json\`\uFF08\u673A\u5668\u53EF\u8BFB\uFF0C\u4EC5\u8F93\u51FA\u51ED\u636E\u540D\u79F0\u4E0E\u5F62\u6001\uFF0C\u4E0D\u8F93\u51FA\u5185\u5BB9\uFF09\uFF1B
1299
1299
  - Agent **\u4E0D\u5F97**\u6267\u884C \`nolo secret get\`\uFF08\u8BE5\u5B50\u547D\u4EE4\u53EA\u4F9B\u4EBA\u7C7B\u8C03\u8BD5\uFF09\uFF0C\u53EA\u5141\u8BB8 \`nolo secret run --with\`\u3002
1300
1300
  3. **\u7528\u6237\u6388\u6743\u95E8\u7981**\uFF1A
1301
1301
  - \u53EA\u6709\u5F53\u7528\u6237\u5728\u5BF9\u8BDD\u4E2D\u660E\u786E\u63D0\u5230\u201C\u5141\u8BB8\u83B7\u53D6 / \u4F7F\u7528\u672C\u5730\u4FDD\u5B58\u7684 xxx \u51ED\u636E\u201D\u65F6\uFF0CAgent \u624D\u88AB\u6388\u6743\u8C03\u7528\u8BE5\u51ED\u636E\uFF1B\u672A\u83B7\u7528\u6237\u660E\u786E\u6307\u793A\u65F6\uFF0C\u4E0D\u5F97\u8BFB\u53D6\u6216\u6CE8\u5165\u3002
@@ -1305,6 +1305,8 @@ var SECRETS_MANAGER_SKILL_DEFINITIONS = {
1305
1305
  \`\`\`bash
1306
1306
  # 1. \u67E5\u770B\u5DF2\u6709\u79D8\u5BC6\uFF08\u5B89\u5168\uFF0C\u4EC5\u8F93\u51FA\u540D\u79F0\u5217\u8868\uFF0C\u7EDD\u4E0D\u6253\u5370\u5BC6\u94A5\u503C\uFF09
1307
1307
  nolo secret list
1308
+ # \u673A\u5668\u53EF\u8BFB\u7248\uFF08\u4EC5\u540D\u79F0\u4E0E\u5F62\u6001\uFF0Cagent \u7528\u5B83\u6765\u53D1\u73B0"\u6211\u4EEC\u6709\u6CA1\u6709\u76F8\u5173\u51ED\u636E"\uFF09
1309
+ nolo secret list --json
1308
1310
 
1309
1311
  # 2. \u8BBE\u7F6E\u6216\u66F4\u65B0\u51ED\u636E\uFF08\u652F\u6301\u5B57\u7B26\u4E32\u6216 JSON \u5BF9\u8C61\uFF09
1310
1312
  nolo secret set amo '{"issuer":"user:<account-id>:<key-id>","secret":"<key>"}'
@@ -1338,7 +1340,9 @@ function buildSecretsManagerSkillConfig(slug) {
1338
1340
  id: buildSecretsManagerSkillId(slug),
1339
1341
  name: seed.title,
1340
1342
  description: seed.description,
1341
- triggerMode: "manual"
1343
+ // 合法枚举是 explicit / required / recommended;"manual" 会被
1344
+ // normalizeSkillEnumValue 静默丢弃,导致 front-matter 的 triggerMode 为空。
1345
+ triggerMode: "explicit"
1342
1346
  };
1343
1347
  }
1344
1348
  function buildSecretsManagerSkillContentBySlug(slug) {
@@ -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
+ };