@github/copilot-sdk-linuxmusl-x64 1.0.14-preview.1 → 1.0.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.
@@ -1,7 +1,7 @@
1
1
  import type { FactoryGetRunProgressRequest, FactoryListRunsRequest, FactoryListRunsResult, FactoryProgressPage, FactoryRunDetail, FactoryRunResult, FactoryRunStatus, FactoryRunSummary } from "./generated/rpc.js";
2
2
  import type { ContextTier } from "./generated/session-events.js";
3
3
  import type { CopilotSession } from "./session.js";
4
- import type { FactoryLimits, FactoryMeta } from "./types.js";
4
+ import type { FactoryMeta } from "./types.js";
5
5
  export type { FactoryRunResult };
6
6
  export type { FactoryAgentSummary, FactoryPhaseStatus, FactoryPhaseObservation, FactoryProgressLine, FactoryProgressPage, FactoryRunDetail, FactoryRunStatus, FactoryRunSummary, } from "./generated/rpc.js";
7
7
  /**
@@ -81,6 +81,21 @@ export interface FactoryStepOptions {
81
81
  /** Skip the journal and always invoke the producer. */
82
82
  volatile?: boolean;
83
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
+ }
84
99
  /**
85
100
  * One stage in a per-item factory pipeline.
86
101
  *
@@ -101,6 +116,13 @@ export interface FactoryContext<TArgs extends JsonValue = JsonValue> {
101
116
  agent(prompt: string, options?: FactoryAgentOptions): Promise<unknown>;
102
117
  /** Memoize an arbitrary producer under a stable author-supplied key. */
103
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>;
104
126
  /**
105
127
  * Run thunks concurrently and await all of them.
106
128
  *
@@ -129,7 +151,7 @@ export interface FactoryContext<TArgs extends JsonValue = JsonValue> {
129
151
  args: TArgs;
130
152
  /**
131
153
  * The session instance returned by `joinSession`. It refuses calls that
132
- * start or resume a factory run.
154
+ * start, resume, or pause a factory run.
133
155
  */
134
156
  session: CopilotSession;
135
157
  /** Cooperative cancellation signal for the current factory run. */
@@ -178,7 +200,7 @@ export interface RunOptions<TArgs extends JsonValue = JsonValue> {
178
200
  /** Input surfaced as `context.args`. */
179
201
  args?: TArgs;
180
202
  /** Optional per-invocation resource ceiling overrides. */
181
- limits?: FactoryLimits;
203
+ limits?: FactoryLimitOverrides;
182
204
  /** Whether to notify the originating session when the factory completes. */
183
205
  notifyOnComplete?: boolean;
184
206
  /** Whether to emit factory phase names to the session transcript. */
@@ -198,7 +220,7 @@ export interface RunOptions<TArgs extends JsonValue = JsonValue> {
198
220
  */
199
221
  export interface ResumeOptions {
200
222
  /** Optional per-invocation resource ceiling overrides. */
201
- limits?: FactoryLimits;
223
+ limits?: FactoryLimitOverrides;
202
224
  /** Whether to notify the originating session when the factory completes. */
203
225
  notifyOnComplete?: boolean;
204
226
  /** Whether to emit factory phase names to the session transcript. */
@@ -222,13 +244,14 @@ export interface SessionFactoryApi {
222
244
  * Run a registered factory and resolve with its run envelope.
223
245
  *
224
246
  * 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.
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.
232
255
  */
233
256
  run(name: string, options?: RunOptions): Promise<FactoryRunResult>;
234
257
  run<TArgs extends JsonValue>(factory: FactoryHandle<TArgs, JsonValue | void>, options?: RunOptions<TArgs>): Promise<FactoryRunResult>;
@@ -243,12 +266,13 @@ export interface SessionFactoryApi {
243
266
  /** Read the latest durable envelope for a factory run. */
244
267
  getRun(runId: string): Promise<FactoryRunResult>;
245
268
  /**
246
- * Wait for a run to settle and resolve with its terminal envelope.
269
+ * Wait for the current attempt to settle and resolve with its envelope.
247
270
  *
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.
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}.
252
276
  *
253
277
  * This watches the run's `factory.run_updated` invalidation events and
254
278
  * periodically re-reads the durable envelope so a missed event cannot
@@ -279,6 +303,8 @@ export interface SessionFactoryApi {
279
303
  getRunDetail(runId: string): Promise<FactoryRunDetail>;
280
304
  /** Page durable progress forward, backward, or from the latest tail. */
281
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>;
282
308
  /** Cancel a factory run and return its terminal envelope. */
283
309
  cancel(runId: string): Promise<FactoryRunResult>;
284
310
  }
@@ -4,12 +4,16 @@ export declare class FfiRuntimeHost {
4
4
  private readonly cliEntrypoint;
5
5
  private readonly environment;
6
6
  private readonly args;
7
+ private static readonly quarantinedHosts;
7
8
  private readonly lib;
8
9
  private serverId;
9
10
  private connectionId;
10
11
  private disposed;
12
+ private starting;
11
13
  private outboundCallback;
12
14
  private keepAliveTimer;
15
+ private cleanupRetryTimer;
16
+ private cleanupInProgress;
13
17
  /** The stream JSON-RPC reads server→client frames from. */
14
18
  readonly receiveStream: PassThrough;
15
19
  /** The stream JSON-RPC writes client→server frames to. */
@@ -30,6 +34,8 @@ export declare class FfiRuntimeHost {
30
34
  */
31
35
  private feedInbound;
32
36
  private unregisterCallback;
33
- /** Closes the FFI connection, shuts down the native host, and releases resources. */
34
- dispose(): void;
37
+ private scheduleCleanupRetry;
38
+ private tryFinalizeCleanup;
39
+ /** Awaits the initial cleanup attempt; a non-quiescent close is retried in the background. */
40
+ dispose(): Promise<void>;
35
41
  }