@onescience/onecode 1.14.50-202607011643 → 1.14.50-202607021504

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/onecode CHANGED
@@ -195,12 +195,9 @@ if (!resolved) {
195
195
  process.exit(1)
196
196
  }
197
197
 
198
- // Pass the real platform binary path to the child so it can locate bundled
199
- // .opencode/ (session-seed, oneskills) inside node_modules/onecode-linux-x64/.
200
- // Without this, process.execPath is bin/.onecode (hardlink) and bundled
201
- // content relative to that path is never found.
202
- if (!process.env.ONECODE_BIN_PATH && !process.env.OPENCODE_BIN_PATH) {
203
- process.env.ONECODE_BIN_PATH = resolved
204
- }
205
-
198
+ // Bundled assets (.opencode/session-seed, .opencode/oneskills, .oneskills)
199
+ // are discovered by the child via parent-directory climbing from
200
+ // process.execPath (bin/.onecode hardlink). postinstall also symlinks those
201
+ // dirs into the launcher package root so the climb from the hardlink reaches
202
+ // them without any env-var contract between launcher and child.
206
203
  run(resolved)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onescience/onecode",
3
- "version": "1.14.50-202607011643",
3
+ "version": "1.14.50-202607021504",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "description": "OneScience AI coding agent for the terminal.",
@@ -146,6 +146,38 @@ export function linkCachedBinary(rootDir, result) {
146
146
  return result.binaryPath
147
147
  }
148
148
 
149
+ // Bundled assets shipped inside the platform package (.opencode/session-seed,
150
+ // .opencode/oneskills, .oneskills/install-state) are discovered at runtime by
151
+ // the platform binary via parent-directory climbing from process.execPath,
152
+ // which is the bin/.onecode hardlink in the launcher package root. That climb
153
+ // never reaches node_modules/onecode-linux-x64/, so mirror the asset dirs into
154
+ // the launcher package root via symlinks. This keeps discovery purely
155
+ // filesystem-based — no env-var contract between the launcher and the child.
156
+ const BUNDLED_ASSET_DIRS = [".opencode", ".oneskills"]
157
+
158
+ export function linkBundledAssets(rootDir, result) {
159
+ const platformPkgDir = path.join(rootDir, "node_modules", result.packageName)
160
+ for (const name of BUNDLED_ASSET_DIRS) {
161
+ const target = path.join(platformPkgDir, name)
162
+ if (!fs.existsSync(target)) continue
163
+ const link = path.join(rootDir, name)
164
+ fs.rmSync(link, { recursive: true, force: true })
165
+ const rel = path.relative(rootDir, target)
166
+ try {
167
+ // "junction" is Windows-only and ignored on posix; on posix a regular
168
+ // symlink is created. Using a relative target keeps the link valid when
169
+ // the install dir is relocated.
170
+ fs.symlinkSync(rel, link, "junction")
171
+ } catch {
172
+ try {
173
+ fs.symlinkSync(rel, link)
174
+ } catch {
175
+ // best-effort: ignore so install still succeeds without the mirror
176
+ }
177
+ }
178
+ }
179
+ }
180
+
149
181
  function removeStalePlatformPackage(rootDir) {
150
182
  const packageName = platformPackageName()
151
183
  fs.rmSync(path.join(rootDir, "node_modules", packageName), { recursive: true, force: true })
@@ -200,7 +232,9 @@ export async function ensurePlatformBinary(rootDir) {
200
232
 
201
233
  if (isPlatformInstalledForVersion(rootDir)) {
202
234
  const existing = findPlatformBinary(rootDir)
235
+ console.log("onecode platform package already installed for this version, refreshing launcher links")
203
236
  linkCachedBinary(rootDir, existing)
237
+ linkBundledAssets(rootDir, existing)
204
238
  return existing.binaryPath
205
239
  }
206
240
 
@@ -216,6 +250,7 @@ export async function ensurePlatformBinary(rootDir) {
216
250
  }
217
251
 
218
252
  linkCachedBinary(rootDir, result)
253
+ linkBundledAssets(rootDir, result)
219
254
  writePlatformInstallStamp(rootDir)
220
255
  return result.binaryPath
221
256
  }
package/postinstall.mjs CHANGED
@@ -2,15 +2,16 @@
2
2
 
3
3
  import path from "path"
4
4
  import { fileURLToPath } from "url"
5
- import { ensurePlatformBinary, isPlatformInstalledForVersion } from "./platform-bootstrap.mjs"
5
+ import { ensurePlatformBinary } from "./platform-bootstrap.mjs"
6
6
 
7
7
  const rootDir = path.dirname(fileURLToPath(import.meta.url))
8
8
 
9
9
  try {
10
- if (isPlatformInstalledForVersion(rootDir)) {
11
- console.log("onecode platform package already installed for this version, skipping download")
12
- process.exit(0)
13
- }
10
+ // ensurePlatformBinary handles the already-installed case internally
11
+ // (skips download, but still refreshes the bin/.onecode hardlink and the
12
+ // .opencode/.oneskills symlinks at the launcher root). Do NOT early-exit
13
+ // before calling it, or re-installs of the same version would skip
14
+ // linkBundledAssets and leave the launcher without asset symlinks.
14
15
  await ensurePlatformBinary(rootDir)
15
16
  } catch (error) {
16
17
  console.error(`Failed to setup onecode platform package:`, error.message)