alchemylab-opencode 1.0.15 → 1.0.17

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/dist/run.js CHANGED
@@ -15,7 +15,7 @@ import { homedir } from "node:os";
15
15
  import { join } from "node:path";
16
16
  var defaultDataDir = join(homedir(), ".alchemy_lab", "opencode");
17
17
  process.env.OPENCODE_DATA_DIR = process.env.OPENCODE_DATA_DIR || defaultDataDir;
18
- var { RunCommand } = await import("./run-YAMFO62Q.js");
18
+ var { RunCommand } = await import("./run-TP5VUB6L.js");
19
19
  var yargs = (await import("yargs")).default;
20
20
  var { hideBin } = await import("yargs/helpers");
21
21
  yargs(hideBin(process.argv)).command(RunCommand).strict().help().parse();
package/dist/serve.js CHANGED
@@ -11,8 +11,12 @@ if (typeof globalThis.__export === 'undefined') { globalThis.__export = (t, a) =
11
11
 
12
12
 
13
13
  // packages/opencode/src/serve.ts
14
+ import { Agent, setGlobalDispatcher } from "undici";
14
15
  import { homedir } from "node:os";
15
16
  import { join } from "node:path";
17
+ setGlobalDispatcher(new Agent({
18
+ connect: { keepAlive: true, keepAliveInitialDelay: 5e3 }
19
+ }));
16
20
  function arg(name, fallback) {
17
21
  const idx = process.argv.indexOf(`--${name}`);
18
22
  return idx !== -1 && process.argv[idx + 1] ? process.argv[idx + 1] : fallback;
@@ -20,7 +24,7 @@ function arg(name, fallback) {
20
24
  var defaultDataDir = join(homedir(), ".alchemy_lab", "opencode");
21
25
  var dataDir = arg("data-dir", defaultDataDir);
22
26
  process.env.OPENCODE_DATA_DIR = dataDir;
23
- var { Server } = await import("./server-TXXCB5OH.js");
27
+ var { Server } = await import("./server-GCGAYYDH.js");
24
28
  var port = parseInt(arg("port", "4096"), 10);
25
29
  var hostname = arg("hostname", "127.0.0.1");
26
30
  try {
package/dist/serve.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../packages/opencode/src/serve.ts"],
4
- "sourcesContent": ["/**\n * Minimal Node.js-compatible entry point for `opencode serve`.\n * Only imports the serve path \u2014 avoids TUI/CLI dependencies that require Bun.\n *\n * Usage:\n * node --experimental-strip-types --experimental-transform-types \\\n * --import ./src/node-preload.mjs \\\n * src/serve.ts --port 4096 [--hostname 127.0.0.1] [--data-dir /path/to/.alchemy_lab]\n */\n\nfunction arg(name: string, fallback: string): string {\n const idx = process.argv.indexOf(`--${name}`)\n return idx !== -1 && process.argv[idx + 1] ? process.argv[idx + 1] : fallback\n}\n\n// Set data directory before any module imports Global.Path\nimport { homedir } from 'node:os'\nimport { join } from 'node:path'\nconst defaultDataDir = join(homedir(), '.alchemy_lab', 'opencode')\nconst dataDir = arg('data-dir', defaultDataDir)\nprocess.env.OPENCODE_DATA_DIR = dataDir\n\n// Now safe to import the server\nconst { Server } = await import(\"./server/server\")\n\nconst port = parseInt(arg('port', '4096'), 10)\nconst hostname = arg('hostname', '127.0.0.1')\n\ntry {\n const server = await Server.listen({ port, hostname })\n console.log(`opencode server listening on http://${server.hostname}:${server.port}`)\n\n const shutdown = async () => {\n await server.stop(true)\n process.exit(0)\n }\n process.on('SIGINT', shutdown)\n process.on('SIGTERM', shutdown)\n\n // Keep process alive\n await new Promise(() => {})\n} catch (err) {\n console.error('Failed to start server:', err)\n process.exit(1)\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;AAgBA,SAAS,eAAe;AACxB,SAAS,YAAY;AAPrB,SAAS,IAAI,MAAc,UAA0B;AACnD,QAAM,MAAM,QAAQ,KAAK,QAAQ,KAAK,IAAI,EAAE;AAC5C,SAAO,QAAQ,MAAM,QAAQ,KAAK,MAAM,CAAC,IAAI,QAAQ,KAAK,MAAM,CAAC,IAAI;AACvE;AAKA,IAAM,iBAAiB,KAAK,QAAQ,GAAG,gBAAgB,UAAU;AACjE,IAAM,UAAU,IAAI,YAAY,cAAc;AAC9C,QAAQ,IAAI,oBAAoB;AAGhC,IAAM,EAAE,OAAO,IAAI,MAAM,OAAO,sBAAiB;AAEjD,IAAM,OAAO,SAAS,IAAI,QAAQ,MAAM,GAAG,EAAE;AAC7C,IAAM,WAAW,IAAI,YAAY,WAAW;AAE5C,IAAI;AACF,QAAM,SAAS,MAAM,OAAO,OAAO,EAAE,MAAM,SAAS,CAAC;AACrD,UAAQ,IAAI,uCAAuC,OAAO,QAAQ,IAAI,OAAO,IAAI,EAAE;AAEnF,QAAM,WAAW,YAAY;AAC3B,UAAM,OAAO,KAAK,IAAI;AACtB,YAAQ,KAAK,CAAC;AAAA,EAChB;AACA,UAAQ,GAAG,UAAU,QAAQ;AAC7B,UAAQ,GAAG,WAAW,QAAQ;AAG9B,QAAM,IAAI,QAAQ,MAAM;AAAA,EAAC,CAAC;AAC5B,SAAS,KAAK;AACZ,UAAQ,MAAM,2BAA2B,GAAG;AAC5C,UAAQ,KAAK,CAAC;AAChB;",
4
+ "sourcesContent": ["/**\n * Minimal Node.js-compatible entry point for `opencode serve`.\n * Only imports the serve path \u2014 avoids TUI/CLI dependencies that require Bun.\n *\n * Usage:\n * node --experimental-strip-types --experimental-transform-types \\\n * --import ./src/node-preload.mjs \\\n * src/serve.ts --port 4096 [--hostname 127.0.0.1] [--data-dir /path/to/.alchemy_lab]\n */\n\n// Enable TCP keepalive on every outgoing fetch so reasoning-model silences\n// don't let NAT / provider-edge / ISP equipment quietly drop the socket\n// (see req009613/req009614: 'agents stop writing' after 60-90s of think-phase silence).\n// Done in serve.ts (not just node-preload.mjs) because build.mjs bundles polyfills\n// from a banner string and never reads node-preload.mjs \u2014 dist/serve.js needs the\n// dispatcher inside the bundled source.\nimport { Agent, setGlobalDispatcher } from 'undici'\nsetGlobalDispatcher(new Agent({\n connect: { keepAlive: true, keepAliveInitialDelay: 5000 },\n}))\n\nfunction arg(name: string, fallback: string): string {\n const idx = process.argv.indexOf(`--${name}`)\n return idx !== -1 && process.argv[idx + 1] ? process.argv[idx + 1] : fallback\n}\n\n// Set data directory before any module imports Global.Path\nimport { homedir } from 'node:os'\nimport { join } from 'node:path'\nconst defaultDataDir = join(homedir(), '.alchemy_lab', 'opencode')\nconst dataDir = arg('data-dir', defaultDataDir)\nprocess.env.OPENCODE_DATA_DIR = dataDir\n\n// Now safe to import the server\nconst { Server } = await import(\"./server/server\")\n\nconst port = parseInt(arg('port', '4096'), 10)\nconst hostname = arg('hostname', '127.0.0.1')\n\ntry {\n const server = await Server.listen({ port, hostname })\n console.log(`opencode server listening on http://${server.hostname}:${server.port}`)\n\n const shutdown = async () => {\n await server.stop(true)\n process.exit(0)\n }\n process.on('SIGINT', shutdown)\n process.on('SIGTERM', shutdown)\n\n // Keep process alive\n await new Promise(() => {})\n} catch (err) {\n console.error('Failed to start server:', err)\n process.exit(1)\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;AAgBA,SAAS,OAAO,2BAA2B;AAW3C,SAAS,eAAe;AACxB,SAAS,YAAY;AAXrB,oBAAoB,IAAI,MAAM;AAAA,EAC5B,SAAS,EAAE,WAAW,MAAM,uBAAuB,IAAK;AAC1D,CAAC,CAAC;AAEF,SAAS,IAAI,MAAc,UAA0B;AACnD,QAAM,MAAM,QAAQ,KAAK,QAAQ,KAAK,IAAI,EAAE;AAC5C,SAAO,QAAQ,MAAM,QAAQ,KAAK,MAAM,CAAC,IAAI,QAAQ,KAAK,MAAM,CAAC,IAAI;AACvE;AAKA,IAAM,iBAAiB,KAAK,QAAQ,GAAG,gBAAgB,UAAU;AACjE,IAAM,UAAU,IAAI,YAAY,cAAc;AAC9C,QAAQ,IAAI,oBAAoB;AAGhC,IAAM,EAAE,OAAO,IAAI,MAAM,OAAO,sBAAiB;AAEjD,IAAM,OAAO,SAAS,IAAI,QAAQ,MAAM,GAAG,EAAE;AAC7C,IAAM,WAAW,IAAI,YAAY,WAAW;AAE5C,IAAI;AACF,QAAM,SAAS,MAAM,OAAO,OAAO,EAAE,MAAM,SAAS,CAAC;AACrD,UAAQ,IAAI,uCAAuC,OAAO,QAAQ,IAAI,OAAO,IAAI,EAAE;AAEnF,QAAM,WAAW,YAAY;AAC3B,UAAM,OAAO,KAAK,IAAI;AACtB,YAAQ,KAAK,CAAC;AAAA,EAChB;AACA,UAAQ,GAAG,UAAU,QAAQ;AAC7B,UAAQ,GAAG,WAAW,QAAQ;AAG9B,QAAM,IAAI,QAAQ,MAAM;AAAA,EAAC,CAAC;AAC5B,SAAS,KAAK;AACZ,UAAQ,MAAM,2BAA2B,GAAG;AAC5C,UAAQ,KAAK,CAAC;AAChB;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,29 @@
1
+ // Built by esbuild from opencode-server source
2
+ if (typeof globalThis.Bun === 'undefined') {
3
+ globalThis.Bun = {
4
+ version: '0.0.0-node-compat',
5
+ stdin: { async text() { const chunks = []; for await (const c of process.stdin) chunks.push(c); return Buffer.concat(chunks).toString(); } },
6
+ which(cmd) { try { return require('child_process').execFileSync('which', [cmd], { encoding: 'utf8' }).trim(); } catch { return null; } },
7
+ };
8
+ }
9
+ if (typeof globalThis.__name === 'undefined') { globalThis.__name = (t, n) => { Object.defineProperty(t, 'name', { value: n, configurable: true }); return t; }; }
10
+ if (typeof globalThis.__export === 'undefined') { globalThis.__export = (t, a) => { for (const k in a) Object.defineProperty(t, k, { get: a[k], enumerable: true }); }; }
11
+
12
+ import {
13
+ Server
14
+ } from "./chunk-UMPQHK6N.js";
15
+ import "./chunk-S53MTTCM.js";
16
+ import "./chunk-3AF5MXLF.js";
17
+ import "./chunk-PWFRMDDF.js";
18
+ import "./chunk-BKZE6GM3.js";
19
+ import "./chunk-GNXOGOVC.js";
20
+ import "./chunk-AAJTTZ2B.js";
21
+ import "./chunk-3PZZ2D23.js";
22
+ import "./chunk-CR6IREZA.js";
23
+ import "./chunk-BI5OUHTQ.js";
24
+ import "./chunk-VL3RSEZ2.js";
25
+ import "./chunk-HORZKFCR.js";
26
+ export {
27
+ Server
28
+ };
29
+ //# sourceMappingURL=server-GCGAYYDH.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -0,0 +1,23 @@
1
+ // Built by esbuild from opencode-server source
2
+ if (typeof globalThis.Bun === 'undefined') {
3
+ globalThis.Bun = {
4
+ version: '0.0.0-node-compat',
5
+ stdin: { async text() { const chunks = []; for await (const c of process.stdin) chunks.push(c); return Buffer.concat(chunks).toString(); } },
6
+ which(cmd) { try { return require('child_process').execFileSync('which', [cmd], { encoding: 'utf8' }).trim(); } catch { return null; } },
7
+ };
8
+ }
9
+ if (typeof globalThis.__name === 'undefined') { globalThis.__name = (t, n) => { Object.defineProperty(t, 'name', { value: n, configurable: true }); return t; }; }
10
+ if (typeof globalThis.__export === 'undefined') { globalThis.__export = (t, a) => { for (const k in a) Object.defineProperty(t, k, { get: a[k], enumerable: true }); }; }
11
+
12
+ import {
13
+ Session
14
+ } from "./chunk-GNXOGOVC.js";
15
+ import "./chunk-AAJTTZ2B.js";
16
+ import "./chunk-3PZZ2D23.js";
17
+ import "./chunk-CR6IREZA.js";
18
+ import "./chunk-BI5OUHTQ.js";
19
+ import "./chunk-HORZKFCR.js";
20
+ export {
21
+ Session
22
+ };
23
+ //# sourceMappingURL=session-7XE2BNL2.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -0,0 +1,24 @@
1
+ // Built by esbuild from opencode-server source
2
+ if (typeof globalThis.Bun === 'undefined') {
3
+ globalThis.Bun = {
4
+ version: '0.0.0-node-compat',
5
+ stdin: { async text() { const chunks = []; for await (const c of process.stdin) chunks.push(c); return Buffer.concat(chunks).toString(); } },
6
+ which(cmd) { try { return require('child_process').execFileSync('which', [cmd], { encoding: 'utf8' }).trim(); } catch { return null; } },
7
+ };
8
+ }
9
+ if (typeof globalThis.__name === 'undefined') { globalThis.__name = (t, n) => { Object.defineProperty(t, 'name', { value: n, configurable: true }); return t; }; }
10
+ if (typeof globalThis.__export === 'undefined') { globalThis.__export = (t, a) => { for (const k in a) Object.defineProperty(t, k, { get: a[k], enumerable: true }); }; }
11
+
12
+ import {
13
+ ShareNext
14
+ } from "./chunk-BKZE6GM3.js";
15
+ import "./chunk-GNXOGOVC.js";
16
+ import "./chunk-AAJTTZ2B.js";
17
+ import "./chunk-3PZZ2D23.js";
18
+ import "./chunk-CR6IREZA.js";
19
+ import "./chunk-BI5OUHTQ.js";
20
+ import "./chunk-HORZKFCR.js";
21
+ export {
22
+ ShareNext
23
+ };
24
+ //# sourceMappingURL=share-next-ZFOC4GLX.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -0,0 +1,63 @@
1
+ // Built by esbuild from opencode-server source
2
+ if (typeof globalThis.Bun === 'undefined') {
3
+ globalThis.Bun = {
4
+ version: '0.0.0-node-compat',
5
+ stdin: { async text() { const chunks = []; for await (const c of process.stdin) chunks.push(c); return Buffer.concat(chunks).toString(); } },
6
+ which(cmd) { try { return require('child_process').execFileSync('which', [cmd], { encoding: 'utf8' }).trim(); } catch { return null; } },
7
+ };
8
+ }
9
+ if (typeof globalThis.__name === 'undefined') { globalThis.__name = (t, n) => { Object.defineProperty(t, 'name', { value: n, configurable: true }); return t; }; }
10
+ if (typeof globalThis.__export === 'undefined') { globalThis.__export = (t, a) => { for (const k in a) Object.defineProperty(t, k, { get: a[k], enumerable: true }); }; }
11
+
12
+ import {
13
+ WorkspaceInfo,
14
+ Worktree
15
+ } from "./chunk-S53MTTCM.js";
16
+ import "./chunk-BKZE6GM3.js";
17
+ import "./chunk-GNXOGOVC.js";
18
+ import "./chunk-AAJTTZ2B.js";
19
+ import "./chunk-3PZZ2D23.js";
20
+ import "./chunk-CR6IREZA.js";
21
+ import "./chunk-BI5OUHTQ.js";
22
+ import "./chunk-HORZKFCR.js";
23
+
24
+ // packages/opencode/src/control-plane/adaptors/worktree.ts
25
+ var Config = WorkspaceInfo.extend({
26
+ name: WorkspaceInfo.shape.name.unwrap(),
27
+ branch: WorkspaceInfo.shape.branch.unwrap(),
28
+ directory: WorkspaceInfo.shape.directory.unwrap()
29
+ });
30
+ var WorktreeAdaptor = {
31
+ async configure(info) {
32
+ const worktree = await Worktree.makeWorktreeInfo(info.name ?? void 0);
33
+ return {
34
+ ...info,
35
+ name: worktree.name,
36
+ branch: worktree.branch,
37
+ directory: worktree.directory
38
+ };
39
+ },
40
+ async create(info) {
41
+ const config = Config.parse(info);
42
+ await Worktree.createFromInfo({
43
+ name: config.name,
44
+ directory: config.directory,
45
+ branch: config.branch
46
+ });
47
+ },
48
+ async remove(info) {
49
+ const config = Config.parse(info);
50
+ await Worktree.remove({ directory: config.directory });
51
+ },
52
+ target(info) {
53
+ const config = Config.parse(info);
54
+ return {
55
+ type: "local",
56
+ directory: config.directory
57
+ };
58
+ }
59
+ };
60
+ export {
61
+ WorktreeAdaptor
62
+ };
63
+ //# sourceMappingURL=worktree-BXX2GEIS.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../packages/opencode/src/control-plane/adaptors/worktree.ts"],
4
+ "sourcesContent": ["import z from \"zod\"\nimport { Worktree } from \"@/worktree\"\nimport { type Adaptor, WorkspaceInfo } from \"../types\"\n\nconst Config = WorkspaceInfo.extend({\n name: WorkspaceInfo.shape.name.unwrap(),\n branch: WorkspaceInfo.shape.branch.unwrap(),\n directory: WorkspaceInfo.shape.directory.unwrap(),\n})\n\ntype Config = z.infer<typeof Config>\n\nexport const WorktreeAdaptor: Adaptor = {\n async configure(info) {\n const worktree = await Worktree.makeWorktreeInfo(info.name ?? undefined)\n return {\n ...info,\n name: worktree.name,\n branch: worktree.branch,\n directory: worktree.directory,\n }\n },\n async create(info) {\n const config = Config.parse(info)\n await Worktree.createFromInfo({\n name: config.name,\n directory: config.directory,\n branch: config.branch,\n })\n },\n async remove(info) {\n const config = Config.parse(info)\n await Worktree.remove({ directory: config.directory })\n },\n target(info) {\n const config = Config.parse(info)\n return {\n type: \"local\",\n directory: config.directory,\n }\n },\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAIA,IAAM,SAAS,cAAc,OAAO;AAAA,EAClC,MAAM,cAAc,MAAM,KAAK,OAAO;AAAA,EACtC,QAAQ,cAAc,MAAM,OAAO,OAAO;AAAA,EAC1C,WAAW,cAAc,MAAM,UAAU,OAAO;AAClD,CAAC;AAIM,IAAM,kBAA2B;AAAA,EACtC,MAAM,UAAU,MAAM;AACpB,UAAM,WAAW,MAAM,SAAS,iBAAiB,KAAK,QAAQ,MAAS;AACvE,WAAO;AAAA,MACL,GAAG;AAAA,MACH,MAAM,SAAS;AAAA,MACf,QAAQ,SAAS;AAAA,MACjB,WAAW,SAAS;AAAA,IACtB;AAAA,EACF;AAAA,EACA,MAAM,OAAO,MAAM;AACjB,UAAM,SAAS,OAAO,MAAM,IAAI;AAChC,UAAM,SAAS,eAAe;AAAA,MAC5B,MAAM,OAAO;AAAA,MACb,WAAW,OAAO;AAAA,MAClB,QAAQ,OAAO;AAAA,IACjB,CAAC;AAAA,EACH;AAAA,EACA,MAAM,OAAO,MAAM;AACjB,UAAM,SAAS,OAAO,MAAM,IAAI;AAChC,UAAM,SAAS,OAAO,EAAE,WAAW,OAAO,UAAU,CAAC;AAAA,EACvD;AAAA,EACA,OAAO,MAAM;AACX,UAAM,SAAS,OAAO,MAAM,IAAI;AAChC,WAAO;AAAA,MACL,MAAM;AAAA,MACN,WAAW,OAAO;AAAA,IACpB;AAAA,EACF;AACF;",
6
+ "names": []
7
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "alchemylab-opencode",
3
- "version": "1.0.15",
3
+ "version": "1.0.17",
4
4
  "description": "OpenCode server runtime for AlchemyLab",
5
5
  "type": "module",
6
6
  "license": "MIT",