@elpapi42/pi-fleet 0.1.0-beta.10 → 0.1.0-beta.14
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/CHANGELOG.md +34 -1
- package/README.md +99 -167
- package/dist/cli-meta.json +313 -315
- package/dist/cli.mjs +2504 -1812
- package/dist/cli.mjs.map +4 -4
- package/dist/client/agent-target.d.ts +33 -0
- package/dist/client/contracts.d.ts +81 -0
- package/dist/client/fleet-client.d.ts +118 -0
- package/dist/client/index.d.ts +4 -0
- package/dist/client/sdk-connector.d.ts +7 -0
- package/dist/client/sdk-facade.d.ts +84 -0
- package/dist/client/sdk-transport.d.ts +24 -0
- package/dist/client/shared-client.d.ts +18 -0
- package/dist/client/socket-fleet-client.d.ts +21 -0
- package/dist/client-meta.json +5736 -0
- package/dist/client.mjs +4434 -0
- package/dist/client.mjs.map +7 -0
- package/dist/installer-meta.json +7 -7
- package/dist/installer.mjs +47 -13
- package/dist/installer.mjs.map +2 -2
- package/dist/journal-sqlite-worker-meta.json +149 -0
- package/dist/journal-sqlite-worker.mjs +1110 -0
- package/dist/journal-sqlite-worker.mjs.map +7 -0
- package/dist/pi/external-installation.d.ts +23 -0
- package/dist/platform/client/start-runtime.d.ts +25 -0
- package/dist/platform/install/runtime-release.d.ts +8 -0
- package/dist/platform/install/tree-integrity.d.ts +7 -0
- package/dist/platform/shared/paths.d.ts +8 -0
- package/dist/platform/shared/runtime-ownership.d.ts +14 -0
- package/dist/protocol/jsonl.d.ts +3 -0
- package/dist/protocol/pi-identity.d.ts +16 -0
- package/dist/protocol/semantic-segmentation.d.ts +22 -0
- package/dist/protocol/version.d.ts +2 -0
- package/dist/runtime/semantic-events.d.ts +43 -0
- package/dist/runtime-manifest.json +156 -31
- package/dist/runtime-meta.json +378 -53
- package/dist/runtime.mjs +3173 -581
- package/dist/runtime.mjs.map +4 -4
- package/dist/shared/result.d.ts +9 -0
- package/package.json +14 -1
- package/dist/sqlite-worker-meta.json +0 -84
- package/dist/sqlite-worker.mjs +0 -359
- package/dist/sqlite-worker.mjs.map +0 -7
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { AgentId, ReceiveCursor } from "./contracts.js";
|
|
2
|
+
/** A user-facing lookup that may resolve to the current generation for a name. */
|
|
3
|
+
export interface AgentNameLookup {
|
|
4
|
+
readonly name: string;
|
|
5
|
+
}
|
|
6
|
+
/** A resolved target that must not retarget a later same-name agent. */
|
|
7
|
+
export interface ExpectedAgentTarget extends AgentNameLookup {
|
|
8
|
+
readonly expectedAgentId: AgentId;
|
|
9
|
+
}
|
|
10
|
+
export type ReceiveStart = {
|
|
11
|
+
readonly kind: "live";
|
|
12
|
+
} | {
|
|
13
|
+
readonly kind: "after";
|
|
14
|
+
readonly cursor: ReceiveCursor;
|
|
15
|
+
} | {
|
|
16
|
+
readonly kind: "start";
|
|
17
|
+
};
|
|
18
|
+
/** The future cursor encoding contract; encoded cursor contents remain private. */
|
|
19
|
+
export interface ReceiveCursorCodec {
|
|
20
|
+
readonly version: 1;
|
|
21
|
+
encode(boundary: {
|
|
22
|
+
readonly agentId: AgentId;
|
|
23
|
+
readonly epoch: number;
|
|
24
|
+
readonly position: number;
|
|
25
|
+
readonly kind?: "position" | "continuation";
|
|
26
|
+
}): ReceiveCursor;
|
|
27
|
+
decode(cursor: ReceiveCursor): {
|
|
28
|
+
readonly agentId: AgentId;
|
|
29
|
+
readonly epoch: number;
|
|
30
|
+
readonly position: number;
|
|
31
|
+
readonly kind: "position" | "continuation";
|
|
32
|
+
};
|
|
33
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
export type AgentId = string & {
|
|
2
|
+
readonly __brand: "AgentId";
|
|
3
|
+
};
|
|
4
|
+
export type AgentEventId = string & {
|
|
5
|
+
readonly __brand: "AgentEventId";
|
|
6
|
+
};
|
|
7
|
+
export type ActivityId = string & {
|
|
8
|
+
readonly __brand: "ActivityId";
|
|
9
|
+
};
|
|
10
|
+
export type ReceiveCursor = string & {
|
|
11
|
+
readonly __brand: "ReceiveCursor";
|
|
12
|
+
};
|
|
13
|
+
export type ContinuityEpoch = number & {
|
|
14
|
+
readonly __brand: "ContinuityEpoch";
|
|
15
|
+
};
|
|
16
|
+
export type AgentState = "restoring" | "working" | "idle" | "failed" | "destroying";
|
|
17
|
+
export type ProcessState = "resident" | "starting" | "absent" | "cleanup_uncertain";
|
|
18
|
+
export interface AgentSummary {
|
|
19
|
+
readonly id: string;
|
|
20
|
+
readonly name: string;
|
|
21
|
+
readonly state: AgentState;
|
|
22
|
+
readonly process: {
|
|
23
|
+
readonly state: ProcessState;
|
|
24
|
+
};
|
|
25
|
+
readonly session: {
|
|
26
|
+
readonly path: string | null;
|
|
27
|
+
readonly id: string | null;
|
|
28
|
+
};
|
|
29
|
+
readonly error?: {
|
|
30
|
+
readonly code: string;
|
|
31
|
+
} | undefined;
|
|
32
|
+
}
|
|
33
|
+
export declare const PI_FLEET_ERROR_CODES: readonly ["agent_busy", "agent_destroyed", "agent_destroying", "agent_not_found", "capacity_exceeded", "cancelled", "compaction_failed", "compaction_uncertain", "cursor_expired", "cursor_invalid", "cursor_wrong_agent", "delivery_uncertain", "destroy_incomplete", "incarnation_cleanup_uncertain", "internal_error", "invalid_arguments", "invalid_request", "name_taken", "nothing_to_compact", "observation_uncertain", "operation_conflict", "operation_in_progress", "pi_installation_changed", "pi_not_executable", "pi_not_found", "pi_runtime_mismatch", "pi_service_mismatch", "pi_start_failed", "pi_version_unavailable", "pi_version_unsupported", "protocol_error", "protocol_incompatible", "receive_resource_exhausted", "runtime_interrupted", "runtime_unavailable", "runtime_upgrade_deferred", "semantic_event_too_large", "stale_agent", "state_corrupt", "storage_unavailable", "timeout"];
|
|
34
|
+
export type PiFleetErrorCode = (typeof PI_FLEET_ERROR_CODES)[number];
|
|
35
|
+
export declare function isPiFleetErrorCode(value: unknown): value is PiFleetErrorCode;
|
|
36
|
+
export interface SemanticEventBase {
|
|
37
|
+
readonly id: AgentEventId;
|
|
38
|
+
readonly activityId: ActivityId;
|
|
39
|
+
readonly agentId: AgentId;
|
|
40
|
+
readonly cursor: ReceiveCursor;
|
|
41
|
+
readonly epoch: ContinuityEpoch;
|
|
42
|
+
readonly sourceRawPosition: number;
|
|
43
|
+
readonly observedAt: string;
|
|
44
|
+
}
|
|
45
|
+
export interface AssistantThinkingStartedEvent extends SemanticEventBase {
|
|
46
|
+
readonly type: "assistant.thinking.started";
|
|
47
|
+
}
|
|
48
|
+
export interface AssistantThinkingFinishedEvent extends SemanticEventBase {
|
|
49
|
+
readonly type: "assistant.thinking.finished";
|
|
50
|
+
readonly text: string;
|
|
51
|
+
}
|
|
52
|
+
export interface AssistantMessageStartedEvent extends SemanticEventBase {
|
|
53
|
+
readonly type: "assistant.message.started";
|
|
54
|
+
}
|
|
55
|
+
export interface AssistantMessageFinishedEvent extends SemanticEventBase {
|
|
56
|
+
readonly type: "assistant.message.finished";
|
|
57
|
+
readonly text: string;
|
|
58
|
+
}
|
|
59
|
+
export interface ToolExecutionStartedEvent extends SemanticEventBase {
|
|
60
|
+
readonly type: "tool.execution.started";
|
|
61
|
+
readonly tool: {
|
|
62
|
+
readonly callId: string;
|
|
63
|
+
readonly name: string;
|
|
64
|
+
readonly input: unknown;
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
export interface ToolExecutionFinishedEvent extends SemanticEventBase {
|
|
68
|
+
readonly type: "tool.execution.finished";
|
|
69
|
+
readonly tool: {
|
|
70
|
+
readonly callId: string;
|
|
71
|
+
readonly name: string;
|
|
72
|
+
readonly input: unknown;
|
|
73
|
+
readonly output: unknown;
|
|
74
|
+
readonly isError: boolean;
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
export type SemanticEvent = AssistantThinkingStartedEvent | AssistantThinkingFinishedEvent | AssistantMessageStartedEvent | AssistantMessageFinishedEvent | ToolExecutionStartedEvent | ToolExecutionFinishedEvent;
|
|
78
|
+
export interface ReceiveStream extends AsyncIterable<SemanticEvent> {
|
|
79
|
+
/** Cursor for the registered replay/live boundary, available before the first event. */
|
|
80
|
+
readonly cursor: ReceiveCursor;
|
|
81
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import type { Readable, Writable } from "node:stream";
|
|
2
|
+
import type { AgentSummary, PiFleetErrorCode, ReceiveCursor, SemanticEvent } from "./contracts.js";
|
|
3
|
+
import type { ReceiveStart } from "./agent-target.js";
|
|
4
|
+
import type { Result } from "../shared/result.js";
|
|
5
|
+
export type { AgentSummary, AgentState, PiFleetErrorCode as FleetClientErrorCode, ProcessState, } from "./contracts.js";
|
|
6
|
+
export interface CreateInput {
|
|
7
|
+
readonly name: string;
|
|
8
|
+
readonly instructions?: string;
|
|
9
|
+
readonly cwd: string;
|
|
10
|
+
readonly piArgv: readonly string[];
|
|
11
|
+
}
|
|
12
|
+
export interface SendInput {
|
|
13
|
+
readonly name: string;
|
|
14
|
+
readonly expectedAgentId?: string;
|
|
15
|
+
readonly message: string;
|
|
16
|
+
readonly delivery?: "steer" | "followUp";
|
|
17
|
+
}
|
|
18
|
+
export interface ReceiveInput {
|
|
19
|
+
readonly name: string;
|
|
20
|
+
readonly expectedAgentId?: string;
|
|
21
|
+
readonly start?: ReceiveStart;
|
|
22
|
+
readonly untilIdle?: boolean;
|
|
23
|
+
}
|
|
24
|
+
export interface StatusInput {
|
|
25
|
+
readonly name: string;
|
|
26
|
+
readonly expectedAgentId?: string;
|
|
27
|
+
}
|
|
28
|
+
export interface DestroyInput {
|
|
29
|
+
readonly name: string;
|
|
30
|
+
readonly expectedAgentId?: string;
|
|
31
|
+
}
|
|
32
|
+
export interface CompactInput {
|
|
33
|
+
readonly name: string;
|
|
34
|
+
readonly expectedAgentId?: string;
|
|
35
|
+
}
|
|
36
|
+
export interface OperationIdentity {
|
|
37
|
+
readonly operationId: string;
|
|
38
|
+
readonly createdAt: string;
|
|
39
|
+
}
|
|
40
|
+
export interface RequestOptions {
|
|
41
|
+
readonly signal: AbortSignal;
|
|
42
|
+
readonly timeoutMs?: number;
|
|
43
|
+
}
|
|
44
|
+
export interface MutationOptions extends RequestOptions {
|
|
45
|
+
readonly operation: OperationIdentity;
|
|
46
|
+
}
|
|
47
|
+
export interface FleetClientError {
|
|
48
|
+
/** Codes are intentionally content-safe; payload-bearing details remain optional and redacted. */
|
|
49
|
+
readonly code: PiFleetErrorCode;
|
|
50
|
+
readonly message: string;
|
|
51
|
+
readonly details?: Readonly<Record<string, unknown>>;
|
|
52
|
+
}
|
|
53
|
+
export interface CreateResult {
|
|
54
|
+
readonly schemaVersion: 1;
|
|
55
|
+
readonly type: "agent.created";
|
|
56
|
+
readonly agent: AgentSummary;
|
|
57
|
+
}
|
|
58
|
+
export interface SendResult {
|
|
59
|
+
readonly schemaVersion: 1;
|
|
60
|
+
readonly type: "message.accepted";
|
|
61
|
+
readonly agent: {
|
|
62
|
+
readonly id: string;
|
|
63
|
+
readonly name: string;
|
|
64
|
+
};
|
|
65
|
+
readonly acceptedAt: string;
|
|
66
|
+
}
|
|
67
|
+
export type ReceiveStreamItem = {
|
|
68
|
+
readonly type: "ready";
|
|
69
|
+
readonly cursor: ReceiveCursor;
|
|
70
|
+
} | {
|
|
71
|
+
readonly type: "event";
|
|
72
|
+
readonly cursor: ReceiveCursor;
|
|
73
|
+
readonly event: SemanticEvent;
|
|
74
|
+
};
|
|
75
|
+
export interface StatusResult {
|
|
76
|
+
readonly schemaVersion: 1;
|
|
77
|
+
readonly type: "agent.status";
|
|
78
|
+
readonly agent: AgentSummary;
|
|
79
|
+
}
|
|
80
|
+
export interface ListResult {
|
|
81
|
+
readonly schemaVersion: 1;
|
|
82
|
+
readonly type: "agent.list";
|
|
83
|
+
readonly agents: readonly AgentSummary[];
|
|
84
|
+
}
|
|
85
|
+
export interface DestroyResult {
|
|
86
|
+
readonly schemaVersion: 1;
|
|
87
|
+
readonly type: "agent.destroyed";
|
|
88
|
+
readonly agent: {
|
|
89
|
+
readonly id: string;
|
|
90
|
+
readonly name: string;
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
export interface CompactResult {
|
|
94
|
+
readonly schemaVersion: 1;
|
|
95
|
+
readonly type: "agent.compacted";
|
|
96
|
+
readonly agent: {
|
|
97
|
+
readonly id: string;
|
|
98
|
+
readonly name: string;
|
|
99
|
+
};
|
|
100
|
+
readonly compaction: {
|
|
101
|
+
readonly tokensBefore: number;
|
|
102
|
+
readonly estimatedTokensAfter?: number;
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
export interface FleetClient {
|
|
106
|
+
create(input: CreateInput, options: MutationOptions): Promise<Result<CreateResult, FleetClientError>>;
|
|
107
|
+
send(input: SendInput, options: MutationOptions): Promise<Result<SendResult, FleetClientError>>;
|
|
108
|
+
receive(input: ReceiveInput, options: RequestOptions): AsyncIterable<Result<ReceiveStreamItem, FleetClientError>>;
|
|
109
|
+
status(input: StatusInput, options: RequestOptions): Promise<Result<StatusResult, FleetClientError>>;
|
|
110
|
+
list(options: RequestOptions): Promise<Result<ListResult, FleetClientError>>;
|
|
111
|
+
destroy(input: DestroyInput, options: MutationOptions): Promise<Result<DestroyResult, FleetClientError>>;
|
|
112
|
+
compact(input: CompactInput, options: MutationOptions): Promise<Result<CompactResult, FleetClientError>>;
|
|
113
|
+
}
|
|
114
|
+
export interface CliIo {
|
|
115
|
+
readonly stdin: Readable;
|
|
116
|
+
readonly stdout: Writable;
|
|
117
|
+
readonly stderr: Writable;
|
|
118
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Explicit connection boundary for the shared per-user pi-fleet control plane. */
|
|
2
|
+
export declare const connectPiFleet: import("./sdk-facade.js").ConnectPiFleet;
|
|
3
|
+
export { PiFleetError, type Agent, type AgentReceiveOptions, type CompactionSummary, type ConnectPiFleetOptions, type CreateAgentInput, type InputReceipt, type PiFleetClient, type SdkRequestOptions, type SendDelivery, } from "./sdk-facade.js";
|
|
4
|
+
export type { ActivityId, AgentEventId, AgentId, AgentState, AgentSummary, AssistantMessageFinishedEvent, AssistantMessageStartedEvent, AssistantThinkingFinishedEvent, AssistantThinkingStartedEvent, PiFleetErrorCode, ProcessState, ReceiveCursor, ReceiveStream, SemanticEvent, ToolExecutionFinishedEvent, ToolExecutionStartedEvent, } from "./contracts.js";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type SdkConnector } from "./sdk-facade.js";
|
|
2
|
+
import { type SharedClientConnection, type SharedClientConnectionOptions } from "./shared-client.js";
|
|
3
|
+
export interface SdkConnectorDependencies {
|
|
4
|
+
readonly createConnection?: (options: SharedClientConnectionOptions) => SharedClientConnection;
|
|
5
|
+
}
|
|
6
|
+
/** Creates the concrete connector while preserving side-effect-free module evaluation. */
|
|
7
|
+
export declare function createSdkConnector(dependencies?: SdkConnectorDependencies): SdkConnector;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { ExpectedAgentTarget, ReceiveStart } from "./agent-target.js";
|
|
2
|
+
import type { AgentId, AgentSummary, PiFleetErrorCode, ReceiveCursor, ReceiveStream } from "./contracts.js";
|
|
3
|
+
export type SendDelivery = "steer" | "followUp";
|
|
4
|
+
export interface ConnectPiFleetOptions {
|
|
5
|
+
readonly stateRoot?: string;
|
|
6
|
+
readonly applicationRoot?: string;
|
|
7
|
+
readonly autoStartRuntime?: boolean;
|
|
8
|
+
readonly signal?: AbortSignal;
|
|
9
|
+
}
|
|
10
|
+
export interface CreateAgentInput {
|
|
11
|
+
readonly name: string;
|
|
12
|
+
readonly cwd: string;
|
|
13
|
+
readonly piArgs?: readonly string[];
|
|
14
|
+
readonly instructions?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface SdkRequestOptions {
|
|
17
|
+
readonly signal?: AbortSignal;
|
|
18
|
+
}
|
|
19
|
+
export interface InputReceipt {
|
|
20
|
+
readonly acceptedAt: string;
|
|
21
|
+
}
|
|
22
|
+
export interface CompactionSummary {
|
|
23
|
+
readonly tokensBefore: number;
|
|
24
|
+
readonly estimatedTokensAfter?: number;
|
|
25
|
+
}
|
|
26
|
+
export type AgentReceiveOptions = {
|
|
27
|
+
readonly signal?: AbortSignal;
|
|
28
|
+
} & ({
|
|
29
|
+
readonly after?: never;
|
|
30
|
+
readonly fromStart?: false;
|
|
31
|
+
} | {
|
|
32
|
+
readonly after: ReceiveCursor;
|
|
33
|
+
readonly fromStart?: never;
|
|
34
|
+
} | {
|
|
35
|
+
readonly after?: never;
|
|
36
|
+
readonly fromStart: true;
|
|
37
|
+
});
|
|
38
|
+
export interface PiFleetClient {
|
|
39
|
+
create(input: CreateAgentInput, options?: SdkRequestOptions): Promise<Agent>;
|
|
40
|
+
get(name: string, options?: SdkRequestOptions): Promise<Agent>;
|
|
41
|
+
list(options?: SdkRequestOptions): Promise<readonly AgentSummary[]>;
|
|
42
|
+
close(): Promise<void>;
|
|
43
|
+
}
|
|
44
|
+
export interface Agent {
|
|
45
|
+
readonly id: AgentId;
|
|
46
|
+
readonly name: string;
|
|
47
|
+
status(options?: SdkRequestOptions): Promise<AgentSummary>;
|
|
48
|
+
send(message: string, options?: {
|
|
49
|
+
readonly delivery?: SendDelivery;
|
|
50
|
+
readonly signal?: AbortSignal;
|
|
51
|
+
}): Promise<InputReceipt>;
|
|
52
|
+
receive(options?: AgentReceiveOptions): Promise<ReceiveStream>;
|
|
53
|
+
compact(options?: SdkRequestOptions): Promise<CompactionSummary>;
|
|
54
|
+
destroy(options?: SdkRequestOptions): Promise<void>;
|
|
55
|
+
}
|
|
56
|
+
export interface SdkTransport {
|
|
57
|
+
create(input: CreateAgentInput, signal: AbortSignal): Promise<AgentSummary>;
|
|
58
|
+
get(name: string, signal: AbortSignal): Promise<AgentSummary | null>;
|
|
59
|
+
list(signal: AbortSignal): Promise<readonly AgentSummary[]>;
|
|
60
|
+
status(target: ExpectedAgentTarget, signal: AbortSignal): Promise<AgentSummary>;
|
|
61
|
+
send(target: ExpectedAgentTarget, message: string, delivery: SendDelivery, signal: AbortSignal): Promise<InputReceipt>;
|
|
62
|
+
receive(target: ExpectedAgentTarget, start: ReceiveStart, signal: AbortSignal, untilIdle?: boolean): Promise<ReceiveStream>;
|
|
63
|
+
compact(target: ExpectedAgentTarget, signal: AbortSignal): Promise<CompactionSummary>;
|
|
64
|
+
destroy(target: ExpectedAgentTarget, signal: AbortSignal): Promise<void>;
|
|
65
|
+
close(): Promise<void>;
|
|
66
|
+
}
|
|
67
|
+
export interface SdkConnector {
|
|
68
|
+
connect(options: ConnectPiFleetOptions): Promise<SdkTransport>;
|
|
69
|
+
}
|
|
70
|
+
export type ConnectPiFleet = (options?: ConnectPiFleetOptions) => Promise<PiFleetClient>;
|
|
71
|
+
/** Creates the public connector while keeping runtime discovery outside this inert module. */
|
|
72
|
+
export declare function createConnectPiFleet(connector: SdkConnector): ConnectPiFleet;
|
|
73
|
+
/** @internal Shared CLI/SDK construction seam; not exported by the public client entry. */
|
|
74
|
+
export declare function createPiFleetClient(transport: SdkTransport): PiFleetClient;
|
|
75
|
+
/** @internal CLI adapter; not exported from the public client entry. */
|
|
76
|
+
export declare function agentInitialStatus(agent: Agent): AgentSummary;
|
|
77
|
+
/** @internal CLI-only finite projection over the same continuous receive contract. */
|
|
78
|
+
export declare function receiveAgentUntilIdle(agent: Agent, options?: SdkRequestOptions): Promise<ReceiveStream>;
|
|
79
|
+
export declare class PiFleetError extends Error {
|
|
80
|
+
readonly code: PiFleetErrorCode;
|
|
81
|
+
readonly details?: Readonly<Record<string, unknown>> | undefined;
|
|
82
|
+
constructor(code: PiFleetErrorCode, message: string, details?: Readonly<Record<string, unknown>> | undefined);
|
|
83
|
+
static from(error: unknown): PiFleetError;
|
|
84
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { FleetClient, OperationIdentity } from "./fleet-client.js";
|
|
2
|
+
import type { ExpectedAgentTarget, ReceiveStart } from "./agent-target.js";
|
|
3
|
+
import { type CompactionSummary, type CreateAgentInput, type InputReceipt, type SdkTransport, type SendDelivery } from "./sdk-facade.js";
|
|
4
|
+
import { type AgentSummary, type ReceiveStream } from "./contracts.js";
|
|
5
|
+
export interface FleetClientSdkTransportOptions {
|
|
6
|
+
readonly reconnectDelayMs?: number;
|
|
7
|
+
readonly autoReconnect?: boolean;
|
|
8
|
+
}
|
|
9
|
+
/** Public-shape adapter over the private Result/wire-oriented client. */
|
|
10
|
+
export declare class FleetClientSdkTransport implements SdkTransport {
|
|
11
|
+
#private;
|
|
12
|
+
private readonly client;
|
|
13
|
+
private readonly operationIds;
|
|
14
|
+
constructor(client: FleetClient, operationIds: () => OperationIdentity, options?: FleetClientSdkTransportOptions);
|
|
15
|
+
create(input: CreateAgentInput, signal: AbortSignal): Promise<AgentSummary>;
|
|
16
|
+
get(name: string, signal: AbortSignal): Promise<AgentSummary | null>;
|
|
17
|
+
list(signal: AbortSignal): Promise<readonly AgentSummary[]>;
|
|
18
|
+
status(target: ExpectedAgentTarget, signal: AbortSignal): Promise<AgentSummary>;
|
|
19
|
+
send(target: ExpectedAgentTarget, message: string, delivery: SendDelivery, signal: AbortSignal): Promise<InputReceipt>;
|
|
20
|
+
receive(target: ExpectedAgentTarget, start: ReceiveStart, signal: AbortSignal, untilIdle?: boolean): Promise<ReceiveStream>;
|
|
21
|
+
compact(target: ExpectedAgentTarget, signal: AbortSignal): Promise<CompactionSummary>;
|
|
22
|
+
destroy(target: ExpectedAgentTarget, signal: AbortSignal): Promise<void>;
|
|
23
|
+
close(): Promise<void>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { FleetClient, OperationIdentity } from "./fleet-client.js";
|
|
2
|
+
export interface SharedClientConnectionOptions {
|
|
3
|
+
readonly stateRoot?: string;
|
|
4
|
+
readonly applicationRoot?: string;
|
|
5
|
+
readonly autoStartRuntime: boolean;
|
|
6
|
+
readonly env?: NodeJS.ProcessEnv;
|
|
7
|
+
}
|
|
8
|
+
export interface SharedClientConnection {
|
|
9
|
+
readonly client: FleetClient;
|
|
10
|
+
readonly operationIds: () => OperationIdentity;
|
|
11
|
+
readonly ensureControlPlane: () => Promise<void>;
|
|
12
|
+
readonly selectPiForMutation: () => Promise<unknown>;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Creates the common CLI/SDK private client graph without performing I/O.
|
|
16
|
+
* Runtime discovery and Pi selection remain lazy explicit operations.
|
|
17
|
+
*/
|
|
18
|
+
export declare function createSharedClientConnection(options: SharedClientConnectionOptions): SharedClientConnection;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type Socket } from "node:net";
|
|
2
|
+
import { type PiRuntimeIdentity } from "../protocol/pi-identity.js";
|
|
3
|
+
import { type Result } from "../shared/result.js";
|
|
4
|
+
import type { CompactInput, CompactResult, CreateInput, CreateResult, DestroyInput, DestroyResult, FleetClient, FleetClientError, ListResult, MutationOptions, ReceiveInput, ReceiveStreamItem, RequestOptions, SendInput, SendResult, StatusInput, StatusResult } from "./fleet-client.js";
|
|
5
|
+
export declare class SocketFleetClient implements FleetClient {
|
|
6
|
+
#private;
|
|
7
|
+
private readonly options;
|
|
8
|
+
constructor(options: {
|
|
9
|
+
readonly socketPath: string;
|
|
10
|
+
readonly beforeConnect?: () => Promise<void>;
|
|
11
|
+
readonly piIdentity?: PiRuntimeIdentity | (() => Promise<PiRuntimeIdentity>);
|
|
12
|
+
});
|
|
13
|
+
create(input: CreateInput, options: MutationOptions): Promise<Result<CreateResult, FleetClientError>>;
|
|
14
|
+
send(input: SendInput, options: MutationOptions): Promise<Result<SendResult, FleetClientError>>;
|
|
15
|
+
receive(input: ReceiveInput, options: RequestOptions): AsyncIterable<Result<ReceiveStreamItem, FleetClientError>>;
|
|
16
|
+
status(input: StatusInput, options: RequestOptions): Promise<Result<StatusResult, FleetClientError>>;
|
|
17
|
+
list(options: RequestOptions): Promise<Result<ListResult, FleetClientError>>;
|
|
18
|
+
destroy(input: DestroyInput, options: MutationOptions): Promise<Result<DestroyResult, FleetClientError>>;
|
|
19
|
+
compact(input: CompactInput, options: MutationOptions): Promise<Result<CompactResult, FleetClientError>>;
|
|
20
|
+
}
|
|
21
|
+
export declare function frameIterator(socket: Socket, signal: AbortSignal, maxQueuedBytes?: number): AsyncIterable<unknown>;
|