mirror of
https://github.com/OpenRouterTeam/spawn.git
synced 2026-05-22 03:14:57 +00:00
fix: populate connection fields in --headless --output json result (#2716)
After runBashHeadless() succeeds, read the spawn record saved during orchestration and populate ip_address, ssh_user, server_id, and server_name in the SpawnResult output. Closes #2715 Co-authored-by: Claude <claude@anthropic.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
2e26d56625
commit
c6087534aa
1 changed files with 23 additions and 1 deletions
|
|
@ -6,7 +6,7 @@ import * as path from "node:path";
|
|||
import * as p from "@clack/prompts";
|
||||
import pc from "picocolors";
|
||||
import { buildDashboardHint, EXIT_CODE_GUIDANCE, SIGNAL_GUIDANCE } from "../guidance-data.js";
|
||||
import { generateSpawnId, getActiveServers, saveSpawnRecord } from "../history.js";
|
||||
import { generateSpawnId, getActiveServers, loadHistory, saveSpawnRecord } from "../history.js";
|
||||
import { loadManifest, RAW_BASE, REPO, SPAWN_CDN } from "../manifest.js";
|
||||
import { validateIdentifier, validatePrompt, validateScriptContent } from "../security.js";
|
||||
import { asyncTryCatch, isFileError, tryCatch, tryCatchIf } from "../shared/result.js";
|
||||
|
|
@ -898,10 +898,32 @@ export async function cmdRunHeadless(agent: string, cloud: string, opts: Headles
|
|||
);
|
||||
}
|
||||
|
||||
// Read the spawn record saved during orchestration to populate connection fields
|
||||
const history = loadHistory();
|
||||
const record = history
|
||||
.filter((r) => r.agent === resolvedAgent && r.cloud === resolvedCloud && r.connection && !r.connection.deleted)
|
||||
.pop();
|
||||
|
||||
const result: SpawnResult = {
|
||||
status: "success",
|
||||
cloud: resolvedCloud,
|
||||
agent: resolvedAgent,
|
||||
...(record?.connection
|
||||
? {
|
||||
ip_address: record.connection.ip,
|
||||
ssh_user: record.connection.user,
|
||||
...(record.connection.server_id
|
||||
? {
|
||||
server_id: record.connection.server_id,
|
||||
}
|
||||
: {}),
|
||||
...(record.connection.server_name
|
||||
? {
|
||||
server_name: record.connection.server_name,
|
||||
}
|
||||
: {}),
|
||||
}
|
||||
: {}),
|
||||
};
|
||||
|
||||
headlessOutput(result, outputFormat);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue