@teith/openclaw-runware-provider 0.2.8 → 0.2.9
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/index.d.ts.map +1 -1
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/openclaw-api.d.ts +16 -0
- package/dist/openclaw-api.d.ts.map +1 -1
- package/dist/stream-wrap.d.ts +24 -0
- package/dist/stream-wrap.d.ts.map +1 -0
- package/dist/stream-wrap.js +51 -0
- package/dist/stream-wrap.js.map +1 -0
- package/package.json +1 -1
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAkB,WAAW,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAkB,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAKrE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,QAAA,MAAM,KAAK,EAAE,WAyCZ,CAAC;AAEF,eAAe,KAAK,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { setHostLogger } from "./logger.js";
|
|
2
2
|
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";
|
|
3
4
|
const PLUGIN_ID = "runware-openclaw-provider";
|
|
4
5
|
/**
|
|
5
6
|
* Plugin entry that openclaw's plugin loader invokes after `npm install`-ing
|
|
@@ -45,6 +46,12 @@ const entry = {
|
|
|
45
46
|
return { provider };
|
|
46
47
|
},
|
|
47
48
|
},
|
|
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,
|
|
48
55
|
});
|
|
49
56
|
api.registerModelCatalogProvider({
|
|
50
57
|
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,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,WAAW,EACX,cAAc,EACd,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,cAAc,GACf,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,WAAW,EACX,cAAc,EACd,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,cAAc,GACf,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAE7D,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,IAAI,GAAG,CAAC,MAAM;YAAE,aAAa,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAC1C,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;YACD,iEAAiE;YACjE,8DAA8D;YAC9D,oEAAoE;YACpE,kEAAkE;YAClE,mDAAmD;YACnD,YAAY,EAAE,yBAAyB;SACxC,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
|
@@ -24,6 +24,22 @@ export interface CatalogContext {
|
|
|
24
24
|
* actually call. Other methods (registerMemoryEmbeddingProvider, etc) are
|
|
25
25
|
* available on the underlying object — we just don't type them here.
|
|
26
26
|
*/
|
|
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
|
+
}
|
|
27
43
|
export interface PluginApi {
|
|
28
44
|
logger?: HostLogger;
|
|
29
45
|
registerProvider: (spec: unknown) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openclaw-api.d.ts","sourceRoot":"","sources":["../src/openclaw-api.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,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,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,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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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"}
|
|
@@ -0,0 +1,24 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,51 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teith/openclaw-runware-provider",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.9",
|
|
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",
|