@teith/openclaw-runware-provider 0.2.7 → 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/README.md +87 -69
- package/dist/catalog.d.ts.map +1 -1
- package/dist/catalog.js +10 -1
- package/dist/catalog.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -1
- package/dist/logger.d.ts +33 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +68 -0
- package/dist/logger.js.map +1 -0
- package/dist/openclaw-api.d.ts +18 -0
- package/dist/openclaw-api.d.ts.map +1 -1
- package/dist/provider-discovery.d.ts.map +1 -1
- package/dist/provider-discovery.js +15 -2
- package/dist/provider-discovery.js.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 +2 -7
- package/dist/types.d.ts +0 -2
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -2
- package/dist/types.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,102 +1,120 @@
|
|
|
1
|
-
#
|
|
1
|
+
# openclaw-runware-provider
|
|
2
2
|
|
|
3
|
-
OpenClaw
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
OpenClaw plugin that wires Runware (a unified OpenAI-compatible endpoint
|
|
4
|
+
proxying Claude, GPT, Gemini, Qwen, GLM, MiniMax, Kimi, Gemma, …) into
|
|
5
|
+
OpenClaw as a first-class provider. Published as
|
|
6
|
+
`@teith/openclaw-runware-provider` on npm.
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
The plugin is the inference contract between the Runware-hosted managed
|
|
9
|
+
OpenClaw service (driven by [openclaw-manager][manager]) and the OpenClaw
|
|
10
|
+
gateway running inside each per-tenant pod. The manager installs this
|
|
11
|
+
package into the pod via `OpenClawInstance.spec.plugins`; the plugin
|
|
12
|
+
discovers the model catalog live from `GET /v1/models` on every gateway
|
|
13
|
+
start.
|
|
8
14
|
|
|
9
|
-
|
|
10
|
-
openclaw plugins install git:github.com/runware/openclaw-provider@v0.1.0
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
Set your API key:
|
|
15
|
+
[manager]: https://github.com/runware/openclaw-manager
|
|
14
16
|
|
|
15
|
-
|
|
16
|
-
export RUNWARE_API_KEY=...your key...
|
|
17
|
-
```
|
|
17
|
+
## Configuration
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
The plugin is configured entirely through environment variables — no
|
|
20
|
+
config file, no CLI onboarding step. The managed deployment injects these
|
|
21
|
+
from a per-instance Kubernetes Secret; for local development, export them
|
|
22
|
+
in the shell before launching the gateway.
|
|
23
|
+
|
|
24
|
+
| Variable | Required | Default | Purpose |
|
|
25
|
+
|--------------------|----------|-------------------------------|------------------------------------------------------------------|
|
|
26
|
+
| `RUNWARE_API_KEY` | yes | — | Bearer token used for `/v1/models` and inference |
|
|
27
|
+
| `RUNWARE_BASE_URL` | no | `https://api.runware.ai/v1` | Endpoint override (e.g. `https://api.runware.dev/v1` for staging) |
|
|
28
|
+
|
|
29
|
+
`RUNWARE_API_KEY` resolution prefers `process.env` over openclaw's
|
|
30
|
+
runtime `resolveProviderApiKey(...)` — env is the source of truth in
|
|
31
|
+
the managed deployment, and openclaw's resolver can return stale values
|
|
32
|
+
from internal credential caches.
|
|
33
|
+
|
|
34
|
+
## What the plugin does
|
|
35
|
+
|
|
36
|
+
- Registers `runware` as an OpenAI-compatible provider in OpenClaw via
|
|
37
|
+
the `providerCatalogEntry` manifest hook (the surface openclaw
|
|
38
|
+
2026.5.x actually calls; mirrors the bundled `ollama` plugin).
|
|
39
|
+
- Fetches `/v1/models` on every catalog resolution. TTL-cached for 5
|
|
40
|
+
minutes; concurrent requests are deduplicated; the last-known-good
|
|
41
|
+
catalog is served on transient upstream failures.
|
|
42
|
+
- Injects `extra_body: { reasoning_effort: "high" }` into every chat
|
|
43
|
+
completions request so reasoning-capable models stream thinking content.
|
|
21
44
|
|
|
22
|
-
|
|
23
|
-
openclaw models auth login --provider runware
|
|
24
|
-
```
|
|
45
|
+
## Logging
|
|
25
46
|
|
|
26
|
-
|
|
27
|
-
|
|
47
|
+
The plugin emits structured log lines prefixed with
|
|
48
|
+
`[runware-openclaw-provider]` on these conditions:
|
|
28
49
|
|
|
29
|
-
|
|
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 |
|
|
30
56
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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.
|
|
35
64
|
|
|
36
|
-
|
|
65
|
+
To follow plugin output in a running managed deployment:
|
|
37
66
|
|
|
38
67
|
```bash
|
|
39
|
-
|
|
40
|
-
export RUNWARE_BASE_URL=https://api.runware.dev/v1
|
|
41
|
-
export RUNWARE_API_KEY=...dev key...
|
|
42
|
-
openclaw models auth login --provider runware
|
|
43
|
-
|
|
44
|
-
# prod (unset override)
|
|
45
|
-
unset RUNWARE_BASE_URL
|
|
46
|
-
export RUNWARE_API_KEY=...prod key...
|
|
47
|
-
openclaw models auth login --provider runware
|
|
68
|
+
openclaw logs --follow | grep runware-openclaw-provider
|
|
48
69
|
```
|
|
49
70
|
|
|
50
|
-
## What this plugin does
|
|
51
|
-
|
|
52
|
-
- Registers `runware` as an OpenAI-compatible provider in OpenClaw.
|
|
53
|
-
- Discovers the model catalog live from `GET /v1/models` on registration.
|
|
54
|
-
TTL-cached for 5 minutes; last-known-good on transient failures.
|
|
55
|
-
- Injects `extra_body: { reasoning_effort: "high" }` into every chat
|
|
56
|
-
completions request, so reasoning-capable models stream thinking content.
|
|
57
|
-
|
|
58
71
|
## Architecture
|
|
59
72
|
|
|
60
|
-
|
|
73
|
+
```
|
|
74
|
+
src/
|
|
75
|
+
├── index.ts plugin entry — register(api) callback
|
|
76
|
+
├── provider-discovery.ts default export consumed by providerCatalogEntry
|
|
77
|
+
├── models.ts shared model-building primitives + env resolution
|
|
78
|
+
├── catalog.ts TTL-cached /v1/models fetcher with dedup
|
|
79
|
+
└── openclaw-api.ts local type stubs for the openclaw runtime API
|
|
80
|
+
```
|
|
61
81
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
82
|
+
`models.ts` is the single source of truth. Both `index.ts`
|
|
83
|
+
(`register(api)` flow, declared but currently not invoked by openclaw
|
|
84
|
+
2026.5.x for external plugins) and `provider-discovery.ts`
|
|
85
|
+
(`providerCatalogEntry` flow, the one openclaw actually calls) share its
|
|
86
|
+
`resolveApiKey`, `resolveBaseUrl`, `buildProvider`, and
|
|
87
|
+
`buildCatalogRows` helpers — so the picker catalog and the inference
|
|
88
|
+
provider always reflect the same `/v1/models` snapshot.
|
|
66
89
|
|
|
67
|
-
|
|
68
|
-
the
|
|
90
|
+
The plugin does not import from the `openclaw` npm package at runtime;
|
|
91
|
+
the API surface is described locally in `openclaw-api.ts`.
|
|
69
92
|
|
|
70
93
|
## Development
|
|
71
94
|
|
|
72
95
|
```bash
|
|
73
96
|
pnpm install
|
|
74
|
-
pnpm test
|
|
97
|
+
pnpm test # vitest, 24 tests
|
|
75
98
|
pnpm typecheck
|
|
76
|
-
pnpm build
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
Local install for testing:
|
|
80
|
-
|
|
81
|
-
```bash
|
|
82
|
-
openclaw plugins install -l /absolute/path/to/this/repo
|
|
99
|
+
pnpm build # tsc → ./dist
|
|
83
100
|
```
|
|
84
101
|
|
|
85
|
-
|
|
86
|
-
|
|
102
|
+
`dist/` is committed to git and shipped in the npm tarball because
|
|
103
|
+
openclaw installs plugins with `npm install --ignore-scripts` and cannot
|
|
104
|
+
run a build step inside the operator's init container.
|
|
87
105
|
|
|
88
106
|
## Release
|
|
89
107
|
|
|
90
108
|
```bash
|
|
91
|
-
pnpm test && pnpm build
|
|
92
|
-
|
|
93
|
-
git
|
|
109
|
+
pnpm test && pnpm clean && pnpm build
|
|
110
|
+
# bump version in package.json
|
|
111
|
+
git commit -am "Release vX.Y.Z"
|
|
112
|
+
git tag vX.Y.Z
|
|
94
113
|
git push origin main --tags
|
|
114
|
+
npm publish --access public
|
|
95
115
|
```
|
|
96
116
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
MIT
|
|
117
|
+
Bumping the version requires a matching bump of `cfg.plugin_package` in
|
|
118
|
+
[openclaw-manager][manager]/`src/openclaw_manager/config.py` (and the
|
|
119
|
+
chart values) — the manager pins to an exact version so the install is
|
|
120
|
+
reproducible across instances.
|
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":"AAiBA,wBAAsB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAkCtF;AAwBD,wBAAgB,UAAU,IAAI,IAAI,CAGjC"}
|
package/dist/catalog.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { logger } from "./logger.js";
|
|
1
2
|
const CACHE_TTL_MS = 5 * 60 * 1000;
|
|
2
3
|
const FETCH_TIMEOUT_MS = 5000;
|
|
3
4
|
let cache = null;
|
|
@@ -16,8 +17,16 @@ export async function fetchModelIds(baseUrl, apiKey) {
|
|
|
16
17
|
return ids;
|
|
17
18
|
}
|
|
18
19
|
catch (err) {
|
|
19
|
-
|
|
20
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
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
|
+
});
|
|
20
27
|
return cache.modelIds;
|
|
28
|
+
}
|
|
29
|
+
logger.error("upstream /v1/models fetch failed and no cached catalog is available", { baseUrl, error: message });
|
|
21
30
|
throw err;
|
|
22
31
|
}
|
|
23
32
|
finally {
|
package/dist/catalog.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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,IA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CAAC,IAAI,EAAE,CAAmB,CAAC;QAClD,OAAO,CAAC,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC;aACrB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;aACpD,MAAM,CAAC,CAAC,EAAE,EAAgB,EAAE,CAAC,EAAE,KAAK,IAAI,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAChE,CAAC;YAAS,CAAC;QACT,YAAY,CAAC,OAAO,CAAC,CAAC;IACxB,CAAC;AACH,CAAC;AAED,MAAM,UAAU,UAAU;IACxB,KAAK,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":"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,4 +1,6 @@
|
|
|
1
|
+
import { setHostLogger } from "./logger.js";
|
|
1
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";
|
|
2
4
|
const PLUGIN_ID = "runware-openclaw-provider";
|
|
3
5
|
/**
|
|
4
6
|
* Plugin entry that openclaw's plugin loader invokes after `npm install`-ing
|
|
@@ -26,6 +28,8 @@ const entry = {
|
|
|
26
28
|
name: PROVIDER_LABEL,
|
|
27
29
|
description: "Runware — unified OpenAI-compatible access to Claude, GPT, Gemini, Qwen, GLM, MiniMax, Kimi, and Gemma.",
|
|
28
30
|
register(api) {
|
|
31
|
+
if (api.logger)
|
|
32
|
+
setHostLogger(api.logger);
|
|
29
33
|
api.registerProvider({
|
|
30
34
|
id: PROVIDER_ID,
|
|
31
35
|
label: PROVIDER_LABEL,
|
|
@@ -42,6 +46,12 @@ const entry = {
|
|
|
42
46
|
return { provider };
|
|
43
47
|
},
|
|
44
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,
|
|
45
55
|
});
|
|
46
56
|
api.registerModelCatalogProvider({
|
|
47
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,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,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,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/logger.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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,CAAC;AACd,CAAC;AAED,SAAS,aAAa,CAAC,IAA6B;IAClD,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,uBAAuB,CAAC;IACjC,CAAC;AACH,CAAC;AAED,SAAS,MAAM,CAAC,OAAe,EAAE,IAA8B;IAC7D,IAAI,CAAC,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,GAAG,MAAM,IAAI,OAAO,EAAE,CAAC;IAC3E,OAAO,GAAG,MAAM,IAAI,OAAO,IAAI,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC;AACvD,CAAC;AAED,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,KAAK,CAAC,OAAe,EAAE,IAA8B;QACnD,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QACnC,IAAI,IAAI;YAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;;YACtB,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC;IACD,IAAI,CAAC,OAAe,EAAE,IAA8B;QAClD,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QACnC,IAAI,IAAI;YAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;;YACrB,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IACD,IAAI,CAAC,OAAe,EAAE,IAA8B;QAClD,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QACnC,IAAI,IAAI;YAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;;YACrB,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IACD,KAAK,CAAC,OAAe,EAAE,IAA8B;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/openclaw-api.d.ts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
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";
|
|
8
9
|
import type { ModelCatalogRow } from "./models.js";
|
|
9
10
|
/**
|
|
10
11
|
* Context passed to plugin hooks (`registerProvider.catalog.run`,
|
|
@@ -23,7 +24,24 @@ export interface CatalogContext {
|
|
|
23
24
|
* actually call. Other methods (registerMemoryEmbeddingProvider, etc) are
|
|
24
25
|
* available on the underlying object — we just don't type them here.
|
|
25
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
|
+
}
|
|
26
43
|
export interface PluginApi {
|
|
44
|
+
logger?: HostLogger;
|
|
27
45
|
registerProvider: (spec: unknown) => void;
|
|
28
46
|
registerModelCatalogProvider: (spec: {
|
|
29
47
|
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,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,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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":"AACA,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,CA4BxF;AAED,QAAA,MAAM,wBAAwB;;;;;;;;;;CAU7B,CAAC;AAEF,eAAe,wBAAwB,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { logger } from "./logger.js";
|
|
1
2
|
import { API_KEY_ENV_VAR, BASE_URL_ENV_VAR, DEFAULT_BASE_URL, PROVIDER_ID, PROVIDER_LABEL, buildProvider, resolveApiKey, resolveBaseUrl, } from "./models.js";
|
|
2
3
|
function emptyProvider(baseUrl) {
|
|
3
4
|
return {
|
|
@@ -16,9 +17,21 @@ async function runwareCatalogRun(ctx) {
|
|
|
16
17
|
// an empty provider shape so openclaw treats the catalog as "known but
|
|
17
18
|
// currently unpopulated" rather than crashing. The next invocation will
|
|
18
19
|
// re-resolve and fill in models once the key is present.
|
|
19
|
-
if (!apiKey)
|
|
20
|
+
if (!apiKey) {
|
|
21
|
+
logger.warn(`${API_KEY_ENV_VAR} is not set — returning an empty Runware catalog`, { baseUrl });
|
|
20
22
|
return { provider: emptyProvider(baseUrl) };
|
|
21
|
-
|
|
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
|
+
}
|
|
22
35
|
}
|
|
23
36
|
const runwareProviderDiscovery = {
|
|
24
37
|
id: PROVIDER_ID,
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
1
|
+
{"version":3,"file":"provider-discovery.js","sourceRoot":"","sources":["../src/provider-discovery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,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,EAAE,CAAC;QACZ,MAAM,CAAC,IAAI,CACT,GAAG,eAAe,kDAAkD,EACpE,EAAE,OAAO,EAAE,CACZ,CAAC;QACF,OAAO,EAAE,QAAQ,EAAE,aAAa,CAAC,OAAO,CAAC,EAAE,CAAC;IAC9C,CAAC;IACD,IAAI,CAAC;QACH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;IAC5D,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,uEAAuE;QACvE,sEAAsE;QACtE,uEAAuE;QACvE,0DAA0D;QAC1D,MAAM,CAAC,KAAK,CACV,qEAAqE,EACrE,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CACrE,CAAC;QACF,OAAO,EAAE,QAAQ,EAAE,aAAa,CAAC,OAAO,CAAC,EAAE,CAAC;IAC9C,CAAC;AACH,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"}
|
|
@@ -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",
|
|
@@ -17,8 +17,7 @@
|
|
|
17
17
|
"files": [
|
|
18
18
|
"dist",
|
|
19
19
|
"openclaw.plugin.json",
|
|
20
|
-
"README.md"
|
|
21
|
-
"LICENSE"
|
|
20
|
+
"README.md"
|
|
22
21
|
],
|
|
23
22
|
"scripts": {
|
|
24
23
|
"build": "tsc -p tsconfig.build.json",
|
|
@@ -38,10 +37,6 @@
|
|
|
38
37
|
"runware"
|
|
39
38
|
]
|
|
40
39
|
},
|
|
41
|
-
"repository": {
|
|
42
|
-
"type": "git",
|
|
43
|
-
"url": "https://github.com/runware/openclaw-provider.git"
|
|
44
|
-
},
|
|
45
40
|
"keywords": [
|
|
46
41
|
"openclaw",
|
|
47
42
|
"openclaw-plugin",
|
package/dist/types.d.ts
DELETED
package/dist/types.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAGA,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/types.js
DELETED
package/dist/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|