@github/copilot-sdk 1.0.29-preview.9 → 1.0.29

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/README.md CHANGED
@@ -64,6 +64,7 @@ By default the callback authenticates only requests made for sessions this clien
64
64
  `startAhpHost()` requires `authentication`: `github`, or direct-only `none` / `custom`
65
65
  (`requireIdentity` and a validator returning `{identity,expiresAt}` or `null`):
66
66
 
67
+ <!-- docs-validate: strict -->
67
68
  ```typescript
68
69
  import { CopilotClient } from "@github/copilot-sdk";
69
70
 
@@ -134,6 +135,7 @@ by the SDK. Published sessions remain discoverable after hosting stops.
134
135
 
135
136
  Supply `createSession` to materialize fresh AHP sessions in your application:
136
137
 
138
+ <!-- docs-validate: strict -->
137
139
  ```typescript
138
140
  import { approveAll, CopilotClient, defineTool } from "@github/copilot-sdk";
139
141
 
@@ -22,7 +22,7 @@ __export(cliVersion_exports, {
22
22
  COPILOT_CLI_VERSION: () => COPILOT_CLI_VERSION
23
23
  });
24
24
  module.exports = __toCommonJS(cliVersion_exports);
25
- const COPILOT_CLI_VERSION = "1.0.106-10";
25
+ const COPILOT_CLI_VERSION = "1.0.107";
26
26
  const COPILOT_CLI_USE_NPM_PACKAGE = false;
27
27
  // Annotate the CommonJS export names for ESM import in node:
