@babav/knowledge-core-client 0.35.0 → 0.37.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
@@ -61,6 +61,8 @@ export interface QueryOverrides {
61
61
  max_reasoning_rounds?: number;
62
62
  decomposition_model?: string;
63
63
  reasoning_inspect_model?: string;
64
+ multi_query_model?: string;
65
+ citation_model?: string;
64
66
  groundedness_verifier_model?: string;
65
67
  groundedness_threshold?: number;
66
68
  grounding_enabled?: boolean;
@@ -417,7 +419,7 @@ export interface Feedback {
417
419
  }
418
420
  export interface Agent {
419
421
  id: UUID;
420
- tenant_id: UUID | null;
422
+ tenant_id: UUID;
421
423
  name: string;
422
424
  identity_prompt: string | null;
423
425
  response_prompt: string | null;
@@ -432,6 +434,8 @@ export interface Agent {
432
434
  max_reasoning_rounds: number | null;
433
435
  decomposition_model: string | null;
434
436
  reasoning_inspect_model: string | null;
437
+ multi_query_model: string | null;
438
+ citation_model: string | null;
435
439
  groundedness_verifier_model: string | null;
436
440
  groundedness_threshold: number | null;
437
441
  grounding_enabled: boolean | null;
@@ -446,8 +450,10 @@ export interface Agent {
446
450
  visual_combine_generation_and_concept: boolean | null;
447
451
  concept_model_mode: string | null;
448
452
  }
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. */
453
+ /** Fields settable when creating/updating an agent. All optional except `name` on create
454
+ * (null/omit => server default); model fields must be one of
455
+ * `agents.modelOptions().fields[field].supported`. The owning tenant is the caller's key —
456
+ * it is never part of the body. */
451
457
  export type AgentWrite = Partial<Omit<Agent, "id" | "tenant_id">>;
452
458
  /** Model catalog for the agent-config UI (GET /v1/agents/model-options). `models` maps id → its
453
459
  * capabilities; `fields` gives each agent model-field its supported ids + default (+ usage metadata);
@@ -888,12 +894,22 @@ export declare class KnowledgeCoreClient extends HttpBase {
888
894
  delete: (id: UUID) => Promise<void>;
889
895
  };
890
896
  agents: {
897
+ /** List this tenant's agents. */
891
898
  list: (q?: {
892
899
  limit?: number;
893
900
  cursor?: string;
894
901
  }) => Promise<Page<Agent>>;
895
902
  listAll: () => Promise<Agent[]>;
896
903
  get: (id: UUID) => Promise<Agent>;
904
+ /** Create an agent owned by this tenant (the owning tenant is the key's — no tenant_id in the body). */
905
+ create: (b: AgentWrite & {
906
+ name: string;
907
+ }) => Promise<Agent>;
908
+ update: (id: UUID, b: AgentWrite) => Promise<Agent>;
909
+ delete: (id: UUID) => Promise<void>;
910
+ /** The model catalog for an agent-config UI: supported models + default per field, per-model
911
+ * capabilities (`supports_reasoning`), and mode↔model dependencies. */
912
+ modelOptions: () => Promise<ModelOptions>;
897
913
  };
898
914
  analytics: {
899
915
  /** Query-volume time series for a corpus (the denominator for everything). */
@@ -958,26 +974,6 @@ export declare class AdminClient extends HttpBase {
958
974
  }) => Promise<Page<ApiKey>>;
959
975
  revokeApiKey: (tenantId: UUID, keyId: UUID) => Promise<void>;
960
976
  };
961
- agents: {
962
- /** List agents (admin). Pass `tenant_id` for one tenant's agents (+ global); omit for all agents
963
- * across every tenant. (A tenant lists its own via KnowledgeCoreClient.agents.list.) */
964
- list: (q?: {
965
- tenant_id?: UUID;
966
- limit?: number;
967
- cursor?: string;
968
- }) => Promise<Page<Agent>>;
969
- listAll: (tenantId?: UUID) => Promise<Agent[]>;
970
- get: (id: UUID) => Promise<Agent>;
971
- create: (b: AgentWrite & {
972
- name: string;
973
- tenant_id?: UUID | null;
974
- }) => Promise<Agent>;
975
- update: (id: UUID, b: AgentWrite) => Promise<Agent>;
976
- delete: (id: UUID) => Promise<void>;
977
- /** The model catalog for an agent-config UI: supported models + default per field, per-model
978
- * capabilities (`supports_reasoning`), and mode↔model dependencies. */
979
- modelOptions: () => Promise<ModelOptions>;
980
- };
981
977
  }
