@k9o/core 1.0.0 → 1.1.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/CHANGELOG.md +5 -71
- package/README.md +224 -32
- package/dist/{chunk-OE2MMUIG.js → chunk-2NDFTHUB.js} +2 -2
- package/dist/chunk-2NDFTHUB.js.map +1 -0
- package/dist/{chunk-2VSTF5UU.js → chunk-LJZ45UA2.js} +1 -1
- package/dist/chunk-LJZ45UA2.js.map +1 -0
- package/dist/{chunk-FVWKL5UQ.js → chunk-O2ZTV6YN.js} +2 -2
- package/dist/chunk-O2ZTV6YN.js.map +1 -0
- package/dist/envelope.d.ts +9 -9
- package/dist/http.d.ts +4 -4
- package/dist/http.js +2 -2
- package/dist/index.d.ts +163 -183
- package/dist/index.js +43 -44
- package/dist/index.js.map +1 -1
- package/dist/kerror.d.ts +2 -2
- package/dist/kerror.js +1 -1
- package/dist/types.d.ts +4 -6
- package/dist/url-grammar.d.ts +6 -6
- package/dist/url-grammar.js +2 -2
- package/package.json +4 -4
- package/src/audit.ts +6 -6
- package/src/compute/llms.ts +16 -16
- package/src/data/from.ts +12 -12
- package/src/envelope.ts +9 -9
- package/src/extensions-bridge.ts +7 -9
- package/src/functions.ts +8 -8
- package/src/gate-bridge.ts +2 -2
- package/src/http.ts +4 -4
- package/src/index.ts +17 -27
- package/src/internal/sse.ts +2 -2
- package/src/kerror.ts +2 -2
- package/src/me.ts +7 -8
- package/src/metadata.ts +13 -20
- package/src/migrations.ts +12 -12
- package/src/org.ts +19 -19
- package/src/orgs.ts +5 -5
- package/src/policies.ts +2 -2
- package/src/projects.ts +5 -5
- package/src/realtime.ts +16 -16
- package/src/retry.ts +1 -1
- package/src/storage-buckets.ts +1 -1
- package/src/studio/dashboards.ts +13 -13
- package/src/studio/index.ts +2 -2
- package/src/studio/workflows.ts +21 -21
- package/src/types.ts +4 -6
- package/src/url-grammar.ts +6 -6
- package/dist/chunk-2VSTF5UU.js.map +0 -1
- package/dist/chunk-FVWKL5UQ.js.map +0 -1
- package/dist/chunk-OE2MMUIG.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -28,14 +28,14 @@ export { orgPath, platformPath, projectPath, resolveBaseUrl, validateBaseUrl, va
|
|
|
28
28
|
* - `from('posts').update({ title: '...' }).eq(...)` → PATCH /@<projectSlug>/data/posts/:id
|
|
29
29
|
* - `from('posts').delete().eq('id','rec_X')` → DELETE /@<projectSlug>/data/posts/:id
|
|
30
30
|
*
|
|
31
|
-
* Filters compose as AND
|
|
31
|
+
* Filters compose as AND; multiple chained `.eq()` /
|
|
32
32
|
* `.gt()` / etc. calls all attach to the query string.
|
|
33
33
|
*
|
|
34
|
-
* Pagination + counting
|
|
34
|
+
* Pagination + counting: `.limit(n)`, `.cursor(opaque)`,
|
|
35
35
|
* `.count('none' | 'exact' | 'estimated')`. The returned envelope's
|
|
36
36
|
* `meta.cursor.next` is the cursor for the next page.
|
|
37
37
|
*
|
|
38
|
-
* Per
|
|
38
|
+
* Per KError delivery: every terminal verb throws KError on
|
|
39
39
|
* non-2xx. Caller catches via `instanceof KError` + narrows on `.code`.
|
|
40
40
|
*/
|
|
41
41
|
|
|
@@ -86,7 +86,7 @@ declare class QueryBuilder {
|
|
|
86
86
|
*/
|
|
87
87
|
cursor(opaque: string): this;
|
|
88
88
|
/**
|
|
89
|
-
* Total-count behaviour
|
|
89
|
+
* Total-count behaviour. `none` (default) skips the
|
|
90
90
|
* count query (cheapest); `exact` runs `SELECT COUNT(*)` (most
|
|
91
91
|
* expensive at scale); `estimated` reads from pg_stats (fast +
|
|
92
92
|
* approximate).
|
|
@@ -114,7 +114,7 @@ declare class FromBuilder {
|
|
|
114
114
|
select<T = unknown>(): SelectBuilder<T>;
|
|
115
115
|
/**
|
|
116
116
|
* Insert one record. Returns the inserted record (with platform-
|
|
117
|
-
* generated `id` + `metadata`)
|
|
117
|
+
* generated `id` + `metadata`).
|
|
118
118
|
*/
|
|
119
119
|
insert<T = unknown>(record: Partial<T>): Promise<Envelope<T>>;
|
|
120
120
|
/**
|
|
@@ -169,19 +169,19 @@ declare function makeFromFactory(config: HttpClientConfig): (collection: string)
|
|
|
169
169
|
*
|
|
170
170
|
* The `list` + `create` operations operate org-plane and require
|
|
171
171
|
* `orgSlug` to be bound on the client (or the bearer token to carry
|
|
172
|
-
* an org context
|
|
172
|
+
* an org context). The `get` + `update` operations
|
|
173
173
|
* operate member-plane and use the project slug.
|
|
174
174
|
*
|
|
175
|
-
* Per
|
|
175
|
+
* Per: all methods throw KError on non-2xx.
|
|
176
176
|
*/
|
|
177
177
|
|
|
178
178
|
/**
|
|
179
|
-
* Project shape
|
|
179
|
+
* Project shape. Fields are typed per the canonical shape;
|
|
180
180
|
* the gateway may return additional fields that this type doesn't
|
|
181
181
|
* narrow — those are accessible via `as unknown as` widening.
|
|
182
182
|
*/
|
|
183
183
|
type Project = {
|
|
184
|
-
/** `proj_<base62
|
|
184
|
+
/** `proj_<base62>`. */
|
|
185
185
|
id: string;
|
|
186
186
|
slug: string;
|
|
187
187
|
name: string;
|
|
@@ -211,7 +211,7 @@ type UpdateProjectInput = {
|
|
|
211
211
|
declare function makeProjectsNamespace(config: HttpClientConfig): {
|
|
212
212
|
/**
|
|
213
213
|
* List projects accessible to the caller. Requires authenticated
|
|
214
|
-
* session; results are scoped by RBAC
|
|
214
|
+
* session; results are scoped by RBAC.
|
|
215
215
|
*/
|
|
216
216
|
list(): Promise<Envelope<ReadonlyArray<Project>>>;
|
|
217
217
|
/**
|
|
@@ -229,7 +229,7 @@ declare function makeProjectsNamespace(config: HttpClientConfig): {
|
|
|
229
229
|
};
|
|
230
230
|
|
|
231
231
|
/**
|
|
232
|
-
* `client.storage` buckets and objects
|
|
232
|
+
* `client.storage` buckets and objects: per-project logical buckets and the objects in them, against
|
|
233
233
|
* `/@<projectSlug>/storage/buckets…`. `client.storage.locations.*` (the customer's own object stores) lives in
|
|
234
234
|
* `storage-locations.ts` and is unchanged.
|
|
235
235
|
*
|
|
@@ -430,31 +430,24 @@ declare function makeStorageNamespace(config: HttpClientConfig): {
|
|
|
430
430
|
};
|
|
431
431
|
|
|
432
432
|
/**
|
|
433
|
-
* `client.metadata.*` —
|
|
433
|
+
* `client.metadata.*` — cross-surface metadata query (`k9o.metadata.*`).
|
|
434
434
|
*
|
|
435
|
-
*
|
|
436
|
-
*
|
|
437
|
-
*
|
|
438
|
-
*
|
|
439
|
-
* hits a 404, not a working query. This ships ahead of the route deliberately (same pattern as the
|
|
440
|
-
* BYOS SDK surfaces) so the wire shape is locked to the spec, not re-derived once the route exists.
|
|
435
|
+
* Client-side surface for `POST /@:projectSlug/metadata/query`. The wire shape is fixed here ahead of the
|
|
436
|
+
* server route: until the gateway ships that route, calling `.execute()` returns a 404 rather than a result.
|
|
437
|
+
* Once it is available, only `telemetry:*` surfaces return data at first; collection and storage metadata
|
|
438
|
+
* follow as their server-side schemas land.
|
|
441
439
|
*
|
|
442
|
-
*
|
|
443
|
-
* (reuses the existing audit-log query); the collection + storage slices are blocked on greenfield
|
|
444
|
-
* `record.metadata`/object-metadata schema (Inc 3/Inc 4) — so even once Inc 2 lands, only
|
|
445
|
-
* `telemetry:*` surfaces will actually return data until those land.
|
|
446
|
-
*
|
|
447
|
-
* `textSearch`/`vectorSearch` (ch14 §3.4) are explicitly a later increment (Inc 5) — not implemented
|
|
440
|
+
* `textSearch`/`vectorSearch` are explicitly a later increment (Inc 5) — not implemented
|
|
448
441
|
* here; adding stub methods for an unspecified future mode would be speculative, not spec-grounded.
|
|
449
442
|
*/
|
|
450
443
|
|
|
451
|
-
/** The three cross-surface slices
|
|
444
|
+
/** The three cross-surface slices. */
|
|
452
445
|
type MetadataSlice = "collection" | "storage" | "telemetry";
|
|
453
|
-
/**
|
|
446
|
+
/** operator vocabulary (= JSON-policy set), mirrored verbatim from the gateway's
|
|
454
447
|
* `metadata-query-parse.ts` so a typo can't silently pass client-side and fail only server-side. */
|
|
455
448
|
declare const METADATA_OPERATORS: readonly ["eq", "neq", "gt", "gte", "lt", "lte", "contains", "startsWith", "endsWith", "in", "notIn", "and", "or", "not"];
|
|
456
449
|
type MetadataOperator = (typeof METADATA_OPERATORS)[number];
|
|
457
|
-
/** A surface label `<slice>:<scope
|
|
450
|
+
/** A surface label `<slice>:<scope>`, e.g. `collection:posts`, `storage:images`,
|
|
458
451
|
* `telemetry:auth.session.created`. */
|
|
459
452
|
type MetadataSurface = `${MetadataSlice}:${string}`;
|
|
460
453
|
type MetadataWhereClause = {
|
|
@@ -463,7 +456,7 @@ type MetadataWhereClause = {
|
|
|
463
456
|
readonly value: unknown;
|
|
464
457
|
};
|
|
465
458
|
/**
|
|
466
|
-
* One result row
|
|
459
|
+
* One result row: "each record carries its surface + scope + the queried metadata
|
|
467
460
|
* fields plus a back-reference id" — `recordId` (collection), `objectPath` (storage), or `eventId`
|
|
468
461
|
* (telemetry), depending on which surface the row came from. Exact field names are provisional
|
|
469
462
|
* pending Inc 2 landing a concrete response schema; kept loose (`metadata: Record<string, unknown>`)
|
|
@@ -481,7 +474,7 @@ type MetadataQueryResult = {
|
|
|
481
474
|
records: readonly MetadataQueryRecord[];
|
|
482
475
|
nextCursor: string | null;
|
|
483
476
|
};
|
|
484
|
-
/** The `k9o.metadata.from(...).where(...).limit(...).execute()` builder
|
|
477
|
+
/** The `k9o.metadata.from(...).where(...).limit(...).execute()` builder. Immutable —
|
|
485
478
|
* every chained call returns a new builder, so a partially-built query can be safely reused/branched. */
|
|
486
479
|
type MetadataQueryBuilder = {
|
|
487
480
|
where(field: string, op: MetadataOperator, value: unknown): MetadataQueryBuilder;
|
|
@@ -490,7 +483,7 @@ type MetadataQueryBuilder = {
|
|
|
490
483
|
execute(): Promise<Envelope<MetadataQueryResult>>;
|
|
491
484
|
};
|
|
492
485
|
declare function makeMetadataNamespace(config: HttpClientConfig): {
|
|
493
|
-
/** Start a cross-surface metadata query against one or more surfaces
|
|
486
|
+
/** Start a cross-surface metadata query against one or more surfaces. */
|
|
494
487
|
from(surface: MetadataSurface | readonly MetadataSurface[]): MetadataQueryBuilder;
|
|
495
488
|
};
|
|
496
489
|
|
|
@@ -512,8 +505,8 @@ declare function makeMetadataNamespace(config: HttpClientConfig): {
|
|
|
512
505
|
*
|
|
513
506
|
* Migration shape — STRUCTURED
|
|
514
507
|
* DECLARATIVE DDL, never raw SQL. Every schema change is a typed, key-tagged
|
|
515
|
-
* operation, so schema drift is impossible at the SDK layer (the
|
|
516
|
-
* invariant). Raw SQL is the separate runtime `client.query()` surface
|
|
508
|
+
* operation, so schema drift is impossible at the SDK layer (the
|
|
509
|
+
* invariant). Raw SQL is the separate runtime `client.query()` surface,
|
|
517
510
|
* which cannot create/alter schema. The gateway checksums each migration and
|
|
518
511
|
* stores it in `_sys.migrations`; already-applied versions are skipped on
|
|
519
512
|
* re-run and mismatched checksums are rejected, preserving the drift invariant.
|
|
@@ -539,9 +532,9 @@ type ColumnReferences = {
|
|
|
539
532
|
on_update?: "CASCADE" | "RESTRICT" | "SET NULL" | "NO ACTION";
|
|
540
533
|
};
|
|
541
534
|
/**
|
|
542
|
-
* A column definition. `type` is the
|
|
535
|
+
* A column definition. `type` is the column-type vocabulary
|
|
543
536
|
* (parser-owned; kept as `string` rather than a fabricated enum). The
|
|
544
|
-
* protection attributes declare at-rest field encryption
|
|
537
|
+
* protection attributes declare at-rest field encryption (gateway
|
|
545
538
|
* shape verified vs the parser, live since `2.56.0`).
|
|
546
539
|
*/
|
|
547
540
|
type ColumnSpec = {
|
|
@@ -553,7 +546,7 @@ type ColumnSpec = {
|
|
|
553
546
|
default?: string;
|
|
554
547
|
references?: ColumnReferences;
|
|
555
548
|
/**
|
|
556
|
-
* At-rest field encryption
|
|
549
|
+
* At-rest field encryption. `true` = inline-stored encrypted column;
|
|
557
550
|
* the object form opts into a `store` ("inline" | "vault") and the D-mode
|
|
558
551
|
* searchable-encryption index (`searchable`). NOTE: `searchable` is NESTED
|
|
559
552
|
* here — it is NOT a sibling attribute.
|
|
@@ -578,7 +571,7 @@ type IndexSpec = {
|
|
|
578
571
|
* mutation (one op carries optional `add_columns[]` + `drop_columns[]`), live in
|
|
579
572
|
* the gateway runner (`migration-runner.ts:156`).
|
|
580
573
|
* `rename_column` remains a pending future op (its parser field names are not yet
|
|
581
|
-
* finalised); NOTE
|
|
574
|
+
* finalised); NOTE / a `rename_column` on an ENCRYPTED column
|
|
582
575
|
* is fail-closed-rejected (`K9O_ENCRYPTED_COLUMN_DECLARATION_INVALID`) pending the
|
|
583
576
|
* re-encryption pass — to document when that op lands.
|
|
584
577
|
*/
|
|
@@ -617,18 +610,18 @@ type Operation = {
|
|
|
617
610
|
};
|
|
618
611
|
};
|
|
619
612
|
/** A declarative authorization/relationship rule (compiles to RLS USING + WITH
|
|
620
|
-
* CHECK
|
|
613
|
+
* CHECK). The rule grammar is the policy-expression DSL. */
|
|
621
614
|
type ActionRule = {
|
|
622
615
|
rule?: unknown;
|
|
623
616
|
};
|
|
624
|
-
/** A declared relationship for embedding/joins (
|
|
617
|
+
/** A declared relationship for embedding/joins (references). */
|
|
625
618
|
type RelationshipSpec = {
|
|
626
619
|
collection: string;
|
|
627
620
|
on: string;
|
|
628
621
|
as: string;
|
|
629
622
|
type?: "inner" | "left";
|
|
630
623
|
};
|
|
631
|
-
/** Per-collection policy block (RLS + relationships)
|
|
624
|
+
/** Per-collection policy block (RLS + relationships),. */
|
|
632
625
|
type CollectionPolicy = {
|
|
633
626
|
references?: ReadonlyArray<RelationshipSpec>;
|
|
634
627
|
actions?: {
|
|
@@ -638,7 +631,7 @@ type CollectionPolicy = {
|
|
|
638
631
|
delete?: ActionRule;
|
|
639
632
|
};
|
|
640
633
|
};
|
|
641
|
-
/** Per-bucket storage policy block
|
|
634
|
+
/** Per-bucket storage policy block,. */
|
|
642
635
|
type StorageBucketPolicy = {
|
|
643
636
|
public?: boolean;
|
|
644
637
|
actions?: {
|
|
@@ -697,7 +690,7 @@ declare function makeMigrationsNamespace(config: HttpClientConfig): {
|
|
|
697
690
|
list(): Promise<Envelope<ReadonlyArray<AppliedMigration>>>;
|
|
698
691
|
/** Get a single applied migration by version. */
|
|
699
692
|
get(version: number): Promise<Envelope<AppliedMigration>>;
|
|
700
|
-
/** Queue migrations for maker-checker approval
|
|
693
|
+
/** Queue migrations for maker-checker approval. */
|
|
701
694
|
queue(input: {
|
|
702
695
|
migrations: ReadonlyArray<Migration>;
|
|
703
696
|
}): Promise<Envelope<{
|
|
@@ -706,7 +699,7 @@ declare function makeMigrationsNamespace(config: HttpClientConfig): {
|
|
|
706
699
|
/** List pending (queued, not yet approved) migrations. */
|
|
707
700
|
listPending(): Promise<Envelope<ReadonlyArray<PendingMigration>>>;
|
|
708
701
|
/**
|
|
709
|
-
* Apply a queued migration by id (
|
|
702
|
+
* Apply a queued migration by id (same-actor fast path — floors at
|
|
710
703
|
* PROJECT_ADMIN; a `pending_approval` row, i.e. a protected-collection
|
|
711
704
|
* migration awaiting a distinct-admin's review, is refused here and
|
|
712
705
|
* needs its own approval flow, not this call).
|
|
@@ -736,8 +729,8 @@ declare function makeMigrationsNamespace(config: HttpClientConfig): {
|
|
|
736
729
|
* - `delete(name)` → DELETE /@<slug>/functions/<name>
|
|
737
730
|
* - `invoke(name, payload)` → POST /@<slug>/functions/<name>/invoke
|
|
738
731
|
*
|
|
739
|
-
* Per
|
|
740
|
-
* function manifest. Per
|
|
732
|
+
* Per: deploy requires PROJECT_ADMIN; invoke authority is per
|
|
733
|
+
* function manifest. Per: deploy returns 202 with status
|
|
741
734
|
* `deploying`; the function is ready when status flips to `active`.
|
|
742
735
|
*/
|
|
743
736
|
|
|
@@ -745,7 +738,7 @@ declare function makeMigrationsNamespace(config: HttpClientConfig): {
|
|
|
745
738
|
* Function record returned by gateway endpoints.
|
|
746
739
|
*/
|
|
747
740
|
type FunctionRecord = {
|
|
748
|
-
/** `fn_<base62
|
|
741
|
+
/** `fn_<base62>`. */
|
|
749
742
|
id: string;
|
|
750
743
|
name: string;
|
|
751
744
|
runtime: "wasm" | "bun" | "node";
|
|
@@ -756,7 +749,7 @@ type FunctionRecord = {
|
|
|
756
749
|
};
|
|
757
750
|
/**
|
|
758
751
|
* Deploy input. The `code` field is the runtime bundle (base64-encoded
|
|
759
|
-
* WASM or JS source)
|
|
752
|
+
* WASM or JS source).
|
|
760
753
|
*/
|
|
761
754
|
type DeployFunctionInput = {
|
|
762
755
|
name: string;
|
|
@@ -768,7 +761,7 @@ type DeployFunctionInput = {
|
|
|
768
761
|
declare function makeFunctionsNamespace(config: HttpClientConfig): {
|
|
769
762
|
/** Deploy or redeploy a function. Returns the function record with status. */
|
|
770
763
|
deploy(input: DeployFunctionInput): Promise<Envelope<FunctionRecord>>;
|
|
771
|
-
/** List deployed functions (cursor pagination
|
|
764
|
+
/** List deployed functions (cursor pagination). */
|
|
772
765
|
list(opts?: {
|
|
773
766
|
limit?: number;
|
|
774
767
|
cursor?: string;
|
|
@@ -776,7 +769,7 @@ declare function makeFunctionsNamespace(config: HttpClientConfig): {
|
|
|
776
769
|
}): Promise<Envelope<ReadonlyArray<FunctionRecord>>>;
|
|
777
770
|
/** Get a function by name. */
|
|
778
771
|
get(name: string): Promise<Envelope<FunctionRecord>>;
|
|
779
|
-
/** Retire a function. Returns confirmation; the function name enters a 24h cooldown
|
|
772
|
+
/** Retire a function. Returns confirmation; the function name enters a 24h cooldown. */
|
|
780
773
|
delete(name: string): Promise<Envelope<{
|
|
781
774
|
retired: boolean;
|
|
782
775
|
cooldownUntil: string;
|
|
@@ -786,8 +779,8 @@ declare function makeFunctionsNamespace(config: HttpClientConfig): {
|
|
|
786
779
|
* verbatim; the gateway returns whatever the function returns wrapped
|
|
787
780
|
* in the standard envelope.
|
|
788
781
|
*
|
|
789
|
-
* Per
|
|
790
|
-
* function manifest). Per
|
|
782
|
+
* Per: invoke authority is per-function (declared in the
|
|
783
|
+
* function manifest). Per: streaming responses use the
|
|
791
784
|
* subscription/async-iterator pattern; this method covers the
|
|
792
785
|
* request-response variant only.
|
|
793
786
|
*/
|
|
@@ -809,13 +802,13 @@ declare function makeFunctionsNamespace(config: HttpClientConfig): {
|
|
|
809
802
|
* - `delete(bundleId)` → DELETE /@<slug>/policies/<id>
|
|
810
803
|
* - `publish(bundleId)` → POST /@<slug>/policies/<id>/publish
|
|
811
804
|
*
|
|
812
|
-
* Per
|
|
805
|
+
* Per: only Pathmaker-class roles author policy; only
|
|
813
806
|
* Custodian-class roles publish. `validate` is read-only and any role
|
|
814
807
|
* with policy-read can lint a candidate bundle.
|
|
815
808
|
*/
|
|
816
809
|
|
|
817
810
|
type PolicyBundle = {
|
|
818
|
-
/** `pol_<base62
|
|
811
|
+
/** `pol_<base62>`. */
|
|
819
812
|
id: string;
|
|
820
813
|
name: string;
|
|
821
814
|
version: number;
|
|
@@ -882,19 +875,19 @@ declare function makePoliciesNamespace(config: HttpClientConfig): {
|
|
|
882
875
|
*
|
|
883
876
|
* The endpoint accepts cursor-paginated reverse-chronological queries.
|
|
884
877
|
* `type` is the audit-event namespace (e.g. `data.write.access.insert`,
|
|
885
|
-
* `gate.signin.success`) per the
|
|
878
|
+
* `gate.signin.success`) per the event-name taxonomy +
|
|
886
879
|
* `feedback_error_code_namespace_boundary_and_prefix.md` cement.
|
|
887
880
|
*
|
|
888
881
|
* Returns audit events with full context payload — actorId / targetKind /
|
|
889
|
-
* targetId / payload / occurredAt / requestId / traceId
|
|
882
|
+
* targetId / payload / occurredAt / requestId / traceId.
|
|
890
883
|
*/
|
|
891
884
|
|
|
892
885
|
/**
|
|
893
|
-
* Audit event record
|
|
886
|
+
* Audit event record `_sys.audit_log` shape.
|
|
894
887
|
*/
|
|
895
888
|
type AuditEvent = {
|
|
896
889
|
id: string;
|
|
897
|
-
/** Dotted namespace
|
|
890
|
+
/** Dotted namespace (e.g. `data.write.access.insert`). */
|
|
898
891
|
type: string;
|
|
899
892
|
actorId: string | null;
|
|
900
893
|
targetKind: string | null;
|
|
@@ -927,7 +920,7 @@ declare function makeAuditNamespace(config: HttpClientConfig): {
|
|
|
927
920
|
* Query the audit log. Returns reverse-chronological events matching
|
|
928
921
|
* all supplied filters (AND composition).
|
|
929
922
|
*
|
|
930
|
-
* Per
|
|
923
|
+
* Per RBAC: requires `AUDIT_READER` role minimum; Custodian-
|
|
931
924
|
* class roles inherit. Project-level audit is project-scoped (this
|
|
932
925
|
* endpoint); platform-level audit is admin-only (separate surface).
|
|
933
926
|
*/
|
|
@@ -935,7 +928,7 @@ declare function makeAuditNamespace(config: HttpClientConfig): {
|
|
|
935
928
|
/**
|
|
936
929
|
* Convenience: live-tail recent events. Currently single-shot read
|
|
937
930
|
* with `since` defaulted to "1 minute ago"; subscription-mode tail
|
|
938
|
-
* (SSE) lands when the streaming layer ships
|
|
931
|
+
* (SSE) lands when the streaming layer ships pattern.
|
|
939
932
|
*/
|
|
940
933
|
tail(opts?: {
|
|
941
934
|
sinceMinutes?: number;
|
|
@@ -961,14 +954,14 @@ declare function makeAuditNamespace(config: HttpClientConfig): {
|
|
|
961
954
|
* `restore` is the one exception — it stays keyed by `orgId`, because a
|
|
962
955
|
* soft-deleted org's slug is tombstoned and may have been reassigned.
|
|
963
956
|
*
|
|
964
|
-
|
|
965
|
-
* (most callers see exactly one — their own). Org creation is
|
|
966
|
-
*
|
|
967
|
-
*
|
|
957
|
+
*: org listing is scoped by the caller's accessible orgs
|
|
958
|
+
* (most callers see exactly one — their own). Org creation is not available
|
|
959
|
+
* through the SDK yet; `client.orgs.create()` will be added once sign-up
|
|
960
|
+
* is exposed as an API).
|
|
968
961
|
*/
|
|
969
962
|
|
|
970
963
|
type Org = {
|
|
971
|
-
/** `org_<base62
|
|
964
|
+
/** `org_<base62>`. */
|
|
972
965
|
id: string;
|
|
973
966
|
slug: string;
|
|
974
967
|
name: string;
|
|
@@ -991,39 +984,39 @@ declare function makeOrgsNamespace(config: HttpClientConfig): {
|
|
|
991
984
|
* Compute LLMs SDK — `client.compute.llms.*`.
|
|
992
985
|
*
|
|
993
986
|
* Compute LLMs registry. Curated 9-model library
|
|
994
|
-
*
|
|
987
|
+
* + 4-endpoint family + per-model tier-gating.
|
|
995
988
|
*
|
|
996
|
-
* Wire mapping (project-plane;
|
|
989
|
+
* Wire mapping (project-plane;):
|
|
997
990
|
* - list() → GET /@<slug>/compute/llms
|
|
998
991
|
* - read(modelId) → GET /@<slug>/compute/llms/<model-id>
|
|
999
992
|
* - invoke(modelId, ...) → POST /@<slug>/compute/llms/<model-id>/invoke
|
|
1000
993
|
* - invokeStream(modelId,...) → POST /@<slug>/compute/llms/<model-id>/invoke-stream (SSE)
|
|
1001
994
|
*
|
|
1002
|
-
* Per
|
|
995
|
+
* Per RBAC: list/read against all cohort roles; invoke +
|
|
1003
996
|
* invokeStream require PROJECT_AUTHOR or PROJECT_ADMIN (LLM cost gate).
|
|
1004
|
-
* Per
|
|
997
|
+
* Per, surfaces K9O_LLM_PROVIDER_UNAVAILABLE (503) +
|
|
1005
998
|
* reuses K9O_MODEL_NOT_DECLARED / K9O_TIER_FEATURE_GATED /
|
|
1006
999
|
* K9O_AGENT_INFERENCE_TIMEOUT.
|
|
1007
1000
|
*/
|
|
1008
1001
|
|
|
1009
|
-
/** Curated 9-model closed enum at v2 launch
|
|
1002
|
+
/** Curated 9-model closed enum at v2 launch (extensible v2.x). */
|
|
1010
1003
|
type LLMModelId = "mistral-7b" | "mistral-8x7b" | "llama-3-8b" | "llama-3-70b" | "claude-3-5-sonnet" | "gpt-4o" | "gpt-4o-mini" | "text-embedding-3-small" | "text-embedding-3-large";
|
|
1011
1004
|
type LLMProviderClass = "self-hosted" | "external";
|
|
1012
1005
|
type LLMModality = "text-completion" | "text-completion+tool-use" | "embeddings";
|
|
1013
|
-
/** Model metadata
|
|
1006
|
+
/** Model metadata + (cost transparency). */
|
|
1014
1007
|
type LLMModel = {
|
|
1015
1008
|
id: LLMModelId;
|
|
1016
1009
|
providerClass: LLMProviderClass;
|
|
1017
1010
|
modality: LLMModality;
|
|
1018
|
-
/** Minimum tier gate
|
|
1011
|
+
/** Minimum tier gate (e.g. "base-camp", "ascent", "ridge"). */
|
|
1019
1012
|
tierGate: string;
|
|
1020
1013
|
contextWindow: number;
|
|
1021
1014
|
capabilities: ReadonlyArray<string>;
|
|
1022
|
-
/** Per-model token cost for cost-transparency
|
|
1015
|
+
/** Per-model token cost for cost-transparency. */
|
|
1023
1016
|
costPerMillionInputTokens: number;
|
|
1024
1017
|
costPerMillionOutputTokens: number;
|
|
1025
1018
|
};
|
|
1026
|
-
/** Inference parameters
|
|
1019
|
+
/** Inference parameters (passed through to provider). */
|
|
1027
1020
|
type LLMInvokeParams = {
|
|
1028
1021
|
maxTokens?: number;
|
|
1029
1022
|
temperature?: number;
|
|
@@ -1031,13 +1024,13 @@ type LLMInvokeParams = {
|
|
|
1031
1024
|
stop?: ReadonlyArray<string>;
|
|
1032
1025
|
[key: string]: unknown;
|
|
1033
1026
|
};
|
|
1034
|
-
/** Synchronous inference response
|
|
1027
|
+
/** Synchronous inference response `/invoke`. */
|
|
1035
1028
|
type LLMResponse = {
|
|
1036
1029
|
completion: string;
|
|
1037
1030
|
tokensUsed: number;
|
|
1038
1031
|
latencyMs: number;
|
|
1039
1032
|
};
|
|
1040
|
-
/** Streaming chunk
|
|
1033
|
+
/** Streaming chunk `/invoke-stream` (SSE per-token). */
|
|
1041
1034
|
type LLMStreamChunk = {
|
|
1042
1035
|
/** Incremental completion delta. */
|
|
1043
1036
|
delta: string;
|
|
@@ -1050,14 +1043,14 @@ type LLMInvokeInput = {
|
|
|
1050
1043
|
prompt: string;
|
|
1051
1044
|
params?: LLMInvokeParams;
|
|
1052
1045
|
};
|
|
1053
|
-
/** Error code coined in
|
|
1046
|
+
/** Error code coined in (others reused). */
|
|
1054
1047
|
declare const LLM_ERROR_CODES: {
|
|
1055
1048
|
readonly PROVIDER_UNAVAILABLE: "K9O_LLM_PROVIDER_UNAVAILABLE";
|
|
1056
1049
|
};
|
|
1057
1050
|
declare function makeComputeNamespace(config: HttpClientConfig): {
|
|
1058
|
-
/** LLM registry + inference — `client.compute.llms
|
|
1051
|
+
/** LLM registry + inference — `client.compute.llms.*`. */
|
|
1059
1052
|
llms: {
|
|
1060
|
-
/** GET /@<slug>/compute/llms — list models available to the project tier
|
|
1053
|
+
/** GET /@<slug>/compute/llms — list models available to the project tier. */
|
|
1061
1054
|
list(opts?: {
|
|
1062
1055
|
modality?: LLMModality;
|
|
1063
1056
|
providerClass?: LLMProviderClass;
|
|
@@ -1066,12 +1059,12 @@ declare function makeComputeNamespace(config: HttpClientConfig): {
|
|
|
1066
1059
|
read(modelId: LLMModelId | string): Promise<Envelope<LLMModel>>;
|
|
1067
1060
|
/**
|
|
1068
1061
|
* POST /@<slug>/compute/llms/<model-id>/invoke — synchronous inference.
|
|
1069
|
-
* Requires PROJECT_AUTHOR or PROJECT_ADMIN (LLM cost gate
|
|
1062
|
+
* Requires PROJECT_AUTHOR or PROJECT_ADMIN (LLM cost gate).
|
|
1070
1063
|
*/
|
|
1071
1064
|
invoke(modelId: LLMModelId | string, input: LLMInvokeInput): Promise<Envelope<LLMResponse>>;
|
|
1072
1065
|
/**
|
|
1073
1066
|
* POST /@<slug>/compute/llms/<model-id>/invoke-stream — streaming
|
|
1074
|
-
* inference (SSE; per-token delta for low-latency UX
|
|
1067
|
+
* inference (SSE; per-token delta for low-latency UX).
|
|
1075
1068
|
* Returns an async iterable of `LLMStreamChunk` — caller writes
|
|
1076
1069
|
* `for await (const chunk of client.compute.llms.invokeStream(...))`.
|
|
1077
1070
|
* The SDK handles SSE framing internally per
|
|
@@ -1090,30 +1083,30 @@ declare function makeComputeNamespace(config: HttpClientConfig): {
|
|
|
1090
1083
|
* across accessible orgs) — `client.org` is the singular bound-org
|
|
1091
1084
|
* namespace with member / group / smtp / audit / gate sub-namespaces.
|
|
1092
1085
|
*
|
|
1093
|
-
* Org-plane URL grammar
|
|
1086
|
+
* Org-plane URL grammar: requests route against the
|
|
1094
1087
|
* `<orgSlug>.api.k9o.io/` org subdomain WITHOUT the `@<projectSlug>/`
|
|
1095
1088
|
* prefix used by project-plane requests. The gateway resolves the org
|
|
1096
1089
|
* context from the subdomain.
|
|
1097
1090
|
*/
|
|
1098
1091
|
|
|
1099
1092
|
type OrgMember = {
|
|
1100
|
-
/** `u_<base62
|
|
1093
|
+
/** `u_<base62>`. */
|
|
1101
1094
|
userId: string;
|
|
1102
1095
|
email: string;
|
|
1103
|
-
/** Org-level role enum
|
|
1096
|
+
/** Org-level role enum. */
|
|
1104
1097
|
role: "ORG_OWNER" | "ORG_ADMIN" | "ORG_BILLING_ADMIN" | "ORG_MEMBER";
|
|
1105
1098
|
joinedAt: string;
|
|
1106
1099
|
status: "active" | "invited" | "suspended";
|
|
1107
1100
|
};
|
|
1108
1101
|
type OrgGroup = {
|
|
1109
|
-
/** `grp_<base62
|
|
1102
|
+
/** `grp_<base62>`. */
|
|
1110
1103
|
id: string;
|
|
1111
1104
|
name: string;
|
|
1112
1105
|
memberCount: number;
|
|
1113
1106
|
createdAt: string;
|
|
1114
1107
|
};
|
|
1115
1108
|
type OrgRoleGrant = {
|
|
1116
|
-
/** `grt_<base62
|
|
1109
|
+
/** `grt_<base62>`. */
|
|
1117
1110
|
id: string;
|
|
1118
1111
|
userId: string;
|
|
1119
1112
|
role: "ORG_ADMIN" | "ORG_BILLING_ADMIN";
|
|
@@ -1124,7 +1117,7 @@ type OrgRoleGrant = {
|
|
|
1124
1117
|
viaDelegationId: string | null;
|
|
1125
1118
|
};
|
|
1126
1119
|
/**
|
|
1127
|
-
* Org-level audit event
|
|
1120
|
+
* Org-level audit event 6-event family.
|
|
1128
1121
|
*
|
|
1129
1122
|
* Event types (closed set at v2.1.132):
|
|
1130
1123
|
* - `data.write.org.member_invited`
|
|
@@ -1134,7 +1127,7 @@ type OrgRoleGrant = {
|
|
|
1134
1127
|
* - `data.write.org.idp_config_changed`
|
|
1135
1128
|
* - `data.write.org.settings_updated`
|
|
1136
1129
|
*
|
|
1137
|
-
* `targetKind` is `org` for all; `targetId` is the orgId
|
|
1130
|
+
* `targetKind` is `org` for all; `targetId` is the orgId.
|
|
1138
1131
|
*/
|
|
1139
1132
|
type OrgAuditEvent = {
|
|
1140
1133
|
id: string;
|
|
@@ -1148,7 +1141,7 @@ type OrgAuditEvent = {
|
|
|
1148
1141
|
traceId: string | null;
|
|
1149
1142
|
};
|
|
1150
1143
|
/**
|
|
1151
|
-
* Org SMTP configuration
|
|
1144
|
+
* Org SMTP configuration. Sensitive fields (passwordRef)
|
|
1152
1145
|
* are sequestered in Kibo enclave; the SDK stores only the reference.
|
|
1153
1146
|
*/
|
|
1154
1147
|
type SmtpConfig = {
|
|
@@ -1175,7 +1168,7 @@ type SmtpTestEmailResult = {
|
|
|
1175
1168
|
attemptedAt: string;
|
|
1176
1169
|
};
|
|
1177
1170
|
type OrgIdpProvider = {
|
|
1178
|
-
/** `idp_<base62
|
|
1171
|
+
/** `idp_<base62>`. */
|
|
1179
1172
|
id: string;
|
|
1180
1173
|
name: string;
|
|
1181
1174
|
/** Protocol/vendor (e.g. "okta-saml", "azure-ad-oidc", "google-workspace"). */
|
|
@@ -1233,7 +1226,7 @@ declare function makeOrgNamespace(config: HttpClientConfig): {
|
|
|
1233
1226
|
* GET /audit-log (org-plane).
|
|
1234
1227
|
* Distinct from project-plane `client.audit.query()` which routes to
|
|
1235
1228
|
* `@<projectSlug>/audit-log`. Org-plane events cover the 6-event family
|
|
1236
|
-
*
|
|
1229
|
+
* (member_invited/removed/role_granted/revoked/
|
|
1237
1230
|
* idp_config_changed/settings_updated).
|
|
1238
1231
|
*/
|
|
1239
1232
|
query(opts?: {
|
|
@@ -1255,7 +1248,7 @@ declare function makeOrgNamespace(config: HttpClientConfig): {
|
|
|
1255
1248
|
/** Gate (IAK) org-level surfaces — role-grants + IdP-providers. */
|
|
1256
1249
|
gate: {
|
|
1257
1250
|
roles: {
|
|
1258
|
-
/** GET /org-role-grants — list active grants
|
|
1251
|
+
/** GET /org-role-grants — list active grants ask 4. */
|
|
1259
1252
|
list(opts?: {
|
|
1260
1253
|
userId?: string | undefined;
|
|
1261
1254
|
role?: OrgRoleGrant["role"] | undefined;
|
|
@@ -1272,7 +1265,7 @@ declare function makeOrgNamespace(config: HttpClientConfig): {
|
|
|
1272
1265
|
revoke(grantId: string): Promise<Envelope<OrgRoleGrant>>;
|
|
1273
1266
|
};
|
|
1274
1267
|
idpProviders: {
|
|
1275
|
-
/** GET /idp-providers — list configured org operator IdP providers
|
|
1268
|
+
/** GET /idp-providers — list configured org operator IdP providers ask 7. */
|
|
1276
1269
|
list(): Promise<Envelope<ReadonlyArray<OrgIdpProvider>>>;
|
|
1277
1270
|
/** POST /idp-providers — create a new IdP integration. */
|
|
1278
1271
|
create(input: CreateOrgIdpInput): Promise<Envelope<OrgIdpProvider>>;
|
|
@@ -1295,7 +1288,7 @@ declare function makeOrgNamespace(config: HttpClientConfig): {
|
|
|
1295
1288
|
/**
|
|
1296
1289
|
* GET /org/smtp — read current SMTP config.
|
|
1297
1290
|
* Returns null when no org-level SMTP is configured (falls back to
|
|
1298
|
-
* platform SMTP
|
|
1291
|
+
* platform SMTP 3-tier cascade).
|
|
1299
1292
|
*/
|
|
1300
1293
|
get(): Promise<Envelope<SmtpConfig | null>>;
|
|
1301
1294
|
/**
|
|
@@ -1318,18 +1311,18 @@ declare function makeOrgNamespace(config: HttpClientConfig): {
|
|
|
1318
1311
|
cleared: boolean;
|
|
1319
1312
|
}>>;
|
|
1320
1313
|
};
|
|
1321
|
-
/** Org-default LLM — get / set
|
|
1314
|
+
/** Org-default LLM — get / set (ORG_ADMIN). */
|
|
1322
1315
|
defaultLLM: {
|
|
1323
1316
|
/**
|
|
1324
|
-
* GET /org/default-llm — read the org-default LLM model id
|
|
1325
|
-
|
|
1326
|
-
* falls back to `mistral-7b`
|
|
1317
|
+
* GET /org/default-llm — read the org-default LLM model id
|
|
1318
|
+
*. Returns `null` when no explicit default is set (gateway
|
|
1319
|
+
* falls back to `mistral-7b`). ORG_ADMIN read; tier-gated.
|
|
1327
1320
|
*/
|
|
1328
1321
|
get(): Promise<Envelope<LLMModelId | null>>;
|
|
1329
1322
|
/**
|
|
1330
|
-
* PATCH /org/default-llm — set the org-default LLM
|
|
1323
|
+
* PATCH /org/default-llm — set the org-default LLM.
|
|
1331
1324
|
* ORG_ADMIN only. The model must be available to the org's tier per
|
|
1332
|
-
*
|
|
1325
|
+
* or the gateway returns K9O_TIER_FEATURE_GATED.
|
|
1333
1326
|
*/
|
|
1334
1327
|
set(input: {
|
|
1335
1328
|
modelId: LLMModelId;
|
|
@@ -1359,17 +1352,17 @@ declare function makeOrgNamespace(config: HttpClientConfig): {
|
|
|
1359
1352
|
* Wire mapping (gateway uses platform-plane / cross-org `/me/...` routes):
|
|
1360
1353
|
* - `client.me.profile.get/update` → GET/PATCH /me
|
|
1361
1354
|
* - `client.me.sessions.list/revoke` → GET/DELETE /me/sessions
|
|
1362
|
-
* - `client.me.apiTokens.list/create/delete` → GET/POST/DELETE /me/api-tokens (
|
|
1363
|
-
* - `client.me.notifications.list/markRead` → GET/PATCH /me/notifications (
|
|
1364
|
-
* - `client.me.auditLog.query` → GET /me/audit-log (
|
|
1365
|
-
* - `client.me.dataExport.request` → POST /me/data-export (
|
|
1355
|
+
* - `client.me.apiTokens.list/create/delete` → GET/POST/DELETE /me/api-tokens (not available yet)
|
|
1356
|
+
* - `client.me.notifications.list/markRead` → GET/PATCH /me/notifications (not available yet)
|
|
1357
|
+
* - `client.me.auditLog.query` → GET /me/audit-log (not available yet)
|
|
1358
|
+
* - `client.me.dataExport.request` → POST /me/data-export (not available yet)
|
|
1366
1359
|
*
|
|
1367
1360
|
* Profile, sessions and MFA setup are served by the existing gateway routes
|
|
1368
1361
|
* `me.ts` + `mfa.ts`.
|
|
1369
1362
|
*/
|
|
1370
1363
|
|
|
1371
1364
|
type MyProfile = {
|
|
1372
|
-
/** `u_<base62
|
|
1365
|
+
/** `u_<base62>`. */
|
|
1373
1366
|
id: string;
|
|
1374
1367
|
email: string;
|
|
1375
1368
|
displayName: string | null;
|
|
@@ -1431,9 +1424,8 @@ declare function makeMeNamespace(config: HttpClientConfig): {
|
|
|
1431
1424
|
}>>;
|
|
1432
1425
|
};
|
|
1433
1426
|
/**
|
|
1434
|
-
* API tokens for personal scripting
|
|
1435
|
-
*
|
|
1436
|
-
* Methods will return K9O_NOT_FOUND until gateway lands the endpoints.
|
|
1427
|
+
* API tokens for personal scripting. The gateway endpoints are not available yet,
|
|
1428
|
+
* so these methods return K9O_NOT_FOUND until they ship.
|
|
1437
1429
|
*/
|
|
1438
1430
|
apiTokens: {
|
|
1439
1431
|
list(): Promise<Envelope<ReadonlyArray<MyApiToken>>>;
|
|
@@ -1505,9 +1497,9 @@ declare function makeMeNamespace(config: HttpClientConfig): {
|
|
|
1505
1497
|
* Studio Dashboards SDK — `client.studio.dashboards.*`.
|
|
1506
1498
|
*
|
|
1507
1499
|
* Dashboards persisted authoring substrate.
|
|
1508
|
-
* Mirrors `_sys.dashboards`
|
|
1500
|
+
* Mirrors `_sys.dashboards` row shape.
|
|
1509
1501
|
*
|
|
1510
|
-
* Wire mapping (project-plane;
|
|
1502
|
+
* Wire mapping (project-plane;):
|
|
1511
1503
|
* - list() → GET /@<slug>/dashboards
|
|
1512
1504
|
* - create(dashboard) → POST /@<slug>/dashboards
|
|
1513
1505
|
* - read(id) → GET /@<slug>/dashboards/<dsh-id>
|
|
@@ -1516,17 +1508,17 @@ declare function makeMeNamespace(config: HttpClientConfig): {
|
|
|
1516
1508
|
* - pin(id) → POST /@<slug>/dashboards/<dsh-id>/pin
|
|
1517
1509
|
* - unpin(id) → POST /@<slug>/dashboards/<dsh-id>/unpin
|
|
1518
1510
|
*
|
|
1519
|
-
* Per
|
|
1511
|
+
* Per RBAC: create/update/delete/pin/unpin require
|
|
1520
1512
|
* PROJECT_AUTHOR; list/read read against all cohort roles subject
|
|
1521
|
-
* to RLS. Per
|
|
1513
|
+
* to RLS. Per, surfaces 2 K9O_DASHBOARD_* codes.
|
|
1522
1514
|
*/
|
|
1523
1515
|
|
|
1524
|
-
/** 9-widget catalogue
|
|
1516
|
+
/** 9-widget catalogue. */
|
|
1525
1517
|
type WidgetType = "kpi_card" | "bar_chart" | "line_chart" | "pie_chart" | "data_table" | "filter_dropdown" | "filter_date_range" | "text_panel" | "workflow_status";
|
|
1526
1518
|
/** Widget data source modes. */
|
|
1527
1519
|
type WidgetDataSourceMode = "view" | "query" | "workflow" | "rollup" | "form";
|
|
1528
1520
|
type DashboardStatus = "active" | "archived" | "draft";
|
|
1529
|
-
/** A widget config entry in the `widgets` array
|
|
1521
|
+
/** A widget config entry in the `widgets` array. */
|
|
1530
1522
|
type Widget = {
|
|
1531
1523
|
id: string;
|
|
1532
1524
|
widgetType: WidgetType;
|
|
@@ -1539,20 +1531,20 @@ type Widget = {
|
|
|
1539
1531
|
/** Widget-local config (display options, thresholds, etc.). */
|
|
1540
1532
|
config?: Record<string, unknown>;
|
|
1541
1533
|
};
|
|
1542
|
-
/** Dashboard record
|
|
1534
|
+
/** Dashboard record `_sys.dashboards` row. */
|
|
1543
1535
|
type Dashboard = {
|
|
1544
|
-
/** `dsh_<base62
|
|
1536
|
+
/** `dsh_<base62>`. */
|
|
1545
1537
|
id: string;
|
|
1546
1538
|
projectId: string;
|
|
1547
1539
|
name: string;
|
|
1548
1540
|
description: string;
|
|
1549
1541
|
status: DashboardStatus;
|
|
1550
|
-
/** Widget positions + sizes per output-03
|
|
1542
|
+
/** Widget positions + sizes per output-03 layout schema. */
|
|
1551
1543
|
layoutGrid: Record<string, unknown>;
|
|
1552
1544
|
widgets: ReadonlyArray<Widget>;
|
|
1553
1545
|
/** Dashboard-level filter widgets cascade to per-widget data sources. */
|
|
1554
1546
|
filterConfig: Record<string, unknown>;
|
|
1555
|
-
/** Pathmaker org-pin per output-03
|
|
1547
|
+
/** Pathmaker org-pin per output-03; surfaces in Workspace sidebar. */
|
|
1556
1548
|
pinnedToWorkspace: boolean;
|
|
1557
1549
|
rbacBinding: Record<string, unknown>;
|
|
1558
1550
|
authoredBy: string;
|
|
@@ -1576,7 +1568,7 @@ type DashboardListFilters = {
|
|
|
1576
1568
|
status?: DashboardStatus;
|
|
1577
1569
|
pinnedToWorkspace?: boolean;
|
|
1578
1570
|
};
|
|
1579
|
-
/** 2 K9O_DASHBOARD_* error codes
|
|
1571
|
+
/** 2 K9O_DASHBOARD_* error codes. */
|
|
1580
1572
|
declare const DASHBOARD_ERROR_CODES: {
|
|
1581
1573
|
readonly NOT_FOUND: "K9O_DASHBOARD_NOT_FOUND";
|
|
1582
1574
|
readonly WIDGET_INVALID: "K9O_DASHBOARD_WIDGET_INVALID";
|
|
@@ -1586,9 +1578,9 @@ declare const DASHBOARD_ERROR_CODES: {
|
|
|
1586
1578
|
* Studio Workflows SDK — `client.studio.workflows.*`.
|
|
1587
1579
|
*
|
|
1588
1580
|
* Workflows substrate. Mirrors
|
|
1589
|
-
* `_sys.workflows`
|
|
1581
|
+
* `_sys.workflows` + `_sys.workflow_runs` row shapes.
|
|
1590
1582
|
*
|
|
1591
|
-
* Wire mapping (project-plane;
|
|
1583
|
+
* Wire mapping (project-plane;):
|
|
1592
1584
|
* - list() → GET /@<slug>/workflows
|
|
1593
1585
|
* - create(workflow) → POST /@<slug>/workflows
|
|
1594
1586
|
* - read(id) → GET /@<slug>/workflows/<wfl-id>
|
|
@@ -1599,19 +1591,19 @@ declare const DASHBOARD_ERROR_CODES: {
|
|
|
1599
1591
|
* - runs.read(id, runId) → GET /@<slug>/workflows/<wfl-id>/runs/<wfr-id>
|
|
1600
1592
|
* - runs.cancel(id, runId) → POST /@<slug>/workflows/<wfl-id>/runs/<wfr-id>/cancel
|
|
1601
1593
|
*
|
|
1602
|
-
* Per
|
|
1594
|
+
* Per RBAC: create/update/delete/trigger/cancel require
|
|
1603
1595
|
* PROJECT_AUTHOR; list/read/runs read against all cohort roles subject
|
|
1604
|
-
* to RLS. Per
|
|
1596
|
+
* to RLS. Per, surfaces 6 K9O_WORKFLOW_* error codes (see
|
|
1605
1597
|
* `WORKFLOW_ERROR_CODES`); callers narrow on `error.code`.
|
|
1606
1598
|
*/
|
|
1607
1599
|
|
|
1608
|
-
/** 5-trigger catalogue
|
|
1600
|
+
/** 5-trigger catalogue. */
|
|
1609
1601
|
type WorkflowTriggerType = "view_row_event" | "form_submission" | "scheduled" | "manual" | "webhook";
|
|
1610
|
-
/** 9-action catalogue
|
|
1602
|
+
/** 9-action catalogue. */
|
|
1611
1603
|
type WorkflowActionType = "write_collection" | "read_collection" | "invoke_function" | "invoke_extension" | "llm_inference" | "send_notification" | "http_request" | "approval_step" | "branch";
|
|
1612
1604
|
type WorkflowStatus = "active" | "archived" | "draft";
|
|
1613
1605
|
type WorkflowRunStatus = "pending" | "running" | "succeeded" | "failed" | "cancelled";
|
|
1614
|
-
/** A single step in the `actions` chain
|
|
1606
|
+
/** A single step in the `actions` chain. */
|
|
1615
1607
|
type WorkflowAction = {
|
|
1616
1608
|
index: number;
|
|
1617
1609
|
action_type: WorkflowActionType;
|
|
@@ -1621,30 +1613,30 @@ type WorkflowAction = {
|
|
|
1621
1613
|
backoffStrategy?: string;
|
|
1622
1614
|
};
|
|
1623
1615
|
condition?: Record<string, unknown>;
|
|
1624
|
-
/** Sibling steps with parallel:true execute concurrently
|
|
1616
|
+
/** Sibling steps with parallel:true execute concurrently. */
|
|
1625
1617
|
parallel?: boolean;
|
|
1626
1618
|
};
|
|
1627
|
-
/** Workflow record
|
|
1619
|
+
/** Workflow record `_sys.workflows` row. */
|
|
1628
1620
|
type Workflow = {
|
|
1629
|
-
/** `wfl_<base62
|
|
1621
|
+
/** `wfl_<base62>`. */
|
|
1630
1622
|
id: string;
|
|
1631
1623
|
projectId: string;
|
|
1632
1624
|
name: string;
|
|
1633
1625
|
description: string;
|
|
1634
1626
|
status: WorkflowStatus;
|
|
1635
1627
|
triggerType: WorkflowTriggerType;
|
|
1636
|
-
/** Shape varies per triggerType
|
|
1628
|
+
/** Shape varies per triggerType. */
|
|
1637
1629
|
triggerConfig: Record<string, unknown>;
|
|
1638
|
-
/** Chain definition
|
|
1630
|
+
/** Chain definition. */
|
|
1639
1631
|
actions: ReadonlyArray<WorkflowAction>;
|
|
1640
|
-
/** Approver-step participant resolution
|
|
1632
|
+
/** Approver-step participant resolution. */
|
|
1641
1633
|
rbacBinding: Record<string, unknown>;
|
|
1642
1634
|
authoredBy: string;
|
|
1643
1635
|
authoredAt: string;
|
|
1644
1636
|
updatedBy: string;
|
|
1645
1637
|
updatedAt: string;
|
|
1646
1638
|
};
|
|
1647
|
-
/** Per-step status entry in a run
|
|
1639
|
+
/** Per-step status entry in a run `per_step_status`. */
|
|
1648
1640
|
type WorkflowRunStep = {
|
|
1649
1641
|
stepIndex: number;
|
|
1650
1642
|
actionType: WorkflowActionType;
|
|
@@ -1655,9 +1647,9 @@ type WorkflowRunStep = {
|
|
|
1655
1647
|
outputSummary?: unknown;
|
|
1656
1648
|
costSubtotal?: number;
|
|
1657
1649
|
};
|
|
1658
|
-
/** Workflow run record
|
|
1650
|
+
/** Workflow run record `_sys.workflow_runs` row. */
|
|
1659
1651
|
type WorkflowRun = {
|
|
1660
|
-
/** `wfr_<base62
|
|
1652
|
+
/** `wfr_<base62>`. */
|
|
1661
1653
|
id: string;
|
|
1662
1654
|
workflowId: string;
|
|
1663
1655
|
projectId: string;
|
|
@@ -1670,7 +1662,7 @@ type WorkflowRun = {
|
|
|
1670
1662
|
completedAt: string | null;
|
|
1671
1663
|
firedBy: string;
|
|
1672
1664
|
};
|
|
1673
|
-
/** Create input — omits server-assigned fields
|
|
1665
|
+
/** Create input — omits server-assigned fields. */
|
|
1674
1666
|
type CreateWorkflowInput = {
|
|
1675
1667
|
name: string;
|
|
1676
1668
|
description?: string;
|
|
@@ -1693,7 +1685,7 @@ type WorkflowRunListFilters = {
|
|
|
1693
1685
|
status?: WorkflowRunStatus;
|
|
1694
1686
|
};
|
|
1695
1687
|
/**
|
|
1696
|
-
* 6 K9O_WORKFLOW_* error codes
|
|
1688
|
+
* 6 K9O_WORKFLOW_* error codes. KError code-space is
|
|
1697
1689
|
* open; these constants document the well-known codes for narrowing
|
|
1698
1690
|
* (`if (e.code === WORKFLOW_ERROR_CODES.RUN_NOT_CANCELLABLE)`).
|
|
1699
1691
|
*/
|
|
@@ -1707,7 +1699,7 @@ declare const WORKFLOW_ERROR_CODES: {
|
|
|
1707
1699
|
};
|
|
1708
1700
|
|
|
1709
1701
|
declare function makeStudioNamespace(config: HttpClientConfig): {
|
|
1710
|
-
/** Workflow lifecycle + runs — `client.studio.workflows
|
|
1702
|
+
/** Workflow lifecycle + runs — `client.studio.workflows.*`. */
|
|
1711
1703
|
workflows: {
|
|
1712
1704
|
list(filters?: WorkflowListFilters): Promise<Envelope<ReadonlyArray<Workflow>>>;
|
|
1713
1705
|
create(workflow: CreateWorkflowInput): Promise<Envelope<Workflow>>;
|
|
@@ -1723,7 +1715,7 @@ declare function makeStudioNamespace(config: HttpClientConfig): {
|
|
|
1723
1715
|
cancel(workflowId: string, runId: string): Promise<Envelope<WorkflowRun>>;
|
|
1724
1716
|
};
|
|
1725
1717
|
};
|
|
1726
|
-
/** Dashboard lifecycle + widget data — `client.studio.dashboards
|
|
1718
|
+
/** Dashboard lifecycle + widget data — `client.studio.dashboards.*`. */
|
|
1727
1719
|
dashboards: {
|
|
1728
1720
|
list(filters?: DashboardListFilters): Promise<Envelope<ReadonlyArray<Dashboard>>>;
|
|
1729
1721
|
create(dashboard: CreateDashboardInput): Promise<Envelope<Dashboard>>;
|
|
@@ -1781,22 +1773,22 @@ declare function makeAiNamespace(config: HttpClientConfig): {
|
|
|
1781
1773
|
* `for await (const event of client.realtime.subscribe(topic)) { ... }`.
|
|
1782
1774
|
*
|
|
1783
1775
|
* Per `feedback_sdk_abstracted_primitive_default_to_richer_interaction.md`
|
|
1784
|
-
*
|
|
1776
|
+
* +: the SDK chooses the transport (WebSocket primary → SSE
|
|
1785
1777
|
* → poll), transparently. SPLIT (polling) is the SDK-internal fallback
|
|
1786
1778
|
* when WebSocket / SSE are unavailable — NOT a consumer-side design
|
|
1787
1779
|
* choice. The consumer sees one uniform async iterable regardless.
|
|
1788
1780
|
*
|
|
1789
|
-
* Wire mapping (project-plane;
|
|
1781
|
+
* Wire mapping (project-plane;):
|
|
1790
1782
|
* - subscribe → GET /@<slug>/realtime/subscribe?topic=<t>&filter=<jsonb> (WS/SSE upgrade)
|
|
1791
1783
|
* - replay → POST /@<slug>/realtime/replay { topic, fromSequence, untilSequence?, limit? }
|
|
1792
1784
|
*
|
|
1793
|
-
* Per
|
|
1794
|
-
* Per
|
|
1785
|
+
* Per, `filter` + RLS compose (filter narrows, RLS gates).
|
|
1786
|
+
* Per, surfaces no new codes — reuses K9O_INVALID_FILTER +
|
|
1795
1787
|
* K9O_SUBSCRIPTION_LIMIT_EXCEEDED + K9O_TIER_FEATURE_GATED.
|
|
1796
1788
|
*/
|
|
1797
1789
|
|
|
1798
1790
|
/**
|
|
1799
|
-
* The 6 closed subscription topic families
|
|
1791
|
+
* The 6 closed subscription topic families. Concrete
|
|
1800
1792
|
* topic strings carry a dynamic segment (collection name, resource id,
|
|
1801
1793
|
* event family) — use `realtimeTopic.*` builders to construct them.
|
|
1802
1794
|
*/
|
|
@@ -1804,7 +1796,7 @@ type RealtimeTopicFamily = "collections" | "studio.workflows.runs" | "studio.que
|
|
|
1804
1796
|
/** A concrete topic string, e.g. `studio.dashboards.refresh.dsh_abc`. */
|
|
1805
1797
|
type RealtimeTopic = string;
|
|
1806
1798
|
/**
|
|
1807
|
-
* Typed builders for the 6 topic families
|
|
1799
|
+
* Typed builders for the 6 topic families. Prefer these
|
|
1808
1800
|
* over hand-built strings for compile-time family safety.
|
|
1809
1801
|
*/
|
|
1810
1802
|
declare const realtimeTopic: {
|
|
@@ -1821,9 +1813,9 @@ declare const realtimeTopic: {
|
|
|
1821
1813
|
/** `audit.org.<event-family>` — org-plane audit events. */
|
|
1822
1814
|
readonly auditOrg: (eventFamily: string) => RealtimeTopic;
|
|
1823
1815
|
};
|
|
1824
|
-
/** Per-topic filter predicate
|
|
1816
|
+
/** Per-topic filter predicate (vocabulary). */
|
|
1825
1817
|
type RealtimeFilter = Record<string, unknown>;
|
|
1826
|
-
/** A single realtime event delivered on a subscription
|
|
1818
|
+
/** A single realtime event delivered on a subscription. */
|
|
1827
1819
|
type RealtimeEvent<T = unknown> = {
|
|
1828
1820
|
topic: RealtimeTopic;
|
|
1829
1821
|
/** Event type within the topic family (e.g. `row_inserted`, `workflow.run.completed`). */
|
|
@@ -1840,7 +1832,7 @@ type SubscribeOptions = {
|
|
|
1840
1832
|
/**
|
|
1841
1833
|
* Force a transport instead of the WebSocket → SSE → poll cascade.
|
|
1842
1834
|
* Mainly for tests + constrained runtimes. Omit for production —
|
|
1843
|
-
* the SDK picks the richest available transport
|
|
1835
|
+
* the SDK picks the richest available transport.
|
|
1844
1836
|
*/
|
|
1845
1837
|
transport?: RealtimeTransportKind;
|
|
1846
1838
|
/** Poll-transport interval in ms (default 2000). Only used when polling. */
|
|
@@ -1868,7 +1860,7 @@ declare function makeRealtimeNamespace(config: HttpClientConfig): {
|
|
|
1868
1860
|
/**
|
|
1869
1861
|
* Subscribe to a topic. Returns a `RealtimeSubscription` — an async
|
|
1870
1862
|
* iterable of `RealtimeEvent`s. The SDK selects the richest available
|
|
1871
|
-
* transport (WebSocket → SSE → poll)
|
|
1863
|
+
* transport (WebSocket → SSE → poll); the caller's
|
|
1872
1864
|
* `for await` loop is transport-agnostic.
|
|
1873
1865
|
*
|
|
1874
1866
|
* ```ts
|
|
@@ -1882,7 +1874,7 @@ declare function makeRealtimeNamespace(config: HttpClientConfig): {
|
|
|
1882
1874
|
*/
|
|
1883
1875
|
subscribe<T = unknown>(topic: RealtimeTopic, options?: SubscribeOptions): RealtimeSubscription<T>;
|
|
1884
1876
|
/**
|
|
1885
|
-
* One-shot historical replay
|
|
1877
|
+
* One-shot historical replay — catch up on missed
|
|
1886
1878
|
* events from `fromSequence`. Capped at 10k events server-side;
|
|
1887
1879
|
* paginate via the returned events' `sequence`. Use the highest
|
|
1888
1880
|
* `sequence` you've seen as the next `fromSequence`.
|
|
@@ -1899,21 +1891,19 @@ declare function makeRealtimeNamespace(config: HttpClientConfig): {
|
|
|
1899
1891
|
* factory returning typed bindings for Trailblazer/Anchor/Keystone
|
|
1900
1892
|
* class extensions (baked in at SDK publish time). Circuit-class
|
|
1901
1893
|
* (Long Tail) extensions use the install-time `k9o codegen` tool
|
|
1902
|
-
*
|
|
1903
|
-
*
|
|
1904
|
-
*
|
|
1905
|
-
*
|
|
1906
|
-
*
|
|
1907
|
-
*
|
|
1908
|
-
* the bridge will need to thread baseUrl + auth into the extension
|
|
1909
|
-
* runtime; until then the re-export is a thin pass-through.
|
|
1894
|
+
* path (a) OR raw HTTP / vendor-SDK fallback per path (b).
|
|
1895
|
+
*
|
|
1896
|
+
* The bridge re-exports the factory directly — it is config-free
|
|
1897
|
+
* (extension stubs do not require HTTP routing yet). Once per-method dispatch
|
|
1898
|
+
* ships, the bridge will thread baseUrl + auth into the extension runtime;
|
|
1899
|
+
* until then the re-export is a thin pass-through.
|
|
1910
1900
|
*/
|
|
1911
1901
|
|
|
1912
1902
|
/**
|
|
1913
1903
|
* Build the composed `client.extensions` namespace. Currently a thin
|
|
1914
1904
|
* re-export of the `@k9o/extensions` `k9o.extension(slug)` factory.
|
|
1915
|
-
* Config-free
|
|
1916
|
-
*
|
|
1905
|
+
* Config-free for now; it will use the client HTTP config once runtime
|
|
1906
|
+
* dispatch ships.
|
|
1917
1907
|
*/
|
|
1918
1908
|
declare function makeExtensionsBridge(): {
|
|
1919
1909
|
/** Resolve a typed extension instance by slug. See `@k9o/extensions` for the factory contract. */
|
|
@@ -2042,22 +2032,12 @@ declare function assertProviderRegion(value: unknown, provider?: ProviderRegionP
|
|
|
2042
2032
|
* Customer-facing surface. The `createClient(options)`
|
|
2043
2033
|
* factory returns a `K9oClient` instance with namespaces:
|
|
2044
2034
|
*
|
|
2045
|
-
* - `client.from(collection)` — data-plane DSL
|
|
2046
|
-
* - `client.projects` — project lifecycle
|
|
2047
|
-
*
|
|
2048
|
-
*
|
|
2049
|
-
*
|
|
2050
|
-
*
|
|
2051
|
-
* - `client.extensions` — extension consumption (re-export from `@k9o/extensions`)
|
|
2052
|
-
* - `client.migrations` — migration lifecycle (ch04 §2)
|
|
2053
|
-
* - `client.functions` — function deploy/invoke (ch07)
|
|
2054
|
-
* - `client.policies` — policy bundle lifecycle (ch06)
|
|
2055
|
-
* - `client.audit` — audit log queries (ch05 §4)
|
|
2056
|
-
* - `client.orgs` — org lifecycle (ch02)
|
|
2057
|
-
*
|
|
2058
|
-
* Architectural posture: 3-pillar default (`@k9o/gate` + `@k9o/extensions` + future `@k9o/kibo`)
|
|
2059
|
-
* with `@k9o/core` as the umbrella factory that composes pillars +
|
|
2060
|
-
* provides cross-cutting client construction + data-plane surface.
|
|
2035
|
+
* - `client.from(collection)` — data-plane DSL
|
|
2036
|
+
* - `client.projects` — project lifecycle
|
|
2037
|
+
* - `client.gate`, `client.extensions`, `client.migrations`, `client.functions`, `client.policies`,
|
|
2038
|
+
* `client.audit`, `client.orgs` and the other namespaces on the client type
|
|
2039
|
+
*
|
|
2040
|
+
* `@k9o/core` composes `@k9o/gate` and `@k9o/extensions` and adds client construction and the data-plane surface.
|
|
2061
2041
|
* The SDK shape stays stable whether pillars are imported directly or
|
|
2062
2042
|
* through `@k9o/core` — only the package boundary moves.
|
|
2063
2043
|
*
|
|
@@ -2070,8 +2050,8 @@ declare function assertProviderRegion(value: unknown, provider?: ProviderRegionP
|
|
|
2070
2050
|
* ```typescript
|
|
2071
2051
|
* import { createClient, KError } from "@k9o/core";
|
|
2072
2052
|
*
|
|
2053
|
+
* // `orgSlug` selects your organization's host (https://acme.api.k9o.io); do not also pass `baseUrl`.
|
|
2073
2054
|
* const client = createClient({
|
|
2074
|
-
* baseUrl: "https://acme.api.k9o.io",
|
|
2075
2055
|
* apiKey: process.env.K9O_API_KEY,
|
|
2076
2056
|
* orgSlug: "acme",
|
|
2077
2057
|
* projectSlug: "member-portal",
|
|
@@ -2103,7 +2083,7 @@ type K9oClient = {
|
|
|
2103
2083
|
* `client.kibo.vault.secrets` (credential pre-create): this namespace only registers a caller-supplied
|
|
2104
2084
|
* `credentialRef` string, never creates or resolves one. */
|
|
2105
2085
|
storage: ReturnType<typeof makeStorageNamespace>;
|
|
2106
|
-
/** Cross-surface metadata query
|
|
2086
|
+
/** Cross-surface metadata query — `client.metadata.from(...).where(...).execute()`. Client-side
|
|
2107
2087
|
* only until the gateway's Inc-2 route lands; see `metadata.ts` for status. */
|
|
2108
2088
|
metadata: ReturnType<typeof makeMetadataNamespace>;
|
|
2109
2089
|
/** Migration lifecycle — `client.migrations.apply()` etc. */
|
|
@@ -2120,27 +2100,27 @@ type K9oClient = {
|
|
|
2120
2100
|
org: ReturnType<typeof makeOrgNamespace>;
|
|
2121
2101
|
/** Operator-self namespace — `client.me.profile`, `client.me.sessions`, etc. Cross-org; no tenant context required. */
|
|
2122
2102
|
me: ReturnType<typeof makeMeNamespace>;
|
|
2123
|
-
/** Studio surfaces — `client.studio.workflows.*`
|
|
2103
|
+
/** Studio surfaces — `client.studio.workflows.*` + `client.studio.dashboards.*`. */
|
|
2124
2104
|
studio: ReturnType<typeof makeStudioNamespace>;
|
|
2125
|
-
/** Compute surfaces — `client.compute.llms
|
|
2105
|
+
/** Compute surfaces — `client.compute.llms.*`. */
|
|
2126
2106
|
compute: ReturnType<typeof makeComputeNamespace>;
|
|
2127
2107
|
/** Platform AI primitives — `client.ai.embed({ model?, input })`. */
|
|
2128
2108
|
ai: ReturnType<typeof makeAiNamespace>;
|
|
2129
|
-
/** Realtime subscriptions — `client.realtime.subscribe()` / `.replay()
|
|
2109
|
+
/** Realtime subscriptions — `client.realtime.subscribe()` / `.replay()`. */
|
|
2130
2110
|
realtime: ReturnType<typeof makeRealtimeNamespace>;
|
|
2131
2111
|
/** Gate (Identity-Aware Kernel) — composed from `@k9o/gate`. Available when projectSlug is bound on the client. */
|
|
2132
2112
|
readonly gate: GateClient;
|
|
2133
|
-
/** Kibo (Zero-Knowledge vault) — composed from `@k9o/kibo`. `client.kibo.vault.zkDeks.*` (
|
|
2113
|
+
/** Kibo (Zero-Knowledge vault) — composed from `@k9o/kibo`. `client.kibo.vault.zkDeks.*` (F.5); project-scoped methods self-guard the project context. */
|
|
2134
2114
|
readonly kibo: KiboClient;
|
|
2135
|
-
/** Extensions consumption — composed from `@k9o/extensions`. `client.extensions.extension(slug)` returns typed extension bindings
|
|
2115
|
+
/** Extensions consumption — composed from `@k9o/extensions`. `client.extensions.extension(slug)` returns typed extension bindings. */
|
|
2136
2116
|
extensions: ReturnType<typeof makeExtensionsBridge>;
|
|
2137
2117
|
/** Bound config — exposed for advanced use (custom HTTP per-call). */
|
|
2138
2118
|
readonly config: Readonly<HttpClientConfig>;
|
|
2139
2119
|
};
|
|
2140
2120
|
/**
|
|
2141
2121
|
* Construct a `K9oClient` bound to the supplied gateway baseUrl + auth
|
|
2142
|
-
* + project context. Validates the baseUrl at construct time
|
|
2143
|
-
*
|
|
2122
|
+
* + project context. Validates the baseUrl at construct time
|
|
2123
|
+
* — path-bearing baseUrls throw `K9O_INVALID_BASE_URL` synchronously.
|
|
2144
2124
|
*/
|
|
2145
2125
|
declare function createClient(options: CreateClientOptions): K9oClient;
|
|
2146
2126
|
|