nolo-cli 0.141.0-alpha.2 → 0.143.0-alpha.1

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 (59) hide show
  1. package/{_executeModel-PHFKA2OL.js → _executeModel-QK43QR2R.js} +12 -12
  2. package/{agentDeleteCommand-PDOMFCIL.js → agentDeleteCommand-SE4WUIRR.js} +3 -3
  3. package/{agentEmailCommands-COB4Z4JG.js → agentEmailCommands-LW5JMYH2.js} +15 -14
  4. package/{agentListCommands-MWAR7A4K.js → agentListCommands-LGZG2OQR.js} +11 -3
  5. package/{agentMachineCommands-N5TMIAPZ.js → agentMachineCommands-BNOXYSPZ.js} +4 -4
  6. package/{agentRecordCommands-EF4O73ZD.js → agentRecordCommands-W5ZXPHZV.js} +14 -13
  7. package/{agentRunCommand-QXC6SUES.js → agentRunCommand-VRLCL57M.js} +14 -13
  8. package/{agentRuntimeLocal-F7VBM3ZK.js → agentRuntimeLocal-VOQ3UYZB.js} +3 -3
  9. package/{agentSlice-EYRJX2J6.js → agentSlice-4AK24F5F.js} +3 -3
  10. package/{appDeleteCommands-C6SHMXRO.js → appDeleteCommands-XWAIUHTN.js} +3 -3
  11. package/{appDeployCommands-TN7KPWQK.js → appDeployCommands-CBJJCUMG.js} +3 -3
  12. package/{appDeployStatusCommands-CZLHVPY3.js → appDeployStatusCommands-LTTZTJQS.js} +3 -3
  13. package/{appGetCommands-SE2MWTE2.js → appGetCommands-QHUB7MFF.js} +3 -3
  14. package/{appListCommands-J47WTLZ3.js → appListCommands-HINIDJE7.js} +3 -3
  15. package/{authCommand-CYPLLWIC.js → authCommand-LARLQ3GC.js} +57 -31
  16. package/{chatQueueReduxAdapter-YNI7ALFW.js → chatQueueReduxAdapter-KIQ3FQ62.js} +4 -4
  17. package/{chunk-SUFNELDG.js → chunk-44F6KKUE.js} +2 -2
  18. package/{chunk-ATXCJGRN.js → chunk-AAROOKLX.js} +1 -1
  19. package/{chunk-DT7WS4NV.js → chunk-DID5AVGT.js} +4 -4
  20. package/{chunk-BWSBFGQN.js → chunk-DOBBRISY.js} +6 -6
  21. package/{chunk-65U5FCBE.js → chunk-GH4MH73K.js} +1 -1
  22. package/{chunk-CRGSU5DB.js → chunk-GZQNKKDG.js} +1 -1
  23. package/{chunk-MPRDXX4T.js → chunk-K25DK52L.js} +9 -9
  24. package/{chunk-TS5BDIPV.js → chunk-KUPDS66Q.js} +8 -8
  25. package/{chunk-ESRMFY7G.js → chunk-L36OWPP3.js} +1 -1
  26. package/{chunk-X45MLRN4.js → chunk-L6RB42ZR.js} +17 -2
  27. package/{chunk-TV5ODOAF.js → chunk-MXRUAINC.js} +4 -4
  28. package/{chunk-6YT7I7KF.js → chunk-OUOJE2P2.js} +5 -5
  29. package/{chunk-W5UYXCQE.js → chunk-QDT5T7MK.js} +31 -2
  30. package/{chunk-A3JENOEB.js → chunk-T36EFAW7.js} +2 -2
  31. package/{chunk-A3OTEZGZ.js → chunk-VVUSRF5D.js} +4 -4
  32. package/{chunk-TUETDBTI.js → chunk-WTUVMKSQ.js} +2 -2
  33. package/{chunk-63ZFMDDF.js → chunk-WYYO2YOL.js} +1 -1
  34. package/{chunk-SFRMB7XN.js → chunk-ZOI6KA4N.js} +79 -9
  35. package/{chunk-HNGRBWYF.js → chunk-ZWQUWF6W.js} +33 -1
  36. package/{commandRegistry-2RDTD6CT.js → commandRegistry-DETYXF5I.js} +47 -47
  37. package/{contentThunks-2PJ4QDAV.js → contentThunks-6QBTPLWT.js} +5 -5
  38. package/{createAgentAutomationAction-SWO62RE2.js → createAgentAutomationAction-TZVIJTZ7.js} +5 -5
  39. package/{createDialogAction-2BMDM4X3.js → createDialogAction-KTDAEA42.js} +6 -6
  40. package/{createPageAction-HLSLX4R4.js → createPageAction-4RASVDAU.js} +5 -5
  41. package/{dialogCommands-LUR5GD4V.js → dialogCommands-GY7LRERG.js} +3 -3
  42. package/{dialogSlice-7IGCUDZE.js → dialogSlice-J24APUGG.js} +4 -4
  43. package/{docCreateCommands-F4JYZZXQ.js → docCreateCommands-T7KII3WP.js} +3 -3
  44. package/{docDeleteCommands-Z3QD6SGU.js → docDeleteCommands-SQ26EFE6.js} +3 -3
  45. package/{docReadCommands-UKTYKVGA.js → docReadCommands-I6NA2ZKV.js} +3 -3
  46. package/{docStore-OD3NRNBN.js → docStore-SPOGE7K3.js} +1 -1
  47. package/{docUpdateCommands-JSQCDHTL.js → docUpdateCommands-IG43SZ6U.js} +3 -3
  48. package/{handleSendMessageAction-PRF7JNOH.js → handleSendMessageAction-I2IN64DS.js} +4 -4
  49. package/index.js +2 -2
  50. package/{machineCommands-Y5QYMVTJ.js → machineCommands-U7VABJPW.js} +14 -13
  51. package/{machineWsRunDispatch-4DWFWYZ6.js → machineWsRunDispatch-ZNU6LRNG.js} +14 -13
  52. package/{oauthTokenStore-ITEB663N.js → oauthTokenStore-PADKLNOC.js} +1 -1
  53. package/package.json +1 -1
  54. package/{readlineWorkspace-YHJMMTC7.js → readlineWorkspace-46KDFUHN.js} +13 -13
  55. package/{runAgentClientLoop-66UNGCTW.js → runAgentClientLoop-CQWLWU4W.js} +10 -10
  56. package/{spaceCommands-BPQ6XFKS.js → spaceCommands-TSBC5UWP.js} +3 -3
  57. package/{streamAgentChatTurn-6F3M4KUY.js → streamAgentChatTurn-XD5JEJXA.js} +11 -11
  58. package/{tools-VSECJ5T7.js → tools-5NAJJTFN.js} +8 -8
  59. package/{updateDialogTitleAction-WE5KY3SM.js → updateDialogTitleAction-IKZPJCRA.js} +5 -5
