nolo-cli 0.27.0 → 0.28.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 (68) hide show
  1. package/{_executeModel-GBJY45QW.js → _executeModel-SUMILI7E.js} +13 -13
  2. package/{agentDeleteCommand-VFHDZJG3.js → agentDeleteCommand-GEHAXWM6.js} +7 -7
  3. package/{agentEmailCommands-NV64EI7G.js → agentEmailCommands-PQXAKGK2.js} +17 -17
  4. package/{agentListCommands-BDDUYHLP.js → agentListCommands-V2IIWNTX.js} +8 -8
  5. package/{agentMachineCommands-2KYBYNLE.js → agentMachineCommands-Y47CABE2.js} +7 -7
  6. package/{agentRecordCommands-3OX576G3.js → agentRecordCommands-UYUJUT4K.js} +16 -16
  7. package/{agentRunCommand-FZOGN67Y.js → agentRunCommand-3P6CCJQK.js} +17 -17
  8. package/{agentRuntimeLocal-552R4CZA.js → agentRuntimeLocal-ZALQDCZ3.js} +4 -4
  9. package/{agentSlice-7AEBCNVZ.js → agentSlice-LH2YKWE7.js} +1 -1
  10. package/{appDeleteCommands-IPJT6IYW.js → appDeleteCommands-XELAKISE.js} +8 -8
  11. package/{appDeployCommands-24P4CADQ.js → appDeployCommands-PFHVHXJ3.js} +8 -8
  12. package/{appDeployStatusCommands-3DRZOUAG.js → appDeployStatusCommands-RULB3DGE.js} +8 -8
  13. package/{appGetCommands-JEOSBLUL.js → appGetCommands-A3NLQ2U5.js} +8 -8
  14. package/{appListCommands-EIBM54WR.js → appListCommands-NQLJ7RHY.js} +8 -8
  15. package/{authCommand-MKMYHD52.js → authCommand-XMQHBK5L.js} +470 -40
  16. package/chunk-2FX23RGA.js +162 -0
  17. package/{chunk-6MBOZ4UP.js → chunk-2TYLTEAH.js} +1 -1
  18. package/{chunk-W2IOPRHX.js → chunk-4O2L6YR5.js} +3 -3
  19. package/{chunk-X43U4JUJ.js → chunk-4UYKPT74.js} +1 -1
  20. package/{chunk-TTPVLL5F.js → chunk-7IX2Z2IF.js} +8 -8
  21. package/{chunk-3X4IYB22.js → chunk-7OYY7W4W.js} +2 -2
  22. package/{chunk-ZNFZGHKL.js → chunk-7ZKK4F22.js} +1 -1
  23. package/{chunk-YZV4676I.js → chunk-A6WDXLAG.js} +2 -2
  24. package/{chunk-KXEWHQAW.js → chunk-ATGTWONB.js} +1 -1
  25. package/{chunk-Z3ORPMOA.js → chunk-BTA2CW6H.js} +6 -6
  26. package/{chunk-J7PB5GXH.js → chunk-D36OKPFG.js} +1 -1
  27. package/{chunk-56CPK6JE.js → chunk-D5D3XTWF.js} +30 -35
  28. package/{chunk-V7BUGVT2.js → chunk-E4XWECLB.js} +2 -2
  29. package/{chunk-UADEEVDX.js → chunk-HTLBU4ZY.js} +5 -5
  30. package/{chunk-N32A423D.js → chunk-IVMPWUAR.js} +2 -2
  31. package/{chunk-O5VFD7V6.js → chunk-MSXDPLDQ.js} +1 -1
  32. package/{chunk-NCRWA6ZB.js → chunk-MY54LNPC.js} +2 -2
  33. package/{chunk-4FRIAKSZ.js → chunk-OMN2LILO.js} +1 -1
  34. package/{chunk-7OYLPHDL.js → chunk-PASYOZYI.js} +22 -65
  35. package/{chunk-AL2V7U3E.js → chunk-PJY5AH5A.js} +25 -8
  36. package/chunk-PSK2RUHV.js +529 -0
  37. package/{chunk-Q4TAIQTA.js → chunk-QUXMWSCQ.js} +21 -47
  38. package/{chunk-PVWFM7JP.js → chunk-RRWRVIQU.js} +1 -1
  39. package/{chunk-QCUS52YR.js → chunk-SFFG3HJH.js} +3 -3
  40. package/{chunk-7WMLPRXP.js → chunk-UP7UFQOH.js} +1 -1
  41. package/{chunk-VV4TYWNV.js → chunk-WX3ZOSTL.js} +376 -656
  42. package/{chunk-HQFXBRI2.js → chunk-XMAELUQW.js} +11 -11
  43. package/{chunk-7OBMZCRD.js → chunk-ZVZMT3EA.js} +7 -5
  44. package/{createAgentAutomationAction-YB65NAU5.js → createAgentAutomationAction-FAYQK5ME.js} +2 -2
  45. package/{createDialogAction-6USRBKKL.js → createDialogAction-NDBK6IQG.js} +3 -3
  46. package/{createPageAction-ZGE3SG6J.js → createPageAction-CQTLV7FP.js} +2 -2
  47. package/{dialogCommands-O4CJJRTQ.js → dialogCommands-ZR42K2M5.js} +8 -8
  48. package/{dialogSlice-HMRBZCSE.js → dialogSlice-ZLGEYKLO.js} +2 -2
  49. package/{docCreateCommands-2U5AIF3O.js → docCreateCommands-2WXA3BCQ.js} +7 -7
  50. package/{docDeleteCommands-EDCAUQEF.js → docDeleteCommands-HSL7CD32.js} +8 -8
  51. package/{docReadCommands-KFMBFGPY.js → docReadCommands-YSPUU2DP.js} +7 -7
  52. package/{docStore-ZGGDZFCC.js → docStore-LJQIY2ZU.js} +3 -3
  53. package/{docUpdateCommands-57M4XOT7.js → docUpdateCommands-EFYOIVM7.js} +7 -7
  54. package/{handleSendMessageAction-ANCZXLQY.js → handleSendMessageAction-JL6GGVNW.js} +2 -2
  55. package/index.js +46 -46
  56. package/{machineCommands-6EG5U6TU.js → machineCommands-VAANUFNC.js} +15 -15
  57. package/{machineWsRunDispatch-SFIKRI4G.js → machineWsRunDispatch-ABWV2WZO.js} +15 -15
  58. package/package.json +1 -1
  59. package/{readlineWorkspace-TVIHBRN2.js → readlineWorkspace-GQI3XP5E.js} +41 -44
  60. package/{runAgentClientLoop-SJ6QQ3ZS.js → runAgentClientLoop-U632N2KO.js} +9 -9
  61. package/{skillDiscovery-KJWT7JBU.js → skillDiscovery-ITA7BI7A.js} +4 -2
  62. package/{spaceCommands-XK46FRYG.js → spaceCommands-DE6KNJIV.js} +7 -7
  63. package/{spaceSlice-FNFNVXPQ.js → spaceSlice-QTMWWQHQ.js} +2 -2
  64. package/{streamAgentChatTurn-HHIWP44U.js → streamAgentChatTurn-VU7BM3K3.js} +12 -12
  65. package/{tools-CT7AFBI3.js → tools-LSIS6NY6.js} +5 -5
  66. package/{updateDialogTitleAction-7RFN5GA4.js → updateDialogTitleAction-T77A54DE.js} +2 -2
  67. package/chunk-UTYJ47H2.js +0 -51
  68. package/chunk-ZJ7WLPDP.js +0 -553
