opencode-immune 1.0.52 → 1.0.54
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/plugin.js +13 -1
- package/package.json +1 -1
package/dist/plugin.js
CHANGED
|
@@ -11,9 +11,17 @@ import { execFile } from "child_process";
|
|
|
11
11
|
// ═══════════════════════════════════════════════════════════════════════════════
|
|
12
12
|
// PLUGIN VERSION CHECK
|
|
13
13
|
// ═══════════════════════════════════════════════════════════════════════════════
|
|
14
|
-
const PLUGIN_VERSION = "1.0.
|
|
14
|
+
const PLUGIN_VERSION = "1.0.54";
|
|
15
15
|
const PLUGIN_PACKAGE_NAME = "opencode-immune";
|
|
16
16
|
const PLUGIN_DIRNAME = dirname(fileURLToPath(import.meta.url));
|
|
17
|
+
function getServerAuthHeaders() {
|
|
18
|
+
const password = process.env.OPENCODE_SERVER_PASSWORD;
|
|
19
|
+
if (!password)
|
|
20
|
+
return undefined;
|
|
21
|
+
return {
|
|
22
|
+
Authorization: `Basic ${Buffer.from(`opencode:${password}`).toString("base64")}`,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
17
25
|
/**
|
|
18
26
|
* Read plugin version from package.json at runtime.
|
|
19
27
|
* Falls back to PLUGIN_VERSION constant if read fails.
|
|
@@ -80,6 +88,7 @@ function createState(input) {
|
|
|
80
88
|
client: createOpencodeClientV2({
|
|
81
89
|
baseUrl: input.serverUrl.toString(),
|
|
82
90
|
directory: input.directory,
|
|
91
|
+
headers: getServerAuthHeaders(),
|
|
83
92
|
}),
|
|
84
93
|
recoveryContext: null,
|
|
85
94
|
managedUltraworkSessions: new Map(),
|
|
@@ -148,6 +157,9 @@ async function createManagedUltraworkSession(state, title) {
|
|
|
148
157
|
title,
|
|
149
158
|
permission: ULTRAWORK_SESSION_PERMISSION,
|
|
150
159
|
});
|
|
160
|
+
if (result.error || !result.response.ok) {
|
|
161
|
+
throw new Error(`session.create failed with status ${result.response.status}: ${JSON.stringify(result.error ?? null)}`);
|
|
162
|
+
}
|
|
151
163
|
const sessionID = result?.data?.id;
|
|
152
164
|
if (!sessionID)
|
|
153
165
|
return null;
|