alchemylab-opencode 1.0.26 → 2.0.1

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.
Files changed (123) hide show
  1. package/NODE_COMPAT.md +23 -174
  2. package/dist/20260127222353_familiar_lady_ursula-KV747FJX.js +14 -0
  3. package/dist/{chunk-LTCXIXYM.js → 20260211171708_add_project_commands-GDOHPDPF.js} +3 -1
  4. package/dist/20260213144116_wakeful_the_professor-ZVDD54AK.js +14 -0
  5. package/dist/20260225215848_workspace-ZMSOZSPA.js +14 -0
  6. package/dist/20260227213759_add_session_workspace_id-ROENWPKA.js +14 -0
  7. package/dist/20260228203230_blue_harpoon-IW3Z4TQZ.js +14 -0
  8. package/dist/20260303231226_add_workspace_fields-OUVZMNAG.js +14 -0
  9. package/dist/20260309230000_move_org_to_state-NOXAPU5V.js +14 -0
  10. package/dist/20260312043431_session_message_cursor-DJ4T3T4R.js +14 -0
  11. package/dist/20260323234822_events-72GIKJ2A.js +14 -0
  12. package/dist/20260410174513_workspace-name-JXSWFBJN.js +14 -0
  13. package/dist/20260413175956_chief_energizer-4HEWZ6U3.js +14 -0
  14. package/dist/20260423070820_add_icon_url_override-X5SHFGTI.js +14 -0
  15. package/dist/20260427172553_slow_nightmare-PS5T2AH2.js +14 -0
  16. package/dist/{chunk-PWFRMDDF.js → 20260428004200_add_session_path-LGW75WYA.js} +3 -0
  17. package/dist/{valibot--1zFm7rT-FSYJNYJ6.js → 20260501142318_next_venus-J3TLVXZ6.js} +3 -1
  18. package/dist/20260504145000_add_sync_owner-3R52GB4C.js +14 -0
  19. package/dist/20260507164347_add_workspace_time-JHDRCZAR.js +14 -0
  20. package/dist/20260510033149_session_usage-UGBVOXZB.js +53 -0
  21. package/dist/20260511000411_data_migration_state-FB4LBFSE.js +14 -0
  22. package/dist/20260511173437_session-metadata-T2XHGWHS.js +14 -0
  23. package/dist/20260601010001_normalize_storage_paths-5MAY5GT3.js +14 -0
  24. package/dist/{chunk-YRY5Y3QL.js → 20260601202201_amazing_prowler-PET224YG.js} +3 -1
  25. package/dist/20260602002951_lowly_union_jack-PG6XDMGL.js +14 -0
  26. package/dist/20260602182828_add_project_directories-ZCH2ACGG.js +14 -0
  27. package/dist/20260603001617_session_message_projection_indexes-XVLJTUF2.js +14 -0
  28. package/dist/20260603040000_session_message_projection_order-XG6RACZQ.js +14 -0
  29. package/dist/20260603141458_session_input_inbox-K2VQ7V6E.js +14 -0
  30. package/dist/20260603160727_jittery_ezekiel_stane-WKJLRDO7.js +14 -0
  31. package/dist/20260604172448_event_sourced_session_input-NTXOECR7.js +14 -0
  32. package/dist/20260605003541_add_session_context_snapshot-DXMQEXMT.js +14 -0
  33. package/dist/{zod-Bwrt9trS-HVDOFWRP.js → 20260605042240_add_context_epoch_agent-W6IQYZXE.js} +3 -1
  34. package/dist/20260611035744_credential-XTMSYTJD.js +14 -0
  35. package/dist/20260611192811_lush_chimera-XPLIQMJD.js +14 -0
  36. package/dist/20260612174303_project_dir_strategy-FR2NGQKK.js +14 -0
  37. package/dist/20260622142730_simplify_session_context_epoch-NTQZR3RE.js +14 -0
  38. package/dist/20260622170816_reset_v2_session_state-5JPHJTZG.js +14 -0
  39. package/dist/20260622202450_simplify_session_input-2EXF2HMV.js +14 -0
  40. package/dist/app-runtime-HQBOCDV5.js +14 -0
  41. package/dist/chunk-4FEBIOI5.js +865 -0
  42. package/dist/chunk-4K2RXRZL.js +14 -0
  43. package/dist/chunk-4RFMKEKM.js +1455 -0
  44. package/dist/chunk-BM2C7NHL.js +41 -0
  45. package/dist/chunk-MKEMZFJI.js +393 -0
  46. package/dist/chunk-OMDJ6ZZ2.js +684 -0
  47. package/dist/chunk-OWMG4NNF.js +186 -0
  48. package/dist/chunk-QRABYJKL.js +14 -0
  49. package/dist/chunk-RHIWAYN5.js +14 -0
  50. package/dist/{arktype-aI7TBD0R-TFNARRIP.js → chunk-VURLSDCB.js} +3 -1
  51. package/dist/chunk-Z5TLIUAI.js +28 -0
  52. package/dist/code-mode-7BQJUARW.js +40 -0
  53. package/dist/copilot-provider-TX4YFKJZ.js +14 -0
  54. package/dist/photon-VQS5F5BI.js +14 -0
  55. package/dist/pty.node-Y3N2XKYG.js +14 -0
  56. package/dist/run.js +3 -1
  57. package/dist/serve.js +3 -1
  58. package/dist/server-BFUQR7MX.js +17 -0
  59. package/dist/session-6RNXZNG6.js +14 -0
  60. package/dist/{chunk-2ANK3QEN.js → worktree-QHQHX3SG.js} +3 -1
  61. package/package.json +83 -50
  62. package/patches/@ai-sdk%2Famazon-bedrock@4.0.166.patch +164 -0
  63. package/patches/@ai-sdk%2Fanthropic@3.0.111.patch +528 -0
  64. package/patches/@ai-sdk%2Fgoogle@3.0.73.patch +69 -0
  65. package/patches/@ai-sdk%2Fgroq@3.0.31.patch +79 -0
  66. package/patches/@ai-sdk%2Fmistral@3.0.51.patch +714 -0
  67. package/patches/@ai-sdk%2Fopenai-compatible@2.0.41.patch +39 -0
  68. package/patches/@ai-sdk%2Fopenai@3.0.88.patch +280 -0
  69. package/patches/@ai-sdk%2Fxai@3.0.139.patch +296 -0
  70. package/patches/@modelcontextprotocol%2Fsdk@1.29.0.patch +647 -0
  71. package/patches/@npmcli%2Fagent@4.0.2.patch +13 -0
  72. package/patches/@silvia-odwyer%2Fphoton-node@0.3.4.patch +285 -0
  73. package/patches/effect@4.0.0-beta.83.patch +57 -0
  74. package/patches/gcp-metadata@8.1.2.patch +14 -0
  75. package/patches/pacote@21.5.0.patch +18 -0
  76. package/postinstall.cjs +146 -0
  77. package/dist/chunk-5P5WLADX.js +0 -18
  78. package/dist/chunk-7KKA6WBY.js +0 -12
  79. package/dist/chunk-A7EXZZPC.js +0 -12
  80. package/dist/chunk-CZVKIDQZ.js +0 -12
  81. package/dist/chunk-FXLFZ5DL.js +0 -12
  82. package/dist/chunk-G752V4OP.js +0 -2187
  83. package/dist/chunk-GBXMNWYD.js +0 -18
  84. package/dist/chunk-IR6PDN4W.js +0 -13
  85. package/dist/chunk-M4CB72HE.js +0 -13
  86. package/dist/chunk-MBZTOEAD.js +0 -12
  87. package/dist/default-u_dwuiYb-652AQZKX.js +0 -12
  88. package/dist/effect-QlVUlMFu-JVYEXAZL.js +0 -12
  89. package/dist/log-MVJ7H4K5.js +0 -12
  90. package/dist/pty.node-X2EITEZ4.js +0 -12
  91. package/dist/registry-ISXIFNPG.js +0 -12
  92. package/dist/run-AUCA7EKA.js +0 -20
  93. package/dist/run-service-MT3LOWLS.js +0 -12
  94. package/dist/schema-YWIVP7UR.js +0 -12
  95. package/dist/server-PIYRZLBG.js +0 -12
  96. package/dist/session-ACBIJ2VE.js +0 -12
  97. package/dist/share-next-MPGA7EO4.js +0 -12
  98. package/dist/sury-CWZTCd75-3YHH6KVI.js +0 -12
  99. package/dist/typebox-Dei93FPO-GLI7OCTY.js +0 -12
  100. package/dist/valibot-D_HTw1Gn-E5NKVIOV.js +0 -12
  101. package/dist/worktree-E4DGSBLJ.js +0 -12
  102. package/dist/zod-DSgpEGAE-DSH6V7MG.js +0 -12
  103. package/packages/opencode/migration/20260127222353_familiar_lady_ursula/migration.sql +0 -90
  104. package/packages/opencode/migration/20260127222353_familiar_lady_ursula/snapshot.json +0 -796
  105. package/packages/opencode/migration/20260211171708_add_project_commands/migration.sql +0 -1
  106. package/packages/opencode/migration/20260211171708_add_project_commands/snapshot.json +0 -806
  107. package/packages/opencode/migration/20260213144116_wakeful_the_professor/migration.sql +0 -11
  108. package/packages/opencode/migration/20260213144116_wakeful_the_professor/snapshot.json +0 -897
  109. package/packages/opencode/migration/20260225215848_workspace/migration.sql +0 -7
  110. package/packages/opencode/migration/20260225215848_workspace/snapshot.json +0 -959
  111. package/packages/opencode/migration/20260227213759_add_session_workspace_id/migration.sql +0 -2
  112. package/packages/opencode/migration/20260227213759_add_session_workspace_id/snapshot.json +0 -983
  113. package/packages/opencode/migration/20260228203230_blue_harpoon/migration.sql +0 -17
  114. package/packages/opencode/migration/20260228203230_blue_harpoon/snapshot.json +0 -1102
  115. package/packages/opencode/migration/20260303231226_add_workspace_fields/migration.sql +0 -5
  116. package/packages/opencode/migration/20260303231226_add_workspace_fields/snapshot.json +0 -1013
  117. package/packages/opencode/migration/20260309230000_move_org_to_state/migration.sql +0 -3
  118. package/packages/opencode/migration/20260309230000_move_org_to_state/snapshot.json +0 -1156
  119. package/packages/opencode/migration/20260312043431_session_message_cursor/migration.sql +0 -4
  120. package/packages/opencode/migration/20260312043431_session_message_cursor/snapshot.json +0 -1168
  121. package/packages/opencode/migration/20260323234822_events/migration.sql +0 -13
  122. package/packages/opencode/migration/20260323234822_events/snapshot.json +0 -1271
  123. package/packages/opencode/migration/20260409000000_add_session_metadata/migration.sql +0 -1