@@ -3,7 +3,7 @@ import {
3
3
  parseFlagWithOptionalValue,
4
4
  runCloudflareOAuthLogin,
5
5
  upsertEnvVariable
6
- } from "./chunk-ATXCJGRN.js";
6
+ } from "./chunk-AAROOKLX.js";
7
7
  import {
8
8
  ANTHROPIC_OAUTH_AUTHORIZE_URL,
9
9
  ANTHROPIC_OAUTH_CALLBACK_PORT,
@@ -38,13 +38,14 @@ import {
38
38
  readJsonBody,
39
39
  refreshAntigravityOAuthToken,
40
40
  renderDeviceCodeDisplay,
41
+ resolveServerSyncConfig,
41
42
  runAntigravityOAuthLogin,
42
43
  runOpenAiCodexBrowserPkce,
43
44
  runOpenAiCodexDeviceCode,
44
45
  startCallbackServer,
45
46
  validateXAIEndpoint,
46
47
  xaiOAuthDiscovery
47
- } from "./chunk-W5UYXCQE.js";
48
+ } from "./chunk-QDT5T7MK.js";
48
49
  import {
49
50
  defaultOpenBrowser
50
51
  } from "./chunk-VPFEPRME.js";
@@ -75,13 +76,13 @@ import "./chunk-W7XHHYWM.js";
75
76
  import {
76
77
  createOAuthTokenStore,
77
78
  resolveFreshAccessToken
78
- } from "./chunk-HNGRBWYF.js";
79
- import "./chunk-A7GB5UGH.js";
79
+ } from "./chunk-ZWQUWF6W.js";
80
+ import {
81
+ parseUserIdFromAuthToken
82
+ } from "./chunk-A7GB5UGH.js";
80
83
  import "./chunk-OLZBQWZU.js";
81
84
  import {
82
- buildEnvFromProfile,
83
85
  getProfileOAuthSync,
84
- loadProfileConfig,
85
86
  saveProfileOAuthSync
86
87
  } from "./chunk-TNIX77YM.js";
87
88
  import "./chunk-Y3PMXGLH.js";
@@ -898,27 +899,34 @@ var HELP_BY_PROVIDER = {
898
899
  cursor: CURSOR_HELP_TEXT,
899
900
  devin: DEVIN_HELP_TEXT
900
901
  };
