TypeScript SDK Deno API
This page lists declarations added or changed by @stacklok-oss/mecatl-sdk/deno. The entry point also exports the shared core API.
Symbol index
| Symbol | Kind |
|---|---|
connect | Function |
DaemonInfo | Interface |
DenoConnectOptions | Type alias |
NodeTransportCommonOptions | Interface |
NodeTransportOptions | Type alias |
query | Function |
Query | Interface |
QueryOptions | Interface |
spawn | Function |
SpawnedClient | Interface |
SpawnOptions | Interface |
Functions
connect
Creates a Deno client using the shared ConnectRPC gRPC transport.
export declare function connect(options: DenoConnectOptions): Client;
Parameters:
options(DenoConnectOptions): TCP authority, Unix socket, credentials, HTTP/2 settings, or a caller-owned transport.
Returns: Client: A high-level client without callback-tool registration.
query
Spawns if needed, creates one session, runs one prompt, and cleans up owned resources.
export declare function query(prompt: PromptInput, options?: QueryOptions): Promise<Query>;
Parameters:
prompt(PromptInput): Text or ordered text, image, and audio parts for the run.options(QueryOptions, optional): Session, responder, cancellation, retention, and daemon options.
Returns: Promise<Query>: A single-consumption event stream for the query-created session.
Throws: PlanApprovalRequiredError when plan mode has no approval responder.
spawn
Starts one local mecated daemon with Deno.Command and waits for its ready-file barrier.
export declare function spawn(options?: SpawnOptions): Promise<SpawnedClient>;
Parameters:
options(SpawnOptions, optional): Executable, daemon arguments, environment, readiness, and diagnostics options.
Returns: Promise<SpawnedClient>: A client that owns the daemon process and its private runtime directory.
Interfaces
DaemonInfo
Non-secret facts published by a Deno-owned daemon.
export interface DaemonInfo
DaemonInfo.apiMajor
The ready document's wire API major.
readonly apiMajor: number;
DaemonInfo.features
Deployment-scoped feature identifiers reported by the daemon.
readonly features: readonly string[];
DaemonInfo.grpcAddress
Loopback TCP gRPC address used by this client.
readonly grpcAddress: string;
DaemonInfo.pid
The spawned daemon's process identifier.
readonly pid: number;
DaemonInfo.transport
Deno-spawned clients use the shared ConnectRPC gRPC transport.
readonly transport: "grpc";
NodeTransportCommonOptions
Shared credentials and HTTP/2 settings for gRPC in Node.js, Bun, or Deno.
export interface NodeTransportCommonOptions extends CredentialOptions
NodeTransportCommonOptions.nodeOptions
HTTP/2 and TLS session options. The SDK controls createConnection when using socketPath.
nodeOptions?: Omit<SecureClientSessionOptions, "createConnection">;
Query
One query-owned event stream and its created session ID.
export interface Query extends AsyncIterable<Event>
Query.sessionId
The ID of the session created for this query.
readonly sessionId: string;
QueryOptions
Options for one Deno query() call.
export interface QueryOptions
QueryOptions.client
Use an existing client instead of spawning a local daemon. The client remains caller-owned.
client?: Client;
QueryOptions.onPermissionAsk
Automatically answer permission asks. With no responder, query denies each ask safely.
onPermissionAsk?: PermissionAskResponder;
QueryOptions.onPlanApproval
Required in plan mode and invoked only for PresentPlan approval asks.
onPlanApproval?: PlanApprovalResponder;
QueryOptions.retainSession
Keep the created session after the query. SDK-spawned daemons use an in-memory store.
retainSession?: boolean;
QueryOptions.session
Fields applied when query creates its session.
session?: CreateSessionOptions;
QueryOptions.signal
Abort this query and clean up every resource it created.
signal?: AbortSignal;
QueryOptions.spawn
Deno daemon options used only when query creates its own client.
spawn?: SpawnOptions;
SpawnedClient
A Client that owns one Deno.Command-launched local daemon.
export interface SpawnedClient extends Client
SpawnedClient.daemon
The ready document's non-secret daemon facts.
readonly daemon: DaemonInfo;
SpawnOptions
Options for starting one Deno-owned local daemon.
export interface SpawnOptions extends ClientDiagnosticsOptions
SpawnOptions.args
Additional daemon arguments. SDK-owned listener and lifecycle flags cannot be replaced.
args?: readonly string[];
SpawnOptions.binaryPath
Explicit mecated executable. Defaults to resolving mecated through PATH.
binaryPath?: string;
SpawnOptions.env
Environment overrides inherited by the daemon.
env?: Readonly<Record<string, string>>;
SpawnOptions.readinessTimeoutMs
Deadline for publication of a complete supported ready document.
readinessTimeoutMs?: number;
SpawnOptions.tempDirectory
Parent directory for the private ready-file directory. Defaults to Deno's temporary directory.
tempDirectory?: string;
Type aliases
DenoConnectOptions
Options accepted by gRPC connect() in Deno.
export type DenoConnectOptions = (NodeTransportOptions | InjectedTransportOptions) & ClientDiagnosticsOptions;
NodeTransportOptions
Selects a TCP authority or Unix domain socket for the gRPC transport.
export type NodeTransportOptions = NodeTransportCommonOptions & ({
baseUrl: string;
socketPath?: never;
} | {
baseUrl?: string;
socketPath: string;
});