@kweaver-ai/kweaver-sdk 0.8.3 → 0.8.4

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.
Files changed (74) hide show
  1. package/dist/api/agent-chat.d.ts +10 -2
  2. package/dist/api/agent-chat.js +19 -5
  3. package/dist/api/datasources.d.ts +14 -0
  4. package/dist/api/datasources.js +14 -0
  5. package/dist/cli.js +2 -14
  6. package/dist/client.d.ts +7 -1
  7. package/dist/client.js +7 -1
  8. package/dist/commands/bkn-ops.d.ts +1 -1
  9. package/dist/commands/bkn-ops.js +42 -21
  10. package/dist/commands/bkn.js +6 -3
  11. package/dist/commands/ds.d.ts +0 -31
  12. package/dist/commands/ds.js +18 -448
  13. package/dist/commands/explore-bkn.d.ts +7 -1
  14. package/dist/commands/explore-bkn.js +32 -3
  15. package/dist/resources/datasources.d.ts +7 -0
  16. package/dist/resources/datasources.js +7 -0
  17. package/dist/templates/explorer/bkn.js +860 -9
  18. package/dist/templates/explorer/index.html +1 -0
  19. package/dist/templates/explorer/style.css +225 -0
  20. package/dist/templates/explorer/vendor/g6.min.js +68 -0
  21. package/dist/trace-ai/eval-set/schemas.d.ts +1 -0
  22. package/dist/trace-ai/eval-set/schemas.js +4 -0
  23. package/dist/trace-ai/eval-set/types.d.ts +2 -0
  24. package/dist/trace-ai/exp/capture-fingerprint.d.ts +10 -0
  25. package/dist/trace-ai/exp/capture-fingerprint.js +12 -0
  26. package/dist/trace-ai/exp/context/context-assembler.d.ts +18 -0
  27. package/dist/trace-ai/exp/context/context-assembler.js +42 -0
  28. package/dist/trace-ai/exp/context/failure-analyzer.d.ts +22 -0
  29. package/dist/trace-ai/exp/context/failure-analyzer.js +59 -0
  30. package/dist/trace-ai/exp/context/kn-data-prober.d.ts +13 -0
  31. package/dist/trace-ai/exp/context/kn-data-prober.js +38 -0
  32. package/dist/trace-ai/exp/context/kn-schema-client.d.ts +14 -0
  33. package/dist/trace-ai/exp/context/kn-schema-client.js +41 -0
  34. package/dist/trace-ai/exp/context/retrieval-health.d.ts +32 -0
  35. package/dist/trace-ai/exp/context/retrieval-health.js +138 -0
  36. package/dist/trace-ai/exp/context/vega-catalog-client.d.ts +14 -0
  37. package/dist/trace-ai/exp/context/vega-catalog-client.js +15 -0
  38. package/dist/trace-ai/exp/coordinator.d.ts +34 -21
  39. package/dist/trace-ai/exp/coordinator.js +246 -24
  40. package/dist/trace-ai/exp/eval-runner.js +4 -2
  41. package/dist/trace-ai/exp/exp-store/events-jsonl.d.ts +1 -0
  42. package/dist/trace-ai/exp/exp-store/events-jsonl.js +18 -0
  43. package/dist/trace-ai/exp/exp-store/expected-fingerprint.d.ts +3 -0
  44. package/dist/trace-ai/exp/exp-store/expected-fingerprint.js +31 -0
  45. package/dist/trace-ai/exp/exp-store/index.d.ts +63 -2
  46. package/dist/trace-ai/exp/exp-store/index.js +2 -1
  47. package/dist/trace-ai/exp/exp-store/rollback-yaml.d.ts +12 -0
  48. package/dist/trace-ai/exp/exp-store/rollback-yaml.js +29 -0
  49. package/dist/trace-ai/exp/index.d.ts +2 -0
  50. package/dist/trace-ai/exp/index.js +68 -3
  51. package/dist/trace-ai/exp/info.js +1 -1
  52. package/dist/trace-ai/exp/patch/index.d.ts +13 -2
  53. package/dist/trace-ai/exp/patch/index.js +65 -10
  54. package/dist/trace-ai/exp/patch/kn-api-client.d.ts +40 -0
  55. package/dist/trace-ai/exp/patch/kn-api-client.js +14 -0
  56. package/dist/trace-ai/exp/patch/kn.d.ts +8 -0
  57. package/dist/trace-ai/exp/patch/kn.js +36 -0
  58. package/dist/trace-ai/exp/patch/skill-api-client.d.ts +17 -0
  59. package/dist/trace-ai/exp/patch/skill-api-client.js +14 -0
  60. package/dist/trace-ai/exp/patch/skill-content.d.ts +9 -0
  61. package/dist/trace-ai/exp/patch/skill-content.js +12 -0
  62. package/dist/trace-ai/exp/preflight.d.ts +77 -0
  63. package/dist/trace-ai/exp/preflight.js +148 -0
  64. package/dist/trace-ai/exp/providers/synthesizer-client.d.ts +3 -14
  65. package/dist/trace-ai/exp/providers/synthesizer-client.js +53 -35
  66. package/dist/trace-ai/exp/providers/triage-client.d.ts +15 -2
  67. package/dist/trace-ai/exp/providers/triage-client.js +143 -28
  68. package/dist/trace-ai/exp/run-preflight.d.ts +19 -0
  69. package/dist/trace-ai/exp/run-preflight.js +56 -0
  70. package/dist/trace-ai/exp/schemas.d.ts +402 -44
  71. package/dist/trace-ai/exp/schemas.js +131 -18
  72. package/dist/utils/deprecation.d.ts +1 -0
  73. package/dist/utils/deprecation.js +18 -0
  74. package/package.json +2 -1
