@babav/knowledge-core-client 0.34.0 → 0.36.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/dist/index.d.ts CHANGED
@@ -417,7 +417,7 @@ export interface Feedback {
417
417
  }
418
418
  export interface Agent {
419
419
  id: UUID;
420
- tenant_id: UUID | null;
420
+ tenant_id: UUID;
421
421
  name: string;
422
422
  identity_prompt: string | null;
423
423
  response_prompt: string | null;
@@ -446,8 +446,10 @@ export interface Agent {
446
446
  visual_combine_generation_and_concept: boolean | null;
447
447
  concept_model_mode: string | null;
448
448
  }
449
- /** Fields settable when creating/updating an agent. All optional (null/omit => server default); model
450
- * fields must be one of `getModelOptions().fields[field].supported`. `tenant_id` is create-only. */
449
+ /** Fields settable when creating/updating an agent. All optional except `name` on create
450
+ * (null/omit => server default); model fields must be one of
451
+ * `agents.modelOptions().fields[field].supported`. The owning tenant is the caller's key —
452
+ * it is never part of the body. */
451
453
  export type AgentWrite = Partial<Omit<Agent, "id" | "tenant_id">>;
452
454
  /** Model catalog for the agent-config UI (GET /v1/agents/model-options). `models` maps id → its
453
455
  * capabilities; `fields` gives each agent model-field its supported ids + default (+ usage metadata);
@@ -888,12 +890,22 @@ export declare class KnowledgeCoreClient extends HttpBase {
888
890
  delete: (id: UUID) => Promise<void>;
889
891
  };
890
892
  agents: {
893
+ /** List this tenant's agents. */
891
894
  list: (q?: {
892
895
  limit?: number;
893
896
  cursor?: string;
894
897
  }) => Promise<Page<Agent>>;
895
898
  listAll: () => Promise<Agent[]>;
896
899
  get: (id: UUID) => Promise<Agent>;
900
+ /** Create an agent owned by this tenant (the owning tenant is the key's — no tenant_id in the body). */
901
+ create: (b: AgentWrite & {
902
+ name: string;
903
+ }) => Promise<Agent>;
904
+ update: (id: UUID, b: AgentWrite) => Promise<Agent>;
905
+ delete: (id: UUID) => Promise<void>;
906
+ /** The model catalog for an agent-config UI: supported models + default per field, per-model
907
+ * capabilities (`supports_reasoning`), and mode↔model dependencies. */
908
+ modelOptions: () => Promise<ModelOptions>;
897
909
  };
898
910
  analytics: {
899
911
  /** Query-volume time series for a corpus (the denominator for everything). */
@@ -958,17 +970,6 @@ export declare class AdminClient extends HttpBase {
958
970
  }) => Promise<Page<ApiKey>>;
959
971
  revokeApiKey: (tenantId: UUID, keyId: UUID) => Promise<void>;
960
972
  };
961
- agents: {
962
- create: (b: AgentWrite & {
963
- name: string;
964
- tenant_id?: UUID | null;
965
- }) => Promise<Agent>;
966
- update: (id: UUID, b: AgentWrite) => Promise<Agent>;
967
- delete: (id: UUID) => Promise<void>;
968
- /** The model catalog for an agent-config UI: supported models + default per field, per-model
969
- * capabilities (`supports_reasoning`), and mode↔model dependencies. */
970
- modelOptions: () => Promise<ModelOptions>;
971
- };
972
973
  }
