@ai-sdk/harness-opencode 1.0.94 → 1.0.95
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/CHANGELOG.md +16 -0
- package/README.md +24 -0
- package/dist/bridge/index.mjs +51 -7
- package/dist/bridge/index.mjs.map +1 -1
- package/dist/bridge/package.json +2 -2
- package/dist/bridge/pnpm-lock.yaml +59 -59
- package/dist/bridge/pnpm-workspace.yaml +1 -1
- package/dist/index.d.ts +9 -0
- package/dist/index.js +45 -28
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/src/bridge/index.ts +25 -3
- package/src/bridge/package.json +2 -2
- package/src/bridge/pnpm-lock.yaml +59 -59
- package/src/bridge/pnpm-workspace.yaml +1 -1
- package/src/opencode-bridge-protocol.ts +2 -0
- package/src/opencode-harness.ts +56 -35
package/dist/bridge/package.json
CHANGED
|
@@ -12,11 +12,11 @@ importers:
|
|
|
12
12
|
specifier: 1.29.0
|
|
13
13
|
version: 1.29.0(zod@3.25.76)
|
|
14
14
|
'@opencode-ai/sdk':
|
|
15
|
-
specifier: 1.18.
|
|
16
|
-
version: 1.18.
|
|
15
|
+
specifier: 1.18.23
|
|
16
|
+
version: 1.18.23
|
|
17
17
|
opencode-ai:
|
|
18
|
-
specifier: 1.18.
|
|
19
|
-
version: 1.18.
|
|
18
|
+
specifier: 1.18.23
|
|
19
|
+
version: 1.18.23
|
|
20
20
|
ws:
|
|
21
21
|
specifier: 8.21.0
|
|
22
22
|
version: 8.21.0
|
|
@@ -42,8 +42,8 @@ packages:
|
|
|
42
42
|
'@cfworker/json-schema':
|
|
43
43
|
optional: true
|
|
44
44
|
|
|
45
|
-
'@opencode-ai/sdk@1.18.
|
|
46
|
-
resolution: {integrity: sha512-
|
|
45
|
+
'@opencode-ai/sdk@1.18.23':
|
|
46
|
+
resolution: {integrity: sha512-VouYbL8O2ynLq0atr5fjzCv8YLtFi/zKLQ/uYkCvTJ4CmUdA01XwPn8om+u3TvxnGEfQsBfmThGU141vt3sg5w==}
|
|
47
47
|
|
|
48
48
|
accepts@2.0.0:
|
|
49
49
|
resolution: {integrity: sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng==}
|
|
@@ -286,72 +286,72 @@ packages:
|
|
|
286
286
|
once@1.4.0:
|
|
287
287
|
resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==}
|
|
288
288
|
|
|
289
|
-
opencode-ai@1.18.
|
|
290
|
-
resolution: {integrity: sha512-
|
|
289
|
+
opencode-ai@1.18.23:
|
|
290
|
+
resolution: {integrity: sha512-3NkT0XINL7d0HYkTyGV1SPChHXhvRgKqNaTgKRTGb0TXUWszXA7MW/y3zMZw29y1AQuUDAzRvVYmQ9KGRQhroA==}
|
|
291
291
|
cpu: [arm64, x64]
|
|
292
292
|
os: [darwin, linux, win32]
|
|
293
293
|
hasBin: true
|
|
294
294
|
|
|
295
|
-
opencode-darwin-arm64@1.18.
|
|
296
|
-
resolution: {integrity: sha512-
|
|
295
|
+
opencode-darwin-arm64@1.18.23:
|
|
296
|
+
resolution: {integrity: sha512-QP9PjwpHtZoLVXw2WvUmPZecz7mWbQkT4t3K36B//fCaDG+zWa+SsztIeaW5azujNwwtUemLA5icE/zINng48Q==}
|
|
297
297
|
cpu: [arm64]
|
|
298
298
|
os: [darwin]
|
|
299
299
|
|
|
300
|
-
opencode-darwin-x64-baseline@1.18.
|
|
301
|
-
resolution: {integrity: sha512-
|
|
300
|
+
opencode-darwin-x64-baseline@1.18.23:
|
|
301
|
+
resolution: {integrity: sha512-QGx6I/nFYur7qJ/Nx2L3fC4XYQt44cyDsm7p8twNA+cdjGX3ndnPbMdAl5ikdZyAfSMUGYK8VWY2JMxv0rmfjw==}
|
|
302
302
|
cpu: [x64]
|
|
303
303
|
os: [darwin]
|
|
304
304
|
|
|
305
|
-
opencode-darwin-x64@1.18.
|
|
306
|
-
resolution: {integrity: sha512-
|
|
305
|
+
opencode-darwin-x64@1.18.23:
|
|
306
|
+
resolution: {integrity: sha512-R9nWP3edz/0FnEfwmuxtiWBB7bS4NtZCyCffJyiMlrbwdDC+bIXYrWxWXVrzaP1mJujs6g2MAwTCUSx/qpBhDw==}
|
|
307
307
|
cpu: [x64]
|
|
308
308
|
os: [darwin]
|
|
309
309
|
|
|
310
|
-
opencode-linux-arm64-musl@1.18.
|
|
311
|
-
resolution: {integrity: sha512-
|
|
310
|
+
opencode-linux-arm64-musl@1.18.23:
|
|
311
|
+
resolution: {integrity: sha512-VyDkzUJfJgkx9h9RhazTW9xeTgSXBmVFPblsbPGBW9tR612f6gjQxfOfu4cpHnQHK1qjuW9ClzLKHWqv3EcJTA==}
|
|
312
312
|
cpu: [arm64]
|
|
313
313
|
os: [linux]
|
|
314
314
|
libc: [musl]
|
|
315
315
|
|
|
316
|
-
opencode-linux-arm64@1.18.
|
|
317
|
-
resolution: {integrity: sha512-
|
|
316
|
+
opencode-linux-arm64@1.18.23:
|
|
317
|
+
resolution: {integrity: sha512-g1zDFhuE9FOYwjSGderlu69wfd4GQzS0xsDiIY11QUciuBmM6DrHqLvmhlLFsUVHYVnCPY1YeN1pq5ewE3x72Q==}
|
|
318
318
|
cpu: [arm64]
|
|
319
319
|
os: [linux]
|
|
320
320
|
|
|
321
|
-
opencode-linux-x64-baseline-musl@1.18.
|
|
322
|
-
resolution: {integrity: sha512-
|
|
321
|
+
opencode-linux-x64-baseline-musl@1.18.23:
|
|
322
|
+
resolution: {integrity: sha512-c1DPxauhzAurlIBhJBr/rokDpc65l084T4qTl36gDDT9Xzc/Nk5Q5yMDaPm1DDI3WeHKDt11MDlxT5AjQW5gtw==}
|
|
323
323
|
cpu: [x64]
|
|
324
324
|
os: [linux]
|
|
325
325
|
libc: [musl]
|
|
326
326
|
|
|
327
|
-
opencode-linux-x64-baseline@1.18.
|
|
328
|
-
resolution: {integrity: sha512-
|
|
327
|
+
opencode-linux-x64-baseline@1.18.23:
|
|
328
|
+
resolution: {integrity: sha512-yUhBOXfTQour2JCdAkwD3DDqSnyxB0grefwdPqEhYmJHIkYxfJIIzyy6V//pyouvkE0XMouFtiuZXw8S6Wo0iQ==}
|
|
329
329
|
cpu: [x64]
|
|
330
330
|
os: [linux]
|
|
331
331
|
|
|
332
|
-
opencode-linux-x64-musl@1.18.
|
|
333
|
-
resolution: {integrity: sha512-
|
|
332
|
+
opencode-linux-x64-musl@1.18.23:
|
|
333
|
+
resolution: {integrity: sha512-t/5mlnTBZKdZpqKHwdwxlWqGakntauvMSmXtyJc17M7XJRmZaaGHtNSaSefbbYFIL4agoQCXTvIkhhyxOvr7zQ==}
|
|
334
334
|
cpu: [x64]
|
|
335
335
|
os: [linux]
|
|
336
336
|
libc: [musl]
|
|
337
337
|
|
|
338
|
-
opencode-linux-x64@1.18.
|
|
339
|
-
resolution: {integrity: sha512-
|
|
338
|
+
opencode-linux-x64@1.18.23:
|
|
339
|
+
resolution: {integrity: sha512-5x9d1Cm/YtqzR6lAlNbgVprTQ3R3hx7qGTWCzm5l5u6lBNkhYTrhy2s8k25dxKKuxqZ9Kngqz9JYWvSVHy2Lmw==}
|
|
340
340
|
cpu: [x64]
|
|
341
341
|
os: [linux]
|
|
342
342
|
|
|
343
|
-
opencode-windows-arm64@1.18.
|
|
344
|
-
resolution: {integrity: sha512-
|
|
343
|
+
opencode-windows-arm64@1.18.23:
|
|
344
|
+
resolution: {integrity: sha512-QtJQcLU0yPz6on3jjks3f/EHgZuIDFw7FvAKu3wsHhL09NYDh7GczfRXDPRHa3NgqnU8dkB8p9mhqgaPRPogoQ==}
|
|
345
345
|
cpu: [arm64]
|
|
346
346
|
os: [win32]
|
|
347
347
|
|
|
348
|
-
opencode-windows-x64-baseline@1.18.
|
|
349
|
-
resolution: {integrity: sha512
|
|
348
|
+
opencode-windows-x64-baseline@1.18.23:
|
|
349
|
+
resolution: {integrity: sha512-AqXsTKaPcDx3rrid5bLUwJbQ/3vr9rJ6fvOStIznTzwrbOgP8wy5G4jCoIzu6KB/WxGx/d1MrV4cGaJ73qnjBA==}
|
|
350
350
|
cpu: [x64]
|
|
351
351
|
os: [win32]
|
|
352
352
|
|
|
353
|
-
opencode-windows-x64@1.18.
|
|
354
|
-
resolution: {integrity: sha512-
|
|
353
|
+
opencode-windows-x64@1.18.23:
|
|
354
|
+
resolution: {integrity: sha512-mMaIITuXzkNfjdcYL8uZaZuMDjulFyH/UCq9bxblam2mUZf9uWisoi5J6CXFsS/mkN7CZfTAt6PttSp4n3PH4g==}
|
|
355
355
|
cpu: [x64]
|
|
356
356
|
os: [win32]
|
|
357
357
|
|
|
@@ -508,7 +508,7 @@ snapshots:
|
|
|
508
508
|
transitivePeerDependencies:
|
|
509
509
|
- supports-color
|
|
510
510
|
|
|
511
|
-
'@opencode-ai/sdk@1.18.
|
|
511
|
+
'@opencode-ai/sdk@1.18.23':
|
|
512
512
|
dependencies:
|
|
513
513
|
cross-spawn: 7.0.6
|
|
514
514
|
|
|
@@ -752,55 +752,55 @@ snapshots:
|
|
|
752
752
|
dependencies:
|
|
753
753
|
wrappy: 1.0.2
|
|
754
754
|
|
|
755
|
-
opencode-ai@1.18.
|
|
755
|
+
opencode-ai@1.18.23:
|
|
756
756
|
optionalDependencies:
|
|
757
|
-
opencode-darwin-arm64: 1.18.
|
|
758
|
-
opencode-darwin-x64: 1.18.
|
|
759
|
-
opencode-darwin-x64-baseline: 1.18.
|
|
760
|
-
opencode-linux-arm64: 1.18.
|
|
761
|
-
opencode-linux-arm64-musl: 1.18.
|
|
762
|
-
opencode-linux-x64: 1.18.
|
|
763
|
-
opencode-linux-x64-baseline: 1.18.
|
|
764
|
-
opencode-linux-x64-baseline-musl: 1.18.
|
|
765
|
-
opencode-linux-x64-musl: 1.18.
|
|
766
|
-
opencode-windows-arm64: 1.18.
|
|
767
|
-
opencode-windows-x64: 1.18.
|
|
768
|
-
opencode-windows-x64-baseline: 1.18.
|
|
769
|
-
|
|
770
|
-
opencode-darwin-arm64@1.18.
|
|
757
|
+
opencode-darwin-arm64: 1.18.23
|
|
758
|
+
opencode-darwin-x64: 1.18.23
|
|
759
|
+
opencode-darwin-x64-baseline: 1.18.23
|
|
760
|
+
opencode-linux-arm64: 1.18.23
|
|
761
|
+
opencode-linux-arm64-musl: 1.18.23
|
|
762
|
+
opencode-linux-x64: 1.18.23
|
|
763
|
+
opencode-linux-x64-baseline: 1.18.23
|
|
764
|
+
opencode-linux-x64-baseline-musl: 1.18.23
|
|
765
|
+
opencode-linux-x64-musl: 1.18.23
|
|
766
|
+
opencode-windows-arm64: 1.18.23
|
|
767
|
+
opencode-windows-x64: 1.18.23
|
|
768
|
+
opencode-windows-x64-baseline: 1.18.23
|
|
769
|
+
|
|
770
|
+
opencode-darwin-arm64@1.18.23:
|
|
771
771
|
optional: true
|
|
772
772
|
|
|
773
|
-
opencode-darwin-x64-baseline@1.18.
|
|
773
|
+
opencode-darwin-x64-baseline@1.18.23:
|
|
774
774
|
optional: true
|
|
775
775
|
|
|
776
|
-
opencode-darwin-x64@1.18.
|
|
776
|
+
opencode-darwin-x64@1.18.23:
|
|
777
777
|
optional: true
|
|
778
778
|
|
|
779
|
-
opencode-linux-arm64-musl@1.18.
|
|
779
|
+
opencode-linux-arm64-musl@1.18.23:
|
|
780
780
|
optional: true
|
|
781
781
|
|
|
782
|
-
opencode-linux-arm64@1.18.
|
|
782
|
+
opencode-linux-arm64@1.18.23:
|
|
783
783
|
optional: true
|
|
784
784
|
|
|
785
|
-
opencode-linux-x64-baseline-musl@1.18.
|
|
785
|
+
opencode-linux-x64-baseline-musl@1.18.23:
|
|
786
786
|
optional: true
|
|
787
787
|
|
|
788
|
-
opencode-linux-x64-baseline@1.18.
|
|
788
|
+
opencode-linux-x64-baseline@1.18.23:
|
|
789
789
|
optional: true
|
|
790
790
|
|
|
791
|
-
opencode-linux-x64-musl@1.18.
|
|
791
|
+
opencode-linux-x64-musl@1.18.23:
|
|
792
792
|
optional: true
|
|
793
793
|
|
|
794
|
-
opencode-linux-x64@1.18.
|
|
794
|
+
opencode-linux-x64@1.18.23:
|
|
795
795
|
optional: true
|
|
796
796
|
|
|
797
|
-
opencode-windows-arm64@1.18.
|
|
797
|
+
opencode-windows-arm64@1.18.23:
|
|
798
798
|
optional: true
|
|
799
799
|
|
|
800
|
-
opencode-windows-x64-baseline@1.18.
|
|
800
|
+
opencode-windows-x64-baseline@1.18.23:
|
|
801
801
|
optional: true
|
|
802
802
|
|
|
803
|
-
opencode-windows-x64@1.18.
|
|
803
|
+
opencode-windows-x64@1.18.23:
|
|
804
804
|
optional: true
|
|
805
805
|
|
|
806
806
|
parseurl@1.3.3: {}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
allowBuilds:
|
|
2
|
-
'opencode-ai@1.18.
|
|
2
|
+
'opencode-ai@1.18.23': true
|
package/dist/index.d.ts
CHANGED
|
@@ -12,11 +12,20 @@ type OpenCodeHarnessSettings = {
|
|
|
12
12
|
* discover, read, or otherwise access in the host process.
|
|
13
13
|
*/
|
|
14
14
|
readonly credentialForwarding?: HarnessV1CredentialForwarding;
|
|
15
|
+
/**
|
|
16
|
+
* Additional configuration passed through to OpenCode as-is. OpenCode
|
|
17
|
+
* config keys must use their native names. Values managed by this adapter
|
|
18
|
+
* take precedence over conflicting entries.
|
|
19
|
+
*/
|
|
20
|
+
readonly openCodeConfig?: Record<string, unknown>;
|
|
15
21
|
/**
|
|
16
22
|
* MCP server definitions keyed by server name. Each definition uses the
|
|
17
23
|
* underlying runtime's native MCP server configuration format.
|
|
18
24
|
*/
|
|
19
25
|
readonly mcpServers?: Record<string, unknown>;
|
|
26
|
+
/**
|
|
27
|
+
* @deprecated Use `model` on `HarnessAgent` instead.
|
|
28
|
+
*/
|
|
20
29
|
readonly model?: string;
|
|
21
30
|
readonly provider?: string;
|
|
22
31
|
/**
|
package/dist/index.js
CHANGED
|
@@ -308,7 +308,9 @@ var startMessageSchema = harnessV1BridgeStartBaseSchema.extend({
|
|
|
308
308
|
provider: z.string().optional(),
|
|
309
309
|
variant: z.string().optional(),
|
|
310
310
|
instructions: z.string().optional(),
|
|
311
|
+
skillsChanged: z.boolean().optional(),
|
|
311
312
|
resumeSessionId: z.string().optional(),
|
|
313
|
+
openCodeConfig: z.record(z.string(), z.unknown()).optional(),
|
|
312
314
|
mcpServers: z.record(z.string(), z.unknown()).optional()
|
|
313
315
|
});
|
|
314
316
|
var inboundMessageSchema = z.discriminatedUnion("type", [
|
|
@@ -317,7 +319,7 @@ var inboundMessageSchema = z.discriminatedUnion("type", [
|
|
|
317
319
|
]);
|
|
318
320
|
|
|
319
321
|
// src/version.ts
|
|
320
|
-
var VERSION = true ? "1.0.
|
|
322
|
+
var VERSION = true ? "1.0.95" : "0.0.0-test";
|
|
321
323
|
|
|
322
324
|
// src/opencode-harness.ts
|
|
323
325
|
var OPENCODE_CLIENT_APP = `ai-sdk/harness-opencode/${VERSION}`;
|
|
@@ -445,6 +447,7 @@ function createOpenCode(settings = {}) {
|
|
|
445
447
|
lifecycleStateSchema: openCodeResumeStateSchema,
|
|
446
448
|
getBootstrap: getOpenCodeBootstrap,
|
|
447
449
|
doStart: async (startOpts) => {
|
|
450
|
+
const configuredModel = startOpts.model ?? settings.model;
|
|
448
451
|
const sandboxSession = startOpts.sandboxSession;
|
|
449
452
|
const toolSafeSandboxSession = getRestrictedSandboxSession(sandboxSession);
|
|
450
453
|
const sandboxId = "id" in sandboxSession ? sandboxSession.id : void 0;
|
|
@@ -471,12 +474,12 @@ function createOpenCode(settings = {}) {
|
|
|
471
474
|
const coords = resumeData?.bridge;
|
|
472
475
|
const authenticationMode = resolveOpenCodeAuthenticationMode({
|
|
473
476
|
auth: settings.auth,
|
|
474
|
-
model:
|
|
477
|
+
model: configuredModel,
|
|
475
478
|
provider: settings.provider
|
|
476
479
|
});
|
|
477
480
|
const resolvedAuthEnvironment = resolveOpenCodeEnv({
|
|
478
481
|
auth: settings.auth,
|
|
479
|
-
model:
|
|
482
|
+
model: configuredModel,
|
|
480
483
|
provider: settings.provider
|
|
481
484
|
});
|
|
482
485
|
let sandboxAuthEnvironment = resolvedAuthEnvironment;
|
|
@@ -511,10 +514,18 @@ function createOpenCode(settings = {}) {
|
|
|
511
514
|
OPENCODE_BOOTSTRAP_DIR
|
|
512
515
|
);
|
|
513
516
|
const workDir = startOpts.sessionWorkDir;
|
|
517
|
+
const sandboxHomeDir = await resolveSandboxHomeDir({
|
|
518
|
+
sandbox: toolSafeSandboxSession,
|
|
519
|
+
abortSignal: startOpts.abortSignal
|
|
520
|
+
});
|
|
521
|
+
const skillsDir = path.posix.join(sandboxHomeDir, ".agents", "skills");
|
|
514
522
|
const sessionDataDir = `${defaultWorkingDirectory}/.agent-runs/${startOpts.sessionId}`;
|
|
515
523
|
const bridgeStateDir = `${sessionDataDir}/bridge`;
|
|
516
524
|
const timeoutMs = settings.startupTimeoutMs ?? 12e4;
|
|
517
|
-
const model = splitOpenCodeModel(
|
|
525
|
+
const model = splitOpenCodeModel(
|
|
526
|
+
configuredModel,
|
|
527
|
+
settings.provider
|
|
528
|
+
).model;
|
|
518
529
|
const report = startOpts.observability?.report;
|
|
519
530
|
const onDiagnostic = report ? (frame) => report(
|
|
520
531
|
harnessV1DiagnosticFromBridgeFrame(frame, {
|
|
@@ -559,6 +570,7 @@ function createOpenCode(settings = {}) {
|
|
|
559
570
|
model,
|
|
560
571
|
provider: settings.provider,
|
|
561
572
|
reasoningVariant: settings.reasoningVariant,
|
|
573
|
+
openCodeConfig: settings.openCodeConfig,
|
|
562
574
|
mcpServers: settings.mcpServers,
|
|
563
575
|
openCodeSessionId: resumeSessionId,
|
|
564
576
|
isResume: true,
|
|
@@ -571,6 +583,8 @@ function createOpenCode(settings = {}) {
|
|
|
571
583
|
debug: startOpts.observability?.debug,
|
|
572
584
|
permissionMode: startOpts.permissionMode,
|
|
573
585
|
builtinToolFiltering: startOpts.builtinToolFiltering,
|
|
586
|
+
sandbox: toolSafeSandboxSession,
|
|
587
|
+
sandboxHomeDir,
|
|
574
588
|
supportsUserMessageResponses: () => supportsUserMessageResponses2
|
|
575
589
|
});
|
|
576
590
|
} catch {
|
|
@@ -593,20 +607,6 @@ function createOpenCode(settings = {}) {
|
|
|
593
607
|
override: settings.port
|
|
594
608
|
});
|
|
595
609
|
const token = settings.mintBridgeToken == null ? randomBytes(32).toString("hex") : settings.mintBridgeToken(sandboxId);
|
|
596
|
-
const sandboxHomeDir = await resolveSandboxHomeDir({
|
|
597
|
-
sandbox: toolSafeSandboxSession,
|
|
598
|
-
abortSignal: startOpts.abortSignal
|
|
599
|
-
});
|
|
600
|
-
const xdgConfigHome = `${sandboxHomeDir}/.config`;
|
|
601
|
-
const xdgCacheHome = `${sandboxHomeDir}/.cache`;
|
|
602
|
-
const xdgDataHome = `${sandboxHomeDir}/.local/share`;
|
|
603
|
-
const xdgStateHome = `${sandboxHomeDir}/.local/state`;
|
|
604
|
-
const skillSetup = startOpts.skills && startOpts.skills.length > 0 ? await writeOpenCodeSkills({
|
|
605
|
-
sandbox: toolSafeSandboxSession,
|
|
606
|
-
skills: startOpts.skills,
|
|
607
|
-
homeDir: sandboxHomeDir,
|
|
608
|
-
abortSignal: startOpts.abortSignal
|
|
609
|
-
}) : void 0;
|
|
610
610
|
const forwardedAuthEnvironment = credentialsBrokered ? sandboxAuthEnvironment : await applyCredentialForwarding({
|
|
611
611
|
environment: sandboxAuthEnvironment,
|
|
612
612
|
credentialEnvironmentVariables: OPENCODE_CREDENTIAL_ENVIRONMENT_VARIABLES,
|
|
@@ -617,17 +617,11 @@ function createOpenCode(settings = {}) {
|
|
|
617
617
|
AI_SDK_HARNESS_CLIENT_APP: OPENCODE_CLIENT_APP,
|
|
618
618
|
BRIDGE_CHANNEL_TOKEN: token,
|
|
619
619
|
BRIDGE_WS_PORT: String(port),
|
|
620
|
-
HOME: sandboxHomeDir,
|
|
621
|
-
USERPROFILE: sandboxHomeDir,
|
|
622
|
-
XDG_CONFIG_HOME: xdgConfigHome,
|
|
623
|
-
XDG_CACHE_HOME: xdgCacheHome,
|
|
624
|
-
XDG_DATA_HOME: xdgDataHome,
|
|
625
|
-
XDG_STATE_HOME: xdgStateHome,
|
|
626
620
|
...respawnStrategy === "replay" ? { BRIDGE_REPLAY_FROM_DISK: "1" } : {}
|
|
627
621
|
};
|
|
628
622
|
if (respawnStrategy === void 0) {
|
|
629
623
|
await toolSafeSandboxSession.run({
|
|
630
|
-
command: `mkdir -p ${shellQuote(workDir)} ${shellQuote(bridgeStateDir)}
|
|
624
|
+
command: `mkdir -p ${shellQuote(workDir)} ${shellQuote(bridgeStateDir)}`,
|
|
631
625
|
abortSignal: startOpts.abortSignal
|
|
632
626
|
});
|
|
633
627
|
}
|
|
@@ -638,7 +632,7 @@ function createOpenCode(settings = {}) {
|
|
|
638
632
|
abortSignal: startOpts.abortSignal
|
|
639
633
|
});
|
|
640
634
|
const proc = await toolSafeSandboxSession.spawn({
|
|
641
|
-
command: `node ${shellQuote(`${bootstrapDir}/bridge.mjs`)} --workdir ${shellQuote(workDir)} --bridge-state-dir ${shellQuote(bridgeStateDir)} --bootstrap-dir ${shellQuote(bootstrapDir)}
|
|
635
|
+
command: `node ${shellQuote(`${bootstrapDir}/bridge.mjs`)} --workdir ${shellQuote(workDir)} --bridge-state-dir ${shellQuote(bridgeStateDir)} --bootstrap-dir ${shellQuote(bootstrapDir)} --skills-dir ${shellQuote(skillsDir)}`,
|
|
642
636
|
env,
|
|
643
637
|
abortSignal: startOpts.abortSignal
|
|
644
638
|
});
|
|
@@ -702,6 +696,7 @@ function createOpenCode(settings = {}) {
|
|
|
702
696
|
model,
|
|
703
697
|
provider: settings.provider,
|
|
704
698
|
reasoningVariant: settings.reasoningVariant,
|
|
699
|
+
openCodeConfig: settings.openCodeConfig,
|
|
705
700
|
mcpServers: settings.mcpServers,
|
|
706
701
|
openCodeSessionId: resumeSessionId,
|
|
707
702
|
isResume: respawnStrategy !== void 0,
|
|
@@ -714,6 +709,8 @@ function createOpenCode(settings = {}) {
|
|
|
714
709
|
debug: startOpts.observability?.debug,
|
|
715
710
|
permissionMode: startOpts.permissionMode,
|
|
716
711
|
builtinToolFiltering: startOpts.builtinToolFiltering,
|
|
712
|
+
sandbox: toolSafeSandboxSession,
|
|
713
|
+
sandboxHomeDir,
|
|
717
714
|
supportsUserMessageResponses: () => supportsUserMessageResponses
|
|
718
715
|
});
|
|
719
716
|
}
|
|
@@ -772,7 +769,7 @@ async function writeOpenCodeSkills({
|
|
|
772
769
|
abortSignal
|
|
773
770
|
}) {
|
|
774
771
|
const skillsDir = path.posix.join(homeDir, ".agents", "skills");
|
|
775
|
-
|
|
772
|
+
return writeHarnessSkills({
|
|
776
773
|
sandbox,
|
|
777
774
|
rootDir: skillsDir,
|
|
778
775
|
skills,
|
|
@@ -780,7 +777,6 @@ async function writeOpenCodeSkills({
|
|
|
780
777
|
invalidSkillNameMessage: ({ name }) => `Invalid OpenCode skill name: ${name}`,
|
|
781
778
|
invalidSkillFilePathMessage: ({ skillName, filePath }) => `Invalid OpenCode skill file path for ${skillName}: ${filePath}`
|
|
782
779
|
});
|
|
783
|
-
return { skillsDir };
|
|
784
780
|
}
|
|
785
781
|
function openWebSocket({
|
|
786
782
|
endpoint,
|
|
@@ -880,6 +876,7 @@ function createSession({
|
|
|
880
876
|
model,
|
|
881
877
|
provider,
|
|
882
878
|
reasoningVariant,
|
|
879
|
+
openCodeConfig,
|
|
883
880
|
mcpServers,
|
|
884
881
|
openCodeSessionId,
|
|
885
882
|
isResume,
|
|
@@ -892,6 +889,8 @@ function createSession({
|
|
|
892
889
|
debug,
|
|
893
890
|
permissionMode,
|
|
894
891
|
builtinToolFiltering,
|
|
892
|
+
sandbox,
|
|
893
|
+
sandboxHomeDir,
|
|
895
894
|
supportsUserMessageResponses
|
|
896
895
|
}) {
|
|
897
896
|
let stopped = false;
|
|
@@ -1037,6 +1036,7 @@ function createSession({
|
|
|
1037
1036
|
model,
|
|
1038
1037
|
provider,
|
|
1039
1038
|
...reasoningVariant ? { variant: reasoningVariant } : {},
|
|
1039
|
+
...openCodeConfig == null ? {} : { openCodeConfig },
|
|
1040
1040
|
...mcpServers == null ? {} : { mcpServers },
|
|
1041
1041
|
...permissionMode ? { permissionMode } : {},
|
|
1042
1042
|
...builtinToolFiltering ? { builtinToolFiltering } : {},
|
|
@@ -1054,6 +1054,12 @@ function createSession({
|
|
|
1054
1054
|
harnessId: "opencode"
|
|
1055
1055
|
});
|
|
1056
1056
|
}
|
|
1057
|
+
const skillWriteResult = await writeOpenCodeSkills({
|
|
1058
|
+
sandbox,
|
|
1059
|
+
skills: promptOpts.skills,
|
|
1060
|
+
homeDir: sandboxHomeDir,
|
|
1061
|
+
abortSignal: promptOpts.abortSignal
|
|
1062
|
+
});
|
|
1057
1063
|
const control = wireTurn({
|
|
1058
1064
|
emit: promptOpts.emit,
|
|
1059
1065
|
abortSignal: promptOpts.abortSignal
|
|
@@ -1069,6 +1075,7 @@ function createSession({
|
|
|
1069
1075
|
})),
|
|
1070
1076
|
...promptOpts.responseFormat == null ? {} : { responseFormat: promptOpts.responseFormat },
|
|
1071
1077
|
...promptOpts.instructions ? { instructions: promptOpts.instructions } : {},
|
|
1078
|
+
skillsChanged: skillWriteResult.changed,
|
|
1072
1079
|
...startBase()
|
|
1073
1080
|
});
|
|
1074
1081
|
pendingResumeSessionId = void 0;
|
|
@@ -1081,6 +1088,12 @@ function createSession({
|
|
|
1081
1088
|
harnessId: "opencode"
|
|
1082
1089
|
});
|
|
1083
1090
|
}
|
|
1091
|
+
const skillWriteResult = await writeOpenCodeSkills({
|
|
1092
|
+
sandbox,
|
|
1093
|
+
skills: continueOpts.skills,
|
|
1094
|
+
homeDir: sandboxHomeDir,
|
|
1095
|
+
abortSignal: continueOpts.abortSignal
|
|
1096
|
+
});
|
|
1084
1097
|
const control = wireTurn({
|
|
1085
1098
|
emit: continueOpts.emit,
|
|
1086
1099
|
abortSignal: continueOpts.abortSignal
|
|
@@ -1097,6 +1110,7 @@ function createSession({
|
|
|
1097
1110
|
})),
|
|
1098
1111
|
...continueOpts.responseFormat == null ? {} : { responseFormat: continueOpts.responseFormat },
|
|
1099
1112
|
...continueOpts.instructions ? { instructions: continueOpts.instructions } : {},
|
|
1113
|
+
skillsChanged: skillWriteResult.changed,
|
|
1100
1114
|
...startBase()
|
|
1101
1115
|
});
|
|
1102
1116
|
pendingResumeSessionId = void 0;
|
|
@@ -1122,6 +1136,7 @@ function createSession({
|
|
|
1122
1136
|
provider,
|
|
1123
1137
|
permissionMode,
|
|
1124
1138
|
debug,
|
|
1139
|
+
openCodeConfig,
|
|
1125
1140
|
mcpServers,
|
|
1126
1141
|
resumeSessionId: latestOpenCodeSessionId,
|
|
1127
1142
|
onCompaction: (part) => pendingCompactionParts.push(part)
|
|
@@ -1279,6 +1294,7 @@ async function runCompactOperation({
|
|
|
1279
1294
|
provider,
|
|
1280
1295
|
permissionMode,
|
|
1281
1296
|
debug,
|
|
1297
|
+
openCodeConfig,
|
|
1282
1298
|
mcpServers,
|
|
1283
1299
|
resumeSessionId,
|
|
1284
1300
|
onCompaction
|
|
@@ -1307,6 +1323,7 @@ async function runCompactOperation({
|
|
|
1307
1323
|
tools: [],
|
|
1308
1324
|
model,
|
|
1309
1325
|
provider,
|
|
1326
|
+
...openCodeConfig == null ? {} : { openCodeConfig },
|
|
1310
1327
|
...mcpServers == null ? {} : { mcpServers },
|
|
1311
1328
|
...permissionMode ? { permissionMode } : {},
|
|
1312
1329
|
...resumeSessionId ? { resumeSessionId } : {},
|