@github/copilot-sdk-win32-x64 1.0.15-preview.3 → 1.0.15-preview.4

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.
@@ -1,327 +0,0 @@
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 { 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
- * Per-invocation factory resource ceiling overrides.
86
- *
87
- * An omitted field preserves the existing/default ceiling, a number replaces
88
- * it, and `null` explicitly makes that dimension unlimited.
89
- *
90
- * @experimental Part of the experimental Agent Factories surface and may
91
- * change or be removed in future SDK or CLI releases.
92
- */
93
- export interface FactoryLimitOverrides {
94
- maxConcurrentSubagents?: number | null;
95
- maxTotalSubagents?: number | null;
96
- maxAiCredits?: number | null;
97
- timeoutSeconds?: number | null;
98
- }
99
- /**
100
- * One stage in a per-item factory pipeline.
101
- *
102
- * @experimental Part of the experimental Agent Factories surface and may
103
- * change or be removed in future SDK or CLI releases.
104
- */
105
- export type FactoryPipelineStage<TInput = unknown, TResult = unknown> = (previous: TInput, item: unknown, index: number) => Promise<TResult> | TResult;
106
- /**
107
- * Context passed to an extension-authored factory body.
108
- *
109
- * @experimental Part of the experimental Agent Factories surface and may
110
- * change or be removed in future SDK or CLI releases.
111
- */
112
- export interface FactoryContext<TArgs extends JsonValue = JsonValue> {
113
- /** Stable identifier for the current factory run. */
114
- readonly runId: string;
115
- /** Spawn and await one factory-scoped subagent. */
116
- agent(prompt: string, options?: FactoryAgentOptions): Promise<unknown>;
117
- /** Memoize an arbitrary producer under a stable author-supplied key. */
118
- step(key: string, producer: () => Promise<JsonValue> | JsonValue, options?: FactoryStepOptions): Promise<JsonValue>;
119
- /**
120
- * Pause this run at a durable, one-shot checkpoint.
121
- *
122
- * The first attempt to reach a key pauses and aborts cooperatively. A
123
- * resumed attempt returns from the same key and continues.
124
- */
125
- pause(key: string): Promise<void>;
126
- /**
127
- * Run thunks concurrently and await all of them.
128
- *
129
- * A thunk that throws becomes `null` in the result array, so one failed
130
- * item does not lose the rest. Cancellation and hard runtime failures
131
- * (`ResponseError`, `ConnectionError`) are the exception: those propagate
132
- * and reject the whole call, because they mean the run itself is in
133
- * trouble rather than one item having failed.
134
- */
135
- parallel<TResult>(thunks: Array<() => Promise<TResult> | TResult>): Promise<Array<TResult | null>>;
136
- /**
137
- * Run each item through every stage without barriers between stages.
138
- *
139
- * A stage that throws drops that item to `null` and skips its remaining
140
- * stages. As with {@link FactoryContext.parallel}, cancellation and hard
141
- * runtime failures propagate instead of being recorded per item.
142
- */
143
- pipeline(items: unknown[], ...stages: FactoryPipelineStage[]): Promise<unknown[]>;
144
- /** Start a named factory progress phase. */
145
- phase(title: string): void;
146
- /** Emit a factory progress line. */
147
- log(message: string): void;
148
- /** Reject because nested factories are not supported. */
149
- factory(name: string, args?: JsonValue): Promise<JsonValue | void>;
150
- /** Caller-supplied input, forwarded verbatim. */
151
- args: TArgs;
152
- /**
153
- * The session instance returned by `joinSession`. It refuses calls that
154
- * start, resume, or pause a factory run.
155
- */
156
- session: CopilotSession;
157
- /** Cooperative cancellation signal for the current factory run. */
158
- signal: AbortSignal;
159
- }
160
- /**
161
- * Definition accepted by {@link defineFactory}.
162
- *
163
- * @experimental Part of the experimental Agent Factories surface and may
164
- * change or be removed in future SDK or CLI releases.
165
- */
166
- export interface FactoryDefinition<TArgs extends JsonValue = JsonValue, TResult extends JsonValue | void = JsonValue | void> {
167
- meta: FactoryMeta;
168
- run(context: FactoryContext<TArgs>): Promise<TResult>;
169
- }
170
- /**
171
- * A deeply immutable view of a value.
172
- *
173
- * `defineFactory` deep-freezes the metadata it stores, so the handle's view of
174
- * it has to be readonly all the way down or `handle.meta.name = "..."` and
175
- * `handle.meta.phases.push(...)` would compile and then throw at runtime.
176
- */
177
- type DeepReadonly<T> = T extends (infer U)[] ? readonly DeepReadonly<U>[] : T extends object ? {
178
- readonly [K in keyof T]: DeepReadonly<T[K]>;
179
- } : T;
180
- /**
181
- * Opaque reusable reference to a defined factory.
182
- *
183
- * @experimental Part of the experimental Agent Factories surface and may
184
- * change or be removed in future SDK or CLI releases.
185
- */
186
- export interface FactoryHandle<TArgs extends JsonValue = JsonValue, TResult extends JsonValue | void = JsonValue | void> {
187
- readonly meta: DeepReadonly<FactoryMeta>;
188
- readonly [factoryHandleBrand]: {
189
- readonly args: TArgs;
190
- readonly result: TResult;
191
- };
192
- }
193
- /**
194
- * Options for invoking a factory.
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 RunOptions<TArgs extends JsonValue = JsonValue> {
200
- /** Input surfaced as `context.args`. */
201
- args?: TArgs;
202
- /** Optional per-invocation resource ceiling overrides. */
203
- limits?: FactoryLimitOverrides;
204
- /** Whether to notify the originating session when the factory completes. */
205
- notifyOnComplete?: boolean;
206
- /** Whether to emit factory phase names to the session transcript. */
207
- logPhaseNames?: boolean;
208
- /**
209
- * Prior run whose persisted identity, arguments, journal, and accounting should be resumed.
210
- *
211
- * @deprecated Use {@link SessionFactoryApi.resume} instead.
212
- */
213
- resumeFromRunId?: string;
214
- }
215
- /**
216
- * Options for resuming a factory run by ID.
217
- *
218
- * @experimental Part of the experimental Agent Factories surface and may
219
- * change or be removed in future SDK or CLI releases.
220
- */
221
- export interface ResumeOptions {
222
- /** Optional per-invocation resource ceiling overrides. */
223
- limits?: FactoryLimitOverrides;
224
- /** Whether to notify the originating session when the factory completes. */
225
- notifyOnComplete?: boolean;
226
- /** Whether to emit factory phase names to the session transcript. */
227
- logPhaseNames?: boolean;
228
- }
229
- /**
230
- * Machine-readable pre-execution factory resume failure.
231
- *
232
- * @experimental Part of the experimental Agent Factories surface and may
233
- * change or be removed in future SDK or CLI releases.
234
- */
235
- export type FactoryResumeErrorCode = "not_found" | "non_resumable" | "already_active" | "factory_already_running" | "factory_limits_invalid" | "factory_session_disposed" | "factory_storage_unavailable" | "factory_storage_corrupt";
236
- /**
237
- * Friendly factory API exposed on a session.
238
- *
239
- * @experimental Part of the experimental Agent Factories surface and may
240
- * change or be removed in future SDK or CLI releases.
241
- */
242
- export interface SessionFactoryApi {
243
- /**
244
- * Run a registered factory and resolve with its run envelope.
245
- *
246
- * The envelope is returned for every outcome, including `error`, `halted`,
247
- * `paused`, and `cancelled` — inspect `status` and read `result` only when
248
- * the run completed. `paused` settles the current attempt, but the same
249
- * durable run can later resume under its existing run ID. SDK-initiated
250
- * runs do not request permission, so they have no declined outcome. The
251
- * model's `run_factory` tool requests permission before a durable row
252
- * exists; declining it creates no run row. Failures that occur before a run
253
- * exists (such as an unknown factory or attempting to start a run while the
254
- * session is at its active top-level run limit) still reject.
255
- */
256
- run(name: string, options?: RunOptions): Promise<FactoryRunResult>;
257
- run<TArgs extends JsonValue>(factory: FactoryHandle<TArgs, JsonValue | void>, options?: RunOptions<TArgs>): Promise<FactoryRunResult>;
258
- /**
259
- * Resume a run from its persisted factory name, arguments, journal, and accounting.
260
- *
261
- * Resolves with the run envelope like {@link SessionFactoryApi.run}.
262
- * SDK-initiated resumes do not request permission. A pre-execution failure
263
- * with a documented resume code rejects with {@link FactoryResumeError}.
264
- */
265
- resume(runId: string, options?: ResumeOptions): Promise<FactoryRunResult>;
266
- /** Read the latest durable envelope for a factory run. */
267
- getRun(runId: string): Promise<FactoryRunResult>;
268
- /**
269
- * Wait for the current attempt to settle and resolve with its envelope.
270
- *
271
- * Resolves as soon as the run reaches `completed`, `error`, `halted`,
272
- * `paused`, or `cancelled`, and resolves immediately when the current
273
- * attempt has already settled. A `paused` envelope is an attempt-level
274
- * snapshot: resuming the same durable run can later change the envelope
275
- * returned by {@link SessionFactoryApi.getRun}.
276
- *
277
- * This watches the run's `factory.run_updated` invalidation events and
278
- * periodically re-reads the durable envelope so a missed event cannot
279
- * leave the wait hanging. Pass a `signal` to stop waiting; aborting rejects
280
- * and has no effect on the run itself, which keeps executing. Use
281
- * {@link SessionFactoryApi.cancel} to actually stop it.
282
- */
283
- waitForRun(runId: string, options?: {
284
- signal?: AbortSignal;
285
- }): Promise<FactoryRunResult>;
286
- /**
287
- * List the newest default page of this session's durable factory runs.
288
- *
289
- * This backwards-compatible overload returns only the runs array. Pass
290
- * paging options to receive the full page, including its cursors and
291
- * truncation metadata.
292
- */
293
- listRuns(): Promise<FactoryRunSummary[]>;
294
- /**
295
- * Page this session's durable factory runs.
296
- *
297
- * `afterSeq` and `beforeSeq` are exclusive cursors. The result includes
298
- * `oldestSeq`, `newestSeq`, `hasMoreNewer`, and `omittedOlder` so callers
299
- * can continue paging without using the raw RPC client.
300
- */
301
- listRuns(options: FactoryListRunsOptions): Promise<FactoryRunsPage>;
302
- /** Read durable phases, direct agents, and the latest progress tail for a run. */
303
- getRunDetail(runId: string): Promise<FactoryRunDetail>;
304
- /** Page durable progress forward, backward, or from the latest tail. */
305
- getRunProgress(runId: string, options?: Omit<FactoryGetRunProgressRequest, "runId">): Promise<FactoryProgressPage>;
306
- /** Pause a running factory attempt and return its `paused` envelope. */
307
- pause(runId: string): Promise<FactoryRunResult>;
308
- /** Cancel a factory run and return its terminal envelope. */
309
- cancel(runId: string): Promise<FactoryRunResult>;
310
- }
311
- /**
312
- * Error thrown when a factory cannot be resumed before execution begins.
313
- *
314
- * @experimental Part of the experimental Agent Factories surface and may
315
- * change or be removed in future SDK or CLI releases.
316
- */
317
- export declare class FactoryResumeError extends Error {
318
- readonly code: FactoryResumeErrorCode;
319
- constructor(code: FactoryResumeErrorCode, message: string);
320
- }
321
- /**
322
- * Defines an extension-authored factory and returns an opaque registration handle.
323
- *
324
- * @experimental Part of the experimental Agent Factories surface and may
325
- * change or be removed in future SDK or CLI releases.
326
- */
327
- export declare function defineFactory<TArgs extends JsonValue = JsonValue, TResult extends JsonValue | void = JsonValue | void>(definition: FactoryDefinition<TArgs, TResult>): FactoryHandle<TArgs, TResult>;
Binary file