973
974
  export interface ChatSendOptions extends StreamHandlers {
974
975
  overrides?: QueryRequest["overrides"];
package/dist/index.js CHANGED
@@ -444,11 +444,19 @@ export class KnowledgeCoreClient extends HttpBase {
444
444
  get: (id) => this.request("GET", `/v1/feedback/${id}`),
445
445
  delete: (id) => this.request("DELETE", `/v1/feedback/${id}`),
446
446
  };
447
- // --- agents (tenant read-only: choose an agent to query) ---
447
+ // --- agents (tenant-owned config the chat queries; full CRUD with the tenant key) ---
448
448
  agents = {
449
+ /** List this tenant's agents. */
449
450
  list: (q) => this.request("GET", "/v1/agents", { query: q }),
450
451
  listAll: () => this.pageAll("/v1/agents"),
451
452
  get: (id) => this.request("GET", `/v1/agents/${id}`),
453
+ /** Create an agent owned by this tenant (the owning tenant is the key's — no tenant_id in the body). */
454
+ create: (b) => this.request("POST", "/v1/agents", { json: b }),
455
+ update: (id, b) => this.request("PATCH", `/v1/agents/${id}`, { json: b }),
456
+ delete: (id) => this.request("DELETE", `/v1/agents/${id}`),
457
+ /** The model catalog for an agent-config UI: supported models + default per field, per-model
458
+ * capabilities (`supports_reasoning`), and mode↔model dependencies. */
459
+ modelOptions: () => this.request("GET", "/v1/agents/model-options"),
452
460
  };
453
461
  // --- retrieval analytics (read-only, tenant-scoped, aggregate-on-read) ---
454
462
  analytics = {
@@ -472,7 +480,8 @@ export class KnowledgeCoreClient extends HttpBase {
472
480
  };
473
481
  }
474
482
  // ---------------------------------------------------------------------------
475
- // Admin client (tenant + key + agent management) — use the ADMIN key
483
+ // Admin client (tenant + API-key provisioning) — use the ADMIN key.
484
+ // Agents are tenant data; manage them with the tenant client (KnowledgeCoreClient.agents).
476
485
  // ---------------------------------------------------------------------------
477
486
  export class AdminClient extends HttpBase {
478
487
  /** @param opts.apiKey the ADMIN key, supplied by the caller. */
@@ -490,16 +499,6 @@ export class AdminClient extends HttpBase {
490
499
  listApiKeys: (tenantId, q) => this.request("GET", `/v1/tenants/${tenantId}/api-keys`, { query: q }),
491
500
  revokeApiKey: (tenantId, keyId) => this.request("DELETE", `/v1/tenants/${tenantId}/api-keys/${keyId}`),
492
501
  };
493
- // Agent provisioning (query agents). Pass `tenant_id` on create for a per-tenant agent; omit (or
494
- // null) for a Babav-global one. Model fields are validated against the model registry server-side.
495
- agents = {
496
- create: (b) => this.request("POST", "/v1/agents", { json: b }),
497
- update: (id, b) => this.request("PATCH", `/v1/agents/${id}`, { json: b }),
498
- delete: (id) => this.request("DELETE", `/v1/agents/${id}`),
499
- /** The model catalog for an agent-config UI: supported models + default per field, per-model
500
- * capabilities (`supports_reasoning`), and mode↔model dependencies. */
501
- modelOptions: () => this.request("GET", "/v1/agents/model-options"),
502
- };
503
502
  }
504
503
  /** A chat session bound to ONE conversation (created via `kc.chat(...)`). Every `send()` is ALWAYS
505
504
  * conversational: the conversation_id is attached for you, so a chat turn can never be a
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@babav/knowledge-core-client",
3
- "version": "0.34.0",
3
+ "version": "0.36.0",
4
4
  "description": "TypeScript client for the Babav Knowledge Core API (Deno + Node 18+, zero deps). Includes the babav.visual grammar TYPES at the ./visual subpath (types only; all visual rendering is server-side).",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
package/src/index.ts CHANGED
@@ -399,7 +399,7 @@ export interface Feedback {
399
399
  }
400
400
  export interface Agent {
401
401
  id: UUID;
402
- tenant_id: UUID | null; // null => Babav-global agent; a tenant id => per-tenant
402
+ tenant_id: UUID; // the owning tenant (every agent belongs to exactly one; no globals)
403
403
  name: string;
404
404
  identity_prompt: string | null; // answer-system: who/purpose (null => server default)
405
405
  response_prompt: string | null; // answer-system: output guidelines (null => server default)
@@ -430,8 +430,10 @@ export interface Agent {
430
430
  concept_model_mode: string | null; // "reasoning" | "standard"; overrules gen mode when combining
431
431
  }
432
432
 
433
- /** Fields settable when creating/updating an agent. All optional (null/omit => server default); model
434
- * fields must be one of `getModelOptions().fields[field].supported`. `tenant_id` is create-only. */
433
+ /** Fields settable when creating/updating an agent. All optional except `name` on create
434
+ * (null/omit => server default); model fields must be one of
435
+ * `agents.modelOptions().fields[field].supported`. The owning tenant is the caller's key —
436
+ * it is never part of the body. */
435
437
  export type AgentWrite = Partial<Omit<Agent, "id" | "tenant_id">>;
436
438
 
437
439
  /** Model catalog for the agent-config UI (GET /v1/agents/model-options). `models` maps id → its
@@ -1037,11 +1039,19 @@ export class KnowledgeCoreClient extends HttpBase {
1037
1039
  delete: (id: UUID) => this.request<void>("DELETE", `/v1/feedback/${id}`),
1038
1040
  };
1039
1041
 
1040
- // --- agents (tenant read-only: choose an agent to query) ---
1042
+ // --- agents (tenant-owned config the chat queries; full CRUD with the tenant key) ---
1041
1043
  agents = {
1044
+ /** List this tenant's agents. */
1042
1045
  list: (q?: { limit?: number; cursor?: string }) => this.request<Page<Agent>>("GET", "/v1/agents", { query: q }),
1043
1046
  listAll: () => this.pageAll<Agent>("/v1/agents"),
1044
1047
  get: (id: UUID) => this.request<Agent>("GET", `/v1/agents/${id}`),
1048
+ /** Create an agent owned by this tenant (the owning tenant is the key's — no tenant_id in the body). */
1049
+ create: (b: AgentWrite & { name: string }) => this.request<Agent>("POST", "/v1/agents", { json: b }),
1050
+ update: (id: UUID, b: AgentWrite) => this.request<Agent>("PATCH", `/v1/agents/${id}`, { json: b }),
1051
+ delete: (id: UUID) => this.request<void>("DELETE", `/v1/agents/${id}`),
1052
+ /** The model catalog for an agent-config UI: supported models + default per field, per-model
1053
+ * capabilities (`supports_reasoning`), and mode↔model dependencies. */
1054
+ modelOptions: () => this.request<ModelOptions>("GET", "/v1/agents/model-options"),
1045
1055
  };
