GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(openwrk): download sidecars on demand (#387) · bussard76/openwork@120c106

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • .opencode/skills/openwrk-npm-publish
    • SKILL.md
  • AGENTS.md
  • packages
    • headless
      • README.md
      • package.json
      • scripts
        • build-sidecars.mjs
        • clean-dist.mjs
      • src
        • cli.ts
    • owpenbot
      • package.json
    • server
      • package.json
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎.opencode/skills/openwrk-npm-publish/SKILL.md‎

Copy file name to clipboardExpand all lines: .opencode/skills/openwrk-npm-publish/SKILL.md
+13-2Lines changed: 13 additions & 2 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,23 @@ description: |
1414
1. Ensure you are on the default branch and the tree is clean.
1515
2. Bump the version in `packages/headless/package.json`.
1616
3. Commit the bump.
17-
4. Publish the package.
17+
4. Build sidecar artifacts and publish them to a release tag.
18+
19+
```bash
20+
pnpm --filter openwrk build:sidecars
21+
gh release create openwrk-vX.Y.Z packages/headless/dist/sidecars/* \
22+
--repo different-ai/openwork \
23+
--title "openwrk vX.Y.Z sidecars" \
24+
--notes "Sidecar binaries and manifest for openwrk vX.Y.Z"
25+
```
26+
27+
5. Publish the package.
1828

1929
```bash
2030
pnpm --filter openwrk publish --access public
2131
```
2232

23-
5. Verify the published version.
33+
6. Verify the published version.
2434

2535
```bash
2636
npm view openwrk version
@@ -52,3 +62,4 @@ Alternatively, export an npm token in your environment (see `.env.example`).
5262

5363
- `pnpm publish` requires a clean git tree.
5464
- This publish flow is separate from app release tags.
65+
- openwrk downloads sidecars from `openwrk-vX.Y.Z` release assets by default.
Collapse file

‎AGENTS.md‎

Copy file name to clipboardExpand all lines: AGENTS.md
+5-2Lines changed: 5 additions & 2 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,10 @@ This is separate from app release tags. Use `.opencode/skills/openwrk-npm-publis
147147
1. Ensure the default branch is up to date and clean.
148148
2. Bump `packages/headless/package.json` (`version`).
149149
3. Commit the bump.
150-
4. Publish:
150+
4. Build and upload sidecar assets for the same version tag:
151+
* `pnpm --filter openwrk build:sidecars`
152+
* `gh release create openwrk-vX.Y.Z packages/headless/dist/sidecars/* --repo different-ai/openwork`
153+
5. Publish:
151154
* `pnpm --filter openwrk publish --access public`
152-
5. Verify:
155+
6. Verify:
153156
* `npm view openwrk version`
Collapse file

‎packages/headless/README.md‎

Copy file name to clipboardExpand all lines: packages/headless/README.md
+6-3Lines changed: 6 additions & 3 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,12 @@ openwrk start --workspace /path/to/workspace --approval auto
1111

1212
`openwrk` ships as a compiled binary, so Bun is not required at runtime.
1313

14-
`openwrk` bundles and validates exact versions of `openwork-server` + `owpenbot` from the
15-
monorepo using a SHA-256 manifest. It will refuse to start if the bundled binaries are missing
16-
or tampered with.
14+
`openwrk` downloads and caches the `openwork-server`, `owpenbot`, and `opencode` sidecars on
15+
first run using a SHA-256 manifest. Use `--sidecar-dir` or `OPENWRK_SIDECAR_DIR` to control the
16+
cache location, and `--sidecar-base-url` / `--sidecar-manifest` to point at a custom host.
17+
18+
By default the manifest is fetched from
19+
`https://github.com/different-ai/openwork/releases/download/openwrk-v<openwrk-version>/openwrk-sidecars.json`.
1720

1821
Owpenbot is optional. If it exits, `openwrk` continues running unless you pass
1922
`--owpenbot-required` or set `OPENWRK_OWPENBOT_REQUIRED=1`.
Collapse file

‎packages/headless/package.json‎

Copy file name to clipboardExpand all lines: packages/headless/package.json
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,23 @@
33
"version": "0.1.11",
44
"description": "Headless OpenWork host orchestrator for OpenCode + OpenWork server + Owpenbot",
55
"type": "module",
6+
"opencodeVersion": "1.1.45",
67
"bin": {
78
"openwrk": "dist/openwrk"
89
},
910
"scripts": {
1011
"dev": "bun src/cli.ts",
1112
"build": "tsc -p tsconfig.json",
12-
"build:bin": "node ../desktop/scripts/prepare-sidecar.mjs --outdir dist && bun build --compile src/cli.ts --outfile dist/openwrk",
13+
"build:bin": "node scripts/clean-dist.mjs && bun build --compile src/cli.ts --outfile dist/openwrk",
14+
"build:bin:bundled": "node scripts/clean-dist.mjs && node ../desktop/scripts/prepare-sidecar.mjs --outdir dist && bun build --compile src/cli.ts --outfile dist/openwrk && bun scripts/build-bin.ts",
15+
"build:sidecars": "node scripts/build-sidecars.mjs",
1316
"typecheck": "tsc -p tsconfig.json --noEmit",
1417
"test:router": "pnpm build && node scripts/router.mjs",
1518
"prepublishOnly": "pnpm build:bin"
1619
},
1720
"files": [
1821
"dist",
19-
"README.md",
20-
"dist/openwork-server",
21-
"dist/owpenbot",
22-
"dist/versions.json"
22+
"README.md"
2323
],
2424
"repository": {
2525
"type": "git",
Collapse file

‎packages/headless/scripts/build-sidecars.mjs‎

Copy file name to clipboard
+96Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
import { spawnSync } from "node:child_process";
2+
import { createHash } from "node:crypto";
3+
import { copyFileSync, existsSync, mkdirSync, readFileSync, statSync, writeFileSync } from "node:fs";
4+
import { basename, join, resolve } from "node:path";
5+
import { fileURLToPath } from "node:url";
6+
7+
const root = resolve(fileURLToPath(new URL("..", import.meta.url)));
8+
const repoRoot = resolve(root, "..", "..");
9+
const outdir = resolve(root, "dist", "sidecars");
10+
11+
const openwrkPkg = JSON.parse(readFileSync(resolve(root, "package.json"), "utf8"));
12+
const openwrkVersion = String(openwrkPkg.version ?? "").trim();
13+
if (!openwrkVersion) {
14+
throw new Error("openwrk version missing in packages/headless/package.json");
15+
}
16+
17+
const serverPkg = JSON.parse(readFileSync(resolve(repoRoot, "packages", "server", "package.json"), "utf8"));
18+
const serverVersion = String(serverPkg.version ?? "").trim();
19+
if (!serverVersion) {
20+
throw new Error("openwork-server version missing in packages/server/package.json");
21+
}
22+
23+
const owpenbotPkg = JSON.parse(readFileSync(resolve(repoRoot, "packages", "owpenbot", "package.json"), "utf8"));
24+
const owpenbotVersion = String(owpenbotPkg.version ?? "").trim();
25+
if (!owpenbotVersion) {
26+
throw new Error("owpenbot version missing in packages/owpenbot/package.json");
27+
}
28+
29+
const run = (command, args, cwd) => {
30+
const result = spawnSync(command, args, { cwd, stdio: "inherit" });
31+
if (result.status !== 0) {
32+
process.exit(result.status ?? 1);
33+
}
34+
};
35+
36+
run("pnpm", ["--filter", "openwork-server", "build:bin:all"], repoRoot);
37+
run("pnpm", ["--filter", "owpenwork", "build:bin:all"], repoRoot);
38+
39+
const targets = [
40+
{ id: "darwin-arm64", bun: "bun-darwin-arm64" },
41+
{ id: "darwin-x64", bun: "bun-darwin-x64" },
42+
{ id: "linux-x64", bun: "bun-linux-x64" },
43+
{ id: "linux-arm64", bun: "bun-linux-arm64" },
44+
{ id: "windows-x64", bun: "bun-windows-x64" },
45+
];
46+
47+
const sha256File = (path) => {
48+
const data = readFileSync(path);
49+
return createHash("sha256").update(data).digest("hex");
50+
};
51+
52+
const serverDir = resolve(repoRoot, "packages", "server", "dist", "bin");
53+
const owpenbotDir = resolve(repoRoot, "packages", "owpenbot", "dist", "bin");
54+
55+
mkdirSync(outdir, { recursive: true });
56+
57+
const entries = {
58+
"openwork-server": { version: serverVersion, targets: {} },
59+
owpenbot: { version: owpenbotVersion, targets: {} },
60+
};
61+
62+
for (const target of targets) {
63+
const ext = target.id.startsWith("windows") ? ".exe" : "";
64+
const serverSrc = join(serverDir, `openwork-server-${target.bun}${ext}`);
65+
if (!existsSync(serverSrc)) {
66+
throw new Error(`Missing openwork-server binary at ${serverSrc}`);
67+
}
68+
const serverDest = join(outdir, `openwork-server-${target.id}${ext}`);
69+
copyFileSync(serverSrc, serverDest);
70+
71+
const owpenbotSrc = join(owpenbotDir, `owpenbot-${target.bun}${ext}`);
72+
if (!existsSync(owpenbotSrc)) {
73+
throw new Error(`Missing owpenbot binary at ${owpenbotSrc}`);
74+
}
75+
const owpenbotDest = join(outdir, `owpenbot-${target.id}${ext}`);
76+
copyFileSync(owpenbotSrc, owpenbotDest);
77+
78+
entries["openwork-server"].targets[target.id] = {
79+
asset: basename(serverDest),
80+
sha256: sha256File(serverDest),
81+
size: statSync(serverDest).size,
82+
};
83+
entries.owpenbot.targets[target.id] = {
84+
asset: basename(owpenbotDest),
85+
sha256: sha256File(owpenbotDest),
86+
size: statSync(owpenbotDest).size,
87+
};
88+
}
89+
90+
const manifest = {
91+
version: openwrkVersion,
92+
generatedAt: new Date().toISOString(),
93+
entries,
94+
};
95+
96+
writeFileSync(join(outdir, "openwrk-sidecars.json"), `${JSON.stringify(manifest, null, 2)}\n`, "utf8");
Collapse file

‎packages/headless/scripts/clean-dist.mjs‎

Copy file name to clipboard
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { rm } from "node:fs/promises";
2+
import { resolve } from "node:path";
3+
import { fileURLToPath } from "node:url";
4+
5+
const root = resolve(fileURLToPath(new URL("..", import.meta.url)));
6+
await rm(resolve(root, "dist"), { recursive: true, force: true });

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.