982
978
  export interface ChatSendOptions extends StreamHandlers {
983
979
  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,21 +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
- /** List agents (admin). Pass `tenant_id` for one tenant's agents (+ global); omit for all agents
497
- * across every tenant. (A tenant lists its own via KnowledgeCoreClient.agents.list.) */
498
- list: (q) => this.request("GET", "/v1/agents", { query: q }),
499
- listAll: (tenantId) => this.pageAll("/v1/agents", tenantId ? { tenant_id: tenantId } : {}),
500
- get: (id) => this.request("GET", `/v1/agents/${id}`),
501
- create: (b) => this.request("POST", "/v1/agents", { json: b }),
502
- update: (id, b) => this.request("PATCH", `/v1/agents/${id}`, { json: b }),
503
- delete: (id) => this.request("DELETE", `/v1/agents/${id}`),
504
- /** The model catalog for an agent-config UI: supported models + default per field, per-model
505
- * capabilities (`supports_reasoning`), and mode↔model dependencies. */
506
- modelOptions: () => this.request("GET", "/v1/agents/model-options"),
507
- };
508
502
  }
509
503
  /** A chat session bound to ONE conversation (created via `kc.chat(...)`). Every `send()` is ALWAYS
510
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.35.0",
3
+ "version": "0.37.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
@@ -82,6 +82,8 @@ export interface QueryOverrides {
82
82
  max_reasoning_rounds?: number; // iterative agentic-loop ceiling (1 = single pass; early-stops)
83
83
  decomposition_model?: string; // model for query decomposition
84
84
  reasoning_inspect_model?: string; // model for the per-round sufficiency / next-query decision
85
+ multi_query_model?: string; // model for multi-query expansion
86
+ citation_model?: string; // model for the citation pass (non-native-citation providers)
85
87
  groundedness_verifier_model?: string; // model for the groundedness LLM judge
86
88
  groundedness_threshold?: number;
87
89
  grounding_enabled?: boolean; // groundedness score (default off)
@@ -399,7 +401,7 @@ export interface Feedback {
399
401
  }
400
402
  export interface Agent {
401
403
  id: UUID;
402
- tenant_id: UUID | null; // null => Babav-global agent; a tenant id => per-tenant
404
+ tenant_id: UUID; // the owning tenant (every agent belongs to exactly one; no globals)
403
405
  name: string;
404
406
  identity_prompt: string | null; // answer-system: who/purpose (null => server default)
405
407
  response_prompt: string | null; // answer-system: output guidelines (null => server default)
@@ -414,6 +416,8 @@ export interface Agent {
414
416
  max_reasoning_rounds: number | null;
415
417
  decomposition_model: string | null;
416
418
  reasoning_inspect_model: string | null;
419
+ multi_query_model: string | null;
420
+ citation_model: string | null;
417
421
  groundedness_verifier_model: string | null;
418
422
  groundedness_threshold: number | null;
419
423
  grounding_enabled: boolean | null;
@@ -430,8 +434,10 @@ export interface Agent {
430
434
  concept_model_mode: string | null; // "reasoning" | "standard"; overrules gen mode when combining
431
435
  }
432
436
 
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. */
437
+ /** Fields settable when creating/updating an agent. All optional except `name` on create
438
+ * (null/omit => server default); model fields must be one of
439
+ * `agents.modelOptions().fields[field].supported`. The owning tenant is the caller's key —
440
+ * it is never part of the body. */
435
441
  export type AgentWrite = Partial<Omit<Agent, "id" | "tenant_id">>;
436
442
 
437
443
  /** Model catalog for the agent-config UI (GET /v1/agents/model-options). `models` maps id → its
@@ -1037,11 +1043,19 @@ export class KnowledgeCoreClient extends HttpBase {
1037
1043
  delete: (id: UUID) => this.request<void>("DELETE", `/v1/feedback/${id}`),
1038
1044
  };
1039
1045
 
1040
- // --- agents (tenant read-only: choose an agent to query) ---
1046
+ // --- agents (tenant-owned config the chat queries; full CRUD with the tenant key) ---
1041
1047
  agents = {
1048
+ /** List this tenant's agents. */
1042
1049
  list: (q?: { limit?: number; cursor?: string }) => this.request<Page<Agent>>("GET", "/v1/agents", { query: q }),
