opencode-m365-copilot 0.3.2 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{agent-C28PfLXM.mjs → agent-CdFt3iSQ.mjs} +1 -1
- package/dist/cli.mjs +3 -3
- package/dist/{dist-BGVW-hOf.mjs → dist-Bx5AzuFm.mjs} +179 -61
- package/dist/{login-Y2igNqfw.mjs → login-CRnd-p8w.mjs} +2 -2
- package/dist/plugin.mjs +2 -2
- package/dist/{server-Buz1ZIg5.mjs → server-Bfa7StU_.mjs} +11 -5
- package/dist/server.mjs +1 -1
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as createLogger, b as AGENT_FILE, d as POWERPLATFORM_SCOPE, l as BAP_SCOPE, y as writePrivateFile } from "./server-
|
|
1
|
+
import { _ as createLogger, b as AGENT_FILE, d as POWERPLATFORM_SCOPE, l as BAP_SCOPE, y as writePrivateFile } from "./server-Bfa7StU_.mjs";
|
|
2
2
|
import { createHash } from "node:crypto";
|
|
3
3
|
import { readFileSync } from "node:fs";
|
|
4
4
|
//#region src/agent.ts
|
package/dist/cli.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { C as SECRETS_FILE, M as LOCAL_TITLE_MODEL, S as CONFIG_DIR, T as PROVIDER_ID, a as startServer, b as AGENT_FILE, g as createTokenClient, j as DEFAULT_MODEL, k as mergeOpencodeConfig, x as CACHE_FILE } from "./server-
|
|
3
|
-
import { t as getOrCreateAgent } from "./agent-
|
|
2
|
+
import { C as SECRETS_FILE, M as LOCAL_TITLE_MODEL, S as CONFIG_DIR, T as PROVIDER_ID, a as startServer, b as AGENT_FILE, g as createTokenClient, j as DEFAULT_MODEL, k as mergeOpencodeConfig, x as CACHE_FILE } from "./server-Bfa7StU_.mjs";
|
|
3
|
+
import { t as getOrCreateAgent } from "./agent-CdFt3iSQ.mjs";
|
|
4
4
|
import { copyFileSync, existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
5
5
|
import { homedir } from "node:os";
|
|
6
6
|
import { dirname, join, resolve } from "node:path";
|
|
@@ -46,7 +46,7 @@ to complete SSO/MFA by hand once — the only option on tenants with push-only
|
|
|
46
46
|
MFA, FIDO2, or a federated IdP.`);
|
|
47
47
|
}
|
|
48
48
|
async function doLogin(args) {
|
|
49
|
-
const { login } = await import("./login-
|
|
49
|
+
const { login } = await import("./login-CRnd-p8w.mjs");
|
|
50
50
|
const interactive = args.includes("--interactive");
|
|
51
51
|
try {
|
|
52
52
|
const account = await login({
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { F as __require, I as __toESM, P as __commonJSMin } from "./server-
|
|
1
|
+
import { F as __require, I as __toESM, P as __commonJSMin } from "./server-Bfa7StU_.mjs";
|
|
2
2
|
import { randomUUID } from "node:crypto";
|
|
3
3
|
import http from "http";
|
|
4
4
|
import crypto, { createHash as createHash$1 } from "crypto";
|
|
5
5
|
//#region node_modules/@azure/msal-node/dist/cache/serializer/Serializer.mjs
|
|
6
|
-
/*! @azure/msal-node
|
|
6
|
+
/*! @azure/msal-node v7.0.0 2026-09-23 */
|
|
7
7
|
/**
|
|
8
8
|
* This class serializes cache entities to be saved into in-memory object types defined internally
|
|
9
9
|
* @internal
|
|
@@ -5949,7 +5949,7 @@ function containsResourceParam(params) {
|
|
|
5949
5949
|
}
|
|
5950
5950
|
//#endregion
|
|
5951
5951
|
//#region node_modules/@azure/msal-node/dist/cache/serializer/Deserializer.mjs
|
|
5952
|
-
/*! @azure/msal-node
|
|
5952
|
+
/*! @azure/msal-node v7.0.0 2026-09-23 */
|
|
5953
5953
|
/**
|
|
5954
5954
|
* This class deserializes cache entities read from the file into in-memory object types defined internally
|
|
5955
5955
|
* @internal
|
|
@@ -6097,7 +6097,7 @@ var Deserializer = class {
|
|
|
6097
6097
|
};
|
|
6098
6098
|
}
|
|
6099
6099
|
};
|
|
6100
|
-
/*! @azure/msal-node
|
|
6100
|
+
/*! @azure/msal-node v7.0.0 2026-09-23 */
|
|
6101
6101
|
/**
|
|
6102
6102
|
* Managed Identity Query Parameters - used in network requests
|
|
6103
6103
|
*/
|
|
@@ -6210,7 +6210,7 @@ const LOOPBACK_SERVER_CONSTANTS = {
|
|
|
6210
6210
|
};
|
|
6211
6211
|
//#endregion
|
|
6212
6212
|
//#region node_modules/@azure/msal-node/dist/network/HttpClient.mjs
|
|
6213
|
-
/*! @azure/msal-node
|
|
6213
|
+
/*! @azure/msal-node v7.0.0 2026-09-23 */
|
|
6214
6214
|
/**
|
|
6215
6215
|
* HTTP client implementation using Node.js native fetch API.
|
|
6216
6216
|
*
|
|
@@ -6347,7 +6347,7 @@ function getFetchHeaders(options) {
|
|
|
6347
6347
|
}
|
|
6348
6348
|
//#endregion
|
|
6349
6349
|
//#region node_modules/@azure/msal-node/dist/error/ManagedIdentityErrorCodes.mjs
|
|
6350
|
-
/*! @azure/msal-node
|
|
6350
|
+
/*! @azure/msal-node v7.0.0 2026-09-23 */
|
|
6351
6351
|
const invalidFileExtension = "invalid_file_extension";
|
|
6352
6352
|
const invalidFilePath = "invalid_file_path";
|
|
6353
6353
|
const invalidManagedIdentityIdType = "invalid_managed_identity_id_type";
|
|
@@ -6371,7 +6371,7 @@ const MsiEnvironmentVariableUrlMalformedErrorCodes = {
|
|
|
6371
6371
|
};
|
|
6372
6372
|
//#endregion
|
|
6373
6373
|
//#region node_modules/@azure/msal-node/dist/error/ManagedIdentityError.mjs
|
|
6374
|
-
/*! @azure/msal-node
|
|
6374
|
+
/*! @azure/msal-node v7.0.0 2026-09-23 */
|
|
6375
6375
|
/**
|
|
6376
6376
|
* ManagedIdentityErrorMessage class containing string constants used by error codes and messages.
|
|
6377
6377
|
*/
|
|
@@ -6408,10 +6408,10 @@ function createManagedIdentityError(errorCode, correlationId) {
|
|
|
6408
6408
|
}
|
|
6409
6409
|
//#endregion
|
|
6410
6410
|
//#region node_modules/@azure/msal-node/dist/config/ManagedIdentityId.mjs
|
|
6411
|
-
/*! @azure/msal-node
|
|
6411
|
+
/*! @azure/msal-node v7.0.0 2026-09-23 */
|
|
6412
6412
|
//#endregion
|
|
6413
6413
|
//#region node_modules/@azure/msal-node/dist/error/NodeAuthError.mjs
|
|
6414
|
-
/*! @azure/msal-node
|
|
6414
|
+
/*! @azure/msal-node v7.0.0 2026-09-23 */
|
|
6415
6415
|
/**
|
|
6416
6416
|
* NodeAuthErrorMessage class containing string constants used by error codes and messages.
|
|
6417
6417
|
*/
|
|
@@ -6440,6 +6440,10 @@ const NodeAuthErrorMessage = {
|
|
|
6440
6440
|
code: "loopback_server_timeout",
|
|
6441
6441
|
desc: "Timed out waiting for auth code listener to be registered."
|
|
6442
6442
|
},
|
|
6443
|
+
loopbackServerQueryResponseNotSupported: {
|
|
6444
|
+
code: "loopback_server_query_response_not_supported",
|
|
6445
|
+
desc: "The loopback server received an OAuth response in the URL. Interactive authentication requires form_post."
|
|
6446
|
+
},
|
|
6443
6447
|
stateNotFoundError: {
|
|
6444
6448
|
code: "state_not_found",
|
|
6445
6449
|
desc: "State not found. Please verify that the request originated from msal."
|
|
@@ -6495,6 +6499,12 @@ var NodeAuthError = class NodeAuthError extends AuthError {
|
|
|
6495
6499
|
return new NodeAuthError(NodeAuthErrorMessage.loopbackServerTimeout.code, correlationId, `${NodeAuthErrorMessage.loopbackServerTimeout.desc}`);
|
|
6496
6500
|
}
|
|
6497
6501
|
/**
|
|
6502
|
+
* Creates an error thrown if the loopback server receives an OAuth response in a query string.
|
|
6503
|
+
*/
|
|
6504
|
+
static createLoopbackServerQueryResponseNotSupportedError() {
|
|
6505
|
+
return new NodeAuthError(NodeAuthErrorMessage.loopbackServerQueryResponseNotSupported.code, "", NodeAuthErrorMessage.loopbackServerQueryResponseNotSupported.desc);
|
|
6506
|
+
}
|
|
6507
|
+
/**
|
|
6498
6508
|
* Creates an error thrown when the state is not present.
|
|
6499
6509
|
*/
|
|
6500
6510
|
static createStateNotFoundError(correlationId = "") {
|
|
@@ -6515,7 +6525,7 @@ var NodeAuthError = class NodeAuthError extends AuthError {
|
|
|
6515
6525
|
};
|
|
6516
6526
|
//#endregion
|
|
6517
6527
|
//#region node_modules/@azure/msal-node/dist/config/Configuration.mjs
|
|
6518
|
-
/*! @azure/msal-node
|
|
6528
|
+
/*! @azure/msal-node v7.0.0 2026-09-23 */
|
|
6519
6529
|
const DEFAULT_AUTH_OPTIONS = {
|
|
6520
6530
|
clientId: "",
|
|
6521
6531
|
authority: DEFAULT_AUTHORITY,
|
|
@@ -6590,7 +6600,7 @@ function buildAppConfiguration({ auth, broker, cache, system, telemetry }) {
|
|
|
6590
6600
|
}
|
|
6591
6601
|
//#endregion
|
|
6592
6602
|
//#region node_modules/@azure/msal-node/dist/crypto/GuidGenerator.mjs
|
|
6593
|
-
/*! @azure/msal-node
|
|
6603
|
+
/*! @azure/msal-node v7.0.0 2026-09-23 */
|
|
6594
6604
|
var GuidGenerator = class {
|
|
6595
6605
|
/**
|
|
6596
6606
|
* Generates a random [RFC 4122](https://www.rfc-editor.org/rfc/rfc4122.txt) version 4 UUID. The UUID is generated using a
|
|
@@ -6609,7 +6619,7 @@ var GuidGenerator = class {
|
|
|
6609
6619
|
};
|
|
6610
6620
|
//#endregion
|
|
6611
6621
|
//#region node_modules/@azure/msal-node/dist/utils/EncodingUtils.mjs
|
|
6612
|
-
/*! @azure/msal-node
|
|
6622
|
+
/*! @azure/msal-node v7.0.0 2026-09-23 */
|
|
6613
6623
|
var EncodingUtils = class EncodingUtils {
|
|
6614
6624
|
/**
|
|
6615
6625
|
* 'utf8': Multibyte encoded Unicode characters. Many web pages and other document formats use UTF-8.
|
|
@@ -6647,7 +6657,7 @@ var EncodingUtils = class EncodingUtils {
|
|
|
6647
6657
|
};
|
|
6648
6658
|
//#endregion
|
|
6649
6659
|
//#region node_modules/@azure/msal-node/dist/crypto/HashUtils.mjs
|
|
6650
|
-
/*! @azure/msal-node
|
|
6660
|
+
/*! @azure/msal-node v7.0.0 2026-09-23 */
|
|
6651
6661
|
var HashUtils = class {
|
|
6652
6662
|
/**
|
|
6653
6663
|
* generate 'SHA256' hash
|
|
@@ -6659,7 +6669,7 @@ var HashUtils = class {
|
|
|
6659
6669
|
};
|
|
6660
6670
|
//#endregion
|
|
6661
6671
|
//#region node_modules/@azure/msal-node/dist/crypto/PkceGenerator.mjs
|
|
6662
|
-
/*! @azure/msal-node
|
|
6672
|
+
/*! @azure/msal-node v7.0.0 2026-09-23 */
|
|
6663
6673
|
/**
|
|
6664
6674
|
* https://tools.ietf.org/html/rfc7636#page-8
|
|
6665
6675
|
*/
|
|
@@ -6703,7 +6713,7 @@ var PkceGenerator = class {
|
|
|
6703
6713
|
};
|
|
6704
6714
|
//#endregion
|
|
6705
6715
|
//#region node_modules/@azure/msal-node/dist/crypto/CryptoProvider.mjs
|
|
6706
|
-
/*! @azure/msal-node
|
|
6716
|
+
/*! @azure/msal-node v7.0.0 2026-09-23 */
|
|
6707
6717
|
/**
|
|
6708
6718
|
* This class implements MSAL node's crypto interface, which allows it to perform base64 encoding and decoding, generating cryptographically random GUIDs and
|
|
6709
6719
|
* implementing Proof Key for Code Exchange specs for the OAuth Authorization Code Flow using PKCE (rfc here: https://tools.ietf.org/html/rfc7636).
|
|
@@ -6790,7 +6800,7 @@ var CryptoProvider = class {
|
|
|
6790
6800
|
};
|
|
6791
6801
|
//#endregion
|
|
6792
6802
|
//#region node_modules/@azure/msal-node/dist/cache/CacheHelpers.mjs
|
|
6793
|
-
/*! @azure/msal-node
|
|
6803
|
+
/*! @azure/msal-node v7.0.0 2026-09-23 */
|
|
6794
6804
|
/**
|
|
6795
6805
|
* Computes a combined hash from additional cache key components.
|
|
6796
6806
|
*
|
|
@@ -6844,7 +6854,7 @@ function generateAccountKey(account) {
|
|
|
6844
6854
|
}
|
|
6845
6855
|
//#endregion
|
|
6846
6856
|
//#region node_modules/@azure/msal-node/dist/cache/NodeStorage.mjs
|
|
6847
|
-
/*! @azure/msal-node
|
|
6857
|
+
/*! @azure/msal-node v7.0.0 2026-09-23 */
|
|
6848
6858
|
/**
|
|
6849
6859
|
* This class implements Storage for node, reading cache from user specified storage location or an extension library
|
|
6850
6860
|
* @public
|
|
@@ -7211,7 +7221,7 @@ var NodeStorage = class extends CacheManager {
|
|
|
7211
7221
|
};
|
|
7212
7222
|
//#endregion
|
|
7213
7223
|
//#region node_modules/@azure/msal-node/dist/cache/TokenCache.mjs
|
|
7214
|
-
/*! @azure/msal-node
|
|
7224
|
+
/*! @azure/msal-node v7.0.0 2026-09-23 */
|
|
7215
7225
|
const defaultSerializedCache = {
|
|
7216
7226
|
Account: {},
|
|
7217
7227
|
IdToken: {},
|
|
@@ -11607,7 +11617,7 @@ var import_jsonwebtoken = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin
|
|
|
11607
11617
|
TokenExpiredError: require_TokenExpiredError()
|
|
11608
11618
|
};
|
|
11609
11619
|
})))(), 1);
|
|
11610
|
-
/*! @azure/msal-node
|
|
11620
|
+
/*! @azure/msal-node v7.0.0 2026-09-23 */
|
|
11611
11621
|
const userTimeoutReached = "user_timeout_reached";
|
|
11612
11622
|
const invalidAssertion = "invalid_assertion";
|
|
11613
11623
|
const deviceCodePollingCancelled = "device_code_polling_cancelled";
|
|
@@ -11615,7 +11625,7 @@ const deviceCodeExpired = "device_code_expired";
|
|
|
11615
11625
|
const deviceCodeUnknownError = "device_code_unknown_error";
|
|
11616
11626
|
//#endregion
|
|
11617
11627
|
//#region node_modules/@azure/msal-node/dist/client/ClientAssertion.mjs
|
|
11618
|
-
/*! @azure/msal-node
|
|
11628
|
+
/*! @azure/msal-node v7.0.0 2026-09-23 */
|
|
11619
11629
|
/**
|
|
11620
11630
|
* Client assertion of type jwt-bearer used in confidential client flows
|
|
11621
11631
|
* @public
|
|
@@ -11723,12 +11733,12 @@ var ClientAssertion = class ClientAssertion {
|
|
|
11723
11733
|
};
|
|
11724
11734
|
//#endregion
|
|
11725
11735
|
//#region node_modules/@azure/msal-node/dist/packageMetadata.mjs
|
|
11726
|
-
/*! @azure/msal-node
|
|
11736
|
+
/*! @azure/msal-node v7.0.0 2026-09-23 */
|
|
11727
11737
|
const name = "@azure/msal-node";
|
|
11728
|
-
const version = "
|
|
11738
|
+
const version = "7.0.0";
|
|
11729
11739
|
//#endregion
|
|
11730
11740
|
//#region node_modules/@azure/msal-node/dist/client/BaseClient.mjs
|
|
11731
|
-
/*! @azure/msal-node
|
|
11741
|
+
/*! @azure/msal-node v7.0.0 2026-09-23 */
|
|
11732
11742
|
/**
|
|
11733
11743
|
* Base application class which will construct requests to send to and handle responses from the Microsoft STS using the authorization code flow.
|
|
11734
11744
|
* @internal
|
|
@@ -11780,7 +11790,7 @@ var BaseClient = class {
|
|
|
11780
11790
|
};
|
|
11781
11791
|
//#endregion
|
|
11782
11792
|
//#region node_modules/@azure/msal-node/dist/client/UsernamePasswordClient.mjs
|
|
11783
|
-
/*! @azure/msal-node
|
|
11793
|
+
/*! @azure/msal-node v7.0.0 2026-09-23 */
|
|
11784
11794
|
/**
|
|
11785
11795
|
* Oauth2.0 Password grant client
|
|
11786
11796
|
* Note: We are only supporting public clients for password grant and for purely testing purposes
|
|
@@ -11861,7 +11871,7 @@ var UsernamePasswordClient = class extends BaseClient {
|
|
|
11861
11871
|
};
|
|
11862
11872
|
//#endregion
|
|
11863
11873
|
//#region node_modules/@azure/msal-node/dist/protocol/Authorize.mjs
|
|
11864
|
-
/*! @azure/msal-node
|
|
11874
|
+
/*! @azure/msal-node v7.0.0 2026-09-23 */
|
|
11865
11875
|
/**
|
|
11866
11876
|
* Constructs the full /authorize URL with request parameters
|
|
11867
11877
|
* @param config
|
|
@@ -11889,8 +11899,103 @@ function getAuthCodeRequestUrl(config, authority, request, logger) {
|
|
|
11889
11899
|
return getAuthorizeUrl(authority, parameters);
|
|
11890
11900
|
}
|
|
11891
11901
|
//#endregion
|
|
11902
|
+
//#region node_modules/@azure/msal-node/dist/client/SilentRequestCoalescer.mjs
|
|
11903
|
+
/*! @azure/msal-node v7.0.0 2026-09-23 */
|
|
11904
|
+
const activeSilentTokenRequests = /* @__PURE__ */ new WeakMap();
|
|
11905
|
+
/**
|
|
11906
|
+
* Shares an in-flight silent acquisition while preserving each caller's correlation ID.
|
|
11907
|
+
*/
|
|
11908
|
+
function acquireTokenSilentDeduped(owner, logger, silentRequestKey, correlationId, acquireToken) {
|
|
11909
|
+
const existingRequests = activeSilentTokenRequests.get(owner);
|
|
11910
|
+
const activeRequests = existingRequests || /* @__PURE__ */ new Map();
|
|
11911
|
+
if (!existingRequests) activeSilentTokenRequests.set(owner, activeRequests);
|
|
11912
|
+
const inProgressRequest = activeRequests.get(silentRequestKey);
|
|
11913
|
+
if (inProgressRequest) {
|
|
11914
|
+
logger.verbose("acquireTokenSilent has been called previously, returning the result from the first call", correlationId);
|
|
11915
|
+
return applyCallerCorrelationIdToResult(inProgressRequest, correlationId);
|
|
11916
|
+
}
|
|
11917
|
+
logger.verbose("acquireTokenSilent called for the first time, storing active request", correlationId);
|
|
11918
|
+
const activeRequest = Promise.resolve().then(acquireToken).finally(() => {
|
|
11919
|
+
activeRequests.delete(silentRequestKey);
|
|
11920
|
+
if (activeRequests.size === 0) activeSilentTokenRequests.delete(owner);
|
|
11921
|
+
});
|
|
11922
|
+
activeRequests.set(silentRequestKey, activeRequest);
|
|
11923
|
+
return applyCallerCorrelationIdToResult(activeRequest, correlationId);
|
|
11924
|
+
}
|
|
11925
|
+
/**
|
|
11926
|
+
* Builds the key used to identify equivalent in-progress silent requests.
|
|
11927
|
+
*/
|
|
11928
|
+
function getSilentRequestKey(input) {
|
|
11929
|
+
const { request } = input;
|
|
11930
|
+
const authority = input.requestType === "native" ? request.authority : input.authority;
|
|
11931
|
+
const commonKeyFields = {
|
|
11932
|
+
requestType: input.requestType,
|
|
11933
|
+
clientId: input.requestType === "native" ? input.request.clientId : input.clientId,
|
|
11934
|
+
authority,
|
|
11935
|
+
scopes: canonicalizeRequestValues(request.scopes),
|
|
11936
|
+
claims: request.claims,
|
|
11937
|
+
authenticationScheme: request.authenticationScheme,
|
|
11938
|
+
resourceRequestMethod: request.resourceRequestMethod,
|
|
11939
|
+
resourceRequestUri: request.resourceRequestUri,
|
|
11940
|
+
forceRefresh: request.forceRefresh,
|
|
11941
|
+
redirectUri: request.redirectUri || "",
|
|
11942
|
+
resource: request.resource,
|
|
11943
|
+
extraParameters: canonicalizeRequestValues(request.extraParameters)
|
|
11944
|
+
};
|
|
11945
|
+
if (input.requestType === "native") return JSON.stringify({
|
|
11946
|
+
...commonKeyFields,
|
|
11947
|
+
accountId: input.request.accountId,
|
|
11948
|
+
shrNonce: input.request.shrNonce,
|
|
11949
|
+
extraScopesToConsent: canonicalizeRequestValues(input.request.extraScopesToConsent),
|
|
11950
|
+
loginHint: input.request.loginHint,
|
|
11951
|
+
prompt: input.request.prompt
|
|
11952
|
+
});
|
|
11953
|
+
const nonNativeRequest = input.request;
|
|
11954
|
+
const thumbprint = getRequestThumbprint(input.clientId, {
|
|
11955
|
+
...nonNativeRequest,
|
|
11956
|
+
authority
|
|
11957
|
+
}, nonNativeRequest.account.homeAccountId);
|
|
11958
|
+
return JSON.stringify({
|
|
11959
|
+
...thumbprint,
|
|
11960
|
+
...commonKeyFields,
|
|
11961
|
+
accountTenantId: nonNativeRequest.account.tenantId,
|
|
11962
|
+
accountEnvironment: nonNativeRequest.account.environment,
|
|
11963
|
+
refreshTokenExpirationOffsetSeconds: nonNativeRequest.refreshTokenExpirationOffsetSeconds,
|
|
11964
|
+
extraQueryParameters: canonicalizeRequestValues(nonNativeRequest.extraQueryParameters),
|
|
11965
|
+
skipBrokerClaims: thumbprint.embeddedClientId || nonNativeRequest.extraParameters?.["brk_client_id"] ? nonNativeRequest.skipBrokerClaims : void 0
|
|
11966
|
+
});
|
|
11967
|
+
}
|
|
11968
|
+
/**
|
|
11969
|
+
* Copies mutable native request values so execution cannot diverge from the stored key.
|
|
11970
|
+
*/
|
|
11971
|
+
function snapshotNativeRequest(request) {
|
|
11972
|
+
return {
|
|
11973
|
+
...request,
|
|
11974
|
+
scopes: [...request.scopes],
|
|
11975
|
+
extraParameters: request.extraParameters ? { ...request.extraParameters } : void 0,
|
|
11976
|
+
extraScopesToConsent: request.extraScopesToConsent ? [...request.extraScopesToConsent] : void 0
|
|
11977
|
+
};
|
|
11978
|
+
}
|
|
11979
|
+
/**
|
|
11980
|
+
* Canonicalizes scope sets and request dictionaries without changing the outgoing request.
|
|
11981
|
+
*/
|
|
11982
|
+
function canonicalizeRequestValues(values) {
|
|
11983
|
+
if (Array.isArray(values)) return Array.from(new Set(values.map((scope) => scope.trim()).filter((scope) => scope.length > 0))).sort();
|
|
11984
|
+
return values ? Object.keys(values).sort().map((key) => [key, values[key]]) : void 0;
|
|
11985
|
+
}
|
|
11986
|
+
/**
|
|
11987
|
+
* Applies the caller's correlation ID to successful results.
|
|
11988
|
+
* Shared failures retain the original error and underlying operation correlation ID.
|
|
11989
|
+
*/
|
|
11990
|
+
function applyCallerCorrelationIdToResult(activeRequest, correlationId) {
|
|
11991
|
+
return activeRequest.then((result) => ({
|
|
11992
|
+
...result,
|
|
11993
|
+
correlationId
|
|
11994
|
+
}));
|
|
11995
|
+
}
|
|
11996
|
+
//#endregion
|
|
11892
11997
|
//#region node_modules/@azure/msal-node/dist/client/ClientApplication.mjs
|
|
11893
|
-
/*! @azure/msal-node
|
|
11998
|
+
/*! @azure/msal-node v7.0.0 2026-09-23 */
|
|
11894
11999
|
/**
|
|
11895
12000
|
* Base abstract class for all ClientApplications - public and confidential
|
|
11896
12001
|
* @public
|
|
@@ -12001,6 +12106,7 @@ var ClientApplication = class {
|
|
|
12001
12106
|
*
|
|
12002
12107
|
* This API expects the user to provide an account object and looks into the cache to retrieve the token if present.
|
|
12003
12108
|
* There is also an optional "forceRefresh" boolean the user can send to bypass the cache for access_token and id_token.
|
|
12109
|
+
* Concurrent requests with the same request thumbprint return the same in-progress result.
|
|
12004
12110
|
* In case the refresh_token is expired or not found, an error is thrown
|
|
12005
12111
|
* and the guidance is for the user to call any interactive token acquisition API (eg: `acquireTokenByCode()`).
|
|
12006
12112
|
*/
|
|
@@ -12010,9 +12116,19 @@ var ClientApplication = class {
|
|
|
12010
12116
|
...await this.initializeBaseRequest(request),
|
|
12011
12117
|
forceRefresh: request.forceRefresh || false
|
|
12012
12118
|
};
|
|
12119
|
+
if (!validRequest.account) return this.acquireTokenSilentAsync(validRequest, request.azureCloudOptions);
|
|
12120
|
+
const silentRequestKey = getSilentRequestKey({
|
|
12121
|
+
requestType: "non-native",
|
|
12122
|
+
request: validRequest,
|
|
12123
|
+
authority: Authority.generateAuthority(validRequest.authority, request.azureCloudOptions || this.config.auth.azureCloudOptions),
|
|
12124
|
+
clientId: this.config.auth.clientId
|
|
12125
|
+
});
|
|
12126
|
+
return acquireTokenSilentDeduped(this, this.logger, silentRequestKey, validRequest.correlationId, () => this.acquireTokenSilentAsync(validRequest, request.azureCloudOptions));
|
|
12127
|
+
}
|
|
12128
|
+
async acquireTokenSilentAsync(validRequest, azureCloudOptions) {
|
|
12013
12129
|
const serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenSilent, validRequest.correlationId, validRequest.forceRefresh);
|
|
12014
12130
|
try {
|
|
12015
|
-
const discoveredAuthority = await this.createAuthority(validRequest.authority, validRequest.correlationId, void 0,
|
|
12131
|
+
const discoveredAuthority = await this.createAuthority(validRequest.authority, validRequest.correlationId, void 0, azureCloudOptions);
|
|
12016
12132
|
const clientConfiguration = await this.buildOauthClientConfiguration(discoveredAuthority, validRequest.correlationId, validRequest.redirectUri || "", serverTelemetryManager);
|
|
12017
12133
|
const silentFlowClient = new SilentFlowClient(clientConfiguration, new StubPerformanceClient());
|
|
12018
12134
|
this.logger.verbose("Silent flow client created", validRequest.correlationId);
|
|
@@ -12210,7 +12326,7 @@ var ClientApplication = class {
|
|
|
12210
12326
|
};
|
|
12211
12327
|
//#endregion
|
|
12212
12328
|
//#region node_modules/@azure/msal-node/dist/network/LoopbackClient.mjs
|
|
12213
|
-
/*! @azure/msal-node
|
|
12329
|
+
/*! @azure/msal-node v7.0.0 2026-09-23 */
|
|
12214
12330
|
var LoopbackClient = class {
|
|
12215
12331
|
constructor(preferredPort) {
|
|
12216
12332
|
this.preferredPort = preferredPort;
|
|
@@ -12252,12 +12368,9 @@ var LoopbackClient = class {
|
|
|
12252
12368
|
res.end();
|
|
12253
12369
|
return;
|
|
12254
12370
|
}
|
|
12255
|
-
|
|
12256
|
-
|
|
12257
|
-
|
|
12258
|
-
}
|
|
12259
|
-
if (authCodeResponse.error) res.end(errorTemplate || `Error occurred: ${authCodeResponse.error}`);
|
|
12260
|
-
resolve(authCodeResponse);
|
|
12371
|
+
res.writeHead(400);
|
|
12372
|
+
res.end("OAuth responses must use form_post and cannot be returned in the URL.");
|
|
12373
|
+
reject(NodeAuthError.createLoopbackServerQueryResponseNotSupportedError());
|
|
12261
12374
|
} else {
|
|
12262
12375
|
res.writeHead(200);
|
|
12263
12376
|
res.end();
|
|
@@ -12333,7 +12446,7 @@ var LoopbackClient = class {
|
|
|
12333
12446
|
};
|
|
12334
12447
|
//#endregion
|
|
12335
12448
|
//#region node_modules/@azure/msal-node/dist/client/DeviceCodeClient.mjs
|
|
12336
|
-
/*! @azure/msal-node
|
|
12449
|
+
/*! @azure/msal-node v7.0.0 2026-09-23 */
|
|
12337
12450
|
/**
|
|
12338
12451
|
* OAuth2.0 Device code client
|
|
12339
12452
|
* @public
|
|
@@ -12507,7 +12620,7 @@ var DeviceCodeClient = class extends BaseClient {
|
|
|
12507
12620
|
};
|
|
12508
12621
|
//#endregion
|
|
12509
12622
|
//#region node_modules/@azure/msal-node/dist/client/PublicClientApplication.mjs
|
|
12510
|
-
/*! @azure/msal-node
|
|
12623
|
+
/*! @azure/msal-node v7.0.0 2026-09-23 */
|
|
12511
12624
|
/**
|
|
12512
12625
|
* This class is to be used to acquire tokens for public client applications (desktop, mobile). Public client applications
|
|
12513
12626
|
* are not trusted to safely store application secrets, and therefore can only request tokens in the name of an user.
|
|
@@ -12600,8 +12713,8 @@ var PublicClientApplication = class extends ClientApplication {
|
|
|
12600
12713
|
}
|
|
12601
12714
|
const { verifier, challenge } = await this.cryptoProvider.generatePkceCodes();
|
|
12602
12715
|
const loopbackClient = new LoopbackClient(preferredPort);
|
|
12603
|
-
const responseMode = remainingProperties.responseMode
|
|
12604
|
-
if (responseMode !==
|
|
12716
|
+
const responseMode = remainingProperties.responseMode;
|
|
12717
|
+
if (responseMode !== void 0 && responseMode !== ResponseMode$1.FORM_POST) throw createClientConfigurationError(invalidResponseMode, correlationId);
|
|
12605
12718
|
let authCodeResponse = {};
|
|
12606
12719
|
let authCodeListenerError = null;
|
|
12607
12720
|
try {
|
|
@@ -12616,7 +12729,7 @@ var PublicClientApplication = class extends ClientApplication {
|
|
|
12616
12729
|
correlationId,
|
|
12617
12730
|
scopes: request.scopes || OIDC_DEFAULT_SCOPES,
|
|
12618
12731
|
redirectUri,
|
|
12619
|
-
responseMode,
|
|
12732
|
+
responseMode: ResponseMode$1.FORM_POST,
|
|
12620
12733
|
codeChallenge: challenge,
|
|
12621
12734
|
codeChallengeMethod: CodeChallengeMethodValues.S256
|
|
12622
12735
|
};
|
|
@@ -12647,7 +12760,8 @@ var PublicClientApplication = class extends ClientApplication {
|
|
|
12647
12760
|
this.logger.trace("acquireTokenSilent called", correlationId);
|
|
12648
12761
|
enforceResourceParameter(this.config.auth.isMcp, request);
|
|
12649
12762
|
if (this.nativeBrokerPlugin) {
|
|
12650
|
-
const
|
|
12763
|
+
const nativeBrokerPlugin = this.nativeBrokerPlugin;
|
|
12764
|
+
const brokerRequest = snapshotNativeRequest({
|
|
12651
12765
|
...request,
|
|
12652
12766
|
clientId: this.config.auth.clientId,
|
|
12653
12767
|
scopes: request.scopes || OIDC_DEFAULT_SCOPES,
|
|
@@ -12661,8 +12775,12 @@ var PublicClientApplication = class extends ClientApplication {
|
|
|
12661
12775
|
},
|
|
12662
12776
|
accountId: request.account.nativeAccountId,
|
|
12663
12777
|
forceRefresh: request.forceRefresh || false
|
|
12664
|
-
};
|
|
12665
|
-
|
|
12778
|
+
});
|
|
12779
|
+
const silentRequestKey = getSilentRequestKey({
|
|
12780
|
+
requestType: "native",
|
|
12781
|
+
request: brokerRequest
|
|
12782
|
+
});
|
|
12783
|
+
return acquireTokenSilentDeduped(this, this.logger, silentRequestKey, correlationId, () => nativeBrokerPlugin.acquireTokenSilent(brokerRequest));
|
|
12666
12784
|
}
|
|
12667
12785
|
if (request.redirectUri) {
|
|
12668
12786
|
if (!this.config.broker.nativeBrokerPlugin) throw NodeAuthError.createRedirectUriNotSupportedError(correlationId);
|
|
@@ -12748,19 +12866,19 @@ var PublicClientApplication = class extends ClientApplication {
|
|
|
12748
12866
|
};
|
|
12749
12867
|
//#endregion
|
|
12750
12868
|
//#region node_modules/@azure/msal-node/dist/client/ClientCredentialClient.mjs
|
|
12751
|
-
/*! @azure/msal-node
|
|
12869
|
+
/*! @azure/msal-node v7.0.0 2026-09-23 */
|
|
12752
12870
|
//#endregion
|
|
12753
12871
|
//#region node_modules/@azure/msal-node/dist/client/OnBehalfOfClient.mjs
|
|
12754
|
-
/*! @azure/msal-node
|
|
12872
|
+
/*! @azure/msal-node v7.0.0 2026-09-23 */
|
|
12755
12873
|
//#endregion
|
|
12756
12874
|
//#region node_modules/@azure/msal-node/dist/client/UserFederatedIdentityCredentialClient.mjs
|
|
12757
|
-
/*! @azure/msal-node
|
|
12875
|
+
/*! @azure/msal-node v7.0.0 2026-09-23 */
|
|
12758
12876
|
//#endregion
|
|
12759
12877
|
//#region node_modules/@azure/msal-node/dist/client/ConfidentialClientApplication.mjs
|
|
12760
|
-
/*! @azure/msal-node
|
|
12878
|
+
/*! @azure/msal-node v7.0.0 2026-09-23 */
|
|
12761
12879
|
//#endregion
|
|
12762
12880
|
//#region node_modules/@azure/msal-node/dist/utils/TimeUtils.mjs
|
|
12763
|
-
/*! @azure/msal-node
|
|
12881
|
+
/*! @azure/msal-node v7.0.0 2026-09-23 */
|
|
12764
12882
|
/**
|
|
12765
12883
|
* @internal
|
|
12766
12884
|
* Checks if a given date string is in ISO 8601 format.
|
|
@@ -12775,7 +12893,7 @@ function isIso8601(dateString) {
|
|
|
12775
12893
|
}
|
|
12776
12894
|
//#endregion
|
|
12777
12895
|
//#region node_modules/@azure/msal-node/dist/network/HttpClientWithRetries.mjs
|
|
12778
|
-
/*! @azure/msal-node
|
|
12896
|
+
/*! @azure/msal-node v7.0.0 2026-09-23 */
|
|
12779
12897
|
var HttpClientWithRetries = class {
|
|
12780
12898
|
constructor(httpClientNoRetries, retryPolicy, logger) {
|
|
12781
12899
|
this.httpClientNoRetries = httpClientNoRetries;
|
|
@@ -12805,7 +12923,7 @@ var HttpClientWithRetries = class {
|
|
|
12805
12923
|
};
|
|
12806
12924
|
//#endregion
|
|
12807
12925
|
//#region node_modules/@azure/msal-node/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.mjs
|
|
12808
|
-
/*! @azure/msal-node
|
|
12926
|
+
/*! @azure/msal-node v7.0.0 2026-09-23 */
|
|
12809
12927
|
/**
|
|
12810
12928
|
* Managed Identity User Assigned Id Query Parameter Names
|
|
12811
12929
|
*/
|
|
@@ -12995,21 +13113,21 @@ BaseManagedIdentitySource.getValidatedEnvVariableUrlString = (envVariableStringN
|
|
|
12995
13113
|
throw createManagedIdentityError(MsiEnvironmentVariableUrlMalformedErrorCodes[envVariableStringName], "");
|
|
12996
13114
|
}
|
|
12997
13115
|
};
|
|
12998
|
-
/*! @azure/msal-node
|
|
12999
|
-
/*! @azure/msal-node
|
|
13000
|
-
/*! @azure/msal-node
|
|
13001
|
-
/*! @azure/msal-node
|
|
13116
|
+
/*! @azure/msal-node v7.0.0 2026-09-23 */
|
|
13117
|
+
/*! @azure/msal-node v7.0.0 2026-09-23 */
|
|
13118
|
+
/*! @azure/msal-node v7.0.0 2026-09-23 */
|
|
13119
|
+
/*! @azure/msal-node v7.0.0 2026-09-23 */
|
|
13002
13120
|
`${process.env["ProgramData"]}`;
|
|
13003
13121
|
`${process.env["ProgramFiles"]}`;
|
|
13004
|
-
/*! @azure/msal-node
|
|
13005
|
-
/*! @azure/msal-node
|
|
13006
|
-
/*! @azure/msal-node
|
|
13007
|
-
/*! @azure/msal-node
|
|
13008
|
-
/*! @azure/msal-node
|
|
13122
|
+
/*! @azure/msal-node v7.0.0 2026-09-23 */
|
|
13123
|
+
/*! @azure/msal-node v7.0.0 2026-09-23 */
|
|
13124
|
+
/*! @azure/msal-node v7.0.0 2026-09-23 */
|
|
13125
|
+
/*! @azure/msal-node v7.0.0 2026-09-23 */
|
|
13126
|
+
/*! @azure/msal-node v7.0.0 2026-09-23 */
|
|
13009
13127
|
`${ManagedIdentitySourceNames.MACHINE_LEARNING}`;
|
|
13010
|
-
/*! @azure/msal-node
|
|
13011
|
-
/*! @azure/msal-node
|
|
13128
|
+
/*! @azure/msal-node v7.0.0 2026-09-23 */
|
|
13129
|
+
/*! @azure/msal-node v7.0.0 2026-09-23 */
|
|
13012
13130
|
ManagedIdentitySourceNames.SERVICE_FABRIC;
|
|
13013
|
-
/*! @azure/msal-node
|
|
13131
|
+
/*! @azure/msal-node v7.0.0 2026-09-23 */
|
|
13014
13132
|
//#endregion
|
|
13015
13133
|
export { CryptoProvider, PublicClientApplication };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as SECRETS_FILE, S as CONFIG_DIR, _ as createLogger, c as AUTHORITY, f as REDIRECT_URI, h as createCachePlugin, m as authCodeFromUrl, o as object, p as SYDNEY_SCOPES, s as string, u as CLIENT_ID, v as ensurePrivateDir } from "./server-
|
|
1
|
+
import { C as SECRETS_FILE, S as CONFIG_DIR, _ as createLogger, c as AUTHORITY, f as REDIRECT_URI, h as createCachePlugin, m as authCodeFromUrl, o as object, p as SYDNEY_SCOPES, s as string, u as CLIENT_ID, v as ensurePrivateDir } from "./server-Bfa7StU_.mjs";
|
|
2
2
|
import { chmodSync, existsSync, readFileSync, statSync } from "node:fs";
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
//#region src/login.ts
|
|
@@ -96,7 +96,7 @@ async function login(options = {}) {
|
|
|
96
96
|
const secrets = loadSecrets(options.secretsFile);
|
|
97
97
|
const interactive = options.interactive ?? !secrets?.mfaSecret;
|
|
98
98
|
if (!interactive && !secrets) throw new Error(`No credentials at ${options.secretsFile ?? SECRETS_FILE}. Create it with { "email", "password", "mfaSecret" }, or sign in interactively with --interactive.`);
|
|
99
|
-
const { PublicClientApplication, CryptoProvider } = await import("./dist-
|
|
99
|
+
const { PublicClientApplication, CryptoProvider } = await import("./dist-Bx5AzuFm.mjs");
|
|
100
100
|
const app = new PublicClientApplication({
|
|
101
101
|
auth: {
|
|
102
102
|
clientId: CLIENT_ID,
|
package/dist/plugin.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as resolveOptions, D as buildModelInfos, E as applyPluginConfig, N as isLocalModel, O as buildProviderInfo, T as PROVIDER_ID, _ as createLogger, a as startServer, g as createTokenClient, j as DEFAULT_MODEL, r as SESSION_ID_HEADER, t as AUX_REQUEST_KIND_HEADER, w as PLUGIN_ID } from "./server-
|
|
2
|
-
import { t as getOrCreateAgent } from "./agent-
|
|
1
|
+
import { A as resolveOptions, D as buildModelInfos, E as applyPluginConfig, N as isLocalModel, O as buildProviderInfo, T as PROVIDER_ID, _ as createLogger, a as startServer, g as createTokenClient, j as DEFAULT_MODEL, r as SESSION_ID_HEADER, t as AUX_REQUEST_KIND_HEADER, w as PLUGIN_ID } from "./server-Bfa7StU_.mjs";
|
|
2
|
+
import { t as getOrCreateAgent } from "./agent-CdFt3iSQ.mjs";
|
|
3
3
|
//#region src/runtime.ts
|
|
4
4
|
/**
|
|
5
5
|
* The part of the plugin that is the same under both opencode plugin APIs.
|
|
@@ -1004,7 +1004,7 @@ function createTokenClient(options = {}) {
|
|
|
1004
1004
|
const cache = /* @__PURE__ */ new Map();
|
|
1005
1005
|
async function client() {
|
|
1006
1006
|
if (app) return app;
|
|
1007
|
-
const { PublicClientApplication } = await import("./dist-
|
|
1007
|
+
const { PublicClientApplication } = await import("./dist-Bx5AzuFm.mjs");
|
|
1008
1008
|
app = new PublicClientApplication({
|
|
1009
1009
|
auth: {
|
|
1010
1010
|
clientId: CLIENT_ID,
|
|
@@ -3172,11 +3172,16 @@ var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
3172
3172
|
this._bufferedAmount = 0;
|
|
3173
3173
|
this._isServer = false;
|
|
3174
3174
|
this._redirects = 0;
|
|
3175
|
-
if (protocols === void 0)
|
|
3176
|
-
|
|
3175
|
+
if (protocols === void 0) {
|
|
3176
|
+
if (!options || options.protocols === void 0) protocols = [];
|
|
3177
|
+
else if (Array.isArray(options.protocols)) protocols = options.protocols;
|
|
3178
|
+
else protocols = [options.protocols];
|
|
3179
|
+
} else if (!Array.isArray(protocols)) {
|
|
3177
3180
|
if (typeof protocols === "object" && protocols !== null) {
|
|
3178
3181
|
options = protocols;
|
|
3179
|
-
protocols = [];
|
|
3182
|
+
if (options.protocols === void 0) protocols = [];
|
|
3183
|
+
else if (Array.isArray(options.protocols)) protocols = options.protocols;
|
|
3184
|
+
else protocols = [options.protocols];
|
|
3180
3185
|
} else protocols = [protocols];
|
|
3181
3186
|
}
|
|
3182
3187
|
initAsClient(this, address, protocols, options);
|
|
@@ -3366,12 +3371,12 @@ var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
3366
3371
|
if (this._closeFrameSent && (this._closeFrameReceived || this._receiver._writableState.errorEmitted)) this._socket.end();
|
|
3367
3372
|
return;
|
|
3368
3373
|
}
|
|
3369
|
-
this._readyState = WebSocket.CLOSING;
|
|
3370
3374
|
this._sender.close(code, data, !this._isServer, (err) => {
|
|
3371
3375
|
if (err) return;
|
|
3372
3376
|
this._closeFrameSent = true;
|
|
3373
3377
|
if (this._closeFrameReceived || this._receiver._writableState.errorEmitted) this._socket.end();
|
|
3374
3378
|
});
|
|
3379
|
+
this._readyState = WebSocket.CLOSING;
|
|
3375
3380
|
setCloseTimer(this);
|
|
3376
3381
|
}
|
|
3377
3382
|
/**
|
|
@@ -3654,6 +3659,7 @@ var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
3654
3659
|
socketPath: void 0,
|
|
3655
3660
|
hostname: void 0,
|
|
3656
3661
|
protocol: void 0,
|
|
3662
|
+
protocols: void 0,
|
|
3657
3663
|
timeout: void 0,
|
|
3658
3664
|
method: "GET",
|
|
3659
3665
|
host: void 0,
|
package/dist/server.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as startServer, i as generateApiKey, j as DEFAULT_MODEL, n as DEFAULT_MAX_BODY_BYTES, r as SESSION_ID_HEADER, t as AUX_REQUEST_KIND_HEADER } from "./server-
|
|
1
|
+
import { a as startServer, i as generateApiKey, j as DEFAULT_MODEL, n as DEFAULT_MAX_BODY_BYTES, r as SESSION_ID_HEADER, t as AUX_REQUEST_KIND_HEADER } from "./server-Bfa7StU_.mjs";
|
|
2
2
|
export { AUX_REQUEST_KIND_HEADER, DEFAULT_MAX_BODY_BYTES, DEFAULT_MODEL, SESSION_ID_HEADER, generateApiKey, startServer };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-m365-copilot",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "Use your org's Microsoft 365 Copilot as the model backend for opencode",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"typecheck": "tsc --noEmit"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@azure/msal-node": "^
|
|
35
|
+
"@azure/msal-node": "^7.0.0",
|
|
36
36
|
"otpauth": "^9.5.0",
|
|
37
37
|
"ws": "^8.20.0",
|
|
38
38
|
"zod": "^4.3.6"
|