28
28
  0 && (module.exports = {
@@ -1196,7 +1196,10 @@ class CopilotSession {
1196
1196
  if (!this._claimExternalTool(requestId, controller)) {
1197
1197
  return;
1198
1198
  }
1199
- const message = error instanceof Error ? error.message : String(error);
1199
+ let message = error instanceof Error ? error.message : String(error);
1200
+ if (!message) {
1201
+ message = error instanceof Error && error.name || "Error";
1202
+ }
1200
1203
  try {
1201
1204
  await this.rpc.tools.handlePendingToolCall({ requestId, error: message });
1202
1205
  } catch (rpcError) {
@@ -1,2 +1,2 @@
1
- export declare const COPILOT_CLI_VERSION = "1.0.106-10";
1
+ export declare const COPILOT_CLI_VERSION = "1.0.107";
2
2
  export declare const COPILOT_CLI_USE_NPM_PACKAGE = false;
@@ -1,4 +1,4 @@
1
- const COPILOT_CLI_VERSION = "1.0.106-10";
1
+ const COPILOT_CLI_VERSION = "1.0.107";
2
2
  const COPILOT_CLI_USE_NPM_PACKAGE = false;
3
3
  export {
4
4
  COPILOT_CLI_USE_NPM_PACKAGE,
package/dist/session.js CHANGED
@@ -1183,7 +1183,10 @@ class CopilotSession {
1183
1183
  if (!this._claimExternalTool(requestId, controller)) {
1184
1184
  return;
1185
1185
  }
1186
- const message = error instanceof Error ? error.message : String(error);
1186
+ let message = error instanceof Error ? error.message : String(error);
1187
+ if (!message) {
1188
+ message = error instanceof Error && error.name || "Error";
1189
+ }
1187
1190
  try {
1188
1191
  await this.rpc.tools.handlePendingToolCall({ requestId, error: message });
1189
1192
  } catch (rpcError) {
@@ -131,6 +131,7 @@ hooks: {
131
131
  ```
132
132
 
133
133
  All hook inputs include `sessionId`, `timestamp` (`Date`) and `workingDirectory`.
134
+ Tool hooks also receive `toolCallId` when the runtime supplies one; correlate a call's hooks with `(input.sessionId, input.toolCallId)`.
134
135
  All handlers receive `invocation: { sessionId: string }` as the second argument.
135
136
  All handlers may return `void`/`undefined` (no-op) or an output object.
136
137
 
@@ -162,7 +163,7 @@ runtime-generated context.
162
163
 
163
164
  ### onPreToolUse
164
165
 
165
- **Input:** `{ toolName: string, toolArgs: unknown, timestamp, workingDirectory }`
166
+ **Input:** `{ toolCallId?: string, toolName: string, toolArgs: unknown, timestamp, workingDirectory }`
166
167
 
167
168
  **Output (all fields optional):**
168
169
  | Field | Type | Effect |
@@ -187,7 +188,7 @@ object sent with the request; to allow, deny or change the call itself, use
187
188
 
188
189
  ### onPostToolUse
189
190
 
190
- **Input:** `{ toolName: string, toolArgs: unknown, toolResult: ToolResultObject, timestamp, workingDirectory }`
191
+ **Input:** `{ toolCallId?: string, toolName: string, toolArgs: unknown, toolResult: ToolResultObject, timestamp, workingDirectory }`
191
192
 
192
193
  Fires only when the tool returned a successful result. To observe non-success
193
194
  outcomes, register `onPostToolUseFailure` as well.
@@ -200,7 +201,7 @@ outcomes, register `onPostToolUseFailure` as well.
200
201
 
201
202
  ### onPostToolUseFailure
202
203
 
203
- **Input:** `{ toolName: string, toolArgs: unknown, error: string, timestamp, workingDirectory }`
204
+ **Input:** `{ toolCallId?: string, toolName: string, toolArgs: unknown, error: string, timestamp, workingDirectory }`
204
205
 
205
206
  Fires after a tool execution whose result was `"failure"`. `onPostToolUse`
206
207
  does **not** fire for these outcomes, so register this handler to observe or
package/package.json CHANGED
@@ -5,8 +5,8 @@
5
5
  "url": "https://github.com/github/copilot-agent-runtime.git",
6
6
  "directory": "src/sdk/nodejs"
7
7
  },
8
- "version": "1.0.29-preview.9",
9
- "copilotCliVersion": "1.0.106-10",
8
+ "version": "1.0.29",
9
+ "copilotCliVersion": "1.0.107",
10
10
  "description": "TypeScript SDK for programmatic control of GitHub Copilot CLI via JSON-RPC",
11
11
  "main": "./dist/cjs/index.js",
12
12
  "types": "./dist/index.d.ts",
@@ -117,18 +117,18 @@
117
117
  "README.md"
118
118
  ],
119
119
  "copilotRuntime": {
120
- "sourceSha": "b3da66080b3d00711a816a990fdaf6308ff17a1f",
121
- "version": "1.0.106-10",
120
+ "sourceSha": "2bfb456b9e0878c4cb3dd05cb9877ac9c97cbd68",
121
+ "version": "1.0.107",
122
122
  "visibility": "public"
123
123
  },
124
124
  "optionalDependencies": {
125
- "@github/copilot-sdk-darwin-arm64": "1.0.29-preview.9",
126
- "@github/copilot-sdk-darwin-x64": "1.0.29-preview.9",
127
- "@github/copilot-sdk-linux-arm64": "1.0.29-preview.9",
128
- "@github/copilot-sdk-linux-x64": "1.0.29-preview.9",
129
- "@github/copilot-sdk-linuxmusl-arm64": "1.0.29-preview.9",
130
- "@github/copilot-sdk-linuxmusl-x64": "1.0.29-preview.9",
131
- "@github/copilot-sdk-win32-arm64": "1.0.29-preview.9",
132
- "@github/copilot-sdk-win32-x64": "1.0.29-preview.9"
125
+ "@github/copilot-sdk-darwin-arm64": "1.0.29",
126
+ "@github/copilot-sdk-darwin-x64": "1.0.29",
127
+ "@github/copilot-sdk-linux-arm64": "1.0.29",
128
+ "@github/copilot-sdk-linux-x64": "1.0.29",
129
+ "@github/copilot-sdk-linuxmusl-arm64": "1.0.29",
130
+ "@github/copilot-sdk-linuxmusl-x64": "1.0.29",
131
+ "@github/copilot-sdk-win32-arm64": "1.0.29",
132
+ "@github/copilot-sdk-win32-x64": "1.0.29"
133
133
  }
134
134
  }