fix: fallback chain for step retrieval (5 method+field combos)

This commit is contained in:
2026-03-07 19:32:32 +09:00
parent b6adeff402
commit dfc76a9b4b
4 changed files with 50 additions and 15 deletions

Binary file not shown.

View File

@@ -304,13 +304,30 @@ function activate(context) {
return; return;
} }
const trajId = current.trajectoryId; const trajId = current.trajectoryId;
// Fetch actual steps to detect changes // Try multiple RPC methods and field name variants
const stepsResult = await lsRPC('GetCascadeTrajectorySteps', { const attempts = [
trajectoryId: trajId, { method: 'GetCascadeTrajectorySteps', params: { trajectoryId: trajId } },
}); { method: 'GetCascadeTrajectory', params: { trajectoryId: trajId } },
if (isFirstPoll && stepsResult) { { method: 'GetCascadeTrajectorySteps', params: { cascadeId: trajId } },
console.log(`Gravity Bridge: [LS] steps response keys: ${typeof stepsResult === 'object' ? Object.keys(stepsResult).join(', ') : typeof stepsResult}`); { method: 'GetCascadeTrajectory', params: { cascadeId: trajId } },
console.log(`Gravity Bridge: [LS] steps sample: ${JSON.stringify(stepsResult).substring(0, 800)}`); { method: 'GetUserTrajectory', params: { trajectoryId: trajId } },
];
let stepsResult = null;
for (const attempt of attempts) {
const res = await lsRPC(attempt.method, attempt.params);
if (res && !res.code && !res.message?.includes('not found')) {
stepsResult = res;
if (isFirstPoll) {
console.log(`Gravity Bridge: [LS] ✅ ${attempt.method}(${JSON.stringify(attempt.params).substring(0, 50)}) worked!`);
console.log(`Gravity Bridge: [LS] steps response keys: ${Object.keys(res).join(', ')}`);
console.log(`Gravity Bridge: [LS] steps sample: ${JSON.stringify(res).substring(0, 800)}`);
}
break;
}
if (isFirstPoll) {
const errMsg = res?.message || res?.code || 'null/empty';
console.log(`Gravity Bridge: [LS] ❌ ${attempt.method}(${Object.keys(attempt.params)[0]}): ${errMsg}`);
}
} }
if (!stepsResult) { if (!stepsResult) {
return; return;

File diff suppressed because one or more lines are too long

View File

@@ -284,16 +284,34 @@ export function activate(context: vscode.ExtensionContext) {
const trajId = current.trajectoryId; const trajId = current.trajectoryId;
// Fetch actual steps to detect changes // Try multiple RPC methods and field name variants
const stepsResult = await lsRPC('GetCascadeTrajectorySteps', { const attempts = [
trajectoryId: trajId, { method: 'GetCascadeTrajectorySteps', params: { trajectoryId: trajId } },
}); { method: 'GetCascadeTrajectory', params: { trajectoryId: trajId } },
{ method: 'GetCascadeTrajectorySteps', params: { cascadeId: trajId } },
{ method: 'GetCascadeTrajectory', params: { cascadeId: trajId } },
{ method: 'GetUserTrajectory', params: { trajectoryId: trajId } },
];
if (isFirstPoll && stepsResult) { let stepsResult: any = null;
console.log(`Gravity Bridge: [LS] steps response keys: ${typeof stepsResult === 'object' ? Object.keys(stepsResult).join(', ') : typeof stepsResult}`); for (const attempt of attempts) {
console.log(`Gravity Bridge: [LS] steps sample: ${JSON.stringify(stepsResult).substring(0, 800)}`); const res = await lsRPC(attempt.method, attempt.params);
if (res && !res.code && !res.message?.includes('not found')) {
stepsResult = res;
if (isFirstPoll) {
console.log(`Gravity Bridge: [LS] ✅ ${attempt.method}(${JSON.stringify(attempt.params).substring(0, 50)}) worked!`);
console.log(`Gravity Bridge: [LS] steps response keys: ${Object.keys(res).join(', ')}`);
console.log(`Gravity Bridge: [LS] steps sample: ${JSON.stringify(res).substring(0, 800)}`);
}
break;
}
if (isFirstPoll) {
const errMsg = res?.message || res?.code || 'null/empty';
console.log(`Gravity Bridge: [LS] ❌ ${attempt.method}(${Object.keys(attempt.params)[0]}): ${errMsg}`);
}
} }
if (!stepsResult) { return; } if (!stepsResult) { return; }
// Count steps — detect new ones // Count steps — detect new ones