901
- function resolveServerSyncConfig() {
902
- const envServer = process.env.NOLO_SERVER?.trim() || process.env.NOLO_SERVER_URL?.trim() || process.env.BASE_URL?.trim() || "";
903
- const envToken = process.env.AUTH_TOKEN?.trim() || process.env.NOLO_AUTH_TOKEN?.trim() || "";
904
- if (envServer && envToken) {
905
- return { serverOrigin: envServer.replace(/\/+$/, ""), authToken: envToken };
906
- }
907
- let profileServer = "";
908
- let profileToken = "";
902
+ function markCredentialServerManaged(provider, credential, syncConfig, deps) {
903
+ const output = deps.output ?? console;
904
+ const userId = parseUserIdFromAuthToken(syncConfig.authToken) || "local-user";
909
905
  try {
910
- const config = loadProfileConfig();
911
- const profileEnv = buildEnvFromProfile(config);
912
- profileServer = profileEnv.NOLO_SERVER?.trim() || "";
913
- profileToken = profileEnv.AUTH_TOKEN?.trim() || "";
914
- } catch {
915
- }
916
- const serverOrigin = (envServer || profileServer).replace(/\/+$/, "");
917
- const authToken = envToken || profileToken;
918
- if (serverOrigin && authToken) {
919
- return { serverOrigin, authToken };
906
+ const { refreshToken: _dropped, ...rest } = credential;
907
+ const tokenStore = deps.tokenStore ?? createOAuthTokenStore(
908
+ void 0,
909
+ deps.credentialMigration ?? { enableLegacyMigration: true }
910
+ );
911
+ tokenStore.write(provider, {
912
+ ...rest,
913
+ obtainedAt: credential.obtainedAt ?? Date.now(),
914
+ serverManaged: {
915
+ origin: syncConfig.serverOrigin,
916
+ userId,
917
+ syncedAt: Date.now()
918
+ }
919
+ });
920
+ output.log(
921
+ `[nolo] \u672C\u5730\u4E0D\u518D\u4FDD\u5B58 refresh token\uFF1A${provider} \u7531 ${syncConfig.serverOrigin} \u7EDF\u4E00\u5237\u65B0\uFF08\u7528\u5B8C\u5373\u53D6\uFF09\u3002`
922
+ );
923
+ return true;
924
+ } catch (err) {
925
+ output.log(
926
+ `[nolo] Warning: \u672C\u5730\u51ED\u636E\u72B6\u6001\u66F4\u65B0\u5931\u8D25\uFF08${toErrorMessage(err)}\uFF09\u3002`
927
+ );
928
+ return false;
920
929
  }
921
- return null;
922
930
  }
923
931
  async function syncCredentialToServer(provider, credential, deps) {
924
932
  const output = deps.output ?? console;
@@ -928,7 +936,7 @@ async function syncCredentialToServer(provider, credential, deps) {
928
936
  output.log(
929
937
  `[nolo] Warning: server sync requires NOLO_SERVER and AUTH_TOKEN env vars, or a configured profile. Skipping server sync.`
930
938
  );
931
- return;
939
+ return "sync_failed";
932
940
  }
933
941
  const { serverOrigin, authToken } = syncConfig;
934
942
  const url = `${serverOrigin}/api/oauth/${provider}/sync`;
@@ -951,8 +959,13 @@ async function syncCredentialToServer(provider, credential, deps) {
951
959
  })
952
960
  });
953
961
  if (res.ok) {
954
- output.log(`[nolo] Synced to ${serverOrigin}`);
955
- output.log(`[nolo] \u7F51\u9875\u7AEF\u73B0\u5728\u53EF\u4EE5\u4F7F\u7528\u8BE5\u8BA2\u9605\u4E86\u3002`);
962
+ const marked = markCredentialServerManaged(provider, credential, syncConfig, deps);
963
+ if (marked) {
964
+ output.log(`[nolo] Synced to ${serverOrigin}`);
965
+ output.log(`[nolo] \u7F51\u9875\u7AEF\u73B0\u5728\u53EF\u4EE5\u4F7F\u7528\u8BE5\u8BA2\u9605\u4E86\u3002`);
966
+ return "ok";
967
+ }
968
+ return "mark_failed";
956
969
  } else {
957
970
  let errorDetail = "";
958
971
  try {
@@ -963,11 +976,13 @@ async function syncCredentialToServer(provider, credential, deps) {
963
976
  output.log(
964
977
  `[nolo] Warning: server sync failed (${res.status}${errorDetail ? `: ${errorDetail}` : ""}). Token saved locally.`
965
978
  );
979
+ return "sync_failed";
966
980
  }
967
981
  } catch (err) {
968
982
  output.log(
969
983
  `[nolo] Warning: server sync failed (${err?.message ?? "network error"}). Token saved locally.`
970
984
  );
985
+ return "sync_failed";
971
986
  }
972
987
  }
973
988
  async function runAuthProviderCommand(provider, args, _ctx, deps = {}) {
@@ -997,8 +1012,15 @@ async function runAuthProviderCommand(provider, args, _ctx, deps = {}) {
997
1012
  );
998
1013
  return 1;
999
1014
  }
1000
- await syncCredentialToServer(provider, credential, deps);
1001
- return 0;
1015
+ if (credential.serverManaged) {
1016
+ error.error(
1017
+ `[nolo] ${provider} \u51ED\u636E\u5DF2\u7531 ${credential.serverManaged.origin} \u670D\u52A1\u7AEF\u6258\u7BA1\uFF08\u672C\u5730\u65E0 refreshToken\uFF09\u3002
1018
+ \u5982\u9700\u91CD\u65B0\u540C\u6B65\uFF0C\u8BF7\u8FD0\u884C: nolo auth ${provider} --sync-to-server`
1019
+ );
1020
+ return 1;
1021
+ }
1022
+ const synced = await syncCredentialToServer(provider, credential, deps);
1023
+ return synced === "ok" ? 0 : 1;
1002
1024
  }
1003
1025
  if (verify) {
1004
1026
  if (provider !== "antigravity") {
@@ -1216,7 +1238,11 @@ Store it as CLOUDFLARE_EMAIL_ROUTING_API_TOKEN:
1216
1238
  }
1217
1239
  }
1218
1240
  if (shouldSync) {
1219
- await syncCredentialToServer(provider, credential, deps);
1241
+ const syncResult = await syncCredentialToServer(provider, credential, deps);
1242
+ if (syncResult === "mark_failed") {
1243
+ error.error(`[nolo] \u51ED\u636E\u5DF2\u6210\u529F\u4E0A\u4F20\u670D\u52A1\u5668\uFF0C\u4F46\u672C\u5730\u6253\u4E0A\u6258\u7BA1\u6807\u8BB0\u5931\u8D25\u3002\u4E3A\u9632\u53CC\u65B9\u7ADE\u6001\u5237\u65B0\u5BFC\u81F4\u5931\u6548\uFF0C\u8BF7\u91CD\u65B0\u6388\u6743\u3002`);
1244
+ return 1;
1245
+ }
1220
1246
  }
