@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.
- package/dist/bridge/chunk-3RG5ZIWI.js +10 -0
- package/dist/bridge/cli.js +1 -0
- package/dist/bridge/core.js +1 -0
- package/dist/bridge/mcp-server.js +23 -11
- package/dist/bridge/openclaw.js +2 -0
- package/package.json +1 -1
- package/src/bridge/mcp-server.ts +29 -13
|
@@ -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
|
+
};
|
package/dist/bridge/cli.js
CHANGED
package/dist/bridge/core.js
CHANGED
|
@@ -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
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
"
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
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;
|
package/dist/bridge/openclaw.js
CHANGED
package/package.json
CHANGED
package/src/bridge/mcp-server.ts
CHANGED
|
@@ -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
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
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)
|