mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-29 23:56:43 +01:00
feat(ssh): use the agent AI account in new environments (#21248)
Use the agent-selected AI account for new SSH environments. Preserve
remote-machine authentication for existing environments and expose it as
an advanced option. Keep managed credentials private while preserving
supported conversation state and credential refreshes across turns.
Validated with focused route, adapter, lifecycle, and real-process tests;
final CI passed on d634944df1.
Greptile Apex reviewed that revision at 5/5 with no unresolved threads.
External neutral security reports remain documented in the pull request.
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
2a8b485140
commit
12aa08721c
77 files changed
+6115
-3898
No files matched your search
@@ -16,6 +16,23 @@ import {
|
||||
import { sessionCodec as acpxSessionCodec } from "@paperclipai/adapter-utils/acpx-engine/session-codec";
|
||||
|
||||
describe("adapter session codecs", () => {
|
||||
it.each([claudeSessionCodec.serialize, claudeSessionCodec.deserialize])("keeps only normalized Claude remote identity and valid conversation references", transform => {
|
||||
const params = {
|
||||
sessionId: "11111111-1111-4111-8111-111111111111",
|
||||
sshClaudeConversationId: "a".repeat(64), sshClaudeAccountScope: "b".repeat(64),
|
||||
remoteExecution: { transport: "ssh", host: "fixture.example.test", port: 22, username: "agent", remoteCwd: "/work",
|
||||
useHostAuth: false, privateKey: "fixture-private-key", tailscaleSocksProxySocketPath: "/fixture/socket" },
|
||||
};
|
||||
const output = transform(params)!;
|
||||
expect(output).toMatchObject({ sessionId: params.sessionId, sshClaudeConversationId: params.sshClaudeConversationId,
|
||||
sshClaudeAccountScope: params.sshClaudeAccountScope, remoteExecution: { transport: "ssh", host: "fixture.example.test", useHostAuth: false } });
|
||||
expect(JSON.stringify(output)).not.toContain("fixture-private-key");
|
||||
expect(JSON.stringify(output)).not.toContain("/fixture/socket");
|
||||
const invalid = transform({ ...params, sshClaudeConversationId: "../../untrusted" })!;
|
||||
expect(invalid.sshClaudeConversationId).toBeUndefined();
|
||||
expect(invalid.sshClaudeAccountScope).toBeUndefined();
|
||||
});
|
||||
|
||||
it("normalizes claude session params with cwd", () => {
|
||||
const parsed = claudeSessionCodec.deserialize({
|
||||
session_id: "claude-session-1",
|
||||
|
||||
@@ -575,6 +575,24 @@ describe("agent test-environment route", () => {
|
||||
expect(mockCopilotModels).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it.each([undefined, true, false])("uses the selected SSH authentication source for probes (%s)", async useHostAuth => {
|
||||
const environmentId = "11111111-1111-4111-8111-111111111111";
|
||||
mockEnvironmentService.getById.mockResolvedValue({ id: environmentId, name: "SSH", driver: "ssh",
|
||||
config: { ...(useHostAuth !== undefined ? { useHostAuth } : {}), host: "fixture.invalid", username: "fixture", remoteWorkspacePath: "/workspace" } });
|
||||
const target = { kind: "remote", transport: "ssh", remoteCwd: "/workspace", spec: { host: "fixture.invalid", port: 22, username: "fixture", remoteCwd: "/workspace", remoteWorkspacePath: "/workspace", useHostAuth } };
|
||||
mockResolveEnvironmentExecutionTarget.mockResolvedValue(target);
|
||||
const response = await request(await createApp()).post("/api/companies/company-1/adapters/external_test/test-environment")
|
||||
.send({ adapterConfig: {}, environmentId });
|
||||
if (useHostAuth === false) {
|
||||
expect(response.status, JSON.stringify(response.body)).toBe(422);
|
||||
expect(response.body.code).toBe("ssh_ai_connection_required");
|
||||
expect(testEnvironmentSpy).not.toHaveBeenCalled();
|
||||
} else {
|
||||
expect(response.status, JSON.stringify(response.body)).toBe(200);
|
||||
expect(testEnvironmentSpy).toHaveBeenCalledWith(expect.objectContaining({ executionTarget: target }));
|
||||
}
|
||||
});
|
||||
|
||||
it("tests the instance default sandbox when the agent inherits its environment", async () => {
|
||||
const environmentId = "11111111-1111-4111-8111-111111111111";
|
||||
mockInstanceSettingsService.get.mockResolvedValue({ defaultEnvironmentId: environmentId });
|
||||
|
||||
@@ -27,6 +27,8 @@ import { legacyExecutionNeedsReconciliation } from "../services/legacy-execution
|
||||
import { getServerAdapter, registerServerAdapter, unregisterServerAdapter } from "../adapters/index.js";
|
||||
import { waitForPendingRunFailureReports } from "../services/run-failure-report.js";
|
||||
import { dotRunnerBroker } from "../services/dot-runner-broker.js";
|
||||
import { environmentService } from "../services/environments.js";
|
||||
import * as executionConfiguration from "../services/heartbeat/execution-configuration.js";
|
||||
|
||||
const captureRunFailure = vi.hoisted(() => vi.fn());
|
||||
vi.mock("../sentry.js", async (importOriginal) => ({
|
||||
@@ -446,6 +448,52 @@ describe("durable, authorized connection routing", () => {
|
||||
expect(resolveTaskSessionConfigFreshness({ hasTaskSession: true, configuredModel: String(selected.runtimeConfig.model), taskSessionParams: { __paperclipConfiguredModel: selected.runtimeConfig.model, __paperclipConfigFingerprint: previous.fingerprint, __paperclipConfigFingerprintVersion: previous.version, __paperclipConfigCategoryFingerprints: previous.categoryFingerprints }, configMetadata: current, compatibleConfigMetadata }).reset).toBe(false);
|
||||
} finally { await before.cleanup(); await after.cleanup(); }
|
||||
});
|
||||
it.each([
|
||||
{ useHostAuth: undefined, nativeHomeMode: undefined }, { useHostAuth: true, nativeHomeMode: undefined },
|
||||
{ useHostAuth: false, nativeHomeMode: undefined }, { useHostAuth: false, nativeHomeMode: "preconfigured" },
|
||||
])("applies SSH authentication before selecting a busy pool (%j)", async ({ useHostAuth, nativeHomeMode }) => {
|
||||
const original = await instanceSettingsService(db).getExperimental();
|
||||
await instanceSettingsService(db).updateExperimental({ enableAiConnectionRouters: true, enableNativeRunner: true, enableEnvironments: true, enableWorktreeRunExecution: true });
|
||||
const pool = await makePool({ members: [members[0]!] });
|
||||
const environment = await environmentService(db).create(companyId, { name: `SSH routing fixture ${useHostAuth} ${nativeHomeMode}`, driver: "ssh", status: "active", envVars: {}, config: {
|
||||
host: "ssh.example.test", username: "fixture", remoteWorkspacePath: "/workspace", ...(useHostAuth === undefined ? {} : { useHostAuth }),
|
||||
} });
|
||||
const configured = { provider: "acpx", acpxAgent: "claude", model: "fixture-host-model", ...(nativeHomeMode ? { homeMode: nativeHomeMode } : {}) };
|
||||
const [agent] = await db.insert(agents).values({ companyId, name: "SSH routing fixture", status: "idle", adapterType: "paperclip_runner",
|
||||
adapterConfig: configured, defaultEnvironmentId: environment.id,
|
||||
runtimeConfig: { aiConnection: { mode: "router", connectionId: pool.id }, heartbeat: { enabled: false, wakeOnDemand: true } } }).returning();
|
||||
const [issue] = await db.insert(issues).values({ companyId, title: "SSH pool routing fixture", status: "todo", assigneeAgentId: agent.id, responsibleUserId: "alice", createdByUserId: "alice" }).returning();
|
||||
proposal.mockClear();
|
||||
proposal.mockImplementation(async () => ({ kind: "exhausted", retryAt: new Date(Date.now() + 60_000).toISOString(), skipped: {} }));
|
||||
const preparation = vi.spyOn(executionConfiguration, "prepareHeartbeatExecutionConfiguration").mockRejectedValue(new Error("fixture stopped before provider configuration"));
|
||||
const heartbeat = heartbeatService(db, { pluginWorkerManager: worker, runtimeEnv: {} });
|
||||
try {
|
||||
const run = await heartbeat.wakeup(agent.id, { source: "assignment", reason: "issue_assigned", triggerDetail: "system",
|
||||
payload: { issueId: issue.id }, contextSnapshot: { issueId: issue.id, responsibleUserId: "alice" } });
|
||||
expect(run).not.toBeNull();
|
||||
await heartbeat.drainActiveRunExecutions();
|
||||
const saved = await heartbeat.getRun(run!.id);
|
||||
if (useHostAuth === false) {
|
||||
expect(proposal).toHaveBeenCalled();
|
||||
expect(preparation).not.toHaveBeenCalled();
|
||||
expect(saved?.errorCode).toBe("ai_connection_pool_exhausted");
|
||||
} else {
|
||||
expect(proposal).not.toHaveBeenCalled();
|
||||
expect(saved?.contextSnapshot?.aiRouterSelection).toBeUndefined();
|
||||
expect(saved?.error).toContain("fixture stopped before provider configuration");
|
||||
expect(preparation).toHaveBeenCalledWith(expect.anything(), expect.objectContaining({ config: expect.objectContaining({
|
||||
aiBinding: undefined, sourceWorkspaceConfig: expect.objectContaining(configured),
|
||||
}) }));
|
||||
}
|
||||
} finally {
|
||||
await db.update(agents).set({ status: "paused" }).where(eq(agents.id, agent.id));
|
||||
await heartbeat.drainActiveRunExecutions();
|
||||
preparation.mockRestore();
|
||||
proposal.mockImplementation(defaultProposal);
|
||||
await instanceSettingsService(db).updateExperimental(original);
|
||||
}
|
||||
}, 30_000);
|
||||
|
||||
it("admits a healthy pool member when the saved Grok connection is held", async () => {
|
||||
const original = await instanceSettingsService(db).getExperimental();
|
||||
await instanceSettingsService(db).updateExperimental({ enableAiConnectionRouters: true,
|
||||
|
||||
@@ -61,8 +61,11 @@ function oracle(db: Db, scope: AttentionRetentionScope, cursor?: Cursor, sourceI
|
||||
|
||||
async function seed(company: string, prefix: string, status: string, size: number) {
|
||||
await db.execute(sql`insert into companies (id, name, issue_prefix, status) values (${company}::uuid, ${prefix}, ${prefix}, ${status})`);
|
||||
await db.execute(sql`insert into agents (company_id, name, status)
|
||||
select ${company}::uuid, 'Agent ' || n, case when n % 3 = 0 then 'error' else 'idle' end from generate_series(1, 6) n`);
|
||||
// Put error agents in the archived and kept retention positions. The
|
||||
// unretained error added below guarantees a candidate of this kind.
|
||||
await db.execute(sql`insert into agents (id, company_id, name, status)
|
||||
select (left(${company}::text, 24) || lpad(n::text, 12, '0'))::uuid,
|
||||
${company}::uuid, 'Agent ' || n, case when n in (4, 6) then 'error' else 'idle' end from generate_series(1, 6) n`);
|
||||
// Issues: blocked, in review, hidden, harness-owned and ordinary ones.
|
||||
await db.execute(sql`insert into issues (company_id, title, status, hidden_at, harness_kind, updated_at)
|
||||
select ${company}::uuid, 'Issue ' || n,
|
||||
@@ -108,6 +111,8 @@ function oracle(db: Db, scope: AttentionRetentionScope, cursor?: Cursor, sourceI
|
||||
union all select company_id, 'decision', id::text, row_number() over (order by id) from decisions where company_id = ${company}::uuid
|
||||
union all select company_id, 'agent_error_alert', id::text, row_number() over (order by id) from agents where company_id = ${company}::uuid
|
||||
) x where n % 2 = 0`);
|
||||
await db.execute(sql`insert into agents (company_id, name, status)
|
||||
values (${company}::uuid, 'Unretained error agent', 'error')`);
|
||||
}
|
||||
|
||||
beforeAll(async () => {
|
||||
|
||||
@@ -3,6 +3,17 @@ import { HttpError } from "../errors.js";
|
||||
import { normalizeEnvironmentConfig, parseEnvironmentDriverConfig } from "../services/environment-config.ts";
|
||||
|
||||
describe("environment config helpers", () => {
|
||||
it.each([undefined, true, false])("preserves SSH authentication compatibility when useHostAuth is %s", useHostAuth => {
|
||||
const config = normalizeEnvironmentConfig({ driver: "ssh", config: {
|
||||
host: "ssh.example.test", username: "fixture", remoteWorkspacePath: "/workspace",
|
||||
...(useHostAuth !== undefined ? { useHostAuth } : {}),
|
||||
} });
|
||||
expect(config.useHostAuth).toBe(useHostAuth);
|
||||
expect(Object.hasOwn(config, "useHostAuth")).toBe(useHostAuth !== undefined);
|
||||
expect(() => normalizeEnvironmentConfig({ driver: "ssh", config: { ...config, useHostAuth: "false" } })).toThrow(HttpError);
|
||||
});
|
||||
|
||||
|
||||
it("normalizes SSH config into its canonical stored shape", () => {
|
||||
const config = normalizeEnvironmentConfig({
|
||||
driver: "ssh",
|
||||
|
||||
@@ -2111,6 +2111,27 @@ describe("environment routes", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it.each([undefined, true, false])("defaults new SSH API environments to managed auth while preserving explicit %s", async (useHostAuth) => {
|
||||
const environment = { ...createEnvironment(), driver: "ssh" as const, config: createSshConfig() };
|
||||
mockEnvironmentService.create.mockResolvedValue(environment);
|
||||
const app = createApp(localBoardActor());
|
||||
const res = await request(app).post("/api/companies/company-1/environments").send({
|
||||
name: "SSH Fixture", driver: "ssh", config: { ...createSshConfig(), ...(useHostAuth === undefined ? {} : { useHostAuth }) },
|
||||
});
|
||||
expect(res.status).toBe(201);
|
||||
expect(mockEnvironmentService.create.mock.calls[0]![0].config.useHostAuth).toBe(useHostAuth ?? false);
|
||||
});
|
||||
|
||||
it("preserves absent authentication on an existing SSH API environment update", async () => {
|
||||
const environment = { ...createEnvironment(), id: "env-ssh", driver: "ssh" as const, config: createSshConfig() };
|
||||
mockEnvironmentService.getById.mockResolvedValue(environment);
|
||||
mockEnvironmentService.update.mockResolvedValue(environment);
|
||||
const app = createApp(localBoardActor());
|
||||
const res = await request(app).patch("/api/environments/env-ssh").send({ config: { host: "changed.example.test" } });
|
||||
expect(res.status).toBe(200);
|
||||
expect(mockEnvironmentService.update.mock.calls[0]![1].config).not.toHaveProperty("useHostAuth");
|
||||
});
|
||||
|
||||
it("rejects invalid SSH config on create", async () => {
|
||||
const app = createApp(localBoardActor());
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ import * as assignedMcp from "../services/native-runtime/assigned-mcp-tools.js";
|
||||
import * as sentry from "../sentry.js";
|
||||
import { waitForPendingRunFailureReports } from "../services/run-failure-report.js";
|
||||
import { recoveryPostgresSupport, startRecoveryPostgres } from "./helpers/recovery-postgres.js";
|
||||
import { selectHeartbeatEnvironment, type HeartbeatEnvironmentSelectionInput } from "../services/heartbeat/environment-selection.js";
|
||||
import { selectHeartbeatEnvironment, resolveSshAuthenticationBeforeRouting, type HeartbeatEnvironmentSelectionInput } from "../services/heartbeat/environment-selection.js";
|
||||
import { environmentService } from "../services/environments.js";
|
||||
import { executionWorkspaceService } from "../services/execution-workspaces.js";
|
||||
import { buildExecutionWorkspaceAdapterConfig } from "../services/execution-workspace-policy.js";
|
||||
@@ -41,6 +41,21 @@ function deferred<T>() {
|
||||
const skillFailures = vi.hoisted(() => new Map<string, string>());
|
||||
const skillWaits = vi.hoisted(() => new Map<string, () => Promise<void>>());
|
||||
|
||||
describe("SSH authentication before account routing", () => {
|
||||
it.each([
|
||||
{ agentDefaultEnvironmentId: "agent", lowTrustIssueEnvironmentId: null, executionMode: "any", expectedId: "agent", expected: "host" },
|
||||
{ agentDefaultEnvironmentId: null, lowTrustIssueEnvironmentId: null, executionMode: "any", expectedId: "instance", expected: "host" },
|
||||
{ agentDefaultEnvironmentId: "agent", lowTrustIssueEnvironmentId: "sandbox", executionMode: "any", expectedId: "sandbox", expected: null },
|
||||
{ agentDefaultEnvironmentId: "agent", lowTrustIssueEnvironmentId: null, executionMode: "kubernetes", expectedId: null, expected: null },
|
||||
] as const)("honors environment precedence and forced execution policy: %j", async value => {
|
||||
const get = vi.fn(async () => ({ defaultEnvironmentId: "instance", general: { executionMode: value.executionMode } }));
|
||||
const getById = vi.fn(async (id: string) => ({ id, driver: id === "sandbox" ? "sandbox" : "ssh", config: {} } as Environment));
|
||||
expect(await resolveSshAuthenticationBeforeRouting({ ...value, instanceSettings: { get }, environmentsSvc: { getById } })).toBe(value.expected);
|
||||
if (value.expectedId) expect(getById).toHaveBeenCalledExactlyOnceWith(value.expectedId);
|
||||
else expect(getById).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
describe("Runner home mode during recovery preparation", () => {
|
||||
const fingerprint = (effectiveAdapterConfig: Record<string, unknown>) => buildEffectiveRunSessionConfigMetadata({
|
||||
adapterType: "paperclip_runner", effectiveAdapterConfig, agentRuntimeConfig: {}, issueOverrides: null,
|
||||
@@ -333,7 +348,7 @@ describePostgres("heartbeat execution configuration through adapter dispatch", (
|
||||
}
|
||||
});
|
||||
|
||||
async function configuration(f: Awaited<ReturnType<typeof seed>>, config: Record<string, unknown>, snapshot: Record<string, unknown> = {}, type = "paperclip_runner", explicitTaskDirectory = false, requestedExecutionWorkspaceMode: HeartbeatExecutionConfigurationInput["policy"]["requestedExecutionWorkspaceMode"] = "shared_workspace", selectedEnvironmentForConfig: HeartbeatExecutionConfigurationInput["environment"]["selectedEnvironmentForConfig"] = null, pinnedSkillTest?: HeartbeatExecutionConfigurationInput["task"]["pinnedSkillTest"], adoptingLiveRunner = false) {
|
||||
async function configuration(f: Awaited<ReturnType<typeof seed>>, config: Record<string, unknown>, snapshot: Record<string, unknown> = {}, type = "paperclip_runner", explicitTaskDirectory = false, requestedExecutionWorkspaceMode: HeartbeatExecutionConfigurationInput["policy"]["requestedExecutionWorkspaceMode"] = "shared_workspace", selectedEnvironmentForConfig: HeartbeatExecutionConfigurationInput["environment"]["selectedEnvironmentForConfig"] = null, pinnedSkillTest?: HeartbeatExecutionConfigurationInput["task"]["pinnedSkillTest"], adoptingLiveRunner = false, aiBinding?: HeartbeatExecutionConfigurationInput["config"]["aiBinding"]) {
|
||||
const [agent] = await db.update(agents).set({ adapterType: type, adapterConfig: config }).where(eq(agents.id, f.agentId)).returning();
|
||||
const [run] = await db.insert(heartbeatRuns).values({ companyId: f.companyId, agentId: f.agentId, issueId: f.issueId, scopeKind: "issue", status: "running", contextSnapshot: snapshot }).returning();
|
||||
const resolvedInstanceSettings = await instanceSettingsService(db).get();
|
||||
@@ -344,7 +359,7 @@ describePostgres("heartbeat execution configuration through adapter dispatch", (
|
||||
task: { issueId: f.issueId, context: { ...snapshot, issueId: f.issueId }, responsibleUserId: null, pinnedSkillTest, adoptingLiveRunner,
|
||||
acceptedPlanContinuationWake: false, acceptedPlanWakeRoutingDecision: null,
|
||||
taskProjectContext: null, routineEnvContext: { routineId: null, env: null, responsibleUserId: null } },
|
||||
config: { sourceWorkspaceConfig: config, aiBinding: undefined },
|
||||
config: { sourceWorkspaceConfig: config, aiBinding },
|
||||
policy: { trustPreset: { kind: "standard", preset: "standard", boundary: null, sourcePresets: {} }, useIsolatedTaskDirectory: false, explicitTaskDirectory, requestedExecutionWorkspaceMode },
|
||||
environment: { selectedEnvironmentId: environment.id, selectedEnvironmentForConfig: environment,
|
||||
resolvedInstanceSettings, persistedNativeExecutionInput: adoptingLiveRunner
|
||||
@@ -356,6 +371,46 @@ describePostgres("heartbeat execution configuration through adapter dispatch", (
|
||||
}) };
|
||||
}
|
||||
|
||||
it.each([undefined, true, false])("defaults existing SSH environments to remote authentication and honors the saved choice (saved=%s)", async useHostAuth => {
|
||||
const f = await seed(true);
|
||||
const environment = { ...await environmentService(db).ensureLocalEnvironment(), driver: "ssh", config: { ...(useHostAuth !== undefined ? { useHostAuth } : {}), host: "fixture.invalid", username: "fixture", remoteWorkspacePath: "/workspace" } } as Environment;
|
||||
const binding = aiConnectionBindingSchema.parse((await db.select().from(agents).where(eq(agents.id, f.agentId)))[0]!.runtimeConfig!.aiConnection);
|
||||
const prepare = vi.spyOn(aiRuntime, "prepareManagedAiRuntime").mockRejectedValue(new Error("fixture managed account reached"));
|
||||
const opening = await configuration(f, { provider: "codex" }, {}, "paperclip_runner", false, "shared_workspace", environment, undefined, false, binding);
|
||||
if (useHostAuth !== false) {
|
||||
const result = await opening.prepare();
|
||||
expect(result.prepared).toBe(true);
|
||||
if (!result.prepared) throw new Error("SSH configuration failed");
|
||||
expect(result.runtimeConfig.homeMode).toBe("preconfigured");
|
||||
expect(prepare).not.toHaveBeenCalled();
|
||||
} else {
|
||||
await expect(opening.prepare()).rejects.toThrow("fixture managed account reached");
|
||||
expect(prepare).toHaveBeenCalledOnce();
|
||||
}
|
||||
});
|
||||
|
||||
it.each([
|
||||
{ provider: "opencode", model: "openai/gpt-5" },
|
||||
{ provider: "acpx", acpxAgent: "copilot", model: "gpt-5.6-luna" },
|
||||
{ provider: "acpx", acpxAgent: "claude", model: "claude-sonnet-4-6", acpxPermissionMode: "approve-reads" },
|
||||
])("keeps native SSH provider home support during preparation: $provider $acpxAgent", async config => {
|
||||
const f = await seed();
|
||||
const environment = { ...await environmentService(db).ensureLocalEnvironment(), driver: "ssh", config: {
|
||||
host: "fixture.invalid", username: "fixture", remoteWorkspacePath: "/workspace",
|
||||
} } as Environment;
|
||||
const opening = await configuration(f, config, {}, "paperclip_runner", false, "shared_workspace", environment);
|
||||
const result = await opening.prepare();
|
||||
if (!result.prepared) throw new Error("SSH preparation failed");
|
||||
expect(result.runtimeConfig.homeMode).toBe("isolated");
|
||||
});
|
||||
|
||||
it("requires an agent AI account for a new SSH environment when remote authentication is off", async () => {
|
||||
const f = await seed();
|
||||
const environment = { ...await environmentService(db).ensureLocalEnvironment(), driver: "ssh", config: { useHostAuth: false } } as Environment;
|
||||
const opening = await configuration(f, { provider: "codex" }, {}, "paperclip_runner", false, "shared_workspace", environment);
|
||||
await expect(opening.prepare()).rejects.toMatchObject({ resultJson: { configurationIncomplete: { reason: "ssh_ai_connection_required" } } });
|
||||
});
|
||||
|
||||
it("delivers the Studio pin instead of ordinary assignments and recovers that exact native selection", async () => {
|
||||
const f = await seed(), skills = companySkillService(db);
|
||||
const selected = await skills.createLocalSkill(f.companyId, { name: "Unassigned Studio skill", markdown: "# Studio\nOriginal selected bytes.\n" });
|
||||
|
||||
@@ -24,7 +24,7 @@ vi.mock("node:child_process", async importOriginal => {
|
||||
spawn: (file: string, args: string[], options: Parameters<typeof actual.spawn>[2]) => {
|
||||
if (file !== "ssh") return actual.spawn(file, args, options);
|
||||
mocks.wire.push({ file, args, stdin: true });
|
||||
return actual.spawn(process.execPath, ["-e", 'process.stdout.write(require("node:fs").readFileSync(0,"utf8"))'], options);
|
||||
return actual.spawn(process.execPath, ["-e", 'const wire = require("node:fs").readFileSync(0); process.stdout.write(wire.subarray(wire.indexOf(10) + 1))'], options);
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user