1221
1247
  return 0;
1222
1248
  } catch (err) {
@@ -4,11 +4,11 @@ import {
4
4
  } from "./chunk-YPREESF4.js";
5
5
  import {
6
6
  handleSendMessage
7
- } from "./chunk-TS5BDIPV.js";
7
+ } from "./chunk-KUPDS66Q.js";
8
8
  import "./chunk-MC4XLIJ7.js";
9
9
  import "./chunk-YYLHWIW6.js";
10
10
  import "./chunk-6O4IK4V2.js";
11
- import "./chunk-TV5ODOAF.js";
11
+ import "./chunk-MXRUAINC.js";
12
12
  import "./chunk-D76D3RTR.js";
13
13
  import "./chunk-5RGU3J7P.js";
14
14
  import "./chunk-M76ECQRD.js";
@@ -25,7 +25,7 @@ import "./chunk-AGGIDPCZ.js";
25
25
  import "./chunk-RVX32KGQ.js";
26
26
  import "./chunk-F64B2W3R.js";
27
27
  import "./chunk-PSCNXBYA.js";
28
- import "./chunk-ESRMFY7G.js";
28
+ import "./chunk-L36OWPP3.js";
29
29
  import "./chunk-BYXBJQAS.js";
30
30
  import "./chunk-DWLEOOGR.js";
31
31
  import "./chunk-7KVZ5LDQ.js";
@@ -34,7 +34,7 @@ import "./chunk-3BXNTXYI.js";
34
34
  import "./chunk-W7XHHYWM.js";
35
35
  import "./chunk-B7ANJQWZ.js";
36
36
  import "./chunk-UAD2WT54.js";
37
- import "./chunk-HNGRBWYF.js";
37
+ import "./chunk-ZWQUWF6W.js";
38
38
  import "./chunk-CYSYR67N.js";
39
39
  import "./chunk-Y3PMXGLH.js";
40
40
  import "./chunk-3IYMTWYZ.js";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  toolRegistry
3
- } from "./chunk-MPRDXX4T.js";
3
+ } from "./chunk-K25DK52L.js";
4
4
  import {
5
5
  i18n_default
6
- } from "./chunk-TS5BDIPV.js";
6
+ } from "./chunk-KUPDS66Q.js";
7
7
  import {
8
8
  canonicalizeToolNames
9
9
  } from "./chunk-O6OSWFZQ.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  generatePkcePair,
3
3
  startCallbackServer
4
- } from "./chunk-W5UYXCQE.js";
4
+ } from "./chunk-QDT5T7MK.js";
5
5
  import {
6
6
  toErrorMessage
7
7
  } from "./chunk-HNMXYYJR.js";
@@ -10,7 +10,7 @@ import {
10
10
  import {
11
11
  clipMultilineText,
12
12
  fetchAndSerializeTable
13
- } from "./chunk-MPRDXX4T.js";
13
+ } from "./chunk-K25DK52L.js";
14
14
  import {
15
15
  resolvePageReadMarkdown,
16
16
  slateToSimplifiedMarkdown
@@ -20,13 +20,13 @@ import {
20
20
  } from "./chunk-MEYIRKDN.js";
21
21
  import {
22
22
  fetchAndCacheMessages
23
- } from "./chunk-TS5BDIPV.js";
23
+ } from "./chunk-KUPDS66Q.js";
24
24
  import {
25
25
  shouldUseServerProxy
26
26
  } from "./chunk-YYLHWIW6.js";
27
27
  import {
28
28
  fetchServerSyncedCredential
29
- } from "./chunk-TV5ODOAF.js";
29
+ } from "./chunk-MXRUAINC.js";
30
30
  import {
31
31
  buildSkillGuidancePromptBlock,
32
32
  extractRuntimePageCapabilities,
@@ -60,7 +60,7 @@ import {
60
60
  } from "./chunk-PSCNXBYA.js";
61
61
  import {
62
62
  createFileCredentialBroker
63
- } from "./chunk-ESRMFY7G.js";
63
+ } from "./chunk-L36OWPP3.js";
64
64
  import {
65
65
  isOpenAiResponsesModel,
66
66
  resolvePlatformChatCompletionsEndpoint,
@@ -28,7 +28,7 @@ import {
28
28
  t,
29
29
  toolLabel,
30
30
  toolLabelVariants
31
- } from "./chunk-SFRMB7XN.js";
31
+ } from "./chunk-ZOI6KA4N.js";
32
32
  import {
33
33
  clearCredentialAvailability,
34
34
  readCredentialEntry,
@@ -75,7 +75,7 @@ import {
75
75
  } from "./chunk-LTRXGFMS.js";
76
76
  import {
77
77
  formatAgentListCard
78
- } from "./chunk-MPRDXX4T.js";
78
+ } from "./chunk-K25DK52L.js";
79
79
  import {
80
80
  isTransientFetchError
81
81
  } from "./chunk-5UTFL4QJ.js";
