@bohuyeshan/openagent-labforge-core 3.13.0 → 3.13.2

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.
@@ -1,192 +1,192 @@
1
- #!/usr/bin/env node
2
- // bin/openagent-labforge.js
3
- // Wrapper script that detects platform and spawns the correct binary
4
-
5
- import { spawnSync } from "node:child_process";
6
- import { existsSync, readFileSync } from "node:fs";
7
- import { createRequire } from "node:module";
8
- import { dirname, join } from "node:path";
9
- import { fileURLToPath } from "node:url";
10
- import { getPlatformPackageCandidates, getBinaryPath } from "./platform.js";
11
-
12
- const require = createRequire(import.meta.url);
13
- const CURRENT_DIR = dirname(fileURLToPath(import.meta.url));
14
-
15
- function readJson(path) {
16
- try {
17
- return JSON.parse(readFileSync(path, "utf8"));
18
- } catch {
19
- return null;
20
- }
21
- }
22
-
23
- function getCorePackageVersion() {
24
- const pkg = readJson(join(CURRENT_DIR, "..", "package.json"));
25
- return typeof pkg?.version === "string" ? pkg.version : null;
26
- }
27
-
28
- function getPlatformPackageVersion(pkg) {
29
- try {
30
- const pkgJsonPath = require.resolve(`${pkg}/package.json`);
31
- const parsed = readJson(pkgJsonPath);
32
- return typeof parsed?.version === "string" ? parsed.version : null;
33
- } catch {
34
- return null;
35
- }
36
- }
37
-
38
- function resolveBunCommand() {
39
- const envBun = process.env.BUN || process.env.BUN_PATH;
40
- if (envBun && existsSync(envBun)) {
41
- return envBun;
42
- }
43
-
44
- if (process.platform === "win32") {
45
- const appData = process.env.APPDATA || join(process.env.USERPROFILE || "", "AppData", "Roaming");
46
- const localAppData = process.env.LOCALAPPDATA || join(process.env.USERPROFILE || "", "AppData", "Local");
47
- const candidates = [
48
- join(appData, "npm", "bun.cmd"),
49
- join(appData, "npm", "bun.exe"),
50
- join(localAppData, "bun", "bin", "bun.exe"),
51
- "bun.cmd",
52
- "bun.exe",
53
- "bun",
54
- ];
55
-
56
- for (const candidate of candidates) {
57
- if (!candidate.includes("\\") && !candidate.includes("/")) {
58
- return candidate;
59
- }
60
- if (existsSync(candidate)) {
61
- return candidate;
62
- }
63
- }
64
- }
65
-
66
- return "bun";
67
- }
68
-
69
- function runJsCliFallback() {
70
- const cliPath = join(CURRENT_DIR, "..", "dist", "cli", "index.js");
71
- const bunCommand = resolveBunCommand();
72
- const result = spawnSync(bunCommand, [cliPath, ...process.argv.slice(2)], {
73
- stdio: "inherit",
74
- shell: process.platform === "win32",
75
- });
76
-
77
- if (result.error) {
78
- console.error(`\nopenagent-labforge: Failed to execute JS CLI fallback.`);
79
- console.error(`Error: ${result.error.message}\n`);
80
- process.exit(2);
81
- }
82
-
83
- if (result.signal) process.exit(getSignalExitCode(result.signal));
84
- process.exit(result.status ?? 1);
85
- }
86
-
87
- function getLibcFamily() {
88
- if (process.platform !== "linux") return undefined;
89
- try {
90
- const detectLibc = require("detect-libc");
91
- return detectLibc.familySync();
92
- } catch {
93
- return null;
94
- }
95
- }
96
-
97
- function supportsAvx2() {
98
- if (process.arch !== "x64") return null;
99
- if (process.env.OPENAGENT_LABFORGE_FORCE_BASELINE === "1") return false;
100
-
101
- if (process.platform === "linux") {
102
- try {
103
- const cpuInfo = readFileSync("/proc/cpuinfo", "utf8").toLowerCase();
104
- return cpuInfo.includes("avx2");
105
- } catch {
106
- return null;
107
- }
108
- }
109
-
110
- if (process.platform === "darwin") {
111
- const probe = spawnSync("sysctl", ["-n", "machdep.cpu.leaf7_features"], { encoding: "utf8" });
112
- if (probe.error || probe.status !== 0) return null;
113
- return probe.stdout.toUpperCase().includes("AVX2");
114
- }
115
-
116
- return null;
117
- }
118
-
119
- function getSignalExitCode(signal) {
120
- const signalCodeByName = { SIGINT: 2, SIGILL: 4, SIGKILL: 9, SIGTERM: 15 };
121
- return 128 + (signalCodeByName[signal] ?? 1);
122
- }
123
-
124
- function main() {
125
- const { platform, arch } = process;
126
- const libcFamily = getLibcFamily();
127
- const avx2Supported = supportsAvx2();
128
- const coreVersion = getCorePackageVersion();
129
-
130
- let packageCandidates;
131
- try {
132
- packageCandidates = getPlatformPackageCandidates({
133
- platform,
134
- arch,
135
- libcFamily,
136
- preferBaseline: avx2Supported === false,
137
- });
138
- } catch (error) {
139
- console.error(`\nopenagent-labforge: ${error.message}\n`);
140
- process.exit(1);
141
- }
142
-
143
- const resolvedBinaries = packageCandidates
144
- .map((pkg) => {
145
- try {
146
- return {
147
- pkg,
148
- binPath: require.resolve(getBinaryPath(pkg, platform)),
149
- version: getPlatformPackageVersion(pkg),
150
- };
151
- } catch {
152
- return null;
153
- }
154
- })
155
- .filter((entry) => entry !== null)
156
- .filter((entry) => {
157
- if (!coreVersion || !entry.version) return true;
158
- if (entry.version === coreVersion) return true;
159
-
160
- console.error(
161
- `openagent-labforge: Skipping stale platform binary ${entry.pkg}@${entry.version} ` +
162
- `(core package is ${coreVersion}).`
163
- );
164
- return false;
165
- });
166
-
167
- if (resolvedBinaries.length === 0) {
168
- runJsCliFallback();
169
- return;
170
- }
171
-
172
- for (let index = 0; index < resolvedBinaries.length; index += 1) {
173
- const currentBinary = resolvedBinaries[index];
174
- const hasFallback = index < resolvedBinaries.length - 1;
175
- const result = spawnSync(currentBinary.binPath, process.argv.slice(2), { stdio: "inherit" });
176
-
177
- if (result.error) {
178
- if (hasFallback) continue;
179
- console.error(`\nopenagent-labforge: Failed to execute binary.`);
180
- console.error(`Error: ${result.error.message}\n`);
181
- process.exit(2);
182
- }
183
-
184
- if (result.signal === "SIGILL" && hasFallback) continue;
185
- if (result.signal) process.exit(getSignalExitCode(result.signal));
186
- process.exit(result.status ?? 1);
187
- }
188
-
189
- process.exit(1);
190
- }
191
-
192
- main();
1
+ #!/usr/bin/env node
2
+ // bin/openagent-labforge.js
3
+ // Wrapper script that detects platform and spawns the correct binary
4
+
5
+ import { spawnSync } from "node:child_process";
6
+ import { existsSync, readFileSync } from "node:fs";
7
+ import { createRequire } from "node:module";
8
+ import { dirname, join } from "node:path";
9
+ import { fileURLToPath } from "node:url";
10
+ import { getPlatformPackageCandidates, getBinaryPath } from "./platform.js";
11
+
12
+ const require = createRequire(import.meta.url);
13
+ const CURRENT_DIR = dirname(fileURLToPath(import.meta.url));
14
+
15
+ function readJson(path) {
16
+ try {
17
+ return JSON.parse(readFileSync(path, "utf8"));
18
+ } catch {
19
+ return null;
20
+ }
21
+ }
22
+
23
+ function getCorePackageVersion() {
24
+ const pkg = readJson(join(CURRENT_DIR, "..", "package.json"));
25
+ return typeof pkg?.version === "string" ? pkg.version : null;
26
+ }
27
+
28
+ function getPlatformPackageVersion(pkg) {
29
+ try {
30
+ const pkgJsonPath = require.resolve(`${pkg}/package.json`);
31
+ const parsed = readJson(pkgJsonPath);
32
+ return typeof parsed?.version === "string" ? parsed.version : null;
33
+ } catch {
34
+ return null;
35
+ }
36
+ }
37
+
38
+ function resolveBunCommand() {
39
+ const envBun = process.env.BUN || process.env.BUN_PATH;
40
+ if (envBun && existsSync(envBun)) {
41
+ return envBun;
42
+ }
43
+
44
+ if (process.platform === "win32") {
45
+ const appData = process.env.APPDATA || join(process.env.USERPROFILE || "", "AppData", "Roaming");
46
+ const localAppData = process.env.LOCALAPPDATA || join(process.env.USERPROFILE || "", "AppData", "Local");
47
+ const candidates = [
48
+ join(appData, "npm", "bun.cmd"),
49
+ join(appData, "npm", "bun.exe"),
50
+ join(localAppData, "bun", "bin", "bun.exe"),
51
+ "bun.cmd",
52
+ "bun.exe",
53
+ "bun",
54
+ ];
55
+
56
+ for (const candidate of candidates) {
57
+ if (!candidate.includes("\\") && !candidate.includes("/")) {
58
+ return candidate;
59
+ }
60
+ if (existsSync(candidate)) {
61
+ return candidate;
62
+ }
63
+ }
64
+ }
65
+
66
+ return "bun";
67
+ }
68
+
69
+ function runJsCliFallback() {
70
+ const cliPath = join(CURRENT_DIR, "..", "dist", "cli", "index.js");
71
+ const bunCommand = resolveBunCommand();
72
+ const result = spawnSync(bunCommand, [cliPath, ...process.argv.slice(2)], {
73
+ stdio: "inherit",
74
+ shell: process.platform === "win32",
75
+ });
76
+
77
+ if (result.error) {
78
+ console.error(`\nopenagent-labforge: Failed to execute JS CLI fallback.`);
79
+ console.error(`Error: ${result.error.message}\n`);
80
+ process.exit(2);
81
+ }
82
+
83
+ if (result.signal) process.exit(getSignalExitCode(result.signal));
84
+ process.exit(result.status ?? 1);
85
+ }
86
+
87
+ function getLibcFamily() {
88
+ if (process.platform !== "linux") return undefined;
89
+ try {
90
+ const detectLibc = require("detect-libc");
91
+ return detectLibc.familySync();
92
+ } catch {
93
+ return null;
94
+ }
95
+ }
96
+
97
+ function supportsAvx2() {
98
+ if (process.arch !== "x64") return null;
99
+ if (process.env.OPENAGENT_LABFORGE_FORCE_BASELINE === "1") return false;
100
+
101
+ if (process.platform === "linux") {
102
+ try {
103
+ const cpuInfo = readFileSync("/proc/cpuinfo", "utf8").toLowerCase();
104
+ return cpuInfo.includes("avx2");
105
+ } catch {
106
+ return null;
107
+ }
108
+ }
109
+
110
+ if (process.platform === "darwin") {
111
+ const probe = spawnSync("sysctl", ["-n", "machdep.cpu.leaf7_features"], { encoding: "utf8" });
112
+ if (probe.error || probe.status !== 0) return null;
113
+ return probe.stdout.toUpperCase().includes("AVX2");
114
+ }
115
+
116
+ return null;
117
+ }
118
+
119
+ function getSignalExitCode(signal) {
120
+ const signalCodeByName = { SIGINT: 2, SIGILL: 4, SIGKILL: 9, SIGTERM: 15 };
121
+ return 128 + (signalCodeByName[signal] ?? 1);
122
+ }
123
+
124
+ function main() {
125
+ const { platform, arch } = process;
126
+ const libcFamily = getLibcFamily();
127
+ const avx2Supported = supportsAvx2();
128
+ const coreVersion = getCorePackageVersion();
129
+
130
+ let packageCandidates;
131
+ try {
132
+ packageCandidates = getPlatformPackageCandidates({
133
+ platform,
134
+ arch,
135
+ libcFamily,
136
+ preferBaseline: avx2Supported === false,
137
+ });
138
+ } catch (error) {
139
+ console.error(`\nopenagent-labforge: ${error.message}\n`);
140
+ process.exit(1);
141
+ }
142
+
143
+ const resolvedBinaries = packageCandidates
144
+ .map((pkg) => {
145
+ try {
146
+ return {
147
+ pkg,
148
+ binPath: require.resolve(getBinaryPath(pkg, platform)),
149
+ version: getPlatformPackageVersion(pkg),
150
+ };
151
+ } catch {
152
+ return null;
153
+ }
154
+ })
155
+ .filter((entry) => entry !== null)
156
+ .filter((entry) => {
157
+ if (!coreVersion || !entry.version) return true;
158
+ if (entry.version === coreVersion) return true;
159
+
160
+ console.error(
161
+ `openagent-labforge: Skipping stale platform binary ${entry.pkg}@${entry.version} ` +
162
+ `(core package is ${coreVersion}).`
163
+ );
164
+ return false;
165
+ });
166
+
167
+ if (resolvedBinaries.length === 0) {
168
+ runJsCliFallback();
169
+ return;
170
+ }
171
+
172
+ for (let index = 0; index < resolvedBinaries.length; index += 1) {
173
+ const currentBinary = resolvedBinaries[index];
174
+ const hasFallback = index < resolvedBinaries.length - 1;
175
+ const result = spawnSync(currentBinary.binPath, process.argv.slice(2), { stdio: "inherit" });
176
+
177
+ if (result.error) {
178
+ if (hasFallback) continue;
179
+ console.error(`\nopenagent-labforge: Failed to execute binary.`);
180
+ console.error(`Error: ${result.error.message}\n`);
181
+ process.exit(2);
182
+ }
183
+
184
+ if (result.signal === "SIGILL" && hasFallback) continue;
185
+ if (result.signal) process.exit(getSignalExitCode(result.signal));
186
+ process.exit(result.status ?? 1);
187
+ }
188
+
189
+ process.exit(1);
190
+ }
191
+
192
+ main();
@@ -12,7 +12,7 @@ describe("getPlatformPackage", () => {
12
12
  const result = getPlatformPackage(input);
13
13
 
14
14
  // #then returns correct package name
15
- expect(result).toBe("openagent-labforge-darwin-arm64");
15
+ expect(result).toBe("openagent-labforge-darwin-arm64");
16
16
  });
