@openbkn/bkn-sdk 0.1.1 → 0.1.3-rc.1

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
@@ -12,6 +12,10 @@ interface ClientOptions {
12
12
  businessDomain?: string;
13
13
  /** Skip TLS verification (dev / self-signed only). */
14
14
  insecure?: boolean;
15
+ /** Dedicated producer credential, sent only to BKN Trace evidence write endpoints. */
16
+ evidenceIngestToken?: string;
17
+ /** Optional BKN Trace phase-one context for request correlation. */
18
+ trace?: TraceContextOptions;
15
19
  }
16
20
  /** Fully resolved request context — every field is known. */
17
21
  interface RefreshableTokens {
@@ -24,6 +28,10 @@ interface RequestContext {
24
28
  token: string;
25
29
  businessDomain: string;
26
30
  insecure: boolean;
31
+ /** Dedicated producer credential; never sent to read or non-Trace endpoints. */
32
+ evidenceIngestToken?: string;
33
+ /** Stable per-client BKN Trace context propagated on outbound requests. */
34
+ trace?: TraceContext;
27
35
  /**
28
36
  * Stored-credential refresh: on a 401, swap the refresh token for a fresh
29
37
  * access token, persist it, and retry once. Absent for explicit `--token`/env.
@@ -34,6 +42,34 @@ interface RequestContext {
34
42
  persist: (tokens: RefreshableTokens) => void;
35
43
  };
36
44
  }
45
+ interface TraceContextOptions {
46
+ /** OpenBKN request id. Generated as `req_<uuid>` when omitted or invalid. */
47
+ requestId?: string;
48
+ /** W3C Trace Context header. Generated when omitted or invalid. */
49
+ traceparent?: string;
50
+ /** Caller-owned business conversation id. The SDK never generates one. */
51
+ conversationId?: string;
52
+ /** Caller-owned id for one user question and its operations. The SDK never generates one. */
53
+ interactionId?: string;
54
+ /** Replay-stable operation id. Transports generate one per logical operation when omitted. */
55
+ operationId?: string;
56
+ /** Retry ordinal for the operation. Defaults to 1. */
57
+ attempt?: number;
58
+ /** Producer observation time in RFC3339 format. Generated per logical operation when omitted. */
59
+ observedAt?: string;
60
+ /** Baggage values are allowlisted before propagation. */
61
+ baggage?: Record<string, string>;
62
+ }
63
+ interface TraceContext {
64
+ requestId: string;
65
+ traceparent: string;
66
+ conversationId?: string;
67
+ interactionId?: string;
68
+ operationId?: string;
69
+ attempt?: number;
70
+ observedAt?: string;
71
+ baggage?: Record<string, string>;
72
+ }
37
73
  declare const DEFAULT_BUSINESS_DOMAIN = "bd_public";
38
74
  /** Default list/query limits — see AGENTS.md conventions. */
39
75
  declare const DEFAULT_LIST_LIMIT = 30;
@@ -372,13 +408,258 @@ declare function appKeys(ctx: RequestContext): {
372
408
  adminRevoke: (id: string) => Promise<void>;
373
409
  };
374
410
 
375
- /**
376
- * Context-loader client over the agent-retrieval MCP endpoint (JSON-RPC).
377
- * Slim implementation: initialize → session id →
378
- * notifications/initialized, then tools/call. Handles plain-JSON and
379
- * SSE (`data:`) response bodies. Per-process session cache (5 min TTL).
380
- */
411
+ type LifecycleErrorCode = "conversation_required" | "conversation_not_found" | "conversation_closed" | "conversation_expired" | "conversation_owner_mismatch" | "interaction_required" | "interaction_in_progress" | "interaction_terminal" | "operation_required" | "idempotency_conflict" | "event_payload_conflict" | "receipt_pending" | "terminal_conflict" | "closure_manifest_invalid" | "feature_not_installed" | "capability_not_licensed" | "permission_denied" | "resource_not_disclosed";
412
+ interface LifecycleError {
413
+ code: LifecycleErrorCode;
414
+ message: string;
415
+ retryable: boolean;
416
+ retry_after_ms: number;
417
+ current_status?: string;
418
+ required_action?: string;
419
+ request_id?: string;
420
+ }
421
+ interface LifecycleErrorEnvelope {
422
+ error: LifecycleError;
423
+ }
424
+ interface LifecycleOwner {
425
+ tenant_id: string;
426
+ business_domain_id: string;
427
+ application_principal_id: string;
428
+ effective_subject_type: "user" | "service";
429
+ effective_subject_id: string;
430
+ delegation_id?: string;
431
+ }
432
+ interface ManagedConversation {
433
+ conversation_id: string;
434
+ agent_name?: string;
435
+ owner: LifecycleOwner;
436
+ external_conversation_key: string;
437
+ generation: number;
438
+ status: "active" | "closed" | "expired";
439
+ one_shot: boolean;
440
+ row_version: number;
441
+ created_at: string;
442
+ updated_at: string;
443
+ closed_at?: string;
444
+ }
445
+ interface ConversationPage {
446
+ entries: ManagedConversation[];
447
+ }
448
+ interface ListConversationsQuery {
449
+ limit?: number;
450
+ }
451
+ interface ExpectedOperation {
452
+ operation_id: string;
453
+ required: boolean;
454
+ }
455
+ interface ExpectedReceipt {
456
+ receipt_id: string;
457
+ required: boolean;
458
+ }
459
+ interface EvidenceReference {
460
+ evidence_ref: string;
461
+ ref_type: "event" | "artifact" | "artifact_fragment" | "operation_output" | "claim";
462
+ source_interaction_id: string;
463
+ source_revision_id: string;
464
+ source_operation_id?: string;
465
+ artifact_ref?: string;
466
+ fragment_selector?: string;
467
+ version: string;
468
+ content_hash: string;
469
+ as_of?: string;
470
+ }
471
+ interface ClaimSupport {
472
+ target_ref: string;
473
+ target_type: "evidence" | "claim" | "artifact_fragment" | "operation_output";
474
+ source_interaction_id: string;
475
+ source_revision_id: string;
476
+ source_operation_id?: string;
477
+ version: string;
478
+ content_hash: string;
479
+ fragment_selector?: string;
480
+ role: string;
481
+ status: "adopted" | "rejected";
482
+ reason?: string;
483
+ }
484
+ interface ManagedClaim {
485
+ claim_id: string;
486
+ claim_type: string;
487
+ materiality: "material" | "supporting";
488
+ claim_status: "asserted" | "withdrawn";
489
+ content_artifact_ref: string;
490
+ required_support_roles: string[];
491
+ supports: ClaimSupport[];
492
+ }
493
+ interface InteractionCompletionInput {
494
+ terminal_idempotency_key: string;
495
+ lease_token: string;
496
+ lease_epoch: number;
497
+ completion_manifest_version: string;
498
+ completion_reason: string;
499
+ answer_artifact_ref?: string;
500
+ claims?: ManagedClaim[];
501
+ expected_operations?: ExpectedOperation[];
502
+ expected_receipts?: ExpectedReceipt[];
503
+ assembler_deadline?: string;
504
+ }
505
+ interface InteractionClosureManifest {
506
+ completion_manifest_version: string;
507
+ completion_reason: string;
508
+ answer_artifact_ref?: string;
509
+ claims?: ManagedClaim[];
510
+ expected_operations?: ExpectedOperation[];
511
+ expected_receipts?: ExpectedReceipt[];
512
+ assembler_deadline?: string;
513
+ system_partial_reasons?: string[];
514
+ }
515
+ interface ManagedInteraction {
516
+ interaction_id: string;
517
+ conversation_id: string;
518
+ ordinal: number;
519
+ execution_status: "active" | "completed" | "failed" | "canceled" | "handed_off" | "abandoned";
520
+ evidence_status: "not_applicable" | "assembling" | "complete" | "partial" | "failed";
521
+ closure_manifest?: InteractionClosureManifest;
522
+ lease_token: string;
523
+ lease_epoch: number;
524
+ lease_version: number;
525
+ lease_expires_at: string;
526
+ row_version: number;
527
+ created_at: string;
528
+ updated_at: string;
529
+ terminal_at?: string;
530
+ }
531
+ interface ManagedOperation {
532
+ operation_id: string;
533
+ conversation_id: string;
534
+ interaction_id: string;
535
+ operation_key: string;
536
+ tool_name: string;
537
+ normalized_input_hash: string;
538
+ parent_operation_id?: string;
539
+ causation_event_ids?: string[];
540
+ attempt: number;
541
+ attempt_status: "pending" | "completed" | "failed";
542
+ retryable: boolean;
543
+ row_version: number;
544
+ created_at: string;
545
+ updated_at: string;
546
+ }
547
+ interface LifecycleBusinessRef {
548
+ ref_type: string;
549
+ ref_id: string;
550
+ business_domain_id: string;
551
+ version: string;
552
+ as_of?: string;
553
+ display_hint?: string;
554
+ }
555
+ type EvidenceDurability = "pending" | "durable" | "failed";
556
+ interface OperationReceipt {
557
+ receipt_id: string;
558
+ schema_version: string;
559
+ owner: LifecycleOwner;
560
+ conversation_id: string;
561
+ interaction_id: string;
562
+ operation_id: string;
563
+ attempt: number;
564
+ operation_key: string;
565
+ tool_name: string;
566
+ normalized_input_hash: string;
567
+ receipt_status: "pending" | "completed" | "failed";
568
+ evidence_durability: EvidenceDurability;
569
+ required: boolean;
570
+ request_id: string;
571
+ trace_id: string;
572
+ causation_event_ids: string[];
573
+ observed_evidence_refs: EvidenceReference[];
574
+ business_refs: LifecycleBusinessRef[];
575
+ artifact_refs: string[];
576
+ partial_reasons: string[];
577
+ row_version: number;
578
+ issued_at: string;
579
+ terminal_at?: string;
580
+ payload_hash: string;
581
+ }
582
+ interface OperationResult {
583
+ operation: ManagedOperation;
584
+ receipt: OperationReceipt;
585
+ created: boolean;
586
+ }
587
+ interface EnsureConversationInput {
588
+ external_conversation_key: string;
589
+ idempotency_key?: string;
590
+ one_shot?: boolean;
591
+ }
592
+ interface CreateNewConversationGenerationInput extends EnsureConversationInput {
593
+ idempotency_key: string;
594
+ }
595
+ interface ResumeConversationInput {
596
+ conversation_id: string;
597
+ }
598
+ interface CloseConversationInput {
599
+ idempotency_key?: string;
600
+ }
601
+ interface StartInteractionInput {
602
+ idempotency_key: string;
603
+ agent_name?: string;
604
+ lease_seconds?: number;
605
+ }
606
+ interface EnsureOperationInput {
607
+ operation_key: string;
608
+ tool_name: string;
609
+ normalized_input_hash: string;
610
+ parent_operation_id?: string;
611
+ causation_event_ids?: string[];
612
+ required?: boolean;
613
+ lease_token: string;
614
+ lease_epoch: number;
615
+ }
616
+ interface RetryOperationAttemptInput {
617
+ lease_token: string;
618
+ lease_epoch: number;
619
+ }
620
+ interface FinishOperationAttemptInput {
621
+ receipt_id: string;
622
+ payload_hash: string;
623
+ evidence_durability: EvidenceDurability;
624
+ retryable?: boolean;
625
+ request_id: string;
626
+ trace_id: string;
627
+ observed_evidence_refs?: EvidenceReference[];
628
+ business_refs?: LifecycleBusinessRef[];
629
+ artifact_refs?: string[];
630
+ partial_reasons?: string[];
631
+ }
632
+ interface TraceLifecycleApi {
633
+ listConversations(query?: ListConversationsQuery): Promise<ConversationPage>;
634
+ ensureConversation(input: EnsureConversationInput): Promise<ManagedConversation>;
635
+ createNewConversationGeneration(input: CreateNewConversationGenerationInput): Promise<ManagedConversation>;
636
+ resumeConversation(input: ResumeConversationInput): Promise<ManagedConversation>;
637
+ getConversation(conversationId: string): Promise<ManagedConversation>;
638
+ closeConversation(conversationId: string, input: CloseConversationInput): Promise<ManagedConversation>;
639
+ startInteraction(conversationId: string, input: StartInteractionInput): Promise<ManagedInteraction>;
640
+ getInteraction(interactionId: string): Promise<ManagedInteraction>;
641
+ completeInteraction(interactionId: string, input: InteractionCompletionInput): Promise<ManagedInteraction>;
642
+ failInteraction(interactionId: string, input: InteractionCompletionInput): Promise<ManagedInteraction>;
643
+ cancelInteraction(interactionId: string, input: InteractionCompletionInput): Promise<ManagedInteraction>;
644
+ handoffInteraction(interactionId: string, input: InteractionCompletionInput): Promise<ManagedInteraction>;
645
+ ensureOperation(conversationId: string, interactionId: string, input: EnsureOperationInput): Promise<OperationResult>;
646
+ getOperation(operationId: string): Promise<ManagedOperation>;
647
+ retryOperationAttempt(operationId: string, input: RetryOperationAttemptInput): Promise<OperationResult>;
648
+ completeOperationAttempt(operationId: string, attempt: number, input: FinishOperationAttemptInput): Promise<OperationResult>;
649
+ failOperationAttempt(operationId: string, attempt: number, input: FinishOperationAttemptInput): Promise<OperationResult>;
650
+ getReceipt(receiptId: string): Promise<OperationReceipt>;
651
+ }
652
+ declare function traceLifecycleApi(ctx: RequestContext): TraceLifecycleApi;
381
653
 
654
+ interface ManagedToolResult<T = unknown> {
655
+ value: T;
656
+ receipt: OperationReceipt;
657
+ }
658
+ /** Adapter-owned MCP metadata for lifecycle-safe host retries. */
659
+ interface ToolCallOptions {
660
+ hostConversationKey?: string;
661
+ clientInvocationId?: string;
662
+ }
382
663
  interface SearchSchemaOptions {
383
664
  searchScope?: string[];
384
665
  maxConcepts?: number;
@@ -386,8 +667,6 @@ interface SearchSchemaOptions {
386
667
  /** Progressive KN-detail disclosure level: `summary` (skeleton + property names) | `full`. */
387
668
  type DetailLevel = "summary" | "full";
388
669
 
389
- /** Context-loader resource surface (MCP over agent-retrieval). */
390
-
391
670
  declare function context(ctx: RequestContext): {
392
671
  searchSchema: (knId: string, query: string, opts?: SearchSchemaOptions) => Promise<unknown>;
393
672
  queryObjectInstance: (knId: string, args: Record<string, unknown>) => Promise<unknown>;
@@ -397,7 +676,8 @@ declare function context(ctx: RequestContext): {
397
676
  relationTypes: (knId: string, ids: string[]) => Promise<unknown>;
398
677
  info: () => Promise<unknown>;
399
678
  tools: (knId: string) => Promise<unknown>;
400
- toolCall: (knId: string, name: string, args: Record<string, unknown>) => Promise<unknown>;
679
+ toolCall: (knId: string, name: string, args: Record<string, unknown>, options?: ToolCallOptions) => Promise<unknown>;
680
+ managedToolCall: <T = unknown>(knId: string, name: string, args: Record<string, unknown>, options?: ToolCallOptions) => Promise<ManagedToolResult<T>>;
401
681
  callMethod: (knId: string, method: string, params?: Record<string, unknown>) => Promise<unknown>;
402
682
  queryInstanceSubgraph: (knId: string, args: Record<string, unknown>) => Promise<unknown>;
403
683
  logicProperties: (knId: string, args: Record<string, unknown>) => Promise<unknown>;
@@ -426,6 +706,8 @@ interface TemplateArg {
426
706
 
427
707
  interface ListRunsOptions {
428
708
  since?: string;
709
+ page?: number;
710
+ limit?: number;
429
711
  }
430
712
  interface LogsOptions {
431
713
  page?: number;
@@ -450,6 +732,33 @@ declare function dataflows(ctx: RequestContext): {
450
732
  createBkn: (template: string, args: Record<string, unknown>) => Promise<unknown>;
451
733
  };
452
734
 
735
+ /** The body field the lifecycle middleware reads. Snake_case: it goes on the wire. */
736
+ interface BknContext {
737
+ conversation_id: string;
738
+ interaction_id: string;
739
+ /** v1 only. v2 rejects the field outright, so it must stay absent there. */
740
+ operation_key?: string;
741
+ }
742
+ /**
743
+ * Release the interactions this process opened.
744
+ *
745
+ * Only v2 is released. Its finish takes an id and an outcome, where v1's
746
+ * cancel demands a closure manifest — and the two kinds of v1 session are
747
+ * skipped for different reasons: one we opened ourselves carries `one_shot`
748
+ * and is swept when idle, while one opened inside a caller's conversation has
749
+ * no `one_shot` to rely on and no manifest we can supply (see `openSession`),
750
+ * so it waits out its five-minute lease. The outcome is `cancelled` because a
751
+ * CLI invocation has no answer artifact to close over, and `completed` without
752
+ * one is rejected.
753
+ *
754
+ * Best-effort by construction: this runs while a process is shutting down,
755
+ * where a throw would turn a successful command into a failed one. The whole
756
+ * release is bounded, not just its final call — the handshake being awaited
757
+ * here has no deadline of its own, so a server that accepted the connection
758
+ * and went quiet would hold the process open after its output was printed.
759
+ */
760
+ declare function releaseLifecycleSessions(): Promise<void>;
761
+
453
762
  /**
454
763
  * Knowledge-network backend client (ontology-manager + agent-retrieval).
455
764
  * Responses are passed through as parsed JSON
@@ -491,6 +800,15 @@ interface SemanticSearchOptions {
491
800
  mode?: string;
492
801
  maxConcepts?: number;
493
802
  returnQueryUnderstanding?: boolean;
803
+ /**
804
+ * A `bkn_context` the caller built itself, sent as-is.
805
+ *
806
+ * The same escape hatch `context.toolCall` has: supplying one skips the
807
+ * managed session entirely, so an `operation_key` pre-registered through
808
+ * `ManagedTrace` survives instead of being replaced, and
809
+ * `parent_operation_id` / `causation_event_ids` travel with it.
810
+ */
811
+ bknContext?: BknContext;
494
812
  }
495
813
 
496
814
  interface CreateFromCatalogOptions {
@@ -547,7 +865,6 @@ declare function kn(ctx: RequestContext): {
547
865
  metricValidate: (knId: string, body: unknown) => Promise<unknown>;
548
866
  objectTypes: (knId: string, opts?: ListSchemaOptions) => Promise<unknown>;
549
867
  objectTypeQuery: (knId: string, otId: string, body: unknown) => Promise<unknown>;
550
- objectTypeProperties: (knId: string, otId: string) => Promise<unknown>;
551
868
  objectTypeGet: (knId: string, id: string) => Promise<unknown>;
552
869
  objectTypeCreate: (knId: string, body: unknown) => Promise<unknown>;
553
870
  objectTypeUpdate: (knId: string, id: string, body: unknown) => Promise<unknown>;
@@ -575,10 +892,6 @@ declare function kn(ctx: RequestContext): {
575
892
  actionScheduleUpdate: (knId: string, scheduleId: string, body: unknown) => Promise<unknown>;
576
893
  actionScheduleSetStatus: (knId: string, scheduleId: string, body: unknown) => Promise<unknown>;
577
894
  actionScheduleDelete: (knId: string, ids: string) => Promise<unknown>;
578
- jobs: (knId: string) => Promise<unknown>;
579
- job: (knId: string, jobId: string) => Promise<unknown>;
580
- jobTasks: (knId: string, jobId: string) => Promise<unknown>;
581
- jobDelete: (knId: string, ids: string) => Promise<unknown>;
582
895
  relationTypePaths: (knId: string, body: unknown) => Promise<unknown>;
583
896
  bknResources: () => Promise<unknown>;
584
897
  createFromCatalog: (opts: CreateFromCatalogOptions) => Promise<unknown>;
@@ -722,11 +1035,17 @@ interface FindResourceOptions {
722
1035
  datasourceId?: string;
723
1036
  /** Exact name match instead of fuzzy. */
724
1037
  exact?: boolean;
1038
+ /** Rows to fetch before filtering; `-1` = all. Defaults to the list default. */
1039
+ limit?: number;
725
1040
  }
726
1041
  interface QueryResourceOptions {
727
1042
  limit?: number;
728
1043
  offset?: number;
729
1044
  needTotal?: boolean;
1045
+ pagingMode?: "single" | "cursor";
1046
+ keepAliveSec?: number;
1047
+ /** Opaque cursor returned by the preceding resource data page. */
1048
+ cursor?: string;
730
1049
  }
731
1050
 
732
1051
  /** Resource surface (the exported SDK API) over vega-backend resources. */
@@ -741,6 +1060,33 @@ declare function resources(ctx: RequestContext): {
741
1060
  query: (id: string, opts?: QueryResourceOptions) => Promise<unknown>;
742
1061
  };
743
1062
 
1063
+ /**
1064
+ * Which side of the skill API to read.
1065
+ *
1066
+ * The consumer surface serves the **published** release; the management surface
1067
+ * serves the **draft** (current) version and takes `view`/`modify` permissions
1068
+ * rather than `execute`/`public_access`/`view`. The two disagree whenever a
1069
+ * skill has been edited but not republished, so they are never interchangeable.
1070
+ */
1071
+ type SkillView = "published" | "draft";
1072
+ interface ExecuteSkillOptions {
1073
+ /** Shell command run inside the sandbox, relative to the skill's work dir. */
1074
+ entryShell: string;
1075
+ /** Sandbox wall-clock limit in seconds. */
1076
+ timeout?: number;
1077
+ }
1078
+ interface SkillExecutionResult {
1079
+ skill_id?: string;
1080
+ session_id?: string;
1081
+ work_dir?: string;
1082
+ command?: string;
1083
+ exit_code?: number;
1084
+ stdout?: string;
1085
+ stderr?: string;
1086
+ execution_time?: number;
1087
+ /** True when the sandbox stubbed the run instead of executing it. */
1088
+ mocked?: boolean;
1089
+ }
744
1090
  interface ListSkillsOptions {
745
1091
  page?: number;
746
1092
  pageSize?: number;
@@ -749,16 +1095,69 @@ interface ListSkillsOptions {
749
1095
  status?: string;
750
1096
  createUser?: string;
751
1097
  }
1098
+ /**
1099
+ * `url` hands back a pre-signed object-store link; `content` inlines the file
1100
+ * body. Only the management surface honours `content` today — the consumer
1101
+ * surface ignores it and answers with a URL either way.
1102
+ */
1103
+ type SkillResponseMode = "url" | "content";
1104
+ interface SkillContentResponse {
1105
+ skill_id?: string;
1106
+ version?: string;
1107
+ url?: string;
1108
+ /** Present only when the backend honoured `response_mode=content`. */
1109
+ content?: string;
1110
+ files?: SkillFileEntry[];
1111
+ }
1112
+ interface SkillFileEntry {
1113
+ rel_path: string;
1114
+ file_type?: string;
1115
+ size?: number;
1116
+ mime_type?: string;
1117
+ }
1118
+ interface SkillReadFileResponse {
1119
+ skill_id?: string;
1120
+ rel_path?: string;
1121
+ url?: string;
1122
+ content?: string;
1123
+ mime_type?: string;
1124
+ file_type?: string;
1125
+ }
752
1126
  type SkillStatus = "unpublish" | "published" | "offline";
753
1127
 
1128
+ /** Which version a read targets: the published release, or the editable draft. */
1129
+ interface SkillViewOptions {
1130
+ draft?: boolean;
1131
+ }
754
1132
  declare function skills(ctx: RequestContext): {
755
1133
  list: (opts?: ListSkillsOptions) => Promise<unknown>;
756
1134
  get: (skillId: string) => Promise<unknown>;
757
1135
  market: (opts?: ListSkillsOptions) => Promise<unknown>;
758
1136
  marketGet: (skillId: string) => Promise<unknown>;
759
1137
  delete: (skillId: string) => Promise<unknown>;
760
- content: (skillId: string) => Promise<unknown>;
761
- readFile: (skillId: string, relPath: string) => Promise<unknown>;
1138
+ content: (skillId: string, opts?: SkillViewOptions) => Promise<SkillContentResponse>;
1139
+ readFile: (skillId: string, relPath: string, opts?: SkillViewOptions) => Promise<SkillReadFileResponse>;
1140
+ /** SKILL.md's own text, for callers that want the document rather than a link. */
1141
+ contentRaw: (skillId: string, opts?: SkillViewOptions) => Promise<string>;
1142
+ /** A bundled file's text. */
1143
+ readFileRaw: (skillId: string, relPath: string, opts?: SkillViewOptions) => Promise<string>;
1144
+ /** Run the skill in the platform sandbox. */
1145
+ execute: (skillId: string, opts: ExecuteSkillOptions) => Promise<SkillExecutionResult>;
1146
+ /** Resolve skill ids to names; unknown ids are simply absent from the result. */
1147
+ names: (ids: string[]) => Promise<unknown>;
1148
+ /**
1149
+ * One level of the skill's file tree. Directories are inferred from the
1150
+ * manifest's paths — see utils/skill-tree.
1151
+ */
1152
+ files: (skillId: string, path?: string, opts?: SkillViewOptions) => Promise<{
1153
+ skillId: string;
1154
+ path: string;
1155
+ entries: SkillChild[];
1156
+ totalFiles: number;
1157
+ totalSize: number;
1158
+ }>;
1159
+ /** The manifest itself, for callers that want to render the whole tree. */
1160
+ fileManifest: (skillId: string, opts?: SkillViewOptions) => Promise<SkillFileEntry[]>;
762
1161
  history: (skillId: string) => Promise<unknown>;
763
1162
  setStatus: (skillId: string, status: SkillStatus) => Promise<unknown>;
764
1163
  updateMetadata: (skillId: string, body: unknown) => Promise<unknown>;
@@ -772,13 +1171,13 @@ declare function skills(ctx: RequestContext): {
772
1171
  /** Replace a skill's package from a local directory. */
773
1172
  updatePackage: (skillId: string, dir: string) => Promise<unknown>;
774
1173
  /** Download a skill archive to a local .zip file. */
775
- download: (skillId: string, outPath?: string) => Promise<{
1174
+ download: (skillId: string, outPath?: string, opts?: SkillViewOptions) => Promise<{
776
1175
  skillId: string;
777
1176
  path: string;
778
1177
  bytes: number;
779
1178
  }>;
780
1179
  /** Download a skill archive and extract it into a directory. */
781
- install: (skillId: string, dir?: string) => Promise<{
1180
+ install: (skillId: string, dir?: string, opts?: SkillViewOptions) => Promise<{
782
1181
  skillId: string;
783
1182
  dir: string;
784
1183
  files: number;
@@ -791,6 +1190,11 @@ interface ListToolboxesOptions {
791
1190
  limit?: number;
792
1191
  offset?: number;
793
1192
  }
1193
+ interface ListToolsOptions {
1194
+ page?: number;
1195
+ pageSize?: number;
1196
+ all?: boolean;
1197
+ }
794
1198
  interface CreateToolboxOptions {
795
1199
  name: string;
796
1200
  serviceUrl: string;
@@ -807,7 +1211,7 @@ interface ToolInvokeEnvelope {
807
1211
 
808
1212
  declare function toolboxes(ctx: RequestContext): {
809
1213
  list: (opts?: ListToolboxesOptions) => Promise<unknown>;
810
- tools: (boxId: string) => Promise<unknown>;
1214
+ tools: (boxId: string, opts?: ListToolsOptions) => Promise<unknown>;
811
1215
  create: (opts: CreateToolboxOptions) => Promise<unknown>;
812
1216
  delete: (boxId: string) => Promise<unknown>;
813
1217
  publish: (boxId: string) => Promise<unknown>;
@@ -826,6 +1230,178 @@ declare function toolboxes(ctx: RequestContext): {
826
1230
  debug: (boxId: string, toolId: string, e?: ToolInvokeEnvelope) => Promise<unknown>;
827
1231
  };
828
1232
 
1233
+ interface FixtureValidationError {
1234
+ code: string;
1235
+ path: string;
1236
+ message: string;
1237
+ }
1238
+ interface FixtureValidationResult {
1239
+ fixtureId: string;
1240
+ result: "pass" | "fail";
1241
+ contractVersion: string | null;
1242
+ errors: FixtureValidationError[];
1243
+ warnings: string[];
1244
+ expectedResult: "pass" | "fail" | null;
1245
+ expectationMatched: boolean;
1246
+ }
1247
+ interface FixturePathValidationResult {
1248
+ ok: boolean;
1249
+ results: FixtureValidationResult[];
1250
+ }
1251
+
1252
+ type ConversationStrategy = {
1253
+ mode: "resume_by_id";
1254
+ conversationId: string;
1255
+ } | {
1256
+ mode: "ensure_current";
1257
+ externalConversationKey: string;
1258
+ } | {
1259
+ mode: "one_shot";
1260
+ externalConversationKey?: string;
1261
+ } | {
1262
+ mode: "create_new_generation";
1263
+ externalConversationKey: string;
1264
+ };
1265
+ type ManagedCompletionInput = Omit<InteractionCompletionInput, "terminal_idempotency_key" | "lease_token" | "lease_epoch">;
1266
+ interface BknBusinessContext {
1267
+ bkn_context: {
1268
+ conversation_id: string;
1269
+ interaction_id: string;
1270
+ operation_key: string;
1271
+ parent_operation_id?: string;
1272
+ causation_event_ids?: string[];
1273
+ };
1274
+ }
1275
+ interface SupportCandidate {
1276
+ ref: EvidenceReference;
1277
+ state: "observed";
1278
+ adopted: false;
1279
+ }
1280
+ interface ManagedInteractionScope {
1281
+ conversation: ManagedConversation;
1282
+ interaction: ManagedInteraction;
1283
+ bknContext(operationKey: string, parentOperationId?: string, causationEventIds?: string[]): BknBusinessContext;
1284
+ recordReceipt(receipt: OperationReceipt): void;
1285
+ supportCandidates(): SupportCandidate[];
1286
+ runOperation<T>(input: ManagedOperationInput, execute: (call: ManagedOperationCall) => Promise<ManagedOperationExecution<T>>): Promise<ManagedOperationResult<T>>;
1287
+ cancel(reason: string): Promise<ManagedInteraction>;
1288
+ handoff(reason: string): Promise<ManagedInteraction>;
1289
+ }
1290
+ interface ManagedOperationInput {
1291
+ operationKey?: string;
1292
+ toolName: string;
1293
+ normalizedInputHash: string;
1294
+ parentOperationId?: string;
1295
+ causationEventIds?: string[];
1296
+ required?: boolean;
1297
+ /** Maximum authoritative attempt ordinal, including the current attempt. */
1298
+ maxAttempts?: number;
1299
+ }
1300
+ interface ManagedOperationCall {
1301
+ context: BknBusinessContext;
1302
+ operation: ManagedOperation;
1303
+ receipt: OperationReceipt;
1304
+ }
1305
+ interface ManagedOperationExecution<T> {
1306
+ value: T;
1307
+ receipt: OperationReceipt;
1308
+ }
1309
+ type ManagedOperationResult<T> = (ManagedOperationExecution<T> & {
1310
+ recovered: false;
1311
+ }) | {
1312
+ value: undefined;
1313
+ receipt: OperationReceipt;
1314
+ recovered: true;
1315
+ };
1316
+ interface ManagedTraceOptions {
1317
+ idFactory?: () => string;
1318
+ }
1319
+ declare class ManagedTrace {
1320
+ private readonly api;
1321
+ private readonly idFactory;
1322
+ private readonly pendingConversations;
1323
+ private readonly activeConversationIds;
1324
+ constructor(api: TraceLifecycleApi, options?: ManagedTraceOptions);
1325
+ withInteraction(strategy: ConversationStrategy, callback: (scope: ManagedInteractionScope) => Promise<ManagedCompletionInput>): Promise<ManagedInteraction>;
1326
+ private resolveConversation;
1327
+ private ensureCurrent;
1328
+ private runOperation;
1329
+ }
1330
+
1331
+ /**
1332
+ * BKN Trace client (agent-observability). Implements raw trace search and a
1333
+ * two-hop "spans by conversation" fetch. The full
1334
+ * diagnose/eval-set rule engine (LLM-as-judge) is a separate large feature and
1335
+ * is NOT included here — see docs/exec-plans/tech-debt-tracker.md.
1336
+ */
1337
+
1338
+ interface ActionSummary {
1339
+ recommended: number;
1340
+ approved: number;
1341
+ executed: number;
1342
+ completed: number;
1343
+ last_status?: string;
1344
+ }
1345
+ interface TraceExecutionSummary {
1346
+ trace_id: string;
1347
+ request_id: string;
1348
+ conversation_id?: string;
1349
+ interaction_id?: string;
1350
+ started_at?: string;
1351
+ completed_at?: string;
1352
+ agent_or_app?: string;
1353
+ business_domain?: string;
1354
+ root_operation?: string;
1355
+ status: string;
1356
+ span_count: number;
1357
+ duration_ms?: number;
1358
+ error_summary?: string;
1359
+ }
1360
+ interface VisibilitySummary {
1361
+ authorized_ref_count: number;
1362
+ redacted_ref_count: number;
1363
+ hidden_ref_count: number;
1364
+ omitted_ref_count: number;
1365
+ unresolved_ref_count: number;
1366
+ unauthorized_ref_count?: number;
1367
+ }
1368
+ interface GraphPage {
1369
+ node_count: number;
1370
+ edge_count: number;
1371
+ truncated?: boolean;
1372
+ next_cursor?: string | null;
1373
+ }
1374
+ interface TraceGraphNode {
1375
+ span_id: string;
1376
+ parent_span_id?: string;
1377
+ name: string;
1378
+ kind: string;
1379
+ service_name?: string;
1380
+ status: string;
1381
+ error_message?: string;
1382
+ start_nano: number;
1383
+ end_nano: number;
1384
+ duration_nano: number;
1385
+ }
1386
+ interface TraceGraphEdge {
1387
+ id: string;
1388
+ parent_span_id: string;
1389
+ child_span_id: string;
1390
+ edge_type: string;
1391
+ }
1392
+ interface TraceGraphResponse {
1393
+ trace_id: string;
1394
+ status: string;
1395
+ duration_nano: number;
1396
+ partial: boolean;
1397
+ partial_reason: string[];
1398
+ page: GraphPage;
1399
+ data: {
1400
+ nodes: TraceGraphNode[];
1401
+ edges: TraceGraphEdge[];
1402
+ };
1403
+ }
1404
+
829
1405
  /**
830
1406
  * Trace diagnose engine. Fetches a conversation's spans, shapes them into a
831
1407
  * trace tree, runs deterministic symbolic predicates, and (in hybrid mode) adds
@@ -914,8 +1490,14 @@ interface EvalSetResult {
914
1490
  }
915
1491
 
916
1492
  declare function trace(ctx: RequestContext): {
1493
+ /** Low-level BKN Trace 3.0 lifecycle and durable receipt API. */
1494
+ lifecycle: TraceLifecycleApi;
1495
+ /** Own one complete interaction lifecycle around an application callback. */
1496
+ withInteraction: (strategy: ConversationStrategy, callback: (scope: ManagedInteractionScope) => Promise<ManagedCompletionInput>) => Promise<ManagedInteraction>;
917
1497
  /** Raw trace search (OpenSearch-style body). */
918
1498
  search: (body: unknown) => Promise<unknown>;
1499
+ /** Normalized trace tree/status graph by trace id. */
1500
+ graph: (traceId: string) => Promise<TraceGraphResponse>;
919
1501
  /** All span source docs for a conversation. */
920
1502
  spans: (conversationId: string, opts?: {
921
1503
  maxTraceIds?: number;
@@ -946,6 +1528,8 @@ declare function trace(ctx: RequestContext): {
946
1528
  }>;
947
1529
  /** Build eval cases from a loosely-shaped queries object/array. */
948
1530
  evalSetBuild: (raw: unknown) => EvalCase[];
1531
+ /** Validate BKN Trace phase-one fixture files or directories. */
1532
+ validateFixture: (path: string) => FixturePathValidationResult;
949
1533
  /**
950
1534
  * Run an eval set against an agent: each case's query is sent to the agent,
951
1535
  * the resulting trace is fetched, and assertions are checked. `llm` enables
@@ -965,32 +1549,113 @@ declare function trace(ctx: RequestContext): {
965
1549
 
966
1550
  declare const BuildMode: z.ZodEnum<["batch", "streaming"]>;
967
1551
  type BuildMode = z.infer<typeof BuildMode>;
1552
+ declare const BuildTaskStatus: z.ZodEnum<["init", "running", "stopping", "stopped", "completed", "failed"]>;
1553
+ type BuildTaskStatus = z.infer<typeof BuildTaskStatus>;
1554
+ declare const CatalogHealthCheckScheduleMode: z.ZodEnum<["inherit", "enabled", "disabled"]>;
1555
+ type CatalogHealthCheckScheduleMode = z.infer<typeof CatalogHealthCheckScheduleMode>;
1556
+ declare const CatalogHealthCheckStatus: z.ZodEnum<["healthy", "degraded", "unhealthy", "offline", "unchecked"]>;
1557
+ type CatalogHealthCheckStatus = z.infer<typeof CatalogHealthCheckStatus>;
1558
+ declare const CatalogHealthStatus: z.ZodObject<{
1559
+ id: z.ZodString;
1560
+ health_check_status: z.ZodEnum<["healthy", "degraded", "unhealthy", "offline", "unchecked"]>;
1561
+ last_check_time: z.ZodOptional<z.ZodNumber>;
1562
+ health_check_result: z.ZodOptional<z.ZodString>;
1563
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1564
+ id: z.ZodString;
1565
+ health_check_status: z.ZodEnum<["healthy", "degraded", "unhealthy", "offline", "unchecked"]>;
1566
+ last_check_time: z.ZodOptional<z.ZodNumber>;
1567
+ health_check_result: z.ZodOptional<z.ZodString>;
1568
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1569
+ id: z.ZodString;
1570
+ health_check_status: z.ZodEnum<["healthy", "degraded", "unhealthy", "offline", "unchecked"]>;
1571
+ last_check_time: z.ZodOptional<z.ZodNumber>;
1572
+ health_check_result: z.ZodOptional<z.ZodString>;
1573
+ }, z.ZodTypeAny, "passthrough">>;
1574
+ type CatalogHealthStatus = z.infer<typeof CatalogHealthStatus>;
1575
+ type CatalogHealthCheckScheduleRequest = {
1576
+ mode: "enabled";
1577
+ cronExpr: string;
1578
+ } | {
1579
+ mode: "inherit" | "disabled";
1580
+ cronExpr?: never;
1581
+ };
1582
+ declare const CatalogHealthCheckSchedule: z.ZodObject<{
1583
+ catalog_id: z.ZodString;
1584
+ mode: z.ZodEnum<["inherit", "enabled", "disabled"]>;
1585
+ cron_expr: z.ZodOptional<z.ZodString>;
1586
+ last_run: z.ZodNumber;
1587
+ next_run: z.ZodNumber;
1588
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1589
+ catalog_id: z.ZodString;
1590
+ mode: z.ZodEnum<["inherit", "enabled", "disabled"]>;
1591
+ cron_expr: z.ZodOptional<z.ZodString>;
1592
+ last_run: z.ZodNumber;
1593
+ next_run: z.ZodNumber;
1594
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1595
+ catalog_id: z.ZodString;
1596
+ mode: z.ZodEnum<["inherit", "enabled", "disabled"]>;
1597
+ cron_expr: z.ZodOptional<z.ZodString>;
1598
+ last_run: z.ZodNumber;
1599
+ next_run: z.ZodNumber;
1600
+ }, z.ZodTypeAny, "passthrough">>;
1601
+ type CatalogHealthCheckSchedule = z.infer<typeof CatalogHealthCheckSchedule>;
1602
+ interface CatalogConnectionTestRequest {
1603
+ connectorType: string;
1604
+ connectorConfig: Record<string, unknown>;
1605
+ }
1606
+ declare const CatalogConnectionTestResult: z.ZodObject<{
1607
+ success: z.ZodBoolean;
1608
+ message: z.ZodOptional<z.ZodString>;
1609
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1610
+ success: z.ZodBoolean;
1611
+ message: z.ZodOptional<z.ZodString>;
1612
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1613
+ success: z.ZodBoolean;
1614
+ message: z.ZodOptional<z.ZodString>;
1615
+ }, z.ZodTypeAny, "passthrough">>;
1616
+ type CatalogConnectionTestResult = z.infer<typeof CatalogConnectionTestResult>;
1617
+ interface CatalogWriteOptions {
1618
+ allowUnhealthy?: boolean;
1619
+ }
968
1620
  /** POST /build-tasks body. */
969
- declare const CreateBuildTaskRequest: z.ZodObject<{
1621
+ declare const CreateBuildTaskRequest: z.ZodDiscriminatedUnion<"mode", [z.ZodObject<{
970
1622
  resource_id: z.ZodString;
971
- mode: z.ZodEnum<["batch", "streaming"]>;
1623
+ mode: z.ZodLiteral<"batch">;
972
1624
  execute_type: z.ZodOptional<z.ZodEnum<["incremental", "full"]>>;
973
1625
  }, "strip", z.ZodTypeAny, {
974
- mode: "batch" | "streaming";
1626
+ mode: "batch";
975
1627
  resource_id: string;
976
1628
  execute_type?: "full" | "incremental" | undefined;
977
1629
  }, {
978
- mode: "batch" | "streaming";
1630
+ mode: "batch";
979
1631
  resource_id: string;
980
1632
  execute_type?: "full" | "incremental" | undefined;
981
- }>;
1633
+ }>, z.ZodObject<{
1634
+ resource_id: z.ZodString;
1635
+ mode: z.ZodLiteral<"streaming">;
1636
+ execute_type: z.ZodOptional<z.ZodNever>;
1637
+ }, "strip", z.ZodTypeAny, {
1638
+ mode: "streaming";
1639
+ resource_id: string;
1640
+ execute_type?: undefined;
1641
+ }, {
1642
+ mode: "streaming";
1643
+ resource_id: string;
1644
+ execute_type?: undefined;
1645
+ }>]>;
982
1646
  type CreateBuildTaskRequest = z.infer<typeof CreateBuildTaskRequest>;
983
1647
  declare const BuildTask: z.ZodObject<{
984
1648
  id: z.ZodString;
985
1649
  resource_id: z.ZodOptional<z.ZodString>;
986
1650
  mode: z.ZodOptional<z.ZodEnum<["batch", "streaming"]>>;
987
- status: z.ZodOptional<z.ZodString>;
1651
+ status: z.ZodOptional<z.ZodEnum<["init", "running", "stopping", "stopped", "completed", "failed"]>>;
988
1652
  state: z.ZodOptional<z.ZodString>;
989
1653
  total_count: z.ZodOptional<z.ZodNumber>;
990
1654
  synced_count: z.ZodOptional<z.ZodNumber>;
991
1655
  vectorized_count: z.ZodOptional<z.ZodNumber>;
992
1656
  index_config: z.ZodOptional<z.ZodUnknown>;
993
1657
  catalog_id: z.ZodOptional<z.ZodString>;
1658
+ execute_type: z.ZodOptional<z.ZodEnum<["incremental", "full"]>>;
994
1659
  index_health: z.ZodOptional<z.ZodObject<{
995
1660
  embedding: z.ZodString;
996
1661
  fulltext: z.ZodString;
@@ -1008,13 +1673,14 @@ declare const BuildTask: z.ZodObject<{
1008
1673
  id: z.ZodString;
1009
1674
  resource_id: z.ZodOptional<z.ZodString>;
1010
1675
  mode: z.ZodOptional<z.ZodEnum<["batch", "streaming"]>>;
1011
- status: z.ZodOptional<z.ZodString>;
1676
+ status: z.ZodOptional<z.ZodEnum<["init", "running", "stopping", "stopped", "completed", "failed"]>>;
1012
1677
  state: z.ZodOptional<z.ZodString>;
1013
1678
  total_count: z.ZodOptional<z.ZodNumber>;
1014
1679
  synced_count: z.ZodOptional<z.ZodNumber>;
1015
1680
  vectorized_count: z.ZodOptional<z.ZodNumber>;
1016
1681
  index_config: z.ZodOptional<z.ZodUnknown>;
1017
1682
  catalog_id: z.ZodOptional<z.ZodString>;
1683
+ execute_type: z.ZodOptional<z.ZodEnum<["incremental", "full"]>>;
1018
1684
  index_health: z.ZodOptional<z.ZodObject<{
1019
1685
  embedding: z.ZodString;
1020
1686
  fulltext: z.ZodString;
@@ -1032,13 +1698,14 @@ declare const BuildTask: z.ZodObject<{
1032
1698
  id: z.ZodString;
1033
1699
  resource_id: z.ZodOptional<z.ZodString>;
1034
1700
  mode: z.ZodOptional<z.ZodEnum<["batch", "streaming"]>>;
1035
- status: z.ZodOptional<z.ZodString>;
1701
+ status: z.ZodOptional<z.ZodEnum<["init", "running", "stopping", "stopped", "completed", "failed"]>>;
1036
1702
  state: z.ZodOptional<z.ZodString>;
1037
1703
  total_count: z.ZodOptional<z.ZodNumber>;
1038
1704
  synced_count: z.ZodOptional<z.ZodNumber>;
1039
1705
  vectorized_count: z.ZodOptional<z.ZodNumber>;
1040
1706
  index_config: z.ZodOptional<z.ZodUnknown>;
1041
1707
  catalog_id: z.ZodOptional<z.ZodString>;
1708
+ execute_type: z.ZodOptional<z.ZodEnum<["incremental", "full"]>>;
1042
1709
  index_health: z.ZodOptional<z.ZodObject<{
1043
1710
  embedding: z.ZodString;
1044
1711
  fulltext: z.ZodString;
@@ -1054,38 +1721,574 @@ declare const BuildTask: z.ZodObject<{
1054
1721
  }, z.ZodTypeAny, "passthrough">>>;
1055
1722
  }, z.ZodTypeAny, "passthrough">>;
1056
1723
  type BuildTask = z.infer<typeof BuildTask>;
1724
+ /** Lightweight BuildTask representation returned by list APIs. */
1725
+ declare const BuildTaskSummary: z.ZodObject<{
1726
+ id: z.ZodString;
1727
+ resource_id: z.ZodString;
1728
+ resource_name: z.ZodOptional<z.ZodString>;
1729
+ catalog_id: z.ZodString;
1730
+ catalog_name: z.ZodOptional<z.ZodString>;
1731
+ status: z.ZodEnum<["init", "running", "stopping", "stopped", "completed", "failed"]>;
1732
+ mode: z.ZodEnum<["batch", "streaming"]>;
1733
+ execute_type: z.ZodOptional<z.ZodEnum<["incremental", "full"]>>;
1734
+ total_count: z.ZodNumber;
1735
+ synced_count: z.ZodNumber;
1736
+ vectorized_count: z.ZodNumber;
1737
+ synced_mark: z.ZodString;
1738
+ error_msg: z.ZodOptional<z.ZodString>;
1739
+ creator: z.ZodObject<{
1740
+ id: z.ZodString;
1741
+ name: z.ZodOptional<z.ZodString>;
1742
+ type: z.ZodString;
1743
+ }, "strip", z.ZodTypeAny, {
1744
+ id: string;
1745
+ type: string;
1746
+ name?: string | undefined;
1747
+ }, {
1748
+ id: string;
1749
+ type: string;
1750
+ name?: string | undefined;
1751
+ }>;
1752
+ create_time: z.ZodNumber;
1753
+ update_time: z.ZodNumber;
1754
+ index_health: z.ZodOptional<z.ZodObject<{
1755
+ embedding: z.ZodString;
1756
+ fulltext: z.ZodString;
1757
+ usable: z.ZodBoolean;
1758
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1759
+ embedding: z.ZodString;
1760
+ fulltext: z.ZodString;
1761
+ usable: z.ZodBoolean;
1762
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1763
+ embedding: z.ZodString;
1764
+ fulltext: z.ZodString;
1765
+ usable: z.ZodBoolean;
1766
+ }, z.ZodTypeAny, "passthrough">>>;
1767
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1768
+ id: z.ZodString;
1769
+ resource_id: z.ZodString;
1770
+ resource_name: z.ZodOptional<z.ZodString>;
1771
+ catalog_id: z.ZodString;
1772
+ catalog_name: z.ZodOptional<z.ZodString>;
1773
+ status: z.ZodEnum<["init", "running", "stopping", "stopped", "completed", "failed"]>;
1774
+ mode: z.ZodEnum<["batch", "streaming"]>;
1775
+ execute_type: z.ZodOptional<z.ZodEnum<["incremental", "full"]>>;
1776
+ total_count: z.ZodNumber;
1777
+ synced_count: z.ZodNumber;
1778
+ vectorized_count: z.ZodNumber;
1779
+ synced_mark: z.ZodString;
1780
+ error_msg: z.ZodOptional<z.ZodString>;
1781
+ creator: z.ZodObject<{
1782
+ id: z.ZodString;
1783
+ name: z.ZodOptional<z.ZodString>;
1784
+ type: z.ZodString;
1785
+ }, "strip", z.ZodTypeAny, {
1786
+ id: string;
1787
+ type: string;
1788
+ name?: string | undefined;
1789
+ }, {
1790
+ id: string;
1791
+ type: string;
1792
+ name?: string | undefined;
1793
+ }>;
1794
+ create_time: z.ZodNumber;
1795
+ update_time: z.ZodNumber;
1796
+ index_health: z.ZodOptional<z.ZodObject<{
1797
+ embedding: z.ZodString;
1798
+ fulltext: z.ZodString;
1799
+ usable: z.ZodBoolean;
1800
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1801
+ embedding: z.ZodString;
1802
+ fulltext: z.ZodString;
1803
+ usable: z.ZodBoolean;
1804
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1805
+ embedding: z.ZodString;
1806
+ fulltext: z.ZodString;
1807
+ usable: z.ZodBoolean;
1808
+ }, z.ZodTypeAny, "passthrough">>>;
1809
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1810
+ id: z.ZodString;
1811
+ resource_id: z.ZodString;
1812
+ resource_name: z.ZodOptional<z.ZodString>;
1813
+ catalog_id: z.ZodString;
1814
+ catalog_name: z.ZodOptional<z.ZodString>;
1815
+ status: z.ZodEnum<["init", "running", "stopping", "stopped", "completed", "failed"]>;
1816
+ mode: z.ZodEnum<["batch", "streaming"]>;
1817
+ execute_type: z.ZodOptional<z.ZodEnum<["incremental", "full"]>>;
1818
+ total_count: z.ZodNumber;
1819
+ synced_count: z.ZodNumber;
1820
+ vectorized_count: z.ZodNumber;
1821
+ synced_mark: z.ZodString;
1822
+ error_msg: z.ZodOptional<z.ZodString>;
1823
+ creator: z.ZodObject<{
1824
+ id: z.ZodString;
1825
+ name: z.ZodOptional<z.ZodString>;
1826
+ type: z.ZodString;
1827
+ }, "strip", z.ZodTypeAny, {
1828
+ id: string;
1829
+ type: string;
1830
+ name?: string | undefined;
1831
+ }, {
1832
+ id: string;
1833
+ type: string;
1834
+ name?: string | undefined;
1835
+ }>;
1836
+ create_time: z.ZodNumber;
1837
+ update_time: z.ZodNumber;
1838
+ index_health: z.ZodOptional<z.ZodObject<{
1839
+ embedding: z.ZodString;
1840
+ fulltext: z.ZodString;
1841
+ usable: z.ZodBoolean;
1842
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1843
+ embedding: z.ZodString;
1844
+ fulltext: z.ZodString;
1845
+ usable: z.ZodBoolean;
1846
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1847
+ embedding: z.ZodString;
1848
+ fulltext: z.ZodString;
1849
+ usable: z.ZodBoolean;
1850
+ }, z.ZodTypeAny, "passthrough">>>;
1851
+ }, z.ZodTypeAny, "passthrough">>;
1852
+ type BuildTaskSummary = z.infer<typeof BuildTaskSummary>;
1853
+ declare const ListBuildTasksResponse: z.ZodObject<{
1854
+ entries: z.ZodArray<z.ZodObject<{
1855
+ id: z.ZodString;
1856
+ resource_id: z.ZodString;
1857
+ resource_name: z.ZodOptional<z.ZodString>;
1858
+ catalog_id: z.ZodString;
1859
+ catalog_name: z.ZodOptional<z.ZodString>;
1860
+ status: z.ZodEnum<["init", "running", "stopping", "stopped", "completed", "failed"]>;
1861
+ mode: z.ZodEnum<["batch", "streaming"]>;
1862
+ execute_type: z.ZodOptional<z.ZodEnum<["incremental", "full"]>>;
1863
+ total_count: z.ZodNumber;
1864
+ synced_count: z.ZodNumber;
1865
+ vectorized_count: z.ZodNumber;
1866
+ synced_mark: z.ZodString;
1867
+ error_msg: z.ZodOptional<z.ZodString>;
1868
+ creator: z.ZodObject<{
1869
+ id: z.ZodString;
1870
+ name: z.ZodOptional<z.ZodString>;
1871
+ type: z.ZodString;
1872
+ }, "strip", z.ZodTypeAny, {
1873
+ id: string;
1874
+ type: string;
1875
+ name?: string | undefined;
1876
+ }, {
1877
+ id: string;
1878
+ type: string;
1879
+ name?: string | undefined;
1880
+ }>;
1881
+ create_time: z.ZodNumber;
1882
+ update_time: z.ZodNumber;
1883
+ index_health: z.ZodOptional<z.ZodObject<{
1884
+ embedding: z.ZodString;
1885
+ fulltext: z.ZodString;
1886
+ usable: z.ZodBoolean;
1887
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1888
+ embedding: z.ZodString;
1889
+ fulltext: z.ZodString;
1890
+ usable: z.ZodBoolean;
1891
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1892
+ embedding: z.ZodString;
1893
+ fulltext: z.ZodString;
1894
+ usable: z.ZodBoolean;
1895
+ }, z.ZodTypeAny, "passthrough">>>;
1896
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1897
+ id: z.ZodString;
1898
+ resource_id: z.ZodString;
1899
+ resource_name: z.ZodOptional<z.ZodString>;
1900
+ catalog_id: z.ZodString;
1901
+ catalog_name: z.ZodOptional<z.ZodString>;
1902
+ status: z.ZodEnum<["init", "running", "stopping", "stopped", "completed", "failed"]>;
1903
+ mode: z.ZodEnum<["batch", "streaming"]>;
1904
+ execute_type: z.ZodOptional<z.ZodEnum<["incremental", "full"]>>;
1905
+ total_count: z.ZodNumber;
1906
+ synced_count: z.ZodNumber;
1907
+ vectorized_count: z.ZodNumber;
1908
+ synced_mark: z.ZodString;
1909
+ error_msg: z.ZodOptional<z.ZodString>;
1910
+ creator: z.ZodObject<{
1911
+ id: z.ZodString;
1912
+ name: z.ZodOptional<z.ZodString>;
1913
+ type: z.ZodString;
1914
+ }, "strip", z.ZodTypeAny, {
1915
+ id: string;
1916
+ type: string;
1917
+ name?: string | undefined;
1918
+ }, {
1919
+ id: string;
1920
+ type: string;
1921
+ name?: string | undefined;
1922
+ }>;
1923
+ create_time: z.ZodNumber;
1924
+ update_time: z.ZodNumber;
1925
+ index_health: z.ZodOptional<z.ZodObject<{
1926
+ embedding: z.ZodString;
1927
+ fulltext: z.ZodString;
1928
+ usable: z.ZodBoolean;
1929
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1930
+ embedding: z.ZodString;
1931
+ fulltext: z.ZodString;
1932
+ usable: z.ZodBoolean;
1933
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1934
+ embedding: z.ZodString;
1935
+ fulltext: z.ZodString;
1936
+ usable: z.ZodBoolean;
1937
+ }, z.ZodTypeAny, "passthrough">>>;
1938
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1939
+ id: z.ZodString;
1940
+ resource_id: z.ZodString;
1941
+ resource_name: z.ZodOptional<z.ZodString>;
1942
+ catalog_id: z.ZodString;
1943
+ catalog_name: z.ZodOptional<z.ZodString>;
1944
+ status: z.ZodEnum<["init", "running", "stopping", "stopped", "completed", "failed"]>;
1945
+ mode: z.ZodEnum<["batch", "streaming"]>;
1946
+ execute_type: z.ZodOptional<z.ZodEnum<["incremental", "full"]>>;
1947
+ total_count: z.ZodNumber;
1948
+ synced_count: z.ZodNumber;
1949
+ vectorized_count: z.ZodNumber;
1950
+ synced_mark: z.ZodString;
1951
+ error_msg: z.ZodOptional<z.ZodString>;
1952
+ creator: z.ZodObject<{
1953
+ id: z.ZodString;
1954
+ name: z.ZodOptional<z.ZodString>;
1955
+ type: z.ZodString;
1956
+ }, "strip", z.ZodTypeAny, {
1957
+ id: string;
1958
+ type: string;
1959
+ name?: string | undefined;
1960
+ }, {
1961
+ id: string;
1962
+ type: string;
1963
+ name?: string | undefined;
1964
+ }>;
1965
+ create_time: z.ZodNumber;
1966
+ update_time: z.ZodNumber;
1967
+ index_health: z.ZodOptional<z.ZodObject<{
1968
+ embedding: z.ZodString;
1969
+ fulltext: z.ZodString;
1970
+ usable: z.ZodBoolean;
1971
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1972
+ embedding: z.ZodString;
1973
+ fulltext: z.ZodString;
1974
+ usable: z.ZodBoolean;
1975
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1976
+ embedding: z.ZodString;
1977
+ fulltext: z.ZodString;
1978
+ usable: z.ZodBoolean;
1979
+ }, z.ZodTypeAny, "passthrough">>>;
1980
+ }, z.ZodTypeAny, "passthrough">>, "many">;
1981
+ total_count: z.ZodNumber;
1982
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1983
+ entries: z.ZodArray<z.ZodObject<{
1984
+ id: z.ZodString;
1985
+ resource_id: z.ZodString;
1986
+ resource_name: z.ZodOptional<z.ZodString>;
1987
+ catalog_id: z.ZodString;
1988
+ catalog_name: z.ZodOptional<z.ZodString>;
1989
+ status: z.ZodEnum<["init", "running", "stopping", "stopped", "completed", "failed"]>;
1990
+ mode: z.ZodEnum<["batch", "streaming"]>;
1991
+ execute_type: z.ZodOptional<z.ZodEnum<["incremental", "full"]>>;
1992
+ total_count: z.ZodNumber;
1993
+ synced_count: z.ZodNumber;
1994
+ vectorized_count: z.ZodNumber;
1995
+ synced_mark: z.ZodString;
1996
+ error_msg: z.ZodOptional<z.ZodString>;
1997
+ creator: z.ZodObject<{
1998
+ id: z.ZodString;
1999
+ name: z.ZodOptional<z.ZodString>;
2000
+ type: z.ZodString;
2001
+ }, "strip", z.ZodTypeAny, {
2002
+ id: string;
2003
+ type: string;
2004
+ name?: string | undefined;
2005
+ }, {
2006
+ id: string;
2007
+ type: string;
2008
+ name?: string | undefined;
2009
+ }>;
2010
+ create_time: z.ZodNumber;
2011
+ update_time: z.ZodNumber;
2012
+ index_health: z.ZodOptional<z.ZodObject<{
2013
+ embedding: z.ZodString;
2014
+ fulltext: z.ZodString;
2015
+ usable: z.ZodBoolean;
2016
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
2017
+ embedding: z.ZodString;
2018
+ fulltext: z.ZodString;
2019
+ usable: z.ZodBoolean;
2020
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
2021
+ embedding: z.ZodString;
2022
+ fulltext: z.ZodString;
2023
+ usable: z.ZodBoolean;
2024
+ }, z.ZodTypeAny, "passthrough">>>;
2025
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
2026
+ id: z.ZodString;
2027
+ resource_id: z.ZodString;
2028
+ resource_name: z.ZodOptional<z.ZodString>;
2029
+ catalog_id: z.ZodString;
2030
+ catalog_name: z.ZodOptional<z.ZodString>;
2031
+ status: z.ZodEnum<["init", "running", "stopping", "stopped", "completed", "failed"]>;
2032
+ mode: z.ZodEnum<["batch", "streaming"]>;
2033
+ execute_type: z.ZodOptional<z.ZodEnum<["incremental", "full"]>>;
2034
+ total_count: z.ZodNumber;
2035
+ synced_count: z.ZodNumber;
2036
+ vectorized_count: z.ZodNumber;
2037
+ synced_mark: z.ZodString;
2038
+ error_msg: z.ZodOptional<z.ZodString>;
2039
+ creator: z.ZodObject<{
2040
+ id: z.ZodString;
2041
+ name: z.ZodOptional<z.ZodString>;
2042
+ type: z.ZodString;
2043
+ }, "strip", z.ZodTypeAny, {
2044
+ id: string;
2045
+ type: string;
2046
+ name?: string | undefined;
2047
+ }, {
2048
+ id: string;
2049
+ type: string;
2050
+ name?: string | undefined;
2051
+ }>;
2052
+ create_time: z.ZodNumber;
2053
+ update_time: z.ZodNumber;
2054
+ index_health: z.ZodOptional<z.ZodObject<{
2055
+ embedding: z.ZodString;
2056
+ fulltext: z.ZodString;
2057
+ usable: z.ZodBoolean;
2058
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
2059
+ embedding: z.ZodString;
2060
+ fulltext: z.ZodString;
2061
+ usable: z.ZodBoolean;
2062
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
2063
+ embedding: z.ZodString;
2064
+ fulltext: z.ZodString;
2065
+ usable: z.ZodBoolean;
2066
+ }, z.ZodTypeAny, "passthrough">>>;
2067
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
2068
+ id: z.ZodString;
2069
+ resource_id: z.ZodString;
2070
+ resource_name: z.ZodOptional<z.ZodString>;
2071
+ catalog_id: z.ZodString;
2072
+ catalog_name: z.ZodOptional<z.ZodString>;
2073
+ status: z.ZodEnum<["init", "running", "stopping", "stopped", "completed", "failed"]>;
2074
+ mode: z.ZodEnum<["batch", "streaming"]>;
2075
+ execute_type: z.ZodOptional<z.ZodEnum<["incremental", "full"]>>;
2076
+ total_count: z.ZodNumber;
2077
+ synced_count: z.ZodNumber;
2078
+ vectorized_count: z.ZodNumber;
2079
+ synced_mark: z.ZodString;
2080
+ error_msg: z.ZodOptional<z.ZodString>;
2081
+ creator: z.ZodObject<{
2082
+ id: z.ZodString;
2083
+ name: z.ZodOptional<z.ZodString>;
2084
+ type: z.ZodString;
2085
+ }, "strip", z.ZodTypeAny, {
2086
+ id: string;
2087
+ type: string;
2088
+ name?: string | undefined;
2089
+ }, {
2090
+ id: string;
2091
+ type: string;
2092
+ name?: string | undefined;
2093
+ }>;
2094
+ create_time: z.ZodNumber;
2095
+ update_time: z.ZodNumber;
2096
+ index_health: z.ZodOptional<z.ZodObject<{
2097
+ embedding: z.ZodString;
2098
+ fulltext: z.ZodString;
2099
+ usable: z.ZodBoolean;
2100
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
2101
+ embedding: z.ZodString;
2102
+ fulltext: z.ZodString;
2103
+ usable: z.ZodBoolean;
2104
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
2105
+ embedding: z.ZodString;
2106
+ fulltext: z.ZodString;
2107
+ usable: z.ZodBoolean;
2108
+ }, z.ZodTypeAny, "passthrough">>>;
2109
+ }, z.ZodTypeAny, "passthrough">>, "many">;
2110
+ total_count: z.ZodNumber;
2111
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
2112
+ entries: z.ZodArray<z.ZodObject<{
2113
+ id: z.ZodString;
2114
+ resource_id: z.ZodString;
2115
+ resource_name: z.ZodOptional<z.ZodString>;
2116
+ catalog_id: z.ZodString;
2117
+ catalog_name: z.ZodOptional<z.ZodString>;
2118
+ status: z.ZodEnum<["init", "running", "stopping", "stopped", "completed", "failed"]>;
2119
+ mode: z.ZodEnum<["batch", "streaming"]>;
2120
+ execute_type: z.ZodOptional<z.ZodEnum<["incremental", "full"]>>;
2121
+ total_count: z.ZodNumber;
2122
+ synced_count: z.ZodNumber;
2123
+ vectorized_count: z.ZodNumber;
2124
+ synced_mark: z.ZodString;
2125
+ error_msg: z.ZodOptional<z.ZodString>;
2126
+ creator: z.ZodObject<{
2127
+ id: z.ZodString;
2128
+ name: z.ZodOptional<z.ZodString>;
2129
+ type: z.ZodString;
2130
+ }, "strip", z.ZodTypeAny, {
2131
+ id: string;
2132
+ type: string;
2133
+ name?: string | undefined;
2134
+ }, {
2135
+ id: string;
2136
+ type: string;
2137
+ name?: string | undefined;
2138
+ }>;
2139
+ create_time: z.ZodNumber;
2140
+ update_time: z.ZodNumber;
2141
+ index_health: z.ZodOptional<z.ZodObject<{
2142
+ embedding: z.ZodString;
2143
+ fulltext: z.ZodString;
2144
+ usable: z.ZodBoolean;
2145
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
2146
+ embedding: z.ZodString;
2147
+ fulltext: z.ZodString;
2148
+ usable: z.ZodBoolean;
2149
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
2150
+ embedding: z.ZodString;
2151
+ fulltext: z.ZodString;
2152
+ usable: z.ZodBoolean;
2153
+ }, z.ZodTypeAny, "passthrough">>>;
2154
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
2155
+ id: z.ZodString;
2156
+ resource_id: z.ZodString;
2157
+ resource_name: z.ZodOptional<z.ZodString>;
2158
+ catalog_id: z.ZodString;
2159
+ catalog_name: z.ZodOptional<z.ZodString>;
2160
+ status: z.ZodEnum<["init", "running", "stopping", "stopped", "completed", "failed"]>;
2161
+ mode: z.ZodEnum<["batch", "streaming"]>;
2162
+ execute_type: z.ZodOptional<z.ZodEnum<["incremental", "full"]>>;
2163
+ total_count: z.ZodNumber;
2164
+ synced_count: z.ZodNumber;
2165
+ vectorized_count: z.ZodNumber;
2166
+ synced_mark: z.ZodString;
2167
+ error_msg: z.ZodOptional<z.ZodString>;
2168
+ creator: z.ZodObject<{
2169
+ id: z.ZodString;
2170
+ name: z.ZodOptional<z.ZodString>;
2171
+ type: z.ZodString;
2172
+ }, "strip", z.ZodTypeAny, {
2173
+ id: string;
2174
+ type: string;
2175
+ name?: string | undefined;
2176
+ }, {
2177
+ id: string;
2178
+ type: string;
2179
+ name?: string | undefined;
2180
+ }>;
2181
+ create_time: z.ZodNumber;
2182
+ update_time: z.ZodNumber;
2183
+ index_health: z.ZodOptional<z.ZodObject<{
2184
+ embedding: z.ZodString;
2185
+ fulltext: z.ZodString;
2186
+ usable: z.ZodBoolean;
2187
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
2188
+ embedding: z.ZodString;
2189
+ fulltext: z.ZodString;
2190
+ usable: z.ZodBoolean;
2191
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
2192
+ embedding: z.ZodString;
2193
+ fulltext: z.ZodString;
2194
+ usable: z.ZodBoolean;
2195
+ }, z.ZodTypeAny, "passthrough">>>;
2196
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
2197
+ id: z.ZodString;
2198
+ resource_id: z.ZodString;
2199
+ resource_name: z.ZodOptional<z.ZodString>;
2200
+ catalog_id: z.ZodString;
2201
+ catalog_name: z.ZodOptional<z.ZodString>;
2202
+ status: z.ZodEnum<["init", "running", "stopping", "stopped", "completed", "failed"]>;
2203
+ mode: z.ZodEnum<["batch", "streaming"]>;
2204
+ execute_type: z.ZodOptional<z.ZodEnum<["incremental", "full"]>>;
2205
+ total_count: z.ZodNumber;
2206
+ synced_count: z.ZodNumber;
2207
+ vectorized_count: z.ZodNumber;
2208
+ synced_mark: z.ZodString;
2209
+ error_msg: z.ZodOptional<z.ZodString>;
2210
+ creator: z.ZodObject<{
2211
+ id: z.ZodString;
2212
+ name: z.ZodOptional<z.ZodString>;
2213
+ type: z.ZodString;
2214
+ }, "strip", z.ZodTypeAny, {
2215
+ id: string;
2216
+ type: string;
2217
+ name?: string | undefined;
2218
+ }, {
2219
+ id: string;
2220
+ type: string;
2221
+ name?: string | undefined;
2222
+ }>;
2223
+ create_time: z.ZodNumber;
2224
+ update_time: z.ZodNumber;
2225
+ index_health: z.ZodOptional<z.ZodObject<{
2226
+ embedding: z.ZodString;
2227
+ fulltext: z.ZodString;
2228
+ usable: z.ZodBoolean;
2229
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
2230
+ embedding: z.ZodString;
2231
+ fulltext: z.ZodString;
2232
+ usable: z.ZodBoolean;
2233
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
2234
+ embedding: z.ZodString;
2235
+ fulltext: z.ZodString;
2236
+ usable: z.ZodBoolean;
2237
+ }, z.ZodTypeAny, "passthrough">>>;
2238
+ }, z.ZodTypeAny, "passthrough">>, "many">;
2239
+ total_count: z.ZodNumber;
2240
+ }, z.ZodTypeAny, "passthrough">>;
2241
+ type ListBuildTasksResponse = z.infer<typeof ListBuildTasksResponse>;
1057
2242
  interface ListBuildTasksOptions {
1058
2243
  limit?: number;
1059
2244
  offset?: number;
1060
2245
  resourceId?: string;
1061
2246
  catalogId?: string;
1062
- status?: string | string[];
2247
+ status?: BuildTaskStatus | BuildTaskStatus[];
1063
2248
  active?: boolean;
1064
2249
  mode?: BuildMode;
1065
- orderBy?: "default" | "created_at" | "updated_at" | "status" | "mode";
2250
+ orderBy?: "created_at" | "updated_at";
1066
2251
  order?: "asc" | "desc";
1067
2252
  }
1068
2253
  interface DeleteBuildTasksOptions {
1069
2254
  ignoreMissing?: boolean;
1070
2255
  deleteActiveIndex?: boolean;
1071
2256
  }
1072
- interface SqlQueryRequest {
1073
- /** SQL string (MySQL/MariaDB/PostgreSQL) or an OpenSearch DSL object. */
1074
- query: string | Record<string, unknown>;
1075
- /** Query mode. `stream` uses cursor-style paging through `query_id`. */
1076
- query_type?: "standard" | "stream";
1077
- /**
1078
- * Source type (mysql | mariadb | postgresql | opensearch …). Required by the
1079
- * current vega-backend raw query handler.
1080
- */
1081
- resource_type: string;
1082
- /** Streaming batch size (100–10000, default server-side). */
1083
- stream_size?: number;
1084
- /** Query timeout in seconds (1–3600). */
1085
- query_timeout?: number;
1086
- /** Cursor session id for paged streaming. */
1087
- query_id?: string;
2257
+ type QueryPagingMode = "single" | "cursor";
2258
+ /** Paging options for an initial Vega raw query. */
2259
+ interface RawQueryPaging {
2260
+ mode?: QueryPagingMode;
2261
+ offset?: number;
2262
+ limit?: number;
2263
+ keep_alive_sec?: number;
2264
+ }
2265
+ /** Opaque cursor continuation. No initial-query fields may accompany it. */
2266
+ interface RawQueryContinuationRequest {
2267
+ paging: {
2268
+ cursor: string;
2269
+ };
2270
+ /** Accepted by the API but cannot override the value frozen on the first page. */
2271
+ need_total?: boolean;
2272
+ }
2273
+ interface RawQueryInitialBase {
2274
+ paging?: RawQueryPaging;
2275
+ /** Per-page timeout in seconds (1–3600); defaults to 60 server-side. */
2276
+ query_timeout_sec?: number;
2277
+ need_total?: boolean;
2278
+ }
2279
+ interface SqlRawQueryRequest extends RawQueryInitialBase {
2280
+ query: string;
2281
+ query_format: "sql";
2282
+ /** SQL input dialect; defaults to postgres server-side. */
2283
+ input_dialect?: "postgres" | "mysql" | "trino" | "duckdb";
1088
2284
  }
2285
+ interface DslRawQueryRequest extends RawQueryInitialBase {
2286
+ query: Record<string, unknown>;
2287
+ query_format: "dsl";
2288
+ input_dialect: "opensearch";
2289
+ }
2290
+ /** Request contract for POST /resources/query. */
2291
+ type RawQueryRequest = SqlRawQueryRequest | DslRawQueryRequest | RawQueryContinuationRequest;
1089
2292
  interface ListCatalogsOptions {
1090
2293
  limit?: number;
1091
2294
  offset?: number;
@@ -1093,7 +2296,7 @@ interface ListCatalogsOptions {
1093
2296
  tag?: string;
1094
2297
  type?: "physical" | "logical" | string;
1095
2298
  enabled?: boolean;
1096
- healthCheckStatus?: string;
2299
+ healthCheckStatus?: CatalogHealthCheckStatus;
1097
2300
  includeExtensions?: boolean;
1098
2301
  includeExtensionKeys?: string;
1099
2302
  extensionPairs?: Array<{
@@ -1107,31 +2310,68 @@ interface ListCatalogsOptions {
1107
2310
  interface CreateCatalogRequest {
1108
2311
  name: string;
1109
2312
  connectorType: string;
1110
- connectorConfig: unknown;
2313
+ connectorConfig: Record<string, unknown>;
1111
2314
  tags?: string[];
1112
2315
  description?: string;
1113
2316
  enabled?: boolean;
1114
2317
  id?: string;
1115
2318
  internal?: boolean;
1116
2319
  extensions?: Record<string, string>;
2320
+ healthCheckSchedule?: CatalogHealthCheckScheduleRequest | null;
2321
+ }
2322
+ /** Full PUT /catalogs/{id} body; the path id is injected by the API client. */
2323
+ interface UpdateCatalogRequest {
2324
+ name: string;
2325
+ connectorType: string;
2326
+ enabled: boolean;
2327
+ connectorConfig?: Record<string, unknown>;
2328
+ tags?: string[];
2329
+ description?: string;
2330
+ extensions?: Record<string, string>;
1117
2331
  }
1118
2332
 
1119
2333
  declare function vega(ctx: RequestContext): {
1120
2334
  catalogs: (opts?: ListCatalogsOptions) => Promise<unknown>;
1121
2335
  getCatalog: (id: string) => Promise<unknown>;
1122
- createCatalog: (req: CreateCatalogRequest) => Promise<unknown>;
1123
- updateCatalog: (id: string, req: Partial<CreateCatalogRequest>) => Promise<unknown>;
2336
+ createCatalog: (req: CreateCatalogRequest, opts?: CatalogWriteOptions) => Promise<unknown>;
2337
+ updateCatalog: (id: string, req: UpdateCatalogRequest, opts?: CatalogWriteOptions) => Promise<unknown>;
1124
2338
  enableCatalog: (id: string) => Promise<unknown>;
1125
2339
  disableCatalog: (id: string) => Promise<unknown>;
1126
2340
  deleteCatalog: (id: string) => Promise<unknown>;
1127
- testCatalogConnection: (id: string) => Promise<unknown>;
2341
+ testCatalogConnectionConfig: (req: CatalogConnectionTestRequest) => Promise<zod.objectOutputType<{
2342
+ success: zod.ZodBoolean;
2343
+ message: zod.ZodOptional<zod.ZodString>;
2344
+ }, zod.ZodTypeAny, "passthrough">>;
2345
+ testCatalogConnection: (id: string) => Promise<zod.objectOutputType<{
2346
+ success: zod.ZodBoolean;
2347
+ message: zod.ZodOptional<zod.ZodString>;
2348
+ }, zod.ZodTypeAny, "passthrough">>;
2349
+ catalogHealthCheckSchedule: (id: string) => Promise<zod.objectOutputType<{
2350
+ catalog_id: zod.ZodString;
2351
+ mode: zod.ZodEnum<["inherit", "enabled", "disabled"]>;
2352
+ cron_expr: zod.ZodOptional<zod.ZodString>;
2353
+ last_run: zod.ZodNumber;
2354
+ next_run: zod.ZodNumber;
2355
+ }, zod.ZodTypeAny, "passthrough">>;
2356
+ updateCatalogHealthCheckSchedule: (id: string, req: CatalogHealthCheckScheduleRequest) => Promise<zod.objectOutputType<{
2357
+ catalog_id: zod.ZodString;
2358
+ mode: zod.ZodEnum<["inherit", "enabled", "disabled"]>;
2359
+ cron_expr: zod.ZodOptional<zod.ZodString>;
2360
+ last_run: zod.ZodNumber;
2361
+ next_run: zod.ZodNumber;
2362
+ }, zod.ZodTypeAny, "passthrough">>;
1128
2363
  discoverCatalog: (id: string, wait?: boolean) => Promise<unknown>;
1129
- catalogResources: (id: string, category?: string) => Promise<unknown>;
1130
- catalogHealth: (ids: string[]) => Promise<unknown>;
2364
+ catalogResources: (id: string, category?: string, limit?: number, offset?: number) => Promise<unknown>;
2365
+ catalogHealth: (id: string) => Promise<zod.objectOutputType<{
2366
+ id: zod.ZodString;
2367
+ health_check_status: zod.ZodEnum<["healthy", "degraded", "unhealthy", "offline", "unchecked"]>;
2368
+ last_check_time: zod.ZodOptional<zod.ZodNumber>;
2369
+ health_check_result: zod.ZodOptional<zod.ZodString>;
2370
+ }, zod.ZodTypeAny, "passthrough">>;
1131
2371
  connectorTypes: () => Promise<unknown>;
1132
2372
  connectorType: (type: string) => Promise<unknown>;
1133
2373
  /** Run SQL / OpenSearch DSL directly against a data source. */
1134
- sql: (body: SqlQueryRequest) => Promise<unknown>;
2374
+ sql: (body: RawQueryRequest) => Promise<unknown>;
1135
2375
  /** Build a resource's index. With `wait`, polls until terminal. */
1136
2376
  build: (req: CreateBuildTaskRequest, opts?: {
1137
2377
  wait?: boolean;
@@ -1142,13 +2382,14 @@ declare function vega(ctx: RequestContext): {
1142
2382
  id: zod.ZodString;
1143
2383
  resource_id: zod.ZodOptional<zod.ZodString>;
1144
2384
  mode: zod.ZodOptional<zod.ZodEnum<["batch", "streaming"]>>;
1145
- status: zod.ZodOptional<zod.ZodString>;
2385
+ status: zod.ZodOptional<zod.ZodEnum<["init", "running", "stopping", "stopped", "completed", "failed"]>>;
1146
2386
  state: zod.ZodOptional<zod.ZodString>;
1147
2387
  total_count: zod.ZodOptional<zod.ZodNumber>;
1148
2388
  synced_count: zod.ZodOptional<zod.ZodNumber>;
1149
2389
  vectorized_count: zod.ZodOptional<zod.ZodNumber>;
1150
2390
  index_config: zod.ZodOptional<zod.ZodUnknown>;
1151
2391
  catalog_id: zod.ZodOptional<zod.ZodString>;
2392
+ execute_type: zod.ZodOptional<zod.ZodEnum<["incremental", "full"]>>;
1152
2393
  index_health: zod.ZodOptional<zod.ZodObject<{
1153
2394
  embedding: zod.ZodString;
1154
2395
  fulltext: zod.ZodString;
@@ -1163,7 +2404,136 @@ declare function vega(ctx: RequestContext): {
1163
2404
  usable: zod.ZodBoolean;
1164
2405
  }, zod.ZodTypeAny, "passthrough">>>;
1165
2406
  }, zod.ZodTypeAny, "passthrough">>;
1166
- buildTasks: (opts?: ListBuildTasksOptions) => Promise<unknown>;
2407
+ buildTasks: (opts?: ListBuildTasksOptions) => Promise<zod.objectOutputType<{
2408
+ entries: zod.ZodArray<zod.ZodObject<{
2409
+ id: zod.ZodString;
2410
+ resource_id: zod.ZodString;
2411
+ resource_name: zod.ZodOptional<zod.ZodString>;
2412
+ catalog_id: zod.ZodString;
2413
+ catalog_name: zod.ZodOptional<zod.ZodString>;
2414
+ status: zod.ZodEnum<["init", "running", "stopping", "stopped", "completed", "failed"]>;
2415
+ mode: zod.ZodEnum<["batch", "streaming"]>;
2416
+ execute_type: zod.ZodOptional<zod.ZodEnum<["incremental", "full"]>>;
2417
+ total_count: zod.ZodNumber;
2418
+ synced_count: zod.ZodNumber;
2419
+ vectorized_count: zod.ZodNumber;
2420
+ synced_mark: zod.ZodString;
2421
+ error_msg: zod.ZodOptional<zod.ZodString>;
2422
+ creator: zod.ZodObject<{
2423
+ id: zod.ZodString;
2424
+ name: zod.ZodOptional<zod.ZodString>;
2425
+ type: zod.ZodString;
2426
+ }, "strip", zod.ZodTypeAny, {
2427
+ id: string;
2428
+ type: string;
2429
+ name?: string | undefined;
2430
+ }, {
2431
+ id: string;
2432
+ type: string;
2433
+ name?: string | undefined;
2434
+ }>;
2435
+ create_time: zod.ZodNumber;
2436
+ update_time: zod.ZodNumber;
2437
+ index_health: zod.ZodOptional<zod.ZodObject<{
2438
+ embedding: zod.ZodString;
2439
+ fulltext: zod.ZodString;
2440
+ usable: zod.ZodBoolean;
2441
+ }, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{
2442
+ embedding: zod.ZodString;
2443
+ fulltext: zod.ZodString;
2444
+ usable: zod.ZodBoolean;
2445
+ }, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{
2446
+ embedding: zod.ZodString;
2447
+ fulltext: zod.ZodString;
2448
+ usable: zod.ZodBoolean;
2449
+ }, zod.ZodTypeAny, "passthrough">>>;
2450
+ }, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{
2451
+ id: zod.ZodString;
2452
+ resource_id: zod.ZodString;
2453
+ resource_name: zod.ZodOptional<zod.ZodString>;
2454
+ catalog_id: zod.ZodString;
2455
+ catalog_name: zod.ZodOptional<zod.ZodString>;
2456
+ status: zod.ZodEnum<["init", "running", "stopping", "stopped", "completed", "failed"]>;
2457
+ mode: zod.ZodEnum<["batch", "streaming"]>;
2458
+ execute_type: zod.ZodOptional<zod.ZodEnum<["incremental", "full"]>>;
2459
+ total_count: zod.ZodNumber;
2460
+ synced_count: zod.ZodNumber;
2461
+ vectorized_count: zod.ZodNumber;
2462
+ synced_mark: zod.ZodString;
2463
+ error_msg: zod.ZodOptional<zod.ZodString>;
2464
+ creator: zod.ZodObject<{
2465
+ id: zod.ZodString;
2466
+ name: zod.ZodOptional<zod.ZodString>;
2467
+ type: zod.ZodString;
2468
+ }, "strip", zod.ZodTypeAny, {
2469
+ id: string;
2470
+ type: string;
2471
+ name?: string | undefined;
2472
+ }, {
2473
+ id: string;
2474
+ type: string;
2475
+ name?: string | undefined;
2476
+ }>;
2477
+ create_time: zod.ZodNumber;
2478
+ update_time: zod.ZodNumber;
2479
+ index_health: zod.ZodOptional<zod.ZodObject<{
2480
+ embedding: zod.ZodString;
2481
+ fulltext: zod.ZodString;
2482
+ usable: zod.ZodBoolean;
2483
+ }, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{
2484
+ embedding: zod.ZodString;
2485
+ fulltext: zod.ZodString;
2486
+ usable: zod.ZodBoolean;
2487
+ }, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{
2488
+ embedding: zod.ZodString;
2489
+ fulltext: zod.ZodString;
2490
+ usable: zod.ZodBoolean;
2491
+ }, zod.ZodTypeAny, "passthrough">>>;
2492
+ }, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{
2493
+ id: zod.ZodString;
2494
+ resource_id: zod.ZodString;
2495
+ resource_name: zod.ZodOptional<zod.ZodString>;
2496
+ catalog_id: zod.ZodString;
2497
+ catalog_name: zod.ZodOptional<zod.ZodString>;
2498
+ status: zod.ZodEnum<["init", "running", "stopping", "stopped", "completed", "failed"]>;
2499
+ mode: zod.ZodEnum<["batch", "streaming"]>;
2500
+ execute_type: zod.ZodOptional<zod.ZodEnum<["incremental", "full"]>>;
2501
+ total_count: zod.ZodNumber;
2502
+ synced_count: zod.ZodNumber;
2503
+ vectorized_count: zod.ZodNumber;
2504
+ synced_mark: zod.ZodString;
2505
+ error_msg: zod.ZodOptional<zod.ZodString>;
2506
+ creator: zod.ZodObject<{
2507
+ id: zod.ZodString;
2508
+ name: zod.ZodOptional<zod.ZodString>;
2509
+ type: zod.ZodString;
2510
+ }, "strip", zod.ZodTypeAny, {
2511
+ id: string;
2512
+ type: string;
2513
+ name?: string | undefined;
2514
+ }, {
2515
+ id: string;
2516
+ type: string;
2517
+ name?: string | undefined;
2518
+ }>;
2519
+ create_time: zod.ZodNumber;
2520
+ update_time: zod.ZodNumber;
2521
+ index_health: zod.ZodOptional<zod.ZodObject<{
2522
+ embedding: zod.ZodString;
2523
+ fulltext: zod.ZodString;
2524
+ usable: zod.ZodBoolean;
2525
+ }, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{
2526
+ embedding: zod.ZodString;
2527
+ fulltext: zod.ZodString;
2528
+ usable: zod.ZodBoolean;
2529
+ }, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{
2530
+ embedding: zod.ZodString;
2531
+ fulltext: zod.ZodString;
2532
+ usable: zod.ZodBoolean;
2533
+ }, zod.ZodTypeAny, "passthrough">>>;
2534
+ }, zod.ZodTypeAny, "passthrough">>, "many">;
2535
+ total_count: zod.ZodNumber;
2536
+ }, zod.ZodTypeAny, "passthrough">>;
1167
2537
  deleteBuildTasks: (ids: string[], opts?: DeleteBuildTasksOptions) => Promise<unknown>;
1168
2538
  startBuildTask: (taskId: string, opts?: {
1169
2539
  reset?: boolean;
@@ -1204,6 +2574,15 @@ declare class HttpError extends Error {
1204
2574
  readonly hint?: string;
1205
2575
  constructor(status: number, statusText: string, body: string, hint?: string);
1206
2576
  }
2577
+ /**
2578
+ * Raised when an MCP tool answers with `isError`. The transport call succeeded,
2579
+ * so this is not an {@link HttpError} — but the server's error `code` is what
2580
+ * decides whether a caller can recover, so it travels with the error.
2581
+ */
2582
+ declare class ToolError extends Error {
2583
+ readonly code?: string;
2584
+ constructor(message: string, code?: string);
2585
+ }
1207
2586
  /** Raised for bad CLI/SDK input before any request is made. */
1208
2587
  declare class InputError extends Error {
1209
2588
  constructor(message: string);
@@ -1362,6 +2741,33 @@ declare namespace auth {
1362
2741
  export { type auth_AuthStatus as AuthStatus, type auth_PlatformListItem as PlatformListItem, type auth_WhoamiResult as WhoamiResult, auth_attachToken as attachToken, auth_currentToken as currentToken, auth_currentTokenFresh as currentTokenFresh, auth_deletePlatform as deletePlatform, auth_exportCreds as exportCreds, auth_hostOf as hostOf, auth_listPlatforms as listPlatforms, auth_logout as logout, auth_status as status, auth_switchUser as switchUser, auth_use as use, auth_userIdFromToken as userIdFromToken, auth_usersOf as usersOf, auth_whoami as whoami };
1363
2742
  }
1364
2743
 
2744
+ /**
2745
+ * Directory views over a skill's file manifest.
2746
+ *
2747
+ * The backend manifest is a flat list of archive-relative paths — registration
2748
+ * drops zip directory entries — so the folder structure here is inferred from
2749
+ * the paths themselves. One consequence is inherent: a directory that holds no
2750
+ * files cannot appear, because nothing in the manifest mentions it.
2751
+ */
2752
+
2753
+ interface SkillDirChild {
2754
+ name: string;
2755
+ type: "dir";
2756
+ /** Files anywhere beneath this directory. */
2757
+ files: number;
2758
+ /** Total bytes beneath this directory. */
2759
+ size: number;
2760
+ }
2761
+ interface SkillFileChild {
2762
+ name: string;
2763
+ type: "file";
2764
+ relPath: string;
2765
+ fileType?: string;
2766
+ size?: number;
2767
+ mime?: string;
2768
+ }
2769
+ type SkillChild = SkillDirChild | SkillFileChild;
2770
+
1365
2771
  interface RequestInitEx {
1366
2772
  method?: string;
1367
2773
  /** JSON body — serialized and Content-Type set automatically. */
@@ -1369,17 +2775,20 @@ interface RequestInitEx {
1369
2775
  /** Query params appended to the path. */
1370
2776
  query?: Record<string, string | number | boolean | Array<string | number | boolean> | undefined>;
1371
2777
  headers?: Record<string, string>;
2778
+ /** Redirect policy; credential-bearing writes should use `manual`. */
2779
+ redirect?: "follow" | "error" | "manual";
1372
2780
  /** Per-request timeout; defaults to 30s. */
1373
2781
  timeoutMs?: number;
2782
+ /**
2783
+ * Raise undici's 300s response-header deadline for this request.
2784
+ *
2785
+ * Needed by any endpoint that blocks until its work finishes — it sends no
2786
+ * headers until then, so `timeoutMs` alone cannot buy more than 300s.
2787
+ */
2788
+ headersTimeoutMs?: number;
1374
2789
  }
1375
2790
  declare function request<T = unknown>(ctx: RequestContext, path: string, init?: RequestInitEx): Promise<T>;
1376
2791
 
1377
- /**
1378
- * Resolve a full RequestContext from explicit options → env → store.
1379
- * Order: caller options win, then env vars, then the active platform/user
1380
- * in `~/.bkn/`.
1381
- */
1382
-
1383
2792
  declare function resolveContext(opts?: ClientOptions): RequestContext;
1384
2793
 
1385
- export { type BknClient, BuildMode, BuildTask, type ClientOptions, CreateBuildTaskRequest, DEFAULT_BUSINESS_DOMAIN, DEFAULT_LIST_LIMIT, DEFAULT_QUERY_LIMIT, HttpError, InputError, type RequestContext, admin, agents, auth, context, createClient, dataflows, kn, models, request, resolveContext, resources, skills, toolboxes, trace, vega };
2794
+ export { type ActionSummary, type BknBusinessContext, type BknClient, type BknContext, BuildMode, BuildTask, BuildTaskSummary, type CatalogConnectionTestRequest, CatalogConnectionTestResult, CatalogHealthCheckSchedule, CatalogHealthCheckScheduleMode, type CatalogHealthCheckScheduleRequest, CatalogHealthCheckStatus, CatalogHealthStatus, type CatalogWriteOptions, type ClaimSupport, type ClientOptions, type CloseConversationInput, type ConversationPage, type ConversationStrategy, CreateBuildTaskRequest, type CreateCatalogRequest, type CreateNewConversationGenerationInput, DEFAULT_BUSINESS_DOMAIN, DEFAULT_LIST_LIMIT, DEFAULT_QUERY_LIMIT, type DslRawQueryRequest, type EnsureConversationInput, type EnsureOperationInput, type EvidenceDurability, type EvidenceReference, type ExecuteSkillOptions, type ExpectedOperation, type ExpectedReceipt, type FinishOperationAttemptInput, type GraphPage, HttpError, InputError, type InteractionCompletionInput, type LifecycleBusinessRef, type LifecycleError, type LifecycleErrorCode, type LifecycleErrorEnvelope, type LifecycleOwner, type ListBuildTasksOptions, ListBuildTasksResponse, type ListConversationsQuery, type ManagedClaim, type ManagedCompletionInput, type ManagedConversation, type ManagedInteraction, type ManagedInteractionScope, type ManagedOperation, type ManagedOperationCall, type ManagedOperationExecution, type ManagedOperationInput, type ManagedOperationResult, type ManagedToolResult, ManagedTrace, type ManagedTraceOptions, type OperationReceipt, type OperationResult, type QueryPagingMode, type RawQueryContinuationRequest, type RawQueryPaging, type RawQueryRequest, type RequestContext, type ResumeConversationInput, type RetryOperationAttemptInput, type SkillChild, type SkillContentResponse, type SkillDirChild, type SkillExecutionResult, type SkillFileChild, type SkillFileEntry, type SkillReadFileResponse, type SkillResponseMode, type SkillView, type SkillViewOptions, type SqlRawQueryRequest, type StartInteractionInput, type SupportCandidate, type ToolCallOptions, ToolError, type TraceExecutionSummary, type TraceGraphEdge, type TraceGraphNode, type TraceGraphResponse, type TraceLifecycleApi, type UpdateCatalogRequest, type VisibilitySummary, admin, agents, auth, context, createClient, dataflows, kn, models, releaseLifecycleSessions, request, resolveContext, resources, skills, toolboxes, trace, traceLifecycleApi, vega };