@babav/knowledge-core-client 0.33.0 → 0.35.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,6 +417,7 @@ export interface Feedback {
417
417
  }
418
418
  export interface Agent {
419
419
  id: UUID;
420
+ tenant_id: UUID | null;
420
421
  name: string;
421
422
  identity_prompt: string | null;
422
423
  response_prompt: string | null;
@@ -435,6 +436,41 @@ export interface Agent {
435
436
  groundedness_threshold: number | null;
436
437
  grounding_enabled: boolean | null;
437
438
  citations_enabled: boolean | null;
439
+ visual_mode_default: string | null;
440
+ visual_concept_model: string | null;
441
+ visual_concept_vet_model: string | null;
442
+ visual_proposer_model: string | null;
443
+ visual_claims_check_model: string | null;
444
+ visual_vision_judge_model: string | null;
445
+ visual_max_revisions: number | null;
446
+ visual_combine_generation_and_concept: boolean | null;
447
+ concept_model_mode: string | null;
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. */
451
+ export type AgentWrite = Partial<Omit<Agent, "id" | "tenant_id">>;
452
+ /** Model catalog for the agent-config UI (GET /v1/agents/model-options). `models` maps id → its
453
+ * capabilities; `fields` gives each agent model-field its supported ids + default (+ usage metadata);
454
+ * `modes` says which model field governs each mode (reasoning is valid only if that model's
455
+ * supports_reasoning is true). KC provides the data; the UI decides presentation. */
456
+ export interface ModelOptions {
457
+ models: Record<string, {
458
+ label: string;
459
+ provider: "anthropic" | "vertex";
460
+ kind: "text" | "vision";
461
+ supports_reasoning: boolean;
462
+ }>;
463
+ fields: Record<string, {
464
+ supported: string[];
465
+ default: string;
466
+ applies_when?: string;
467
+ applies_to?: string[];
468
+ note?: string;
469
+ }>;
470
+ modes: Record<string, {
471
+ depends_on: string;
472
+ values: string[];
473
+ }>;
438
474
  }
439
475
  export interface Tenant {
440
476
  id: UUID;
@@ -923,28 +959,24 @@ export declare class AdminClient extends HttpBase {
923
959
  revokeApiKey: (tenantId: UUID, keyId: UUID) => Promise<void>;
924
960
  };
925
961
  agents: {
926
- create: (b: {
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 & {
927
972
  name: string;
928
- identity_prompt?: string;
929
- response_prompt?: string;
930
- generation_model?: string;
931
- generation_model_mode?: string;
932
- max_response_tokens?: number;
933
- top_k_retrieved_chunks?: number;
934
- top_k_reranked_chunks?: number;
935
- sibling_window?: number;
936
- rerank_instruction?: string;
937
- max_subqueries?: number;
938
- max_reasoning_rounds?: number;
939
- decomposition_model?: string;
940
- reasoning_inspect_model?: string;
941
- groundedness_verifier_model?: string;
942
- groundedness_threshold?: number;
943
- grounding_enabled?: boolean;
944
- citations_enabled?: boolean;
973
+ tenant_id?: UUID | null;
945
974
  }) => Promise<Agent>;
946
- update: (id: UUID, b: Partial<Omit<Agent, "id">>) => Promise<Agent>;
975
+ update: (id: UUID, b: AgentWrite) => Promise<Agent>;
947
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>;
948
980
  };
949
981
  }
950
982
  export interface ChatSendOptions extends StreamHandlers {
package/dist/index.js CHANGED
@@ -490,11 +490,20 @@ export class AdminClient extends HttpBase {
490
490
  listApiKeys: (tenantId, q) => this.request("GET", `/v1/tenants/${tenantId}/api-keys`, { query: q }),
491
491
  revokeApiKey: (tenantId, keyId) => this.request("DELETE", `/v1/tenants/${tenantId}/api-keys/${keyId}`),
492
492
  };
493
- // Agents are query agents, global for now.
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.
494
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}`),
495
501
  create: (b) => this.request("POST", "/v1/agents", { json: b }),
496
502
  update: (id, b) => this.request("PATCH", `/v1/agents/${id}`, { json: b }),
497
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"),
498
507
  };
499
508
  }
500
509
  /** A chat session bound to ONE conversation (created via `kc.chat(...)`). Every `send()` is ALWAYS
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@babav/knowledge-core-client",
3
- "version": "0.33.0",
3
+ "version": "0.35.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,6 +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
403
  name: string;
403
404
  identity_prompt: string | null; // answer-system: who/purpose (null => server default)
404
405
  response_prompt: string | null; // answer-system: output guidelines (null => server default)
@@ -417,6 +418,30 @@ export interface Agent {
417
418
  groundedness_threshold: number | null;
418
419
  grounding_enabled: boolean | null;
419
420
  citations_enabled: boolean | null;
421
+ // Visual pipeline defaults (null => server default; overridable per request).
422
+ visual_mode_default: string | null; // "off" | "on"
423
+ visual_concept_model: string | null;
424
+ visual_concept_vet_model: string | null;
425
+ visual_proposer_model: string | null; // authors the HTML figure + chart/structural/scene specs
426
+ visual_claims_check_model: string | null;
427
+ visual_vision_judge_model: string | null; // Vertex Gemini model
428
+ visual_max_revisions: number | null;
429
+ visual_combine_generation_and_concept: boolean | null;
430
+ concept_model_mode: string | null; // "reasoning" | "standard"; overrules gen mode when combining
431
+ }
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. */
435
+ export type AgentWrite = Partial<Omit<Agent, "id" | "tenant_id">>;
436
+
437
+ /** Model catalog for the agent-config UI (GET /v1/agents/model-options). `models` maps id → its
438
+ * capabilities; `fields` gives each agent model-field its supported ids + default (+ usage metadata);
439
+ * `modes` says which model field governs each mode (reasoning is valid only if that model's
440
+ * supports_reasoning is true). KC provides the data; the UI decides presentation. */
441
+ export interface ModelOptions {
442
+ models: Record<string, { label: string; provider: "anthropic" | "vertex"; kind: "text" | "vision"; supports_reasoning: boolean }>;
443
+ fields: Record<string, { supported: string[]; default: string; applies_when?: string; applies_to?: string[]; note?: string }>;
444
+ modes: Record<string, { depends_on: string; values: string[] }>;
420
445
  }
421
446
  export interface Tenant {
422
447
  id: UUID;
@@ -1065,13 +1090,23 @@ export class AdminClient extends HttpBase {
1065
1090
  revokeApiKey: (tenantId: UUID, keyId: UUID) => this.request<void>("DELETE", `/v1/tenants/${tenantId}/api-keys/${keyId}`),
1066
1091
  };
1067
1092
 
1068
- // Agents are query agents, global for now.
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.
1069
1095
  agents = {
1070
- create: (b: { name: string; identity_prompt?: string; response_prompt?: string; generation_model?: string; generation_model_mode?: string; max_response_tokens?: number; top_k_retrieved_chunks?: number; top_k_reranked_chunks?: number; sibling_window?: number; rerank_instruction?: string; max_subqueries?: number; max_reasoning_rounds?: number; decomposition_model?: string; reasoning_inspect_model?: string; groundedness_verifier_model?: string; groundedness_threshold?: number; grounding_enabled?: boolean; citations_enabled?: boolean }) =>
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 }) =>
1071
1103
  this.request<Agent>("POST", "/v1/agents", { json: b }),
1072
- update: (id: UUID, b: Partial<Omit<Agent, "id">>) =>
1104
+ update: (id: UUID, b: AgentWrite) =>
1073
1105
  this.request<Agent>("PATCH", `/v1/agents/${id}`, { json: b }),
1074
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"),
1075
1110
  };
1076
1111
  }
1077
1112