neoagent 2.3.1-beta.114 → 2.3.1-beta.115

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.
package/lib/manager.js CHANGED
@@ -5,6 +5,7 @@ const net = require('net');
5
5
  const crypto = require('crypto');
6
6
  const readline = require('readline');
7
7
  const { spawn, spawnSync } = require('child_process');
8
+ const { CLAUDE_CODE_SCOPES } = require('../server/services/ai/providers/claudeCode');
8
9
  const {
9
10
  buildBundledWebClientIfPossible: buildWebClient,
10
11
  commandExists: sharedCommandExists,
@@ -815,7 +816,7 @@ async function cmdLoginClaudeCode() {
815
816
  const { URL: NodeURL } = require('url');
816
817
 
817
818
  const clientId = '9d1c250a-e61b-44d9-88ed-5944d1962f5e';
818
- const SCOPES = 'user:inference user:profile org:create_api_key user:sessions:claude_code user:mcp_servers';
819
+ const SCOPES = CLAUDE_CODE_SCOPES;
819
820
 
820
821
  // The registered redirect URIs are http://localhost/callback and http://127.0.0.1/callback
821
822
  // (port 80). The OAuth server validates the URI exactly, so we must use port 80.
@@ -919,6 +920,7 @@ async function cmdLoginClaudeCode() {
919
920
  redirect_uri: redirectUri,
920
921
  client_id: clientId,
921
922
  code_verifier: codeVerifier,
923
+ scope: SCOPES,
922
924
  state,
923
925
  }),
924
926
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neoagent",
3
- "version": "2.3.1-beta.114",
3
+ "version": "2.3.1-beta.115",
4
4
  "description": "Proactive personal AI agent with no limits",
5
5
  "license": "MIT",
6
6
  "main": "server/index.js",
@@ -1 +1 @@
1
- d24ae5d149080cae1dd694a9d7d1cca7
1
+ 1924fa6bc28b6ba8af56dfa6c7146c4b
@@ -37,6 +37,6 @@ _flutter.buildConfig = {"engineRevision":"42d3d75a56efe1a2e9902f52dc8006099c45d9
37
37
 
38
38
  _flutter.loader.load({
39
39
  serviceWorkerSettings: {
40
- serviceWorkerVersion: "2783772789" /* Flutter's service worker is deprecated and will be removed in a future Flutter release. */
40
+ serviceWorkerVersion: "138973699" /* Flutter's service worker is deprecated and will be removed in a future Flutter release. */
41
41
  }
42
42
  });
@@ -129338,7 +129338,7 @@ r===$&&A.b()
129338
129338
  o.push(A.ii(p,A.iY(!1,new A.a3(B.tM,A.dT(new A.cI(B.he,new A.a5V(r,p),p),p,p),p),!1,B.I,!0),p,p,0,0,0,p))}r=!1
129339
129339
  if(!s.ay)if(!s.ch){r=s.e
129340
129340
  r===$&&A.b()
129341
- r=B.b.t("mpb91fkt-6e44b2b").length!==0&&r.b}if(r){r=s.d
129341
+ r=B.b.t("mpb9d6tg-0a6c4fd").length!==0&&r.b}if(r){r=s.d
129342
129342
  r===$&&A.b()
129343
129343
  r=r.ag&&!r.V?84:0
129344
129344
  q=s.e
@@ -134146,7 +134146,7 @@ $S:236}
134146
134146
  A.Ys.prototype={}
134147
134147
  A.Rr.prototype={
134148
134148
  mT(a){var s=this
134149
- if(B.b.t("mpb91fkt-6e44b2b").length===0||s.a!=null)return
134149
+ if(B.b.t("mpb9d6tg-0a6c4fd").length===0||s.a!=null)return
134150
134150
  s.A5()
134151
134151
  s.a=A.q1(B.PP,new A.b58(s))},
134152
134152
  A5(){var s=0,r=A.l(t.H),q,p=2,o=[],n=this,m,l,k,j,i,h,g,f
@@ -134164,7 +134164,7 @@ if(!t.f.b(k)){s=1
134164
134164
  break}i=J.Z(k,"buildId")
134165
134165
  h=i==null?null:B.b.t(J.r(i))
134166
134166
  j=h==null?"":h
134167
- if(J.bm(j)===0||J.d(j,"mpb91fkt-6e44b2b")){s=1
134167
+ if(J.bm(j)===0||J.d(j,"mpb9d6tg-0a6c4fd")){s=1
134168
134168
  break}n.b=!0
134169
134169
  n.D()
134170
134170
  p=2
@@ -134181,7 +134181,7 @@ case 2:return A.i(o.at(-1),r)}})
134181
134181
  return A.k($async$A5,r)},
