@github/copilot-sdk 1.0.18-preview.4 → 1.0.18
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 +10 -2
- package/dist/cjs/cliVersion.js +1 -1
- package/dist/cjs/client.js +5 -2
- package/dist/cjs/generated/rpc.js +8 -0
- package/dist/cjs/host.js +8 -2
- package/dist/cjs/session.js +6 -3
- package/dist/cliVersion.d.ts +1 -1
- package/dist/cliVersion.js +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/client.js +5 -2
- package/dist/generated/rpc.d.ts +87 -1
- package/dist/generated/rpc.js +8 -0
- package/dist/host.d.ts +9 -4
- package/dist/host.js +8 -2
- package/dist/session.js +6 -3
- package/dist/types.d.ts +18 -0
- package/package.json +13 -12
package/README.md
CHANGED
|
@@ -74,6 +74,9 @@ without deleting underlying sessions. Reconnecting does not reclaim a host.
|
|
|
74
74
|
The optional `onExit` callback reports exits at most once. If the owner connection
|
|
75
75
|
is lost, it reports that loss rather than claiming that listener cleanup was
|
|
76
76
|
acknowledged.
|
|
77
|
+
Call `const { sessions } = await host.listSessions()` to read the complete catalog
|
|
78
|
+
of live and dormant sessions advertised by the host. The method returns a
|
|
79
|
+
`HostListSessionsResult` containing `sessions`, not a session array directly.
|
|
77
80
|
|
|
78
81
|
`host.pid` is absent for in-process listeners. The optional field is retained
|
|
79
82
|
for separate host process IDs returned by legacy runtimes, never the runtime PID.
|
|
@@ -104,6 +107,10 @@ The listener follows the owning client's lifetime. Call `await host.dispose()`
|
|
|
104
107
|
only when you want to stop it earlier; `await using host` also supports a shorter
|
|
105
108
|
scope. Each disposal call forwards to the runtime, which owns idempotent cleanup.
|
|
106
109
|
The AHP transport remains owned by the host.
|
|
110
|
+
Set top-level `computeId` to reuse the same durable catalog for local and Mission
|
|
111
|
+
Control hosting; it must agree with `githubEnvironment.computeId` when both are
|
|
112
|
+
supplied. Omitted local-only identities are persisted by the runtime, not generated
|
|
113
|
+
by the SDK. Published sessions remain discoverable after hosting stops.
|
|
107
114
|
|
|
108
115
|
### Application-owned sessions
|
|
109
116
|
|
|
@@ -165,8 +172,9 @@ still matches the requested identity and workspace.
|
|
|
165
172
|
Only catalog entries marked as application-owned invoke this callback.
|
|
166
173
|
If the callback is missing, restoring such an entry fails instead of falling
|
|
167
174
|
back to host-owned creation.
|
|
168
|
-
|
|
169
|
-
their current registrations.
|
|
175
|
+
Currently resident published sessions attach directly, without invoking it or replacing
|
|
176
|
+
their current registrations. Dormant published application sessions require this
|
|
177
|
+
resume callback to restore their tools and handlers. Resumed sessions follow the same original-object
|
|
170
178
|
retention, cancellation, late-result release, and `onSessionReleased` rules.
|
|
171
179
|
|
|
172
180
|
The `copilotd-hosting` library runs inside the runtime provider.
|
package/dist/cjs/cliVersion.js
CHANGED
|
@@ -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.94
|
|
25
|
+
const COPILOT_CLI_VERSION = "1.0.94";
|
|
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 = {
|
package/dist/cjs/client.js
CHANGED
|
@@ -1713,7 +1713,7 @@ class CopilotClient {
|
|
|
1713
1713
|
* This connection owns the host. Disposing it or disconnecting the client
|
|
1714
1714
|
* stops the listener without deleting sessions. The host uses a separate
|
|
1715
1715
|
* SDK connection to the same runtime, not another runtime process.
|
|
1716
|
-
* Only one AHP host may own
|
|
1716
|
+
* Only one AHP host may own a compute-scoped catalog in an effective Copilot home
|
|
1717
1717
|
* at a time. Other SDK clients and sessions remain usable in that home.
|
|
1718
1718
|
* Select localServer, githubEnvironment, or both. An empty localServer
|
|
1719
1719
|
* selects 127.0.0.1 on an available port. `onExit` runs at most once; owner disconnection cannot
|
|
@@ -1731,6 +1731,7 @@ class CopilotClient {
|
|
|
1731
1731
|
const rpc = this.rpc;
|
|
1732
1732
|
const hostId = (0, import_node_crypto.randomUUID)();
|
|
1733
1733
|
const {
|
|
1734
|
+
computeId,
|
|
1734
1735
|
localServer,
|
|
1735
1736
|
githubEnvironment,
|
|
1736
1737
|
onExit,
|
|
@@ -1751,6 +1752,7 @@ class CopilotClient {
|
|
|
1751
1752
|
try {
|
|
1752
1753
|
const info = await rpc.host.start({
|
|
1753
1754
|
hostId,
|
|
1755
|
+
computeId,
|
|
1754
1756
|
localServer,
|
|
1755
1757
|
githubEnvironment,
|
|
1756
1758
|
sessionFactory: createSession ? true : void 0,
|
|
@@ -1761,7 +1763,8 @@ class CopilotClient {
|
|
|
1761
1763
|
async () => {
|
|
1762
1764
|
await rpc.host.dispose({ hostId });
|
|
1763
1765
|
},
|
|
1764
|
-
(sessionId) => rpc.host.publishSession({ hostId, sessionId })
|
|
1766
|
+
(sessionId) => rpc.host.publishSession({ hostId, sessionId }),
|
|
1767
|
+
() => rpc.host.listSessions({ hostId })
|
|
1765
1768
|
);
|
|
1766
1769
|
} catch (error) {
|
|
1767
1770
|
this.hostExitCallbacks.delete(hostId);
|
|
@@ -65,6 +65,14 @@ function createServerRpc(connection) {
|
|
|
65
65
|
* @returns The existing runtime identity and its resource on the listener.
|
|
66
66
|
*/
|
|
67
67
|
publishSession: async (params) => connection.sendRequest("host.publishSession", params),
|
|
68
|
+
/**
|
|
69
|
+
* Reads the complete advertised live and dormant session catalog of an existing host owned by this connection. Does not start hosting, subscribe to sessions, or guarantee resumability.
|
|
70
|
+
*
|
|
71
|
+
* @param params Reads a running host's catalog or the runtime's saved default catalog.
|
|
72
|
+
*
|
|
73
|
+
* @returns The complete live and dormant advertised catalog, without subscribing to sessions.
|
|
74
|
+
*/
|
|
75
|
+
listSessions: async (params) => connection.sendRequest("host.listSessions", params),
|
|
68
76
|
/**
|
|
69
77
|
* Starts a connection-owned AHP host with explicit localServer and/or githubEnvironment transports as a supervised SDK participant.
|
|
70
78
|
*
|
package/dist/cjs/host.js
CHANGED
|
@@ -23,9 +23,10 @@ __export(host_exports, {
|
|
|
23
23
|
module.exports = __toCommonJS(host_exports);
|
|
24
24
|
class AhpHost {
|
|
25
25
|
/** @internal */
|
|
26
|
-
constructor(info, disposeHost, publishHostSession) {
|
|
26
|
+
constructor(info, disposeHost, publishHostSession, listHostSessions) {
|
|
27
27
|
this.disposeHost = disposeHost;
|
|
28
28
|
this.publishHostSession = publishHostSession;
|
|
29
|
+
this.listHostSessions = listHostSessions;
|
|
29
30
|
this.hostId = info.hostId;
|
|
30
31
|
this.url = info.url;
|
|
31
32
|
this.environmentId = info.environmentId;
|
|
@@ -34,6 +35,7 @@ class AhpHost {
|
|
|
34
35
|
}
|
|
35
36
|
disposeHost;
|
|
36
37
|
publishHostSession;
|
|
38
|
+
listHostSessions;
|
|
37
39
|
hostId;
|
|
38
40
|
/** Local WebSocket URL. Absent when only the GitHub environment is enabled. */
|
|
39
41
|
url;
|
|
@@ -47,10 +49,14 @@ class AhpHost {
|
|
|
47
49
|
dispose() {
|
|
48
50
|
return this.disposeHost();
|
|
49
51
|
}
|
|
50
|
-
/** Publish an
|
|
52
|
+
/** Publish an attached application session into the durable compute-scoped host catalog. */
|
|
51
53
|
publishSession(sessionId) {
|
|
52
54
|
return this.publishHostSession(sessionId);
|
|
53
55
|
}
|
|
56
|
+
/** List all live and dormant catalog sessions advertised by this host. */
|
|
57
|
+
listSessions() {
|
|
58
|
+
return this.listHostSessions();
|
|
59
|
+
}
|
|
54
60
|
async [Symbol.asyncDispose]() {
|
|
55
61
|
await this.dispose();
|
|
56
62
|
}
|
package/dist/cjs/session.js
CHANGED
|
@@ -815,7 +815,8 @@ class CopilotSession {
|
|
|
815
815
|
args,
|
|
816
816
|
handler,
|
|
817
817
|
traceparent,
|
|
818
|
-
tracestate
|
|
818
|
+
tracestate,
|
|
819
|
+
event.agentId || void 0
|
|
819
820
|
);
|
|
820
821
|
}
|
|
821
822
|
} else if (event.type === "external_tool.completed") {
|
|
@@ -906,7 +907,7 @@ class CopilotSession {
|
|
|
906
907
|
* Executes a tool handler and sends the result back via RPC.
|
|
907
908
|
* @internal
|
|
908
909
|
*/
|
|
909
|
-
async _executeToolAndRespond(requestId, toolName, toolCallId, args, handler, traceparent, tracestate) {
|
|
910
|
+
async _executeToolAndRespond(requestId, toolName, toolCallId, args, handler, traceparent, tracestate, agentId) {
|
|
910
911
|
const controller = new AbortController();
|
|
911
912
|
if (this.disconnected || this.pendingExternalTools.has(requestId)) {
|
|
912
913
|
return;
|
|
@@ -944,7 +945,9 @@ class CopilotSession {
|
|
|
944
945
|
availableTools,
|
|
945
946
|
traceparent,
|
|
946
947
|
tracestate,
|
|
947
|
-
signal: controller.signal
|
|
948
|
+
signal: controller.signal,
|
|
949
|
+
agentId,
|
|
950
|
+
requestId
|
|
948
951
|
});
|
|
949
952
|
let result;
|
|
950
953
|
if (rawResult == null) {
|
package/dist/cliVersion.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const COPILOT_CLI_VERSION = "1.0.94
|
|
1
|
+
export declare const COPILOT_CLI_VERSION = "1.0.94";
|
|
2
2
|
export declare const COPILOT_CLI_USE_NPM_PACKAGE = false;
|
package/dist/cliVersion.js
CHANGED
package/dist/client.d.ts
CHANGED
|
@@ -254,7 +254,7 @@ export declare class CopilotClient {
|
|
|
254
254
|
* This connection owns the host. Disposing it or disconnecting the client
|
|
255
255
|
* stops the listener without deleting sessions. The host uses a separate
|
|
256
256
|
* SDK connection to the same runtime, not another runtime process.
|
|
257
|
-
* Only one AHP host may own
|
|
257
|
+
* Only one AHP host may own a compute-scoped catalog in an effective Copilot home
|
|
258
258
|
* at a time. Other SDK clients and sessions remain usable in that home.
|
|
259
259
|
* Select localServer, githubEnvironment, or both. An empty localServer
|
|
260
260
|
* selects 127.0.0.1 on an available port. `onExit` runs at most once; owner disconnection cannot
|
package/dist/client.js
CHANGED
|
@@ -1693,7 +1693,7 @@ class CopilotClient {
|
|
|
1693
1693
|
* This connection owns the host. Disposing it or disconnecting the client
|
|
1694
1694
|
* stops the listener without deleting sessions. The host uses a separate
|
|
1695
1695
|
* SDK connection to the same runtime, not another runtime process.
|
|
1696
|
-
* Only one AHP host may own
|
|
1696
|
+
* Only one AHP host may own a compute-scoped catalog in an effective Copilot home
|
|
1697
1697
|
* at a time. Other SDK clients and sessions remain usable in that home.
|
|
1698
1698
|
* Select localServer, githubEnvironment, or both. An empty localServer
|
|
1699
1699
|
* selects 127.0.0.1 on an available port. `onExit` runs at most once; owner disconnection cannot
|
|
@@ -1711,6 +1711,7 @@ class CopilotClient {
|
|
|
1711
1711
|
const rpc = this.rpc;
|
|
1712
1712
|
const hostId = randomUUID();
|
|
1713
1713
|
const {
|
|
1714
|
+
computeId,
|
|
1714
1715
|
localServer,
|
|
1715
1716
|
githubEnvironment,
|
|
1716
1717
|
onExit,
|
|
@@ -1731,6 +1732,7 @@ class CopilotClient {
|
|
|
1731
1732
|
try {
|
|
1732
1733
|
const info = await rpc.host.start({
|
|
1733
1734
|
hostId,
|
|
1735
|
+
computeId,
|
|
1734
1736
|
localServer,
|
|
1735
1737
|
githubEnvironment,
|
|
1736
1738
|
sessionFactory: createSession ? true : void 0,
|
|
@@ -1741,7 +1743,8 @@ class CopilotClient {
|
|
|
1741
1743
|
async () => {
|
|
1742
1744
|
await rpc.host.dispose({ hostId });
|
|
1743
1745
|
},
|
|
1744
|
-
(sessionId) => rpc.host.publishSession({ hostId, sessionId })
|
|
1746
|
+
(sessionId) => rpc.host.publishSession({ hostId, sessionId }),
|
|
1747
|
+
() => rpc.host.listSessions({ hostId })
|
|
1745
1748
|
);
|
|
1746
1749
|
} catch (error) {
|
|
1747
1750
|
this.hostExitCallbacks.delete(hostId);
|
package/dist/generated/rpc.d.ts
CHANGED
|
@@ -12133,6 +12133,10 @@ export interface HostGitHubEnvironmentOptions {
|
|
|
12133
12133
|
* Stable application installation identity, reused across host restarts.
|
|
12134
12134
|
*/
|
|
12135
12135
|
computeId: string;
|
|
12136
|
+
/**
|
|
12137
|
+
* Require sealed, connection-bound authentication (default true), independent of listener address. False permits unsealed direct credentials and unbound sealed relay credentials; use only when the caller fully controls and trusts the direct transport. Relay token encryption remains mandatory.
|
|
12138
|
+
*/
|
|
12139
|
+
requireConnectionBinding?: boolean;
|
|
12136
12140
|
}
|
|
12137
12141
|
/**
|
|
12138
12142
|
* Stops a connection-owned listener and joins its teardown.
|
|
@@ -12203,6 +12207,66 @@ export interface HostExitedNotification {
|
|
|
12203
12207
|
*/
|
|
12204
12208
|
error?: string | null;
|
|
12205
12209
|
}
|
|
12210
|
+
/**
|
|
12211
|
+
* Reads a running host's catalog or the runtime's saved default catalog.
|
|
12212
|
+
*
|
|
12213
|
+
* This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
|
|
12214
|
+
* via the `definition` "HostListSessionsRequest".
|
|
12215
|
+
*/
|
|
12216
|
+
/** @experimental */
|
|
12217
|
+
export interface HostListSessionsRequest {
|
|
12218
|
+
/**
|
|
12219
|
+
* Listener UUID returned by host.start; the caller must own it. Omit to read
|
|
12220
|
+
* the saved default compute-identity catalog without starting a listener.
|
|
12221
|
+
*/
|
|
12222
|
+
hostId?: string;
|
|
12223
|
+
}
|
|
12224
|
+
/**
|
|
12225
|
+
* The complete live and dormant advertised catalog, without subscribing to sessions.
|
|
12226
|
+
*
|
|
12227
|
+
* This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
|
|
12228
|
+
* via the `definition` "HostListSessionsResult".
|
|
12229
|
+
*/
|
|
12230
|
+
/** @experimental */
|
|
12231
|
+
export interface HostListSessionsResult {
|
|
12232
|
+
/**
|
|
12233
|
+
* Complete advertised session summaries, in the host's catalog order.
|
|
12234
|
+
*/
|
|
12235
|
+
sessions: HostSessionSummary[];
|
|
12236
|
+
}
|
|
12237
|
+
/**
|
|
12238
|
+
* Metadata advertised by the AHP host, not a guarantee that history can be resumed.
|
|
12239
|
+
*
|
|
12240
|
+
* This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
|
|
12241
|
+
* via the `definition` "HostSessionSummary".
|
|
12242
|
+
*/
|
|
12243
|
+
/** @experimental */
|
|
12244
|
+
export interface HostSessionSummary {
|
|
12245
|
+
/**
|
|
12246
|
+
* Stable AHP resource URI identifying the session on this host.
|
|
12247
|
+
*/
|
|
12248
|
+
resource: string;
|
|
12249
|
+
/**
|
|
12250
|
+
* Authoritative title advertised by the host.
|
|
12251
|
+
*/
|
|
12252
|
+
title: string;
|
|
12253
|
+
/**
|
|
12254
|
+
* Session creation time as an ISO 8601 timestamp.
|
|
12255
|
+
*/
|
|
12256
|
+
createdAt: string;
|
|
12257
|
+
/**
|
|
12258
|
+
* Last modification time as an ISO 8601 timestamp.
|
|
12259
|
+
*/
|
|
12260
|
+
modifiedAt: string;
|
|
12261
|
+
/**
|
|
12262
|
+
* Unsigned 32-bit AHP session status bitset (0..=4294967295); unknown bits must be preserved.
|
|
12263
|
+
*/
|
|
12264
|
+
status: number;
|
|
12265
|
+
/**
|
|
12266
|
+
* Optional activity description advertised by the host.
|
|
12267
|
+
*/
|
|
12268
|
+
activity?: string;
|
|
12269
|
+
}
|
|
12206
12270
|
/**
|
|
12207
12271
|
* Local WebSocket transport options.
|
|
12208
12272
|
*
|
|
@@ -12359,6 +12423,11 @@ export interface HostSessionCreateRequest {
|
|
|
12359
12423
|
* Resume an app-owned durable session instead of creating a new session.
|
|
12360
12424
|
*/
|
|
12361
12425
|
resume?: boolean;
|
|
12426
|
+
/**
|
|
12427
|
+
* For an explicit publication, borrow an existing owning-connection resident
|
|
12428
|
+
* instead of invoking the resume factory. Cold sessions still use the factory.
|
|
12429
|
+
*/
|
|
12430
|
+
preferResident?: boolean;
|
|
12362
12431
|
/**
|
|
12363
12432
|
* Host-selected SDK creation or resume settings, without executable callbacks or tools.
|
|
12364
12433
|
*/
|
|
@@ -12421,6 +12490,10 @@ export interface HostStartRequest {
|
|
|
12421
12490
|
* Caller-generated UUID identifying this connection-owned listener.
|
|
12422
12491
|
*/
|
|
12423
12492
|
hostId: string;
|
|
12493
|
+
/**
|
|
12494
|
+
* Stable application identity selecting its durable host catalog. Defaults to the persisted runtime compute GUID; must agree with githubEnvironment.computeId when both are supplied.
|
|
12495
|
+
*/
|
|
12496
|
+
computeId?: string;
|
|
12424
12497
|
localServer?: HostLocalServerOptions;
|
|
12425
12498
|
githubEnvironment?: HostGitHubEnvironmentOptions;
|
|
12426
12499
|
/**
|
|
@@ -14648,7 +14721,7 @@ export interface McpConfiguredServer {
|
|
|
14648
14721
|
* Human-readable display name supplied by configuration.
|
|
14649
14722
|
*/
|
|
14650
14723
|
displayName?: string;
|
|
14651
|
-
live
|
|
14724
|
+
live: McpConfiguredServerState;
|
|
14652
14725
|
}
|
|
14653
14726
|
/**
|
|
14654
14727
|
* Observational state for a matching already materialized MCP server.
|
|
@@ -29764,6 +29837,11 @@ export interface HostCreateSessionRequest {
|
|
|
29764
29837
|
* Resume an app-owned durable session instead of creating a new session.
|
|
29765
29838
|
*/
|
|
29766
29839
|
resume?: boolean;
|
|
29840
|
+
/**
|
|
29841
|
+
* For an explicit publication, borrow an existing owning-connection resident
|
|
29842
|
+
* instead of invoking the resume factory. Cold sessions still use the factory.
|
|
29843
|
+
*/
|
|
29844
|
+
preferResident?: boolean;
|
|
29767
29845
|
/**
|
|
29768
29846
|
* Host-selected SDK creation or resume settings, without executable callbacks or tools.
|
|
29769
29847
|
*/
|
|
@@ -30406,6 +30484,14 @@ export declare function createServerRpc(connection: MessageConnection): {
|
|
|
30406
30484
|
* @returns The existing runtime identity and its resource on the listener.
|
|
30407
30485
|
*/
|
|
30408
30486
|
publishSession: (params: HostPublishSessionRequest) => Promise<HostPublishSessionResult>;
|
|
30487
|
+
/**
|
|
30488
|
+
* Reads the complete advertised live and dormant session catalog of an existing host owned by this connection. Does not start hosting, subscribe to sessions, or guarantee resumability.
|
|
30489
|
+
*
|
|
30490
|
+
* @param params Reads a running host's catalog or the runtime's saved default catalog.
|
|
30491
|
+
*
|
|
30492
|
+
* @returns The complete live and dormant advertised catalog, without subscribing to sessions.
|
|
30493
|
+
*/
|
|
30494
|
+
listSessions: (params: HostListSessionsRequest) => Promise<HostListSessionsResult>;
|
|
30409
30495
|
/**
|
|
30410
30496
|
* Starts a connection-owned AHP host with explicit localServer and/or githubEnvironment transports as a supervised SDK participant.
|
|
30411
30497
|
*
|
package/dist/generated/rpc.js
CHANGED
|
@@ -37,6 +37,14 @@ function createServerRpc(connection) {
|
|
|
37
37
|
* @returns The existing runtime identity and its resource on the listener.
|
|
38
38
|
*/
|
|
39
39
|
publishSession: async (params) => connection.sendRequest("host.publishSession", params),
|
|
40
|
+
/**
|
|
41
|
+
* Reads the complete advertised live and dormant session catalog of an existing host owned by this connection. Does not start hosting, subscribe to sessions, or guarantee resumability.
|
|
42
|
+
*
|
|
43
|
+
* @param params Reads a running host's catalog or the runtime's saved default catalog.
|
|
44
|
+
*
|
|
45
|
+
* @returns The complete live and dormant advertised catalog, without subscribing to sessions.
|
|
46
|
+
*/
|
|
47
|
+
listSessions: async (params) => connection.sendRequest("host.listSessions", params),
|
|
40
48
|
/**
|
|
41
49
|
* Starts a connection-owned AHP host with explicit localServer and/or githubEnvironment transports as a supervised SDK participant.
|
|
42
50
|
*
|
package/dist/host.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { HostExitedNotification, HostPublishSessionResult, HostLocalServerOptions, HostGitHubEnvironmentOptions } from "./generated/rpc.js";
|
|
1
|
+
import type { HostExitedNotification, HostPublishSessionResult, HostListSessionsResult, HostLocalServerOptions, HostGitHubEnvironmentOptions } from "./generated/rpc.js";
|
|
2
2
|
import type { CopilotSession } from "./session.js";
|
|
3
3
|
import type { SessionConfig, ResumeSessionConfig } from "./types.js";
|
|
4
4
|
/** Host-selected defaults for a fresh application-owned session. @experimental */
|
|
@@ -30,6 +30,8 @@ export type AhpHostExit = HostExitedNotification;
|
|
|
30
30
|
* @experimental
|
|
31
31
|
*/
|
|
32
32
|
export interface AhpHostOptions {
|
|
33
|
+
/** Stable catalog identity; must agree with githubEnvironment.computeId when both are supplied. */
|
|
34
|
+
computeId?: string;
|
|
33
35
|
/** Enable a local WebSocket listener; an empty object selects loopback defaults. */
|
|
34
36
|
localServer?: HostLocalServerOptions;
|
|
35
37
|
/** Register a Mission Control environment and enable remote WPS connections. */
|
|
@@ -43,7 +45,7 @@ export interface AhpHostOptions {
|
|
|
43
45
|
*/
|
|
44
46
|
createSession?: (request: AhpSessionCreateRequest) => Promise<CopilotSession>;
|
|
45
47
|
/**
|
|
46
|
-
* Resume a durable session
|
|
48
|
+
* Resume a durable application-owned session, including a previously published session.
|
|
47
49
|
* Return the original object from this client's resumeSession, or an existing
|
|
48
50
|
* attached original without reconfiguring it. Published resident sessions
|
|
49
51
|
* attach directly and never invoke this callback.
|
|
@@ -62,13 +64,14 @@ export interface AhpHostOptions {
|
|
|
62
64
|
* the owning client also stops the host; reconnecting does not reclaim it.
|
|
63
65
|
* Stopping a host does not delete its underlying sessions.
|
|
64
66
|
* Its durable AHP catalog is shared by successive hosts in the runtime's
|
|
65
|
-
* effective Copilot home; a concurrent host for that catalog is rejected.
|
|
67
|
+
* effective Copilot home and compute identity; a concurrent host for that catalog is rejected.
|
|
66
68
|
*
|
|
67
69
|
* @experimental
|
|
68
70
|
*/
|
|
69
71
|
export declare class AhpHost {
|
|
70
72
|
private readonly disposeHost;
|
|
71
73
|
private readonly publishHostSession;
|
|
74
|
+
private readonly listHostSessions;
|
|
72
75
|
readonly hostId: string;
|
|
73
76
|
/** Local WebSocket URL. Absent when only the GitHub environment is enabled. */
|
|
74
77
|
readonly url: string | undefined;
|
|
@@ -80,7 +83,9 @@ export declare class AhpHost {
|
|
|
80
83
|
readonly pid: number | undefined;
|
|
81
84
|
/** Ask the runtime to stop the listener and await its cleanup, on every call. */
|
|
82
85
|
dispose(): Promise<void>;
|
|
83
|
-
/** Publish an
|
|
86
|
+
/** Publish an attached application session into the durable compute-scoped host catalog. */
|
|
84
87
|
publishSession(sessionId: string): Promise<HostPublishSessionResult>;
|
|
88
|
+
/** List all live and dormant catalog sessions advertised by this host. */
|
|
89
|
+
listSessions(): Promise<HostListSessionsResult>;
|
|
85
90
|
[Symbol.asyncDispose](): Promise<void>;
|
|
86
91
|
}
|
package/dist/host.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
class AhpHost {
|
|
2
2
|
/** @internal */
|
|
3
|
-
constructor(info, disposeHost, publishHostSession) {
|
|
3
|
+
constructor(info, disposeHost, publishHostSession, listHostSessions) {
|
|
4
4
|
this.disposeHost = disposeHost;
|
|
5
5
|
this.publishHostSession = publishHostSession;
|
|
6
|
+
this.listHostSessions = listHostSessions;
|
|
6
7
|
this.hostId = info.hostId;
|
|
7
8
|
this.url = info.url;
|
|
8
9
|
this.environmentId = info.environmentId;
|
|
@@ -11,6 +12,7 @@ class AhpHost {
|
|
|
11
12
|
}
|
|
12
13
|
disposeHost;
|
|
13
14
|
publishHostSession;
|
|
15
|
+
listHostSessions;
|
|
14
16
|
hostId;
|
|
15
17
|
/** Local WebSocket URL. Absent when only the GitHub environment is enabled. */
|
|
16
18
|
url;
|
|
@@ -24,10 +26,14 @@ class AhpHost {
|
|
|
24
26
|
dispose() {
|
|
25
27
|
return this.disposeHost();
|
|
26
28
|
}
|
|
27
|
-
/** Publish an
|
|
29
|
+
/** Publish an attached application session into the durable compute-scoped host catalog. */
|
|
28
30
|
publishSession(sessionId) {
|
|
29
31
|
return this.publishHostSession(sessionId);
|
|
30
32
|
}
|
|
33
|
+
/** List all live and dormant catalog sessions advertised by this host. */
|
|
34
|
+
listSessions() {
|
|
35
|
+
return this.listHostSessions();
|
|
36
|
+
}
|
|
31
37
|
async [Symbol.asyncDispose]() {
|
|
32
38
|
await this.dispose();
|
|
33
39
|
}
|
package/dist/session.js
CHANGED
|
@@ -797,7 +797,8 @@ class CopilotSession {
|
|
|
797
797
|
args,
|
|
798
798
|
handler,
|
|
799
799
|
traceparent,
|
|
800
|
-
tracestate
|
|
800
|
+
tracestate,
|
|
801
|
+
event.agentId || void 0
|
|
801
802
|
);
|
|
802
803
|
}
|
|
803
804
|
} else if (event.type === "external_tool.completed") {
|
|
@@ -888,7 +889,7 @@ class CopilotSession {
|
|
|
888
889
|
* Executes a tool handler and sends the result back via RPC.
|
|
889
890
|
* @internal
|
|
890
891
|
*/
|
|
891
|
-
async _executeToolAndRespond(requestId, toolName, toolCallId, args, handler, traceparent, tracestate) {
|
|
892
|
+
async _executeToolAndRespond(requestId, toolName, toolCallId, args, handler, traceparent, tracestate, agentId) {
|
|
892
893
|
const controller = new AbortController();
|
|
893
894
|
if (this.disconnected || this.pendingExternalTools.has(requestId)) {
|
|
894
895
|
return;
|
|
@@ -926,7 +927,9 @@ class CopilotSession {
|
|
|
926
927
|
availableTools,
|
|
927
928
|
traceparent,
|
|
928
929
|
tracestate,
|
|
929
|
-
signal: controller.signal
|
|
930
|
+
signal: controller.signal,
|
|
931
|
+
agentId,
|
|
932
|
+
requestId
|
|
930
933
|
});
|
|
931
934
|
let result;
|
|
932
935
|
if (rawResult == null) {
|
package/dist/types.d.ts
CHANGED
|
@@ -522,6 +522,24 @@ export interface ToolInvocation {
|
|
|
522
522
|
tracestate?: string;
|
|
523
523
|
/** Aborted when the runtime completes this request or the session disconnects. */
|
|
524
524
|
signal?: AbortSignal;
|
|
525
|
+
/**
|
|
526
|
+
* Sub-agent instance that issued this call (the `agentId` of its session
|
|
527
|
+
* events). `undefined` for a root-agent call, and for every call when the
|
|
528
|
+
* runtime does not attribute sub-agent tool calls.
|
|
529
|
+
*
|
|
530
|
+
* @experimental
|
|
531
|
+
*/
|
|
532
|
+
agentId?: string;
|
|
533
|
+
/**
|
|
534
|
+
* Runtime request id of this call: the key
|
|
535
|
+
* `session.tools.handlePendingToolCall` and `session.tools.listPendingRequests`
|
|
536
|
+
* use. A root-agent call stays answerable after the session is resumed with
|
|
537
|
+
* pending work continued; a sub-agent's call can be answered only while that
|
|
538
|
+
* sub-agent is still running.
|
|
539
|
+
*
|
|
540
|
+
* @experimental
|
|
541
|
+
*/
|
|
542
|
+
requestId?: string;
|
|
525
543
|
}
|
|
526
544
|
export type ToolHandler<TArgs = unknown> = (args: TArgs, invocation: ToolInvocation) => Promise<unknown> | unknown;
|
|
527
545
|
/**
|
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.18
|
|
9
|
-
"copilotCliVersion": "1.0.94
|
|
8
|
+
"version": "1.0.18",
|
|
9
|
+
"copilotCliVersion": "1.0.94",
|
|
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",
|
|
@@ -81,6 +81,7 @@
|
|
|
81
81
|
"esbuild": "^0.28.1",
|
|
82
82
|
"eslint": "^9.0.0",
|
|
83
83
|
"glob": "^13.0.1",
|
|
84
|
+
"hpke-js": "^1.8.0",
|
|
84
85
|
"json-schema": "^0.4.0",
|
|
85
86
|
"json-schema-to-typescript": "^15.0.4",
|
|
86
87
|
"prettier": "^3.8.1",
|
|
@@ -103,18 +104,18 @@
|
|
|
103
104
|
"README.md"
|
|
104
105
|
],
|
|
105
106
|
"copilotRuntime": {
|
|
106
|
-
"sourceSha": "
|
|
107
|
-
"version": "1.0.94
|
|
107
|
+
"sourceSha": "fdeb5949944ebccf3bb4dda8552a21aa1a09b6f6",
|
|
108
|
+
"version": "1.0.94",
|
|
108
109
|
"visibility": "public"
|
|
109
110
|
},
|
|
110
111
|
"optionalDependencies": {
|
|
111
|
-
"@github/copilot-sdk-darwin-arm64": "1.0.18
|
|
112
|
-
"@github/copilot-sdk-darwin-x64": "1.0.18
|
|
113
|
-
"@github/copilot-sdk-linux-arm64": "1.0.18
|
|
114
|
-
"@github/copilot-sdk-linux-x64": "1.0.18
|
|
115
|
-
"@github/copilot-sdk-linuxmusl-arm64": "1.0.18
|
|
116
|
-
"@github/copilot-sdk-linuxmusl-x64": "1.0.18
|
|
117
|
-
"@github/copilot-sdk-win32-arm64": "1.0.18
|
|
118
|
-
"@github/copilot-sdk-win32-x64": "1.0.18
|
|
112
|
+
"@github/copilot-sdk-darwin-arm64": "1.0.18",
|
|
113
|
+
"@github/copilot-sdk-darwin-x64": "1.0.18",
|
|
114
|
+
"@github/copilot-sdk-linux-arm64": "1.0.18",
|
|
115
|
+
"@github/copilot-sdk-linux-x64": "1.0.18",
|
|
116
|
+
"@github/copilot-sdk-linuxmusl-arm64": "1.0.18",
|
|
117
|
+
"@github/copilot-sdk-linuxmusl-x64": "1.0.18",
|
|
118
|
+
"@github/copilot-sdk-win32-arm64": "1.0.18",
|
|
119
|
+
"@github/copilot-sdk-win32-x64": "1.0.18"
|
|
119
120
|
}
|
|
120
121
|
}
|