@ai-sdk/harness-opencode 1.0.153 → 1.0.154
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 +11 -0
- package/dist/bridge/index.mjs +29 -32
- package/dist/bridge/index.mjs.map +1 -1
- package/dist/bridge/package.json +1 -0
- package/dist/bridge/pnpm-lock.yaml +117 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +53 -8
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
- package/src/bridge/index.ts +58 -53
- package/src/bridge/opencode-path.ts +3 -1
- package/src/bridge/package.json +1 -0
- package/src/bridge/pnpm-lock.yaml +117 -0
- package/src/opencode-bridge-protocol.ts +33 -11
- package/src/opencode-harness.ts +49 -3
package/dist/bridge/package.json
CHANGED
|
@@ -14,6 +14,9 @@ importers:
|
|
|
14
14
|
'@opencode-ai/sdk':
|
|
15
15
|
specifier: 1.18.34
|
|
16
16
|
version: 1.18.34
|
|
17
|
+
'@vscode/ripgrep':
|
|
18
|
+
specifier: 1.18.0
|
|
19
|
+
version: 1.18.0
|
|
17
20
|
opencode-ai:
|
|
18
21
|
specifier: 1.18.34
|
|
19
22
|
version: 1.18.34
|
|
@@ -45,6 +48,69 @@ packages:
|
|
|
45
48
|
'@opencode-ai/sdk@1.18.34':
|
|
46
49
|
resolution: {integrity: sha512-R9QWUpcngtdQ6FCixz7NC6n1WsSho6CEuRUzYHz/CzZcp3miSklDzXkm0oDwXVCnuEu+ANoeM0f6RDp51kOMzQ==}
|
|
47
50
|
|
|
51
|
+
'@vscode/ripgrep-darwin-arm64@1.18.0':
|
|
52
|
+
resolution: {integrity: sha512-r3ktHSvbFycQNF6sl7sNDPocpsI7J+mEzh1IaZFkY0spm3k2Z9t8hPAeOK7+p0l6p6/swkQC14XWX01low+94Q==}
|
|
53
|
+
cpu: [arm64]
|
|
54
|
+
os: [darwin]
|
|
55
|
+
|
|
56
|
+
'@vscode/ripgrep-darwin-x64@1.18.0':
|
|
57
|
+
resolution: {integrity: sha512-25b4gWbL138dGuQU244ebCKKc0q05ULBMoFSz9oAEUHNeqK/lOJViDS7DRvbDazzAzSEdan391Znks/R5mkaTQ==}
|
|
58
|
+
cpu: [x64]
|
|
59
|
+
os: [darwin]
|
|
60
|
+
|
|
61
|
+
'@vscode/ripgrep-linux-arm64@1.18.0':
|
|
62
|
+
resolution: {integrity: sha512-lQ/5zTG++U0E3IhVgS4EPTTn/U4okncaRMM5GOFfOYZywS4nuD31GhkHbNYlDk5CuDC68+hYJ0/eQeyCKJDA+g==}
|
|
63
|
+
cpu: [arm64]
|
|
64
|
+
os: [linux]
|
|
65
|
+
|
|
66
|
+
'@vscode/ripgrep-linux-arm@1.18.0':
|
|
67
|
+
resolution: {integrity: sha512-GDAvufNDHu8zqLEmXstalQF0Wh6wQvdsBi/Vg3Yi3CK4a8XoFXqqXVEHEZ9xQz3t0NfoSEc9JbvK9DDS6FxyxQ==}
|
|
68
|
+
cpu: [arm]
|
|
69
|
+
os: [linux]
|
|
70
|
+
|
|
71
|
+
'@vscode/ripgrep-linux-ia32@1.18.0':
|
|
72
|
+
resolution: {integrity: sha512-YWLkSUtFd4Jh5EepIhA9RJSfv3uMAVMo+2rBIGHPBnvgLrZciIs2cDKei1/p6Wc/aCzUoHyMAg2R6tw4ZCBKGg==}
|
|
73
|
+
cpu: [ia32]
|
|
74
|
+
os: [linux]
|
|
75
|
+
|
|
76
|
+
'@vscode/ripgrep-linux-ppc64@1.18.0':
|
|
77
|
+
resolution: {integrity: sha512-quXVY8fwQ8O/lvU1yrSqSl3jlUzysRSb+AfUfCL/tRtphxsKlFvPAejryZ6vg4Bgvn8XL74xb4qMCDmWgYrT5w==}
|
|
78
|
+
cpu: [ppc64]
|
|
79
|
+
os: [linux]
|
|
80
|
+
|
|
81
|
+
'@vscode/ripgrep-linux-riscv64@1.18.0':
|
|
82
|
+
resolution: {integrity: sha512-f5kBQBrWfQt8Q7OhSORuNDei5dkYagBj3y4jImSUXGMy8B/Ke7SltSRcUtjPv166FAFfHCAmWuZp3+cWnX2/Vw==}
|
|
83
|
+
cpu: [riscv64]
|
|
84
|
+
os: [linux]
|
|
85
|
+
|
|
86
|
+
'@vscode/ripgrep-linux-s390x@1.18.0':
|
|
87
|
+
resolution: {integrity: sha512-rTOcJFGGcl2c07RUOWUo4U1ndnemKhY6A9hnMB18uk7jSgJc0d/QLBGWMWpumdtoJtpizn/wIv5mXIisJukusQ==}
|
|
88
|
+
cpu: [s390x]
|
|
89
|
+
os: [linux]
|
|
90
|
+
|
|
91
|
+
'@vscode/ripgrep-linux-x64@1.18.0':
|
|
92
|
+
resolution: {integrity: sha512-mQ3bVrUpnD2vs7QT0vX90Lt0cnUq467uFtEktIdsJJmW296RoSULRGqWgzG1AKxyBpNDD6l4ZO4qKf6SgyC23Q==}
|
|
93
|
+
cpu: [x64]
|
|
94
|
+
os: [linux]
|
|
95
|
+
|
|
96
|
+
'@vscode/ripgrep-win32-arm64@1.18.0':
|
|
97
|
+
resolution: {integrity: sha512-vfTIjq1OHnzUjxZcHVQAMbnggp8dpGf+0QKFOZHwWPqFwXxQC8eCWM+5NUdoJ6yrElCeMzoUTXoK/LdZaniB+Q==}
|
|
98
|
+
cpu: [arm64]
|
|
99
|
+
os: [win32]
|
|
100
|
+
|
|
101
|
+
'@vscode/ripgrep-win32-ia32@1.18.0':
|
|
102
|
+
resolution: {integrity: sha512-//rfAE+BOw5AC2EMmepmiE36jUuevtQYNQqqlw1s3m9FlRxjxEut97RkRPHAu9BG4mSojatZx+kXZXNdyI9caQ==}
|
|
103
|
+
cpu: [ia32]
|
|
104
|
+
os: [win32]
|
|
105
|
+
|
|
106
|
+
'@vscode/ripgrep-win32-x64@1.18.0':
|
|
107
|
+
resolution: {integrity: sha512-KNPvtElldqILHdnAetujPaowkNbpqJy3ssIGGN6F6Kve9Qi+nNLI2DN01O83JjCEVQbCzl8Ov3QZ9Eov3BR8Dg==}
|
|
108
|
+
cpu: [x64]
|
|
109
|
+
os: [win32]
|
|
110
|
+
|
|
111
|
+
'@vscode/ripgrep@1.18.0':
|
|
112
|
+
resolution: {integrity: sha512-ns5lWe44tSfbTMbVUsyB+I1819PVSw4AdpgK0RNkzfWfwy6+3IUNSxwSrfTno1/oWaS/hERNz+XLWVyga2aJBQ==}
|
|
113
|
+
|
|
48
114
|
accepts@2.0.0:
|
|
49
115
|
resolution: {integrity: sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng==}
|
|
50
116
|
engines: {node: '>= 0.6'}
|
|
@@ -507,6 +573,57 @@ snapshots:
|
|
|
507
573
|
dependencies:
|
|
508
574
|
cross-spawn: 7.0.6
|
|
509
575
|
|
|
576
|
+
'@vscode/ripgrep-darwin-arm64@1.18.0':
|
|
577
|
+
optional: true
|
|
578
|
+
|
|
579
|
+
'@vscode/ripgrep-darwin-x64@1.18.0':
|
|
580
|
+
optional: true
|
|
581
|
+
|
|
582
|
+
'@vscode/ripgrep-linux-arm64@1.18.0':
|
|
583
|
+
optional: true
|
|
584
|
+
|
|
585
|
+
'@vscode/ripgrep-linux-arm@1.18.0':
|
|
586
|
+
optional: true
|
|
587
|
+
|
|
588
|
+
'@vscode/ripgrep-linux-ia32@1.18.0':
|
|
589
|
+
optional: true
|
|
590
|
+
|
|
591
|
+
'@vscode/ripgrep-linux-ppc64@1.18.0':
|
|
592
|
+
optional: true
|
|
593
|
+
|
|
594
|
+
'@vscode/ripgrep-linux-riscv64@1.18.0':
|
|
595
|
+
optional: true
|
|
596
|
+
|
|
597
|
+
'@vscode/ripgrep-linux-s390x@1.18.0':
|
|
598
|
+
optional: true
|
|
599
|
+
|
|
600
|
+
'@vscode/ripgrep-linux-x64@1.18.0':
|
|
601
|
+
optional: true
|
|
602
|
+
|
|
603
|
+
'@vscode/ripgrep-win32-arm64@1.18.0':
|
|
604
|
+
optional: true
|
|
605
|
+
|
|
606
|
+
'@vscode/ripgrep-win32-ia32@1.18.0':
|
|
607
|
+
optional: true
|
|
608
|
+
|
|
609
|
+
'@vscode/ripgrep-win32-x64@1.18.0':
|
|
610
|
+
optional: true
|
|
611
|
+
|
|
612
|
+
'@vscode/ripgrep@1.18.0':
|
|
613
|
+
optionalDependencies:
|
|
614
|
+
'@vscode/ripgrep-darwin-arm64': 1.18.0
|
|
615
|
+
'@vscode/ripgrep-darwin-x64': 1.18.0
|
|
616
|
+
'@vscode/ripgrep-linux-arm': 1.18.0
|
|
617
|
+
'@vscode/ripgrep-linux-arm64': 1.18.0
|
|
618
|
+
'@vscode/ripgrep-linux-ia32': 1.18.0
|
|
619
|
+
'@vscode/ripgrep-linux-ppc64': 1.18.0
|
|
620
|
+
'@vscode/ripgrep-linux-riscv64': 1.18.0
|
|
621
|
+
'@vscode/ripgrep-linux-s390x': 1.18.0
|
|
622
|
+
'@vscode/ripgrep-linux-x64': 1.18.0
|
|
623
|
+
'@vscode/ripgrep-win32-arm64': 1.18.0
|
|
624
|
+
'@vscode/ripgrep-win32-ia32': 1.18.0
|
|
625
|
+
'@vscode/ripgrep-win32-x64': 1.18.0
|
|
626
|
+
|
|
510
627
|
accepts@2.0.0:
|
|
511
628
|
dependencies:
|
|
512
629
|
mime-types: 3.0.2
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":["SandboxSession"],"sources":["../src/opencode-auth.ts","../src/opencode-harness.ts","../src/version.ts","../src/index.ts"],"mappings":";;;;;KAmMY,6BAA6B;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":["SandboxSession"],"sources":["../src/opencode-auth.ts","../src/opencode-harness.ts","../src/version.ts","../src/index.ts"],"mappings":";;;;;KAmMY,6BAA6B;;;KCtG7B;WACD,OAAO;;;;;;WAMP,uBAAuB;;;;;;WAMvB,iBAAiB;;;;;WAKjB,aAAa;WACb;;;;;;WAMA;WACA;;;;;WAKA,eAAe;WACf;;;;;;;WAOA,YAAY;;;;;WAKZ,kBAAkB;;cAKvB;;;;;;;;;;;;;QAm3Cy4V;QAAoC;;;UAAmE;UAAsC;;QAAiE;QAA2C;;;;;;;;;;;QAAzP;QAAoC;;;UAAmE;UAAsC;;QAAiE;QAA2C;;;;;;;;;;;;;;;UAAzP;UAAoC;;;YAAmE;YAAsC;;UAAiE;UAA2C;;;;;;;;;;;;;UAAzP;UAAoC;;;YAAmE;YAAsC;;UAAiE;UAA2C;;;;;;;;;UAA4K;;;;;;UAAgJ;;;;;;;;;;;;QAAhJ;;;;;;QAAgJ;;;;;;;;;;;;QAArjB;QAAoC;;;UAAmE;UAAsC;;QAAiE;QAA2C;;;;;;;;QAA4K;;;;;;QAAgJ;;;;;;;;;;;;;;;;;;UAArjB;UAAoC;;;YAAmE;YAAsC;;UAAiE;UAA2C;;;;;;;;;;;;;;;;;;;;;;;QAAzP;QAAoC;;;UAAmE;UAAsC;;QAAiE;QAA2C;;;;;;;;;;;QAAzP;QAAoC;;;UAAmE;UAAsC;;QAAiE;QAA2C;;;;;;;;;;;;;;;UAAzP;UAAoC;;;YAAmE;YAAsC;;UAAiE;UAA2C;;;;;;;;;;;;;UAAzP;UAAoC;;;YAAmE;YAAsC;;UAAiE;UAA2C;;;;;;;;;UAA4K;;;;;;UAAgJ;;;;;;;;;;;;QAAhJ;;;;;;QAAgJ;;;;;;;;;;;;;;;;;;;UAArjB;UAAoC;;;YAAmE;YAAsC;;UAAiE;UAA2C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAnvCxnW,eACd,WAAU,0BACT,iBAAiB;;;qBC9QP;;;;;;;qBCIA,oCAAQ;;;;;;;;;;;;;QAO+51D;QAAoC;;;UAAmE;UAAsC;;QAAiE;QAA2C;;;;;;;;;;;QAAzP;QAAoC;;;UAAmE;UAAsC;;QAAiE;QAA2C;;;;;;;;;;;;;;;UAAzP;UAAoC;;;YAAmE;YAAsC;;UAAiE;UAA2C;;;;;;;;;;;;;UAAzP;UAAoC;;;YAAmE;YAAsC;;UAAiE;UAA2C;;;;;;;;;UAA4K;;;;;;UAAgJ;;;;;;;;;;;;QAAhJ;;;;;;QAAgJ;;;;;;;;;;;;QAArjB;QAAoC;;;UAAmE;UAAsC;;QAAiE;QAA2C;;;;;;;;QAA4K;;;;;;QAAgJ;;;;;;;;;;;;;;;;;;UAArjB;UAAoC;;;YAAmE;YAAsC;;UAAiE;UAA2C;;;;;;;;;;;;;;;;;;;;;;;QAAzP;QAAoC;;;UAAmE;UAAsC;;QAAiE;QAA2C;;;;;;;;;;;QAAzP;QAAoC;;;UAAmE;UAAsC;;QAAiE;QAA2C;;;;;;;;;;;;;;;UAAzP;UAAoC;;;YAAmE;YAAsC;;UAAiE;UAA2C;;;;;;;;;;;;;UAAzP;UAAoC;;;YAAmE;YAAsC;;UAAiE;UAA2C;;;;;;;;;UAA4K;;;;;;UAAgJ;;;;;;;;;;;;QAAhJ;;;;;;QAAgJ;;;;;;;;;;;;;;;;;;;UAArjB;UAAoC;;;YAAmE;YAAsC;;UAAiE;UAA2C"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import path, { dirname, join } from "node:path";
|
|
2
|
-
import { HARNESS_V1_BUILTIN_TOOLS, HarnessCapabilityUnsupportedError, commonTool, harnessSessionDataDirectoryPath, harnessStateDirectoryPath, harnessV1BridgeInboundCommandSchemas, harnessV1BridgeOutboundMessageSchema, harnessV1BridgeStartBaseSchema, harnessV1DiagnosticFromBridgeFrame } from "@ai-sdk/harness";
|
|
2
|
+
import { HARNESS_V1_BUILTIN_TOOLS, HarnessCapabilityUnsupportedError, commonTool, harnessSessionDataDirectoryPath, harnessStateDirectoryPath, harnessV1BridgeInboundCommandSchemas, harnessV1BridgeOutboundMessageSchema, harnessV1BridgeStartBaseSchema, harnessV1DiagnosticFromBridgeFrame, isHarnessV1BuiltinToolIncluded } from "@ai-sdk/harness";
|
|
3
3
|
import { SandboxChannel, applyCredentialForwarding, classifyDiskLog, createBridgeErrorHandler, createBridgeStartupError, createBridgeToken, createCredentialRequestTransformation, createReadBridgeAsset, drainBridgeProcessStream, experimental_createBridgeUserMessageSubmitter, forwardBridgeProcessStream, getAiGatewayAuthFromEnv, getRestrictedSandboxSession, isAccessTokenExpiringSoon, isHarnessAuthenticationEnvironment, isWindows, markBridgeStarting, parseJwtPayload, refreshOAuthAccessToken, resolveSandboxCredentialEnvironment, resolveSandboxHomeDir, shellQuote, waitForBridgeReady, warnCredentialBrokeringUnavailable, withBridgeToken, writeSkills } from "@ai-sdk/harness/utils";
|
|
4
4
|
import { isRecord, safeParseJSON, tool } from "@ai-sdk/provider-utils";
|
|
5
5
|
import { WebSocket } from "ws";
|
|
@@ -699,7 +699,21 @@ function isSubscriptionProvider(value) {
|
|
|
699
699
|
//#endregion
|
|
700
700
|
//#region src/opencode-bridge-protocol.ts
|
|
701
701
|
const outboundMessageSchema = harnessV1BridgeOutboundMessageSchema;
|
|
702
|
-
const
|
|
702
|
+
const openCodeBuiltinToolNameSchema = z.enum([
|
|
703
|
+
"askUserQuestions",
|
|
704
|
+
"read",
|
|
705
|
+
"write",
|
|
706
|
+
"edit",
|
|
707
|
+
"bash",
|
|
708
|
+
"glob",
|
|
709
|
+
"grep",
|
|
710
|
+
"ls",
|
|
711
|
+
"webfetch",
|
|
712
|
+
"skill",
|
|
713
|
+
"todowrite",
|
|
714
|
+
"agent"
|
|
715
|
+
]);
|
|
716
|
+
const startMessageSchema = harnessV1BridgeStartBaseSchema.omit({ builtinToolFiltering: true }).extend({
|
|
703
717
|
operation: z.enum(["prompt", "compact"]).optional(),
|
|
704
718
|
provider: z.string().optional(),
|
|
705
719
|
variant: z.string().optional(),
|
|
@@ -708,12 +722,13 @@ const startMessageSchema = harnessV1BridgeStartBaseSchema.extend({
|
|
|
708
722
|
resumeSessionId: z.string().optional(),
|
|
709
723
|
openCodeConfig: z.record(z.string(), z.unknown()).optional(),
|
|
710
724
|
mcpServers: z.record(z.string(), z.unknown()).optional(),
|
|
711
|
-
headers: z.record(z.string(), z.string()).optional()
|
|
725
|
+
headers: z.record(z.string(), z.string()).optional(),
|
|
726
|
+
inactiveBuiltinToolNames: z.array(openCodeBuiltinToolNameSchema).optional()
|
|
712
727
|
});
|
|
713
728
|
z.discriminatedUnion("type", [startMessageSchema, ...harnessV1BridgeInboundCommandSchemas]);
|
|
714
729
|
//#endregion
|
|
715
730
|
//#region src/version.ts
|
|
716
|
-
const VERSION = "1.0.
|
|
731
|
+
const VERSION = "1.0.154";
|
|
717
732
|
//#endregion
|
|
718
733
|
//#region src/opencode-harness.ts
|
|
719
734
|
/**
|
|
@@ -814,6 +829,7 @@ const OPENCODE_BUILTIN_TOOLS = {
|
|
|
814
829
|
})
|
|
815
830
|
})
|
|
816
831
|
};
|
|
832
|
+
const OPENCODE_BUILTIN_TOOL_NAMES = Object.keys(OPENCODE_BUILTIN_TOOLS);
|
|
817
833
|
const openCodeBridgeCoordsSchema = z.object({
|
|
818
834
|
port: z.number(),
|
|
819
835
|
token: z.string(),
|
|
@@ -832,9 +848,11 @@ function createOpenCode(settings = {}) {
|
|
|
832
848
|
harnessId: "opencode",
|
|
833
849
|
builtinTools: OPENCODE_BUILTIN_TOOLS,
|
|
834
850
|
supportsBuiltinToolApprovals: true,
|
|
851
|
+
supportsBuiltinToolFiltering: true,
|
|
835
852
|
lifecycleStateSchema: openCodeResumeStateSchema,
|
|
836
853
|
getBootstrap: getOpenCodeBootstrap,
|
|
837
854
|
doStart: async (startOpts) => {
|
|
855
|
+
validateBuiltinToolFiltering(startOpts.builtinToolFiltering);
|
|
838
856
|
const sandboxSession = startOpts.sandboxSession;
|
|
839
857
|
const toolSafeSandboxSession = getRestrictedSandboxSession(sandboxSession);
|
|
840
858
|
const sandboxId = "id" in sandboxSession ? sandboxSession.id : void 0;
|
|
@@ -1120,6 +1138,24 @@ function createOpenCode(settings = {}) {
|
|
|
1120
1138
|
}
|
|
1121
1139
|
};
|
|
1122
1140
|
}
|
|
1141
|
+
function validateBuiltinToolFiltering(toolFiltering) {
|
|
1142
|
+
if (toolFiltering == null) return;
|
|
1143
|
+
const isActive = (toolName) => isHarnessV1BuiltinToolIncluded({
|
|
1144
|
+
toolName,
|
|
1145
|
+
toolFiltering
|
|
1146
|
+
});
|
|
1147
|
+
if (isActive("write") !== isActive("edit")) throw new HarnessCapabilityUnsupportedError({
|
|
1148
|
+
harnessId: "opencode",
|
|
1149
|
+
message: "OpenCode built-in filtering requires 'write' and 'edit' to either both be active or both be inactive."
|
|
1150
|
+
});
|
|
1151
|
+
}
|
|
1152
|
+
function resolveInactiveBuiltinToolNames(toolFiltering) {
|
|
1153
|
+
if (toolFiltering == null) return void 0;
|
|
1154
|
+
return OPENCODE_BUILTIN_TOOL_NAMES.filter((toolName) => !isHarnessV1BuiltinToolIncluded({
|
|
1155
|
+
toolName,
|
|
1156
|
+
toolFiltering
|
|
1157
|
+
}));
|
|
1158
|
+
}
|
|
1123
1159
|
function resolveBridgePort({ sandboxSession, override }) {
|
|
1124
1160
|
if (override !== void 0) return override;
|
|
1125
1161
|
if ("ports" in sandboxSession && sandboxSession.ports.length > 0) return sandboxSession.ports[0];
|
|
@@ -1242,16 +1278,19 @@ function createSession({ sessionId, channel, proc, provider, reasoningVariant, o
|
|
|
1242
1278
|
let selectedModel;
|
|
1243
1279
|
let activeTurn = false;
|
|
1244
1280
|
let pendingTurnDrain = Promise.resolve();
|
|
1281
|
+
let abortedTurnDrain = Promise.resolve();
|
|
1245
1282
|
const pendingCompactionParts = [];
|
|
1283
|
+
const inactiveBuiltinToolNames = resolveInactiveBuiltinToolNames(builtinToolFiltering);
|
|
1246
1284
|
channel.on("bridge-thread", (msg) => {
|
|
1247
1285
|
latestOpenCodeSessionId = msg.threadId;
|
|
1248
1286
|
});
|
|
1249
1287
|
const wireTurn = (turnOpts) => {
|
|
1250
1288
|
activeTurn = true;
|
|
1251
1289
|
let resolveTurnDrain;
|
|
1252
|
-
|
|
1290
|
+
const turnDrain = new Promise((resolve) => {
|
|
1253
1291
|
resolveTurnDrain = resolve;
|
|
1254
1292
|
});
|
|
1293
|
+
pendingTurnDrain = turnDrain;
|
|
1255
1294
|
let pendingResolve;
|
|
1256
1295
|
let pendingReject;
|
|
1257
1296
|
const done = new Promise((resolve, reject) => {
|
|
@@ -1348,6 +1387,7 @@ function createSession({ sessionId, channel, proc, provider, reasoningVariant, o
|
|
|
1348
1387
|
const error = turnOpts.abortSignal?.reason ?? new DOMException("Aborted", "AbortError");
|
|
1349
1388
|
isSettled = true;
|
|
1350
1389
|
drainingAfterAbort = true;
|
|
1390
|
+
abortedTurnDrain = turnDrain;
|
|
1351
1391
|
userMessageSubmitter?.close(error);
|
|
1352
1392
|
pendingReject(error);
|
|
1353
1393
|
};
|
|
@@ -1388,12 +1428,11 @@ function createSession({ sessionId, channel, proc, provider, reasoningVariant, o
|
|
|
1388
1428
|
...mcpServers == null ? {} : { mcpServers },
|
|
1389
1429
|
...headers == null ? {} : { headers },
|
|
1390
1430
|
...permissionMode ? { permissionMode } : {},
|
|
1391
|
-
...
|
|
1431
|
+
...inactiveBuiltinToolNames == null ? {} : { inactiveBuiltinToolNames },
|
|
1392
1432
|
...pendingResumeSessionId ? { resumeSessionId: pendingResumeSessionId } : latestOpenCodeSessionId ? { resumeSessionId: latestOpenCodeSessionId } : {},
|
|
1393
1433
|
...debug ? { debug } : {}
|
|
1394
1434
|
});
|
|
1395
1435
|
const prepareTurn = async (opts) => {
|
|
1396
|
-
await pendingTurnDrain;
|
|
1397
1436
|
if (opts.responseFormat?.type === "json" && opts.responseFormat.schema == null) throw new HarnessCapabilityUnsupportedError({
|
|
1398
1437
|
message: "Harness 'opencode' requires a JSON schema for structured output.",
|
|
1399
1438
|
harnessId: "opencode"
|
|
@@ -1419,6 +1458,7 @@ function createSession({ sessionId, channel, proc, provider, reasoningVariant, o
|
|
|
1419
1458
|
sessionId,
|
|
1420
1459
|
isResume,
|
|
1421
1460
|
doPromptTurn: async (promptOpts) => {
|
|
1461
|
+
await pendingTurnDrain;
|
|
1422
1462
|
const { control, skillWriteResult } = await prepareTurn(promptOpts);
|
|
1423
1463
|
const turnModel = promptOpts.model ?? selectedModel;
|
|
1424
1464
|
if (turnModel) selectedModel = turnModel;
|
|
@@ -1437,11 +1477,14 @@ function createSession({ sessionId, channel, proc, provider, reasoningVariant, o
|
|
|
1437
1477
|
...startBase(turnModel)
|
|
1438
1478
|
});
|
|
1439
1479
|
pendingResumeSessionId = void 0;
|
|
1480
|
+
rerunContinue = false;
|
|
1440
1481
|
return control;
|
|
1441
1482
|
},
|
|
1442
1483
|
doContinueTurn: async (continueOpts) => {
|
|
1484
|
+
await abortedTurnDrain;
|
|
1443
1485
|
const { control, skillWriteResult } = await prepareTurn(continueOpts);
|
|
1444
1486
|
if (rerunContinue) {
|
|
1487
|
+
rerunContinue = false;
|
|
1445
1488
|
const turnModel = continueOpts.model ?? selectedModel;
|
|
1446
1489
|
if (turnModel) selectedModel = turnModel;
|
|
1447
1490
|
channel.send({
|
|
@@ -1477,6 +1520,7 @@ function createSession({ sessionId, channel, proc, provider, reasoningVariant, o
|
|
|
1477
1520
|
provider,
|
|
1478
1521
|
permissionMode,
|
|
1479
1522
|
debug,
|
|
1523
|
+
inactiveBuiltinToolNames,
|
|
1480
1524
|
openCodeConfig,
|
|
1481
1525
|
mcpServers,
|
|
1482
1526
|
headers,
|
|
@@ -1596,7 +1640,7 @@ function createSession({ sessionId, channel, proc, provider, reasoningVariant, o
|
|
|
1596
1640
|
}
|
|
1597
1641
|
};
|
|
1598
1642
|
}
|
|
1599
|
-
async function runCompactOperation({ channel, model, provider, permissionMode, debug, openCodeConfig, mcpServers, headers, resumeSessionId, onCompaction }) {
|
|
1643
|
+
async function runCompactOperation({ channel, model, provider, permissionMode, debug, inactiveBuiltinToolNames, openCodeConfig, mcpServers, headers, resumeSessionId, onCompaction }) {
|
|
1600
1644
|
let pendingResolve;
|
|
1601
1645
|
let pendingReject;
|
|
1602
1646
|
const done = new Promise((resolve, reject) => {
|
|
@@ -1625,6 +1669,7 @@ async function runCompactOperation({ channel, model, provider, permissionMode, d
|
|
|
1625
1669
|
...mcpServers == null ? {} : { mcpServers },
|
|
1626
1670
|
...headers == null ? {} : { headers },
|
|
1627
1671
|
...permissionMode ? { permissionMode } : {},
|
|
1672
|
+
...inactiveBuiltinToolNames == null ? {} : { inactiveBuiltinToolNames },
|
|
1628
1673
|
...resumeSessionId ? { resumeSessionId } : {},
|
|
1629
1674
|
...debug ? { debug } : {}
|
|
1630
1675
|
});
|