@dimi-agent/cli 0.5.3 → 0.5.4

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/main.mjs CHANGED
@@ -99274,18 +99274,34 @@ var init_loginShellPath = __esmMin((() => {
99274
99274
  * live in `dimi-wire` (Rust) and `@dimi-agent/transcript` (zod) and are
99275
99275
  * cross-checked by the differential test suite.
99276
99276
  */
99277
+ function loadPlatformSubpackage() {
99278
+ try {
99279
+ return nodeRequire$4(PLATFORM_SUBPACKAGE);
99280
+ } catch {
99281
+ return null;
99282
+ }
99283
+ }
99277
99284
  /**
99278
- * Loads the native binding, building nothing. Throws with a pointer to the
99279
- * build command when `dist/dimi_bridge.node` is missing.
99285
+ * Loads the native binding, building nothing. Resolution order:
99286
+ * 1. `dist/dimi_bridge.node` next to the package — the dev / workspace
99287
+ * layout (local cargo builds always win).
99288
+ * 2. the npm platform subpackage (`@dimi-agent/dimi-native-<platform>-<arch>`)
99289
+ * — npm installs >=0.5.4; the SEA binary's module hook redirects the same
99290
+ * specifier into the embedded native-asset cache.
99291
+ * Throws with a pointer to the build command when neither exists.
99280
99292
  */
99281
99293
  function loadNative() {
99282
99294
  if (binding) return binding;
99283
99295
  try {
99284
- binding = require$1("../dist/dimi_bridge.node");
99285
- } catch (error) {
99286
- throw new Error("dimi-native: native binding not found; run `pnpm --filter @dimi-agent/dimi-native run build:native`", { cause: error });
99296
+ binding = nodeRequire$4("../dist/dimi_bridge.node");
99297
+ return binding;
99298
+ } catch {}
99299
+ const platformBinding = loadPlatformSubpackage();
99300
+ if (platformBinding !== null) {
99301
+ binding = platformBinding;
99302
+ return binding;
99287
99303
  }
99288
- return binding;
99304
+ throw new Error("dimi-native: native binding not found; run `pnpm --filter @dimi-agent/dimi-native run build:native`");
99289
99305
  }
99290
99306
  /** Full cold rebuild: wire records JSON array → snapshot JSON. */
99291
99307
  function coldRebuild(recordsJson) {
@@ -99321,9 +99337,10 @@ function rustHostEnvironmentProbe() {
99321
99337
  function rustTerminalSpawn(options) {
99322
99338
  return loadNative().RustTerminal.spawn(options);
99323
99339
  }
99324
- var require$1, binding, RustAgentTranscript, RustFileSystem;
99340
+ var nodeRequire$4, binding, PLATFORM_SUBPACKAGE, RustAgentTranscript, RustFileSystem;
99325
99341
  var init_src$7 = __esmMin((() => {
99326
- require$1 = createRequire(import.meta.url);
99342
+ nodeRequire$4 = createRequire(import.meta.url);
99343
+ PLATFORM_SUBPACKAGE = `@dimi-agent/dimi-native-${process.platform}-${process.arch}`;
99327
99344
  RustAgentTranscript = class {
99328
99345
  #inner;
99329
99346
  constructor(agentId) {
@@ -99601,7 +99618,6 @@ function toRustOptions$1(options) {
99601
99618
  }
99602
99619
  var ERRNO_PREFIX, RustHostFileSystem;
99603
99620
  var init_rustHostFileSystemService = __esmMin((() => {
99604
- init_scope();
99605
99621
  init_src$7();
99606
99622
  init_hostFileSystem();
99607
99623
  init_hostFsErrors();
@@ -393981,6 +393997,20 @@ var init_upgrade = __esmMin((() => {
393981
393997
  }));
393982
393998
  //#endregion
393983
393999
  //#region src/native/module-hook.ts
394000
+ /**
394001
+ * The cached dimi_bridge.node for the requested binding subpackage, or null
394002
+ * when the package resolves normally (dev / npm installs — the real package
394003
+ * wins) or the native-asset tree has no such package.
394004
+ */
394005
+ function dimiNativeBindingPath(request) {
394006
+ try {
394007
+ nodeRequire.resolve(request);
394008
+ return null;
394009
+ } catch {}
394010
+ const pkgRoot = getNativePackageRoot(request);
394011
+ if (pkgRoot === null) return null;
394012
+ return join(pkgRoot, "dimi_bridge.node");
394013
+ }
393984
394014
  function installNativeModuleHook() {
393985
394015
  if (installed) return;
393986
394016
  installed = true;
@@ -393988,28 +394018,38 @@ function installNativeModuleHook() {
393988
394018
  const originalLoad = moduleBuiltin._load;
393989
394019
  if (originalLoad === void 0) return;
393990
394020
  moduleBuiltin._load = function loadWithNativeAssets(request, parent, isMain) {
393991
- if (typeof request === "string" && PI_TUI_NATIVE_PATTERN.test(request) && !existsSync(request)) {
393992
- const pkgRoot = getNativePackageRoot("@dimi-agent/pi-tui");
393993
- if (pkgRoot !== null) {
393994
- const match = request.match(PI_TUI_NATIVE_PATTERN);
393995
- if (match !== null) {
393996
- const redirected = join(pkgRoot, match[0]);
393997
- return originalLoad.call(this, redirected, parent, isMain);
394021
+ if (typeof request === "string") {
394022
+ if (PI_TUI_NATIVE_PATTERN.test(request) && !existsSync(request)) {
394023
+ const pkgRoot = getNativePackageRoot("@dimi-agent/pi-tui");
394024
+ if (pkgRoot !== null) {
394025
+ const match = request.match(PI_TUI_NATIVE_PATTERN);
394026
+ if (match !== null) {
394027
+ const redirected = join(pkgRoot, match[0]);
394028
+ return originalLoad.call(this, redirected, parent, isMain);
394029
+ }
393998
394030
  }
394031
+ } else if (DIMI_NATIVE_SUBPACKAGE.test(request)) {
394032
+ const redirected = dimiNativeBindingPath(request);
394033
+ if (redirected !== null) return originalLoad.call(this, redirected, parent, isMain);
393999
394034
  }
394000
394035
  }
394001
394036
  return originalLoad.call(this, request, parent, isMain);
394002
394037
  };
394003
394038
  }
394004
- var nodeRequire, installed, PI_TUI_NATIVE_PATTERN;
394039
+ var nodeRequire, installed, PI_TUI_NATIVE_PATTERN, DIMI_NATIVE_SUBPACKAGE;
394005
394040
  var init_module_hook = __esmMin((() => {
394006
394041
  init_native_assets();
394007
394042
  nodeRequire = createRequire(import.meta.url);
394008
394043
  installed = false;
394009
394044
  PI_TUI_NATIVE_PATTERN = /native[\\/](?:win32|darwin)[\\/]prebuilds[\\/].+\.node$/;
394045
+ DIMI_NATIVE_SUBPACKAGE = /^@dimi-agent\/dimi-native-(?:darwin|linux|win32)-(?:arm64|x64)$/;
394010
394046
  }));
394011
394047
  //#endregion
394012
394048
  //#region src/native/smoke.ts
394049
+ function smokeDimiNativeLoad() {
394050
+ const info = createRequire(import.meta.url)(dimiNativePackage)?.RustHostEnvironment?.probe?.();
394051
+ if (typeof info !== "object" || info === null || typeof info.osKind !== "string") throw new Error("dimi-native binding loaded but probe() returned an unexpected shape");
394052
+ }
394013
394053
  function smokePiTuiNativeLoad() {
394014
394054
  const platform = process.platform;
394015
394055
  const arch = process.arch;
@@ -394027,6 +394067,7 @@ function runNativeAssetSmokeIfRequested() {
394027
394067
  if (manifest === null) throw new Error("Native asset manifest is not available.");
394028
394068
  for (const packageName of smokePackages) if (getNativePackageRoot(packageName, { manifest }) === null) throw new Error(`Native package is not available: ${packageName}`);
394029
394069
  smokePiTuiNativeLoad();
394070
+ smokeDimiNativeLoad();
394030
394071
  process.stdout.write(`Native asset smoke passed: ${manifest.target}\n`);
394031
394072
  process.exit(0);
394032
394073
  } catch (error) {
@@ -394035,10 +394076,15 @@ function runNativeAssetSmokeIfRequested() {
394035
394076
  process.exit(1);
394036
394077
  }
394037
394078
  }
394038
- var smokePackages;
394079
+ var dimiNativePackage, smokePackages;
394039
394080
  var init_smoke = __esmMin((() => {
394040
394081
  init_native_assets();
394041
- smokePackages = ["@mariozechner/clipboard", "@dimi-agent/pi-tui"];
394082
+ dimiNativePackage = `@dimi-agent/dimi-native-${process.platform}-${process.arch}`;
394083
+ smokePackages = [
394084
+ "@mariozechner/clipboard",
394085
+ "@dimi-agent/pi-tui",
394086
+ dimiNativePackage
394087
+ ];
394042
394088
  }));
394043
394089
  //#endregion
394044
394090
  //#region src/main-app.ts
@@ -394186,16 +394232,26 @@ if (process.env["DIMI_LEGACY"] !== "1" && !nativeBindingAvailable()) {
394186
394232
  process.env["DIMI_LEGACY"] = "1";
394187
394233
  process.stderr.write("dimi: native runtime unavailable (dimi_bridge.node not found); falling back to the legacy TypeScript backend. Reinstall or run \"dimi upgrade\" to get the Rust runtime.\n");
394188
394234
  }
394189
- await Promise.resolve().then(() => (init_main_app(), main_app_exports));
394235
+ Promise.resolve().then(() => (init_main_app(), main_app_exports)).catch((error) => {
394236
+ process.stderr.write(`dimi: failed to start: ${error instanceof Error ? error.message : String(error)}\n`);
394237
+ process.exit(1);
394238
+ });
394190
394239
  /** Locate the napi binding without loading it. */
394191
394240
  function nativeBindingAvailable() {
394192
- const require = createRequire(import.meta.url);
394193
- const candidates = [resolve(dirname(fileURLToPath(import.meta.url)), "../dist/dimi_bridge.node")];
394241
+ const nodeRequire = createRequire(import.meta.url);
394194
394242
  try {
394195
- const pkgPath = require.resolve("@dimi-agent/dimi-native/package.json");
394196
- candidates.push(resolve(dirname(pkgPath), "dist/dimi_bridge.node"));
394243
+ const sea = nodeRequire("node:sea");
394244
+ if (typeof sea?.isSea === "function" && sea.isSea()) return true;
394197
394245
  } catch {}
394198
- return candidates.some((candidate) => existsSync(candidate));
394246
+ if (existsSync(resolve(dirname(fileURLToPath(import.meta.url)), "../dist/dimi_bridge.node"))) return true;
394247
+ try {
394248
+ nodeRequire.resolve(`@dimi-agent/dimi-native-${process.platform}-${process.arch}`);
394249
+ return true;
394250
+ } catch {}
394251
+ try {
394252
+ if (existsSync(resolve(dirname(nodeRequire.resolve("@dimi-agent/dimi-native/package.json")), "dist/dimi_bridge.node"))) return true;
394253
+ } catch {}
394254
+ return false;
394199
394255
  }
394200
394256
  //#endregion
394201
394257
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dimi-agent/cli",
3
- "version": "0.5.3",
3
+ "version": "0.5.4",
4
4
  "description": "The Starting Point for Next-Gen Agents",
5
5
  "keywords": [
6
6
  "agent",
@@ -27,6 +27,7 @@
27
27
  },
28
28
  "files": [
29
29
  "dist",
30
+ "!dist/dimi_bridge.node",
30
31
  "dist-web",
31
32
  "native",
32
33
  "README.md"
@@ -60,17 +61,23 @@
60
61
  "yazl": "^3.3.1",
61
62
  "zod": "^4.3.6",
62
63
  "@dimi-agent/agent-core-v2": "^0.1.0",
63
- "@dimi-agent/dimi-sdk": "^0.2.0",
64
64
  "@dimi-agent/dimi-oauth": "^0.1.0",
65
+ "@dimi-agent/dimi-sdk": "^0.2.0",
65
66
  "@dimi-agent/dimi-telemetry": "^0.1.0",
66
67
  "@dimi-agent/dimi-web": "^0.1.0",
67
- "@dimi-agent/pi-tui": "^0.1.0",
68
+ "@dimi-agent/kap-server": "^0.1.0",
68
69
  "@dimi-agent/remote": "^0.1.0",
69
- "@dimi-agent/kap-server": "^0.1.0"
70
+ "@dimi-agent/pi-tui": "^0.1.0"
70
71
  },
71
72
  "optionalDependencies": {
72
73
  "@mariozechner/clipboard": "^0.3.9",
73
- "node-pty": "^1.1.0"
74
+ "node-pty": "^1.1.0",
75
+ "@dimi-agent/dimi-native-darwin-arm64": ">=0.5.3 <1",
76
+ "@dimi-agent/dimi-native-darwin-x64": ">=0.5.3 <1",
77
+ "@dimi-agent/dimi-native-linux-x64": ">=0.5.3 <1",
78
+ "@dimi-agent/dimi-native-linux-arm64": ">=0.5.3 <1",
79
+ "@dimi-agent/dimi-native-win32-x64": ">=0.5.3 <1",
80
+ "@dimi-agent/dimi-native-win32-arm64": ">=0.5.3 <1"
74
81
  },
75
82
  "engines": {
76
83
  "node": ">=22.19.0"
Binary file