package/NODE_COMPAT.md CHANGED
@@ -1,185 +1,34 @@
1
- # OpenCode Node.js Compatibility
1
+ # OpenCode on Node.js (alchemylab-opencode)
2
2
 
3
- OpenCode serve mode has been patched to run on Node.js (22.16+ for the bundle, 24+ for the source) without Bun.
4
- This document describes what was changed, why, and how to run it.
3
+ The fork is upstream OpenCode 1.18.35 with AlchemyLab's patches, published as an
4
+ esbuild bundle in `dist/` that runs on Node 22.16+ or 24+. Upstream builds for Node
5
+ itself since 1.18 (`#sqlite`, `#pty` and `#fff` have "node" conditions in
6
+ packages/core), so no Node-compat patches of upstream files remain.
5
7
 
6
- ## Quick Start
8
+ ## Running
7
9
 
8
10
  ```bash
9
- # Running the source needs Node.js 24+ (the published bundle runs on 22.16+)
10
- node --experimental-strip-types --experimental-transform-types \
11
- --import ./packages/opencode/src/node-preload.mjs \
12
- packages/opencode/src/serve.ts --port 4096
13
-
14
- # With per-project data isolation (recommended for alchemylab)
15
- node --experimental-strip-types --experimental-transform-types \
16
- --import ./packages/opencode/src/node-preload.mjs \
17
- packages/opencode/src/serve.ts --port 4096 --data-dir /path/to/project/.alchemy_lab/opencode
11
+ node dist/serve.js --port 4096 --data-dir /path/to/project/.alchemy_lab/opencode [--log-level WARN]
12
+ node dist/run.js run --attach http://127.0.0.1:4096 --session ses_... --agent build "prompt"
18
13
  ```