@@ -96,11 +96,11 @@ import {
96
96
  chooseMemoryOwners,
97
97
  loadMemoryCandidatesFromDb,
98
98
  resolveAgentMemoryPolicy
99
- } from "./chunk-A3JENOEB.js";
99
+ } from "./chunk-T36EFAW7.js";
100
100
  import {
101
101
  API_REPORTED_COST_MULTIPLIER,
102
102
  parseUiAskChoiceContent
103
- } from "./chunk-TS5BDIPV.js";
103
+ } from "./chunk-KUPDS66Q.js";
104
104
  import {
105
105
  isOAuthApiKeyRef
106
106
  } from "./chunk-YYLHWIW6.js";
@@ -115,7 +115,7 @@ import {
115
115
  LOCAL_AGENT_CONFIG_MISSING_CODE,
116
116
  LOCAL_TURN_ABORTED_CODE,
117
117
  readActionGate
118
- } from "./chunk-65U5FCBE.js";
118
+ } from "./chunk-GH4MH73K.js";
119
119
  import {
120
120
  resolveAgentRuntimeConfigFromRecord
121
121
  } from "./chunk-I4A26N52.js";
@@ -10739,7 +10739,7 @@ function findCollapsedPasteSpanAt(buffer, pos, opts = {}) {
10739
10739
  // packages/cli/client/agentRun.ts
10740
10740
  import { ulid as ulid2 } from "ulid";
10741
10741
  async function loadRunLocalAgentTurn() {
10742
- const { runLocalAgentTurn } = await import("./agentRuntimeLocal-F7VBM3ZK.js");
10742
+ const { runLocalAgentTurn } = await import("./agentRuntimeLocal-VOQ3UYZB.js");
10743
10743
  return runLocalAgentTurn;
10744
10744
  }
10745
10745
  var stripDebugNoise = (s) => s.replace(/\s*raw="[\s\S]*"/g, "").replace(/\s*raw=\S+/g, "").replace(/\s*headers=\[[^\]]*\]/g, "").replace(/\s*headers=\S+/g, "").trim();
@@ -121,7 +121,7 @@ import {
121
121
  } from "./chunk-HNMXYYJR.js";
122
122
  import {
123
123
  resolveNoloStateDir
124
- } from "./chunk-HNGRBWYF.js";
124
+ } from "./chunk-ZWQUWF6W.js";
125
125
  import {
126
126
  buildDialogSummaryLayer
127
127
  } from "./chunk-DVINR3PL.js";
@@ -9,7 +9,7 @@ import {
9
9
  initReactI18next,
10
10
  instance,
11
11
  toast
12
- } from "./chunk-TS5BDIPV.js";
12
+ } from "./chunk-KUPDS66Q.js";
13
13
  import {
14
14
  require_date_fns
15
15
  } from "./chunk-M76ECQRD.js";
@@ -38,7 +38,7 @@ import {
38
38
  } from "./chunk-L4KXQ6QP.js";
39
39
  import {
40
40
  createDialogAction
41
- } from "./chunk-A3JENOEB.js";
41
+ } from "./chunk-T36EFAW7.js";
42
42
  import {
43
43
  addMemberSpace,
44
44
  fetchAuthoritativeRemoteSpace,
@@ -62,7 +62,7 @@ import {
62
62
  } from "./chunk-VF4K2QE6.js";
63
63
  import {
64
64
  createDocState
65
- } from "./chunk-TUETDBTI.js";
65
+ } from "./chunk-WTUVMKSQ.js";
66
66
  import {
67
67
  setDialogExtraReferencesAction
68
68
  } from "./chunk-Z7IZQF56.js";
@@ -101,7 +101,7 @@ import {
101
101
  updateContentCategory,
102
102
  updateContentTitle,
103
103
  writeStoredCollapsedCategories
104
- } from "./chunk-CRGSU5DB.js";
104
+ } from "./chunk-GZQNKKDG.js";
105
105
  import {
106
106
  getCurrentSpaceId,
107
107
  getCurrentSpaceIdRaw,
@@ -123,14 +123,14 @@ import {
123
123
  selectMsgById,
124
124
  uiAskChoiceFunc,
125
125
  uiAskChoiceFunctionSchema
126
- } from "./chunk-TS5BDIPV.js";
126
+ } from "./chunk-KUPDS66Q.js";
127
127
  import {
128
128
  createAgent,
129
129
  deleteServerSyncedCredential,
130
130
  runLlm,
131
131
  streamAgentChatTurn,
132
132
  updateAgent
133
- } from "./chunk-TV5ODOAF.js";
133
+ } from "./chunk-MXRUAINC.js";
134
134
  import {
135
135
  getActiveDialogKey,
136
136
  selectCurrentDialogKey,
@@ -183,7 +183,7 @@ import {
183
183
  } from "./chunk-F64B2W3R.js";
184
184
  import {
185
185
  createFileCredentialBroker
186
- } from "./chunk-ESRMFY7G.js";
186
+ } from "./chunk-L36OWPP3.js";
187
187
  import {
188
188
  compactWhitespace
189
189
  } from "./chunk-DWLEOOGR.js";
