basion-ai-sdk 0.17.0 → 0.18.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.
@@ -510,6 +510,11 @@ declare class GatewayClient {
510
510
  * HTTP URL for VFS (Versioned Filesystem) service via proxy.
511
511
  */
512
512
  get vfsUrl(): string;
513
+ /**
514
+ * HTTP URL for Patient Profile service via proxy (includes /api/v1 suffix).
515
+ * Routes are under /api/v1 per the NestJS service prefix.
516
+ */
517
+ get patientProfileUrl(): string;
513
518
  /**
514
519
  * Register a handler for a topic.
515
520
  */
@@ -2495,6 +2500,113 @@ declare class MatchingClient {
2495
2500
  getMatchesByUser(userId: string): Promise<GroupedMatch[]>;
2496
2501
  }
2497
2502
 
2503
+ /**
2504
+ * Basion Agent SDK - Patient Profile Client
2505
+ *
2506
+ * HTTP client for the patient-profile service — provides SQL-over-agent_q
2507
+ * read access and draft-write (proposeFhirUpdate) capabilities for FHIR
2508
+ * patient data.
2509
+ *
2510
+ * The service exposes NestJS routes under `/api/v1`; this client is constructed
2511
+ * with the gateway proxy base URL (e.g. `http://gateway:8080/s/patient-profile/api/v1`)
2512
+ * and calls those routes directly.
2513
+ */
2514
+ interface AgentSqlResult {
2515
+ rows: Record<string, unknown>[];
2516
+ rowCount: number;
2517
+ ms: number;
2518
+ }
2519
+ interface ChunkResult {
2520
+ text: string;
2521
+ page?: number;
2522
+ offsets?: {
2523
+ start: number;
2524
+ end: number;
2525
+ };
2526
+ signedUrl?: string;
2527
+ }
2528
+ interface BinaryResult {
2529
+ url: string;
2530
+ contentType?: string;
2531
+ }
2532
+ interface DraftResult {
2533
+ diffId: string;
2534
+ status: 'awaiting_approval';
2535
+ resource: Record<string, unknown>;
2536
+ }
2537
+ interface ApproveDraftResult {
2538
+ status: 'approved' | 'rejected';
2539
+ diffId: string;
2540
+ }
2541
+ type DraftDecision = 'approve' | 'reject';
2542
+ interface ValidateCodeResult {
2543
+ valid: boolean;
2544
+ display?: string;
2545
+ message?: string;
2546
+ }
2547
+ interface ExpandValueSetResult {
2548
+ expansion: Array<{
2549
+ system: string;
2550
+ code: string;
2551
+ display?: string;
2552
+ }>;
2553
+ }
2554
+ interface LookupCodeResult {
2555
+ found: boolean;
2556
+ display?: string;
2557
+ definition?: string;
2558
+ properties?: Record<string, unknown>;
2559
+ }
2560
+ /**
2561
+ * HTTP client for the patient-profile service.
2562
+ *
2563
+ * The provided baseUrl should already include the `/api/v1` suffix, e.g.:
2564
+ * `http://agent-gateway:8080/s/patient-profile/api/v1`
2565
+ *
2566
+ * This matches the `patientProfileUrl` computed prop on `GatewayClient`.
2567
+ */
2568
+ declare class PatientProfileClient {
2569
+ private readonly baseUrl;
2570
+ constructor(baseUrl: string);
2571
+ /**
2572
+ * Execute a validated SELECT against the `agent_q.*` views for a patient.
2573
+ * The service enforces: one statement, SELECT-only, agent_q schema, LIMIT clamp.
2574
+ */
2575
+ agentSql(patientId: string, sql: string, timeoutSec?: number): Promise<AgentSqlResult>;
2576
+ /**
2577
+ * Get a document chunk by ID for a patient (includes text, page, offsets, signed URL).
2578
+ */
2579
+ getChunk(patientId: string, chunkId: string): Promise<ChunkResult>;
2580
+ /**
2581
+ * Get a binary/attachment for a patient (returns a signed or Medplum URL).
2582
+ */
2583
+ getBinary(patientId: string, binaryId: string): Promise<BinaryResult>;
2584
+ /**
2585
+ * Propose a FHIR resource update for a patient (chat-write / proposeFhirUpdate).
2586
+ * Returns a staged diff entry in `awaiting_approval` status.
2587
+ * The diff must be explicitly approved via `approveDraft`.
2588
+ */
2589
+ draft(patientId: string, resource: Record<string, unknown>, sourceText: string): Promise<DraftResult>;
2590
+ /**
2591
+ * Approve or reject a previously proposed draft diff.
2592
+ * `rejectedEntryIds` is optional and allows partial rejection within a diff.
2593
+ */
2594
+ approveDraft(patientId: string, diffId: string, decision: DraftDecision, rejectedEntryIds?: string[]): Promise<ApproveDraftResult>;
2595
+ /**
2596
+ * Validate a FHIR code against a code system.
2597
+ */
2598
+ validateCode(patientId: string, system: string, code: string, display?: string): Promise<ValidateCodeResult>;
2599
+ /**
2600
+ * Expand a FHIR ValueSet by URL (returns concept list).
2601
+ */
2602
+ expandValueSet(patientId: string, url: string, filter?: string): Promise<ExpandValueSetResult>;
2603
+ /**
2604
+ * Look up a code in a system (returns display name and properties).
2605
+ */
2606
+ lookupCode(patientId: string, system: string, code: string): Promise<LookupCodeResult>;
2607
+ private json;
2608
+ }
2609
+
2498
2610
  /**
2499
2611
  * Loki log handler for remote log collection.
2500
2612
  *
@@ -2635,6 +2747,7 @@ declare class BasionAgentApp {
2635
2747
  readonly renderClient: RenderClient;
2636
2748
  readonly matchingClient: MatchingClient;
2637
2749
  readonly vfsClient: VfsClient;
2750
+ readonly patientProfileClient: PatientProfileClient;
2638
2751
  readonly _pendingCalls: Map<string, PendingCall>;
2639
2752
  readonly _callContent: Map<string, {
2640
2753
  content: string;
@@ -2748,4 +2861,4 @@ declare class BasionAgentApp {
2748
2861
  private doShutdown;
2749
2862
  }
2750
2863
 
2751
- export { type GetMessagesOptions as $, type AttachmentInfo as A, BasionAgentApp as B, type CheckboxConfig as C, type DatePickerConfig as D, type Capability as E, type Field as F, GatewayClient as G, type HiddenConfig as H, type InferFields as I, type CapabilityItem as J, type ConnectionState as K, type ConnectionStateListener as L, type MultiSelectConfig as M, type NumberConfig as N, type OptionDef as O, Conversation as P, ConversationClient as Q, type ConversationData as R, StructuralStreamer as S, type TextConfig as T, ConversationMessage as U, type ValidationResult as V, DEFAULT_RECONNECTION_OPTIONS as W, type Edge as X, type Entity as Y, type GenuiComponent as Z, type GenuiComponentDict as _, type CheckboxGroupConfig as a, type GroupedMatch as a0, type GroupedMatchEntry as a1, type HeartbeatFailureCallback as a2, HeartbeatManager as a3, type HeartbeatOptions as a4, type IngestResponse as a5, type KafkaHeaders as a6, type KafkaMessage as a7, KnowledgeGraphTool as a8, type LogEntry as a9, type RelatedPage as aA, type RenderBufferResult as aB, RenderClient as aC, type RenderOptions as aD, type RenderResult as aE, type SearchMatch as aF, type SearchOptions as aG, type SearchResult as aH, SenderFilter as aI, type SenderFilterOptions as aJ, type SentryConfig as aK, type SentryLoggerProxy as aL, type SimilarDisease as aM, type StreamOptions as aN, Streamer as aO, type StreamerOptions as aP, Tools as aQ, type UserSummary as aR, createAttachmentInfo as aS, getSentryLogger as aT, isBraintrustEnabled as aU, isSentryEnabled as aV, reportPath as aW, type LogLevel as aa, type LokiHandlerOptions as ab, LokiLogHandler as ac, MatchingClient as ad, MatchingTool as ae, Memory as af, MemoryClient as ag, type MemoryIngestOptions as ah, type MemoryMessage as ai, type MemorySearchOptions as aj, type MemorySearchResult as ak, MemoryV2 as al, MemoryV2Client as am, type MemoryV2IngestPayload as an, type MemoryV2SearchPayload as ao, type MessageHandler as ap, type Need as aq, type NeedItem as ar, type NeedWithMatches as as, type PathStep as at, type PdfOptions as au, type ProduceAck as av, type Prompt as aw, type QueryOptions as ax, type ReconnectionOptions as ay, type RegisterOptions as az, type FileFieldConfig as b, type SelectConfig as c, type SliderConfig as d, type SwitchConfig as e, type ConfirmationConfig as f, Message as g, type ConfirmationResult as h, type StepDef as i, type ToDict as j, type AccordionItemDef as k, type AccordionConfig as l, type AccordionComponentDict as m, type CardVariant as n, type CardSectionDef as o, type CardButtonDef as p, type CardConfig as q, type CardComponentDict as r, Agent as s, type AgentInfo as t, AgentInventoryTool as u, type AgentRegistrationData as v, type AppOptions as w, AttachmentClient as x, type BraintrustConfig as y, type BundleRenderOptions as z };
2864
+ export { type DraftDecision as $, type AttachmentInfo as A, BasionAgentApp as B, type CheckboxConfig as C, type DatePickerConfig as D, type BinaryResult as E, type Field as F, GatewayClient as G, type HiddenConfig as H, type InferFields as I, type BraintrustConfig as J, type BundleRenderOptions as K, type Capability as L, type MultiSelectConfig as M, type NumberConfig as N, type OptionDef as O, type CapabilityItem as P, type ChunkResult as Q, type ConnectionState as R, StructuralStreamer as S, type TextConfig as T, type ConnectionStateListener as U, type ValidationResult as V, Conversation as W, ConversationClient as X, type ConversationData as Y, ConversationMessage as Z, DEFAULT_RECONNECTION_OPTIONS as _, type CheckboxGroupConfig as a, type ValidateCodeResult as a$, type DraftResult as a0, type Edge as a1, type Entity as a2, type ExpandValueSetResult as a3, type GenuiComponent as a4, type GenuiComponentDict as a5, type GetMessagesOptions as a6, type GroupedMatch as a7, type GroupedMatchEntry as a8, type HeartbeatFailureCallback as a9, type NeedWithMatches as aA, type PathStep as aB, PatientProfileClient as aC, type PdfOptions as aD, type ProduceAck as aE, type Prompt as aF, type QueryOptions as aG, type ReconnectionOptions as aH, type RegisterOptions as aI, type RelatedPage as aJ, type RenderBufferResult as aK, RenderClient as aL, type RenderOptions as aM, type RenderResult as aN, type SearchMatch as aO, type SearchOptions as aP, type SearchResult as aQ, SenderFilter as aR, type SenderFilterOptions as aS, type SentryConfig as aT, type SentryLoggerProxy as aU, type SimilarDisease as aV, type StreamOptions as aW, Streamer as aX, type StreamerOptions as aY, Tools as aZ, type UserSummary as a_, HeartbeatManager as aa, type HeartbeatOptions as ab, type IngestResponse as ac, type KafkaHeaders as ad, type KafkaMessage as ae, KnowledgeGraphTool as af, type LogEntry as ag, type LogLevel as ah, type LokiHandlerOptions as ai, LokiLogHandler as aj, type LookupCodeResult as ak, MatchingClient as al, MatchingTool as am, Memory as an, MemoryClient as ao, type MemoryIngestOptions as ap, type MemoryMessage as aq, type MemorySearchOptions as ar, type MemorySearchResult as as, MemoryV2 as at, MemoryV2Client as au, type MemoryV2IngestPayload as av, type MemoryV2SearchPayload as aw, type MessageHandler as ax, type Need as ay, type NeedItem as az, type FileFieldConfig as b, createAttachmentInfo as b0, getSentryLogger as b1, isBraintrustEnabled as b2, isSentryEnabled as b3, reportPath as b4, type SelectConfig as c, type SliderConfig as d, type SwitchConfig as e, type ConfirmationConfig as f, Message as g, type ConfirmationResult as h, type StepDef as i, type ToDict as j, type AccordionItemDef as k, type AccordionConfig as l, type AccordionComponentDict as m, type CardVariant as n, type CardSectionDef as o, type CardButtonDef as p, type CardConfig as q, type CardComponentDict as r, Agent as s, type AgentInfo as t, AgentInventoryTool as u, type AgentRegistrationData as v, type AgentSqlResult as w, type AppOptions as x, type ApproveDraftResult as y, AttachmentClient as z };
@@ -1,4 +1,4 @@
1
- import { B as BasionAgentApp } from '../app-BtaHyH9Q.js';
1
+ import { B as BasionAgentApp } from '../app-mRFPU6oe.js';
2
2
  import 'zod';
3
3
  import '../vfs-client-CsHAFj1R.js';
4
4
 
@@ -1,4 +1,4 @@
1
- import { B as BasionAgentApp } from '../app-BtaHyH9Q.js';
1
+ import { B as BasionAgentApp } from '../app-mRFPU6oe.js';
2
2
  import 'zod';
3
3
  import '../vfs-client-CsHAFj1R.js';
4
4
 
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { G as GatewayClient, S as StructuralStreamer, C as CheckboxConfig, F as Field, a as CheckboxGroupConfig, D as DatePickerConfig, b as FileFieldConfig, A as AttachmentInfo, H as HiddenConfig, M as MultiSelectConfig, N as NumberConfig, O as OptionDef, c as SelectConfig, d as SliderConfig, e as SwitchConfig, T as TextConfig, f as ConfirmationConfig, g as Message, h as ConfirmationResult, I as InferFields, V as ValidationResult, i as StepDef, j as ToDict, k as AccordionItemDef, l as AccordionConfig, m as AccordionComponentDict, n as CardVariant, o as CardSectionDef, p as CardButtonDef, q as CardConfig, r as CardComponentDict } from './app-BtaHyH9Q.js';
2
- export { s as Agent, t as AgentInfo, u as AgentInventoryTool, v as AgentRegistrationData, w as AppOptions, x as AttachmentClient, B as BasionAgentApp, y as BraintrustConfig, z as BundleRenderOptions, E as Capability, J as CapabilityItem, K as ConnectionState, L as ConnectionStateListener, P as Conversation, Q as ConversationClient, R as ConversationData, U as ConversationMessage, W as DEFAULT_RECONNECTION_OPTIONS, X as Edge, Y as Entity, Z as GenuiComponent, _ as GenuiComponentDict, $ as GetMessagesOptions, a0 as GroupedMatch, a1 as GroupedMatchEntry, a2 as HeartbeatFailureCallback, a3 as HeartbeatManager, a4 as HeartbeatOptions, a5 as IngestResponse, a6 as KafkaHeaders, a7 as KafkaMessage, a8 as KnowledgeGraphTool, a9 as LogEntry, aa as LogLevel, ab as LokiHandlerOptions, ac as LokiLogHandler, ad as MatchingClient, ae as MatchingTool, af as Memory, ag as MemoryClient, ah as MemoryIngestOptions, ai as MemoryMessage, aj as MemorySearchOptions, ak as MemorySearchResult, al as MemoryV2, am as MemoryV2Client, an as MemoryV2IngestPayload, ao as MemoryV2SearchPayload, ap as MessageHandler, aq as Need, ar as NeedItem, as as NeedWithMatches, at as PathStep, au as PdfOptions, av as ProduceAck, aw as Prompt, ax as QueryOptions, ay as ReconnectionOptions, az as RegisterOptions, aA as RelatedPage, aB as RenderBufferResult, aC as RenderClient, aD as RenderOptions, aE as RenderResult, aF as SearchMatch, aG as SearchOptions, aH as SearchResult, aI as SenderFilter, aJ as SenderFilterOptions, aK as SentryConfig, aL as SentryLoggerProxy, aM as SimilarDisease, aN as StreamOptions, aO as Streamer, aP as StreamerOptions, aQ as Tools, aR as UserSummary, aS as createAttachmentInfo, aT as getSentryLogger, aU as isBraintrustEnabled, aV as isSentryEnabled, aW as reportPath } from './app-BtaHyH9Q.js';
1
+ import { G as GatewayClient, S as StructuralStreamer, C as CheckboxConfig, F as Field, a as CheckboxGroupConfig, D as DatePickerConfig, b as FileFieldConfig, A as AttachmentInfo, H as HiddenConfig, M as MultiSelectConfig, N as NumberConfig, O as OptionDef, c as SelectConfig, d as SliderConfig, e as SwitchConfig, T as TextConfig, f as ConfirmationConfig, g as Message, h as ConfirmationResult, I as InferFields, V as ValidationResult, i as StepDef, j as ToDict, k as AccordionItemDef, l as AccordionConfig, m as AccordionComponentDict, n as CardVariant, o as CardSectionDef, p as CardButtonDef, q as CardConfig, r as CardComponentDict } from './app-mRFPU6oe.js';
2
+ export { s as Agent, t as AgentInfo, u as AgentInventoryTool, v as AgentRegistrationData, w as AgentSqlResult, x as AppOptions, y as ApproveDraftResult, z as AttachmentClient, B as BasionAgentApp, E as BinaryResult, J as BraintrustConfig, K as BundleRenderOptions, L as Capability, P as CapabilityItem, Q as ChunkResult, R as ConnectionState, U as ConnectionStateListener, W as Conversation, X as ConversationClient, Y as ConversationData, Z as ConversationMessage, _ as DEFAULT_RECONNECTION_OPTIONS, $ as DraftDecision, a0 as DraftResult, a1 as Edge, a2 as Entity, a3 as ExpandValueSetResult, a4 as GenuiComponent, a5 as GenuiComponentDict, a6 as GetMessagesOptions, a7 as GroupedMatch, a8 as GroupedMatchEntry, a9 as HeartbeatFailureCallback, aa as HeartbeatManager, ab as HeartbeatOptions, ac as IngestResponse, ad as KafkaHeaders, ae as KafkaMessage, af as KnowledgeGraphTool, ag as LogEntry, ah as LogLevel, ai as LokiHandlerOptions, aj as LokiLogHandler, ak as LookupCodeResult, al as MatchingClient, am as MatchingTool, an as Memory, ao as MemoryClient, ap as MemoryIngestOptions, aq as MemoryMessage, ar as MemorySearchOptions, as as MemorySearchResult, at as MemoryV2, au as MemoryV2Client, av as MemoryV2IngestPayload, aw as MemoryV2SearchPayload, ax as MessageHandler, ay as Need, az as NeedItem, aA as NeedWithMatches, aB as PathStep, aC as PatientProfileClient, aD as PdfOptions, aE as ProduceAck, aF as Prompt, aG as QueryOptions, aH as ReconnectionOptions, aI as RegisterOptions, aJ as RelatedPage, aK as RenderBufferResult, aL as RenderClient, aM as RenderOptions, aN as RenderResult, aO as SearchMatch, aP as SearchOptions, aQ as SearchResult, aR as SenderFilter, aS as SenderFilterOptions, aT as SentryConfig, aU as SentryLoggerProxy, aV as SimilarDisease, aW as StreamOptions, aX as Streamer, aY as StreamerOptions, aZ as Tools, a_ as UserSummary, a$ as ValidateCodeResult, b0 as createAttachmentInfo, b1 as getSentryLogger, b2 as isBraintrustEnabled, b3 as isSentryEnabled, b4 as reportPath } from './app-mRFPU6oe.js';
3
3
  export { V as VfsBatchOperation, a as VfsBranch, b as VfsClient, c as VfsCommit, d as VfsCreateBranchOptions, e as VfsCreateFilesystemOptions, f as VfsDeleteFileOptions, g as VfsDiffEntry, h as VfsDiffResult, i as VfsFilesystem, j as VfsMergeConflict, k as VfsMergeResult, l as VfsReadFileResult, m as VfsTreeEntry, n as VfsWriteFileOptions, o as VfsWriteFileResponse } from './vfs-client-CsHAFj1R.js';
4
4
  import 'zod';
5
5
 
package/dist/index.js CHANGED
@@ -3271,6 +3271,14 @@ var GatewayClient = class {
3271
3271
  const protocol = this.secure ? "https" : "http";
3272
3272
  return `${protocol}://${this.gatewayUrl}/s/vfs`;
3273
3273
  }
3274
+ /**
3275
+ * HTTP URL for Patient Profile service via proxy (includes /api/v1 suffix).
3276
+ * Routes are under /api/v1 per the NestJS service prefix.
3277
+ */
3278
+ get patientProfileUrl() {
3279
+ const protocol = this.secure ? "https" : "http";
3280
+ return `${protocol}://${this.gatewayUrl}/s/patient-profile/api/v1`;
3281
+ }
3274
3282
  /**
3275
3283
  * Register a handler for a topic.
3276
3284
  */
@@ -4740,6 +4748,128 @@ var VfsClient = class {
4740
4748
  }
4741
4749
  };
