@alfe.ai/openclaw-chat 0.0.20 → 0.0.21
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/plugin2.cjs +19 -7
- package/dist/plugin2.js +23 -8
- package/package.json +1 -1
package/dist/plugin2.cjs
CHANGED
|
@@ -418,17 +418,29 @@ function buildA2ATools(chatClient, log) {
|
|
|
418
418
|
*/
|
|
419
419
|
let dispatchInbound = null;
|
|
420
420
|
/**
|
|
421
|
-
* Resolve OpenClaw SDK functions from the
|
|
422
|
-
*
|
|
423
|
-
*
|
|
424
|
-
*
|
|
421
|
+
* Resolve OpenClaw SDK functions from the running process.
|
|
422
|
+
*
|
|
423
|
+
* The openclaw package is NOT in the plugin's node_modules (it's a peer dep).
|
|
424
|
+
* Since the plugin runs inside OpenClaw's process, we anchor resolution to
|
|
425
|
+
* OpenClaw's own entry module via require.main, then fall back to deriving
|
|
426
|
+
* the global modules path from process.execPath.
|
|
425
427
|
*/
|
|
426
428
|
function resolveOpenClawSdk(log) {
|
|
427
|
-
|
|
428
|
-
|
|
429
|
+
const anchors = [require.main?.filename, process.argv[1]].filter(Boolean);
|
|
430
|
+
for (const anchor of anchors) try {
|
|
431
|
+
const channelInbound = (0, node_module.createRequire)(anchor)("openclaw/plugin-sdk/channel-inbound");
|
|
432
|
+
if (channelInbound.dispatchInboundDirectDmWithRuntime) {
|
|
433
|
+
dispatchInbound = channelInbound.dispatchInboundDirectDmWithRuntime;
|
|
434
|
+
log.info(`Resolved OpenClaw SDK from ${anchor}`);
|
|
435
|
+
return;
|
|
436
|
+
}
|
|
437
|
+
} catch {}
|
|
438
|
+
try {
|
|
439
|
+
const derivedPath = (0, node_path.join)((0, node_path.resolve)((0, node_path.dirname)(process.execPath), ".."), "lib", "node_modules", "openclaw", "package.json");
|
|
440
|
+
const channelInbound = (0, node_module.createRequire)(derivedPath)("openclaw/plugin-sdk/channel-inbound");
|
|
429
441
|
if (channelInbound.dispatchInboundDirectDmWithRuntime) {
|
|
430
442
|
dispatchInbound = channelInbound.dispatchInboundDirectDmWithRuntime;
|
|
431
|
-
log.info(`Resolved OpenClaw SDK from ${
|
|
443
|
+
log.info(`Resolved OpenClaw SDK from ${derivedPath}`);
|
|
432
444
|
return;
|
|
433
445
|
}
|
|
434
446
|
} catch {}
|
package/dist/plugin2.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
2
|
import { mkdir, readFile, readdir, stat, unlink, writeFile } from "node:fs/promises";
|
|
3
|
-
import { join } from "node:path";
|
|
3
|
+
import { dirname, join, resolve } from "node:path";
|
|
4
4
|
import { homedir } from "node:os";
|
|
5
5
|
import { ChatServiceClient, resolveAlfeChat } from "@alfe.ai/chat";
|
|
6
6
|
import { resolveConfig } from "@alfe.ai/config";
|
|
7
7
|
import { AgentApiClient } from "@alfe.ai/agent-api-client";
|
|
8
8
|
import { existsSync } from "node:fs";
|
|
9
|
+
//#region \0rolldown/runtime.js
|
|
10
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
11
|
+
//#endregion
|
|
9
12
|
//#region src/alfe-channel.ts
|
|
10
13
|
const CHANNEL_ID = "alfe";
|
|
11
14
|
const DEFAULT_ACCOUNT_ID = "default";
|
|
@@ -418,17 +421,29 @@ function buildA2ATools(chatClient, log) {
|
|
|
418
421
|
*/
|
|
419
422
|
let dispatchInbound = null;
|
|
420
423
|
/**
|
|
421
|
-
* Resolve OpenClaw SDK functions from the
|
|
422
|
-
*
|
|
423
|
-
*
|
|
424
|
-
*
|
|
424
|
+
* Resolve OpenClaw SDK functions from the running process.
|
|
425
|
+
*
|
|
426
|
+
* The openclaw package is NOT in the plugin's node_modules (it's a peer dep).
|
|
427
|
+
* Since the plugin runs inside OpenClaw's process, we anchor resolution to
|
|
428
|
+
* OpenClaw's own entry module via require.main, then fall back to deriving
|
|
429
|
+
* the global modules path from process.execPath.
|
|
425
430
|
*/
|
|
426
431
|
function resolveOpenClawSdk(log) {
|
|
427
|
-
|
|
428
|
-
|
|
432
|
+
const anchors = [__require.main?.filename, process.argv[1]].filter(Boolean);
|
|
433
|
+
for (const anchor of anchors) try {
|
|
434
|
+
const channelInbound = createRequire(anchor)("openclaw/plugin-sdk/channel-inbound");
|
|
435
|
+
if (channelInbound.dispatchInboundDirectDmWithRuntime) {
|
|
436
|
+
dispatchInbound = channelInbound.dispatchInboundDirectDmWithRuntime;
|
|
437
|
+
log.info(`Resolved OpenClaw SDK from ${anchor}`);
|
|
438
|
+
return;
|
|
439
|
+
}
|
|
440
|
+
} catch {}
|
|
441
|
+
try {
|
|
442
|
+
const derivedPath = join(resolve(dirname(process.execPath), ".."), "lib", "node_modules", "openclaw", "package.json");
|
|
443
|
+
const channelInbound = createRequire(derivedPath)("openclaw/plugin-sdk/channel-inbound");
|
|
429
444
|
if (channelInbound.dispatchInboundDirectDmWithRuntime) {
|
|
430
445
|
dispatchInbound = channelInbound.dispatchInboundDirectDmWithRuntime;
|
|
431
|
-
log.info(`Resolved OpenClaw SDK from ${
|
|
446
|
+
log.info(`Resolved OpenClaw SDK from ${derivedPath}`);
|
|
432
447
|
return;
|
|
433
448
|
}
|
|
434
449
|
} catch {}
|