@@ -3978,7 +3978,7 @@ async function deleteDialogsFunc(args, thunkApi) {
3978
3978
  const deletedDialogIds = [];
3979
3979
  const deletedDialogKeys = [];
3980
3980
  const failures = [];
3981
- const { deleteDialog: deleteDialog2 } = await import("./dialogSlice-7IGCUDZE.js");
3981
+ const { deleteDialog: deleteDialog2 } = await import("./dialogSlice-J24APUGG.js");
3982
3982
  for (const target of targets) {
3983
3983
  try {
3984
3984
  await thunkApi.dispatch(deleteDialog2(target.dbKey)).unwrap();
@@ -15043,7 +15043,7 @@ var executeToolRun = createAsyncThunk(
15043
15043
  if (!executionInput) {
15044
15044
  throw new Error(`ToolRun ${id} has no input to execute with.`);
15045
15045
  }
15046
- const { findToolExecutor: findToolExecutor2 } = await import("./tools-VSECJ5T7.js");
15046
+ const { findToolExecutor: findToolExecutor2 } = await import("./tools-5NAJJTFN.js");
15047
15047
  const { executor } = findToolExecutor2(run.toolName);
15048
15048
  toolRunStarted({
15049
15049
  id: run.id,
@@ -17550,7 +17550,7 @@ async function updateDocFunc(args, thunkApi) {
17550
17550
  updated_at: (/* @__PURE__ */ new Date()).toISOString()
17551
17551
  };
17552
17552
  await dispatch(write({ data: updatedPageData, customKey: id })).unwrap();
17553
- const { getDocState, applyExternalDocUpdate } = await import("./docStore-OD3NRNBN.js");
17553
+ const { getDocState, applyExternalDocUpdate } = await import("./docStore-SPOGE7K3.js");
17554
17554
  if (getDocState().pageKey === id) {
17555
17555
  applyExternalDocUpdate({
17556
17556
  slateData: finalSlateData,
@@ -11,7 +11,7 @@ import {
11
11
  } from "./chunk-6O4IK4V2.js";
12
12
  import {
13
13
  runLlm
14
- } from "./chunk-TV5ODOAF.js";
14
+ } from "./chunk-MXRUAINC.js";
15
15
  import {
16
16
  cleanupCliSessionForDialog
17
17
  } from "./chunk-D76D3RTR.js";
@@ -23937,7 +23937,7 @@ var messageSlice = createSliceWithThunks({
23937
23937
  runtimeOptions: args.runtimeOptions
23938
23938
  });
23939
23939
  if (agentKeyToUse) {
23940
- const { streamAgentChatTurn } = await import("./agentSlice-EYRJX2J6.js");
23940
+ const { streamAgentChatTurn } = await import("./agentSlice-4AK24F5F.js");
23941
23941
  await dispatch(
23942
23942
  streamAgentChatTurn({
23943
23943
  agentKey: agentKeyToUse,
@@ -25073,7 +25073,7 @@ var deleteDialogThunk = async (payload, thunkApi) => {
25073
25073
  }
25074
25074
  if (isCurrentDialog) {
25075
25075
  await thunkApi.dispatch(resetMsgs());
25076
- const { clearPendingAttachments: clearPendingAttachments2 } = await import("./dialogSlice-7IGCUDZE.js");
25076
+ const { clearPendingAttachments: clearPendingAttachments2 } = await import("./dialogSlice-J24APUGG.js");
25077
25077
  dispatch(clearPendingAttachments2());
25078
25078
  }
25079
25079
  return { dialogKey, isCurrentDialog, attachmentPlan };
@@ -25081,15 +25081,15 @@ var deleteDialogThunk = async (payload, thunkApi) => {
25081
25081
 
25082
25082
  // packages/chat/dialog/dialogSlice.ts
25083
25083
  var runCreateDialogAction = async (args, thunkApi) => {
25084
- const { createDialogAction } = await import("./createDialogAction-2BMDM4X3.js");
25084
+ const { createDialogAction } = await import("./createDialogAction-KTDAEA42.js");
25085
25085
  return createDialogAction(args, thunkApi);
25086
25086
  };
25087
25087
  var runCreateAgentAutomationAction = async (args, thunkApi) => {
25088
- const { createAgentAutomationAction } = await import("./createAgentAutomationAction-SWO62RE2.js");
25088
+ const { createAgentAutomationAction } = await import("./createAgentAutomationAction-TZVIJTZ7.js");
25089
25089
  return createAgentAutomationAction(args, thunkApi);
25090
25090
  };
25091
25091
  var runUpdateDialogTitleAction = async (args, thunkApi) => {
25092
- const { updateDialogTitleAction } = await import("./updateDialogTitleAction-WE5KY3SM.js");
25092
+ const { updateDialogTitleAction } = await import("./updateDialogTitleAction-IKZPJCRA.js");
25093
25093
  return updateDialogTitleAction(args, thunkApi);
25094
25094
  };
25095
25095
  var runAddDialogAgentAction = async (args, thunkApi) => {
@@ -25113,7 +25113,7 @@ var runSetDialogExtraReferencesAction = async (args, thunkApi) => {
25113
25113
  return setDialogExtraReferencesAction(args, thunkApi);
25114
25114
  };
25115
25115
  var runHandleSendMessageAction = async (args, thunkApi) => {
25116
- const { handleSendMessageAction } = await import("./handleSendMessageAction-PRF7JNOH.js");
25116
+ const { handleSendMessageAction } = await import("./handleSendMessageAction-I2IN64DS.js");
25117
25117
  return handleSendMessageAction(args, thunkApi);
25118
25118
  };
25119
25119
  function clearDialogState() {
@@ -25126,7 +25126,7 @@ var createPageAndAddReference = createAsyncThunk(
25126
25126
  async (payload, { dispatch, getState, rejectWithValue }) => {
25127
25127
  const { slateData, jsonData, title, type, fileId, groupId, dialogKey } = payload;
25128
25128
  try {
25129
- const { createDocState } = await import("./docStore-OD3NRNBN.js");
25129
+ const { createDocState } = await import("./docStore-SPOGE7K3.js");
25130
25130
  const pageKey = await createDocState(
25131
25131
  { slateData, title },
25132
25132
  { dispatch, getState }
@@ -2,7 +2,7 @@ import {
2
2
  getCredentialsDir,
3
3
  getLegacyCredentialPath,
4
4
  migrateLegacyCredentialFile
5
- } from "./chunk-HNGRBWYF.js";
5
+ } from "./chunk-ZWQUWF6W.js";
6
6
  import {
7
7
  asNonEmptyStringArray
8
8
  } from "./chunk-3AH7LNUB.js";
@@ -3,7 +3,10 @@ import {
3
3
  } from "./chunk-U4STABYN.js";
4
4
  import {
5
5
  clearCliLocalRuntimePreparedAgentCache
6
- } from "./chunk-SFRMB7XN.js";
6
+ } from "./chunk-ZOI6KA4N.js";
7
+ import {
8
+ readCredentialAvailability
9
+ } from "./chunk-62IL3KQV.js";
7
10
  import {
8
11
  getReadableCliDb
9
12
  } from "./chunk-CTUQJVQM.js";
@@ -81,8 +84,20 @@ async function runAgentReadCommand(args, deps = {}) {
81
84
  fetchImpl
82
85
  }) : {};
83
86
  const quota = fresh[result.agentKey] ?? recordQuota;
87
+ const rawRecordObj = result.record;
88
+ const credAvail = await readCredentialAvailability(env).catch(() => ({}));
89
+ const credGroup = typeof rawRecordObj?.apiKeyRef === "string" ? rawRecordObj.apiKeyRef : void 0;
90
+ const credDeadline = credGroup ? credAvail[credGroup] : void 0;
91
+ const recordDeadline = typeof rawRecordObj?.nextAvailableAt === "number" ? rawRecordObj.nextAvailableAt : void 0;
92
+ const effectiveNextAvailableAt = Math.max(recordDeadline ?? 0, credDeadline ?? 0) || void 0;
93
+ const isRateLimited = typeof effectiveNextAvailableAt === "number" && effectiveNextAvailableAt > Date.now();
84
94
  output.write(JSON.stringify({
85
95
  ...normalizeAgentRecordForOutput(result.agentKey, authToken, result.record),
96
+ ...isRateLimited ? {
97
+ rateLimited: true,
98
+ cooldownRemainingSeconds: Math.ceil((effectiveNextAvailableAt - Date.now()) / 1e3),
99
+ nextAvailableAt: new Date(effectiveNextAvailableAt).toISOString()
100
+ } : {},
86
101
  ...quota ? { quota } : {},
87
102
  source: result.source
88
103
  }, null, 2));
@@ -242,7 +257,7 @@ async function runAgentCreateCommand(args, deps = {}) {
242
257
  const OAUTH_REFS = /* @__PURE__ */ new Set(["claude", "chatgpt", "xai", "antigravity", "cloudflare"]);
243
258
  if (apiKeyRef && OAUTH_REFS.has(apiKeyRef)) {
244
259
  try {
245
- const { createOAuthTokenStore } = await import("./oauthTokenStore-ITEB663N.js");
260
+ const { createOAuthTokenStore } = await import("./oauthTokenStore-PADKLNOC.js");
246
261
  const store = createOAuthTokenStore();
247
262
  if (!store.read(apiKeyRef)) {
248
263
  authHint = `Subscription "${apiKeyRef}" is not authorized yet. Run \`nolo auth ${apiKeyRef}\` to log in.`;
@@ -3,7 +3,7 @@ import {
3
3
  createFileCredentialBroker,
4
4
  migrateAgentSecrets,
5
5
  normalizeAgentRuntimeToolPolicy
6
- } from "./chunk-ESRMFY7G.js";
6
+ } from "./chunk-L36OWPP3.js";
7
7
  import {
8
8
  asRecordOrEmpty
9
9
  } from "./chunk-KX6YBIHG.js";
@@ -304,7 +304,7 @@ var slice = createSliceWithThunks({
304
304
  const overrides = {};
305
305
  if (args.systemPromptOverride !== void 0) overrides.prompt = args.systemPromptOverride;
306
306
  if (args.toolsOverride !== void 0) overrides.tools = args.toolsOverride;
307
- const { _executeModel } = await import("./_executeModel-PHFKA2OL.js");
307
+ const { _executeModel } = await import("./_executeModel-QK43QR2R.js");
308
308
  return _executeModel(
309
309
  {
310
310
  isStreaming: args.isStreaming ?? false,
@@ -325,7 +325,7 @@ var slice = createSliceWithThunks({
325
325
  * - 循环直到无工具调用或触发其他运行时停止条件
326
326
  */
327
327
  runAgent: create.asyncThunk(async (args, thunkApi) => {
328
- const { runAgentClientLoop } = await import("./runAgentClientLoop-66UNGCTW.js");
328
+ const { runAgentClientLoop } = await import("./runAgentClientLoop-CQWLWU4W.js");
329
329
  const { content: loopContent, toolCallCount } = await runAgentClientLoop(
330
330
  {
331
331
  agentKey: args.agentKey,
@@ -341,7 +341,7 @@ var slice = createSliceWithThunks({
341
341
  * 聊天轮次流式 Agent 调用
342
342
  */
343
343
  streamAgentChatTurn: create.asyncThunk(async (args, thunkApi) => {
344
- const { streamAgentChatTurnHandler } = await import("./streamAgentChatTurn-6F3M4KUY.js");
344
+ const { streamAgentChatTurnHandler } = await import("./streamAgentChatTurn-XD5JEJXA.js");
345
345
  return streamAgentChatTurnHandler(args, thunkApi);
346
346
  }),
347
347
  /**
@@ -5,7 +5,7 @@ import {
5
5
  inlineImageUrlsForCustomProvider,
6
6
  prepareTools,
7
7
  shouldInlineImageUrlsForAgent
8
- } from "./chunk-SUFNELDG.js";
8
+ } from "./chunk-44F6KKUE.js";
9
9
  import {
10
10
  parseApiError
11
11
  } from "./chunk-OCZKATRC.js";
@@ -15,7 +15,7 @@ import {
15
15
  parseToolCallArguments,
16
16
  performFetchRequest,
17
17
  sanitizeOutboundMessages
18
- } from "./chunk-DT7WS4NV.js";
18
+ } from "./chunk-DID5AVGT.js";
19
19
  import {
20
20
  createToolRunId,
21
21
  findToolExecutor,
@@ -25,7 +25,7 @@ import {
25
25
  toolRunSetPending,
26
26
  toolRunStarted,
27
27
  toolRunSucceeded
28
- } from "./chunk-MPRDXX4T.js";
28
+ } from "./chunk-K25DK52L.js";
29
29
  import {
30
30
  createSSEParser
31
31
  } from "./chunk-GOMR6S5Z.js";
@@ -37,10 +37,10 @@ import {
37
37
  messageStreamEnd,
38
38
  messageStreaming,
39
39
  updateToolMessage
40
- } from "./chunk-TS5BDIPV.js";
40
+ } from "./chunk-KUPDS66Q.js";
41
41
  import {
42
42
  streamAgentChatTurn
43
- } from "./chunk-TV5ODOAF.js";
43
+ } from "./chunk-MXRUAINC.js";
44
44
  import {
45
45
  addActiveController,
46
46
  removeActiveController,
@@ -17,7 +17,11 @@ import {
17
17
  } from "./chunk-HNMXYYJR.js";
18
18
  import {
19
19
  writeOAuthCredential
20
- } from "./chunk-HNGRBWYF.js";
20
+ } from "./chunk-ZWQUWF6W.js";
21
+ import {
22
+ buildEnvFromProfile,
23
+ loadProfileConfig
24
+ } from "./chunk-TNIX77YM.js";
21
25
  import {
22
26
  asOptionalFiniteNumber
23
27
  } from "./chunk-WWC7I6TA.js";
@@ -840,6 +844,30 @@ var refreshOpenAiCodexToken2 = async (credential, deps = {}) => {
840
844
  });
841
845
  };
842
846
 
847
+ // packages/cli/oauth/serverSyncConfig.ts
848
+ function resolveServerSyncConfig() {
849
+ const envServer = process.env.NOLO_SERVER?.trim() || process.env.NOLO_SERVER_URL?.trim() || process.env.BASE_URL?.trim() || "";
850
+ const envToken = process.env.AUTH_TOKEN?.trim() || process.env.NOLO_AUTH_TOKEN?.trim() || "";
851
+ if (envServer && envToken) {
852
+ return { serverOrigin: envServer.replace(/\/+$/, ""), authToken: envToken };
853
+ }
854
+ let profileServer = "";
855
+ let profileToken = "";
856
+ try {
857
+ const config = loadProfileConfig();
858
+ const profileEnv = buildEnvFromProfile(config);
859
+ profileServer = profileEnv.NOLO_SERVER?.trim() || "";
860
+ profileToken = profileEnv.AUTH_TOKEN?.trim() || "";
861
+ } catch {
862
+ }
863
+ const serverOrigin = (envServer || profileServer).replace(/\/+$/, "");
864
+ const authToken = envToken || profileToken;
865
+ if (serverOrigin && authToken) {
866
+ return { serverOrigin, authToken };
867
+ }
868
+ return null;
869
+ }
870
+
843
871
  // packages/agent-runtime/xaiOAuth.ts
844
872
  var XAI_OAUTH_ISSUER = "https://auth.x.ai";
845
873
  var XAI_OAUTH_DISCOVERY_URL = `${XAI_OAUTH_ISSUER}/.well-known/openid-configuration`;
@@ -1260,5 +1288,6 @@ export {
1260
1288
  CURSOR_POLL_MAX_CONSECUTIVE_ERRORS,
1261
1289
  CURSOR_ACCESS_TOKEN_CLIENT_SKEW_MS,
1262
1290
  decodeJwtExp,
1263
- cursorRefresh
1291
+ cursorRefresh,
1292
+ resolveServerSyncConfig
1264
1293
  };
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  addContentToSpace
3
- } from "./chunk-CRGSU5DB.js";
3
+ } from "./chunk-GZQNKKDG.js";
4
4
  import {
5
5
  prepareAndPersistMessage,
6
6
  uiAskChoiceFunc,
7
7
  uiAskChoiceFunctionSchema
8
- } from "./chunk-TS5BDIPV.js";
8
+ } from "./chunk-KUPDS66Q.js";
9
9
  import {
10
10
  require_date_fns
11
11
  } from "./chunk-M76ECQRD.js";