@github/copilot-sdk 1.0.6-preview.0 → 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.
- package/dist/cjs/client.js +5 -3
- package/dist/cjs/generated/rpc.js +48 -25
- package/dist/client.js +5 -3
- package/dist/generated/rpc.d.ts +920 -197
- package/dist/generated/rpc.js +48 -25
- package/dist/generated/session-events.d.ts +299 -84
- package/package.json +2 -2
package/dist/cjs/client.js
CHANGED
|
@@ -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
|
|
1375
|
-
|
|
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
|
|
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
|
*
|
|
@@ -621,14 +621,6 @@ function createInternalServerRpc(connection) {
|
|
|
621
621
|
* @returns Dynamic-context board entry count, when available.
|
|
622
622
|
*/
|
|
623
623
|
getBoardEntryCount: async (params) => connection.sendRequest("sessions.getBoardEntryCount", params),
|
|
624
|
-
/**
|
|
625
|
-
* Cursor-based long-poll for sessions spawned by the runtime (e.g. in response to a Mission Control `start_session` command). The cursor is an opaque token; pass it back to receive only spawn events that occurred AFTER the cursor was issued. Omit the cursor on the first call to receive any events buffered since the runtime started. Internal: this is a CLI background-daemon plumbing primitive. SDK consumers that need to react to runtime-spawned sessions should subscribe to a higher-level event stream rather than driving a long-poll loop.
|
|
626
|
-
*
|
|
627
|
-
* @param params Cursor and optional long-poll wait for polling runtime-spawned sessions.
|
|
628
|
-
*
|
|
629
|
-
* @returns Batch of spawn events plus a cursor for follow-up polls.
|
|
630
|
-
*/
|
|
631
|
-
pollSpawnedSessions: async (params) => connection.sendRequest("sessions.pollSpawnedSessions", params),
|
|
632
624
|
/**
|
|
633
625
|
* Registers extension-provided tools on the given session, gated by an optional `enabled` callback. Returns an opaque unsubscribe function the caller must invoke to deregister the tools when the extension is torn down. Marked internal because `loader`, `enabled`, and the returned `unsubscribe` are in-process handles that cannot cross the JSON-RPC boundary. Disappears once extension discovery / launch / tool registration are owned by the runtime: SDK consumers will pass pure config (search paths, disabled ids) via `SessionOptions` and the runtime will resolve, launch, register, and tear down extensions itself.
|
|
634
626
|
*
|
|
@@ -700,6 +692,17 @@ function createSessionRpc(connection, sessionId) {
|
|
|
700
692
|
setCredentials: async (params) => connection.sendRequest("session.gitHubAuth.setCredentials", { sessionId, ...params })
|
|
701
693
|
},
|
|
702
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 */
|
|
703
706
|
canvas: {
|
|
704
707
|
/**
|
|
705
708
|
* Lists canvases declared for the session.
|
|
@@ -1538,17 +1541,17 @@ function createSessionRpc(connection, sessionId) {
|
|
|
1538
1541
|
*/
|
|
1539
1542
|
setApproveAll: async (params) => connection.sendRequest("session.permissions.setApproveAll", { sessionId, ...params }),
|
|
1540
1543
|
/**
|
|
1541
|
-
*
|
|
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.
|
|
1542
1545
|
*
|
|
1543
|
-
* @param params
|
|
1546
|
+
* @param params Allow-all mode to apply for the session.
|
|
1544
1547
|
*
|
|
1545
1548
|
* @returns Indicates whether the operation succeeded and reports the post-mutation state.
|
|
1546
1549
|
*/
|
|
1547
1550
|
setAllowAll: async (params) => connection.sendRequest("session.permissions.setAllowAll", { sessionId, ...params }),
|
|
1548
1551
|
/**
|
|
1549
|
-
* Returns
|
|
1552
|
+
* Returns the current allow-all permission mode for the session.
|
|
1550
1553
|
*
|
|
1551
|
-
* @returns Current
|
|
1554
|
+
* @returns Current allow-all permission mode.
|
|
1552
1555
|
*/
|
|
1553
1556
|
getAllowAll: async () => connection.sendRequest("session.permissions.getAllowAll", { sessionId }),
|
|
1554
1557
|
/**
|
|
@@ -1718,6 +1721,20 @@ function createSessionRpc(connection, sessionId) {
|
|
|
1718
1721
|
* @returns Token breakdown for the session's current context window, or null if uninitialized.
|
|
1719
1722
|
*/
|
|
1720
1723
|
contextInfo: async (params) => connection.sendRequest("session.metadata.contextInfo", { sessionId, ...params }),
|
|
1724
|
+
/**
|
|
1725
|
+
* Returns the experimental per-source attribution breakdown of the session's current context window as a flat list of entries (skills, subagents, MCP servers, built-in tools, plugin rollups, system/tool-definition costs, with nesting via parentId), plus the successful compaction count. The heaviest individual messages are available separately via `metadata.getContextHeaviestMessages`. Returns null until the session has initialized its system prompt and tool metadata.
|
|
1726
|
+
*
|
|
1727
|
+
* @returns Per-source attribution breakdown for the session's current context window, or null if uninitialized.
|
|
1728
|
+
*/
|
|
1729
|
+
getContextAttribution: async () => connection.sendRequest("session.metadata.getContextAttribution", { sessionId }),
|
|
1730
|
+
/**
|
|
1731
|
+
* Returns the largest individual messages currently in the session's context window, most-expensive first. Companion to `metadata.getContextAttribution`. Returns an empty list until the session has initialized.
|
|
1732
|
+
*
|
|
1733
|
+
* @param params Parameters for the heaviest-messages query.
|
|
1734
|
+
*
|
|
1735
|
+
* @returns The heaviest individual messages in the session's context window, most-expensive first.
|
|
1736
|
+
*/
|
|
1737
|
+
getContextHeaviestMessages: async (params) => connection.sendRequest("session.metadata.getContextHeaviestMessages", { sessionId, ...params }),
|
|
1721
1738
|
/**
|
|
1722
1739
|
* Records a working-directory/git context change and emits a `session.context_changed` event.
|
|
1723
1740
|
*
|
|
@@ -1978,18 +1995,24 @@ function createInternalSessionRpc(connection, sessionId) {
|
|
|
1978
1995
|
*
|
|
1979
1996
|
* @param params Server name identifying the external client to remove.
|
|
1980
1997
|
*/
|
|
1981
|
-
unregisterExternalClient: async (params) => connection.sendRequest("session.mcp.unregisterExternalClient", { sessionId, ...params })
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
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 })
|
|
1993
2016
|
}
|
|
1994
2017
|
};
|
|
1995
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
|
|
1362
|
-
|
|
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")) {
|