19
14
 
20
- ## Per-Project Data Isolation
21
-
22
- By default, OpenCode stores data in `~/.local/share/opencode/`. The `--data-dir` flag
23
- (or `OPENCODE_DATA_DIR` env var) redirects project-specific data to a custom directory:
24
-
25
- | Path | Default | With `--data-dir` |
26
- |------|---------|-------------------|
27
- | Database | `~/.local/share/opencode/opencode.db` | `<data-dir>/opencode.db` |
28
- | Auth | `~/.local/share/opencode/auth.json` | `<data-dir>/auth.json` |
29
- | Plans | `~/.local/share/opencode/plans/` | `<data-dir>/plans/` |
30
- | State/locks | `~/.local/state/opencode/` | `<data-dir>/state/` |
31
- | Logs | `~/.local/share/opencode/log/` | `<data-dir>/log/` |
32
- | Config | `~/.config/opencode/` | `~/.config/opencode/` (unchanged) |
33
- | Bin cache | `~/.cache/opencode/bin/` | `~/.cache/opencode/bin/` (unchanged) |
34
-
35
- Config and bin cache stay global so user preferences and downloaded tools are shared.
36
-
37
- ## Which Node
38
-
39
- | Node Version | Status | Why |
40
- |--------------|--------|-----|
41
- | 20 | no | no `node:sqlite` |
42
- | 22.0 to 22.15 | no | drizzle's node-sqlite driver calls `StatementSync.setReturnArrays`, added in 22.16 |
43
- | 22.16+ | yes | the published bundle (`dist/`) runs as is |
44
- | 23 | no | V8 crash in async ESM evaluation; end of life |
45
- | 24+ | yes | also runs the TypeScript source directly (Quick Start above) |
46
-
47
- The published package is an esbuild bundle, so running it needs no TypeScript
48
- stripping and no `tsx` (whose `__name` helper broke Effect on 22). Running the
49
- source directly, as in Quick Start, still needs Node 24's `--experimental-strip-types`.
50
-
51
- ## Architecture
52
-
53
- ### Entry Point
54
-
55
- `src/serve.ts` — A minimal entry point that only imports the server path.
56
- The main `src/index.ts` eagerly imports TUI/CLI code that depends on Bun-specific
57
- packages (`bun`, `bun-pty`, `bun:ffi`). The serve entry point sidesteps all of that.
58
-
59
- ### Node Preload (`src/node-preload.mjs`)
60
-
61
- Loaded via `--import` before any application code. Does two things:
62
-
63
- 1. **Polyfills `globalThis.__name`** — Bun provides this globally (esbuild `--keep-names`
64
- helper). The Effect framework and other dependencies rely on it.
65
- 2. **Registers the custom ESM loader** via `node:module` `register()`.
66
-
67
- ### Node Loader (`src/node-loader.mjs`)
68
-
69
- Custom ESM resolve + load hooks that bridge Bun/Node differences:
70
-
71
- - **Extensionless imports** → tries `.ts`, `.tsx`, `/index.ts`, `/index.tsx`
72
- - **`.txt` file imports** → reads file and exports as default string (Bun supports this natively)
73
- - **`bun:sqlite`** → redirected to `node:sqlite`
74
- - **`bun:ffi`** → stubbed (only used for Windows TUI, not serve)
75
- - **`bun` / `bun-pty`** → stubbed (only used for TUI/CLI)
76
- - **`.js` → `.ts` remapping** → for workspace packages where imports use `.js` but source is `.ts`
77
- - **`@/` and `@tui/` path aliases** → resolved to `src/` and `src/cli/cmd/tui/`
78
-
79
- ## Files Changed
80
-
81
- ### HTTP Server (`src/server/server.ts`)
82
- - **Already done in dev branch**: Uses `@hono/node-server` with `createAdaptorServer`
83
- - No Bun-specific code remains
84
-
85
- ### WebSocket Proxy (`src/server/proxy.ts`)
86
- - **Before**: `import { upgradeWebSocket } from "hono/bun"`
87
- - **After**: `import { createNodeWebSocket } from "@hono/node-ws"`
88
-
89
- ### Static File Serving (`src/server/instance.ts`)
90
- - **Before**: `Bun.file(match)` for embedded web UI
91
- - **After**: `fs.readFileSync(match)` with manual MIME type lookup
92
-
93
- ### Prompt Async Route (`src/server/routes/session.ts`)
94
- - **Before**: `c.status(204)` + `stream()` — Node's `Response` rejects 204 with body
95
- - **After**: `c.status(202)` — semantically correct for "accepted for processing"
96
-
97
- ### Database (`src/storage/db.ts`)
98
- - **Before**: `import { type SQLiteBunDatabase } from "drizzle-orm/bun-sqlite"` and
99
- `import { migrate } from "drizzle-orm/bun-sqlite/migrator"`
100
- - **After**: Uses `drizzle-orm/node-sqlite` equivalents
101
- - **Migration**: `bun-sqlite` migrator accepts raw journal entries; `node-sqlite` migrator
102
- requires `{ migrationsFolder }` config. Dev mode now passes the folder path.
103
-
104
- ### Database Conditional Import (`package.json`)
105
- - **Before**: `"#db": { "default": "./src/storage/db.bun.ts" }`
106
- - **After**: `"#db": { "default": "./src/storage/db.node.ts" }`
107
-
108
- ### File Watcher (`src/file/watcher.ts`)
109
- - **Before**: `require("@parcel/watcher-...")` — `require` doesn't exist in ESM
110
- - **After**: `import { createRequire } from "node:module"` then `createRequire(import.meta.url)`
111
-
112
- ### OAuth Servers
113
- Both `src/mcp/oauth-callback.ts` and `src/plugin/codex.ts`:
114
- - **Before**: `Bun.serve({ port, fetch() {} })`
115
- - **After**: `http.createServer()` with manual Request/Response bridging
116
-
117
- ### Lazy Imports (`src/index.ts`)
118
- These modules use `bun:sqlite` directly and would crash on import:
119
- - `JsonMigration` — now lazy: `import("./storage/json-migration").catch(() => null)`
120
- - `DbCommand` — now lazy, removed from yargs command registration
121
-
122
- ## Dependencies Added
123
-
124
- - `@hono/node-ws` — Node.js WebSocket adapter for Hono (already had `@hono/node-server`)
125
-
126
- ## Session Identity via _meta (Core Fix)
127
-
128
- Upstream OpenCode's `callTool` does not pass `_meta` on MCP tool calls. This means MCP
129
- servers cannot know which session a tool call belongs to — a critical problem when MCP
130
- processes are shared across sessions (which OpenCode does for efficiency).
131
-
132
- ### The Fix
133
-
134
- - `src/mcp/index.ts`: Added `MCP.currentToolContext` (thread-local context) and modified
135
- `convertMcpTool()` to include `_meta: { sessionId, messageId }` in every `callTool` request.
136
- - `src/session/prompt.ts`: Sets `MCP.currentToolContext` from the session's tool execution
137
- context before each MCP tool call.
138
-
139
- ### Result
140
-
141
- Every MCP tool call now carries `_meta.sessionId` and `_meta.messageId`. The alchemy MCP
142
- server uses these directly (via `request.params._meta.sessionId`) instead of expensive HTTP
143
- discovery. This eliminates session identity races when MCP processes are shared across
144
- concurrent sessions.
145
-
146
- ### Verified
147
-
148
- ```
149
- [11:58:36] read_files | _meta-debug {
150
- "has_meta": true,
151
- "sessionId": "ses_2986f17c8ffefuXAJN3qDIHzND",
152
- "messageId": "msg_d67cf04da001EdSMwdFednSJES"
153
- }
154
- ```
155
-
156
- ## Known Limitations
157
-
158
- 1. **Plugin CJS loading** — Alchemy plugins compiled as CJS fail with "not a function"
159
- under Node's ESM import. The IIFE wrapper in `MCPClientConfigurer.ts` handles this
160
- for Bun/OpenCode; same approach needed for Node.
161
-
162
- 2. **`opencode db` CLI command** — Not available (uses `bun:sqlite` directly). Only
163
- affects database admin tasks, not serve mode.
15
+ ## Data directory (`--data-dir`, `OPENCODE_DATA_DIR`)
164
16
 