17
17
 
18
18
  test("returns darwin-x64 for macOS Intel", () => {
@@ -23,7 +23,7 @@ describe("getPlatformPackage", () => {
23
23
  const result = getPlatformPackage(input);
24
24
 
25
25
  // #then returns correct package name
26
- expect(result).toBe("openagent-labforge-darwin-x64");
26
+ expect(result).toBe("openagent-labforge-darwin-x64");
27
27
  });
28
28
  // #endregion
29
29
 
@@ -36,7 +36,7 @@ describe("getPlatformPackage", () => {
36
36
  const result = getPlatformPackage(input);
37
37
 
38
38
  // #then returns correct package name
39
- expect(result).toBe("openagent-labforge-linux-x64");
39
+ expect(result).toBe("openagent-labforge-linux-x64");
40
40
  });
41
41
 
42
42
  test("returns linux-arm64 for Linux ARM64 with glibc", () => {
@@ -47,7 +47,7 @@ describe("getPlatformPackage", () => {
47
47
  const result = getPlatformPackage(input);
48
48
 
49
49
  // #then returns correct package name
50
- expect(result).toBe("openagent-labforge-linux-arm64");
50
+ expect(result).toBe("openagent-labforge-linux-arm64");
51
51
  });
52
52
  // #endregion
53
53
 
@@ -60,7 +60,7 @@ describe("getPlatformPackage", () => {
60
60
  const result = getPlatformPackage(input);
61
61
 
62
62
  // #then returns correct package name with musl suffix
63
- expect(result).toBe("openagent-labforge-linux-x64-musl");
63
+ expect(result).toBe("openagent-labforge-linux-x64-musl");
64
64
  });
65
65
 
66
66
  test("returns linux-arm64-musl for Alpine ARM64", () => {
@@ -71,7 +71,7 @@ describe("getPlatformPackage", () => {
71
71
  const result = getPlatformPackage(input);
72
72
 
73
73
  // #then returns correct package name with musl suffix
74
- expect(result).toBe("openagent-labforge-linux-arm64-musl");
74
+ expect(result).toBe("openagent-labforge-linux-arm64-musl");
75
75
  });
76
76
  // #endregion
77
77
 
@@ -84,7 +84,7 @@ describe("getPlatformPackage", () => {
84
84
  const result = getPlatformPackage(input);
85
85
 
86
86
  // #then returns correct package name with 'windows' not 'win32'
87
- expect(result).toBe("openagent-labforge-windows-x64");
87
+ expect(result).toBe("openagent-labforge-windows-x64");
88
88
  });
89
89
  // #endregion
90
90
 
@@ -112,38 +112,38 @@ describe("getPlatformPackage", () => {
112
112
  describe("getBinaryPath", () => {
113
113
  test("returns path without .exe for Unix platforms", () => {
114
114
  // #given Unix platform package
115
- const pkg = "openagent-labforge-darwin-arm64";
115
+ const pkg = "openagent-labforge-darwin-arm64";
116
116
  const platform = "darwin";
117
117
 
118
118
  // #when getting binary path
119
119
  const result = getBinaryPath(pkg, platform);
120
120
 
121
121
  // #then returns path without extension
122
- expect(result).toBe("openagent-labforge-darwin-arm64/bin/openagent-labforge");
122
+ expect(result).toBe("openagent-labforge-darwin-arm64/bin/openagent-labforge");
123
123
  });
124
124
 
125
125
  test("returns path with .exe for Windows", () => {
126
126
  // #given Windows platform package
127
- const pkg = "openagent-labforge-windows-x64";
127
+ const pkg = "openagent-labforge-windows-x64";
128
128
  const platform = "win32";
129
129
 
130
130
  // #when getting binary path
131
131
  const result = getBinaryPath(pkg, platform);
132
132
 
133
133
  // #then returns path with .exe extension
134
- expect(result).toBe("openagent-labforge-windows-x64/bin/openagent-labforge.exe");
134
+ expect(result).toBe("openagent-labforge-windows-x64/bin/openagent-labforge.exe");
135
135
  });
136
136
 
137
137
  test("returns path without .exe for Linux", () => {
138
138
  // #given Linux platform package
139
- const pkg = "openagent-labforge-linux-x64";
139
+ const pkg = "openagent-labforge-linux-x64";
140
140
  const platform = "linux";
141
141
 
142
142
  // #when getting binary path
143
143
  const result = getBinaryPath(pkg, platform);
144
144
 
145
145
  // #then returns path without extension
146
- expect(result).toBe("openagent-labforge-linux-x64/bin/openagent-labforge");
146
+ expect(result).toBe("openagent-labforge-linux-x64/bin/openagent-labforge");
147
147
  });
148
148
  });
149
149
 
@@ -157,8 +157,8 @@ describe("getPlatformPackageCandidates", () => {
157
157
 
158
158
  // #then returns modern first then baseline fallback
159
159
  expect(result).toEqual([
160
- "openagent-labforge-linux-x64",
161
- "openagent-labforge-linux-x64-baseline",
160
+ "openagent-labforge-linux-x64",
161
+ "openagent-labforge-linux-x64-baseline",
162
162
  ]);
163
163
  });
164
164
 
@@ -171,8 +171,8 @@ describe("getPlatformPackageCandidates", () => {
171
171
 
172
172
  // #then returns musl modern first then musl baseline fallback
173
173
  expect(result).toEqual([
174
- "openagent-labforge-linux-x64-musl",
175
- "openagent-labforge-linux-x64-musl-baseline",
174
+ "openagent-labforge-linux-x64-musl",
175
+ "openagent-labforge-linux-x64-musl-baseline",
176
176
  ]);
177
177
  });
178
178
 
@@ -185,8 +185,8 @@ describe("getPlatformPackageCandidates", () => {
185
185
 
186
186
  // #then baseline package is preferred first
187
187
  expect(result).toEqual([
188
- "openagent-labforge-windows-x64-baseline",
189
- "openagent-labforge-windows-x64",
188
+ "openagent-labforge-windows-x64-baseline",
189
+ "openagent-labforge-windows-x64",
190
190
  ]);
191
191
  });
192
192
 
@@ -198,6 +198,6 @@ describe("getPlatformPackageCandidates", () => {
198
198
  const result = getPlatformPackageCandidates(input);
199
199
 
200
200
  // #then baseline fallback is not included
201
- expect(result).toEqual(["openagent-labforge-linux-arm64"]);
201
+ expect(result).toEqual(["openagent-labforge-linux-arm64"]);
202
202
  });
203
203
  });
package/dist/cli/index.js CHANGED
@@ -33030,7 +33030,7 @@ var {
33030
33030
  // package.json
33031
33031
  var package_default = {
33032
33032
  name: "@bohuyeshan/openagent-labforge-core",
33033
- version: "3.13.0",
33033
+ version: "3.13.2",
33034
33034
  description: "The Best AI Agent Harness - Batteries-Included OpenCode Plugin with Multi-Model Orchestration, Parallel Background Agents, and Crafted LSP/AST Tools",
33035
33035
  main: "./dist/index.js",
33036
33036
  types: "./dist/index.d.ts",
@@ -33122,7 +33122,7 @@ var package_default = {
33122
33122
  "openagent-labforge-linux-x64-baseline": "3.11.2",
33123
33123
  "openagent-labforge-linux-x64-musl": "3.11.2",
33124
33124
  "openagent-labforge-linux-x64-musl-baseline": "3.11.2",
33125
- "openagent-labforge-windows-x64": "3.13.0",
33125
+ "openagent-labforge-windows-x64": "3.13.2",
33126
33126
  "openagent-labforge-windows-x64-baseline": "3.11.2"
33127
33127
  },
33128
33128
  overrides: {
@@ -0,0 +1,8 @@
1
+ import type { PluginInput } from "@opencode-ai/plugin";
2
+ import type { AtlasHookOptions, SessionState } from "./types";
3
+ export declare function handleAtlasSessionIdle(input: {
4
+ ctx: PluginInput;
5
+ options?: AtlasHookOptions;
6
+ getState: (sessionID: string) => SessionState;
7
+ sessionID: string;
8
+ }): Promise<void>;
@@ -0,0 +1,11 @@
1
+ import type { PluginInput } from "@opencode-ai/plugin";
2
+ import type { BoulderState, PlanProgress } from "../../features/boulder-state";
3
+ export declare function resolveActiveBoulderSession(input: {
4
+ client: PluginInput["client"];
5
+ directory: string;
6
+ sessionID: string;
7
+ }): Promise<{
8
+ boulderState: BoulderState;
9
+ progress: PlanProgress;
10
+ appendedSession: boolean;
11
+ } | null>;
@@ -28,4 +28,7 @@ export interface SessionState {
28
28
  promptFailureCount: number;
29
29
  lastFailureAt?: number;
30
30
  pendingRetryTimer?: ReturnType<typeof setTimeout>;
31
+ waitingForFinalWaveApproval?: boolean;
32
+ pendingFinalWaveTaskCount?: number;
33
+ approvedFinalWaveTaskCount?: number;
31
34
  }