mirror of
https://github.com/OpenRouterTeam/spawn.git
synced 2026-04-28 03:49:31 +00:00
fix: resolve 4 production TypeScript type errors (#3266)
- local.ts: spread ReadonlyArray into mutable array for Bun.spawn - run.ts: capture optional fields in local vars for proper narrowing - delete.ts: filter SpawnRecordSchema output for required id field Agent: code-health Co-authored-by: B <6723574+louisgv@users.noreply.github.com> Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
35c436b876
commit
187595283e
4 changed files with 24 additions and 14 deletions
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@openrouter/spawn",
|
||||
"version": "1.0.2",
|
||||
"version": "1.0.3",
|
||||
"type": "module",
|
||||
"bin": {
|
||||
"spawn": "cli.js"
|
||||
|
|
|
|||
|
|
@ -319,8 +319,11 @@ export async function pullChildHistory(record: SpawnRecord): Promise<void> {
|
|||
const childRecords: SpawnRecord[] = [];
|
||||
for (const el of parsed) {
|
||||
const result = v.safeParse(SpawnRecordSchema, el);
|
||||
if (result.success) {
|
||||
childRecords.push(result.output);
|
||||
if (result.success && result.output.id) {
|
||||
childRecords.push({
|
||||
...result.output,
|
||||
id: result.output.id,
|
||||
});
|
||||
}
|
||||
}
|
||||
if (childRecords.length > 0) {
|
||||
|
|
|
|||
|
|
@ -1196,11 +1196,13 @@ export async function cmdRunHeadless(agent: string, cloud: string, opts: Headles
|
|||
if (conn.user && tryCatch(() => validateUsername(conn.user)).ok) {
|
||||
connectionFields.ssh_user = conn.user;
|
||||
}
|
||||
if (conn.server_id && tryCatch(() => validateServerIdentifier(conn.server_id)).ok) {
|
||||
connectionFields.server_id = conn.server_id;
|
||||
const serverId = conn.server_id;
|
||||
if (serverId && tryCatch(() => validateServerIdentifier(serverId)).ok) {
|
||||
connectionFields.server_id = serverId;
|
||||
}
|
||||
if (conn.server_name && tryCatch(() => validateServerIdentifier(conn.server_name)).ok) {
|
||||
connectionFields.server_name = conn.server_name;
|
||||
const serverName = conn.server_name;
|
||||
if (serverName && tryCatch(() => validateServerIdentifier(serverName)).ok) {
|
||||
connectionFields.server_name = serverName;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -83,14 +83,19 @@ export async function runLocal(cmd: string): Promise<void> {
|
|||
|
||||
/** Run a command locally using an argument array (no shell interpretation). */
|
||||
export async function runLocalArgs(args: ReadonlyArray<string>): Promise<void> {
|
||||
const proc = Bun.spawn(args, {
|
||||
stdio: [
|
||||
"inherit",
|
||||
"inherit",
|
||||
"inherit",
|
||||
const proc = Bun.spawn(
|
||||
[
|
||||
...args,
|
||||
],
|
||||
env: process.env,
|
||||
});
|
||||
{
|
||||
stdio: [
|
||||
"inherit",
|
||||
"inherit",
|
||||
"inherit",
|
||||
],
|
||||
env: process.env,
|
||||
},
|
||||
);
|
||||
const exitCode = await proc.exited;
|
||||
if (exitCode !== 0) {
|
||||
throw new Error(`Command failed (exit ${exitCode}): ${args.join(" ")}`);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue