@wipcomputer/wip-ldm-os 0.4.73-alpha.21 → 0.4.73-alpha.22

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.
@@ -0,0 +1,10 @@
1
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
+ }) : x)(function(x) {
4
+ if (typeof require !== "undefined") return require.apply(this, arguments);
5
+ throw Error('Dynamic require of "' + x + '" is not supported');
6
+ });
7
+
8
+ export {
9
+ __require
10
+ };
@@ -9,6 +9,7 @@ import {
9
9
  searchWorkspace,
10
10
  sendMessage
11
11
  } from "./chunk-24DJYS7Z.js";
12
+ import "./chunk-3RG5ZIWI.js";
12
13
 
13
14
  // cli.ts
14
15
  import { existsSync, statSync } from "fs";
@@ -24,6 +24,7 @@ import {
24
24
  sendMessage,
25
25
  setSessionIdentity
26
26
  } from "./chunk-24DJYS7Z.js";
27
+ import "./chunk-3RG5ZIWI.js";
27
28
  export {
28
29
  LDM_ROOT,
29
30
  blobToEmbedding,
@@ -16,6 +16,9 @@ import {
16
16
  sendMessage,
17
17
  setSessionIdentity
18
18
  } from "./chunk-24DJYS7Z.js";
19
+ import {
20
+ __require
21
+ } from "./chunk-3RG5ZIWI.js";
19
22
 
20
23
  // mcp-server.ts
21
24
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
@@ -323,18 +326,27 @@ ${lines.join("\n")}` }] };
323
326
  console.error(`wip-bridge: registered ${executableSkills.length} skill tools + oc_skills_list (${skills.length} total skills)`);
324
327
  }
325
328
  function resolveSessionName() {
326
- try {
327
- const ccSessionPath = join(
328
- process.env.HOME || homedir(),
329
- ".claude",
330
- "sessions",
331
- `${process.ppid}.json`
332
- );
333
- const data = JSON.parse(readFileSync(ccSessionPath, "utf-8"));
334
- if (data.name && typeof data.name === "string") {
335
- return data.name;
329
+ const ccSessionDir = join(process.env.HOME || homedir(), ".claude", "sessions");
330
+ const ccSessionPath = join(ccSessionDir, `${process.ppid}.json`);
331
+ for (let attempt = 0; attempt < 3; attempt++) {
332
+ try {
333
+ const data = JSON.parse(readFileSync(ccSessionPath, "utf-8"));
334
+ if (data.name && typeof data.name === "string") {
335
+ return data.name;
336
+ }
337
+ if (attempt < 2) {
338
+ const { execSync } = __require("child_process");
339
+ execSync("sleep 0.5", { stdio: "ignore" });
340
+ }
341
+ } catch {
342
+ if (attempt < 2) {
343
+ try {
344
+ const { execSync } = __require("child_process");
345
+ execSync("sleep 0.5", { stdio: "ignore" });
346
+ } catch {
347
+ }
348
+ }
336
349
  }
337
- } catch {
338
350
  }
339
351
  if (process.env.LDM_SESSION_NAME) {
340
352
  return process.env.LDM_SESSION_NAME;
@@ -1,3 +1,5 @@
1
+ import "./chunk-3RG5ZIWI.js";
2
+
1
3
  // openclaw.ts
2
4
  var openclaw_default = {
3
5
  register(api) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wipcomputer/wip-ldm-os",
3
- "version": "0.4.73-alpha.21",
3
+ "version": "0.4.73-alpha.22",
4
4
  "type": "module",
5
5
  "description": "LDM OS: identity, memory, and sovereignty infrastructure for AI agents",
6
6
  "engines": {
@@ -452,20 +452,36 @@ function registerSkillTools(skills: SkillInfo[]): void {
452
452
  * Fallback chain: CC session file -> LDM_SESSION_NAME env -> "default"
453
453
  */
454
454
  function resolveSessionName(): string {
455
- // 1. Try CC session file for parent PID
456
- try {
457
- const ccSessionPath = join(
458
- process.env.HOME || homedir(),
459
- ".claude",
460
- "sessions",
461
- `${process.ppid}.json`
462
- );
463
- const data = JSON.parse(readFileSync(ccSessionPath, "utf-8"));
464
- if (data.name && typeof data.name === "string") {
465
- return data.name;
455
+ // 1. Try CC session file for parent PID.
456
+ // CC and the bridge MCP server start concurrently. CC writes the session
457
+ // file after boot, but the bridge may read it before it exists or before
458
+ // the /rename label is written. Retry with a brief delay to handle the
459
+ // race. Three attempts, 500ms apart = up to 1s total wait. If it still
460
+ // fails, fall through to env var or default.
461
+ const ccSessionDir = join(process.env.HOME || homedir(), ".claude", "sessions");
462
+ const ccSessionPath = join(ccSessionDir, `${process.ppid}.json`);
463
+
464
+ for (let attempt = 0; attempt < 3; attempt++) {
465
+ try {
466
+ const data = JSON.parse(readFileSync(ccSessionPath, "utf-8"));
467
+ if (data.name && typeof data.name === "string") {
468
+ return data.name;
469
+ }
470
+ // File exists but no name yet. CC hasn't written /rename label.
471
+ // On the last attempt, break to fallback. Otherwise wait and retry.
472
+ if (attempt < 2) {
473
+ const { execSync } = require("node:child_process");
474
+ execSync("sleep 0.5", { stdio: "ignore" });
475
+ }
476
+ } catch {
477
+ // File doesn't exist yet. Wait and retry.
478
+ if (attempt < 2) {
479
+ try {
480
+ const { execSync } = require("node:child_process");
481
+ execSync("sleep 0.5", { stdio: "ignore" });
482
+ } catch {}
483
+ }
466
484
  }
467
- } catch {
468
- // No session file for parent PID. Normal for non-CC harnesses.
469
485
  }
470
486
 
471
487
  // 2. Try env var (explicit override)