1043
1050
  listAll: () => this.pageAll<Agent>("/v1/agents"),
1044
1051
  get: (id: UUID) => this.request<Agent>("GET", `/v1/agents/${id}`),
1052
+ /** Create an agent owned by this tenant (the owning tenant is the key's — no tenant_id in the body). */
1053
+ create: (b: AgentWrite & { name: string }) => this.request<Agent>("POST", "/v1/agents", { json: b }),
1054
+ update: (id: UUID, b: AgentWrite) => this.request<Agent>("PATCH", `/v1/agents/${id}`, { json: b }),
1055
+ delete: (id: UUID) => this.request<void>("DELETE", `/v1/agents/${id}`),
1056
+ /** The model catalog for an agent-config UI: supported models + default per field, per-model
1057
+ * capabilities (`supports_reasoning`), and mode↔model dependencies. */
1058
+ modelOptions: () => this.request<ModelOptions>("GET", "/v1/agents/model-options"),
1045
1059
  };
1046
1060
 
1047
1061
  // --- retrieval analytics (read-only, tenant-scoped, aggregate-on-read) ---
@@ -1070,7 +1084,8 @@ export class KnowledgeCoreClient extends HttpBase {
1070
1084
  }
1071
1085
 
1072
1086
  // ---------------------------------------------------------------------------
1073
- // Admin client (tenant + key + agent management) — use the ADMIN key
1087
+ // Admin client (tenant + API-key provisioning) — use the ADMIN key.
1088
+ // Agents are tenant data; manage them with the tenant client (KnowledgeCoreClient.agents).
1074
1089
  // ---------------------------------------------------------------------------
1075
1090
  export class AdminClient extends HttpBase {
1076
1091
  /** @param opts.apiKey the ADMIN key, supplied by the caller. */
@@ -1089,25 +1104,8 @@ export class AdminClient extends HttpBase {
1089
1104
  listApiKeys: (tenantId: UUID, q?: { limit?: number; cursor?: string }) => this.request<Page<ApiKey>>("GET", `/v1/tenants/${tenantId}/api-keys`, { query: q }),
1090
1105
  revokeApiKey: (tenantId: UUID, keyId: UUID) => this.request<void>("DELETE", `/v1/tenants/${tenantId}/api-keys/${keyId}`),
1091
1106
  };
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
- /** List agents (admin). Pass `tenant_id` for one tenant's agents (+ global); omit for all agents
1097
- * across every tenant. (A tenant lists its own via KnowledgeCoreClient.agents.list.) */
1098
- list: (q?: { tenant_id?: UUID; limit?: number; cursor?: string }) =>
1099
- this.request<Page<Agent>>("GET", "/v1/agents", { query: q }),
1100
- listAll: (tenantId?: UUID) => this.pageAll<Agent>("/v1/agents", tenantId ? { tenant_id: tenantId } : {}),
1101
- get: (id: UUID) => this.request<Agent>("GET", `/v1/agents/${id}`),
1102
- create: (b: AgentWrite & { name: string; tenant_id?: UUID | null }) =>
1103
- this.request<Agent>("POST", "/v1/agents", { json: b }),
1104
- update: (id: UUID, b: AgentWrite) =>
1105
- this.request<Agent>("PATCH", `/v1/agents/${id}`, { json: b }),
1106
- delete: (id: UUID) => this.request<void>("DELETE", `/v1/agents/${id}`),
1107
- /** The model catalog for an agent-config UI: supported models + default per field, per-model
1108
- * capabilities (`supports_reasoning`), and mode↔model dependencies. */
1109
- modelOptions: () => this.request<ModelOptions>("GET", "/v1/agents/model-options"),
1110
- };
1107
+ // Agents are TENANT data, not an admin surface — manage them with the tenant key via
1108
+ // KnowledgeCoreClient.agents (create/update/delete/list/get/modelOptions).
1111
1109
  }
1112
1110
 
1113
1111
  export interface ChatSendOptions extends StreamHandlers {