@teith/openclaw-runware-provider 0.2.8 → 0.2.10

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.
@@ -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;AAIrE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,QAAA,MAAM,KAAK,EAAE,WAmCZ,CAAC;AAEF,eAAe,KAAK,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAkB,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAQrE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,QAAA,MAAM,KAAK,EAAE,WA+CZ,CAAC;AAEF,eAAe,KAAK,CAAC"}
package/dist/index.js CHANGED
@@ -1,5 +1,9 @@
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
+ // Imported but intentionally not passed to registerProvider in 0.2.10 —
4
+ // see note inside register() below.
5
+ import { buildRunwareStreamWrapper as _buildRunwareStreamWrapper } from "./stream-wrap.js";
6
+ void _buildRunwareStreamWrapper;
3
7
  const PLUGIN_ID = "runware-openclaw-provider";
4
8
  /**
5
9
  * Plugin entry that openclaw's plugin loader invokes after `npm install`-ing
@@ -45,6 +49,18 @@ const entry = {
45
49
  return { provider };
46
50
  },
47
51
  },
52
+ // NOTE: `wrapStreamFn: buildRunwareStreamWrapper` was removed in
53
+ // 0.2.10 — its presence on a catalog-style registerProvider call
54
+ // triggers a TypeError in openclaw 2026.5.18's prompt-assembly
55
+ // path ("Cannot read properties of undefined (reading
56
+ // 'systemPrompt')") before any HTTP request is made. The hook is
57
+ // documented in the provider SDK but is apparently not wired up for
58
+ // providers that expose models via `catalog.run` returning a custom
59
+ // openai-completions provider config. Until we find the correct
60
+ // surface (likely `prepareExtraParams`) or openclaw fixes the
61
+ // lookup, the temperature-strip workaround is parked. Imports of
62
+ // buildRunwareStreamWrapper remain in the build so the helper ships
63
+ // unchanged; just not registered with the host.
48
64
  });
49
65
  api.registerModelCatalogProvider({
50
66
  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;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,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,QAA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AC,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,iEAAiE;YACjE,+DAA+D;YAC/D,sDAAsD;YACtD,iEAAiE;YACjE,oEAAoE;YACpE,oEAAoE;YACpE,gEAAgE;YAChE,8DAA8D;YAC9D,iEAAiE;YACjE,oEAAoE;YACpE,gDAAgD;SACjD,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"}
@@ -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,IAAI,CAAC,CAAC;KACzE,KAAK,IAAI,CAAC;CACZ;AAED,MAAM,WAAW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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.8",
3
+ "version": "0.2.10",
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",