@openclaw/cloudflare-ai-gateway-provider 2026.9.5 → 2026.9.6

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.
Files changed (2) hide show
  1. package/dist/index.js +14 -36
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -3,8 +3,8 @@ import { buildCloudflareAiGatewayCatalogProvider } from "./catalog-provider.js";
3
3
  import { applyCloudflareAiGatewayConnectionConfig, applyCloudflareAiGatewayProviderConnectionConfig } from "./onboard.js";
4
4
  import { wrapCloudflareAiGatewayProviderStream } from "./stream-wrappers.js";
5
5
  import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
6
- import { applyAuthProfileConfig, buildApiKeyCredential, ensureApiKeyFromOptionEnvOrPrompt, ensureAuthProfileStore, listProfilesForProvider, normalizeApiKeyInput, normalizeOptionalSecretInput, validateApiKeyInput } from "openclaw/plugin-sdk/provider-auth";
7
- import { upsertAuthProfileWithLockOrThrow } from "openclaw/plugin-sdk/provider-auth-api-key";
6
+ import { applyAuthProfileConfig, buildApiKeyCredential, ensureAuthProfileStore, listProfilesForProvider, normalizeOptionalSecretInput } from "openclaw/plugin-sdk/provider-auth";
7
+ import { captureProviderApiKey, persistProviderApiKey } from "openclaw/plugin-sdk/provider-auth-api-key";
8
8
  import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
9
9
  //#region extensions/cloudflare-ai-gateway/index.ts
10
10
  /**
@@ -62,36 +62,22 @@ var cloudflare_ai_gateway_default = definePluginEntry({
62
62
  gatewayId: normalizeOptionalSecretInput(ctx.opts?.cloudflareAiGatewayGatewayId),
63
63
  prompter: ctx.prompter
64
64
  });
65
- let capturedSecretInput = "";
66
- let capturedCredential = false;
67
- let capturedMode;
68
- await ensureApiKeyFromOptionEnvOrPrompt({
65
+ const { input, mode } = await captureProviderApiKey(ctx, {
69
66
  token: normalizeOptionalSecretInput(ctx.opts?.cloudflareAiGatewayApiKey),
70
67
  tokenProvider: "cloudflare-ai-gateway",
71
- secretInputMode: ctx.allowSecretRefPrompt === false ? ctx.secretInputMode ?? "plaintext" : ctx.secretInputMode,
72
- config: ctx.config,
73
- workspaceDir: ctx.workspaceDir,
74
68
  expectedProviders: [PROVIDER_ID],
75
69
  provider: PROVIDER_ID,
76
70
  envLabel: PROVIDER_ENV_VAR,
77
71
  promptMessage: "Enter Cloudflare AI Gateway API key",
78
- normalize: normalizeApiKeyInput,
79
- validate: validateApiKeyInput,
80
- prompter: ctx.prompter,
81
- setCredential: async (apiKey, mode) => {
82
- capturedSecretInput = apiKey;
83
- capturedCredential = true;
84
- capturedMode = mode;
85
- }
72
+ missingInputMessage: "Missing Cloudflare AI Gateway API key."
86
73
  });
87
- if (!capturedCredential) throw new Error("Missing Cloudflare AI Gateway API key.");
88
74
  return {
89
75
  profiles: [{
90
76
  profileId: PROFILE_ID,
91
- credential: buildApiKeyCredential(PROVIDER_ID, capturedSecretInput ?? "", {
77
+ credential: buildApiKeyCredential(PROVIDER_ID, input, {
92
78
  accountId: metadata.accountId,
93
79
  gatewayId: metadata.gatewayId
94
- }, capturedMode ? { secretInputMode: capturedMode } : void 0)
80
+ }, mode ? { secretInputMode: mode } : void 0)
95
81
  }],
96
82
  configPatch: applyCloudflareAiGatewayProviderConnectionConfig(ctx.config, metadata),
97
83
  defaultModel: CLOUDFLARE_AI_GATEWAY_DEFAULT_MODEL_REF
@@ -117,22 +103,14 @@ var cloudflare_ai_gateway_default = definePluginEntry({
117
103
  envVar: PROVIDER_ENV_VAR
118
104
  });
119
105
  if (!resolved) return null;
120
- if (resolved.source !== "profile") {
121
- const credential = ctx.toApiKeyCredential({
122
- provider: PROVIDER_ID,
123
- resolved,
124
- metadata: {
125
- accountId,
126
- gatewayId
127
- }
128
- });
129
- if (!credential) return null;
130
- await upsertAuthProfileWithLockOrThrow({
131
- profileId: PROFILE_ID,
132
- credential,
133
- agentDir: ctx.agentDir
134
- });
135
- }
106
+ if (!await persistProviderApiKey(ctx, PROFILE_ID, {
107
+ provider: PROVIDER_ID,
108
+ resolved,
109
+ metadata: {
110
+ accountId,
111
+ gatewayId
112
+ }
113
+ })) return null;
136
114
  const next = applyAuthProfileConfig(ctx.config, {
137
115
  profileId: PROFILE_ID,
138
116
  provider: PROVIDER_ID,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openclaw/cloudflare-ai-gateway-provider",
3
- "version": "2026.9.5",
3
+ "version": "2026.9.6",
4
4
  "description": "OpenClaw Cloudflare AI Gateway 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.9.5"
21
+ "pluginApi": ">=2026.9.6"
22
22
  },
23
23
  "build": {
24
- "openclawVersion": "2026.9.5",
24
+ "openclawVersion": "2026.9.6",
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.9.5"
43
+ "openclaw": ">=2026.9.6"
44
44
  },
45
45
  "peerDependenciesMeta": {
46
46
  "openclaw": {