4742
4750
 
4751
+ // src/patient-profile-client.ts
4752
+ var PatientProfileClient = class {
4753
+ baseUrl;
4754
+ constructor(baseUrl) {
4755
+ this.baseUrl = baseUrl.replace(/\/$/, "");
4756
+ }
4757
+ // ─── Read: SQL ───────────────────────────────────────────────────────
4758
+ /**
4759
+ * Execute a validated SELECT against the `agent_q.*` views for a patient.
4760
+ * The service enforces: one statement, SELECT-only, agent_q schema, LIMIT clamp.
4761
+ */
4762
+ async agentSql(patientId, sql, timeoutSec) {
4763
+ const body = { sql };
4764
+ if (timeoutSec !== void 0) body.timeoutSec = timeoutSec;
4765
+ return this.json(
4766
+ "POST",
4767
+ `/patients/${encodeURIComponent(patientId)}/agent-sql`,
4768
+ body
4769
+ );
4770
+ }
4771
+ // ─── Read: Chunks & Binaries ─────────────────────────────────────────
4772
+ /**
4773
+ * Get a document chunk by ID for a patient (includes text, page, offsets, signed URL).
4774
+ */
4775
+ async getChunk(patientId, chunkId) {
4776
+ return this.json(
4777
+ "GET",
4778
+ `/patients/${encodeURIComponent(patientId)}/chunks/${encodeURIComponent(chunkId)}`
4779
+ );
4780
+ }
4781
+ /**
4782
+ * Get a binary/attachment for a patient (returns a signed or Medplum URL).
4783
+ */
4784
+ async getBinary(patientId, binaryId) {
4785
+ return this.json(
4786
+ "GET",
4787
+ `/patients/${encodeURIComponent(patientId)}/binaries/${encodeURIComponent(binaryId)}`
4788
+ );
4789
+ }
4790
+ // ─── Write: Draft ────────────────────────────────────────────────────
4791
+ /**
4792
+ * Propose a FHIR resource update for a patient (chat-write / proposeFhirUpdate).
4793
+ * Returns a staged diff entry in `awaiting_approval` status.
4794
+ * The diff must be explicitly approved via `approveDraft`.
4795
+ */
4796
+ async draft(patientId, resource, sourceText) {
4797
+ return this.json(
4798
+ "POST",
4799
+ `/patients/${encodeURIComponent(patientId)}/draft`,
4800
+ { resource, sourceText }
4801
+ );
4802
+ }
4803
+ /**
4804
+ * Approve or reject a previously proposed draft diff.
4805
+ * `rejectedEntryIds` is optional and allows partial rejection within a diff.
4806
+ */
4807
+ async approveDraft(patientId, diffId, decision, rejectedEntryIds) {
4808
+ const body = { decision };
4809
+ if (rejectedEntryIds !== void 0) body.rejectedEntryIds = rejectedEntryIds;
4810
+ return this.json(
4811
+ "POST",
4812
+ `/patients/${encodeURIComponent(patientId)}/draft/${encodeURIComponent(diffId)}/approve`,
4813
+ body
4814
+ );
4815
+ }
4816
+ // ─── Codes ───────────────────────────────────────────────────────────
4817
+ /**
4818
+ * Validate a FHIR code against a code system.
4819
+ */
4820
+ async validateCode(patientId, system, code, display) {
4821
+ const body = { system, code };
4822
+ if (display !== void 0) body.display = display;
4823
+ return this.json(
4824
+ "POST",
4825
+ `/patients/${encodeURIComponent(patientId)}/codes/validate`,
4826
+ body
4827
+ );
4828
+ }
4829
+ /**
4830
+ * Expand a FHIR ValueSet by URL (returns concept list).
4831
+ */
4832
+ async expandValueSet(patientId, url, filter) {
4833
+ const body = { url };
4834
+ if (filter !== void 0) body.filter = filter;
4835
+ return this.json(
4836
+ "POST",
4837
+ `/patients/${encodeURIComponent(patientId)}/codes/expand`,
4838
+ body
4839
+ );
4840
+ }
4841
+ /**
4842
+ * Look up a code in a system (returns display name and properties).
4843
+ */
4844
+ async lookupCode(patientId, system, code) {
4845
+ return this.json(
4846
+ "POST",
4847
+ `/patients/${encodeURIComponent(patientId)}/codes/lookup`,
4848
+ { system, code }
4849
+ );
4850
+ }
4851
+ // ─── Internal helpers ────────────────────────────────────────────────
4852
+ async json(method, path, body) {
4853
+ const init = {
4854
+ method,
4855
+ headers: { "Content-Type": "application/json" }
4856
+ };
4857
+ if (body !== void 0) {
4858
+ init.body = JSON.stringify(body);
4859
+ }
4860
+ const res = await fetch(`${this.baseUrl}${path}`, init);
4861
+ if (!res.ok) {
4862
+ let detail = "";
4863
+ try {
4864
+ detail = ` ${await res.text()}`;
4865
+ } catch {
4866
+ }
4867
+ throw new APIException(`${method} ${path} -> ${res.status}${detail}`, res.status);
4868
+ }
4869
+ return await res.json();
4870
+ }
4871
+ };
4872
+
4743
4873
  // src/loki-handler.ts
