@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.
Files changed (49) hide show
  1. package/CHANGELOG.md +5 -71
  2. package/README.md +224 -32
  3. package/dist/{chunk-OE2MMUIG.js → chunk-2NDFTHUB.js} +2 -2
  4. package/dist/chunk-2NDFTHUB.js.map +1 -0
  5. package/dist/{chunk-2VSTF5UU.js → chunk-LJZ45UA2.js} +1 -1
  6. package/dist/chunk-LJZ45UA2.js.map +1 -0
  7. package/dist/{chunk-FVWKL5UQ.js → chunk-O2ZTV6YN.js} +2 -2
  8. package/dist/chunk-O2ZTV6YN.js.map +1 -0
  9. package/dist/envelope.d.ts +9 -9
  10. package/dist/http.d.ts +4 -4
  11. package/dist/http.js +2 -2
  12. package/dist/index.d.ts +163 -183
  13. package/dist/index.js +43 -44
  14. package/dist/index.js.map +1 -1
  15. package/dist/kerror.d.ts +2 -2
  16. package/dist/kerror.js +1 -1
  17. package/dist/types.d.ts +4 -6
  18. package/dist/url-grammar.d.ts +6 -6
  19. package/dist/url-grammar.js +2 -2
  20. package/package.json +4 -4
  21. package/src/audit.ts +6 -6
  22. package/src/compute/llms.ts +16 -16
  23. package/src/data/from.ts +12 -12
  24. package/src/envelope.ts +9 -9
  25. package/src/extensions-bridge.ts +7 -9
  26. package/src/functions.ts +8 -8
  27. package/src/gate-bridge.ts +2 -2
  28. package/src/http.ts +4 -4
  29. package/src/index.ts +17 -27
  30. package/src/internal/sse.ts +2 -2
  31. package/src/kerror.ts +2 -2
  32. package/src/me.ts +7 -8
  33. package/src/metadata.ts +13 -20
  34. package/src/migrations.ts +12 -12
  35. package/src/org.ts +19 -19
  36. package/src/orgs.ts +5 -5
  37. package/src/policies.ts +2 -2
  38. package/src/projects.ts +5 -5
  39. package/src/realtime.ts +16 -16
  40. package/src/retry.ts +1 -1
  41. package/src/storage-buckets.ts +1 -1
  42. package/src/studio/dashboards.ts +13 -13
  43. package/src/studio/index.ts +2 -2
  44. package/src/studio/workflows.ts +21 -21
  45. package/src/types.ts +4 -6
  46. package/src/url-grammar.ts +6 -6
  47. package/dist/chunk-2VSTF5UU.js.map +0 -1
  48. package/dist/chunk-FVWKL5UQ.js.map +0 -1
  49. package/dist/chunk-OE2MMUIG.js.map +0 -1
package/src/index.ts CHANGED
@@ -4,22 +4,12 @@
4
4
  * Customer-facing surface. The `createClient(options)`
5
5
  * factory returns a `K9oClient` instance with namespaces:
6
6
  *
7
- * - `client.from(collection)` — data-plane DSL (ch04 §3 + §6.4)
8
- * - `client.projects` — project lifecycle (ch02)
7
+ * - `client.from(collection)` — data-plane DSL
8
+ * - `client.projects` — project lifecycle
9
+ * - `client.gate`, `client.extensions`, `client.migrations`, `client.functions`, `client.policies`,
10
+ * `client.audit`, `client.orgs` and the other namespaces on the client type
9
11
  *
10
- * Forward sub-cycles add:
11
- * - `client.gate` — auth composition (re-export from `@k9o/gate`)
12
- * - `client.kibo` — vault ops (re-export from future `@k9o/kibo`)
13
- * - `client.extensions` — extension consumption (re-export from `@k9o/extensions`)
14
- * - `client.migrations` — migration lifecycle (ch04 §2)
15
- * - `client.functions` — function deploy/invoke (ch07)
16
- * - `client.policies` — policy bundle lifecycle (ch06)
17
- * - `client.audit` — audit log queries (ch05 §4)
18
- * - `client.orgs` — org lifecycle (ch02)
19
- *
20
- * Architectural posture: 3-pillar default (`@k9o/gate` + `@k9o/extensions` + future `@k9o/kibo`)
21
- * with `@k9o/core` as the umbrella factory that composes pillars +
22
- * provides cross-cutting client construction + data-plane surface.
12
+ * `@k9o/core` composes `@k9o/gate` and `@k9o/extensions` and adds client construction and the data-plane surface.
23
13
  * The SDK shape stays stable whether pillars are imported directly or
24
14
  * through `@k9o/core` — only the package boundary moves.
25
15
  *