@@ -43,13 +43,21 @@ export interface AgentInfo {
43
43
  }
44
44
  export declare function buildChatUrl(baseUrl: string, agentKey: string): string;
45
45
  export declare function buildAgentInfoUrl(baseUrl: string, agentId: string, version: string): string;
46
- export declare function fetchAgentInfo(options: {
46
+ /** Options for fetching agent data from the agent-factory API. */
47
+ export interface AgentFetchOptions {
47
48
  baseUrl: string;
48
49
  accessToken: string;
49
50
  agentId: string;
50
51
  version: string;
51
52
  businessDomain?: string;
52
- }): Promise<AgentInfo>;
53
+ }
54
+ /**
55
+ * Fetch the full agent configuration body (system_prompt, llms, skills, …) from
56
+ * the agent-factory API. Returns the raw parsed JSON object unchanged — callers
57
+ * narrow it as needed (see fetchAgentInfo).
58
+ */
59
+ export declare function fetchAgentConfig(options: AgentFetchOptions): Promise<Record<string, unknown>>;
60
+ export declare function fetchAgentInfo(options: AgentFetchOptions): Promise<AgentInfo>;
53
61
  export declare function extractText(data: unknown): string;
54
62
  export declare function processIncrementalUpdate(data: {
55
63
  key?: string[];
@@ -17,7 +17,12 @@ function applyConversationOptions(body, conversationId) {
17
17
  body.conversation_id = conversationId;
18
18
  body.chat_option = { is_need_history: true };
19
19
  }
20
- export async function fetchAgentInfo(options) {
20
+ /**
21
+ * Fetch the full agent configuration body (system_prompt, llms, skills, …) from
22
+ * the agent-factory API. Returns the raw parsed JSON object unchanged — callers
23
+ * narrow it as needed (see fetchAgentInfo).
24
+ */
25
+ export async function fetchAgentConfig(options) {
21
26
  const { baseUrl, accessToken, agentId, version, businessDomain = "bd_public" } = options;
22
27
  const url = buildAgentInfoUrl(baseUrl, agentId, version);
23
28
  const agentHeaders = {
@@ -35,13 +40,22 @@ export async function fetchAgentInfo(options) {
35
40
  headers: agentHeaders,
36
41
  });
37
42
  const data = JSON.parse(body);
38
- if (!data.id || !data.key) {
43
+ if (data === null || typeof data !== "object") {
44
+ throw new Error("Agent config response was not a JSON object.");
45
+ }
46
+ return data;
47
+ }
48
+ export async function fetchAgentInfo(options) {
49
+ const data = await fetchAgentConfig(options);
50
+ const id = data["id"];
51
+ const key = data["key"];
52
+ if (typeof id !== "string" || !id || typeof key !== "string" || !key) {
39
53
  throw new Error("Agent info response did not include id and key.");
40
54
  }
41
55
  return {
42
- id: data.id,
43
- key: data.key,
44
- version: typeof data.version === "string" ? data.version : version,
56
+ id,
57
+ key,
58
+ version: typeof data["version"] === "string" ? data["version"] : options.version,
45
59
  };
46
60
  }
47
61
  function getByPath(obj, path) {
@@ -1,3 +1,17 @@
1
+ /**
2
+ * @deprecated The legacy `/datasources` API surface. The platform has migrated
3
+ * data-connection management to vega catalogs; prefer the equivalents from
4
+ * `../api/vega.js`:
5
+ *
6
+ * testDatasource → testVegaCatalogConnection
7
+ * createDatasource → createVegaCatalog
8
+ * listDatasources → listVegaCatalogs
9
+ * getDatasource → getVegaCatalog
10
+ * deleteDatasource → deleteVegaCatalogs
11
+ *
12
+ * Kept as thin back-compat shims for users on older backends; may be removed
13
+ * in a future major release.
14
+ */
1
15
  export interface TestDatasourceOptions {
2
16
  baseUrl: string;
3
17
  accessToken: string;
@@ -1,3 +1,17 @@
1
+ /**
2
+ * @deprecated The legacy `/datasources` API surface. The platform has migrated
3
+ * data-connection management to vega catalogs; prefer the equivalents from
4
+ * `../api/vega.js`:
5
+ *
6
+ * testDatasource → testVegaCatalogConnection
7
+ * createDatasource → createVegaCatalog
8
+ * listDatasources → listVegaCatalogs
9
+ * getDatasource → getVegaCatalog
10
+ * deleteDatasource → deleteVegaCatalogs
11
+ *
12
+ * Kept as thin back-compat shims for users on older backends; may be removed
13
+ * in a future major release.
14
+ */
1
15
  import { HttpError } from "../utils/http.js";
2
16
  import { encryptPassword } from "../utils/crypto.js";
3
17
  import { buildHeaders } from "./headers.js";
package/dist/cli.js CHANGED
@@ -7,7 +7,6 @@ import { runCallCommand } from "./commands/call.js";
7
7
  import { runConfigCommand } from "./commands/config.js";
8
8
  import { runContextLoaderCommand } from "./commands/context-loader.js";
9
9
  import { runDataflowCommand } from "./commands/dataflow.js";
10
- import { runDsCommand } from "./commands/ds.js";
11
10
  import { runExploreCommand } from "./commands/explore.js";
12
11
  import { runResourceCommand } from "./commands/resource.js";
13
12
  import { runModelCommand } from "./commands/model.js";
@@ -46,7 +45,6 @@ function printHelp() {
46
45
  title: "AI DATA PLATFORM",
47
46
  items: [
48
47
  { name: "bkn", desc: "Knowledge network — build, query, action, metric" },
49
- { name: "ds", desc: "Datasource (list, get, connect, tables)" },
50
48
  { name: "resource (res)", desc: "Resources — list, find, get, query, delete" },
51
49
  { name: "dataflow", desc: "Dataflow document workflows (run, runs, logs)" },
52
50
  { name: "vega", desc: "Vega observability — catalog, resource, query" },
@@ -135,13 +133,6 @@ Usage:
135
133
  kweaver agent publish <agent_id> [-bd value]
136
134
  kweaver agent unpublish <agent_id> [-bd value]
137
135
 
138
- kweaver ds list [--keyword X] [--type T] [-bd value]
139
- kweaver ds get <id>
140
- kweaver ds delete <id> [-y]
141
- kweaver ds tables <id> [--keyword X]
142
- kweaver ds connect <db_type> <host> <port> <database> --account X --password Y [--schema S] [--name N]
143
- [--reuse-existing|--force-new]
144
-
145
136
  kweaver dataflow templates [--json]
146
137
  kweaver dataflow create-dataset --template <name> --set "key=value" [--json] [-bd value]
147
138
  kweaver dataflow create-bkn --template <name> --set "key=value" [--json] [-bd value]
@@ -165,7 +156,8 @@ Usage:
165
156
  kweaver bkn get <kn-id> [options]
166
157
  kweaver bkn search <kn-id> <query> [--max-concepts N] [--mode M] [-bd value]
167
158
  kweaver bkn create [options]
168
- kweaver bkn create-from-ds [options]
159
+ kweaver bkn create-from-catalog [options]
160
+ [deprecated] kweaver bkn create-from-ds [options] (alias for create-from-catalog)
169
161
  kweaver bkn update <kn-id> [options]
170
162
  kweaver bkn delete <kn-id> [-y]
171
163
  kweaver bkn build <kn-id> [--wait] [--no-wait] [--timeout N]
@@ -252,7 +244,6 @@ Commands:
252
244
  token Print the current access token, refreshing it first if needed
253
245
  call (curl) Call an API with curl-style flags and auto-injected token headers
254
246
  agent Agent CRUD, chat, sessions, history, publish/unpublish
255
- ds Manage datasources (list, get, delete, tables, connect)
256
247
  dataflow Dataflow document workflows (list, run, runs, logs)
257
248
  model Model factory: LLM/small-model CRUD (manager) and llm chat (OpenAI-compatible API)
258
249
  resource|res List, find, get, query, delete vega-backend resources (table / logicview)
@@ -340,9 +331,6 @@ export async function run(argv) {
340
331
  if (command === "call" || command === "curl") {
341
332
  return runCallCommand(rest);
342
333
  }
343
- if (command === "ds") {
344
- return runDsCommand(rest);
345
- }
346
334
  if (command === "dataflow") {
347
335
  return runDataflowCommand(rest);
348
336
  }
package/dist/client.d.ts CHANGED
@@ -96,7 +96,13 @@ export declare class KWeaverClient implements ClientContext {
96
96
  readonly conversations: ConversationsResource;
97
97
  /** Dataflow DAG automation (create/run/poll/delete). */
98
98
  readonly dataflows: DataflowsResource;
99
- /** Data source management (connect, test, list tables). */
99
+ /**
100
+ * Data source management (connect, test, list tables).
101
+ *
102
+ * @deprecated Datasource is a legacy concept. Use `client.vega.catalogs` for
103
+ * catalog CRUD and `client.resources` for resource queries. This property is
104
+ * kept as a thin back-compat layer and may be removed in a future major release.
105
+ */
100
106
  readonly datasources: DataSourcesResource;
101
107
  /** Vega-backend resource management (table/logicview resources under a catalog). */
102
108
  readonly resources: ResourcesResource;
package/dist/client.js CHANGED
@@ -58,7 +58,13 @@ export class KWeaverClient {
58
58
  conversations;
59
59
  /** Dataflow DAG automation (create/run/poll/delete). */
60
60
  dataflows;
61
- /** Data source management (connect, test, list tables). */
61
+ /**
62
+ * Data source management (connect, test, list tables).
63
+ *
64
+ * @deprecated Datasource is a legacy concept. Use `client.vega.catalogs` for
65
+ * catalog CRUD and `client.resources` for resource queries. This property is
66
+ * kept as a thin back-compat layer and may be removed in a future major release.
67
+ */
62
68
  datasources;
63
69
  /** Vega-backend resource management (table/logicview resources under a catalog). */
64
70
  resources;
@@ -44,7 +44,7 @@ export declare function generateObjectTypeBkn(tableName: string, dvId: string, p
44
44
  name: string;
45
45
  type: string;
46
46
  }>): string;
47
- export declare function runKnCreateFromDsCommand(args: string[], sampleRows?: Record<string, Array<Record<string, string | null>>>): Promise<number>;
47
+ export declare function runKnCreateFromCatalogCommand(args: string[], sampleRows?: Record<string, Array<Record<string, string | null>>>, invokedAs?: "create-from-catalog" | "create-from-ds"): Promise<number>;
48
48
  export declare function parseKnCreateFromCsvArgs(args: string[]): {
49
49
  dsId: string;
50
50
  files: string;
@@ -14,6 +14,7 @@ import { formatCallOutput } from "./call.js";
14
14
  import { resolveBusinessDomain } from "../config/store.js";
15
15
  import { runDsImportCsv } from "./ds.js";
16
16
  import { renderHelp } from "../help/format.js";
17
+ import { warnDeprecated } from "../utils/deprecation.js";
17
18
  import { pollWithBackoff, detectDisplayKey, formatPkDetectionError, parsePkMap, resolvePrimaryKey, confirmYes, assertVegaCatalogId, } from "./bkn-utils.js";
18
19
  // ── BKN object name validation ──────────────────────────────────────────────
19
20
  // Mirrors bkn-backend OBJECT_NAME_MAX_LENGTH (interfaces/common.go:28) and
@@ -507,29 +508,45 @@ export async function runKnPullCommand(args) {
507
508
  return 1;
508
509
  }
509
510
  }
510
- // ── Create from datasource ──────────────────────────────────────────────────
511
+ // ── Create from catalog (formerly create-from-ds) ──────────────────────────
512
+ const CREATE_FROM_CATALOG_FLAGS = [
513
+ { name: "--name <s>", desc: "Knowledge network name (required)" },
514
+ { name: "--tables <a,b>", desc: "Comma-separated table names (default: all)" },
515
+ { name: "--pk-map <s>", desc: "Explicit primary keys <table>:<field>[,...]; required when auto-detection fails" },
516
+ { name: "--build", desc: "Build after creation (default)" },
517
+ { name: "--no-build", desc: "Skip build after creation" },
518
+ { name: "--timeout <n>", desc: "Build timeout in seconds (default: 300)" },
519
+ { name: "--no-rollback", desc: "Keep partially-created KN on failure (debug; default: rollback)" },
520
+ { name: "-bd, --biz-domain <s>", desc: "Business domain (default: bd_public)" },
521
+ { name: "--pretty", desc: "Pretty-print output (default)" },
522
+ ];
523
+ const KN_CREATE_FROM_CATALOG_HELP = renderHelp({
524
+ tagline: "Create a knowledge network from a vega catalog (resources + object types + optional build).",
525
+ usage: "kweaver bkn create-from-catalog <vega-catalog-id> --name X [flags]",
526
+ flags: CREATE_FROM_CATALOG_FLAGS,
527
+ inheritedFlags: "--base-url, --token, --user, --help",
528
+ examples: [
529
+ "kweaver bkn create-from-catalog vcat-123 --name customers",
530
+ "kweaver bkn create-from-catalog vcat-123 --name orders --tables orders,items --no-build",
531
+ ],
532
+ learnMore: [
533
+ "<vega-catalog-id> is a vega catalog id (use `kweaver vega catalog list` to find one)",
534
+ "Legacy data-connection datasource UUIDs are no longer accepted",
535
+ "`kweaver bkn create-from-ds` is kept as a deprecated alias for back-compat",
536
+ ],
537
+ });
511
538
  const KN_CREATE_FROM_DS_HELP = renderHelp({
512
- tagline: "Create a knowledge network from a vega catalog datasource (resources + object types + optional build)",
539
+ tagline: "[DEPRECATED] Alias for `kweaver bkn create-from-catalog`. Subcommand name retained for back-compat; flags and behavior identical.",
513
540
  usage: "kweaver bkn create-from-ds <vega-catalog-id> --name X [flags]",
514
- flags: [
515
- { name: "--name <s>", desc: "Knowledge network name (required)" },
516
- { name: "--tables <a,b>", desc: "Comma-separated table names (default: all)" },
517
- { name: "--pk-map <s>", desc: "Explicit primary keys <table>:<field>[,...]; required when auto-detection fails" },
518
- { name: "--build", desc: "Build after creation (default)" },
519
- { name: "--no-build", desc: "Skip build after creation" },
520
- { name: "--timeout <n>", desc: "Build timeout in seconds (default: 300)" },
521
- { name: "--no-rollback", desc: "Keep partially-created KN on failure (debug; default: rollback)" },
522
- { name: "-bd, --biz-domain <s>", desc: "Business domain (default: bd_public)" },
523
- { name: "--pretty", desc: "Pretty-print output (default)" },
524
- ],
541
+ flags: CREATE_FROM_CATALOG_FLAGS,
525
542
  inheritedFlags: "--base-url, --token, --user, --help",
526
543
  examples: [
527
544
  "kweaver bkn create-from-ds vcat-123 --name customers",
528
545
  "kweaver bkn create-from-ds vcat-123 --name orders --tables orders,items --no-build",
529
546
  ],
530
547
  learnMore: [
531
- "<vega-catalog-id> is a vega catalog id (use `kweaver vega catalog list` to find one)",
532
- "Legacy data-connection datasource UUIDs are no longer accepted",
548
+ "Prefer `kweaver bkn create-from-catalog` in new scripts.",
549
+ "<vega-catalog-id> is a vega catalog id (use `kweaver vega catalog list` to find one).",
533
550
  ],
534
551
  });
535
552
  export function parseKnCreateFromDsArgs(args) {
@@ -590,7 +607,7 @@ export function parseKnCreateFromDsArgs(args) {
590
607
  }
591
608
  const tables = tablesStr ? tablesStr.split(",").map((s) => s.trim()).filter(Boolean) : [];
592
609
  if (!dsId || !name) {
593
- throw new Error("Usage: kweaver bkn create-from-ds <ds-id> --name X [options]");
610
+ throw new Error("Usage: kweaver bkn create-from-catalog <vega-catalog-id> --name X [options]");
594
611
  }
595
612
  assertVegaCatalogId(dsId);
596
613
  const pkMap = pkMapStr ? parsePkMap(pkMapStr) : {};
@@ -616,19 +633,23 @@ export function generateObjectTypeBkn(tableName, dvId, pk, dk, columns) {
616
633
  const frontmatter = `---\ntype: object_type\nid: ${safeId}\nname: ${tableName}\n---\n\n`;
617
634
  return `${frontmatter}${header}\n${dsTable}\n${dpHeader}${dpRows}\n`;
618
635
  }
619
- export async function runKnCreateFromDsCommand(args, sampleRows) {
636
+ export async function runKnCreateFromCatalogCommand(args, sampleRows, invokedAs = "create-from-catalog") {
637
+ const help = invokedAs === "create-from-ds" ? KN_CREATE_FROM_DS_HELP : KN_CREATE_FROM_CATALOG_HELP;
620
638
  let options;
621
639
  try {
622
640
  options = parseKnCreateFromDsArgs(args);
623
641
  }
624
642
  catch (error) {
625
643
  if (error instanceof Error && error.message === "help") {
626
- console.log(KN_CREATE_FROM_DS_HELP);
644
+ console.log(help);
627
645
  return 0;
628
646
  }
629
647
  console.error(formatHttpError(error));
630
648
  return 1;
631
649
  }
650
+ if (invokedAs === "create-from-ds") {
651
+ warnDeprecated("kweaver bkn create-from-ds", "renamed to `kweaver bkn create-from-catalog`. The old name is kept as an alias and will be removed in a future major release.");
652
+ }
632
653
  try {
633
654
  const token = await ensureValidToken();
634
655
  const base = {
@@ -944,7 +965,7 @@ export function parseKnCreateFromCsvArgs(args) {
944
965
  }
945
966
  const tables = tablesStr ? tablesStr.split(",").map((s) => s.trim()).filter(Boolean) : [];
946
967
  if (!dsId || !files || !name) {
947
- throw new Error("Usage: kweaver bkn create-from-csv <ds-id> --files <glob> --name X [options]");
968
+ throw new Error("Usage: kweaver bkn create-from-csv <vega-catalog-id> --files <glob> --name X [options]");
948
969
  }
949
970
  assertVegaCatalogId(dsId);
950
971
  const pkMap = pkMapStr ? parsePkMap(pkMapStr) : {};
@@ -994,7 +1015,7 @@ export async function runKnCreateFromCsvCommand(args) {
994
1015
  return importResult.code;
995
1016
  }
996
1017
  // (Phase 1.5 metadata scan removed — runDsImportCsv now self-scans on
997
- // success, and runKnCreateFromDsCommand's table-discovery retry triggers
1018
+ // success, and runKnCreateFromCatalogCommand's table-discovery retry triggers
998
1019
  // a scan if the catalog still lags. Two layers of fallback are enough.)
999
1020
  // Phase 2: Create KN from datasource
1000
1021
  console.error("Phase 2: Creating knowledge network ...");
@@ -1016,7 +1037,7 @@ export async function runKnCreateFromCsvCommand(args) {
1016
1037
  : []),
1017
1038
  ...(options.noRollback ? ["--no-rollback"] : []),
1018
1039
  ];
1019
- return runKnCreateFromDsCommand(knArgs, importResult.sampleRows);
1040
+ return runKnCreateFromCatalogCommand(knArgs, importResult.sampleRows, "create-from-catalog");
1020
1041
  }
1021
1042
  export function parseActionScheduleArgs(args) {
1022
1043
  const [action, ...rest] = args;
@@ -7,7 +7,7 @@ import { resolveBusinessDomain } from "../config/store.js";
7
7
  import { renderHelp } from "../help/format.js";
8
8
  import { runKnObjectTypeCommand, runKnRelationTypeCommand, runKnActionTypeCommand, runKnConceptGroupCommand, } from "./bkn-schema.js";
9
9
  import { runKnSubgraphCommand, runKnActionExecutionCommand, runKnActionLogCommand, runKnSearchCommand, runKnRelationTypePathsCommand, runKnResourcesCommand, } from "./bkn-query.js";
10
- import { runKnBuildCommand, runKnValidateCommand, runKnPushCommand, runKnPullCommand, runKnCreateFromDsCommand, runKnCreateFromCsvCommand, runKnActionScheduleCommand, runKnJobCommand, } from "./bkn-ops.js";
10
+ import { runKnBuildCommand, runKnValidateCommand, runKnPushCommand, runKnPullCommand, runKnCreateFromCatalogCommand, runKnCreateFromCsvCommand, runKnActionScheduleCommand, runKnJobCommand, } from "./bkn-ops.js";
11
11
  import { runKnMetricCommand } from "./bkn-metric.js";
12
12
  // Re-export shared utils for backward compatibility (tests import from bkn.js)
13
13
  export { pollWithBackoff, parseOntologyQueryFlags, parseJsonObject, parseSearchAfterArray, confirmYes, DISPLAY_HINTS, detectPrimaryKey, detectDisplayKey, } from "./bkn-utils.js";
@@ -368,7 +368,8 @@ const KN_HELP = renderHelp({
368
368
  { name: "list", desc: "List knowledge networks" },
369
369
  { name: "get", desc: "Get KN detail (use --stats or --export)" },
370
370
  { name: "create", desc: "Create a KN (empty or from --body-file)" },
371
- { name: "create-from-ds", desc: "Create KN from datasource (--name --tables --build)" },
371
+ { name: "create-from-catalog", desc: "Create KN from a vega catalog (--name --tables --build)" },
372
+ { name: "create-from-ds", desc: "[deprecated] Alias for `create-from-catalog`; kept for back-compat" },
372
373
  { name: "create-from-csv", desc: "Import CSVs then create KN (--files glob --name --build)" },
373
374
  { name: "update", desc: "Update a KN" },
374
375
  { name: "delete", desc: "Delete a KN" },
@@ -442,8 +443,10 @@ export async function runKnCommand(args) {
442
443
  return runKnGetCommand(rest);
443
444
  if (subcommand === "create")
444
445
  return runKnCreateCommand(rest);
446
+ if (subcommand === "create-from-catalog")
447
+ return runKnCreateFromCatalogCommand(rest, undefined, "create-from-catalog");
445
448
  if (subcommand === "create-from-ds")
446
- return runKnCreateFromDsCommand(rest);
449
+ return runKnCreateFromCatalogCommand(rest, undefined, "create-from-ds");
447
450
  if (subcommand === "create-from-csv")
448
451
  return runKnCreateFromCsvCommand(rest);
449
452
  if (subcommand === "update")
@@ -1,33 +1,3 @@
1
- export declare function runDsCommand(args: string[]): Promise<number>;
2
- export declare function parseDsListArgs(args: string[]): {
3
- keyword?: string;
4
- type?: string;
5
- businessDomain: string;
6
- pretty: boolean;
7
- };
8
- /**
9
- * Match candidate signature against a list response (the kind returned by
10
- * `listDatasources`). Connection metadata lives under `bin_data` — host,
11
- * port, account, plus type-specific fields (`database_name` for MySQL etc.).
12
- *
13
- * Exported for unit testing.
14
- */
15
- export interface DsMatchSignature {
16
- type: string;
17
- host: string;
18
- port: number;
19
- database: string;
20
- account: string;
21
- name?: string;
22
- }
23
- export interface DsMatchHit {
24
- id: string;
25
- name: string;
26
- matchedByName: boolean;
27
- matchedByTuple: boolean;
28
- }
29
- export declare function findExistingDatasource(listBody: string, sig: DsMatchSignature): DsMatchHit | undefined;
30
- export declare function findDatasourceIdByName(listBody: string, name: string): string | undefined;
31
1
  export declare function parseImportCsvArgs(args: string[]): {
32
2
  datasourceId: string;
33
3
  files: string;
@@ -44,4 +14,3 @@ export interface ImportCsvResult {
44
14
  sampleRows: Record<string, Array<Record<string, string | null>>>;
45
15
  }
46
16
  export declare function runDsImportCsv(args: string[]): Promise<ImportCsvResult>;
47
- export declare function runDsImportCsvCommand(args: string[]): Promise<number>;