@@ -1,12 +1,13 @@
1
1
  import {
2
+ anthropicRefresh,
2
3
  cursorRefresh,
3
4
  refreshAntigravityOAuthToken,
4
5
  refreshOpenAiCodexToken,
5
- refreshXaiOAuthToken
6
- } from "./chunk-VV4TYWNV.js";
6
+ xaiRefresh
7
+ } from "./chunk-WX3ZOSTL.js";
7
8
  import {
8
9
  buildLocalAgentLookupKeys
9
- } from "./chunk-7WMLPRXP.js";
10
+ } from "./chunk-UP7UFQOH.js";
10
11
  import {
11
12
  LOCAL_CODEX_AGENT_ID,
12
13
  LOCAL_CODEX_AGENT_KEY,
@@ -19,13 +20,13 @@ import {
19
20
  import {
20
21
  inlineImageUrlsForCustomProvider,
21
22
  prepareTools
22
- } from "./chunk-J7PB5GXH.js";
23
+ } from "./chunk-D36OKPFG.js";
23
24
  import {
24
25
  getAntigravityUserAgent,
25
26
  isAntigravityOAuthAgent,
26
27
  readAntigravityProjectId,
27
28
  resolveAntigravityCloudCodeBaseUrl
28
- } from "./chunk-UTYJ47H2.js";
29
+ } from "./chunk-2FX23RGA.js";
29
30
  import {
30
31
  readXPostFunc,
31
32
  readXPostFunctionSchema,
@@ -34,7 +35,7 @@ import {
34
35
  rememberMemoryFunctionSchema,
35
36
  resolveAgentRequiredPackIds,
36
37
  setTodoListFunc
37
- } from "./chunk-HQFXBRI2.js";
38
+ } from "./chunk-XMAELUQW.js";
38
39
  import {
39
40
  createDrainExhaustedResponse,
40
41
  isCoreDrainingBody,
@@ -49,13 +50,13 @@ import {
49
50
  prepareTokenUsageData,
50
51
  resolveBuiltinPlatformAgentConfig,
51
52
  runKeyed
52
- } from "./chunk-Q4TAIQTA.js";
53
+ } from "./chunk-QUXMWSCQ.js";
53
54
  import {
54
55
  BUILTIN_TITLE_LLM_CONFIG
55
56
  } from "./chunk-XOIF2TNF.js";