165
- 3. **JSON migration** — Skipped on Node.js (migrates legacy JSON storage to SQLite).
166
- Only relevant for users upgrading from very old opencode versions.
17
+ Database, state and logs go to the data directory; config and cache stay user-global,
18
+ and so do auth.json and mcp-auth.json (Global.Path.globalData). The database is
19
+ `opencode.db`, or an existing `opencode-local.db` from before 1.18 (serve.ts).
167
20
 
168
- 4. **ExperimentalWarning** — Node 24 prints warnings for `strip-types`, `transform-types`,
169
- and `SQLite`. These are harmless and can be suppressed with `--no-warnings`.
21
+ ## Build (`node build.mjs`)
170
22
 
171
- ## Tested Endpoints
23
+ - The workspace packages (`packages/*`, linked into node_modules/@opencode-ai by
24
+ postinstall.cjs) are bundled through their own package.json exports and imports,
25
+ with the "node" condition. Other dependencies stay external.
26
+ - Bun's `with { type: "text" }` and `with { type: "file" }` imports are handled by a
27
+ plugin; `require` is defined in every chunk; `bun:*` imports are stubbed.
28
+ - OPENCODE_VERSION and OPENCODE_CHANNEL are defined (packages/opencode/package.json's
29
+ version, channel "latest").
172
30
 
173
- All passing on Node.js 24.14.1:
31
+ ## Dependency patches
174
32
 
