@fxz26284407/yuanma-gateway 0.1.12 → 0.1.13

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.
@@ -44,7 +44,7 @@ export class AntigravityNative {
44
44
  const desktop = await platform.antigravity.discover();
45
45
  let found;
46
46
  for (const port of desktop.ports) {
47
- const authority = { pid: desktop.pid, port, token: desktop.token };
47
+ const authority = { pid: desktop.pid, port, token: desktop.token, version: desktop.version };
48
48
  try {
49
49
  cascadeSummaries(await this.rpc(authority, 'GetAllCascadeTrajectories', { excludeSubtrajectories: true }, 5000));
50
50
  found = authority;
@@ -62,6 +62,11 @@ export class AntigravityNative {
62
62
  await this.connect();
63
63
  const authority = this.#authority;
64
64
  try {
65
+ if (method === 'GetAllCascadeTrajectories' && authority.version === '2.31.0') {
66
+ const snapshot = await this.readState('JetboxSubscribeToSummaries', {});
67
+ requireValue(snapshot.updates && typeof snapshot.updates === 'object' && !Array.isArray(snapshot.updates), 'PROTOCOL_INCOMPATIBLE', '桌面会话订阅格式已变化', 503);
68
+ return { trajectorySummaries: snapshot.updates };
69
+ }
65
70
  const result = await this.rpc(authority, method, params, timeout, signal);
66
71
  if (method === 'GetCascadeTrajectorySteps') {
67
72
  requireValue(result && typeof result === 'object' && !Array.isArray(result) && (result.steps === undefined || Array.isArray(result.steps)), 'PROTOCOL_INCOMPATIBLE', '原生步骤列表格式已变化', 503);
@@ -151,8 +151,9 @@ export class MacOsAdapter extends HostAdapter {
151
151
  antigravity = {
152
152
  unavailableMessage: 'Antigravity 桌面会话接口未就绪', diffAvailable: true,
153
153
  discover: async () => {
154
- const app = '/Applications/Antigravity.app/Contents/Resources/app', binary = '/Applications/Antigravity.app/Contents/Resources/bin/language_server';
155
- requireValue(JSON.parse(await readFile(join(app, 'package.json'), 'utf8')).version === '2.29.0', 'PROTOCOL_INCOMPATIBLE', '当前仅适配 Antigravity App 2.29.0,请核对桌面版本', 503);
154
+ const binary = '/Applications/Antigravity.app/Contents/Resources/bin/language_server';
155
+ const { stdout: version } = await exec('/usr/libexec/PlistBuddy', ['-c', 'Print :CFBundleShortVersionString', '/Applications/Antigravity.app/Contents/Info.plist']);
156
+ requireValue(['2.29.0', '2.31.0'].includes(version.trim()), 'PROTOCOL_INCOMPATIBLE', '当前适配 Antigravity App 2.29.0、2.31.0,请核对桌面版本', 503);
156
157
  const { stdout } = await exec('/bin/ps', ['-axo', 'uid,pid,ppid,command'], { maxBuffer: 4 * 1024 * 1024 });
157
158
  const rows = stdout.split('\n').flatMap(line => {
158
159
  const match = /^\s*(\d+)\s+(\d+)\s+(\d+)\s+(.*)$/.exec(line);
@@ -171,7 +172,7 @@ export class MacOsAdapter extends HostAdapter {
171
172
  requireValue(ports.length > 0, 'BACKEND_UNAVAILABLE', '无法核实 Antigravity 桌面监听地址', 503);
172
173
  const file = await stat(binary);
173
174
  requireValue(file.isFile() && !(file.mode & 0o002), 'UNSAFE_STORAGE', 'Antigravity 可执行文件权限异常', 403);
174
- return { ...row, ports };
175
+ return { ...row, ports, version: version.trim() };
175
176
  },
176
177
  diff: async (path, original, modified) => new Promise((ok, no) => {
177
178
  const child = this.spawn('/usr/bin/diff', ['-u', '-L', path, '-L', path, original.length ? '/dev/fd/3' : '/dev/null', modified.length ? '/dev/fd/4' : '/dev/null'], { stdio: ['ignore', 'pipe', 'ignore', 'pipe', 'pipe'] });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fxz26284407/yuanma-gateway",
3
- "version": "0.1.12",
3
+ "version": "0.1.13",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": "22.x || 26.x"