basion-ai-sdk 0.19.0 → 0.20.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.
@@ -377,6 +377,46 @@ interface CreateConversationPayload {
377
377
  isNew?: boolean;
378
378
  metadata?: Record<string, unknown>;
379
379
  }
380
+ /**
381
+ * Payload for creating an issue on a conversation.
382
+ *
383
+ * Attribution is caller-supplied and unopinionated:
384
+ * - agent/judge callers pass `creatorType: 'agent'` + `createdByAgent`
385
+ * - human callers pass `createdBy` (an auth.users id)
386
+ * When omitted, conversation-store resolves attribution from request context
387
+ * (no X-User-ID header ⇒ agent path).
388
+ */
389
+ interface CreateIssuePayload {
390
+ /** Category KEY: 'factual_error' | 'tool_error' | 'communication' | 'safety' | 'other' */
391
+ category: string;
392
+ description: string;
393
+ severity?: 'low' | 'medium' | 'high' | 'critical';
394
+ messageId?: string;
395
+ creatorType?: 'evaluator' | 'admin' | 'agent';
396
+ createdByAgent?: string;
397
+ createdBy?: string;
398
+ }
399
+ /**
400
+ * Issue record returned by conversation-store (camelCase view of the API's
401
+ * snake_case IssueResponse).
402
+ */
403
+ interface IssueData {
404
+ id: string;
405
+ conversationId: string;
406
+ messageId: string | null;
407
+ categoryId: string;
408
+ severity: string;
409
+ status: string;
410
+ description: string;
411
+ resolutionNote: string | null;
412
+ createdBy: string | null;
413
+ createdByAgent: string | null;
414
+ creatorType: string;
415
+ resolvedBy: string | null;
416
+ resolvedAt: string | null;
417
+ createdAt: string;
418
+ updatedAt: string;
419
+ }
380
420
  /**
381
421
  * HTTP client for interacting with conversation-store API.
382
422
  */
@@ -399,6 +439,13 @@ declare class ConversationClient {
399
439
  * Update conversation fields (PATCH).
400
440
  */
401
441
  updateConversation(conversationId: string, data: Partial<ConversationData>): Promise<ConversationData>;
442
+ /**
443
+ * Create an issue on a conversation (or a specific message).
444
+ *
445
+ * Sends no X-User-ID header, so conversation-store treats the caller as a
446
+ * trusted service/agent and honors body-supplied attribution.
447
+ */
448
+ createIssue(conversationId: string, payload: CreateIssuePayload): Promise<IssueData>;
402
449
  }
403
450
 
