* fix(#2991): route /gsd command output through Pi's display shape The registerCommand('gsd') handler returned a bare string, which Pi's ExtensionAPI does not display. Changed all return paths to Pi's structured { content: [{ type: 'text', text }] } shape, matching the gsd_invoke tool's proven output contract. Updated 2 reachability tests that asserted the old bare-string return shape. * chore(#2991): backfill changeset PR number 3097 --------- Co-authored-by: sim <sim@local>
This commit is contained in:
11
pi/gsd.cjs
11
pi/gsd.cjs
@@ -287,11 +287,16 @@ module.exports = function gsdPiExtension(pi) {
|
||||
try {
|
||||
({ dispatchGsdCommand } = require(path.join(GSD_CORE, 'bin', 'lib', 'shell-command-projection.cjs')));
|
||||
} catch (e) {
|
||||
return `GSD engine unavailable: ${e && e.message ? e.message : String(e)}`;
|
||||
// #2991: return the structured { content } shape Pi's ExtensionAPI
|
||||
// displays, not a bare string (which Pi silently drops).
|
||||
return { content: [{ type: 'text', text: `GSD engine unavailable: ${e && e.message ? e.message : String(e)}` }] };
|
||||
}
|
||||
const result = dispatchGsdCommand({ family, subcommand, args: rest, cwd });
|
||||
if (result.ok) return result.stdout;
|
||||
return `GSD error: ${result.stderr || result.stdout || `dispatch failed (exit ${result.code})`}`;
|
||||
// #2991: match gsd_invoke's proven output shape so Pi actually displays it.
|
||||
const text = result.ok
|
||||
? result.stdout
|
||||
: `GSD error: ${result.stderr || result.stdout || `dispatch failed (exit ${result.code})`}`;
|
||||
return { content: [{ type: 'text', text }] };
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user