4744
4874
  var LOG_LEVEL_PRIORITY = {
4745
4875
  debug: 0,
@@ -4929,6 +5059,7 @@ var BasionAgentApp = class {
4929
5059
  renderClient;
4930
5060
  matchingClient;
4931
5061
  vfsClient;
5062
+ patientProfileClient;
4932
5063
  // agent.call() infrastructure
4933
5064
  _pendingCalls = /* @__PURE__ */ new Map();
4934
5065
  _callContent = /* @__PURE__ */ new Map();
@@ -4991,6 +5122,9 @@ var BasionAgentApp = class {
4991
5122
  this.vfsClient = new VfsClient(
4992
5123
  this.gatewayClient.vfsUrl
4993
5124
  );
5125
+ this.patientProfileClient = new PatientProfileClient(
5126
+ this.gatewayClient.patientProfileUrl
5127
+ );
4994
5128
  }
4995
5129
  /**
4996
5130
  * Register a listener for connection state changes at the app level.
@@ -6755,6 +6889,6 @@ function reportPath(importMetaUrl, filename) {
6755
6889
  // src/index.ts
6756
6890
  var VERSION = "0.5.1";
6757
6891
 
6758
- export { AI_INVENTORY_PATHS, APIException, Accordion, Agent, AgentInventoryTool, AgentStateClient, Artifact, AttachmentClient, BasionAgentApp, BasionAgentError, CONVERSATION_STORE_PATHS, Card, CheckpointClient, ConfigurationError, Confirmation, Conversation, ConversationClient, ConversationMessage, DEFAULT_RECONNECTION_OPTIONS, Form, GatewayClient, GatewayError, HeartbeatError, HeartbeatManager, KafkaError, KnowledgeGraphTool, LokiLogHandler, MATCHING_ENGINE_PATHS, MEMORY_PATHS, MatchCard, MatchingClient, MatchingTool, Memory, MemoryClient, MemoryV2, MemoryV2Client, Message, MultiStepForm, ReconnectionError, RegistrationError, RenderClient, SERVICES, SenderFilter, Stepper, Streamer, StructuralStreamer, Surface, TextBlock, Tools, VERSION, VfsClient, accordion, card, checkbox, checkboxGroup, confirmation, createAttachmentInfo, datePicker, file, getSentryLogger, hidden, isBraintrustEnabled, isSentryEnabled, multiSelect, number, option, reportPath, select, sendDlqEnvelope, slider, step, switchField, text };
6892
+ export { AI_INVENTORY_PATHS, APIException, Accordion, Agent, AgentInventoryTool, AgentStateClient, Artifact, AttachmentClient, BasionAgentApp, BasionAgentError, CONVERSATION_STORE_PATHS, Card, CheckpointClient, ConfigurationError, Confirmation, Conversation, ConversationClient, ConversationMessage, DEFAULT_RECONNECTION_OPTIONS, Form, GatewayClient, GatewayError, HeartbeatError, HeartbeatManager, KafkaError, KnowledgeGraphTool, LokiLogHandler, MATCHING_ENGINE_PATHS, MEMORY_PATHS, MatchCard, MatchingClient, MatchingTool, Memory, MemoryClient, MemoryV2, MemoryV2Client, Message, MultiStepForm, PatientProfileClient, ReconnectionError, RegistrationError, RenderClient, SERVICES, SenderFilter, Stepper, Streamer, StructuralStreamer, Surface, TextBlock, Tools, VERSION, VfsClient, accordion, card, checkbox, checkboxGroup, confirmation, createAttachmentInfo, datePicker, file, getSentryLogger, hidden, isBraintrustEnabled, isSentryEnabled, multiSelect, number, option, reportPath, select, sendDlqEnvelope, slider, step, switchField, text };
6759
6893
  //# sourceMappingURL=index.js.map
6760
6894
  //# sourceMappingURL=index.js.map