56
57
  import {
57
58
  fetchServerSyncedCredential
58
- } from "./chunk-QCUS52YR.js";
59
+ } from "./chunk-SFFG3HJH.js";
59
60
  import {
60
61
  require_date_fns
61
62
  } from "./chunk-M76ECQRD.js";
@@ -89,7 +90,7 @@ import {
89
90
  readOpenAiCompatibleSseCompletion,
90
91
  resolveAgentNextAvailableAt,
91
92
  resolveOpenAiCompatibleProviderConfig
92
- } from "./chunk-TTPVLL5F.js";
93
+ } from "./chunk-7IX2Z2IF.js";
93
94
  import {
94
95
  buildPlatformChatCompletionRequest,
95
96
  canUsePlatformChatProvider,
@@ -106,7 +107,7 @@ import {
106
107
  import {
107
108
  resolveHistoricalToolContentCap,
108
109
  summarizeToolArguments
109
- } from "./chunk-YZV4676I.js";
110
+ } from "./chunk-A6WDXLAG.js";
110
111
  import {
111
112
  convertMessagesToResponsesInput,
112
113
  toResponsesTools
@@ -191,9 +192,6 @@ import {
191
192
  createUserKey,
192
193
  dialogMessageRange
193
194
  } from "./chunk-NRY4GCKJ.js";
194
- import {
195
- asOptionalFiniteNumber
196
- } from "./chunk-WWC7I6TA.js";
197
195
  import {
198
196
  asTrimmedNonEmptyStringArray
199
197
  } from "./chunk-I42VC5KR.js";
@@ -10107,57 +10105,6 @@ function isCodexOAuthAgent(agentConfig) {
10107
10105
  return apiKeyRef === "chatgpt";
10108
10106
  }
10109
10107
 
10110
- // packages/agent-runtime/oauthProviders.ts
10111
- var XAI_ACCESS_TOKEN_CLIENT_SKEW_MS = 5 * 60 * 1e3;
10112
- var decodeBase64 = (s) => Buffer.from(s, "base64").toString("utf8");
10113
- var ANTIGRAVITY_CLIENT_ID = decodeBase64(
10114
- "MTA3MTAwNjA2MDU5MS10bWhzc2luMmgyMWxjcmUyMzV2dG9sb2poNGc0MDNlcC5hcHBzLmdvb2dsZXVzZXJjb250ZW50LmNvbQ=="
10115
- );
10116
- var ANTIGRAVITY_CLIENT_SECRET = decodeBase64("R09DU1BYLUs1OEZXUjQ4NkxkTEoxbUxCOHNYQzR6NnFEQWY=");
10117
- var ANTIGRAVITY_ACCESS_TOKEN_CLIENT_SKEW_MS = 5 * 60 * 1e3;
10118
- var ANTHROPIC_OAUTH_CLIENT_ID = "9d1c250a-e61b-44d9-88ed-5944d1962f5e";
10119
- var ANTHROPIC_OAUTH_TOKEN_URL = "https://api.anthropic.com/v1/oauth/token";
10120
- var ANTHROPIC_ACCESS_TOKEN_CLIENT_SKEW_MS = 5 * 60 * 1e3;
10121
- var anthropicRefresh = async (credential, deps = {}) => {
10122
- if (!credential.refreshToken) {
10123
- throw new Error("Claude credential has no refresh_token");
10124
- }
10125
- const fetchImpl = deps.fetchImpl ?? fetch;
10126
- const response = await fetchImpl(ANTHROPIC_OAUTH_TOKEN_URL, {
10127
- method: "POST",
10128
- headers: {
10129
- "Content-Type": "application/json",
10130
- "anthropic-beta": "oauth-2025-04-20",
10131
- "User-Agent": "nolo-cli userOAuthProvider"
10132
- },
10133
- body: JSON.stringify({
10134
- grant_type: "refresh_token",
10135
- client_id: ANTHROPIC_OAUTH_CLIENT_ID,
10136
- refresh_token: credential.refreshToken
10137
- }),
10138
- signal: AbortSignal.timeout(3e4)
10139
- });
10140
- const payload = await response.json().catch(() => ({}));
10141
- if (!response.ok) {
10142
- const detail = typeof payload.error_description === "string" ? payload.error_description : typeof payload.error === "string" ? payload.error : `HTTP ${response.status}`;
10143
- throw new Error(`Claude token refresh failed: ${detail}`);
10144
- }
10145
- if (typeof payload.access_token !== "string" || !payload.access_token) {
10146
- throw new Error("Claude token refresh response missing access_token");
10147
- }
10148
- const expiresIn = asOptionalFiniteNumber(payload.expires_in);
10149
- const now = deps.now?.() ?? Date.now();
10150
- return {
10151
- ...credential,
10152
- provider: "claude",
10153
- accessToken: payload.access_token,
10154
- refreshToken: typeof payload.refresh_token === "string" && payload.refresh_token ? payload.refresh_token : credential.refreshToken,
10155
- ...expiresIn !== void 0 ? { expiresAt: now + expiresIn * 1e3 - ANTHROPIC_ACCESS_TOKEN_CLIENT_SKEW_MS } : {},
10156
- scope: typeof payload.scope === "string" ? payload.scope : credential.scope,
10157
- obtainedAt: now
10158
- };
10159
- };
10160
-
10161
10108
  // packages/cli/oauth/apiKeyRefResolver.ts
10162
10109
  var REFRESH_BY_PROVIDER = {
10163
10110
  chatgpt: refreshOpenAiCodexToken,
@@ -10165,7 +10112,7 @@ var REFRESH_BY_PROVIDER = {
10165
10112
  // surfaced as "OAuth credential not found" even when ~/.nolo/credentials
10166
10113
  // still held a valid refresh_token.
10167
10114
  antigravity: refreshAntigravityOAuthToken,
10168
- xai: refreshXaiOAuthToken,
10115
+ xai: xaiRefresh,
10169
10116
  claude: anthropicRefresh,
10170
10117
  cursor: cursorRefresh
10171
10118
  };
@@ -11230,6 +11177,11 @@ function createCliLocalRuntimeAdapter(deps) {
11230
11177
  model: agentConfig.model || "gemini-3.1-pro",
11231
11178
  provider: agentConfig.provider || "google-antigravity",
11232
11179
  ...tool_calls ? { tool_calls } : {},
11180
+ // fetchAntigravityCloudCodeCompletion 已把 CCA 流聚合完毕并归一化成
11181
+ // OpenAI chat.completions 形状:choices[0] + usage
11182
+ // (prompt_tokens/completion_tokens/total_tokens)。必须透传,否则
11183
+ // localLoop 的 lastUsage 无 token 数,TUI context chip 拿不到更新。
11184
+ usage: result.body?.usage,
11233
11185
  trace: messages
11234
11186
  };
11235
11187
  }
@@ -11298,6 +11250,11 @@ function createCliLocalRuntimeAdapter(deps) {
11298
11250
  model: agentConfig.model || "claude-sonnet-5",
11299
11251
  provider: "anthropic",
11300
11252
  ...tool_calls ? { tool_calls } : {},
11253
+ // fetchAnthropicMessagesCompletion 已把 Anthropic Messages 响应归一化成
11254
+ // OpenAI chat.completions 形状:choices[0] + usage(prompt_tokens/
11255
+ // output_tokens/cache_*)。必须透传,否则 localLoop 的 lastUsage 无
11256
+ // token 数,TUI context chip 拿不到更新(与 Codex OAuth 分支同因)。
11257
+ usage: result.body?.usage,
11301
11258
  trace: messages
11302
11259
  };
11303
11260
  }
@@ -77,20 +77,26 @@ var buildSpaceContextLayer = async (args) => {
77
77
  ].join("\n")
78
78
  );
