@wazootech/worlds-client 0.0.0-stage → 0.8.2

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.
@@ -0,0 +1,2045 @@
1
+ type AuthToken = string | undefined;
2
+ interface Auth {
3
+ /**
4
+ * Which part of the request do we use to send the auth?
5
+ *
6
+ * @default 'header'
7
+ */
8
+ in?: 'header' | 'query' | 'cookie';
9
+ /**
10
+ * A unique identifier for the security scheme.
11
+ *
12
+ * Defined only when there are multiple security schemes whose `Auth`
13
+ * shape would otherwise be identical.
14
+ */
15
+ key?: string;
16
+ /**
17
+ * Header or query parameter name.
18
+ *
19
+ * @default 'Authorization'
20
+ */
21
+ name?: string;
22
+ scheme?: 'basic' | 'bearer';
23
+ type: 'apiKey' | 'http';
24
+ }
25
+ interface SerializerOptions<T> {
26
+ /**
27
+ * @default true
28
+ */
29
+ explode: boolean;
30
+ style: T;
31
+ }
32
+ type ArrayStyle = 'form' | 'spaceDelimited' | 'pipeDelimited';
33
+ type ObjectStyle = 'form' | 'deepObject';
34
+ type QuerySerializer = (query: Record<string, unknown>) => string;
35
+ type BodySerializer = (body: unknown) => unknown;
36
+ type QuerySerializerOptionsObject = {
37
+ allowReserved?: boolean;
38
+ array?: Partial<SerializerOptions<ArrayStyle>>;
39
+ object?: Partial<SerializerOptions<ObjectStyle>>;
40
+ };
41
+ type QuerySerializerOptions = QuerySerializerOptionsObject & {
42
+ /**
43
+ * Per-parameter serialization overrides. When provided, these settings
44
+ * override the global array/object settings for specific parameter names.
45
+ */
46
+ parameters?: Record<string, QuerySerializerOptionsObject>;
47
+ };
48
+ type HttpMethod = 'connect' | 'delete' | 'get' | 'head' | 'options' | 'patch' | 'post' | 'put' | 'trace';
49
+ type Client$1<RequestFn = never, Config = unknown, MethodFn = never, BuildUrlFn = never, SseFn = never> = {
50
+ /**
51
+ * Returns the final request URL.
52
+ */
53
+ buildUrl: BuildUrlFn;
54
+ getConfig: () => Config;
55
+ request: RequestFn;
56
+ setConfig: (config: Config) => Config;
57
+ } & { [K in HttpMethod]: MethodFn; } & ([SseFn] extends [never] ? {
58
+ sse?: never;
59
+ } : {
60
+ sse: { [K in HttpMethod]: SseFn; };
61
+ });
62
+ interface Config$1 {
63
+ /**
64
+ * Auth token or a function returning auth token. The resolved value will be
65
+ * added to the request payload as defined by its `security` array.
66
+ */
67
+ auth?: ((auth: Auth) => Promise<AuthToken> | AuthToken) | AuthToken;
68
+ /**
69
+ * A function for serializing request body parameter. By default,
70
+ * {@link JSON.stringify()} will be used.
71
+ */
72
+ bodySerializer?: BodySerializer | null;
73
+ /**
74
+ * An object containing any HTTP headers that you want to pre-populate your
75
+ * `Headers` object with.
76
+ *
77
+ * {@link https://developer.mozilla.org/docs/Web/API/Headers/Headers#init See more}
78
+ */
79
+ headers?: RequestInit['headers'] | Record<string, string | number | boolean | (string | number | boolean)[] | null | undefined | unknown>;
80
+ /**
81
+ * The request method.
82
+ *
83
+ * {@link https://developer.mozilla.org/docs/Web/API/fetch#method See more}
84
+ */
85
+ method?: Uppercase<HttpMethod>;
86
+ /**
87
+ * A function for serializing request query parameters. By default, arrays
88
+ * will be exploded in form style, objects will be exploded in deepObject
89
+ * style, and reserved characters are percent-encoded.
90
+ *
91
+ * This method will have no effect if the native `paramsSerializer()` Axios
92
+ * API function is used.
93
+ *
94
+ * {@link https://swagger.io/docs/specification/serialization/#query View examples}
95
+ */
96
+ querySerializer?: QuerySerializer | QuerySerializerOptions;
97
+ /**
98
+ * A function validating request data. This is useful if you want to ensure
99
+ * the request conforms to the desired shape, so it can be safely sent to
100
+ * the server.
101
+ */
102
+ requestValidator?: (data: unknown) => Promise<unknown>;
103
+ /**
104
+ * A function transforming response data before it's returned. This is useful
105
+ * for post-processing data, e.g., converting ISO strings into Date objects.
106
+ */
107
+ responseTransformer?: (data: unknown) => Promise<unknown>;
108
+ /**
109
+ * A function validating response data. This is useful if you want to ensure
110
+ * the response conforms to the desired shape, so it can be safely passed to
111
+ * the transformers and returned to the user.
112
+ */
113
+ responseValidator?: (data: unknown) => Promise<unknown>;
114
+ }
115
+ /**
116
+ * Arbitrary metadata passed through the `meta` request option.
117
+ */
118
+ interface ClientMeta {}
119
+ type ServerSentEventsOptions<TData = unknown> = Omit<RequestInit, 'method'> & Pick<Config$1, 'method' | 'responseTransformer' | 'responseValidator'> & {
120
+ /**
121
+ * Fetch API implementation. You can use this option to provide a custom
122
+ * fetch instance.
123
+ *
124
+ * @default globalThis.fetch
125
+ */
126
+ fetch?: typeof fetch;
127
+ /**
128
+ * Implementing clients can call request interceptors inside this hook.
129
+ */
130
+ onRequest?: (url: string, init: RequestInit) => Promise<Request>;
131
+ /**
132
+ * Callback invoked when a network or parsing error occurs during streaming.
133
+ *
134
+ * This option applies only if the endpoint returns a stream of events.
135
+ *
136
+ * @param error The error that occurred.
137
+ */
138
+ onSseError?: (error: unknown) => void;
139
+ /**
140
+ * Callback invoked when an event is streamed from the server.
141
+ *
142
+ * This option applies only if the endpoint returns a stream of events.
143
+ *
144
+ * @param event Event streamed from the server.
145
+ * @returns Nothing (void).
146
+ */
147
+ onSseEvent?: (event: StreamEvent<TData>) => void;
148
+ serializedBody?: RequestInit['body'];
149
+ /**
150
+ * Default retry delay in milliseconds.
151
+ *
152
+ * This option applies only if the endpoint returns a stream of events.
153
+ *
154
+ * @default 3000
155
+ */
156
+ sseDefaultRetryDelay?: number;
157
+ /**
158
+ * Maximum number of retry attempts before giving up.
159
+ */
160
+ sseMaxRetryAttempts?: number;
161
+ /**
162
+ * Maximum retry delay in milliseconds.
163
+ *
164
+ * Applies only when exponential backoff is used.
165
+ *
166
+ * This option applies only if the endpoint returns a stream of events.
167
+ *
168
+ * @default 30000
169
+ */
170
+ sseMaxRetryDelay?: number;
171
+ /**
172
+ * Optional sleep function for retry backoff.
173
+ *
174
+ * Defaults to using `setTimeout`.
175
+ */
176
+ sseSleepFn?: (ms: number) => Promise<void>;
177
+ url: string;
178
+ };
179
+ interface StreamEvent<TData = unknown> {
180
+ data: TData;
181
+ event?: string;
182
+ id?: string;
183
+ retry?: number;
184
+ }
185
+ type ServerSentEventsResult<TData = unknown, TReturn = void, TNext = unknown> = {
186
+ stream: AsyncGenerator<TData extends Record<string, unknown> ? TData[keyof TData] : TData, TReturn, TNext>;
187
+ };
188
+ type ErrInterceptor<Err, Res, Req, Options> = (error: Err,
189
+ /** response may be undefined due to a network error where no response object is produced */
190
+ response: Res | undefined,
191
+ /** request may be undefined, because error may be from building the request object itself */
192
+ request: Req | undefined, options: Options) => Err | Promise<Err>;
193
+ type ReqInterceptor<Req, Options> = (request: Req, options: Options) => Req | Promise<Req>;
194
+ type ResInterceptor<Res, Req, Options> = (response: Res, request: Req, options: Options) => Res | Promise<Res>;
195
+ declare class Interceptors<Interceptor> {
196
+ fns: Array<Interceptor | null>;
197
+ clear(): void;
198
+ eject(id: number | Interceptor): void;
199
+ exists(id: number | Interceptor): boolean;
200
+ getInterceptorIndex(id: number | Interceptor): number;
201
+ update(id: number | Interceptor, fn: Interceptor): number | Interceptor | false;
202
+ use(fn: Interceptor): number;
203
+ }
204
+ interface Middleware<Req, Res, Err, Options> {
205
+ error: Interceptors<ErrInterceptor<Err, Res, Req, Options>>;
206
+ request: Interceptors<ReqInterceptor<Req, Options>>;
207
+ response: Interceptors<ResInterceptor<Res, Req, Options>>;
208
+ }
209
+ type ResponseStyle = 'data' | 'fields';
210
+ interface Config<T extends ClientOptions$1 = ClientOptions$1> extends Omit<RequestInit, 'body' | 'headers' | 'method'>, Config$1 {
211
+ /**
212
+ * Base URL for all requests made by this client.
213
+ */
214
+ baseUrl?: T['baseUrl'];
215
+ /**
216
+ * Fetch API implementation. You can use this option to provide a custom
217
+ * fetch instance.
218
+ *
219
+ * @default globalThis.fetch
220
+ */
221
+ fetch?: typeof fetch;
222
+ /**
223
+ * Please don't use the Fetch client for Next.js applications. The `next`
224
+ * options won't have any effect.
225
+ *
226
+ * Install {@link https://www.npmjs.com/package/@hey-api/client-next `@hey-api/client-next`} instead.
227
+ */
228
+ next?: never;
229
+ /**
230
+ * Return the response data parsed in a specified format. By default, `auto`
231
+ * will infer the appropriate method from the `Content-Type` response header.
232
+ * You can override this behavior with any of the {@link Body} methods.
233
+ * Select `stream` if you don't want to parse response data at all.
234
+ *
235
+ * @default 'auto'
236
+ */
237
+ parseAs?: 'arrayBuffer' | 'auto' | 'blob' | 'formData' | 'json' | 'stream' | 'text';
238
+ /**
239
+ * Should we return only data or multiple fields (data, error, response, etc.)?
240
+ *
241
+ * @default 'fields'
242
+ */
243
+ responseStyle?: ResponseStyle;
244
+ /**
245
+ * Throw an error instead of returning it in the response?
246
+ *
247
+ * @default false
248
+ */
249
+ throwOnError?: T['throwOnError'];
250
+ }
251
+ interface RequestOptions<TData = unknown, TResponseStyle extends ResponseStyle = 'fields', ThrowOnError extends boolean = boolean, Url extends string = string> extends Config<{
252
+ responseStyle: TResponseStyle;
253
+ throwOnError: ThrowOnError;
254
+ }>, Pick<ServerSentEventsOptions<TData>, 'onRequest' | 'onSseError' | 'onSseEvent' | 'sseDefaultRetryDelay' | 'sseMaxRetryAttempts' | 'sseMaxRetryDelay'> {
255
+ /**
256
+ * Any body that you want to add to your request.
257
+ *
258
+ * {@link https://developer.mozilla.org/docs/Web/API/fetch#body}
259
+ */
260
+ body?: unknown;
261
+ path?: Record<string, unknown>;
262
+ query?: Record<string, unknown>;
263
+ /**
264
+ * Security mechanism(s) to use for the request.
265
+ */
266
+ security?: ReadonlyArray<Auth>;
267
+ url: Url;
268
+ }
269
+ interface ResolvedRequestOptions<TResponseStyle extends ResponseStyle = 'fields', ThrowOnError extends boolean = boolean, Url extends string = string> extends RequestOptions<unknown, TResponseStyle, ThrowOnError, Url> {
270
+ headers: Headers;
271
+ serializedBody?: string;
272
+ }
273
+ type RequestResult<TData = unknown, TError = unknown, ThrowOnError extends boolean = boolean, TResponseStyle extends ResponseStyle = 'fields'> = ThrowOnError extends true ? Promise<TResponseStyle extends 'data' ? TData extends Record<string, unknown> ? TData[keyof TData] : TData : {
274
+ data: TData extends Record<string, unknown> ? TData[keyof TData] : TData;
275
+ request: Request;
276
+ response: Response;
277
+ }> : Promise<TResponseStyle extends 'data' ? (TData extends Record<string, unknown> ? TData[keyof TData] : TData) | undefined : ({
278
+ data: TData extends Record<string, unknown> ? TData[keyof TData] : TData;
279
+ error: undefined;
280
+ } | {
281
+ data: undefined;
282
+ error: TError extends Record<string, unknown> ? TError[keyof TError] : TError;
283
+ }) & {
284
+ /** request may be undefined, because error may be from building the request object itself */
285
+ request?: Request;
286
+ /** response may be undefined, because error may be from building the request object itself or from a network error */
287
+ response?: Response;
288
+ }>;
289
+ interface ClientOptions$1 {
290
+ baseUrl?: string;
291
+ responseStyle?: ResponseStyle;
292
+ throwOnError?: boolean;
293
+ }
294
+ type MethodFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = 'fields'>(options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, 'method'>) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>;
295
+ type SseFn = <TData = unknown, _TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = 'fields'>(options: Omit<RequestOptions<never, TResponseStyle, ThrowOnError>, 'method'>) => Promise<ServerSentEventsResult<TData>>;
296
+ type RequestFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = 'fields'>(options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, 'method'> & Pick<Required<RequestOptions<TData, TResponseStyle, ThrowOnError>>, 'method'>) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>;
297
+ type BuildUrlFn = <TData extends {
298
+ body?: unknown;
299
+ path?: Record<string, unknown>;
300
+ query?: Record<string, unknown>;
301
+ url: string;
302
+ }>(options: TData & Options<TData>) => string;
303
+ type Client = Client$1<RequestFn, Config, MethodFn, BuildUrlFn, SseFn> & {
304
+ interceptors: Middleware<Request, Response, unknown, ResolvedRequestOptions>;
305
+ };
306
+ interface TDataShape {
307
+ body?: unknown;
308
+ headers?: unknown;
309
+ path?: unknown;
310
+ query?: unknown;
311
+ url: string;
312
+ }
313
+ type OmitKeys<T, K> = Pick<T, Exclude<keyof T, K>>;
314
+ type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown, TResponseStyle extends ResponseStyle = 'fields'> = OmitKeys<RequestOptions<TResponse, TResponseStyle, ThrowOnError>, 'body' | 'path' | 'query' | 'url'> & ([TData] extends [never] ? unknown : Omit<TData, 'url'>);
315
+ export declare const createClient: (config?: Config) => Client;
316
+ type ClientOptions = {
317
+ baseUrl: 'https://data.wazoo.dev' | (string & {});
318
+ };
319
+ type WorldResource = {
320
+ /**
321
+ * Immutable World ID minted by Worlds API as `w_<ULID>`.
322
+ */
323
+ id: string;
324
+ /**
325
+ * User-facing display name for the world. Set on creation or update.
326
+ */
327
+ displayName: string;
328
+ /**
329
+ * Lifecycle state: active, deleted, or suspended. Deleted worlds enter a 30-day grace period before permanent purge.
330
+ */
331
+ state: string;
332
+ /**
333
+ * Storage backend for the world. All worlds share a single Cloudflare D1 database, separated by world_id.
334
+ *
335
+ * @deprecated
336
+ */
337
+ storage: 'd1';
338
+ /**
339
+ * Embedding model identifier used for vector search indexing, e.g. openai/text-embedding-3-small or openrouter/openai/text-embedding-3-small. Values outside the allowlist (including the legacy tfjs-universal-sentence-encoder default) are reported as embeddingStatus unconfigured and search stays keyword-only.
340
+ */
341
+ embeddingModel: string;
342
+ /**
343
+ * Whether vector search is usable for this world. unconfigured: embeddings are not enabled or the model is not allowlisted. no_credential: the namespace has no active embedding credential for the provider of this world's model. invalid: the provider rejected the namespace credential. stale: vectors are not built for the current model; search is keyword-only until POST /worlds/{worldId}/reindex. partial: some vectors failed to sync; hybrid search covers what exists. ready: vectors are current.
344
+ */
345
+ embeddingStatus: 'unconfigured' | 'no_credential' | 'invalid' | 'stale' | 'partial' | 'ready';
346
+ /**
347
+ * Maximum number of RDF quads per chunk when indexing for vector search.
348
+ */
349
+ chunkSize: number;
350
+ /**
351
+ * Default number of top search results to return when the caller does not override.
352
+ */
353
+ topK: number;
354
+ /**
355
+ * Default minimum relevance score (0–1) for search results. Results below this threshold are omitted.
356
+ */
357
+ minScore: number;
358
+ inference?: InferenceSetting;
359
+ /**
360
+ * Whether the world records when each fact was written or removed, by which API key and from what source. Read the records with POST /worlds/{worldId}/provenance.
361
+ */
362
+ provenance: boolean;
363
+ /**
364
+ * ISO 8601 timestamp when the world was created.
365
+ */
366
+ createTime: string;
367
+ /**
368
+ * ISO 8601 timestamp when the world was last updated.
369
+ */
370
+ updateTime: string;
371
+ /**
372
+ * ISO 8601 timestamp when the world was soft-deleted. Null if not deleted.
373
+ */
374
+ deleteTime?: string;
375
+ /**
376
+ * ISO 8601 timestamp when the world will be permanently purged after the grace period. Null if not scheduled for purge.
377
+ */
378
+ expireTime?: string;
379
+ };
380
+ /**
381
+ * OWL 2 RL inference setting. Omitted when never configured, which means inference is off.
382
+ */
383
+ type InferenceSetting = {
384
+ /**
385
+ * Opt the world in to OWL 2 RL materialization on write. false is the same as never setting it.
386
+ */
387
+ enabled: boolean;
388
+ /**
389
+ * Named-graph mode. per-graph (default) lists each entailed quad in the graph(s) that entail it alone; union merges all graphs and lists everything in the default graph.
390
+ */
391
+ graphs?: 'per-graph' | 'union';
392
+ /**
393
+ * Size guard (default 100000). A commit that would exceed this many asserted quads fails before writing instead of exhausting the isolate.
394
+ */
395
+ maxAssertedQuads?: number;
396
+ };
397
+ type CreateWorldRequest = {
398
+ /**
399
+ * User-facing display name for the new world.
400
+ */
401
+ displayName?: string;
402
+ /**
403
+ * Embedding model to use for vector search, as provider/model. Allowlist: openai/text-embedding-3-small (recommended), openai/text-embedding-3-large (pinned to 1536 dimensions), legacy openai/text-embedding-ada-002, and the same OpenAI models through OpenRouter as openrouter/openai/text-embedding-3-small and openrouter/openai/text-embedding-3-large. The model's provider decides which namespace credential is used. Defaults to the platform default, which reports embeddingStatus unconfigured until a model is chosen.
404
+ */
405
+ embeddingModel?: 'openai/text-embedding-3-small' | 'openai/text-embedding-3-large' | 'openai/text-embedding-ada-002' | 'openrouter/openai/text-embedding-3-small' | 'openrouter/openai/text-embedding-3-large';
406
+ /**
407
+ * Maximum quads per chunk for vector search indexing. Defaults to the platform default.
408
+ */
409
+ chunkSize?: number;
410
+ /**
411
+ * Default number of top results for search queries against this world.
412
+ */
413
+ topK?: number;
414
+ /**
415
+ * Default minimum relevance score (0–1) for search results in this world.
416
+ */
417
+ minScore?: number;
418
+ inference?: InferenceSetting & unknown;
419
+ /**
420
+ * Record when each fact is written or removed, by which API key and from what source. Off when omitted. Adds to the database rows each write uses.
421
+ */
422
+ provenance?: boolean;
423
+ };
424
+ type UpdateWorldRequest = {
425
+ /**
426
+ * New display name for the world.
427
+ */
428
+ displayName?: string;
429
+ /**
430
+ * New embedding model, as provider/model. Requires an active embedding credential, for the new model's provider, in the namespace. Changing the model marks the world stale (embeddingStatus stale): search is keyword-only until POST /worlds/{worldId}/reindex is called. It does not reindex automatically because reindexing spends the customer's provider budget.
431
+ */
432
+ embeddingModel?: 'openai/text-embedding-3-small' | 'openai/text-embedding-3-large' | 'openai/text-embedding-ada-002' | 'openrouter/openai/text-embedding-3-small' | 'openrouter/openai/text-embedding-3-large';
433
+ /**
434
+ * New chunk size for vector search indexing.
435
+ */
436
+ chunkSize?: number;
437
+ /**
438
+ * New default top-K for search queries.
439
+ */
440
+ topK?: number;
441
+ /**
442
+ * New default minimum score threshold for search results.
443
+ */
444
+ minScore?: number;
445
+ inference?: InferenceSetting & unknown;
446
+ /**
447
+ * Turns provenance recording on or off. Facts written while it is off never get records. Turning it off keeps the existing records, but they cannot be read until it is on again.
448
+ */
449
+ provenance?: boolean;
450
+ };
451
+ type VectorCleanupReport = {
452
+ /**
453
+ * Worlds of the namespace whose vectors were cleaned.
454
+ */
455
+ worlds: number;
456
+ attempted: number;
457
+ deleted: number;
458
+ failed: number;
459
+ /**
460
+ * True when vectors remain (a failure, or more than one request can remove). Calling the endpoint again is safe and continues; the purge sweep retries too.
461
+ */
462
+ incomplete: boolean;
463
+ errors: Array<string>;
464
+ };
465
+ type ImportResponse = {
466
+ /**
467
+ * Imported quad and chunk counts.
468
+ */
469
+ imported: {
470
+ /**
471
+ * Number of RDF quads successfully imported.
472
+ */
473
+ quads: number;
474
+ /**
475
+ * Number of vector search chunks created from the imported quads.
476
+ */
477
+ chunks: number;
478
+ };
479
+ };
480
+ type ErrorResponse = {
481
+ error: {
482
+ /**
483
+ * Machine-readable error code, e.g. NOT_FOUND, INVALID_ARGUMENT, RATE_LIMITED.
484
+ */
485
+ code: string;
486
+ /**
487
+ * Human-readable error message describing what went wrong.
488
+ */
489
+ message: string;
490
+ };
491
+ };
492
+ type EmbeddingFailureResponse = {
493
+ error: {
494
+ /**
495
+ * The embedding service failed or returned unusable vectors. Nothing was written; retrying the same request is safe.
496
+ */
497
+ code: 'EMBEDDING_FAILED';
498
+ message: string;
499
+ /**
500
+ * Class of the embedding failure (never provider text): no_credential, auth, rate_limited, timeout, provider_error, bad_request, or bad_response (including vectors of the wrong length).
501
+ */
502
+ reason: 'budget_exceeded' | 'no_credential' | 'auth' | 'rate_limited' | 'timeout' | 'provider_error' | 'bad_request' | 'bad_response';
503
+ };
504
+ };
505
+ type ImportRequest = {
506
+ /**
507
+ * RDF payload to import. The format must match the contentType field.
508
+ */
509
+ data: string;
510
+ /**
511
+ * MIME type of the import payload. Supported values: text/turtle, application/trig, application/n-triples, application/n-quads, text/n3, application/json (quad rows), text/plain or application/x-ndjson (text chunks). Defaults to text/turtle.
512
+ */
513
+ contentType?: string;
514
+ /**
515
+ * Where the data came from, such as a feed or tool name. Recorded with each new fact when the world keeps provenance, and ignored otherwise.
516
+ */
517
+ source?: string;
518
+ };
519
+ type ExportQuadsResponse = {
520
+ /**
521
+ * Page of exported RDF quads.
522
+ */
523
+ quads: Array<Quad>;
524
+ /**
525
+ * Offset for the next page. Omit this field when there are no more results.
526
+ */
527
+ nextOffset?: number;
528
+ };
529
+ type Quad = {
530
+ /**
531
+ * RDF subject URI.
532
+ */
533
+ subject: string;
534
+ /**
535
+ * RDF predicate URI.
536
+ */
537
+ predicate: string;
538
+ /**
539
+ * RDF object URI or literal value.
540
+ */
541
+ object: string;
542
+ /**
543
+ * Named graph URI. Null when the quad belongs to the default graph.
544
+ */
545
+ graph?: string;
546
+ };
547
+ type SearchResponse = {
548
+ /**
549
+ * Ranked search results, best first.
550
+ */
551
+ results: Array<SearchResult>;
552
+ /**
553
+ * Search mode that actually ran: keyword (full-text), semantic (vector), hybrid (both), or fallback (LIKE) when the primary engine is unavailable.
554
+ */
555
+ mode: 'semantic' | 'keyword' | 'hybrid' | 'fallback';
556
+ };
557
+ type SearchResult = {
558
+ /**
559
+ * Stable deterministic identifier for the matched quad and text (shared across backends), used for ranked-list evaluation and deduplication.
560
+ */
561
+ id: string;
562
+ /**
563
+ * RDF subject URI identifying the matched resource, e.g. https://example.org/entity/42.
564
+ */
565
+ subject: string;
566
+ /**
567
+ * RDF predicate URI describing the relationship, e.g. http://schema.org/name.
568
+ */
569
+ predicate: string;
570
+ /**
571
+ * Named graph URI the quad belongs to. Absent when the world uses a default graph.
572
+ */
573
+ graph?: string;
574
+ /**
575
+ * Text content of the matched quad, used for display and snippet generation. The single text field replacing the legacy object field.
576
+ */
577
+ content: string;
578
+ /**
579
+ * Relevance score from the search engine on the normalized 0–1 scale (1.0 = best). Null for fallback LIKE search results.
580
+ */
581
+ score: number | null;
582
+ /**
583
+ * Scoring family the score expresses: rrf (reciprocal rank fusion, normalized), cosine (vector similarity), or unranked (fallback results carry no ordering meaning).
584
+ */
585
+ scoreType: 'rrf' | 'cosine' | 'unranked';
586
+ };
587
+ type SearchRequest = {
588
+ /**
589
+ * Natural language or keyword search query to find matching content in the world.
590
+ */
591
+ query: string;
592
+ /**
593
+ * Maximum number of results to return (1–100). Defaults to 20. The response is capped at this value after ranking; the engine's internal candidate pool is at least this large.
594
+ */
595
+ limit?: number;
596
+ /**
597
+ * Override the world's minimum relevance score on the normalized 0–1 scale (1.0 = best). Results below this threshold are omitted after ranking.
598
+ */
599
+ minScore?: number;
600
+ filter?: SearchFilter;
601
+ };
602
+ /**
603
+ * Include/exclude quad filters applied before ranking (SDK QuadFilter semantics).
604
+ */
605
+ type SearchFilter = {
606
+ /**
607
+ * Include allowlist: only quads matching these exact subject/predicate/graph values are candidates.
608
+ */
609
+ include?: {
610
+ /**
611
+ * Only match quads whose subject is in this list. Applied before ranking.
612
+ */
613
+ subjects?: Array<string>;
614
+ /**
615
+ * Only match quads whose predicate is in this list. Applied before ranking.
616
+ */
617
+ predicates?: Array<string>;
618
+ /**
619
+ * Only match quads whose graph is in this list. Applied before ranking.
620
+ */
621
+ graphs?: Array<string>;
622
+ };
623
+ /**
624
+ * Exclude denylist: quads matching these exact subject/predicate/graph values are not candidates.
625
+ */
626
+ exclude?: {
627
+ /**
628
+ * Exclude quads whose subject is in this list. Applied before ranking.
629
+ */
630
+ subjects?: Array<string>;
631
+ /**
632
+ * Exclude quads whose predicate is in this list. Applied before ranking.
633
+ */
634
+ predicates?: Array<string>;
635
+ /**
636
+ * Exclude quads whose graph is in this list. Applied before ranking.
637
+ */
638
+ graphs?: Array<string>;
639
+ };
640
+ };
641
+ type SparqlRequest = {
642
+ /**
643
+ * SPARQL 1.1 query string. Supports SELECT, ASK, and SPARQL UPDATE (INSERT/DELETE). SELECT results are limited by the server-configured maximum.
644
+ */
645
+ query: string;
646
+ };
647
+ type ApiKeyCreateResponse = {
648
+ /**
649
+ * Unique identifier for the created API key.
650
+ */
651
+ uid: string;
652
+ /**
653
+ * The full bearer token (wzw format). Displayed once on creation — store it securely.
654
+ */
655
+ token: string;
656
+ /**
657
+ * Human-readable label for the key.
658
+ */
659
+ name: string;
660
+ /**
661
+ * Namespace the key is scoped to.
662
+ */
663
+ namespace: string;
664
+ /**
665
+ * World ID the key is scoped to, or null if the key has namespace-wide access.
666
+ */
667
+ worldId: string | null;
668
+ /**
669
+ * ISO 8601 timestamp when the key was created.
670
+ */
671
+ createTime: string;
672
+ };
673
+ type ApiKeyCreateRequest = {
674
+ /**
675
+ * Namespace to scope the API key to. Required. The key can only access worlds within this namespace.
676
+ */
677
+ namespace: string;
678
+ /**
679
+ * Optional world ID to scope the key to a single world. Omit to allow access to all worlds in the namespace.
680
+ */
681
+ worldId?: string;
682
+ /**
683
+ * Human-readable label for the key. Helps identify keys in the list.
684
+ */
685
+ name?: string;
686
+ /**
687
+ * Optional scope grant. Defaults to ["data:read", "data:write"]. Use ["data:read"] for read-only keys. embeddings:admin grants management of the namespace embedding credential and is never part of the default grant.
688
+ */
689
+ scopes?: Array<'data:read' | 'data:write' | 'embeddings:admin'>;
690
+ };
691
+ type ApiKeyResource = {
692
+ /**
693
+ * Unique identifier for the API key.
694
+ */
695
+ uid: string;
696
+ /**
697
+ * Human-readable label for the key.
698
+ */
699
+ name: string;
700
+ /**
701
+ * Namespace the key is scoped to.
702
+ */
703
+ namespace: string;
704
+ /**
705
+ * World ID the key is scoped to, or absent for namespace-wide keys.
706
+ */
707
+ worldId?: string;
708
+ /**
709
+ * Granted scopes, e.g. ["data:read", "data:write"].
710
+ */
711
+ scopes: Array<string>;
712
+ /**
713
+ * ISO 8601 timestamp when the key was created.
714
+ */
715
+ createTime: string;
716
+ };
717
+ type VectorSyncReport = {
718
+ enabled: boolean;
719
+ attempted: number;
720
+ upserted: number;
721
+ failedUpserts: number;
722
+ embeddingFailures: number;
723
+ staleDeleteFailures: number;
724
+ errors: Array<string>;
725
+ };
726
+ type ProvenanceResponse = {
727
+ /**
728
+ * One row per event, grouped by fact.
729
+ */
730
+ records: Array<ProvenanceRecord>;
731
+ };
732
+ type ProvenanceRecord = {
733
+ /**
734
+ * Stable identifier of the fact, derived from its content. Every event of one fact shares it.
735
+ */
736
+ factId: string;
737
+ /**
738
+ * Subject of the fact.
739
+ */
740
+ subject: string;
741
+ /**
742
+ * Predicate of the fact.
743
+ */
744
+ predicate: string;
745
+ /**
746
+ * Object of the fact.
747
+ */
748
+ object: string;
749
+ /**
750
+ * Named graph IRI. Absent for the default graph.
751
+ */
752
+ graph?: string;
753
+ /**
754
+ * What happened. Absent, with time and the writer fields, when the fact has no records.
755
+ */
756
+ type?: 'write' | 'remove';
757
+ /**
758
+ * ISO 8601 timestamp of the event.
759
+ */
760
+ time?: string;
761
+ /**
762
+ * ID of the API key that made the change, or `admin` for the platform's own key. Set by the API; callers cannot choose it.
763
+ */
764
+ writerKeyId?: string;
765
+ /**
766
+ * Name of that API key, if it has one.
767
+ */
768
+ writerName?: string;
769
+ /**
770
+ * The source given with the import.
771
+ */
772
+ source?: string;
773
+ /**
774
+ * factId of the fact this one replaced: same subject, predicate and graph, removed in the same change.
775
+ */
776
+ replacesFactId?: string;
777
+ };
778
+ type ProvenanceRequest = {
779
+ /**
780
+ * Subject IRI whose facts to look up.
781
+ */
782
+ subject: string;
783
+ /**
784
+ * Only return facts with this predicate IRI.
785
+ */
786
+ predicate?: string;
787
+ /**
788
+ * Maximum number of records to return (1–100).
789
+ */
790
+ limit?: number;
791
+ };
792
+ type NamespaceWriteBudget = {
793
+ namespace: string;
794
+ /**
795
+ * The override set for this namespace, or null when it uses the default.
796
+ */
797
+ dailyRows: number | null;
798
+ /**
799
+ * The deployment default (NAMESPACE_DAILY_ROW_WRITE_BUDGET), or null when none is set.
800
+ */
801
+ defaultDailyRows: number | null;
802
+ /**
803
+ * The budget that applies now: the override, else the default. Null means no budget.
804
+ */
805
+ effectiveDailyRows: number | null;
806
+ /**
807
+ * D1 rows the namespace has written today (UTC), index writes included.
808
+ */
809
+ rowsWrittenToday: number;
810
+ /**
811
+ * The UTC day, YYYY-MM-DD.
812
+ */
813
+ day: string;
814
+ };
815
+ type SetNamespaceWriteBudgetRequest = {
816
+ /**
817
+ * Daily D1 rows the namespace may write (UTC day). Each stored quad costs about 9 rows, and about 94 per asserted quad with inference on.
818
+ */
819
+ dailyRows: number;
820
+ };
821
+ type EmbeddingProviderList = {
822
+ /**
823
+ * One entry per provider the namespace has stored a credential for, newest first, revoked ones included.
824
+ */
825
+ providers: Array<EmbeddingCredential>;
826
+ };
827
+ type EmbeddingCredential = {
828
+ /**
829
+ * Embedding provider.
830
+ */
831
+ provider: 'openai' | 'openrouter';
832
+ /**
833
+ * active: usable. invalid: the provider rejected the key repeatedly; rotate it. revoked: deleted; worlds fall back to keyword-only search.
834
+ */
835
+ status: 'active' | 'invalid' | 'revoked';
836
+ /**
837
+ * First 8 hex characters of the key's SHA-256, for support.
838
+ */
839
+ fingerprint: string;
840
+ /**
841
+ * Last four characters of the key.
842
+ */
843
+ last4: string;
844
+ /**
845
+ * ISO 8601 creation time.
846
+ */
847
+ createTime: string;
848
+ /**
849
+ * ISO 8601 time of the most recent rotation.
850
+ */
851
+ rotateTime?: string;
852
+ /**
853
+ * ISO 8601 time the credential was revoked.
854
+ */
855
+ revokeTime?: string;
856
+ };
857
+ type EmbeddingCredentialRequest = {
858
+ /**
859
+ * The provider API key. Write-only: it is encrypted at rest and never returned or logged; only a fingerprint and last four characters are exposed.
860
+ */
861
+ apiKey: string;
862
+ };
863
+ type GetHealthData = {
864
+ body?: never;
865
+ path?: never;
866
+ query?: never;
867
+ url: '/health';
868
+ };
869
+ type GetHealthErrors = {
870
+ /**
871
+ * Service is degraded
872
+ */
873
+ 503: {
874
+ status: 'degraded';
875
+ gitSha: string | null;
876
+ error: string;
877
+ };
878
+ };
879
+ type GetHealthError = GetHealthErrors[keyof GetHealthErrors];
880
+ type GetHealthResponses = {
881
+ /**
882
+ * Service is healthy
883
+ */
884
+ 200: {
885
+ status: 'ok';
886
+ gitSha: string | null;
887
+ };
888
+ };
889
+ type GetHealthResponse = GetHealthResponses[keyof GetHealthResponses];
890
+ type GetReadinessData = {
891
+ body?: never;
892
+ path?: never;
893
+ query?: never;
894
+ url: '/ready';
895
+ };
896
+ type GetReadinessErrors = {
897
+ /**
898
+ * Service is not ready
899
+ */
900
+ 503: {
901
+ status: 'not_ready';
902
+ error: string;
903
+ };
904
+ };
905
+ type GetReadinessError = GetReadinessErrors[keyof GetReadinessErrors];
906
+ type GetReadinessResponses = {
907
+ /**
908
+ * Service and control-plane schema are ready
909
+ */
910
+ 200: {
911
+ status: 'ready';
912
+ };
913
+ };
914
+ type GetReadinessResponse = GetReadinessResponses[keyof GetReadinessResponses];
915
+ type ListWorldsData = {
916
+ body?: never;
917
+ path?: never;
918
+ query?: never;
919
+ url: '/worlds';
920
+ };
921
+ type ListWorldsResponses = {
922
+ /**
923
+ * World list
924
+ */
925
+ 200: {
926
+ worlds: Array<WorldResource>;
927
+ };
928
+ };
929
+ type ListWorldsResponse = ListWorldsResponses[keyof ListWorldsResponses];
930
+ type CreateWorldData = {
931
+ body: CreateWorldRequest;
932
+ path?: never;
933
+ query?: never;
934
+ url: '/worlds';
935
+ };
936
+ type CreateWorldErrors = {
937
+ /**
938
+ * Bad request
939
+ */
940
+ 400: {
941
+ error: {
942
+ code: string;
943
+ message: string;
944
+ };
945
+ };
946
+ /**
947
+ * embeddingModel was given but the namespace has no active embedding credential (EMBEDDING_CREDENTIAL_REQUIRED).
948
+ */
949
+ 409: {
950
+ error: {
951
+ code: string;
952
+ message: string;
953
+ };
954
+ };
955
+ };
956
+ type CreateWorldError = CreateWorldErrors[keyof CreateWorldErrors];
957
+ type CreateWorldResponses = {
958
+ /**
959
+ * Created World
960
+ */
961
+ 201: WorldResource;
962
+ };
963
+ type CreateWorldResponse = CreateWorldResponses[keyof CreateWorldResponses];
964
+ type DeleteWorldData = {
965
+ body?: never;
966
+ path: {
967
+ /**
968
+ * The world-api-minted world ID, a w_ prefix and a lowercase ULID.
969
+ */
970
+ worldId: string;
971
+ };
972
+ query?: never;
973
+ url: '/worlds/{worldId}';
974
+ };
975
+ type DeleteWorldErrors = {
976
+ /**
977
+ * Not found
978
+ */
979
+ 404: {
980
+ error: {
981
+ code: string;
982
+ message: string;
983
+ };
984
+ };
985
+ };
986
+ type DeleteWorldError = DeleteWorldErrors[keyof DeleteWorldErrors];
987
+ type DeleteWorldResponses = {
988
+ /**
989
+ * Deleted
990
+ */
991
+ 204: void;
992
+ };
993
+ type DeleteWorldResponse = DeleteWorldResponses[keyof DeleteWorldResponses];
994
+ type GetWorldData = {
995
+ body?: never;
996
+ path: {
997
+ /**
998
+ * The world-api-minted world ID, a w_ prefix and a lowercase ULID.
999
+ */
1000
+ worldId: string;
1001
+ };
1002
+ query?: never;
1003
+ url: '/worlds/{worldId}';
1004
+ };
1005
+ type GetWorldErrors = {
1006
+ /**
1007
+ * Not found
1008
+ */
1009
+ 404: {
1010
+ error: {
1011
+ code: string;
1012
+ message: string;
1013
+ };
1014
+ };
1015
+ };
1016
+ type GetWorldError = GetWorldErrors[keyof GetWorldErrors];
1017
+ type GetWorldResponses = {
1018
+ /**
1019
+ * World
1020
+ */
1021
+ 200: WorldResource;
1022
+ };
1023
+ type GetWorldResponse = GetWorldResponses[keyof GetWorldResponses];
1024
+ type UpdateWorldData = {
1025
+ body: UpdateWorldRequest;
1026
+ path: {
1027
+ /**
1028
+ * The world-api-minted world ID, a w_ prefix and a lowercase ULID.
1029
+ */
1030
+ worldId: string;
1031
+ };
1032
+ query?: never;
1033
+ url: '/worlds/{worldId}';
1034
+ };
1035
+ type UpdateWorldErrors = {
1036
+ /**
1037
+ * Bad request
1038
+ */
1039
+ 400: {
1040
+ error: {
1041
+ code: string;
1042
+ message: string;
1043
+ };
1044
+ };
1045
+ /**
1046
+ * Not found
1047
+ */
1048
+ 404: {
1049
+ error: {
1050
+ code: string;
1051
+ message: string;
1052
+ };
1053
+ };
1054
+ };
1055
+ type UpdateWorldError = UpdateWorldErrors[keyof UpdateWorldErrors];
1056
+ type UpdateWorldResponses = {
1057
+ /**
1058
+ * Updated World
1059
+ */
1060
+ 200: WorldResource;
1061
+ };
1062
+ type UpdateWorldResponse = UpdateWorldResponses[keyof UpdateWorldResponses];
1063
+ type UndeleteWorldData = {
1064
+ body?: never;
1065
+ path: {
1066
+ /**
1067
+ * The world-api-minted world ID, a w_ prefix and a lowercase ULID.
1068
+ */
1069
+ worldId: string;
1070
+ };
1071
+ query?: never;
1072
+ url: '/worlds/{worldId}/undelete';
1073
+ };
1074
+ type UndeleteWorldErrors = {
1075
+ /**
1076
+ * Not found
1077
+ */
1078
+ 404: {
1079
+ error: {
1080
+ code: string;
1081
+ message: string;
1082
+ };
1083
+ };
1084
+ /**
1085
+ * Restore blocked
1086
+ */
1087
+ 409: {
1088
+ error: {
1089
+ code: string;
1090
+ message: string;
1091
+ };
1092
+ };
1093
+ };
1094
+ type UndeleteWorldError = UndeleteWorldErrors[keyof UndeleteWorldErrors];
1095
+ type UndeleteWorldResponses = {
1096
+ /**
1097
+ * Restored World
1098
+ */
1099
+ 200: WorldResource;
1100
+ };
1101
+ type UndeleteWorldResponse = UndeleteWorldResponses[keyof UndeleteWorldResponses];
1102
+ type SuspendWorldData = {
1103
+ body?: never;
1104
+ path: {
1105
+ /**
1106
+ * The world-api-minted world ID, a w_ prefix and a lowercase ULID.
1107
+ */
1108
+ worldId: string;
1109
+ };
1110
+ query?: never;
1111
+ url: '/worlds/{worldId}/suspend';
1112
+ };
1113
+ type SuspendWorldErrors = {
1114
+ /**
1115
+ * Not found
1116
+ */
1117
+ 404: {
1118
+ error: {
1119
+ code: string;
1120
+ message: string;
1121
+ };
1122
+ };
1123
+ };
1124
+ type SuspendWorldError = SuspendWorldErrors[keyof SuspendWorldErrors];
1125
+ type SuspendWorldResponses = {
1126
+ /**
1127
+ * Suspended World
1128
+ */
1129
+ 200: WorldResource;
1130
+ };
1131
+ type SuspendWorldResponse = SuspendWorldResponses[keyof SuspendWorldResponses];
1132
+ type ResumeWorldData = {
1133
+ body?: never;
1134
+ path: {
1135
+ /**
1136
+ * The world-api-minted world ID, a w_ prefix and a lowercase ULID.
1137
+ */
1138
+ worldId: string;
1139
+ };
1140
+ query?: never;
1141
+ url: '/worlds/{worldId}/resume';
1142
+ };
1143
+ type ResumeWorldErrors = {
1144
+ /**
1145
+ * Not found
1146
+ */
1147
+ 404: {
1148
+ error: {
1149
+ code: string;
1150
+ message: string;
1151
+ };
1152
+ };
1153
+ };
1154
+ type ResumeWorldError = ResumeWorldErrors[keyof ResumeWorldErrors];
1155
+ type ResumeWorldResponses = {
1156
+ /**
1157
+ * Resumed World
1158
+ */
1159
+ 200: WorldResource;
1160
+ };
1161
+ type ResumeWorldResponse = ResumeWorldResponses[keyof ResumeWorldResponses];
1162
+ type DeleteNamespaceWorldsData = {
1163
+ body?: never;
1164
+ path: {
1165
+ namespace: string;
1166
+ };
1167
+ query?: never;
1168
+ url: '/admin/namespaces/{namespace}/delete';
1169
+ };
1170
+ type DeleteNamespaceWorldsErrors = {
1171
+ /**
1172
+ * Forbidden
1173
+ */
1174
+ 403: {
1175
+ error: {
1176
+ code: string;
1177
+ message: string;
1178
+ };
1179
+ };
1180
+ };
1181
+ type DeleteNamespaceWorldsError = DeleteNamespaceWorldsErrors[keyof DeleteNamespaceWorldsErrors];
1182
+ type DeleteNamespaceWorldsResponses = {
1183
+ /**
1184
+ * Delete result
1185
+ */
1186
+ 200: {
1187
+ deletedWorlds: number;
1188
+ revokedKeys: number;
1189
+ vectorCleanup?: VectorCleanupReport;
1190
+ };
1191
+ };
1192
+ type DeleteNamespaceWorldsResponse = DeleteNamespaceWorldsResponses[keyof DeleteNamespaceWorldsResponses];
1193
+ type PurgeWorldsData = {
1194
+ body?: never;
1195
+ path?: never;
1196
+ query?: never;
1197
+ url: '/admin/purge';
1198
+ };
1199
+ type PurgeWorldsErrors = {
1200
+ /**
1201
+ * Forbidden
1202
+ */
1203
+ 403: {
1204
+ error: {
1205
+ code: string;
1206
+ message: string;
1207
+ };
1208
+ };
1209
+ };
1210
+ type PurgeWorldsError = PurgeWorldsErrors[keyof PurgeWorldsErrors];
1211
+ type PurgeWorldsResponses = {
1212
+ /**
1213
+ * Purge sweep result
1214
+ */
1215
+ 200: {
1216
+ purged: number;
1217
+ failed: number;
1218
+ };
1219
+ };
1220
+ type PurgeWorldsResponse = PurgeWorldsResponses[keyof PurgeWorldsResponses];
1221
+ type ImportWorldData = {
1222
+ body: ImportRequest;
1223
+ path: {
1224
+ /**
1225
+ * The world-api-minted world ID, a w_ prefix and a lowercase ULID.
1226
+ */
1227
+ worldId: string;
1228
+ };
1229
+ query?: never;
1230
+ url: '/worlds/{worldId}/import';
1231
+ };
1232
+ type ImportWorldErrors = {
1233
+ /**
1234
+ * Bad request
1235
+ */
1236
+ 400: {
1237
+ error: {
1238
+ code: string;
1239
+ message: string;
1240
+ };
1241
+ };
1242
+ /**
1243
+ * The namespace has used its daily database write budget (WRITE_BUDGET_EXCEEDED). Nothing was written; it resets at 00:00 UTC. Reads are unaffected. A 429 EMBEDDING_BUDGET_EXCEEDED means the daily embedding budget ran out during the write; nothing was written.
1244
+ */
1245
+ 429: ErrorResponse;
1246
+ /**
1247
+ * The embedding service failed or returned vectors of the wrong length (EMBEDDING_FAILED; reason says which class). Nothing was written and the same request can be retried. Worlds that are not embedding-enabled (stale or no credential) are written keyword-only and never return this.
1248
+ */
1249
+ 502: EmbeddingFailureResponse;
1250
+ };
1251
+ type ImportWorldError = ImportWorldErrors[keyof ImportWorldErrors];
1252
+ type ImportWorldResponses = {
1253
+ /**
1254
+ * Import result
1255
+ */
1256
+ 200: ImportResponse;
1257
+ };
1258
+ type ImportWorldResponse = ImportWorldResponses[keyof ImportWorldResponses];
1259
+ type ExportWorldData = {
1260
+ body?: never;
1261
+ path: {
1262
+ /**
1263
+ * The world-api-minted world ID, a w_ prefix and a lowercase ULID.
1264
+ */
1265
+ worldId: string;
1266
+ };
1267
+ query?: {
1268
+ /**
1269
+ * Export format. Supported: application/json (quad rows), text/plain (text chunks), application/n-quads, application/n-triples, text/turtle, application/trig, application/ld+json. Defaults to application/json.
1270
+ */
1271
+ format?: string;
1272
+ /**
1273
+ * Maximum number of quads in this page (a positive integer). Honored by every format. Defaults to 1000 for application/json and text/plain; serialized RDF formats return the whole world when limit is omitted. When more data remains, the response carries an X-Next-Offset header (and nextOffset in JSON bodies).
1274
+ */
1275
+ limit?: string;
1276
+ /**
1277
+ * Pagination offset (a non-negative integer). Use the X-Next-Offset header, or nextOffset in JSON bodies, from the previous response.
1278
+ */
1279
+ offset?: string;
1280
+ };
1281
+ url: '/worlds/{worldId}/export';
1282
+ };
1283
+ type ExportWorldErrors = {
1284
+ /**
1285
+ * Bad request
1286
+ */
1287
+ 400: {
1288
+ error: {
1289
+ code: string;
1290
+ message: string;
1291
+ };
1292
+ };
1293
+ };
1294
+ type ExportWorldError = ExportWorldErrors[keyof ExportWorldErrors];
1295
+ type ExportWorldResponses = {
1296
+ /**
1297
+ * Export result
1298
+ */
1299
+ 200: ExportQuadsResponse;
1300
+ };
1301
+ type ExportWorldResponse = ExportWorldResponses[keyof ExportWorldResponses];
1302
+ type SearchWorldData = {
1303
+ body: SearchRequest;
1304
+ path: {
1305
+ /**
1306
+ * The world-api-minted world ID, a w_ prefix and a lowercase ULID.
1307
+ */
1308
+ worldId: string;
1309
+ };
1310
+ query?: never;
1311
+ url: '/worlds/{worldId}/search';
1312
+ };
1313
+ type SearchWorldErrors = {
1314
+ /**
1315
+ * Bad request
1316
+ */
1317
+ 400: {
1318
+ error: {
1319
+ code: string;
1320
+ message: string;
1321
+ };
1322
+ };
1323
+ };
1324
+ type SearchWorldError = SearchWorldErrors[keyof SearchWorldErrors];
1325
+ type SearchWorldResponses = {
1326
+ /**
1327
+ * Search results
1328
+ */
1329
+ 200: SearchResponse;
1330
+ };
1331
+ type SearchWorldResponse = SearchWorldResponses[keyof SearchWorldResponses];
1332
+ type SparqlNoWorldData = {
1333
+ body?: never;
1334
+ path?: never;
1335
+ query?: never;
1336
+ url: '/worlds/sparql';
1337
+ };
1338
+ type SparqlNoWorldErrors = {
1339
+ /**
1340
+ * Must specify a World
1341
+ */
1342
+ 400: {
1343
+ error: {
1344
+ code: string;
1345
+ message: string;
1346
+ };
1347
+ };
1348
+ };
1349
+ type SparqlNoWorldError = SparqlNoWorldErrors[keyof SparqlNoWorldErrors];
1350
+ type SparqlWorldData = {
1351
+ body: SparqlRequest;
1352
+ path: {
1353
+ /**
1354
+ * The world-api-minted world ID, a w_ prefix and a lowercase ULID.
1355
+ */
1356
+ worldId: string;
1357
+ };
1358
+ query?: never;
1359
+ url: '/worlds/{worldId}/sparql';
1360
+ };
1361
+ type SparqlWorldErrors = {
1362
+ /**
1363
+ * Bad request
1364
+ */
1365
+ 400: {
1366
+ error: {
1367
+ code: string;
1368
+ message: string;
1369
+ };
1370
+ };
1371
+ /**
1372
+ * The namespace has used its daily database write budget (WRITE_BUDGET_EXCEEDED). Nothing was written; it resets at 00:00 UTC. Reads are unaffected. A 429 EMBEDDING_BUDGET_EXCEEDED means the daily embedding budget ran out during the write; nothing was written.
1373
+ */
1374
+ 429: ErrorResponse;
1375
+ /**
1376
+ * The embedding service failed or returned vectors of the wrong length (EMBEDDING_FAILED; reason says which class). Nothing was written and the same request can be retried. Worlds that are not embedding-enabled (stale or no credential) are written keyword-only and never return this.
1377
+ */
1378
+ 502: EmbeddingFailureResponse;
1379
+ };
1380
+ type SparqlWorldError = SparqlWorldErrors[keyof SparqlWorldErrors];
1381
+ type SparqlWorldResponses = {
1382
+ /**
1383
+ * SPARQL query result
1384
+ */
1385
+ 200: unknown;
1386
+ };
1387
+ type ListApiKeysData = {
1388
+ body?: never;
1389
+ path?: never;
1390
+ query?: {
1391
+ /**
1392
+ * Filter API keys by namespace.
1393
+ */
1394
+ namespace?: string;
1395
+ };
1396
+ url: '/api-keys';
1397
+ };
1398
+ type ListApiKeysErrors = {
1399
+ /**
1400
+ * Forbidden
1401
+ */
1402
+ 403: {
1403
+ error: {
1404
+ code: string;
1405
+ message: string;
1406
+ };
1407
+ };
1408
+ };
1409
+ type ListApiKeysError = ListApiKeysErrors[keyof ListApiKeysErrors];
1410
+ type ListApiKeysResponses = {
1411
+ /**
1412
+ * API keys list
1413
+ */
1414
+ 200: {
1415
+ keys: Array<ApiKeyResource>;
1416
+ };
1417
+ };
1418
+ type ListApiKeysResponse = ListApiKeysResponses[keyof ListApiKeysResponses];
1419
+ type CreateApiKeyData = {
1420
+ body: ApiKeyCreateRequest;
1421
+ path?: never;
1422
+ query?: never;
1423
+ url: '/api-keys';
1424
+ };
1425
+ type CreateApiKeyErrors = {
1426
+ /**
1427
+ * Bad request
1428
+ */
1429
+ 400: {
1430
+ error: {
1431
+ code: string;
1432
+ message: string;
1433
+ };
1434
+ };
1435
+ /**
1436
+ * Forbidden
1437
+ */
1438
+ 403: {
1439
+ error: {
1440
+ code: string;
1441
+ message: string;
1442
+ };
1443
+ };
1444
+ };
1445
+ type CreateApiKeyError = CreateApiKeyErrors[keyof CreateApiKeyErrors];
1446
+ type CreateApiKeyResponses = {
1447
+ /**
1448
+ * Created API key
1449
+ */
1450
+ 201: ApiKeyCreateResponse;
1451
+ };
1452
+ type CreateApiKeyResponse = CreateApiKeyResponses[keyof CreateApiKeyResponses];
1453
+ type DeleteApiKeyData = {
1454
+ body?: never;
1455
+ path: {
1456
+ /**
1457
+ * Unique identifier of the API key to revoke.
1458
+ */
1459
+ keyId: string;
1460
+ };
1461
+ query?: never;
1462
+ url: '/api-keys/{keyId}';
1463
+ };
1464
+ type DeleteApiKeyErrors = {
1465
+ /**
1466
+ * Forbidden
1467
+ */
1468
+ 403: {
1469
+ error: {
1470
+ code: string;
1471
+ message: string;
1472
+ };
1473
+ };
1474
+ /**
1475
+ * Not found
1476
+ */
1477
+ 404: {
1478
+ error: {
1479
+ code: string;
1480
+ message: string;
1481
+ };
1482
+ };
1483
+ };
1484
+ type DeleteApiKeyError = DeleteApiKeyErrors[keyof DeleteApiKeyErrors];
1485
+ type DeleteApiKeyResponses = {
1486
+ /**
1487
+ * Revoked
1488
+ */
1489
+ 204: void;
1490
+ };
1491
+ type DeleteApiKeyResponse = DeleteApiKeyResponses[keyof DeleteApiKeyResponses];
1492
+ type ReindexWorldData = {
1493
+ body?: never;
1494
+ path: {
1495
+ /**
1496
+ * The world-api-minted world ID, a w_ prefix and a lowercase ULID.
1497
+ */
1498
+ worldId: string;
1499
+ };
1500
+ query?: never;
1501
+ url: '/worlds/{worldId}/reindex';
1502
+ };
1503
+ type ReindexWorldErrors = {
1504
+ /**
1505
+ * World database not found
1506
+ */
1507
+ 404: {
1508
+ error: {
1509
+ code: string;
1510
+ message: string;
1511
+ };
1512
+ };
1513
+ /**
1514
+ * The namespace's daily embedding budget is exhausted (EMBEDDING_BUDGET_EXCEEDED), before or during the run. The world is not marked ready and a windowed pass keeps its cursor.
1515
+ */
1516
+ 429: {
1517
+ error: {
1518
+ code: string;
1519
+ message: string;
1520
+ };
1521
+ };
1522
+ /**
1523
+ * Reindex failed
1524
+ */
1525
+ 500: {
1526
+ error: {
1527
+ code: string;
1528
+ message: string;
1529
+ };
1530
+ };
1531
+ /**
1532
+ * The embedding service failed or returned vectors of the wrong length (EMBEDDING_FAILED; reason says which class). The world is never marked ready and a windowed pass keeps its cursor: call again to retry the same window. If the namespace budget runs out mid-request the response is 429 EMBEDDING_BUDGET_EXCEEDED instead.
1533
+ */
1534
+ 502: EmbeddingFailureResponse;
1535
+ };
1536
+ type ReindexWorldError = ReindexWorldErrors[keyof ReindexWorldErrors];
1537
+ type ReindexWorldResponses = {
1538
+ /**
1539
+ * Reindex ran. status is completed, completed_with_vector_errors when the vector index could not be fully synced (see vectorSync; calling again retries the failed window), or in_progress when a large world is reindexed in windows: call again until completed (continuation.remainingChunksEstimate says how much is left).
1540
+ */
1541
+ 200: {
1542
+ ok: true;
1543
+ status: 'completed' | 'completed_with_vector_errors' | 'in_progress';
1544
+ processedQuadCount: number;
1545
+ chunkRowCount: number;
1546
+ vectorSync?: VectorSyncReport;
1547
+ continuation?: {
1548
+ remainingChunksEstimate: number;
1549
+ };
1550
+ };
1551
+ };
1552
+ type ReindexWorldResponse = ReindexWorldResponses[keyof ReindexWorldResponses];
1553
+ type BackfillWorldInferenceData = {
1554
+ body?: never;
1555
+ path: {
1556
+ /**
1557
+ * The world-api-minted world ID, a w_ prefix and a lowercase ULID.
1558
+ */
1559
+ worldId: string;
1560
+ };
1561
+ query?: never;
1562
+ url: '/worlds/{worldId}/infer';
1563
+ };
1564
+ type BackfillWorldInferenceErrors = {
1565
+ /**
1566
+ * World database not found
1567
+ */
1568
+ 404: ErrorResponse;
1569
+ /**
1570
+ * Inference is not enabled for this world (INFERENCE_NOT_ENABLED), or the database is missing the quads.derived column (INFERENCE_UNAVAILABLE).
1571
+ */
1572
+ 409: ErrorResponse;
1573
+ /**
1574
+ * The world has more asserted quads than its maxAssertedQuads limit (INFERENCE_SIZE_GUARD). Nothing was written.
1575
+ */
1576
+ 422: ErrorResponse;
1577
+ /**
1578
+ * The namespace has used its daily database write budget (WRITE_BUDGET_EXCEEDED). Nothing was written; it resets at 00:00 UTC.
1579
+ */
1580
+ 429: ErrorResponse;
1581
+ /**
1582
+ * The back-fill failed
1583
+ */
1584
+ 500: ErrorResponse;
1585
+ };
1586
+ type BackfillWorldInferenceError = BackfillWorldInferenceErrors[keyof BackfillWorldInferenceErrors];
1587
+ type BackfillWorldInferenceResponses = {
1588
+ /**
1589
+ * The back-fill ran.
1590
+ */
1591
+ 200: {
1592
+ ok: true;
1593
+ /**
1594
+ * Asserted quads the reasoner read.
1595
+ */
1596
+ assertedQuads: number;
1597
+ /**
1598
+ * Inferred quads stored after the back-fill.
1599
+ */
1600
+ derivedWritten: number;
1601
+ /**
1602
+ * Inferred quads cleared before writing the closure.
1603
+ */
1604
+ derivedRemoved: number;
1605
+ /**
1606
+ * OWL 2 RL consistency rules the data violates. They do not block the back-fill.
1607
+ */
1608
+ inconsistencyCount: number;
1609
+ };
1610
+ };
1611
+ type BackfillWorldInferenceResponse = BackfillWorldInferenceResponses[keyof BackfillWorldInferenceResponses];
1612
+ type QueryWorldProvenanceData = {
1613
+ body: ProvenanceRequest;
1614
+ path: {
1615
+ /**
1616
+ * The world-api-minted world ID, a w_ prefix and a lowercase ULID.
1617
+ */
1618
+ worldId: string;
1619
+ };
1620
+ query?: never;
1621
+ url: '/worlds/{worldId}/provenance';
1622
+ };
1623
+ type QueryWorldProvenanceErrors = {
1624
+ /**
1625
+ * Bad request
1626
+ */
1627
+ 400: ErrorResponse;
1628
+ /**
1629
+ * Not found
1630
+ */
1631
+ 404: ErrorResponse;
1632
+ /**
1633
+ * Provenance is not turned on for this world (PROVENANCE_NOT_ENABLED).
1634
+ */
1635
+ 409: ErrorResponse;
1636
+ };
1637
+ type QueryWorldProvenanceError = QueryWorldProvenanceErrors[keyof QueryWorldProvenanceErrors];
1638
+ type QueryWorldProvenanceResponses = {
1639
+ /**
1640
+ * Provenance records
1641
+ */
1642
+ 200: ProvenanceResponse;
1643
+ };
1644
+ type QueryWorldProvenanceResponse = QueryWorldProvenanceResponses[keyof QueryWorldProvenanceResponses];
1645
+ type ClearNamespaceWriteBudgetData = {
1646
+ body?: never;
1647
+ path: {
1648
+ namespace: string;
1649
+ };
1650
+ query?: never;
1651
+ url: '/admin/namespaces/{namespace}/write-budget';
1652
+ };
1653
+ type ClearNamespaceWriteBudgetErrors = {
1654
+ /**
1655
+ * Admin key required
1656
+ */
1657
+ 403: ErrorResponse;
1658
+ };
1659
+ type ClearNamespaceWriteBudgetError = ClearNamespaceWriteBudgetErrors[keyof ClearNamespaceWriteBudgetErrors];
1660
+ type ClearNamespaceWriteBudgetResponses = {
1661
+ /**
1662
+ * The budget now in effect
1663
+ */
1664
+ 200: NamespaceWriteBudget;
1665
+ };
1666
+ type ClearNamespaceWriteBudgetResponse = ClearNamespaceWriteBudgetResponses[keyof ClearNamespaceWriteBudgetResponses];
1667
+ type GetNamespaceWriteBudgetData = {
1668
+ body?: never;
1669
+ path: {
1670
+ namespace: string;
1671
+ };
1672
+ query?: never;
1673
+ url: '/admin/namespaces/{namespace}/write-budget';
1674
+ };
1675
+ type GetNamespaceWriteBudgetErrors = {
1676
+ /**
1677
+ * Admin key required
1678
+ */
1679
+ 403: ErrorResponse;
1680
+ };
1681
+ type GetNamespaceWriteBudgetError = GetNamespaceWriteBudgetErrors[keyof GetNamespaceWriteBudgetErrors];
1682
+ type GetNamespaceWriteBudgetResponses = {
1683
+ /**
1684
+ * The namespace's budget and usage
1685
+ */
1686
+ 200: NamespaceWriteBudget;
1687
+ };
1688
+ type GetNamespaceWriteBudgetResponse = GetNamespaceWriteBudgetResponses[keyof GetNamespaceWriteBudgetResponses];
1689
+ type SetNamespaceWriteBudgetData = {
1690
+ body?: SetNamespaceWriteBudgetRequest;
1691
+ path: {
1692
+ namespace: string;
1693
+ };
1694
+ query?: never;
1695
+ url: '/admin/namespaces/{namespace}/write-budget';
1696
+ };
1697
+ type SetNamespaceWriteBudgetErrors = {
1698
+ /**
1699
+ * Admin key required
1700
+ */
1701
+ 403: ErrorResponse;
1702
+ };
1703
+ type SetNamespaceWriteBudgetError = SetNamespaceWriteBudgetErrors[keyof SetNamespaceWriteBudgetErrors];
1704
+ type SetNamespaceWriteBudgetResponses = {
1705
+ /**
1706
+ * The budget now in effect
1707
+ */
1708
+ 200: NamespaceWriteBudget;
1709
+ };
1710
+ type SetNamespaceWriteBudgetResponse = SetNamespaceWriteBudgetResponses[keyof SetNamespaceWriteBudgetResponses];
1711
+ type ListEmbeddingProvidersData = {
1712
+ body?: never;
1713
+ path: {
1714
+ namespace: string;
1715
+ };
1716
+ query?: never;
1717
+ url: '/namespaces/{namespace}/embedding-providers';
1718
+ };
1719
+ type ListEmbeddingProvidersErrors = {
1720
+ /**
1721
+ * Unauthorized
1722
+ */
1723
+ 401: ErrorResponse;
1724
+ /**
1725
+ * Forbidden
1726
+ */
1727
+ 403: ErrorResponse;
1728
+ };
1729
+ type ListEmbeddingProvidersError = ListEmbeddingProvidersErrors[keyof ListEmbeddingProvidersErrors];
1730
+ type ListEmbeddingProvidersResponses = {
1731
+ /**
1732
+ * Credential metadata, one entry per provider
1733
+ */
1734
+ 200: EmbeddingProviderList;
1735
+ };
1736
+ type ListEmbeddingProvidersResponse = ListEmbeddingProvidersResponses[keyof ListEmbeddingProvidersResponses];
1737
+ type DeleteEmbeddingProviderCredentialData = {
1738
+ body?: never;
1739
+ path: {
1740
+ namespace: string;
1741
+ /**
1742
+ * Embedding provider whose credential this addresses. A namespace holds at most one credential per provider.
1743
+ */
1744
+ provider: 'openai' | 'openrouter';
1745
+ };
1746
+ query?: never;
1747
+ url: '/namespaces/{namespace}/embedding-providers/{provider}';
1748
+ };
1749
+ type DeleteEmbeddingProviderCredentialErrors = {
1750
+ /**
1751
+ * Bad request
1752
+ */
1753
+ 400: ErrorResponse;
1754
+ /**
1755
+ * Unauthorized
1756
+ */
1757
+ 401: ErrorResponse;
1758
+ /**
1759
+ * Forbidden
1760
+ */
1761
+ 403: ErrorResponse;
1762
+ /**
1763
+ * No credential
1764
+ */
1765
+ 404: ErrorResponse;
1766
+ };
1767
+ type DeleteEmbeddingProviderCredentialError = DeleteEmbeddingProviderCredentialErrors[keyof DeleteEmbeddingProviderCredentialErrors];
1768
+ type DeleteEmbeddingProviderCredentialResponses = {
1769
+ /**
1770
+ * Revoked
1771
+ */
1772
+ 204: void;
1773
+ };
1774
+ type DeleteEmbeddingProviderCredentialResponse = DeleteEmbeddingProviderCredentialResponses[keyof DeleteEmbeddingProviderCredentialResponses];
1775
+ type GetEmbeddingProviderCredentialData = {
1776
+ body?: never;
1777
+ path: {
1778
+ namespace: string;
1779
+ /**
1780
+ * Embedding provider whose credential this addresses. A namespace holds at most one credential per provider.
1781
+ */
1782
+ provider: 'openai' | 'openrouter';
1783
+ };
1784
+ query?: never;
1785
+ url: '/namespaces/{namespace}/embedding-providers/{provider}';
1786
+ };
1787
+ type GetEmbeddingProviderCredentialErrors = {
1788
+ /**
1789
+ * Bad request
1790
+ */
1791
+ 400: ErrorResponse;
1792
+ /**
1793
+ * Unauthorized
1794
+ */
1795
+ 401: ErrorResponse;
1796
+ /**
1797
+ * Forbidden
1798
+ */
1799
+ 403: ErrorResponse;
1800
+ /**
1801
+ * No credential
1802
+ */
1803
+ 404: ErrorResponse;
1804
+ };
1805
+ type GetEmbeddingProviderCredentialError = GetEmbeddingProviderCredentialErrors[keyof GetEmbeddingProviderCredentialErrors];
1806
+ type GetEmbeddingProviderCredentialResponses = {
1807
+ /**
1808
+ * Credential metadata
1809
+ */
1810
+ 200: EmbeddingCredential;
1811
+ };
1812
+ type GetEmbeddingProviderCredentialResponse = GetEmbeddingProviderCredentialResponses[keyof GetEmbeddingProviderCredentialResponses];
1813
+ type SetEmbeddingProviderCredentialData = {
1814
+ body: EmbeddingCredentialRequest;
1815
+ path: {
1816
+ namespace: string;
1817
+ /**
1818
+ * Embedding provider whose credential this addresses. A namespace holds at most one credential per provider.
1819
+ */
1820
+ provider: 'openai' | 'openrouter';
1821
+ };
1822
+ query?: never;
1823
+ url: '/namespaces/{namespace}/embedding-providers/{provider}';
1824
+ };
1825
+ type SetEmbeddingProviderCredentialErrors = {
1826
+ /**
1827
+ * Bad request
1828
+ */
1829
+ 400: ErrorResponse;
1830
+ /**
1831
+ * Unauthorized
1832
+ */
1833
+ 401: ErrorResponse;
1834
+ /**
1835
+ * Forbidden
1836
+ */
1837
+ 403: ErrorResponse;
1838
+ /**
1839
+ * Embeddings are not configured on this deployment
1840
+ */
1841
+ 503: ErrorResponse;
1842
+ };
1843
+ type SetEmbeddingProviderCredentialError = SetEmbeddingProviderCredentialErrors[keyof SetEmbeddingProviderCredentialErrors];
1844
+ type SetEmbeddingProviderCredentialResponses = {
1845
+ /**
1846
+ * Credential stored; metadata only
1847
+ */
1848
+ 200: EmbeddingCredential;
1849
+ };
1850
+ type SetEmbeddingProviderCredentialResponse = SetEmbeddingProviderCredentialResponses[keyof SetEmbeddingProviderCredentialResponses];
1851
+ type Options$1<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown> = Options<TData, ThrowOnError, TResponse> & {
1852
+ /**
1853
+ * You can provide a client instance returned by `createClient()` instead of
1854
+ * individual options. This might be also useful if you want to implement a
1855
+ * custom client.
1856
+ */
1857
+ client?: Client;
1858
+ /**
1859
+ * You can pass arbitrary values through the `meta` object. This can be
1860
+ * used to access values that aren't defined as part of the SDK function.
1861
+ */
1862
+ meta?: keyof ClientMeta extends never ? Record<string, unknown> : ClientMeta;
1863
+ };
1864
+ /**
1865
+ * Get health
1866
+ *
1867
+ * Liveness probe. Returns 200 when the service can reach its database; 503 when the database is unreachable.
1868
+ */
1869
+ export declare const getHealth: <ThrowOnError extends boolean = false>(options?: Options$1<GetHealthData, ThrowOnError>) => RequestResult<GetHealthResponses, GetHealthErrors, ThrowOnError>;
1870
+ /**
1871
+ * Get readiness
1872
+ *
1873
+ * Readiness probe. Returns 200 only when D1 is reachable and its control-plane schema matches this service.
1874
+ */
1875
+ export declare const getReadiness: <ThrowOnError extends boolean = false>(options?: Options$1<GetReadinessData, ThrowOnError>) => RequestResult<GetReadinessResponses, GetReadinessErrors, ThrowOnError>;
1876
+ /**
1877
+ * List worlds
1878
+ *
1879
+ * List all worlds accessible to the authenticated token. Admin tokens see all worlds; namespace-scoped tokens see only their namespace's worlds.
1880
+ */
1881
+ export declare const listWorlds: <ThrowOnError extends boolean = false>(options?: Options$1<ListWorldsData, ThrowOnError>) => RequestResult<ListWorldsResponses, unknown, ThrowOnError>;
1882
+ /**
1883
+ * Create world
1884
+ *
1885
+ * Create a new World metadata record in the shared D1 database. Worlds API mints its ID as w_<ULID>; callers cannot choose the ID or a slug.
1886
+ */
1887
+ export declare const createWorld: <ThrowOnError extends boolean = false>(options: Options$1<CreateWorldData, ThrowOnError>) => RequestResult<CreateWorldResponses, CreateWorldErrors, ThrowOnError>;
1888
+ /**
1889
+ * Delete world
1890
+ *
1891
+ * Soft-delete a world. The world enters a 30-day grace period during which it can be restored via undelete. After the grace period, the world is permanently purged.
1892
+ */
1893
+ export declare const deleteWorld: <ThrowOnError extends boolean = false>(options: Options$1<DeleteWorldData, ThrowOnError>) => RequestResult<DeleteWorldResponses, DeleteWorldErrors, ThrowOnError>;
1894
+ /**
1895
+ * Get world
1896
+ *
1897
+ * Retrieve a single world by its unique identifier. Returns the full WorldResource including state, storage backend (deprecated), and search configuration.
1898
+ */
1899
+ export declare const getWorld: <ThrowOnError extends boolean = false>(options: Options$1<GetWorldData, ThrowOnError>) => RequestResult<GetWorldResponses, GetWorldErrors, ThrowOnError>;
1900
+ /**
1901
+ * Update world
1902
+ *
1903
+ * Update a world's display name, embedding model, or search configuration. Changing the embedding model marks the world stale (embeddingStatus stale): search runs keyword-only until POST /worlds/{worldId}/reindex is called. It does not reindex automatically, because reindexing spends the namespace's embedding budget. Setting a model requires an active embedding credential for the namespace.
1904
+ */
1905
+ export declare const updateWorld: <ThrowOnError extends boolean = false>(options: Options$1<UpdateWorldData, ThrowOnError>) => RequestResult<UpdateWorldResponses, UpdateWorldErrors, ThrowOnError>;
1906
+ /**
1907
+ * Undelete world
1908
+ *
1909
+ * Restore a soft-deleted world within its 30-day grace period. Returns the restored WorldResource. Fails if the grace period has expired.
1910
+ */
1911
+ export declare const undeleteWorld: <ThrowOnError extends boolean = false>(options: Options$1<UndeleteWorldData, ThrowOnError>) => RequestResult<UndeleteWorldResponses, UndeleteWorldErrors, ThrowOnError>;
1912
+ /**
1913
+ * Suspend world
1914
+ *
1915
+ * Suspend a world, temporarily blocking all read and write operations. The world can be resumed later without data loss.
1916
+ */
1917
+ export declare const suspendWorld: <ThrowOnError extends boolean = false>(options: Options$1<SuspendWorldData, ThrowOnError>) => RequestResult<SuspendWorldResponses, SuspendWorldErrors, ThrowOnError>;
1918
+ /**
1919
+ * Resume world
1920
+ *
1921
+ * Resume a suspended world, restoring full read and write access.
1922
+ */
1923
+ export declare const resumeWorld: <ThrowOnError extends boolean = false>(options: Options$1<ResumeWorldData, ThrowOnError>) => RequestResult<ResumeWorldResponses, ResumeWorldErrors, ThrowOnError>;
1924
+ /**
1925
+ * Mark all worlds for a namespace deleted (account deletion)
1926
+ *
1927
+ * Admin-only. Soft-deletes all worlds in a namespace and revokes all API keys for that namespace. Used for account deletion workflows.
1928
+ */
1929
+ export declare const deleteNamespaceWorlds: <ThrowOnError extends boolean = false>(options: Options$1<DeleteNamespaceWorldsData, ThrowOnError>) => RequestResult<DeleteNamespaceWorldsResponses, DeleteNamespaceWorldsErrors, ThrowOnError>;
1930
+ /**
1931
+ * Run purge sweep on demand
1932
+ *
1933
+ * Admin-only. Triggers the purge sweep to permanently delete all worlds whose 30-day grace period has expired. Normally runs on a schedule; this endpoint forces an immediate sweep.
1934
+ */
1935
+ export declare const purgeWorlds: <ThrowOnError extends boolean = false>(options?: Options$1<PurgeWorldsData, ThrowOnError>) => RequestResult<PurgeWorldsResponses, PurgeWorldsErrors, ThrowOnError>;
1936
+ /**
1937
+ * Import graph data
1938
+ *
1939
+ * Import RDF data into a world. Accepts Turtle (the default), TriG, N-Triples, N-Quads, or N3 payloads; application/json quad rows; or text/plain chunks. Quads are stored in the world's Cloudflare D1 database and indexed for vector search.
1940
+ */
1941
+ export declare const importWorld: <ThrowOnError extends boolean = false>(options: Options$1<ImportWorldData, ThrowOnError>) => RequestResult<ImportWorldResponses, ImportWorldErrors, ThrowOnError>;
1942
+ /**
1943
+ * Export graph data
1944
+ *
1945
+ * Export RDF quads from a world. Supports JSON (RDF/JSON array), Turtle, TriG, and JSON-LD output formats. Use the limit and offset query parameters for pagination.
1946
+ */
1947
+ export declare const exportWorld: <ThrowOnError extends boolean = false>(options: Options$1<ExportWorldData, ThrowOnError>) => RequestResult<ExportWorldResponses, ExportWorldErrors, ThrowOnError>;
1948
+ /**
1949
+ * Search world
1950
+ *
1951
+ * Full-text and vector similarity search across a world's graph data. Returns ranked results with id, subject, predicate, content, score, and scoreType on the normalized 0–1 scale, plus the mode that actually ran. Falls back to LIKE-based search if the primary engine is unavailable.
1952
+ */
1953
+ export declare const searchWorld: <ThrowOnError extends boolean = false>(options: Options$1<SearchWorldData, ThrowOnError>) => RequestResult<SearchWorldResponses, SearchWorldErrors, ThrowOnError>;
1954
+ /**
1955
+ * SPARQL without world
1956
+ *
1957
+ * Always returns 400. Use POST /worlds/{worldId}/sparql to execute a SPARQL query against a specific world.
1958
+ */
1959
+ export declare const sparqlNoWorld: <ThrowOnError extends boolean = false>(options?: Options$1<SparqlNoWorldData, ThrowOnError>) => RequestResult<unknown, SparqlNoWorldErrors, ThrowOnError>;
1960
+ /**
1961
+ * Execute SPARQL query
1962
+ *
1963
+ * Execute a SPARQL 1.1 query (SELECT, ASK, or UPDATE) against a world's RDF graph. SELECT and ASK require the data:read scope; SPARQL UPDATE (INSERT, DELETE, CLEAR, DROP, and the other update forms) requires data:write, and a key without it receives 403 before the update runs. An unparseable query returns 400 INVALID_ARGUMENT. SELECT results are limited by the server-configured maximum. Queries time out after the configured limit.
1964
+ */
1965
+ export declare const sparqlWorld: <ThrowOnError extends boolean = false>(options: Options$1<SparqlWorldData, ThrowOnError>) => RequestResult<SparqlWorldResponses, SparqlWorldErrors, ThrowOnError>;
1966
+ /**
1967
+ * List API keys
1968
+ *
1969
+ * List all active (non-revoked) API keys. Optionally filter by namespace. Admin-only.
1970
+ */
1971
+ export declare const listApiKeys: <ThrowOnError extends boolean = false>(options?: Options$1<ListApiKeysData, ThrowOnError>) => RequestResult<ListApiKeysResponses, ListApiKeysErrors, ThrowOnError>;
1972
+ /**
1973
+ * Create API key
1974
+ *
1975
+ * Create a new API key scoped to a namespace and optionally a single world. The token is returned once on creation and cannot be retrieved again.
1976
+ */
1977
+ export declare const createApiKey: <ThrowOnError extends boolean = false>(options: Options$1<CreateApiKeyData, ThrowOnError>) => RequestResult<CreateApiKeyResponses, CreateApiKeyErrors, ThrowOnError>;
1978
+ /**
1979
+ * Revoke API key
1980
+ *
1981
+ * Permanently revoke an API key. The key immediately loses all access. This action cannot be undone.
1982
+ */
1983
+ export declare const deleteApiKey: <ThrowOnError extends boolean = false>(options: Options$1<DeleteApiKeyData, ThrowOnError>) => RequestResult<DeleteApiKeyResponses, DeleteApiKeyErrors, ThrowOnError>;
1984
+ /**
1985
+ * Reindex world vector & FTS indexes
1986
+ *
1987
+ * Rebuild the vector and full-text search indexes for a world from its stored RDF quads. Required after changing the embedding model (the world is stale and search is keyword-only until it completes) and useful to repair search quality. The full-text index is always rebuilt from D1; if any vector could not be embedded, written or cleaned up, status is completed_with_vector_errors and vectorSync says what failed. Rerunning reindex repairs it. If the embedding service fails outright (an outage, or vectors of the wrong length) the request fails with 502 EMBEDDING_FAILED instead: nothing is recorded as ready, a windowed pass keeps its cursor so calling again retries the same window, and the keyword index is unaffected. Embedding spend is checked against the namespace's daily write budget first; an exhausted budget returns 429 EMBEDDING_BUDGET_EXCEEDED. Worlds with more text than EMBEDDING_REINDEX_MAX_CHUNKS are reindexed in windows across several calls: each call embeds only the next window, so no chunk is embedded twice and the world becomes ready when the last window completes.
1988
+ */
1989
+ export declare const reindexWorld: <ThrowOnError extends boolean = false>(options: Options$1<ReindexWorldData, ThrowOnError>) => RequestResult<ReindexWorldResponses, ReindexWorldErrors, ThrowOnError>;
1990
+ /**
1991
+ * Back-fill inference for a world's existing data
1992
+ *
1993
+ * Materializes OWL 2 RL inference for data a world already holds. Enabling inference on a world only reacts to later writes; call this once afterwards to cover what is stored. It reads the world's asserted quads, runs the reasoner once, clears the world's inferred quads and writes the closure. Asserted quads are never changed. It is idempotent and safe to repeat; a failure part way leaves some inferred quads, so call it again. The world must have inference enabled. A world larger than its maxAssertedQuads limit is refused before any write (422 INFERENCE_SIZE_GUARD).
1994
+ */
1995
+ export declare const backfillWorldInference: <ThrowOnError extends boolean = false>(options: Options$1<BackfillWorldInferenceData, ThrowOnError>) => RequestResult<BackfillWorldInferenceResponses, BackfillWorldInferenceErrors, ThrowOnError>;
1996
+ /**
1997
+ * Read provenance
1998
+ *
1999
+ * Returns when a subject's facts were written, by which API key, from what source, and which fact each one replaced. One row per event, newest first within a fact, so the first row of a fact is normally the write that made it current. If it is a remove, the fact was written again while provenance was off, or is now inferred. A fact with many events can fill the limit by itself; narrow by predicate to reach the others. Only facts the world holds now are returned, and earlier values are not kept: replacesFactId identifies the replaced fact but not what it said. Facts written before provenance was turned on, and inferred facts, come back without type, time or writer.
2000
+ */
2001
+ export declare const queryWorldProvenance: <ThrowOnError extends boolean = false>(options: Options$1<QueryWorldProvenanceData, ThrowOnError>) => RequestResult<QueryWorldProvenanceResponses, QueryWorldProvenanceErrors, ThrowOnError>;
2002
+ /**
2003
+ * Clear a namespace's daily write budget override
2004
+ *
2005
+ * Admin-only. Removes the namespace's override so it uses the deployment default again. Idempotent.
2006
+ */
2007
+ export declare const clearNamespaceWriteBudget: <ThrowOnError extends boolean = false>(options: Options$1<ClearNamespaceWriteBudgetData, ThrowOnError>) => RequestResult<ClearNamespaceWriteBudgetResponses, ClearNamespaceWriteBudgetErrors, ThrowOnError>;
2008
+ /**
2009
+ * Get a namespace's daily write budget and today's usage
2010
+ *
2011
+ * Admin-only. Returns the budget that applies to the namespace (its override, else the deployment default) and the D1 rows it has written today. The platform reads this to show usage against a plan.
2012
+ */
2013
+ export declare const getNamespaceWriteBudget: <ThrowOnError extends boolean = false>(options: Options$1<GetNamespaceWriteBudgetData, ThrowOnError>) => RequestResult<GetNamespaceWriteBudgetResponses, GetNamespaceWriteBudgetErrors, ThrowOnError>;
2014
+ /**
2015
+ * Set a namespace's daily write budget
2016
+ *
2017
+ * Admin-only. Sets how many D1 rows the namespace may write per UTC day, overriding the deployment default. Writes (SPARQL updates, import, inference back-fill) are refused with 429 WRITE_BUDGET_EXCEEDED once the namespace has used it; reads are never refused. Used by the platform to apply a customer's plan. Takes effect within about 30 seconds across the fleet.
2018
+ */
2019
+ export declare const setNamespaceWriteBudget: <ThrowOnError extends boolean = false>(options: Options$1<SetNamespaceWriteBudgetData, ThrowOnError>) => RequestResult<SetNamespaceWriteBudgetResponses, SetNamespaceWriteBudgetErrors, ThrowOnError>;
2020
+ /**
2021
+ * List embedding providers
2022
+ *
2023
+ * Lists the namespace's embedding provider credentials, newest first, revoked ones included so their status stays readable. Metadata only: no key is ever returned. Requires the embeddings:admin scope.
2024
+ */
2025
+ export declare const listEmbeddingProviders: <ThrowOnError extends boolean = false>(options: Options$1<ListEmbeddingProvidersData, ThrowOnError>) => RequestResult<ListEmbeddingProvidersResponses, ListEmbeddingProvidersErrors, ThrowOnError>;
2026
+ /**
2027
+ * Revoke embedding provider credential
2028
+ *
2029
+ * Revokes the namespace's credential for one provider: the ciphertext is erased and worlds on that provider's models fall back to keyword-only search (embeddingStatus no_credential). Every world on that provider's models is marked stale (worlds on another provider's models are untouched), so after a new key is set search stays keyword-only until each world is reindexed (vectors built before the revoke are never trusted again). Requires the embeddings:admin scope.
2030
+ */
2031
+ export declare const deleteEmbeddingProviderCredential: <ThrowOnError extends boolean = false>(options: Options$1<DeleteEmbeddingProviderCredentialData, ThrowOnError>) => RequestResult<DeleteEmbeddingProviderCredentialResponses, DeleteEmbeddingProviderCredentialErrors, ThrowOnError>;
2032
+ /**
2033
+ * Get embedding provider credential status
2034
+ *
2035
+ * Returns the metadata of the namespace's credential for one provider (status, fingerprint, last four characters, timestamps). The key itself is never returned. Requires the embeddings:admin scope.
2036
+ */
2037
+ export declare const getEmbeddingProviderCredential: <ThrowOnError extends boolean = false>(options: Options$1<GetEmbeddingProviderCredentialData, ThrowOnError>) => RequestResult<GetEmbeddingProviderCredentialResponses, GetEmbeddingProviderCredentialErrors, ThrowOnError>;
2038
+ /**
2039
+ * Set embedding provider credential
2040
+ *
2041
+ * Store or rotate the namespace's API key for one embedding provider (bring your own key). The key is encrypted at rest with a key held only as a Worker secret and is write-only: it is never returned or logged. Requires the embeddings:admin scope (or an admin key); world-scoped tokens are refused. Returns 503 EMBEDDINGS_NOT_CONFIGURED when the deployment has no key-encryption key.
2042
+ */
2043
+ export declare const setEmbeddingProviderCredential: <ThrowOnError extends boolean = false>(options: Options$1<SetEmbeddingProviderCredentialData, ThrowOnError>) => RequestResult<SetEmbeddingProviderCredentialResponses, SetEmbeddingProviderCredentialErrors, ThrowOnError>;
2044
+ export declare const client: Client;
2045
+ export type { ApiKeyCreateRequest, ApiKeyCreateResponse, ApiKeyResource, BackfillWorldInferenceData, BackfillWorldInferenceError, BackfillWorldInferenceErrors, BackfillWorldInferenceResponse, BackfillWorldInferenceResponses, ClearNamespaceWriteBudgetData, ClearNamespaceWriteBudgetError, ClearNamespaceWriteBudgetErrors, ClearNamespaceWriteBudgetResponse, ClearNamespaceWriteBudgetResponses, Client, ClientOptions, CreateApiKeyData, CreateApiKeyError, CreateApiKeyErrors, CreateApiKeyResponse, CreateApiKeyResponses, CreateWorldData, CreateWorldError, CreateWorldErrors, CreateWorldRequest, CreateWorldResponse, CreateWorldResponses, DeleteApiKeyData, DeleteApiKeyError, DeleteApiKeyErrors, DeleteApiKeyResponse, DeleteApiKeyResponses, DeleteEmbeddingProviderCredentialData, DeleteEmbeddingProviderCredentialError, DeleteEmbeddingProviderCredentialErrors, DeleteEmbeddingProviderCredentialResponse, DeleteEmbeddingProviderCredentialResponses, DeleteNamespaceWorldsData, DeleteNamespaceWorldsError, DeleteNamespaceWorldsErrors, DeleteNamespaceWorldsResponse, DeleteNamespaceWorldsResponses, DeleteWorldData, DeleteWorldError, DeleteWorldErrors, DeleteWorldResponse, DeleteWorldResponses, EmbeddingCredential, EmbeddingCredentialRequest, EmbeddingFailureResponse, EmbeddingProviderList, ErrorResponse, ExportQuadsResponse, ExportWorldData, ExportWorldError, ExportWorldErrors, ExportWorldResponse, ExportWorldResponses, GetEmbeddingProviderCredentialData, GetEmbeddingProviderCredentialError, GetEmbeddingProviderCredentialErrors, GetEmbeddingProviderCredentialResponse, GetEmbeddingProviderCredentialResponses, GetHealthData, GetHealthError, GetHealthErrors, GetHealthResponse, GetHealthResponses, GetNamespaceWriteBudgetData, GetNamespaceWriteBudgetError, GetNamespaceWriteBudgetErrors, GetNamespaceWriteBudgetResponse, GetNamespaceWriteBudgetResponses, GetReadinessData, GetReadinessError, GetReadinessErrors, GetReadinessResponse, GetReadinessResponses, GetWorldData, GetWorldError, GetWorldErrors, GetWorldResponse, GetWorldResponses, ImportRequest, ImportResponse, ImportWorldData, ImportWorldError, ImportWorldErrors, ImportWorldResponse, ImportWorldResponses, InferenceSetting, ListApiKeysData, ListApiKeysError, ListApiKeysErrors, ListApiKeysResponse, ListApiKeysResponses, ListEmbeddingProvidersData, ListEmbeddingProvidersError, ListEmbeddingProvidersErrors, ListEmbeddingProvidersResponse, ListEmbeddingProvidersResponses, ListWorldsData, ListWorldsResponse, ListWorldsResponses, NamespaceWriteBudget, Options, ProvenanceRecord, ProvenanceRequest, ProvenanceResponse, PurgeWorldsData, PurgeWorldsError, PurgeWorldsErrors, PurgeWorldsResponse, PurgeWorldsResponses, Quad, QueryWorldProvenanceData, QueryWorldProvenanceError, QueryWorldProvenanceErrors, QueryWorldProvenanceResponse, QueryWorldProvenanceResponses, ReindexWorldData, ReindexWorldError, ReindexWorldErrors, ReindexWorldResponse, ReindexWorldResponses, RequestResult, ResumeWorldData, ResumeWorldError, ResumeWorldErrors, ResumeWorldResponse, ResumeWorldResponses, SearchFilter, SearchRequest, SearchResponse, SearchResult, SearchWorldData, SearchWorldError, SearchWorldErrors, SearchWorldResponse, SearchWorldResponses, SetEmbeddingProviderCredentialData, SetEmbeddingProviderCredentialError, SetEmbeddingProviderCredentialErrors, SetEmbeddingProviderCredentialResponse, SetEmbeddingProviderCredentialResponses, SetNamespaceWriteBudgetData, SetNamespaceWriteBudgetError, SetNamespaceWriteBudgetErrors, SetNamespaceWriteBudgetRequest, SetNamespaceWriteBudgetResponse, SetNamespaceWriteBudgetResponses, SparqlNoWorldData, SparqlNoWorldError, SparqlNoWorldErrors, SparqlRequest, SparqlWorldData, SparqlWorldError, SparqlWorldErrors, SparqlWorldResponses, SuspendWorldData, SuspendWorldError, SuspendWorldErrors, SuspendWorldResponse, SuspendWorldResponses, UndeleteWorldData, UndeleteWorldError, UndeleteWorldErrors, UndeleteWorldResponse, UndeleteWorldResponses, UpdateWorldData, UpdateWorldError, UpdateWorldErrors, UpdateWorldRequest, UpdateWorldResponse, UpdateWorldResponses, VectorCleanupReport, VectorSyncReport, WorldResource };