175
- - `GET /session` — list sessions
176
- - `POST /session` — create session
177
- - `GET /session/:id` — get session
178
- - `DELETE /session/:id` — delete session
179
- - `POST /session/:id/prompt_async` — send async prompt
180
- - `GET /session/:id/message` — get messages
181
- - `GET /event` — SSE event stream
182
- - `GET /global/health` — health check
183
- - `GET /config/providers` — provider configuration
184
- - `GET /auth/:provider` — auth status
185
- - `GET /doc` — OpenAPI specification
33
+ Upstream patches some dependencies through bun's patchedDependencies. The ones the
34
+ server uses are in `patches/` and postinstall.cjs applies them after npm install.
@@ -0,0 +1,14 @@
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
+ import { createRequire as __alchemyCreateRequire } from 'node:module';
12
+ const require = __alchemyCreateRequire(import.meta.url);
13
+
14
+ import"./chunk-RHIWAYN5.js";import{Effect as i}from"effect";var s={id:"20260127222353_familiar_lady_ursula",up(e){return i.gen(function*(){yield*e.run("\n CREATE TABLE `project` (\n `id` text PRIMARY KEY,\n `worktree` text NOT NULL,\n `vcs` text,\n `name` text,\n `icon_url` text,\n `icon_color` text,\n `time_created` integer NOT NULL,\n `time_updated` integer NOT NULL,\n `time_initialized` integer,\n `sandboxes` text NOT NULL\n );\n "),yield*e.run("\n CREATE TABLE `message` (\n `id` text PRIMARY KEY,\n `session_id` text NOT NULL,\n `time_created` integer NOT NULL,\n `time_updated` integer NOT NULL,\n `data` text NOT NULL,\n CONSTRAINT `fk_message_session_id_session_id_fk` FOREIGN KEY (`session_id`) REFERENCES `session`(`id`) ON DELETE CASCADE\n );\n "),yield*e.run("\n CREATE TABLE `part` (\n `id` text PRIMARY KEY,\n `message_id` text NOT NULL,\n `session_id` text NOT NULL,\n `time_created` integer NOT NULL,\n `time_updated` integer NOT NULL,\n `data` text NOT NULL,\n CONSTRAINT `fk_part_message_id_message_id_fk` FOREIGN KEY (`message_id`) REFERENCES `message`(`id`) ON DELETE CASCADE\n );\n "),yield*e.run("\n CREATE TABLE `permission` (\n `project_id` text PRIMARY KEY,\n `time_created` integer NOT NULL,\n `time_updated` integer NOT NULL,\n `data` text NOT NULL,\n CONSTRAINT `fk_permission_project_id_project_id_fk` FOREIGN KEY (`project_id`) REFERENCES `project`(`id`) ON DELETE CASCADE\n );\n "),yield*e.run("\n CREATE TABLE `session` (\n `id` text PRIMARY KEY,\n `project_id` text NOT NULL,\n `parent_id` text,\n `slug` text NOT NULL,\n `directory` text NOT NULL,\n `title` text NOT NULL,\n `version` text NOT NULL,\n `share_url` text,\n `summary_additions` integer,\n `summary_deletions` integer,\n `summary_files` integer,\n `summary_diffs` text,\n `revert` text,\n `permission` text,\n `time_created` integer NOT NULL,\n `time_updated` integer NOT NULL,\n `time_compacting` integer,\n `time_archived` integer,\n CONSTRAINT `fk_session_project_id_project_id_fk` FOREIGN KEY (`project_id`) REFERENCES `project`(`id`) ON DELETE CASCADE\n );\n "),yield*e.run("\n CREATE TABLE `todo` (\n `session_id` text NOT NULL,\n `content` text NOT NULL,\n `status` text NOT NULL,\n `priority` text NOT NULL,\n `position` integer NOT NULL,\n `time_created` integer NOT NULL,\n `time_updated` integer NOT NULL,\n CONSTRAINT `todo_pk` PRIMARY KEY(`session_id`, `position`),\n CONSTRAINT `fk_todo_session_id_session_id_fk` FOREIGN KEY (`session_id`) REFERENCES `session`(`id`) ON DELETE CASCADE\n );\n "),yield*e.run("\n CREATE TABLE `session_share` (\n `session_id` text PRIMARY KEY,\n `id` text NOT NULL,\n `secret` text NOT NULL,\n `url` text NOT NULL,\n `time_created` integer NOT NULL,\n `time_updated` integer NOT NULL,\n CONSTRAINT `fk_session_share_session_id_session_id_fk` FOREIGN KEY (`session_id`) REFERENCES `session`(`id`) ON DELETE CASCADE\n );\n "),yield*e.run("CREATE INDEX `message_session_idx` ON `message` (`session_id`);"),yield*e.run("CREATE INDEX `part_message_idx` ON `part` (`message_id`);"),yield*e.run("CREATE INDEX `part_session_idx` ON `part` (`session_id`);"),yield*e.run("CREATE INDEX `session_project_idx` ON `session` (`project_id`);"),yield*e.run("CREATE INDEX `session_parent_idx` ON `session` (`parent_id`);"),yield*e.run("CREATE INDEX `todo_session_idx` ON `todo` (`session_id`);")})}};export{s as default};
@@ -8,5 +8,7 @@ if (typeof globalThis.Bun === 'undefined') {
8
8
  }
9
9
  if (typeof globalThis.__name === 'undefined') { globalThis.__name = (t, n) => { Object.defineProperty(t, 'name', { value: n, configurable: true }); return t; }; }
10
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
+ import { createRequire as __alchemyCreateRequire } from 'node:module';
12
+ const require = __alchemyCreateRequire(import.meta.url);
11
13
 
