mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-12-03 11:47:42 +01:00
feat(plugins): support agentless harness sign-in (#23392)
## Thinking Path > - Paperclip manages agents and the AI accounts they use. > - A company can connect an account before creating its first agent. > - Some plugin drivers can run sign-in in a dedicated sandbox. > - Core currently selects a saved agent for every plugin login. > - This change lets each driver declare that it can sign in without an agent. ## Linked Issues or Issue Description **Subsystem affected** Environment drivers, managed AI connections, and the agent setup UI. **Current behavior** A company with zero agents cannot start a provider login on a plugin environment, even when that driver can provision a temporary environment. **Proposed behavior** A driver can declare `supportsAgentlessLogin`. Core uses this capability when it selects a login target and acquires the lease. Drivers that omit it retain the existing agent selection. **Reason and benefit** Operators can finish connecting the account before they configure its first agent. **Additional context** The driver capability follows the per-driver adapter declaration in #22827. The onboarding flow keeps the agent readiness check from #23383. ## What Changed - Added the optional capability to the manifest, capabilities response, and login UI. - Kept company and driver validation at sign-in and lease acquisition. - Applied the plugin device-login deadline to sessions with no agent. Ordinary task provisioning keeps its existing contract. ## Verification - 122 tests passed across shared capabilities, environment target resolution, lease construction, device-login HTTP routes, and session lifecycle. - The server typecheck passed. - The SDK input registry matches the source revision. `pnpm verify` requests broader CI coverage for that registry. - After merging the current base, 82 focused tests passed, including the onboarding tests. The UI typecheck passed. All required GitHub checks passed. ## Risks Drivers must advertise this capability only when they can run and clean up a login without an agent. Existing manifests retain their previous behavior. No database migration is required. > For core feature work, check [`ROADMAP.md`](ROADMAP.md) first and discuss it in `#dev` before opening the PR. Feature PRs that overlap with planned core work may need to be redirected — check the roadmap first. See `CONTRIBUTING.md`. ## Model Used OpenAI Codex, GPT-6, with local code inspection and test execution. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [x] All Paperclip CI gates are green - [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge --------- Co-authored-by: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
ce2e6ccc00
commit
07af22c57f
18 files changed
+88
-32
No files matched your search
@@ -638,6 +638,12 @@ that harness as unavailable there. A driver without `supportedAdapters` keeps
|
||||
the earlier behavior: every Runner harness, Claude sign-in, and Codex sign-in
|
||||
when the worker reads credentials back.
|
||||
|
||||
An environment driver that can allocate a dedicated sign-in sandbox may also
|
||||
declare `supportsAgentlessLogin: true`. Core can then acquire a
|
||||
`purpose: "login"` lease without an agent ID, including for a company's first
|
||||
connection. The driver scopes the login and its cleanup to that allocation.
|
||||
`requiresAgent` continues to govern ordinary agent provisioning.
|
||||
|
||||
## Login allocations on an existing computer
|
||||
|
||||
A login-capable environment driver can host authorization on a saved agent's
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
adapterSupportsRemoteManagedEnvironments,
|
||||
environmentLoginRequiresAgent,
|
||||
environmentSupportsLoginPty,
|
||||
getEnvironmentCapabilities,
|
||||
isSandboxProviderSupportedForAdapter,
|
||||
supportedEnvironmentDriversForAdapter,
|
||||
@@ -119,3 +121,14 @@ describe("environment login PTY support", () => {
|
||||
expect(environmentSupportsLoginPty(computer, none, "claude_local")).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
it("offers the declared adapters for a plugin login that needs no agent", () => {
|
||||
const environment = { driver: "plugin", config: { pluginKey: "test", driverKey: "temporary" } };
|
||||
const capabilities = { ...getEnvironmentCapabilities(["codex_local"]), loginPtyDrivers: {
|
||||
"test:temporary": { supportsLoginPty: true, loginAdapters: ["codex_local"], supportsAgentlessLogin: true },
|
||||
} };
|
||||
expect(environmentLoginRequiresAgent(environment, capabilities)).toBe(false);
|
||||
expect(environmentLoginRequiresAgent(environment)).toBe(true);
|
||||
expect(environmentSupportsLoginPty(environment, capabilities, "codex_local")).toBe(true);
|
||||
expect(environmentSupportsLoginPty(environment, capabilities, "claude_local")).toBe(false);
|
||||
});
|
||||
@@ -60,7 +60,7 @@ export interface EnvironmentProviderCapability {
|
||||
|
||||
export interface EnvironmentCapabilities {
|
||||
/** Namespaced plugin driver keys that can host a login on a saved agent. */
|
||||
loginPtyDrivers?: Record<string, { supportsLoginPty: boolean; loginAdapters: string[] }>;
|
||||
loginPtyDrivers?: Record<string, { supportsLoginPty: boolean; supportsAgentlessLogin?: boolean; loginAdapters: string[] }>;
|
||||
adapters: AdapterEnvironmentSupport[];
|
||||
drivers: Record<EnvironmentDriver, EnvironmentSupportStatus>;
|
||||
sandboxProviders: Record<SandboxEnvironmentProvider, EnvironmentProviderCapability>;
|
||||
@@ -203,15 +203,17 @@ export function getEnvironmentCapabilities(
|
||||
};
|
||||
}
|
||||
|
||||
export function environmentLoginRequiresAgent(environment: { driver: string } | null | undefined): boolean {
|
||||
return environment?.driver === "plugin";
|
||||
export function environmentLoginRequiresAgent(environment: { driver: string; config?: Record<string, unknown> | null } | null | undefined, capabilities?: EnvironmentCapabilities | null): boolean {
|
||||
if (environment?.driver !== "plugin") return false;
|
||||
const config = environment.config;
|
||||
return capabilities?.loginPtyDrivers?.[`${config?.pluginKey}:${config?.driverKey}`]?.supportsAgentlessLogin !== true;
|
||||
}
|
||||
|
||||
/** Shared presentation rule for both temporary sandboxes and existing computers. */
|
||||
export function environmentSupportsLoginPty(environment: { driver: string; config: Record<string, unknown> } | null | undefined, capabilities: EnvironmentCapabilities | null | undefined, adapterType?: string): boolean {
|
||||
if (!environment || !capabilities) return false;
|
||||
if (environment.driver === "sandbox") return typeof environment.config.provider === "string" && capabilities.sandboxProviders[environment.config.provider]?.supportsLoginPty === true;
|
||||
if (environmentLoginRequiresAgent(environment)) {
|
||||
if (environment.driver === "plugin") {
|
||||
const driver = capabilities.loginPtyDrivers?.[`${environment.config.pluginKey}:${environment.config.driverKey}`];
|
||||
return driver?.supportsLoginPty === true
|
||||
&& (adapterType === undefined ? driver.loginAdapters.length > 0 : driver.loginAdapters.includes(adapterType));
|
||||
|
||||
@@ -267,6 +267,8 @@ export interface PluginEnvironmentDriverDeclaration {
|
||||
* never starts a login.
|
||||
*/
|
||||
supportsLoginPty?: boolean;
|
||||
/** Browser login can acquire a dedicated environment lease before any agent exists. */
|
||||
supportsAgentlessLogin?: boolean;
|
||||
/**
|
||||
* Deprecated alias for `supportsLoginPty`. It exists only so an external
|
||||
* plugin manifest that declares the old name still loads. The manifest
|
||||
|
||||
@@ -195,6 +195,7 @@ export const pluginEnvironmentDriverDeclarationSchema = z.object({
|
||||
// The neutral transport capability: does the provider host an interactive
|
||||
// login on a real pseudo-terminal? Validate a literal boolean only.
|
||||
supportsLoginPty: z.boolean().optional(),
|
||||
supportsAgentlessLogin: z.boolean().optional(),
|
||||
// Deprecated alias for `supportsLoginPty`. It exists only so an external
|
||||
// plugin manifest that declares the old name still loads. Validate a literal
|
||||
// boolean only. The transform below canonicalizes it onto `supportsLoginPty`
|
||||
|
||||
@@ -1285,7 +1285,8 @@ describe("device login service", () => {
|
||||
}
|
||||
});
|
||||
|
||||
it("holds the session active until exactly five minutes, then times out and deletes", async () => {
|
||||
it.each([{}, { environmentDriver: "plugin", ttlSeconds: 3_600 }])(
|
||||
"holds the session until five minutes and bounds agentless plugin leases %j", async options => {
|
||||
vi.useFakeTimers();
|
||||
try {
|
||||
const store = createMemoryStore();
|
||||
@@ -1293,6 +1294,7 @@ describe("device login service", () => {
|
||||
const service = makeService({ store, runtime });
|
||||
const companyId = randomUUID();
|
||||
const { session, completed } = await service.start({
|
||||
...options,
|
||||
companyId,
|
||||
environmentId: randomUUID(),
|
||||
adapterType: ADAPTER_TYPE,
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import type { Request, Response } from "express";
|
||||
import type { z } from "zod";
|
||||
|
||||
type LoginTarget = { agentId: string | undefined; environment: { driver: string } };
|
||||
|
||||
/**
|
||||
* The result of the shared adapter login start-route spine. The spine returns it
|
||||
* when every guard passes. `ownerUserId` is the immutable session owner from the
|
||||
@@ -9,7 +11,7 @@ import type { z } from "zod";
|
||||
export interface AdapterLoginStartResolution<TData> {
|
||||
ownerUserId: string;
|
||||
data: TData;
|
||||
targetAgentId: string | undefined;
|
||||
target: LoginTarget;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -57,7 +59,7 @@ export interface AdapterLoginStartSpineInput<TData extends { environmentId: stri
|
||||
/**
|
||||
* Checks the sign-in environment and resolves its computer target, when required.
|
||||
*/
|
||||
resolveTargetAgentId: (data: TData) => Promise<string | undefined>;
|
||||
resolveTarget: (data: TData) => Promise<LoginTarget>;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -102,6 +104,6 @@ export async function runAdapterLoginStartSpine<TData extends { environmentId: s
|
||||
if (stop) return null;
|
||||
}
|
||||
|
||||
const targetAgentId = await input.resolveTargetAgentId(data);
|
||||
return { ownerUserId, data, targetAgentId };
|
||||
const target = await input.resolveTarget(data);
|
||||
return { ownerUserId, data, target };
|
||||
}
|
||||
+13
-12
@@ -15,7 +15,7 @@ import { connectionManagementService, continuingConnectionManagement } from "../
|
||||
import { connectionManagementGuard, connectionRequestContext, connectionRequestUserId, aiLoginUserAction } from "./connection-management-authz.js";
|
||||
import { cancellationRequestId } from "../services/native-runtime/native-cancellation-request.js";
|
||||
import { NATIVE_CLEANUP_SETTLING_MESSAGE } from "../services/native-runtime/completed-turn-cleanup.js";
|
||||
import { agentHarnessType, environmentLoginRequiresAgent, isEnvironmentDriverSupportedForAdapter, normalizeClaudeRunnerOptions, type AgentConfigurationWarning, type AgentRunnerChoice } from "@paperclipai/shared";
|
||||
import { agentHarnessType, isEnvironmentDriverSupportedForAdapter, normalizeClaudeRunnerOptions, type AgentConfigurationWarning, type AgentRunnerChoice } from "@paperclipai/shared";
|
||||
import { assertRunnerTaskEnvironmentSupportsHarness, resolveNewAgentRunnerForCompany } from "../services/agent-runner-selection.js";
|
||||
import { PLUGIN_RUNNER_AI_CONNECTION_REQUIRED, pluginEnvironmentRunnerTaskDriver, pluginRunnerAiConnectionRequiredMessage, pluginRunnerAiConnectionRequiredTestResult } from "../services/plugin-runner-ai-connection.js";
|
||||
import { agentEnvironmentTestService } from "../services/agent-environment-test.js";
|
||||
@@ -1581,7 +1581,7 @@ export function agentRoutes(
|
||||
companyId: string,
|
||||
environmentId: string,
|
||||
options: { requireSetupTokenLoginProvider?: boolean; agentId?: string; adapterType?: string; selectComputer?: boolean },
|
||||
): Promise<string | undefined> {
|
||||
) {
|
||||
const target = await resolveLoginEnvironmentTarget(db, { companyId, environmentId, ...options });
|
||||
// Gate the Claude setup-token login on the provider capability. Only a
|
||||
// sandbox provider that advertises the setup-token login capability
|
||||
@@ -1593,7 +1593,7 @@ export function agentRoutes(
|
||||
if (options.requireSetupTokenLoginProvider) {
|
||||
await assertSetupTokenLoginProviderCapability(environmentId);
|
||||
}
|
||||
return target.agentId;
|
||||
return target;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1612,7 +1612,7 @@ export function agentRoutes(
|
||||
environment?.config && typeof environment.config === "object"
|
||||
? (environment.config as Record<string, unknown>)
|
||||
: {};
|
||||
if (environmentLoginRequiresAgent(environment)) {
|
||||
if (environment?.driver === "plugin") {
|
||||
if (!options.pluginWorkerManager || typeof config.pluginKey !== "string" || typeof config.driverKey !== "string") return false;
|
||||
try {
|
||||
const resolved = await resolvePluginEnvironmentDriver({ db, workerManager: options.pluginWorkerManager, config: config as unknown as import("@paperclipai/shared").PluginEnvironmentConfig });
|
||||
@@ -3816,21 +3816,21 @@ export function agentRoutes(
|
||||
requestSchema: startAdapterAuthSessionRequestSchema,
|
||||
invalidRequestError: "The device login start request is invalid.",
|
||||
requestOverrides: { adapterType: type },
|
||||
resolveTargetAgentId: async (data) => {
|
||||
resolveTarget: async (data) => {
|
||||
// The device login runs on a real pseudo-terminal, so it needs a
|
||||
// provider that advertises the login pseudo-terminal capability. Gate
|
||||
// the route on the current provider capability before any session or
|
||||
// lease state. The lease-acquisition path re-checks it from current
|
||||
// runtime state before the provider lease.
|
||||
const targetAgentId = await resolveSandboxLoginTarget(companyId, data.environmentId, {
|
||||
const target = await resolveSandboxLoginTarget(companyId, data.environmentId, {
|
||||
agentId: data.agentId, adapterType: data.adapterType, selectComputer: Boolean(data.aiConnection),
|
||||
});
|
||||
await assertDeviceLoginProviderCapability(data.environmentId, data.adapterType);
|
||||
return targetAgentId;
|
||||
return target;
|
||||
},
|
||||
});
|
||||
if (!resolved) return;
|
||||
const { ownerUserId: startedByUserId, data, targetAgentId } = resolved;
|
||||
const { ownerUserId: startedByUserId, data, target } = resolved;
|
||||
|
||||
if (req.actor.type === "agent" && !data.aiConnection) throw forbidden("Agent logins must save a managed AI account");
|
||||
if (data.aiConnection) {
|
||||
@@ -3843,7 +3843,8 @@ export function agentRoutes(
|
||||
result = await adapterLoginService.start({
|
||||
companyId,
|
||||
environmentId: data.environmentId,
|
||||
agentId: targetAgentId,
|
||||
agentId: target.agentId,
|
||||
environmentDriver: target.environment.driver,
|
||||
adapterType: type,
|
||||
startedByUserId,
|
||||
ttlSeconds: data.ttlSeconds,
|
||||
@@ -7052,7 +7053,7 @@ export function agentRoutes(
|
||||
}
|
||||
return false;
|
||||
},
|
||||
resolveTargetAgentId: (data) =>
|
||||
resolveTarget: (data) =>
|
||||
resolveSandboxLoginTarget(companyId, data.environmentId, {
|
||||
requireSetupTokenLoginProvider: true,
|
||||
agentId: data.agentId,
|
||||
@@ -7061,7 +7062,7 @@ export function agentRoutes(
|
||||
}),
|
||||
});
|
||||
if (!resolved) return;
|
||||
const { ownerUserId, data, targetAgentId } = resolved;
|
||||
const { ownerUserId, data, target } = resolved;
|
||||
const { environmentId, adapterType } = data;
|
||||
if (req.actor.type === "agent" && !data.aiConnection) throw forbidden("Agent logins must save a managed AI account");
|
||||
if (data.aiConnection) {
|
||||
@@ -7075,7 +7076,7 @@ export function agentRoutes(
|
||||
ownerUserId,
|
||||
adapterType,
|
||||
environmentId,
|
||||
agentId: targetAgentId,
|
||||
agentId: target.agentId,
|
||||
confirmedOverwrite,
|
||||
aiConnection: data.aiConnection,
|
||||
managementContext: continuingConnectionManagement(connectionRequestContext(req)),
|
||||
|
||||
@@ -824,6 +824,7 @@ export function environmentRoutes(
|
||||
`${driver.pluginKey}:${driver.driverKey}`, {
|
||||
supportsLoginPty: driver.supportsLoginPty === true,
|
||||
loginAdapters: driver.loginAdapters,
|
||||
...(driver.supportsAgentlessLogin ? { supportsAgentlessLogin: true } : {}),
|
||||
},
|
||||
])) });
|
||||
});
|
||||
|
||||
@@ -215,6 +215,7 @@ export interface LoginSessionActivityEvent {
|
||||
export type LoginSessionActivityRecorder = (event: LoginSessionActivityEvent) => void;
|
||||
|
||||
export interface StartDeviceLoginInput {
|
||||
environmentDriver?: string;
|
||||
agentId?: string;
|
||||
managementContext?: ConnectionManagementContext;
|
||||
aiConnection?: import("@paperclipai/shared").AiConnectionLoginIntent;
|
||||
@@ -939,7 +940,7 @@ export function createDeviceLoginService(deps: DeviceLoginServiceDeps) {
|
||||
const publicSessionId = randomUUID();
|
||||
const startedAt = now();
|
||||
const requestedTtlSeconds = input.ttlSeconds ?? resolveProfile(input.adapterType).timeoutMs / 1000;
|
||||
const ttlSeconds = input.agentId ? Math.min(requestedTtlSeconds, DEVICE_LOGIN_TIMEOUT_MS / 1000) : requestedTtlSeconds;
|
||||
const ttlSeconds = input.environmentDriver === "plugin" || input.agentId ? Math.min(requestedTtlSeconds, DEVICE_LOGIN_TIMEOUT_MS / 1000) : requestedTtlSeconds;
|
||||
const expiresAt = new Date(startedAt.getTime() + ttlSeconds * 1000);
|
||||
const base = {
|
||||
sessionId,
|
||||
|
||||
@@ -8,9 +8,23 @@ const fixtures = vi.hoisted(() => ({ environment: { id: "environment", driver: "
|
||||
vi.mock("./environments.js", () => ({ environmentService: () => ({ getById: async () => fixtures.environment, listBoundCompanyIds: async () => fixtures.companies }) }));
|
||||
vi.mock("./instance-settings.js", () => ({ instanceSettingsService: () => ({ get: async () => ({ defaultEnvironmentId: fixtures.instanceDefault }) }) }));
|
||||
vi.mock("./environment-selection.js", () => ({ assertEnvironmentSelectionForCompany: vi.fn(async () => {}) }));
|
||||
const { getByKey } = vi.hoisted(() => ({ getByKey: vi.fn() }));
|
||||
vi.mock("./plugin-registry.js", () => ({ pluginRegistryService: () => ({ getByKey }) }));
|
||||
const db = { select: () => ({ from: () => ({ where: () => ({ limit: async () => fixtures.agent ? [fixtures.agent] : [] }) }) }) } as unknown as Db;
|
||||
beforeEach(() => { fixtures.instanceDefault = "environment"; fixtures.environment = { id: "environment", driver: "plugin" }; fixtures.companies = ["company"]; fixtures.agent = { id: "agent", companyId: "company", adapterType: "paperclip_runner", lifecycleState: "verifying", defaultEnvironmentId: "environment" }; });
|
||||
describe("login environment transport target", () => {
|
||||
it("acquires an opted-in plugin login without selecting an agent", async () => {
|
||||
Object.assign(fixtures.environment, { config: { pluginKey: "computers", driverKey: "temporary" } });
|
||||
getByKey.mockResolvedValue({ status: "ready", manifestJson: { environmentDrivers: [
|
||||
{ kind: "environment_driver", driverKey: "temporary", supportsLoginPty: true, supportsAgentlessLogin: true },
|
||||
] } });
|
||||
fixtures.agent = undefined;
|
||||
const input = { companyId: "company", environmentId: "environment", adapterType: "codex_local" };
|
||||
await expect(resolveLoginEnvironmentTarget(db, { ...input, selectComputer: true })).resolves.toEqual({ environment: fixtures.environment, agentId: undefined });
|
||||
await expect(assertLoginEnvironmentTarget(db, input)).resolves.toEqual(fixtures.environment);
|
||||
Object.assign(fixtures.environment, { config: { pluginKey: "computers", driverKey: "persistent" } });
|
||||
await expect(assertLoginEnvironmentTarget(db, input)).rejects.toMatchObject({ status: 400 });
|
||||
});
|
||||
it("permits a verifying saved agent on its own computer", async () => { await expect(assertLoginEnvironmentTarget(db, { companyId: "company", environmentId: "environment", agentId: "agent" })).resolves.toEqual(fixtures.environment); });
|
||||
it("leaves which adapters a computer signs in to its driver's declared support", async () => { await expect(assertLoginEnvironmentTarget(db, { companyId: "company", environmentId: "environment", agentId: "agent", adapterType: "grok_local" })).resolves.toEqual(fixtures.environment); });
|
||||
it("rejects an adapter that has no Paperclip sign-in", async () => { await expect(assertLoginEnvironmentTarget(db, { companyId: "company", environmentId: "environment", agentId: "agent", adapterType: "copilot_runtime" })).rejects.toMatchObject({ status: 400 }); });
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import { agents, environmentLeases, type Db } from "@paperclipai/db";
|
||||
import { adapterLoginCommandKey, environmentLoginRequiresAgent } from "@paperclipai/shared";
|
||||
import { adapterLoginCommandKey } from "@paperclipai/shared";
|
||||
import { and, asc, eq, isNull, notExists, notInArray, or, sql } from "drizzle-orm";
|
||||
import { badRequest, forbidden, notFound } from "../errors.js";
|
||||
import { assertEnvironmentSelectionForCompany } from "./environment-selection.js";
|
||||
import { environmentService } from "./environments.js";
|
||||
import { pluginRegistryService } from "./plugin-registry.js";
|
||||
import { instanceSettingsService } from "./instance-settings.js";
|
||||
|
||||
type LoginEnvironmentTarget = { companyId: string; environmentId: string; agentId?: string; adapterType?: string };
|
||||
@@ -25,12 +26,20 @@ export async function resolveLoginEnvironmentTarget(
|
||||
if (!environment) throw notFound("Environment not found");
|
||||
const companies = await environments.listBoundCompanyIds(environment.id);
|
||||
if (companies.length && !companies.includes(input.companyId)) throw forbidden("The selected environment belongs to another company.", { code: "environment_company_mismatch" });
|
||||
if (!environmentLoginRequiresAgent(environment)) {
|
||||
if (environment.driver !== "plugin") {
|
||||
if (input.agentId) throw badRequest("A temporary sandbox login does not take an agent computer target.");
|
||||
return { environment, agentId: undefined };
|
||||
}
|
||||
if (input.adapterType && !adapterLoginCommandKey(input.adapterType)) throw badRequest("This provider login is not supported on agent computers.", { code: "login_adapter_unsupported" });
|
||||
if (!input.agentId) {
|
||||
const config = environment.config;
|
||||
if (typeof config?.pluginKey === "string" && typeof config.driverKey === "string") {
|
||||
const plugin = await pluginRegistryService(db).getByKey(config.pluginKey);
|
||||
const driver = plugin?.manifestJson.environmentDrivers?.find(item => item.driverKey === config.driverKey);
|
||||
if (plugin?.status === "ready" && driver?.kind !== "sandbox_provider" && driver?.supportsLoginPty && driver.supportsAgentlessLogin) {
|
||||
return { environment, agentId: undefined };
|
||||
}
|
||||
}
|
||||
if (!input.selectComputer) throw badRequest("Select an agent computer for sign-in.", { code: "login_agent_required" });
|
||||
const settings = await instanceSettingsService(db).get();
|
||||
const matchesEnvironment = eq(agents.defaultEnvironmentId, environment.id);
|
||||
|
||||
@@ -211,6 +211,7 @@ export interface ReadyPluginEnvironmentDriver {
|
||||
reusableLeaseMethodsVerified: boolean;
|
||||
supportedAdapters?: string[];
|
||||
loginAdapters: string[];
|
||||
supportsAgentlessLogin?: boolean;
|
||||
supportsInteractiveSetup?: PluginEnvironmentDriverDeclaration["supportsInteractiveSetup"];
|
||||
interactiveSetupConnectionTypes?: PluginEnvironmentDriverDeclaration["interactiveSetupConnectionTypes"];
|
||||
supportsTemplateCapture?: PluginEnvironmentDriverDeclaration["supportsTemplateCapture"];
|
||||
@@ -471,6 +472,7 @@ export async function listReadyPluginEnvironmentDrivers(input: {
|
||||
templateConfigBinding: driver.templateConfigBinding,
|
||||
supportsTemplateDelete: driver.supportsTemplateDelete,
|
||||
supportsLoginPty: driver.kind === "environment_driver" ? pluginSupportsLoginPty(driver, [...workerMethods]) : sandboxProviderSupportsLoginPty(driver),
|
||||
...(driver.supportsAgentlessLogin ? { supportsAgentlessLogin: true } : {}),
|
||||
...supportedAdapterFields(plugin.pluginKey, driver, [...workerMethods]),
|
||||
})),
|
||||
);
|
||||
|
||||
@@ -253,8 +253,8 @@
|
||||
"packages/shared/src/env-file.ts": "ee15f8dfa6610d3fd1eea3ca0846cc2c583f9070",
|
||||
"packages/shared/src/environment-custom-images.test.ts": "80d00f3581f13a782480700296b1295d8159ddae",
|
||||
"packages/shared/src/environment-custom-images.ts": "a81814b7f99e5c8871f50ffcf9dd93dc435dee27",
|
||||
"packages/shared/src/environment-support.test.ts": "91a7aacce30fb6fcf6782045a5a5e1281448cdf4",
|
||||
"packages/shared/src/environment-support.ts": "261c02dccfb7d8396687739ccc1b03bb59067a6b",
|
||||
"packages/shared/src/environment-support.test.ts": "eed931ef7535cd4aae1dc12d640149976634b057",
|
||||
"packages/shared/src/environment-support.ts": "6bef8200e293fa734e7779456bde5774bab4bdf0",
|
||||
"packages/shared/src/execution-workspace-guards.ts": "5428546ab16ef5cb4d23edd914d0a15a83a94668",
|
||||
"packages/shared/src/external-agent-guidance.ts": "d815fc60b170717f0fdcff61bc30c8a1289f7fcc",
|
||||
"packages/shared/src/external-objects-server.ts": "f323ba3e5e0b1a2ad415bdb5e0ca99bf9d449821",
|
||||
@@ -465,7 +465,7 @@
|
||||
"packages/shared/src/types/issue.ts": "1a01870cfda97510486c20425fabe7ac553460ac",
|
||||
"packages/shared/src/types/live.ts": "b90e55e4de8600c6fc17d7fa8d89079d4ae655ec",
|
||||
"packages/shared/src/types/native-finalization.ts": "c026a73003ae232fea4f7624d561493b383df358",
|
||||
"packages/shared/src/types/plugin.ts": "99567f30af5165880d67519c1d9e71855600d4f9",
|
||||
"packages/shared/src/types/plugin.ts": "ec78e2ec76b61eca20f7250237042c9ac70d5376",
|
||||
"packages/shared/src/types/project.ts": "50b9d9c51cb38d5862e287c1a47726716603f21c",
|
||||
"packages/shared/src/types/quota.ts": "a0686a9afb3111a4de093f66200dc0c9152e883e",
|
||||
"packages/shared/src/types/resource-memberships.ts": "9eab6fad50facf3e489f8c40e5bedd92e1d1faf8",
|
||||
@@ -552,7 +552,7 @@
|
||||
"packages/shared/src/validators/onboarding-seed.ts": "de302a8400d4199053f379d9ed853522a3ac6d32",
|
||||
"packages/shared/src/validators/partial.ts": "fa60ec7481fc14175365e9e500c814b159f1ab53",
|
||||
"packages/shared/src/validators/plugin.test.ts": "0a028e978f6706b3b23039e30ea04d7d8bccb1e2",
|
||||
"packages/shared/src/validators/plugin.ts": "072f0e6e3b7618b1d3a7c85dc1cc5074c86bd2b0",
|
||||
"packages/shared/src/validators/plugin.ts": "424177f7a174e00622acfc0abe1726a7a0768bbb",
|
||||
"packages/shared/src/validators/project.ts": "6ea168f5faf3161e6004ea47274f60634c77b219",
|
||||
"packages/shared/src/validators/provider-trace.ts": "b38b6200a2e51513f5dca0f8b008f2fe68175e82",
|
||||
"packages/shared/src/validators/resource-memberships.ts": "b124ac8a8f24b4dbb03ae82bcc87541f6b4ecdfd",
|
||||
|
||||
@@ -1519,7 +1519,7 @@ export function AgentConfigForm(props: AgentConfigFormProps) {
|
||||
// effective environment provider. The form reads the adapter login capability,
|
||||
// not the adapter name: every adapter login gates on this provider capability.
|
||||
const providerSupportsLoginPty = environmentSupportsLoginPty(effectiveLoginEnvironment, environmentCapabilities, isRunnerHarness ? harnessType : adapterType);
|
||||
const loginRequiresAgent = environmentLoginRequiresAgent(effectiveLoginEnvironment);
|
||||
const loginRequiresAgent = environmentLoginRequiresAgent(effectiveLoginEnvironment, environmentCapabilities);
|
||||
const showAdapterLogin =
|
||||
(isCreate || !currentAiConnection) &&
|
||||
adapterSupportsSandboxLogin &&
|
||||
|
||||
@@ -1165,7 +1165,7 @@ function OnboardingWizardInner({
|
||||
createdCompanyId &&
|
||||
loginProviderSupportsPty,
|
||||
);
|
||||
const loginRequiresAgent = canShowAdapterLogin && environmentLoginRequiresAgent(resolvedLoginEnvironment);
|
||||
const loginRequiresAgent = canShowAdapterLogin && environmentLoginRequiresAgent(resolvedLoginEnvironment, loginEnvironmentCapabilities);
|
||||
const agentSettledOnChoice = (agent: Pick<Agent, "adapterType" | "adapterConfig">) =>
|
||||
agentHarnessType(agent.adapterType, agent.adapterConfig) === adapterType
|
||||
&& (!model.trim() || agent.adapterConfig?.model === model.trim());
|
||||
|
||||
@@ -113,7 +113,7 @@ function SubscriptionConnectionStep({ defaultAccountDialog, onOtherModels, advan
|
||||
adapterType={provider === "google" ? "antigravity_runtime" : provider === "anthropic" ? "claude_local" : provider === "xai" ? "grok_local" : "codex_local"}
|
||||
environmentId={environmentId}
|
||||
canLogin={!loading && canLogin}
|
||||
requiresAgent={environmentLoginRequiresAgent(environment)}
|
||||
requiresAgent={environmentLoginRequiresAgent(environment, caps.data)}
|
||||
agentId={environmentId === (suppliedEnvironmentId ?? settings.data?.defaultEnvironmentId) ? loginAgentId : undefined}
|
||||
localEnvironment={!loading && environment?.driver === "local"}
|
||||
onBack={onCancel}
|
||||
|
||||
@@ -371,7 +371,7 @@ function Setup({
|
||||
&& transition.environmentId === environmentId && transition.runner === defaultRunner) return;
|
||||
resetTest();
|
||||
}, [companyId, environmentId, runner === "auto" ? defaultRunner : undefined]);
|
||||
const loginOnComputer = environmentLoginRequiresAgent(environment);
|
||||
const loginOnComputer = environmentLoginRequiresAgent(environment, caps.data);
|
||||
const canLogin = environmentSupportsLoginPty(environment, caps.data, connectionAdapter ?? adapterType);
|
||||
const loginComputer = useAgentComputerLogin({
|
||||
required: loginOnComputer,
|
||||
|
||||
Reference in new issue
Block a user