AbstractOptionalhttpTransport: ICloudHttpTransportProtectedauthProtectedconfigProtecteddidProtectedemittedProtectedhttpProtectedisProtectedlastProtectedpermissionProtectedreportedProtectedresumedProtectedresumedProtectedruntimeProtectedsessionProtectedsystemWhat this adapter actually supports. See the class doc on capability honesty.
Protected AbstractDefaultDefault base URL when neither CloudOptions.endpointUrl nor the provider env var is set.
Whether this session actually continued HarnessSessionConfig.ResumeSessionId.
Default false: a harness that cannot resume, or one offered no prior session, starts cold and must be sent the full conversation. Adapters that DO resume MUST override this and report truthfully — the caller sends only the newest message when it returns true, so a false positive leaves the harness answering a question it never saw the context for.
Deliberately separate from CapabilitySettings.SessionResume. That flag says the adapter CAN
resume in principle; this says it DID, this time. A stale or pruned session id makes the two
disagree, and only the second one is safe to branch the turn input on.
Protected AbstractEndpointEnvironment variable inspected for a custom provider endpoint URL (e.g. CLAUDE_CLOUD_API_URL).
True when the session detached in adaptive-wake mode while remote work remains running.
Most recently observed remote cloud execution state.
Protected AbstractProviderHuman-readable provider label for error and status messages.
The model the harness actually used, if it reports one.
Adapters that can observe this SHOULD override it. Accounting resolves AIPromptRun.ModelID
from this first and only falls back to the harness row's declared model, because a harness left
to choose its own model will — and billing a run against a model it never used is worse than
having no attribution at all, since it looks authoritative.
Vendor session id once known, persisted to AIAgentRun.ExternalSessionID.
Translates MJ's permission policy into whatever this harness understands.
Overridable and default no-op, matching the other capability seams. An adapter that cannot
enforce permissions should leave this alone AND report PermissionHooks: false, so the
runtime knows the policy is advisory rather than enforced. Silently accepting a policy you
cannot apply is the worst option: the operator believes strict is gating something.
Called once, before StartSession, so adapters can fold the result into launch flags.
ProtectedbuildBuilds a normalized permission policy object for vendor request payloads.
ProtectedbuildBuilds standard JSON request headers combining auth headers, JSON content-type, and extraHeaders.
ProtectedbuildBuilds a normalized cloud workspace/repository descriptor when repo or environment fields are present.
Protected AbstractcancelRequests remote cancellation of an in-flight cloud session/interaction.
Tears the session down.
MUST be idempotent and MUST be safe to call on every exit path — success, failure, cancellation and crash — because it is what revokes the per-run MCP credential and releases the workspace. A teardown that only runs on the happy path leaks a live credential.
Protected AbstractinspectQueries an existing remote session (init.ResumeSessionId), returning null if not found (HTTP 404).
Optionalsignal: AbortSignalProtectedonOptional hook invoked during StartSession when starting a brand-new session (no ResumeSessionId).
Stateful session-container platforms (e.g. Claude Cloud /v1/sessions) override this to allocate
the remote session upfront; interaction-per-turn platforms leave the default no-op.
Optional_signal: AbortSignalProtected AbstractpollPolls an in-flight cloud session/interaction and returns its latest normalized snapshot.
Optionalsignal: AbortSignalProtected AbstractresolveResolves provider authentication headers from config or throws if required credentials are missing.
Answers a permission-request the adapter raised.
Only meaningful when Capabilities.PermissionHooks is true; adapters without hooks should treat this as a no-op rather than throwing, because the posture layer above may still call it defensively.
Optional_note: stringRuns one turn and streams what happens.
The first call receives the task prompt; subsequent calls receive formatted results of steps MJ
executed on the harness's behalf. Implementations MUST emit exactly one terminal event —
turn-complete or session-error — so the caller's accumulation loop always terminates.
Where the harness cannot resume a session natively (SessionResume false), the adapter is
responsible for replaying prior context into a fresh invocation here, and for reporting the
resulting token cost through usage so the run's guardrails see the true spend.
ProtectedsendPerforms an HTTP call and throws a descriptive error on non-2xx status (unless allow404 is true).
Optionaloptions: { allow404?: boolean }Injects a custom HTTP transport (used for deterministic offline unit tests).
Injects a custom sleep implementation for deterministic timer control in tests.
Supplies MJ's system prompt for the session, where the harness can accept one.
Harnesses ship their own system prompt defining their identity, and it dominates anything sent as user text. MJ's turn-end contract delivered as a user message therefore competes with the harness's own instructions and loses — observed directly: a harness given the contract in the user turn still answered "what can you do?" in prose, costing a retry every run.
Adapters whose harness accepts a system prompt SHOULD override this. Those that cannot are no worse off than before: the contract still rides in the turn input.
Launches the harness session. Called once per run, before the first turn.
Implementations must not begin reasoning here — only establish the process, workspace and credentials. Any failure should throw, so the run fails visibly rather than proceeding with a half-built session.
Protected AbstractsubmitSubmits a new turn on the cloud platform and returns its initial normalized snapshot.
Optionalsignal: AbortSignal
Abstract base class for remote HTTP/cloud agent harness adapters (Antigravity Cloud, Claude Code Cloud, OpenAI Codex Cloud).
Implements full session initialization, credential & header assembly,
bounded-pollandadaptive-waketurn waiting modes, mid-turn cancellation, deduplicated incremental event emission, and idempotent session teardown that preserves remote execution when detached forAgentWake.