@fxz26284407/yuanma-gateway 0.1.6 → 0.1.7

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.
@@ -322,7 +322,15 @@ export class AntigravityBackend {
322
322
  return { id, name: catalog.trajectorySummaries[id].summary || '新会话', status: 'idle' };
323
323
  }
324
324
  requireValue(!creation.recoverOnly, 'CREATION_UNKNOWN', '原创建请求尚未确认,请稍后在原项目重试', 409);
325
- const result = await this.desktop.call('StartCascade', { cascadeId: id, workspaceUris: project.scope.roots.map(r => pathToFileURL(r).href), projectEnvConfig: { projectId: project.native.id }, backend: 'BACKEND_TYPE_LOCAL' });
325
+ let result;
326
+ try {
327
+ result = await this.desktop.call('StartCascade', { cascadeId: id, source: 'CORTEX_TRAJECTORY_SOURCE_CASCADE_CLIENT', workspaceUris: [], projectEnvConfig: { projectId: project.native.id, defaultProjectEnvironment: {} }, backend: 'BACKEND_TYPE_LOCAL' });
328
+ }
329
+ catch (error) {
330
+ if (error.rpcError?.code === 'invalid_argument')
331
+ throw new Fault('CREATION_NOT_STARTED', 'Antigravity 未接受新建请求,请在原项目重试', 400);
332
+ throw error;
333
+ }
326
334
  if (result.cascadeId !== id)
327
335
  throw new Error('Antigravity 会话创建结果未知,请核对原项目');
328
336
  await this.session(id, projectId);
@@ -772,23 +780,22 @@ export class AntigravityBackend {
772
780
  return { model, effort };
773
781
  }
774
782
  async getPermissions(projectId, threadId) {
775
- await this.session(threadId, projectId);
783
+ const row = await this.session(threadId, projectId);
776
784
  const state = await this.desktop.state();
777
785
  const preset = state.userConfig?.userSettings?.permissionPreset ?? state.state?.userSettings?.permissionPreset;
778
786
  const mode = preset === 'AGENT_PERMISSION_PRESET_REQUEST_REVIEW' ? 'request-review' : preset === 'AGENT_PERMISSION_PRESET_TURBO' ? 'turbo' : 'desktop';
779
787
  const options = [
780
- { value: 'desktop', label: '沿用桌面策略', description: '确认此手机沿用桌面当前的执行权限,不修改桌面设置', requiresConfirmation: true },
788
+ { value: 'desktop', label: '沿用桌面策略', description: '沿用桌面当前的执行权限,不修改桌面设置', requiresConfirmation: false },
781
789
  { value: 'request-review', label: '要求审查', description: '将 Antigravity 桌面全局策略切换为要求审查,影响后续任务', requiresConfirmation: true },
782
790
  { value: 'turbo', label: 'Turbo', description: '将 Antigravity 桌面全局策略切换为 Turbo,影响后续任务', requiresConfirmation: true }
783
791
  ];
784
- const selection = this.permissionSelections.get(permissionKey(projectId, threadId));
785
- return { mode, scope: 'desktop-global', mobileControl: !this.readOnly && (selection === 'desktop' || selection === mode), options };
792
+ return { mode, scope: 'desktop-global', mobileControl: row.statusKnown && !this.readOnly && typeof preset === 'string' && preset.length > 0, options };
786
793
  }
