dsh-coding-subscription-oauth 0.6.4 → 0.6.5
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/CHANGELOG.md +280 -255
- package/CONTRIBUTING.md +138 -129
- package/INSTALL.md +256 -255
- package/LICENSE +19 -19
- package/NOTICE +11 -11
- package/README.de.md +303 -303
- package/README.es.md +304 -304
- package/README.fr.md +304 -304
- package/README.ja.md +304 -304
- package/README.ko.md +304 -304
- package/README.md +320 -320
- package/README.pt-BR.md +304 -304
- package/README.ru.md +304 -304
- package/README.zh-CN.md +318 -318
- package/compatibility/dsh-bom.json +30 -30
- package/cordis.patch.yml +13 -13
- package/docs/00-project-rules.md +212 -212
- package/docs/02-architecture.md +141 -137
- package/docs/02-architecture.zh-CN.md +141 -137
- package/lib/bin.js.map +1 -1
- package/lib/client.js +1 -1
- package/lib/client.js.map +1 -1
- package/lib/gateway-protocol.d.ts +3 -46
- package/lib/gateway-protocol.d.ts.map +1 -1
- package/lib/gateway-routes.d.ts.map +1 -1
- package/lib/grok-errors.d.ts +2 -12
- package/lib/grok-errors.d.ts.map +1 -1
- package/lib/grok-imagine/client.d.ts +73 -0
- package/lib/grok-imagine/client.d.ts.map +1 -0
- package/lib/grok-imagine/index.d.ts +8 -0
- package/lib/grok-imagine/index.d.ts.map +1 -0
- package/lib/grok-imagine/net.d.ts +10 -0
- package/lib/grok-imagine/net.d.ts.map +1 -0
- package/lib/grok-imagine/parse.d.ts +20 -0
- package/lib/grok-imagine/parse.d.ts.map +1 -0
- package/lib/grok-imagine/types.d.ts +191 -0
- package/lib/grok-imagine/types.d.ts.map +1 -0
- package/lib/grok-imagine.d.ts +3 -263
- package/lib/grok-imagine.d.ts.map +1 -1
- package/lib/http-json.d.ts +2 -9
- package/lib/http-json.d.ts.map +1 -1
- package/lib/index.js +57 -37
- package/lib/index.js.map +4 -4
- package/lib/invariant.js.map +1 -1
- package/lib/kimi-errors.d.ts +2 -12
- package/lib/kimi-errors.d.ts.map +1 -1
- package/lib/runtime/gateway-protocol.d.ts +47 -0
- package/lib/runtime/gateway-protocol.d.ts.map +1 -0
- package/lib/runtime/grok-errors.d.ts +13 -0
- package/lib/runtime/grok-errors.d.ts.map +1 -0
- package/lib/runtime/http-json.d.ts +10 -0
- package/lib/runtime/http-json.d.ts.map +1 -0
- package/lib/runtime/kimi-errors.d.ts +13 -0
- package/lib/runtime/kimi-errors.d.ts.map +1 -0
- package/media/en/settings_accounts.png +0 -0
- package/media/en/settings_capabilities.png +0 -0
- package/media/en/settings_gateway.png +0 -0
- package/media/settings_accounts.png +0 -0
- package/media/settings_capabilities.png +0 -0
- package/media/settings_gateway.png +0 -0
- package/media/settings_overview.png +0 -0
- package/media/zh-CN/settings_accounts.png +0 -0
- package/media/zh-CN/settings_capabilities.png +0 -0
- package/media/zh-CN/settings_gateway.png +0 -0
- package/package.json +225 -220
- package/patches/dsh-agy@0.1.2.patch +25 -25
- package/scripts/release.mjs +187 -186
- package/scripts/smoke-deployed-routes.mjs +146 -146
- package/scripts/verify-deployed-catalog.mjs +87 -87
- package/src/adapter.ts +0 -348
- package/src/alias-adapter.ts +0 -147
- package/src/auth-routes.ts +0 -921
- package/src/auth.ts +0 -67
- package/src/bin.ts +0 -350
- package/src/capability-routes.ts +0 -279
- package/src/capability-runtime.ts +0 -314
- package/src/capability-settings.ts +0 -671
- package/src/capability-tools.ts +0 -685
- package/src/catalog.ts +0 -271
- package/src/client/GrokBuildSettings.tsx +0 -771
- package/src/client/api.ts +0 -88
- package/src/client/components/AboutTab.tsx +0 -30
- package/src/client/components/AccountsTab.tsx +0 -241
- package/src/client/components/Badge.tsx +0 -33
- package/src/client/components/CapabilitiesTab.tsx +0 -265
- package/src/client/components/CliPullPreview.tsx +0 -116
- package/src/client/components/CopyButton.tsx +0 -57
- package/src/client/components/GatewayTab.tsx +0 -469
- package/src/client/components/NoticeBanner.tsx +0 -46
- package/src/client/components/ProgressBar.tsx +0 -53
- package/src/client/components/ProviderCard.tsx +0 -606
- package/src/client/components/SettingsTabs.tsx +0 -75
- package/src/client/components/ToggleSwitch.tsx +0 -71
- package/src/client/constants.ts +0 -230
- package/src/client/display.ts +0 -61
- package/src/client/dshClientAdapter.ts +0 -127
- package/src/client/gatewaySnippets.ts +0 -37
- package/src/client/index.tsx +0 -156
- package/src/client/locales.ts +0 -540
- package/src/client/microStyles.ts +0 -52
- package/src/client/parsers.ts +0 -398
- package/src/client/styles.ts +0 -325
- package/src/client/types.ts +0 -199
- package/src/codex-http.ts +0 -447
- package/src/codex-images.ts +0 -503
- package/src/codex-model-capabilities.ts +0 -320
- package/src/codex-search.ts +0 -245
- package/src/codex-usage.ts +0 -263
- package/src/compatibility.ts +0 -55
- package/src/dsh-host-adapter.ts +0 -173
- package/src/gateway-anthropic-messages.ts +0 -84
- package/src/gateway-auth.ts +0 -102
- package/src/gateway-backend.ts +0 -274
- package/src/gateway-body.ts +0 -49
- package/src/gateway-config.ts +0 -76
- package/src/gateway-http.ts +0 -104
- package/src/gateway-openai-chat.ts +0 -124
- package/src/gateway-openai-responses.ts +0 -53
- package/src/gateway-parse.ts +0 -224
- package/src/gateway-protocol.ts +0 -52
- package/src/gateway-routes.ts +0 -158
- package/src/gateway.ts +0 -258
- package/src/grok-errors.ts +0 -24
- package/src/grok-imagine.ts +0 -1627
- package/src/grok-import.ts +0 -151
- package/src/http-json.ts +0 -82
- package/src/ids.ts +0 -59
- package/src/imagine-routes.ts +0 -463
- package/src/index.ts +0 -735
- package/src/invariant.ts +0 -17
- package/src/kimi-errors.ts +0 -26
- package/src/media-store.ts +0 -927
- package/src/oauth-import-routes.ts +0 -324
- package/src/oauth-providers.ts +0 -152
- package/src/oauth-session.ts +0 -183
- package/src/oauth-sources.ts +0 -1104
- package/src/oauth.ts +0 -620
- package/src/provider.ts +0 -128
- package/src/proxy.ts +0 -11
- package/src/redact.ts +0 -72
- package/src/session.ts +0 -218
- package/src/store.ts +0 -217
- package/src/web-origin.ts +0 -296
- package/src/web-routes.ts +0 -38
package/lib/grok-imagine.d.ts
CHANGED
|
@@ -5,267 +5,7 @@
|
|
|
5
5
|
* a signed upstream URL.
|
|
6
6
|
* @module dsh-coding-subscription-oauth/grok-imagine
|
|
7
7
|
*/
|
|
8
|
-
|
|
9
|
-
export
|
|
10
|
-
export
|
|
11
|
-
export declare const GROK_IMAGINE_VIDEO_START_PATH = "/v1/videos/generations";
|
|
12
|
-
export declare const GROK_IMAGINE_IMAGE_MODEL = "grok-imagine-image-2.0";
|
|
13
|
-
export declare const GROK_IMAGINE_VIDEO_MODEL = "grok-imagine-video-1.5";
|
|
14
|
-
export declare const GROK_IMAGINE_IMAGE_TOOL = "grok_imagine_image";
|
|
15
|
-
export declare const GROK_IMAGINE_VIDEO_TOOL = "grok_imagine_video";
|
|
16
|
-
export declare const GROK_IMAGINE_VIDEO_STATUS_TOOL = "grok_imagine_video_status";
|
|
17
|
-
export declare const IMAGINE_IMAGE_ROUTE_PREFIX = "/plugins/dsh-grok-build/imagine/images/";
|
|
18
|
-
/** Frozen xAI output hosts. Callers cannot widen this list. */
|
|
19
|
-
export declare const XAI_OUTPUT_HOSTS: readonly ["imgen.x.ai", "videogen.x.ai", "vidgen.x.ai"];
|
|
20
|
-
export declare const IMAGINE_IMAGE_RESOLUTIONS: readonly ["1k", "2k"];
|
|
21
|
-
export declare const IMAGINE_VIDEO_RESOLUTIONS: readonly ["480p", "720p", "1080p"];
|
|
22
|
-
export declare const IMAGINE_IMAGE_ASPECT_RATIOS: readonly ["1:1", "3:4", "4:3", "9:16", "16:9", "2:3", "3:2", "9:19.5", "19.5:9", "9:20", "20:9", "1:2", "2:1", "auto"];
|
|
23
|
-
export declare const IMAGINE_VIDEO_ASPECT_RATIOS: readonly ["1:1", "16:9", "9:16", "4:3", "3:4", "3:2", "2:3"];
|
|
24
|
-
export declare const IMAGINE_VIDEO_MIN_DURATION_SECONDS = 1;
|
|
25
|
-
export declare const IMAGINE_VIDEO_MAX_DURATION_SECONDS = 15;
|
|
26
|
-
export declare const IMAGINE_IMAGE_MAX_N = 10;
|
|
27
|
-
/**
|
|
28
|
-
* Hard ceilings enforced both at the tool boundary (consumer guard) and inside
|
|
29
|
-
* the Imagine client (defence-in-depth). The prompt ceiling uses UTF-16 code
|
|
30
|
-
* units because that is what the JSON wire format bounds; the image-id arrays
|
|
31
|
-
* are bounded so a runaway caller cannot exhaust the bounded body reader.
|
|
32
|
-
*/
|
|
33
|
-
export declare const IMAGINE_PROMPT_MAX_LENGTH = 4000;
|
|
34
|
-
export declare const IMAGINE_IMAGE_IDS_MIN = 1;
|
|
35
|
-
export declare const IMAGINE_IMAGE_IDS_MAX = 5;
|
|
36
|
-
export declare const DEFAULT_IMAGE_DOWNLOAD_MAX_BYTES: number;
|
|
37
|
-
export declare const DEFAULT_API_TIMEOUT_MS = 30000;
|
|
38
|
-
export declare const DEFAULT_IMAGE_DOWNLOAD_TIMEOUT_MS = 15000;
|
|
39
|
-
export declare const DEFAULT_VIDEO_DOWNLOAD_TIMEOUT_MS = 60000;
|
|
40
|
-
export declare const DEFAULT_MAX_REDIRECTS = 3;
|
|
41
|
-
export declare const DEFAULT_API_JSON_MAX_BYTES: number;
|
|
42
|
-
export declare const MAX_CACHED_VIDEO_JOBS = 256;
|
|
43
|
-
export type ImagineOperation = "image.generate" | "video.start" | "video.status";
|
|
44
|
-
export type ImagineImageResolution = (typeof IMAGINE_IMAGE_RESOLUTIONS)[number];
|
|
45
|
-
export type ImagineVideoResolution = (typeof IMAGINE_VIDEO_RESOLUTIONS)[number];
|
|
46
|
-
export type ImagineImageAspectRatio = (typeof IMAGINE_IMAGE_ASPECT_RATIOS)[number];
|
|
47
|
-
export type ImagineVideoAspectRatio = (typeof IMAGINE_VIDEO_ASPECT_RATIOS)[number];
|
|
48
|
-
export type ImagineApiKeyResolver = (operation: ImagineOperation) => Promise<string>;
|
|
49
|
-
export type ImagineFetch = (input: string | URL, init?: RequestInit) => Promise<Response>;
|
|
50
|
-
export type ImagineDnsLookup = (hostname: string) => Promise<readonly string[]>;
|
|
51
|
-
export type ImagineImageMediaType = "image/png" | "image/jpeg" | "image/webp" | "image/gif";
|
|
52
|
-
export interface ImagineMediaHopRequest {
|
|
53
|
-
timeoutMs: number;
|
|
54
|
-
maxBytes: number;
|
|
55
|
-
accept: string;
|
|
56
|
-
signal?: AbortSignal;
|
|
57
|
-
}
|
|
58
|
-
export interface ImagineMediaHop {
|
|
59
|
-
status: number;
|
|
60
|
-
location?: string;
|
|
61
|
-
contentType?: string;
|
|
62
|
-
data?: Uint8Array;
|
|
63
|
-
}
|
|
64
|
-
/** Single-hop GET. Must not follow redirects or attach credentials. */
|
|
65
|
-
export interface ImagineMediaTransport {
|
|
66
|
-
get(url: URL, request: ImagineMediaHopRequest): Promise<ImagineMediaHop>;
|
|
67
|
-
}
|
|
68
|
-
export interface ImagineDownloadRequest {
|
|
69
|
-
url: string;
|
|
70
|
-
timeoutMs: number;
|
|
71
|
-
maxBytes: number;
|
|
72
|
-
accept: string;
|
|
73
|
-
signal?: AbortSignal;
|
|
74
|
-
}
|
|
75
|
-
export interface ImagineDownloadResult {
|
|
76
|
-
data: Uint8Array;
|
|
77
|
-
contentType?: string;
|
|
78
|
-
}
|
|
79
|
-
/** Full download including redirect revalidation. Production default is pinned. */
|
|
80
|
-
export interface ImagineDownloader {
|
|
81
|
-
download(request: ImagineDownloadRequest): Promise<ImagineDownloadResult>;
|
|
82
|
-
}
|
|
83
|
-
export type GrokImagineErrorCode = "MISSING_CREDENTIAL" | "AUTH" | "QUOTA" | "RATE_LIMIT" | "SSRF" | "INVALID_INPUT" | "UPSTREAM" | "TIMEOUT" | "MEDIA";
|
|
84
|
-
export declare class GrokImagineError extends Error {
|
|
85
|
-
readonly code: GrokImagineErrorCode;
|
|
86
|
-
readonly status?: number;
|
|
87
|
-
constructor(code: GrokImagineErrorCode, message: string, options?: {
|
|
88
|
-
cause?: unknown;
|
|
89
|
-
status?: number;
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
export interface ImagineImageAttachmentRef {
|
|
93
|
-
attachmentId: string;
|
|
94
|
-
mediaType: ImagineImageMediaType;
|
|
95
|
-
bytes: number;
|
|
96
|
-
width: number;
|
|
97
|
-
height: number;
|
|
98
|
-
name?: string;
|
|
99
|
-
}
|
|
100
|
-
export interface ImagineImageLimits {
|
|
101
|
-
maxImageBytes?: number;
|
|
102
|
-
mediaTypes?: readonly string[];
|
|
103
|
-
}
|
|
104
|
-
/** Structural AttachmentStore surface used by Imagine. */
|
|
105
|
-
export interface ImagineAttachmentStore {
|
|
106
|
-
imageLimits?: ImagineImageLimits;
|
|
107
|
-
saveImage(input: {
|
|
108
|
-
data: Uint8Array;
|
|
109
|
-
mediaType: ImagineImageMediaType;
|
|
110
|
-
name?: string;
|
|
111
|
-
}): Promise<ImagineImageAttachmentRef>;
|
|
112
|
-
readImage?(ref: ImagineImageAttachmentRef, signal?: AbortSignal): Promise<{
|
|
113
|
-
ref: ImagineImageAttachmentRef;
|
|
114
|
-
data: Uint8Array;
|
|
115
|
-
}>;
|
|
116
|
-
}
|
|
117
|
-
export interface GenerateImagineImageInput {
|
|
118
|
-
prompt: string;
|
|
119
|
-
model?: string;
|
|
120
|
-
n?: number;
|
|
121
|
-
aspectRatio?: string;
|
|
122
|
-
resolution?: string;
|
|
123
|
-
name?: string;
|
|
124
|
-
}
|
|
125
|
-
export interface ImagineImageResult {
|
|
126
|
-
model: string;
|
|
127
|
-
images: readonly ImaginePersistedImage[];
|
|
128
|
-
attachment: ImagineImageAttachmentRef;
|
|
129
|
-
path: string;
|
|
130
|
-
}
|
|
131
|
-
export interface ImaginePersistedImage {
|
|
132
|
-
attachment: ImagineImageAttachmentRef;
|
|
133
|
-
path: string;
|
|
134
|
-
}
|
|
135
|
-
export interface StartImagineVideoInput {
|
|
136
|
-
prompt: string;
|
|
137
|
-
model?: string;
|
|
138
|
-
duration?: number;
|
|
139
|
-
aspectRatio?: string;
|
|
140
|
-
resolution?: string;
|
|
141
|
-
name?: string;
|
|
142
|
-
}
|
|
143
|
-
export interface ImagineVideoStartResult {
|
|
144
|
-
model: string;
|
|
145
|
-
requestId: string;
|
|
146
|
-
status: "pending";
|
|
147
|
-
}
|
|
148
|
-
export type ImagineVideoJobStatus = "pending" | "completed" | "failed";
|
|
149
|
-
export interface ImagineVideoStatusResult {
|
|
150
|
-
requestId: string;
|
|
151
|
-
status: ImagineVideoJobStatus;
|
|
152
|
-
artifact?: MediaArtifactMeta;
|
|
153
|
-
path?: string;
|
|
154
|
-
error?: string;
|
|
155
|
-
}
|
|
156
|
-
export interface GrokImagineClientOptions {
|
|
157
|
-
resolveApiKey: ImagineApiKeyResolver;
|
|
158
|
-
attachments: ImagineAttachmentStore;
|
|
159
|
-
media: MediaStore;
|
|
160
|
-
/** API-only test seam. Never used for media and never a production default. */
|
|
161
|
-
fetch?: ImagineFetch;
|
|
162
|
-
/** Media downloads. Production default pins DNS at connect time via undici. */
|
|
163
|
-
downloader?: ImagineDownloader;
|
|
164
|
-
now?: () => number;
|
|
165
|
-
imageDownloadTimeoutMs?: number;
|
|
166
|
-
videoDownloadTimeoutMs?: number;
|
|
167
|
-
apiTimeoutMs?: number;
|
|
168
|
-
maxRedirects?: number;
|
|
169
|
-
imageMaxBytes?: number;
|
|
170
|
-
apiJsonMaxBytes?: number;
|
|
171
|
-
}
|
|
172
|
-
export interface ImagineImageDownloadHeaders {
|
|
173
|
-
"Content-Type": string;
|
|
174
|
-
"Content-Length": string;
|
|
175
|
-
"Content-Disposition": string;
|
|
176
|
-
"Cache-Control": string;
|
|
177
|
-
"X-Content-Type-Options": "nosniff";
|
|
178
|
-
}
|
|
179
|
-
export interface ImagineImageDownloadView {
|
|
180
|
-
ref: ImagineImageAttachmentRef;
|
|
181
|
-
body: Uint8Array;
|
|
182
|
-
headers: ImagineImageDownloadHeaders;
|
|
183
|
-
}
|
|
184
|
-
export declare function redactImagineMessage(error: unknown): string;
|
|
185
|
-
/** True when an address is loopback, private, reserved, documentation, or an embedded special form. */
|
|
186
|
-
export declare function isBlockedIp(address: string): boolean;
|
|
187
|
-
export declare function isAllowlistedImagineHost(hostname: string): boolean;
|
|
188
|
-
export declare function grokImagineVideoStatusPath(requestId: string): string;
|
|
189
|
-
export declare function isSafeImagineAttachmentId(attachmentId: string): boolean;
|
|
190
|
-
export declare function imagineImagePath(attachmentId: string): string;
|
|
191
|
-
export declare function parseImagineImagePath(pathname: string): string | undefined;
|
|
192
|
-
export declare function imagineImageDownloadHeaders(ref: ImagineImageAttachmentRef): ImagineImageDownloadHeaders;
|
|
193
|
-
export { IMAGINE_MEDIA_ROUTE_PREFIX, imagineMediaPath, isTrustedImaginePeer };
|
|
194
|
-
export declare function detectImageMediaType(data: Uint8Array): ImagineImageMediaType | undefined;
|
|
195
|
-
export declare function detectVideoMediaType(data: Uint8Array): MediaStoreVideoType | undefined;
|
|
196
|
-
export declare function defaultImagineLookup(hostname: string): Promise<readonly string[]>;
|
|
197
|
-
export declare function assertSafeRemoteMediaUrl(raw: string, lookup: ImagineDnsLookup): Promise<URL>;
|
|
198
|
-
export declare function createPinnedMediaTransport(lookup?: ImagineDnsLookup): ImagineMediaTransport;
|
|
199
|
-
export declare function createPinnedApiFetch(lookup?: ImagineDnsLookup, maxBytes?: number): ImagineFetch;
|
|
200
|
-
export declare function downloadRemoteImagineMedia(initialUrl: string, transport: ImagineMediaTransport, options: {
|
|
201
|
-
lookup: ImagineDnsLookup;
|
|
202
|
-
timeoutMs: number;
|
|
203
|
-
maxBytes: number;
|
|
204
|
-
accept: string;
|
|
205
|
-
maxRedirects: number;
|
|
206
|
-
signal?: AbortSignal;
|
|
207
|
-
}): Promise<ImagineDownloadResult>;
|
|
208
|
-
export declare function createPinnedImagineDownloader(options?: {
|
|
209
|
-
lookup?: ImagineDnsLookup;
|
|
210
|
-
maxRedirects?: number;
|
|
211
|
-
}): ImagineDownloader;
|
|
212
|
-
/**
|
|
213
|
-
* Test-only adapter around an injected fetch. Ordinary mock fetch is not
|
|
214
|
-
* production-safe: it cannot pin DNS at connect time.
|
|
215
|
-
*/
|
|
216
|
-
export declare function createImagineDownloaderFromFetch(fetchImpl: ImagineFetch, options: {
|
|
217
|
-
trustedTestTransport: true;
|
|
218
|
-
lookup?: ImagineDnsLookup;
|
|
219
|
-
maxRedirects?: number;
|
|
220
|
-
}): ImagineDownloader;
|
|
221
|
-
/**
|
|
222
|
-
* Validate a tool-supplied Imagine video `requestId`. Returns the id unchanged
|
|
223
|
-
* on success or throws an `INVALID_INPUT` error. Exposed so capability tools
|
|
224
|
-
* fail closed at the boundary instead of dispatching a malformed id to the
|
|
225
|
-
* internal client.
|
|
226
|
-
*/
|
|
227
|
-
export declare function parseVideoRequestId(value: unknown): string;
|
|
228
|
-
/** Enforce min/max bounds on a candidate image-id array. */
|
|
229
|
-
export declare function clampImagineImageIds(ids: readonly unknown[]): readonly string[];
|
|
230
|
-
export declare class GrokImagineClient {
|
|
231
|
-
private readonly resolveApiKey;
|
|
232
|
-
private readonly attachments;
|
|
233
|
-
private readonly media;
|
|
234
|
-
private readonly apiFetch;
|
|
235
|
-
private readonly downloader;
|
|
236
|
-
private readonly imageDownloadTimeoutMs;
|
|
237
|
-
private readonly videoDownloadTimeoutMs;
|
|
238
|
-
private readonly apiTimeoutMs;
|
|
239
|
-
private readonly maxRedirects;
|
|
240
|
-
private readonly imageMaxBytes;
|
|
241
|
-
private readonly apiJsonMaxBytes;
|
|
242
|
-
private readonly videoResults;
|
|
243
|
-
private readonly videoInflight;
|
|
244
|
-
private readonly disposeController;
|
|
245
|
-
private disposed;
|
|
246
|
-
constructor(options: GrokImagineClientOptions);
|
|
247
|
-
/**
|
|
248
|
-
* Permanently retire this client. In-flight API calls, downloads, and
|
|
249
|
-
* media persistence operations are aborted; subsequent operations fail
|
|
250
|
-
* closed with an `INVALID_INPUT` error until callers construct a new client.
|
|
251
|
-
*/
|
|
252
|
-
dispose(): void;
|
|
253
|
-
/** @returns true once {@link dispose} has been called. */
|
|
254
|
-
get isDisposed(): boolean;
|
|
255
|
-
private assertWritable;
|
|
256
|
-
generateImage(input: GenerateImagineImageInput, signal?: AbortSignal): Promise<ImagineImageResult>;
|
|
257
|
-
startVideo(input: StartImagineVideoInput, signal?: AbortSignal): Promise<ImagineVideoStartResult>;
|
|
258
|
-
videoStatus(requestId: string, options?: {
|
|
259
|
-
name?: string;
|
|
260
|
-
signal?: AbortSignal;
|
|
261
|
-
}): Promise<ImagineVideoStatusResult>;
|
|
262
|
-
private pollVideo;
|
|
263
|
-
private rememberVideo;
|
|
264
|
-
private persistGeneratedImage;
|
|
265
|
-
private resolveCredential;
|
|
266
|
-
private apiJson;
|
|
267
|
-
}
|
|
268
|
-
export declare function createGrokImagineClient(options: GrokImagineClientOptions): GrokImagineClient;
|
|
269
|
-
/** Gate a same-origin image download. Requires an explicit trusted/authz token. */
|
|
270
|
-
export declare function openTrustedImagineImageDownload(attachments: ImagineAttachmentStore, ref: ImagineImageAttachmentRef, authz: TrustedImagineAuthz): Promise<ImagineImageDownloadView>;
|
|
8
|
+
export type { GenerateImagineImageInput, GrokImagineClientOptions, GrokImagineErrorCode, ImagineApiKeyResolver, ImagineAttachmentStore, ImagineDnsLookup, ImagineDownloader, ImagineDownloadRequest, ImagineDownloadResult, ImagineFetch, ImagineImageAspectRatio, ImagineImageAttachmentRef, ImagineImageDownloadHeaders, ImagineImageDownloadView, ImagineImageLimits, ImagineImageMediaType, ImagineImageResolution, ImagineImageResult, ImagineMediaHop, ImagineMediaHopRequest, ImagineMediaTransport, ImagineOperation, ImaginePersistedImage, ImagineVideoAspectRatio, ImagineVideoJobStatus, ImagineVideoResolution, ImagineVideoStartResult, ImagineVideoStatusResult, StartImagineVideoInput, } from "./grok-imagine/index.js";
|
|
9
|
+
export { assertSafeRemoteMediaUrl, clampImagineImageIds, createGrokImagineClient, createImagineDownloaderFromFetch, createPinnedApiFetch, createPinnedImagineDownloader, createPinnedMediaTransport, DEFAULT_API_JSON_MAX_BYTES, DEFAULT_API_TIMEOUT_MS, DEFAULT_IMAGE_DOWNLOAD_MAX_BYTES, DEFAULT_IMAGE_DOWNLOAD_TIMEOUT_MS, DEFAULT_MAX_REDIRECTS, DEFAULT_VIDEO_DOWNLOAD_TIMEOUT_MS, defaultImagineLookup, detectImageMediaType, detectVideoMediaType, downloadRemoteImagineMedia, GROK_IMAGINE_IMAGE_MODEL, GROK_IMAGINE_IMAGE_PATH, GROK_IMAGINE_IMAGE_TOOL, GROK_IMAGINE_VIDEO_MODEL, GROK_IMAGINE_VIDEO_START_PATH, GROK_IMAGINE_VIDEO_STATUS_TOOL, GROK_IMAGINE_VIDEO_TOOL, GrokImagineClient, GrokImagineError, grokImagineVideoStatusPath, IMAGINE_IMAGE_ASPECT_RATIOS, IMAGINE_IMAGE_IDS_MAX, IMAGINE_IMAGE_IDS_MIN, IMAGINE_IMAGE_MAX_N, IMAGINE_IMAGE_RESOLUTIONS, IMAGINE_IMAGE_ROUTE_PREFIX, IMAGINE_PROMPT_MAX_LENGTH, IMAGINE_VIDEO_ASPECT_RATIOS, IMAGINE_VIDEO_MAX_DURATION_SECONDS, IMAGINE_VIDEO_MIN_DURATION_SECONDS, IMAGINE_VIDEO_RESOLUTIONS, imagineImageDownloadHeaders, imagineImagePath, isAllowlistedImagineHost, isBlockedIp, isSafeImagineAttachmentId, MAX_CACHED_VIDEO_JOBS, openTrustedImagineImageDownload, parseImagineImagePath, parseVideoRequestId, redactImagineMessage, XAI_API_ORIGIN, XAI_OUTPUT_HOSTS, } from "./grok-imagine/index.js";
|
|
10
|
+
export { IMAGINE_MEDIA_ROUTE_PREFIX, imagineMediaPath, isTrustedImaginePeer } from "./media-store.js";
|
|
271
11
|
//# sourceMappingURL=grok-imagine.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grok-imagine.d.ts","sourceRoot":"","sources":["../../src/grok-imagine.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"grok-imagine.d.ts","sourceRoot":"","sources":["../../src/grok-imagine.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,YAAY,EACX,yBAAyB,EACzB,wBAAwB,EACxB,oBAAoB,EACpB,qBAAqB,EACrB,sBAAsB,EACtB,gBAAgB,EAChB,iBAAiB,EACjB,sBAAsB,EACtB,qBAAqB,EACrB,YAAY,EACZ,uBAAuB,EACvB,yBAAyB,EACzB,2BAA2B,EAC3B,wBAAwB,EACxB,kBAAkB,EAClB,qBAAqB,EACrB,sBAAsB,EACtB,kBAAkB,EAClB,eAAe,EACf,sBAAsB,EACtB,qBAAqB,EACrB,gBAAgB,EAChB,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,EACrB,sBAAsB,EACtB,uBAAuB,EACvB,wBAAwB,EACxB,sBAAsB,GACtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACN,wBAAwB,EACxB,oBAAoB,EACpB,uBAAuB,EACvB,gCAAgC,EAChC,oBAAoB,EACpB,6BAA6B,EAC7B,0BAA0B,EAC1B,0BAA0B,EAC1B,sBAAsB,EACtB,gCAAgC,EAChC,iCAAiC,EACjC,qBAAqB,EACrB,iCAAiC,EACjC,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,0BAA0B,EAC1B,wBAAwB,EACxB,uBAAuB,EACvB,uBAAuB,EACvB,wBAAwB,EACxB,6BAA6B,EAC7B,8BAA8B,EAC9B,uBAAuB,EACvB,iBAAiB,EACjB,gBAAgB,EAChB,0BAA0B,EAC1B,2BAA2B,EAC3B,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,EACnB,yBAAyB,EACzB,0BAA0B,EAC1B,yBAAyB,EACzB,2BAA2B,EAC3B,kCAAkC,EAClC,kCAAkC,EAClC,yBAAyB,EACzB,2BAA2B,EAC3B,gBAAgB,EAChB,wBAAwB,EACxB,WAAW,EACX,yBAAyB,EACzB,qBAAqB,EACrB,+BAA+B,EAC/B,qBAAqB,EACrB,mBAAmB,EACnB,oBAAoB,EACpB,cAAc,EACd,gBAAgB,GAChB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,0BAA0B,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC"}
|
package/lib/http-json.d.ts
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
export declare class JsonRequestError extends Error {
|
|
4
|
-
readonly statusCode: 400 | 413;
|
|
5
|
-
constructor(statusCode: 400 | 413, message: string);
|
|
6
|
-
}
|
|
7
|
-
/** Read one JSON request body with a strict in-memory ceiling. */
|
|
8
|
-
export declare function readJsonRequest(request: IncomingMessage, limit?: number): Promise<unknown>;
|
|
9
|
-
export declare function requestErrorStatus(error: unknown, fallback: number): number;
|
|
1
|
+
/** Compatibility facade — implementation lives in `src/runtime/` (mirrored from Hub vendor core). */
|
|
2
|
+
export { JSON_BODY_LIMIT_BYTES, JsonRequestError, readJsonRequest, requestErrorStatus, } from "./runtime/http-json.js";
|
|
10
3
|
//# sourceMappingURL=http-json.d.ts.map
|
package/lib/http-json.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-json.d.ts","sourceRoot":"","sources":["../../src/http-json.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"http-json.d.ts","sourceRoot":"","sources":["../../src/http-json.ts"],"names":[],"mappings":"AAAA,qGAAqG;AAErG,OAAO,EACN,qBAAqB,EACrB,gBAAgB,EAChB,eAAe,EACf,kBAAkB,GAClB,MAAM,wBAAwB,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -14906,7 +14906,7 @@ var require_dump = __commonJS({
|
|
|
14906
14906
|
var require_dns = __commonJS({
|
|
14907
14907
|
"node_modules/.pnpm/undici@7.29.0/node_modules/undici/lib/interceptor/dns.js"(exports, module) {
|
|
14908
14908
|
"use strict";
|
|
14909
|
-
var { isIP:
|
|
14909
|
+
var { isIP: isIP3 } = __require("node:net");
|
|
14910
14910
|
var { lookup } = __require("node:dns");
|
|
14911
14911
|
var DecoratorHandler = require_decorator_handler();
|
|
14912
14912
|
var { InvalidArgumentError, InformationalError } = require_errors();
|
|
@@ -15312,7 +15312,7 @@ var require_dns = __commonJS({
|
|
|
15312
15312
|
return (dispatch) => {
|
|
15313
15313
|
return function dnsInterceptor(origDispatchOpts, handler) {
|
|
15314
15314
|
const origin = origDispatchOpts.origin.constructor === URL ? origDispatchOpts.origin : new URL(origDispatchOpts.origin);
|
|
15315
|
-
if (
|
|
15315
|
+
if (isIP3(origin.hostname) !== 0) {
|
|
15316
15316
|
return dispatch(origDispatchOpts, handler);
|
|
15317
15317
|
}
|
|
15318
15318
|
instance.runLookup(origin, origDispatchOpts, (err, newOrigin) => {
|
|
@@ -26069,7 +26069,7 @@ import { PiAiAdapter } from "@deepseek-ai/dsh-llm-pi-ai";
|
|
|
26069
26069
|
// src/alias-adapter.ts
|
|
26070
26070
|
import { LlmAdapter, LlmError } from "@deepseek-ai/dsh-llm";
|
|
26071
26071
|
|
|
26072
|
-
// src/grok-errors.ts
|
|
26072
|
+
// src/runtime/grok-errors.ts
|
|
26073
26073
|
var XAI_CAPACITY = /\b(?:at\s+capacity|high\s+demand|priority\s+processing|overloaded)\b/i;
|
|
26074
26074
|
function isXaiCapacityError(detail) {
|
|
26075
26075
|
return XAI_CAPACITY.test(detail);
|
|
@@ -26079,7 +26079,7 @@ function remapXaiCapacityFailure(failure) {
|
|
|
26079
26079
|
return { ...failure, code: "RATE_LIMIT" };
|
|
26080
26080
|
}
|
|
26081
26081
|
|
|
26082
|
-
// src/kimi-errors.ts
|
|
26082
|
+
// src/runtime/kimi-errors.ts
|
|
26083
26083
|
import { CONTEXT_WINDOW_EXCEEDED_CODE, isContextWindowExceededError } from "@deepseek-ai/dsh-llm";
|
|
26084
26084
|
var KIMI_CONTEXT_CAPACITY = /\bsupports only\s+\d+\s*k\s+context\b/i;
|
|
26085
26085
|
function isMisclassifiedContextWindowError(detail) {
|
|
@@ -28248,7 +28248,7 @@ async function importGrokBuildSession(session, filename) {
|
|
|
28248
28248
|
await session.refreshLiveCatalog();
|
|
28249
28249
|
}
|
|
28250
28250
|
|
|
28251
|
-
// src/http-json.ts
|
|
28251
|
+
// src/runtime/http-json.ts
|
|
28252
28252
|
var JSON_BODY_LIMIT_BYTES = 64 * 1024;
|
|
28253
28253
|
var JsonRequestError = class extends Error {
|
|
28254
28254
|
statusCode;
|
|
@@ -30589,11 +30589,11 @@ function createCodexImageController(options) {
|
|
|
30589
30589
|
};
|
|
30590
30590
|
}
|
|
30591
30591
|
|
|
30592
|
-
// src/grok-imagine.ts
|
|
30592
|
+
// src/grok-imagine/client.ts
|
|
30593
30593
|
var import_undici2 = __toESM(require_undici());
|
|
30594
30594
|
import { Buffer as Buffer3 } from "node:buffer";
|
|
30595
30595
|
import { lookup as dnsLookup } from "node:dns/promises";
|
|
30596
|
-
import {
|
|
30596
|
+
import { isIP as isIP2 } from "node:net";
|
|
30597
30597
|
|
|
30598
30598
|
// src/media-store.ts
|
|
30599
30599
|
import { createHash as createHash3, randomBytes as randomBytes3 } from "node:crypto";
|
|
@@ -31330,7 +31330,10 @@ var MediaStore = class {
|
|
|
31330
31330
|
}
|
|
31331
31331
|
};
|
|
31332
31332
|
|
|
31333
|
-
// src/grok-imagine.ts
|
|
31333
|
+
// src/grok-imagine/net.ts
|
|
31334
|
+
import { BlockList, isIP } from "node:net";
|
|
31335
|
+
|
|
31336
|
+
// src/grok-imagine/types.ts
|
|
31334
31337
|
var XAI_API_ORIGIN = "https://api.x.ai";
|
|
31335
31338
|
var GROK_IMAGINE_IMAGE_PATH = "/v1/images/generations";
|
|
31336
31339
|
var GROK_IMAGINE_VIDEO_START_PATH = "/v1/videos/generations";
|
|
@@ -31387,6 +31390,8 @@ var IMAGE_RESOLUTION_SET = new Set(IMAGINE_IMAGE_RESOLUTIONS);
|
|
|
31387
31390
|
var VIDEO_RESOLUTION_SET = new Set(IMAGINE_VIDEO_RESOLUTIONS);
|
|
31388
31391
|
var IMAGE_ASPECT_SET = new Set(IMAGINE_IMAGE_ASPECT_RATIOS);
|
|
31389
31392
|
var VIDEO_ASPECT_SET = new Set(IMAGINE_VIDEO_ASPECT_RATIOS);
|
|
31393
|
+
|
|
31394
|
+
// src/grok-imagine/net.ts
|
|
31390
31395
|
var blockedNetworks = new BlockList();
|
|
31391
31396
|
blockedNetworks.addSubnet("0.0.0.0", 8, "ipv4");
|
|
31392
31397
|
blockedNetworks.addSubnet("10.0.0.0", 8, "ipv4");
|
|
@@ -31418,16 +31423,6 @@ blockedNetworks.addSubnet("5f00::", 16, "ipv6");
|
|
|
31418
31423
|
blockedNetworks.addSubnet("fc00::", 7, "ipv6");
|
|
31419
31424
|
blockedNetworks.addSubnet("fe80::", 10, "ipv6");
|
|
31420
31425
|
blockedNetworks.addSubnet("ff00::", 8, "ipv6");
|
|
31421
|
-
function isRecord5(value) {
|
|
31422
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
31423
|
-
}
|
|
31424
|
-
function redactImagineMessage(error) {
|
|
31425
|
-
const withoutRemoteUrls = (error instanceof Error ? error.message : String(error)).replace(
|
|
31426
|
-
/https?:\/\/[^\s"'<>\\]+/giu,
|
|
31427
|
-
"[redacted-url]"
|
|
31428
|
-
);
|
|
31429
|
-
return safeMessage(withoutRemoteUrls);
|
|
31430
|
-
}
|
|
31431
31426
|
function dottedFromWords(high, low) {
|
|
31432
31427
|
return `${high >> 8 & 255}.${high & 255}.${low >> 8 & 255}.${low & 255}`;
|
|
31433
31428
|
}
|
|
@@ -31520,6 +31515,18 @@ function isBlockedHostname(hostname) {
|
|
|
31520
31515
|
function isAllowlistedImagineHost(hostname) {
|
|
31521
31516
|
return FROZEN_OUTPUT_HOSTS.has(normalizeHostname(hostname));
|
|
31522
31517
|
}
|
|
31518
|
+
|
|
31519
|
+
// src/grok-imagine/parse.ts
|
|
31520
|
+
function isRecord5(value) {
|
|
31521
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
31522
|
+
}
|
|
31523
|
+
function redactImagineMessage(error) {
|
|
31524
|
+
const withoutRemoteUrls = (error instanceof Error ? error.message : String(error)).replace(
|
|
31525
|
+
/https?:\/\/[^\s"'<>\\]+/giu,
|
|
31526
|
+
"[redacted-url]"
|
|
31527
|
+
);
|
|
31528
|
+
return safeMessage(withoutRemoteUrls);
|
|
31529
|
+
}
|
|
31523
31530
|
function grokImagineVideoStatusPath(requestId) {
|
|
31524
31531
|
if (!VIDEO_REQUEST_ID_PATTERN.test(requestId)) {
|
|
31525
31532
|
throw new GrokImagineError("INVALID_INPUT", "video request id is not a safe identifier");
|
|
@@ -31614,6 +31621,20 @@ function detectVideoMediaType(data) {
|
|
|
31614
31621
|
}
|
|
31615
31622
|
return void 0;
|
|
31616
31623
|
}
|
|
31624
|
+
function parseVideoRequestId(value) {
|
|
31625
|
+
if (typeof value !== "string") {
|
|
31626
|
+
throw new GrokImagineError("INVALID_INPUT", "video request id must be a string");
|
|
31627
|
+
}
|
|
31628
|
+
if (!VIDEO_REQUEST_ID_PATTERN.test(value)) {
|
|
31629
|
+
throw new GrokImagineError(
|
|
31630
|
+
"INVALID_INPUT",
|
|
31631
|
+
"video request id must match ^[A-Za-z0-9_-]{1,256}$ and be a safe ASCII identifier"
|
|
31632
|
+
);
|
|
31633
|
+
}
|
|
31634
|
+
return value;
|
|
31635
|
+
}
|
|
31636
|
+
|
|
31637
|
+
// src/grok-imagine/client.ts
|
|
31617
31638
|
function parseContentType(value) {
|
|
31618
31639
|
if (value === null || value === void 0 || value.trim() === "") return void 0;
|
|
31619
31640
|
return value.split(";", 1)[0]?.trim().toLowerCase();
|
|
@@ -31639,7 +31660,7 @@ async function assertSafeRemoteMediaUrl(raw, lookup) {
|
|
|
31639
31660
|
throw new GrokImagineError("SSRF", "generated media URL must use port 443");
|
|
31640
31661
|
}
|
|
31641
31662
|
const host = normalizeHostname(url.hostname);
|
|
31642
|
-
if (host === "" || isBlockedHostname(host) ||
|
|
31663
|
+
if (host === "" || isBlockedHostname(host) || isIP2(host) !== 0) {
|
|
31643
31664
|
throw new GrokImagineError("SSRF", "generated media host is not allowed");
|
|
31644
31665
|
}
|
|
31645
31666
|
if (!isAllowlistedImagineHost(host)) {
|
|
@@ -31658,7 +31679,7 @@ async function assertSafeRemoteMediaUrl(raw, lookup) {
|
|
|
31658
31679
|
}
|
|
31659
31680
|
async function resolvePublicAddresses(hostname, lookup) {
|
|
31660
31681
|
const host = normalizeHostname(hostname);
|
|
31661
|
-
if (host === "" || isBlockedHostname(host) ||
|
|
31682
|
+
if (host === "" || isBlockedHostname(host) || isIP2(host) !== 0) {
|
|
31662
31683
|
throw new GrokImagineError("SSRF", "host is not allowed");
|
|
31663
31684
|
}
|
|
31664
31685
|
const addresses = [...await lookup(host)];
|
|
@@ -31671,7 +31692,7 @@ async function resolvePublicAddresses(hostname, lookup) {
|
|
|
31671
31692
|
function createPinnedAgent(hostname, addresses) {
|
|
31672
31693
|
const expected = normalizeHostname(hostname);
|
|
31673
31694
|
const records = addresses.map((address) => {
|
|
31674
|
-
const family =
|
|
31695
|
+
const family = isIP2(address);
|
|
31675
31696
|
if (family !== 4 && family !== 6) {
|
|
31676
31697
|
throw new GrokImagineError("SSRF", "pinned address is not a valid IP");
|
|
31677
31698
|
}
|
|
@@ -31926,18 +31947,6 @@ function requirePrompt(prompt) {
|
|
|
31926
31947
|
}
|
|
31927
31948
|
return prompt;
|
|
31928
31949
|
}
|
|
31929
|
-
function parseVideoRequestId(value) {
|
|
31930
|
-
if (typeof value !== "string") {
|
|
31931
|
-
throw new GrokImagineError("INVALID_INPUT", "video request id must be a string");
|
|
31932
|
-
}
|
|
31933
|
-
if (!VIDEO_REQUEST_ID_PATTERN.test(value)) {
|
|
31934
|
-
throw new GrokImagineError(
|
|
31935
|
-
"INVALID_INPUT",
|
|
31936
|
-
"video request id must match ^[A-Za-z0-9_-]{1,256}$ and be a safe ASCII identifier"
|
|
31937
|
-
);
|
|
31938
|
-
}
|
|
31939
|
-
return value;
|
|
31940
|
-
}
|
|
31941
31950
|
var ImagineAbortError = class extends Error {
|
|
31942
31951
|
name = "ImagineAbortError";
|
|
31943
31952
|
constructor(reason) {
|
|
@@ -33628,7 +33637,7 @@ async function persistGatewayKeyDocument(path, document) {
|
|
|
33628
33637
|
`, { mode: 384 });
|
|
33629
33638
|
}
|
|
33630
33639
|
|
|
33631
|
-
// src/gateway-protocol.ts
|
|
33640
|
+
// src/runtime/gateway-protocol.ts
|
|
33632
33641
|
function isThinkingLevel(value) {
|
|
33633
33642
|
return value === "off" || value === "minimal" || value === "low" || value === "medium" || value === "high" || value === "xhigh" || value === "max";
|
|
33634
33643
|
}
|
|
@@ -34645,6 +34654,17 @@ function createCodingOAuthGatewayController(options) {
|
|
|
34645
34654
|
}
|
|
34646
34655
|
|
|
34647
34656
|
// src/gateway-routes.ts
|
|
34657
|
+
function authorizeGatewayControl(req, ownerRequestPolicy) {
|
|
34658
|
+
return ownerRequestPolicy.authorize(req);
|
|
34659
|
+
}
|
|
34660
|
+
function authorizeGatewaySecret(req, ownerRequestPolicy) {
|
|
34661
|
+
const decision = ownerRequestPolicy.authorize(req);
|
|
34662
|
+
if (!decision.authorized) return decision;
|
|
34663
|
+
if (decision.accessMode !== "loopback") {
|
|
34664
|
+
return { authorized: false, reason: "loopback-only" };
|
|
34665
|
+
}
|
|
34666
|
+
return decision;
|
|
34667
|
+
}
|
|
34648
34668
|
function registerGatewayRoutes(ctx, controller, ownerRequestPolicy = LOOPBACK_OWNER_REQUEST_POLICY) {
|
|
34649
34669
|
let dispose = () => void 0;
|
|
34650
34670
|
ctx.effect(() => {
|
|
@@ -34670,7 +34690,7 @@ function registerGatewayRoutes(ctx, controller, ownerRequestPolicy = LOOPBACK_OW
|
|
|
34670
34690
|
return () => dispose();
|
|
34671
34691
|
}
|
|
34672
34692
|
async function handleGatewaySettings(req, res, controller, ownerRequestPolicy) {
|
|
34673
|
-
if (!
|
|
34693
|
+
if (!authorizeGatewayControl(req, ownerRequestPolicy).authorized) {
|
|
34674
34694
|
json3(res, 403, { error: "forbidden" });
|
|
34675
34695
|
return;
|
|
34676
34696
|
}
|
|
@@ -34715,7 +34735,7 @@ async function handleGatewaySettings(req, res, controller, ownerRequestPolicy) {
|
|
|
34715
34735
|
}
|
|
34716
34736
|
}
|
|
34717
34737
|
async function handleGatewayReveal(req, res, controller, ownerRequestPolicy) {
|
|
34718
|
-
if (!
|
|
34738
|
+
if (!authorizeGatewaySecret(req, ownerRequestPolicy).authorized) {
|
|
34719
34739
|
json3(res, 403, { error: "forbidden" });
|
|
34720
34740
|
return;
|
|
34721
34741
|
}
|
|
@@ -34730,7 +34750,7 @@ async function handleGatewayReveal(req, res, controller, ownerRequestPolicy) {
|
|
|
34730
34750
|
}
|
|
34731
34751
|
}
|
|
34732
34752
|
async function handleGatewayRotate(req, res, controller, ownerRequestPolicy) {
|
|
34733
|
-
if (!
|
|
34753
|
+
if (!authorizeGatewaySecret(req, ownerRequestPolicy).authorized) {
|
|
34734
34754
|
json3(res, 403, { error: "forbidden" });
|
|
34735
34755
|
return;
|
|
34736
34756
|
}
|