hyperbrane 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +81 -11
- package/dist/agent/agentClient.d.ts +5 -0
- package/dist/agent/agentClient.js +4 -0
- package/dist/agent/agentService.d.ts +9 -30
- package/dist/agent/agentService.js +62 -293
- package/dist/agent/agentStorage.d.ts +1 -20
- package/dist/agent/agentStorage.js +0 -30
- package/dist/agent/api.d.ts +89 -133
- package/dist/agent/api.js +4 -4
- package/dist/agent/client.d.ts +3 -1
- package/dist/agent/client.js +2 -3
- package/dist/agent/control.d.ts +23 -0
- package/dist/agent/control.js +479 -0
- package/dist/agent/hostTranscript.d.ts +0 -6
- package/dist/agent/hostTranscript.js +3 -14
- package/dist/agent/session/backend.d.ts +17 -30
- package/dist/agent/session/claude/home.d.ts +0 -1
- package/dist/agent/session/claude/home.js +0 -1
- package/dist/agent/session/claude/provision.d.ts +10 -0
- package/dist/agent/session/claude/provision.js +17 -0
- package/dist/agent/session/claude/transcript.d.ts +2 -7
- package/dist/agent/session/claude/transcript.js +68 -14
- package/dist/agent/session/client.d.ts +1 -10
- package/dist/agent/session/client.js +0 -3
- package/dist/agent/session/codex/provision.d.ts +14 -0
- package/dist/agent/session/codex/provision.js +25 -0
- package/dist/agent/session/fileTranscript.d.ts +6 -49
- package/dist/agent/session/fileTranscript.js +26 -82
- package/dist/agent/session/install.d.ts +5 -0
- package/dist/agent/session/install.js +35 -0
- package/dist/agent/session/sessionStorage.d.ts +4 -35
- package/dist/agent/session/sessionStorage.js +10 -16
- package/dist/agent/session/sharedConnection.d.ts +0 -8
- package/dist/agent/session/sharedConnection.js +0 -7
- package/dist/agent/session/storedTranscripts.d.ts +1 -6
- package/dist/agent/session/storedTranscripts.js +0 -3
- package/dist/agent/session/worker/jsonRpc.d.ts +2 -13
- package/dist/agent/session/worker/jsonRpc.js +2 -11
- package/dist/agent/session/worker/protocol.d.ts +27 -18
- package/dist/agent/session/worker/protocol.js +32 -16
- package/dist/agent/session/worker/workerParams.d.ts +0 -5
- package/dist/agent/session/worker/workerParams.js +15 -14
- package/dist/agent/session/workerConnection.d.ts +2 -13
- package/dist/agent/session/workerConnection.js +7 -12
- package/dist/agent/session/workerGatewayConnection.d.ts +18 -0
- package/dist/agent/session/workerGatewayConnection.js +86 -0
- package/dist/agent/vendor-types/manifest.json +87 -0
- package/dist/agent/workerBundle.d.ts +4 -19
- package/dist/agent/workerBundle.generated.js +1 -1
- package/dist/agent/workerBundle.js +3 -30
- package/dist/agent/workerReplacement.d.ts +3 -0
- package/dist/agent/workerReplacement.js +49 -0
- package/dist/cli/agent.js +44 -16
- package/dist/cli/command.d.ts +10 -11
- package/dist/cli/command.js +0 -4
- package/dist/cli/dimension.js +6 -6
- package/dist/cli/gateway.js +3 -6
- package/dist/cli/main.js +14 -31
- package/dist/cli/streamPrinter.d.ts +2 -10
- package/dist/cli/streamPrinter.js +16 -46
- package/dist/cli/table.d.ts +0 -3
- package/dist/cli/table.js +0 -4
- package/dist/dimension/api.d.ts +39 -27
- package/dist/dimension/api.js +28 -47
- package/dist/dimension/client.d.ts +5 -0
- package/dist/dimension/client.js +4 -0
- package/dist/dimension/control.d.ts +21 -0
- package/dist/dimension/control.js +328 -0
- package/dist/dimension/image.d.ts +0 -5
- package/dist/dimension/image.js +0 -8
- package/dist/dimension/imageFiles.generated.js +1 -1
- package/dist/dimension/paths.d.ts +5 -4
- package/dist/dimension/paths.js +15 -6
- package/dist/dimension/service.d.ts +8 -21
- package/dist/dimension/service.js +60 -224
- package/dist/dimension/transport-worker.d.ts +1 -0
- package/dist/dimension/transport-worker.js +151 -0
- package/dist/dimension/transportBundle.d.ts +2 -0
- package/dist/dimension/transportBundle.generated.d.ts +1 -0
- package/dist/dimension/transportBundle.generated.js +2 -0
- package/dist/dimension/transportBundle.js +4 -0
- package/dist/dimension/transportClient.d.ts +10 -0
- package/dist/dimension/transportClient.js +115 -0
- package/dist/dimension/transportProtocol.d.ts +53 -0
- package/dist/dimension/transportProtocol.js +8 -0
- package/dist/index.d.ts +5 -8
- package/dist/index.js +5 -16
- package/dist/lib/control.d.ts +8 -0
- package/dist/lib/control.js +62 -0
- package/dist/lib/docker.d.ts +0 -22
- package/dist/lib/docker.js +0 -10
- package/dist/lib/image.d.ts +0 -3
- package/dist/lib/image.js +0 -2
- package/dist/lib/jsonDirectory.d.ts +0 -13
- package/dist/lib/jsonDirectory.js +10 -15
- package/dist/lib/scriptBundle.d.ts +6 -0
- package/dist/lib/scriptBundle.js +28 -0
- package/dist/lib/sh.d.ts +2 -0
- package/dist/lib/sh.js +8 -0
- package/dist/lib/sleep.d.ts +0 -1
- package/dist/lib/sleep.js +0 -1
- package/dist/lib/streamFetch.d.ts +15 -0
- package/dist/lib/streamFetch.js +150 -0
- package/dist/lib/tar.d.ts +0 -1
- package/dist/lib/tar.js +5 -11
- package/dist/portal-gateway/api.d.ts +13 -44
- package/dist/portal-gateway/api.js +1 -3
- package/dist/portal-gateway/control.d.ts +42 -0
- package/dist/portal-gateway/control.js +657 -0
- package/dist/portal-gateway/gatewayClient.d.ts +5 -0
- package/dist/portal-gateway/gatewayClient.js +4 -0
- package/dist/portal-gateway/gatewayService.d.ts +8 -35
- package/dist/portal-gateway/gatewayService.js +79 -253
- package/dist/portal-gateway/image.d.ts +1 -2
- package/dist/portal-gateway/image.js +1 -3
- package/dist/portal-gateway/imageFiles.generated.js +3 -3
- package/dist/portal-gateway/portalClient.d.ts +5 -0
- package/dist/portal-gateway/portalClient.js +4 -0
- package/dist/portal-gateway/portalService.d.ts +5 -47
- package/dist/portal-gateway/portalService.js +19 -317
- package/dist/portal-gateway/transport-worker.d.ts +1 -0
- package/dist/portal-gateway/transport-worker.js +205 -0
- package/dist/portal-gateway/transportBundle.d.ts +2 -0
- package/dist/portal-gateway/transportBundle.generated.d.ts +1 -0
- package/dist/portal-gateway/transportBundle.generated.js +2 -0
- package/dist/portal-gateway/transportBundle.js +4 -0
- package/dist/portal-gateway/upstream.d.ts +12 -82
- package/dist/portal-gateway/upstream.js +0 -1
- package/dist/sandbox/api.d.ts +121 -178
- package/dist/sandbox/api.js +5 -7
- package/dist/sandbox/client.d.ts +2 -0
- package/dist/sandbox/client.js +4 -0
- package/dist/sandbox/data-endpoints/dataEndpoints.d.ts +13 -0
- package/dist/sandbox/data-endpoints/dataEndpoints.js +100 -0
- package/dist/sandbox/data-endpoints/firewalledPorts.d.ts +4 -0
- package/dist/sandbox/data-endpoints/firewalledPorts.js +28 -0
- package/dist/sandbox/lib/httpOverStream.d.ts +3 -0
- package/dist/sandbox/lib/httpOverStream.js +21 -0
- package/dist/sandbox/lib/remoteFileOperations.d.ts +10 -0
- package/dist/sandbox/lib/remoteFileOperations.js +70 -0
- package/dist/sandbox/lib/shellCommand.d.ts +3 -0
- package/dist/sandbox/lib/shellCommand.js +7 -0
- package/dist/sandbox/providers/boat/boatService.d.ts +2 -0
- package/dist/sandbox/providers/boat/boatService.js +321 -0
- package/dist/sandbox/providers/exedev/exeDevService.d.ts +2 -0
- package/dist/sandbox/providers/exedev/exeDevService.js +127 -0
- package/dist/sandbox/providers/exedev/exeDevToken.d.ts +1 -0
- package/dist/sandbox/providers/exedev/exeDevToken.js +54 -0
- package/dist/sandbox/providers/local/localService.d.ts +2 -0
- package/dist/sandbox/providers/local/localService.js +219 -0
- package/dist/sandbox/providers/ssh/sshService.d.ts +2 -0
- package/dist/sandbox/providers/ssh/sshService.js +82 -0
- package/dist/sandbox/providers/ssh/sshTransport.d.ts +12 -0
- package/dist/sandbox/providers/ssh/sshTransport.js +216 -0
- package/dist/sandbox/service.d.ts +2 -0
- package/dist/sandbox/service.js +18 -0
- package/dist/sandbox/storage/descriptors.d.ts +6 -0
- package/dist/sandbox/storage/descriptors.js +25 -0
- package/dist/sandbox/storage/sandboxStorage.d.ts +11 -0
- package/dist/sandbox/storage/sandboxStorage.js +42 -0
- package/dist/upstreams/anthropic.d.ts +0 -5
- package/dist/upstreams/anthropic.js +1 -8
- package/dist/upstreams/index.d.ts +2 -6
- package/dist/upstreams/index.js +0 -4
- package/dist/upstreams/openai.d.ts +0 -5
- package/dist/upstreams/openai.js +1 -13
- package/package.json +12 -4
- package/dist/agent/gatewaySignIns.d.ts +0 -5
- package/dist/agent/gatewaySignIns.js +0 -11
- package/dist/agent/session/codex/home.d.ts +0 -2
- package/dist/agent/session/codex/home.js +0 -4
- package/dist/agent/session/codex/messages.d.ts +0 -30
- package/dist/agent/session/codex/messages.js +0 -135
- package/dist/agent/session/codex/transcript.d.ts +0 -12
- package/dist/agent/session/codex/transcript.js +0 -22
- package/dist/agent/session/sdkMessages.d.ts +0 -15
- package/dist/agent/session/sdkMessages.js +0 -28
- package/dist/agent/session/workerSseConnection.d.ts +0 -15
- package/dist/agent/session/workerSseConnection.js +0 -26
- package/dist/agent/vendor-types/codex/app-server/AbsolutePathBuf.d.ts +0 -10
- package/dist/agent/vendor-types/codex/app-server/AbsolutePathBuf.js +0 -2
- package/dist/agent/vendor-types/codex/app-server/FunctionCallOutputBody.d.ts +0 -2
- package/dist/agent/vendor-types/codex/app-server/FunctionCallOutputBody.js +0 -2
- package/dist/agent/vendor-types/codex/app-server/FunctionCallOutputContentItem.d.ts +0 -22
- package/dist/agent/vendor-types/codex/app-server/FunctionCallOutputContentItem.js +0 -2
- package/dist/agent/vendor-types/codex/app-server/ImageDetail.d.ts +0 -1
- package/dist/agent/vendor-types/codex/app-server/ImageDetail.js +0 -2
- package/dist/agent/vendor-types/codex/app-server/ImageGenerationFailure.d.ts +0 -5
- package/dist/agent/vendor-types/codex/app-server/ImageGenerationFailure.js +0 -2
- package/dist/agent/vendor-types/codex/app-server/ImageGenerationItem.d.ts +0 -11
- package/dist/agent/vendor-types/codex/app-server/ImageGenerationItem.js +0 -2
- package/dist/agent/vendor-types/codex/app-server/LegacyAppPathString.d.ts +0 -23
- package/dist/agent/vendor-types/codex/app-server/LegacyAppPathString.js +0 -2
- package/dist/agent/vendor-types/codex/app-server/MessagePhase.d.ts +0 -7
- package/dist/agent/vendor-types/codex/app-server/MessagePhase.js +0 -2
- package/dist/agent/vendor-types/codex/app-server/ReasoningEffort.d.ts +0 -4
- package/dist/agent/vendor-types/codex/app-server/ReasoningEffort.js +0 -2
- package/dist/agent/vendor-types/codex/app-server/SleepItem.d.ts +0 -7
- package/dist/agent/vendor-types/codex/app-server/SleepItem.js +0 -2
- package/dist/agent/vendor-types/codex/app-server/WebSearchItem.d.ts +0 -14
- package/dist/agent/vendor-types/codex/app-server/WebSearchItem.js +0 -2
- package/dist/agent/vendor-types/codex/app-server/serde_json/JsonValue.d.ts +0 -3
- package/dist/agent/vendor-types/codex/app-server/serde_json/JsonValue.js +0 -2
- package/dist/agent/vendor-types/codex/app-server/v2/AgentMessageDelivery.d.ts +0 -1
- package/dist/agent/vendor-types/codex/app-server/v2/AgentMessageDelivery.js +0 -2
- package/dist/agent/vendor-types/codex/app-server/v2/AsyncUserInputQuestion.d.ts +0 -4
- package/dist/agent/vendor-types/codex/app-server/v2/AsyncUserInputQuestion.js +0 -2
- package/dist/agent/vendor-types/codex/app-server/v2/ByteRange.d.ts +0 -4
- package/dist/agent/vendor-types/codex/app-server/v2/ByteRange.js +0 -2
- package/dist/agent/vendor-types/codex/app-server/v2/CollabAgentState.d.ts +0 -5
- package/dist/agent/vendor-types/codex/app-server/v2/CollabAgentState.js +0 -2
- package/dist/agent/vendor-types/codex/app-server/v2/CollabAgentStatus.d.ts +0 -1
- package/dist/agent/vendor-types/codex/app-server/v2/CollabAgentStatus.js +0 -2
- package/dist/agent/vendor-types/codex/app-server/v2/CollabAgentTool.d.ts +0 -1
- package/dist/agent/vendor-types/codex/app-server/v2/CollabAgentTool.js +0 -2
- package/dist/agent/vendor-types/codex/app-server/v2/CollabAgentToolCallStatus.d.ts +0 -1
- package/dist/agent/vendor-types/codex/app-server/v2/CollabAgentToolCallStatus.js +0 -2
- package/dist/agent/vendor-types/codex/app-server/v2/CommandAction.d.ts +0 -19
- package/dist/agent/vendor-types/codex/app-server/v2/CommandAction.js +0 -2
- package/dist/agent/vendor-types/codex/app-server/v2/CommandExecutionSource.d.ts +0 -1
- package/dist/agent/vendor-types/codex/app-server/v2/CommandExecutionSource.js +0 -2
- package/dist/agent/vendor-types/codex/app-server/v2/CommandExecutionStatus.d.ts +0 -1
- package/dist/agent/vendor-types/codex/app-server/v2/CommandExecutionStatus.js +0 -2
- package/dist/agent/vendor-types/codex/app-server/v2/DynamicToolCallOutputContentItem.d.ts +0 -10
- package/dist/agent/vendor-types/codex/app-server/v2/DynamicToolCallOutputContentItem.js +0 -2
- package/dist/agent/vendor-types/codex/app-server/v2/DynamicToolCallStatus.d.ts +0 -1
- package/dist/agent/vendor-types/codex/app-server/v2/DynamicToolCallStatus.js +0 -2
- package/dist/agent/vendor-types/codex/app-server/v2/FileUpdateChange.d.ts +0 -6
- package/dist/agent/vendor-types/codex/app-server/v2/FileUpdateChange.js +0 -2
- package/dist/agent/vendor-types/codex/app-server/v2/HookPromptFragment.d.ts +0 -4
- package/dist/agent/vendor-types/codex/app-server/v2/HookPromptFragment.js +0 -2
- package/dist/agent/vendor-types/codex/app-server/v2/McpAppDisplayMode.d.ts +0 -1
- package/dist/agent/vendor-types/codex/app-server/v2/McpAppDisplayMode.js +0 -2
- package/dist/agent/vendor-types/codex/app-server/v2/McpAppUi.d.ts +0 -8
- package/dist/agent/vendor-types/codex/app-server/v2/McpAppUi.js +0 -2
- package/dist/agent/vendor-types/codex/app-server/v2/McpToolCallAppContext.d.ts +0 -7
- package/dist/agent/vendor-types/codex/app-server/v2/McpToolCallAppContext.js +0 -2
- package/dist/agent/vendor-types/codex/app-server/v2/McpToolCallError.d.ts +0 -3
- package/dist/agent/vendor-types/codex/app-server/v2/McpToolCallError.js +0 -2
- package/dist/agent/vendor-types/codex/app-server/v2/McpToolCallResult.d.ts +0 -6
- package/dist/agent/vendor-types/codex/app-server/v2/McpToolCallResult.js +0 -2
- package/dist/agent/vendor-types/codex/app-server/v2/McpToolCallStatus.d.ts +0 -1
- package/dist/agent/vendor-types/codex/app-server/v2/McpToolCallStatus.js +0 -2
- package/dist/agent/vendor-types/codex/app-server/v2/MemoryCitation.d.ts +0 -5
- package/dist/agent/vendor-types/codex/app-server/v2/MemoryCitation.js +0 -2
- package/dist/agent/vendor-types/codex/app-server/v2/MemoryCitationEntry.d.ts +0 -6
- package/dist/agent/vendor-types/codex/app-server/v2/MemoryCitationEntry.js +0 -2
- package/dist/agent/vendor-types/codex/app-server/v2/PatchApplyStatus.d.ts +0 -1
- package/dist/agent/vendor-types/codex/app-server/v2/PatchApplyStatus.js +0 -2
- package/dist/agent/vendor-types/codex/app-server/v2/PatchChangeKind.d.ts +0 -8
- package/dist/agent/vendor-types/codex/app-server/v2/PatchChangeKind.js +0 -2
- package/dist/agent/vendor-types/codex/app-server/v2/SubAgentActivityKind.d.ts +0 -1
- package/dist/agent/vendor-types/codex/app-server/v2/SubAgentActivityKind.js +0 -2
- package/dist/agent/vendor-types/codex/app-server/v2/TextElement.d.ts +0 -11
- package/dist/agent/vendor-types/codex/app-server/v2/TextElement.js +0 -2
- package/dist/agent/vendor-types/codex/app-server/v2/ThreadItem.d.ts +0 -215
- package/dist/agent/vendor-types/codex/app-server/v2/ThreadItem.js +0 -2
- package/dist/agent/vendor-types/codex/app-server/v2/UserInput.d.ts +0 -35
- package/dist/agent/vendor-types/codex/app-server/v2/UserInput.js +0 -2
- package/dist/agent/vendor-types/codex/app-server/v2/WebSearchAction.d.ts +0 -14
- package/dist/agent/vendor-types/codex/app-server/v2/WebSearchAction.js +0 -2
- package/dist/cli/services.d.ts +0 -19
- package/dist/cli/services.js +0 -33
- package/dist/dimension/http.d.ts +0 -7
- package/dist/dimension/http.js +0 -77
- package/dist/dimension/storage.d.ts +0 -39
- package/dist/dimension/storage.js +0 -79
- package/dist/portal-gateway/fakes.d.ts +0 -3
- package/dist/portal-gateway/fakes.js +0 -11
- package/dist/portal-gateway/gatewayStorage.d.ts +0 -66
- package/dist/portal-gateway/gatewayStorage.js +0 -125
- package/dist/portal-gateway/portalStorage.d.ts +0 -34
- package/dist/portal-gateway/portalStorage.js +0 -44
- package/dist/sandbox/boatService.d.ts +0 -52
- package/dist/sandbox/boatService.js +0 -343
- package/dist/sandbox/containerService.d.ts +0 -15
- package/dist/sandbox/containerService.js +0 -184
- package/dist/sandbox/endpointProxy.d.ts +0 -90
- package/dist/sandbox/endpointProxy.js +0 -701
- package/dist/sandbox/exeDevAuth.d.ts +0 -16
- package/dist/sandbox/exeDevAuth.js +0 -49
- package/dist/sandbox/localService.d.ts +0 -19
- package/dist/sandbox/localService.js +0 -200
- package/dist/sandbox/sseConnection.d.ts +0 -41
- package/dist/sandbox/sseConnection.js +0 -166
- package/dist/sandbox/sshService.d.ts +0 -30
- package/dist/sandbox/sshService.js +0 -680
|
@@ -1,29 +1,10 @@
|
|
|
1
|
-
import type { Sandbox
|
|
1
|
+
import type { Sandbox } from "../sandbox/api.ts";
|
|
2
2
|
import type { Agent } from "./api.ts";
|
|
3
|
-
/** Every name must pass checkName; operations throw InvalidNameError otherwise. */
|
|
4
3
|
export interface AgentStorage {
|
|
5
|
-
/** Stores the record unless one with that name exists; returns whichever record is stored afterwards. */
|
|
6
4
|
insertAgent(agent: Agent): Promise<Agent>;
|
|
7
|
-
/** Null if missing. */
|
|
8
5
|
readAgent(agentName: string): Promise<Agent | null>;
|
|
9
|
-
/** No-op if missing. */
|
|
10
6
|
removeAgent(agentName: string): Promise<void>;
|
|
11
7
|
listAgents(): Promise<Agent[]>;
|
|
12
|
-
/** Hyperbrane's data directory these are kept in, with the dimensions' (see dimension/paths.ts). */
|
|
13
8
|
dataDirectory(): Promise<string>;
|
|
14
|
-
/**
|
|
15
|
-
* The agent's accessible endpoints (AgentService.exposeAgent), credentials included, by the
|
|
16
|
-
* accessible host each was exposed for: one per way the machine is reached.
|
|
17
|
-
*/
|
|
18
|
-
readEndpoints(agentName: string): Promise<Record<string, SandboxEndpoint>>;
|
|
19
|
-
saveEndpoint(agentName: string, accessibleHost: string, endpoint: SandboxEndpoint): Promise<void>;
|
|
20
|
-
/** No-op if missing. */
|
|
21
|
-
removeEndpoint(agentName: string, accessibleHost: string): Promise<void>;
|
|
22
|
-
/** All of them. No-op if none. */
|
|
23
|
-
removeEndpoints(agentName: string): Promise<void>;
|
|
24
9
|
}
|
|
25
|
-
/**
|
|
26
|
-
* `dir` is a sandbox path; defaults to ~/.local/share/hyperbrane of the sandbox's user. Layout:
|
|
27
|
-
* agents/<agent>.json, agent-endpoints/<agent>.json.
|
|
28
|
-
*/
|
|
29
10
|
export declare function createAgentStorage(sandbox: Sandbox, dir?: string): AgentStorage;
|
|
@@ -1,33 +1,7 @@
|
|
|
1
1
|
import { createJsonDirectory, defaultDataDir } from "../lib/jsonDirectory.js";
|
|
2
|
-
/**
|
|
3
|
-
* `dir` is a sandbox path; defaults to ~/.local/share/hyperbrane of the sandbox's user. Layout:
|
|
4
|
-
* agents/<agent>.json, agent-endpoints/<agent>.json.
|
|
5
|
-
*/
|
|
6
2
|
export function createAgentStorage(sandbox, dir) {
|
|
7
3
|
const dataDirectory = async () => dir ?? (await defaultDataDir(sandbox));
|
|
8
4
|
const agents = createJsonDirectory(sandbox, async () => `${await dataDirectory()}/agents`);
|
|
9
|
-
// A record used to hold one endpoint; it is read as the entry for its URL's host:port.
|
|
10
|
-
const endpoints = createJsonDirectory(sandbox, async () => `${await dataDirectory()}/agent-endpoints`);
|
|
11
|
-
async function readEndpoints(agentName) {
|
|
12
|
-
const record = await endpoints.read(agentName);
|
|
13
|
-
if (!record)
|
|
14
|
-
return {};
|
|
15
|
-
if (typeof record.id === "string")
|
|
16
|
-
return { [new URL(record.url).host]: record };
|
|
17
|
-
return record;
|
|
18
|
-
}
|
|
19
|
-
async function saveEndpoint(agentName, accessibleHost, endpoint) {
|
|
20
|
-
await endpoints.save(agentName, { ...(await readEndpoints(agentName)), [accessibleHost]: endpoint });
|
|
21
|
-
}
|
|
22
|
-
async function removeEndpoint(agentName, accessibleHost) {
|
|
23
|
-
const { [accessibleHost]: removed, ...rest } = await readEndpoints(agentName);
|
|
24
|
-
if (!removed)
|
|
25
|
-
return;
|
|
26
|
-
if (Object.keys(rest).length === 0)
|
|
27
|
-
await endpoints.remove(agentName);
|
|
28
|
-
else
|
|
29
|
-
await endpoints.save(agentName, rest);
|
|
30
|
-
}
|
|
31
5
|
async function insertAgent(agent) {
|
|
32
6
|
return agents.insert(agent.name, agent);
|
|
33
7
|
}
|
|
@@ -46,9 +20,5 @@ export function createAgentStorage(sandbox, dir) {
|
|
|
46
20
|
removeAgent,
|
|
47
21
|
listAgents,
|
|
48
22
|
dataDirectory,
|
|
49
|
-
readEndpoints,
|
|
50
|
-
saveEndpoint,
|
|
51
|
-
removeEndpoint,
|
|
52
|
-
removeEndpoints: (agentName) => endpoints.remove(agentName),
|
|
53
23
|
};
|
|
54
24
|
}
|
package/dist/agent/api.d.ts
CHANGED
|
@@ -1,157 +1,157 @@
|
|
|
1
|
-
import type { ModelInfo, SDKBackgroundTasksChangedMessage, PermissionResult, SDKAssistantMessage, SDKPartialAssistantMessage, SDKResultMessage, SDKSystemMessage, SDKUserMessage } from "../vendor-types/claude/agent-sdk/sdk.js";
|
|
1
|
+
import type { ModelInfo, SDKBackgroundTasksChangedMessage, PermissionResult, SDKAssistantMessage, SDKCompactBoundaryMessage, SDKPartialAssistantMessage, SDKResultMessage, SDKSystemMessage, SDKUserMessage } from "../vendor-types/claude/agent-sdk/sdk.js";
|
|
2
2
|
import type { AskUserQuestionInput } from "../vendor-types/claude/agent-sdk/sdk-tools.js";
|
|
3
3
|
import type { CPULimit, MemoryLimit } from "../dimension/api.ts";
|
|
4
|
-
import type { SandboxEndpoint, SandboxEndpointScheme } from "../sandbox/api.ts";
|
|
5
|
-
/** A session worker running in a dimension; it hosts that agent's sessions. */
|
|
6
4
|
export type Agent = {
|
|
7
5
|
name: string;
|
|
8
6
|
dimensionName: string;
|
|
9
7
|
};
|
|
10
|
-
/** The agent CLIs a session can run (agent/session/<backend>/). */
|
|
11
8
|
export declare const AGENT_BACKENDS: readonly ["claude", "codex"];
|
|
9
|
+
export declare const AGENT_PERMISSION_MODES: readonly ["ask", "auto"];
|
|
10
|
+
export type AgentPermissionMode = (typeof AGENT_PERMISSION_MODES)[number];
|
|
12
11
|
export type AgentBackend = (typeof AGENT_BACKENDS)[number];
|
|
13
12
|
export type AgentSession = {
|
|
14
13
|
name: string;
|
|
15
14
|
backend: AgentBackend;
|
|
16
15
|
memoryLimit: MemoryLimit;
|
|
17
16
|
cpuLimit: CPULimit;
|
|
18
|
-
/** Dimension path the agent works in; defaults to the workspace. */
|
|
19
17
|
cwd?: string;
|
|
20
|
-
/** Extra environment for the agent CLI (e.g. ANTHROPIC_BASE_URL). */
|
|
21
18
|
env?: Record<string, string>;
|
|
22
19
|
};
|
|
23
|
-
/** What `updateSession` can change; omitted limits stay as they are. */
|
|
24
20
|
export type AgentSessionLimits = Partial<Pick<AgentSession, "memoryLimit" | "cpuLimit">>;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
21
|
+
export type AgentSessionState = ({
|
|
22
|
+
readonly state: "exited";
|
|
23
|
+
readonly code: number | null;
|
|
24
|
+
readonly signal: string | null;
|
|
25
|
+
readonly error?: string;
|
|
26
|
+
} | {
|
|
27
|
+
readonly state: "installing";
|
|
28
|
+
readonly backend: AgentBackend;
|
|
29
|
+
readonly version: string;
|
|
30
|
+
} | {
|
|
31
|
+
readonly state: "starting";
|
|
32
|
+
} | {
|
|
33
|
+
readonly state: "waiting";
|
|
34
|
+
} | {
|
|
35
|
+
readonly state: "idle";
|
|
36
|
+
} | {
|
|
37
|
+
readonly state: "tool";
|
|
38
|
+
readonly tools: readonly string[];
|
|
39
|
+
} | {
|
|
40
|
+
readonly state: "thinking";
|
|
41
|
+
}) & {
|
|
42
|
+
readonly since?: number;
|
|
43
|
+
};
|
|
44
|
+
export type AgentStatusMessage = {
|
|
45
|
+
readonly type: "session_status";
|
|
46
|
+
readonly status: AgentSessionState;
|
|
47
|
+
};
|
|
48
|
+
export type AgentPromptFailedMessage = {
|
|
49
|
+
readonly type: "prompt_failed";
|
|
50
|
+
readonly uuid: string;
|
|
51
|
+
readonly error: string;
|
|
52
|
+
};
|
|
53
|
+
export type AgentNoticeMessage = {
|
|
54
|
+
readonly type: "session_notice";
|
|
55
|
+
readonly text: string;
|
|
56
|
+
};
|
|
57
|
+
export type AgentCompactionMessage = Omit<SDKCompactBoundaryMessage, "compact_metadata"> & {
|
|
58
|
+
readonly compact_metadata?: SDKCompactBoundaryMessage["compact_metadata"];
|
|
59
|
+
readonly timestamp?: string;
|
|
60
|
+
};
|
|
61
|
+
export type AgentSessionEvent = {
|
|
62
|
+
readonly kind: "review";
|
|
63
|
+
readonly state: "entered" | "exited";
|
|
64
|
+
readonly review: string;
|
|
65
|
+
} | {
|
|
66
|
+
readonly kind: "subagent";
|
|
67
|
+
readonly activity: "started" | "interacted" | "interrupted" | "completed";
|
|
68
|
+
readonly agent: string;
|
|
69
|
+
readonly path: string;
|
|
70
|
+
};
|
|
71
|
+
export type AgentEventMessage = {
|
|
72
|
+
readonly type: "system";
|
|
73
|
+
readonly subtype: "session_event";
|
|
74
|
+
readonly event: AgentSessionEvent;
|
|
75
|
+
readonly uuid: string;
|
|
76
|
+
readonly session_id: string;
|
|
77
|
+
readonly timestamp?: string;
|
|
78
|
+
};
|
|
79
|
+
export type AgentAssistantMessage = SDKAssistantMessage & {
|
|
80
|
+
readonly phase?: "commentary" | "final";
|
|
81
|
+
readonly async?: true;
|
|
82
|
+
};
|
|
32
83
|
export type AgentSessionInfo = AgentSession & {
|
|
33
84
|
readonly agentName: string;
|
|
34
85
|
readonly status: AgentSessionState;
|
|
35
|
-
/** The backend's own id for the conversation (claude's session id, codex's thread id), once known. */
|
|
36
86
|
readonly nativeId: string | null;
|
|
37
|
-
/** Chosen through AgentModels; null for the backend's default. */
|
|
38
87
|
readonly model: string | null;
|
|
88
|
+
readonly permissionMode: AgentPermissionMode;
|
|
39
89
|
};
|
|
40
|
-
/** Where a session lives: sessions are named per agent. */
|
|
41
90
|
export type SessionRef = {
|
|
42
91
|
agentName: string;
|
|
43
92
|
sessionName: string;
|
|
44
93
|
};
|
|
45
94
|
/** @sealed */
|
|
46
95
|
export interface AgentClient {
|
|
47
|
-
/** PUT /v1/agents/:agentName — starts (or updates) the worker in the dimension. */
|
|
48
96
|
createAgent(agent: Agent): Promise<Agent>;
|
|
49
|
-
/** DELETE /v1/agents/:agentName — stops the worker and its sessions. */
|
|
50
97
|
stopAgent(agentName: string): Promise<void>;
|
|
51
|
-
/** GET /v1/agents */
|
|
52
98
|
listAgents(): Promise<Agent[]>;
|
|
53
|
-
/** POST /v1/agents/:agentName/sessions — idempotent for the same spec. */
|
|
54
99
|
createSession(agentName: string, session: AgentSession): Promise<AgentSessionInfo>;
|
|
55
|
-
/** PATCH /v1/agents/:agentName/sessions/:sessionName — changes its limits. */
|
|
56
100
|
updateSession(ref: SessionRef, limits: AgentSessionLimits): Promise<AgentSessionInfo>;
|
|
57
|
-
/** GET /v1/sessions — every agent's sessions. */
|
|
58
101
|
listSessions(): Promise<AgentSessionInfo[]>;
|
|
59
|
-
/** DELETE /v1/agents/:agentName/sessions/:sessionName — ends the CLI and forgets the session. */
|
|
60
102
|
stopSession(ref: SessionRef): Promise<void>;
|
|
103
|
+
restoreAgents(): Promise<string[]>;
|
|
61
104
|
}
|
|
62
105
|
export type AgentStreamingRequest = {
|
|
63
|
-
/**
|
|
64
|
-
* The `uuid` of the last user or assistant message already seen (e.g. the prompt just sent);
|
|
65
|
-
* omitted to read the whole conversation. Those uuids are the backend's own ids for the messages
|
|
66
|
-
* it stores, so a stream resumes from the backend's transcript; partial output and results aren't
|
|
67
|
-
* stored and can't be resumed from.
|
|
68
|
-
*/
|
|
69
106
|
after_id?: string;
|
|
70
107
|
};
|
|
71
|
-
|
|
72
|
-
* The SDK messages a session streams. `stream_event` messages are the partial assistant output;
|
|
73
|
-
* `assistant`/`user` the complete messages (tool calls and their results included), each with the
|
|
74
|
-
* uuid its backend stores it under; `result` ends each turn. codex sessions emit no `system` message.
|
|
75
|
-
*/
|
|
76
|
-
export type AgentStreamingMessage = SDKSystemMessage | SDKAssistantMessage | SDKPartialAssistantMessage | (SDKUserMessage & {
|
|
108
|
+
export type AgentStreamingMessage = SDKSystemMessage | AgentAssistantMessage | SDKPartialAssistantMessage | (SDKUserMessage & {
|
|
77
109
|
uuid: string;
|
|
78
110
|
session_id: string;
|
|
79
|
-
}) | SDKResultMessage;
|
|
80
|
-
/** A complete message of the conversation so far (no partial output), as the stream carried it. */
|
|
111
|
+
}) | SDKResultMessage | AgentCompactionMessage | AgentEventMessage | AgentStatusMessage | AgentPromptFailedMessage | AgentNoticeMessage;
|
|
81
112
|
export type AgentTranscriptMessage = Extract<AgentStreamingMessage, {
|
|
82
113
|
type: "user" | "assistant";
|
|
83
|
-
}
|
|
114
|
+
}> | AgentCompactionMessage | AgentEventMessage;
|
|
84
115
|
export type AgentTranscriptRequest = {
|
|
85
|
-
/** How many messages a page holds, about (a tool call and its result share a page); default 50, at most 500. */
|
|
86
116
|
limit?: number;
|
|
87
|
-
/**
|
|
88
|
-
* An ISO 8601 time: the page holds the newest messages from before it (a page's `nextBefore`, for
|
|
89
|
-
* the page before that one); omitted for the newest page.
|
|
90
|
-
*/
|
|
91
117
|
before?: string;
|
|
92
|
-
|
|
118
|
+
toolUseId?: string;
|
|
119
|
+
/** @deprecated */
|
|
93
120
|
cursor?: string;
|
|
94
121
|
};
|
|
95
|
-
/**
|
|
96
|
-
* Newest pages first; each page's messages oldest first. `nextBefore` is the time of its oldest
|
|
97
|
-
* message, when there are older ones: every message of that time is on this page.
|
|
98
|
-
*/
|
|
99
122
|
export type AgentTranscriptPage = {
|
|
100
123
|
readonly messages: AgentTranscriptMessage[];
|
|
101
124
|
readonly nextBefore: string | null;
|
|
102
|
-
/** @deprecated
|
|
125
|
+
/** @deprecated */
|
|
103
126
|
readonly nextCursor: string | null;
|
|
104
127
|
};
|
|
105
128
|
export type UserMessage = SDKUserMessage;
|
|
106
|
-
/**
|
|
107
|
-
* A tool call waiting for permission: claude's canUseTool call. The SDK's own permission request (its
|
|
108
|
-
* `can_use_tool` control request) isn't exported, so this mirrors it.
|
|
109
|
-
*/
|
|
110
129
|
export type AgentPermissionRequest = {
|
|
111
130
|
readonly id: string;
|
|
112
131
|
readonly tool_name: string;
|
|
113
132
|
readonly input: Record<string, unknown>;
|
|
114
133
|
readonly tool_use_id: string;
|
|
115
|
-
/** Why the agent asks, when it says (e.g. codex's reason for wanting network access). */
|
|
116
134
|
readonly decision_reason?: string;
|
|
117
135
|
};
|
|
118
136
|
export type AgentPermissionResult = PermissionResult;
|
|
119
137
|
type AskUserQuestion = AskUserQuestionInput["questions"][number];
|
|
120
|
-
/** A question of claude's AskUserQuestion tool; codex's may come with any number of options. */
|
|
121
138
|
export type AgentQuestion = Omit<AskUserQuestion, "options"> & {
|
|
122
139
|
readonly options: AskUserQuestion["options"][number][];
|
|
123
140
|
};
|
|
124
|
-
/** The agent asking the user something (claude's AskUserQuestion, codex's request_user_input). */
|
|
125
141
|
export type AgentQuestionRequest = {
|
|
126
142
|
readonly id: string;
|
|
127
143
|
readonly tool_use_id: string;
|
|
128
144
|
readonly questions: AgentQuestion[];
|
|
129
145
|
};
|
|
130
|
-
/**
|
|
131
|
-
* AskUserQuestion's own answer: question text -> the chosen label (labels joined with ", " for a
|
|
132
|
-
* multi-select), or the user's own words.
|
|
133
|
-
*/
|
|
134
146
|
export type AgentQuestionResponse = {
|
|
135
147
|
answers: NonNullable<AskUserQuestionInput["answers"]>;
|
|
136
148
|
};
|
|
137
|
-
/** One of the models a session can be switched to. */
|
|
138
149
|
export type AgentModelInfo = ModelInfo;
|
|
139
|
-
/**
|
|
140
|
-
* A task the agent keeps running after the tool call that started it has returned: claude's
|
|
141
|
-
* background commands and agents (its own shape, from background_tasks_changed), codex's background
|
|
142
|
-
* terminals.
|
|
143
|
-
*/
|
|
144
150
|
export type AgentBackgroundTask = SDKBackgroundTasksChangedMessage["tasks"][number];
|
|
145
|
-
/**
|
|
146
|
-
* Where a session's CLI stands with its sign-in. The CLI signs in as it normally would, through the
|
|
147
|
-
* dimension's gateway, which keeps the real tokens and gives the CLI fakes. "pending": a sign-in is
|
|
148
|
-
* waiting for the user to open `url` (and, for codex, enter `userCode` there; for claude, send back
|
|
149
|
-
* the code the page shows, when `needsCode`).
|
|
150
|
-
*/
|
|
151
151
|
export type AgentAuthStatus = {
|
|
152
152
|
readonly state: "signedIn";
|
|
153
153
|
} | {
|
|
154
|
-
readonly state: "signedOut";
|
|
154
|
+
readonly state: "signedOut";
|
|
155
155
|
readonly error?: string;
|
|
156
156
|
} | {
|
|
157
157
|
readonly state: "pending";
|
|
@@ -159,130 +159,86 @@ export type AgentAuthStatus = {
|
|
|
159
159
|
readonly userCode?: string;
|
|
160
160
|
readonly needsCode: boolean;
|
|
161
161
|
};
|
|
162
|
+
export type AgentBackendInfo = {
|
|
163
|
+
readonly backend: AgentBackend;
|
|
164
|
+
readonly version: string | null;
|
|
165
|
+
readonly ready: boolean;
|
|
166
|
+
readonly pinned: string;
|
|
167
|
+
};
|
|
162
168
|
/** @sealed */
|
|
163
169
|
export interface AgentProvision {
|
|
164
|
-
/** POST /v1/agents/:agentName/backends/:backend/install — installs the backend in the dimension, or updates it. */
|
|
165
170
|
install(agentName: string, backend: AgentBackend): Promise<void>;
|
|
166
|
-
|
|
167
|
-
/** @sealed */
|
|
168
|
-
export interface AgentEndpoint {
|
|
169
|
-
/**
|
|
170
|
-
* POST /v1/agents/:agentName/endpoint — the agent's worker, reachable from the client over the
|
|
171
|
-
* network (workerSseConnector speaks to it), authenticated by `scheme`, callable from pages of
|
|
172
|
-
* `allowedOrigins`. Call it before each connection: it starts the endpoint's proxy again if that
|
|
173
|
-
* stopped, keeping the same URL and credentials; a new endpoint only for another scheme or origins,
|
|
174
|
-
* or once the old one can't be served (closed, its port taken). Closed with the agent. Needs a host
|
|
175
|
-
* that declares endpoints.
|
|
176
|
-
*/
|
|
177
|
-
exposeAgent(agentName: string, scheme: SandboxEndpointScheme, allowedOrigins?: string[]): Promise<SandboxEndpoint>;
|
|
171
|
+
listBackends(agentName: string): Promise<AgentBackendInfo[]>;
|
|
178
172
|
}
|
|
179
173
|
/** @sealed */
|
|
180
174
|
export interface AgentStream {
|
|
181
|
-
/**
|
|
182
|
-
* GET /v1/agents/:agentName/sessions/:sessionName/stream?after_id= — the complete messages after
|
|
183
|
-
* `after_id` from the backend's transcript, then each message as the session produces it, pushed
|
|
184
|
-
* by the worker (session/subscribe) until the caller stops reading. Throws if the worker goes
|
|
185
|
-
* away; resume with the last user or assistant uuid seen.
|
|
186
|
-
*/
|
|
187
175
|
getStream(ref: SessionRef, req: AgentStreamingRequest): AsyncGenerator<AgentStreamingMessage>;
|
|
188
176
|
}
|
|
189
177
|
/** @sealed */
|
|
190
178
|
export interface AgentTranscript {
|
|
191
|
-
/**
|
|
192
|
-
* GET /v1/agents/:agentName/sessions/:sessionName/transcript?limit=&before= (or &cursor=, its old name) — a page of the
|
|
193
|
-
* conversation, read from the backend's own storage a piece at a time, so a conversation of any
|
|
194
|
-
* length can be paged through.
|
|
195
|
-
*/
|
|
196
179
|
getTranscript(ref: SessionRef, req?: AgentTranscriptRequest): Promise<AgentTranscriptPage>;
|
|
197
180
|
}
|
|
198
181
|
/** @sealed */
|
|
199
182
|
export interface AgentInterrupt {
|
|
200
|
-
/** POST /v1/agents/:agentName/sessions/:sessionName/interrupt — ends the current turn; pending permission requests are denied and questions dropped. */
|
|
201
183
|
cancel(ref: SessionRef): Promise<void>;
|
|
202
184
|
}
|
|
203
185
|
/** @sealed */
|
|
204
186
|
export interface AgentInput {
|
|
205
|
-
/**
|
|
206
|
-
* POST /v1/agents/:agentName/sessions/:sessionName/messages — resolves once the agent confirms it
|
|
207
|
-
* received the message (it starts a turn, or waits in the agent's own queue); fails if the agent
|
|
208
|
-
* refuses it or doesn't confirm.
|
|
209
|
-
*/
|
|
210
187
|
sendMessage(ref: SessionRef, message: UserMessage): Promise<void>;
|
|
211
188
|
}
|
|
212
189
|
/** @sealed */
|
|
213
190
|
export interface AgentSessionStatus {
|
|
214
|
-
/** GET /v1/agents/:agentName/sessions/:sessionName/status */
|
|
215
191
|
getSessionStatus(ref: SessionRef): Promise<AgentSessionState>;
|
|
216
192
|
}
|
|
217
193
|
/** @sealed */
|
|
218
194
|
export interface AgentMessageQueue {
|
|
219
|
-
/**
|
|
220
|
-
* GET /v1/agents/:agentName/sessions/:sessionName/queue — from the agent (claude's command
|
|
221
|
-
* lifecycle, codex's turn items), oldest first: the last message it took into a turn, then every
|
|
222
|
-
* one it still holds queued. While no CLI runs (nothing can be queued), the last prompt in its
|
|
223
|
-
* transcript. Empty before the first message.
|
|
224
|
-
*/
|
|
225
195
|
getLastUserMessages(ref: SessionRef): Promise<AgentLastUserMessage[]>;
|
|
226
196
|
}
|
|
227
197
|
/** @sealed */
|
|
228
198
|
export interface AgentPermissions {
|
|
229
|
-
/** GET /v1/agents/:agentName/sessions/:sessionName/permission-requests — the ones still waiting. */
|
|
230
199
|
listPermissionRequests(ref: SessionRef): Promise<AgentPermissionRequest[]>;
|
|
231
|
-
/** POST /v1/agents/:agentName/sessions/:sessionName/permission-requests/:requestId */
|
|
232
200
|
respondPermissionRequest(ref: SessionRef, requestId: string, result: AgentPermissionResult): Promise<void>;
|
|
233
201
|
}
|
|
234
202
|
/** @sealed */
|
|
235
203
|
export interface AgentQuestions {
|
|
236
|
-
/** GET /v1/agents/:agentName/sessions/:sessionName/question-requests — the ones still waiting. */
|
|
237
204
|
listQuestionRequests(ref: SessionRef): Promise<AgentQuestionRequest[]>;
|
|
238
|
-
/** POST /v1/agents/:agentName/sessions/:sessionName/question-requests/:requestId */
|
|
239
205
|
respondQuestionRequest(ref: SessionRef, requestId: string, response: AgentQuestionResponse): Promise<void>;
|
|
240
206
|
}
|
|
241
207
|
/** @sealed */
|
|
242
208
|
export interface AgentBackgroundTasks {
|
|
243
|
-
/** GET /v1/agents/:agentName/sessions/:sessionName/background-tasks — those still running; none while the CLI isn't. */
|
|
244
209
|
listBackgroundTasks(ref: SessionRef): Promise<AgentBackgroundTask[]>;
|
|
245
|
-
/** POST /v1/agents/:agentName/sessions/:sessionName/background-tasks/:taskId/stop — ends the task. */
|
|
246
210
|
stopTask(ref: SessionRef, taskId: string): Promise<void>;
|
|
247
211
|
}
|
|
248
212
|
/** @sealed */
|
|
249
213
|
export interface AgentAuth {
|
|
250
|
-
/** GET /v1/agents/:agentName/sessions/:sessionName/auth */
|
|
251
214
|
getAuthStatus(ref: SessionRef): Promise<AgentAuthStatus>;
|
|
252
|
-
/**
|
|
253
|
-
* POST /v1/agents/:agentName/sessions/:sessionName/auth/login — signs the session's CLI in with
|
|
254
|
-
* its own login. When the dimension's gateway already holds the upstream's credential, the sign-in
|
|
255
|
-
* completes without anyone (the gateway answers it) and this resolves signed in; otherwise it
|
|
256
|
-
* resolves pending, with the link for the user, and the gateway keeps the tokens once they sign in.
|
|
257
|
-
*/
|
|
258
215
|
login(ref: SessionRef): Promise<AgentAuthStatus>;
|
|
259
|
-
/** POST /v1/agents/:agentName/sessions/:sessionName/auth/code — finishes a pending sign-in that needs the page's code. */
|
|
260
216
|
submitAuthCode(ref: SessionRef, code: string): Promise<AgentAuthStatus>;
|
|
261
217
|
}
|
|
262
218
|
/** @sealed */
|
|
263
219
|
export interface AgentModels {
|
|
264
|
-
/** GET /v1/agents/:agentName/sessions/:sessionName/models — starts the CLI if it isn't running. */
|
|
265
220
|
listModels(ref: SessionRef): Promise<AgentModelInfo[]>;
|
|
266
|
-
/** PUT /v1/agents/:agentName/sessions/:sessionName/model — from the next turn on; null for the backend's default. */
|
|
267
221
|
setModel(ref: SessionRef, model: string | null): Promise<void>;
|
|
268
222
|
}
|
|
269
|
-
/**
|
|
270
|
-
export
|
|
271
|
-
|
|
223
|
+
/** @sealed */
|
|
224
|
+
export interface AgentPermissionModes {
|
|
225
|
+
setPermissionMode(ref: SessionRef, mode: AgentPermissionMode): Promise<void>;
|
|
226
|
+
}
|
|
227
|
+
export type AgentSessionCapabilities = AgentStream & AgentTranscript & AgentInterrupt & AgentInput & AgentSessionStatus & AgentMessageQueue & AgentPermissions & AgentQuestions & AgentBackgroundTasks & AgentAuth & AgentModels & AgentPermissionModes;
|
|
272
228
|
export type AgentLastUserMessage = {
|
|
273
229
|
readonly message: UserMessage;
|
|
274
230
|
readonly queued: boolean;
|
|
275
231
|
};
|
|
276
|
-
/** The request can't be satisfied as sent (bad name, unknown backend, unknown after_id, ...). */
|
|
277
232
|
export declare class AgentInvalidError extends Error {
|
|
278
233
|
name: string;
|
|
279
234
|
}
|
|
280
|
-
/** No agent, session, permission or question request by that name. */
|
|
281
235
|
export declare class AgentNotFoundError extends Error {
|
|
282
236
|
name: string;
|
|
283
237
|
}
|
|
284
|
-
/** The name is taken with a different spec. */
|
|
285
238
|
export declare class AgentConflictError extends Error {
|
|
286
239
|
name: string;
|
|
287
240
|
}
|
|
241
|
+
export declare class AgentBackendNotInstalledError extends AgentConflictError {
|
|
242
|
+
name: string;
|
|
243
|
+
}
|
|
288
244
|
export {};
|
package/dist/agent/api.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
/** The agent CLIs a session can run (agent/session/<backend>/). */
|
|
2
1
|
export const AGENT_BACKENDS = ["claude", "codex"];
|
|
3
|
-
|
|
2
|
+
export const AGENT_PERMISSION_MODES = ["ask", "auto"];
|
|
4
3
|
export class AgentInvalidError extends Error {
|
|
5
4
|
name = "AgentInvalidError";
|
|
6
5
|
}
|
|
7
|
-
/** No agent, session, permission or question request by that name. */
|
|
8
6
|
export class AgentNotFoundError extends Error {
|
|
9
7
|
name = "AgentNotFoundError";
|
|
10
8
|
}
|
|
11
|
-
/** The name is taken with a different spec. */
|
|
12
9
|
export class AgentConflictError extends Error {
|
|
13
10
|
name = "AgentConflictError";
|
|
14
11
|
}
|
|
12
|
+
export class AgentBackendNotInstalledError extends AgentConflictError {
|
|
13
|
+
name = "AgentBackendNotInstalledError";
|
|
14
|
+
}
|
package/dist/agent/client.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export { createWorkerClient, type WorkerClient } from "./session/client.ts";
|
|
2
2
|
export { sharedConnector, type SharedConnector } from "./session/sharedConnection.ts";
|
|
3
|
-
export {
|
|
3
|
+
export type { ConnectWorker } from "./session/workerConnection.ts";
|
|
4
|
+
export { EndpointCredentialsError, EndpointUnreachableError, workerGatewayConnector } from "./session/workerGatewayConnection.ts";
|
|
5
|
+
export { WorkerErrorCode } from "./session/worker/protocol.ts";
|
package/dist/agent/client.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
// An agent's worker, reached through its endpoint (AgentService.exposeAgent): what a browser can
|
|
2
|
-
// import (hyperbrane/agent/client), since the root module brings the server side with it.
|
|
3
1
|
export { createWorkerClient } from "./session/client.js";
|
|
4
2
|
export { sharedConnector } from "./session/sharedConnection.js";
|
|
5
|
-
export {
|
|
3
|
+
export { EndpointCredentialsError, EndpointUnreachableError, workerGatewayConnector } from "./session/workerGatewayConnection.js";
|
|
4
|
+
export { WorkerErrorCode } from "./session/worker/protocol.js";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Sandbox } from "../sandbox/api.ts";
|
|
2
|
+
import { type Agent, type AgentBackend, type AgentBackendInfo, type AgentSessionInfo, type SessionRef } from "./api.ts";
|
|
3
|
+
export declare const WORKER_DIR: string;
|
|
4
|
+
export type ControlOptions = {
|
|
5
|
+
dataDirectory?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare function createAgentScript(host: Sandbox, agent: Agent, options?: ControlOptions & {
|
|
8
|
+
replaceBuild?: boolean;
|
|
9
|
+
}): Promise<void>;
|
|
10
|
+
export declare function stopAgentScript(host: Sandbox, agentName: string, options?: ControlOptions): Promise<void>;
|
|
11
|
+
export declare function listAgentsScript(host: Sandbox, options?: ControlOptions): Promise<Agent[]>;
|
|
12
|
+
export declare function listSessionsScript(host: Sandbox, options?: ControlOptions): Promise<AgentSessionInfo[]>;
|
|
13
|
+
export declare function installScript(host: Sandbox, agentName: string, backend: AgentBackend, options?: ControlOptions): Promise<void>;
|
|
14
|
+
export declare function loginStateScript(host: Sandbox, ref: SessionRef, options?: ControlOptions): Promise<{
|
|
15
|
+
backend: AgentBackend;
|
|
16
|
+
gatewaySignedIn: boolean;
|
|
17
|
+
}>;
|
|
18
|
+
export declare function agentsDownScript(host: Sandbox, options?: ControlOptions): Promise<Agent[]>;
|
|
19
|
+
export declare function workerSocketScript(host: Sandbox, agentName: string, options?: ControlOptions): Promise<{
|
|
20
|
+
dimensionName: string;
|
|
21
|
+
socket: string;
|
|
22
|
+
}>;
|
|
23
|
+
export declare function listBackendsScript(host: Sandbox, agentName: string, options?: ControlOptions): Promise<AgentBackendInfo[]>;
|