@teith/openclaw-runware-provider 0.2.9 → 0.3.0
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/README.md +0 -26
- package/dist/catalog.d.ts.map +1 -1
- package/dist/catalog.js +1 -10
- package/dist/catalog.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -10
- package/dist/index.js.map +1 -1
- package/dist/openclaw-api.d.ts +0 -18
- package/dist/openclaw-api.d.ts.map +1 -1
- package/dist/provider-discovery.d.ts.map +1 -1
- package/dist/provider-discovery.js +2 -15
- package/dist/provider-discovery.js.map +1 -1
- package/package.json +1 -1
- package/dist/logger.d.ts +0 -33
- package/dist/logger.d.ts.map +0 -1
- package/dist/logger.js +0 -68
- package/dist/logger.js.map +0 -1
- package/dist/stream-wrap.d.ts +0 -24
- package/dist/stream-wrap.d.ts.map +0 -1
- package/dist/stream-wrap.js +0 -51
- package/dist/stream-wrap.js.map +0 -1
package/README.md
CHANGED
|
@@ -42,32 +42,6 @@ from internal credential caches.
|
|
|
42
42
|
- Injects `extra_body: { reasoning_effort: "high" }` into every chat
|
|
43
43
|
completions request so reasoning-capable models stream thinking content.
|
|
44
44
|
|
|
45
|
-
## Logging
|
|
46
|
-
|
|
47
|
-
The plugin emits structured log lines prefixed with
|
|
48
|
-
`[runware-openclaw-provider]` on these conditions:
|
|
49
|
-
|
|
50
|
-
| Level | When |
|
|
51
|
-
|-------|----------------------------------------------------------------------|
|
|
52
|
-
| warn | `RUNWARE_API_KEY` missing — empty catalog returned |
|
|
53
|
-
| warn | `/v1/models` upstream failed but a cached catalog is being served |
|
|
54
|
-
| error | `/v1/models` upstream failed and no cached catalog exists |
|
|
55
|
-
| error | Any other failure inside `catalog.run` — falls back to empty catalog |
|
|
56
|
-
|
|
57
|
-
Transport is `console.{error,warn,info,debug}` by default. The openclaw
|
|
58
|
-
gateway CLI captures process console output into the shared gateway log,
|
|
59
|
-
so these lines show up in `openclaw logs --follow`, the Control UI Logs
|
|
60
|
-
tab, and the gateway stderr without any additional wiring. If a future
|
|
61
|
-
openclaw version starts invoking `register(api)` for external plugins,
|
|
62
|
-
the logger is automatically swapped to `api.logger` so lines are tagged
|
|
63
|
-
by the openclaw scoped logger instead.
|
|
64
|
-
|
|
65
|
-
To follow plugin output in a running managed deployment:
|
|
66
|
-
|
|
67
|
-
```bash
|
|
68
|
-
openclaw logs --follow | grep runware-openclaw-provider
|
|
69
|
-
```
|
|
70
|
-
|
|
71
45
|
## Architecture
|
|
72
46
|
|
|
73
47
|
```
|
package/dist/catalog.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../src/catalog.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../src/catalog.ts"],"names":[],"mappings":"AAeA,wBAAsB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAsBtF;AAwBD,wBAAgB,UAAU,IAAI,IAAI,CAGjC"}
|
package/dist/catalog.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { logger } from "./logger.js";
|
|
2
1
|
const CACHE_TTL_MS = 5 * 60 * 1000;
|
|
3
2
|
const FETCH_TIMEOUT_MS = 5000;
|
|
4
3
|
let cache = null;
|
|
@@ -17,16 +16,8 @@ export async function fetchModelIds(baseUrl, apiKey) {
|
|
|
17
16
|
return ids;
|
|
18
17
|
}
|
|
19
18
|
catch (err) {
|
|
20
|
-
|
|
21
|
-
if (cache) {
|
|
22
|
-
logger.warn("upstream /v1/models fetch failed; serving stale catalog", {
|
|
23
|
-
baseUrl,
|
|
24
|
-
cachedModels: cache.modelIds.length,
|
|
25
|
-
error: message,
|
|
26
|
-
});
|
|
19
|
+
if (cache)
|
|
27
20
|
return cache.modelIds;
|
|
28
|
-
}
|
|
29
|
-
logger.error("upstream /v1/models fetch failed and no cached catalog is available", { baseUrl, error: message });
|
|
30
21
|
throw err;
|
|
31
22
|
}
|
|
32
23
|
finally {
|
package/dist/catalog.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalog.js","sourceRoot":"","sources":["../src/catalog.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"catalog.js","sourceRoot":"","sources":["../src/catalog.ts"],"names":[],"mappings":"AAAA,MAAM,YAAY,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;AACnC,MAAM,gBAAgB,GAAG,IAAI,CAAC;AAW9B,IAAI,KAAK,GAAsB,IAAI,CAAC;AACpC,IAAI,QAAQ,GAA6B,IAAI,CAAC;AAE9C,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,OAAe,EAAE,MAAc;IACjE,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IACvB,IAAI,KAAK,IAAI,GAAG,GAAG,KAAK,CAAC,SAAS,GAAG,YAAY,EAAE,CAAC;QAClD,OAAO,KAAK,CAAC,QAAQ,CAAC;IACxB,CAAC;IAED,IAAI,QAAQ;QAAE,OAAO,QAAQ,CAAC;IAE9B,QAAQ,GAAG,CAAC,KAAK,IAAI,EAAE;QACrB,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,MAAM,iBAAiB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;YACrD,KAAK,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;YACjD,OAAO,GAAG,CAAC;QACb,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAI,KAAK;gBAAE,OAAO,KAAK,CAAC,QAAQ,CAAC;YACjC,MAAM,GAAG,CAAC;QACZ,CAAC;gBAAS,CAAC;YACT,QAAQ,GAAG,IAAI,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,EAAE,C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,GAAG,IAAI,CAAC;IACb,QAAQ,GAAG,IAAI,CAAC;AAClB,CAAC"}
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAkB,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIrE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,QAAA,MAAM,KAAK,EAAE,WAkCZ,CAAC;AAEF,eAAe,KAAK,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { setHostLogger } from "./logger.js";
|
|
2
1
|
import { API_KEY_ENV_VAR, BASE_URL_ENV_VAR, PROVIDER_ID, PROVIDER_LABEL, buildCatalogRows, buildProvider, resolveApiKey, resolveBaseUrl, } from "./models.js";
|
|
3
|
-
import { buildRunwareStreamWrapper } from "./stream-wrap.js";
|
|
4
2
|
const PLUGIN_ID = "runware-openclaw-provider";
|
|
5
3
|
/**
|
|
6
4
|
* Plugin entry that openclaw's plugin loader invokes after `npm install`-ing
|
|
@@ -28,8 +26,6 @@ const entry = {
|
|
|
28
26
|
name: PROVIDER_LABEL,
|
|
29
27
|
description: "Runware — unified OpenAI-compatible access to Claude, GPT, Gemini, Qwen, GLM, MiniMax, Kimi, and Gemma.",
|
|
30
28
|
register(api) {
|
|
31
|
-
if (api.logger)
|
|
32
|
-
setHostLogger(api.logger);
|
|
33
29
|
api.registerProvider({
|
|
34
30
|
id: PROVIDER_ID,
|
|
35
31
|
label: PROVIDER_LABEL,
|
|
@@ -46,12 +42,6 @@ const entry = {
|
|
|
46
42
|
return { provider };
|
|
47
43
|
},
|
|
48
44
|
},
|
|
49
|
-
// Strip `temperature` from outbound Runware requests (their text
|
|
50
|
-
// inference endpoint rejects it with HTTP 400) and prefix raw
|
|
51
|
-
// upstream errors with "Runware:" so end users see the actual cause
|
|
52
|
-
// in webchat instead of openclaw's generic "provider rejected the
|
|
53
|
-
// request schema or tool payload" classifier text.
|
|
54
|
-
wrapStreamFn: buildRunwareStreamWrapper,
|
|
55
45
|
});
|
|
56
46
|
api.registerModelCatalogProvider({
|
|
57
47
|
provider: PROVIDER_ID,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,WAAW,EACX,cAAc,EACd,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,cAAc,GACf,MAAM,aAAa,CAAC;AAGrB,MAAM,SAAS,GAAG,2BAA2B,CAAC;AAE9C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,KAAK,GAAgB;IACzB,EAAE,EAAE,SAAS;IACb,IAAI,EAAE,cAAc;IACpB,WAAW,EACT,yGAAyG;IAE3G,QAAQ,CAAC,GAAG;QACV,GAAG,CAAC,gBAAgB,CAAC;YACnB,EAAE,EAAE,WAAW;YACf,KAAK,EAAE,cAAc;YACrB,QAAQ,EAAE,yBAAyB;YACnC,OAAO,EAAE,CAAC,eAAe,EAAE,gBAAgB,CAAC;YAC5C,IAAI,EAAE,EAAE;YACR,OAAO,EAAE;gBACP,KAAK,EAAE,QAAQ;gBACf,GAAG,EAAE,KAAK,EAAE,GAAmB,EAAE,EAAE;oBACjC,MAAM,MAAM,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC;oBAClC,IAAI,CAAC,MAAM;wBAAE,OAAO,IAAI,CAAC;oBACzB,MAAM,QAAQ,GAAG,MAAM,aAAa,CAAC,MAAM,EAAE,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;oBACtE,OAAO,EAAE,QAAQ,EAAE,CAAC;gBACtB,CAAC;aACF;SACF,CAAC,CAAC;QAEH,GAAG,CAAC,4BAA4B,CAAC;YAC/B,QAAQ,EAAE,WAAW;YACrB,KAAK,EAAE,CAAC,MAAM,CAAC;YACf,WAAW,EAAE,KAAK,EAAE,GAAmB,EAAE,EAAE;gBACzC,MAAM,MAAM,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC;gBAClC,IAAI,CAAC,MAAM;oBAAE,OAAO,IAAI,CAAC;gBACzB,OAAO,gBAAgB,CAAC,MAAM,EAAE,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;YAC3D,CAAC;SACF,CAAC,CAAC;IACL,CAAC;CACF,CAAC;AAEF,eAAe,KAAK,CAAC"}
|
package/dist/openclaw-api.d.ts
CHANGED
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
* a downstream consumer of openclaw's TypeScript types. Keeping the surface
|
|
6
6
|
* minimal here also lets us track exactly which hooks we touch.
|
|
7
7
|
*/
|
|
8
|
-
import type { HostLogger } from "./logger.js";
|
|
9
8
|
import type { ModelCatalogRow } from "./models.js";
|
|
10
9
|
/**
|
|
11
10
|
* Context passed to plugin hooks (`registerProvider.catalog.run`,
|
|
@@ -24,24 +23,7 @@ export interface CatalogContext {
|
|
|
24
23
|
* actually call. Other methods (registerMemoryEmbeddingProvider, etc) are
|
|
25
24
|
* available on the underlying object — we just don't type them here.
|
|
26
25
|
*/
|
|
27
|
-
/**
|
|
28
|
-
* Params object passed to a wrapped openai-completions StreamFn. Shape is
|
|
29
|
-
* the openclaw internal one — we type only the fields we touch. Other keys
|
|
30
|
-
* (messages, model, tools, headers, etc) pass through unchanged.
|
|
31
|
-
*/
|
|
32
|
-
export interface StreamFnParams {
|
|
33
|
-
temperature?: number;
|
|
34
|
-
[key: string]: unknown;
|
|
35
|
-
}
|
|
36
|
-
export type StreamFn = (params: StreamFnParams) => Promise<unknown>;
|
|
37
|
-
export interface WrapStreamFnCtx {
|
|
38
|
-
streamFn?: StreamFn;
|
|
39
|
-
model?: {
|
|
40
|
-
id?: string;
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
26
|
export interface PluginApi {
|
|
44
|
-
logger?: HostLogger;
|
|
45
27
|
registerProvider: (spec: unknown) => void;
|
|
46
28
|
registerModelCatalogProvider: (spec: {
|
|
47
29
|
provider: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openclaw-api.d.ts","sourceRoot":"","sources":["../src/openclaw-api.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"openclaw-api.d.ts","sourceRoot":"","sources":["../src/openclaw-api.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC7B,qBAAqB,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACpE,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;CAC1C;AAED;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACxB,gBAAgB,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAC1C,4BAA4B,EAAE,CAAC,IAAI,EAAE;QACnC,QAAQ,EAAE,MAAM,CAAC;QACjB,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;QACrB,WAAW,EAAE,CAAC,GAAG,EAAE,cAAc,KAAK,OAAO,CAAC,eAAe,EAAE,GAAG,IAAI,CAAC,CAAC;KACzE,KAAK,IAAI,CAAC;CACZ;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,CAAC,GAAG,EAAE,SAAS,KAAK,IAAI,CAAC;CACpC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider-discovery.d.ts","sourceRoot":"","sources":["../src/provider-discovery.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"provider-discovery.d.ts","sourceRoot":"","sources":["../src/provider-discovery.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,gBAAgB,EAMjB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD;;;;;;;;;;;;;;GAcG;AAEH,UAAU,YAAY;IACpB,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IACzC,qBAAqB,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACrE;AAYD,iBAAe,iBAAiB,CAAC,GAAG,EAAE,YAAY,GAAG,OAAO,CAAC;IAAE,QAAQ,EAAE,aAAa,CAAA;CAAE,CAAC,CAUxF;AAED,QAAA,MAAM,wBAAwB;;;;;;;;;;CAU7B,CAAC;AAEF,eAAe,wBAAwB,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { logger } from "./logger.js";
|
|
2
1
|
import { API_KEY_ENV_VAR, BASE_URL_ENV_VAR, DEFAULT_BASE_URL, PROVIDER_ID, PROVIDER_LABEL, buildProvider, resolveApiKey, resolveBaseUrl, } from "./models.js";
|
|
3
2
|
function emptyProvider(baseUrl) {
|
|
4
3
|
return {
|
|
@@ -17,21 +16,9 @@ async function runwareCatalogRun(ctx) {
|
|
|
17
16
|
// an empty provider shape so openclaw treats the catalog as "known but
|
|
18
17
|
// currently unpopulated" rather than crashing. The next invocation will
|
|
19
18
|
// re-resolve and fill in models once the key is present.
|
|
20
|
-
if (!apiKey)
|
|
21
|
-
logger.warn(`${API_KEY_ENV_VAR} is not set — returning an empty Runware catalog`, { baseUrl });
|
|
19
|
+
if (!apiKey)
|
|
22
20
|
return { provider: emptyProvider(baseUrl) };
|
|
23
|
-
}
|
|
24
|
-
try {
|
|
25
|
-
return { provider: await buildProvider(apiKey, baseUrl) };
|
|
26
|
-
}
|
|
27
|
-
catch (err) {
|
|
28
|
-
// openclaw silently swallows rejections from catalog.run, which is why
|
|
29
|
-
// upstream failures were previously invisible. Log explicitly via the
|
|
30
|
-
// gateway CLI's console capture and degrade to an empty catalog so the
|
|
31
|
-
// gateway keeps booting — the next invocation will retry.
|
|
32
|
-
logger.error("failed to build Runware provider catalog — returning empty fallback", { baseUrl, error: err instanceof Error ? err.message : String(err) });
|
|
33
|
-
return { provider: emptyProvider(baseUrl) };
|
|
34
|
-
}
|
|
21
|
+
return { provider: await buildProvider(apiKey, baseUrl) };
|
|
35
22
|
}
|
|
36
23
|
const runwareProviderDiscovery = {
|
|
37
24
|
id: PROVIDER_ID,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider-discovery.js","sourceRoot":"","sources":["../src/provider-discovery.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"provider-discovery.js","sourceRoot":"","sources":["../src/provider-discovery.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,WAAW,EACX,cAAc,EACd,aAAa,EACb,aAAa,EACb,cAAc,GACf,MAAM,aAAa,CAAC;AAwBrB,SAAS,aAAa,CAAC,OAAe;IACpC,OAAO;QACL,OAAO;QACP,MAAM,EAAE,EAAE;QACV,GAAG,EAAE,oBAAoB;QACzB,cAAc,EAAE,GAAG;QACnB,MAAM,EAAE,EAAE;KACX,CAAC;AACJ,CAAC;AAED,KAAK,UAAU,iBAAiB,CAAC,GAAiB;IAChD,MAAM,OAAO,GAAG,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACxC,MAAM,MAAM,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC;IAClC,uEAAuE;IACvE,0EAA0E;IAC1E,uEAAuE;IACvE,wEAAwE;IACxE,yDAAyD;IACzD,IAAI,CAAC,MAAM;QAAE,OAAO,EAAE,QAAQ,EAAE,aAAa,CAAC,OAAO,CAAC,EAAE,CAAC;IACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;AAC5D,CAAC;AAED,MAAM,wBAAwB,GAAG;IAC/B,EAAE,EAAE,WAAW;IACf,KAAK,EAAE,cAAc;IACrB,QAAQ,EAAE,yBAAyB;IACnC,OAAO,EAAE,CAAC,eAAe,EAAE,gBAAgB,CAAC;IAC5C,IAAI,EAAE,EAAE;IACR,OAAO,EAAE;QACP,KAAK,EAAE,MAAe;QACtB,GAAG,EAAE,iBAAiB;KACvB;CACF,CAAC;AAEF,eAAe,wBAAwB,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teith/openclaw-runware-provider",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "OpenClaw provider plugin for Runware — unified OpenAI-compatible access to Claude, GPT, Gemini, Qwen, GLM, MiniMax, Kimi, and Gemma.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
package/dist/logger.d.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Plugin-scoped logger with two transports:
|
|
3
|
-
*
|
|
4
|
-
* - default: console.error/warn/info/debug. OpenClaw's gateway CLI
|
|
5
|
-
* captures process console output and writes it to the shared gateway
|
|
6
|
-
* log file alongside its own logger output, so anything we emit here
|
|
7
|
-
* surfaces in `openclaw logs --follow` and the Control UI Logs tab
|
|
8
|
-
* without any wiring. This is the only path available from the
|
|
9
|
-
* `providerCatalogEntry` hook, where we never get a `register(api)` call
|
|
10
|
-
* and therefore never see `api.logger`.
|
|
11
|
-
*
|
|
12
|
-
* - host: `setHostLogger(api.logger)` swaps console for openclaw's plugin
|
|
13
|
-
* logger. Used from the `register(api)` flow when openclaw actually
|
|
14
|
-
* invokes it (currently 2026.5.x does not for external plugins, but
|
|
15
|
-
* future versions are expected to per the SDK docs).
|
|
16
|
-
*
|
|
17
|
-
* Both modes prepend the plugin id so the line is greppable in the shared
|
|
18
|
-
* gateway log next to log lines from bundled plugins.
|
|
19
|
-
*/
|
|
20
|
-
export interface HostLogger {
|
|
21
|
-
error: (message: string) => void;
|
|
22
|
-
warn: (message: string) => void;
|
|
23
|
-
info: (message: string) => void;
|
|
24
|
-
debug?: (message: string) => void;
|
|
25
|
-
}
|
|
26
|
-
export declare function setHostLogger(next: HostLogger | null): void;
|
|
27
|
-
export declare const logger: {
|
|
28
|
-
readonly error: (message: string, meta?: Record<string, unknown>) => void;
|
|
29
|
-
readonly warn: (message: string, meta?: Record<string, unknown>) => void;
|
|
30
|
-
readonly info: (message: string, meta?: Record<string, unknown>) => void;
|
|
31
|
-
readonly debug: (message: string, meta?: Record<string, unknown>) => void;
|
|
32
|
-
};
|
|
33
|
-
//# sourceMappingURL=logger.d.ts.map
|
package/dist/logger.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC;AAID,wBAAgB,aAAa,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,GAAG,IAAI,CAE3D;AAeD,eAAO,MAAM,MAAM;8BACF,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAG,IAAI;6BAK9C,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAG,IAAI;6BAK7C,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAG,IAAI;8BAK5C,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAG,IAAI;CAKpD,CAAC"}
|
package/dist/logger.js
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Plugin-scoped logger with two transports:
|
|
3
|
-
*
|
|
4
|
-
* - default: console.error/warn/info/debug. OpenClaw's gateway CLI
|
|
5
|
-
* captures process console output and writes it to the shared gateway
|
|
6
|
-
* log file alongside its own logger output, so anything we emit here
|
|
7
|
-
* surfaces in `openclaw logs --follow` and the Control UI Logs tab
|
|
8
|
-
* without any wiring. This is the only path available from the
|
|
9
|
-
* `providerCatalogEntry` hook, where we never get a `register(api)` call
|
|
10
|
-
* and therefore never see `api.logger`.
|
|
11
|
-
*
|
|
12
|
-
* - host: `setHostLogger(api.logger)` swaps console for openclaw's plugin
|
|
13
|
-
* logger. Used from the `register(api)` flow when openclaw actually
|
|
14
|
-
* invokes it (currently 2026.5.x does not for external plugins, but
|
|
15
|
-
* future versions are expected to per the SDK docs).
|
|
16
|
-
*
|
|
17
|
-
* Both modes prepend the plugin id so the line is greppable in the shared
|
|
18
|
-
* gateway log next to log lines from bundled plugins.
|
|
19
|
-
*/
|
|
20
|
-
const PREFIX = "[runware-openclaw-provider]";
|
|
21
|
-
let host = null;
|
|
22
|
-
export function setHostLogger(next) {
|
|
23
|
-
host = next;
|
|
24
|
-
}
|
|
25
|
-
function safeStringify(meta) {
|
|
26
|
-
try {
|
|
27
|
-
return JSON.stringify(meta);
|
|
28
|
-
}
|
|
29
|
-
catch {
|
|
30
|
-
return "[unserializable meta]";
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
function format(message, meta) {
|
|
34
|
-
if (!meta || Object.keys(meta).length === 0)
|
|
35
|
-
return `${PREFIX} ${message}`;
|
|
36
|
-
return `${PREFIX} ${message} ${safeStringify(meta)}`;
|
|
37
|
-
}
|
|
38
|
-
export const logger = {
|
|
39
|
-
error(message, meta) {
|
|
40
|
-
const line = format(message, meta);
|
|
41
|
-
if (host)
|
|
42
|
-
host.error(line);
|
|
43
|
-
else
|
|
44
|
-
console.error(line);
|
|
45
|
-
},
|
|
46
|
-
warn(message, meta) {
|
|
47
|
-
const line = format(message, meta);
|
|
48
|
-
if (host)
|
|
49
|
-
host.warn(line);
|
|
50
|
-
else
|
|
51
|
-
console.warn(line);
|
|
52
|
-
},
|
|
53
|
-
info(message, meta) {
|
|
54
|
-
const line = format(message, meta);
|
|
55
|
-
if (host)
|
|
56
|
-
host.info(line);
|
|
57
|
-
else
|
|
58
|
-
console.info(line);
|
|
59
|
-
},
|
|
60
|
-
debug(message, meta) {
|
|
61
|
-
const line = format(message, meta);
|
|
62
|
-
if (host?.debug)
|
|
63
|
-
host.debug(line);
|
|
64
|
-
else if (!host)
|
|
65
|
-
(console.debug ?? console.log).call(console, line);
|
|
66
|
-
},
|
|
67
|
-
};
|
|
68
|
-
//# sourceMappingURL=logger.js.map
|
package/dist/logger.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,MAAM,MAAM,GAAG,6BAA6B,CAAC;AAS7C,IAAI,IAAI,GAAsB,IAAI,CAAC;AAEnC,MAAM,UAAU,aAAa,CAAC,IAAuB;IACnD,IAAI,GAAG,IAAI,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8B;QACnD,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QACnC,IAAI,IAAI,EAAE,KAAK;YAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;aAC7B,IAAI,CAAC,IAAI;YAAE,CAAC,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IACrE,CAAC;CACO,CAAC"}
|
package/dist/stream-wrap.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { StreamFn, WrapStreamFnCtx } from "./openclaw-api.js";
|
|
2
|
-
/**
|
|
3
|
-
* StreamFn wrapper for Runware. Two responsibilities:
|
|
4
|
-
*
|
|
5
|
-
* 1. Strip outgoing params Runware's text-inference endpoint rejects.
|
|
6
|
-
* Runware /v1/chat/completions returns HTTP 400 with
|
|
7
|
-
* "Unsupported use of 'settings.temperature' parameter. This
|
|
8
|
-
* parameter is not supported for text inference" if the request body
|
|
9
|
-
* contains a top-level `temperature`. Openclaw's bundled pi-ai
|
|
10
|
-
* openai-completions builder hardcodes sending temperature whenever a
|
|
11
|
-
* numeric value is configured (see openclaw#32496 — only `temperature`
|
|
12
|
-
* and `maxTokens` are forwarded out of extraParams, and there is no
|
|
13
|
-
* documented `compat` flag to skip it). Deleting the key on the way
|
|
14
|
-
* out is the only surface available to a plugin.
|
|
15
|
-
*
|
|
16
|
-
* 2. Translate cryptic upstream errors into a Runware-prefixed message
|
|
17
|
-
* that openclaw's `surface_error` path will show to the end user in
|
|
18
|
-
* webchat / TUI verbatim. Without this, every Runware 4xx collapses
|
|
19
|
-
* into openclaw's generic "provider rejected the request schema or
|
|
20
|
-
* tool payload" classifier and the actual cause is buried in
|
|
21
|
-
* diagnostics-only logs.
|
|
22
|
-
*/
|
|
23
|
-
export declare function buildRunwareStreamWrapper(ctx: WrapStreamFnCtx): StreamFn | undefined;
|
|
24
|
-
//# sourceMappingURL=stream-wrap.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stream-wrap.d.ts","sourceRoot":"","sources":["../src/stream-wrap.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEnE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,yBAAyB,CACvC,GAAG,EAAE,eAAe,GACnB,QAAQ,GAAG,SAAS,CA2BtB"}
|
package/dist/stream-wrap.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { logger } from "./logger.js";
|
|
2
|
-
/**
|
|
3
|
-
* StreamFn wrapper for Runware. Two responsibilities:
|
|
4
|
-
*
|
|
5
|
-
* 1. Strip outgoing params Runware's text-inference endpoint rejects.
|
|
6
|
-
* Runware /v1/chat/completions returns HTTP 400 with
|
|
7
|
-
* "Unsupported use of 'settings.temperature' parameter. This
|
|
8
|
-
* parameter is not supported for text inference" if the request body
|
|
9
|
-
* contains a top-level `temperature`. Openclaw's bundled pi-ai
|
|
10
|
-
* openai-completions builder hardcodes sending temperature whenever a
|
|
11
|
-
* numeric value is configured (see openclaw#32496 — only `temperature`
|
|
12
|
-
* and `maxTokens` are forwarded out of extraParams, and there is no
|
|
13
|
-
* documented `compat` flag to skip it). Deleting the key on the way
|
|
14
|
-
* out is the only surface available to a plugin.
|
|
15
|
-
*
|
|
16
|
-
* 2. Translate cryptic upstream errors into a Runware-prefixed message
|
|
17
|
-
* that openclaw's `surface_error` path will show to the end user in
|
|
18
|
-
* webchat / TUI verbatim. Without this, every Runware 4xx collapses
|
|
19
|
-
* into openclaw's generic "provider rejected the request schema or
|
|
20
|
-
* tool payload" classifier and the actual cause is buried in
|
|
21
|
-
* diagnostics-only logs.
|
|
22
|
-
*/
|
|
23
|
-
export function buildRunwareStreamWrapper(ctx) {
|
|
24
|
-
if (!ctx.streamFn)
|
|
25
|
-
return undefined;
|
|
26
|
-
const inner = ctx.streamFn;
|
|
27
|
-
const modelId = ctx.model?.id;
|
|
28
|
-
return async (params) => {
|
|
29
|
-
if ("temperature" in params) {
|
|
30
|
-
logger.debug("stripping unsupported `temperature` param for Runware request", {
|
|
31
|
-
model: modelId,
|
|
32
|
-
});
|
|
33
|
-
delete params.temperature;
|
|
34
|
-
}
|
|
35
|
-
try {
|
|
36
|
-
return await inner(params);
|
|
37
|
-
}
|
|
38
|
-
catch (err) {
|
|
39
|
-
const raw = err instanceof Error ? err.message : String(err);
|
|
40
|
-
logger.error("Runware inference call failed", {
|
|
41
|
-
model: modelId,
|
|
42
|
-
error: raw,
|
|
43
|
-
});
|
|
44
|
-
// Re-throw with a "Runware:" prefix so the gateway's surface_error
|
|
45
|
-
// path shows the real upstream message to the user instead of the
|
|
46
|
-
// generic classifier text.
|
|
47
|
-
throw new Error(`Runware: ${raw}`);
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
//# sourceMappingURL=stream-wrap.js.map
|
package/dist/stream-wrap.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stream-wrap.js","sourceRoot":"","sources":["../src/stream-wrap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGrC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,yBAAyB,CACvC,GAAoB;IAEpB,IAAI,CAAC,GAAG,CAAC,QAAQ;QAAE,OAAO,SAAS,CAAC;IACpC,MAAM,KAAK,GAAG,GAAG,CAAC,QAAQ,CAAC;IAC3B,MAAM,OAAO,GAAG,GAAG,CAAC,KAAK,EAAE,EAAE,CAAC;IAE9B,OAAO,KAAK,EAAE,MAAM,EAAE,EAAE;QACtB,IAAI,aAAa,IAAI,MAAM,EAAE,CAAC;YAC5B,MAAM,CAAC,KAAK,CAAC,+DAA+D,EAAE;gBAC5E,KAAK,EAAE,OAAO;aACf,CAAC,CAAC;YACH,OAAO,MAAM,CAAC,WAAW,CAAC;QAC5B,CAAC;QAED,IAAI,CAAC;YACH,OAAO,MAAM,KAAK,CAAC,MAAM,CAAC,CAAC;QAC7B,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,GAAG,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YAC7D,MAAM,CAAC,KAAK,CAAC,+BAA+B,EAAE;gBAC5C,KAAK,EAAE,OAAO;gBACd,KAAK,EAAE,GAAG;aACX,CAAC,CAAC;YACH,mEAAmE;YACnE,kEAAkE;YAClE,2BAA2B;YAC3B,MAAM,IAAI,KAAK,CAAC,YAAY,GAAG,EAAE,CAAC,CAAC;QACrC,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
|