@github/copilot-sdk 1.0.25 → 1.0.26-preview.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/README.md +15 -23
- package/dist/cjs/cliVersion.js +1 -1
- package/dist/cjs/client.js +101 -13
- package/dist/cjs/generated/rpc.js +48 -2
- package/dist/cjs/host.js +7 -1
- package/dist/cjs/session.js +140 -14
- package/dist/cliVersion.d.ts +1 -1
- package/dist/cliVersion.js +1 -1
- package/dist/client.d.ts +2 -0
- package/dist/client.js +104 -14
- package/dist/generated/rpc.d.ts +361 -22
- package/dist/generated/rpc.js +48 -2
- package/dist/generated/session-events.d.ts +90 -1
- package/dist/host.d.ts +41 -1
- package/dist/host.js +7 -1
- package/dist/index.d.ts +2 -2
- package/dist/session.d.ts +10 -7
- package/dist/session.js +146 -15
- package/dist/types.d.ts +18 -16
- package/package.json +12 -12
package/README.md
CHANGED
|
@@ -43,8 +43,8 @@ npm install @github/copilot-sdk
|
|
|
43
43
|
|
|
44
44
|
## Runtime-supervised AHP host (experimental)
|
|
45
45
|
|
|
46
|
-
`startAhpHost()`
|
|
47
|
-
|
|
46
|
+
`startAhpHost()` requires `authentication`: `github`, or direct-only `none` / `custom`
|
|
47
|
+
(`requireIdentity` and a validator returning `{identity,expiresAt}` or `null`):
|
|
48
48
|
|
|
49
49
|
```typescript
|
|
50
50
|
import { CopilotClient } from "@github/copilot-sdk";
|
|
@@ -52,7 +52,7 @@ import { CopilotClient } from "@github/copilot-sdk";
|
|
|
52
52
|
await using client = new CopilotClient();
|
|
53
53
|
await client.start();
|
|
54
54
|
const host = await client.startAhpHost({
|
|
55
|
-
localServer: {},
|
|
55
|
+
localServer: {}, authentication: { mode: "github" },
|
|
56
56
|
onExit: (exit) => {
|
|
57
57
|
if (exit.error) console.error(exit.error);
|
|
58
58
|
},
|
|
@@ -121,7 +121,7 @@ import { approveAll, CopilotClient, defineTool } from "@github/copilot-sdk";
|
|
|
121
121
|
|
|
122
122
|
await using client = new CopilotClient();
|
|
123
123
|
await using host = await client.startAhpHost({
|
|
124
|
-
localServer: {},
|
|
124
|
+
localServer: {}, authentication: { mode: "github" },
|
|
125
125
|
createSession: ({ config, signal }) => {
|
|
126
126
|
signal.throwIfAborted();
|
|
127
127
|
return client.createSession({
|
|
@@ -306,7 +306,6 @@ Binary reads and writes are limited to 50,330,880 raw bytes (approximately 48 Mi
|
|
|
306
306
|
larger results return a filesystem error before encoding or decoding.
|
|
307
307
|
|
|
308
308
|
- `sessionIdleTimeoutSeconds?: number` - Server-wide idle timeout for sessions in seconds. Ignored when connecting via `RuntimeConnection.forUri`.
|
|
309
|
-
- `enableRemoteSessions?: boolean` - Enable Mission Control remote session support. Ignored when connecting via `RuntimeConnection.forUri`.
|
|
310
309
|
|
|
311
310
|
#### Installation confirmation (experimental)
|
|
312
311
|
|
|
@@ -543,11 +542,11 @@ Source is independent of delivery mode. Leaving it unset preserves the existing
|
|
|
543
542
|
|
|
544
543
|
##### `sendAndWait(options: MessageOptions, timeout?: number): Promise<AssistantMessageEvent | undefined>`
|
|
545
544
|
|
|
546
|
-
Send a message and wait for response completion
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
`
|
|
550
|
-
|
|
545
|
+
Send a message and wait for its request-owned response completion.
|
|
546
|
+
Remote sessions retain the legacy non-Autopilot `session.idle` or correlated
|
|
547
|
+
`session.autopilot_stopped` wait. Autopilot completion does not wait for or stop
|
|
548
|
+
attached shells. Neither `assistant.idle` nor `session.task_complete` alone
|
|
549
|
+
completes the wait.
|
|
551
550
|
Sub-agent events are still delivered to listeners, but do not complete the wait or supply its reply.
|
|
552
551
|
|
|
553
552
|
**Options:**
|
|
@@ -617,19 +616,12 @@ admission. Schemas larger than 32 MiB when JSON-encoded are also rejected before
|
|
|
617
616
|
admission, using the runtime's existing request-size ceiling. This does not
|
|
618
617
|
guarantee the schema plus conversation and tools fits the provider's budget.
|
|
619
618
|
|
|
620
|
-
Structured waits
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
Unformatted waits also isolate their replies and accept idle only after their
|
|
627
|
-
own request starts. Both forms ignore child-agent events and `session.error`
|
|
628
|
-
events whose `originatingMessageId` belongs to another request. A matching error
|
|
629
|
-
fails its own wait even before a user message is emitted. Errors without an ID
|
|
630
|
-
retain legacy handling: unformatted waits treat them as session-wide, while
|
|
631
|
-
structured waits require their request to have started. Older hosts that omit
|
|
632
|
-
error IDs cannot provide concurrent request-error isolation.
|
|
619
|
+
Structured and unformatted waits return their request's root-agent response when
|
|
620
|
+
its execution completes. Remote sessions retain event-based completion, selecting
|
|
621
|
+
the response and Autopilot terminal by originating request ID. Automatic
|
|
622
|
+
continuation messages do not change ownership. Child-agent events cannot supply
|
|
623
|
+
the result. Legacy errors without an ID cannot provide concurrent request-error
|
|
624
|
+
isolation.
|
|
633
625
|
`turnId` identifies an individual model/tool iteration, not the whole
|
|
634
626
|
run; telemetry interaction IDs are not unique run identifiers.
|
|
635
627
|
|
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.
|
|
25
|
+
const COPILOT_CLI_VERSION = "1.0.103-0";
|
|
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
|
@@ -293,6 +293,8 @@ class CopilotClient {
|
|
|
293
293
|
sessions = /* @__PURE__ */ new Map();
|
|
294
294
|
hostExitCallbacks = /* @__PURE__ */ new Map();
|
|
295
295
|
hostSessionFactories = /* @__PURE__ */ new Map();
|
|
296
|
+
hostAuthenticators = /* @__PURE__ */ new Map();
|
|
297
|
+
hostAuthentications = /* @__PURE__ */ new Map();
|
|
296
298
|
hostHandoffs = /* @__PURE__ */ new Map();
|
|
297
299
|
stderrBuffer = "";
|
|
298
300
|
// Captures CLI stderr for error messages
|
|
@@ -497,6 +499,7 @@ class CopilotClient {
|
|
|
497
499
|
const connArgs = conn.kind === "stdio" || conn.kind === "tcp" ? conn.args ?? [] : [];
|
|
498
500
|
this.connectionExtraArgs = [...connArgs];
|
|
499
501
|
this.options = {
|
|
502
|
+
entra: options.entra ? { ...options.entra } : void 0,
|
|
500
503
|
workingDirectory: options.workingDirectory ?? process.cwd(),
|
|
501
504
|
logLevel: options.logLevel,
|
|
502
505
|
gitHubToken: options.gitHubToken,
|
|
@@ -505,7 +508,6 @@ class CopilotClient {
|
|
|
505
508
|
telemetry: options.telemetry,
|
|
506
509
|
baseDirectory: options.baseDirectory,
|
|
507
510
|
sessionIdleTimeoutSeconds: options.sessionIdleTimeoutSeconds ?? 0,
|
|
508
|
-
enableRemoteSessions: options.enableRemoteSessions ?? false,
|
|
509
511
|
mode: options.mode ?? "copilot-cli",
|
|
510
512
|
clientInfo: options.clientInfo
|
|
511
513
|
};
|
|
@@ -1419,7 +1421,6 @@ class CopilotClient {
|
|
|
1419
1421
|
memory: config.memory,
|
|
1420
1422
|
gitHubToken: config.gitHubToken,
|
|
1421
1423
|
gitHubTokenProviderRegistrationId,
|
|
1422
|
-
remoteSession: config.remoteSession,
|
|
1423
1424
|
cloud: config.cloud,
|
|
1424
1425
|
featureFlags: config.featureFlags,
|
|
1425
1426
|
expAssignments: config.expAssignments,
|
|
@@ -1695,7 +1696,6 @@ class CopilotClient {
|
|
|
1695
1696
|
continuePendingWork: config.continuePendingWork,
|
|
1696
1697
|
gitHubToken: config.gitHubToken,
|
|
1697
1698
|
gitHubTokenProviderRegistrationId,
|
|
1698
|
-
remoteSession: config.remoteSession,
|
|
1699
1699
|
openCanvases: config.openCanvases,
|
|
1700
1700
|
featureFlags: config.featureFlags,
|
|
1701
1701
|
expAssignments: config.expAssignments,
|
|
@@ -1765,6 +1765,18 @@ class CopilotClient {
|
|
|
1765
1765
|
* @experimental
|
|
1766
1766
|
*/
|
|
1767
1767
|
async startAhpHost(options) {
|
|
1768
|
+
const authentication = options?.authentication;
|
|
1769
|
+
if (!authentication || !["github", "none", "custom"].includes(authentication.mode)) {
|
|
1770
|
+
throw new Error("An explicit authentication mode is required");
|
|
1771
|
+
}
|
|
1772
|
+
if (authentication.mode === "custom" && (typeof authentication.requireIdentity !== "string" || !authentication.requireIdentity.trim() || typeof authentication.authenticate !== "function")) {
|
|
1773
|
+
throw new Error(
|
|
1774
|
+
"Custom authentication requires a nonempty requireIdentity and authenticate callback"
|
|
1775
|
+
);
|
|
1776
|
+
}
|
|
1777
|
+
if (authentication.mode !== "github" && options.githubEnvironment) {
|
|
1778
|
+
throw new Error("githubEnvironment requires github authentication");
|
|
1779
|
+
}
|
|
1768
1780
|
if (!options?.localServer && !options?.githubEnvironment) {
|
|
1769
1781
|
throw new Error("At least one of localServer or githubEnvironment is required");
|
|
1770
1782
|
}
|
|
@@ -1773,8 +1785,12 @@ class CopilotClient {
|
|
|
1773
1785
|
}
|
|
1774
1786
|
const rpc = this.rpc;
|
|
1775
1787
|
const hostId = (0, import_node_crypto.randomUUID)();
|
|
1788
|
+
if (authentication.mode === "custom") {
|
|
1789
|
+
this.hostAuthenticators.set(hostId, { ...authentication });
|
|
1790
|
+
}
|
|
1776
1791
|
const {
|
|
1777
1792
|
computeId,
|
|
1793
|
+
allowCreatingNewSessions,
|
|
1778
1794
|
localServer,
|
|
1779
1795
|
githubEnvironment,
|
|
1780
1796
|
onExit,
|
|
@@ -1786,7 +1802,11 @@ class CopilotClient {
|
|
|
1786
1802
|
this.hostSessionFactories.set(hostId, {
|
|
1787
1803
|
createSession,
|
|
1788
1804
|
resumeSession,
|
|
1789
|
-
onSessionReleased
|
|
1805
|
+
onSessionReleased,
|
|
1806
|
+
policy: {
|
|
1807
|
+
mode: authentication.mode,
|
|
1808
|
+
requireIdentity: authentication.mode === "custom" ? authentication.requireIdentity : void 0
|
|
1809
|
+
}
|
|
1790
1810
|
});
|
|
1791
1811
|
}
|
|
1792
1812
|
if (onExit) {
|
|
@@ -1795,11 +1815,13 @@ class CopilotClient {
|
|
|
1795
1815
|
try {
|
|
1796
1816
|
const info = await rpc.host.start({
|
|
1797
1817
|
hostId,
|
|
1818
|
+
authentication: authentication.mode === "custom" ? { mode: "custom", requireIdentity: authentication.requireIdentity } : { mode: authentication.mode },
|
|
1798
1819
|
computeId,
|
|
1799
1820
|
localServer,
|
|
1800
1821
|
githubEnvironment,
|
|
1801
1822
|
sessionFactory: createSession ? true : void 0,
|
|
1802
|
-
resumeFactory: resumeSession ? true : void 0
|
|
1823
|
+
resumeFactory: resumeSession ? true : void 0,
|
|
1824
|
+
allowCreatingNewSessions
|
|
1803
1825
|
});
|
|
1804
1826
|
return new import_host.AhpHost(
|
|
1805
1827
|
info,
|
|
@@ -1808,7 +1830,13 @@ class CopilotClient {
|
|
|
1808
1830
|
},
|
|
1809
1831
|
(sessionId) => rpc.host.publishSession({ hostId, sessionId }),
|
|
1810
1832
|
() => rpc.host.listSessions({ hostId }),
|
|
1811
|
-
(sessionId) => rpc.host.unpublishSession({ hostId, sessionId })
|
|
1833
|
+
(sessionId) => rpc.host.unpublishSession({ hostId, sessionId }),
|
|
1834
|
+
async (allowed) => {
|
|
1835
|
+
await rpc.host.setSessionCreationPolicy({
|
|
1836
|
+
hostId,
|
|
1837
|
+
allowCreatingNewSessions: allowed
|
|
1838
|
+
});
|
|
1839
|
+
}
|
|
1812
1840
|
);
|
|
1813
1841
|
} catch (error) {
|
|
1814
1842
|
this.hostExitCallbacks.delete(hostId);
|
|
@@ -1834,7 +1862,8 @@ class CopilotClient {
|
|
|
1834
1862
|
disconnectHosts() {
|
|
1835
1863
|
for (const hostId of /* @__PURE__ */ new Set([
|
|
1836
1864
|
...this.hostExitCallbacks.keys(),
|
|
1837
|
-
...this.hostSessionFactories.keys()
|
|
1865
|
+
...this.hostSessionFactories.keys(),
|
|
1866
|
+
...this.hostAuthenticators.keys()
|
|
1838
1867
|
])) {
|
|
1839
1868
|
this.handleHostExit({
|
|
1840
1869
|
hostId,
|
|
@@ -1844,6 +1873,13 @@ class CopilotClient {
|
|
|
1844
1873
|
}
|
|
1845
1874
|
}
|
|
1846
1875
|
releaseHostSessions(hostId) {
|
|
1876
|
+
this.hostAuthenticators.delete(hostId);
|
|
1877
|
+
for (const [requestId, entry] of this.hostAuthentications) {
|
|
1878
|
+
if (entry.hostId === hostId) {
|
|
1879
|
+
this.hostAuthentications.delete(requestId);
|
|
1880
|
+
entry.controller.abort();
|
|
1881
|
+
}
|
|
1882
|
+
}
|
|
1847
1883
|
this.hostSessionFactories.delete(hostId);
|
|
1848
1884
|
for (const [handoffId, entry] of this.hostHandoffs) {
|
|
1849
1885
|
if (entry.hostId === hostId) this.releaseHostSession(handoffId);
|
|
@@ -1872,10 +1908,19 @@ class CopilotClient {
|
|
|
1872
1908
|
}
|
|
1873
1909
|
}
|
|
1874
1910
|
async createHostSession(params) {
|
|
1911
|
+
const authentication = params.authentication;
|
|
1912
|
+
if (!authentication) {
|
|
1913
|
+
throw new Error("AHP session handoff authentication is required");
|
|
1914
|
+
}
|
|
1875
1915
|
const options = this.hostSessionFactories.get(params.hostId);
|
|
1876
1916
|
if (!(params.resume ? options?.resumeSession : options?.createSession) || this.hostHandoffs.has(params.handoffId)) {
|
|
1877
1917
|
throw new Error("AHP session factory is unavailable or handoff already exists");
|
|
1878
1918
|
}
|
|
1919
|
+
const policy = options.policy;
|
|
1920
|
+
const identity = authentication.identity;
|
|
1921
|
+
if (authentication.mode !== policy.mode || (authentication.mode === "none" ? identity !== void 0 : typeof identity !== "string" || !identity.trim()) || policy.mode === "custom" && identity !== policy.requireIdentity) {
|
|
1922
|
+
throw new Error("AHP trusted authentication does not match host policy");
|
|
1923
|
+
}
|
|
1879
1924
|
const entry = {
|
|
1880
1925
|
hostId: params.hostId,
|
|
1881
1926
|
requestedSessionId: params.config.sessionId,
|
|
@@ -1902,12 +1947,14 @@ class CopilotClient {
|
|
|
1902
1947
|
const { sessionId, ...resumeConfig } = config;
|
|
1903
1948
|
if (!sessionId) throw new Error("AHP resume requires sessionId");
|
|
1904
1949
|
return options.resumeSession({
|
|
1950
|
+
authentication,
|
|
1905
1951
|
sessionId,
|
|
1906
1952
|
config: resumeConfig,
|
|
1907
1953
|
signal: entry.controller.signal
|
|
1908
1954
|
});
|
|
1909
1955
|
}
|
|
1910
1956
|
return options.createSession({
|
|
1957
|
+
authentication,
|
|
1911
1958
|
config,
|
|
1912
1959
|
signal: entry.controller.signal
|
|
1913
1960
|
});
|
|
@@ -2054,6 +2101,7 @@ class CopilotClient {
|
|
|
2054
2101
|
let serverVersion;
|
|
2055
2102
|
try {
|
|
2056
2103
|
const connectParams = {
|
|
2104
|
+
entra: this.options.entra,
|
|
2057
2105
|
token: this.effectiveConnectionToken,
|
|
2058
2106
|
supportedTaskKinds: ["agent", "client", "shell"]
|
|
2059
2107
|
};
|
|
@@ -2068,6 +2116,9 @@ class CopilotClient {
|
|
|
2068
2116
|
serverVersion = result.protocolVersion;
|
|
2069
2117
|
} catch (err) {
|
|
2070
2118
|
if (err instanceof import_node.ResponseError && (err.code === import_node.ErrorCodes.MethodNotFound || err.message === "Unhandled method connect")) {
|
|
2119
|
+
if (this.options.entra) {
|
|
2120
|
+
throw new Error("This runtime does not support Entra client configuration.");
|
|
2121
|
+
}
|
|
2071
2122
|
serverVersion = (await raceAgainstExit(this.ping())).protocolVersion;
|
|
2072
2123
|
} else {
|
|
2073
2124
|
throw err;
|
|
@@ -2354,9 +2405,6 @@ class CopilotClient {
|
|
|
2354
2405
|
this.options.sessionIdleTimeoutSeconds.toString()
|
|
2355
2406
|
);
|
|
2356
2407
|
}
|
|
2357
|
-
if (this.options.enableRemoteSessions) {
|
|
2358
|
-
args.push("--remote");
|
|
2359
|
-
}
|
|
2360
2408
|
const envWithoutNodeDebug = this.buildRuntimeEnv();
|
|
2361
2409
|
if (!this.resolvedCliPath) {
|
|
2362
2410
|
throw new Error(
|
|
@@ -2542,9 +2590,6 @@ stderr: ${this.stderrBuffer.trim().slice(-8192) || "(empty)"}`
|
|
|
2542
2590
|
if (this.options.sessionIdleTimeoutSeconds > 0) {
|
|
2543
2591
|
args.push("--session-idle-timeout", this.options.sessionIdleTimeoutSeconds.toString());
|
|
2544
2592
|
}
|
|
2545
|
-
if (this.options.enableRemoteSessions) {
|
|
2546
|
-
args.push("--remote");
|
|
2547
|
-
}
|
|
2548
2593
|
if (cliLoginSyncIntegrationId) {
|
|
2549
2594
|
args.push(`--cli-login-sync-integration-id=${cliLoginSyncIntegrationId}`);
|
|
2550
2595
|
}
|
|
@@ -2720,6 +2765,49 @@ stderr: ${stderrOutput}` : ""}`
|
|
|
2720
2765
|
"host.materializeSession",
|
|
2721
2766
|
(params) => this.createHostSession(params)
|
|
2722
2767
|
);
|
|
2768
|
+
this.connection.onRequest(
|
|
2769
|
+
"host.validateAuthentication",
|
|
2770
|
+
async (params) => {
|
|
2771
|
+
const authenticator = this.hostAuthenticators.get(params.hostId);
|
|
2772
|
+
if (!authenticator || this.hostAuthentications.has(params.requestId)) {
|
|
2773
|
+
throw new Error("AHP authenticator is unavailable or request already exists");
|
|
2774
|
+
}
|
|
2775
|
+
const entry = { hostId: params.hostId, controller: new AbortController() };
|
|
2776
|
+
this.hostAuthentications.set(params.requestId, entry);
|
|
2777
|
+
const signal = entry.controller.signal;
|
|
2778
|
+
const cancelled = new Promise((_resolve, reject) => {
|
|
2779
|
+
signal.addEventListener(
|
|
2780
|
+
"abort",
|
|
2781
|
+
() => reject(new Error("AHP authentication ended")),
|
|
2782
|
+
{ once: true }
|
|
2783
|
+
);
|
|
2784
|
+
});
|
|
2785
|
+
try {
|
|
2786
|
+
const result = await Promise.race([
|
|
2787
|
+
Promise.resolve().then(
|
|
2788
|
+
() => authenticator.authenticate({ token: params.token, signal })
|
|
2789
|
+
),
|
|
2790
|
+
cancelled
|
|
2791
|
+
]);
|
|
2792
|
+
if (signal.aborted || this.hostAuthenticators.get(params.hostId) !== authenticator) {
|
|
2793
|
+
throw new Error("AHP authentication ended");
|
|
2794
|
+
}
|
|
2795
|
+
return result;
|
|
2796
|
+
} finally {
|
|
2797
|
+
if (this.hostAuthentications.get(params.requestId) === entry) {
|
|
2798
|
+
this.hostAuthentications.delete(params.requestId);
|
|
2799
|
+
}
|
|
2800
|
+
entry.controller.abort();
|
|
2801
|
+
}
|
|
2802
|
+
}
|
|
2803
|
+
);
|
|
2804
|
+
this.connection.onNotification(
|
|
2805
|
+
"host.authenticationCancelled",
|
|
2806
|
+
(params) => {
|
|
2807
|
+
const entry = this.hostAuthentications.get(params.requestId);
|
|
2808
|
+
if (entry?.hostId === params.hostId) entry.controller.abort();
|
|
2809
|
+
}
|
|
2810
|
+
);
|
|
2723
2811
|
this.connection.onNotification(
|
|
2724
2812
|
"host.sessionReleased",
|
|
2725
2813
|
(params) => {
|
|
@@ -232,7 +232,15 @@ function createServerRpc(connection) {
|
|
|
232
232
|
*
|
|
233
233
|
* @returns Empty acknowledgement for a completed host lifecycle operation.
|
|
234
234
|
*/
|
|
235
|
-
dispose: async (params) => connection.sendRequest("host.dispose", params)
|
|
235
|
+
dispose: async (params) => connection.sendRequest("host.dispose", params),
|
|
236
|
+
/**
|
|
237
|
+
* Changes remote creation admission on a host owned by this SDK connection without disconnecting clients. Acknowledgement means subsequent admissions use the new policy; already-admitted creation may complete.
|
|
238
|
+
*
|
|
239
|
+
* @param params Changes remote session creation admission without disconnecting clients.
|
|
240
|
+
*
|
|
241
|
+
* @returns Empty acknowledgement for a completed host lifecycle operation.
|
|
242
|
+
*/
|
|
243
|
+
setSessionCreationPolicy: async (params) => connection.sendRequest("host.setSessionCreationPolicy", params)
|
|
236
244
|
},
|
|
237
245
|
/**
|
|
238
246
|
* Checks server responsiveness and returns protocol information.
|
|
@@ -1702,6 +1710,28 @@ function createInternalServerRpc(connection) {
|
|
|
1702
1710
|
* @returns Normalized listener settings delivered only to the supervised hosting participant.
|
|
1703
1711
|
*/
|
|
1704
1712
|
getConfiguration: async () => connection.sendRequest("host.getConfiguration", {}),
|
|
1713
|
+
/**
|
|
1714
|
+
* Resolves the host account credential without applying Mission Control transport policy, only for its supervised GitHub hosting participant.
|
|
1715
|
+
*
|
|
1716
|
+
* @returns Private credentials delivered only to a runtime-owned Mission Control hosting participant.
|
|
1717
|
+
*/
|
|
1718
|
+
getAuthenticationCredentials: async () => connection.sendRequest("host.getAuthenticationCredentials", {}),
|
|
1719
|
+
/**
|
|
1720
|
+
* Validates a decrypted admission credential through the owning application, only for its supervised custom-authentication participant.
|
|
1721
|
+
*
|
|
1722
|
+
* @param params A decrypted credential presented by a supervised hosting participant.
|
|
1723
|
+
*
|
|
1724
|
+
* @returns Validated admission credential, or null when the application rejects it.
|
|
1725
|
+
*/
|
|
1726
|
+
authenticate: async (params) => connection.sendRequest("host.authenticate", params),
|
|
1727
|
+
/**
|
|
1728
|
+
* Cancels a supervised participant's pending admission validation.
|
|
1729
|
+
*
|
|
1730
|
+
* @param params Cancels a pending validation on the supervised participant's connection.
|
|
1731
|
+
*
|
|
1732
|
+
* @returns Empty acknowledgement for a completed host lifecycle operation.
|
|
1733
|
+
*/
|
|
1734
|
+
cancelAuthentication: async (params) => connection.sendRequest("host.cancelAuthentication", params),
|
|
1705
1735
|
/**
|
|
1706
1736
|
* Reports a supervised hosting participant's bound AHP endpoint after its SDK handshake.
|
|
1707
1737
|
*
|
|
@@ -3560,7 +3590,13 @@ function createSessionRpc(connection, sessionId) {
|
|
|
3560
3590
|
*/
|
|
3561
3591
|
set: async (params) => connection.sendRequest("session.tools.set", { ...params, sessionId }),
|
|
3562
3592
|
/**
|
|
3563
|
-
*
|
|
3593
|
+
* Returns the session's live subagent settings override, or the current persisted user settings when no override is active. Returns null in subagents when no settings block exists; defaults, model inheritance, and billing limits are not resolved. Persisted settings are loaded strictly, including before the first turn, and loading errors are reported. Reading does not change the session or persist settings. Read-modify-write with updateSubagentSettings is not atomic; writing back creates a live override that ignores later persisted changes until cleared.
|
|
3594
|
+
*
|
|
3595
|
+
* @returns Current configured subagent settings for the session, before resolving defaults or inheritance.
|
|
3596
|
+
*/
|
|
3597
|
+
getSubagentSettings: async () => connection.sendRequest("session.tools.getSubagentSettings", { sessionId }),
|
|
3598
|
+
/**
|
|
3599
|
+
* Replaces the current session's complete live subagent settings override; nested fields are not merged. The override takes precedence over persisted user settings until cleared. Persisted user settings remain the source of truth for future sessions.
|
|
3564
3600
|
*
|
|
3565
3601
|
* @param params Subagent settings to apply to the current session
|
|
3566
3602
|
*
|
|
@@ -4320,6 +4356,16 @@ function createSessionRpc(connection, sessionId) {
|
|
|
4320
4356
|
}
|
|
4321
4357
|
function createInternalSessionRpc(connection, sessionId) {
|
|
4322
4358
|
return {
|
|
4359
|
+
/**
|
|
4360
|
+
* Submits one message through normal admission and waits for its request-owned completion. Returns the exact root assistant event, or an explicit aborted/no-response outcome. Cancelling or timing out the wait does not abort agent work. Unsupported execution hosts reject the method before admitting the message.
|
|
4361
|
+
*
|
|
4362
|
+
* @param params Parameters for sending a user message to the session
|
|
4363
|
+
*
|
|
4364
|
+
* @returns Internal request-correlated completion of one submitted message.
|
|
4365
|
+
*
|
|
4366
|
+
* @experimental
|
|
4367
|
+
*/
|
|
4368
|
+
sendAndWait: async (params) => connection.sendRequest("session.sendAndWait", { ...params, sessionId }),
|
|
4323
4369
|
/**
|
|
4324
4370
|
* Queues or sends an internal system notification to the session according to its passive policy.
|
|
4325
4371
|
*
|
package/dist/cjs/host.js
CHANGED
|
@@ -23,11 +23,12 @@ __export(host_exports, {
|
|
|
23
23
|
module.exports = __toCommonJS(host_exports);
|
|
24
24
|
class AhpHost {
|
|
25
25
|
/** @internal */
|
|
26
|
-
constructor(info, disposeHost, publishHostSession, listHostSessions, unpublishHostSession) {
|
|
26
|
+
constructor(info, disposeHost, publishHostSession, listHostSessions, unpublishHostSession, updateCreationPolicy) {
|
|
27
27
|
this.disposeHost = disposeHost;
|
|
28
28
|
this.publishHostSession = publishHostSession;
|
|
29
29
|
this.listHostSessions = listHostSessions;
|
|
30
30
|
this.unpublishHostSession = unpublishHostSession;
|
|
31
|
+
this.updateCreationPolicy = updateCreationPolicy;
|
|
31
32
|
this.hostId = info.hostId;
|
|
32
33
|
this.url = info.url;
|
|
33
34
|
this.environmentId = info.environmentId;
|
|
@@ -38,6 +39,7 @@ class AhpHost {
|
|
|
38
39
|
publishHostSession;
|
|
39
40
|
listHostSessions;
|
|
40
41
|
unpublishHostSession;
|
|
42
|
+
updateCreationPolicy;
|
|
41
43
|
hostId;
|
|
42
44
|
/** Local WebSocket URL. Absent when only the GitHub environment is enabled. */
|
|
43
45
|
url;
|
|
@@ -51,6 +53,10 @@ class AhpHost {
|
|
|
51
53
|
dispose() {
|
|
52
54
|
return this.disposeHost();
|
|
53
55
|
}
|
|
56
|
+
/** Change subsequent remote admissions without disconnecting clients; admitted creation may finish. */
|
|
57
|
+
setAllowCreatingNewSessions(allowed) {
|
|
58
|
+
return this.updateCreationPolicy(allowed);
|
|
59
|
+
}
|
|
54
60
|
/** Publish an attached application session into the durable compute-scoped host catalog. */
|
|
55
61
|
publishSession(sessionId) {
|
|
56
62
|
return this.publishHostSession(sessionId);
|