@syengup/friday-channel-next 0.1.18 → 0.1.19
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/src/host-config.js +13 -6
- package/dist/src/runtime.d.ts +2 -1
- package/package.json +1 -1
- package/src/host-config.ts +14 -9
- package/src/runtime.ts +3 -1
- package/src/test-support/mock-runtime.ts +2 -0
package/dist/src/host-config.js
CHANGED
|
@@ -1,13 +1,20 @@
|
|
|
1
|
-
function
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
function asConfigLoader(value) {
|
|
2
|
+
if (!value || typeof value !== "object")
|
|
3
|
+
return null;
|
|
4
|
+
const v = value;
|
|
5
|
+
if (typeof v.current === "function" || typeof v.loadConfig === "function")
|
|
6
|
+
return v;
|
|
7
|
+
return null;
|
|
5
8
|
}
|
|
6
9
|
export function getHostOpenClawConfigSnapshot(config) {
|
|
7
|
-
|
|
10
|
+
const loader = asConfigLoader(config);
|
|
11
|
+
if (!loader)
|
|
8
12
|
return {};
|
|
9
13
|
try {
|
|
10
|
-
|
|
14
|
+
// Prefer current() to avoid the deprecation warning; fall back to loadConfig() on old gateways.
|
|
15
|
+
if (typeof loader.current === "function")
|
|
16
|
+
return loader.current();
|
|
17
|
+
return loader.loadConfig();
|
|
11
18
|
}
|
|
12
19
|
catch {
|
|
13
20
|
return {};
|
package/dist/src/runtime.d.ts
CHANGED
package/package.json
CHANGED
package/src/host-config.ts
CHANGED
|
@@ -1,19 +1,24 @@
|
|
|
1
1
|
type HostConfigLoader = {
|
|
2
|
-
|
|
2
|
+
// Modern OpenClaw exposes config.current(); older builds only had config.loadConfig(),
|
|
3
|
+
// which is now deprecated and logs a "runtime-config-load-write" warning on every call.
|
|
4
|
+
current?: () => unknown;
|
|
5
|
+
loadConfig?: () => unknown;
|
|
3
6
|
};
|
|
4
7
|
|
|
5
|
-
function
|
|
6
|
-
return
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
);
|
|
8
|
+
function asConfigLoader(value: unknown): HostConfigLoader | null {
|
|
9
|
+
if (!value || typeof value !== "object") return null;
|
|
10
|
+
const v = value as HostConfigLoader;
|
|
11
|
+
if (typeof v.current === "function" || typeof v.loadConfig === "function") return v;
|
|
12
|
+
return null;
|
|
11
13
|
}
|
|
12
14
|
|
|
13
15
|
export function getHostOpenClawConfigSnapshot(config: unknown): unknown {
|
|
14
|
-
|
|
16
|
+
const loader = asConfigLoader(config);
|
|
17
|
+
if (!loader) return {};
|
|
15
18
|
try {
|
|
16
|
-
|
|
19
|
+
// Prefer current() to avoid the deprecation warning; fall back to loadConfig() on old gateways.
|
|
20
|
+
if (typeof loader.current === "function") return loader.current();
|
|
21
|
+
return loader.loadConfig!();
|
|
17
22
|
} catch {
|
|
18
23
|
return {};
|
|
19
24
|
}
|
package/src/runtime.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { createPluginRuntimeStore } from "./vendor/runtime-store.js";
|
|
2
2
|
|
|
3
3
|
type FridayRuntime = {
|
|
4
|
-
|
|
4
|
+
// `current()` is the modern OpenClaw API; `loadConfig()` is the deprecated fallback
|
|
5
|
+
// kept for older gateways.
|
|
6
|
+
config: { current?: () => unknown; loadConfig?: () => unknown };
|
|
5
7
|
logger?: { info?: (...args: unknown[]) => void; warn?: (...args: unknown[]) => void };
|
|
6
8
|
};
|
|
7
9
|
|
|
@@ -66,6 +66,8 @@ export function setMockRuntime(opts: MockRuntimeOptions = {}): void {
|
|
|
66
66
|
};
|
|
67
67
|
setFridayNextRuntime({
|
|
68
68
|
config: {
|
|
69
|
+
// Mirror modern OpenClaw (current()) plus the deprecated alias so both paths resolve.
|
|
70
|
+
current: () => cfg,
|
|
69
71
|
loadConfig: () => cfg,
|
|
70
72
|
},
|
|
71
73
|
logger: {
|