@github/copilot-sdk 1.0.11 → 1.0.12-unstable.0

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/dist/session.js CHANGED
@@ -1156,7 +1156,13 @@ class CopilotSession {
1156
1156
  }
1157
1157
  try {
1158
1158
  const result = await this.elicitationHandler(context);
1159
- await this.rpc.ui.handlePendingElicitation({ requestId, result });
1159
+ await this.rpc.ui.handlePendingElicitation({
1160
+ requestId,
1161
+ result: {
1162
+ action: result.action,
1163
+ ...result.content ? { content: result.content } : {}
1164
+ }
1165
+ });
1160
1166
  } catch {
1161
1167
  try {
1162
1168
  await this.rpc.ui.handlePendingElicitation({
@@ -53,6 +53,27 @@ const session = await joinSession({
53
53
 
54
54
  The `session` object provides methods for sending messages, logging to the timeline, listening to events, and accessing the RPC API. See the `.d.ts` files in the SDK package for full type information.
55
55
 
56
+ ## Requesting Sensitive Environment Variables
57
+
58
+ The CLI strips sensitive environment variables (for example `GITHUB_TOKEN`) from every extension process before it starts. An extension that needs one asks for it by name:
59
+
60
+ ```js
61
+ import { joinSession } from "@github/copilot-sdk/extension";
62
+
63
+ const session = await joinSession({
64
+ requestedEnvironmentVariables: ["GITHUB_TOKEN"],
65
+ });
66
+
67
+ // Granted values are in process.env once joinSession resolves.
68
+ const token = process.env.GITHUB_TOKEN;
69
+ ```
70
+
71
+ The CLI prompts the user with the extension's name and the exact list of variables requested. If the user approves, only those variables reach this extension and their values are written into `process.env` before `joinSession()` resolves. If the user denies, `joinSession()` rejects, the extension does not load, and its tools never reach the model.
72
+
73
+ An approval is remembered against the exact set of names the user saw, so an extension that later asks for an additional variable prompts again. Names that are unset, or that the CLI does not filter from extensions, are not prompted for.
74
+
75
+ An approved extension can pass a granted value to anything it starts, so ask only for what the extension genuinely needs.
76
+
56
77
  ## Further Reading
57
78
 
58
79
  - `examples.md` — Practical code examples for tools, hooks, events, and complete extensions
package/docs/factories.md CHANGED
@@ -23,12 +23,6 @@ const reviewChanged = defineFactory({
23
23
  files: { type: "array", items: { type: "string" } },
24
24
  },
25
25
  },
26
- limits: {
27
- maxConcurrentSubagents: 3,
28
- maxTotalSubagents: 10,
29
- timeoutSeconds: 90.5,
30
- maxAiCredits: 5,
31
- },
32
26
  },
33
27
  run: async (ctx) => {
34
28
  ctx.phase("Review");
@@ -121,7 +115,14 @@ See [factory-patterns.md](./factory-patterns.md) for composable orchestration pa
121
115
 
122
116
  ## Resource limits
123
117
 
124
- Limits may be declared in `meta.limits` and overridden per invocation. All limits must be positive when present.
118
+ Limits may be declared in `meta.limits` and overridden per invocation. Every limit is optional and must be positive when present; an omitted limit leaves that dimension unbounded, except that an omitted `maxConcurrentSubagents` falls back to `maxTotalSubagents`, so a declared total cap also bounds concurrency.
119
+
120
+ Set a ceiling only from real knowledge of what the factory costs, or because the user named one. A guessed ceiling does not make a run safer: it stops a healthy run partway with `factory_limit_reached`, after that run has already spent credits. An agent authoring or invoking a factory on the user's behalf has no basis for estimating a number, so it should leave `limits` unset and bound the work with the factory's own counters instead. Omitting limits does not remove oversight of a model-initiated run: `run_factory` requests permission first, and that prompt shows the effective limits. SDK-initiated `run` and `resume` do not request permission, so an SDK caller that wants a ceiling sets it deliberately, from the cost it already knows.
121
+
122
+ ```js
123
+ // Only when the cost profile is known, or the user asked for this ceiling.
124
+ limits: { maxTotalSubagents: 10 },
125
+ ```
125
126
 
126
127
  - `maxConcurrentSubagents`: Positive integer concurrent-subagent cap. Additional subagents wait in a queue. Queueing applies backpressure and does not fail the run.
127
128
  - `maxTotalSubagents`: Positive integer cumulative admission cap. An attempted subagent beyond the cap ends the attempt with failure kind `maxTotalSubagents`.
@@ -189,6 +189,6 @@ Compose these freely.
189
189
 
190
190
  Match the orchestration to what was asked. A quick check wants a couple of subagents and single-vote verification; a request to be thorough or comprehensive wants a larger finder pool, a three-to-five vote adversarial pass, and a synthesis stage.
191
191
 
192
- There is no in-script budget object. Scale with your own counters, as in the loop patterns above, and treat the declared limits as the safety ceiling rather than the control mechanism. Only `agent()` spawns are throttled, by `maxConcurrentSubagents` falling back to `maxTotalSubagents`; with neither declared there is no built-in concurrency cap, so declare one before fanning out widely. `parallel` itself is `Promise.all`, so non-agent work in a thunk runs fully concurrently regardless.
192
+ There is no in-script budget object. Scale with your own counters, as in the loop patterns above, and treat any declared limits as the safety ceiling rather than the control mechanism. Only `agent()` spawns are throttled, by `maxConcurrentSubagents` falling back to `maxTotalSubagents`; with neither declared there is no built-in concurrency cap, so bound a wide fan-out with the factory's own counters. Do not invent a ceiling to compensate, and see [Resource limits](./factories.md#resource-limits) for when declaring one is appropriate. `parallel` itself is `Promise.all`, so non-agent work in a thunk runs fully concurrently regardless.
193
193
 
194
194
  These patterns are not exhaustive. Compose novel harnesses — tournament brackets, self-repair loops, staged escalation — when the task calls for it.
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "type": "git",
5
5
  "url": "https://github.com/github/copilot-sdk.git"
6
6
  },
7
- "version": "1.0.11",
7
+ "version": "1.0.12-unstable.0",
8
8
  "description": "TypeScript SDK for programmatic control of GitHub Copilot CLI via JSON-RPC",
9
9
  "main": "./dist/cjs/index.js",
10
10
  "types": "./dist/index.d.ts",
@@ -56,7 +56,7 @@
56
56
  "author": "GitHub",
57
57
  "license": "MIT",
58
58
  "dependencies": {
59
- "@github/copilot": "^1.0.79",
59
+ "@github/copilot": "^1.0.81-9",
60
60
  "koffi": "^3.1.0",
61
61
  "vscode-jsonrpc": "^8.2.1",
62
62
  "zod": "^4.3.6"