1046
1056
 
1047
1057
  // --- retrieval analytics (read-only, tenant-scoped, aggregate-on-read) ---
@@ -1070,7 +1080,8 @@ export class KnowledgeCoreClient extends HttpBase {
1070
1080
  }
1071
1081
 
1072
1082
  // ---------------------------------------------------------------------------
1073
- // Admin client (tenant + key + agent management) — use the ADMIN key
1083
+ // Admin client (tenant + API-key provisioning) — use the ADMIN key.
1084
+ // Agents are tenant data; manage them with the tenant client (KnowledgeCoreClient.agents).
1074
1085
  // ---------------------------------------------------------------------------
1075
1086
  export class AdminClient extends HttpBase {
1076
1087
  /** @param opts.apiKey the ADMIN key, supplied by the caller. */
@@ -1089,19 +1100,8 @@ export class AdminClient extends HttpBase {
1089
1100
  listApiKeys: (tenantId: UUID, q?: { limit?: number; cursor?: string }) => this.request<Page<ApiKey>>("GET", `/v1/tenants/${tenantId}/api-keys`, { query: q }),
1090
1101
  revokeApiKey: (tenantId: UUID, keyId: UUID) => this.request<void>("DELETE", `/v1/tenants/${tenantId}/api-keys/${keyId}`),
1091
1102
  };
1092
-
1093
- // Agent provisioning (query agents). Pass `tenant_id` on create for a per-tenant agent; omit (or
1094
- // null) for a Babav-global one. Model fields are validated against the model registry server-side.
1095
- agents = {
1096
- create: (b: AgentWrite & { name: string; tenant_id?: UUID | null }) =>
1097
- this.request<Agent>("POST", "/v1/agents", { json: b }),
1098
- update: (id: UUID, b: AgentWrite) =>
1099
- this.request<Agent>("PATCH", `/v1/agents/${id}`, { json: b }),
1100
- delete: (id: UUID) => this.request<void>("DELETE", `/v1/agents/${id}`),
1101
- /** The model catalog for an agent-config UI: supported models + default per field, per-model
1102
- * capabilities (`supports_reasoning`), and mode↔model dependencies. */
1103
- modelOptions: () => this.request<ModelOptions>("GET", "/v1/agents/model-options"),
1104
- };
1103
+ // Agents are TENANT data, not an admin surface — manage them with the tenant key via
1104
+ // KnowledgeCoreClient.agents (create/update/delete/list/get/modelOptions).
1105
1105
  }
1106
1106
 
1107
1107
  export interface ChatSendOptions extends StreamHandlers {