79
79
  };
80
- var buildSkillDiscoveryLayer = (skills, boundFolder) => {
80
+ var buildSkillDiscoveryLayer = (skills, _boundFolder) => {
81
81
  if (skills.length === 0) return null;
82
82
  const lines = [
83
83
  "--- \u53EF\u7528\u6280\u80FD\uFF08Skills\uFF09---",
84
- `\u5DE5\u4F5C\u533A ${boundFolder} \u4E2D\u53D1\u73B0\u4E86 ${skills.length} \u4E2A\u6280\u80FD\uFF08SKILL.md\uFF09\uFF1A`,
85
- "\u6A21\u578B\u53EF\u6309\u9700\u7528 loadSkill \u5DE5\u5177\u6309\u540D\u52A0\u8F7D\uFF0C\u628A SKILL.md \u5168\u6587\u62C9\u8FDB\u4E0A\u4E0B\u6587\u540E\u9075\u5FAA\u5176\u6307\u4EE4\uFF1B",
86
- "\u5982 loadSkill \u4E0D\u53EF\u7528\u6216\u60F3\u76F4\u63A5\u8BFB\u53D6\u6587\u4EF6\uFF0C\u4E0B\u65B9 path \u4ECD\u53EF\u7528 readFile \u4F5C\u4E3A fallback\uFF1A",
87
- "",
84
+ `\u5DE5\u4F5C\u533A\u4E2D\u53D1\u73B0\u4E86 ${skills.length} \u4E2A\u6280\u80FD\uFF08SKILL.md\uFF09\uFF0C\u6A21\u578B\u53EF\u6309\u9700\u7528 loadSkill \u6309\u540D\u52A0\u8F7D\u6216 readFile \u76F4\u63A5\u8BFB\u53D6\uFF1A`,
88
85
  ...skills.map(
89
- (s) => `- ${s.name}: ${s.description}
90
- path: ${s.relativePath}`
86
+ (s) => `- ${s.name}: ${s.description} (path: ${s.relativePath})`
91
87
  )
92
88
  ];
93
- return makeLayer("skill-discovery", lines.join("\n"));
89
+ return makeLayer("skill-discovery", lines.join("\n"), "session");
90
+ };
91
+ var buildAgentsMdLayer = (content, fileName = "AGENTS.md") => {
92
+ const trimmed = content.trim();
93
+ if (!trimmed) return null;
94
+ return makeLayer(
95
+ "agents-md",
96
+ `--- \u9879\u76EE\u6307\u4EE4\uFF08${fileName}\uFF09---
97
+ ${trimmed}`,
98
+ "session"
99
+ );
94
100
  };
95
101
  var buildLinkedSpacesSection = async (args) => {
96
102
  const ids = (args.linkedSpaceIds ?? []).filter(
@@ -123,6 +129,14 @@ var buildLinkedSpacesSection = async (args) => {
123
129
  "\u63D0\u793A\uFF1A\u5982\u9700\u67E5\u8BE2\u8FD9\u4E9B\u7A7A\u95F4\u7684\u8BE6\u7EC6\u5185\u5BB9\uFF0C\u53EF\u4F7F\u7528 read \u5DE5\u5177\u914D\u5408\u5BF9\u5E94\u7684 dbKey\u3002"
124
130
  ].join("\n");
125
131
  };
132
+ var renderTurnContextBlocksWithScope = (layers) => layers.filter((layer) => Boolean(layer?.content?.trim())).map((layer) => ({
133
+ content: layer.content.trim(),
134
+ cacheScope: layer.cacheScope
135
+ }));
136
+ var partitionScopedBlocks = (blocks) => [
137
+ ...blocks.filter((block) => block.cacheScope === "session"),
138
+ ...blocks.filter((block) => block.cacheScope === "turn")
139
+ ];
126
140
  var buildDialogSummaryLayer = (args) => {
127
141
  const historical = wrapHistoricalSummaryWithReplayGuard(
128
142
  asTrimmed(args.summary)
@@ -149,7 +163,10 @@ var buildMemoryUseGuidanceLayer = (args) => {
149
163
  export {
150
164
  buildSpaceContextLayer,
151
165
  buildSkillDiscoveryLayer,
166
+ buildAgentsMdLayer,
152
167
  buildLinkedSpacesSection,
168
+ renderTurnContextBlocksWithScope,
169
+ partitionScopedBlocks,
153
170
  buildDialogSummaryLayer,
154
171
  buildMemoryOverlayLayer,
155
172
  buildMemoryUseGuidanceLayer