20260109
This commit is contained in:
60
requirement-web/node_modules/@anthropic-ai/claude-agent-sdk/transport/processTransportTypes.d.ts
generated
vendored
Normal file
60
requirement-web/node_modules/@anthropic-ai/claude-agent-sdk/transport/processTransportTypes.d.ts
generated
vendored
Normal file
@ -0,0 +1,60 @@
|
||||
import type { Readable, Writable } from 'stream';
|
||||
/**
|
||||
* Represents a spawned process with stdin/stdout streams and lifecycle management.
|
||||
* Implementers provide this interface to abstract the process spawning mechanism.
|
||||
* ChildProcess already satisfies this interface.
|
||||
*/
|
||||
export interface SpawnedProcess {
|
||||
/** Writable stream for sending data to the process stdin */
|
||||
stdin: Writable;
|
||||
/** Readable stream for receiving data from the process stdout */
|
||||
stdout: Readable;
|
||||
/** Whether the process has been killed */
|
||||
readonly killed: boolean;
|
||||
/** Exit code if the process has exited, null otherwise */
|
||||
readonly exitCode: number | null;
|
||||
/**
|
||||
* Kill the process with the given signal
|
||||
* @param signal - The signal to send (e.g., 'SIGTERM', 'SIGKILL')
|
||||
*/
|
||||
kill(signal: NodeJS.Signals): boolean;
|
||||
/**
|
||||
* Register a callback for when the process exits
|
||||
* @param event - Must be 'exit'
|
||||
* @param listener - Callback receiving exit code and signal
|
||||
*/
|
||||
on(event: 'exit', listener: (code: number | null, signal: NodeJS.Signals | null) => void): void;
|
||||
/**
|
||||
* Register a callback for process errors
|
||||
* @param event - Must be 'error'
|
||||
* @param listener - Callback receiving the error
|
||||
*/
|
||||
on(event: 'error', listener: (error: Error) => void): void;
|
||||
/**
|
||||
* Register a one-time callback for when the process exits
|
||||
*/
|
||||
once(event: 'exit', listener: (code: number | null, signal: NodeJS.Signals | null) => void): void;
|
||||
once(event: 'error', listener: (error: Error) => void): void;
|
||||
/**
|
||||
* Remove an event listener
|
||||
*/
|
||||
off(event: 'exit', listener: (code: number | null, signal: NodeJS.Signals | null) => void): void;
|
||||
off(event: 'error', listener: (error: Error) => void): void;
|
||||
}
|
||||
/**
|
||||
* Options passed to the spawn function.
|
||||
*/
|
||||
export interface SpawnOptions {
|
||||
/** Command to execute */
|
||||
command: string;
|
||||
/** Arguments to pass to the command */
|
||||
args: string[];
|
||||
/** Working directory */
|
||||
cwd?: string;
|
||||
/** Environment variables */
|
||||
env: {
|
||||
[envVar: string]: string | undefined;
|
||||
};
|
||||
/** Abort signal for cancellation */
|
||||
signal: AbortSignal;
|
||||
}
|
||||
30
requirement-web/node_modules/@anthropic-ai/claude-agent-sdk/transport/transport.d.ts
generated
vendored
Normal file
30
requirement-web/node_modules/@anthropic-ai/claude-agent-sdk/transport/transport.d.ts
generated
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
import type { StdoutMessage } from '../entrypoints/sdkControlTypes.js';
|
||||
/**
|
||||
* Transport interface for Claude Code SDK communication
|
||||
* Abstracts the communication layer to support both process and WebSocket transports
|
||||
*/
|
||||
export interface Transport {
|
||||
/**
|
||||
* Write data to the transport
|
||||
* May be async for network-based transports
|
||||
*/
|
||||
write(data: string): void | Promise<void>;
|
||||
/**
|
||||
* Close the transport connection and clean up resources
|
||||
* This also closes stdin if still open (eliminating need for endInput)
|
||||
*/
|
||||
close(): void;
|
||||
/**
|
||||
* Check if transport is ready for communication
|
||||
*/
|
||||
isReady(): boolean;
|
||||
/**
|
||||
* Read and parse messages from the transport
|
||||
* Each transport handles its own protocol and error checking
|
||||
*/
|
||||
readMessages(): AsyncGenerator<StdoutMessage, void, unknown>;
|
||||
/**
|
||||
* End the input stream
|
||||
*/
|
||||
endInput(): void;
|
||||
}
|
||||
Reference in New Issue
Block a user