404
451
  /**
@@ -2947,4 +2994,4 @@ declare class BasionAgentApp {
2947
2994
  private doShutdown;
2948
2995
  }
2949
2996
 
2950
- export { ConversationMessage as $, type AttachmentInfo as A, BasionAgentApp as B, type CheckboxConfig as C, type DatePickerConfig as D, AttachmentClient as E, type Field as F, GatewayClient as G, type HiddenConfig as H, type InferFields as I, type JudgeHandler as J, type BinaryResult as K, type BraintrustConfig as L, type MultiSelectConfig as M, type NumberConfig as N, type OptionDef as O, type BundleRenderOptions as P, type Capability as Q, type CapabilityItem as R, StructuralStreamer as S, type TextConfig as T, type ChunkResult as U, type ValidationResult as V, type ConnectionState as W, type ConnectionStateListener as X, Conversation as Y, ConversationClient as Z, type ConversationData as _, type CheckboxGroupConfig as a, type SentryLoggerProxy as a$, DEFAULT_RECONNECTION_OPTIONS as a0, type DraftDecision as a1, type DraftResult as a2, type Edge as a3, type Entity as a4, type ExpandValueSetResult as a5, type GenuiComponent as a6, type GenuiComponentDict as a7, type GetMessagesOptions as a8, type GroupedMatch as a9, MemoryV2 as aA, MemoryV2Client as aB, type MemoryV2IngestPayload as aC, type MemoryV2SearchPayload as aD, type Need as aE, type NeedItem as aF, type NeedWithMatches as aG, type PathStep as aH, PatientProfileClient as aI, type PdfOptions as aJ, type ProduceAck as aK, type Prompt as aL, type QueryOptions as aM, type ReconnectionOptions as aN, type RegisterJudgeOptions as aO, type RegisterOptions as aP, type RelatedPage as aQ, type RenderBufferResult as aR, RenderClient as aS, type RenderOptions as aT, type RenderResult as aU, type SearchMatch as aV, type SearchOptions as aW, type SearchResult as aX, SenderFilter as aY, type SenderFilterOptions as aZ, type SentryConfig as a_, type GroupedMatchEntry as aa, type HeartbeatFailureCallback as ab, HeartbeatManager as ac, type HeartbeatOptions as ad, type IngestResponse as ae, type JudgeContext as af, type JudgeMetricDef as ag, type JudgeRequestPayload as ah, type JudgeVerdict as ai, type JudgeVerdictMetric as aj, type KafkaHeaders as ak, type KafkaMessage as al, KnowledgeGraphTool as am, type LogEntry as an, type LogLevel as ao, type LokiHandlerOptions as ap, LokiLogHandler as aq, type LookupCodeResult as ar, MatchingClient as as, MatchingTool as at, Memory as au, MemoryClient as av, type MemoryIngestOptions as aw, type MemoryMessage as ax, type MemorySearchOptions as ay, type MemorySearchResult as az, type FileFieldConfig as b, type SimilarDisease as b0, type StreamOptions as b1, Streamer as b2, type StreamerOptions as b3, Tools as b4, type UserSummary as b5, type ValidateCodeResult as b6, createAttachmentInfo as b7, getSentryLogger as b8, isBraintrustEnabled as b9, isSentryEnabled as ba, reportPath as bb, 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 MessageHandler as t, type AgentInfo as u, AgentInventoryTool as v, type AgentRegistrationData as w, type AgentSqlResult as x, type AppOptions as y, type ApproveDraftResult as z };
2997
+ export { ConversationMessage as $, type AttachmentInfo as A, BasionAgentApp as B, type CheckboxConfig as C, type DatePickerConfig as D, AttachmentClient as E, type Field as F, GatewayClient as G, type HiddenConfig as H, type InferFields as I, type JudgeHandler as J, type BinaryResult as K, type BraintrustConfig as L, type MultiSelectConfig as M, type NumberConfig as N, type OptionDef as O, type BundleRenderOptions as P, type Capability as Q, type CapabilityItem as R, StructuralStreamer as S, type TextConfig as T, type ChunkResult as U, type ValidationResult as V, type ConnectionState as W, type ConnectionStateListener as X, Conversation as Y, ConversationClient as Z, type ConversationData as _, type CheckboxGroupConfig as a, type SenderFilterOptions as a$, type CreateIssuePayload as a0, DEFAULT_RECONNECTION_OPTIONS as a1, type DraftDecision as a2, type DraftResult as a3, type Edge as a4, type Entity as a5, type ExpandValueSetResult as a6, type GenuiComponent as a7, type GenuiComponentDict as a8, type GetMessagesOptions as a9, type MemorySearchOptions as aA, type MemorySearchResult as aB, MemoryV2 as aC, MemoryV2Client as aD, type MemoryV2IngestPayload as aE, type MemoryV2SearchPayload as aF, type Need as aG, type NeedItem as aH, type NeedWithMatches as aI, type PathStep as aJ, PatientProfileClient as aK, type PdfOptions as aL, type ProduceAck as aM, type Prompt as aN, type QueryOptions as aO, type ReconnectionOptions as aP, type RegisterJudgeOptions as aQ, type RegisterOptions as aR, type RelatedPage as aS, type RenderBufferResult as aT, RenderClient as aU, type RenderOptions as aV, type RenderResult as aW, type SearchMatch as aX, type SearchOptions as aY, type SearchResult as aZ, SenderFilter as a_, type GroupedMatch as aa, type GroupedMatchEntry as ab, type HeartbeatFailureCallback as ac, HeartbeatManager as ad, type HeartbeatOptions as ae, type IngestResponse as af, type IssueData as ag, type JudgeContext as ah, type JudgeMetricDef as ai, type JudgeRequestPayload as aj, type JudgeVerdict as ak, type JudgeVerdictMetric as al, type KafkaHeaders as am, type KafkaMessage as an, KnowledgeGraphTool as ao, type LogEntry as ap, type LogLevel as aq, type LokiHandlerOptions as ar, LokiLogHandler as as, type LookupCodeResult as at, MatchingClient as au, MatchingTool as av, Memory as aw, MemoryClient as ax, type MemoryIngestOptions as ay, type MemoryMessage as az, type FileFieldConfig as b, type SentryConfig as b0, type SentryLoggerProxy as b1, type SimilarDisease as b2, type StreamOptions as b3, Streamer as b4, type StreamerOptions as b5, Tools as b6, type UserSummary as b7, type ValidateCodeResult as b8, createAttachmentInfo as b9, getSentryLogger as ba, isBraintrustEnabled as bb, isSentryEnabled as bc, reportPath as bd, 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 MessageHandler as t, type AgentInfo as u, AgentInventoryTool as v, type AgentRegistrationData as w, type AgentSqlResult as x, type AppOptions as y, type ApproveDraftResult as z };
@@ -1,4 +1,4 @@
1
- import { B as BasionAgentApp } from '../app-ChZ3-kr7.js';
1
+ import { B as BasionAgentApp } from '../app-CfmWOkE7.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-ChZ3-kr7.js';
1
+ import { B as BasionAgentApp } from '../app-CfmWOkE7.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, B as BasionAgentApp, s as Agent, J as JudgeHandler, t as MessageHandler } from './app-ChZ3-kr7.js';
2
- export { u as AgentInfo, v as AgentInventoryTool, w as AgentRegistrationData, x as AgentSqlResult, y as AppOptions, z as ApproveDraftResult, E as AttachmentClient, K as BinaryResult, L as BraintrustConfig, P as BundleRenderOptions, Q as Capability, R as CapabilityItem, U as ChunkResult, W as ConnectionState, X as ConnectionStateListener, Y as Conversation, Z as ConversationClient, _ as ConversationData, $ as ConversationMessage, a0 as DEFAULT_RECONNECTION_OPTIONS, a1 as DraftDecision, a2 as DraftResult, a3 as Edge, a4 as Entity, a5 as ExpandValueSetResult, a6 as GenuiComponent, a7 as GenuiComponentDict, a8 as GetMessagesOptions, a9 as GroupedMatch, aa as GroupedMatchEntry, ab as HeartbeatFailureCallback, ac as HeartbeatManager, ad as HeartbeatOptions, ae as IngestResponse, af as JudgeContext, ag as JudgeMetricDef, ah as JudgeRequestPayload, ai as JudgeVerdict, aj as JudgeVerdictMetric, ak as KafkaHeaders, al as KafkaMessage, am as KnowledgeGraphTool, an as LogEntry, ao as LogLevel, ap as LokiHandlerOptions, aq as LokiLogHandler, ar as LookupCodeResult, as as MatchingClient, at as MatchingTool, au as Memory, av as MemoryClient, aw as MemoryIngestOptions, ax as MemoryMessage, ay as MemorySearchOptions, az as MemorySearchResult, aA as MemoryV2, aB as MemoryV2Client, aC as MemoryV2IngestPayload, aD as MemoryV2SearchPayload, aE as Need, aF as NeedItem, aG as NeedWithMatches, aH as PathStep, aI as PatientProfileClient, aJ as PdfOptions, aK as ProduceAck, aL as Prompt, aM as QueryOptions, aN as ReconnectionOptions, aO as RegisterJudgeOptions, aP as RegisterOptions, aQ as RelatedPage, aR as RenderBufferResult, aS as RenderClient, aT as RenderOptions, aU as RenderResult, aV as SearchMatch, aW as SearchOptions, aX as SearchResult, aY as SenderFilter, aZ as SenderFilterOptions, a_ as SentryConfig, a$ as SentryLoggerProxy, b0 as SimilarDisease, b1 as StreamOptions, b2 as Streamer, b3 as StreamerOptions, b4 as Tools, b5 as UserSummary, b6 as ValidateCodeResult, b7 as createAttachmentInfo, b8 as getSentryLogger, b9 as isBraintrustEnabled, ba as isSentryEnabled, bb as reportPath } from './app-ChZ3-kr7.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, B as BasionAgentApp, s as Agent, J as JudgeHandler, t as MessageHandler } from './app-CfmWOkE7.js';
2
+ export { u as AgentInfo, v as AgentInventoryTool, w as AgentRegistrationData, x as AgentSqlResult, y as AppOptions, z as ApproveDraftResult, E as AttachmentClient, K as BinaryResult, L as BraintrustConfig, P as BundleRenderOptions, Q as Capability, R as CapabilityItem, U as ChunkResult, W as ConnectionState, X as ConnectionStateListener, Y as Conversation, Z as ConversationClient, _ as ConversationData, $ as ConversationMessage, a0 as CreateIssuePayload, a1 as DEFAULT_RECONNECTION_OPTIONS, a2 as DraftDecision, a3 as DraftResult, a4 as Edge, a5 as Entity, a6 as ExpandValueSetResult, a7 as GenuiComponent, a8 as GenuiComponentDict, a9 as GetMessagesOptions, aa as GroupedMatch, ab as GroupedMatchEntry, ac as HeartbeatFailureCallback, ad as HeartbeatManager, ae as HeartbeatOptions, af as IngestResponse, ag as IssueData, ah as JudgeContext, ai as JudgeMetricDef, aj as JudgeRequestPayload, ak as JudgeVerdict, al as JudgeVerdictMetric, am as KafkaHeaders, an as KafkaMessage, ao as KnowledgeGraphTool, ap as LogEntry, aq as LogLevel, ar as LokiHandlerOptions, as as LokiLogHandler, at as LookupCodeResult, au as MatchingClient, av as MatchingTool, aw as Memory, ax as MemoryClient, ay as MemoryIngestOptions, az as MemoryMessage, aA as MemorySearchOptions, aB as MemorySearchResult, aC as MemoryV2, aD as MemoryV2Client, aE as MemoryV2IngestPayload, aF as MemoryV2SearchPayload, aG as Need, aH as NeedItem, aI as NeedWithMatches, aJ as PathStep, aK as PatientProfileClient, aL as PdfOptions, aM as ProduceAck, aN as Prompt, aO as QueryOptions, aP as ReconnectionOptions, aQ as RegisterJudgeOptions, aR as RegisterOptions, aS as RelatedPage, aT as RenderBufferResult, aU as RenderClient, aV as RenderOptions, aW as RenderResult, aX as SearchMatch, aY as SearchOptions, aZ as SearchResult, a_ as SenderFilter, a$ as SenderFilterOptions, b0 as SentryConfig, b1 as SentryLoggerProxy, b2 as SimilarDisease, b3 as StreamOptions, b4 as Streamer, b5 as StreamerOptions, b6 as Tools, b7 as UserSummary, b8 as ValidateCodeResult, b9 as createAttachmentInfo, ba as getSentryLogger, bb as isBraintrustEnabled, bc as isSentryEnabled, bd as reportPath } from './app-CfmWOkE7.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
 
@@ -783,6 +783,8 @@ declare const CONVERSATION_STORE_PATHS: {
783
783
  readonly CHECKPOINT_THREAD: (threadId: string) => string;
784
784
  /** Agent state by conversation ID */
