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

View File

@@ -304,13 +304,30 @@ function activate(context) {
return;
}
const trajId = current.trajectoryId;
// Fetch actual steps to detect changes
const stepsResult = await lsRPC('GetCascadeTrajectorySteps', {
trajectoryId: trajId,
});
if (isFirstPoll && stepsResult) {
console.log(`Gravity Bridge: [LS] steps response keys: ${typeof stepsResult === 'object' ? Object.keys(stepsResult).join(', ') : typeof stepsResult}`);
console.log(`Gravity Bridge: [LS] steps sample: ${JSON.stringify(stepsResult).substring(0, 800)}`);
// Try multiple RPC methods and field name variants
const attempts = [
{ 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 } },
];
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) {
return;

File diff suppressed because one or more lines are too long