134182
134182
  vb(){var s=0,r=A.l(t.H),q,p=2,o=[],n=this,m,l,k,j,i,h,g,f,e,d,c,b,a,a0,a1
134183
134183
  var $async$vb=A.h(function(a2,a3){if(a2===1){o.push(a3)
134184
- s=p}for(;;)switch(s){case 0:if(B.b.t("mpb91fkt-6e44b2b").length===0||n.c){s=1
134184
+ s=p}for(;;)switch(s){case 0:if(B.b.t("mpb9d6tg-0a6c4fd").length===0||n.c){s=1
134185
134185
  break}n.c=!0
134186
134186
  n.D()
134187
134187
  p=4
@@ -11,6 +11,7 @@ const CLAUDE_CODE_OAUTH_BETA = 'claude-code-20250219,oauth-2025-04-20,fine-grain
11
11
  const CLAUDE_CODE_SYSTEM_PROMPT = "You are Claude Code, Anthropic's official CLI for Claude.";
12
12
  const CLAUDE_CODE_CLIENT_ID = '9d1c250a-e61b-44d9-88ed-5944d1962f5e';
13
13
  const CLAUDE_CODE_TOKEN_URL = 'https://platform.claude.com/v1/oauth/token';
14
+ const CLAUDE_CODE_SCOPES = 'user:inference user:profile org:create_api_key user:sessions:claude_code user:mcp_servers';
14
15
 
15
16
  function readTokenRecord(data) {
16
17
  const tokens = data?.claudeAiOauthTokens || data?.claudeAiOauth || {};
@@ -114,6 +115,7 @@ async function refreshClaudeCodeAccessToken(refreshToken, fetchImpl = fetch) {
114
115
  grant_type: 'refresh_token',
115
116
  refresh_token: refreshToken,
116
117
  client_id: CLAUDE_CODE_CLIENT_ID,
118
+ scope: CLAUDE_CODE_SCOPES,
117
119
  }),
118
120
  });
119
121
 
@@ -144,6 +146,22 @@ function isAuthenticationError(err) {
144
146
  return err?.status === 401 || err?.error?.type === 'authentication_error';
145
147
  }
146
148
 
149
+ function isInferenceScopeError(err) {
150
+ const message = String(err?.error?.message || err?.message || '');
151
+ const type = String(err?.error?.type || err?.type || '');
152
+ return err?.status === 403
153
+ && (type === 'permission_error' || message.includes('"permission_error"'))
154
+ && message.includes('scope requirement')
155
+ && message.includes('user:inference');
156
+ }
157
+
158
+ function formatClaudeCodeCredentialError(err) {
159
+ if (isInferenceScopeError(err)) {
160
+ return new Error(`Claude Code OAuth token is missing inference scope. Re-run \`neoagent login claude-code\` to create a token with ${CLAUDE_CODE_SCOPES}.`);
161
+ }
162
+ return err;
163
+ }
164
+
147
165
  class ClaudeCodeProvider extends AnthropicProvider {
148
166
  constructor(config = {}) {
149
167
  super(config);
@@ -224,9 +242,15 @@ class ClaudeCodeProvider extends AnthropicProvider {
224
242
  try {
225
243
  return await super.chat(messages, tools, options);
226
244
  } catch (err) {
227
- if (!isAuthenticationError(err) || !this.refreshToken) throw err;
245
+ if ((!isAuthenticationError(err) && !isInferenceScopeError(err)) || !this.refreshToken) {
246
+ throw formatClaudeCodeCredentialError(err);
247
+ }
228
248
  await this.refreshClient();
229
- return await super.chat(messages, tools, options);
249
+ try {
250
+ return await super.chat(messages, tools, options);
251
+ } catch (retryErr) {
252
+ throw formatClaudeCodeCredentialError(retryErr);
253
+ }
230
254
  }
231
255
  }
232
256
 
@@ -234,11 +258,17 @@ class ClaudeCodeProvider extends AnthropicProvider {
234
258
  try {
235
259
  yield* super.stream(messages, tools, options);
236
260
  } catch (err) {
237
- if (!isAuthenticationError(err) || !this.refreshToken) throw err;
261
+ if ((!isAuthenticationError(err) && !isInferenceScopeError(err)) || !this.refreshToken) {
262
+ throw formatClaudeCodeCredentialError(err);
263
+ }
238
264
  await this.refreshClient();
239
- yield* super.stream(messages, tools, options);
265
+ try {
266
+ yield* super.stream(messages, tools, options);
267
+ } catch (retryErr) {
268
+ throw formatClaudeCodeCredentialError(retryErr);
269
+ }
240
270
  }
241
271
  }
242
272
  }
243
273
 
244
- module.exports = { ClaudeCodeProvider, readClaudeCliToken, refreshClaudeCodeAccessToken };
274
+ module.exports = { ClaudeCodeProvider, readClaudeCliToken, refreshClaudeCodeAccessToken, CLAUDE_CODE_SCOPES };