openwork-orchestrator 0.11.77

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/bin/openwork ADDED
@@ -0,0 +1,61 @@
1
+ #!/usr/bin/env node
2
+
3
+ const childProcess = require("child_process")
4
+ const os = require("os")
5
+ const path = require("path")
6
+
7
+ function run(target) {
8
+ const result = childProcess.spawnSync(target, process.argv.slice(2), {
9
+ stdio: "inherit",
10
+ })
11
+ if (result.error) {
12
+ console.error(result.error.message)
13
+ process.exit(1)
14
+ }
15
+ const code = typeof result.status === "number" ? result.status : 0
16
+ process.exit(code)
17
+ }
18
+
19
+ const envPath = process.env.OPENWORK_ORCHESTRATOR_BIN_PATH
20
+ if (envPath) {
21
+ run(envPath)
22
+ }
23
+
24
+ const platformMap = {
25
+ darwin: "darwin",
26
+ linux: "linux",
27
+ win32: "windows",
28
+ }
29
+
30
+ const archMap = {
31
+ x64: "x64",
32
+ arm64: "arm64",
33
+ arm: "arm",
34
+ }
35
+
36
+ let platform = platformMap[os.platform()]
37
+ if (!platform) {
38
+ platform = os.platform()
39
+ }
40
+
41
+ let arch = archMap[os.arch()]
42
+ if (!arch) {
43
+ arch = os.arch()
44
+ }
45
+
46
+ const pkg = `openwork-orchestrator-${platform}-${arch}`
47
+ const binary = platform === "windows" ? "openwork.exe" : "openwork"
48
+
49
+ let pkgJsonPath
50
+ try {
51
+ pkgJsonPath = require.resolve(`${pkg}/package.json`)
52
+ } catch {
53
+ console.error(
54
+ `openwork: no prebuilt binary package found for ${platform}/${arch}.\n` +
55
+ `Try installing the platform package manually: ${pkg}`,
56
+ )
57
+ process.exit(1)
58
+ }
59
+
60
+ const resolved = path.join(path.dirname(pkgJsonPath), "bin", binary)
61
+ run(resolved)
package/package.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "openwork-orchestrator",
3
+ "version": "0.11.77",
4
+ "description": "OpenWork host orchestrator for opencode + OpenWork server + opencode-router",
5
+ "license": "MIT",
6
+ "bin": {
7
+ "openwork": "./bin/openwork",
8
+ "openwork-orchestrator": "./bin/openwork"
9
+ },
10
+ "scripts": {
11
+ "postinstall": "bun ./postinstall.mjs || node ./postinstall.mjs"
12
+ },
13
+ "optionalDependencies": {
14
+ "openwork-orchestrator-darwin-arm64": "0.11.77",
15
+ "openwork-orchestrator-darwin-x64": "0.11.77",
16
+ "openwork-orchestrator-linux-x64": "0.11.77",
17
+ "openwork-orchestrator-linux-arm64": "0.11.77",
18
+ "openwork-orchestrator-windows-x64": "0.11.77"
19
+ },
20
+ "files": [
21
+ "bin",
22
+ "postinstall.mjs"
23
+ ]
24
+ }
@@ -0,0 +1,42 @@
1
+ #!/usr/bin/env node
2
+
3
+ import os from "os"
4
+ import { createRequire } from "module"
5
+
6
+ const require = createRequire(import.meta.url)
7
+
8
+ function detect() {
9
+ const platformMap = {
10
+ darwin: "darwin",
11
+ linux: "linux",
12
+ win32: "windows",
13
+ }
14
+ const archMap = {
15
+ x64: "x64",
16
+ arm64: "arm64",
17
+ arm: "arm",
18
+ }
19
+
20
+ const platform = platformMap[os.platform()] || os.platform()
21
+ const arch = archMap[os.arch()] || os.arch()
22
+ return { platform, arch }
23
+ }
24
+
25
+ function name() {
26
+ const { platform, arch } = detect()
27
+ return `openwork-orchestrator-${platform}-${arch}`
28
+ }
29
+
30
+ try {
31
+ const pkg = name()
32
+ require.resolve(`${pkg}/package.json`)
33
+ console.log(`openwork-orchestrator: verified platform package: ${pkg}`)
34
+ } catch (error) {
35
+ const pkg = name()
36
+ console.error(
37
+ `openwork-orchestrator: failed to locate platform binary package (${pkg}).\n` +
38
+ `Your package manager may have skipped optionalDependencies.\n` +
39
+ `Try installing it manually: npm i -g ${pkg}`,
40
+ )
41
+ process.exit(1)
42
+ }