787
794
  async setPermissions(projectId, threadId, mode, confirmed = false) {
788
795
  const row = await this.session(threadId, projectId);
789
796
  requireValue(row.statusKnown && !this.readOnly, 'BACKEND_UNAVAILABLE', '请先打开 Antigravity 桌面应用', 503);
790
797
  requireValue(['desktop', 'request-review', 'turbo'].includes(mode), 'INVALID_REQUEST', '执行策略无效', 400);
791
- requireValue(confirmed, 'CONFIRM_FULL_ACCESS', '请确认使用所选执行策略', 428);
798
+ requireValue(mode === 'desktop' || confirmed, 'CONFIRM_FULL_ACCESS', '请确认使用所选执行策略', 428);
792
799
  if (mode !== 'desktop') {
793
800
  const preset = mode === 'turbo' ? 'AGENT_PERMISSION_PRESET_TURBO' : 'AGENT_PERMISSION_PRESET_REQUEST_REVIEW';
794
801
  await this.desktop.call('JetboxWriteState', { userConfig: { userSettings: { permissionPreset: preset } } });
package/dist/codex.js CHANGED
@@ -201,7 +201,7 @@ export class CodexBackend {
201
201
  if (fresh) {
202
202
  requireValue(fresh.projectId === projectId, 'THREAD_MISMATCH', 'Fresh thread belongs to another project', 403);
203
203
  const r = fresh.result;
204
- requireValue(r.thread.projectId === projectId && this.permissionAllowed(r, projectId, threadId), 'UNSAFE_THREAD', 'Fresh thread configuration is not constrained', 403);
204
+ requireValue(r.thread.projectId === projectId && this.permissionAllowed(r), 'UNSAFE_THREAD', '无法识别此会话的桌面执行策略', 403);
205
205
  let current;
206
206
  try {
207
207
  current = await this.call('thread/read', { threadId });
@@ -232,7 +232,7 @@ export class CodexBackend {
232
232
  const r = relative(root, resumedCwd);
233
233
  return r === '' || (!isAbsolute(r) && r !== '..' && !r.startsWith(`..${sep}`));
234
234
  }), 'THREAD_MISMATCH', 'Thread scope changed during resume', 403);
235
- requireValue(this.permissionAllowed(resumed, projectId, threadId), 'UNSAFE_THREAD', 'Remote control requires a constrained thread and interactive approval', 403);
235
+ requireValue(this.permissionAllowed(resumed), 'UNSAFE_THREAD', '无法识别此会话的桌面执行策略,请在桌面选择标准策略', 403);
236
236
  for (const granted of resumed.sandbox.writableRoots ?? []) {
237
237
  const target = await realpath(granted);
238
238
  requireValue(roots.some(root => {
@@ -513,13 +513,13 @@ export class CodexBackend {
513
513
  cursor = page.nextCursor ?? undefined;
514
514
  } while (cursor && projects.length < 2000); return projects; }
515
515
  replaceProjects(projects) { this.projects.splice(0, this.projects.length, ...projects); }
516
- permissionView(projectId, threadId, value = this.profileCache.get(threadId)) { return { mode: permissionMode(value ?? {}), mobileControl: !!value && this.permissionAllowed(value, projectId, threadId) }; }
517
- permissionAllowed(value, projectId, threadId) { const mode = permissionMode(value); return mode !== 'custom' && (mode !== 'full' || this.permissionSelections.get(permissionKey(projectId, threadId)) === 'full'); }
516
+ permissionView(projectId, threadId, value = this.profileCache.get(threadId)) { return { mode: permissionMode(value ?? {}), mobileControl: !!value && this.permissionAllowed(value) }; }
517
+ permissionAllowed(value) { return permissionMode(value) !== 'custom'; }
518
518
  async getPermissions(projectId, threadId) {
519
519
  await this.inspect(projectId, threadId);
520
520
  const value = this.fresh.get(threadId)?.result ?? await this.call('thread/resume', { threadId, excludeTurns: true });
521
521
  this.profileCache.set(threadId, value);
522
- return { mode: permissionMode(value), mobileControl: this.permissionAllowed(value, projectId, threadId), approvalPolicy: value.approvalPolicy, reviewer: value.approvalsReviewer ?? 'user', sandbox: value.sandbox?.type ?? 'unknown' };
522
+ return { mode: permissionMode(value), mobileControl: this.permissionAllowed(value), approvalPolicy: value.approvalPolicy, reviewer: value.approvalsReviewer ?? 'user', sandbox: value.sandbox?.type ?? 'unknown' };
523
523
  }
524
524
  async setPermissions(projectId, threadId, mode) {
525
525
  await this.inspect(projectId, threadId);
@@ -535,7 +535,7 @@ export class CodexBackend {
535
535
  requireValue((actualProject === projectId || (fresh && actualProject === null)) && roots.some(root => { const r = relative(root, actualCwd); return r === '' || (!isAbsolute(r) && r !== '..' && !r.startsWith('..' + sep)); }), 'THREAD_MISMATCH', 'Thread scope changed while updating permissions', 403);
536
536
  if (fresh)
537
537
  fresh.result = { ...value, thread: { ...value.thread, projectId: fresh.projectId } };
538
- return { mode, approvalPolicy: value.approvalPolicy, reviewer: value.approvalsReviewer ?? 'user', sandbox: value.sandbox?.type ?? 'unknown' };
538
+ return { mode, mobileControl: this.permissionAllowed(value), approvalPolicy: value.approvalPolicy, reviewer: value.approvalsReviewer ?? 'user', sandbox: value.sandbox?.type ?? 'unknown' };
539
539
  }
540
540
  async extensions(projectId, threadId, refresh = false) {
541
541
  const project = this.projects.find(p => p.id === projectId);
package/dist/deepseek.js CHANGED
@@ -344,7 +344,7 @@ export class DeepSeekBackend {
344
344
  f.values = values;
345
345
  const options = await this.permissionOptions(), mode = values.permissions?.currentValue ?? 'custom';
346
346
  const state = this.turnState(f);
347
- return { runtime: await this.runtime(id, values), name: f.values.title || this.title(row), latestTurnId: state.latest, active: !!state.active, turnId: state.active, waiting: [...this.pending.values()].some(p => p.threadId === id && p.visible), permissions: { mode, options, mobileControl: options.some(o => o.value === mode && (!o.requiresConfirmation || this.permissionSelections.get(permissionKey(projectId, id)) === mode)) } };
347
+ return { runtime: await this.runtime(id, values), name: f.values.title || this.title(row), latestTurnId: state.latest, active: !!state.active, turnId: state.active, waiting: [...this.pending.values()].some(p => p.threadId === id && p.visible), permissions: { mode, options, mobileControl: options.some(o => o.value === mode) } };
348
348
  }
349
349
  goalView(goal) {
350
350
  return goal ? { objective: goal.objective, status: goal.phase, automatic: goal.activation === 'armed', version: digest({ id: goal.id, revision: goal.revision, phase: goal.phase, activation: goal.activation }) } : null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fxz26284407/yuanma-gateway",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": "22.x"
@@ -55,4 +55,3 @@
55
55
  "registry": "https://registry.npmjs.org"
56
56
  }
57
57
  }
58
-