@github/copilot-sdk-darwin-x64 0.0.1 → 1.0.13-preview.6
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/animations/app-install-nudge.json.gz +0 -0
- package/animations/banner.json.gz +0 -0
- package/builtin/customize-cloud-agent/SKILL.md +254 -0
- package/builtin/discover-resources/SKILL.md +35 -0
- package/builtin/github-pr-media/SKILL.md +108 -0
- package/builtin-skills/customize-cloud-agent/SKILL.md +254 -0
- package/builtin-skills/discover-resources/SKILL.md +35 -0
- package/builtin-skills/github-pr-media/SKILL.md +108 -0
- package/copilot-sdk/canvas.d.ts +126 -0
- package/copilot-sdk/client.d.ts +478 -0
- package/copilot-sdk/copilotRequestHandler.d.ts +85 -0
- package/copilot-sdk/docs/agent-author.md +295 -0
- package/copilot-sdk/docs/examples.md +682 -0
- package/copilot-sdk/docs/extensions.md +81 -0
- package/copilot-sdk/docs/factories.md +279 -0
- package/copilot-sdk/docs/factory-patterns.md +194 -0
- package/copilot-sdk/extension.d.ts +59 -0
- package/copilot-sdk/extension.js +11399 -0
- package/copilot-sdk/factory.d.ts +301 -0
- package/copilot-sdk/ffiRuntimeHost.d.ts +35 -0
- package/copilot-sdk/generated/rpc.d.ts +24623 -0
- package/copilot-sdk/generated/session-events.d.ts +11117 -0
- package/copilot-sdk/index.d.ts +15 -0
- package/copilot-sdk/index.js +11540 -0
- package/copilot-sdk/runtimeArtifacts.d.ts +6 -0
- package/copilot-sdk/sdkProtocolVersion.d.ts +10 -0
- package/copilot-sdk/session.d.ts +331 -0
- package/copilot-sdk/sessionFsProvider.d.ts +107 -0
- package/copilot-sdk/telemetry.d.ts +14 -0
- package/copilot-sdk/toolSet.d.ts +75 -0
- package/copilot-sdk/types.d.ts +2974 -0
- package/definitions/code-review.agent.yaml +94 -0
- package/definitions/explore.agent.yaml +75 -0
- package/definitions/rem-agent.agent.yaml +22 -0
- package/definitions/research.agent.yaml +111 -0
- package/definitions/rubber-duck.agent.yaml +67 -0
- package/definitions/security-review.agent.yaml +261 -0
- package/definitions/sidekick/cloud-session-search.yaml +37 -0
- package/definitions/sidekick/github-context-memory.yaml +46 -0
- package/definitions/sidekick/github-context.yaml +44 -0
- package/definitions/sidekick/session-search.yaml +37 -0
- package/definitions/sidekick/subconscious-agent.yaml +60 -0
- package/definitions/sidekick/test-sidekick-context-changed.yaml +24 -0
- package/definitions/sidekick/test-sidekick-persistent.yaml +23 -0
- package/definitions/sidekick/test-sidekick-restart.yaml +23 -0
- package/definitions/sidekick/test-sidekick-trigger-once.yaml +22 -0
- package/definitions/task.agent.yaml +44 -0
- package/package.json +14 -11
- package/plugins/computer-use/.mcp.json +10 -0
- package/plugins/computer-use/.plugin/plugin.json +6 -0
- package/plugins/computer-use/.release-target +1 -0
- package/plugins/computer-use/Copilot Computer Use.app/Contents/CodeResources +0 -0
- package/plugins/computer-use/Copilot Computer Use.app/Contents/Info.plist +38 -0
- package/plugins/computer-use/Copilot Computer Use.app/Contents/MacOS/Copilot Computer Use +0 -0
- package/plugins/computer-use/Copilot Computer Use.app/Contents/PkgInfo +1 -0
- package/plugins/computer-use/Copilot Computer Use.app/Contents/Resources/Assets.car +0 -0
- package/plugins/computer-use/Copilot Computer Use.app/Contents/Resources/icon.icns +0 -0
- package/plugins/computer-use/Copilot Computer Use.app/Contents/_CodeSignature/CodeResources +139 -0
- package/plugins/computer-use/computer-use-mcp +0 -0
- package/prebuilds/darwin-x64/copilot-runtime +0 -0
- package/prebuilds/darwin-x64/runtime.node +0 -0
- package/preloads/extension_bootstrap.mjs +68 -0
- package/preloads/extension_sdk_resolver.mjs +34 -0
- package/ripgrep/bin/darwin-arm64/rg +0 -0
- package/ripgrep/bin/darwin-x64/rg +0 -0
- package/schemas/api.schema.json +41931 -0
- package/schemas/session-events.schema.json +20937 -0
- package/sdk/index.js +1489 -0
- package/tgrep/bin/darwin-arm64/tgrep +0 -0
- package/tgrep/bin/darwin-x64/tgrep +0 -0
- package/README.md +0 -3
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
import type { FactoryGetRunProgressRequest, FactoryListRunsRequest, FactoryListRunsResult, FactoryProgressPage, FactoryRunDetail, FactoryRunResult, FactoryRunStatus, FactoryRunSummary } from "./generated/rpc.js";
|
|
2
|
+
import type { ContextTier } from "./generated/session-events.js";
|
|
3
|
+
import type { CopilotSession } from "./session.js";
|
|
4
|
+
import type { FactoryLimits, FactoryMeta } from "./types.js";
|
|
5
|
+
export type { FactoryRunResult };
|
|
6
|
+
export type { FactoryAgentSummary, FactoryPhaseStatus, FactoryPhaseObservation, FactoryProgressLine, FactoryProgressPage, FactoryRunDetail, FactoryRunStatus, FactoryRunSummary, } from "./generated/rpc.js";
|
|
7
|
+
/**
|
|
8
|
+
* Options for paging durable factory runs.
|
|
9
|
+
*
|
|
10
|
+
* @experimental Part of the experimental Agent Factories surface and may
|
|
11
|
+
* change or be removed in future SDK or CLI releases.
|
|
12
|
+
*/
|
|
13
|
+
export type FactoryListRunsOptions = FactoryListRunsRequest;
|
|
14
|
+
/**
|
|
15
|
+
* A page of durable factory runs and its paging metadata.
|
|
16
|
+
*
|
|
17
|
+
* @experimental Part of the experimental Agent Factories surface and may
|
|
18
|
+
* change or be removed in future SDK or CLI releases.
|
|
19
|
+
*/
|
|
20
|
+
export type FactoryRunsPage = FactoryListRunsResult;
|
|
21
|
+
/**
|
|
22
|
+
* Whether a factory run status is terminal.
|
|
23
|
+
*
|
|
24
|
+
* @experimental Part of the experimental Agent Factories surface and may
|
|
25
|
+
* change or be removed in future SDK or CLI releases.
|
|
26
|
+
*/
|
|
27
|
+
export declare function isFactoryRunTerminal(status: FactoryRunStatus): boolean;
|
|
28
|
+
declare const factoryHandleBrand: unique symbol;
|
|
29
|
+
/** A value that can be represented losslessly on the SDK JSON wire. */
|
|
30
|
+
export type JsonValue = null | boolean | number | string | JsonValue[] | {
|
|
31
|
+
[key: string]: JsonValue;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Conservative JSON shape language accepted by the Agent Factories surface, for
|
|
35
|
+
* both structured factory agent output and a factory's declared `argsSchema`.
|
|
36
|
+
*
|
|
37
|
+
* This is a best-effort structural guard — used to decide whether a subagent's
|
|
38
|
+
* structured output should be accepted or retried, and whether a caller's
|
|
39
|
+
* factory `args` match the declared shape — **not** a full JSON Schema
|
|
40
|
+
* validator. Only these keywords are honored: `type`, `required`, `enum`,
|
|
41
|
+
* `const`, recursive `properties`/`items`, and `anyOf`/`oneOf`/`allOf`. A `type`
|
|
42
|
+
* is one of `null`, `boolean`, `integer`, `number`, `string`, `array`, or
|
|
43
|
+
* `object`, or a non-empty array of those (for example `["object", "null"]`).
|
|
44
|
+
*
|
|
45
|
+
* Everything else is **ignored, not enforced**. In particular, string
|
|
46
|
+
* constraints (`pattern`, `minLength`, `maxLength`, `format`), numeric ranges
|
|
47
|
+
* (`minimum`, `maximum`), `additionalProperties`, and boolean (`true`/`false`)
|
|
48
|
+
* schemas do not reject non-conforming output. `oneOf` is treated like `anyOf`
|
|
49
|
+
* (at least one branch must match) rather than strict exactly-one. Author
|
|
50
|
+
* schemas within this subset; do not rely on unsupported constraints for
|
|
51
|
+
* correctness.
|
|
52
|
+
*
|
|
53
|
+
* @experimental Part of the experimental Agent Factories surface and may
|
|
54
|
+
* change or be removed in future SDK or CLI releases.
|
|
55
|
+
*/
|
|
56
|
+
export type FactoryJsonSchema = {
|
|
57
|
+
[key: string]: JsonValue;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Options for one factory-scoped subagent call.
|
|
61
|
+
*
|
|
62
|
+
* @experimental Part of the experimental Agent Factories surface and may
|
|
63
|
+
* change or be removed in future SDK or CLI releases.
|
|
64
|
+
*/
|
|
65
|
+
export interface FactoryAgentOptions {
|
|
66
|
+
label?: string;
|
|
67
|
+
schema?: FactoryJsonSchema;
|
|
68
|
+
model?: string;
|
|
69
|
+
reasoningEffort?: string;
|
|
70
|
+
contextTier?: ContextTier;
|
|
71
|
+
agent?: string;
|
|
72
|
+
}
|
|
73
|
+
export declare const FACTORY_AGENT_OPTION_KEYS: readonly ["label", "schema", "model", "reasoningEffort", "contextTier", "agent"];
|
|
74
|
+
/**
|
|
75
|
+
* Options for a durable factory step.
|
|
76
|
+
*
|
|
77
|
+
* @experimental Part of the experimental Agent Factories surface and may
|
|
78
|
+
* change or be removed in future SDK or CLI releases.
|
|
79
|
+
*/
|
|
80
|
+
export interface FactoryStepOptions {
|
|
81
|
+
/** Skip the journal and always invoke the producer. */
|
|
82
|
+
volatile?: boolean;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* One stage in a per-item factory pipeline.
|
|
86
|
+
*
|
|
87
|
+
* @experimental Part of the experimental Agent Factories surface and may
|
|
88
|
+
* change or be removed in future SDK or CLI releases.
|
|
89
|
+
*/
|
|
90
|
+
export type FactoryPipelineStage<TInput = unknown, TResult = unknown> = (previous: TInput, item: unknown, index: number) => Promise<TResult> | TResult;
|
|
91
|
+
/**
|
|
92
|
+
* Context passed to an extension-authored factory body.
|
|
93
|
+
*
|
|
94
|
+
* @experimental Part of the experimental Agent Factories surface and may
|
|
95
|
+
* change or be removed in future SDK or CLI releases.
|
|
96
|
+
*/
|
|
97
|
+
export interface FactoryContext<TArgs extends JsonValue = JsonValue> {
|
|
98
|
+
/** Stable identifier for the current factory run. */
|
|
99
|
+
readonly runId: string;
|
|
100
|
+
/** Spawn and await one factory-scoped subagent. */
|
|
101
|
+
agent(prompt: string, options?: FactoryAgentOptions): Promise<unknown>;
|
|
102
|
+
/** Memoize an arbitrary producer under a stable author-supplied key. */
|
|
103
|
+
step(key: string, producer: () => Promise<JsonValue> | JsonValue, options?: FactoryStepOptions): Promise<JsonValue>;
|
|
104
|
+
/**
|
|
105
|
+
* Run thunks concurrently and await all of them.
|
|
106
|
+
*
|
|
107
|
+
* A thunk that throws becomes `null` in the result array, so one failed
|
|
108
|
+
* item does not lose the rest. Cancellation and hard runtime failures
|
|
109
|
+
* (`ResponseError`, `ConnectionError`) are the exception: those propagate
|
|
110
|
+
* and reject the whole call, because they mean the run itself is in
|
|
111
|
+
* trouble rather than one item having failed.
|
|
112
|
+
*/
|
|
113
|
+
parallel<TResult>(thunks: Array<() => Promise<TResult> | TResult>): Promise<Array<TResult | null>>;
|
|
114
|
+
/**
|
|
115
|
+
* Run each item through every stage without barriers between stages.
|
|
116
|
+
*
|
|
117
|
+
* A stage that throws drops that item to `null` and skips its remaining
|
|
118
|
+
* stages. As with {@link FactoryContext.parallel}, cancellation and hard
|
|
119
|
+
* runtime failures propagate instead of being recorded per item.
|
|
120
|
+
*/
|
|
121
|
+
pipeline(items: unknown[], ...stages: FactoryPipelineStage[]): Promise<unknown[]>;
|
|
122
|
+
/** Start a named factory progress phase. */
|
|
123
|
+
phase(title: string): void;
|
|
124
|
+
/** Emit a factory progress line. */
|
|
125
|
+
log(message: string): void;
|
|
126
|
+
/** Reject because nested factories are not supported. */
|
|
127
|
+
factory(name: string, args?: JsonValue): Promise<JsonValue | void>;
|
|
128
|
+
/** Caller-supplied input, forwarded verbatim. */
|
|
129
|
+
args: TArgs;
|
|
130
|
+
/**
|
|
131
|
+
* The session instance returned by `joinSession`. It refuses calls that
|
|
132
|
+
* start or resume a factory run.
|
|
133
|
+
*/
|
|
134
|
+
session: CopilotSession;
|
|
135
|
+
/** Cooperative cancellation signal for the current factory run. */
|
|
136
|
+
signal: AbortSignal;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Definition accepted by {@link defineFactory}.
|
|
140
|
+
*
|
|
141
|
+
* @experimental Part of the experimental Agent Factories surface and may
|
|
142
|
+
* change or be removed in future SDK or CLI releases.
|
|
143
|
+
*/
|
|
144
|
+
export interface FactoryDefinition<TArgs extends JsonValue = JsonValue, TResult extends JsonValue | void = JsonValue | void> {
|
|
145
|
+
meta: FactoryMeta;
|
|
146
|
+
run(context: FactoryContext<TArgs>): Promise<TResult>;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* A deeply immutable view of a value.
|
|
150
|
+
*
|
|
151
|
+
* `defineFactory` deep-freezes the metadata it stores, so the handle's view of
|
|
152
|
+
* it has to be readonly all the way down or `handle.meta.name = "..."` and
|
|
153
|
+
* `handle.meta.phases.push(...)` would compile and then throw at runtime.
|
|
154
|
+
*/
|
|
155
|
+
type DeepReadonly<T> = T extends (infer U)[] ? readonly DeepReadonly<U>[] : T extends object ? {
|
|
156
|
+
readonly [K in keyof T]: DeepReadonly<T[K]>;
|
|
157
|
+
} : T;
|
|
158
|
+
/**
|
|
159
|
+
* Opaque reusable reference to a defined factory.
|
|
160
|
+
*
|
|
161
|
+
* @experimental Part of the experimental Agent Factories surface and may
|
|
162
|
+
* change or be removed in future SDK or CLI releases.
|
|
163
|
+
*/
|
|
164
|
+
export interface FactoryHandle<TArgs extends JsonValue = JsonValue, TResult extends JsonValue | void = JsonValue | void> {
|
|
165
|
+
readonly meta: DeepReadonly<FactoryMeta>;
|
|
166
|
+
readonly [factoryHandleBrand]: {
|
|
167
|
+
readonly args: TArgs;
|
|
168
|
+
readonly result: TResult;
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Options for invoking a factory.
|
|
173
|
+
*
|
|
174
|
+
* @experimental Part of the experimental Agent Factories surface and may
|
|
175
|
+
* change or be removed in future SDK or CLI releases.
|
|
176
|
+
*/
|
|
177
|
+
export interface RunOptions<TArgs extends JsonValue = JsonValue> {
|
|
178
|
+
/** Input surfaced as `context.args`. */
|
|
179
|
+
args?: TArgs;
|
|
180
|
+
/** Optional per-invocation resource ceiling overrides. */
|
|
181
|
+
limits?: FactoryLimits;
|
|
182
|
+
/** Whether to notify the originating session when the factory completes. */
|
|
183
|
+
notifyOnComplete?: boolean;
|
|
184
|
+
/** Whether to emit factory phase names to the session transcript. */
|
|
185
|
+
logPhaseNames?: boolean;
|
|
186
|
+
/**
|
|
187
|
+
* Prior run whose persisted identity, arguments, journal, and accounting should be resumed.
|
|
188
|
+
*
|
|
189
|
+
* @deprecated Use {@link SessionFactoryApi.resume} instead.
|
|
190
|
+
*/
|
|
191
|
+
resumeFromRunId?: string;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Options for resuming a factory run by ID.
|
|
195
|
+
*
|
|
196
|
+
* @experimental Part of the experimental Agent Factories surface and may
|
|
197
|
+
* change or be removed in future SDK or CLI releases.
|
|
198
|
+
*/
|
|
199
|
+
export interface ResumeOptions {
|
|
200
|
+
/** Optional per-invocation resource ceiling overrides. */
|
|
201
|
+
limits?: FactoryLimits;
|
|
202
|
+
/** Whether to notify the originating session when the factory completes. */
|
|
203
|
+
notifyOnComplete?: boolean;
|
|
204
|
+
/** Whether to emit factory phase names to the session transcript. */
|
|
205
|
+
logPhaseNames?: boolean;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Machine-readable pre-execution factory resume failure.
|
|
209
|
+
*
|
|
210
|
+
* @experimental Part of the experimental Agent Factories surface and may
|
|
211
|
+
* change or be removed in future SDK or CLI releases.
|
|
212
|
+
*/
|
|
213
|
+
export type FactoryResumeErrorCode = "not_found" | "non_resumable" | "already_active" | "factory_already_running" | "factory_limits_invalid" | "factory_session_disposed" | "factory_storage_unavailable" | "factory_storage_corrupt";
|
|
214
|
+
/**
|
|
215
|
+
* Friendly factory API exposed on a session.
|
|
216
|
+
*
|
|
217
|
+
* @experimental Part of the experimental Agent Factories surface and may
|
|
218
|
+
* change or be removed in future SDK or CLI releases.
|
|
219
|
+
*/
|
|
220
|
+
export interface SessionFactoryApi {
|
|
221
|
+
/**
|
|
222
|
+
* Run a registered factory and resolve with its run envelope.
|
|
223
|
+
*
|
|
224
|
+
* The envelope is returned for every outcome, including `error`, `halted`,
|
|
225
|
+
* and `cancelled` — inspect `status` and read `result` only when the run
|
|
226
|
+
* completed. SDK-initiated runs do not request permission, so they have no
|
|
227
|
+
* declined outcome. The model's `run_factory` tool requests permission
|
|
228
|
+
* before a durable row exists; declining it creates no run row. Failures
|
|
229
|
+
* that occur before a run exists (such as an unknown factory or attempting
|
|
230
|
+
* to start a run while the session is at its active top-level run limit)
|
|
231
|
+
* still reject.
|
|
232
|
+
*/
|
|
233
|
+
run(name: string, options?: RunOptions): Promise<FactoryRunResult>;
|
|
234
|
+
run<TArgs extends JsonValue>(factory: FactoryHandle<TArgs, JsonValue | void>, options?: RunOptions<TArgs>): Promise<FactoryRunResult>;
|
|
235
|
+
/**
|
|
236
|
+
* Resume a run from its persisted factory name, arguments, journal, and accounting.
|
|
237
|
+
*
|
|
238
|
+
* Resolves with the run envelope like {@link SessionFactoryApi.run}.
|
|
239
|
+
* SDK-initiated resumes do not request permission. A pre-execution failure
|
|
240
|
+
* with a documented resume code rejects with {@link FactoryResumeError}.
|
|
241
|
+
*/
|
|
242
|
+
resume(runId: string, options?: ResumeOptions): Promise<FactoryRunResult>;
|
|
243
|
+
/** Read the latest durable envelope for a factory run. */
|
|
244
|
+
getRun(runId: string): Promise<FactoryRunResult>;
|
|
245
|
+
/**
|
|
246
|
+
* Wait for a run to settle and resolve with its terminal envelope.
|
|
247
|
+
*
|
|
248
|
+
* Resolves as soon as the run reaches `completed`, `error`, `halted`, or
|
|
249
|
+
* `cancelled`, and resolves immediately when it has already settled. A
|
|
250
|
+
* terminal envelope is final, so the resolved value never changes
|
|
251
|
+
* afterwards.
|
|
252
|
+
*
|
|
253
|
+
* This watches the run's `factory.run_updated` invalidation events and
|
|
254
|
+
* periodically re-reads the durable envelope so a missed event cannot
|
|
255
|
+
* leave the wait hanging. Pass a `signal` to stop waiting; aborting rejects
|
|
256
|
+
* and has no effect on the run itself, which keeps executing. Use
|
|
257
|
+
* {@link SessionFactoryApi.cancel} to actually stop it.
|
|
258
|
+
*/
|
|
259
|
+
waitForRun(runId: string, options?: {
|
|
260
|
+
signal?: AbortSignal;
|
|
261
|
+
}): Promise<FactoryRunResult>;
|
|
262
|
+
/**
|
|
263
|
+
* List the newest default page of this session's durable factory runs.
|
|
264
|
+
*
|
|
265
|
+
* This backwards-compatible overload returns only the runs array. Pass
|
|
266
|
+
* paging options to receive the full page, including its cursors and
|
|
267
|
+
* truncation metadata.
|
|
268
|
+
*/
|
|
269
|
+
listRuns(): Promise<FactoryRunSummary[]>;
|
|
270
|
+
/**
|
|
271
|
+
* Page this session's durable factory runs.
|
|
272
|
+
*
|
|
273
|
+
* `afterSeq` and `beforeSeq` are exclusive cursors. The result includes
|
|
274
|
+
* `oldestSeq`, `newestSeq`, `hasMoreNewer`, and `omittedOlder` so callers
|
|
275
|
+
* can continue paging without using the raw RPC client.
|
|
276
|
+
*/
|
|
277
|
+
listRuns(options: FactoryListRunsOptions): Promise<FactoryRunsPage>;
|
|
278
|
+
/** Read durable phases, direct agents, and the latest progress tail for a run. */
|
|
279
|
+
getRunDetail(runId: string): Promise<FactoryRunDetail>;
|
|
280
|
+
/** Page durable progress forward, backward, or from the latest tail. */
|
|
281
|
+
getRunProgress(runId: string, options?: Omit<FactoryGetRunProgressRequest, "runId">): Promise<FactoryProgressPage>;
|
|
282
|
+
/** Cancel a factory run and return its terminal envelope. */
|
|
283
|
+
cancel(runId: string): Promise<FactoryRunResult>;
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Error thrown when a factory cannot be resumed before execution begins.
|
|
287
|
+
*
|
|
288
|
+
* @experimental Part of the experimental Agent Factories surface and may
|
|
289
|
+
* change or be removed in future SDK or CLI releases.
|
|
290
|
+
*/
|
|
291
|
+
export declare class FactoryResumeError extends Error {
|
|
292
|
+
readonly code: FactoryResumeErrorCode;
|
|
293
|
+
constructor(code: FactoryResumeErrorCode, message: string);
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Defines an extension-authored factory and returns an opaque registration handle.
|
|
297
|
+
*
|
|
298
|
+
* @experimental Part of the experimental Agent Factories surface and may
|
|
299
|
+
* change or be removed in future SDK or CLI releases.
|
|
300
|
+
*/
|
|
301
|
+
export declare function defineFactory<TArgs extends JsonValue = JsonValue, TResult extends JsonValue | void = JsonValue | void>(definition: FactoryDefinition<TArgs, TResult>): FactoryHandle<TArgs, TResult>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { PassThrough, Writable } from "node:stream";
|
|
2
|
+
export declare class FfiRuntimeHost {
|
|
3
|
+
private readonly libraryPath;
|
|
4
|
+
private readonly cliEntrypoint;
|
|
5
|
+
private readonly environment;
|
|
6
|
+
private readonly args;
|
|
7
|
+
private readonly lib;
|
|
8
|
+
private serverId;
|
|
9
|
+
private connectionId;
|
|
10
|
+
private disposed;
|
|
11
|
+
private outboundCallback;
|
|
12
|
+
private keepAliveTimer;
|
|
13
|
+
/** The stream JSON-RPC reads server→client frames from. */
|
|
14
|
+
readonly receiveStream: PassThrough;
|
|
15
|
+
/** The stream JSON-RPC writes client→server frames to. */
|
|
16
|
+
readonly sendStream: Writable;
|
|
17
|
+
private constructor();
|
|
18
|
+
/**
|
|
19
|
+
* Loads the runtime cdylib at the given path and prepares the FFI host.
|
|
20
|
+
*/
|
|
21
|
+
static create(libraryPath: string, cliEntrypoint: string | undefined, environment: Record<string, string | undefined> | undefined, args: readonly string[]): FfiRuntimeHost;
|
|
22
|
+
/** Starts the in-process Rust runtime and opens the FFI JSON-RPC connection. */
|
|
23
|
+
start(): Promise<void>;
|
|
24
|
+
private writeFrame;
|
|
25
|
+
/**
|
|
26
|
+
* Native outbound (server→client) callback. koffi delivers it on the JS event loop
|
|
27
|
+
* via a threadsafe function, so the frame is decoded and written straight to
|
|
28
|
+
* {@link receiveStream}. The native pointer is only valid for this call, so the
|
|
29
|
+
* bytes are copied out before returning.
|
|
30
|
+
*/
|
|
31
|
+
private feedInbound;
|
|
32
|
+
private unregisterCallback;
|
|
33
|
+
/** Closes the FFI connection, shuts down the native host, and releases resources. */
|
|
34
|
+
dispose(): void;
|
|
35
|
+
}
|