@civitai/app-sdk 0.1.0 → 0.6.0

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 CHANGED
@@ -17,7 +17,16 @@ pnpm add @civitai/app-sdk
17
17
  | `oauth/*` — `generatePkce`, `buildAuthorizeUrl`, `exchangeCode`, `refreshToken`, `revokeToken`, `fetchMe` | The Civitai OAuth flow (Authorization Code + PKCE S256), as a set of stateless functions you call from your server-side handlers. |
18
18
  | `scopes/*` — `TokenScope`, `TokenScopePresets`, `bitmaskFromScopes`, `scopesFromBitmask`, `hasScope`, `getScopeLabel` | Civitai scopes are stored as bitmasks. These helpers let you compose scope sets from named flags rather than magic numbers. |
19
19
  | `cookies/*` — `sealCookie`, `unsealCookie`, `buildSetCookieHeader`, `readCookie` | AES-256-CTR encrypted cookie crypto. Use to seal a session blob (refresh token, expiry, scope) into an `httpOnly` cookie with zero external session store. |
20
- | `orchestrator/*` — `createOrchestratorClient`, `estimateWorkflow`, `submitWorkflow`, `getWorkflow`, `pollWorkflow`, `buildTextToImageBody`, `isTerminal`, `extractImageUrls`, `OrchestratorError`, `WorkflowSnapshot`, `GenerateInput`, `DEFAULT_MODEL_AIR` | Orchestrator workflow glue — types, body builder, raw HTTP, and long-poll helper. Client + server safe (fetch-only). `estimateWorkflow` calls `?whatif=true` to preview Buzz cost without spending. `pollWorkflow` long-polls to terminal status. |
20
+ | `orchestrator/*` — `createOrchestratorClient`, `estimateWorkflow`, `submitWorkflow`, `getWorkflow`, `pollWorkflow`, `buildTextToImageBody`, `buildImageGenBody`, `buildWorkflowBody`, `WORKFLOW_STEP_TYPES`, `IMAGE_GEN_ENGINES`, `isTerminal`, `extractImageUrls`, `OrchestratorError`, `WorkflowSnapshot`, `GenerateInput`, `ImageGenInput`, `WorkflowStepType`, `ImageGenEngine`, `DEFAULT_MODEL_AIR` | Orchestrator workflow glue — types, body builders, raw HTTP, and long-poll helper. Client + server safe (fetch-only). `estimateWorkflow` calls `?whatif=true` to preview Buzz cost without spending. `pollWorkflow` long-polls to terminal status. `WORKFLOW_STEP_TYPES` is the catalog of every step `$type` the orchestrator accepts. |
21
+ | `blocks/*` — `defineBlock`, `BlockManifestError`, `BLOCK_SCOPES`, `BLOCK_SCOPE_PATTERN`, `isMessage`, types (`BlockManifestV1`, `BlockContext`, `BlockToken`, `BlockSettings`, `ViewerInfo`, `ThemeInfo`, `BlockWorkflowSnapshot`, `BlockInitPayload`, `ParentToBlockMessage`, `BlockToParentMessage`, …) | Framework-agnostic contract for [Civitai App Blocks](https://developer.civitai.com). `defineBlock(config)` validates a `BlockManifestV1` at startup so authoring mistakes surface in `pnpm dev` instead of at `civitai deploy`. Ships the JSON Schema (draft-07) at the `./schemas/app-block/v1.json` subpath for offline validation. Runtime-agnostic — no React or DOM types. Hooks and the iframe transport live in a separate package. |
22
+
23
+ ## Subpath imports
24
+
25
+ ```ts
26
+ import { defineBlock, BLOCK_SCOPES } from '@civitai/app-sdk/blocks';
27
+ // JSON Schema for the manifest, e.g. for IDE validation:
28
+ import manifestSchema from '@civitai/app-sdk/schemas/app-block/v1.json' with { type: 'json' };
29
+ ```
21
30
 
22
31
  ## Minimal usage example
23
32
 
@@ -75,6 +84,42 @@ const finished = await pollWorkflow(client, submitted.id, { timeoutMs: 30_000 })
75
84
 
76
85
  The starters in `civitai/civitai-app-starters` wire this into framework-specific route handlers (Next.js App Router, SvelteKit `+server.ts`, Hono inside a Vite-built PWA). Read those for end-to-end reference implementations.
77
86
 
87
+ ## Choosing a workflow step type
88
+
89
+ The orchestrator is a workflow API: each request submits a list of typed steps. `WORKFLOW_STEP_TYPES` is the in-code catalog of every step `$type` it accepts, with a one-line description for each — `textToImage`, `imageGen`, `videoGen`, `comfy`, `textToSpeech`, `aceStepAudio`, `transcription`, `imageUpscaler`, and ~25 more.
90
+
91
+ Find the step you want, then pick a builder:
92
+
93
+ | Step type | Builder | When |
94
+ |---|---|---|
95
+ | `textToImage` | `buildTextToImageBody` | Diffusion checkpoints (SDXL / Flux.1 / Pony / SD1.5) via AIR URN |
96
+ | `imageGen` | `buildImageGenBody` | Closed-source image-gen APIs — Nano Banana, Gemini, GPT-Image, Flux.1 Kontext, Flux.2, Seedream, Grok, fal. `IMAGE_GEN_ENGINES` lists the engines. |
97
+ | Any other (`videoGen`, `comfy`, `textToSpeech`, `transcription`, …) | `buildWorkflowBody` | Generic single-step envelope — pass `{ $type, input }`, the SDK adds `name`/`timeout` defaults. |
98
+
99
+ For multi-step workflows, hand-build `{ tags?, steps: [step1, step2, ...] }` — no special envelope work beyond a JSON array.
100
+
101
+ **Reference-image gen (the Nano Banana / Gemini / Kontext use case):**
102
+
103
+ ```ts
104
+ import { buildImageGenBody, estimateWorkflow, submitWorkflow } from '@civitai/app-sdk/orchestrator';
105
+
106
+ const body = buildImageGenBody({
107
+ engine: 'google',
108
+ model: 'nano-banana-2',
109
+ prompt: 'turn this person into a cartoon sticker',
110
+ images: ['data:image/png;base64,...', 'https://example.com/style-ref.jpg'],
111
+ aspectRatio: '1:1',
112
+ numImages: 1,
113
+ resolution: '1K',
114
+ }, { tags: ['my-app'] });
115
+
116
+ const estimate = await estimateWorkflow(client, body);
117
+ console.log(`This will cost ${estimate.cost?.total ?? 0} Buzz`);
118
+ const submitted = await submitWorkflow(client, body);
119
+ ```
120
+
121
+ Per-engine input shapes (`aspectRatio`, `resolution`, `numImages`, etc.) come from the OpenAPI spec at <https://orchestration.civitai.com/openapi/v2-consumers.json> — `ImageGenInput` is intentionally pass-through so new engine fields work without an SDK release.
122
+
78
123
  ## Public vs. confidential clients
79
124
 
80
125
  Civitai's OAuth server supports both:
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Build-time / startup validation for a `BlockManifestV1`.
3
+ *
4
+ * This is a subset of what the civitai/civitai server enforces — the client
5
+ * runs it so authoring mistakes surface in `pnpm dev` rather than at
6
+ * `civitai deploy` time. Rules here MUST stay a strict subset of the
7
+ * server's; if the server tightens, mirror the change here.
8
+ *
9
+ * Every check guards `typeof` before pattern-testing — the highest-value
10
+ * caller is `JSON.parse(fs.readFileSync('block.manifest.json'))`, where
11
+ * the TypeScript type is a lie.
12
+ */
13
+ import type { BlockManifest } from './types.js';
14
+ /** Thrown by `defineBlock` for any manifest violation. */
15
+ export declare class BlockManifestError extends Error {
16
+ /** Dot-path to the offending field, e.g. `iframe.sandbox`. */
17
+ readonly field?: string | undefined;
18
+ readonly name = "BlockManifestError";
19
+ constructor(message: string,
20
+ /** Dot-path to the offending field, e.g. `iframe.sandbox`. */
21
+ field?: string | undefined);
22
+ }
23
+ export interface DefineBlockConfig {
24
+ manifest: BlockManifest;
25
+ }
26
+ /**
27
+ * Validates the manifest and returns it unchanged. Acts as a typed identity
28
+ * function — call it at module scope in the block app so violations throw
29
+ * before the app mounts.
30
+ */
31
+ export declare function defineBlock(config: DefineBlockConfig): BlockManifest;
32
+ //# sourceMappingURL=defineBlock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defineBlock.d.ts","sourceRoot":"","sources":["../../src/blocks/defineBlock.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAiB,MAAM,YAAY,CAAC;AAkD/D,0DAA0D;AAC1D,qBAAa,kBAAmB,SAAQ,KAAK;IAIzC,8DAA8D;IAC9D,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM;IAJzB,SAAkB,IAAI,wBAAwB;gBAE5C,OAAO,EAAE,MAAM;IACf,8DAA8D;IACrD,KAAK,CAAC,EAAE,MAAM,YAAA;CAI1B;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,aAAa,CAAC;CAIzB;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,iBAAiB,GAAG,aAAa,CAmFpE"}
@@ -0,0 +1,270 @@
1
+ /**
2
+ * Build-time / startup validation for a `BlockManifestV1`.
3
+ *
4
+ * This is a subset of what the civitai/civitai server enforces — the client
5
+ * runs it so authoring mistakes surface in `pnpm dev` rather than at
6
+ * `civitai deploy` time. Rules here MUST stay a strict subset of the
7
+ * server's; if the server tightens, mirror the change here.
8
+ *
9
+ * Every check guards `typeof` before pattern-testing — the highest-value
10
+ * caller is `JSON.parse(fs.readFileSync('block.manifest.json'))`, where
11
+ * the TypeScript type is a lie.
12
+ */
13
+ import { BLOCK_SCOPE_PATTERN } from './scopes.js';
14
+ const BLOCK_ID_PATTERN = /^[a-z0-9-]{3,64}$/;
15
+ const NAME_MAX_LENGTH = 80;
16
+ const SEMVER_PATTERN = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/;
17
+ /** Detects the SubresourceIntegrity hash format (sha256/384/512 + base64). */
18
+ const SRI_PATTERN = /^sha(?:256|384|512)-[A-Za-z0-9+/=]+$/;
19
+ /** Heuristic for "looks PascalCase" — used only to pick the pointed error message. */
20
+ const PASCAL_CASE_PATTERN = /^[A-Z][A-Za-z0-9]*$/;
21
+ const EXPECTED_SCHEMA_URL = 'https://civitai.com/schemas/app-block/v1.json';
22
+ const CONTENT_RATINGS = ['g', 'pg', 'pg13', 'r', 'x'];
23
+ /**
24
+ * W3 v0 — settings type set. Mirrors the meta-schema discriminated union
25
+ * in civitai/civitai's `manifest-settings.meta.schema.ts`. Keep aligned.
26
+ */
27
+ const SETTING_TYPES = ['number', 'string', 'boolean'];
28
+ const SETTING_SCOPES = ['publisher', 'viewer'];
29
+ const SETTING_KEY_PATTERN = /^[a-z][a-z0-9_]{0,40}$/;
30
+ const MAX_SETTINGS_PER_BLOCK = 32;
31
+ /**
32
+ * All `allow-top-navigation*` sandbox tokens are rejected. The
33
+ * `-by-user-activation` and `-to-custom-protocols` variants gate on a user
34
+ * gesture but produce the same threat (block navigates the host frame) —
35
+ * blocks must route navigation through the `NAVIGATE` postMessage so the
36
+ * host can mediate.
37
+ */
38
+ const BANNED_SANDBOX_TOKENS = new Set([
39
+ 'allow-same-origin',
40
+ 'allow-top-navigation',
41
+ 'allow-top-navigation-by-user-activation',
42
+ 'allow-top-navigation-to-custom-protocols',
43
+ ]);
44
+ const REQUIRED_FIELDS = [
45
+ '$schema',
46
+ 'appId',
47
+ 'blockId',
48
+ 'version',
49
+ 'name',
50
+ 'type',
51
+ 'targets',
52
+ 'scopes',
53
+ 'iframe',
54
+ 'contentRating',
55
+ 'minApiVersion',
56
+ ];
57
+ /** Thrown by `defineBlock` for any manifest violation. */
58
+ export class BlockManifestError extends Error {
59
+ field;
60
+ name = 'BlockManifestError';
61
+ constructor(message,
62
+ /** Dot-path to the offending field, e.g. `iframe.sandbox`. */
63
+ field) {
64
+ super(message);
65
+ this.field = field;
66
+ }
67
+ }
68
+ /**
69
+ * Validates the manifest and returns it unchanged. Acts as a typed identity
70
+ * function — call it at module scope in the block app so violations throw
71
+ * before the app mounts.
72
+ */
73
+ export function defineBlock(config) {
74
+ const { manifest } = config;
75
+ if (manifest == null || typeof manifest !== 'object') {
76
+ throw new BlockManifestError('manifest must be an object');
77
+ }
78
+ for (const field of REQUIRED_FIELDS) {
79
+ if (manifest[field] === undefined || manifest[field] === null) {
80
+ throw new BlockManifestError(`manifest.${field} is required`, field);
81
+ }
82
+ }
83
+ if (manifest.$schema !== EXPECTED_SCHEMA_URL) {
84
+ throw new BlockManifestError(`manifest.$schema must be "${EXPECTED_SCHEMA_URL}"`, '$schema');
85
+ }
86
+ requireNonEmptyString(manifest.appId, 'appId');
87
+ requireNonEmptyString(manifest.blockId, 'blockId');
88
+ if (!BLOCK_ID_PATTERN.test(manifest.blockId)) {
89
+ throw new BlockManifestError(`manifest.blockId must match ${BLOCK_ID_PATTERN} ` +
90
+ `(lowercase letters, digits, and hyphens; 3-64 chars). Got: ${JSON.stringify(manifest.blockId)}`, 'blockId');
91
+ }
92
+ requireNonEmptyString(manifest.version, 'version');
93
+ if (!SEMVER_PATTERN.test(manifest.version)) {
94
+ throw new BlockManifestError(`manifest.version must be semver (e.g. "0.1.0" or "1.2.3-beta.1"). Got: ${JSON.stringify(manifest.version)}`, 'version');
95
+ }
96
+ requireNonEmptyString(manifest.name, 'name');
97
+ if (manifest.name.length > NAME_MAX_LENGTH) {
98
+ throw new BlockManifestError(`manifest.name must be ${NAME_MAX_LENGTH} characters or fewer (got ${manifest.name.length})`, 'name');
99
+ }
100
+ if (manifest.type !== 'block' && manifest.type !== 'embed') {
101
+ throw new BlockManifestError(`manifest.type must be "block" or "embed". Got: ${JSON.stringify(manifest.type)}`, 'type');
102
+ }
103
+ if (!Array.isArray(manifest.scopes) || manifest.scopes.length === 0) {
104
+ throw new BlockManifestError('manifest.scopes must be a non-empty array', 'scopes');
105
+ }
106
+ for (const scope of manifest.scopes) {
107
+ if (typeof scope !== 'string' || !BLOCK_SCOPE_PATTERN.test(scope)) {
108
+ throw new BlockManifestError(buildScopeError(scope), 'scopes');
109
+ }
110
+ }
111
+ if (!Array.isArray(manifest.targets) || manifest.targets.length === 0) {
112
+ throw new BlockManifestError('manifest.targets must be a non-empty array', 'targets');
113
+ }
114
+ manifest.targets.forEach((target, i) => validateTarget(target, i));
115
+ if (!CONTENT_RATINGS.includes(manifest.contentRating)) {
116
+ throw new BlockManifestError(`manifest.contentRating must be one of ${CONTENT_RATINGS.join(', ')}. Got: ${JSON.stringify(manifest.contentRating)}`, 'contentRating');
117
+ }
118
+ requireNonEmptyString(manifest.minApiVersion, 'minApiVersion');
119
+ validateIframe(manifest.iframe);
120
+ if (manifest.assets !== undefined)
121
+ validateAssets(manifest.assets);
122
+ if (manifest.settings !== undefined)
123
+ validateSettings(manifest.settings);
124
+ return manifest;
125
+ }
126
+ function requireNonEmptyString(value, field) {
127
+ if (typeof value !== 'string' || value.length === 0) {
128
+ throw new BlockManifestError(`manifest.${field} must be a non-empty string`, field);
129
+ }
130
+ }
131
+ function buildScopeError(scope) {
132
+ const shown = JSON.stringify(scope);
133
+ if (typeof scope === 'string' && PASCAL_CASE_PATTERN.test(scope)) {
134
+ return (`Block scope strings must use colon-separated lowercase format ` +
135
+ `(e.g. "models:read:self"), not PascalCase (e.g. "ModelsReadSelf"). Got: ${shown}`);
136
+ }
137
+ return (`Block scope strings must match ${BLOCK_SCOPE_PATTERN} ` +
138
+ `(three colon-separated lowercase segments, e.g. "models:read:self"). Got: ${shown}`);
139
+ }
140
+ function validateTarget(target, index) {
141
+ const path = `targets[${index}]`;
142
+ if (target == null || typeof target !== 'object') {
143
+ throw new BlockManifestError(`manifest.${path} must be an object`, path);
144
+ }
145
+ const t = target;
146
+ if (typeof t.slotId !== 'string' || t.slotId.length === 0) {
147
+ throw new BlockManifestError(`manifest.${path}.slotId must be a non-empty string`, `${path}.slotId`);
148
+ }
149
+ if (typeof t.priority !== 'number' || !Number.isInteger(t.priority)) {
150
+ throw new BlockManifestError(`manifest.${path}.priority must be an integer`, `${path}.priority`);
151
+ }
152
+ }
153
+ function validateIframe(iframe) {
154
+ if (iframe == null || typeof iframe !== 'object') {
155
+ throw new BlockManifestError('manifest.iframe must be an object', 'iframe');
156
+ }
157
+ if (typeof iframe.src !== 'string' || iframe.src.length === 0) {
158
+ throw new BlockManifestError('manifest.iframe.src must be a non-empty string', 'iframe.src');
159
+ }
160
+ if (!isAllowedIframeSrc(iframe.src)) {
161
+ throw new BlockManifestError(`manifest.iframe.src must use https:// (http:// only accepted for localhost/127.0.0.1/[::1]/*.localhost). Got: ${JSON.stringify(iframe.src)}`, 'iframe.src');
162
+ }
163
+ if (typeof iframe.sandbox !== 'string') {
164
+ throw new BlockManifestError('manifest.iframe.sandbox must be a string', 'iframe.sandbox');
165
+ }
166
+ const tokens = new Set(iframe.sandbox.split(/\s+/).filter(Boolean));
167
+ for (const banned of BANNED_SANDBOX_TOKENS) {
168
+ if (tokens.has(banned)) {
169
+ throw new BlockManifestError(`manifest.iframe.sandbox must not contain "${banned}". ` +
170
+ (banned === 'allow-same-origin'
171
+ ? 'Combined with "allow-scripts" it defeats the sandbox entirely.'
172
+ : 'Blocks must route navigation through the NAVIGATE postMessage so the host can mediate.'), 'iframe.sandbox');
173
+ }
174
+ }
175
+ if (typeof iframe.minHeight !== 'number' || !Number.isInteger(iframe.minHeight) || iframe.minHeight <= 0) {
176
+ throw new BlockManifestError('manifest.iframe.minHeight must be a positive integer', 'iframe.minHeight');
177
+ }
178
+ if (iframe.maxHeight !== undefined &&
179
+ iframe.maxHeight !== null &&
180
+ (typeof iframe.maxHeight !== 'number' || !Number.isInteger(iframe.maxHeight) || iframe.maxHeight <= 0)) {
181
+ throw new BlockManifestError('manifest.iframe.maxHeight must be a positive integer, null, or omitted', 'iframe.maxHeight');
182
+ }
183
+ if (typeof iframe.resizable !== 'boolean') {
184
+ throw new BlockManifestError('manifest.iframe.resizable must be a boolean', 'iframe.resizable');
185
+ }
186
+ }
187
+ function validateAssets(assets) {
188
+ if (!Array.isArray(assets)) {
189
+ throw new BlockManifestError('manifest.assets must be an array', 'assets');
190
+ }
191
+ assets.forEach((asset, i) => {
192
+ const path = `assets[${i}]`;
193
+ if (asset == null || typeof asset !== 'object') {
194
+ throw new BlockManifestError(`manifest.${path} must be an object`, path);
195
+ }
196
+ const a = asset;
197
+ if (typeof a.url !== 'string' || a.url.length === 0) {
198
+ throw new BlockManifestError(`manifest.${path}.url must be a non-empty string`, `${path}.url`);
199
+ }
200
+ if (typeof a.integrity !== 'string' || !SRI_PATTERN.test(a.integrity)) {
201
+ throw new BlockManifestError(`manifest.${path}.integrity must be a SubresourceIntegrity hash ` +
202
+ `(sha256/384/512-<base64>). Got: ${JSON.stringify(a.integrity)}`, `${path}.integrity`);
203
+ }
204
+ });
205
+ }
206
+ /**
207
+ * W3 v0 settings validation. Manifest authors declare fields as a record
208
+ * keyed by snake_case field name; each entry carries scope, type, label,
209
+ * description, and a widget hint. This is a strict subset of the platform
210
+ * meta-schema (`manifestSettingsSchema`) — keep both sides aligned.
211
+ */
212
+ function validateSettings(settings) {
213
+ if (settings == null || typeof settings !== 'object' || Array.isArray(settings)) {
214
+ throw new BlockManifestError('manifest.settings must be an object (record keyed by snake_case field name)', 'settings');
215
+ }
216
+ const entries = Object.entries(settings);
217
+ if (entries.length > MAX_SETTINGS_PER_BLOCK) {
218
+ throw new BlockManifestError(`manifest.settings has ${entries.length} entries (max ${MAX_SETTINGS_PER_BLOCK})`, 'settings');
219
+ }
220
+ for (const [key, raw] of entries) {
221
+ const path = `settings.${key}`;
222
+ if (!SETTING_KEY_PATTERN.test(key)) {
223
+ throw new BlockManifestError(`manifest.${path}: key must match ${SETTING_KEY_PATTERN} (snake_case, must start with a letter)`, path);
224
+ }
225
+ if (raw == null || typeof raw !== 'object') {
226
+ throw new BlockManifestError(`manifest.${path} must be an object`, path);
227
+ }
228
+ const s = raw;
229
+ if (typeof s.scope !== 'string' || !SETTING_SCOPES.includes(s.scope)) {
230
+ throw new BlockManifestError(`manifest.${path}.scope must be one of ${SETTING_SCOPES.join(', ')}. Got: ${JSON.stringify(s.scope)}`, `${path}.scope`);
231
+ }
232
+ if (typeof s.type !== 'string' || !SETTING_TYPES.includes(s.type)) {
233
+ throw new BlockManifestError(`manifest.${path}.type must be one of ${SETTING_TYPES.join(', ')}. Got: ${JSON.stringify(s.type)}`, `${path}.type`);
234
+ }
235
+ if (typeof s.label !== 'string' || s.label.length === 0) {
236
+ throw new BlockManifestError(`manifest.${path}.label must be a non-empty string`, `${path}.label`);
237
+ }
238
+ if (typeof s.description !== 'string' || s.description.length === 0) {
239
+ throw new BlockManifestError(`manifest.${path}.description must be a non-empty string`, `${path}.description`);
240
+ }
241
+ }
242
+ }
243
+ function isAllowedIframeSrc(src) {
244
+ let url;
245
+ try {
246
+ url = new URL(src);
247
+ }
248
+ catch {
249
+ return false;
250
+ }
251
+ // Reject URLs with no host even if they parse (e.g. "https://" alone, which
252
+ // some URL parsers permit).
253
+ if (!url.hostname)
254
+ return false;
255
+ if (url.protocol === 'https:')
256
+ return true;
257
+ if (url.protocol !== 'http:')
258
+ return false;
259
+ const host = url.hostname;
260
+ // RFC 6761 reserves `.localhost` for loopback.
261
+ if (host === 'localhost' || host.endsWith('.localhost'))
262
+ return true;
263
+ if (host === '127.0.0.1')
264
+ return true;
265
+ // IPv6 loopback. WHATWG URL parses "[::1]" → hostname "[::1]" or "::1".
266
+ if (host === '[::1]' || host === '::1')
267
+ return true;
268
+ return false;
269
+ }
270
+ //# sourceMappingURL=defineBlock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defineBlock.js","sourceRoot":"","sources":["../../src/blocks/defineBlock.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAGlD,MAAM,gBAAgB,GAAG,mBAAmB,CAAC;AAC7C,MAAM,eAAe,GAAG,EAAE,CAAC;AAC3B,MAAM,cAAc,GAAG,qCAAqC,CAAC;AAC7D,8EAA8E;AAC9E,MAAM,WAAW,GAAG,sCAAsC,CAAC;AAC3D,sFAAsF;AACtF,MAAM,mBAAmB,GAAG,qBAAqB,CAAC;AAClD,MAAM,mBAAmB,GAAG,+CAA+C,CAAC;AAE5E,MAAM,eAAe,GAA6B,CAAC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AAChF;;;GAGG;AACH,MAAM,aAAa,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,CAAU,CAAC;AAC/D,MAAM,cAAc,GAAG,CAAC,WAAW,EAAE,QAAQ,CAAU,CAAC;AACxD,MAAM,mBAAmB,GAAG,wBAAwB,CAAC;AACrD,MAAM,sBAAsB,GAAG,EAAE,CAAC;AAGlC;;;;;;GAMG;AACH,MAAM,qBAAqB,GAAG,IAAI,GAAG,CAAC;IACpC,mBAAmB;IACnB,sBAAsB;IACtB,yCAAyC;IACzC,0CAA0C;CAC3C,CAAC,CAAC;AAEH,MAAM,eAAe,GAAG;IACtB,SAAS;IACT,OAAO;IACP,SAAS;IACT,SAAS;IACT,MAAM;IACN,MAAM;IACN,SAAS;IACT,QAAQ;IACR,QAAQ;IACR,eAAe;IACf,eAAe;CACsC,CAAC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,OAAO,KAAK,CAAC;IACf,CAAC;IACD,4EAA4E;IAC5E,4BAA4B;IAC5B,IAAI,CAAC,GAAG,CAAC,QAAQ;QAAE,OAAO,KAAK,CAAC;IAChC,IAAI,GAAG,CAAC,QAAQ,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IAC3C,IAAI,GAAG,CAAC,QAAQ,KAAK,OAAO;QAAE,OAAO,KAAK,CAAC;IAC3C,MAAM,IAAI,GAAG,GAAG,CAAC,QAAQ,CAAC;IAC1B,+CAA+C;IAC/C,IAAI,IAAI,KAAK,WAAW,IAAI,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC;QAAE,OAAO,IAAI,CAAC;IACrE,IAAI,IAAI,KAAK,WAAW;QAAE,OAAO,IAAI,CAAC;IACtC,wEAAwE;IACxE,IAAI,IAAI,KAAK,OAAO,IAAI,IAAI,KAAK,KAAK;QAAE,OAAO,IAAI,CAAC;IACpD,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * `@civitai/app-sdk/blocks` — framework-agnostic contract for Civitai App Blocks.
3
+ *
4
+ * This subpath exports the manifest type, scope strings, postMessage protocol,
5
+ * and the `defineBlock` validator. Hooks and transport implementations live in
6
+ * a separate package (see `@civitai/blocks-react`) so this module stays usable
7
+ * from any runtime — Node, browsers, workers — with no React dependency.
8
+ */
9
+ export { defineBlock, BlockManifestError } from './defineBlock.js';
10
+ export type { DefineBlockConfig } from './defineBlock.js';
11
+ export { BLOCK_SCOPES, BLOCK_SCOPE_PATTERN } from './scopes.js';
12
+ export type { BlockScope, BlockScopeKey } from './scopes.js';
13
+ export { isMessage } from './messages.js';
14
+ export type { BlockInitPayload, BlockToParentMessage, BlockToParentMessageType, ParentToBlockMessage, ParentToBlockMessageType, WrappedToken, } from './messages.js';
15
+ export type { BlockContext, BlockManifest, BlockManifestV1, BlockSettings, BlockToken, ContentRating, ManifestAsset, ManifestBooleanField, ManifestIframe, ManifestNumberField, ManifestPreview, ManifestSettingField, ManifestSettings, ManifestStringField, ManifestTarget, ModelSlotContext, SettingScope, SettingWidget, Theme, ViewerInfo, BlockCheckpointInfo, BlockTextToImageParams, BlockWorkflowSnapshot, ShowcaseImage, WorkflowBody, WorkflowStatus, } from './types.js';
16
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/blocks/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACnE,YAAY,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAE1D,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAChE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE7D,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,YAAY,EACV,gBAAgB,EAChB,oBAAoB,EACpB,wBAAwB,EACxB,oBAAoB,EACpB,wBAAwB,EACxB,YAAY,GACb,MAAM,eAAe,CAAC;AAEvB,YAAY,EACV,YAAY,EACZ,aAAa,EACb,eAAe,EACf,aAAa,EACb,UAAU,EACV,aAAa,EACb,aAAa,EACb,oBAAoB,EACpB,cAAc,EACd,mBAAmB,EACnB,eAAe,EACf,oBAAoB,EACpB,gBAAgB,EAChB,mBAAmB,EACnB,cAAc,EACd,gBAAgB,EAChB,YAAY,EACZ,aAAa,EACb,KAAK,EACL,UAAU,EACV,mBAAmB,EACnB,sBAAsB,EACtB,qBAAqB,EACrB,aAAa,EACb,YAAY,EACZ,cAAc,GACf,MAAM,YAAY,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * `@civitai/app-sdk/blocks` — framework-agnostic contract for Civitai App Blocks.
3
+ *
4
+ * This subpath exports the manifest type, scope strings, postMessage protocol,
5
+ * and the `defineBlock` validator. Hooks and transport implementations live in
6
+ * a separate package (see `@civitai/blocks-react`) so this module stays usable
7
+ * from any runtime — Node, browsers, workers — with no React dependency.
8
+ */
9
+ export { defineBlock, BlockManifestError } from './defineBlock.js';
10
+ export { BLOCK_SCOPES, BLOCK_SCOPE_PATTERN } from './scopes.js';
11
+ export { isMessage } from './messages.js';
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/blocks/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAGnE,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAGhE,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC"}