mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-12-03 20:09:33 +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
@@ -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`
|
||||
|
||||
Reference in new issue
Block a user