mirror of
https://github.com/harivansh-afk/sandbox-agent.git
synced 2026-04-18 13:04:05 +00:00
acp spec (#155)
This commit is contained in:
parent
70287ec471
commit
e72eb9f611
264 changed files with 18559 additions and 51021 deletions
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -1,76 +1,48 @@
|
|||
export { SandboxAgent, SandboxAgentError } from "./client.ts";
|
||||
export { buildInspectorUrl } from "./inspector.ts";
|
||||
export type { InspectorUrlOptions } from "./inspector.ts";
|
||||
export type {
|
||||
SandboxAgentConnectOptions,
|
||||
SandboxAgentStartOptions,
|
||||
export {
|
||||
AlreadyConnectedError,
|
||||
NotConnectedError,
|
||||
SandboxAgent,
|
||||
SandboxAgentClient,
|
||||
SandboxAgentError,
|
||||
} from "./client.ts";
|
||||
export { buildInspectorUrl } from "./inspector.ts";
|
||||
|
||||
export type {
|
||||
AgentEvent,
|
||||
AgentUnparsedNotification,
|
||||
ListModelsResponse,
|
||||
PermissionRequest,
|
||||
PermissionResponse,
|
||||
SandboxAgentClientConnectOptions,
|
||||
SandboxAgentClientOptions,
|
||||
SandboxAgentConnectOptions,
|
||||
SandboxAgentEventObserver,
|
||||
SandboxAgentStartOptions,
|
||||
SandboxMetadata,
|
||||
SessionCreateRequest,
|
||||
SessionModelInfo,
|
||||
SessionUpdateNotification,
|
||||
} from "./client.ts";
|
||||
|
||||
export type {
|
||||
InspectorUrlOptions,
|
||||
} from "./inspector.ts";
|
||||
|
||||
export type {
|
||||
AgentCapabilities,
|
||||
AgentInfo,
|
||||
AgentInstallArtifact,
|
||||
AgentInstallRequest,
|
||||
AgentInstallResponse,
|
||||
AgentListResponse,
|
||||
AgentModelInfo,
|
||||
AgentModelsResponse,
|
||||
AgentModeInfo,
|
||||
AgentModesResponse,
|
||||
AgentUnparsedData,
|
||||
ContentPart,
|
||||
CreateSessionRequest,
|
||||
CreateSessionResponse,
|
||||
ErrorData,
|
||||
EventSource,
|
||||
EventsQuery,
|
||||
EventsResponse,
|
||||
FileAction,
|
||||
FsActionResponse,
|
||||
FsDeleteQuery,
|
||||
FsEntriesQuery,
|
||||
FsEntry,
|
||||
FsEntryType,
|
||||
FsMoveRequest,
|
||||
FsMoveResponse,
|
||||
FsPathQuery,
|
||||
FsSessionQuery,
|
||||
FsStat,
|
||||
FsUploadBatchQuery,
|
||||
FsUploadBatchResponse,
|
||||
FsWriteResponse,
|
||||
HealthResponse,
|
||||
ItemDeltaData,
|
||||
ItemEventData,
|
||||
ItemKind,
|
||||
ItemRole,
|
||||
ItemStatus,
|
||||
MessageAttachment,
|
||||
MessageRequest,
|
||||
PermissionEventData,
|
||||
PermissionReply,
|
||||
PermissionReplyRequest,
|
||||
PermissionStatus,
|
||||
ProblemDetails,
|
||||
QuestionEventData,
|
||||
QuestionReplyRequest,
|
||||
QuestionStatus,
|
||||
ReasoningVisibility,
|
||||
SessionEndReason,
|
||||
SessionEndedData,
|
||||
SessionInfo,
|
||||
SessionListResponse,
|
||||
SessionStartedData,
|
||||
TerminatedBy,
|
||||
TurnStreamQuery,
|
||||
UniversalEvent,
|
||||
UniversalEventData,
|
||||
UniversalEventType,
|
||||
UniversalItem,
|
||||
McpServerConfig,
|
||||
McpCommand,
|
||||
McpRemoteTransport,
|
||||
McpOAuthConfig,
|
||||
McpOAuthConfigOrDisabled,
|
||||
SkillSource,
|
||||
SkillsConfig,
|
||||
SessionTerminateResponse,
|
||||
} from "./types.ts";
|
||||
export type { components, paths } from "./generated/openapi.ts";
|
||||
export type { SandboxAgentSpawnOptions, SandboxAgentSpawnLogMode } from "./spawn.ts";
|
||||
|
||||
export type {
|
||||
SandboxAgentSpawnLogMode,
|
||||
SandboxAgentSpawnOptions,
|
||||
} from "./spawn.ts";
|
||||
|
|
|
|||
|
|
@ -207,7 +207,7 @@ async function waitForHealth(
|
|||
throw new Error("sandbox-agent exited before becoming healthy.");
|
||||
}
|
||||
try {
|
||||
const response = await fetcher(`${baseUrl}/v1/health`, {
|
||||
const response = await fetcher(`${baseUrl}/v2/health`, {
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
});
|
||||
if (response.ok) {
|
||||
|
|
|
|||
|
|
@ -1,70 +1,282 @@
|
|||
import type { components } from "./generated/openapi.ts";
|
||||
export interface ProblemDetails {
|
||||
type: string;
|
||||
title: string;
|
||||
status: number;
|
||||
detail?: string;
|
||||
instance?: string;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
type S = components["schemas"];
|
||||
export type HealthStatus = "healthy" | "degraded" | "unhealthy" | "ok";
|
||||
|
||||
export type AgentCapabilities = S["AgentCapabilities"];
|
||||
export type AgentInfo = S["AgentInfo"];
|
||||
export type AgentInstallRequest = S["AgentInstallRequest"];
|
||||
export type AgentListResponse = S["AgentListResponse"];
|
||||
export type AgentModelInfo = S["AgentModelInfo"];
|
||||
export type AgentModelsResponse = S["AgentModelsResponse"];
|
||||
export type AgentModeInfo = S["AgentModeInfo"];
|
||||
export type AgentModesResponse = S["AgentModesResponse"];
|
||||
export type AgentUnparsedData = S["AgentUnparsedData"];
|
||||
export type ContentPart = S["ContentPart"];
|
||||
export type CreateSessionRequest = S["CreateSessionRequest"];
|
||||
export type CreateSessionResponse = S["CreateSessionResponse"];
|
||||
export type ErrorData = S["ErrorData"];
|
||||
export type EventSource = S["EventSource"];
|
||||
export type EventsQuery = S["EventsQuery"];
|
||||
export type EventsResponse = S["EventsResponse"];
|
||||
export type FileAction = S["FileAction"];
|
||||
export type FsActionResponse = S["FsActionResponse"];
|
||||
export type FsDeleteQuery = S["FsDeleteQuery"];
|
||||
export type FsEntriesQuery = S["FsEntriesQuery"];
|
||||
export type FsEntry = S["FsEntry"];
|
||||
export type FsEntryType = S["FsEntryType"];
|
||||
export type FsMoveRequest = S["FsMoveRequest"];
|
||||
export type FsMoveResponse = S["FsMoveResponse"];
|
||||
export type FsPathQuery = S["FsPathQuery"];
|
||||
export type FsSessionQuery = S["FsSessionQuery"];
|
||||
export type FsStat = S["FsStat"];
|
||||
export type FsUploadBatchQuery = S["FsUploadBatchQuery"];
|
||||
export type FsUploadBatchResponse = S["FsUploadBatchResponse"];
|
||||
export type FsWriteResponse = S["FsWriteResponse"];
|
||||
export type HealthResponse = S["HealthResponse"];
|
||||
export type ItemDeltaData = S["ItemDeltaData"];
|
||||
export type ItemEventData = S["ItemEventData"];
|
||||
export type ItemKind = S["ItemKind"];
|
||||
export type ItemRole = S["ItemRole"];
|
||||
export type ItemStatus = S["ItemStatus"];
|
||||
export type MessageRequest = S["MessageRequest"];
|
||||
export type MessageAttachment = S["MessageAttachment"];
|
||||
export type PermissionEventData = S["PermissionEventData"];
|
||||
export type PermissionReply = S["PermissionReply"];
|
||||
export type PermissionReplyRequest = S["PermissionReplyRequest"];
|
||||
export type PermissionStatus = S["PermissionStatus"];
|
||||
export type ProblemDetails = S["ProblemDetails"];
|
||||
export type QuestionEventData = S["QuestionEventData"];
|
||||
export type QuestionReplyRequest = S["QuestionReplyRequest"];
|
||||
export type QuestionStatus = S["QuestionStatus"];
|
||||
export type ReasoningVisibility = S["ReasoningVisibility"];
|
||||
export type SessionEndReason = S["SessionEndReason"];
|
||||
export type SessionEndedData = S["SessionEndedData"];
|
||||
export type SessionInfo = S["SessionInfo"];
|
||||
export type SessionListResponse = S["SessionListResponse"];
|
||||
export type SessionStartedData = S["SessionStartedData"];
|
||||
export type TerminatedBy = S["TerminatedBy"];
|
||||
export type TurnStreamQuery = S["TurnStreamQuery"];
|
||||
export type UniversalEvent = S["UniversalEvent"];
|
||||
export type UniversalEventData = S["UniversalEventData"];
|
||||
export type UniversalEventType = S["UniversalEventType"];
|
||||
export type UniversalItem = S["UniversalItem"];
|
||||
export interface AgentHealthInfo {
|
||||
agent: string;
|
||||
installed: boolean;
|
||||
running: boolean;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
export type McpServerConfig = S["McpServerConfig"];
|
||||
export type McpCommand = S["McpCommand"];
|
||||
export type McpRemoteTransport = S["McpRemoteTransport"];
|
||||
export type McpOAuthConfig = S["McpOAuthConfig"];
|
||||
export type McpOAuthConfigOrDisabled = S["McpOAuthConfigOrDisabled"];
|
||||
export type SkillSource = S["SkillSource"];
|
||||
export type SkillsConfig = S["SkillsConfig"];
|
||||
export interface HealthResponse {
|
||||
status: HealthStatus | string;
|
||||
version: string;
|
||||
uptime_ms: number;
|
||||
agents: AgentHealthInfo[];
|
||||
// Backward-compatible field from earlier v2 payloads.
|
||||
api_version?: string;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
export type ServerStatus = "running" | "stopped" | "error";
|
||||
|
||||
export interface ServerStatusInfo {
|
||||
status: ServerStatus | string;
|
||||
base_url?: string | null;
|
||||
baseUrl?: string | null;
|
||||
uptime_ms?: number | null;
|
||||
uptimeMs?: number | null;
|
||||
restart_count?: number;
|
||||
restartCount?: number;
|
||||
last_error?: string | null;
|
||||
lastError?: string | null;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
export interface AgentModelInfo {
|
||||
id?: string;
|
||||
model_id?: string;
|
||||
modelId?: string;
|
||||
name?: string | null;
|
||||
description?: string | null;
|
||||
default_variant?: string | null;
|
||||
defaultVariant?: string | null;
|
||||
variants?: string[] | null;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
export interface AgentModeInfo {
|
||||
id: string;
|
||||
name: string;
|
||||
description: string;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
export interface AgentCapabilities {
|
||||
plan_mode?: boolean;
|
||||
permissions?: boolean;
|
||||
questions?: boolean;
|
||||
tool_calls?: boolean;
|
||||
tool_results?: boolean;
|
||||
text_messages?: boolean;
|
||||
images?: boolean;
|
||||
file_attachments?: boolean;
|
||||
session_lifecycle?: boolean;
|
||||
error_events?: boolean;
|
||||
reasoning?: boolean;
|
||||
status?: boolean;
|
||||
command_execution?: boolean;
|
||||
file_changes?: boolean;
|
||||
mcp_tools?: boolean;
|
||||
streaming_deltas?: boolean;
|
||||
item_started?: boolean;
|
||||
shared_process?: boolean;
|
||||
unstable_methods?: boolean;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
export interface AgentInfo {
|
||||
id: string;
|
||||
installed?: boolean;
|
||||
credentials_available?: boolean;
|
||||
native_required?: boolean;
|
||||
native_installed?: boolean;
|
||||
native_version?: string | null;
|
||||
agent_process_installed?: boolean;
|
||||
agent_process_source?: string | null;
|
||||
agent_process_version?: string | null;
|
||||
version?: string | null;
|
||||
path?: string | null;
|
||||
server_status?: ServerStatusInfo | null;
|
||||
models?: AgentModelInfo[] | null;
|
||||
default_model?: string | null;
|
||||
modes?: AgentModeInfo[] | null;
|
||||
capabilities: AgentCapabilities;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
export interface AgentListResponse {
|
||||
agents: AgentInfo[];
|
||||
}
|
||||
|
||||
export interface AgentInstallRequest {
|
||||
reinstall?: boolean;
|
||||
agentVersion?: string;
|
||||
agentProcessVersion?: string;
|
||||
}
|
||||
|
||||
export interface AgentInstallArtifact {
|
||||
kind: string;
|
||||
path: string;
|
||||
source: string;
|
||||
version?: string | null;
|
||||
}
|
||||
|
||||
export interface AgentInstallResponse {
|
||||
already_installed: boolean;
|
||||
artifacts: AgentInstallArtifact[];
|
||||
}
|
||||
|
||||
export type SessionEndReason = "completed" | "error" | "terminated";
|
||||
export type TerminatedBy = "agent" | "daemon";
|
||||
|
||||
export interface StderrOutput {
|
||||
head?: string | null;
|
||||
tail?: string | null;
|
||||
truncated: boolean;
|
||||
total_lines?: number | null;
|
||||
}
|
||||
|
||||
export interface SessionTerminationInfo {
|
||||
reason: SessionEndReason | string;
|
||||
terminated_by: TerminatedBy | string;
|
||||
message?: string | null;
|
||||
exit_code?: number | null;
|
||||
stderr?: StderrOutput | null;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
export interface SessionInfo {
|
||||
session_id: string;
|
||||
sessionId?: string;
|
||||
agent?: string;
|
||||
cwd?: string;
|
||||
title?: string | null;
|
||||
ended?: boolean;
|
||||
created_at?: string | number | null;
|
||||
createdAt?: string | number | null;
|
||||
updated_at?: string | number | null;
|
||||
updatedAt?: string | number | null;
|
||||
model?: string | null;
|
||||
metadata?: Record<string, unknown> | null;
|
||||
agent_mode?: string;
|
||||
agentMode?: string;
|
||||
permission_mode?: string;
|
||||
permissionMode?: string;
|
||||
native_session_id?: string | null;
|
||||
nativeSessionId?: string | null;
|
||||
event_count?: number;
|
||||
eventCount?: number;
|
||||
directory?: string | null;
|
||||
variant?: string | null;
|
||||
mcp?: Record<string, unknown> | null;
|
||||
skills?: Record<string, unknown> | null;
|
||||
termination_info?: SessionTerminationInfo | null;
|
||||
terminationInfo?: SessionTerminationInfo | null;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
export interface SessionListResponse {
|
||||
sessions: SessionInfo[];
|
||||
}
|
||||
|
||||
export interface SessionTerminateResponse {
|
||||
terminated?: boolean;
|
||||
reason?: SessionEndReason | string;
|
||||
terminated_by?: TerminatedBy | string;
|
||||
terminatedBy?: TerminatedBy | string;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
export interface SessionEndedParams {
|
||||
session_id?: string;
|
||||
sessionId?: string;
|
||||
data?: SessionTerminationInfo;
|
||||
reason?: SessionEndReason | string;
|
||||
terminated_by?: TerminatedBy | string;
|
||||
terminatedBy?: TerminatedBy | string;
|
||||
message?: string | null;
|
||||
exit_code?: number | null;
|
||||
stderr?: StderrOutput | null;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
export interface SessionEndedNotification {
|
||||
jsonrpc: "2.0";
|
||||
method: "_sandboxagent/session/ended";
|
||||
params: SessionEndedParams;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
export interface FsPathQuery {
|
||||
path: string;
|
||||
session_id?: string | null;
|
||||
sessionId?: string | null;
|
||||
}
|
||||
|
||||
export interface FsEntriesQuery {
|
||||
path?: string | null;
|
||||
session_id?: string | null;
|
||||
sessionId?: string | null;
|
||||
}
|
||||
|
||||
export interface FsSessionQuery {
|
||||
session_id?: string | null;
|
||||
sessionId?: string | null;
|
||||
}
|
||||
|
||||
export interface FsDeleteQuery {
|
||||
path: string;
|
||||
recursive?: boolean | null;
|
||||
session_id?: string | null;
|
||||
sessionId?: string | null;
|
||||
}
|
||||
|
||||
export interface FsUploadBatchQuery {
|
||||
path?: string | null;
|
||||
session_id?: string | null;
|
||||
sessionId?: string | null;
|
||||
}
|
||||
|
||||
export type FsEntryType = "file" | "directory";
|
||||
|
||||
export interface FsEntry {
|
||||
name: string;
|
||||
path: string;
|
||||
size: number;
|
||||
entry_type?: FsEntryType;
|
||||
entryType?: FsEntryType;
|
||||
modified?: string | null;
|
||||
}
|
||||
|
||||
export interface FsStat {
|
||||
path: string;
|
||||
size: number;
|
||||
entry_type?: FsEntryType;
|
||||
entryType?: FsEntryType;
|
||||
modified?: string | null;
|
||||
}
|
||||
|
||||
export interface FsWriteResponse {
|
||||
path: string;
|
||||
bytes_written?: number;
|
||||
bytesWritten?: number;
|
||||
}
|
||||
|
||||
export interface FsMoveRequest {
|
||||
from: string;
|
||||
to: string;
|
||||
overwrite?: boolean | null;
|
||||
}
|
||||
|
||||
export interface FsMoveResponse {
|
||||
from: string;
|
||||
to: string;
|
||||
}
|
||||
|
||||
export interface FsActionResponse {
|
||||
path: string;
|
||||
}
|
||||
|
||||
export interface FsUploadBatchResponse {
|
||||
paths: string[];
|
||||
truncated: boolean;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue