Files
PaperClipAI/packages/adapter-utils/src/ssh-auth.test.ts
T
Devin FoleyandPaperclip 12aa08721c 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>
2026-11-13 13:20:13 -08:00

23 lines
1.4 KiB
TypeScript

import { describe, expect, it } from "vitest";
import { parseSshRemoteExecutionSpec } from "./ssh.js";
import { buildRemoteExecutionSessionIdentity, remoteExecutionSessionMatches } from "./remote-managed-runtime.js";
const spec = { host: "ssh.example.test", port: 22, username: "fixture", remoteCwd: "/workspace", remoteWorkspacePath: "/workspace", privateKey: null, knownHosts: null, strictHostKeyChecking: true };
describe("SSH authentication source", () => {
it.each([undefined, true, false])("preserves the SSH authentication option through target parsing (%s)", useHostAuth => {
const target = { ...spec, ...(useHostAuth !== undefined ? { useHostAuth } : {}) };
expect(parseSshRemoteExecutionSpec(target)).toEqual(target);
expect(parseSshRemoteExecutionSpec({ ...spec, useHostAuth: "false" })).toBeNull();
});
it("starts a fresh SSH session when its authentication source changes", () => {
const saved = buildRemoteExecutionSessionIdentity(spec);
expect(remoteExecutionSessionMatches(saved, { ...spec })).toBe(true);
expect(remoteExecutionSessionMatches(saved, { ...spec, useHostAuth: false })).toBe(false);
const configured = buildRemoteExecutionSessionIdentity({ ...spec, useHostAuth: false });
expect(remoteExecutionSessionMatches(configured, { ...spec, useHostAuth: false })).toBe(true);
expect(remoteExecutionSessionMatches(configured, { ...spec, useHostAuth: true })).toBe(false);
});
});