@@ -32,8 +22,8 @@
32
22
  * ```typescript
33
23
  * import { createClient, KError } from "@k9o/core";
34
24
  *
25
+ * // `orgSlug` selects your organization's host (https://acme.api.k9o.io); do not also pass `baseUrl`.
35
26
  * const client = createClient({
36
- * baseUrl: "https://acme.api.k9o.io",
37
27
  * apiKey: process.env.K9O_API_KEY,
38
28
  * orgSlug: "acme",
39
29
  * projectSlug: "member-portal",
@@ -160,7 +150,7 @@ export type {
160
150
  UpdateSecretInput, UpdateSecretResult, RotateSecretResult, MoveSecretResult,
161
151
  } from "@k9o/kibo";
162
152
 
163
- // Studio surfaces (ch07 §9 workflows + ch04 §3.10 dashboards)
153
+ // Studio surfaces (workflows + dashboards)
164
154
  export {
165
155
  WORKFLOW_ERROR_CODES,
166
156
  type Workflow,
@@ -188,7 +178,7 @@ export {
188
178
  type DashboardListFilters,
189
179
  } from "./studio/dashboards.ts";
190
180
 
191
- // Compute LLMs (ch07 §10)
181
+ // Compute LLMs
192
182
  export {
193
183
  LLM_ERROR_CODES,
194
184
  type LLMModelId,
@@ -205,7 +195,7 @@ export type { EmbedInput, EmbedResult, EmbeddingModelId } from "./ai.ts";
205
195
 
206
196
  export { assertProviderRegion, isProviderRegion, type ProviderRegionProvider } from "./provider-region.ts";
207
197
 
208
- // Realtime subscriptions (ch07 §11)
198
+ // Realtime subscriptions
209
199
  export {
210
200
  realtimeTopic,
211
201
  type RealtimeTopic,
@@ -232,7 +222,7 @@ export type K9oClient = {
232
222
  * `client.kibo.vault.secrets` (credential pre-create): this namespace only registers a caller-supplied
233
223
  * `credentialRef` string, never creates or resolves one. */
234
224
  storage: ReturnType<typeof makeStorageNamespace>;
235
- /** Cross-surface metadata query (ch14) — `client.metadata.from(...).where(...).execute()`. Client-side
225
+ /** Cross-surface metadata query — `client.metadata.from(...).where(...).execute()`. Client-side
236
226
  * only until the gateway's Inc-2 route lands; see `metadata.ts` for status. */
237
227
  metadata: ReturnType<typeof makeMetadataNamespace>;
238
228
  /** Migration lifecycle — `client.migrations.apply()` etc. */
@@ -249,19 +239,19 @@ export type K9oClient = {
249
239
  org: ReturnType<typeof makeOrgNamespace>;
250
240
  /** Operator-self namespace — `client.me.profile`, `client.me.sessions`, etc. Cross-org; no tenant context required. */
251
241
  me: ReturnType<typeof makeMeNamespace>;
252
- /** Studio surfaces — `client.studio.workflows.*` (ch07 §9) + `client.studio.dashboards.*` (ch04 §3.10). */
242
+ /** Studio surfaces — `client.studio.workflows.*` + `client.studio.dashboards.*`. */
253
243
  studio: ReturnType<typeof makeStudioNamespace>;
254
- /** Compute surfaces — `client.compute.llms.*` (ch07 §10). */
244
+ /** Compute surfaces — `client.compute.llms.*`. */
255
245
  compute: ReturnType<typeof makeComputeNamespace>;
256
246
  /** Platform AI primitives — `client.ai.embed({ model?, input })`. */
257
247
  ai: ReturnType<typeof makeAiNamespace>;
258
- /** Realtime subscriptions — `client.realtime.subscribe()` / `.replay()` (ch07 §11). */
248
+ /** Realtime subscriptions — `client.realtime.subscribe()` / `.replay()`. */
259
249
  realtime: ReturnType<typeof makeRealtimeNamespace>;
260
250
  /** Gate (Identity-Aware Kernel) — composed from `@k9o/gate`. Available when projectSlug is bound on the client. */
261
251
  readonly gate: GateClient;
262
- /** Kibo (Zero-Knowledge vault) — composed from `@k9o/kibo`. `client.kibo.vault.zkDeks.*` (ch08 §11.3.2 F.5); project-scoped methods self-guard the project context. */
252
+ /** Kibo (Zero-Knowledge vault) — composed from `@k9o/kibo`. `client.kibo.vault.zkDeks.*` (F.5); project-scoped methods self-guard the project context. */
263
253
  readonly kibo: KiboClient;
264
- /** Extensions consumption — composed from `@k9o/extensions`. `client.extensions.extension(slug)` returns typed extension bindings per ch13 §8.1. */
254
+ /** Extensions consumption — composed from `@k9o/extensions`. `client.extensions.extension(slug)` returns typed extension bindings. */
265
255
  extensions: ReturnType<typeof makeExtensionsBridge>;
266
256
  /** Bound config — exposed for advanced use (custom HTTP per-call). */
267
257
  readonly config: Readonly<HttpClientConfig>;
@@ -269,8 +259,8 @@ export type K9oClient = {
269
259
 
270
260
  /**
271
261
  * Construct a `K9oClient` bound to the supplied gateway baseUrl + auth
272
- * + project context. Validates the baseUrl at construct time per ch13
273
- * §7.2 — path-bearing baseUrls throw `K9O_INVALID_BASE_URL` synchronously.
262
+ * + project context. Validates the baseUrl at construct time
263
+ * — path-bearing baseUrls throw `K9O_INVALID_BASE_URL` synchronously.
274
264
  */
275
265
  export function createClient(options: CreateClientOptions): K9oClient {
276
266
  const baseUrl = resolveBaseUrl(options.baseUrl, options.orgSlug);
@@ -2,8 +2,8 @@
2
2
  * Minimal SSE (Server-Sent Events) stream parser — internal.
3
3
  *
4
4
  * Used by:
5
- * - `client.compute.llms.invokeStream()` (ch07 §10.2 `/invoke-stream`)
6
- * - `client.realtime.subscribe()` SSE transport fallback (ch07 §11.3)
5
+ * - `client.compute.llms.invokeStream()` (`/invoke-stream`)
6
+ * - `client.realtime.subscribe()` SSE transport fallback
7
7
  *
8
8
  * Parses an SSE byte stream (a `ReadableStream<Uint8Array>` from a fetch
9
9
  * `Response.body`) into an async iterable of parsed `data:` payloads.
package/src/kerror.ts CHANGED
@@ -17,7 +17,7 @@
17
17
  * gateway didn't return one).
18
18
  * - `status` — HTTP status the gateway returned (or null for
19
19
  * SDK-side construct-time errors like
20
- * `K9O_INVALID_BASE_URL` per ch13 §7.2).
20
+ * `K9O_INVALID_BASE_URL`).
21
21
  * - `requestId` — gateway-emitted trace ID for downstream correlation.
22
22
  *
23
23
  * Standalone `@k9o/gate` ships its own `GateError` for the Auth0-parity
@@ -75,7 +75,7 @@ export class KError extends Error {
75
75
  * Rehydrate a wire `KError` payload into a typed `KError` instance.
76
76
  * Unlike `@k9o/gate.gateErrorFromWire`, `@k9o/core` does not maintain
77
77
  * a hand-curated allow-list of known codes — the gateway's KError
78
- * code-space is open-ended and curated centrally per ch11; the SDK
78
+ * code-space is open-ended and curated centrally; the SDK
79
79
  * preserves whatever code the gateway sends. Code-narrowing in caller
80
80
  * code uses string-literal comparison against the well-known codes
81
81
  * (e.g. `if (e.code === 'K9O_TIER_CAP_HIT')`).
package/src/me.ts CHANGED
@@ -8,10 +8,10 @@
8
8
  * Wire mapping (gateway uses platform-plane / cross-org `/me/...` routes):
9
9
  * - `client.me.profile.get/update` → GET/PATCH /me
10
10
  * - `client.me.sessions.list/revoke` → GET/DELETE /me/sessions
11
- * - `client.me.apiTokens.list/create/delete` → GET/POST/DELETE /me/api-tokens (forward sub-cycle)
12
- * - `client.me.notifications.list/markRead` → GET/PATCH /me/notifications (forward sub-cycle)
13
- * - `client.me.auditLog.query` → GET /me/audit-log (forward sub-cycle)
14
- * - `client.me.dataExport.request` → POST /me/data-export (forward sub-cycle)
11
+ * - `client.me.apiTokens.list/create/delete` → GET/POST/DELETE /me/api-tokens (not available yet)
12
+ * - `client.me.notifications.list/markRead` → GET/PATCH /me/notifications (not available yet)
13
+ * - `client.me.auditLog.query` → GET /me/audit-log (not available yet)
14
+ * - `client.me.dataExport.request` → POST /me/data-export (not available yet)
15
15
  *
16
16
  * Profile, sessions and MFA setup are served by the existing gateway routes
17
17
  * `me.ts` + `mfa.ts`.
@@ -22,7 +22,7 @@ import { orgPath } from "./url-grammar.ts";
22
22
  import type { Envelope } from "./envelope.ts";
23
23
 
24
24
  export type MyProfile = {
25
- /** `u_<base62>` per ch01 §3.2. */
25
+ /** `u_<base62>`. */
26
26
  id: string;
27
27
  email: string;
28
28
  displayName: string | null;
@@ -98,9 +98,8 @@ export function makeMeNamespace(config: HttpClientConfig) {
98
98
  },
99
99
 
100
100
  /**
101
- * API tokens for personal scripting (forward-cycle surface per ch12
102
- * §3.1 implicit; substrate not yet shipped per gateway routes audit).
103
- * Methods will return K9O_NOT_FOUND until gateway lands the endpoints.
101
+ * API tokens for personal scripting. The gateway endpoints are not available yet,
102
+ * so these methods return K9O_NOT_FOUND until they ship.
104
103
  */
105
104
  apiTokens: {
106
105
  async list(): Promise<Envelope<ReadonlyArray<MyApiToken>>> {
package/src/metadata.ts CHANGED
@@ -1,19 +1,12 @@
1
1
  /**
2
- * `client.metadata.*` — ch14 cross-surface metadata query (`k9o.metadata.*` per ch14 §3.1).
2
+ * `client.metadata.*` — cross-surface metadata query (`k9o.metadata.*`).
3
3
  *
4
- * 🔴 Client-side surface only, built against the ch14 §3.2 REST contract and the landed Inc-1
5
- * parse/validate layer (`w4-ch14-metadata-query @ 3488e5c2`, unmerged as of this writing —
6
- * `services/gateway/src/routes/metadata-query-parse.ts`). `POST /@:projectSlug/metadata/query`
7
- * (Inc 2 — the route + telemetry-slice execution) has NOT landed yet; calling `.execute()` today
8
- * hits a 404, not a working query. This ships ahead of the route deliberately (same pattern as the
9
- * BYOS SDK surfaces) so the wire shape is locked to the spec, not re-derived once the route exists.
4
+ * Client-side surface for `POST /@:projectSlug/metadata/query`. The wire shape is fixed here ahead of the
5
+ * server route: until the gateway ships that route, calling `.execute()` returns a 404 rather than a result.
6
+ * Once it is available, only `telemetry:*` surfaces return data at first; collection and storage metadata
7
+ * follow as their server-side schemas land.
10
8
  *
11
- * The telemetry slice is buildable on Inc 2
12
- * (reuses the existing audit-log query); the collection + storage slices are blocked on greenfield
13
- * `record.metadata`/object-metadata schema (Inc 3/Inc 4) — so even once Inc 2 lands, only
14
- * `telemetry:*` surfaces will actually return data until those land.
15
- *
16
- * `textSearch`/`vectorSearch` (ch14 §3.4) are explicitly a later increment (Inc 5) — not implemented
9
+ * `textSearch`/`vectorSearch` are explicitly a later increment (Inc 5) — not implemented
17
10
  * here; adding stub methods for an unspecified future mode would be speculative, not spec-grounded.
18
11
  */
19
12
 
@@ -22,10 +15,10 @@ import { projectPath } from "./url-grammar.ts";
22
15
  import { KError } from "./kerror.ts";
23
16
  import type { Envelope } from "./envelope.ts";
24
17
 
25
- /** The three cross-surface slices (ch14 §2.1). */
18
+ /** The three cross-surface slices. */
26
19
  export type MetadataSlice = "collection" | "storage" | "telemetry";
27
20
 
28
- /** ch14 §3.3 operator vocabulary (= ch06 §3.5 JSON-policy set), mirrored verbatim from the gateway's
21
+ /** operator vocabulary (= JSON-policy set), mirrored verbatim from the gateway's
29
22
  * `metadata-query-parse.ts` so a typo can't silently pass client-side and fail only server-side. */
30
23
  export const METADATA_OPERATORS = [
31
24
  "eq", "neq", "gt", "gte", "lt", "lte",
@@ -34,7 +27,7 @@ export const METADATA_OPERATORS = [
34
27
  ] as const;
35
28
  export type MetadataOperator = (typeof METADATA_OPERATORS)[number];
36
29
 
37
- /** A surface label `<slice>:<scope>` (ch14 §2.2), e.g. `collection:posts`, `storage:images`,
30
+ /** A surface label `<slice>:<scope>`, e.g. `collection:posts`, `storage:images`,
38
31
  * `telemetry:auth.session.created`. */
39
32
  export type MetadataSurface = `${MetadataSlice}:${string}`;
40
33
 
@@ -45,7 +38,7 @@ export type MetadataWhereClause = {
45
38
  };
46
39
 
47
40
  /**
48
- * One result row (ch14 §3.1): "each record carries its surface + scope + the queried metadata
41
+ * One result row: "each record carries its surface + scope + the queried metadata
49
42
  * fields plus a back-reference id" — `recordId` (collection), `objectPath` (storage), or `eventId`
50
43
  * (telemetry), depending on which surface the row came from. Exact field names are provisional
51
44
  * pending Inc 2 landing a concrete response schema; kept loose (`metadata: Record<string, unknown>`)
@@ -65,7 +58,7 @@ export type MetadataQueryResult = {
65
58
  nextCursor: string | null;
66
59
  };
67
60
 
68
- /** The `k9o.metadata.from(...).where(...).limit(...).execute()` builder (ch14 §3.1). Immutable —
61
+ /** The `k9o.metadata.from(...).where(...).limit(...).execute()` builder. Immutable —
69
62
  * every chained call returns a new builder, so a partially-built query can be safely reused/branched. */
70
63
  export type MetadataQueryBuilder = {
71
64
  where(field: string, op: MetadataOperator, value: unknown): MetadataQueryBuilder;
@@ -78,7 +71,7 @@ function requireProjectSlug(config: HttpClientConfig): string {
78
71
  if (config.projectSlug === undefined || config.projectSlug.length === 0) {
79
72
  throw new KError({
80
73
  code: "K9O_MISSING_PROJECT_CONTEXT",
81
- message: "client.metadata requires a bound projectSlug (project data-plane resource, ch14 §4)",
74
+ message: "client.metadata requires a bound projectSlug (project data-plane resource,)",
82
75
  context: {},
83
76
  recommendation: "Pass projectSlug when constructing the client.",
84
77
  });
@@ -120,7 +113,7 @@ function makeBuilder(
120
113
 
121
114
  export function makeMetadataNamespace(config: HttpClientConfig) {
122
115
  return {
123
- /** Start a cross-surface metadata query against one or more surfaces (ch14 §3.1). */
116
+ /** Start a cross-surface metadata query against one or more surfaces. */
124
117
  from(surface: MetadataSurface | readonly MetadataSurface[]): MetadataQueryBuilder {
125
118
  const surfaces = Array.isArray(surface) ? surface : [surface as MetadataSurface];
126
119
  if (surfaces.length === 0) {
package/src/migrations.ts CHANGED
@@ -16,8 +16,8 @@
16
16
  *
17
17
  * Migration shape — STRUCTURED
18
18
  * DECLARATIVE DDL, never raw SQL. Every schema change is a typed, key-tagged
19
- * operation, so schema drift is impossible at the SDK layer (the §2.1
20
- * invariant). Raw SQL is the separate runtime `client.query()` surface (§6),
19
+ * operation, so schema drift is impossible at the SDK layer (the
20
+ * invariant). Raw SQL is the separate runtime `client.query()` surface,
21
21
  * which cannot create/alter schema. The gateway checksums each migration and
22
22
  * stores it in `_sys.migrations`; already-applied versions are skipped on
23
23
  * re-run and mismatched checksums are rejected, preserving the drift invariant.
@@ -48,9 +48,9 @@ export type ColumnReferences = {
48
48
  };
49
49
 
50
50
  /**
51
- * A column definition. `type` is the ch04 §2.2.1 column-type vocabulary
51
+ * A column definition. `type` is the column-type vocabulary
52
52
  * (parser-owned; kept as `string` rather than a fabricated enum). The
53
- * protection attributes declare at-rest field encryption per §2.2.1 (gateway
53
+ * protection attributes declare at-rest field encryption (gateway
54
54
  * shape verified vs the parser, live since `2.56.0`).
55
55
  */
56
56
  export type ColumnSpec = {
@@ -62,7 +62,7 @@ export type ColumnSpec = {
62
62
  default?: string;
63
63
  references?: ColumnReferences;
64
64
  /**
65
- * At-rest field encryption (§2.2.1). `true` = inline-stored encrypted column;
65
+ * At-rest field encryption. `true` = inline-stored encrypted column;
66
66
  * the object form opts into a `store` ("inline" | "vault") and the D-mode
67
67
  * searchable-encryption index (`searchable`). NOTE: `searchable` is NESTED
68
68
  * here — it is NOT a sibling attribute.
@@ -86,7 +86,7 @@ export type IndexSpec = {
86
86
  * mutation (one op carries optional `add_columns[]` + `drop_columns[]`), live in
87
87
  * the gateway runner (`migration-runner.ts:156`).
88
88
  * `rename_column` remains a pending future op (its parser field names are not yet
89
- * finalised); NOTE per ch04 §2.2.1/§2.2.3 a `rename_column` on an ENCRYPTED column
89
+ * finalised); NOTE / a `rename_column` on an ENCRYPTED column
90
90
  * is fail-closed-rejected (`K9O_ENCRYPTED_COLUMN_DECLARATION_INVALID`) pending the
91
91
  * re-encryption pass — to document when that op lands.
92
92
  */
@@ -100,10 +100,10 @@ export type Operation =
100
100
  | { drop_index: { name: string } };
101
101
 
102
102
  /** A declarative authorization/relationship rule (compiles to RLS USING + WITH
103
- * CHECK per ch06 §4.2). The rule grammar is the policy-expression DSL. */
103
+ * CHECK). The rule grammar is the policy-expression DSL. */
104
104
  export type ActionRule = { rule?: unknown };
105
105
 
106
- /** A declared relationship for embedding/joins (ch04 §2.2 references). */
106
+ /** A declared relationship for embedding/joins (references). */
107
107
  export type RelationshipSpec = {
108
108
  collection: string;
109
109
  on: string;
@@ -111,7 +111,7 @@ export type RelationshipSpec = {
111
111
  type?: "inner" | "left";
112
112
  };
113
113
 
114
- /** Per-collection policy block (RLS + relationships), ch06 §4. */
114
+ /** Per-collection policy block (RLS + relationships),. */
115
115
  export type CollectionPolicy = {
116
116
  references?: ReadonlyArray<RelationshipSpec>;
117
117
  actions?: {
@@ -122,7 +122,7 @@ export type CollectionPolicy = {
122
122
  };
123
123
  };
124
124
 
125
- /** Per-bucket storage policy block, ch06 §5. */
125
+ /** Per-bucket storage policy block,. */
126
126
  export type StorageBucketPolicy = {
127
127
  public?: boolean;
128
128
  actions?: {
@@ -210,7 +210,7 @@ export function makeMigrationsNamespace(config: HttpClientConfig) {
210
210
  });
211
211
  },
212
212
 
213
- /** Queue migrations for maker-checker approval per ch06 §8. */
213
+ /** Queue migrations for maker-checker approval. */
214
214
  async queue(input: { migrations: ReadonlyArray<Migration> }): Promise<Envelope<{ pending: ReadonlyArray<PendingMigration> }>> {
215
215
  const slug = requireProjectSlug(config);
216
216
  return request(config, {
@@ -230,7 +230,7 @@ export function makeMigrationsNamespace(config: HttpClientConfig) {
230
230
  },
231
231
 
232
232
  /**
233
- * Apply a queued migration by id (§2.6 same-actor fast path — floors at
233
+ * Apply a queued migration by id (same-actor fast path — floors at
234
234
  * PROJECT_ADMIN; a `pending_approval` row, i.e. a protected-collection
235
235
  * migration awaiting a distinct-admin's review, is refused here and
236
236
  * needs its own approval flow, not this call).
package/src/org.ts CHANGED
@@ -7,7 +7,7 @@
7
7
  * across accessible orgs) — `client.org` is the singular bound-org
8
8
  * namespace with member / group / smtp / audit / gate sub-namespaces.
9
9
  *
10
- * Org-plane URL grammar per v2.5.68 §5.4: requests route against the
10
+ * Org-plane URL grammar: requests route against the
11
11
  * `<orgSlug>.api.k9o.io/` org subdomain WITHOUT the `@<projectSlug>/`
12
12
  * prefix used by project-plane requests. The gateway resolves the org
13
13
  * context from the subdomain.
@@ -23,17 +23,17 @@ import type { LLMModelId } from "./compute/llms.ts";
23
23
  // ----------------------------------------------------------------------
24
24
 
25
25
  export type OrgMember = {
26
- /** `u_<base62>` per ch01 §3.2. */
26
+ /** `u_<base62>`. */
27
27
  userId: string;
28
28
  email: string;
29
- /** Org-level role enum per ch05 §2.1. */
29
+ /** Org-level role enum. */
30
30
  role: "ORG_OWNER" | "ORG_ADMIN" | "ORG_BILLING_ADMIN" | "ORG_MEMBER";
31
31
  joinedAt: string;
32
32
  status: "active" | "invited" | "suspended";
33
33
  };
34
34
 
35
35
  export type OrgGroup = {
36
- /** `grp_<base62>` per ch01 §3.2. */
36
+ /** `grp_<base62>`. */
37
37
  id: string;
38
38
  name: string;
39
39
  memberCount: number;
@@ -41,7 +41,7 @@ export type OrgGroup = {
41
41
  };
42
42
 
43
43
  export type OrgRoleGrant = {
44
- /** `grt_<base62>` per ch02 §6.5. */
44
+ /** `grt_<base62>`. */
45
45
  id: string;
46
46
  userId: string;
47
47
  role: "ORG_ADMIN" | "ORG_BILLING_ADMIN";
@@ -53,7 +53,7 @@ export type OrgRoleGrant = {
53
53
  };
54
54
 
55
55
  /**
56
- * Org-level audit event per ch05 §4.2 6-event family.
56
+ * Org-level audit event 6-event family.
57
57
  *
58
58
  * Event types (closed set at v2.1.132):
59
59
  * - `data.write.org.member_invited`
@@ -63,7 +63,7 @@ export type OrgRoleGrant = {
63
63
  * - `data.write.org.idp_config_changed`
64
64
  * - `data.write.org.settings_updated`
65
65
  *
66
- * `targetKind` is `org` for all; `targetId` is the orgId per ch05 §4.1.
66
+ * `targetKind` is `org` for all; `targetId` is the orgId.
67
67
  */
68
68
  export type OrgAuditEvent = {
69
69
  id: string;
@@ -78,7 +78,7 @@ export type OrgAuditEvent = {
78
78
  };
79
79
 
80
80
  /**
81
- * Org SMTP configuration per ch02 §6.6. Sensitive fields (passwordRef)
81
+ * Org SMTP configuration. Sensitive fields (passwordRef)
82
82
  * are sequestered in Kibo enclave; the SDK stores only the reference.
83
83
  */
84
84
  export type SmtpConfig = {
@@ -108,7 +108,7 @@ export type SmtpTestEmailResult = {
108
108
  };
109
109
 
110
110
  export type OrgIdpProvider = {
111
- /** `idp_<base62>` per ch01 §3.2. */
111
+ /** `idp_<base62>`. */
112
112
  id: string;
113
113
  name: string;
114
114
  /** Protocol/vendor (e.g. "okta-saml", "azure-ad-oidc", "google-workspace"). */
@@ -181,7 +181,7 @@ function makeOrgAuditLogNamespace(config: HttpClientConfig) {
181
181
  * GET /audit-log (org-plane).
182
182
  * Distinct from project-plane `client.audit.query()` which routes to
183
183
  * `@<projectSlug>/audit-log`. Org-plane events cover the 6-event family
184
- * per ch05 §4.2 (member_invited/removed/role_granted/revoked/
184
+ * (member_invited/removed/role_granted/revoked/
185
185
  * idp_config_changed/settings_updated).
186
186
  */
187
187
  async query(opts?: {
@@ -207,7 +207,7 @@ function makeOrgAuditLogNamespace(config: HttpClientConfig) {
207
207
  function makeOrgGateNamespace(config: HttpClientConfig) {
208
208
  return {
209
209
  roles: {
210
- /** GET /org-role-grants — list active grants per ch02 §6.5 ask 4. */
210
+ /** GET /org-role-grants — list active grants ask 4. */
211
211
  async list(opts?: { userId?: string | undefined; role?: OrgRoleGrant["role"] | undefined; includeRevoked?: boolean | undefined }): Promise<Envelope<ReadonlyArray<OrgRoleGrant>>> {
212
212
  return request(config, { method: "GET", path: orgPath("org-role-grants"), query: opts });
213
213
  },
@@ -229,7 +229,7 @@ function makeOrgGateNamespace(config: HttpClientConfig) {
229
229
  },
230
230
 
231
231
  idpProviders: {
232
- /** GET /idp-providers — list configured org operator IdP providers per ch02 §6.5 ask 7. */
232
+ /** GET /idp-providers — list configured org operator IdP providers ask 7. */
233
233
  async list(): Promise<Envelope<ReadonlyArray<OrgIdpProvider>>> {
234
234
  return request(config, { method: "GET", path: orgPath("idp-providers") });
235
235
  },
@@ -262,7 +262,7 @@ function makeSmtpNamespace(config: HttpClientConfig) {
262
262
  /**
263
263
  * GET /org/smtp — read current SMTP config.
264
264
  * Returns null when no org-level SMTP is configured (falls back to
265
- * platform SMTP per ch02 §6.6 3-tier cascade).
265
+ * platform SMTP 3-tier cascade).
266
266
  */
267
267
  async get(): Promise<Envelope<SmtpConfig | null>> {
268
268
  return request(config, { method: "GET", path: orgPath("org/smtp") });
@@ -297,18 +297,18 @@ function makeSmtpNamespace(config: HttpClientConfig) {
297
297
  function makeDefaultLlmNamespace(config: HttpClientConfig) {
298
298
  return {
299
299
  /**
300
- * GET /org/default-llm — read the org-default LLM model id per ch07
301
- * §10.3. Returns `null` when no explicit default is set (gateway
302
- * falls back to `mistral-7b` per §10.3). ORG_ADMIN read; tier-gated.
300
+ * GET /org/default-llm — read the org-default LLM model id
301
+ *. Returns `null` when no explicit default is set (gateway
302
+ * falls back to `mistral-7b`). ORG_ADMIN read; tier-gated.
303
303
  */
304
304
  async get(): Promise<Envelope<LLMModelId | null>> {
305
305
  return request(config, { method: "GET", path: orgPath("org/default-llm") });
306
306
  },
307
307
 
308
308
  /**
309
- * PATCH /org/default-llm — set the org-default LLM per ch07 §10.3.
309
+ * PATCH /org/default-llm — set the org-default LLM.
310
310
  * ORG_ADMIN only. The model must be available to the org's tier per
311
- * §10.1 or the gateway returns K9O_TIER_FEATURE_GATED.
311
+ * or the gateway returns K9O_TIER_FEATURE_GATED.
312
312
  */
313
313
  async set(input: { modelId: LLMModelId }): Promise<Envelope<LLMModelId>> {
314
314
  return request(config, { method: "PATCH", path: orgPath("org/default-llm"), body: input });
@@ -332,7 +332,7 @@ export function makeOrgNamespace(config: HttpClientConfig) {
332
332
  gate: makeOrgGateNamespace(config),
333
333
  /** Org-level SMTP config — get / set / test / unset. */
334
334
  smtp: makeSmtpNamespace(config),
335
- /** Org-default LLM — get / set per ch07 §10.3 (ORG_ADMIN). */
335
+ /** Org-default LLM — get / set (ORG_ADMIN). */
336
336
  defaultLLM: makeDefaultLlmNamespace(config),
337
337
 
338
338
  /**
package/src/orgs.ts CHANGED
@@ -16,10 +16,10 @@
16
16
  * `restore` is the one exception — it stays keyed by `orgId`, because a
17
17
  * soft-deleted org's slug is tombstoned and may have been reassigned.
18
18
  *
19
- * Per ch02 RBAC: org listing is scoped by the caller's accessible orgs
20
- * (most callers see exactly one — their own). Org creation is currently
21
- * out of scope at v0.1.0 (signup flow per ch10 §1; future sub-cycle
22
- * wires `client.orgs.create()` once signup substrate stabilises).
19
+ *: org listing is scoped by the caller's accessible orgs
20
+ * (most callers see exactly one — their own). Org creation is not available
21
+ * through the SDK yet; `client.orgs.create()` will be added once sign-up
22
+ * is exposed as an API).
23
23
  */
24
24
 
25
25
  import { request, type HttpClientConfig } from "./http.ts";
@@ -27,7 +27,7 @@ import { orgPath, validateSlug } from "./url-grammar.ts";
27
27
  import type { Envelope } from "./envelope.ts";
28
28
 
29
29
  export type Org = {
30
- /** `org_<base62>` per ch01 §3.2. */
30
+ /** `org_<base62>`. */
31
31
  id: string;
32
32
  slug: string;
33
33
  name: string;
package/src/policies.ts CHANGED
@@ -13,7 +13,7 @@
13
13
  * - `delete(bundleId)` → DELETE /@<slug>/policies/<id>
14
14
  * - `publish(bundleId)` → POST /@<slug>/policies/<id>/publish
15
15
  *
16
- * Per ch06 §9.4: only Pathmaker-class roles author policy; only
16
+ * Per: only Pathmaker-class roles author policy; only
17
17
  * Custodian-class roles publish. `validate` is read-only and any role
18
18
  * with policy-read can lint a candidate bundle.
19
19
  */
@@ -23,7 +23,7 @@ import { projectPath } from "./url-grammar.ts";
23
23
  import type { Envelope } from "./envelope.ts";
24
24
 
25
25
  export type PolicyBundle = {
26
- /** `pol_<base62>` per ch01 §3.2. */
26
+ /** `pol_<base62>`. */
27
27
  id: string;
28
28
  name: string;
29
29
  version: number;
package/src/projects.ts CHANGED
@@ -10,10 +10,10 @@
10
10
  *
11
11
  * The `list` + `create` operations operate org-plane and require
12
12
  * `orgSlug` to be bound on the client (or the bearer token to carry
13
- * an org context per ch01 §8.3). The `get` + `update` operations
13
+ * an org context). The `get` + `update` operations
14
14
  * operate member-plane and use the project slug.
15
15
  *
16
- * Per ch13 §4.1: all methods throw KError on non-2xx.
16
+ * Per: all methods throw KError on non-2xx.
17
17
  */
18
18
 
19
19
  import { request, type HttpClientConfig } from "./http.ts";
@@ -21,12 +21,12 @@ import { orgPath, projectPath, validateSlug } from "./url-grammar.ts";
21
21
  import type { Envelope } from "./envelope.ts";
22
22
 
23
23
  /**
24
- * Project shape per ch02. Fields are typed per the canonical shape;
24
+ * Project shape. Fields are typed per the canonical shape;
25
25
  * the gateway may return additional fields that this type doesn't
26
26
  * narrow — those are accessible via `as unknown as` widening.
27
27
  */
28
28
  export type Project = {
29
- /** `proj_<base62>` per ch01 §3.2. */
29
+ /** `proj_<base62>`. */
30
30
  id: string;
31
31
  slug: string;
32
32
  name: string;
@@ -60,7 +60,7 @@ export function makeProjectsNamespace(config: HttpClientConfig) {
60
60
  return {
61
61
  /**
62
62
  * List projects accessible to the caller. Requires authenticated
63
- * session; results are scoped by RBAC per ch06.
63
+ * session; results are scoped by RBAC.
64
64
  */
65
65
  async list(): Promise<Envelope<ReadonlyArray<Project>>> {
66
66
  return request<ReadonlyArray<Project>>(config, {