12
- import{a}from"./chunk-MBZTOEAD.js";var c=a(t=>e=>Object.assign(e,t(e)),"withStatics");function S(){return(t,e)=>{class n{static{a(this,"Base")}static makeUnsafe(r){return r}}return Object.setPrototypeOf(n,e),n}}a(S,"Newtype");export{c as a,S as b};
14
+ import"./chunk-RHIWAYN5.js";import{Effect as a}from"effect";var o={id:"20260211171708_add_project_commands",up(t){return a.gen(function*(){yield*t.run("ALTER TABLE `project` ADD `commands` text;")})}};export{o as default};
@@ -0,0 +1,14 @@
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
+ import { createRequire as __alchemyCreateRequire } from 'node:module';
12
+ const require = __alchemyCreateRequire(import.meta.url);
13
+
14
+ import"./chunk-RHIWAYN5.js";import{Effect as t}from"effect";var i={id:"20260213144116_wakeful_the_professor",up(e){return t.gen(function*(){yield*e.run("\n CREATE TABLE `control_account` (\n `email` text NOT NULL,\n `url` text NOT NULL,\n `access_token` text NOT NULL,\n `refresh_token` text NOT NULL,\n `token_expiry` integer,\n `active` integer NOT NULL,\n `time_created` integer NOT NULL,\n `time_updated` integer NOT NULL,\n CONSTRAINT `control_account_pk` PRIMARY KEY(`email`, `url`)\n );\n ")})}};export{i as default};
@@ -0,0 +1,14 @@
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
+ import { createRequire as __alchemyCreateRequire } from 'node:module';
12
+ const require = __alchemyCreateRequire(import.meta.url);
13
+
14
+ import"./chunk-RHIWAYN5.js";import{Effect as e}from"effect";var r={id:"20260225215848_workspace",up(t){return e.gen(function*(){yield*t.run("\n CREATE TABLE `workspace` (\n `id` text PRIMARY KEY,\n `branch` text,\n `project_id` text NOT NULL,\n `config` text NOT NULL,\n CONSTRAINT `fk_workspace_project_id_project_id_fk` FOREIGN KEY (`project_id`) REFERENCES `project`(`id`) ON DELETE CASCADE\n );\n ")})}};export{r as default};
@@ -0,0 +1,14 @@
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
+ import { createRequire as __alchemyCreateRequire } from 'node:module';
12
+ const require = __alchemyCreateRequire(import.meta.url);
13
+
14
+ import"./chunk-RHIWAYN5.js";import{Effect as s}from"effect";var o={id:"20260227213759_add_session_workspace_id",up(i){return s.gen(function*(){yield*i.run("ALTER TABLE `session` ADD `workspace_id` text;"),yield*i.run("CREATE INDEX `session_workspace_idx` ON `session` (`workspace_id`);")})}};export{o as default};
@@ -0,0 +1,14 @@
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
+ import { createRequire as __alchemyCreateRequire } from 'node:module';
12
+ const require = __alchemyCreateRequire(import.meta.url);
13
+
14
+ import"./chunk-RHIWAYN5.js";import{Effect as e}from"effect";var a={id:"20260228203230_blue_harpoon",up(t){return e.gen(function*(){yield*t.run("\n CREATE TABLE `account` (\n `id` text PRIMARY KEY,\n `email` text NOT NULL,\n `url` text NOT NULL,\n `access_token` text NOT NULL,\n `refresh_token` text NOT NULL,\n `token_expiry` integer,\n `selected_org_id` text,\n `time_created` integer NOT NULL,\n `time_updated` integer NOT NULL\n );\n "),yield*t.run("\n CREATE TABLE `account_state` (\n `id` integer PRIMARY KEY NOT NULL,\n `active_account_id` text,\n FOREIGN KEY (`active_account_id`) REFERENCES `account`(`id`) ON UPDATE no action ON DELETE set null\n );\n ")})}};export{a as default};
@@ -0,0 +1,14 @@
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
+ import { createRequire as __alchemyCreateRequire } from 'node:module';
12
+ const require = __alchemyCreateRequire(import.meta.url);
13
+
14
+ import"./chunk-RHIWAYN5.js";import{Effect as r}from"effect";var t={id:"20260303231226_add_workspace_fields",up(e){return r.gen(function*(){yield*e.run("ALTER TABLE `workspace` ADD `type` text NOT NULL;"),yield*e.run("ALTER TABLE `workspace` ADD `name` text;"),yield*e.run("ALTER TABLE `workspace` ADD `directory` text;"),yield*e.run("ALTER TABLE `workspace` ADD `extra` text;"),yield*e.run("ALTER TABLE `workspace` DROP COLUMN `config`;")})}};export{t as default};
@@ -0,0 +1,14 @@
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
+ import { createRequire as __alchemyCreateRequire } from 'node:module';
12
+ const require = __alchemyCreateRequire(import.meta.url);
13
+
14
+ import"./chunk-RHIWAYN5.js";import{Effect as e}from"effect";var i={id:"20260309230000_move_org_to_state",up(t){return e.gen(function*(){yield*t.run("ALTER TABLE `account_state` ADD `active_org_id` text;"),yield*t.run("UPDATE `account_state` SET `active_org_id` = (SELECT `selected_org_id` FROM `account` WHERE `account`.`id` = `account_state`.`active_account_id`);"),yield*t.run("ALTER TABLE `account` DROP COLUMN `selected_org_id`;")})}};export{i as default};
@@ -0,0 +1,14 @@
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
+ import { createRequire as __alchemyCreateRequire } from 'node:module';
12
+ const require = __alchemyCreateRequire(import.meta.url);
13
+
14
+ import"./chunk-RHIWAYN5.js";import{Effect as i}from"effect";var a={id:"20260312043431_session_message_cursor",up(e){return i.gen(function*(){yield*e.run("DROP INDEX IF EXISTS `message_session_idx`;"),yield*e.run("DROP INDEX IF EXISTS `part_message_idx`;"),yield*e.run("CREATE INDEX `message_session_time_created_id_idx` ON `message` (`session_id`,`time_created`,`id`);"),yield*e.run("CREATE INDEX `part_message_id_id_idx` ON `part` (`message_id`,`id`);")})}};export{a as default};
@@ -0,0 +1,14 @@
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
+ import { createRequire as __alchemyCreateRequire } from 'node:module';
12
+ const require = __alchemyCreateRequire(import.meta.url);
13
+
14
+ import"./chunk-RHIWAYN5.js";import{Effect as t}from"effect";var g={id:"20260323234822_events",up(e){return t.gen(function*(){yield*e.run("\n CREATE TABLE `event_sequence` (\n `aggregate_id` text PRIMARY KEY,\n `seq` integer NOT NULL\n );\n "),yield*e.run("\n CREATE TABLE `event` (\n `id` text PRIMARY KEY,\n `aggregate_id` text NOT NULL,\n `seq` integer NOT NULL,\n `type` text NOT NULL,\n `data` text NOT NULL,\n CONSTRAINT `fk_event_aggregate_id_event_sequence_aggregate_id_fk` FOREIGN KEY (`aggregate_id`) REFERENCES `event_sequence`(`aggregate_id`) ON DELETE CASCADE\n );\n ")})}};export{g as default};
@@ -0,0 +1,14 @@
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
+ import { createRequire as __alchemyCreateRequire } from 'node:module';
12
+ const require = __alchemyCreateRequire(import.meta.url);
13
+
14
+ import"./chunk-RHIWAYN5.js";import{Effect as i}from"effect";var n={id:"20260410174513_workspace-name",up(e){return i.gen(function*(){let r=(yield*e.all("PRAGMA table_info(`workspace`)")).some(t=>t.name==="name")?"`name`":"''";yield*e.run("PRAGMA foreign_keys=OFF;"),yield*e.run("\n CREATE TABLE `__new_workspace` (\n `id` text PRIMARY KEY,\n `type` text NOT NULL,\n `name` text DEFAULT '' NOT NULL,\n `branch` text,\n `directory` text,\n `extra` text,\n `project_id` text NOT NULL,\n CONSTRAINT `fk_workspace_project_id_project_id_fk` FOREIGN KEY (`project_id`) REFERENCES `project`(`id`) ON DELETE CASCADE\n );\n "),yield*e.run(`INSERT INTO \`__new_workspace\`(\`id\`, \`type\`, \`branch\`, \`name\`, \`directory\`, \`extra\`, \`project_id\`) SELECT \`id\`, \`type\`, \`branch\`, ${r}, \`directory\`, \`extra\`, \`project_id\` FROM \`workspace\`;`),yield*e.run("DROP TABLE `workspace`;"),yield*e.run("ALTER TABLE `__new_workspace` RENAME TO `workspace`;"),yield*e.run("PRAGMA foreign_keys=ON;")})}};export{n as default};
@@ -0,0 +1,14 @@
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
+ import { createRequire as __alchemyCreateRequire } from 'node:module';
12
+ const require = __alchemyCreateRequire(import.meta.url);
13
+
14
+ import"./chunk-RHIWAYN5.js";import{Effect as s}from"effect";var t={id:"20260413175956_chief_energizer",up(e){return s.gen(function*(){yield*e.run("\n CREATE TABLE `session_entry` (\n `id` text PRIMARY KEY,\n `session_id` text NOT NULL,\n `type` text NOT NULL,\n `time_created` integer NOT NULL,\n `time_updated` integer NOT NULL,\n `data` text NOT NULL,\n CONSTRAINT `fk_session_entry_session_id_session_id_fk` FOREIGN KEY (`session_id`) REFERENCES `session`(`id`) ON DELETE CASCADE\n );\n "),yield*e.run("CREATE INDEX `session_entry_session_idx` ON `session_entry` (`session_id`);"),yield*e.run("CREATE INDEX `session_entry_session_type_idx` ON `session_entry` (`session_id`,`type`);"),yield*e.run("CREATE INDEX `session_entry_time_created_idx` ON `session_entry` (`time_created`);")})}};export{t as default};
@@ -0,0 +1,14 @@
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
+ import { createRequire as __alchemyCreateRequire } from 'node:module';
12
+ const require = __alchemyCreateRequire(import.meta.url);
13
+
14
+ import"./chunk-RHIWAYN5.js";import{Effect as i}from"effect";var e={id:"20260423070820_add_icon_url_override",up(r){return i.gen(function*(){yield*r.run("\n ALTER TABLE `project` ADD `icon_url_override` text;\n UPDATE `project` SET `icon_url_override` = `icon_url` WHERE `icon_url` IS NOT NULL;\n ")})}};export{e as default};
@@ -0,0 +1,14 @@
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
+ import { createRequire as __alchemyCreateRequire } from 'node:module';
12
+ const require = __alchemyCreateRequire(import.meta.url);
13
+
14
+ import"./chunk-RHIWAYN5.js";import{Effect as e}from"effect";var n={id:"20260427172553_slow_nightmare",up(s){return e.gen(function*(){yield*s.run("\n CREATE TABLE `session_message` (\n `id` text PRIMARY KEY,\n `session_id` text NOT NULL,\n `type` text NOT NULL,\n `time_created` integer NOT NULL,\n `time_updated` integer NOT NULL,\n `data` text NOT NULL,\n CONSTRAINT `fk_session_message_session_id_session_id_fk` FOREIGN KEY (`session_id`) REFERENCES `session`(`id`) ON DELETE CASCADE\n );\n "),yield*s.run("DROP INDEX IF EXISTS `session_entry_session_idx`;"),yield*s.run("DROP INDEX IF EXISTS `session_entry_session_type_idx`;"),yield*s.run("DROP INDEX IF EXISTS `session_entry_time_created_idx`;"),yield*s.run("CREATE INDEX `session_message_session_idx` ON `session_message` (`session_id`);"),yield*s.run("CREATE INDEX `session_message_session_type_idx` ON `session_message` (`session_id`,`type`);"),yield*s.run("CREATE INDEX `session_message_time_created_idx` ON `session_message` (`time_created`);"),yield*s.run("DROP TABLE `session_entry`;")})}};export{n as default};
@@ -8,4 +8,7 @@ if (typeof globalThis.Bun === 'undefined') {
8
8
  }
