opencode-m365-copilot 0.2.2 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +66 -3
- package/dist/{agent-BXH7KR-e.mjs → agent-C3DxtJPy.mjs} +3 -5
- package/dist/cli.mjs +46 -10
- package/dist/{dist-JS8R_Thl.mjs → dist-CBYT-Zyt.mjs} +325 -152
- package/dist/{login-BD6JAsn7.mjs → login-_9JzoRK8.mjs} +25 -7
- package/dist/{otpauth.node-klD_z4Tx.mjs → otpauth.node-CBOz_1IZ.mjs} +22 -13
- package/dist/plugin.d.mts +11 -3
- package/dist/plugin.mjs +99 -22
- package/dist/{server-B_2RPeJD.mjs → server-DO0_u884.mjs} +2896 -1398
- package/dist/server.d.mts +44 -6
- package/dist/server.mjs +2 -2
- package/package.json +14 -7
package/dist/server.d.mts
CHANGED
|
@@ -8,10 +8,26 @@
|
|
|
8
8
|
* which says reasoning tones meta-analyse the injected prompt and disengage — that
|
|
9
9
|
* note predates the GPT-5.5 measurements. See README for the full story.
|
|
10
10
|
*/
|
|
11
|
-
declare const DEFAULT_MODEL = "gpt-5.5-think-deeper";
|
|
11
|
+
export declare const DEFAULT_MODEL = "gpt-5.5-think-deeper";
|
|
12
12
|
//#endregion
|
|
13
13
|
//#region src/server.d.ts
|
|
14
|
-
|
|
14
|
+
/**
|
|
15
|
+
* Header a harness uses to declare what an auxiliary request is *for*.
|
|
16
|
+
*
|
|
17
|
+
* Node lowercases incoming header names, so this must stay lowercase to match.
|
|
18
|
+
*
|
|
19
|
+
* Only `title` is acted on. Compaction and generation are real model work and belong
|
|
20
|
+
* on the real model; titling is the one auxiliary request that would open a second
|
|
21
|
+
* M365 conversation per session, which is precisely the throttle signature.
|
|
22
|
+
*/
|
|
23
|
+
export declare const AUX_REQUEST_KIND_HEADER = "x-m365-request-kind";
|
|
24
|
+
/**
|
|
25
|
+
* Header a harness uses to name the session a request belongs to, so two sessions
|
|
26
|
+
* that happen to open with the same message never share an M365 conversation.
|
|
27
|
+
* Lowercase for the same reason as {@link AUX_REQUEST_KIND_HEADER}.
|
|
28
|
+
*/
|
|
29
|
+
export declare const SESSION_ID_HEADER = "x-m365-session-id";
|
|
30
|
+
export interface ServerDeps {
|
|
15
31
|
/** Supplies a Sydney chat token. */
|
|
16
32
|
getToken: () => Promise<string>;
|
|
17
33
|
/**
|
|
@@ -39,13 +55,35 @@ interface ServerDeps {
|
|
|
39
55
|
*/
|
|
40
56
|
leanSystemPrompt?: string;
|
|
41
57
|
port?: number;
|
|
58
|
+
/** Loopback only: `127.0.0.1` (the default), `::1` or `localhost`. Anything else throws. */
|
|
42
59
|
host?: string;
|
|
60
|
+
/**
|
|
61
|
+
* The bearer secret every request must carry. Omit it and a fresh 32-byte random
|
|
62
|
+
* one is generated per launch, which is what the in-process plugin wants: it hands
|
|
63
|
+
* the key straight to opencode's provider config and nobody else ever sees it.
|
|
64
|
+
*/
|
|
65
|
+
apiKey?: string;
|
|
66
|
+
/**
|
|
67
|
+
* @deprecated Ignored, with a warning. Every request carrying an `Origin` is refused:
|
|
68
|
+
* opencode sends none, so one means a web page — and no allowlist could have made
|
|
69
|
+
* the proxy usable from a page anyway, since the bearer header forces a CORS
|
|
70
|
+
* preflight and preflights are always refused. Kept only so an old caller that
|
|
71
|
+
* still passes it keeps starting.
|
|
72
|
+
*/
|
|
73
|
+
allowedOrigins?: readonly string[];
|
|
74
|
+
/** Largest request body accepted, in bytes. */
|
|
75
|
+
maxBodyBytes?: number;
|
|
43
76
|
}
|
|
44
|
-
interface ProxyHandle {
|
|
77
|
+
export interface ProxyHandle {
|
|
45
78
|
url: string;
|
|
46
79
|
port: number;
|
|
80
|
+
/** The bearer secret a client must send. */
|
|
81
|
+
apiKey: string;
|
|
47
82
|
close(): Promise<void>;
|
|
48
83
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
84
|
+
/** Generous: a long agent history is a few MB of JSON; this only stops abuse. */
|
|
85
|
+
export declare const DEFAULT_MAX_BODY_BYTES: number;
|
|
86
|
+
/** A fresh per-launch secret: 32 random bytes, base64url. */
|
|
87
|
+
export declare function generateApiKey(): string;
|
|
88
|
+
export declare function startServer(deps: ServerDeps): Promise<ProxyHandle>;
|
|
89
|
+
//#endregion
|
package/dist/server.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { DEFAULT_MODEL, startServer };
|
|
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-DO0_u884.mjs";
|
|
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
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Use your org's Microsoft 365 Copilot as the model backend for opencode",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -31,18 +31,21 @@
|
|
|
31
31
|
"test:watch": "vitest",
|
|
32
32
|
"typecheck": "tsc --noEmit"
|
|
33
33
|
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@azure/msal-node": "^6.0.0",
|
|
36
|
+
"otpauth": "^9.5.0",
|
|
37
|
+
"ws": "^8.20.0",
|
|
38
|
+
"zod": "^4.3.6"
|
|
39
|
+
},
|
|
34
40
|
"devDependencies": {
|
|
35
|
-
"@azure/msal-node": "^5.1.1",
|
|
36
41
|
"@opencode-ai/plugin": "^1.18.18",
|
|
42
|
+
"@opencode/plugin": "^2.0.11",
|
|
37
43
|
"@types/node": "^26.2.0",
|
|
38
44
|
"@types/ws": "^8.18.1",
|
|
39
|
-
"otpauth": "^9.5.0",
|
|
40
45
|
"playwright": "^1.62.1",
|
|
41
|
-
"tsdown": "^0.
|
|
46
|
+
"tsdown": "^0.23.0",
|
|
42
47
|
"typescript": "^7.0.2",
|
|
43
|
-
"vitest": "^
|
|
44
|
-
"ws": "^8.20.0",
|
|
45
|
-
"zod": "^4.3.6"
|
|
48
|
+
"vitest": "^5.0.0"
|
|
46
49
|
},
|
|
47
50
|
"publishConfig": {
|
|
48
51
|
"access": "public"
|
|
@@ -62,12 +65,16 @@
|
|
|
62
65
|
},
|
|
63
66
|
"peerDependencies": {
|
|
64
67
|
"@opencode-ai/plugin": ">=1.18.0",
|
|
68
|
+
"@opencode/plugin": ">=2.0.0",
|
|
65
69
|
"playwright": ">=1.50.0"
|
|
66
70
|
},
|
|
67
71
|
"peerDependenciesMeta": {
|
|
68
72
|
"@opencode-ai/plugin": {
|
|
69
73
|
"optional": true
|
|
70
74
|
},
|
|
75
|
+
"@opencode/plugin": {
|
|
76
|
+
"optional": true
|
|
77
|
+
},
|
|
71
78
|
"playwright": {
|
|
72
79
|
"optional": true
|
|
73
80
|
}
|