@github/copilot-sdk 1.0.6-preview.1 → 1.0.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.
@@ -1371,9 +1371,11 @@ class CopilotClient {
1371
1371
  const raceAgainstExit = (p) => this.processExitPromise ? Promise.race([p, this.processExitPromise]) : p;
1372
1372
  let serverVersion;
1373
1373
  try {
1374
- const result = await raceAgainstExit(
1375
- this.internalRpc.connect({ token: this.effectiveConnectionToken })
1376
- );
1374
+ const connectParams = { token: this.effectiveConnectionToken };
1375
+ if (this.onGitHubTelemetry != null) {
1376
+ connectParams.enableGitHubTelemetryForwarding = true;
1377
+ }
1378
+ const result = await raceAgainstExit(this.internalRpc.connect(connectParams));
1377
1379
  serverVersion = result.protocolVersion;
1378
1380
  } catch (err) {
1379
1381
  if (err instanceof import_node.ResponseError && (err.code === import_node.ErrorCodes.MethodNotFound || err.message === "Unhandled method connect")) {
@@ -588,7 +588,7 @@ function createInternalServerRpc(connection) {
588
588
  /**
589
589
  * Performs the SDK server connection handshake and validates the optional connection token. Marked internal because this is JSON-RPC transport plumbing invoked automatically by an SDK client's own `connect()` wrapper, not a user-facing method. Stays internal as long as the SDK client owns the handshake; would only become public if the SDK ever exposed the raw schema surface to consumers without a connection wrapper.
590
590
  *
591
- * @param params Optional connection token presented by the SDK client during the handshake.
591
+ * @param params Parameters for the `server.connect` handshake: an optional connection token and optional connection-level opt-ins (e.g. GitHub telemetry forwarding).
592
592
  *
593
593
  * @returns Handshake result reporting the server's protocol version and package version on success.
594
594
  *
@@ -692,6 +692,17 @@ function createSessionRpc(connection, sessionId) {
692
692
  setCredentials: async (params) => connection.sendRequest("session.gitHubAuth.setCredentials", { sessionId, ...params })
693
693
  },
694
694
  /** @experimental */
695
+ debug: {
696
+ /**
697
+ * Collects a redacted session debug log bundle into a local archive or staging directory. The runtime includes session-owned logs by default and accepts caller-provided diagnostic entries so host applications can add their own files without changing this API shape.
698
+ *
699
+ * @param params Options for collecting a redacted session debug bundle.
700
+ *
701
+ * @returns Result of collecting a redacted debug bundle.
702
+ */
703
+ collectLogs: async (params) => connection.sendRequest("session.debug.collectLogs", { sessionId, ...params })
704
+ },
705
+ /** @experimental */
695
706
  canvas: {
696
707
  /**
697
708
  * Lists canvases declared for the session.
@@ -1530,17 +1541,17 @@ function createSessionRpc(connection, sessionId) {
1530
1541
  */
1531
1542
  setApproveAll: async (params) => connection.sendRequest("session.permissions.setApproveAll", { sessionId, ...params }),
1532
1543
  /**
1533
- * Enables or disables full allow-all permissions (tools, paths, and URLs) for the session. Used by attach-mode clients (e.g. LocalRpcSession's `/allow-all` forwarder) to flip the target session's permission state. Unlike `setApproveAll`, this swaps in the unrestricted path and URL managers and emits `session.permissions_changed` on transition. The result returns the authoritative post-mutation state so callers can update their local mirrors without racing the `session.permissions_changed` notification on the same wire.
1544
+ * Sets the allow-all permission mode for the session. Used by attach-mode clients (e.g. LocalRpcSession's `/allow-all` forwarder) to flip the target session's permission state. The `on` mode swaps in unrestricted path and URL managers and emits `session.permissions_changed` on transition; the `auto` mode keeps normal prompt paths active while attaching LLM safety recommendations. The result returns the authoritative post-mutation state so callers can update their local mirrors without racing the `session.permissions_changed` notification on the same wire.
1534
1545
  *
1535
- * @param params Whether to enable full allow-all permissions for the session.
1546
+ * @param params Allow-all mode to apply for the session.
1536
1547
  *
1537
1548
  * @returns Indicates whether the operation succeeded and reports the post-mutation state.
1538
1549
  */
1539
1550
  setAllowAll: async (params) => connection.sendRequest("session.permissions.setAllowAll", { sessionId, ...params }),
1540
1551
  /**
1541
- * Returns whether full allow-all permissions are currently active for the session.
1552
+ * Returns the current allow-all permission mode for the session.
1542
1553
  *
1543
- * @returns Current full allow-all permission state.
1554
+ * @returns Current allow-all permission mode.
1544
1555
  */
1545
1556
  getAllowAll: async () => connection.sendRequest("session.permissions.getAllowAll", { sessionId }),
1546
1557
  /**
@@ -1984,18 +1995,24 @@ function createInternalSessionRpc(connection, sessionId) {
1984
1995
  *
1985
1996
  * @param params Server name identifying the external client to remove.
1986
1997
  */
1987
- unregisterExternalClient: async (params) => connection.sendRequest("session.mcp.unregisterExternalClient", { sessionId, ...params }),
1988
- /** @experimental */
1989
- oauth: {
1990
- /**
1991
- * Responds to a pending MCP OAuth request with an in-process provider. This internal CLI-only API accepts a live OAuthClientProvider instance and cannot be used over the SDK JSON-RPC boundary. Use session.mcp.oauth.handlePendingRequest instead for the public SDK-safe response path.
1992
- *
1993
- * @param params MCP OAuth request id and optional provider response.
1994
- *
1995
- * @returns Empty result after recording the MCP OAuth response.
1996
- */
1997
- respond: async (params) => connection.sendRequest("session.mcp.oauth.respond", { sessionId, ...params })
1998
- }
1998
+ unregisterExternalClient: async (params) => connection.sendRequest("session.mcp.unregisterExternalClient", { sessionId, ...params })
1999
+ },
2000
+ /** @experimental */
2001
+ settings: {
2002
+ /**
2003
+ * Returns a redacted snapshot of session runtime settings, with secrets and raw feature flags excluded. Internal: the runtime settings shape is a runtime-internal surface and is deliberately kept out of the public SDK, because consumers should not depend on the runtime's internal settings layout. It remains callable in-process and is expected to be reworked as the runtime internals are consolidated.
2004
+ *
2005
+ * @returns Redacted, serializable view of session runtime settings for SDK boundary consumers. Secrets and raw feature flags are intentionally excluded.
2006
+ */
2007
+ snapshot: async () => connection.sendRequest("session.settings.snapshot", { sessionId }),
2008
+ /**
2009
+ * Evaluates a named Rust-owned settings predicate without exposing raw feature flags. Internal: the raw feature-flag names and composition are runtime-internal, so this predicate-evaluation helper is kept out of the public SDK surface and is callable in-process only.
2010
+ *
2011
+ * @param params Named Rust-owned settings predicate to evaluate for this session.
2012
+ *
2013
+ * @returns Result of evaluating a Rust-owned settings predicate.
2014
+ */
2015
+ evaluatePredicate: async (params) => connection.sendRequest("session.settings.evaluatePredicate", { sessionId, ...params })
1999
2016
  }
2000
2017
  };
2001
2018
  }
package/dist/client.js CHANGED
@@ -1358,9 +1358,11 @@ class CopilotClient {
1358
1358
  const raceAgainstExit = (p) => this.processExitPromise ? Promise.race([p, this.processExitPromise]) : p;
1359
1359
  let serverVersion;
1360
1360
  try {
1361
- const result = await raceAgainstExit(
1362
- this.internalRpc.connect({ token: this.effectiveConnectionToken })
1363
- );
1361
+ const connectParams = { token: this.effectiveConnectionToken };
1362
+ if (this.onGitHubTelemetry != null) {
1363
+ connectParams.enableGitHubTelemetryForwarding = true;
1364
+ }
1365
+ const result = await raceAgainstExit(this.internalRpc.connect(connectParams));
1364
1366
  serverVersion = result.protocolVersion;
1365
1367
  } catch (err) {
1366
1368
  if (err instanceof ResponseError && (err.code === ErrorCodes.MethodNotFound || err.message === "Unhandled method connect")) {