@openclaw/chutes-provider 2026.10.1 → 2026.10.5-beta.1
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/api.js +1 -1
- package/dist/models.js +1 -1
- package/dist/oauth.js +40 -36
- package/dist/onboard.js +1 -1
- package/dist/provider-catalog.js +1 -1
- package/package.json +4 -4
- package/dist/.setup/{models-DUGqZYGQ.mjs → models-gP4ptQtt.mjs} +1 -1
package/dist/api.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as CHUTES_MODEL_CATALOG, r as discoverChutesModels, t as CHUTES_BASE_URL } from "./.setup/models-
|
|
1
|
+
import { n as CHUTES_MODEL_CATALOG, r as discoverChutesModels, t as CHUTES_BASE_URL } from "./.setup/models-gP4ptQtt.mjs";
|
|
2
2
|
import { CHUTES_DEFAULT_MODEL_ID, CHUTES_DEFAULT_MODEL_REF, applyChutesApiKeyConfig, applyChutesConfig, applyChutesProviderConfig } from "./onboard.js";
|
|
3
3
|
import { buildChutesProvider } from "./provider-catalog.js";
|
|
4
4
|
export { CHUTES_BASE_URL, CHUTES_DEFAULT_MODEL_ID, CHUTES_DEFAULT_MODEL_REF, CHUTES_MODEL_CATALOG, applyChutesApiKeyConfig, applyChutesConfig, applyChutesProviderConfig, buildChutesProvider, discoverChutesModels };
|
package/dist/models.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as CHUTES_MODEL_CATALOG, r as discoverChutesModels, t as CHUTES_BASE_URL } from "./.setup/models-
|
|
1
|
+
import { n as CHUTES_MODEL_CATALOG, r as discoverChutesModels, t as CHUTES_BASE_URL } from "./.setup/models-gP4ptQtt.mjs";
|
|
2
2
|
export { CHUTES_BASE_URL, CHUTES_MODEL_CATALOG, discoverChutesModels };
|
package/dist/oauth.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { generatePkceVerifierChallenge } from "openclaw/plugin-sdk/provider-auth";
|
|
2
2
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
3
|
import { randomBytes } from "node:crypto";
|
|
4
|
+
import { withTrustedEnvProxyGuardedFetchMode } from "openclaw/plugin-sdk/fetch-runtime";
|
|
4
5
|
import { resolveExpiresAtMsFromDurationSeconds } from "openclaw/plugin-sdk/number-runtime";
|
|
5
6
|
import { parseOAuthCallbackInput, waitForLocalOAuthCallback } from "openclaw/plugin-sdk/provider-auth-runtime";
|
|
6
7
|
import { assertOkOrThrowProviderError, readProviderJsonResponse } from "openclaw/plugin-sdk/provider-http";
|
|
7
8
|
import { buildOAuthRequestSignal } from "openclaw/plugin-sdk/provider-oauth-runtime";
|
|
9
|
+
import { fetchWithSsrFGuard } from "openclaw/plugin-sdk/ssrf-runtime";
|
|
8
10
|
//#region extensions/chutes/oauth.ts
|
|
9
11
|
const CHUTES_AUTHORIZE_ENDPOINT = "https://api.chutes.ai/idp/authorize";
|
|
10
12
|
const CHUTES_TOKEN_ENDPOINT = "https://api.chutes.ai/idp/token";
|
|
@@ -38,45 +40,53 @@ function resolveChutesExpiresAt(value, now) {
|
|
|
38
40
|
});
|
|
39
41
|
}
|
|
40
42
|
async function requestChutesTokenGrant(params) {
|
|
41
|
-
const response = await (
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
const { response, release } = await fetchWithSsrFGuard(withTrustedEnvProxyGuardedFetchMode({
|
|
44
|
+
url: CHUTES_TOKEN_ENDPOINT,
|
|
45
|
+
init: {
|
|
46
|
+
method: "POST",
|
|
47
|
+
headers: { "Content-Type": "application/x-www-form-urlencoded" },
|
|
48
|
+
body: params.body
|
|
49
|
+
},
|
|
45
50
|
signal: buildOAuthRequestSignal({
|
|
46
51
|
timeoutMs: CHUTES_OAUTH_REQUEST_TIMEOUT_MS,
|
|
47
52
|
...params.signal ? { signal: params.signal } : {}
|
|
48
53
|
})
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
54
|
+
}));
|
|
55
|
+
try {
|
|
56
|
+
await assertOkOrThrowProviderError(response, `${params.responseLabel} failed`);
|
|
57
|
+
const data = await readProviderJsonResponse(response, params.responseLabel);
|
|
58
|
+
const access = normalizeOptionalString(data.access_token);
|
|
59
|
+
const expires = resolveChutesExpiresAt(data.expires_in, params.now ?? Date.now());
|
|
60
|
+
if (!access) throw new Error(`${params.responseLabel} returned no access_token`);
|
|
61
|
+
if (expires === void 0) throw new Error(`${params.responseLabel} returned invalid expires_in`);
|
|
62
|
+
return {
|
|
63
|
+
access,
|
|
64
|
+
refresh: normalizeOptionalString(data.refresh_token),
|
|
65
|
+
expires
|
|
66
|
+
};
|
|
67
|
+
} finally {
|
|
68
|
+
await release();
|
|
69
|
+
}
|
|
61
70
|
}
|
|
62
71
|
async function fetchChutesUserInfo(params) {
|
|
63
|
-
const response = await (
|
|
64
|
-
|
|
72
|
+
const { response, release } = await fetchWithSsrFGuard(withTrustedEnvProxyGuardedFetchMode({
|
|
73
|
+
url: CHUTES_USERINFO_ENDPOINT,
|
|
74
|
+
init: { headers: { Authorization: `Bearer ${params.accessToken}` } },
|
|
65
75
|
signal: buildOAuthRequestSignal({
|
|
66
76
|
timeoutMs: CHUTES_OAUTH_REQUEST_TIMEOUT_MS,
|
|
67
77
|
...params.signal ? { signal: params.signal } : {}
|
|
68
78
|
})
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
79
|
+
}));
|
|
80
|
+
try {
|
|
81
|
+
if (!response.ok) return null;
|
|
82
|
+
const data = await readProviderJsonResponse(response, "Chutes userinfo");
|
|
83
|
+
return data && typeof data === "object" ? data : null;
|
|
84
|
+
} finally {
|
|
85
|
+
await release();
|
|
73
86
|
}
|
|
74
|
-
const data = await readProviderJsonResponse(response, "Chutes userinfo");
|
|
75
|
-
return data && typeof data === "object" ? data : null;
|
|
76
87
|
}
|
|
77
88
|
async function exchangeChutesCodeForTokens(params) {
|
|
78
|
-
const
|
|
79
|
-
const now = params.now ?? Date.now();
|
|
89
|
+
const now = Date.now();
|
|
80
90
|
const body = new URLSearchParams({
|
|
81
91
|
grant_type: "authorization_code",
|
|
82
92
|
client_id: params.app.clientId,
|
|
@@ -88,7 +98,6 @@ async function exchangeChutesCodeForTokens(params) {
|
|
|
88
98
|
const token = await requestChutesTokenGrant({
|
|
89
99
|
body,
|
|
90
100
|
responseLabel: "Chutes token exchange",
|
|
91
|
-
fetchFn,
|
|
92
101
|
now,
|
|
93
102
|
...params.signal ? { signal: params.signal } : {}
|
|
94
103
|
});
|
|
@@ -97,7 +106,6 @@ async function exchangeChutesCodeForTokens(params) {
|
|
|
97
106
|
try {
|
|
98
107
|
info = await fetchChutesUserInfo({
|
|
99
108
|
accessToken: token.access,
|
|
100
|
-
fetchFn,
|
|
101
109
|
...params.signal ? { signal: params.signal } : {}
|
|
102
110
|
});
|
|
103
111
|
} catch (error) {
|
|
@@ -113,7 +121,7 @@ async function exchangeChutesCodeForTokens(params) {
|
|
|
113
121
|
};
|
|
114
122
|
}
|
|
115
123
|
/** Refreshes a stored Chutes OAuth credential through the provider token endpoint. */
|
|
116
|
-
async function refreshChutesOAuthCredential(credential
|
|
124
|
+
async function refreshChutesOAuthCredential(credential) {
|
|
117
125
|
const refreshToken = normalizeOptionalString(credential.refresh);
|
|
118
126
|
if (!refreshToken) throw new Error("Chutes OAuth credential is missing refresh token");
|
|
119
127
|
const clientId = normalizeOptionalString(credential.clientId ?? process.env.CHUTES_CLIENT_ID);
|
|
@@ -127,9 +135,7 @@ async function refreshChutesOAuthCredential(credential, options = {}) {
|
|
|
127
135
|
if (clientSecret) body.set("client_secret", clientSecret);
|
|
128
136
|
const token = await requestChutesTokenGrant({
|
|
129
137
|
body,
|
|
130
|
-
responseLabel: "Chutes token refresh"
|
|
131
|
-
fetchFn: options.fetchFn,
|
|
132
|
-
now: options.now
|
|
138
|
+
responseLabel: "Chutes token refresh"
|
|
133
139
|
});
|
|
134
140
|
return {
|
|
135
141
|
...credential,
|
|
@@ -142,8 +148,7 @@ async function refreshChutesOAuthCredential(credential, options = {}) {
|
|
|
142
148
|
/** Runs Chutes OAuth and returns refreshable stored credentials. */
|
|
143
149
|
async function loginChutes(params) {
|
|
144
150
|
const { verifier, challenge } = generatePkceVerifierChallenge();
|
|
145
|
-
const state =
|
|
146
|
-
const timeoutMs = params.timeoutMs ?? 18e4;
|
|
151
|
+
const state = randomBytes(16).toString("hex");
|
|
147
152
|
const query = new URLSearchParams({
|
|
148
153
|
client_id: params.app.clientId,
|
|
149
154
|
redirect_uri: params.app.redirectUri,
|
|
@@ -167,7 +172,7 @@ async function loginChutes(params) {
|
|
|
167
172
|
const redirect = parseRedirectUri(params.app.redirectUri);
|
|
168
173
|
const callback = waitForLocalOAuthCallback({
|
|
169
174
|
expectedState: state,
|
|
170
|
-
timeoutMs,
|
|
175
|
+
timeoutMs: 18e4,
|
|
171
176
|
port: redirect.port,
|
|
172
177
|
callbackPath: redirect.pathname,
|
|
173
178
|
redirectUri: params.app.redirectUri,
|
|
@@ -188,7 +193,6 @@ async function loginChutes(params) {
|
|
|
188
193
|
app: params.app,
|
|
189
194
|
code: codeAndState.code,
|
|
190
195
|
codeVerifier: verifier,
|
|
191
|
-
fetchFn: params.fetchFn,
|
|
192
196
|
...params.signal ? { signal: params.signal } : {}
|
|
193
197
|
});
|
|
194
198
|
}
|
package/dist/onboard.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as openclaw_plugin_default, n as CHUTES_MODEL_CATALOG, t as CHUTES_BASE_URL } from "./.setup/models-
|
|
1
|
+
import { i as openclaw_plugin_default, n as CHUTES_MODEL_CATALOG, t as CHUTES_BASE_URL } from "./.setup/models-gP4ptQtt.mjs";
|
|
2
2
|
import { readManifestProviderDefaultModelRef } from "openclaw/plugin-sdk/provider-catalog-shared";
|
|
3
3
|
import { applyAgentDefaultModelPrimary, createModelCatalogPresetAppliers } from "openclaw/plugin-sdk/provider-onboard";
|
|
4
4
|
//#region extensions/chutes/onboard.ts
|
package/dist/provider-catalog.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as CHUTES_MODEL_CATALOG, r as discoverChutesModels, t as CHUTES_BASE_URL } from "./.setup/models-
|
|
1
|
+
import { n as CHUTES_MODEL_CATALOG, r as discoverChutesModels, t as CHUTES_BASE_URL } from "./.setup/models-gP4ptQtt.mjs";
|
|
2
2
|
//#region extensions/chutes/provider-catalog.ts
|
|
3
3
|
function buildStaticChutesProvider() {
|
|
4
4
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/chutes-provider",
|
|
3
|
-
"version": "2026.10.1",
|
|
3
|
+
"version": "2026.10.5-beta.1",
|
|
4
4
|
"description": "OpenClaw Chutes.ai provider plugin.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
"minHostVersion": ">=2026.6.8"
|
|
19
19
|
},
|
|
20
20
|
"compat": {
|
|
21
|
-
"pluginApi": ">=2026.10.1"
|
|
21
|
+
"pluginApi": ">=2026.10.5-beta.1"
|
|
22
22
|
},
|
|
23
23
|
"build": {
|
|
24
|
-
"openclawVersion": "2026.10.1",
|
|
24
|
+
"openclawVersion": "2026.10.5-beta.1",
|
|
25
25
|
"bundledDist": false
|
|
26
26
|
},
|
|
27
27
|
"release": {
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"assets/activity.svg"
|
|
41
41
|
],
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"openclaw": ">=2026.10.1"
|
|
43
|
+
"openclaw": ">=2026.10.5-beta.1"
|
|
44
44
|
},
|
|
45
45
|
"peerDependenciesMeta": {
|
|
46
46
|
"openclaw": {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { normalizeChutesModelPricing } from "../pricing-api.js";
|
|
2
2
|
import { buildLiveModelProviderConfig } from "openclaw/plugin-sdk/provider-catalog-live-runtime";
|
|
3
3
|
import { asPositiveSafeInteger, normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
|
-
import { buildManifestModelProviderConfig } from "openclaw/plugin-sdk/provider-catalog-shared";
|
|
5
4
|
import { withTrustedEnvProxyGuardedFetchMode } from "openclaw/plugin-sdk/fetch-runtime";
|
|
6
5
|
import { fetchWithSsrFGuard, ssrfPolicyFromHttpBaseUrlAllowedHostname } from "openclaw/plugin-sdk/ssrf-runtime";
|
|
6
|
+
import { buildManifestModelProviderConfig } from "openclaw/plugin-sdk/provider-catalog-shared";
|
|
7
7
|
//#region extensions/chutes/openclaw.plugin.json
|
|
8
8
|
var openclaw_plugin_default = {
|
|
9
9
|
id: "chutes",
|