@openbkn/bkn-sdk 0.1.1-alpha.9 → 0.1.2
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/LICENSE +1 -0
- package/NOTICE +21 -0
- package/README.md +33 -26
- package/README.zh.md +11 -12
- package/dist/{chunk-BFE4SU3V.js → chunk-LH3ONZGQ.js} +2345 -220
- package/dist/cli.js +617 -208
- package/dist/index.d.ts +974 -81
- package/dist/index.js +3 -1
- package/package.json +6 -4
- package/dist/chunk-BFE4SU3V.js.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/index.js.map +0 -1
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;
|
|
@@ -59,12 +95,64 @@ interface RawCallResult {
|
|
|
59
95
|
}
|
|
60
96
|
|
|
61
97
|
/**
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
98
|
+
* bkn-safe admin API (`/api/safe/v1/admin/*`, token-gated; the gateway-exposed
|
|
99
|
+
* replacement for the retired ISF UserManagement / Authorization / EACP). The
|
|
100
|
+
* logged-in user must be an admin: 401 = no/invalid token, 403 = not an admin.
|
|
101
|
+
* Only `audit list` has no endpoint (login-log retired by design). Response
|
|
102
|
+
* shapes: `{users|roles|departments, total}`; department `parent_id` (not the
|
|
103
|
+
* ISF `parent_deps[]`). See docs/exec-plans/admin-bkn-safe-migration.md.
|
|
104
|
+
* Also carries the cluster license hub (`/admin/license/*`, issue #224).
|
|
66
105
|
*/
|
|
67
106
|
|
|
107
|
+
/** licverify judgement states. `invalid` also covers "no license installed". */
|
|
108
|
+
type LicenseState = "valid" | "grace" | "fallback_community" | "invalid";
|
|
109
|
+
/** GET /admin/license response (admin detail view). */
|
|
110
|
+
interface LicenseDetail {
|
|
111
|
+
state: LicenseState;
|
|
112
|
+
/** Whether the installed license is fingerprint-bound to this instance. */
|
|
113
|
+
activated: boolean;
|
|
114
|
+
/** This cluster's machine code (present even with no license installed). */
|
|
115
|
+
instance_fp: string;
|
|
116
|
+
error?: string;
|
|
117
|
+
/** Background auto-renew failure — license itself may still be valid. */
|
|
118
|
+
renew_error?: string;
|
|
119
|
+
edition?: string;
|
|
120
|
+
lic_id?: string;
|
|
121
|
+
customer?: {
|
|
122
|
+
name?: string;
|
|
123
|
+
[k: string]: unknown;
|
|
124
|
+
};
|
|
125
|
+
/** Unix seconds; expires_at 0 = never expires (community). */
|
|
126
|
+
issued_at?: number;
|
|
127
|
+
expires_at?: number;
|
|
128
|
+
contract_expires_at?: number;
|
|
129
|
+
/** Only present in `grace` state. */
|
|
130
|
+
grace_remaining_days?: number;
|
|
131
|
+
features?: string[];
|
|
132
|
+
limits?: Record<string, number>;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Import outcome. Plain success = the stored license's detail. `stored: true`
|
|
136
|
+
* = the .lic was verified and stored, but issuer activation failed (HTTP
|
|
137
|
+
* 409/502) — both facts matter, the import is not lost.
|
|
138
|
+
*/
|
|
139
|
+
type LicenseImportResult = LicenseDetail | {
|
|
140
|
+
stored: true;
|
|
141
|
+
error: string;
|
|
142
|
+
license: LicenseDetail;
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Admin (operator) input shapes — the CLI-facing contract for the `admin`
|
|
147
|
+
* command group. `src/resources/admin.ts` maps each of these onto the bkn-safe
|
|
148
|
+
* client in `./safe.ts`, which is where the requests live.
|
|
149
|
+
*
|
|
150
|
+
* The ISF clients that used to back these types (`/api/user-management/v1`,
|
|
151
|
+
* `/api/authorization/v1`, `/isfweb/api/ShareMgnt`, `/api/eacp/v1`) were removed
|
|
152
|
+
* once ISF was retired — see docs/exec-plans/admin-bkn-safe-migration.md. Some
|
|
153
|
+
* fields here are wider than bkn-safe accepts and are dropped in the mapping;
|
|
154
|
+
* that lossiness is documented in the migration plan.
|
|
155
|
+
*/
|
|
68
156
|
interface AdminListOptions {
|
|
69
157
|
role?: string;
|
|
70
158
|
offset?: number;
|
|
@@ -184,6 +272,17 @@ declare function admin(ctx: RequestContext): {
|
|
|
184
272
|
ok: true;
|
|
185
273
|
}>;
|
|
186
274
|
auditList: (_opts?: AuditListOptions) => never;
|
|
275
|
+
licenseGet: () => Promise<LicenseDetail>;
|
|
276
|
+
licenseImport: (licenseText: string, opts?: {
|
|
277
|
+
receipt?: boolean;
|
|
278
|
+
}) => Promise<LicenseImportResult>;
|
|
279
|
+
licenseActivate: () => Promise<LicenseDetail>;
|
|
280
|
+
licenseRemove: () => Promise<{
|
|
281
|
+
ok: true;
|
|
282
|
+
}>;
|
|
283
|
+
licenseFingerprint: () => Promise<{
|
|
284
|
+
instance_fp: string;
|
|
285
|
+
}>;
|
|
187
286
|
};
|
|
188
287
|
|
|
189
288
|
interface ChatResult {
|
|
@@ -197,8 +296,10 @@ interface SendChatOptions {
|
|
|
197
296
|
}
|
|
198
297
|
|
|
199
298
|
/**
|
|
200
|
-
* Agent client (agent-factory v3). Read side + published listing
|
|
201
|
-
*
|
|
299
|
+
* Agent client (agent-factory v3). Read side + published listing.
|
|
300
|
+
* Responses passed through as parsed JSON.
|
|
301
|
+
* @deprecated The Decision Agent (agent-factory) surface is being phased out and
|
|
302
|
+
* may be removed in a future release. Avoid building new integrations on it.
|
|
202
303
|
*/
|
|
203
304
|
|
|
204
305
|
interface ListAgentsOptions {
|
|
@@ -215,6 +316,11 @@ interface PagingOptions {
|
|
|
215
316
|
name?: string;
|
|
216
317
|
}
|
|
217
318
|
|
|
319
|
+
/**
|
|
320
|
+
* Decision Agent resource surface.
|
|
321
|
+
* @deprecated The Decision Agent (agent-factory) surface is being phased out and
|
|
322
|
+
* may be removed in a future release. Avoid building new integrations on it.
|
|
323
|
+
*/
|
|
218
324
|
declare function agents(ctx: RequestContext): {
|
|
219
325
|
list: (opts?: ListAgentsOptions) => Promise<unknown>;
|
|
220
326
|
get: (agentId: string) => Promise<unknown>;
|
|
@@ -246,16 +352,68 @@ declare function agents(ctx: RequestContext): {
|
|
|
246
352
|
};
|
|
247
353
|
|
|
248
354
|
/**
|
|
249
|
-
*
|
|
250
|
-
*
|
|
251
|
-
*
|
|
252
|
-
*
|
|
355
|
+
* AppKey API (`/api/safe/v1/{me,admin}/api-keys`, OAuth-token-gated). AppKeys
|
|
356
|
+
* are user-issued long-lived credentials (prefix `bak_`) that authenticate AS
|
|
357
|
+
* their owner — downstream authorization is identical to that owner's OAuth
|
|
358
|
+
* token. Issuing/managing them needs a real OAuth session (an AppKey itself
|
|
359
|
+
* cannot mint AppKeys). The plaintext `key` is returned ONCE, on create.
|
|
360
|
+
* Usage of an AppKey is drop-in: pass it as the bearer `--token` against the
|
|
361
|
+
* Context Loader (agent-retrieval) MCP/REST surface. See issue #75.
|
|
253
362
|
*/
|
|
254
363
|
|
|
364
|
+
/** A key's public metadata — never carries the secret. */
|
|
365
|
+
interface ApiKey {
|
|
366
|
+
id: string;
|
|
367
|
+
key_id: string;
|
|
368
|
+
name: string;
|
|
369
|
+
/** Masked preview for display, e.g. `bak_b3ff****b234` — safe to show in lists. */
|
|
370
|
+
masked: string;
|
|
371
|
+
enabled: boolean;
|
|
372
|
+
/** `null` = never expires. */
|
|
373
|
+
expires_at: string | null;
|
|
374
|
+
/** `null` = never used (zombie-key signal). */
|
|
375
|
+
last_used_at: string | null;
|
|
376
|
+
created_at: string;
|
|
377
|
+
/** Present only on the admin list. */
|
|
378
|
+
owner_user_id?: string;
|
|
379
|
+
}
|
|
380
|
+
/** Create response — `key` is the full plaintext, shown only this once. */
|
|
381
|
+
interface CreatedApiKey extends ApiKey {
|
|
382
|
+
key: string;
|
|
383
|
+
}
|
|
384
|
+
interface CreateApiKeyInput {
|
|
385
|
+
name: string;
|
|
386
|
+
/** RFC3339; omit = backend default (1 year). Must be in the future. */
|
|
387
|
+
expiresAt?: string;
|
|
388
|
+
/** `true` = never expire (wins over `expiresAt`). */
|
|
389
|
+
neverExpire?: boolean;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
declare function appKeys(ctx: RequestContext): {
|
|
393
|
+
/** List the caller's own keys (no secrets). */
|
|
394
|
+
list: () => Promise<{
|
|
395
|
+
keys: ApiKey[];
|
|
396
|
+
}>;
|
|
397
|
+
/** Issue a key — the result's `key` is the plaintext, shown only once. */
|
|
398
|
+
create: (input: CreateApiKeyInput) => Promise<CreatedApiKey>;
|
|
399
|
+
/** Revoke one of the caller's keys (immediate). */
|
|
400
|
+
revoke: (id: string) => Promise<void>;
|
|
401
|
+
/** Rotate a key in place — new plaintext (shown once); old secret dies now. */
|
|
402
|
+
regenerate: (id: string) => Promise<CreatedApiKey>;
|
|
403
|
+
/** Admin: list all keys, or one owner's (adds `owner_user_id`). */
|
|
404
|
+
adminList: (ownerId?: string) => Promise<{
|
|
405
|
+
keys: ApiKey[];
|
|
406
|
+
}>;
|
|
407
|
+
/** Admin: revoke any key. */
|
|
408
|
+
adminRevoke: (id: string) => Promise<void>;
|
|
409
|
+
};
|
|
410
|
+
|
|
255
411
|
interface SearchSchemaOptions {
|
|
256
412
|
searchScope?: string[];
|
|
257
413
|
maxConcepts?: number;
|
|
258
414
|
}
|
|
415
|
+
/** Progressive KN-detail disclosure level: `summary` (skeleton + property names) | `full`. */
|
|
416
|
+
type DetailLevel = "summary" | "full";
|
|
259
417
|
|
|
260
418
|
/** Context-loader resource surface (MCP over agent-retrieval). */
|
|
261
419
|
|
|
@@ -263,8 +421,13 @@ declare function context(ctx: RequestContext): {
|
|
|
263
421
|
searchSchema: (knId: string, query: string, opts?: SearchSchemaOptions) => Promise<unknown>;
|
|
264
422
|
queryObjectInstance: (knId: string, args: Record<string, unknown>) => Promise<unknown>;
|
|
265
423
|
findSkills: (knId: string, objectTypeId: string, topK?: number) => Promise<unknown>;
|
|
424
|
+
knDetail: (knId: string, detailLevel?: DetailLevel) => Promise<unknown>;
|
|
425
|
+
objectTypes: (knId: string, ids: string[]) => Promise<unknown>;
|
|
426
|
+
relationTypes: (knId: string, ids: string[]) => Promise<unknown>;
|
|
427
|
+
info: () => Promise<unknown>;
|
|
266
428
|
tools: (knId: string) => Promise<unknown>;
|
|
267
429
|
toolCall: (knId: string, name: string, args: Record<string, unknown>) => Promise<unknown>;
|
|
430
|
+
callMethod: (knId: string, method: string, params?: Record<string, unknown>) => Promise<unknown>;
|
|
268
431
|
queryInstanceSubgraph: (knId: string, args: Record<string, unknown>) => Promise<unknown>;
|
|
269
432
|
logicProperties: (knId: string, args: Record<string, unknown>) => Promise<unknown>;
|
|
270
433
|
actionInfo: (knId: string, args: Record<string, unknown>) => Promise<unknown>;
|
|
@@ -286,12 +449,14 @@ interface TemplateArg {
|
|
|
286
449
|
|
|
287
450
|
/**
|
|
288
451
|
* Dataflow backend client (automation v2). Read endpoints (list/runs/logs) are
|
|
289
|
-
* implemented
|
|
452
|
+
* implemented; trigger/create bodies are deferred until the
|
|
290
453
|
* contract is verified on a live env. Responses passed through as parsed JSON.
|
|
291
454
|
*/
|
|
292
455
|
|
|
293
456
|
interface ListRunsOptions {
|
|
294
457
|
since?: string;
|
|
458
|
+
page?: number;
|
|
459
|
+
limit?: number;
|
|
295
460
|
}
|
|
296
461
|
interface LogsOptions {
|
|
297
462
|
page?: number;
|
|
@@ -318,7 +483,7 @@ declare function dataflows(ctx: RequestContext): {
|
|
|
318
483
|
|
|
319
484
|
/**
|
|
320
485
|
* Knowledge-network backend client (ontology-manager + agent-retrieval).
|
|
321
|
-
*
|
|
486
|
+
* Responses are passed through as parsed JSON
|
|
322
487
|
* (shapes vary by backend version — validate at higher layers as needed).
|
|
323
488
|
*/
|
|
324
489
|
|
|
@@ -365,7 +530,7 @@ interface CreateFromCatalogOptions {
|
|
|
365
530
|
tables?: string[];
|
|
366
531
|
pkMap?: Record<string, string>;
|
|
367
532
|
build?: boolean;
|
|
368
|
-
/** Per-table resource columns to vectorize (sets
|
|
533
|
+
/** Per-table resource columns to vectorize (sets resource schema index features). */
|
|
369
534
|
embeddingFields?: Record<string, string[]>;
|
|
370
535
|
embeddingModel?: string;
|
|
371
536
|
noRollback?: boolean;
|
|
@@ -413,7 +578,6 @@ declare function kn(ctx: RequestContext): {
|
|
|
413
578
|
metricValidate: (knId: string, body: unknown) => Promise<unknown>;
|
|
414
579
|
objectTypes: (knId: string, opts?: ListSchemaOptions) => Promise<unknown>;
|
|
415
580
|
objectTypeQuery: (knId: string, otId: string, body: unknown) => Promise<unknown>;
|
|
416
|
-
objectTypeProperties: (knId: string, otId: string) => Promise<unknown>;
|
|
417
581
|
objectTypeGet: (knId: string, id: string) => Promise<unknown>;
|
|
418
582
|
objectTypeCreate: (knId: string, body: unknown) => Promise<unknown>;
|
|
419
583
|
objectTypeUpdate: (knId: string, id: string, body: unknown) => Promise<unknown>;
|
|
@@ -441,10 +605,6 @@ declare function kn(ctx: RequestContext): {
|
|
|
441
605
|
actionScheduleUpdate: (knId: string, scheduleId: string, body: unknown) => Promise<unknown>;
|
|
442
606
|
actionScheduleSetStatus: (knId: string, scheduleId: string, body: unknown) => Promise<unknown>;
|
|
443
607
|
actionScheduleDelete: (knId: string, ids: string) => Promise<unknown>;
|
|
444
|
-
jobs: (knId: string) => Promise<unknown>;
|
|
445
|
-
job: (knId: string, jobId: string) => Promise<unknown>;
|
|
446
|
-
jobTasks: (knId: string, jobId: string) => Promise<unknown>;
|
|
447
|
-
jobDelete: (knId: string, ids: string) => Promise<unknown>;
|
|
448
608
|
relationTypePaths: (knId: string, body: unknown) => Promise<unknown>;
|
|
449
609
|
bknResources: () => Promise<unknown>;
|
|
450
610
|
createFromCatalog: (opts: CreateFromCatalogOptions) => Promise<unknown>;
|
|
@@ -492,6 +652,8 @@ declare function models(ctx: RequestContext): {
|
|
|
492
652
|
edit: (body: unknown) => Promise<unknown>;
|
|
493
653
|
delete: (modelIds: string[]) => Promise<unknown>;
|
|
494
654
|
test: (body: unknown) => Promise<unknown>;
|
|
655
|
+
/** Set (or clear) the system default LLM. */
|
|
656
|
+
setDefault: (modelId: string, isDefault?: boolean) => Promise<unknown>;
|
|
495
657
|
};
|
|
496
658
|
small: {
|
|
497
659
|
list: (opts?: ListModelsOptions) => Promise<unknown>;
|
|
@@ -502,30 +664,101 @@ declare function models(ctx: RequestContext): {
|
|
|
502
664
|
edit: (body: unknown) => Promise<unknown>;
|
|
503
665
|
delete: (modelIds: string[]) => Promise<unknown>;
|
|
504
666
|
test: (body: unknown) => Promise<unknown>;
|
|
667
|
+
/** Set (or clear) the system default small model (type inferred from the model). */
|
|
668
|
+
setDefault: (modelId: string, isDefault?: boolean) => Promise<unknown>;
|
|
669
|
+
/** Get the system default small model for a type (default "embedding"). */
|
|
670
|
+
getDefault: (modelType?: string) => Promise<unknown>;
|
|
505
671
|
};
|
|
506
672
|
};
|
|
507
673
|
|
|
508
674
|
/**
|
|
509
|
-
* Vega-backend resource client (list/find/get/query/delete).
|
|
510
|
-
*
|
|
675
|
+
* Vega-backend resource client (list/find/get/query/delete).
|
|
676
|
+
* Responses passed through as parsed JSON.
|
|
511
677
|
*/
|
|
512
678
|
|
|
679
|
+
interface PropertyFeature {
|
|
680
|
+
name?: string;
|
|
681
|
+
display_name?: string;
|
|
682
|
+
feature_type: "keyword" | "fulltext" | "vector" | string;
|
|
683
|
+
description?: string;
|
|
684
|
+
ref_property?: string;
|
|
685
|
+
is_default?: boolean;
|
|
686
|
+
is_native?: boolean;
|
|
687
|
+
config?: Record<string, unknown>;
|
|
688
|
+
}
|
|
689
|
+
interface ResourceProperty {
|
|
690
|
+
name: string;
|
|
691
|
+
display_name?: string;
|
|
692
|
+
type?: string;
|
|
693
|
+
description?: string;
|
|
694
|
+
original_name?: string;
|
|
695
|
+
original_type?: string;
|
|
696
|
+
original_description?: string;
|
|
697
|
+
features?: PropertyFeature[];
|
|
698
|
+
attributes?: Record<string, unknown>;
|
|
699
|
+
extensions?: Record<string, string>;
|
|
700
|
+
}
|
|
701
|
+
interface ResourceIndexConfig {
|
|
702
|
+
build_key_fields?: string[];
|
|
703
|
+
default_fulltext_analyzer?: string;
|
|
704
|
+
default_embedding_model?: string;
|
|
705
|
+
}
|
|
513
706
|
interface ListResourcesOptions {
|
|
514
707
|
datasourceId?: string;
|
|
515
708
|
name?: string;
|
|
516
709
|
/** Resource category, e.g. table | logicview. */
|
|
517
710
|
category?: string;
|
|
711
|
+
status?: string;
|
|
712
|
+
database?: string;
|
|
518
713
|
limit?: number;
|
|
714
|
+
offset?: number;
|
|
715
|
+
sort?: "name" | "create_time" | "update_time" | string;
|
|
716
|
+
direction?: "asc" | "desc";
|
|
717
|
+
includeExtensions?: boolean;
|
|
718
|
+
includeExtensionKeys?: string;
|
|
719
|
+
extensionPairs?: Array<{
|
|
720
|
+
key: string;
|
|
721
|
+
value: string;
|
|
722
|
+
}>;
|
|
519
723
|
}
|
|
724
|
+
interface UpdateResourceOptions {
|
|
725
|
+
name?: string;
|
|
726
|
+
catalogId?: string;
|
|
727
|
+
tags?: string[];
|
|
728
|
+
description?: string;
|
|
729
|
+
category?: string;
|
|
730
|
+
status?: string;
|
|
731
|
+
database?: string;
|
|
732
|
+
sourceIdentifier?: string;
|
|
733
|
+
sourceMetadata?: Record<string, unknown>;
|
|
734
|
+
schemaDefinition?: ResourceProperty[];
|
|
735
|
+
indexConfig?: ResourceIndexConfig | null;
|
|
736
|
+
logicDefinition?: unknown;
|
|
737
|
+
extensions?: Record<string, string>;
|
|
738
|
+
}
|
|
739
|
+
interface ConfigureResourceIndexOptions {
|
|
740
|
+
buildKeyFields?: string[];
|
|
741
|
+
embeddingFields?: string[];
|
|
742
|
+
embeddingModel?: string;
|
|
743
|
+
fulltextFields?: string[];
|
|
744
|
+
fulltextAnalyzer?: string;
|
|
745
|
+
}
|
|
746
|
+
declare function configureResourceIndex(ctx: RequestContext, id: string, opts: ConfigureResourceIndexOptions): Promise<unknown>;
|
|
520
747
|
interface FindResourceOptions {
|
|
521
748
|
datasourceId?: string;
|
|
522
749
|
/** Exact name match instead of fuzzy. */
|
|
523
750
|
exact?: boolean;
|
|
751
|
+
/** Rows to fetch before filtering; `-1` = all. Defaults to the list default. */
|
|
752
|
+
limit?: number;
|
|
524
753
|
}
|
|
525
754
|
interface QueryResourceOptions {
|
|
526
755
|
limit?: number;
|
|
527
756
|
offset?: number;
|
|
528
757
|
needTotal?: boolean;
|
|
758
|
+
pagingMode?: "single" | "cursor";
|
|
759
|
+
keepAliveSec?: number;
|
|
760
|
+
/** Opaque cursor returned by the preceding resource data page. */
|
|
761
|
+
cursor?: string;
|
|
529
762
|
}
|
|
530
763
|
|
|
531
764
|
/** Resource surface (the exported SDK API) over vega-backend resources. */
|
|
@@ -534,6 +767,8 @@ declare function resources(ctx: RequestContext): {
|
|
|
534
767
|
list: (opts?: ListResourcesOptions) => Promise<unknown>;
|
|
535
768
|
get: (id: string) => Promise<unknown>;
|
|
536
769
|
delete: (id: string) => Promise<unknown>;
|
|
770
|
+
update: (id: string, patch: UpdateResourceOptions) => Promise<unknown>;
|
|
771
|
+
configureIndex: (id: string, opts: Parameters<typeof configureResourceIndex>[2]) => Promise<unknown>;
|
|
537
772
|
find: (name: string, opts?: FindResourceOptions) => Promise<unknown>;
|
|
538
773
|
query: (id: string, opts?: QueryResourceOptions) => Promise<unknown>;
|
|
539
774
|
};
|
|
@@ -588,6 +823,11 @@ interface ListToolboxesOptions {
|
|
|
588
823
|
limit?: number;
|
|
589
824
|
offset?: number;
|
|
590
825
|
}
|
|
826
|
+
interface ListToolsOptions {
|
|
827
|
+
page?: number;
|
|
828
|
+
pageSize?: number;
|
|
829
|
+
all?: boolean;
|
|
830
|
+
}
|
|
591
831
|
interface CreateToolboxOptions {
|
|
592
832
|
name: string;
|
|
593
833
|
serviceUrl: string;
|
|
@@ -604,7 +844,7 @@ interface ToolInvokeEnvelope {
|
|
|
604
844
|
|
|
605
845
|
declare function toolboxes(ctx: RequestContext): {
|
|
606
846
|
list: (opts?: ListToolboxesOptions) => Promise<unknown>;
|
|
607
|
-
tools: (boxId: string) => Promise<unknown>;
|
|
847
|
+
tools: (boxId: string, opts?: ListToolsOptions) => Promise<unknown>;
|
|
608
848
|
create: (opts: CreateToolboxOptions) => Promise<unknown>;
|
|
609
849
|
delete: (boxId: string) => Promise<unknown>;
|
|
610
850
|
publish: (boxId: string) => Promise<unknown>;
|
|
@@ -623,6 +863,275 @@ declare function toolboxes(ctx: RequestContext): {
|
|
|
623
863
|
debug: (boxId: string, toolId: string, e?: ToolInvokeEnvelope) => Promise<unknown>;
|
|
624
864
|
};
|
|
625
865
|
|
|
866
|
+
interface FixtureValidationError {
|
|
867
|
+
code: string;
|
|
868
|
+
path: string;
|
|
869
|
+
message: string;
|
|
870
|
+
}
|
|
871
|
+
interface FixtureValidationResult {
|
|
872
|
+
fixtureId: string;
|
|
873
|
+
result: "pass" | "fail";
|
|
874
|
+
contractVersion: string | null;
|
|
875
|
+
errors: FixtureValidationError[];
|
|
876
|
+
warnings: string[];
|
|
877
|
+
expectedResult: "pass" | "fail" | null;
|
|
878
|
+
expectationMatched: boolean;
|
|
879
|
+
}
|
|
880
|
+
interface FixturePathValidationResult {
|
|
881
|
+
ok: boolean;
|
|
882
|
+
results: FixtureValidationResult[];
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
/**
|
|
886
|
+
* BKN Trace client (agent-observability). Implements raw trace search and a
|
|
887
|
+
* two-hop "spans by conversation" fetch. The full
|
|
888
|
+
* diagnose/eval-set rule engine (LLM-as-judge) is a separate large feature and
|
|
889
|
+
* is NOT included here — see docs/exec-plans/tech-debt-tracker.md.
|
|
890
|
+
*/
|
|
891
|
+
|
|
892
|
+
interface EvidenceTraceContext {
|
|
893
|
+
trace_id: string;
|
|
894
|
+
traceparent: string;
|
|
895
|
+
"bkn.request.id": string;
|
|
896
|
+
"bkn.conversation.id"?: string;
|
|
897
|
+
"bkn.tenant.id"?: string;
|
|
898
|
+
business_domain?: string;
|
|
899
|
+
"bkn.account.id": string;
|
|
900
|
+
"bkn.account.type": string;
|
|
901
|
+
}
|
|
902
|
+
type BusinessEvidenceEventType = "agent.interaction.started" | "retrieval.completed" | "knowledge.read.observed" | "data.query.observed" | "logic.execution.observed" | "model.call.observed" | "tool.called" | "tool.result.observed" | "claim.created" | "evidence.refs.created" | "business.refs.resolved" | "action.recommended" | "action.approval_requested" | "action.approved" | "action.rejected" | "action.executed" | "action.result_recorded";
|
|
903
|
+
interface EvidenceEvent {
|
|
904
|
+
event_id: string;
|
|
905
|
+
event_type: BusinessEvidenceEventType | (string & {});
|
|
906
|
+
"bkn.trace.schema.version": string;
|
|
907
|
+
observed_at: string;
|
|
908
|
+
emitted_at: string;
|
|
909
|
+
producer_module: string;
|
|
910
|
+
trace_id: string;
|
|
911
|
+
span_id: string;
|
|
912
|
+
"bkn.request.id": string;
|
|
913
|
+
"bkn.operation.name": string;
|
|
914
|
+
interaction_id?: string;
|
|
915
|
+
operation_id?: string;
|
|
916
|
+
causation_event_id?: string;
|
|
917
|
+
claim_id?: string;
|
|
918
|
+
attempt?: number;
|
|
919
|
+
payload: Record<string, unknown>;
|
|
920
|
+
}
|
|
921
|
+
interface EvidenceIngestRequest {
|
|
922
|
+
"bkn.trace.schema.version": "2.0.0" | "2.1.0" | "2.2.0";
|
|
923
|
+
trace: EvidenceTraceContext;
|
|
924
|
+
events: EvidenceEvent[];
|
|
925
|
+
}
|
|
926
|
+
type EvidenceArtifactType = "action_input" | "action_result" | "data_result" | "logic_execution" | "query" | "question" | "result";
|
|
927
|
+
interface EvidenceArtifact {
|
|
928
|
+
artifact_id: string;
|
|
929
|
+
artifact_type: EvidenceArtifactType;
|
|
930
|
+
"bkn.request.id": string;
|
|
931
|
+
trace_id?: string;
|
|
932
|
+
interaction_id?: string;
|
|
933
|
+
operation_id?: string;
|
|
934
|
+
claim_id?: string;
|
|
935
|
+
source_ref?: string;
|
|
936
|
+
business_refs?: string[];
|
|
937
|
+
content_type: string;
|
|
938
|
+
schema_version: "2.2.0";
|
|
939
|
+
observed_at: string;
|
|
940
|
+
as_of?: string;
|
|
941
|
+
source_version?: string;
|
|
942
|
+
content_hash: string;
|
|
943
|
+
content?: unknown;
|
|
944
|
+
snapshot_ref?: string;
|
|
945
|
+
"bkn.tenant.id"?: string;
|
|
946
|
+
business_domain?: string;
|
|
947
|
+
"bkn.account.id": string;
|
|
948
|
+
"bkn.account.type": string;
|
|
949
|
+
initiator?: string;
|
|
950
|
+
agent_or_app?: string;
|
|
951
|
+
}
|
|
952
|
+
interface EvidenceArtifactIngestResponse {
|
|
953
|
+
artifact_id: string;
|
|
954
|
+
artifact_type: EvidenceArtifactType;
|
|
955
|
+
"bkn.request.id": string;
|
|
956
|
+
trace_id?: string;
|
|
957
|
+
content_hash: string;
|
|
958
|
+
created: boolean;
|
|
959
|
+
}
|
|
960
|
+
interface ActionSummary {
|
|
961
|
+
recommended: number;
|
|
962
|
+
approved: number;
|
|
963
|
+
executed: number;
|
|
964
|
+
completed: number;
|
|
965
|
+
last_status?: string;
|
|
966
|
+
}
|
|
967
|
+
interface RequestSummary {
|
|
968
|
+
request_id: string;
|
|
969
|
+
conversation_id?: string;
|
|
970
|
+
interaction_id?: string;
|
|
971
|
+
started_at?: string;
|
|
972
|
+
completed_at?: string;
|
|
973
|
+
initiator?: string;
|
|
974
|
+
agent_or_app?: string;
|
|
975
|
+
business_domain?: string;
|
|
976
|
+
knowledge_networks?: string[];
|
|
977
|
+
question_preview?: string;
|
|
978
|
+
result_preview?: string;
|
|
979
|
+
status: string;
|
|
980
|
+
evidence_completeness: string;
|
|
981
|
+
partial_reasons?: string[];
|
|
982
|
+
business_refs?: string[];
|
|
983
|
+
action_summary: Partial<ActionSummary>;
|
|
984
|
+
trace_count: number;
|
|
985
|
+
duration_ms?: number;
|
|
986
|
+
error_summary?: string;
|
|
987
|
+
}
|
|
988
|
+
interface TraceExecutionSummary {
|
|
989
|
+
trace_id: string;
|
|
990
|
+
request_id: string;
|
|
991
|
+
conversation_id?: string;
|
|
992
|
+
interaction_id?: string;
|
|
993
|
+
started_at?: string;
|
|
994
|
+
completed_at?: string;
|
|
995
|
+
agent_or_app?: string;
|
|
996
|
+
business_domain?: string;
|
|
997
|
+
root_operation?: string;
|
|
998
|
+
status: string;
|
|
999
|
+
span_count: number;
|
|
1000
|
+
duration_ms?: number;
|
|
1001
|
+
error_summary?: string;
|
|
1002
|
+
}
|
|
1003
|
+
interface SummaryPage<T> {
|
|
1004
|
+
entries: T[];
|
|
1005
|
+
total: number;
|
|
1006
|
+
next_cursor?: string | null;
|
|
1007
|
+
truncated: boolean;
|
|
1008
|
+
partial: boolean;
|
|
1009
|
+
partial_reasons?: string[];
|
|
1010
|
+
}
|
|
1011
|
+
interface RequestSummaryQuery {
|
|
1012
|
+
limit?: number;
|
|
1013
|
+
cursor?: string;
|
|
1014
|
+
from?: string;
|
|
1015
|
+
to?: string;
|
|
1016
|
+
status?: string;
|
|
1017
|
+
agentOrApp?: string;
|
|
1018
|
+
businessDomain?: string;
|
|
1019
|
+
conversationId?: string;
|
|
1020
|
+
interactionId?: string;
|
|
1021
|
+
knowledgeNetwork?: string;
|
|
1022
|
+
evidenceCompleteness?: string;
|
|
1023
|
+
keyword?: string;
|
|
1024
|
+
}
|
|
1025
|
+
interface InteractionSummary {
|
|
1026
|
+
interaction_id: string;
|
|
1027
|
+
conversation_id?: string;
|
|
1028
|
+
started_at?: string;
|
|
1029
|
+
completed_at?: string;
|
|
1030
|
+
status: string;
|
|
1031
|
+
duration_ms?: number;
|
|
1032
|
+
requests: RequestSummary[];
|
|
1033
|
+
traces: TraceExecutionSummary[];
|
|
1034
|
+
}
|
|
1035
|
+
interface EvidenceIngestResponse {
|
|
1036
|
+
trace_id: string;
|
|
1037
|
+
"bkn.request.id": string;
|
|
1038
|
+
"bkn.trace.schema.version": string;
|
|
1039
|
+
accepted_event_count: number;
|
|
1040
|
+
claim_count: number;
|
|
1041
|
+
evidence_ref_count: number;
|
|
1042
|
+
business_ref_count: number;
|
|
1043
|
+
}
|
|
1044
|
+
interface VisibilitySummary {
|
|
1045
|
+
authorized_ref_count: number;
|
|
1046
|
+
redacted_ref_count: number;
|
|
1047
|
+
hidden_ref_count: number;
|
|
1048
|
+
omitted_ref_count: number;
|
|
1049
|
+
unresolved_ref_count: number;
|
|
1050
|
+
unauthorized_ref_count?: number;
|
|
1051
|
+
}
|
|
1052
|
+
interface GraphPage {
|
|
1053
|
+
node_count: number;
|
|
1054
|
+
edge_count: number;
|
|
1055
|
+
truncated?: boolean;
|
|
1056
|
+
next_cursor?: string | null;
|
|
1057
|
+
}
|
|
1058
|
+
interface TraceGraphNode {
|
|
1059
|
+
span_id: string;
|
|
1060
|
+
parent_span_id?: string;
|
|
1061
|
+
name: string;
|
|
1062
|
+
kind: string;
|
|
1063
|
+
service_name?: string;
|
|
1064
|
+
status: string;
|
|
1065
|
+
error_message?: string;
|
|
1066
|
+
start_nano: number;
|
|
1067
|
+
end_nano: number;
|
|
1068
|
+
duration_nano: number;
|
|
1069
|
+
}
|
|
1070
|
+
interface TraceGraphEdge {
|
|
1071
|
+
id: string;
|
|
1072
|
+
parent_span_id: string;
|
|
1073
|
+
child_span_id: string;
|
|
1074
|
+
edge_type: string;
|
|
1075
|
+
}
|
|
1076
|
+
interface TraceGraphResponse {
|
|
1077
|
+
trace_id: string;
|
|
1078
|
+
status: string;
|
|
1079
|
+
duration_nano: number;
|
|
1080
|
+
partial: boolean;
|
|
1081
|
+
partial_reason: string[];
|
|
1082
|
+
page: GraphPage;
|
|
1083
|
+
data: {
|
|
1084
|
+
nodes: TraceGraphNode[];
|
|
1085
|
+
edges: TraceGraphEdge[];
|
|
1086
|
+
};
|
|
1087
|
+
}
|
|
1088
|
+
interface EvidenceChainResponse {
|
|
1089
|
+
trace_id: string;
|
|
1090
|
+
"bkn.request.id": string;
|
|
1091
|
+
partial: boolean;
|
|
1092
|
+
partial_reason: string[];
|
|
1093
|
+
visibility_summary: VisibilitySummary;
|
|
1094
|
+
page: GraphPage;
|
|
1095
|
+
data: {
|
|
1096
|
+
claims: Array<Record<string, unknown>>;
|
|
1097
|
+
evidence_refs: Array<Record<string, unknown>>;
|
|
1098
|
+
business_refs: Array<Record<string, unknown>>;
|
|
1099
|
+
};
|
|
1100
|
+
}
|
|
1101
|
+
interface BusinessGraphResponse {
|
|
1102
|
+
trace_id: string;
|
|
1103
|
+
"bkn.request.id": string;
|
|
1104
|
+
partial: boolean;
|
|
1105
|
+
partial_reason: string[];
|
|
1106
|
+
visibility_summary: VisibilitySummary;
|
|
1107
|
+
page: GraphPage;
|
|
1108
|
+
data: {
|
|
1109
|
+
nodes: Array<Record<string, unknown>>;
|
|
1110
|
+
edges: Array<Record<string, unknown>>;
|
|
1111
|
+
};
|
|
1112
|
+
}
|
|
1113
|
+
interface SnapshotPreviewResponse {
|
|
1114
|
+
trace_id: string;
|
|
1115
|
+
"bkn.request.id": string;
|
|
1116
|
+
partial: boolean;
|
|
1117
|
+
partial_reason: string[];
|
|
1118
|
+
visibility_summary: VisibilitySummary;
|
|
1119
|
+
snapshot_ref: {
|
|
1120
|
+
snapshot_id: string;
|
|
1121
|
+
mode: "preview" | string;
|
|
1122
|
+
uri?: string;
|
|
1123
|
+
};
|
|
1124
|
+
manifest: Record<string, unknown>;
|
|
1125
|
+
}
|
|
1126
|
+
type TraceScope = string | {
|
|
1127
|
+
traceId: string;
|
|
1128
|
+
} | {
|
|
1129
|
+
requestId: string;
|
|
1130
|
+
};
|
|
1131
|
+
interface TraceQueryOptions {
|
|
1132
|
+
limit?: number;
|
|
1133
|
+
}
|
|
1134
|
+
|
|
626
1135
|
/**
|
|
627
1136
|
* Trace diagnose engine. Fetches a conversation's spans, shapes them into a
|
|
628
1137
|
* trace tree, runs deterministic symbolic predicates, and (in hybrid mode) adds
|
|
@@ -667,8 +1176,8 @@ interface DiagnoseReport {
|
|
|
667
1176
|
* agent, fetches the resulting trace, and checks each assertion. Deterministic
|
|
668
1177
|
* assertion kinds (contains, regex, tool-call count/order, latency) need no LLM;
|
|
669
1178
|
* `semantic_match` reuses the local-claude judge. Builder lifts cases from a
|
|
670
|
-
* queries file (JSON). The diagnosis-report lift + YAML shards + redaction
|
|
671
|
-
*
|
|
1179
|
+
* queries file (JSON). The diagnosis-report lift + YAML shards + redaction
|
|
1180
|
+
* are deferred — see tech-debt.
|
|
672
1181
|
*/
|
|
673
1182
|
|
|
674
1183
|
type AssertionType = "contains" | "not_contains" | "regex" | "tool_call_count" | "tool_call_order" | "latency_ms" | "semantic_match";
|
|
@@ -710,9 +1219,261 @@ interface EvalSetResult {
|
|
|
710
1219
|
cases: CaseResult[];
|
|
711
1220
|
}
|
|
712
1221
|
|
|
1222
|
+
type EvidenceEmitter = (body: EvidenceIngestRequest) => Promise<EvidenceIngestResponse>;
|
|
1223
|
+
type IDFactory = () => string;
|
|
1224
|
+
interface TraceSessionOptions {
|
|
1225
|
+
trace: EvidenceTraceContext;
|
|
1226
|
+
producerModule: string;
|
|
1227
|
+
spanId: string;
|
|
1228
|
+
interactionId?: string;
|
|
1229
|
+
conversationId?: string;
|
|
1230
|
+
contractVersion?: "2.1.0" | "2.2.0";
|
|
1231
|
+
emit: EvidenceEmitter;
|
|
1232
|
+
idFactory?: IDFactory;
|
|
1233
|
+
now?: () => string;
|
|
1234
|
+
}
|
|
1235
|
+
interface InteractionBase {
|
|
1236
|
+
operationName: string;
|
|
1237
|
+
intentHash: string;
|
|
1238
|
+
mode: "chat" | "task" | "background";
|
|
1239
|
+
questionArtifactRef?: string;
|
|
1240
|
+
}
|
|
1241
|
+
type InteractionInput = InteractionBase & ({
|
|
1242
|
+
agentId: string;
|
|
1243
|
+
appRef?: string;
|
|
1244
|
+
} | {
|
|
1245
|
+
agentId?: string;
|
|
1246
|
+
appRef: string;
|
|
1247
|
+
});
|
|
1248
|
+
interface OperationEventPayloadMap {
|
|
1249
|
+
"retrieval.completed": {
|
|
1250
|
+
query_hash: string;
|
|
1251
|
+
candidate_count: number;
|
|
1252
|
+
truncated: boolean;
|
|
1253
|
+
version_status?: string;
|
|
1254
|
+
source_refs?: string[];
|
|
1255
|
+
};
|
|
1256
|
+
"knowledge.read.observed": {
|
|
1257
|
+
kn_id: string;
|
|
1258
|
+
read_kind: string;
|
|
1259
|
+
version_status: string;
|
|
1260
|
+
schema_version?: string;
|
|
1261
|
+
business_refs?: string[];
|
|
1262
|
+
};
|
|
1263
|
+
"data.query.observed": {
|
|
1264
|
+
query_hash: string;
|
|
1265
|
+
query_type: string;
|
|
1266
|
+
row_count: number;
|
|
1267
|
+
truncated?: boolean;
|
|
1268
|
+
as_of?: string;
|
|
1269
|
+
version_status?: string;
|
|
1270
|
+
resource_refs?: string[];
|
|
1271
|
+
field_refs?: string[];
|
|
1272
|
+
query_artifact_ref?: string;
|
|
1273
|
+
result_artifact_ref?: string;
|
|
1274
|
+
};
|
|
1275
|
+
"logic.execution.observed": {
|
|
1276
|
+
logic_ref: string;
|
|
1277
|
+
input_artifact_ref: string;
|
|
1278
|
+
result_artifact_ref: string;
|
|
1279
|
+
status: "ok" | "success" | "error";
|
|
1280
|
+
};
|
|
1281
|
+
"model.call.observed": {
|
|
1282
|
+
model_name: string;
|
|
1283
|
+
model_provider: string;
|
|
1284
|
+
status: "ok" | "error";
|
|
1285
|
+
input_token_count: number;
|
|
1286
|
+
output_token_count: number;
|
|
1287
|
+
prompt_hash: string;
|
|
1288
|
+
output_hash: string;
|
|
1289
|
+
error_category?: string;
|
|
1290
|
+
error_hash?: string;
|
|
1291
|
+
};
|
|
1292
|
+
"tool.called": {
|
|
1293
|
+
tool_id: string;
|
|
1294
|
+
tool_name: string;
|
|
1295
|
+
args_hash: string;
|
|
1296
|
+
visibility: string;
|
|
1297
|
+
version_status: string;
|
|
1298
|
+
};
|
|
1299
|
+
"tool.result.observed": {
|
|
1300
|
+
tool_id: string;
|
|
1301
|
+
tool_name: string;
|
|
1302
|
+
status: "success" | "error";
|
|
1303
|
+
result_hash?: string;
|
|
1304
|
+
error_hash?: string;
|
|
1305
|
+
visibility: string;
|
|
1306
|
+
version_status: string;
|
|
1307
|
+
};
|
|
1308
|
+
}
|
|
1309
|
+
type OperationEventType = keyof OperationEventPayloadMap;
|
|
1310
|
+
interface OperationInput<T extends OperationEventType = OperationEventType> {
|
|
1311
|
+
operationName: string;
|
|
1312
|
+
causationEventId: string;
|
|
1313
|
+
operationId?: string;
|
|
1314
|
+
attempt?: number;
|
|
1315
|
+
claimId?: string;
|
|
1316
|
+
payload: OperationEventPayloadMap[T];
|
|
1317
|
+
}
|
|
1318
|
+
interface ClaimInput {
|
|
1319
|
+
operationName: string;
|
|
1320
|
+
causationEventId: string;
|
|
1321
|
+
claimId: string;
|
|
1322
|
+
claimType: "answer" | "recommendation" | "structured_output" | "finding";
|
|
1323
|
+
claimHash: string;
|
|
1324
|
+
sourceEventIds: string[];
|
|
1325
|
+
operationIds: string[];
|
|
1326
|
+
resultArtifactRef?: string;
|
|
1327
|
+
visibility?: string;
|
|
1328
|
+
versionStatus?: string;
|
|
1329
|
+
}
|
|
1330
|
+
interface EvidenceRefInput {
|
|
1331
|
+
refId: string;
|
|
1332
|
+
refType: string;
|
|
1333
|
+
sourceSystem: string;
|
|
1334
|
+
validity: "observed" | "available" | "unavailable" | "expired" | "partial";
|
|
1335
|
+
versionStatus: "versioned" | "unversioned" | "not_auditable";
|
|
1336
|
+
visibility: "visible" | "redacted" | "hidden" | "omitted" | "unresolved" | "unauthorized";
|
|
1337
|
+
summaryHash?: string;
|
|
1338
|
+
}
|
|
1339
|
+
interface EvidenceRefsInput {
|
|
1340
|
+
operationName: string;
|
|
1341
|
+
claimId: string;
|
|
1342
|
+
causationEventId?: string;
|
|
1343
|
+
refs: EvidenceRefInput[];
|
|
1344
|
+
}
|
|
1345
|
+
interface BusinessRefInput {
|
|
1346
|
+
refId: string;
|
|
1347
|
+
refType: "knowledge_network" | "object" | "property" | "relation" | "metric" | "logic" | "action";
|
|
1348
|
+
sourceSystem: string;
|
|
1349
|
+
validity: "observed" | "available" | "unavailable" | "expired" | "partial";
|
|
1350
|
+
versionStatus: "versioned" | "unversioned" | "not_auditable";
|
|
1351
|
+
visibility: "visible" | "redacted" | "hidden" | "omitted" | "unresolved" | "unauthorized";
|
|
1352
|
+
}
|
|
1353
|
+
interface BusinessRefsInput {
|
|
1354
|
+
operationName: string;
|
|
1355
|
+
claimId: string;
|
|
1356
|
+
causationEventId?: string;
|
|
1357
|
+
resolverStatus: "resolved" | "partial" | "unresolved";
|
|
1358
|
+
refs: BusinessRefInput[];
|
|
1359
|
+
}
|
|
1360
|
+
interface ActionHandle {
|
|
1361
|
+
readonly actionInstanceId: string;
|
|
1362
|
+
readonly claimId: string;
|
|
1363
|
+
readonly operationId: string;
|
|
1364
|
+
readonly lastEventId: string;
|
|
1365
|
+
readonly state: "recommended" | "approval_requested" | "approved" | "rejected" | "executed" | "result_recorded";
|
|
1366
|
+
}
|
|
1367
|
+
interface RecommendActionInput {
|
|
1368
|
+
operationName: string;
|
|
1369
|
+
claimId: string;
|
|
1370
|
+
actionType: string;
|
|
1371
|
+
targetRefs: string[];
|
|
1372
|
+
reasonHash: string;
|
|
1373
|
+
reasonArtifactRef?: string;
|
|
1374
|
+
inputArtifactRef?: string;
|
|
1375
|
+
causationEventId?: string;
|
|
1376
|
+
}
|
|
1377
|
+
type ExecuteActionInput = {
|
|
1378
|
+
status: "ok";
|
|
1379
|
+
invocationRef: string;
|
|
1380
|
+
} | {
|
|
1381
|
+
status: "error";
|
|
1382
|
+
invocationRef: string;
|
|
1383
|
+
errorCategory: string;
|
|
1384
|
+
errorHash: string;
|
|
1385
|
+
};
|
|
1386
|
+
type ActionResultInput = {
|
|
1387
|
+
status: string;
|
|
1388
|
+
resultHash: string;
|
|
1389
|
+
} & ({
|
|
1390
|
+
resultArtifactRef: string;
|
|
1391
|
+
taskRef?: string;
|
|
1392
|
+
artifactRef?: never;
|
|
1393
|
+
} | {
|
|
1394
|
+
taskRef: string;
|
|
1395
|
+
artifactRef?: string;
|
|
1396
|
+
resultArtifactRef?: string;
|
|
1397
|
+
} | {
|
|
1398
|
+
taskRef?: string;
|
|
1399
|
+
artifactRef: string;
|
|
1400
|
+
resultArtifactRef?: string;
|
|
1401
|
+
});
|
|
1402
|
+
declare class TraceSession {
|
|
1403
|
+
readonly interactionId: string;
|
|
1404
|
+
private readonly trace;
|
|
1405
|
+
private readonly producerModule;
|
|
1406
|
+
private readonly spanId;
|
|
1407
|
+
private readonly emit;
|
|
1408
|
+
private readonly contractVersion;
|
|
1409
|
+
private readonly idFactory;
|
|
1410
|
+
private readonly now;
|
|
1411
|
+
private readonly events;
|
|
1412
|
+
private readonly eventIDs;
|
|
1413
|
+
private readonly operationIDs;
|
|
1414
|
+
private readonly claimEventIDs;
|
|
1415
|
+
private readonly actions;
|
|
1416
|
+
private flushTail;
|
|
1417
|
+
constructor(options: TraceSessionOptions);
|
|
1418
|
+
startInteraction(input: InteractionInput): EvidenceEvent;
|
|
1419
|
+
observeOperation<T extends OperationEventType>(eventType: T, input: OperationInput<T>): EvidenceEvent;
|
|
1420
|
+
createClaim(input: ClaimInput): EvidenceEvent;
|
|
1421
|
+
createEvidenceRefs(input: EvidenceRefsInput): EvidenceEvent;
|
|
1422
|
+
resolveBusinessRefs(input: BusinessRefsInput): EvidenceEvent;
|
|
1423
|
+
recommendAction(input: RecommendActionInput): ActionHandle;
|
|
1424
|
+
requestActionApproval(action: ActionHandle, input: {
|
|
1425
|
+
policyRef: string;
|
|
1426
|
+
}): EvidenceEvent;
|
|
1427
|
+
approveAction(action: ActionHandle, input: {
|
|
1428
|
+
actorRef: string;
|
|
1429
|
+
policyDecisionRef: string;
|
|
1430
|
+
}): EvidenceEvent;
|
|
1431
|
+
rejectAction(action: ActionHandle, input: {
|
|
1432
|
+
actorRef: string;
|
|
1433
|
+
policyDecisionRef: string;
|
|
1434
|
+
}): EvidenceEvent;
|
|
1435
|
+
executeAction(action: ActionHandle, input: ExecuteActionInput): EvidenceEvent;
|
|
1436
|
+
recordActionResult(action: ActionHandle, input: ActionResultInput): EvidenceEvent;
|
|
1437
|
+
pendingEvents(): EvidenceEvent[];
|
|
1438
|
+
flush(): Promise<EvidenceIngestResponse | undefined>;
|
|
1439
|
+
private appendAction;
|
|
1440
|
+
private append;
|
|
1441
|
+
private flushEvents;
|
|
1442
|
+
private assertContractPayload;
|
|
1443
|
+
private assertKnownRefs;
|
|
1444
|
+
private requireClaim;
|
|
1445
|
+
private expectActionState;
|
|
1446
|
+
}
|
|
1447
|
+
|
|
713
1448
|
declare function trace(ctx: RequestContext): {
|
|
714
1449
|
/** Raw trace search (OpenSearch-style body). */
|
|
715
1450
|
search: (body: unknown) => Promise<unknown>;
|
|
1451
|
+
/** Submit BKN Trace phase-two claim/evidence/business events. */
|
|
1452
|
+
emitEvidenceEvents: (body: EvidenceIngestRequest) => Promise<EvidenceIngestResponse>;
|
|
1453
|
+
/** Store one authorized BKN Trace 2.2 business-content artifact. */
|
|
1454
|
+
emitArtifact: (body: EvidenceArtifact) => Promise<EvidenceArtifactIngestResponse>;
|
|
1455
|
+
/** Read one authorized BKN Trace 2.2 business-content artifact. */
|
|
1456
|
+
artifact: (artifactId: string) => Promise<EvidenceArtifact>;
|
|
1457
|
+
/** Product-facing business request list and request-to-trace drilldown. */
|
|
1458
|
+
requests: {
|
|
1459
|
+
get: (requestId: string) => Promise<RequestSummary>;
|
|
1460
|
+
list: (query?: RequestSummaryQuery) => Promise<SummaryPage<RequestSummary>>;
|
|
1461
|
+
traces: (requestId: string, query?: Pick<RequestSummaryQuery, "cursor" | "limit">) => Promise<SummaryPage<TraceExecutionSummary>>;
|
|
1462
|
+
};
|
|
1463
|
+
/** Aggregate all OpenBKN requests and traces for one caller-owned interaction. */
|
|
1464
|
+
interactions: {
|
|
1465
|
+
get: (interactionId: string) => Promise<InteractionSummary>;
|
|
1466
|
+
};
|
|
1467
|
+
/** Create a typed BKN Trace 2.1 session for an Agent or AI application. */
|
|
1468
|
+
createSession: (options: Omit<TraceSessionOptions, "emit">) => TraceSession;
|
|
1469
|
+
/** Normalized trace tree/status graph by trace id. */
|
|
1470
|
+
graph: (traceId: string) => Promise<TraceGraphResponse>;
|
|
1471
|
+
/** Claim -> evidence/business refs graph by trace id or BKN request id. */
|
|
1472
|
+
evidenceChain: (scope: TraceScope, opts?: TraceQueryOptions) => Promise<EvidenceChainResponse>;
|
|
1473
|
+
/** Business semantic graph by trace id or BKN request id. */
|
|
1474
|
+
businessGraph: (scope: TraceScope, opts?: TraceQueryOptions) => Promise<BusinessGraphResponse>;
|
|
1475
|
+
/** Metadata-only evidence snapshot preview by trace id or BKN request id. */
|
|
1476
|
+
snapshotPreview: (scope: TraceScope, opts?: TraceQueryOptions) => Promise<SnapshotPreviewResponse>;
|
|
716
1477
|
/** All span source docs for a conversation. */
|
|
717
1478
|
spans: (conversationId: string, opts?: {
|
|
718
1479
|
maxTraceIds?: number;
|
|
@@ -743,6 +1504,8 @@ declare function trace(ctx: RequestContext): {
|
|
|
743
1504
|
}>;
|
|
744
1505
|
/** Build eval cases from a loosely-shaped queries object/array. */
|
|
745
1506
|
evalSetBuild: (raw: unknown) => EvalCase[];
|
|
1507
|
+
/** Validate BKN Trace phase-one fixture files or directories. */
|
|
1508
|
+
validateFixture: (path: string) => FixturePathValidationResult;
|
|
746
1509
|
/**
|
|
747
1510
|
* Run an eval set against an agent: each case's query is sent to the agent,
|
|
748
1511
|
* the resulting trace is fetched, and assertions are checked. `llm` enables
|
|
@@ -756,7 +1519,8 @@ declare function trace(ctx: RequestContext): {
|
|
|
756
1519
|
|
|
757
1520
|
/**
|
|
758
1521
|
* Vega backend client — catalog/resource reads + BuildTask (index build).
|
|
759
|
-
* Build config
|
|
1522
|
+
* Build config is snapshotted from the Resource's schema_definition/features and
|
|
1523
|
+
* index_config when the BuildTask is created.
|
|
760
1524
|
*/
|
|
761
1525
|
|
|
762
1526
|
declare const BuildMode: z.ZodEnum<["batch", "streaming"]>;
|
|
@@ -765,24 +1529,15 @@ type BuildMode = z.infer<typeof BuildMode>;
|
|
|
765
1529
|
declare const CreateBuildTaskRequest: z.ZodObject<{
|
|
766
1530
|
resource_id: z.ZodString;
|
|
767
1531
|
mode: z.ZodEnum<["batch", "streaming"]>;
|
|
768
|
-
|
|
769
|
-
build_key_fields: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
770
|
-
embedding_model: z.ZodOptional<z.ZodString>;
|
|
771
|
-
model_dimensions: z.ZodOptional<z.ZodNumber>;
|
|
1532
|
+
execute_type: z.ZodOptional<z.ZodEnum<["incremental", "full"]>>;
|
|
772
1533
|
}, "strip", z.ZodTypeAny, {
|
|
773
1534
|
mode: "batch" | "streaming";
|
|
774
1535
|
resource_id: string;
|
|
775
|
-
|
|
776
|
-
build_key_fields?: string[] | undefined;
|
|
777
|
-
embedding_model?: string | undefined;
|
|
778
|
-
model_dimensions?: number | undefined;
|
|
1536
|
+
execute_type?: "full" | "incremental" | undefined;
|
|
779
1537
|
}, {
|
|
780
1538
|
mode: "batch" | "streaming";
|
|
781
1539
|
resource_id: string;
|
|
782
|
-
|
|
783
|
-
build_key_fields?: string[] | undefined;
|
|
784
|
-
embedding_model?: string | undefined;
|
|
785
|
-
model_dimensions?: number | undefined;
|
|
1540
|
+
execute_type?: "full" | "incremental" | undefined;
|
|
786
1541
|
}>;
|
|
787
1542
|
type CreateBuildTaskRequest = z.infer<typeof CreateBuildTaskRequest>;
|
|
788
1543
|
declare const BuildTask: z.ZodObject<{
|
|
@@ -794,10 +1549,21 @@ declare const BuildTask: z.ZodObject<{
|
|
|
794
1549
|
total_count: z.ZodOptional<z.ZodNumber>;
|
|
795
1550
|
synced_count: z.ZodOptional<z.ZodNumber>;
|
|
796
1551
|
vectorized_count: z.ZodOptional<z.ZodNumber>;
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
1552
|
+
index_config: z.ZodOptional<z.ZodUnknown>;
|
|
1553
|
+
catalog_id: z.ZodOptional<z.ZodString>;
|
|
1554
|
+
index_health: z.ZodOptional<z.ZodObject<{
|
|
1555
|
+
embedding: z.ZodString;
|
|
1556
|
+
fulltext: z.ZodString;
|
|
1557
|
+
usable: z.ZodBoolean;
|
|
1558
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1559
|
+
embedding: z.ZodString;
|
|
1560
|
+
fulltext: z.ZodString;
|
|
1561
|
+
usable: z.ZodBoolean;
|
|
1562
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1563
|
+
embedding: z.ZodString;
|
|
1564
|
+
fulltext: z.ZodString;
|
|
1565
|
+
usable: z.ZodBoolean;
|
|
1566
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
801
1567
|
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
802
1568
|
id: z.ZodString;
|
|
803
1569
|
resource_id: z.ZodOptional<z.ZodString>;
|
|
@@ -807,10 +1573,21 @@ declare const BuildTask: z.ZodObject<{
|
|
|
807
1573
|
total_count: z.ZodOptional<z.ZodNumber>;
|
|
808
1574
|
synced_count: z.ZodOptional<z.ZodNumber>;
|
|
809
1575
|
vectorized_count: z.ZodOptional<z.ZodNumber>;
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
1576
|
+
index_config: z.ZodOptional<z.ZodUnknown>;
|
|
1577
|
+
catalog_id: z.ZodOptional<z.ZodString>;
|
|
1578
|
+
index_health: z.ZodOptional<z.ZodObject<{
|
|
1579
|
+
embedding: z.ZodString;
|
|
1580
|
+
fulltext: z.ZodString;
|
|
1581
|
+
usable: z.ZodBoolean;
|
|
1582
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1583
|
+
embedding: z.ZodString;
|
|
1584
|
+
fulltext: z.ZodString;
|
|
1585
|
+
usable: z.ZodBoolean;
|
|
1586
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1587
|
+
embedding: z.ZodString;
|
|
1588
|
+
fulltext: z.ZodString;
|
|
1589
|
+
usable: z.ZodBoolean;
|
|
1590
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
814
1591
|
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
815
1592
|
id: z.ZodString;
|
|
816
1593
|
resource_id: z.ZodOptional<z.ZodString>;
|
|
@@ -820,15 +1597,89 @@ declare const BuildTask: z.ZodObject<{
|
|
|
820
1597
|
total_count: z.ZodOptional<z.ZodNumber>;
|
|
821
1598
|
synced_count: z.ZodOptional<z.ZodNumber>;
|
|
822
1599
|
vectorized_count: z.ZodOptional<z.ZodNumber>;
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
1600
|
+
index_config: z.ZodOptional<z.ZodUnknown>;
|
|
1601
|
+
catalog_id: z.ZodOptional<z.ZodString>;
|
|
1602
|
+
index_health: z.ZodOptional<z.ZodObject<{
|
|
1603
|
+
embedding: z.ZodString;
|
|
1604
|
+
fulltext: z.ZodString;
|
|
1605
|
+
usable: z.ZodBoolean;
|
|
1606
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1607
|
+
embedding: z.ZodString;
|
|
1608
|
+
fulltext: z.ZodString;
|
|
1609
|
+
usable: z.ZodBoolean;
|
|
1610
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1611
|
+
embedding: z.ZodString;
|
|
1612
|
+
fulltext: z.ZodString;
|
|
1613
|
+
usable: z.ZodBoolean;
|
|
1614
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
827
1615
|
}, z.ZodTypeAny, "passthrough">>;
|
|
828
1616
|
type BuildTask = z.infer<typeof BuildTask>;
|
|
1617
|
+
interface ListBuildTasksOptions {
|
|
1618
|
+
limit?: number;
|
|
1619
|
+
offset?: number;
|
|
1620
|
+
resourceId?: string;
|
|
1621
|
+
catalogId?: string;
|
|
1622
|
+
status?: string | string[];
|
|
1623
|
+
active?: boolean;
|
|
1624
|
+
mode?: BuildMode;
|
|
1625
|
+
orderBy?: "default" | "created_at" | "updated_at" | "status" | "mode";
|
|
1626
|
+
order?: "asc" | "desc";
|
|
1627
|
+
}
|
|
1628
|
+
interface DeleteBuildTasksOptions {
|
|
1629
|
+
ignoreMissing?: boolean;
|
|
1630
|
+
deleteActiveIndex?: boolean;
|
|
1631
|
+
}
|
|
1632
|
+
type QueryPagingMode = "single" | "cursor";
|
|
1633
|
+
/** Paging options for an initial Vega raw query. */
|
|
1634
|
+
interface RawQueryPaging {
|
|
1635
|
+
mode?: QueryPagingMode;
|
|
1636
|
+
offset?: number;
|
|
1637
|
+
limit?: number;
|
|
1638
|
+
keep_alive_sec?: number;
|
|
1639
|
+
}
|
|
1640
|
+
/** Opaque cursor continuation. No initial-query fields may accompany it. */
|
|
1641
|
+
interface RawQueryContinuationRequest {
|
|
1642
|
+
paging: {
|
|
1643
|
+
cursor: string;
|
|
1644
|
+
};
|
|
1645
|
+
/** Accepted by the API but cannot override the value frozen on the first page. */
|
|
1646
|
+
need_total?: boolean;
|
|
1647
|
+
}
|
|
1648
|
+
interface RawQueryInitialBase {
|
|
1649
|
+
paging?: RawQueryPaging;
|
|
1650
|
+
/** Per-page timeout in seconds (1–3600); defaults to 60 server-side. */
|
|
1651
|
+
query_timeout_sec?: number;
|
|
1652
|
+
need_total?: boolean;
|
|
1653
|
+
}
|
|
1654
|
+
interface SqlRawQueryRequest extends RawQueryInitialBase {
|
|
1655
|
+
query: string;
|
|
1656
|
+
query_format: "sql";
|
|
1657
|
+
/** SQL input dialect; defaults to postgres server-side. */
|
|
1658
|
+
input_dialect?: "postgres" | "mysql" | "trino" | "duckdb";
|
|
1659
|
+
}
|
|
1660
|
+
interface DslRawQueryRequest extends RawQueryInitialBase {
|
|
1661
|
+
query: Record<string, unknown>;
|
|
1662
|
+
query_format: "dsl";
|
|
1663
|
+
input_dialect: "opensearch";
|
|
1664
|
+
}
|
|
1665
|
+
/** Request contract for POST /resources/query. */
|
|
1666
|
+
type RawQueryRequest = SqlRawQueryRequest | DslRawQueryRequest | RawQueryContinuationRequest;
|
|
829
1667
|
interface ListCatalogsOptions {
|
|
830
1668
|
limit?: number;
|
|
831
1669
|
offset?: number;
|
|
1670
|
+
name?: string;
|
|
1671
|
+
tag?: string;
|
|
1672
|
+
type?: "physical" | "logical" | string;
|
|
1673
|
+
enabled?: boolean;
|
|
1674
|
+
healthCheckStatus?: string;
|
|
1675
|
+
includeExtensions?: boolean;
|
|
1676
|
+
includeExtensionKeys?: string;
|
|
1677
|
+
extensionPairs?: Array<{
|
|
1678
|
+
key: string;
|
|
1679
|
+
value: string;
|
|
1680
|
+
}>;
|
|
1681
|
+
sort?: "name" | "create_time" | "update_time" | string;
|
|
1682
|
+
direction?: "asc" | "desc";
|
|
832
1683
|
}
|
|
833
1684
|
/** POST /catalogs body. `connector_config` shape varies by connector (raw passthrough). */
|
|
834
1685
|
interface CreateCatalogRequest {
|
|
@@ -838,18 +1689,27 @@ interface CreateCatalogRequest {
|
|
|
838
1689
|
tags?: string[];
|
|
839
1690
|
description?: string;
|
|
840
1691
|
enabled?: boolean;
|
|
1692
|
+
id?: string;
|
|
1693
|
+
internal?: boolean;
|
|
1694
|
+
extensions?: Record<string, string>;
|
|
841
1695
|
}
|
|
842
1696
|
|
|
843
1697
|
declare function vega(ctx: RequestContext): {
|
|
844
1698
|
catalogs: (opts?: ListCatalogsOptions) => Promise<unknown>;
|
|
845
1699
|
getCatalog: (id: string) => Promise<unknown>;
|
|
846
1700
|
createCatalog: (req: CreateCatalogRequest) => Promise<unknown>;
|
|
1701
|
+
updateCatalog: (id: string, req: Partial<CreateCatalogRequest>) => Promise<unknown>;
|
|
847
1702
|
enableCatalog: (id: string) => Promise<unknown>;
|
|
1703
|
+
disableCatalog: (id: string) => Promise<unknown>;
|
|
1704
|
+
deleteCatalog: (id: string) => Promise<unknown>;
|
|
1705
|
+
testCatalogConnection: (id: string) => Promise<unknown>;
|
|
848
1706
|
discoverCatalog: (id: string, wait?: boolean) => Promise<unknown>;
|
|
849
|
-
catalogResources: (id: string, category?: string) => Promise<unknown>;
|
|
1707
|
+
catalogResources: (id: string, category?: string, limit?: number, offset?: number) => Promise<unknown>;
|
|
850
1708
|
catalogHealth: (ids: string[]) => Promise<unknown>;
|
|
851
1709
|
connectorTypes: () => Promise<unknown>;
|
|
852
1710
|
connectorType: (type: string) => Promise<unknown>;
|
|
1711
|
+
/** Run SQL / OpenSearch DSL directly against a data source. */
|
|
1712
|
+
sql: (body: RawQueryRequest) => Promise<unknown>;
|
|
853
1713
|
/** Build a resource's index. With `wait`, polls until terminal. */
|
|
854
1714
|
build: (req: CreateBuildTaskRequest, opts?: {
|
|
855
1715
|
wait?: boolean;
|
|
@@ -865,11 +1725,28 @@ declare function vega(ctx: RequestContext): {
|
|
|
865
1725
|
total_count: zod.ZodOptional<zod.ZodNumber>;
|
|
866
1726
|
synced_count: zod.ZodOptional<zod.ZodNumber>;
|
|
867
1727
|
vectorized_count: zod.ZodOptional<zod.ZodNumber>;
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
1728
|
+
index_config: zod.ZodOptional<zod.ZodUnknown>;
|
|
1729
|
+
catalog_id: zod.ZodOptional<zod.ZodString>;
|
|
1730
|
+
index_health: zod.ZodOptional<zod.ZodObject<{
|
|
1731
|
+
embedding: zod.ZodString;
|
|
1732
|
+
fulltext: zod.ZodString;
|
|
1733
|
+
usable: zod.ZodBoolean;
|
|
1734
|
+
}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{
|
|
1735
|
+
embedding: zod.ZodString;
|
|
1736
|
+
fulltext: zod.ZodString;
|
|
1737
|
+
usable: zod.ZodBoolean;
|
|
1738
|
+
}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{
|
|
1739
|
+
embedding: zod.ZodString;
|
|
1740
|
+
fulltext: zod.ZodString;
|
|
1741
|
+
usable: zod.ZodBoolean;
|
|
1742
|
+
}, zod.ZodTypeAny, "passthrough">>>;
|
|
872
1743
|
}, zod.ZodTypeAny, "passthrough">>;
|
|
1744
|
+
buildTasks: (opts?: ListBuildTasksOptions) => Promise<unknown>;
|
|
1745
|
+
deleteBuildTasks: (ids: string[], opts?: DeleteBuildTasksOptions) => Promise<unknown>;
|
|
1746
|
+
startBuildTask: (taskId: string, opts?: {
|
|
1747
|
+
reset?: boolean;
|
|
1748
|
+
}) => Promise<unknown>;
|
|
1749
|
+
stopBuildTask: (taskId: string) => Promise<unknown>;
|
|
873
1750
|
};
|
|
874
1751
|
|
|
875
1752
|
interface BknClient {
|
|
@@ -877,6 +1754,10 @@ interface BknClient {
|
|
|
877
1754
|
readonly kn: ReturnType<typeof kn>;
|
|
878
1755
|
readonly resource: ReturnType<typeof resources>;
|
|
879
1756
|
readonly dataflows: ReturnType<typeof dataflows>;
|
|
1757
|
+
/**
|
|
1758
|
+
* @deprecated Decision Agent (agent-factory) is being phased out and may be
|
|
1759
|
+
* removed in a future release. Avoid building new integrations on it.
|
|
1760
|
+
*/
|
|
880
1761
|
readonly agents: ReturnType<typeof agents>;
|
|
881
1762
|
readonly context: ReturnType<typeof context>;
|
|
882
1763
|
readonly models: ReturnType<typeof models>;
|
|
@@ -884,6 +1765,7 @@ interface BknClient {
|
|
|
884
1765
|
readonly toolboxes: ReturnType<typeof toolboxes>;
|
|
885
1766
|
readonly trace: ReturnType<typeof trace>;
|
|
886
1767
|
readonly admin: ReturnType<typeof admin>;
|
|
1768
|
+
readonly appKeys: ReturnType<typeof appKeys>;
|
|
887
1769
|
readonly vega: ReturnType<typeof vega>;
|
|
888
1770
|
/** Raw API passthrough (the `call` escape hatch). */
|
|
889
1771
|
call(path: string, opts?: RawCallOptions): Promise<RawCallResult>;
|
|
@@ -896,7 +1778,9 @@ declare class HttpError extends Error {
|
|
|
896
1778
|
readonly status: number;
|
|
897
1779
|
readonly statusText: string;
|
|
898
1780
|
readonly body: string;
|
|
899
|
-
|
|
1781
|
+
/** Optional next-step guidance, overriding the status default (e.g. AppKey re-issue). */
|
|
1782
|
+
readonly hint?: string;
|
|
1783
|
+
constructor(status: number, statusText: string, body: string, hint?: string);
|
|
900
1784
|
}
|
|
901
1785
|
/** Raised for bad CLI/SDK input before any request is made. */
|
|
902
1786
|
declare class InputError extends Error {
|
|
@@ -923,16 +1807,28 @@ interface TokenConfig {
|
|
|
923
1807
|
refreshToken?: string;
|
|
924
1808
|
idToken?: string;
|
|
925
1809
|
expiresAt?: string;
|
|
926
|
-
/** Skip TLS verification for this platform (saved by `auth login -k`). */
|
|
927
|
-
tlsInsecure?: boolean;
|
|
928
|
-
/** Platform has no auth stack (no bkn-safe) — requests carry no token. */
|
|
929
|
-
noAuth?: boolean;
|
|
930
1810
|
/** Login name persisted at login time (fallback when JWT lacks claims). */
|
|
931
1811
|
username?: string;
|
|
932
1812
|
/** Human-readable name from userinfo. */
|
|
933
1813
|
displayName?: string;
|
|
1814
|
+
/**
|
|
1815
|
+
* Skip TLS verification for this platform (saved by `auth login -k`), so a
|
|
1816
|
+
* self-signed platform needn't repeat `-k` on every command. The opt-out is
|
|
1817
|
+
* applied per request via an undici dispatcher (see api/tls.ts) and is scoped
|
|
1818
|
+
* to this platform's requests — it never touches the global TLS setting or a
|
|
1819
|
+
* library consumer's unrelated traffic.
|
|
1820
|
+
*/
|
|
1821
|
+
tlsInsecure?: boolean;
|
|
934
1822
|
}
|
|
935
|
-
/**
|
|
1823
|
+
/**
|
|
1824
|
+
* userId from the token's JWT `sub` (id_token first), else "default".
|
|
1825
|
+
*
|
|
1826
|
+
* The `sub` is attacker-supplied — the JWT is never signature-checked — and it
|
|
1827
|
+
* becomes a path segment under `userDir`. An unconstrained one escapes the
|
|
1828
|
+
* store: `sub: "../../<other-platform>/users/default"` overwrites another
|
|
1829
|
+
* platform's saved token, so the victim's later commands there authenticate as
|
|
1830
|
+
* whoever issued this token. Constrain it the way BKN_PROFILE is constrained.
|
|
1831
|
+
*/
|
|
936
1832
|
declare function userIdFromToken(token: TokenConfig): string;
|
|
937
1833
|
interface PlatformUser {
|
|
938
1834
|
userId: string;
|
|
@@ -951,20 +1847,13 @@ declare function hostOf(baseUrl: string): string;
|
|
|
951
1847
|
declare function attachToken(baseUrl: string, accessToken: string, opts?: {
|
|
952
1848
|
refreshToken?: string;
|
|
953
1849
|
idToken?: string;
|
|
954
|
-
insecure?: boolean;
|
|
955
1850
|
username?: string;
|
|
1851
|
+
insecure?: boolean;
|
|
956
1852
|
}): {
|
|
957
1853
|
baseUrl: string;
|
|
958
1854
|
userId: string;
|
|
959
1855
|
username?: string;
|
|
960
1856
|
};
|
|
961
|
-
/** Register a no-auth platform session (no token; the platform has no bkn-safe). */
|
|
962
|
-
declare function attachNoAuth(baseUrl: string, opts?: {
|
|
963
|
-
insecure?: boolean;
|
|
964
|
-
}): {
|
|
965
|
-
baseUrl: string;
|
|
966
|
-
noAuth: true;
|
|
967
|
-
};
|
|
968
1857
|
interface AuthStatus {
|
|
969
1858
|
baseUrl?: string;
|
|
970
1859
|
userId?: string;
|
|
@@ -972,15 +1861,22 @@ interface AuthStatus {
|
|
|
972
1861
|
username?: string;
|
|
973
1862
|
expired?: boolean;
|
|
974
1863
|
}
|
|
975
|
-
declare function status(
|
|
976
|
-
|
|
1864
|
+
declare function status(opts?: {
|
|
1865
|
+
user?: string;
|
|
1866
|
+
}): AuthStatus;
|
|
1867
|
+
declare function currentToken(opts?: {
|
|
1868
|
+
user?: string;
|
|
1869
|
+
}): string;
|
|
977
1870
|
/**
|
|
978
1871
|
* Like {@link currentToken} but proactively refreshes an expired access token
|
|
979
1872
|
* when a refresh token is stored, persisting the result. API requests already
|
|
980
1873
|
* refresh on a 401 (see api/http.ts); this covers the `auth token` getter,
|
|
981
1874
|
* whose output is copied out and used elsewhere where no 401 retry can help.
|
|
982
1875
|
*/
|
|
983
|
-
declare function currentTokenFresh(
|
|
1876
|
+
declare function currentTokenFresh(opts?: {
|
|
1877
|
+
insecure?: boolean;
|
|
1878
|
+
user?: string;
|
|
1879
|
+
}): Promise<string>;
|
|
984
1880
|
interface WhoamiResult extends JwtClaims {
|
|
985
1881
|
/** Platform the active session belongs to. */
|
|
986
1882
|
baseUrl?: string;
|
|
@@ -989,7 +1885,9 @@ interface WhoamiResult extends JwtClaims {
|
|
|
989
1885
|
/** Resolved account/login name — what `auth login` looked up and stored. */
|
|
990
1886
|
username?: string;
|
|
991
1887
|
}
|
|
992
|
-
declare function whoami(
|
|
1888
|
+
declare function whoami(opts?: {
|
|
1889
|
+
user?: string;
|
|
1890
|
+
}): WhoamiResult;
|
|
993
1891
|
interface PlatformListItem {
|
|
994
1892
|
baseUrl: string;
|
|
995
1893
|
userId: string;
|
|
@@ -1024,7 +1922,6 @@ declare function exportCreds(): {
|
|
|
1024
1922
|
type auth_AuthStatus = AuthStatus;
|
|
1025
1923
|
type auth_PlatformListItem = PlatformListItem;
|
|
1026
1924
|
type auth_WhoamiResult = WhoamiResult;
|
|
1027
|
-
declare const auth_attachNoAuth: typeof attachNoAuth;
|
|
1028
1925
|
declare const auth_attachToken: typeof attachToken;
|
|
1029
1926
|
declare const auth_currentToken: typeof currentToken;
|
|
1030
1927
|
declare const auth_currentTokenFresh: typeof currentTokenFresh;
|
|
@@ -1040,7 +1937,7 @@ declare const auth_userIdFromToken: typeof userIdFromToken;
|
|
|
1040
1937
|
declare const auth_usersOf: typeof usersOf;
|
|
1041
1938
|
declare const auth_whoami: typeof whoami;
|
|
1042
1939
|
declare namespace auth {
|
|
1043
|
-
export { type auth_AuthStatus as AuthStatus, type auth_PlatformListItem as PlatformListItem, type auth_WhoamiResult as WhoamiResult,
|
|
1940
|
+
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 };
|
|
1044
1941
|
}
|
|
1045
1942
|
|
|
1046
1943
|
interface RequestInitEx {
|
|
@@ -1048,19 +1945,15 @@ interface RequestInitEx {
|
|
|
1048
1945
|
/** JSON body — serialized and Content-Type set automatically. */
|
|
1049
1946
|
body?: unknown;
|
|
1050
1947
|
/** Query params appended to the path. */
|
|
1051
|
-
query?: Record<string, string | number | boolean | undefined>;
|
|
1948
|
+
query?: Record<string, string | number | boolean | Array<string | number | boolean> | undefined>;
|
|
1052
1949
|
headers?: Record<string, string>;
|
|
1950
|
+
/** Redirect policy; credential-bearing writes should use `manual`. */
|
|
1951
|
+
redirect?: "follow" | "error" | "manual";
|
|
1053
1952
|
/** Per-request timeout; defaults to 30s. */
|
|
1054
1953
|
timeoutMs?: number;
|
|
1055
1954
|
}
|
|
1056
1955
|
declare function request<T = unknown>(ctx: RequestContext, path: string, init?: RequestInitEx): Promise<T>;
|
|
1057
1956
|
|
|
1058
|
-
/**
|
|
1059
|
-
* Resolve a full RequestContext from explicit options → env → store.
|
|
1060
|
-
* Order: caller options win, then env vars, then the active platform/user
|
|
1061
|
-
* in `~/.bkn/`.
|
|
1062
|
-
*/
|
|
1063
|
-
|
|
1064
1957
|
declare function resolveContext(opts?: ClientOptions): RequestContext;
|
|
1065
1958
|
|
|
1066
|
-
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 };
|
|
1959
|
+
export { type ActionHandle, type ActionResultInput, type ActionSummary, type BknClient, BuildMode, BuildTask, type BusinessEvidenceEventType, type BusinessGraphResponse, type BusinessRefInput, type BusinessRefsInput, type ClaimInput, type ClientOptions, CreateBuildTaskRequest, DEFAULT_BUSINESS_DOMAIN, DEFAULT_LIST_LIMIT, DEFAULT_QUERY_LIMIT, type DslRawQueryRequest, type EvidenceArtifact, type EvidenceArtifactIngestResponse, type EvidenceArtifactType, type EvidenceChainResponse, type EvidenceEvent, type EvidenceIngestRequest, type EvidenceIngestResponse, type EvidenceRefInput, type EvidenceRefsInput, type EvidenceTraceContext, type ExecuteActionInput, type GraphPage, HttpError, InputError, type InteractionInput, type InteractionSummary, type OperationEventPayloadMap, type OperationEventType, type OperationInput, type QueryPagingMode, type RawQueryContinuationRequest, type RawQueryPaging, type RawQueryRequest, type RecommendActionInput, type RequestContext, type RequestSummary, type RequestSummaryQuery, type SnapshotPreviewResponse, type SqlRawQueryRequest, type SummaryPage, type TraceExecutionSummary, type TraceGraphEdge, type TraceGraphNode, type TraceGraphResponse, type TraceQueryOptions, type TraceScope, TraceSession, type TraceSessionOptions, type VisibilitySummary, admin, agents, auth, context, createClient, dataflows, kn, models, request, resolveContext, resources, skills, toolboxes, trace, vega };
|