9
9
  if (typeof globalThis.__name === 'undefined') { globalThis.__name = (t, n) => { Object.defineProperty(t, 'name', { value: n, configurable: true }); return t; }; }
10
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
+ import { createRequire as __alchemyCreateRequire } from 'node:module';
12
+ const require = __alchemyCreateRequire(import.meta.url);
11
13
 
14
+ import"./chunk-RHIWAYN5.js";import{Effect as i}from"effect";var e={id:"20260428004200_add_session_path",up(t){return i.gen(function*(){yield*t.run("ALTER TABLE `session` ADD `path` text;")})}};export{e as default};
@@ -8,5 +8,7 @@ if (typeof globalThis.Bun === 'undefined') {
8
8
  }
9
9
  if (typeof globalThis.__name === 'undefined') { globalThis.__name = (t, n) => { Object.defineProperty(t, 'name', { value: n, configurable: true }); return t; }; }
10
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
+ import { createRequire as __alchemyCreateRequire } from 'node:module';
12
+ const require = __alchemyCreateRequire(import.meta.url);
11
13
 
12
- import{a as t}from"./chunk-CZVKIDQZ.js";import{a as o}from"./chunk-MBZTOEAD.js";async function a(){try{let{toJsonSchema:n}=await import("@valibot/to-json-schema");return n}catch{throw new t("@valibot/to-json-schema")}}o(a,"getToJsonSchemaFn");export{a as default};
14
+ import"./chunk-RHIWAYN5.js";import{Effect as e}from"effect";var n={id:"20260501142318_next_venus",up(t){return e.gen(function*(){yield*t.run("ALTER TABLE `session` ADD `agent` text;"),yield*t.run("ALTER TABLE `session` ADD `model` text;")})}};export{n as default};
@@ -0,0 +1,14 @@
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
+ import { createRequire as __alchemyCreateRequire } from 'node:module';
12
+ const require = __alchemyCreateRequire(import.meta.url);
13
+
14
+ import"./chunk-RHIWAYN5.js";import{Effect as t}from"effect";var n={id:"20260504145000_add_sync_owner",up(e){return t.gen(function*(){yield*e.run("ALTER TABLE `event_sequence` ADD `owner_id` text;")})}};export{n as default};
@@ -0,0 +1,14 @@
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
+ import { createRequire as __alchemyCreateRequire } from 'node:module';
12
+ const require = __alchemyCreateRequire(import.meta.url);
13
+
14
+ import"./chunk-RHIWAYN5.js";import{Effect as t}from"effect";var a={id:"20260507164347_add_workspace_time",up(i){return t.gen(function*(){yield*i.run("ALTER TABLE `workspace` ADD `time_used` integer NOT NULL DEFAULT 0;")})}};export{a as default};
@@ -0,0 +1,53 @@
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
+ import { createRequire as __alchemyCreateRequire } from 'node:module';
12
+ const require = __alchemyCreateRequire(import.meta.url);
13
+
14
+ import"./chunk-RHIWAYN5.js";import{Effect as e}from"effect";var t={id:"20260510033149_session_usage",up(s){return e.gen(function*(){yield*s.run("ALTER TABLE `session` ADD `cost` real DEFAULT 0 NOT NULL;"),yield*s.run("ALTER TABLE `session` ADD `tokens_input` integer DEFAULT 0 NOT NULL;"),yield*s.run("ALTER TABLE `session` ADD `tokens_output` integer DEFAULT 0 NOT NULL;"),yield*s.run("ALTER TABLE `session` ADD `tokens_reasoning` integer DEFAULT 0 NOT NULL;"),yield*s.run("ALTER TABLE `session` ADD `tokens_cache_read` integer DEFAULT 0 NOT NULL;"),yield*s.run("ALTER TABLE `session` ADD `tokens_cache_write` integer DEFAULT 0 NOT NULL;"),yield*s.run(`
15
+ UPDATE session
16
+ SET
17
+ cost = coalesce((
18
+ SELECT sum(coalesce(json_extract(message.data, '$.cost'), 0))
19
+ FROM message
20
+ WHERE message.session_id = session.id
21
+ AND json_extract(message.data, '$.role') = 'assistant'
22
+ ), 0),
23
+ tokens_input = coalesce((
24
+ SELECT sum(coalesce(json_extract(message.data, '$.tokens.input'), 0))
25
+ FROM message
26
+ WHERE message.session_id = session.id
27
+ AND json_extract(message.data, '$.role') = 'assistant'
28
+ ), 0),
29
+ tokens_output = coalesce((
30
+ SELECT sum(coalesce(json_extract(message.data, '$.tokens.output'), 0))
31
+ FROM message
32
+ WHERE message.session_id = session.id
33
+ AND json_extract(message.data, '$.role') = 'assistant'
34
+ ), 0),
35
+ tokens_reasoning = coalesce((
36
+ SELECT sum(coalesce(json_extract(message.data, '$.tokens.reasoning'), 0))
37
+ FROM message
38
+ WHERE message.session_id = session.id
39
+ AND json_extract(message.data, '$.role') = 'assistant'
40
+ ), 0),
41
+ tokens_cache_read = coalesce((
42
+ SELECT sum(coalesce(json_extract(message.data, '$.tokens.cache.read'), 0))
43
+ FROM message
44
+ WHERE message.session_id = session.id
45
+ AND json_extract(message.data, '$.role') = 'assistant'
46
+ ), 0),
47
+ tokens_cache_write = coalesce((
48
+ SELECT sum(coalesce(json_extract(message.data, '$.tokens.cache.write'), 0))
49
+ FROM message
50
+ WHERE message.session_id = session.id
51
+ AND json_extract(message.data, '$.role') = 'assistant'
52
+ ), 0)
53
+ `)})}};export{t as default};
@@ -0,0 +1,14 @@
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
+ import { createRequire as __alchemyCreateRequire } from 'node:module';
12
+ const require = __alchemyCreateRequire(import.meta.url);
13
+
14
+ import"./chunk-RHIWAYN5.js";import{Effect as i}from"effect";var e={id:"20260511000411_data_migration_state",up(t){return i.gen(function*(){yield*t.run("\n CREATE TABLE `data_migration` (\n `name` text PRIMARY KEY,\n `time_completed` integer NOT NULL\n );\n ")})}};export{e as default};
@@ -0,0 +1,14 @@
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
+ import { createRequire as __alchemyCreateRequire } from 'node:module';
12
+ const require = __alchemyCreateRequire(import.meta.url);
13
+
14
+ import"./chunk-RHIWAYN5.js";import{Effect as e}from"effect";var n={id:"20260511173437_session-metadata",up(a){return e.gen(function*(){(yield*a.all("PRAGMA table_info(`session`)")).some(t=>t.name==="metadata")||(yield*a.run("ALTER TABLE `session` ADD `metadata` text;"))})}};export{n as default};
@@ -0,0 +1,14 @@
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
+ import { createRequire as __alchemyCreateRequire } from 'node:module';
12
+ const require = __alchemyCreateRequire(import.meta.url);
13
+
14
+ import"./chunk-RHIWAYN5.js";import{Effect as e}from"effect";var t={id:"20260601010001_normalize_storage_paths",up(r){return e.gen(function*(){yield*r.run("UPDATE project SET worktree = REPLACE(worktree, char(92), '/') WHERE worktree GLOB '[A-Za-z]:' || char(92) || '*' OR worktree LIKE char(92) || char(92) || '%';"),yield*r.run("UPDATE project SET sandboxes = REPLACE(sandboxes, char(92) || char(92), '/') WHERE instr(sandboxes, char(92)) > 0 AND (worktree GLOB '[A-Za-z]:*' OR worktree LIKE '//%');"),yield*r.run("UPDATE session SET directory = REPLACE(directory, char(92), '/') WHERE directory GLOB '[A-Za-z]:' || char(92) || '*' OR directory LIKE char(92) || char(92) || '%';"),yield*r.run("UPDATE session SET path = REPLACE(path, char(92), '/') WHERE path IS NOT NULL AND instr(path, char(92)) > 0 AND (directory GLOB '[A-Za-z]:*' OR directory LIKE '//%');")})}};export{t as default};