785
785
  readonly AGENT_STATE: (conversationId: string) => string;
786
+ /** Issues on a conversation */
787
+ readonly ISSUES: (conversationId: string) => string;
786
788
  };
787
789
  /**
788
790
  * API paths for AI Memory service.
package/dist/index.js CHANGED
@@ -400,7 +400,9 @@ var CONVERSATION_STORE_PATHS = {
400
400
  /** Checkpoint by thread ID */
401
401
  CHECKPOINT_THREAD: (threadId) => `/checkpoints/${threadId}`,
402
402
  /** Agent state by conversation ID */
403
- AGENT_STATE: (conversationId) => `/agent-state/${conversationId}`
403
+ AGENT_STATE: (conversationId) => `/agent-state/${conversationId}`,
404
+ /** Issues on a conversation */
405
+ ISSUES: (conversationId) => `/conversations/${conversationId}/issues`
404
406
  };
405
407
  var MEMORY_PATHS = {
406
408
  /** User memory base */
@@ -3897,6 +3899,58 @@ var ConversationClient = class {
3897
3899
  throw new APIException(`Failed to update conversation: ${error}`);
3898
3900
  }
3899
3901
  }
3902
+ /**
3903
+ * Create an issue on a conversation (or a specific message).
3904
+ *
3905
+ * Sends no X-User-ID header, so conversation-store treats the caller as a
3906
+ * trusted service/agent and honors body-supplied attribution.
3907
+ */
3908
+ async createIssue(conversationId, payload) {
3909
+ const url = `${this.baseUrl}/conversations/${conversationId}/issues`;
3910
+ const body = {
3911
+ category: payload.category,
3912
+ description: payload.description
3913
+ };
3914
+ if (payload.severity != null) body.severity = payload.severity;
3915
+ if (payload.messageId != null) body.message_id = payload.messageId;
3916
+ if (payload.creatorType != null) body.creator_type = payload.creatorType;
3917
+ if (payload.createdByAgent != null) body.created_by_agent = payload.createdByAgent;
3918
+ if (payload.createdBy != null) body.created_by = payload.createdBy;
3919
+ try {
3920
+ const response = await fetch(url, {
3921
+ method: "POST",
3922
+ headers: { "Content-Type": "application/json" },
3923
+ body: JSON.stringify(body)
3924
+ });
3925
+ if (response.status === 404) {
3926
+ throw new APIException(`Conversation ${conversationId} not found`, 404);
3927
+ }
3928
+ if (!response.ok) {
3929
+ throw new APIException(`Failed to create issue: ${response.status}`, response.status);
3930
+ }
3931
+ const raw = await response.json();
3932
+ return {
3933
+ id: raw.id,
3934
+ conversationId: raw.conversation_id,
3935
+ messageId: raw.message_id ?? null,
3936
+ categoryId: raw.category_id,
3937
+ severity: raw.severity,
3938
+ status: raw.status,
3939
+ description: raw.description,
3940
+ resolutionNote: raw.resolution_note ?? null,
3941
+ createdBy: raw.created_by ?? null,
3942
+ createdByAgent: raw.created_by_agent ?? null,
3943
+ creatorType: raw.creator_type,
3944
+ resolvedBy: raw.resolved_by ?? null,
3945
+ resolvedAt: raw.resolved_at ?? null,
3946
+ createdAt: raw.created_at,
3947
+ updatedAt: raw.updated_at
3948
+ };
3949
+ } catch (error) {
3950
+ if (error instanceof APIException) throw error;
3951
+ throw new APIException(`Failed to create issue: ${error}`);
3952
+ }
3953
+ }
3900
3954
  };
3901
3955
 
3902
3956
  // src/memory-client.ts