@github/copilot-sdk-win32-x64 1.0.15-preview.3 → 1.0.15-preview.4
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/copilot-sdk/client.d.ts +1 -0
- package/copilot-sdk/docs/extensions.md +0 -1
- package/copilot-sdk/docs/workflows.md +2 -4
- package/copilot-sdk/extension.d.ts +10 -24
- package/copilot-sdk/extension.js +402 -846
- package/copilot-sdk/generated/rpc.d.ts +5960 -4645
- package/copilot-sdk/generated/session-events.d.ts +197 -118
- package/copilot-sdk/index.d.ts +2 -4
- package/copilot-sdk/index.js +392 -832
- package/copilot-sdk/installationConfirmation.d.ts +19 -0
- package/copilot-sdk/session.d.ts +2 -25
- package/copilot-sdk/types.d.ts +10 -65
- package/copilot-sdk/workflow.d.ts +5 -2
- package/package.json +1 -1
- package/prebuilds/win32-x64/OneAuthInterop.dll +0 -0
- package/prebuilds/win32-x64/copilot-runtime.exe +0 -0
- package/prebuilds/win32-x64/runtime.node +2 -2
- package/ripgrep/bin/win32-x64/rg.exe +0 -0
- package/schemas/api.schema.json +18134 -16248
- package/schemas/session-events.schema.json +932 -842
- package/tgrep/bin/win32-x64/tgrep.exe +0 -0
- package/copilot-sdk/docs/factories.md +0 -296
- package/copilot-sdk/docs/factory-patterns.md +0 -194
- package/copilot-sdk/factory.d.ts +0 -327
- package/prebuilds/win32-x64/msal-node-runtime.node +0 -0
- package/prebuilds/win32-x64/msalruntime.dll +0 -0
package/copilot-sdk/index.js
CHANGED
|
@@ -115,7 +115,7 @@ var require_messages = __commonJS({
|
|
|
115
115
|
ErrorCodes4.jsonrpcReservedErrorRangeEnd = -32e3;
|
|
116
116
|
ErrorCodes4.serverErrorEnd = -32e3;
|
|
117
117
|
})(ErrorCodes3 || (exports.ErrorCodes = ErrorCodes3 = {}));
|
|
118
|
-
var
|
|
118
|
+
var ResponseError4 = class _ResponseError extends Error {
|
|
119
119
|
constructor(code, message, data) {
|
|
120
120
|
super(message);
|
|
121
121
|
this.code = is.number(code) ? code : ErrorCodes3.UnknownErrorCode;
|
|
@@ -133,7 +133,7 @@ var require_messages = __commonJS({
|
|
|
133
133
|
return result;
|
|
134
134
|
}
|
|
135
135
|
};
|
|
136
|
-
exports.ResponseError =
|
|
136
|
+
exports.ResponseError = ResponseError4;
|
|
137
137
|
var ParameterStructures = class _ParameterStructures {
|
|
138
138
|
constructor(kind) {
|
|
139
139
|
this.kind = kind;
|
|
@@ -933,7 +933,7 @@ var require_cancellation = __commonJS({
|
|
|
933
933
|
}
|
|
934
934
|
}
|
|
935
935
|
};
|
|
936
|
-
var
|
|
936
|
+
var CancellationTokenSource2 = class {
|
|
937
937
|
get token() {
|
|
938
938
|
if (!this._token) {
|
|
939
939
|
this._token = new MutableToken();
|
|
@@ -955,7 +955,7 @@ var require_cancellation = __commonJS({
|
|
|
955
955
|
}
|
|
956
956
|
}
|
|
957
957
|
};
|
|
958
|
-
exports.CancellationTokenSource =
|
|
958
|
+
exports.CancellationTokenSource = CancellationTokenSource2;
|
|
959
959
|
}
|
|
960
960
|
});
|
|
961
961
|
|
|
@@ -4031,7 +4031,7 @@ var init_ffiRuntimeHost = __esm({
|
|
|
4031
4031
|
});
|
|
4032
4032
|
|
|
4033
4033
|
// src/sdk/nodejs/dist/client.js
|
|
4034
|
-
var
|
|
4034
|
+
var import_node3 = __toESM(require_node(), 1);
|
|
4035
4035
|
import { spawn } from "node:child_process";
|
|
4036
4036
|
import { randomUUID } from "node:crypto";
|
|
4037
4037
|
import { existsSync as existsSync3 } from "node:fs";
|
|
@@ -4209,7 +4209,74 @@ function createServerRpc(connection) {
|
|
|
4209
4209
|
*
|
|
4210
4210
|
* @returns Outcome of an mcp.planInstall call: either a normalised plan, or one typed refusal. Nothing is written in either case.
|
|
4211
4211
|
*/
|
|
4212
|
-
planInstall: async (params) => connection.sendRequest("mcp.planInstall", params)
|
|
4212
|
+
planInstall: async (params) => connection.sendRequest("mcp.planInstall", params),
|
|
4213
|
+
/**
|
|
4214
|
+
* Consumes a bound catalogue plan and retains one exact fully resolved personal remote MCP operation requiring no supplied values or configured secrets. Returns its runtime operation ID and original expiry before any confirmation, activation, writer initialisation or installation effect. Register the original connection, operation and selected-session binding before calling applyInstall. Missing lower owned admission is unavailable, never a raw-config fallback.
|
|
4215
|
+
*
|
|
4216
|
+
* @param params Side-effect-free preparation of one original bound remote MCP choice.
|
|
4217
|
+
*
|
|
4218
|
+
* @returns Management result with contract receipt, or a typed request/negotiation refusal.
|
|
4219
|
+
*/
|
|
4220
|
+
prepareInstall: async (params) => connection.sendRequest("mcp.prepareInstall", params),
|
|
4221
|
+
/**
|
|
4222
|
+
* Consumes a retained prepared MCP operation once, revalidates its original authority, requests explicit human consent through installations.confirm on the original connection, then revalidates source and applies the sealed transaction. An uncertain result requires original-operation inspection or recovery, never replay.
|
|
4223
|
+
*
|
|
4224
|
+
* @param params Applies exactly one previously prepared operation on its original connection.
|
|
4225
|
+
*
|
|
4226
|
+
* @returns An installation result together with the exact honoured contract, or a negotiation refusal.
|
|
4227
|
+
*/
|
|
4228
|
+
applyInstall: async (params) => connection.sendRequest("mcp.applyInstall", params),
|
|
4229
|
+
/**
|
|
4230
|
+
* Prepares a read-only removal plan for an exact owned receipt under the selected existing session. Returns the original operation ID before confirmation; neither planning nor abandonment changes configuration or shared OAuth credentials.
|
|
4231
|
+
*
|
|
4232
|
+
* @param params Read-only preparation of one owned removal under fresh selected-session authority.
|
|
4233
|
+
*
|
|
4234
|
+
* @returns Management result with contract receipt, or a typed request/negotiation refusal.
|
|
4235
|
+
*/
|
|
4236
|
+
planUninstall: async (params) => connection.sendRequest("mcp.planUninstall", params),
|
|
4237
|
+
/**
|
|
4238
|
+
* Consumes the original owned-removal plan once and requests fresh exact human confirmation on its original connection. Drift is refused; unrelated manual configuration and shared OAuth credentials are preserved.
|
|
4239
|
+
*
|
|
4240
|
+
* @param params One-use application of the exact retained removal plan.
|
|
4241
|
+
*
|
|
4242
|
+
* @returns An installation result together with the exact honoured contract, or a negotiation refusal.
|
|
4243
|
+
*/
|
|
4244
|
+
applyUninstall: async (params) => connection.sendRequest("mcp.applyUninstall", params),
|
|
4245
|
+
/** @experimental */
|
|
4246
|
+
installations: {
|
|
4247
|
+
/**
|
|
4248
|
+
* Reads receipt-owned MCP inventory for the selected account and host without activating servers or reconstructing missing ownership. Configuration ownership does not prove session-specific usability.
|
|
4249
|
+
*
|
|
4250
|
+
* @param params New-work inventory or recovery request under an explicitly selected existing session.
|
|
4251
|
+
*
|
|
4252
|
+
* @returns Management result with contract receipt, or a typed request/negotiation refusal.
|
|
4253
|
+
*/
|
|
4254
|
+
list: async (params) => connection.sendRequest("mcp.installations.list", params),
|
|
4255
|
+
/**
|
|
4256
|
+
* Reconciles already-confirmed durable MCP transactions, then inspects owned inventory. Does not replay apply or reconstruct deleted ownership metadata; unresolved or unsafe evidence remains an explicit refusal.
|
|
4257
|
+
*
|
|
4258
|
+
* @param params New-work inventory or recovery request under an explicitly selected existing session.
|
|
4259
|
+
*
|
|
4260
|
+
* @returns Management result with contract receipt, or a typed request/negotiation refusal.
|
|
4261
|
+
*/
|
|
4262
|
+
recover: async (params) => connection.sendRequest("mcp.installations.recover", params),
|
|
4263
|
+
/**
|
|
4264
|
+
* Inspects a known operation only on its original connection. Remains available after account or selected-session loss; does not acquire new authority or rebind an operation.
|
|
4265
|
+
*
|
|
4266
|
+
* @param params Existing-operation control. A new session selector is deliberately not accepted.
|
|
4267
|
+
*
|
|
4268
|
+
* @returns Management result with contract receipt, or a typed request/negotiation refusal.
|
|
4269
|
+
*/
|
|
4270
|
+
status: async (params) => connection.sendRequest("mcp.installations.status", params),
|
|
4271
|
+
/**
|
|
4272
|
+
* Requests cancellation of a known operation on its original connection, including before apply or confirmation. Already-started effects retain their transaction lease and report an honest terminal or recovery outcome.
|
|
4273
|
+
*
|
|
4274
|
+
* @param params Existing-operation control. A new session selector is deliberately not accepted.
|
|
4275
|
+
*
|
|
4276
|
+
* @returns Management result with contract receipt, or a typed request/negotiation refusal.
|
|
4277
|
+
*/
|
|
4278
|
+
cancel: async (params) => connection.sendRequest("mcp.installations.cancel", params)
|
|
4279
|
+
}
|
|
4213
4280
|
},
|
|
4214
4281
|
/** @experimental */
|
|
4215
4282
|
extensions: {
|
|
@@ -4232,6 +4299,115 @@ function createServerRpc(connection) {
|
|
|
4232
4299
|
*/
|
|
4233
4300
|
disable: async (params) => connection.sendRequest("extensions.disable", params)
|
|
4234
4301
|
},
|
|
4302
|
+
/** @experimental */
|
|
4303
|
+
skills: {
|
|
4304
|
+
/**
|
|
4305
|
+
* Plans installation of a verified Agent Finder Skill candidate without writing files. The returned review is safe to present to a user and installing always leaves the Skill disabled until separately enabled.
|
|
4306
|
+
*
|
|
4307
|
+
* @param params Side-effect-free planning of one verified Agent Finder Skill candidate.
|
|
4308
|
+
*
|
|
4309
|
+
* @returns Skill installation management result with the honoured contract, or a typed refusal.
|
|
4310
|
+
*/
|
|
4311
|
+
planInstall: async (params) => connection.sendRequest("skills.planInstall", params),
|
|
4312
|
+
/**
|
|
4313
|
+
* Consumes one verified Skill installation plan, requests explicit human consent through installations.confirm on the original connection, then revalidates and installs the Skill disabled.
|
|
4314
|
+
*
|
|
4315
|
+
* @param params Applies exactly one retained verified Skill installation plan.
|
|
4316
|
+
*
|
|
4317
|
+
* @returns Skill installation result with the honoured contract, or a typed request/negotiation refusal.
|
|
4318
|
+
*/
|
|
4319
|
+
applyInstall: async (params) => connection.sendRequest("skills.applyInstall", params),
|
|
4320
|
+
/** @experimental */
|
|
4321
|
+
installations: {
|
|
4322
|
+
/**
|
|
4323
|
+
* Lists owned verified Agent Finder Skill installations for the selected existing session. Listing is never gated by the Skill-install feature flag.
|
|
4324
|
+
*
|
|
4325
|
+
* @param params Inventory request under an explicitly selected existing session.
|
|
4326
|
+
*
|
|
4327
|
+
* @returns Skill installation management result with the honoured contract, or a typed refusal.
|
|
4328
|
+
*/
|
|
4329
|
+
list: async (params) => connection.sendRequest("skills.installations.list", params),
|
|
4330
|
+
/**
|
|
4331
|
+
* Reconciles interrupted owned Skill installation work for the selected existing session, then inspects owned inventory. Recovery is never gated by the Skill-install feature flag.
|
|
4332
|
+
*
|
|
4333
|
+
* @param params Inventory request under an explicitly selected existing session.
|
|
4334
|
+
*
|
|
4335
|
+
* @returns Skill installation management result with the honoured contract, or a typed refusal.
|
|
4336
|
+
*/
|
|
4337
|
+
recover: async (params) => connection.sendRequest("skills.installations.recover", params),
|
|
4338
|
+
/**
|
|
4339
|
+
* Inspects a known Skill installation operation on its original runtime connection. Status is never gated by the Skill-install feature flag.
|
|
4340
|
+
*
|
|
4341
|
+
* @param params Existing-operation control. A new session selector is deliberately not accepted.
|
|
4342
|
+
*
|
|
4343
|
+
* @returns Skill installation management result with the honoured contract, or a typed refusal.
|
|
4344
|
+
*/
|
|
4345
|
+
status: async (params) => connection.sendRequest("skills.installations.status", params),
|
|
4346
|
+
/**
|
|
4347
|
+
* Requests cancellation of a known Skill installation operation before commit. Already-started durable work requires recovery instead of silent replay.
|
|
4348
|
+
*
|
|
4349
|
+
* @param params Existing-operation control. A new session selector is deliberately not accepted.
|
|
4350
|
+
*
|
|
4351
|
+
* @returns Skill installation management result with the honoured contract, or a typed refusal.
|
|
4352
|
+
*/
|
|
4353
|
+
cancel: async (params) => connection.sendRequest("skills.installations.cancel", params),
|
|
4354
|
+
/**
|
|
4355
|
+
* Atomically persists enablement for one owned Agent Finder Skill and reconciles the selected bound session. Enablement is installation-scoped by receipt identity and is never gated by the Skill-install feature flag.
|
|
4356
|
+
*
|
|
4357
|
+
* @param params Persisted enablement update for one owned Skill installation.
|
|
4358
|
+
*
|
|
4359
|
+
* @returns Skill installation management result with the honoured contract, or a typed refusal.
|
|
4360
|
+
*/
|
|
4361
|
+
setEnabled: async (params) => connection.sendRequest("skills.installations.setEnabled", params)
|
|
4362
|
+
},
|
|
4363
|
+
/**
|
|
4364
|
+
* Prepares a read-only removal plan for an owned verified Agent Finder Skill installation. Uninstall planning is never gated by the Skill-install feature flag.
|
|
4365
|
+
*
|
|
4366
|
+
* @param params Read-only preparation of one owned Skill removal under fresh selected-session authority.
|
|
4367
|
+
*
|
|
4368
|
+
* @returns Skill installation management result with the honoured contract, or a typed refusal.
|
|
4369
|
+
*/
|
|
4370
|
+
planUninstall: async (params) => connection.sendRequest("skills.planUninstall", params),
|
|
4371
|
+
/**
|
|
4372
|
+
* Consumes an owned Skill removal plan, requests explicit human consent through installations.confirm, refuses drift, and removes the exact owned files through quarantine.
|
|
4373
|
+
*
|
|
4374
|
+
* @param params One-use application of the exact retained Skill removal plan.
|
|
4375
|
+
*
|
|
4376
|
+
* @returns Skill installation result with the honoured contract, or a typed request/negotiation refusal.
|
|
4377
|
+
*/
|
|
4378
|
+
applyUninstall: async (params) => connection.sendRequest("skills.applyUninstall", params),
|
|
4379
|
+
/** @experimental */
|
|
4380
|
+
config: {
|
|
4381
|
+
/**
|
|
4382
|
+
* Replaces the global list of disabled skills.
|
|
4383
|
+
*
|
|
4384
|
+
* @param params Skill names to mark as disabled in global configuration, replacing any previous list.
|
|
4385
|
+
*/
|
|
4386
|
+
setDisabledSkills: async (params) => connection.sendRequest("skills.config.setDisabledSkills", params),
|
|
4387
|
+
/**
|
|
4388
|
+
* Atomically adds or removes one skill from the disabled list.
|
|
4389
|
+
*
|
|
4390
|
+
* @param params Adds or removes a single skill from the global disabled list, leaving every other entry untouched.
|
|
4391
|
+
*/
|
|
4392
|
+
setSkillDisabled: async (params) => connection.sendRequest("skills.config.setSkillDisabled", params)
|
|
4393
|
+
},
|
|
4394
|
+
/**
|
|
4395
|
+
* Discovers skills across global and project sources.
|
|
4396
|
+
*
|
|
4397
|
+
* @param params Optional project paths and additional skill directories to include in discovery.
|
|
4398
|
+
*
|
|
4399
|
+
* @returns Skills discovered across global and project sources.
|
|
4400
|
+
*/
|
|
4401
|
+
discover: async (params) => connection.sendRequest("skills.discover", params),
|
|
4402
|
+
/**
|
|
4403
|
+
* Returns the canonical directories where a client may create skills that the runtime will recognize, including ones that do not exist yet. Project directories become active once created.
|
|
4404
|
+
*
|
|
4405
|
+
* @param params Optional project paths to enumerate.
|
|
4406
|
+
*
|
|
4407
|
+
* @returns Canonical locations where skills can be created so the runtime will recognize them.
|
|
4408
|
+
*/
|
|
4409
|
+
getDiscoveryPaths: async (params) => connection.sendRequest("skills.getDiscoveryPaths", params)
|
|
4410
|
+
},
|
|
4235
4411
|
/**
|
|
4236
4412
|
* Registers the calling SDK client as the per-entrypoint extension launch provider. Call before creating any sessions. When omitted, the runtime uses its built-in extension launcher.
|
|
4237
4413
|
*
|
|
@@ -4357,40 +4533,6 @@ function createServerRpc(connection) {
|
|
|
4357
4533
|
}
|
|
4358
4534
|
},
|
|
4359
4535
|
/** @experimental */
|
|
4360
|
-
skills: {
|
|
4361
|
-
/** @experimental */
|
|
4362
|
-
config: {
|
|
4363
|
-
/**
|
|
4364
|
-
* Replaces the global list of disabled skills.
|
|
4365
|
-
*
|
|
4366
|
-
* @param params Skill names to mark as disabled in global configuration, replacing any previous list.
|
|
4367
|
-
*/
|
|
4368
|
-
setDisabledSkills: async (params) => connection.sendRequest("skills.config.setDisabledSkills", params),
|
|
4369
|
-
/**
|
|
4370
|
-
* Atomically adds or removes one skill from the disabled list.
|
|
4371
|
-
*
|
|
4372
|
-
* @param params Adds or removes a single skill from the global disabled list, leaving every other entry untouched.
|
|
4373
|
-
*/
|
|
4374
|
-
setSkillDisabled: async (params) => connection.sendRequest("skills.config.setSkillDisabled", params)
|
|
4375
|
-
},
|
|
4376
|
-
/**
|
|
4377
|
-
* Discovers skills across global and project sources.
|
|
4378
|
-
*
|
|
4379
|
-
* @param params Optional project paths and additional skill directories to include in discovery.
|
|
4380
|
-
*
|
|
4381
|
-
* @returns Skills discovered across global and project sources.
|
|
4382
|
-
*/
|
|
4383
|
-
discover: async (params) => connection.sendRequest("skills.discover", params),
|
|
4384
|
-
/**
|
|
4385
|
-
* Returns the canonical directories where a client may create skills that the runtime will recognize, including ones that do not exist yet. Project directories become active once created.
|
|
4386
|
-
*
|
|
4387
|
-
* @param params Optional project paths to enumerate.
|
|
4388
|
-
*
|
|
4389
|
-
* @returns Canonical locations where skills can be created so the runtime will recognize them.
|
|
4390
|
-
*/
|
|
4391
|
-
getDiscoveryPaths: async (params) => connection.sendRequest("skills.getDiscoveryPaths", params)
|
|
4392
|
-
},
|
|
4393
|
-
/** @experimental */
|
|
4394
4536
|
agents: {
|
|
4395
4537
|
/**
|
|
4396
4538
|
* Discovers custom agents across user, project, plugin, and remote sources.
|
|
@@ -4795,6 +4937,17 @@ function createInternalServerRpc(connection) {
|
|
|
4795
4937
|
* @param params Params to attach or detach an in-process ExtensionController delegate.
|
|
4796
4938
|
*/
|
|
4797
4939
|
configureSessionExtensions: async (params) => connection.sendRequest("sessions.configureSessionExtensions", params)
|
|
4940
|
+
},
|
|
4941
|
+
/** @experimental */
|
|
4942
|
+
accounts: {
|
|
4943
|
+
/**
|
|
4944
|
+
* Acquire a Microsoft Entra access token through the runtime's OneAuth broker. Account-scoped because it uses the same native broker as the account stack: a trusted host application mints a scoped Entra token for its own use, most notably to authenticate to a remote MCP server whose authorization server is Entra ID (in place of the generic browser-OAuth flow).
|
|
4945
|
+
*
|
|
4946
|
+
* @param params OneAuth token request supplied by a trusted host application.
|
|
4947
|
+
*
|
|
4948
|
+
* @returns Result of a OneAuth token acquisition.
|
|
4949
|
+
*/
|
|
4950
|
+
acquireEntraToken: async (params) => connection.sendRequest("accounts.acquireEntraToken", params)
|
|
4798
4951
|
}
|
|
4799
4952
|
};
|
|
4800
4953
|
}
|
|
@@ -4897,6 +5050,58 @@ function createSessionRpc(connection, sessionId) {
|
|
|
4897
5050
|
setCredentials: async (params) => connection.sendRequest("session.gitHubAuth.setCredentials", { sessionId, ...params })
|
|
4898
5051
|
},
|
|
4899
5052
|
/** @experimental */
|
|
5053
|
+
accounts: {
|
|
5054
|
+
/**
|
|
5055
|
+
* Enumerate a typed accounts collection: the signed-in accounts, or the providers offered for interactive login.
|
|
5056
|
+
*
|
|
5057
|
+
* @param params Enumerate request carrying the typed collection query.
|
|
5058
|
+
*
|
|
5059
|
+
* @returns The enumerated collection, keyed by the same selector as the query.
|
|
5060
|
+
*/
|
|
5061
|
+
enumerate: async (params) => connection.sendRequest("session.accounts.enumerate", { sessionId, ...params }),
|
|
5062
|
+
/**
|
|
5063
|
+
* Read one typed accounts datum: the active account, a neutral status summary, or the last authentication errors.
|
|
5064
|
+
*
|
|
5065
|
+
* @param params Read request carrying the typed datum query.
|
|
5066
|
+
*
|
|
5067
|
+
* @returns The read result, keyed by the same selector as the query.
|
|
5068
|
+
*/
|
|
5069
|
+
get: async (params) => connection.sendRequest("session.accounts.get", { sessionId, ...params }),
|
|
5070
|
+
/**
|
|
5071
|
+
* Apply one non-interactive accounts mutation: switch the active account, log an account out, or set credentials from a token.
|
|
5072
|
+
*
|
|
5073
|
+
* @param params Mutation request carrying the typed write command.
|
|
5074
|
+
*
|
|
5075
|
+
* @returns Result of a non-interactive accounts mutation.
|
|
5076
|
+
*/
|
|
5077
|
+
set: async (params) => connection.sendRequest("session.accounts.set", { sessionId, ...params }),
|
|
5078
|
+
/** @experimental */
|
|
5079
|
+
login: {
|
|
5080
|
+
/**
|
|
5081
|
+
* Begin an interactive login flow for a provider kind (dispatch is kind-only) and return its opaque flow id and first step.
|
|
5082
|
+
*
|
|
5083
|
+
* @param params Begin an interactive login flow for a provider kind. Dispatch is kind-only.
|
|
5084
|
+
*
|
|
5085
|
+
* @returns A started login flow: its opaque id and first step.
|
|
5086
|
+
*/
|
|
5087
|
+
begin: async (params) => connection.sendRequest("session.accounts.login.begin", { sessionId, ...params }),
|
|
5088
|
+
/**
|
|
5089
|
+
* Advance an in-flight login flow, optionally fulfilling an input-required step, and return the next step.
|
|
5090
|
+
*
|
|
5091
|
+
* @param params Advance an in-flight login flow, optionally fulfilling an input-required step.
|
|
5092
|
+
*
|
|
5093
|
+
* @returns One step in an interactive login flow. The consumer acts on the step and calls advance to proceed. Browser-open is encoded as two distinct steps by design: `open-url` is CONSUMER-driven (the provider surfaces the authorize URL and the consumer opens it — github.com/GHEC web), while `needs-interaction` is PROVIDER-driven (the provider opens the browser or broker UI itself and does not surface a URL — Entra).
|
|
5094
|
+
*/
|
|
5095
|
+
advance: async (params) => connection.sendRequest("session.accounts.login.advance", { sessionId, ...params }),
|
|
5096
|
+
/**
|
|
5097
|
+
* Cancel an in-flight login flow and release its resources.
|
|
5098
|
+
*
|
|
5099
|
+
* @param params Cancel an in-flight login flow.
|
|
5100
|
+
*/
|
|
5101
|
+
cancel: async (params) => connection.sendRequest("session.accounts.login.cancel", { sessionId, ...params })
|
|
5102
|
+
}
|
|
5103
|
+
},
|
|
5104
|
+
/** @experimental */
|
|
4900
5105
|
debug: {
|
|
4901
5106
|
/**
|
|
4902
5107
|
* Collects a session debug log bundle into a local archive or staging directory. Logs are redacted by default; redaction can be configured per caller-provided diagnostic entry. 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.
|
|
@@ -4948,108 +5153,6 @@ function createSessionRpc(connection, sessionId) {
|
|
|
4948
5153
|
}
|
|
4949
5154
|
},
|
|
4950
5155
|
/** @experimental */
|
|
4951
|
-
factory: {
|
|
4952
|
-
/**
|
|
4953
|
-
* Runs a registered factory by name at the top level.
|
|
4954
|
-
*
|
|
4955
|
-
* @param params Parameters for invoking a registered factory.
|
|
4956
|
-
*
|
|
4957
|
-
* @returns Complete current or terminal factory run envelope.
|
|
4958
|
-
*/
|
|
4959
|
-
run: async (params) => connection.sendRequest("session.factory.run", { sessionId, ...params }),
|
|
4960
|
-
/**
|
|
4961
|
-
* Resumes a factory run using its persisted name, arguments, journal, and accounting.
|
|
4962
|
-
*
|
|
4963
|
-
* @param params Parameters for resuming a factory run from its persisted identity.
|
|
4964
|
-
*
|
|
4965
|
-
* @returns Resolved persisted factory identity and resumed run envelope.
|
|
4966
|
-
*/
|
|
4967
|
-
resume: async (params) => connection.sendRequest("session.factory.resume", { sessionId, ...params }),
|
|
4968
|
-
/**
|
|
4969
|
-
* Gets the current or settled envelope for a factory run.
|
|
4970
|
-
*
|
|
4971
|
-
* @param params Parameters for retrieving a factory run.
|
|
4972
|
-
*
|
|
4973
|
-
* @returns Complete current or terminal factory run envelope.
|
|
4974
|
-
*/
|
|
4975
|
-
getRun: async (params) => connection.sendRequest("session.factory.getRun", { sessionId, ...params }),
|
|
4976
|
-
/**
|
|
4977
|
-
* Lists durable factory runs for this session in creation order.
|
|
4978
|
-
*
|
|
4979
|
-
* @param params Parameters for paging factory runs.
|
|
4980
|
-
*
|
|
4981
|
-
* @returns A page of factory runs in durable creation order.
|
|
4982
|
-
*/
|
|
4983
|
-
listRuns: async (params) => connection.sendRequest("session.factory.listRuns", { sessionId, ...params }),
|
|
4984
|
-
/**
|
|
4985
|
-
* Gets durable and live observability detail for one factory run.
|
|
4986
|
-
*
|
|
4987
|
-
* @param params Parameters for retrieving a factory run.
|
|
4988
|
-
*
|
|
4989
|
-
* @returns Full factory run observability detail.
|
|
4990
|
-
*/
|
|
4991
|
-
getRunDetail: async (params) => connection.sendRequest("session.factory.getRunDetail", { sessionId, ...params }),
|
|
4992
|
-
/**
|
|
4993
|
-
* Pages durable progress for one factory run.
|
|
4994
|
-
*
|
|
4995
|
-
* @param params Parameters for paging factory progress.
|
|
4996
|
-
*
|
|
4997
|
-
* @returns A bidirectional page of factory progress.
|
|
4998
|
-
*/
|
|
4999
|
-
getRunProgress: async (params) => connection.sendRequest("session.factory.getRunProgress", { sessionId, ...params }),
|
|
5000
|
-
/**
|
|
5001
|
-
* Requests cancellation of a factory run and returns its run envelope.
|
|
5002
|
-
*
|
|
5003
|
-
* @param params Parameters for cancelling a factory run.
|
|
5004
|
-
*
|
|
5005
|
-
* @returns Complete current or terminal factory run envelope.
|
|
5006
|
-
*/
|
|
5007
|
-
cancel: async (params) => connection.sendRequest("session.factory.cancel", { sessionId, ...params }),
|
|
5008
|
-
/**
|
|
5009
|
-
* Pauses a running factory and returns its settled run envelope.
|
|
5010
|
-
*
|
|
5011
|
-
* @param params Parameters for pausing a running factory.
|
|
5012
|
-
*
|
|
5013
|
-
* @returns Complete current or terminal factory run envelope.
|
|
5014
|
-
*/
|
|
5015
|
-
pause: async (params) => connection.sendRequest("session.factory.pause", { sessionId, ...params }),
|
|
5016
|
-
/**
|
|
5017
|
-
* Records a batch of ordered factory progress lines.
|
|
5018
|
-
*
|
|
5019
|
-
* @param params Parameters for recording factory progress.
|
|
5020
|
-
*
|
|
5021
|
-
* @returns Acknowledgement that a factory request was accepted.
|
|
5022
|
-
*/
|
|
5023
|
-
log: async (params) => connection.sendRequest("session.factory.log", { sessionId, ...params }),
|
|
5024
|
-
/**
|
|
5025
|
-
* Runs one factory-scoped subagent and returns its result.
|
|
5026
|
-
*
|
|
5027
|
-
* @param params Parameters for one factory-scoped subagent call.
|
|
5028
|
-
*
|
|
5029
|
-
* @returns Result of one factory-scoped subagent call.
|
|
5030
|
-
*/
|
|
5031
|
-
agent: async (params) => connection.sendRequest("session.factory.agent", { sessionId, ...params }),
|
|
5032
|
-
/** @experimental */
|
|
5033
|
-
journal: {
|
|
5034
|
-
/**
|
|
5035
|
-
* Reads a memoized factory journal entry.
|
|
5036
|
-
*
|
|
5037
|
-
* @param params Parameters for reading a factory journal entry.
|
|
5038
|
-
*
|
|
5039
|
-
* @returns Result of reading a factory journal entry.
|
|
5040
|
-
*/
|
|
5041
|
-
get: async (params) => connection.sendRequest("session.factory.journal.get", { sessionId, ...params }),
|
|
5042
|
-
/**
|
|
5043
|
-
* Stores a memoized factory journal entry.
|
|
5044
|
-
*
|
|
5045
|
-
* @param params Parameters for storing a factory journal entry.
|
|
5046
|
-
*
|
|
5047
|
-
* @returns Acknowledgement that a factory request was accepted.
|
|
5048
|
-
*/
|
|
5049
|
-
put: async (params) => connection.sendRequest("session.factory.journal.put", { sessionId, ...params })
|
|
5050
|
-
}
|
|
5051
|
-
},
|
|
5052
|
-
/** @experimental */
|
|
5053
5156
|
workflow: {
|
|
5054
5157
|
/**
|
|
5055
5158
|
* Runs a registered dynamic workflow by name at the top level.
|
|
@@ -5759,7 +5862,15 @@ function createSessionRpc(connection, sessionId) {
|
|
|
5759
5862
|
*/
|
|
5760
5863
|
authenticationStateChanged: async (params) => connection.sendRequest("session.mcp.oauth.authenticationStateChanged", { sessionId, ...params }),
|
|
5761
5864
|
/**
|
|
5762
|
-
*
|
|
5865
|
+
* Prepares an inert, expiring owned OAuth login bound to the original session requester and exact installation. Does not activate, connect, read credentials or open a browser.
|
|
5866
|
+
*
|
|
5867
|
+
* @param params Effect-free preparation bound to the existing local session, requester and installation, with frozen options.
|
|
5868
|
+
*
|
|
5869
|
+
* @returns An inert runtime-issued login handle. Preparation alone performs no activation or OAuth work.
|
|
5870
|
+
*/
|
|
5871
|
+
prepareLogin: async (params) => connection.sendRequest("session.mcp.oauth.prepareLogin", { sessionId, ...params }),
|
|
5872
|
+
/**
|
|
5873
|
+
* Starts OAuth authentication for a remote MCP server. Owned servers require the original one-use prepareLogin handle and exact installation ID; manual servers retain the existing direct login behaviour.
|
|
5763
5874
|
*
|
|
5764
5875
|
* @param params Remote MCP server name and optional overrides controlling reauthentication, OAuth client display name, callback success-page copy, and static OAuth client selection.
|
|
5765
5876
|
*
|
|
@@ -5774,6 +5885,14 @@ function createSessionRpc(connection, sessionId) {
|
|
|
5774
5885
|
* @returns Passive MCP OAuth probe result. `authenticated` means the server accepted the probe request while an OAuth-origin access token was attached; it does not prove the server required or independently validated that token. The probe does not make a second unauthenticated request. Failed is an expected probe-domain outcome; JSON-RPC errors are reserved for API-call failures.
|
|
5775
5886
|
*/
|
|
5776
5887
|
probe: async (params) => connection.sendRequest("session.mcp.oauth.probe", { sessionId, ...params }),
|
|
5888
|
+
/**
|
|
5889
|
+
* Cancels the exact owned OAuth login issued to this original session requester, without clearing shared credentials.
|
|
5890
|
+
*
|
|
5891
|
+
* @param params Targets only the original prepared/applying owned login on this exact session requester.
|
|
5892
|
+
*
|
|
5893
|
+
* @returns Honest terminal cancellation result; persistence or recovery failures remain RPC errors.
|
|
5894
|
+
*/
|
|
5895
|
+
cancelLogin: async (params) => connection.sendRequest("session.mcp.oauth.cancelLogin", { sessionId, ...params }),
|
|
5777
5896
|
/**
|
|
5778
5897
|
* Responds to a pending MCP OAuth authorization request by its request id.
|
|
5779
5898
|
*
|
|
@@ -7012,31 +7131,6 @@ function createInternalSessionRpc(connection, sessionId) {
|
|
|
7012
7131
|
}
|
|
7013
7132
|
},
|
|
7014
7133
|
/** @experimental */
|
|
7015
|
-
factory: {
|
|
7016
|
-
/**
|
|
7017
|
-
* Internal tool-originated factory invocation.
|
|
7018
|
-
*
|
|
7019
|
-
* @param params Internal parameters for invoking a registered factory from a tool.
|
|
7020
|
-
*
|
|
7021
|
-
* @returns Complete current or terminal factory run envelope.
|
|
7022
|
-
*/
|
|
7023
|
-
runFromTool: async (params) => connection.sendRequest("session.factory.runFromTool", { sessionId, ...params }),
|
|
7024
|
-
/**
|
|
7025
|
-
* Internal tool-originated factory resume.
|
|
7026
|
-
*
|
|
7027
|
-
* @param params Internal parameters for resuming a factory run from a tool.
|
|
7028
|
-
*
|
|
7029
|
-
* @returns Resolved persisted factory identity and resumed run envelope.
|
|
7030
|
-
*/
|
|
7031
|
-
resumeFromTool: async (params) => connection.sendRequest("session.factory.resumeFromTool", { sessionId, ...params }),
|
|
7032
|
-
/**
|
|
7033
|
-
* Atomically pauses an owned factory attempt at a durable checkpoint.
|
|
7034
|
-
*
|
|
7035
|
-
* @param params Parameters for an owned durable pause checkpoint.
|
|
7036
|
-
*/
|
|
7037
|
-
pauseAtCheckpoint: async (params) => connection.sendRequest("session.factory.pauseAtCheckpoint", { sessionId, ...params })
|
|
7038
|
-
},
|
|
7039
|
-
/** @experimental */
|
|
7040
7134
|
workflow: {
|
|
7041
7135
|
/**
|
|
7042
7136
|
* Internal tool-originated dynamic workflow invocation.
|
|
@@ -7264,16 +7358,6 @@ function registerClientSessionApiHandlers(connection, getHandlers) {
|
|
|
7264
7358
|
if (!handler) throw new Error(`No providerToken handler registered for session: ${params.sessionId}`);
|
|
7265
7359
|
return handler.getToken(params);
|
|
7266
7360
|
});
|
|
7267
|
-
connection.onRequest("factory.execute", async (params) => {
|
|
7268
|
-
const handler = getHandlers(params.sessionId).factory;
|
|
7269
|
-
if (!handler) throw new Error(`No factory handler registered for session: ${params.sessionId}`);
|
|
7270
|
-
return handler.execute(params);
|
|
7271
|
-
});
|
|
7272
|
-
connection.onRequest("factory.abort", async (params) => {
|
|
7273
|
-
const handler = getHandlers(params.sessionId).factory;
|
|
7274
|
-
if (!handler) throw new Error(`No factory handler registered for session: ${params.sessionId}`);
|
|
7275
|
-
return handler.abort(params);
|
|
7276
|
-
});
|
|
7277
7361
|
connection.onRequest("workflow.execute", async (params) => {
|
|
7278
7362
|
const handler = getHandlers(params.sessionId).workflow;
|
|
7279
7363
|
if (!handler) throw new Error(`No workflow handler registered for session: ${params.sessionId}`);
|
|
@@ -7396,6 +7480,11 @@ function registerClientGlobalApiHandlers(connection, handlers) {
|
|
|
7396
7480
|
if (!handler) throw new Error("No gitHubToken client-global handler registered");
|
|
7397
7481
|
return handler.getToken(params);
|
|
7398
7482
|
});
|
|
7483
|
+
connection.onRequest("installations.confirm", async (params) => {
|
|
7484
|
+
const handler = handlers.installations;
|
|
7485
|
+
if (!handler) throw new Error("No installations client-global handler registered");
|
|
7486
|
+
return handler.confirm(params);
|
|
7487
|
+
});
|
|
7399
7488
|
}
|
|
7400
7489
|
|
|
7401
7490
|
// src/sdk/nodejs/dist/sdkProtocolVersion.js
|
|
@@ -8524,109 +8613,8 @@ var DisableBypassPermissionsModes = {
|
|
|
8524
8613
|
AllowAutoOnly: "allow-auto-only"
|
|
8525
8614
|
};
|
|
8526
8615
|
|
|
8527
|
-
// src/sdk/nodejs/dist/
|
|
8528
|
-
var
|
|
8529
|
-
"completed",
|
|
8530
|
-
"halted",
|
|
8531
|
-
"paused",
|
|
8532
|
-
"cancelled",
|
|
8533
|
-
"error"
|
|
8534
|
-
]);
|
|
8535
|
-
function isFactoryRunTerminal(status) {
|
|
8536
|
-
return FACTORY_TERMINAL_STATUSES.has(status);
|
|
8537
|
-
}
|
|
8538
|
-
var FACTORY_AGENT_OPTION_KEYS = [
|
|
8539
|
-
"label",
|
|
8540
|
-
"schema",
|
|
8541
|
-
"model",
|
|
8542
|
-
"reasoningEffort",
|
|
8543
|
-
"contextTier",
|
|
8544
|
-
"agent"
|
|
8545
|
-
];
|
|
8546
|
-
var FactoryResumeError = class extends Error {
|
|
8547
|
-
constructor(code, message) {
|
|
8548
|
-
super(message);
|
|
8549
|
-
this.code = code;
|
|
8550
|
-
this.name = "FactoryResumeError";
|
|
8551
|
-
}
|
|
8552
|
-
code;
|
|
8553
|
-
};
|
|
8554
|
-
var factoryHandles = /* @__PURE__ */ new WeakMap();
|
|
8555
|
-
var MAX_FACTORY_TIMEOUT_SECONDS = 2147483647e-3;
|
|
8556
|
-
var NANO_AIU_PER_AIU = 1e9;
|
|
8557
|
-
function deepFreeze(value) {
|
|
8558
|
-
if (value !== null && typeof value === "object" && !Object.isFrozen(value)) {
|
|
8559
|
-
Object.freeze(value);
|
|
8560
|
-
for (const nested of Object.values(value)) {
|
|
8561
|
-
deepFreeze(nested);
|
|
8562
|
-
}
|
|
8563
|
-
}
|
|
8564
|
-
return value;
|
|
8565
|
-
}
|
|
8566
|
-
function validateLimits(meta) {
|
|
8567
|
-
const limits = meta.limits;
|
|
8568
|
-
if (!limits) {
|
|
8569
|
-
return;
|
|
8570
|
-
}
|
|
8571
|
-
for (const field of ["maxConcurrentSubagents", "maxTotalSubagents"]) {
|
|
8572
|
-
const value = limits[field];
|
|
8573
|
-
if (value !== void 0 && (!Number.isInteger(value) || value <= 0)) {
|
|
8574
|
-
throw new Error(`Factory limit "${field}" must be a positive integer`);
|
|
8575
|
-
}
|
|
8576
|
-
}
|
|
8577
|
-
if (limits.timeoutSeconds !== void 0 && (!Number.isFinite(limits.timeoutSeconds) || limits.timeoutSeconds <= 0)) {
|
|
8578
|
-
throw new Error(
|
|
8579
|
-
'Factory limit "timeoutSeconds" must be a positive, finite number of seconds'
|
|
8580
|
-
);
|
|
8581
|
-
}
|
|
8582
|
-
if (limits.timeoutSeconds !== void 0 && limits.timeoutSeconds > MAX_FACTORY_TIMEOUT_SECONDS) {
|
|
8583
|
-
throw new Error(
|
|
8584
|
-
`Factory limit "timeoutSeconds" must not exceed ${MAX_FACTORY_TIMEOUT_SECONDS} seconds`
|
|
8585
|
-
);
|
|
8586
|
-
}
|
|
8587
|
-
if (limits.maxAiCredits !== void 0) {
|
|
8588
|
-
const maxNanoAiu = Math.round(limits.maxAiCredits * NANO_AIU_PER_AIU);
|
|
8589
|
-
if (!Number.isFinite(limits.maxAiCredits) || limits.maxAiCredits <= 0 || !Number.isSafeInteger(maxNanoAiu) || maxNanoAiu < 1) {
|
|
8590
|
-
throw new Error(
|
|
8591
|
-
'Factory limit "maxAiCredits" must be a positive, finite number that rounds to a safe positive integer nano-AIU ceiling'
|
|
8592
|
-
);
|
|
8593
|
-
}
|
|
8594
|
-
}
|
|
8595
|
-
}
|
|
8596
|
-
function validatePhases(meta) {
|
|
8597
|
-
const titles = /* @__PURE__ */ new Set();
|
|
8598
|
-
for (const phase of meta.phases) {
|
|
8599
|
-
if (phase.title.trim().length === 0) {
|
|
8600
|
-
throw new Error("Factory phase titles must not be empty");
|
|
8601
|
-
}
|
|
8602
|
-
if (titles.has(phase.title)) {
|
|
8603
|
-
throw new Error(`Factory phase title "${phase.title}" is declared more than once`);
|
|
8604
|
-
}
|
|
8605
|
-
titles.add(phase.title);
|
|
8606
|
-
}
|
|
8607
|
-
}
|
|
8608
|
-
function defineFactory(definition) {
|
|
8609
|
-
const meta = deepFreeze(structuredClone(definition.meta));
|
|
8610
|
-
validateLimits(meta);
|
|
8611
|
-
validatePhases(meta);
|
|
8612
|
-
const stored = {
|
|
8613
|
-
meta,
|
|
8614
|
-
run: definition.run
|
|
8615
|
-
};
|
|
8616
|
-
const handle = Object.freeze({ meta });
|
|
8617
|
-
factoryHandles.set(handle, stored);
|
|
8618
|
-
return handle;
|
|
8619
|
-
}
|
|
8620
|
-
function getFactoryDefinition(handle) {
|
|
8621
|
-
const definition = factoryHandles.get(handle);
|
|
8622
|
-
if (!definition) {
|
|
8623
|
-
throw new Error("Invalid factory handle");
|
|
8624
|
-
}
|
|
8625
|
-
return definition;
|
|
8626
|
-
}
|
|
8627
|
-
|
|
8628
|
-
// src/sdk/nodejs/dist/workflow.js
|
|
8629
|
-
var WORKFLOW_TERMINAL_STATUSES = /* @__PURE__ */ new Set([
|
|
8616
|
+
// src/sdk/nodejs/dist/workflow.js
|
|
8617
|
+
var WORKFLOW_TERMINAL_STATUSES = /* @__PURE__ */ new Set([
|
|
8630
8618
|
"completed",
|
|
8631
8619
|
"halted",
|
|
8632
8620
|
"paused",
|
|
@@ -8654,17 +8642,17 @@ var WorkflowResumeError = class extends Error {
|
|
|
8654
8642
|
};
|
|
8655
8643
|
var workflowHandles = /* @__PURE__ */ new WeakMap();
|
|
8656
8644
|
var MAX_WORKFLOW_TIMEOUT_SECONDS = 2147483647e-3;
|
|
8657
|
-
var
|
|
8658
|
-
function
|
|
8645
|
+
var NANO_AIU_PER_AIU = 1e9;
|
|
8646
|
+
function deepFreeze(value) {
|
|
8659
8647
|
if (value !== null && typeof value === "object" && !Object.isFrozen(value)) {
|
|
8660
8648
|
Object.freeze(value);
|
|
8661
8649
|
for (const nested of Object.values(value)) {
|
|
8662
|
-
|
|
8650
|
+
deepFreeze(nested);
|
|
8663
8651
|
}
|
|
8664
8652
|
}
|
|
8665
8653
|
return value;
|
|
8666
8654
|
}
|
|
8667
|
-
function
|
|
8655
|
+
function validateLimits(meta) {
|
|
8668
8656
|
const limits = meta.limits;
|
|
8669
8657
|
if (!limits) {
|
|
8670
8658
|
return;
|
|
@@ -8686,7 +8674,7 @@ function validateLimits2(meta) {
|
|
|
8686
8674
|
);
|
|
8687
8675
|
}
|
|
8688
8676
|
if (limits.maxAiCredits !== void 0) {
|
|
8689
|
-
const maxNanoAiu = Math.round(limits.maxAiCredits *
|
|
8677
|
+
const maxNanoAiu = Math.round(limits.maxAiCredits * NANO_AIU_PER_AIU);
|
|
8690
8678
|
if (!Number.isFinite(limits.maxAiCredits) || limits.maxAiCredits <= 0 || !Number.isSafeInteger(maxNanoAiu) || maxNanoAiu < 1) {
|
|
8691
8679
|
throw new Error(
|
|
8692
8680
|
'Workflow limit "maxAiCredits" must be a positive, finite number that rounds to a safe positive integer nano-AIU ceiling'
|
|
@@ -8694,7 +8682,7 @@ function validateLimits2(meta) {
|
|
|
8694
8682
|
}
|
|
8695
8683
|
}
|
|
8696
8684
|
}
|
|
8697
|
-
function
|
|
8685
|
+
function validatePhases(meta) {
|
|
8698
8686
|
const titles = /* @__PURE__ */ new Set();
|
|
8699
8687
|
for (const phase of meta.phases) {
|
|
8700
8688
|
if (phase.title.trim().length === 0) {
|
|
@@ -8707,9 +8695,9 @@ function validatePhases2(meta) {
|
|
|
8707
8695
|
}
|
|
8708
8696
|
}
|
|
8709
8697
|
function defineWorkflow(definition) {
|
|
8710
|
-
const meta =
|
|
8711
|
-
|
|
8712
|
-
|
|
8698
|
+
const meta = deepFreeze(structuredClone(definition.meta));
|
|
8699
|
+
validateLimits(meta);
|
|
8700
|
+
validatePhases(meta);
|
|
8713
8701
|
const stored = {
|
|
8714
8702
|
meta,
|
|
8715
8703
|
run: definition.run
|
|
@@ -8727,15 +8715,6 @@ function getWorkflowDefinition(handle) {
|
|
|
8727
8715
|
}
|
|
8728
8716
|
|
|
8729
8717
|
// src/sdk/nodejs/dist/session.js
|
|
8730
|
-
function isFactoryResumeErrorCode(value) {
|
|
8731
|
-
return value === "not_found" || value === "non_resumable" || value === "already_active" || value === "factory_already_running" || value === "factory_limits_invalid" || value === "factory_session_disposed" || value === "factory_storage_unavailable" || value === "factory_storage_corrupt";
|
|
8732
|
-
}
|
|
8733
|
-
function copyDefinedFactoryAgentOption(source, target, key) {
|
|
8734
|
-
const value = source[key];
|
|
8735
|
-
if (value !== void 0) {
|
|
8736
|
-
target[key] = value;
|
|
8737
|
-
}
|
|
8738
|
-
}
|
|
8739
8718
|
function isWorkflowResumeErrorCode(value) {
|
|
8740
8719
|
return value === "not_found" || value === "non_resumable" || value === "workflow_run_not_resumable" || value === "already_active" || value === "workflow_already_running" || value === "workflow_limits_invalid" || value === "workflow_session_disposed" || value === "workflow_storage_unavailable" || value === "workflow_storage_corrupt";
|
|
8741
8720
|
}
|
|
@@ -8745,14 +8724,6 @@ function copyDefinedWorkflowAgentOption(source, target, key) {
|
|
|
8745
8724
|
target[key] = value;
|
|
8746
8725
|
}
|
|
8747
8726
|
}
|
|
8748
|
-
var factoryExecutionStore = new AsyncLocalStorage();
|
|
8749
|
-
function throwIfFactoryExecutionIsActive() {
|
|
8750
|
-
if (factoryExecutionStore.getStore()?.active) {
|
|
8751
|
-
throw new Error(
|
|
8752
|
-
"factory.run, factory.resume, and factory.pause are not allowed while a factory body is running on this call path."
|
|
8753
|
-
);
|
|
8754
|
-
}
|
|
8755
|
-
}
|
|
8756
8727
|
var workflowExecutionStore = new AsyncLocalStorage();
|
|
8757
8728
|
function throwIfWorkflowExecutionIsActive() {
|
|
8758
8729
|
if (workflowExecutionStore.getStore()?.active) {
|
|
@@ -8765,10 +8736,6 @@ function runInWorkflowHelperScope(helperScope, callback) {
|
|
|
8765
8736
|
const current = workflowExecutionStore.getStore();
|
|
8766
8737
|
return workflowExecutionStore.run({ active: current?.active ?? false, helperScope }, callback);
|
|
8767
8738
|
}
|
|
8768
|
-
function runInFactoryHelperScope(helperScope, callback) {
|
|
8769
|
-
const current = factoryExecutionStore.getStore();
|
|
8770
|
-
return factoryExecutionStore.run({ active: current?.active ?? false, helperScope }, callback);
|
|
8771
|
-
}
|
|
8772
8739
|
function deserializeHookInput(raw) {
|
|
8773
8740
|
if (!raw || typeof raw !== "object" || typeof raw.timestamp !== "number") {
|
|
8774
8741
|
return raw;
|
|
@@ -8791,68 +8758,20 @@ function isOpenCanvasInstance(value) {
|
|
|
8791
8758
|
}
|
|
8792
8759
|
var FACTORY_LOG_FLUSH_DELAY_MS = 10;
|
|
8793
8760
|
var MAX_FACTORY_FANOUT_ITEMS = 4096;
|
|
8794
|
-
function
|
|
8761
|
+
function assertWorkflowFanoutSize(kind, size) {
|
|
8795
8762
|
if (size > MAX_FACTORY_FANOUT_ITEMS) {
|
|
8796
8763
|
throw new Error(
|
|
8797
8764
|
`${kind}() accepts at most ${MAX_FACTORY_FANOUT_ITEMS} items; got ${size}.`
|
|
8798
8765
|
);
|
|
8799
8766
|
}
|
|
8800
8767
|
}
|
|
8801
|
-
async function runFactoryParallel(thunks) {
|
|
8802
|
-
if (!Array.isArray(thunks)) {
|
|
8803
|
-
throw new Error(
|
|
8804
|
-
"parallel() expects an array of functions, not promises. Wrap each call: () => agent(...)"
|
|
8805
|
-
);
|
|
8806
|
-
}
|
|
8807
|
-
assertFactoryFanoutSize("parallel", thunks.length);
|
|
8808
|
-
if (thunks.some((thunk) => typeof thunk !== "function")) {
|
|
8809
|
-
throw new Error(
|
|
8810
|
-
"parallel() expects an array of functions, not promises. Wrap each call: () => agent(...)"
|
|
8811
|
-
);
|
|
8812
|
-
}
|
|
8813
|
-
return Promise.all(
|
|
8814
|
-
thunks.map(
|
|
8815
|
-
(thunk) => Promise.resolve().then(() => runInFactoryHelperScope("parallel", thunk)).catch((error) => {
|
|
8816
|
-
if (isFactoryFatalError(error)) {
|
|
8817
|
-
throw error;
|
|
8818
|
-
}
|
|
8819
|
-
return null;
|
|
8820
|
-
})
|
|
8821
|
-
)
|
|
8822
|
-
);
|
|
8823
|
-
}
|
|
8824
|
-
async function runFactoryPipeline(items, ...stages) {
|
|
8825
|
-
if (!Array.isArray(items)) {
|
|
8826
|
-
throw new Error("pipeline(items, ...stages): items must be an array");
|
|
8827
|
-
}
|
|
8828
|
-
assertFactoryFanoutSize("pipeline", items.length);
|
|
8829
|
-
return Promise.all(
|
|
8830
|
-
items.map(async (item, index) => {
|
|
8831
|
-
let previous = item;
|
|
8832
|
-
for (const stage of stages) {
|
|
8833
|
-
try {
|
|
8834
|
-
previous = await runInFactoryHelperScope(
|
|
8835
|
-
"pipeline",
|
|
8836
|
-
() => stage(previous, item, index)
|
|
8837
|
-
);
|
|
8838
|
-
} catch (error) {
|
|
8839
|
-
if (isFactoryFatalError(error)) {
|
|
8840
|
-
throw error;
|
|
8841
|
-
}
|
|
8842
|
-
return null;
|
|
8843
|
-
}
|
|
8844
|
-
}
|
|
8845
|
-
return previous;
|
|
8846
|
-
})
|
|
8847
|
-
);
|
|
8848
|
-
}
|
|
8849
8768
|
async function runWorkflowParallel(thunks) {
|
|
8850
8769
|
if (!Array.isArray(thunks)) {
|
|
8851
8770
|
throw new Error(
|
|
8852
8771
|
"parallel() expects an array of functions, not promises. Wrap each call: () => agent(...)"
|
|
8853
8772
|
);
|
|
8854
8773
|
}
|
|
8855
|
-
|
|
8774
|
+
assertWorkflowFanoutSize("parallel", thunks.length);
|
|
8856
8775
|
if (thunks.some((thunk) => typeof thunk !== "function")) {
|
|
8857
8776
|
throw new Error(
|
|
8858
8777
|
"parallel() expects an array of functions, not promises. Wrap each call: () => agent(...)"
|
|
@@ -8861,7 +8780,7 @@ async function runWorkflowParallel(thunks) {
|
|
|
8861
8780
|
return Promise.all(
|
|
8862
8781
|
thunks.map(
|
|
8863
8782
|
(thunk) => Promise.resolve().then(() => runInWorkflowHelperScope("parallel", thunk)).catch((error) => {
|
|
8864
|
-
if (
|
|
8783
|
+
if (isWorkflowFatalError(error)) {
|
|
8865
8784
|
throw error;
|
|
8866
8785
|
}
|
|
8867
8786
|
return null;
|
|
@@ -8873,7 +8792,7 @@ async function runWorkflowPipeline(items, ...stages) {
|
|
|
8873
8792
|
if (!Array.isArray(items)) {
|
|
8874
8793
|
throw new Error("pipeline(items, ...stages): items must be an array");
|
|
8875
8794
|
}
|
|
8876
|
-
|
|
8795
|
+
assertWorkflowFanoutSize("pipeline", items.length);
|
|
8877
8796
|
return Promise.all(
|
|
8878
8797
|
items.map(async (item, index) => {
|
|
8879
8798
|
let previous = item;
|
|
@@ -8884,7 +8803,7 @@ async function runWorkflowPipeline(items, ...stages) {
|
|
|
8884
8803
|
() => stage(previous, item, index)
|
|
8885
8804
|
);
|
|
8886
8805
|
} catch (error) {
|
|
8887
|
-
if (
|
|
8806
|
+
if (isWorkflowFatalError(error)) {
|
|
8888
8807
|
throw error;
|
|
8889
8808
|
}
|
|
8890
8809
|
return null;
|
|
@@ -8894,85 +8813,6 @@ async function runWorkflowPipeline(items, ...stages) {
|
|
|
8894
8813
|
})
|
|
8895
8814
|
);
|
|
8896
8815
|
}
|
|
8897
|
-
var FactoryProgressBuffer = class {
|
|
8898
|
-
constructor(send) {
|
|
8899
|
-
this.send = send;
|
|
8900
|
-
}
|
|
8901
|
-
send;
|
|
8902
|
-
nextSeq = 0;
|
|
8903
|
-
pending = [];
|
|
8904
|
-
flushTimer;
|
|
8905
|
-
flushTail = Promise.resolve();
|
|
8906
|
-
flushError;
|
|
8907
|
-
flushFailed = false;
|
|
8908
|
-
closed = false;
|
|
8909
|
-
enqueue(kind, text) {
|
|
8910
|
-
if (this.closed) {
|
|
8911
|
-
throw new Error("Cannot log after the factory run has settled");
|
|
8912
|
-
}
|
|
8913
|
-
this.pending.push({ seq: this.nextSeq++, kind, text });
|
|
8914
|
-
this.scheduleFlush();
|
|
8915
|
-
}
|
|
8916
|
-
async flush() {
|
|
8917
|
-
this.clearFlushTimer();
|
|
8918
|
-
const lines = this.pending.splice(0);
|
|
8919
|
-
if (lines.length > 0) {
|
|
8920
|
-
this.flushTail = this.flushTail.then(async () => {
|
|
8921
|
-
try {
|
|
8922
|
-
await this.send(lines);
|
|
8923
|
-
} catch (error) {
|
|
8924
|
-
if (!this.flushFailed) {
|
|
8925
|
-
this.flushFailed = true;
|
|
8926
|
-
this.flushError = error;
|
|
8927
|
-
}
|
|
8928
|
-
}
|
|
8929
|
-
});
|
|
8930
|
-
}
|
|
8931
|
-
await this.flushTail;
|
|
8932
|
-
if (this.flushFailed) {
|
|
8933
|
-
throw this.flushError;
|
|
8934
|
-
}
|
|
8935
|
-
}
|
|
8936
|
-
async close() {
|
|
8937
|
-
this.closed = true;
|
|
8938
|
-
this.clearFlushTimer();
|
|
8939
|
-
const lines = this.pending.splice(0);
|
|
8940
|
-
await this.flushTail;
|
|
8941
|
-
if (this.flushFailed) {
|
|
8942
|
-
console.warn(
|
|
8943
|
-
"Ignoring a background factory progress flush failure after the factory body settled",
|
|
8944
|
-
this.flushError
|
|
8945
|
-
);
|
|
8946
|
-
}
|
|
8947
|
-
if (lines.length > 0) {
|
|
8948
|
-
try {
|
|
8949
|
-
await this.send(lines);
|
|
8950
|
-
} catch (error) {
|
|
8951
|
-
console.warn(
|
|
8952
|
-
"Failed to flush final factory progress after the factory body settled",
|
|
8953
|
-
error
|
|
8954
|
-
);
|
|
8955
|
-
}
|
|
8956
|
-
}
|
|
8957
|
-
}
|
|
8958
|
-
scheduleFlush() {
|
|
8959
|
-
if (this.flushTimer !== void 0) {
|
|
8960
|
-
return;
|
|
8961
|
-
}
|
|
8962
|
-
this.flushTimer = setTimeout(() => {
|
|
8963
|
-
this.flushTimer = void 0;
|
|
8964
|
-
void this.flush().catch(() => {
|
|
8965
|
-
});
|
|
8966
|
-
}, FACTORY_LOG_FLUSH_DELAY_MS);
|
|
8967
|
-
this.flushTimer.unref?.();
|
|
8968
|
-
}
|
|
8969
|
-
clearFlushTimer() {
|
|
8970
|
-
if (this.flushTimer !== void 0) {
|
|
8971
|
-
clearTimeout(this.flushTimer);
|
|
8972
|
-
this.flushTimer = void 0;
|
|
8973
|
-
}
|
|
8974
|
-
}
|
|
8975
|
-
};
|
|
8976
8816
|
var WorkflowProgressBuffer = class {
|
|
8977
8817
|
constructor(send) {
|
|
8978
8818
|
this.send = send;
|
|
@@ -9052,38 +8892,30 @@ var WorkflowProgressBuffer = class {
|
|
|
9052
8892
|
}
|
|
9053
8893
|
}
|
|
9054
8894
|
};
|
|
9055
|
-
async function
|
|
8895
|
+
async function awaitWorkflowOperation(operation, signal) {
|
|
9056
8896
|
let rejectAbort;
|
|
9057
8897
|
const abortPromise = new Promise((_resolve, reject) => {
|
|
9058
8898
|
rejectAbort = reject;
|
|
9059
8899
|
});
|
|
9060
|
-
const onAbort = () => rejectAbort?.(signal.reason ?? new DOMException("
|
|
8900
|
+
const onAbort = () => rejectAbort?.(signal.reason ?? new DOMException("Workflow run was aborted", "AbortError"));
|
|
9061
8901
|
signal.addEventListener("abort", onAbort, { once: true });
|
|
9062
8902
|
try {
|
|
9063
|
-
|
|
8903
|
+
throwIfWorkflowAborted(signal);
|
|
9064
8904
|
return await Promise.race([operation(), abortPromise]);
|
|
9065
8905
|
} finally {
|
|
9066
8906
|
signal.removeEventListener("abort", onAbort);
|
|
9067
8907
|
}
|
|
9068
8908
|
}
|
|
9069
|
-
async function awaitWorkflowOperation(operation, signal) {
|
|
9070
|
-
return awaitFactoryOperation(operation, signal);
|
|
9071
|
-
}
|
|
9072
|
-
function throwIfFactoryAborted(signal) {
|
|
9073
|
-
if (signal.aborted) {
|
|
9074
|
-
throw signal.reason ?? new DOMException("Factory run was aborted", "AbortError");
|
|
9075
|
-
}
|
|
9076
|
-
}
|
|
9077
8909
|
function throwIfWorkflowAborted(signal) {
|
|
9078
8910
|
if (signal.aborted) {
|
|
9079
8911
|
throw signal.reason ?? new DOMException("Workflow run was aborted", "AbortError");
|
|
9080
8912
|
}
|
|
9081
8913
|
}
|
|
9082
|
-
function
|
|
8914
|
+
function isWorkflowAbortError(error) {
|
|
9083
8915
|
return typeof error === "object" && error !== null && "name" in error && error.name === "AbortError";
|
|
9084
8916
|
}
|
|
9085
|
-
function
|
|
9086
|
-
return
|
|
8917
|
+
function isWorkflowFatalError(error) {
|
|
8918
|
+
return isWorkflowAbortError(error) || error instanceof import_node.ResponseError || error instanceof import_node.ConnectionError;
|
|
9087
8919
|
}
|
|
9088
8920
|
var TOOL_SEARCH_TOOL_NAME = "tool_search_tool";
|
|
9089
8921
|
var CopilotSession = class {
|
|
@@ -9115,8 +8947,6 @@ var CopilotSession = class {
|
|
|
9115
8947
|
canvases = /* @__PURE__ */ new Map();
|
|
9116
8948
|
bearerTokenProviders = /* @__PURE__ */ new Map();
|
|
9117
8949
|
commandHandlers = /* @__PURE__ */ new Map();
|
|
9118
|
-
factories = /* @__PURE__ */ new Map();
|
|
9119
|
-
factoryAbortControllers = /* @__PURE__ */ new Map();
|
|
9120
8950
|
workflows = /* @__PURE__ */ new Map();
|
|
9121
8951
|
workflowAbortControllers = /* @__PURE__ */ new Map();
|
|
9122
8952
|
permissionHandler;
|
|
@@ -9140,68 +8970,11 @@ var CopilotSession = class {
|
|
|
9140
8970
|
/** @internal Client session API handlers, populated by CopilotClient during create/resume. */
|
|
9141
8971
|
clientSessionApis = {};
|
|
9142
8972
|
/**
|
|
9143
|
-
* Friendly
|
|
8973
|
+
* Friendly workflow API for running registered workflows by name or handle.
|
|
9144
8974
|
*
|
|
9145
|
-
* @experimental Part of the experimental
|
|
8975
|
+
* @experimental Part of the experimental Dynamic Workflows surface and may
|
|
9146
8976
|
* change or be removed in future SDK or CLI releases.
|
|
9147
8977
|
*/
|
|
9148
|
-
factory = {
|
|
9149
|
-
run: (async (nameOrHandle, options) => {
|
|
9150
|
-
throwIfFactoryExecutionIsActive();
|
|
9151
|
-
const name = typeof nameOrHandle === "string" ? nameOrHandle : getFactoryDefinition(nameOrHandle).meta.name;
|
|
9152
|
-
if (options?.resumeFromRunId !== void 0) {
|
|
9153
|
-
return this.factory.resume(options.resumeFromRunId, {
|
|
9154
|
-
limits: options.limits,
|
|
9155
|
-
notifyOnComplete: options.notifyOnComplete,
|
|
9156
|
-
logPhaseNames: options.logPhaseNames
|
|
9157
|
-
});
|
|
9158
|
-
}
|
|
9159
|
-
const envelope = await this.rpc.factory.run({
|
|
9160
|
-
name,
|
|
9161
|
-
args: options?.args === void 0 ? {} : options.args,
|
|
9162
|
-
options: {
|
|
9163
|
-
limits: options?.limits,
|
|
9164
|
-
notifyOnComplete: options?.notifyOnComplete,
|
|
9165
|
-
logPhaseNames: options?.logPhaseNames
|
|
9166
|
-
}
|
|
9167
|
-
});
|
|
9168
|
-
return this.settleFactoryRun(envelope);
|
|
9169
|
-
}),
|
|
9170
|
-
resume: (async (runId, options) => {
|
|
9171
|
-
throwIfFactoryExecutionIsActive();
|
|
9172
|
-
let response;
|
|
9173
|
-
try {
|
|
9174
|
-
response = await this.rpc.factory.resume({
|
|
9175
|
-
runId,
|
|
9176
|
-
limits: options?.limits,
|
|
9177
|
-
notifyOnComplete: options?.notifyOnComplete,
|
|
9178
|
-
logPhaseNames: options?.logPhaseNames
|
|
9179
|
-
});
|
|
9180
|
-
} catch (error) {
|
|
9181
|
-
if (error instanceof import_node.ResponseError && typeof error.data === "object" && error.data !== null) {
|
|
9182
|
-
const code = error.data.code;
|
|
9183
|
-
if (isFactoryResumeErrorCode(code)) {
|
|
9184
|
-
throw new FactoryResumeError(code, error.message);
|
|
9185
|
-
}
|
|
9186
|
-
}
|
|
9187
|
-
throw error;
|
|
9188
|
-
}
|
|
9189
|
-
return this.settleFactoryRun(response.run);
|
|
9190
|
-
}),
|
|
9191
|
-
getRun: async (runId) => this.rpc.factory.getRun({ runId }),
|
|
9192
|
-
waitForRun: (runId, options) => this.waitForFactoryRun(runId, options?.signal),
|
|
9193
|
-
listRuns: (async (options) => {
|
|
9194
|
-
const page = await this.rpc.factory.listRuns(options ?? {});
|
|
9195
|
-
return options === void 0 ? page.runs : page;
|
|
9196
|
-
}),
|
|
9197
|
-
getRunDetail: (runId) => this.rpc.factory.getRunDetail({ runId }),
|
|
9198
|
-
getRunProgress: (runId, options = {}) => this.rpc.factory.getRunProgress({ runId, ...options }),
|
|
9199
|
-
pause: async (runId) => {
|
|
9200
|
-
throwIfFactoryExecutionIsActive();
|
|
9201
|
-
return this.rpc.factory.pause({ runId });
|
|
9202
|
-
},
|
|
9203
|
-
cancel: async (runId) => this.rpc.factory.cancel({ runId })
|
|
9204
|
-
};
|
|
9205
8978
|
workflow = {
|
|
9206
8979
|
run: (async (nameOrHandle, options) => {
|
|
9207
8980
|
throwIfWorkflowExecutionIsActive();
|
|
@@ -9252,93 +9025,6 @@ var CopilotSession = class {
|
|
|
9252
9025
|
},
|
|
9253
9026
|
cancel: async (runId) => this.rpc.workflow.cancel({ runId })
|
|
9254
9027
|
};
|
|
9255
|
-
/**
|
|
9256
|
-
* Resolve a start/resume envelope into the terminal envelope callers expect.
|
|
9257
|
-
*
|
|
9258
|
-
* The CLI may answer `session.factory.run` and `session.factory.resume`
|
|
9259
|
-
* before the run settles, so a non-terminal envelope is followed by a wait
|
|
9260
|
-
* on the run's terminal state.
|
|
9261
|
-
*/
|
|
9262
|
-
settleFactoryRun(envelope) {
|
|
9263
|
-
if (isFactoryRunTerminal(envelope.status)) {
|
|
9264
|
-
return Promise.resolve(envelope);
|
|
9265
|
-
}
|
|
9266
|
-
return this.waitForFactoryRun(envelope.runId);
|
|
9267
|
-
}
|
|
9268
|
-
/**
|
|
9269
|
-
* Resolve when a factory run reaches a terminal status.
|
|
9270
|
-
*
|
|
9271
|
-
* The subscription is installed *before* the first read so a transition
|
|
9272
|
-
* landing between the two cannot be missed, and re-reads are serialized so
|
|
9273
|
-
* overlapping invalidation events cannot interleave — the run's revision
|
|
9274
|
-
* advances once per operation, so a burst of events is common and must
|
|
9275
|
-
* collapse into a single in-flight read. A bounded periodic re-read keeps a
|
|
9276
|
-
* dropped invalidation from leaving the wait pending forever.
|
|
9277
|
-
*/
|
|
9278
|
-
waitForFactoryRun(runId, signal) {
|
|
9279
|
-
const abortError = () => signal?.reason ?? new DOMException("Factory run wait was aborted", "AbortError");
|
|
9280
|
-
if (signal?.aborted === true) {
|
|
9281
|
-
return Promise.reject(abortError());
|
|
9282
|
-
}
|
|
9283
|
-
return new Promise((resolve3, reject) => {
|
|
9284
|
-
let settled = false;
|
|
9285
|
-
let reading = false;
|
|
9286
|
-
let rereadRequested = false;
|
|
9287
|
-
let pollHandle;
|
|
9288
|
-
let unsubscribe;
|
|
9289
|
-
let onAbort;
|
|
9290
|
-
const finish = (complete) => {
|
|
9291
|
-
if (settled) {
|
|
9292
|
-
return;
|
|
9293
|
-
}
|
|
9294
|
-
settled = true;
|
|
9295
|
-
if (pollHandle !== void 0) {
|
|
9296
|
-
clearInterval(pollHandle);
|
|
9297
|
-
}
|
|
9298
|
-
unsubscribe?.();
|
|
9299
|
-
if (onAbort !== void 0) {
|
|
9300
|
-
signal?.removeEventListener("abort", onAbort);
|
|
9301
|
-
}
|
|
9302
|
-
complete();
|
|
9303
|
-
};
|
|
9304
|
-
const read = async () => {
|
|
9305
|
-
if (settled) {
|
|
9306
|
-
return;
|
|
9307
|
-
}
|
|
9308
|
-
if (reading) {
|
|
9309
|
-
rereadRequested = true;
|
|
9310
|
-
return;
|
|
9311
|
-
}
|
|
9312
|
-
reading = true;
|
|
9313
|
-
try {
|
|
9314
|
-
do {
|
|
9315
|
-
rereadRequested = false;
|
|
9316
|
-
const envelope = await this.rpc.factory.getRun({ runId });
|
|
9317
|
-
if (isFactoryRunTerminal(envelope.status)) {
|
|
9318
|
-
finish(() => resolve3(envelope));
|
|
9319
|
-
return;
|
|
9320
|
-
}
|
|
9321
|
-
} while (rereadRequested && !settled);
|
|
9322
|
-
} catch (error) {
|
|
9323
|
-
finish(() => reject(error));
|
|
9324
|
-
} finally {
|
|
9325
|
-
reading = false;
|
|
9326
|
-
}
|
|
9327
|
-
};
|
|
9328
|
-
if (signal !== void 0) {
|
|
9329
|
-
onAbort = () => finish(() => reject(abortError()));
|
|
9330
|
-
signal.addEventListener("abort", onAbort, { once: true });
|
|
9331
|
-
}
|
|
9332
|
-
unsubscribe = this.on("factory.run_updated", (event) => {
|
|
9333
|
-
if (event.data.runId === runId) {
|
|
9334
|
-
void read();
|
|
9335
|
-
}
|
|
9336
|
-
});
|
|
9337
|
-
pollHandle = setInterval(() => void read(), 5e3);
|
|
9338
|
-
pollHandle.unref?.();
|
|
9339
|
-
void read();
|
|
9340
|
-
});
|
|
9341
|
-
}
|
|
9342
9028
|
settleWorkflowRun(envelope) {
|
|
9343
9029
|
if (isWorkflowRunTerminal(envelope.status)) {
|
|
9344
9030
|
return Promise.resolve(envelope);
|
|
@@ -9409,7 +9095,7 @@ var CopilotSession = class {
|
|
|
9409
9095
|
onAbort = () => finish(() => reject(abortError()));
|
|
9410
9096
|
signal.addEventListener("abort", onAbort, { once: true });
|
|
9411
9097
|
}
|
|
9412
|
-
unsubscribe = this.on("
|
|
9098
|
+
unsubscribe = this.on("workflow.run_updated", (event) => {
|
|
9413
9099
|
if (event.data.runId === runId) {
|
|
9414
9100
|
void read();
|
|
9415
9101
|
}
|
|
@@ -9675,13 +9361,6 @@ var CopilotSession = class {
|
|
|
9675
9361
|
this.autoModeSwitchHandler = void 0;
|
|
9676
9362
|
this.commandHandlers.clear();
|
|
9677
9363
|
this.canvases.clear();
|
|
9678
|
-
this.factories.clear();
|
|
9679
|
-
for (const controllersForRun of this.factoryAbortControllers.values()) {
|
|
9680
|
-
for (const controller of controllersForRun.values()) {
|
|
9681
|
-
controller.abort();
|
|
9682
|
-
}
|
|
9683
|
-
}
|
|
9684
|
-
this.factoryAbortControllers.clear();
|
|
9685
9364
|
this.workflows.clear();
|
|
9686
9365
|
for (const controllersForRun of this.workflowAbortControllers.values()) {
|
|
9687
9366
|
for (const controller of controllersForRun.values()) {
|
|
@@ -10136,192 +9815,6 @@ var CopilotSession = class {
|
|
|
10136
9815
|
}
|
|
10137
9816
|
};
|
|
10138
9817
|
}
|
|
10139
|
-
/**
|
|
10140
|
-
* Registers factory closures and reverse-RPC handlers for this session.
|
|
10141
|
-
*
|
|
10142
|
-
* @param factories - Factory handles declared by the joining extension.
|
|
10143
|
-
* @internal Called by the SDK when an extension joins a session.
|
|
10144
|
-
*/
|
|
10145
|
-
registerFactories(factories) {
|
|
10146
|
-
this.factories.clear();
|
|
10147
|
-
if (!factories || factories.length === 0) {
|
|
10148
|
-
delete this.clientSessionApis.factory;
|
|
10149
|
-
return;
|
|
10150
|
-
}
|
|
10151
|
-
for (const handle of factories) {
|
|
10152
|
-
const definition = getFactoryDefinition(handle);
|
|
10153
|
-
if (this.factories.has(definition.meta.name)) {
|
|
10154
|
-
throw new Error(
|
|
10155
|
-
`Duplicate factory name "${definition.meta.name}". Factory names must be unique within a joinSession call.`
|
|
10156
|
-
);
|
|
10157
|
-
}
|
|
10158
|
-
this.factories.set(definition.meta.name, definition);
|
|
10159
|
-
}
|
|
10160
|
-
const self = this;
|
|
10161
|
-
this.clientSessionApis.factory = {
|
|
10162
|
-
async execute(params) {
|
|
10163
|
-
const definition = self.factories.get(params.name);
|
|
10164
|
-
if (!definition) {
|
|
10165
|
-
const message = `No factory registered with name "${params.name}"`;
|
|
10166
|
-
throw new import_node.ResponseError(import_node.ErrorCodes.InvalidParams, message, {
|
|
10167
|
-
code: "factory_not_found",
|
|
10168
|
-
name: params.name
|
|
10169
|
-
});
|
|
10170
|
-
}
|
|
10171
|
-
const controller = new AbortController();
|
|
10172
|
-
let controllersForRun = self.factoryAbortControllers.get(params.runId);
|
|
10173
|
-
if (controllersForRun === void 0) {
|
|
10174
|
-
controllersForRun = /* @__PURE__ */ new Map();
|
|
10175
|
-
self.factoryAbortControllers.set(params.runId, controllersForRun);
|
|
10176
|
-
}
|
|
10177
|
-
controllersForRun.set(params.executionToken, controller);
|
|
10178
|
-
const progress = new FactoryProgressBuffer(async (lines) => {
|
|
10179
|
-
await self.rpc.factory.log({
|
|
10180
|
-
runId: params.runId,
|
|
10181
|
-
executionToken: params.executionToken,
|
|
10182
|
-
lines
|
|
10183
|
-
});
|
|
10184
|
-
});
|
|
10185
|
-
try {
|
|
10186
|
-
const context = {
|
|
10187
|
-
runId: params.runId,
|
|
10188
|
-
args: params.args,
|
|
10189
|
-
session: self,
|
|
10190
|
-
signal: controller.signal,
|
|
10191
|
-
phase: (title) => {
|
|
10192
|
-
throwIfFactoryAborted(controller.signal);
|
|
10193
|
-
progress.enqueue("phase", title);
|
|
10194
|
-
},
|
|
10195
|
-
log: (message) => {
|
|
10196
|
-
throwIfFactoryAborted(controller.signal);
|
|
10197
|
-
progress.enqueue("log", message);
|
|
10198
|
-
},
|
|
10199
|
-
agent: async (prompt, options = {}) => {
|
|
10200
|
-
await progress.flush();
|
|
10201
|
-
const opts = {};
|
|
10202
|
-
for (const key of FACTORY_AGENT_OPTION_KEYS) {
|
|
10203
|
-
copyDefinedFactoryAgentOption(options, opts, key);
|
|
10204
|
-
}
|
|
10205
|
-
const response = await awaitFactoryOperation(
|
|
10206
|
-
() => self.rpc.factory.agent({
|
|
10207
|
-
factoryRunId: params.runId,
|
|
10208
|
-
executionToken: params.executionToken,
|
|
10209
|
-
prompt,
|
|
10210
|
-
opts
|
|
10211
|
-
}),
|
|
10212
|
-
controller.signal
|
|
10213
|
-
);
|
|
10214
|
-
return response.result ?? null;
|
|
10215
|
-
},
|
|
10216
|
-
step: async (key, producer, options = {}) => {
|
|
10217
|
-
await progress.flush();
|
|
10218
|
-
if (options.volatile) {
|
|
10219
|
-
throwIfFactoryAborted(controller.signal);
|
|
10220
|
-
return producer();
|
|
10221
|
-
}
|
|
10222
|
-
const cached = await awaitFactoryOperation(
|
|
10223
|
-
() => self.rpc.factory.journal.get({
|
|
10224
|
-
runId: params.runId,
|
|
10225
|
-
executionToken: params.executionToken,
|
|
10226
|
-
key
|
|
10227
|
-
}),
|
|
10228
|
-
controller.signal
|
|
10229
|
-
);
|
|
10230
|
-
if (cached.hit) {
|
|
10231
|
-
if (cached.resultJson === void 0) {
|
|
10232
|
-
throw new Error(
|
|
10233
|
-
`step("${key}") journal returned a hit without a result`
|
|
10234
|
-
);
|
|
10235
|
-
}
|
|
10236
|
-
assertFactoryStepResult(cached.resultJson, key);
|
|
10237
|
-
return cached.resultJson;
|
|
10238
|
-
}
|
|
10239
|
-
const result2 = await producer();
|
|
10240
|
-
assertFactoryStepResult(result2, key);
|
|
10241
|
-
await awaitFactoryOperation(
|
|
10242
|
-
() => self.rpc.factory.journal.put({
|
|
10243
|
-
runId: params.runId,
|
|
10244
|
-
executionToken: params.executionToken,
|
|
10245
|
-
key,
|
|
10246
|
-
resultJson: result2
|
|
10247
|
-
}),
|
|
10248
|
-
controller.signal
|
|
10249
|
-
);
|
|
10250
|
-
return result2;
|
|
10251
|
-
},
|
|
10252
|
-
pause: async (key) => {
|
|
10253
|
-
if (typeof key !== "string" || key.length === 0) {
|
|
10254
|
-
throw new Error("Factory pause checkpoint key must not be empty");
|
|
10255
|
-
}
|
|
10256
|
-
const helperScope = factoryExecutionStore.getStore()?.helperScope;
|
|
10257
|
-
if (helperScope !== void 0) {
|
|
10258
|
-
throw new Error(
|
|
10259
|
-
`Factory pause checkpoints are not allowed inside ${helperScope}() branches`
|
|
10260
|
-
);
|
|
10261
|
-
}
|
|
10262
|
-
await progress.flush();
|
|
10263
|
-
const response = await awaitFactoryOperation(
|
|
10264
|
-
() => self.internalRpc.factory.pauseAtCheckpoint({
|
|
10265
|
-
runId: params.runId,
|
|
10266
|
-
executionToken: params.executionToken,
|
|
10267
|
-
key
|
|
10268
|
-
}),
|
|
10269
|
-
controller.signal
|
|
10270
|
-
);
|
|
10271
|
-
switch (response.action) {
|
|
10272
|
-
case "continue":
|
|
10273
|
-
return;
|
|
10274
|
-
case "pause":
|
|
10275
|
-
await awaitFactoryOperation(
|
|
10276
|
-
() => new Promise(() => {
|
|
10277
|
-
}),
|
|
10278
|
-
controller.signal
|
|
10279
|
-
);
|
|
10280
|
-
}
|
|
10281
|
-
},
|
|
10282
|
-
parallel: runFactoryParallel,
|
|
10283
|
-
pipeline: runFactoryPipeline,
|
|
10284
|
-
factory: async () => {
|
|
10285
|
-
throw new Error("nested factories are not supported");
|
|
10286
|
-
}
|
|
10287
|
-
};
|
|
10288
|
-
const execution = { active: true };
|
|
10289
|
-
const result = await factoryExecutionStore.run(execution, async () => {
|
|
10290
|
-
try {
|
|
10291
|
-
return await definition.run(context);
|
|
10292
|
-
} finally {
|
|
10293
|
-
execution.active = false;
|
|
10294
|
-
}
|
|
10295
|
-
});
|
|
10296
|
-
if (result === void 0) {
|
|
10297
|
-
return {};
|
|
10298
|
-
}
|
|
10299
|
-
assertFactoryResult(result);
|
|
10300
|
-
return { result };
|
|
10301
|
-
} finally {
|
|
10302
|
-
try {
|
|
10303
|
-
await progress.close();
|
|
10304
|
-
} finally {
|
|
10305
|
-
const controllersForRun2 = self.factoryAbortControllers.get(params.runId);
|
|
10306
|
-
if (controllersForRun2?.get(params.executionToken) === controller) {
|
|
10307
|
-
controllersForRun2.delete(params.executionToken);
|
|
10308
|
-
if (controllersForRun2.size === 0) {
|
|
10309
|
-
self.factoryAbortControllers.delete(params.runId);
|
|
10310
|
-
}
|
|
10311
|
-
}
|
|
10312
|
-
}
|
|
10313
|
-
}
|
|
10314
|
-
},
|
|
10315
|
-
async abort(params) {
|
|
10316
|
-
const controllersForRun = self.factoryAbortControllers.get(params.runId);
|
|
10317
|
-
const controller = controllersForRun?.get(params.executionToken);
|
|
10318
|
-
if (controller !== void 0) {
|
|
10319
|
-
controller.abort(new DOMException("Factory run was aborted", "AbortError"));
|
|
10320
|
-
}
|
|
10321
|
-
return {};
|
|
10322
|
-
}
|
|
10323
|
-
};
|
|
10324
|
-
}
|
|
10325
9818
|
/**
|
|
10326
9819
|
* Registers workflow closures and reverse-RPC handlers for this session.
|
|
10327
9820
|
*
|
|
@@ -11188,20 +10681,6 @@ function assertStrictJson(value, context) {
|
|
|
11188
10681
|
};
|
|
11189
10682
|
visit(value, "$", context.allowTopLevelUndefined);
|
|
11190
10683
|
}
|
|
11191
|
-
function assertFactoryResult(value) {
|
|
11192
|
-
assertStrictJson(value, {
|
|
11193
|
-
code: "factory_result_not_json",
|
|
11194
|
-
label: "Factory result",
|
|
11195
|
-
allowTopLevelUndefined: true
|
|
11196
|
-
});
|
|
11197
|
-
}
|
|
11198
|
-
function assertFactoryStepResult(value, key) {
|
|
11199
|
-
assertStrictJson(value, {
|
|
11200
|
-
code: "factory_step_not_json",
|
|
11201
|
-
label: `Factory step "${key}" result`,
|
|
11202
|
-
allowTopLevelUndefined: false
|
|
11203
|
-
});
|
|
11204
|
-
}
|
|
11205
10684
|
function assertWorkflowResult(value) {
|
|
11206
10685
|
assertStrictJson(value, {
|
|
11207
10686
|
code: "workflow_result_not_json",
|
|
@@ -11432,6 +10911,79 @@ async function ensureRuntimeBundle(version2, options = {}) {
|
|
|
11432
10911
|
return wrapper;
|
|
11433
10912
|
}
|
|
11434
10913
|
|
|
10914
|
+
// src/sdk/nodejs/dist/installationConfirmation.js
|
|
10915
|
+
var import_node2 = __toESM(require_node(), 1);
|
|
10916
|
+
function createInstallationConfirmationAdapter(connection, handler) {
|
|
10917
|
+
const closed = new import_node2.CancellationTokenSource();
|
|
10918
|
+
const closeSubscription = connection.onClose(() => closed.cancel());
|
|
10919
|
+
const disposeSubscription = connection.onDispose(() => {
|
|
10920
|
+
closed.cancel();
|
|
10921
|
+
closed.dispose();
|
|
10922
|
+
closeSubscription.dispose();
|
|
10923
|
+
disposeSubscription.dispose();
|
|
10924
|
+
});
|
|
10925
|
+
return {
|
|
10926
|
+
async confirm(request, token) {
|
|
10927
|
+
if (!token) {
|
|
10928
|
+
throw new Error("Installation confirmation request cancellation is unavailable");
|
|
10929
|
+
}
|
|
10930
|
+
const { confirmationId, reviewFingerprint } = request;
|
|
10931
|
+
const combined = new import_node2.CancellationTokenSource();
|
|
10932
|
+
const subscriptions = [];
|
|
10933
|
+
const cancelRequest = () => combined.cancel();
|
|
10934
|
+
const cancelConnection = () => combined.cancel();
|
|
10935
|
+
const checkCancellation = () => {
|
|
10936
|
+
if (closed.token.isCancellationRequested) {
|
|
10937
|
+
throw new Error("Installation confirmation connection closed");
|
|
10938
|
+
}
|
|
10939
|
+
if (token.isCancellationRequested) {
|
|
10940
|
+
throw new import_node2.ResponseError(-32800, "Installation confirmation request cancelled");
|
|
10941
|
+
}
|
|
10942
|
+
};
|
|
10943
|
+
try {
|
|
10944
|
+
subscriptions.push(
|
|
10945
|
+
token.onCancellationRequested(cancelRequest),
|
|
10946
|
+
closed.token.onCancellationRequested(cancelConnection)
|
|
10947
|
+
);
|
|
10948
|
+
if (token.isCancellationRequested || closed.token.isCancellationRequested) {
|
|
10949
|
+
combined.cancel();
|
|
10950
|
+
}
|
|
10951
|
+
checkCancellation();
|
|
10952
|
+
const cancelled = new Promise((_resolve, reject) => {
|
|
10953
|
+
subscriptions.push(
|
|
10954
|
+
token.onCancellationRequested(
|
|
10955
|
+
() => reject(
|
|
10956
|
+
new import_node2.ResponseError(
|
|
10957
|
+
-32800,
|
|
10958
|
+
"Installation confirmation request cancelled"
|
|
10959
|
+
)
|
|
10960
|
+
)
|
|
10961
|
+
),
|
|
10962
|
+
closed.token.onCancellationRequested(
|
|
10963
|
+
() => reject(new Error("Installation confirmation connection closed"))
|
|
10964
|
+
)
|
|
10965
|
+
);
|
|
10966
|
+
});
|
|
10967
|
+
const decision = await Promise.race([
|
|
10968
|
+
Promise.resolve().then(() => {
|
|
10969
|
+
checkCancellation();
|
|
10970
|
+
return handler(request, combined.token);
|
|
10971
|
+
}),
|
|
10972
|
+
cancelled
|
|
10973
|
+
]);
|
|
10974
|
+
checkCancellation();
|
|
10975
|
+
if (decision !== "confirm" && decision !== "decline" && decision !== "cancel") {
|
|
10976
|
+
throw new Error("Invalid installation confirmation decision");
|
|
10977
|
+
}
|
|
10978
|
+
return { confirmationId, reviewFingerprint, decision };
|
|
10979
|
+
} finally {
|
|
10980
|
+
for (const subscription of subscriptions) subscription.dispose();
|
|
10981
|
+
combined.dispose();
|
|
10982
|
+
}
|
|
10983
|
+
}
|
|
10984
|
+
};
|
|
10985
|
+
}
|
|
10986
|
+
|
|
11435
10987
|
// src/sdk/nodejs/dist/toolSet.js
|
|
11436
10988
|
var VALID_TOOL_NAME = /^[a-zA-Z0-9_-]+$/;
|
|
11437
10989
|
function validateName(kind, name) {
|
|
@@ -11674,7 +11226,7 @@ function getNodeExecPath() {
|
|
|
11674
11226
|
function getBundledRuntimePath() {
|
|
11675
11227
|
return ensureRuntimeBundle(COPILOT_CLI_VERSION);
|
|
11676
11228
|
}
|
|
11677
|
-
var TeardownResilientStreamMessageWriter = class extends
|
|
11229
|
+
var TeardownResilientStreamMessageWriter = class extends import_node3.StreamMessageWriter {
|
|
11678
11230
|
suppressWriteErrors = false;
|
|
11679
11231
|
async write(msg) {
|
|
11680
11232
|
try {
|
|
@@ -11730,6 +11282,7 @@ var CopilotClient = class _CopilotClient {
|
|
|
11730
11282
|
sessionFsConfig = null;
|
|
11731
11283
|
requestHandler = null;
|
|
11732
11284
|
extensionLaunchProvider;
|
|
11285
|
+
installationConfirmationHandler;
|
|
11733
11286
|
builtinPluginDirectories = [];
|
|
11734
11287
|
onGitHubTelemetry;
|
|
11735
11288
|
clientGlobalHandlers = {};
|
|
@@ -11888,6 +11441,7 @@ var CopilotClient = class _CopilotClient {
|
|
|
11888
11441
|
this.sessionFsConfig = options.sessionFs ?? null;
|
|
11889
11442
|
this.requestHandler = options.requestHandler ?? null;
|
|
11890
11443
|
this.extensionLaunchProvider = options.extensionLaunchProvider;
|
|
11444
|
+
this.installationConfirmationHandler = options.installationConfirmationHandler;
|
|
11891
11445
|
this.onGitHubTelemetry = options.onGitHubTelemetry;
|
|
11892
11446
|
this.setupClientGlobalHandlers();
|
|
11893
11447
|
const connEnv = conn.kind === "stdio" || conn.kind === "tcp" ? conn.env : void 0;
|
|
@@ -12804,14 +12358,12 @@ var CopilotClient = class _CopilotClient {
|
|
|
12804
12358
|
async resumeSession(sessionId, config) {
|
|
12805
12359
|
return this.resumeSessionInternal(sessionId, config);
|
|
12806
12360
|
}
|
|
12361
|
+
/** @internal */
|
|
12807
12362
|
async resumeSessionForExtension(sessionId, config, contributions = {}, extensionOptions) {
|
|
12808
12363
|
return this.resumeSessionInternal(sessionId, config, contributions, extensionOptions);
|
|
12809
12364
|
}
|
|
12810
12365
|
async resumeSessionInternal(sessionId, config, contributions = {}, extensionOptions) {
|
|
12811
|
-
const {
|
|
12812
|
-
if (factories !== void 0 && workflows !== void 0) {
|
|
12813
|
-
throw new Error("Session configuration cannot include both factories and workflows");
|
|
12814
|
-
}
|
|
12366
|
+
const { workflows } = contributions;
|
|
12815
12367
|
if (config.gitHubToken !== void 0 && config.gitHubTokenProvider !== void 0) {
|
|
12816
12368
|
throw new Error("gitHubToken and gitHubTokenProvider are mutually exclusive");
|
|
12817
12369
|
}
|
|
@@ -12831,7 +12383,6 @@ var CopilotClient = class _CopilotClient {
|
|
|
12831
12383
|
session.registerTools(config.tools);
|
|
12832
12384
|
session.registerCanvases(config.canvases);
|
|
12833
12385
|
session.registerCommands(config.commands);
|
|
12834
|
-
session.registerFactories(factories);
|
|
12835
12386
|
session.registerWorkflows(workflows);
|
|
12836
12387
|
const {
|
|
12837
12388
|
wireProvider: bearerWireProvider,
|
|
@@ -12913,7 +12464,6 @@ var CopilotClient = class _CopilotClient {
|
|
|
12913
12464
|
})),
|
|
12914
12465
|
toolSearch: config.toolSearch,
|
|
12915
12466
|
canvases: config.canvases?.map((canvas) => canvas.declaration),
|
|
12916
|
-
factories: factories?.map((factory) => factory.meta),
|
|
12917
12467
|
workflows: workflows?.map((workflow) => workflow.meta),
|
|
12918
12468
|
requestCanvasRenderer: config.requestCanvasRenderer,
|
|
12919
12469
|
requestExtensions: config.requestExtensions,
|
|
@@ -13136,7 +12686,7 @@ var CopilotClient = class _CopilotClient {
|
|
|
13136
12686
|
const result = await raceAgainstExit(this.internalRpc.connect(connectParams));
|
|
13137
12687
|
serverVersion = result.protocolVersion;
|
|
13138
12688
|
} catch (err) {
|
|
13139
|
-
if (err instanceof
|
|
12689
|
+
if (err instanceof import_node3.ResponseError && (err.code === import_node3.ErrorCodes.MethodNotFound || err.message === "Unhandled method connect")) {
|
|
13140
12690
|
serverVersion = (await raceAgainstExit(this.ping())).protocolVersion;
|
|
13141
12691
|
} else {
|
|
13142
12692
|
throw err;
|
|
@@ -13376,6 +12926,9 @@ var CopilotClient = class _CopilotClient {
|
|
|
13376
12926
|
if (this.options.mode === "empty") {
|
|
13377
12927
|
env.COPILOT_DISABLE_KEYTAR = "1";
|
|
13378
12928
|
}
|
|
12929
|
+
if (this.options.mode !== "empty") {
|
|
12930
|
+
env.COPILOT_RUNTIME_PROCESS_FILE_LOGGING = "1";
|
|
12931
|
+
}
|
|
13379
12932
|
if (this.options.telemetry) {
|
|
13380
12933
|
const t = this.options.telemetry;
|
|
13381
12934
|
env.COPILOT_OTEL_ENABLED = "true";
|
|
@@ -13611,8 +13164,8 @@ stderr: ${stderrOutput}`
|
|
|
13611
13164
|
throw new Error("In-process FFI runtime host not started");
|
|
13612
13165
|
}
|
|
13613
13166
|
this.messageWriter = new TeardownResilientStreamMessageWriter(this.ffiHost.sendStream);
|
|
13614
|
-
this.connection = (0,
|
|
13615
|
-
new
|
|
13167
|
+
this.connection = (0, import_node3.createMessageConnection)(
|
|
13168
|
+
new import_node3.StreamMessageReader(this.ffiHost.receiveStream),
|
|
13616
13169
|
this.messageWriter
|
|
13617
13170
|
);
|
|
13618
13171
|
this.attachConnectionHandlers();
|
|
@@ -13665,8 +13218,8 @@ stderr: ${stderrOutput}` : ""}`
|
|
|
13665
13218
|
}
|
|
13666
13219
|
});
|
|
13667
13220
|
this.messageWriter = new TeardownResilientStreamMessageWriter(this.cliProcess.stdin);
|
|
13668
|
-
this.connection = (0,
|
|
13669
|
-
new
|
|
13221
|
+
this.connection = (0, import_node3.createMessageConnection)(
|
|
13222
|
+
new import_node3.StreamMessageReader(this.cliProcess.stdout),
|
|
13670
13223
|
this.messageWriter
|
|
13671
13224
|
);
|
|
13672
13225
|
this.attachConnectionHandlers();
|
|
@@ -13680,8 +13233,8 @@ stderr: ${stderrOutput}` : ""}`
|
|
|
13680
13233
|
throw new Error("CLI child process was unexpectedly started in parent process mode");
|
|
13681
13234
|
}
|
|
13682
13235
|
this.messageWriter = new TeardownResilientStreamMessageWriter(process.stdout);
|
|
13683
|
-
this.connection = (0,
|
|
13684
|
-
new
|
|
13236
|
+
this.connection = (0, import_node3.createMessageConnection)(
|
|
13237
|
+
new import_node3.StreamMessageReader(process.stdin),
|
|
13685
13238
|
this.messageWriter
|
|
13686
13239
|
);
|
|
13687
13240
|
this.attachConnectionHandlers();
|
|
@@ -13703,8 +13256,8 @@ stderr: ${stderrOutput}` : ""}`
|
|
|
13703
13256
|
this.socket.connect(this.runtimePort, this.actualHost, () => {
|
|
13704
13257
|
clearTimeout(connectionTimeout);
|
|
13705
13258
|
this.messageWriter = new TeardownResilientStreamMessageWriter(this.socket);
|
|
13706
|
-
this.connection = (0,
|
|
13707
|
-
new
|
|
13259
|
+
this.connection = (0, import_node3.createMessageConnection)(
|
|
13260
|
+
new import_node3.StreamMessageReader(this.socket),
|
|
13708
13261
|
this.messageWriter
|
|
13709
13262
|
);
|
|
13710
13263
|
this.attachConnectionHandlers();
|
|
@@ -13750,6 +13303,16 @@ stderr: ${stderrOutput}` : ""}`
|
|
|
13750
13303
|
return session.clientSessionApis;
|
|
13751
13304
|
});
|
|
13752
13305
|
registerClientGlobalApiHandlers(this.connection, this.clientGlobalHandlers);
|
|
13306
|
+
if (this.installationConfirmationHandler) {
|
|
13307
|
+
const confirmation = createInstallationConfirmationAdapter(
|
|
13308
|
+
this.connection,
|
|
13309
|
+
this.installationConfirmationHandler
|
|
13310
|
+
);
|
|
13311
|
+
this.connection.onRequest(
|
|
13312
|
+
"installations.confirm",
|
|
13313
|
+
(params, token) => confirmation.confirm(params, token)
|
|
13314
|
+
);
|
|
13315
|
+
}
|
|
13753
13316
|
this.connection.onRequest(
|
|
13754
13317
|
"hooks.invoke",
|
|
13755
13318
|
async (params) => {
|
|
@@ -13898,7 +13461,6 @@ export {
|
|
|
13898
13461
|
CopilotWebSocketForwarder,
|
|
13899
13462
|
CopilotWebSocketHandler,
|
|
13900
13463
|
DisableBypassPermissionsModes,
|
|
13901
|
-
FactoryResumeError,
|
|
13902
13464
|
RuntimeConnection,
|
|
13903
13465
|
SYSTEM_MESSAGE_SECTIONS,
|
|
13904
13466
|
SessionFsSqliteTransactionFailure,
|
|
@@ -13909,9 +13471,7 @@ export {
|
|
|
13909
13471
|
createAttributedPermissionResult,
|
|
13910
13472
|
createCanvas,
|
|
13911
13473
|
createSessionFsAdapter,
|
|
13912
|
-
defineFactory,
|
|
13913
13474
|
defineTool,
|
|
13914
13475
|
defineWorkflow,
|
|
13915
|
-
isFactoryRunTerminal,
|
|
13916
13476
|
isWorkflowRunTerminal
|
|
13917
13477
|
};
|