@openbkn/bkn-sdk 0.1.0 → 0.1.1-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/cli.ts","../package.json","../src/commands/admin.ts","../src/help/grouped-help.ts","../src/utils/output.ts","../src/commands/_shared.ts","../src/commands/auth.ts","../src/auth/oauth.ts","../src/commands/agent.ts","../src/commands/bkn.ts","../src/utils/bkn-validate.ts","../src/commands/call.ts","../src/commands/config.ts","../src/commands/context.ts","../src/commands/dataflow.ts","../src/commands/explore.ts","../src/commands/model.ts","../src/commands/resource.ts","../src/commands/skill.ts","../src/commands/toolbox.ts","../src/commands/trace.ts","../src/trace-ai/schema-validate.ts","../src/commands/vega.ts"],"sourcesContent":["#!/usr/bin/env node\n/**\n * `openbkn` — unified CLI for the BKN platform.\n * Thin shell: parse argv → call a resource → print. No business logic here.\n */\nimport { Command } from \"commander\";\nimport pkg from \"../package.json\" with { type: \"json\" };\nimport { adminCommand } from \"./commands/admin.js\";\nimport { agentCommand } from \"./commands/agent.js\";\nimport { authCommand } from \"./commands/auth.js\";\nimport { bknCommand } from \"./commands/bkn.js\";\nimport { callCommand } from \"./commands/call.js\";\nimport { configCommand } from \"./commands/config.js\";\nimport { contextCommand } from \"./commands/context.js\";\nimport { dataflowCommand } from \"./commands/dataflow.js\";\nimport { exploreCommand } from \"./commands/explore.js\";\nimport { modelCommand } from \"./commands/model.js\";\nimport { resourceCommand } from \"./commands/resource.js\";\nimport { skillCommand } from \"./commands/skill.js\";\nimport { toolCommand, toolboxCommand } from \"./commands/toolbox.js\";\nimport { traceCommand } from \"./commands/trace.js\";\nimport { vegaCommand } from \"./commands/vega.js\";\nimport { installGroupedHelp } from \"./help/grouped-help.js\";\nimport { formatError, toExitCode } from \"./utils/errors.js\";\n\nconst program = new Command();\n\nprogram\n .name(\"openbkn\")\n .description(\"Operate the BKN platform from the CLI\")\n .version(pkg.version, \"-V, --version\", \"output the version number\")\n .option(\"--base-url <url>\", \"platform base URL (env: BKN_BASE_URL)\")\n .option(\"--token <value>\", \"access token (env: BKN_TOKEN)\")\n .option(\"--user <id|name>\", \"use specific user credentials (env: BKN_USER)\")\n .option(\"--json\", \"machine-readable JSON output\")\n .option(\"--compact\", \"single-line JSON output\")\n .option(\"--biz-domain <s>\", \"business domain (alias: -bd)\")\n .option(\"-k, --insecure\", \"skip TLS verification (dev / self-signed only)\")\n .showHelpAfterError();\n\n// Real commands.\nprogram.addCommand(authCommand());\nprogram.addCommand(callCommand());\nprogram.addCommand(configCommand());\nprogram.addCommand(vegaCommand());\nprogram.addCommand(bknCommand());\nprogram.addCommand(resourceCommand());\nprogram.addCommand(dataflowCommand());\nprogram.addCommand(contextCommand());\nprogram.addCommand(agentCommand());\nprogram.addCommand(modelCommand());\nprogram.addCommand(skillCommand());\nprogram.addCommand(toolboxCommand());\nprogram.addCommand(toolCommand());\nprogram.addCommand(traceCommand());\nprogram.addCommand(adminCommand());\nprogram.addCommand(exploreCommand());\n\n// Apply grouped help to the whole tree (after all commands are registered).\ninstallGroupedHelp(program);\n\n// Legacy `-bd` is a 2-char short flag commander can't declare; rewrite it to\n// the canonical `--biz-domain` before parsing (kweaver compatibility).\nconst argv = process.argv.map((a) => (a === \"-bd\" ? \"--biz-domain\" : a));\n\ntry {\n await program.parseAsync(argv);\n} catch (err) {\n console.error(formatError(err));\n process.exit(toExitCode(err));\n}\n","{\n \"name\": \"@openbkn/bkn-sdk\",\n \"version\": \"0.1.0\",\n \"description\": \"Unified TypeScript SDK + CLI for the BKN (Business Knowledge Network) platform.\",\n \"type\": \"module\",\n \"license\": \"Apache-2.0\",\n \"engines\": {\n \"node\": \">=22\"\n },\n \"bin\": {\n \"openbkn\": \"./dist/cli.js\"\n },\n \"main\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"exports\": {\n \".\": {\n \"types\": \"./dist/index.d.ts\",\n \"import\": \"./dist/index.js\"\n }\n },\n \"files\": [\"dist\", \"README.md\", \"README.zh.md\", \"LICENSE\"],\n \"publishConfig\": {\n \"access\": \"public\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/openbkn-ai/bkn-sdk.git\"\n },\n \"keywords\": [\"bkn\", \"openbkn\", \"knowledge-network\", \"cli\", \"sdk\", \"typescript\"],\n \"scripts\": {\n \"build\": \"tsup\",\n \"dev\": \"tsup --watch\",\n \"typecheck\": \"tsc --noEmit\",\n \"lint\": \"biome check . && tsc --noEmit\",\n \"format\": \"biome format --write .\",\n \"test\": \"vitest run\",\n \"test:cover\": \"vitest run --coverage\",\n \"ci\": \"npm run lint && npm test\",\n \"prepublishOnly\": \"npm run ci && npm run build\"\n },\n \"dependencies\": {\n \"@clack/prompts\": \"^0.9.1\",\n \"chalk\": \"^5.4.1\",\n \"cli-table3\": \"^0.6.5\",\n \"commander\": \"^13.1.0\",\n \"csv-parse\": \"^6.2.1\",\n \"js-yaml\": \"^4.2.0\",\n \"jszip\": \"^3.10.1\",\n \"zod\": \"^3.24.1\"\n },\n \"devDependencies\": {\n \"@biomejs/biome\": \"^1.9.4\",\n \"@types/js-yaml\": \"^4.0.9\",\n \"@types/node\": \"^22.13.0\",\n \"tsup\": \"^8.4.0\",\n \"typescript\": \"^5.8.0\",\n \"vitest\": \"^3.0.0\"\n }\n}\n","/**\n * `openbkn admin …` — the kweaver-admin operator CLI, nested as a subcommand.\n * Mapping is 1:1: `kweaver-admin <x>` → `openbkn admin <x>`. org/user/role\n * reads + writes (create/update/delete/reset-password) and org tree are real\n * and live-verified; operator `auth` reuses the top-level `openbkn auth`.\n */\nimport { Command } from \"commander\";\nimport { rawCall } from \"../api/call.js\";\nimport { resolveContext } from \"../config/resolve.js\";\nimport { activePlatform, setActivePlatform } from \"../config/store.js\";\nimport { group } from \"../help/grouped-help.js\";\nimport { DEFAULT_LIST_LIMIT } from \"../types.js\";\nimport { renderOrgTree } from \"../utils/org-tree.js\";\nimport { printJson } from \"../utils/output.js\";\nimport { clientFrom, outputOptions, readBody } from \"./_shared.js\";\nimport { registerAuthLeaves } from \"./auth.js\";\n\nconst int = (v: string) => Number.parseInt(v, 10);\n\nexport function adminCommand(): Command {\n const admin = new Command(\"admin\").description(\n \"Operator CLI (kweaver-admin): org, user, role, models, audit\",\n );\n\n // Operator auth = the same leaves as top-level `openbkn auth` (1:1 nest).\n registerAuthLeaves(admin.command(\"auth\").description(\"Operator authentication\"));\n\n const org = admin.command(\"org\").description(\"Departments and org structure\");\n org\n .command(\"list\")\n .description(\"List departments\")\n .option(\"--role <r>\", \"role qualifier\", \"super_admin\")\n .option(\"--name <s>\", \"filter by name\")\n .option(\"--limit <n>\", \"page size\", int, 100)\n .option(\"--offset <n>\", \"page offset\", int, 0)\n .action(async (opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).admin.orgList({\n role: opts.role,\n name: opts.name,\n limit: opts.limit,\n offset: opts.offset,\n }),\n outputOptions(cmd),\n );\n });\n org\n .command(\"get <id>\")\n .description(\"Get one department\")\n .action(async (id: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).admin.orgGet(id), outputOptions(cmd));\n });\n org\n .command(\"members <id>\")\n .description(\"List members of a department\")\n .option(\"--role <r>\", \"role qualifier\", \"super_admin\")\n .option(\"--fields <s>\", \"fields segment\", \"users\")\n .option(\"--limit <n>\", \"page size\", int, 100)\n .option(\"--offset <n>\", \"page offset\", int, 0)\n .action(async (id: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).admin.orgMembers(id, {\n role: opts.role,\n limit: opts.limit,\n offset: opts.offset,\n }),\n outputOptions(cmd),\n );\n });\n org\n .command(\"create\")\n .description(\"Create a department\")\n .requiredOption(\"--name <s>\", \"department name\")\n .option(\"--parent <id>\", \"parent department id\", \"-1\")\n .option(\"--code <s>\", \"department code\")\n .option(\"--remark <s>\", \"remark\")\n .option(\"--email <s>\", \"email\")\n .option(\"--manager <id>\", \"manager user id\")\n .option(\"--status <n>\", \"status (1=enabled)\", int)\n .option(\"--oss-id <id>\", \"object-storage site id\")\n .action(async (opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).admin.orgCreate({\n name: opts.name,\n parentId: opts.parent,\n code: opts.code,\n remark: opts.remark,\n email: opts.email,\n managerID: opts.manager,\n status: opts.status,\n }),\n outputOptions(cmd),\n );\n });\n org\n .command(\"update <id>\")\n .description(\"Update a department (only provided fields change)\")\n .option(\"--name <s>\", \"new name\")\n .option(\"--code <s>\", \"department code\")\n .option(\"--remark <s>\", \"remark\")\n .option(\"--email <s>\", \"email\")\n .option(\"--manager <id>\", \"manager user id\")\n .option(\"--status <n>\", \"status (1=enabled)\", int)\n .option(\"--oss-id <id>\", \"object-storage site id\")\n .action(async (id: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).admin.orgUpdate(id, {\n name: opts.name,\n code: opts.code,\n remark: opts.remark,\n email: opts.email,\n managerID: opts.manager,\n status: opts.status,\n }),\n outputOptions(cmd),\n );\n });\n org\n .command(\"delete <id>\")\n .description(\"Delete a department\")\n .action(async (id: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).admin.orgDelete(id), outputOptions(cmd));\n });\n org\n .command(\"tree\")\n .description(\"Print the department hierarchy\")\n .option(\"--role <r>\", \"role qualifier\", \"super_admin\")\n .action(async (opts, cmd: Command) => {\n const tree = await clientFrom(cmd).admin.orgTree(opts.role);\n const out = outputOptions(cmd);\n if (out.json) printJson(tree, out);\n else console.log(renderOrgTree(tree));\n });\n\n const user = admin.command(\"user\").description(\"User management\");\n user\n .command(\"list\")\n .description(\"List users\")\n .option(\"--org <id>\", \"filter by department id\")\n .option(\"--keyword <s>\", \"filter by name\")\n .option(\"--limit <n>\", \"page size\", int, 100)\n .option(\"--offset <n>\", \"page offset\", int, 0)\n .action(async (opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).admin.userList({\n orgId: opts.org,\n name: opts.keyword,\n limit: opts.limit,\n offset: opts.offset,\n }),\n outputOptions(cmd),\n );\n });\n user\n .command(\"assign-role <user> <role>\")\n .description(\"Grant a role to a user\")\n .action(async (userId: string, roleId: string, _opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).admin.addRoleMember(roleId, userId, \"user\"),\n outputOptions(cmd),\n );\n });\n user\n .command(\"revoke-role <user> <role>\")\n .description(\"Revoke a role from a user\")\n .action(async (userId: string, roleId: string, _opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).admin.removeRoleMember(roleId, userId, \"user\"),\n outputOptions(cmd),\n );\n });\n user\n .command(\"get <id>\")\n .description(\"Get one user\")\n .action(async (id: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).admin.userGet(id), outputOptions(cmd));\n });\n user\n .command(\"roles <user>\")\n .description(\"List roles granted to a user\")\n .action(async (userId: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).admin.userRoles(userId), outputOptions(cmd));\n });\n user\n .command(\"create\")\n .description(\"Create a user (gets the platform default password)\")\n .requiredOption(\"--login <name>\", \"login name\")\n .option(\"--display-name <s>\", \"display name (defaults to login name)\")\n .option(\"--email <s>\", \"email\")\n .option(\"--department <id>\", \"department id\", \"-1\")\n .option(\"--code <s>\", \"user code\")\n .option(\"--position <s>\", \"position\")\n .option(\"--remark <s>\", \"remark\")\n .option(\"--tel <s>\", \"telephone\")\n .option(\"--priority <n>\", \"priority\", int)\n .option(\"--csf-level <n>\", \"confidentiality level\", int)\n .action(async (opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).admin.userCreate({\n loginName: opts.login,\n displayName: opts.displayName,\n email: opts.email,\n departmentIds: opts.department ? [opts.department] : undefined,\n code: opts.code,\n position: opts.position,\n remark: opts.remark,\n telNumber: opts.tel,\n priority: opts.priority,\n csfLevel: opts.csfLevel,\n }),\n outputOptions(cmd),\n );\n });\n user\n .command(\"update <id>\")\n .description(\"Update a user (only provided fields change)\")\n .option(\"--display-name <s>\", \"display name\")\n .option(\"--email <s>\", \"email\")\n .option(\"--code <s>\", \"user code\")\n .option(\"--position <s>\", \"position\")\n .option(\"--remark <s>\", \"remark\")\n .option(\"--tel <s>\", \"telephone\")\n .option(\"--manager <id>\", \"manager user id\")\n .option(\"--idcard <s>\", \"id-card number\")\n .option(\"--priority <n>\", \"priority\", int)\n .option(\"--csf-level <n>\", \"confidentiality level\", int)\n .option(\"--csf-level2 <n>\", \"secondary confidentiality level\", int)\n .option(\"--expire-time <n>\", \"account expiry (epoch, -1 = never)\", int)\n .action(async (id: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).admin.userUpdate(id, {\n displayName: opts.displayName,\n email: opts.email,\n code: opts.code,\n position: opts.position,\n remark: opts.remark,\n telNumber: opts.tel,\n managerID: opts.manager,\n priority: opts.priority,\n csfLevel: opts.csfLevel,\n }),\n outputOptions(cmd),\n );\n });\n user\n .command(\"delete <id>\")\n .description(\"Delete a user\")\n .action(async (id: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).admin.userDelete(id), outputOptions(cmd));\n });\n user\n .command(\"reset-password [id]\")\n .description(\"Reset a user's password (RSA-encrypted in transit)\")\n .option(\"--id <userId>\", \"explicit user UUID (alt to the positional id)\")\n .option(\"--user <account>\", \"resolve the user by account / login name\")\n .option(\"--password <s>\", \"the new password\")\n .option(\"--new-password <s>\", \"the new password (alias of --password)\")\n .option(\"--prompt-password\", \"prompt for the new password interactively\")\n .option(\"-y, --yes\", \"skip confirmation\")\n .action(async (id: string | undefined, opts, cmd: Command) => {\n const userId = id ?? opts.id ?? opts.user;\n const pwd = opts.password ?? opts.newPassword;\n if (!userId) throw new Error(\"Provide a user id (positional or --id).\");\n if (!pwd) throw new Error(\"Provide --password / --new-password.\");\n printJson(await clientFrom(cmd).admin.userResetPassword(userId, pwd), outputOptions(cmd));\n });\n\n const role = admin.command(\"role\").description(\"Role management\");\n role\n .command(\"list\")\n .description(\"List roles\")\n .option(\"--keyword <s>\", \"filter by keyword\")\n .option(\"--limit <n>\", \"page size\", int, 100)\n .option(\"--offset <n>\", \"page offset\", int, 0)\n .option(\"--source <s>\", \"role source filter (business | user)\")\n .action(async (opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).admin.roleList({ keyword: opts.keyword, limit: opts.limit }),\n outputOptions(cmd),\n );\n });\n role\n .command(\"get <role>\")\n .description(\"Get a role by id\")\n .option(\"--view <mode>\", \"detail view mode\")\n .action(async (roleId: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).admin.roleGet(roleId), outputOptions(cmd));\n });\n role\n .command(\"members <role>\")\n .description(\"List members of a role\")\n .option(\"--keyword <s>\", \"filter by keyword\")\n .option(\"--type <t>\", \"filter by member type (user|department|group|app)\")\n .option(\"--member <spec...>\", \"filter to specific member(s) '<type>:<id-or-name>'\")\n .option(\"--limit <n>\", \"page size\", int, 100)\n .option(\"--offset <n>\", \"page offset\", int, 0)\n .action(async (roleId: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).admin.roleMembers(roleId, {\n keyword: opts.keyword,\n limit: opts.limit,\n }),\n outputOptions(cmd),\n );\n });\n role\n .command(\"add-member <role> <id>\")\n .description(\"Add a member to a role\")\n .option(\"--type <t>\", \"member type\", \"user\")\n .option(\"--member <spec...>\", \"member(s) as '<type>:<id-or-name>' (alt to <id>)\")\n .action(async (roleId: string, id: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).admin.addRoleMember(roleId, id, opts.type),\n outputOptions(cmd),\n );\n });\n role\n .command(\"remove-member <role> <id>\")\n .description(\"Remove a member from a role\")\n .option(\"--type <t>\", \"member type\", \"user\")\n .option(\"--member <spec...>\", \"member(s) as '<type>:<id-or-name>' (alt to <id>)\")\n .action(async (roleId: string, id: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).admin.removeRoleMember(roleId, id, opts.type),\n outputOptions(cmd),\n );\n });\n\n // Models management reuses the (validated) mf-model-manager client. Granular\n // flags assemble the request body; `--body`/`--body-file` override wins.\n const modelBody = (opts: Record<string, unknown>): unknown => {\n if (opts.body || opts.bodyFile) return readBody(opts as { body?: string; bodyFile?: string });\n const mc: Record<string, unknown> = {};\n if (opts.apiModel) mc.api_model = opts.apiModel;\n if (opts.apiUrl) mc.api_url = opts.apiUrl;\n if (opts.apiBase) mc.api_url = opts.apiBase;\n if (opts.apiKey) mc.api_key = opts.apiKey;\n const body: Record<string, unknown> = {};\n if (opts.name) body.model_name = opts.name;\n if (opts.series) body.model_series = opts.series;\n if (opts.type) body.model_type = opts.type;\n if (opts.icon) body.icon = opts.icon;\n if (opts.embeddingDim !== undefined) body.model_dimensions = opts.embeddingDim;\n if (opts.maxTokens !== undefined) body.max_model_len = opts.maxTokens;\n if (opts.batchSize !== undefined) body.batch_size = opts.batchSize;\n if (Object.keys(mc).length > 0) body.model_config = mc;\n return body;\n };\n for (const kind of [\"llm\", \"small-model\"] as const) {\n const isLlm = kind === \"llm\";\n const m = admin.command(kind).description(`${kind} management`);\n const ns = isLlm ? \"llm\" : \"small\";\n\n const list = m\n .command(\"list\")\n .description(`List ${kind} models`)\n .option(\"--name <s>\", \"filter by name\")\n .option(\"--page <n>\", \"page\", int, 1)\n .option(\"--size <n>\", \"page size\", int, DEFAULT_LIST_LIMIT);\n (isLlm\n ? list.option(\"--series <s>\", \"model series\")\n : list.option(\"--type <t>\", \"model type\")\n ).action(async (opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).models[ns].list({\n name: opts.name,\n page: opts.page,\n limit: opts.size,\n modelType: opts.type,\n }),\n outputOptions(cmd),\n );\n });\n\n m.command(\"get <modelid>\")\n .description(`Get a ${kind} model`)\n .action(async (id: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).models[ns].get(id), outputOptions(cmd));\n });\n\n const add = m\n .command(\"add\")\n .description(`Register a ${kind} model (granular flags or --body/--body-file)`)\n .option(\"--name <s>\", \"model name\")\n .option(\"--api-model <s>\", \"upstream API model id\")\n .option(\"--api-key <s>\", \"upstream API key\")\n .option(\"--body <json>\", \"model config JSON (overrides flags)\")\n .option(\"--body-file <path>\", \"read config JSON from a file\");\n if (isLlm) {\n add\n .option(\"--series <s>\", \"model series\")\n .option(\"--api-base <url>\", \"upstream API base URL\")\n .option(\"--icon <url>\", \"icon URL\");\n } else {\n add\n .option(\"--type <t>\", \"small-model type (embedding|reranker)\")\n .option(\"--api-url <url>\", \"upstream API URL\")\n .option(\"--embedding-dim <n>\", \"embedding dimensions\", int)\n .option(\"--max-tokens <n>\", \"max tokens\", int)\n .option(\"--batch-size <n>\", \"batch size\", int);\n }\n add.action(async (opts, cmd: Command) => {\n printJson(await clientFrom(cmd).models[ns].add(modelBody(opts)), outputOptions(cmd));\n });\n\n const edit = m\n .command(\"edit <modelid>\")\n .description(`Edit a ${kind} model (granular flags or --body/--body-file)`)\n .option(\"--name <s>\", \"model name\")\n .option(\"--body <json>\", \"model config JSON (overrides flags)\")\n .option(\"--body-file <path>\", \"read config JSON from a file\");\n if (isLlm) {\n edit.option(\"--icon <url>\", \"icon URL\");\n } else {\n edit\n .option(\"--api-model <s>\", \"upstream API model id\")\n .option(\"--api-url <url>\", \"upstream API URL\");\n }\n edit.action(async (id: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).models[ns].edit({ model_id: id, ...(modelBody(opts) as object) }),\n outputOptions(cmd),\n );\n });\n\n m.command(\"delete <modelid...>\")\n .description(`Delete ${kind} model(s)`)\n .action(async (ids: string[], _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).models[ns].delete(ids), outputOptions(cmd));\n });\n\n m.command(\"test <modelid>\")\n .description(`Test a ${kind} model`)\n .option(\"--body <json>\", \"test request JSON\")\n .option(\"--body-file <path>\", \"read test request JSON from a file\")\n .action(async (id: string, opts, cmd: Command) => {\n const body = opts.body || opts.bodyFile ? (readBody(opts) as object) : {};\n printJson(\n await clientFrom(cmd).models[ns].test({ model_id: id, ...body }),\n outputOptions(cmd),\n );\n });\n }\n\n admin\n .command(\"audit\")\n .description(\"Audit log queries\")\n .command(\"list\")\n .description(\"List login audit events\")\n .option(\"--user <name>\", \"filter by user\")\n .option(\"--start <time>\", \"start time\")\n .option(\"--end <time>\", \"end time\")\n .option(\"--page <n>\", \"page\", int, 1)\n .option(\"--size <n>\", \"page size\", int, 30)\n .action(async (opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).admin.auditList({\n user: opts.user,\n start: opts.start,\n end: opts.end,\n page: opts.page,\n size: opts.size,\n }),\n outputOptions(cmd),\n );\n });\n const adminConfig = admin.command(\"config\").description(\"Admin CLI config (active platform)\");\n adminConfig\n .command(\"show\")\n .description(\"Show the active platform\")\n .action((_opts, cmd: Command) => {\n printJson({ baseUrl: activePlatform() }, outputOptions(cmd));\n });\n adminConfig\n .command(\"set <key> <value>\")\n .description(\"Set a config value (baseUrl)\")\n .action((key: string, value: string, _opts, cmd: Command) => {\n if (key !== \"baseUrl\") {\n throw new Error(`Unknown config key: ${key} (only baseUrl supported)`);\n }\n setActivePlatform(value.replace(/\\/+$/, \"\"));\n printJson({ ok: true, baseUrl: value }, outputOptions(cmd));\n });\n admin\n .command(\"call <url>\")\n .description(\"Operator API passthrough (curl-style; auto-injected auth)\")\n .option(\"-X, --request <method>\", \"HTTP method\")\n .option(\n \"-H, --header <header>\",\n 'extra header \"Name: value\" (repeatable)',\n (v, a: string[]) => {\n a.push(v);\n return a;\n },\n [] as string[],\n )\n .option(\"-d, --data <body>\", \"request body (JSON content-type if unset)\")\n .action(async (url: string, opts, cmd: Command) => {\n const g = cmd.optsWithGlobals();\n const res = await rawCall(\n resolveContext({\n baseUrl: g.baseUrl,\n token: g.token,\n user: g.user,\n businessDomain: g.bizDomain,\n insecure: g.insecure,\n }),\n url,\n { method: opts.request, header: opts.header, data: opts.data, businessDomain: g.bizDomain },\n );\n const out = outputOptions(cmd);\n try {\n printJson(JSON.parse(res.body), out);\n } catch {\n process.stdout.write(res.body.endsWith(\"\\n\") ? res.body : `${res.body}\\n`);\n }\n if (res.status >= 400) process.exitCode = 1;\n });\n\n return group(admin, \"OPERATOR\");\n}\n","/**\n * Grouped help formatter for commander — reproduces the legacy Kweaver layout\n * (section headers + USAGE / FLAGS) at every command level. One formatter, no\n * per-command help strings: each command carries a `group` tag read here.\n */\nimport type { Command, Help } from \"commander\";\n\nconst GROUP = Symbol(\"openbkn.group\");\nconst DEFAULT_GROUP = \"COMMANDS\";\n\n/** Tag a command with the help section it belongs to. Returns the command. */\nexport function group(cmd: Command, name: string): Command {\n (cmd as unknown as Record<symbol, string>)[GROUP] = name;\n return cmd;\n}\n\nfunction groupOf(cmd: Command): string {\n return (cmd as unknown as Record<symbol, string>)[GROUP] ?? DEFAULT_GROUP;\n}\n\nfunction formatHelp(cmd: Command, helper: Help): string {\n const out: string[] = [];\n const desc = helper.commandDescription(cmd);\n if (desc) out.push(desc, \"\");\n\n out.push(\"USAGE\", ` ${helper.commandUsage(cmd)}`, \"\");\n\n const subs = helper.visibleCommands(cmd);\n if (subs.length > 0) {\n const width = Math.max(...subs.map((c) => helper.subcommandTerm(c).length));\n const sections = new Map<string, Command[]>();\n for (const c of subs) {\n const g = groupOf(c);\n const bucket = sections.get(g);\n if (bucket) bucket.push(c);\n else sections.set(g, [c]);\n }\n for (const [name, cmds] of sections) {\n out.push(name);\n for (const c of cmds) {\n out.push(` ${helper.subcommandTerm(c).padEnd(width)} ${helper.subcommandDescription(c)}`);\n }\n out.push(\"\");\n }\n }\n\n const opts = helper.visibleOptions(cmd);\n if (opts.length > 0) {\n const width = Math.max(...opts.map((o) => helper.optionTerm(o).length));\n out.push(\"FLAGS\");\n for (const o of opts) {\n out.push(` ${helper.optionTerm(o).padEnd(width)} ${helper.optionDescription(o)}`);\n }\n out.push(\"\");\n }\n\n return out.join(\"\\n\");\n}\n\n/**\n * Apply the grouped formatter to a command and every descendant. Call AFTER all\n * subcommands are added — commander's `configureHelp` is per-command and is not\n * inherited through `addCommand`, so we set it on each node explicitly.\n */\nexport function installGroupedHelp(root: Command): void {\n const apply = (cmd: Command): void => {\n cmd.configureHelp({ formatHelp });\n for (const child of cmd.commands) apply(child);\n };\n apply(root);\n}\n","/** Output helpers: clean JSON for scripts, aligned tables for humans. */\nimport Table from \"cli-table3\";\n\nexport interface OutputOptions {\n /** Emit machine-readable JSON instead of a table. */\n json?: boolean;\n /** Single-line JSON (implies json). */\n compact?: boolean;\n}\n\n/**\n * Primary output sink. With `--json`/`--compact` (the equivalence path) it\n * prints JSON. Otherwise it renders a human table when the payload is a list of\n * objects (unwrapping common envelopes like `entries`/`data`/`cases`), falling\n * back to pretty JSON for single objects / scalars.\n */\nexport function printJson(value: unknown, opts: OutputOptions = {}): void {\n if (opts.json || opts.compact) {\n process.stdout.write(`${JSON.stringify(value, null, opts.compact ? 0 : 2)}\\n`);\n return;\n }\n const rows = toRows(value);\n if (rows) {\n const columns = columnsOf(rows);\n if (columns.length > 0) {\n printTable(rows, columns);\n return;\n }\n }\n process.stdout.write(`${JSON.stringify(value, null, 2)}\\n`);\n}\n\nconst ROW_ENVELOPES = [\"entries\", \"data\", \"cases\", \"reports\", \"results\", \"list\", \"recurringRules\"];\n\n/** Find the primary array-of-objects in a value (unwrapping common envelopes). */\nfunction toRows(value: unknown): Array<Record<string, unknown>> | null {\n const isRowArray = (v: unknown): v is Array<Record<string, unknown>> =>\n Array.isArray(v) &&\n v.length > 0 &&\n v.every((x) => x !== null && typeof x === \"object\" && !Array.isArray(x));\n if (isRowArray(value)) return value;\n if (value && typeof value === \"object\") {\n for (const key of ROW_ENVELOPES) {\n const inner = (value as Record<string, unknown>)[key];\n if (isRowArray(inner)) return inner;\n }\n }\n return null;\n}\n\n/** Column set = union of row keys, in first-seen order. */\nfunction columnsOf(rows: Array<Record<string, unknown>>): string[] {\n const seen: string[] = [];\n for (const row of rows) {\n for (const k of Object.keys(row)) if (!seen.includes(k)) seen.push(k);\n }\n return seen;\n}\n\n/** Print rows as an aligned table, or as JSON when `--json`/`--compact` is set. */\nexport function printTable(\n rows: Array<Record<string, unknown>>,\n columns: string[],\n opts: OutputOptions = {},\n): void {\n if (opts.json || opts.compact) {\n printJson(rows, opts);\n return;\n }\n const table = new Table({ head: columns });\n for (const row of rows) {\n table.push(columns.map((c) => stringifyCell(row[c])));\n }\n process.stdout.write(`${table.toString()}\\n`);\n}\n\nconst CELL_MAX = 48;\n\nfunction stringifyCell(v: unknown): string {\n if (v === null || v === undefined) return \"\";\n const s = (typeof v === \"object\" ? JSON.stringify(v) : String(v)).replace(/\\s+/g, \" \").trim();\n return s.length > CELL_MAX ? `${s.slice(0, CELL_MAX - 1)}…` : s;\n}\n","/** Helpers shared by command modules: client construction + output options. */\nimport { readFileSync } from \"node:fs\";\nimport type { Command } from \"commander\";\nimport { type BknClient, createClient } from \"../client.js\";\nimport { InputError } from \"../utils/errors.js\";\nimport type { OutputOptions } from \"../utils/output.js\";\n\n/** Build a client from a command's merged (global + local) options. */\nexport function clientFrom(cmd: Command): BknClient {\n const o = cmd.optsWithGlobals();\n return createClient({\n baseUrl: o.baseUrl,\n token: o.token,\n user: o.user,\n businessDomain: o.bizDomain,\n insecure: o.insecure,\n });\n}\n\nexport function outputOptions(cmd: Command): OutputOptions {\n const o = cmd.optsWithGlobals();\n return { json: Boolean(o.json), compact: Boolean(o.compact) };\n}\n\n/** Parse a comma-separated flag value into a trimmed string list. */\nexport function csv(value: string | undefined): string[] | undefined {\n if (!value) return undefined;\n return value\n .split(\",\")\n .map((s) => s.trim())\n .filter(Boolean);\n}\n\n/** Resolve a request body from `--body '<json>'` or `--body-file <path>`. */\nexport function readBody(opts: { body?: string; bodyFile?: string }): unknown {\n const raw = opts.bodyFile ? readFileSync(opts.bodyFile, \"utf8\") : opts.body;\n if (!raw) throw new InputError(\"Provide --body '<json>' or --body-file <path>.\");\n try {\n return JSON.parse(raw);\n } catch {\n throw new InputError(\"Request body is not valid JSON.\");\n }\n}\n","/** `openbkn auth …` — login / session / token (store-backed). */\nimport { readFileSync } from \"node:fs\";\nimport { Command } from \"commander\";\nimport { changePassword } from \"../api/admin.js\";\nimport { browserLogin, passwordLogin } from \"../auth/oauth.js\";\nimport { resolveContext } from \"../config/resolve.js\";\nimport { group } from \"../help/grouped-help.js\";\nimport * as auth from \"../resources/auth.js\";\nimport { printJson } from \"../utils/output.js\";\nimport { outputOptions } from \"./_shared.js\";\n\n/** Register the auth leaves onto a parent (shared by top-level `auth` + `admin auth`). */\nexport function registerAuthLeaves(cmd: Command): void {\n cmd\n .command(\"login <url>\")\n .description(\"Log in to a platform (attach a token, or browser/password OAuth)\")\n .option(\"-u, --username <name>\", \"username for password signin\")\n .option(\"-p, --password <pwd>\", \"password for password signin\")\n .option(\"--token <token>\", \"provide a token directly (CI / headless)\")\n .option(\"--client-id <id>\", \"use a fixed OAuth2 client id (skip dynamic registration)\")\n .option(\"--client-secret <secret>\", \"OAuth2 client secret (omit for public/PKCE)\")\n .option(\"--port <n>\", \"local callback port\", (v) => Number.parseInt(v, 10))\n .option(\n \"--signin-public-key-file <path>\",\n \"override the RSA public key (PEM) for password signin\",\n )\n .option(\"--product <name>\", \"OAuth product query (default 'adp')\")\n .option(\"--no-browser\", \"headless: print the authorize URL instead of opening a browser\")\n .action(async (url: string, opts, cmd: Command) => {\n const g = cmd.optsWithGlobals();\n if (g.insecure) process.env.NODE_TLS_REJECT_UNAUTHORIZED = \"0\";\n const token = opts.token ?? g.token;\n if (token) {\n const r = auth.attachToken(url, token, { insecure: g.insecure });\n printJson({ loggedIn: true, ...r }, outputOptions(cmd));\n return;\n }\n const signinKey = opts.signinPublicKeyFile\n ? readFileSync(opts.signinPublicKeyFile, \"utf8\")\n : undefined;\n const tokens = opts.username\n ? await passwordLogin(url, opts.username, opts.password ?? \"\", {\n clientId: opts.clientId,\n port: opts.port,\n signinPublicKeyPem: signinKey,\n })\n : await browserLogin(url, {\n clientId: opts.clientId,\n port: opts.port,\n noBrowser: opts.browser === false,\n });\n const r = auth.attachToken(url, tokens.accessToken, {\n refreshToken: tokens.refreshToken,\n idToken: tokens.idToken,\n insecure: g.insecure,\n });\n printJson({ loggedIn: true, ...r }, outputOptions(cmd));\n });\n\n cmd\n .command(\"status\")\n .description(\"Show base URL and whether a token is configured\")\n .action((_opts, cmd: Command) => printJson(auth.status(), outputOptions(cmd)));\n\n cmd\n .command(\"token\")\n .description(\"Print the current access token (keep secret)\")\n .action(() => {\n process.stdout.write(`${auth.currentToken()}\\n`);\n });\n\n cmd\n .command(\"whoami [url]\")\n .description(\"Show current user identity (from the token)\")\n .option(\"--no-lookup\", \"skip the backend identity fallback (eacp/user/get)\")\n .action((_url: string | undefined, _opts, cmd: Command) =>\n printJson(auth.whoami(), outputOptions(cmd)),\n );\n\n cmd\n .command(\"list\")\n .alias(\"ls\")\n .description(\"List platforms with a saved session\")\n .action((_opts, cmd: Command) => printJson(auth.listPlatforms(), outputOptions(cmd)));\n\n cmd\n .command(\"use <url>\")\n .description(\"Switch the active platform\")\n .action((url: string, _opts, cmd: Command) => {\n auth.use(url);\n printJson(auth.status(), outputOptions(cmd));\n });\n\n cmd\n .command(\"logout\")\n .description(\"Remove the stored token for the active platform\")\n .action((_opts, cmd: Command) => printJson({ loggedOut: auth.logout() }, outputOptions(cmd)));\n\n cmd\n .command(\"delete <url>\")\n .description(\"Delete saved credentials for a platform\")\n .action((url: string, _opts, cmd: Command) =>\n printJson({ deleted: auth.deletePlatform(url) }, outputOptions(cmd)),\n );\n\n cmd\n .command(\"switch <url> <user-id>\")\n .description(\"Switch the active user for a platform\")\n .action((url: string, userId: string, _opts, cmd: Command) => {\n printJson(auth.switchUser(url, userId), outputOptions(cmd));\n });\n\n cmd\n .command(\"users <url>\")\n .description(\"List saved user profiles for a platform\")\n .action((url: string, _opts, cmd: Command) => {\n printJson(auth.usersOf(url), outputOptions(cmd));\n });\n\n cmd\n .command(\"export\")\n .description(\"Export the active session's tokens (for a headless host)\")\n .action((_opts, cmd: Command) => {\n printJson(auth.exportCreds(), outputOptions(cmd));\n });\n\n cmd\n .command(\"change-password [url]\")\n .description(\"Change your account password (EACP, RSA-encrypted in transit)\")\n .requiredOption(\"-a, --account <name>\", \"account / login name\")\n .requiredOption(\"--old-password <pwd>\", \"current password\")\n .requiredOption(\"--new-password <pwd>\", \"new password\")\n .option(\"--public-key-file <path>\", \"override the RSA public key (PEM) for password encryption\")\n .action(async (_url: string | undefined, opts, cmd: Command) => {\n const g = cmd.optsWithGlobals();\n const ctx = resolveContext({\n baseUrl: g.baseUrl,\n token: g.token,\n user: g.user,\n businessDomain: g.bizDomain,\n insecure: g.insecure,\n });\n printJson(\n await changePassword(ctx, opts.account, opts.oldPassword, opts.newPassword),\n outputOptions(cmd),\n );\n });\n}\n\nexport function authCommand(): Command {\n const cmd = new Command(\"auth\").description(\"Login, session, and token management\");\n registerAuthLeaves(cmd);\n return group(cmd, \"AUTHENTICATION & CONFIG\");\n}\n","/**\n * OAuth2 login flows for `openbkn auth login` — browser (PKCE + loopback\n * callback) and headless password sign-in (RSA-encrypted password → `/oauth2/signin`).\n * Ports the kweaver-admin flow: dynamic client registration (Hydra), authorize\n * redirect, code exchange. Returns a token triple; the command persists it.\n */\nimport { spawn } from \"node:child_process\";\nimport { createHash, constants as cryptoConstants, publicEncrypt, randomBytes } from \"node:crypto\";\nimport { type IncomingMessage, type ServerResponse, createServer } from \"node:http\";\nimport { InputError } from \"../utils/errors.js\";\n\nexport const DEFAULT_REDIRECT_PORT = 9010;\nexport const DEFAULT_SCOPE = \"openid offline all\";\n\n// Studioweb fixed RSA public key for `/oauth2/signin` password encryption\n// (kweaver deploy/auto_config LOGIN_PUBLIC_KEY).\nconst STUDIOWEB_LOGIN_PUBLIC_KEY_PEM = `-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsyOstgbYuubBi2PUqeVj\nGKlkwVUY6w1Y8d4k116dI2SkZI8fxcjHALv77kItO4jYLVplk9gO4HAtsisnNE2o\nwlYIqdmyEPMwupaeFFFcg751oiTXJiYbtX7ABzU5KQYPjRSEjMq6i5qu/mL67XTk\nhvKwrC83zme66qaKApmKupDODPb0RRkutK/zHfd1zL7sciBQ6psnNadh8pE24w8O\n2XVy1v2bgSNkGHABgncR7seyIg81JQ3c/Axxd6GsTztjLnlvGAlmT1TphE84mi99\nfUaGD2A1u1qdIuNc+XuisFeNcUW6fct0+x97eS2eEGRr/7qxWmO/P20sFVzXc2bF\n1QIDAQAB\n-----END PUBLIC KEY-----`;\n\nexport interface OAuthTokens {\n accessToken: string;\n refreshToken?: string;\n idToken?: string;\n}\n\nexport function normalizeBaseUrl(value: string): string {\n return value.replace(/\\/+$/, \"\");\n}\n\nfunction generatePkce(): { verifier: string; challenge: string } {\n const verifier = randomBytes(48).toString(\"base64url\");\n return { verifier, challenge: createHash(\"sha256\").update(verifier).digest(\"base64url\") };\n}\n\nfunction buildAuthorizeUrl(\n base: string,\n clientId: string,\n redirectUri: string,\n state: string,\n codeChallenge: string,\n scope = DEFAULT_SCOPE,\n): string {\n const params = new URLSearchParams({\n response_type: \"code\",\n client_id: clientId,\n redirect_uri: redirectUri,\n scope,\n state,\n \"x-forwarded-prefix\": \"\",\n lang: \"zh-cn\",\n product: \"adp\",\n code_challenge: codeChallenge,\n code_challenge_method: \"S256\",\n });\n return `${base}/oauth2/auth?${params.toString()}`;\n}\n\nfunction mapToken(data: {\n access_token: string;\n refresh_token?: string;\n id_token?: string;\n}): OAuthTokens {\n return {\n accessToken: data.access_token,\n refreshToken: data.refresh_token,\n idToken: data.id_token,\n };\n}\n\nexport interface RegisteredClient {\n clientId: string;\n clientSecret?: string;\n}\n\n/** Register an OAuth2 client with Hydra. Returns its id (+ secret if confidential). */\nexport async function registerClient(\n base: string,\n redirectUri: string,\n scope = DEFAULT_SCOPE,\n): Promise<RegisteredClient> {\n const res = await fetch(`${base}/oauth2/clients`, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\", Accept: \"application/json\" },\n body: JSON.stringify({\n client_name: \"openbkn-cli\",\n grant_types: [\"authorization_code\", \"implicit\", \"refresh_token\"],\n response_types: [\"token id_token\", \"code\", \"token\"],\n scope,\n redirect_uris: [redirectUri],\n post_logout_redirect_uris: [redirectUri.replace(\"/callback\", \"/successful-logout\")],\n metadata: { device: { name: \"openbkn-cli\", client_type: \"web\", description: \"openbkn CLI\" } },\n }),\n });\n if (!res.ok) {\n throw new Error(\n `Client registration failed (${res.status}): ${(await res.text()) || res.statusText}`,\n );\n }\n const data = (await res.json()) as { client_id: string; client_secret?: string };\n return { clientId: data.client_id, clientSecret: data.client_secret };\n}\n\nasync function exchangeCode(\n base: string,\n code: string,\n redirectUri: string,\n client: RegisteredClient,\n codeVerifier: string,\n): Promise<OAuthTokens> {\n const params: Record<string, string> = {\n grant_type: \"authorization_code\",\n code,\n redirect_uri: redirectUri,\n code_verifier: codeVerifier,\n };\n const headers: Record<string, string> = {\n \"Content-Type\": \"application/x-www-form-urlencoded\",\n Accept: \"application/json\",\n };\n if (client.clientSecret) {\n headers.Authorization = `Basic ${Buffer.from(`${client.clientId}:${client.clientSecret}`).toString(\"base64\")}`;\n } else {\n params.client_id = client.clientId;\n }\n const res = await fetch(`${base}/oauth2/token`, {\n method: \"POST\",\n headers,\n body: new URLSearchParams(params).toString(),\n });\n if (!res.ok) {\n throw new Error(\n `Token exchange failed (${res.status}): ${(await res.text()) || res.statusText}`,\n );\n }\n return mapToken((await res.json()) as { access_token: string });\n}\n\nfunction startCallbackServer(\n port: number,\n): Promise<{ code: string; state?: string; close: () => void }> {\n return new Promise((resolve, reject) => {\n const server = createServer((req: IncomingMessage, res: ServerResponse) => {\n const u = new URL(req.url ?? \"/\", `http://127.0.0.1:${port}`);\n if (u.pathname !== \"/callback\") {\n res.writeHead(404);\n res.end();\n return;\n }\n const code = u.searchParams.get(\"code\");\n const error = u.searchParams.get(\"error\");\n if (error) {\n res.writeHead(400, { \"content-type\": \"text/html\" });\n res.end(`<h1>Login failed</h1><p>${error}</p>`);\n server.close(() => reject(new Error(`OAuth error: ${error}`)));\n return;\n }\n if (!code) {\n res.writeHead(400);\n res.end(\"missing code\");\n return;\n }\n res.writeHead(200, { \"content-type\": \"text/html; charset=utf-8\" });\n res.end(\"<h1>Login successful</h1><p>You can close this window.</p>\");\n resolve({\n code,\n state: u.searchParams.get(\"state\") ?? undefined,\n close: () => server.close(),\n });\n });\n server.on(\"error\", reject);\n server.listen(port, \"127.0.0.1\");\n });\n}\n\nfunction openBrowser(url: string): void {\n const cmd =\n process.platform === \"darwin\" ? \"open\" : process.platform === \"win32\" ? \"start\" : \"xdg-open\";\n try {\n spawn(cmd, [url], {\n stdio: \"ignore\",\n detached: true,\n shell: process.platform === \"win32\",\n }).unref();\n } catch {\n /* fall through — URL is printed by the caller */\n }\n}\n\nexport interface BrowserLoginOptions {\n clientId?: string;\n port?: number;\n noBrowser?: boolean;\n scope?: string;\n}\n\n/** Browser PKCE login: resolve client → open authorize URL → catch callback → exchange. */\nexport async function browserLogin(\n baseUrl: string,\n opts: BrowserLoginOptions = {},\n): Promise<OAuthTokens> {\n const base = normalizeBaseUrl(baseUrl);\n const port = opts.port ?? DEFAULT_REDIRECT_PORT;\n const redirectUri = `http://127.0.0.1:${port}/callback`;\n const scope = opts.scope ?? DEFAULT_SCOPE;\n const client = opts.clientId\n ? { clientId: opts.clientId }\n : await registerClient(base, redirectUri, scope);\n const { verifier, challenge } = generatePkce();\n const state = randomBytes(12).toString(\"hex\");\n const authUrl = buildAuthorizeUrl(base, client.clientId, redirectUri, state, challenge, scope);\n\n const waiter = startCallbackServer(port);\n if (opts.noBrowser) {\n process.stderr.write(`Open this URL to log in:\\n${authUrl}\\n`);\n } else {\n process.stderr.write(`Opening browser for login…\\nIf it doesn't open, visit:\\n${authUrl}\\n`);\n openBrowser(authUrl);\n }\n const { code, state: returned, close } = await waiter;\n close();\n if (returned && returned !== state) throw new Error(\"OAuth state mismatch — possible CSRF.\");\n return exchangeCode(base, code, redirectUri, client, verifier);\n}\n\n// ── headless password sign-in ─────────────────────────────────────────────────\n\nfunction mergeCookies(existing: string, res: Response): string {\n const setCookies =\n typeof res.headers.getSetCookie === \"function\"\n ? res.headers.getSetCookie()\n : res.headers.get(\"set-cookie\")\n ? [res.headers.get(\"set-cookie\") as string]\n : [];\n const map = new Map<string, string>();\n const add = (pair: string) => {\n const eq = pair.indexOf(\"=\");\n if (eq > 0) map.set(pair.slice(0, eq), pair.slice(eq + 1));\n };\n for (const p of existing\n .split(\";\")\n .map((s) => s.trim())\n .filter(Boolean))\n add(p);\n for (const sc of setCookies) add(sc.split(\";\")[0]?.trim() ?? \"\");\n return [...map.entries()].map(([k, v]) => `${k}=${v}`).join(\"; \");\n}\n\nfunction parseSigninProps(html: string): {\n csrftoken: string;\n challenge?: string;\n remember?: boolean;\n} {\n const m = html.match(/<script[^>]*\\bid=[\"']__NEXT_DATA__[\"'][^>]*>([\\s\\S]*?)<\\/script>/i);\n if (!m?.[1]) throw new Error(\"Could not find __NEXT_DATA__ on /oauth2/signin.\");\n const data = JSON.parse(m[1]) as Record<string, unknown>;\n const pp = (data.props as Record<string, unknown> | undefined)?.pageProps as\n | Record<string, unknown>\n | undefined;\n const csrftoken = (pp?.csrftoken ?? pp?._csrf) as string | undefined;\n if (typeof csrftoken !== \"string\") throw new Error(\"Sign-in page did not expose csrftoken.\");\n return {\n csrftoken,\n challenge: typeof pp?.challenge === \"string\" ? pp.challenge : undefined,\n remember: pp?.remember === true || pp?.remember === \"true\",\n };\n}\n\nasync function followToCallback(\n startUrl: string,\n jar0: string,\n state: string,\n redirectUri: string,\n): Promise<string> {\n let url = startUrl;\n let jar = jar0;\n const cb = new URL(redirectUri);\n for (let hop = 0; hop < 40; hop++) {\n const resp = await fetch(url, {\n headers: { Cookie: jar, Accept: \"text/html,*/*;q=0.8\" },\n redirect: \"manual\",\n });\n jar = mergeCookies(jar, resp);\n if (![302, 303, 307, 308].includes(resp.status)) {\n throw new Error(`Unexpected OAuth response (HTTP ${resp.status}).`);\n }\n const loc = resp.headers.get(\"location\");\n if (!loc) throw new Error(`OAuth redirect missing Location (HTTP ${resp.status}).`);\n const next = new URL(loc, url);\n if (next.origin === cb.origin && next.pathname === cb.pathname) {\n const err = next.searchParams.get(\"error\");\n if (err) throw new Error(`Authorization failed: ${err}`);\n const code = next.searchParams.get(\"code\");\n if (next.searchParams.get(\"state\") !== state) throw new Error(\"OAuth state mismatch.\");\n if (!code) throw new Error(\"Callback missing authorization code.\");\n return code;\n }\n url = next.href;\n }\n throw new Error(\"Too many OAuth redirects.\");\n}\n\nexport interface PasswordLoginOptions {\n clientId?: string;\n port?: number;\n scope?: string;\n signinPublicKeyPem?: string;\n}\n\n/** Headless password login via RSA-encrypted `/oauth2/signin`. */\nexport async function passwordLogin(\n baseUrl: string,\n username: string,\n password: string,\n opts: PasswordLoginOptions = {},\n): Promise<OAuthTokens> {\n const base = normalizeBaseUrl(baseUrl);\n const port = opts.port ?? DEFAULT_REDIRECT_PORT;\n const redirectUri = `http://127.0.0.1:${port}/callback`;\n const scope = opts.scope ?? DEFAULT_SCOPE;\n const client = opts.clientId\n ? { clientId: opts.clientId }\n : await registerClient(base, redirectUri, scope);\n const { verifier, challenge } = generatePkce();\n const state = randomBytes(12).toString(\"hex\");\n\n let jar = \"\";\n const authResp = await fetch(\n buildAuthorizeUrl(base, client.clientId, redirectUri, state, challenge, scope),\n { redirect: \"manual\" },\n );\n jar = mergeCookies(jar, authResp);\n const authLoc = authResp.headers.get(\"location\");\n if (!authLoc) throw new Error(`/oauth2/auth did not redirect (HTTP ${authResp.status}).`);\n const signinUrl = new URL(authLoc, base);\n if (!signinUrl.pathname.includes(\"signin\")) {\n throw new Error(`Expected a sign-in redirect, got: ${authLoc}`);\n }\n\n const pageResp = await fetch(signinUrl.href, {\n headers: { Cookie: jar, Accept: \"text/html,*/*;q=0.8\" },\n redirect: \"manual\",\n });\n jar = mergeCookies(jar, pageResp);\n const props = parseSigninProps(await pageResp.text());\n const loginChallenge =\n signinUrl.searchParams.get(\"login_challenge\")?.trim() || props.challenge?.trim();\n if (!loginChallenge) throw new Error(\"Could not resolve the login challenge.\");\n\n const cipher = publicEncrypt(\n {\n key: opts.signinPublicKeyPem ?? STUDIOWEB_LOGIN_PUBLIC_KEY_PEM,\n padding: cryptoConstants.RSA_PKCS1_PADDING,\n },\n Buffer.from(password, \"utf8\"),\n ).toString(\"base64\");\n\n const postResp = await fetch(`${base}/oauth2/signin`, {\n method: \"POST\",\n headers: {\n Cookie: jar,\n \"Content-Type\": \"application/json\",\n Accept: \"application/json, text/plain, */*\",\n Origin: new URL(base).origin,\n Referer: signinUrl.href,\n },\n body: JSON.stringify({\n _csrf: props.csrftoken,\n challenge: loginChallenge,\n account: username,\n password: cipher,\n vcode: { id: \"\", content: \"\" },\n dualfactorauthinfo: { validcode: { vcode: \"\" }, OTP: { OTP: \"\" } },\n remember: props.remember ?? false,\n device: { name: \"\", description: \"\", client_type: \"console_web\", udids: [] },\n }),\n redirect: \"manual\",\n });\n jar = mergeCookies(jar, postResp);\n\n let code: string;\n if ([302, 303, 307].includes(postResp.status)) {\n const loc = postResp.headers.get(\"location\");\n if (!loc) throw new Error(\"Sign-in response missing Location.\");\n code = await followToCallback(new URL(loc, base).href, jar, state, redirectUri);\n } else if (postResp.status === 200) {\n const text = await postResp.text();\n let json: Record<string, unknown> | null = null;\n try {\n json = JSON.parse(text) as Record<string, unknown>;\n } catch {\n /* not JSON */\n }\n const redir = json && typeof json.redirect === \"string\" ? json.redirect : \"\";\n if (!redir) {\n const msg = json && typeof json.message === \"string\" ? json.message : text.slice(0, 300);\n throw new InputError(`Sign-in failed: ${msg}`);\n }\n code = await followToCallback(new URL(redir, base).href, jar, state, redirectUri);\n } else {\n throw new InputError(\n `Sign-in failed (HTTP ${postResp.status}): ${(await postResp.text()).slice(0, 300)}`,\n );\n }\n return exchangeCode(base, code, redirectUri, client, verifier);\n}\n","/** `openbkn agent …` — decision agents (read side + listings). */\nimport { Command } from \"commander\";\nimport { group } from \"../help/grouped-help.js\";\nimport { DEFAULT_LIST_LIMIT } from \"../types.js\";\nimport { printJson } from \"../utils/output.js\";\nimport { clientFrom, csv, outputOptions, readBody } from \"./_shared.js\";\n\nconst int = (v: string) => Number.parseInt(v, 10);\n\nexport function agentCommand(): Command {\n const cmd = new Command(\"agent\").description(\"Agent CRUD, chat, sessions, publish\");\n\n cmd\n .command(\"list\")\n .description(\"List published agents\")\n .option(\"--name <s>\", \"filter by name\")\n .option(\"--limit <n>\", \"page size\", int, DEFAULT_LIST_LIMIT)\n .option(\"--offset <n>\", \"page offset\", int, 0)\n .option(\"--category-id <id>\", \"filter by category\")\n .action(async (opts, cmd: Command) => {\n const data = await clientFrom(cmd).agents.list({\n name: opts.name,\n limit: opts.limit,\n offset: opts.offset,\n categoryId: opts.categoryId,\n });\n printJson(data, outputOptions(cmd));\n });\n\n cmd\n .command(\"personal-list\")\n .description(\"List personal-space agents\")\n .option(\"--name <s>\", \"filter by name\")\n .option(\"--limit <n>\", \"page size\", int, DEFAULT_LIST_LIMIT)\n .option(\"--offset <n>\", \"page offset\", int, 0)\n .action(async (opts, cmd: Command) => {\n const data = await clientFrom(cmd).agents.personalList({\n name: opts.name,\n limit: opts.limit,\n offset: opts.offset,\n });\n printJson(data, outputOptions(cmd));\n });\n\n cmd\n .command(\"category-list\")\n .description(\"List agent categories\")\n .action(async (_opts, cmd: Command) => {\n printJson(await clientFrom(cmd).agents.categoryList(), outputOptions(cmd));\n });\n\n cmd\n .command(\"template-list\")\n .description(\"List published agent templates\")\n .option(\"--name <s>\", \"filter by name\")\n .option(\"--limit <n>\", \"page size\", int, DEFAULT_LIST_LIMIT)\n .option(\"--offset <n>\", \"page offset\", int, 0)\n .action(async (opts, cmd: Command) => {\n const data = await clientFrom(cmd).agents.templateList({\n name: opts.name,\n limit: opts.limit,\n offset: opts.offset,\n });\n printJson(data, outputOptions(cmd));\n });\n\n cmd\n .command(\"template-get <id>\")\n .description(\"Get a published agent template\")\n .action(async (id: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).agents.templateGet(id), outputOptions(cmd));\n });\n\n cmd\n .command(\"get <id>\")\n .description(\"Get agent details\")\n .action(async (id: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).agents.get(id), outputOptions(cmd));\n });\n\n cmd\n .command(\"get-by-key <key>\")\n .description(\"Get an agent by key\")\n .action(async (key: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).agents.getByKey(key), outputOptions(cmd));\n });\n\n cmd\n .command(\"create\")\n .description(\"Create an agent (--body-file <json> or --body '<json>')\")\n .option(\"--body <json>\", \"agent definition JSON\")\n .option(\"--body-file <path>\", \"read agent definition JSON from a file\")\n .action(async (opts, cmd: Command) => {\n printJson(await clientFrom(cmd).agents.create(readBody(opts)), outputOptions(cmd));\n });\n\n cmd\n .command(\"update <id>\")\n .description(\"Update an agent (--body-file <json> or --body '<json>')\")\n .option(\"--body <json>\", \"agent definition JSON\")\n .option(\"--body-file <path>\", \"read agent definition JSON from a file\")\n .action(async (id: string, opts, cmd: Command) => {\n printJson(await clientFrom(cmd).agents.update(id, readBody(opts)), outputOptions(cmd));\n });\n\n cmd\n .command(\"delete <id>\")\n .description(\"Delete an agent\")\n .option(\"-y, --yes\", \"skip confirmation\")\n .action(async (id: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).agents.delete(id), outputOptions(cmd));\n });\n\n cmd\n .command(\"publish <id>\")\n .description(\"Publish an agent\")\n .action(async (id: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).agents.publish(id), outputOptions(cmd));\n });\n\n cmd\n .command(\"unpublish <id>\")\n .description(\"Unpublish an agent\")\n .action(async (id: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).agents.unpublish(id), outputOptions(cmd));\n });\n\n cmd\n .command(\"sessions <agent>\")\n .description(\"List conversations for an agent (by agent key)\")\n .option(\"--limit <n>\", \"page size\", int, DEFAULT_LIST_LIMIT)\n .option(\"--page <n>\", \"page\", int, 1)\n .action(async (agentKey: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).agents.sessions(agentKey, { size: opts.limit, page: opts.page }),\n outputOptions(cmd),\n );\n });\n\n cmd\n .command(\"history <agent> <conversation-id>\")\n .description(\"Show message history for a conversation\")\n .action(async (agentKey: string, conversationId: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).agents.history(agentKey, conversationId), outputOptions(cmd));\n });\n\n cmd\n .command(\"chat <agent-id>\")\n .description(\"Chat with an agent (SSE streaming with --stream)\")\n .requiredOption(\"-m, --message <text>\", \"user message\")\n .option(\"--version <v>\", \"agent version\", \"v0\")\n .option(\"--conversation-id <id>\", \"continue an existing conversation\")\n .option(\"--stream\", \"stream the reply to stdout as it arrives\")\n .action(async (agentId: string, opts, cmd: Command) => {\n const client = clientFrom(cmd);\n if (opts.stream) {\n const res = await client.agents.chat(agentId, opts.message, {\n version: opts.version,\n conversationId: opts.conversationId,\n stream: true,\n onDelta: (t) => process.stdout.write(t),\n });\n process.stdout.write(\"\\n\");\n if (res.conversationId) console.error(`conversation_id: ${res.conversationId}`);\n return;\n }\n printJson(\n await client.agents.chat(agentId, opts.message, {\n version: opts.version,\n conversationId: opts.conversationId,\n }),\n outputOptions(cmd),\n );\n });\n\n cmd\n .command(\"trace <conversation-id>\")\n .description(\"Get trace spans for a conversation (agent-scoped alias of `trace get`)\")\n .action(async (conversationId: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).trace.spans(conversationId), outputOptions(cmd));\n });\n\n const skill = cmd.command(\"skill\").description(\"Manage skills attached to an agent\");\n skill\n .command(\"list <agent-id>\")\n .description(\"List skill ids attached to an agent\")\n .action(async (agentId: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).agents.skillList(agentId), outputOptions(cmd));\n });\n skill\n .command(\"add <agent-id> <skill-ids>\")\n .description(\"Attach skill(s) to an agent (comma-joined ids)\")\n .action(async (agentId: string, ids: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).agents.skillAdd(agentId, csv(ids) ?? []), outputOptions(cmd));\n });\n skill\n .command(\"remove <agent-id> <skill-ids>\")\n .description(\"Detach skill(s) from an agent (comma-joined ids)\")\n .action(async (agentId: string, ids: string, _opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).agents.skillRemove(agentId, csv(ids) ?? []),\n outputOptions(cmd),\n );\n });\n\n return group(cmd, \"DECISION AGENT\");\n}\n","/** `openbkn bkn …` — knowledge networks (kept identical to legacy `kweaver bkn`). */\nimport { Command } from \"commander\";\nimport { group } from \"../help/grouped-help.js\";\nimport { DEFAULT_LIST_LIMIT } from \"../types.js\";\nimport { validateBknDirectory } from \"../utils/bkn-validate.js\";\nimport { printJson } from \"../utils/output.js\";\nimport { parsePkMap } from \"../utils/pk-detection.js\";\nimport { clientFrom, csv, outputOptions, readBody } from \"./_shared.js\";\n\nconst int = (v: string) => Number.parseInt(v, 10);\n\nexport function bknCommand(): Command {\n const bkn = new Command(\"bkn\").description(\"Knowledge networks — list, query, schema, instances\");\n\n bkn\n .command(\"list\")\n .description(\"List knowledge networks\")\n .option(\"--limit <n>\", \"page size\", int, DEFAULT_LIST_LIMIT)\n .option(\"--offset <n>\", \"page offset\", int, 0)\n .option(\"--name-pattern <s>\", \"filter by name pattern\")\n .option(\"--tag <s>\", \"filter by tag\")\n .option(\"--sort <field>\", \"sort field\", \"update_time\")\n .option(\"--direction <dir>\", \"asc | desc\", \"desc\")\n .action(async (_opts, cmd: Command) => {\n const o = cmd.optsWithGlobals();\n const data = await clientFrom(cmd).kn.list({\n limit: o.limit,\n offset: o.offset,\n namePattern: o.namePattern,\n tag: o.tag,\n sort: o.sort,\n direction: o.direction,\n });\n printJson(data, outputOptions(cmd));\n });\n\n bkn\n .command(\"get <kn-id>\")\n .description(\"Get a knowledge network (use --stats or --export)\")\n .option(\"--stats\", \"include statistics\")\n .option(\"--export\", \"return the full export payload\")\n .action(async (knId: string, opts, cmd: Command) => {\n const data = await clientFrom(cmd).kn.get(knId, {\n stats: opts.stats,\n exportMode: opts.export,\n });\n printJson(data, outputOptions(cmd));\n });\n\n bkn\n .command(\"search <kn-id> <query>\")\n .description(\"Semantic search within a knowledge network\")\n .option(\"--max-concepts <n>\", \"max concepts to return\", int, 10)\n .option(\"--mode <mode>\", \"retrieval mode\", \"keyword_vector_retrieval\")\n .action(async (knId: string, query: string, opts, cmd: Command) => {\n const data = await clientFrom(cmd).kn.search(knId, query, {\n maxConcepts: opts.maxConcepts,\n mode: opts.mode,\n });\n printJson(data, outputOptions(cmd));\n });\n\n // Schema groups: real list; object-type/relation-type also get real CRUD.\n const schemaGroups: Array<\n [string, \"objectTypes\" | \"relationTypes\" | \"actionTypes\", \"objectType\" | \"relationType\" | null]\n > = [\n [\"object-type\", \"objectTypes\", \"objectType\"],\n [\"relation-type\", \"relationTypes\", \"relationType\"],\n [\"action-type\", \"actionTypes\", null],\n ];\n for (const [name, listMethod, crud] of schemaGroups) {\n const g = bkn.command(name).description(`${name} list/get/...`);\n g.command(\"list <kn-id>\")\n .description(`List ${name}s`)\n .option(\"--branch <b>\", \"branch\", \"main\")\n .action(async (knId: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).kn[listMethod](knId, { branch: opts.branch }),\n outputOptions(cmd),\n );\n });\n if (crud) {\n g.command(\"get <kn-id> <id>\")\n .description(`Get ${name}`)\n .action(async (knId: string, id: string, _o, cmd: Command) => {\n printJson(await clientFrom(cmd).kn[`${crud}Get`](knId, id), outputOptions(cmd));\n });\n g.command(\"create <kn-id>\")\n .description(`Create ${name} (--body / --body-file)`)\n .option(\"--body <json>\", \"body JSON\")\n .option(\"--body-file <path>\", \"read body JSON from a file\")\n .action(async (knId: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).kn[`${crud}Create`](knId, readBody(opts)),\n outputOptions(cmd),\n );\n });\n g.command(\"update <kn-id> <id>\")\n .description(`Update ${name} (--body / --body-file)`)\n .option(\"--body <json>\", \"body JSON\")\n .option(\"--body-file <path>\", \"read body JSON from a file\")\n .action(async (knId: string, id: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).kn[`${crud}Update`](knId, id, readBody(opts)),\n outputOptions(cmd),\n );\n });\n g.command(\"delete <kn-id> <id>\")\n .description(`Delete ${name}`)\n .option(\"-y, --yes\", \"skip confirmation\")\n .action(async (knId: string, id: string, _o, cmd: Command) => {\n printJson(await clientFrom(cmd).kn[`${crud}Delete`](knId, id), outputOptions(cmd));\n });\n }\n }\n\n // Real action-type query + execute on the action-type group.\n const actionType = bkn.commands.find((c) => c.name() === \"action-type\");\n actionType\n ?.command(\"query <kn-id> <at-id>\")\n .description(\"Query an action type (--body / --body-file JSON)\")\n .option(\"--body <json>\", \"query JSON\")\n .option(\"--body-file <path>\", \"read query JSON from a file\")\n .action(async (knId: string, atId: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).kn.actionTypeQuery(knId, atId, readBody(opts)),\n outputOptions(cmd),\n );\n });\n actionType\n ?.command(\"execute <kn-id> <at-id>\")\n .description(\"Execute an action type (--body / --body-file envelope JSON)\")\n .option(\"--body <json>\", \"execution envelope JSON\")\n .option(\"--body-file <path>\", \"read envelope JSON from a file\")\n .action(async (knId: string, atId: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).kn.actionTypeExecute(knId, atId, readBody(opts)),\n outputOptions(cmd),\n );\n });\n actionType\n ?.command(\"inputs <kn-id> <at-id>\")\n .description(\"Get an action type's input schema\")\n .action(async (knId: string, atId: string, _o, cmd: Command) => {\n printJson(await clientFrom(cmd).kn.actionTypeInputs(knId, atId), outputOptions(cmd));\n });\n actionType\n ?.command(\"get <kn-id> <at-id>\")\n .description(\"Get an action type\")\n .action(async (knId: string, atId: string, _o, cmd: Command) => {\n printJson(await clientFrom(cmd).kn.actionTypeGet(knId, atId), outputOptions(cmd));\n });\n\n // stats/export are aliases of `get --stats` / `get --export`.\n bkn\n .command(\"stats <kn-id>\")\n .description(\"Get knowledge-network statistics (alias for get --stats)\")\n .action(async (knId: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).kn.get(knId, { stats: true }), outputOptions(cmd));\n });\n bkn\n .command(\"export <kn-id>\")\n .description(\"Export a knowledge network (alias for get --export)\")\n .action(async (knId: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).kn.get(knId, { exportMode: true }), outputOptions(cmd));\n });\n\n // Real object-type instance query + properties (the rest are stubs above).\n const objectType = bkn.commands.find((c) => c.name() === \"object-type\");\n objectType\n ?.command(\"query <kn-id> <ot-id>\")\n .description(\"Query instances of an object type (--body / --body-file JSON)\")\n .option(\"--body <json>\", \"query JSON\")\n .option(\"--body-file <path>\", \"read query JSON from a file\")\n .action(async (knId: string, otId: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).kn.objectTypeQuery(knId, otId, readBody(opts)),\n outputOptions(cmd),\n );\n });\n objectType\n ?.command(\"properties <kn-id> <ot-id>\")\n .description(\"Get an object type's calculated properties\")\n .action(async (knId: string, otId: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).kn.objectTypeProperties(knId, otId), outputOptions(cmd));\n });\n\n bkn\n .command(\"create <name>\")\n .description(\"Create an (empty) knowledge network\")\n .option(\"--branch <b>\", \"branch\", \"main\")\n .action(async (name: string, opts, cmd: Command) => {\n printJson(await clientFrom(cmd).kn.create({ name, branch: opts.branch }), outputOptions(cmd));\n });\n\n bkn\n .command(\"update <kn-id>\")\n .description(\"Update a knowledge network (--body / --body-file)\")\n .option(\"--body <json>\", \"update body JSON\")\n .option(\"--body-file <path>\", \"read update body JSON from a file\")\n .action(async (knId: string, opts, cmd: Command) => {\n printJson(await clientFrom(cmd).kn.update(knId, readBody(opts)), outputOptions(cmd));\n });\n\n bkn\n .command(\"delete <kn-id>\")\n .description(\"Delete a knowledge network\")\n .option(\"-y, --yes\", \"skip confirmation\")\n .action(async (knId: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).kn.delete(knId), outputOptions(cmd));\n });\n\n bkn\n .command(\"subgraph <kn-id>\")\n .description(\"Query a subgraph (--body / --body-file JSON)\")\n .option(\"--body <json>\", \"subgraph query JSON\")\n .option(\"--body-file <path>\", \"read subgraph query JSON from a file\")\n .action(async (knId: string, opts, cmd: Command) => {\n printJson(await clientFrom(cmd).kn.subgraph(knId, readBody(opts)), outputOptions(cmd));\n });\n\n const actionLog = bkn.command(\"action-log\").description(\"Action logs — list/get/cancel\");\n actionLog\n .command(\"list <kn-id>\")\n .description(\"List action logs\")\n .option(\"--status <s>\", \"filter by status\")\n .option(\"--action-type-id <id>\", \"filter by action type\")\n .option(\"--limit <n>\", \"page size\", int, DEFAULT_LIST_LIMIT)\n .action(async (knId: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).kn.actionLogs(knId, {\n status: opts.status,\n actionTypeId: opts.actionTypeId,\n limit: opts.limit,\n }),\n outputOptions(cmd),\n );\n });\n actionLog\n .command(\"get <kn-id> <log-id>\")\n .description(\"Get an action log\")\n .action(async (knId: string, logId: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).kn.actionLog(knId, logId), outputOptions(cmd));\n });\n actionLog\n .command(\"cancel <kn-id> <log-id>\")\n .description(\"Cancel a running action\")\n .action(async (knId: string, logId: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).kn.cancelActionLog(knId, logId), outputOptions(cmd));\n });\n\n bkn\n .command(\"action-execution <kn-id> <execution-id>\")\n .description(\"Get action execution status\")\n .action(async (knId: string, execId: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).kn.actionExecution(knId, execId), outputOptions(cmd));\n });\n\n const metric = bkn.command(\"metric\").description(\"Metrics — query / dry-run\");\n metric\n .command(\"query <kn-id> <metric-id>\")\n .description(\"Query a metric's data (--body / --body-file JSON)\")\n .option(\"--body <json>\", \"query JSON\")\n .option(\"--body-file <path>\", \"read query JSON from a file\")\n .action(async (knId: string, metricId: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).kn.metricQuery(knId, metricId, readBody(opts)),\n outputOptions(cmd),\n );\n });\n metric\n .command(\"dry-run <kn-id>\")\n .description(\"Dry-run a metric definition (--body / --body-file JSON)\")\n .option(\"--body <json>\", \"metric definition JSON\")\n .option(\"--body-file <path>\", \"read metric definition JSON from a file\")\n .action(async (knId: string, opts, cmd: Command) => {\n printJson(await clientFrom(cmd).kn.metricDryRun(knId, readBody(opts)), outputOptions(cmd));\n });\n metric\n .command(\"list <kn-id>\")\n .description(\"List metrics\")\n .action(async (knId: string, _o, cmd: Command) => {\n printJson(await clientFrom(cmd).kn.metricList(knId), outputOptions(cmd));\n });\n metric\n .command(\"get <kn-id> <metric-id>\")\n .description(\"Get a metric\")\n .action(async (knId: string, id: string, _o, cmd: Command) => {\n printJson(await clientFrom(cmd).kn.metricGet(knId, id), outputOptions(cmd));\n });\n metric\n .command(\"create <kn-id>\")\n .description(\"Create a metric (--body / --body-file)\")\n .option(\"--body <json>\", \"body JSON\")\n .option(\"--body-file <path>\", \"read body JSON from a file\")\n .action(async (knId: string, opts, cmd: Command) => {\n printJson(await clientFrom(cmd).kn.metricCreate(knId, readBody(opts)), outputOptions(cmd));\n });\n metric\n .command(\"update <kn-id> <metric-id>\")\n .description(\"Update a metric (--body / --body-file)\")\n .option(\"--body <json>\", \"body JSON\")\n .option(\"--body-file <path>\", \"read body JSON from a file\")\n .action(async (knId: string, id: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).kn.metricUpdate(knId, id, readBody(opts)),\n outputOptions(cmd),\n );\n });\n metric\n .command(\"delete <kn-id> <metric-id>\")\n .description(\"Delete a metric\")\n .action(async (knId: string, id: string, _o, cmd: Command) => {\n printJson(await clientFrom(cmd).kn.metricDelete(knId, id), outputOptions(cmd));\n });\n metric\n .command(\"search <kn-id>\")\n .description(\"Search metrics (--body / --body-file)\")\n .option(\"--body <json>\", \"body JSON\")\n .option(\"--body-file <path>\", \"read body JSON from a file\")\n .action(async (knId: string, opts, cmd: Command) => {\n printJson(await clientFrom(cmd).kn.metricSearch(knId, readBody(opts)), outputOptions(cmd));\n });\n metric\n .command(\"validate <kn-id>\")\n .description(\"Validate a metric definition (--body / --body-file)\")\n .option(\"--body <json>\", \"body JSON\")\n .option(\"--body-file <path>\", \"read body JSON from a file\")\n .action(async (knId: string, opts, cmd: Command) => {\n printJson(await clientFrom(cmd).kn.metricValidate(knId, readBody(opts)), outputOptions(cmd));\n });\n\n const cg = bkn.command(\"concept-group\").description(\"Concept groups — list/get\");\n cg.command(\"list <kn-id>\")\n .description(\"List concept groups\")\n .action(async (knId: string, _o, cmd: Command) => {\n printJson(await clientFrom(cmd).kn.conceptGroups(knId), outputOptions(cmd));\n });\n cg.command(\"get <kn-id> <cg-id>\")\n .description(\"Get a concept group\")\n .action(async (knId: string, cgId: string, _o, cmd: Command) => {\n printJson(await clientFrom(cmd).kn.conceptGroup(knId, cgId), outputOptions(cmd));\n });\n cg.command(\"create <kn-id>\")\n .description(\"Create a concept group (--body / --body-file)\")\n .option(\"--body <json>\", \"body JSON\")\n .option(\"--body-file <path>\", \"read body JSON from a file\")\n .action(async (knId: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).kn.conceptGroupCreate(knId, readBody(opts)),\n outputOptions(cmd),\n );\n });\n cg.command(\"update <kn-id> <cg-id>\")\n .description(\"Update a concept group (--body / --body-file)\")\n .option(\"--body <json>\", \"body JSON\")\n .option(\"--body-file <path>\", \"read body JSON from a file\")\n .action(async (knId: string, cgId: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).kn.conceptGroupUpdate(knId, cgId, readBody(opts)),\n outputOptions(cmd),\n );\n });\n cg.command(\"delete <kn-id> <cg-id>\")\n .description(\"Delete a concept group\")\n .action(async (knId: string, cgId: string, _o, cmd: Command) => {\n printJson(await clientFrom(cmd).kn.conceptGroupDelete(knId, cgId), outputOptions(cmd));\n });\n cg.command(\"add-members <kn-id> <cg-id>\")\n .description(\"Add object types to a concept group (--body / --body-file)\")\n .option(\"--body <json>\", \"body JSON\")\n .option(\"--body-file <path>\", \"read body JSON from a file\")\n .action(async (knId: string, cgId: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).kn.conceptGroupAddMembers(knId, cgId, readBody(opts)),\n outputOptions(cmd),\n );\n });\n cg.command(\"remove-members <kn-id> <cg-id> <ot-ids>\")\n .description(\"Remove object types (comma-joined ids) from a concept group\")\n .action(async (knId: string, cgId: string, otIds: string, _o, cmd: Command) => {\n printJson(\n await clientFrom(cmd).kn.conceptGroupRemoveMembers(knId, cgId, otIds),\n outputOptions(cmd),\n );\n });\n\n const sched = bkn.command(\"action-schedule\").description(\"Action schedules — list/get\");\n sched\n .command(\"list <kn-id>\")\n .description(\"List action schedules\")\n .action(async (knId: string, _o, cmd: Command) => {\n printJson(await clientFrom(cmd).kn.actionSchedules(knId), outputOptions(cmd));\n });\n sched\n .command(\"get <kn-id> <schedule-id>\")\n .description(\"Get an action schedule\")\n .action(async (knId: string, sId: string, _o, cmd: Command) => {\n printJson(await clientFrom(cmd).kn.actionSchedule(knId, sId), outputOptions(cmd));\n });\n sched\n .command(\"create <kn-id>\")\n .description(\"Create an action schedule (--body / --body-file)\")\n .option(\"--body <json>\", \"body JSON\")\n .option(\"--body-file <path>\", \"read body JSON from a file\")\n .action(async (knId: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).kn.actionScheduleCreate(knId, readBody(opts)),\n outputOptions(cmd),\n );\n });\n sched\n .command(\"update <kn-id> <schedule-id>\")\n .description(\"Update an action schedule (--body / --body-file)\")\n .option(\"--body <json>\", \"body JSON\")\n .option(\"--body-file <path>\", \"read body JSON from a file\")\n .action(async (knId: string, sId: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).kn.actionScheduleUpdate(knId, sId, readBody(opts)),\n outputOptions(cmd),\n );\n });\n sched\n .command(\"set-status <kn-id> <schedule-id>\")\n .description(\"Set an action schedule's status (--body / --body-file)\")\n .option(\"--body <json>\", \"body JSON\")\n .option(\"--body-file <path>\", \"read body JSON from a file\")\n .action(async (knId: string, sId: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).kn.actionScheduleSetStatus(knId, sId, readBody(opts)),\n outputOptions(cmd),\n );\n });\n sched\n .command(\"delete <kn-id> <schedule-ids>\")\n .description(\"Delete action schedule(s) (comma-joined ids)\")\n .action(async (knId: string, ids: string, _o, cmd: Command) => {\n printJson(await clientFrom(cmd).kn.actionScheduleDelete(knId, ids), outputOptions(cmd));\n });\n\n const job = bkn.command(\"job\").description(\"Build jobs — list/get/tasks\");\n job\n .command(\"list <kn-id>\")\n .description(\"List jobs\")\n .action(async (knId: string, _o, cmd: Command) => {\n printJson(await clientFrom(cmd).kn.jobs(knId), outputOptions(cmd));\n });\n job\n .command(\"get <kn-id> <job-id>\")\n .description(\"Get a job\")\n .action(async (knId: string, jobId: string, _o, cmd: Command) => {\n printJson(await clientFrom(cmd).kn.job(knId, jobId), outputOptions(cmd));\n });\n job\n .command(\"tasks <kn-id> <job-id>\")\n .description(\"List a job's tasks\")\n .action(async (knId: string, jobId: string, _o, cmd: Command) => {\n printJson(await clientFrom(cmd).kn.jobTasks(knId, jobId), outputOptions(cmd));\n });\n job\n .command(\"delete <kn-id> <job-ids>\")\n .description(\"Delete job(s) (comma-joined ids)\")\n .action(async (knId: string, ids: string, _o, cmd: Command) => {\n printJson(await clientFrom(cmd).kn.jobDelete(knId, ids), outputOptions(cmd));\n });\n\n bkn\n .command(\"push <directory>\")\n .description(\"Pack a BKN directory into a tar and import it as a knowledge network\")\n .option(\"--branch <name>\", \"target branch\", \"main\")\n .action(async (dir: string, opts, cmd: Command) => {\n printJson(await clientFrom(cmd).kn.push(dir, { branch: opts.branch }), outputOptions(cmd));\n });\n bkn\n .command(\"pull <kn-id> [directory]\")\n .description(\"Download a knowledge network as a BKN tar and extract it locally\")\n .option(\"--branch <name>\", \"source branch\", \"main\")\n .action(async (knId: string, dir: string | undefined, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).kn.pull(knId, dir ?? knId, { branch: opts.branch }),\n outputOptions(cmd),\n );\n });\n\n bkn\n .command(\"relation-type-paths <kn-id>\")\n .description(\"Query relation-type paths between object types (--body / --body-file JSON)\")\n .option(\"--body <json>\", \"request JSON\")\n .option(\"--body-file <path>\", \"read request JSON from a file\")\n .action(async (knId: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).kn.relationTypePaths(knId, readBody(opts)),\n outputOptions(cmd),\n );\n });\n\n bkn\n .command(\"resources\")\n .description(\"List BKN-backend resources\")\n .action(async (_opts, cmd: Command) => {\n printJson(await clientFrom(cmd).kn.bknResources(), outputOptions(cmd));\n });\n\n bkn\n .command(\"create-from-catalog <catalog-id>\")\n .description(\"Build a knowledge network from a Vega catalog's tables\")\n .requiredOption(\"--name <name>\", \"knowledge network name\")\n .option(\"--tables <list>\", \"comma-separated table names (default: all)\")\n .option(\"--pk-map <map>\", \"explicit primary keys: '<table>:<col>[,<table>:<col>...]'\")\n .option(\"--build\", \"submit a Vega build task per resource after creation\")\n .option(\"--no-rollback\", \"keep a partially-created KN on failure\")\n .action(async (catalogId: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).kn.createFromCatalog({\n catalogId,\n name: opts.name,\n tables: csv(opts.tables),\n pkMap: opts.pkMap ? parsePkMap(opts.pkMap) : undefined,\n build: Boolean(opts.build),\n noRollback: opts.rollback === false,\n onProgress: (m) => console.error(m),\n }),\n outputOptions(cmd),\n );\n });\n\n bkn\n .command(\"validate <directory>\")\n .description(\"Validate a local BKN directory's structure (offline)\")\n .action(async (dir: string, _opts, cmd: Command) => {\n const result = validateBknDirectory(dir);\n printJson(result, outputOptions(cmd));\n if (!result.valid) process.exitCode = 1;\n });\n\n bkn\n .command(\"create-from-csv <catalog-id>\")\n .description(\"Import CSV files into a Vega catalog, then build a KN from them\")\n .requiredOption(\"--files <glob>\", \"CSV paths (comma-separated or glob)\")\n .requiredOption(\"--name <name>\", \"knowledge network name\")\n .option(\"--table-prefix <s>\", \"prefix for derived table names\", \"\")\n .option(\"--batch-size <n>\", \"rows per insert batch\", int, 500)\n .option(\"--tables <list>\", \"subset of imported tables to include in the KN\")\n .option(\"--pk-map <map>\", \"explicit primary keys: '<table>:<col>[,...]'\")\n .option(\"--build\", \"submit a Vega build task per resource after creation\")\n .option(\"--no-rollback\", \"keep a partially-created KN on failure\")\n .action(async (catalogId: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).kn.createFromCsv({\n catalogId,\n name: opts.name,\n files: opts.files,\n tablePrefix: opts.tablePrefix,\n batchSize: opts.batchSize,\n tables: csv(opts.tables),\n pkMap: opts.pkMap ? parsePkMap(opts.pkMap) : undefined,\n build: Boolean(opts.build),\n noRollback: opts.rollback === false,\n onProgress: (m) => console.error(m),\n }),\n outputOptions(cmd),\n );\n });\n\n return group(bkn, \"AI DATA PLATFORM\");\n}\n","/**\n * Structural validation of a local BKN directory. This is a slim, dependency-free\n * check (the full `@kweaver-ai/bkn` network model is not vendored): it parses the\n * frontmatter of every `.bkn` file and verifies the network is internally\n * consistent enough to push — required files, well-formed frontmatter, object-type\n * name limits, unique ids, and relation endpoints that reference real object types.\n */\nimport { existsSync, readFileSync, readdirSync, statSync } from \"node:fs\";\nimport { join, resolve } from \"node:path\";\n\n// validateObjectName parity: ISF caps BKN object names at 40 utf-8 codepoints.\nexport const BKN_OBJECT_NAME_MAX_LENGTH = 40;\n\nexport interface ValidationResult {\n valid: boolean;\n dir: string;\n counts: { objectTypes: number; relationTypes: number; conceptGroups: number };\n errors: string[];\n warnings: string[];\n}\n\ninterface Frontmatter {\n type?: string;\n id?: string;\n name?: string;\n}\n\n/** Parse a leading `--- ... ---` YAML-ish frontmatter block (flat scalars only). */\nfunction parseFrontmatter(text: string): Frontmatter | null {\n if (!text.startsWith(\"---\")) return null;\n const end = text.indexOf(\"\\n---\", 3);\n if (end === -1) return null;\n const block = text.slice(3, end);\n const fm: Frontmatter = {};\n for (const line of block.split(\"\\n\")) {\n const m = line.match(/^\\s*(type|id|name)\\s*:\\s*(.+?)\\s*$/);\n if (m?.[1]) fm[m[1] as keyof Frontmatter] = m[2]?.replace(/^[\"']|[\"']$/g, \"\");\n }\n return fm;\n}\n\nfunction bknFiles(dir: string): string[] {\n if (!existsSync(dir) || !statSync(dir).isDirectory()) return [];\n return readdirSync(dir)\n .filter((f) => f.endsWith(\".bkn\"))\n .map((f) => join(dir, f));\n}\n\n/** Pull (source, target) object-type ids out of a relation file's Endpoint table. */\nfunction endpointRefs(text: string): Array<{ source: string; target: string }> {\n const refs: Array<{ source: string; target: string }> = [];\n const idx = text.indexOf(\"### Endpoint\");\n if (idx === -1) return refs;\n // Only the Endpoint section — stop at the next heading (e.g. Mapping Rules).\n const after = text.slice(idx + \"### Endpoint\".length);\n const next = after.indexOf(\"\\n###\");\n const section = next === -1 ? after : after.slice(0, next);\n for (const line of section.split(\"\\n\")) {\n const cells = line\n .split(\"|\")\n .map((c) => c.trim())\n .filter(Boolean);\n if (cells.length < 2) continue;\n const [source, target] = cells;\n if (!source || !target) continue;\n if (/^source$/i.test(source) || /^-+$/.test(source)) continue; // header / divider\n refs.push({ source, target });\n }\n return refs;\n}\n\nexport function validateBknDirectory(dirPath: string): ValidationResult {\n const dir = resolve(dirPath);\n const errors: string[] = [];\n const warnings: string[] = [];\n\n if (!existsSync(dir) || !statSync(dir).isDirectory()) {\n return {\n valid: false,\n dir,\n counts: { objectTypes: 0, relationTypes: 0, conceptGroups: 0 },\n errors: [`Not a directory: ${dir}`],\n warnings: [],\n };\n }\n\n // network.bkn — required, must declare a knowledge_network.\n const networkPath = join(dir, \"network.bkn\");\n if (!existsSync(networkPath)) {\n errors.push(\"Missing network.bkn at the BKN root.\");\n } else {\n const fm = parseFrontmatter(readFileSync(networkPath, \"utf8\"));\n if (!fm) errors.push(\"network.bkn has no frontmatter block.\");\n else {\n if (fm.type !== \"knowledge_network\")\n errors.push(`network.bkn type must be 'knowledge_network', got '${fm.type ?? \"\"}'.`);\n if (!fm.id) errors.push(\"network.bkn is missing 'id'.\");\n if (!fm.name) errors.push(\"network.bkn is missing 'name'.\");\n }\n }\n\n // Object types.\n const otIds = new Set<string>();\n const otFiles = bknFiles(join(dir, \"object_types\"));\n for (const file of otFiles) {\n const fm = parseFrontmatter(readFileSync(file, \"utf8\"));\n const rel = file.slice(dir.length + 1);\n if (!fm || fm.type !== \"object_type\") {\n errors.push(`${rel}: not a valid object_type (missing/wrong frontmatter type).`);\n continue;\n }\n if (!fm.id) errors.push(`${rel}: object_type missing 'id'.`);\n if (!fm.name) errors.push(`${rel}: object_type missing 'name'.`);\n if (fm.name && [...fm.name].length > BKN_OBJECT_NAME_MAX_LENGTH) {\n errors.push(\n `${rel}: object_type name exceeds ${BKN_OBJECT_NAME_MAX_LENGTH} codepoints ('${fm.name}').`,\n );\n }\n if (fm.id) {\n if (otIds.has(fm.id)) errors.push(`Duplicate object_type id '${fm.id}'.`);\n otIds.add(fm.id);\n }\n }\n\n // Relation types — validate frontmatter + endpoint references.\n const rtFiles = bknFiles(join(dir, \"relation_types\"));\n for (const file of rtFiles) {\n const text = readFileSync(file, \"utf8\");\n const fm = parseFrontmatter(text);\n const rel = file.slice(dir.length + 1);\n if (!fm || fm.type !== \"relation_type\") {\n errors.push(`${rel}: not a valid relation_type (missing/wrong frontmatter type).`);\n continue;\n }\n if (!fm.id) errors.push(`${rel}: relation_type missing 'id'.`);\n for (const { source, target } of endpointRefs(text)) {\n if (otIds.size > 0 && !otIds.has(source))\n warnings.push(`${rel}: endpoint source '${source}' is not a known object_type.`);\n if (otIds.size > 0 && !otIds.has(target))\n warnings.push(`${rel}: endpoint target '${target}' is not a known object_type.`);\n }\n }\n\n const cgFiles = bknFiles(join(dir, \"concept_groups\"));\n\n return {\n valid: errors.length === 0,\n dir,\n counts: {\n objectTypes: otFiles.length,\n relationTypes: rtFiles.length,\n conceptGroups: cgFiles.length,\n },\n errors,\n warnings,\n };\n}\n","/** `openbkn call`/`curl` — curl-style API passthrough with auth headers. */\nimport { Command } from \"commander\";\nimport { rawCall } from \"../api/call.js\";\nimport { resolveContext } from \"../config/resolve.js\";\nimport { group } from \"../help/grouped-help.js\";\nimport { printJson } from \"../utils/output.js\";\nimport { outputOptions } from \"./_shared.js\";\n\nfunction collect(value: string, prev: string[]): string[] {\n prev.push(value);\n return prev;\n}\n\nexport function callCommand(): Command {\n const cmd = new Command(\"call\")\n .alias(\"curl\")\n .description(\"Call an API with curl-style flags and auto-injected auth headers\")\n .argument(\"<url>\", \"API path (e.g. /api/...) or absolute URL\")\n .option(\"-X, --request <method>\", \"HTTP method\")\n .option(\"-H, --header <header>\", 'extra header \"Name: value\" (repeatable)', collect, [])\n .option(\"-d, --data <body>\", \"request body (sets JSON content-type if unset)\")\n .option(\"--data-raw <body>\", \"alias for --data\")\n .option(\n \"-F, --form <field>\",\n \"multipart field key=value or key=@file (repeatable)\",\n collect,\n [],\n )\n .option(\"-v, --verbose\", \"print request line to stderr\")\n .action(async (url: string, opts, cmd: Command) => {\n const g = cmd.optsWithGlobals();\n const ctx = resolveContext({\n baseUrl: g.baseUrl,\n token: g.token,\n user: g.user,\n businessDomain: g.bizDomain,\n insecure: g.insecure,\n });\n const res = await rawCall(ctx, url, {\n method: opts.request,\n header: opts.header,\n data: opts.data ?? opts.dataRaw,\n form: opts.form,\n businessDomain: g.bizDomain,\n verbose: opts.verbose,\n });\n\n // Pretty-print JSON bodies; pass anything else through verbatim.\n const out = outputOptions(cmd);\n try {\n printJson(JSON.parse(res.body), out);\n } catch {\n process.stdout.write(res.body.endsWith(\"\\n\") ? res.body : `${res.body}\\n`);\n }\n if (res.status >= 400) process.exitCode = 1;\n });\n\n return group(cmd, \"AUTHENTICATION & CONFIG\");\n}\n","/** `openbkn config …` — active platform + per-platform business domain. */\nimport { Command } from \"commander\";\nimport {\n activePlatform,\n readPlatformConfig,\n setActivePlatform,\n writePlatformConfig,\n} from \"../config/store.js\";\nimport { group } from \"../help/grouped-help.js\";\nimport { InputError } from \"../utils/errors.js\";\nimport { printJson } from \"../utils/output.js\";\nimport { outputOptions } from \"./_shared.js\";\n\nfunction requireActive(): string {\n const baseUrl = activePlatform();\n if (!baseUrl) throw new InputError(\"No active platform. Run `openbkn auth login <url>` first.\");\n return baseUrl;\n}\n\nexport function configCommand(): Command {\n const config = new Command(\"config\").description(\"Per-platform CLI configuration\");\n\n config\n .command(\"show\")\n .description(\"Show the active platform and business domain\")\n .action((_opts, cmd: Command) => {\n const baseUrl = activePlatform();\n printJson(\n {\n baseUrl,\n businessDomain: baseUrl ? readPlatformConfig(baseUrl).businessDomain : undefined,\n },\n outputOptions(cmd),\n );\n });\n\n config\n .command(\"set <key> <value>\")\n .description(\"Set a config value (baseUrl | businessDomain)\")\n .action((key: string, value: string, _opts, cmd: Command) => {\n if (key === \"baseUrl\") {\n setActivePlatform(value.replace(/\\/+$/, \"\"));\n } else if (key === \"businessDomain\") {\n writePlatformConfig(requireActive(), { businessDomain: value });\n } else {\n throw new InputError(`Unknown config key: ${key} (expected baseUrl | businessDomain)`);\n }\n printJson({ ok: true, key, value }, outputOptions(cmd));\n });\n\n config\n .command(\"set-bd <value>\")\n .description(\"Set the default business domain for the active platform\")\n .action((value: string, _opts, cmd: Command) => {\n const baseUrl = requireActive();\n writePlatformConfig(baseUrl, { businessDomain: value });\n printJson({ baseUrl, businessDomain: value }, outputOptions(cmd));\n });\n\n config\n .command(\"list-bd\")\n .description(\"List business domains (requires login)\")\n .action(() => {\n throw new InputError(\"Not yet implemented — requires backend business-domains API.\");\n });\n\n return group(config, \"AUTHENTICATION & CONFIG\");\n}\n","/** `openbkn context …` (alias of legacy context-loader) — MCP retrieval. */\nimport { Command } from \"commander\";\nimport { group } from \"../help/grouped-help.js\";\nimport { InputError } from \"../utils/errors.js\";\nimport { printJson } from \"../utils/output.js\";\nimport { clientFrom, outputOptions } from \"./_shared.js\";\n\nconst int = (v: string) => Number.parseInt(v, 10);\n\nexport function contextCommand(): Command {\n const cmd = new Command(\"context\").description(\n \"Context loader (MCP) — schema discovery, instance query, skill recall\",\n );\n\n cmd\n .command(\"search-schema <kn-id> <query>\")\n .description(\"Search object/relation/action/metric schemas\")\n .option(\"--scope <list>\", \"comma-separated scopes (object,relation,action,metric)\")\n .option(\"--max <n>\", \"max concepts\", int)\n .action(async (knId: string, query: string, opts, cmd: Command) => {\n const data = await clientFrom(cmd).context.searchSchema(knId, query, {\n searchScope: opts.scope ? String(opts.scope).split(\",\") : undefined,\n maxConcepts: opts.max,\n });\n printJson(data, outputOptions(cmd));\n });\n\n cmd\n .command(\"query-object-instance <kn-id>\")\n .description(\"Query object instances (provide --args as JSON)\")\n .requiredOption(\"--args <json>\", \"tool arguments as JSON\")\n .action(async (knId: string, opts, cmd: Command) => {\n let args: Record<string, unknown>;\n try {\n args = JSON.parse(opts.args);\n } catch {\n throw new InputError(\"--args must be valid JSON\");\n }\n printJson(await clientFrom(cmd).context.queryObjectInstance(knId, args), outputOptions(cmd));\n });\n\n cmd\n .command(\"find-skills <kn-id> <object-type-id>\")\n .description(\"Recall skills for an object type\")\n .option(\"--top-k <n>\", \"max skills (1-20)\", int)\n .action(async (knId: string, otId: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).context.findSkills(knId, otId, opts.topK),\n outputOptions(cmd),\n );\n });\n\n cmd\n .command(\"tools <kn-id>\")\n .description(\"List MCP tools\")\n .action(async (knId: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).context.tools(knId), outputOptions(cmd));\n });\n\n cmd\n .command(\"tool-call <kn-id> <name>\")\n .description(\"Call any MCP tool directly (--args JSON)\")\n .requiredOption(\"--args <json>\", \"tool arguments as JSON\")\n .action(async (knId: string, name: string, opts, cmd: Command) => {\n let args: Record<string, unknown>;\n try {\n args = JSON.parse(opts.args);\n } catch {\n throw new InputError(\"--args must be valid JSON\");\n }\n printJson(await clientFrom(cmd).context.toolCall(knId, name, args), outputOptions(cmd));\n });\n\n cmd\n .command(\"resources <kn-id>\")\n .description(\"List MCP resources\")\n .action(async (knId: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).context.resources(knId), outputOptions(cmd));\n });\n cmd\n .command(\"resource <kn-id> <uri>\")\n .description(\"Read one MCP resource by uri\")\n .action(async (knId: string, uri: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).context.resource(knId, uri), outputOptions(cmd));\n });\n cmd\n .command(\"templates <kn-id>\")\n .description(\"List MCP resource templates\")\n .action(async (knId: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).context.templates(knId), outputOptions(cmd));\n });\n cmd\n .command(\"prompts <kn-id>\")\n .description(\"List MCP prompts\")\n .action(async (knId: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).context.prompts(knId), outputOptions(cmd));\n });\n cmd\n .command(\"prompt <kn-id> <name>\")\n .description(\"Get one MCP prompt (--args JSON for prompt arguments)\")\n .option(\"--args <json>\", \"prompt arguments as JSON\")\n .action(async (knId: string, name: string, opts, cmd: Command) => {\n let args: Record<string, unknown> | undefined;\n if (opts.args) {\n try {\n args = JSON.parse(opts.args);\n } catch {\n throw new InputError(\"--args must be valid JSON\");\n }\n }\n printJson(await clientFrom(cmd).context.prompt(knId, name, args), outputOptions(cmd));\n });\n\n const jsonArgs = (raw: string): Record<string, unknown> => {\n try {\n return JSON.parse(raw);\n } catch {\n throw new InputError(\"--args must be valid JSON\");\n }\n };\n cmd\n .command(\"query-instance-subgraph <kn-id>\")\n .description(\"Layer-2: query an instance subgraph across relation-type paths\")\n .requiredOption(\"--args <json>\", \"tool arguments as JSON\")\n .action(async (knId: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).context.queryInstanceSubgraph(knId, jsonArgs(opts.args)),\n outputOptions(cmd),\n );\n });\n cmd\n .command(\"get-logic-properties <kn-id>\")\n .description(\"Layer-3: compute logic-property values for instances\")\n .requiredOption(\"--args <json>\", \"tool arguments as JSON\")\n .action(async (knId: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).context.logicProperties(knId, jsonArgs(opts.args)),\n outputOptions(cmd),\n );\n });\n cmd\n .command(\"get-action-info <kn-id>\")\n .description(\"Layer-3: fetch action info / dynamic tools for an instance\")\n .requiredOption(\"--args <json>\", \"tool arguments as JSON\")\n .action(async (knId: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).context.actionInfo(knId, jsonArgs(opts.args)),\n outputOptions(cmd),\n );\n });\n\n return group(cmd, \"AI DATA PLATFORM\");\n}\n","/** `openbkn dataflow …` — document/data flow workflows. */\nimport { Command } from \"commander\";\nimport { group } from \"../help/grouped-help.js\";\nimport { DEFAULT_LIST_LIMIT } from \"../types.js\";\nimport { printJson } from \"../utils/output.js\";\nimport { clientFrom, outputOptions, readBody } from \"./_shared.js\";\n\nconst int = (v: string) => Number.parseInt(v, 10);\n\nexport function dataflowCommand(): Command {\n const cmd = new Command(\"dataflow\").description(\"Dataflow document workflows — list, runs, logs\");\n\n cmd\n .command(\"list\")\n .description(\"List all dataflows\")\n .action(async (_opts, cmd: Command) => {\n printJson(await clientFrom(cmd).dataflows.list(), outputOptions(cmd));\n });\n\n cmd\n .command(\"runs <dagId>\")\n .description(\"List run records for one dataflow\")\n .option(\"--since <date>\", \"filter runs since a date\")\n .action(async (dagId: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).dataflows.runs(dagId, { since: opts.since }),\n outputOptions(cmd),\n );\n });\n\n cmd\n .command(\"logs <dagId> <instanceId>\")\n .description(\"Show logs for one run\")\n .option(\"--page <n>\", \"page\", int, 0)\n .option(\"--limit <n>\", \"page size\", int, DEFAULT_LIST_LIMIT)\n .action(async (dagId: string, instanceId: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).dataflows.logs(dagId, instanceId, {\n page: opts.page,\n limit: opts.limit,\n }),\n outputOptions(cmd),\n );\n });\n\n cmd\n .command(\"run <dagId>\")\n .description(\"Trigger a dataflow run from a remote file URL\")\n .requiredOption(\"--url <url>\", \"remote file URL\")\n .requiredOption(\"--name <name>\", \"file name\")\n .action(async (dagId: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).dataflows.run(dagId, opts.url, opts.name),\n outputOptions(cmd),\n );\n });\n\n cmd\n .command(\"create\")\n .description(\"Create a dataflow (DAG) from a full document body (--body / --body-file)\")\n .option(\"--body <json>\", \"dataflow document JSON\")\n .option(\"--body-file <path>\", \"read the dataflow document JSON from a file\")\n .action(async (opts, cmd: Command) => {\n printJson(await clientFrom(cmd).dataflows.create(readBody(opts)), outputOptions(cmd));\n });\n\n const parseSet = (pairs: string[] | undefined): Record<string, unknown> => {\n const out: Record<string, unknown> = {};\n for (const item of pairs ?? []) {\n const i = item.indexOf(\"=\");\n if (i > 0) out[item.slice(0, i)] = item.slice(i + 1);\n }\n return out;\n };\n cmd\n .command(\"templates\")\n .description(\"List available dataset/bkn/dataflow templates\")\n .action(async (_opts, cmd: Command) => {\n printJson(clientFrom(cmd).dataflows.templates(), outputOptions(cmd));\n });\n cmd\n .command(\"create-dataset\")\n .description(\"Create a dataset from a template (--template <name> --set k=v ...)\")\n .requiredOption(\"--template <name>\", \"template name\")\n .option(\n \"--set <kv...>\",\n \"set a template argument (key=value); repeatable\",\n (v, acc: string[]) => {\n acc.push(v);\n return acc;\n },\n [] as string[],\n )\n .action(async (opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).dataflows.createDataset(opts.template, parseSet(opts.set)),\n outputOptions(cmd),\n );\n });\n cmd\n .command(\"create-bkn\")\n .description(\"Create a knowledge network from a template (--template <name> --set k=v ...)\")\n .requiredOption(\"--template <name>\", \"template name\")\n .option(\n \"--set <kv...>\",\n \"set a template argument (key=value); repeatable\",\n (v, acc: string[]) => {\n acc.push(v);\n return acc;\n },\n [] as string[],\n )\n .action(async (opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).dataflows.createBkn(opts.template, parseSet(opts.set)),\n outputOptions(cmd),\n );\n });\n\n return group(cmd, \"AI DATA PLATFORM\");\n}\n","/**\n * `openbkn explore` — a minimal local web server exposing read-only JSON\n * endpoints for **bkn** and **vega** (no SPA bundle, no chat). Reuses the\n * configured client; meant for quick local data poking, not a full UI.\n */\nimport { type IncomingMessage, type ServerResponse, createServer } from \"node:http\";\nimport { Command } from \"commander\";\nimport type { BknClient } from \"../client.js\";\nimport { group } from \"../help/grouped-help.js\";\nimport { clientFrom } from \"./_shared.js\";\n\nconst int = (v: string) => Number.parseInt(v, 10);\n\ntype Handler = (\n client: BknClient,\n query: URLSearchParams,\n body: Record<string, unknown>,\n) => Promise<unknown>;\n\n/** Route table: `${METHOD} ${pathname}` → handler. bkn + vega read paths only. */\nconst ROUTES: Record<string, Handler> = {\n \"GET /api/bkn/meta\": (c, q) => c.kn.get(req(q, \"knId\")),\n \"POST /api/bkn/search\": (c, _q, b) =>\n c.kn.search(str(b.knId), str(b.query), {\n maxConcepts: typeof b.maxConcepts === \"number\" ? b.maxConcepts : undefined,\n }),\n \"POST /api/bkn/instances\": (c, _q, b) =>\n c.kn.objectTypeQuery(str(b.knId), str(b.objectTypeId), b.body ?? {}),\n \"POST /api/bkn/subgraph\": (c, _q, b) => c.kn.subgraph(str(b.knId), b.body ?? b),\n \"POST /api/bkn/properties\": (c, _q, b) =>\n c.kn.objectTypeProperties(str(b.knId), str(b.objectTypeId)),\n \"GET /api/vega/catalogs\": (c) => c.vega.catalogs(),\n \"GET /api/vega/catalog\": (c, q) => c.vega.getCatalog(req(q, \"catalogId\")),\n \"GET /api/vega/catalog-resources\": (c, q) =>\n c.vega.catalogResources(req(q, \"catalogId\"), q.get(\"category\") ?? undefined),\n \"GET /api/vega/connector-types\": (c) => c.vega.connectorTypes(),\n \"POST /api/vega/query\": (c, _q, b) => c.resource.query(str(b.resourceId), b.options ?? {}),\n};\n\nfunction str(v: unknown): string {\n return typeof v === \"string\" ? v : String(v ?? \"\");\n}\nfunction req(q: URLSearchParams, key: string): string {\n const v = q.get(key);\n if (!v) throw new Error(`missing query param: ${key}`);\n return v;\n}\n\nfunction readBody(reqMsg: IncomingMessage): Promise<Record<string, unknown>> {\n return new Promise((resolve, reject) => {\n let data = \"\";\n reqMsg.on(\"data\", (chunk) => {\n data += chunk;\n });\n reqMsg.on(\"end\", () => {\n if (!data.trim()) return resolve({});\n try {\n resolve(JSON.parse(data) as Record<string, unknown>);\n } catch {\n reject(new Error(\"invalid JSON body\"));\n }\n });\n reqMsg.on(\"error\", reject);\n });\n}\n\nconst INDEX = `<!doctype html><meta charset=\"utf-8\"><title>openbkn explore</title>\n<h1>openbkn explore</h1>\n<p>Read-only JSON endpoints for bkn + vega:</p>\n<ul>${Object.keys(ROUTES)\n .map((r) => `<li><code>${r}</code></li>`)\n .join(\"\")}</ul>`;\n\nexport function exploreCommand(): Command {\n const cmd = new Command(\"explore\").description(\n \"Start a local web server with read-only bkn + vega JSON endpoints\",\n );\n cmd\n .option(\"--port <n>\", \"port to listen on\", int, 7777)\n .option(\"--host <h>\", \"host to bind\", \"127.0.0.1\")\n .action(async (opts, command: Command) => {\n const client = clientFrom(command);\n const server = createServer((reqMsg, res) => {\n void handle(client, reqMsg, res);\n });\n server.listen(opts.port, opts.host, () => {\n console.error(`openbkn explore running at http://${opts.host}:${opts.port}/`);\n console.error(\"bkn + vega read endpoints only. Press Ctrl+C to stop.\");\n });\n });\n return group(cmd, \"FOUNDATION\");\n}\n\nasync function handle(\n client: BknClient,\n reqMsg: IncomingMessage,\n res: ServerResponse,\n): Promise<void> {\n const url = new URL(reqMsg.url ?? \"/\", \"http://localhost\");\n const method = reqMsg.method ?? \"GET\";\n if (method === \"GET\" && url.pathname === \"/\") {\n res.writeHead(200, { \"content-type\": \"text/html; charset=utf-8\" });\n res.end(INDEX);\n return;\n }\n const handler = ROUTES[`${method} ${url.pathname}`];\n if (!handler) {\n res.writeHead(404, { \"content-type\": \"application/json\" });\n res.end(JSON.stringify({ error: \"not found\" }));\n return;\n }\n try {\n const body = method === \"GET\" ? {} : await readBody(reqMsg);\n const data = await handler(client, url.searchParams, body);\n res.writeHead(200, { \"content-type\": \"application/json\" });\n res.end(JSON.stringify(data ?? null));\n } catch (err) {\n res.writeHead(500, { \"content-type\": \"application/json\" });\n res.end(JSON.stringify({ error: err instanceof Error ? err.message : String(err) }));\n }\n}\n","/** `openbkn model …` — model factory (llm / small-model). */\nimport { Command } from \"commander\";\nimport { group } from \"../help/grouped-help.js\";\nimport { DEFAULT_LIST_LIMIT } from \"../types.js\";\nimport { printJson } from \"../utils/output.js\";\nimport { clientFrom, csv, outputOptions, readBody } from \"./_shared.js\";\n\nconst int = (v: string) => Number.parseInt(v, 10);\n\n/** Management subcommands (add/edit/delete/test) wired to the model resource. */\nfunction addManagementCommands(parent: Command, kind: \"llm\" | \"small\"): void {\n parent\n .command(\"add\")\n .description(\"Register a model (definition JSON via --body / --body-file)\")\n .option(\"--body <json>\", \"model definition JSON\")\n .option(\"--body-file <path>\", \"read model definition JSON from a file\")\n .action(async (opts, cmd: Command) => {\n printJson(await clientFrom(cmd).models[kind].add(readBody(opts)), outputOptions(cmd));\n });\n parent\n .command(\"edit\")\n .description(\"Update a model definition (JSON via --body / --body-file)\")\n .option(\"--body <json>\", \"model definition JSON\")\n .option(\"--body-file <path>\", \"read model definition JSON from a file\")\n .action(async (opts, cmd: Command) => {\n printJson(await clientFrom(cmd).models[kind].edit(readBody(opts)), outputOptions(cmd));\n });\n parent\n .command(\"delete <model-ids>\")\n .description(\"Delete model(s) (comma-joined ids)\")\n .action(async (ids: string, _o, cmd: Command) => {\n printJson(await clientFrom(cmd).models[kind].delete(csv(ids) ?? []), outputOptions(cmd));\n });\n parent\n .command(\"test\")\n .description(\"Test a model's connectivity / inference (JSON via --body / --body-file)\")\n .option(\"--body <json>\", \"test request JSON\")\n .option(\"--body-file <path>\", \"read test request JSON from a file\")\n .action(async (opts, cmd: Command) => {\n printJson(await clientFrom(cmd).models[kind].test(readBody(opts)), outputOptions(cmd));\n });\n}\n\nexport function modelCommand(): Command {\n const model = new Command(\"model\").description(\"Model factory — LLM / small-model CRUD + chat\");\n\n const llm = model.command(\"llm\").description(\"Large language models\");\n llm\n .command(\"list\")\n .description(\"List LLM models\")\n .option(\"--name <s>\", \"filter by name\")\n .option(\"--type <t>\", \"model type filter\")\n .option(\"--limit <n>\", \"page size\", int, DEFAULT_LIST_LIMIT)\n .option(\"--page <n>\", \"page\", int, 1)\n .action(async (opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).models.llm.list({\n name: opts.name,\n modelType: opts.type,\n limit: opts.limit,\n page: opts.page,\n }),\n outputOptions(cmd),\n );\n });\n llm\n .command(\"get <modelId>\")\n .description(\"Get an LLM model\")\n .action(async (id: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).models.llm.get(id), outputOptions(cmd));\n });\n llm\n .command(\"chat <modelId>\")\n .description(\"OpenAI-compatible chat completion\")\n .requiredOption(\"-m, --message <text>\", \"user message\")\n .option(\"--stream\", \"stream the reply token-by-token to stdout\")\n .action(async (id: string, opts, cmd: Command) => {\n const messages = [{ role: \"user\", content: opts.message }];\n if (opts.stream) {\n await clientFrom(cmd).models.llm.chatStream(id, messages, (t) => process.stdout.write(t));\n process.stdout.write(\"\\n\");\n return;\n }\n printJson(await clientFrom(cmd).models.llm.chat(id, messages), outputOptions(cmd));\n });\n addManagementCommands(llm, \"llm\");\n\n const small = model.command(\"small\").description(\"Small models (embedding / reranker)\");\n small\n .command(\"list\")\n .description(\"List small models\")\n .option(\"--name <s>\", \"filter by name\")\n .option(\"--type <t>\", \"model type filter\")\n .option(\"--limit <n>\", \"page size\", int, DEFAULT_LIST_LIMIT)\n .option(\"--page <n>\", \"page\", int, 1)\n .action(async (opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).models.small.list({\n name: opts.name,\n modelType: opts.type,\n limit: opts.limit,\n page: opts.page,\n }),\n outputOptions(cmd),\n );\n });\n small\n .command(\"get <modelId>\")\n .description(\"Get a small model\")\n .action(async (id: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).models.small.get(id), outputOptions(cmd));\n });\n small\n .command(\"embeddings <modelId>\")\n .description(\"Compute embeddings\")\n .requiredOption(\"-i, --input <text>\", \"comma-separated input texts\")\n .action(async (id: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).models.small.embeddings(id, csv(opts.input) ?? []),\n outputOptions(cmd),\n );\n });\n small\n .command(\"rerank <modelId>\")\n .description(\"Rerank documents against a query\")\n .requiredOption(\"-q, --query <text>\", \"query\")\n .requiredOption(\"-d, --documents <list>\", \"comma-separated documents\")\n .action(async (id: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).models.small.rerank(id, opts.query, csv(opts.documents) ?? []),\n outputOptions(cmd),\n );\n });\n addManagementCommands(small, \"small\");\n\n return group(model, \"MODELS & SKILLS\");\n}\n","/** `openbkn resource` (alias `res`) — vega-backend resources. */\nimport { Command } from \"commander\";\nimport { group } from \"../help/grouped-help.js\";\nimport { DEFAULT_LIST_LIMIT, DEFAULT_QUERY_LIMIT } from \"../types.js\";\nimport { printJson } from \"../utils/output.js\";\nimport { clientFrom, outputOptions } from \"./_shared.js\";\n\nconst int = (v: string) => Number.parseInt(v, 10);\n\nexport function resourceCommand(): Command {\n const cmd = new Command(\"resource\")\n .alias(\"res\")\n .description(\"Resources — list, find, get, query, delete\");\n\n cmd\n .command(\"list\")\n .description(\"List resources under a datasource/catalog\")\n .option(\"--datasource-id <id>\", \"filter by datasource/catalog id\")\n .option(\"--type <category>\", \"resource category (table | logicview)\")\n .option(\"--limit <n>\", \"page size\", int, DEFAULT_LIST_LIMIT)\n .action(async (opts, cmd: Command) => {\n const data = await clientFrom(cmd).resource.list({\n datasourceId: opts.datasourceId,\n category: opts.type,\n limit: opts.limit,\n });\n printJson(data, outputOptions(cmd));\n });\n\n cmd\n .command(\"find\")\n .description(\"Search resources by name (fuzzy; --exact for strict)\")\n .requiredOption(\"--name <name>\", \"resource name to search\")\n .option(\"--exact\", \"exact name match\")\n .option(\"--datasource-id <id>\", \"limit to a datasource/catalog\")\n .action(async (opts, cmd: Command) => {\n const data = await clientFrom(cmd).resource.find(opts.name, {\n exact: opts.exact,\n datasourceId: opts.datasourceId,\n });\n printJson(data, outputOptions(cmd));\n });\n\n cmd\n .command(\"get <id>\")\n .description(\"Get resource details\")\n .action(async (id: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).resource.get(id), outputOptions(cmd));\n });\n\n cmd\n .command(\"query <id>\")\n .description(\"Fetch data rows from a resource\")\n .option(\"--limit <n>\", \"row limit\", int, DEFAULT_QUERY_LIMIT)\n .option(\"--offset <n>\", \"row offset\", int, 0)\n .option(\"--need-total\", \"include total count\")\n .action(async (id: string, opts, cmd: Command) => {\n const data = await clientFrom(cmd).resource.query(id, {\n limit: opts.limit,\n offset: opts.offset,\n needTotal: opts.needTotal,\n });\n printJson(data, outputOptions(cmd));\n });\n\n cmd\n .command(\"delete <id>\")\n .description(\"Delete a resource\")\n .option(\"-y, --yes\", \"skip confirmation\")\n .action(async (id: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).resource.delete(id), outputOptions(cmd));\n });\n\n return group(cmd, \"AI DATA PLATFORM\");\n}\n","/** `openbkn skill …` — skill registry and market. */\nimport { Command } from \"commander\";\nimport { group } from \"../help/grouped-help.js\";\nimport { DEFAULT_LIST_LIMIT } from \"../types.js\";\nimport { printJson } from \"../utils/output.js\";\nimport { clientFrom, outputOptions, readBody } from \"./_shared.js\";\n\nconst int = (v: string) => Number.parseInt(v, 10);\n\nexport function skillCommand(): Command {\n const cmd = new Command(\"skill\").description(\"Skill registry and market\");\n\n const listOpts = (c: Command) =>\n c\n .option(\"--name <s>\", \"filter by name\")\n .option(\"--source <s>\", \"filter by source\")\n .option(\"--status <s>\", \"filter by status\")\n .option(\"--limit <n>\", \"page size\", int, DEFAULT_LIST_LIMIT)\n .option(\"--page <n>\", \"page\", int, 1);\n\n listOpts(cmd.command(\"list\").description(\"List skills\"))\n .option(\"--create-user <s>\", \"filter by creator\")\n .action(async (opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).skills.list({\n name: opts.name,\n source: opts.source,\n status: opts.status,\n createUser: opts.createUser,\n pageSize: opts.limit,\n page: opts.page,\n }),\n outputOptions(cmd),\n );\n });\n\n cmd\n .command(\"get <skill-id>\")\n .description(\"Get a skill by id\")\n .action(async (id: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).skills.get(id), outputOptions(cmd));\n });\n\n listOpts(cmd.command(\"market\").description(\"Browse the skill market\")).action(\n async (opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).skills.market({\n name: opts.name,\n source: opts.source,\n pageSize: opts.limit,\n page: opts.page,\n }),\n outputOptions(cmd),\n );\n },\n );\n\n cmd\n .command(\"market-get <skill-id>\")\n .description(\"Get a market skill by id\")\n .action(async (id: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).skills.marketGet(id), outputOptions(cmd));\n });\n\n cmd\n .command(\"delete <skill-id>\")\n .description(\"Delete a skill\")\n .action(async (id: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).skills.delete(id), outputOptions(cmd));\n });\n\n cmd\n .command(\"content <skill-id>\")\n .description(\"Read a skill's SKILL.md content index\")\n .action(async (id: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).skills.content(id), outputOptions(cmd));\n });\n\n cmd\n .command(\"read-file <skill-id> <rel-path>\")\n .description(\"Read a file inside a skill (progressive)\")\n .action(async (id: string, relPath: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).skills.readFile(id, relPath), outputOptions(cmd));\n });\n\n cmd\n .command(\"history <skill-id>\")\n .description(\"Show a skill's version history\")\n .action(async (id: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).skills.history(id), outputOptions(cmd));\n });\n\n cmd\n .command(\"set-status <skill-id> <status>\")\n .description(\"Change status: unpublish | published | offline\")\n .action(async (id: string, status: string, _opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).skills.setStatus(id, status as \"unpublish\" | \"published\" | \"offline\"),\n outputOptions(cmd),\n );\n });\n\n cmd\n .command(\"register <directory>\")\n .description(\"Zip a local skill directory and register it\")\n .option(\"--source <s>\", \"source tag\")\n .option(\"--extend-info <json>\", \"extra metadata as JSON\")\n .action(async (dir: string, opts, cmd: Command) => {\n const extendInfo = opts.extendInfo ? JSON.parse(opts.extendInfo) : undefined;\n printJson(\n await clientFrom(cmd).skills.register(dir, { source: opts.source, extendInfo }),\n outputOptions(cmd),\n );\n });\n cmd\n .command(\"download <skill-id> [out-path]\")\n .description(\"Download a skill archive to a local .zip\")\n .action(async (skillId: string, outPath: string | undefined, _o, cmd: Command) => {\n printJson(await clientFrom(cmd).skills.download(skillId, outPath), outputOptions(cmd));\n });\n cmd\n .command(\"install <skill-id> [directory]\")\n .description(\"Download a skill archive and extract it locally\")\n .action(async (skillId: string, dir: string | undefined, _o, cmd: Command) => {\n printJson(await clientFrom(cmd).skills.install(skillId, dir), outputOptions(cmd));\n });\n cmd\n .command(\"update-metadata <skill-id>\")\n .description(\"Update a skill's metadata (--body / --body-file JSON)\")\n .option(\"--body <json>\", \"metadata JSON\")\n .option(\"--body-file <path>\", \"read metadata JSON from a file\")\n .action(async (skillId: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).skills.updateMetadata(skillId, readBody(opts)),\n outputOptions(cmd),\n );\n });\n cmd\n .command(\"update-package <skill-id> <directory>\")\n .description(\"Replace a skill's package from a local directory\")\n .action(async (skillId: string, dir: string, _o, cmd: Command) => {\n printJson(await clientFrom(cmd).skills.updatePackage(skillId, dir), outputOptions(cmd));\n });\n\n cmd\n .command(\"republish <skill-id>\")\n .description(\"Republish a previous skill version\")\n .requiredOption(\"--version <v>\", \"version to republish\")\n .action(async (skillId: string, opts, cmd: Command) => {\n printJson(await clientFrom(cmd).skills.republish(skillId, opts.version), outputOptions(cmd));\n });\n cmd\n .command(\"publish-history <skill-id>\")\n .description(\"Publish a historical skill version\")\n .requiredOption(\"--version <v>\", \"version to publish\")\n .action(async (skillId: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).skills.publishHistory(skillId, opts.version),\n outputOptions(cmd),\n );\n });\n\n return group(cmd, \"MODELS & SKILLS\");\n}\n","/** `openbkn toolbox …` and `openbkn tool …` — agent toolboxes + tools. */\nimport { Command } from \"commander\";\nimport { group } from \"../help/grouped-help.js\";\nimport { DEFAULT_LIST_LIMIT } from \"../types.js\";\nimport { InputError } from \"../utils/errors.js\";\nimport { printJson } from \"../utils/output.js\";\nimport { clientFrom, outputOptions } from \"./_shared.js\";\n\nconst int = (v: string) => Number.parseInt(v, 10);\n\nexport function toolboxCommand(): Command {\n const cmd = new Command(\"toolbox\").description(\"Agent toolbox lifecycle\");\n\n cmd\n .command(\"list\")\n .description(\"List toolboxes\")\n .option(\"--keyword <s>\", \"filter by keyword\")\n .option(\"--limit <n>\", \"page size\", int, DEFAULT_LIST_LIMIT)\n .option(\"--offset <n>\", \"page offset\", int, 0)\n .action(async (opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).toolboxes.list({\n keyword: opts.keyword,\n limit: opts.limit,\n offset: opts.offset,\n }),\n outputOptions(cmd),\n );\n });\n\n cmd\n .command(\"create\")\n .description(\"Create a toolbox\")\n .requiredOption(\"--name <name>\", \"toolbox name\")\n .requiredOption(\"--service-url <url>\", \"tool service URL\")\n .option(\"--description <d>\", \"description\")\n .action(async (opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).toolboxes.create({\n name: opts.name,\n serviceUrl: opts.serviceUrl,\n description: opts.description,\n }),\n outputOptions(cmd),\n );\n });\n\n cmd\n .command(\"publish <box-id>\")\n .description(\"Publish a toolbox\")\n .action(async (id: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).toolboxes.publish(id), outputOptions(cmd));\n });\n\n cmd\n .command(\"unpublish <box-id>\")\n .description(\"Unpublish a toolbox (status=draft)\")\n .action(async (id: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).toolboxes.unpublish(id), outputOptions(cmd));\n });\n\n cmd\n .command(\"delete <box-id>\")\n .description(\"Delete a toolbox\")\n .option(\"-y, --yes\", \"skip confirmation\")\n .action(async (id: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).toolboxes.delete(id), outputOptions(cmd));\n });\n\n cmd\n .command(\"export <box-id>\")\n .description(\"Export a toolbox config to a local .adp file\")\n .requiredOption(\"-o, --out <file>\", \"output .adp path\")\n .option(\"--type <t>\", \"impex type: toolbox | mcp | operator\", \"toolbox\")\n .action(async (boxId: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).toolboxes.export(boxId, opts.out, opts.type),\n outputOptions(cmd),\n );\n });\n cmd\n .command(\"import <file>\")\n .description(\"Import a toolbox config from a local .adp file\")\n .option(\"--type <t>\", \"impex type: toolbox | mcp | operator\", \"toolbox\")\n .action(async (file: string, opts, cmd: Command) => {\n printJson(await clientFrom(cmd).toolboxes.import(file, opts.type), outputOptions(cmd));\n });\n\n return group(cmd, \"DECISION AGENT\");\n}\n\nexport function toolCommand(): Command {\n const cmd = new Command(\"tool\").description(\"Tools inside a toolbox\");\n\n cmd\n .command(\"list\")\n .description(\"List tools in a toolbox\")\n .requiredOption(\"--toolbox <box-id>\", \"toolbox id\")\n .action(async (opts, cmd: Command) => {\n printJson(await clientFrom(cmd).toolboxes.tools(opts.toolbox), outputOptions(cmd));\n });\n\n cmd\n .command(\"enable <tool-ids...>\")\n .description(\"Enable one or more tools\")\n .requiredOption(\"--toolbox <box-id>\", \"toolbox id\")\n .action(async (toolIds: string[], opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).toolboxes.setToolStatus(opts.toolbox, toolIds, \"enabled\"),\n outputOptions(cmd),\n );\n });\n\n cmd\n .command(\"disable <tool-ids...>\")\n .description(\"Disable one or more tools\")\n .requiredOption(\"--toolbox <box-id>\", \"toolbox id\")\n .action(async (toolIds: string[], opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).toolboxes.setToolStatus(opts.toolbox, toolIds, \"disabled\"),\n outputOptions(cmd),\n );\n });\n\n const invokeOpts = (c: Command) =>\n c\n .requiredOption(\"--toolbox <box-id>\", \"toolbox id\")\n .option(\"--body <json>\", \"request body JSON\")\n .option(\"--header <json>\", \"headers map JSON\")\n .option(\"--query <json>\", \"query params JSON\")\n .option(\"--path <json>\", \"path params JSON\")\n .option(\"--timeout <s>\", \"per-call timeout seconds\", int);\n\n const parseJson = (s: string | undefined, label: string): Record<string, unknown> | undefined => {\n if (!s) return undefined;\n try {\n return JSON.parse(s);\n } catch {\n throw new InputError(`--${label} must be valid JSON`);\n }\n };\n\n const buildEnvelope = (opts: Record<string, string | undefined>) => ({\n body: opts.body ? JSON.parse(opts.body) : undefined,\n header: parseJson(opts.header, \"header\"),\n query: parseJson(opts.query, \"query\"),\n path: parseJson(opts.path, \"path\"),\n timeout: opts.timeout ? Number(opts.timeout) : undefined,\n });\n\n invokeOpts(\n cmd.command(\"execute <tool-id>\").description(\"Invoke a published+enabled tool\"),\n ).action(async (toolId: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).toolboxes.execute(opts.toolbox, toolId, buildEnvelope(opts)),\n outputOptions(cmd),\n );\n });\n invokeOpts(\n cmd.command(\"debug <tool-id>\").description(\"Invoke a tool (draft/disabled too)\"),\n ).action(async (toolId: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).toolboxes.debug(opts.toolbox, toolId, buildEnvelope(opts)),\n outputOptions(cmd),\n );\n });\n\n cmd\n .command(\"upload <file>\")\n .description(\"Upload a tool definition file (OpenAPI spec) into a toolbox\")\n .requiredOption(\"--toolbox <id>\", \"target toolbox id\")\n .option(\"--metadata-type <t>\", \"metadata type\", \"openapi\")\n .action(async (file: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).toolboxes.upload(opts.toolbox, file, opts.metadataType),\n outputOptions(cmd),\n );\n });\n\n return group(cmd, \"DECISION AGENT\");\n}\n","/** `openbkn trace …` — trace data (search/get) + diagnose + eval-set. */\nimport { readFileSync, writeFileSync } from \"node:fs\";\nimport { Command } from \"commander\";\nimport { group } from \"../help/grouped-help.js\";\nimport { renderReportMarkdown } from \"../trace-ai/diagnose.js\";\nimport { validateSchemaFile } from \"../trace-ai/schema-validate.js\";\nimport { printJson } from \"../utils/output.js\";\nimport { clientFrom, outputOptions, readBody } from \"./_shared.js\";\n\nexport function traceCommand(): Command {\n const cmd = new Command(\"trace\").description(\n \"Trace AI — fetch spans, diagnose (symbolic + LLM rubric), scan, eval-set, schema validate\",\n );\n\n cmd\n .command(\"get <conversation-id>\")\n .description(\"Fetch all trace spans for a conversation\")\n .option(\"--max-spans <n>\", \"max spans\", (v) => Number.parseInt(v, 10))\n .action(async (conversationId: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).trace.spans(conversationId, { maxSpans: opts.maxSpans }),\n outputOptions(cmd),\n );\n });\n\n cmd\n .command(\"search\")\n .description(\"Raw trace search (--body / --body-file OpenSearch JSON)\")\n .option(\"--body <json>\", \"search body JSON\")\n .option(\"--body-file <path>\", \"read search body JSON from a file\")\n .action(async (opts, cmd: Command) => {\n printJson(await clientFrom(cmd).trace.search(readBody(opts)), outputOptions(cmd));\n });\n\n cmd\n .command(\"diagnose <conversation-id>\")\n .description(\"Diagnose a conversation's trace (symbolic rules; --llm adds rubric judging)\")\n .option(\"--llm\", \"also run LLM-judged rubric rules via the local `claude` CLI\")\n .action(async (conversationId: string, opts, cmd: Command) => {\n const report = await clientFrom(cmd).trace.diagnose(conversationId, {\n llm: Boolean(opts.llm),\n });\n const out = outputOptions(cmd);\n if (out.json) printJson(report, out);\n else console.log(renderReportMarkdown(report));\n });\n\n cmd\n .command(\"scan <conversation-ids>\")\n .description(\"Batch-diagnose several conversations (comma-joined) + aggregate findings\")\n .option(\"--llm\", \"hybrid mode (rubric + synthesizer) per trace via local `claude`\")\n .action(async (ids: string, opts, cmd: Command) => {\n const list = ids\n .split(\",\")\n .map((s) => s.trim())\n .filter(Boolean);\n printJson(\n await clientFrom(cmd).trace.scan(list, { llm: Boolean(opts.llm) }),\n outputOptions(cmd),\n );\n });\n\n const evalSet = cmd.command(\"eval-set\").description(\"Build + run trace eval sets\");\n evalSet\n .command(\"build <queries-file>\")\n .description(\"Build eval cases from a queries JSON file\")\n .option(\"--out <file>\", \"write the cases JSON here (default: stdout)\")\n .action(async (queriesFile: string, opts, cmd: Command) => {\n const raw = JSON.parse(readFileSync(queriesFile, \"utf8\"));\n const cases = clientFrom(cmd).trace.evalSetBuild(raw);\n if (opts.out) {\n writeFileSync(opts.out, JSON.stringify({ cases }, null, 2));\n printJson({ out: opts.out, cases: cases.length }, outputOptions(cmd));\n } else {\n printJson({ cases }, outputOptions(cmd));\n }\n });\n evalSet\n .command(\"test <cases-file>\")\n .description(\"Run an eval set against an agent (--llm enables semantic_match)\")\n .requiredOption(\"--agent <id>\", \"agent id to run the queries against\")\n .option(\"--version <v>\", \"agent version\", \"v0\")\n .option(\"--llm\", \"enable semantic_match assertions via the local `claude` CLI\")\n .action(async (casesFile: string, opts, cmd: Command) => {\n const raw = JSON.parse(readFileSync(casesFile, \"utf8\"));\n const cases = clientFrom(cmd).trace.evalSetBuild(raw);\n const result = await clientFrom(cmd).trace.evalSetTest(opts.agent, cases, {\n version: opts.version,\n llm: Boolean(opts.llm),\n });\n printJson(result, outputOptions(cmd));\n if (result.failed > 0) process.exitCode = 1;\n });\n\n const schema = cmd.command(\"schema\").description(\"Validate eval-set / diagnosis-rule files\");\n schema\n .command(\"validate <file>\")\n .description(\"Validate an eval-set or diagnosis-rule file (JSON/YAML) against its schema\")\n .option(\"--kind <k>\", \"force schema kind: eval-set | rule (default: auto-detect)\")\n .action(async (file: string, opts, cmd: Command) => {\n const result = validateSchemaFile(file, opts.kind);\n printJson(result, outputOptions(cmd));\n if (!result.valid) process.exitCode = 1;\n });\n\n return group(cmd, \"TRACE AI\");\n}\n","/**\n * `trace schema validate` — validate a local eval-set or diagnosis-rule file\n * (JSON or YAML) against a zod schema. Catches malformed cases/rules before\n * `eval-set test` runs them or before a custom rule is shipped.\n */\nimport { readFileSync } from \"node:fs\";\nimport { extname } from \"node:path\";\nimport yaml from \"js-yaml\";\nimport { z } from \"zod\";\n\nconst Assertion = z\n .object({\n type: z.enum([\n \"contains\",\n \"not_contains\",\n \"regex\",\n \"tool_call_count\",\n \"tool_call_order\",\n \"latency_ms\",\n \"semantic_match\",\n ]),\n })\n .passthrough();\n\nconst EvalCase = z.object({\n query_id: z.string().optional(),\n query: z.string().optional(),\n input: z.object({ user_message: z.string() }).optional(),\n reference: z.object({ answer: z.string() }).optional(),\n assertions: z.array(Assertion).optional(),\n tags: z.array(z.string()).optional(),\n});\n\nconst EvalSetFile = z.union([\n z.array(EvalCase),\n z.object({ cases: z.array(EvalCase) }),\n z.object({ queries: z.array(EvalCase) }),\n]);\n\nconst DiagnosisRule = z.object({\n id: z.string(),\n severity: z.enum([\"low\", \"medium\", \"high\"]),\n symptom: z.string(),\n predicate: z.string().optional(),\n rubric: z.unknown().optional(),\n params: z.record(z.string(), z.unknown()).optional(),\n});\n\nexport type SchemaKind = \"eval-set\" | \"rule\";\n\nexport interface SchemaValidateResult {\n valid: boolean;\n kind: SchemaKind;\n file: string;\n errors: string[];\n}\n\nfunction parseFile(file: string): unknown {\n const text = readFileSync(file, \"utf8\");\n const ext = extname(file).toLowerCase();\n if (ext === \".yaml\" || ext === \".yml\") return yaml.load(text);\n return JSON.parse(text);\n}\n\n/** Infer the schema kind from the parsed shape when not given explicitly. */\nfunction inferKind(data: unknown): SchemaKind {\n if (data && typeof data === \"object\" && !Array.isArray(data)) {\n const o = data as Record<string, unknown>;\n if (\"predicate\" in o || \"rubric\" in o || (\"symptom\" in o && \"severity\" in o)) return \"rule\";\n }\n return \"eval-set\";\n}\n\nexport function validateSchemaFile(file: string, kind?: SchemaKind): SchemaValidateResult {\n let data: unknown;\n try {\n data = parseFile(file);\n } catch (e) {\n return {\n valid: false,\n kind: kind ?? \"eval-set\",\n file,\n errors: [`parse error: ${e instanceof Error ? e.message : String(e)}`],\n };\n }\n const resolved = kind ?? inferKind(data);\n const schema = resolved === \"rule\" ? DiagnosisRule : EvalSetFile;\n const result = schema.safeParse(data);\n if (result.success) return { valid: true, kind: resolved, file, errors: [] };\n return {\n valid: false,\n kind: resolved,\n file,\n errors: result.error.issues.map((i) => `${i.path.join(\".\") || \"(root)\"}: ${i.message}`),\n };\n}\n","/** `openbkn vega …` — Catalog reads + index BuildTask. */\nimport { Command } from \"commander\";\nimport { group } from \"../help/grouped-help.js\";\nimport { DEFAULT_LIST_LIMIT } from \"../types.js\";\nimport { printJson } from \"../utils/output.js\";\nimport { clientFrom, csv, outputOptions } from \"./_shared.js\";\n\nexport function vegaCommand(): Command {\n const vega = new Command(\"vega\").description(\n \"Vega observability — catalog, resources, index build tasks\",\n );\n\n const catalog = vega.command(\"catalog\").description(\"Catalog entries\");\n catalog\n .command(\"list\")\n .description(\"List catalog entries\")\n .option(\"--limit <n>\", \"page size\", (v) => Number.parseInt(v, 10), DEFAULT_LIST_LIMIT)\n .option(\"--offset <n>\", \"page offset\", (v) => Number.parseInt(v, 10), 0)\n .action(async (_opts, cmd: Command) => {\n const o = cmd.optsWithGlobals();\n const data = await clientFrom(cmd).vega.catalogs({ limit: o.limit, offset: o.offset });\n printJson(data, outputOptions(cmd));\n });\n catalog\n .command(\"get <id>\")\n .description(\"Get a catalog by id\")\n .action(async (id: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).vega.getCatalog(id), outputOptions(cmd));\n });\n catalog\n .command(\"resources <id>\")\n .description(\"List resources under a catalog\")\n .option(\"--category <c>\", \"filter by category (e.g. table)\")\n .action(async (id: string, opts, cmd: Command) => {\n printJson(await clientFrom(cmd).vega.catalogResources(id, opts.category), outputOptions(cmd));\n });\n catalog\n .command(\"health <ids...>\")\n .description(\"Health-status for one or more catalogs\")\n .action(async (ids: string[], _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).vega.catalogHealth(ids), outputOptions(cmd));\n });\n\n const connector = vega.command(\"connector-type\").description(\"Connector types\");\n connector\n .command(\"list\")\n .description(\"List connector types\")\n .action(async (_opts, cmd: Command) => {\n printJson(await clientFrom(cmd).vega.connectorTypes(), outputOptions(cmd));\n });\n connector\n .command(\"get <type>\")\n .description(\"Get a connector type\")\n .action(async (type: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).vega.connectorType(type), outputOptions(cmd));\n });\n\n const resource = vega.command(\"resource\").description(\"Vega-backend resources\");\n resource\n .command(\"list\")\n .description(\"List resources\")\n .option(\"--datasource-id <id>\", \"filter by catalog/datasource id\")\n .option(\"--type <category>\", \"resource category\")\n .option(\"--limit <n>\", \"page size\", (v) => Number.parseInt(v, 10), DEFAULT_LIST_LIMIT)\n .action(async (opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).resource.list({\n datasourceId: opts.datasourceId,\n category: opts.type,\n limit: opts.limit,\n }),\n outputOptions(cmd),\n );\n });\n resource\n .command(\"get <id>\")\n .description(\"Get a resource\")\n .action(async (id: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).resource.get(id), outputOptions(cmd));\n });\n resource\n .command(\"query <id>\")\n .description(\"Fetch data rows from a resource\")\n .option(\"--limit <n>\", \"row limit\", (v) => Number.parseInt(v, 10), 50)\n .option(\"--offset <n>\", \"row offset\", (v) => Number.parseInt(v, 10), 0)\n .action(async (id: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).resource.query(id, { limit: opts.limit, offset: opts.offset }),\n outputOptions(cmd),\n );\n });\n\n const dataset = vega.command(\"dataset\").description(\"Dataset index build tasks\");\n dataset\n .command(\"build <resource-id>\")\n .description(\"Build a resource's index (creates a BuildTask)\")\n .requiredOption(\"--mode <mode>\", \"build mode: batch | streaming\")\n .option(\"--embedding-fields <list>\", \"comma-separated fields to vectorize\")\n .option(\n \"--build-key-fields <list>\",\n \"comma-separated key fields (batch: time; streaming: row id)\",\n )\n .option(\"--embedding-model <id>\", \"embedding model id (default if omitted)\")\n .option(\"--model-dimensions <n>\", \"vector dimensions\", (v) => Number.parseInt(v, 10))\n .option(\"--wait\", \"poll until the build reaches a terminal state\")\n .option(\"--timeout <s>\", \"wait timeout in seconds\", (v) => Number.parseInt(v, 10), 300)\n .action(async (resourceId: string, _opts, cmd: Command) => {\n const o = cmd.optsWithGlobals();\n const task = await clientFrom(cmd).vega.build(\n {\n resource_id: resourceId,\n mode: o.mode,\n embedding_fields: csv(o.embeddingFields),\n build_key_fields: csv(o.buildKeyFields),\n embedding_model: o.embeddingModel,\n model_dimensions: o.modelDimensions,\n },\n { wait: Boolean(o.wait), timeoutMs: o.timeout * 1000 },\n );\n printJson(task, outputOptions(cmd));\n });\n\n dataset\n .command(\"build-status <resource-id> <task-id>\")\n .description(\"Show a BuildTask's state and progress\")\n .action(async (_resourceId: string, taskId: string, _opts, cmd: Command) => {\n const task = await clientFrom(cmd).vega.buildStatus(taskId);\n printJson(task, outputOptions(cmd));\n });\n\n return group(vega, \"AI DATA PLATFORM\");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,SAAS,WAAAA,iBAAe;;;ACLxB;AAAA,EACE,MAAQ;AAAA,EACR,SAAW;AAAA,EACX,aAAe;AAAA,EACf,MAAQ;AAAA,EACR,SAAW;AAAA,EACX,SAAW;AAAA,IACT,MAAQ;AAAA,EACV;AAAA,EACA,KAAO;AAAA,IACL,SAAW;AAAA,EACb;AAAA,EACA,MAAQ;AAAA,EACR,OAAS;AAAA,EACT,SAAW;AAAA,IACT,KAAK;AAAA,MACH,OAAS;AAAA,MACT,QAAU;AAAA,IACZ;AAAA,EACF;AAAA,EACA,OAAS,CAAC,QAAQ,aAAa,gBAAgB,SAAS;AAAA,EACxD,eAAiB;AAAA,IACf,QAAU;AAAA,EACZ;AAAA,EACA,YAAc;AAAA,IACZ,MAAQ;AAAA,IACR,KAAO;AAAA,EACT;AAAA,EACA,UAAY,CAAC,OAAO,WAAW,qBAAqB,OAAO,OAAO,YAAY;AAAA,EAC9E,SAAW;AAAA,IACT,OAAS;AAAA,IACT,KAAO;AAAA,IACP,WAAa;AAAA,IACb,MAAQ;AAAA,IACR,QAAU;AAAA,IACV,MAAQ;AAAA,IACR,cAAc;AAAA,IACd,IAAM;AAAA,IACN,gBAAkB;AAAA,EACpB;AAAA,EACA,cAAgB;AAAA,IACd,kBAAkB;AAAA,IAClB,OAAS;AAAA,IACT,cAAc;AAAA,IACd,WAAa;AA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C9B;","names":["Command","Command","readFileSync","resolve","req","cmd","r","readFileSync","Command","Command","int","Command","cmd","Command","readFileSync","int","Command","Command","Command","cmd","Command","Command","Command","int","Command","cmd","Command","int","Command","cmd","createServer","Command","int","readBody","resolve","Command","createServer","Command","int","Command","Command","int","Command","cmd","Command","int","Command","cmd","status","Command","int","Command","cmd","readFileSync","Command","readFileSync","Command","cmd","readFileSync","Command","Command","Command"]}
1
+ {"version":3,"sources":["../src/cli.ts","../package.json","../src/commands/admin.ts","../src/help/grouped-help.ts","../src/utils/output.ts","../src/commands/_shared.ts","../src/commands/auth.ts","../src/auth/oauth.ts","../src/commands/agent.ts","../src/commands/bkn.ts","../src/utils/bkn-validate.ts","../src/commands/call.ts","../src/commands/config.ts","../src/commands/context.ts","../src/commands/dataflow.ts","../src/commands/explore.ts","../src/commands/model.ts","../src/commands/resource.ts","../src/commands/skill.ts","../src/commands/toolbox.ts","../src/commands/trace.ts","../src/trace-ai/schema-validate.ts","../src/commands/vega.ts"],"sourcesContent":["#!/usr/bin/env node\n/**\n * `openbkn` — unified CLI for the BKN platform.\n * Thin shell: parse argv → call a resource → print. No business logic here.\n */\nimport { Command } from \"commander\";\nimport pkg from \"../package.json\" with { type: \"json\" };\nimport { adminCommand } from \"./commands/admin.js\";\nimport { agentCommand } from \"./commands/agent.js\";\nimport { authCommand } from \"./commands/auth.js\";\nimport { bknCommand } from \"./commands/bkn.js\";\nimport { callCommand } from \"./commands/call.js\";\nimport { configCommand } from \"./commands/config.js\";\nimport { contextCommand } from \"./commands/context.js\";\nimport { dataflowCommand } from \"./commands/dataflow.js\";\nimport { exploreCommand } from \"./commands/explore.js\";\nimport { modelCommand } from \"./commands/model.js\";\nimport { resourceCommand } from \"./commands/resource.js\";\nimport { skillCommand } from \"./commands/skill.js\";\nimport { toolCommand, toolboxCommand } from \"./commands/toolbox.js\";\nimport { traceCommand } from \"./commands/trace.js\";\nimport { vegaCommand } from \"./commands/vega.js\";\nimport { installGroupedHelp } from \"./help/grouped-help.js\";\nimport { formatError, toExitCode } from \"./utils/errors.js\";\n\nconst program = new Command();\n\nprogram\n .name(\"openbkn\")\n .description(\"Operate the BKN platform from the CLI\")\n .version(pkg.version, \"-V, --version\", \"output the version number\")\n .option(\"--base-url <url>\", \"platform base URL (env: BKN_BASE_URL)\")\n .option(\"--token <value>\", \"access token (env: BKN_TOKEN)\")\n .option(\"--user <id|name>\", \"use specific user credentials (env: BKN_USER)\")\n .option(\"--json\", \"machine-readable JSON output\")\n .option(\"--compact\", \"single-line JSON output\")\n .option(\"--biz-domain <s>\", \"business domain (alias: -bd)\")\n .option(\"-k, --insecure\", \"skip TLS verification (dev / self-signed only)\")\n .showHelpAfterError();\n\n// Real commands.\nprogram.addCommand(authCommand());\nprogram.addCommand(callCommand());\nprogram.addCommand(configCommand());\nprogram.addCommand(vegaCommand());\nprogram.addCommand(bknCommand());\nprogram.addCommand(resourceCommand());\nprogram.addCommand(dataflowCommand());\nprogram.addCommand(contextCommand());\nprogram.addCommand(agentCommand());\nprogram.addCommand(modelCommand());\nprogram.addCommand(skillCommand());\nprogram.addCommand(toolboxCommand());\nprogram.addCommand(toolCommand());\nprogram.addCommand(traceCommand());\nprogram.addCommand(adminCommand());\nprogram.addCommand(exploreCommand());\n\n// Apply grouped help to the whole tree (after all commands are registered).\ninstallGroupedHelp(program);\n\n// Legacy `-bd` is a 2-char short flag commander can't declare; rewrite it to\n// the canonical `--biz-domain` before parsing (kweaver compatibility).\nconst argv = process.argv.map((a) => (a === \"-bd\" ? \"--biz-domain\" : a));\n\ntry {\n await program.parseAsync(argv);\n} catch (err) {\n console.error(formatError(err));\n process.exit(toExitCode(err));\n}\n","{\n \"name\": \"@openbkn/bkn-sdk\",\n \"version\": \"0.1.1-alpha.0\",\n \"description\": \"Unified TypeScript SDK + CLI for the BKN (Business Knowledge Network) platform.\",\n \"type\": \"module\",\n \"license\": \"Apache-2.0\",\n \"engines\": {\n \"node\": \">=22\"\n },\n \"bin\": {\n \"openbkn\": \"./dist/cli.js\"\n },\n \"main\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"exports\": {\n \".\": {\n \"types\": \"./dist/index.d.ts\",\n \"import\": \"./dist/index.js\"\n }\n },\n \"files\": [\"dist\", \"README.md\", \"README.zh.md\", \"LICENSE\"],\n \"publishConfig\": {\n \"access\": \"public\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/openbkn-ai/bkn-sdk.git\"\n },\n \"keywords\": [\"bkn\", \"openbkn\", \"knowledge-network\", \"cli\", \"sdk\", \"typescript\"],\n \"scripts\": {\n \"build\": \"tsup\",\n \"dev\": \"tsup --watch\",\n \"typecheck\": \"tsc --noEmit\",\n \"lint\": \"biome check . && tsc --noEmit\",\n \"format\": \"biome format --write .\",\n \"test\": \"vitest run\",\n \"test:cover\": \"vitest run --coverage\",\n \"ci\": \"npm run lint && npm test\",\n \"prepublishOnly\": \"npm run ci && npm run build\"\n },\n \"dependencies\": {\n \"@clack/prompts\": \"^0.9.1\",\n \"chalk\": \"^5.4.1\",\n \"cli-table3\": \"^0.6.5\",\n \"commander\": \"^13.1.0\",\n \"csv-parse\": \"^6.2.1\",\n \"js-yaml\": \"^4.2.0\",\n \"jszip\": \"^3.10.1\",\n \"zod\": \"^3.24.1\"\n },\n \"devDependencies\": {\n \"@biomejs/biome\": \"^1.9.4\",\n \"@types/js-yaml\": \"^4.0.9\",\n \"@types/node\": \"^22.13.0\",\n \"tsup\": \"^8.4.0\",\n \"typescript\": \"^5.8.0\",\n \"vitest\": \"^3.0.0\"\n }\n}\n","/**\n * `openbkn admin …` — the kweaver-admin operator CLI, nested as a subcommand.\n * Mapping is 1:1: `kweaver-admin <x>` → `openbkn admin <x>`. org/user/role\n * reads + writes (create/update/delete/reset-password) and org tree are real\n * and live-verified; operator `auth` reuses the top-level `openbkn auth`.\n */\nimport { Command } from \"commander\";\nimport { rawCall } from \"../api/call.js\";\nimport { resolveContext } from \"../config/resolve.js\";\nimport { activePlatform, setActivePlatform } from \"../config/store.js\";\nimport { group } from \"../help/grouped-help.js\";\nimport { DEFAULT_LIST_LIMIT } from \"../types.js\";\nimport { renderOrgTree } from \"../utils/org-tree.js\";\nimport { printJson } from \"../utils/output.js\";\nimport { clientFrom, outputOptions, readBody } from \"./_shared.js\";\nimport { registerAuthLeaves } from \"./auth.js\";\n\nconst int = (v: string) => Number.parseInt(v, 10);\n\nexport function adminCommand(): Command {\n const admin = new Command(\"admin\").description(\n \"Operator CLI (kweaver-admin): org, user, role, models, audit\",\n );\n\n // Operator auth = the same leaves as top-level `openbkn auth` (1:1 nest).\n registerAuthLeaves(admin.command(\"auth\").description(\"Operator authentication\"));\n\n const org = admin.command(\"org\").description(\"Departments and org structure\");\n org\n .command(\"list\")\n .description(\"List departments\")\n .option(\"--role <r>\", \"role qualifier\", \"super_admin\")\n .option(\"--name <s>\", \"filter by name\")\n .option(\"--limit <n>\", \"page size\", int, 100)\n .option(\"--offset <n>\", \"page offset\", int, 0)\n .action(async (opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).admin.orgList({\n role: opts.role,\n name: opts.name,\n limit: opts.limit,\n offset: opts.offset,\n }),\n outputOptions(cmd),\n );\n });\n org\n .command(\"get <id>\")\n .description(\"Get one department\")\n .action(async (id: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).admin.orgGet(id), outputOptions(cmd));\n });\n org\n .command(\"members <id>\")\n .description(\"List members of a department\")\n .option(\"--role <r>\", \"role qualifier\", \"super_admin\")\n .option(\"--fields <s>\", \"fields segment\", \"users\")\n .option(\"--limit <n>\", \"page size\", int, 100)\n .option(\"--offset <n>\", \"page offset\", int, 0)\n .action(async (id: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).admin.orgMembers(id, {\n role: opts.role,\n limit: opts.limit,\n offset: opts.offset,\n }),\n outputOptions(cmd),\n );\n });\n org\n .command(\"create\")\n .description(\"Create a department\")\n .requiredOption(\"--name <s>\", \"department name\")\n .option(\"--parent <id>\", \"parent department id\", \"-1\")\n .option(\"--code <s>\", \"department code\")\n .option(\"--remark <s>\", \"remark\")\n .option(\"--email <s>\", \"email\")\n .option(\"--manager <id>\", \"manager user id\")\n .option(\"--status <n>\", \"status (1=enabled)\", int)\n .option(\"--oss-id <id>\", \"object-storage site id\")\n .action(async (opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).admin.orgCreate({\n name: opts.name,\n parentId: opts.parent,\n code: opts.code,\n remark: opts.remark,\n email: opts.email,\n managerID: opts.manager,\n status: opts.status,\n }),\n outputOptions(cmd),\n );\n });\n org\n .command(\"update <id>\")\n .description(\"Update a department (only provided fields change)\")\n .option(\"--name <s>\", \"new name\")\n .option(\"--code <s>\", \"department code\")\n .option(\"--remark <s>\", \"remark\")\n .option(\"--email <s>\", \"email\")\n .option(\"--manager <id>\", \"manager user id\")\n .option(\"--status <n>\", \"status (1=enabled)\", int)\n .option(\"--oss-id <id>\", \"object-storage site id\")\n .action(async (id: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).admin.orgUpdate(id, {\n name: opts.name,\n code: opts.code,\n remark: opts.remark,\n email: opts.email,\n managerID: opts.manager,\n status: opts.status,\n }),\n outputOptions(cmd),\n );\n });\n org\n .command(\"delete <id>\")\n .description(\"Delete a department\")\n .action(async (id: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).admin.orgDelete(id), outputOptions(cmd));\n });\n org\n .command(\"tree\")\n .description(\"Print the department hierarchy\")\n .option(\"--role <r>\", \"role qualifier\", \"super_admin\")\n .action(async (opts, cmd: Command) => {\n const tree = await clientFrom(cmd).admin.orgTree(opts.role);\n const out = outputOptions(cmd);\n if (out.json) printJson(tree, out);\n else console.log(renderOrgTree(tree));\n });\n\n const user = admin.command(\"user\").description(\"User management\");\n user\n .command(\"list\")\n .description(\"List users\")\n .option(\"--org <id>\", \"filter by department id\")\n .option(\"--keyword <s>\", \"filter by name\")\n .option(\"--limit <n>\", \"page size\", int, 100)\n .option(\"--offset <n>\", \"page offset\", int, 0)\n .action(async (opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).admin.userList({\n orgId: opts.org,\n name: opts.keyword,\n limit: opts.limit,\n offset: opts.offset,\n }),\n outputOptions(cmd),\n );\n });\n user\n .command(\"assign-role <user> <role>\")\n .description(\"Grant a role to a user\")\n .action(async (userId: string, roleId: string, _opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).admin.addRoleMember(roleId, userId, \"user\"),\n outputOptions(cmd),\n );\n });\n user\n .command(\"revoke-role <user> <role>\")\n .description(\"Revoke a role from a user\")\n .action(async (userId: string, roleId: string, _opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).admin.removeRoleMember(roleId, userId, \"user\"),\n outputOptions(cmd),\n );\n });\n user\n .command(\"get <id>\")\n .description(\"Get one user\")\n .action(async (id: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).admin.userGet(id), outputOptions(cmd));\n });\n user\n .command(\"roles <user>\")\n .description(\"List roles granted to a user\")\n .action(async (userId: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).admin.userRoles(userId), outputOptions(cmd));\n });\n user\n .command(\"create\")\n .description(\"Create a user (gets the platform default password)\")\n .requiredOption(\"--login <name>\", \"login name\")\n .option(\"--display-name <s>\", \"display name (defaults to login name)\")\n .option(\"--email <s>\", \"email\")\n .option(\"--department <id>\", \"department id\", \"-1\")\n .option(\"--code <s>\", \"user code\")\n .option(\"--position <s>\", \"position\")\n .option(\"--remark <s>\", \"remark\")\n .option(\"--tel <s>\", \"telephone\")\n .option(\"--priority <n>\", \"priority\", int)\n .option(\"--csf-level <n>\", \"confidentiality level\", int)\n .action(async (opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).admin.userCreate({\n loginName: opts.login,\n displayName: opts.displayName,\n email: opts.email,\n departmentIds: opts.department ? [opts.department] : undefined,\n code: opts.code,\n position: opts.position,\n remark: opts.remark,\n telNumber: opts.tel,\n priority: opts.priority,\n csfLevel: opts.csfLevel,\n }),\n outputOptions(cmd),\n );\n });\n user\n .command(\"update <id>\")\n .description(\"Update a user (only provided fields change)\")\n .option(\"--display-name <s>\", \"display name\")\n .option(\"--email <s>\", \"email\")\n .option(\"--code <s>\", \"user code\")\n .option(\"--position <s>\", \"position\")\n .option(\"--remark <s>\", \"remark\")\n .option(\"--tel <s>\", \"telephone\")\n .option(\"--manager <id>\", \"manager user id\")\n .option(\"--idcard <s>\", \"id-card number\")\n .option(\"--priority <n>\", \"priority\", int)\n .option(\"--csf-level <n>\", \"confidentiality level\", int)\n .option(\"--csf-level2 <n>\", \"secondary confidentiality level\", int)\n .option(\"--expire-time <n>\", \"account expiry (epoch, -1 = never)\", int)\n .action(async (id: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).admin.userUpdate(id, {\n displayName: opts.displayName,\n email: opts.email,\n code: opts.code,\n position: opts.position,\n remark: opts.remark,\n telNumber: opts.tel,\n managerID: opts.manager,\n priority: opts.priority,\n csfLevel: opts.csfLevel,\n }),\n outputOptions(cmd),\n );\n });\n user\n .command(\"delete <id>\")\n .description(\"Delete a user\")\n .action(async (id: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).admin.userDelete(id), outputOptions(cmd));\n });\n user\n .command(\"reset-password [id]\")\n .description(\"Reset a user's password (RSA-encrypted in transit)\")\n .option(\"--id <userId>\", \"explicit user UUID (alt to the positional id)\")\n .option(\"--user <account>\", \"resolve the user by account / login name\")\n .option(\"--password <s>\", \"the new password\")\n .option(\"--new-password <s>\", \"the new password (alias of --password)\")\n .option(\"--prompt-password\", \"prompt for the new password interactively\")\n .option(\"-y, --yes\", \"skip confirmation\")\n .action(async (id: string | undefined, opts, cmd: Command) => {\n const userId = id ?? opts.id ?? opts.user;\n const pwd = opts.password ?? opts.newPassword;\n if (!userId) throw new Error(\"Provide a user id (positional or --id).\");\n if (!pwd) throw new Error(\"Provide --password / --new-password.\");\n printJson(await clientFrom(cmd).admin.userResetPassword(userId, pwd), outputOptions(cmd));\n });\n\n const role = admin.command(\"role\").description(\"Role management\");\n role\n .command(\"list\")\n .description(\"List roles\")\n .option(\"--keyword <s>\", \"filter by keyword\")\n .option(\"--limit <n>\", \"page size\", int, 100)\n .option(\"--offset <n>\", \"page offset\", int, 0)\n .option(\"--source <s>\", \"role source filter (business | user)\")\n .action(async (opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).admin.roleList({ keyword: opts.keyword, limit: opts.limit }),\n outputOptions(cmd),\n );\n });\n role\n .command(\"get <role>\")\n .description(\"Get a role by id\")\n .option(\"--view <mode>\", \"detail view mode\")\n .action(async (roleId: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).admin.roleGet(roleId), outputOptions(cmd));\n });\n role\n .command(\"members <role>\")\n .description(\"List members of a role\")\n .option(\"--keyword <s>\", \"filter by keyword\")\n .option(\"--type <t>\", \"filter by member type (user|department|group|app)\")\n .option(\"--member <spec...>\", \"filter to specific member(s) '<type>:<id-or-name>'\")\n .option(\"--limit <n>\", \"page size\", int, 100)\n .option(\"--offset <n>\", \"page offset\", int, 0)\n .action(async (roleId: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).admin.roleMembers(roleId, {\n keyword: opts.keyword,\n limit: opts.limit,\n }),\n outputOptions(cmd),\n );\n });\n role\n .command(\"add-member <role> <id>\")\n .description(\"Add a member to a role\")\n .option(\"--type <t>\", \"member type\", \"user\")\n .option(\"--member <spec...>\", \"member(s) as '<type>:<id-or-name>' (alt to <id>)\")\n .action(async (roleId: string, id: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).admin.addRoleMember(roleId, id, opts.type),\n outputOptions(cmd),\n );\n });\n role\n .command(\"remove-member <role> <id>\")\n .description(\"Remove a member from a role\")\n .option(\"--type <t>\", \"member type\", \"user\")\n .option(\"--member <spec...>\", \"member(s) as '<type>:<id-or-name>' (alt to <id>)\")\n .action(async (roleId: string, id: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).admin.removeRoleMember(roleId, id, opts.type),\n outputOptions(cmd),\n );\n });\n\n // Models management reuses the (validated) mf-model-manager client. Granular\n // flags assemble the request body; `--body`/`--body-file` override wins.\n const modelBody = (opts: Record<string, unknown>): unknown => {\n if (opts.body || opts.bodyFile) return readBody(opts as { body?: string; bodyFile?: string });\n const mc: Record<string, unknown> = {};\n if (opts.apiModel) mc.api_model = opts.apiModel;\n if (opts.apiUrl) mc.api_url = opts.apiUrl;\n if (opts.apiBase) mc.api_url = opts.apiBase;\n if (opts.apiKey) mc.api_key = opts.apiKey;\n const body: Record<string, unknown> = {};\n if (opts.name) body.model_name = opts.name;\n if (opts.series) body.model_series = opts.series;\n if (opts.type) body.model_type = opts.type;\n if (opts.icon) body.icon = opts.icon;\n if (opts.embeddingDim !== undefined) body.model_dimensions = opts.embeddingDim;\n if (opts.maxTokens !== undefined) body.max_model_len = opts.maxTokens;\n if (opts.batchSize !== undefined) body.batch_size = opts.batchSize;\n if (Object.keys(mc).length > 0) body.model_config = mc;\n return body;\n };\n for (const kind of [\"llm\", \"small-model\"] as const) {\n const isLlm = kind === \"llm\";\n const m = admin.command(kind).description(`${kind} management`);\n const ns = isLlm ? \"llm\" : \"small\";\n\n const list = m\n .command(\"list\")\n .description(`List ${kind} models`)\n .option(\"--name <s>\", \"filter by name\")\n .option(\"--page <n>\", \"page\", int, 1)\n .option(\"--size <n>\", \"page size\", int, DEFAULT_LIST_LIMIT);\n (isLlm\n ? list.option(\"--series <s>\", \"model series\")\n : list.option(\"--type <t>\", \"model type\")\n ).action(async (opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).models[ns].list({\n name: opts.name,\n page: opts.page,\n limit: opts.size,\n modelType: opts.type,\n }),\n outputOptions(cmd),\n );\n });\n\n m.command(\"get <modelid>\")\n .description(`Get a ${kind} model`)\n .action(async (id: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).models[ns].get(id), outputOptions(cmd));\n });\n\n const add = m\n .command(\"add\")\n .description(`Register a ${kind} model (granular flags or --body/--body-file)`)\n .option(\"--name <s>\", \"model name\")\n .option(\"--api-model <s>\", \"upstream API model id\")\n .option(\"--api-key <s>\", \"upstream API key\")\n .option(\"--body <json>\", \"model config JSON (overrides flags)\")\n .option(\"--body-file <path>\", \"read config JSON from a file\");\n if (isLlm) {\n add\n .option(\"--series <s>\", \"model series\")\n .option(\"--api-base <url>\", \"upstream API base URL\")\n .option(\"--icon <url>\", \"icon URL\");\n } else {\n add\n .option(\"--type <t>\", \"small-model type (embedding|reranker)\")\n .option(\"--api-url <url>\", \"upstream API URL\")\n .option(\"--embedding-dim <n>\", \"embedding dimensions\", int)\n .option(\"--max-tokens <n>\", \"max tokens\", int)\n .option(\"--batch-size <n>\", \"batch size\", int);\n }\n add.action(async (opts, cmd: Command) => {\n printJson(await clientFrom(cmd).models[ns].add(modelBody(opts)), outputOptions(cmd));\n });\n\n const edit = m\n .command(\"edit <modelid>\")\n .description(`Edit a ${kind} model (granular flags or --body/--body-file)`)\n .option(\"--name <s>\", \"model name\")\n .option(\"--body <json>\", \"model config JSON (overrides flags)\")\n .option(\"--body-file <path>\", \"read config JSON from a file\");\n if (isLlm) {\n edit.option(\"--icon <url>\", \"icon URL\");\n } else {\n edit\n .option(\"--api-model <s>\", \"upstream API model id\")\n .option(\"--api-url <url>\", \"upstream API URL\");\n }\n edit.action(async (id: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).models[ns].edit({ model_id: id, ...(modelBody(opts) as object) }),\n outputOptions(cmd),\n );\n });\n\n m.command(\"delete <modelid...>\")\n .description(`Delete ${kind} model(s)`)\n .action(async (ids: string[], _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).models[ns].delete(ids), outputOptions(cmd));\n });\n\n m.command(\"test <modelid>\")\n .description(`Test a ${kind} model`)\n .option(\"--body <json>\", \"test request JSON\")\n .option(\"--body-file <path>\", \"read test request JSON from a file\")\n .action(async (id: string, opts, cmd: Command) => {\n const body = opts.body || opts.bodyFile ? (readBody(opts) as object) : {};\n printJson(\n await clientFrom(cmd).models[ns].test({ model_id: id, ...body }),\n outputOptions(cmd),\n );\n });\n }\n\n admin\n .command(\"audit\")\n .description(\"Audit log queries\")\n .command(\"list\")\n .description(\"List login audit events\")\n .option(\"--user <name>\", \"filter by user\")\n .option(\"--start <time>\", \"start time\")\n .option(\"--end <time>\", \"end time\")\n .option(\"--page <n>\", \"page\", int, 1)\n .option(\"--size <n>\", \"page size\", int, 30)\n .action(async (opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).admin.auditList({\n user: opts.user,\n start: opts.start,\n end: opts.end,\n page: opts.page,\n size: opts.size,\n }),\n outputOptions(cmd),\n );\n });\n const adminConfig = admin.command(\"config\").description(\"Admin CLI config (active platform)\");\n adminConfig\n .command(\"show\")\n .description(\"Show the active platform\")\n .action((_opts, cmd: Command) => {\n printJson({ baseUrl: activePlatform() }, outputOptions(cmd));\n });\n adminConfig\n .command(\"set <key> <value>\")\n .description(\"Set a config value (baseUrl)\")\n .action((key: string, value: string, _opts, cmd: Command) => {\n if (key !== \"baseUrl\") {\n throw new Error(`Unknown config key: ${key} (only baseUrl supported)`);\n }\n setActivePlatform(value.replace(/\\/+$/, \"\"));\n printJson({ ok: true, baseUrl: value }, outputOptions(cmd));\n });\n admin\n .command(\"call <url>\")\n .description(\"Operator API passthrough (curl-style; auto-injected auth)\")\n .option(\"-X, --request <method>\", \"HTTP method\")\n .option(\n \"-H, --header <header>\",\n 'extra header \"Name: value\" (repeatable)',\n (v, a: string[]) => {\n a.push(v);\n return a;\n },\n [] as string[],\n )\n .option(\"-d, --data <body>\", \"request body (JSON content-type if unset)\")\n .action(async (url: string, opts, cmd: Command) => {\n const g = cmd.optsWithGlobals();\n const res = await rawCall(\n resolveContext({\n baseUrl: g.baseUrl,\n token: g.token,\n user: g.user,\n businessDomain: g.bizDomain,\n insecure: g.insecure,\n }),\n url,\n { method: opts.request, header: opts.header, data: opts.data, businessDomain: g.bizDomain },\n );\n const out = outputOptions(cmd);\n try {\n printJson(JSON.parse(res.body), out);\n } catch {\n process.stdout.write(res.body.endsWith(\"\\n\") ? res.body : `${res.body}\\n`);\n }\n if (res.status >= 400) process.exitCode = 1;\n });\n\n return group(admin, \"OPERATOR\");\n}\n","/**\n * Grouped help formatter for commander — reproduces the legacy Kweaver layout\n * (section headers + USAGE / FLAGS) at every command level. One formatter, no\n * per-command help strings: each command carries a `group` tag read here.\n */\nimport type { Command, Help } from \"commander\";\n\nconst GROUP = Symbol(\"openbkn.group\");\nconst DEFAULT_GROUP = \"COMMANDS\";\n\n/** Tag a command with the help section it belongs to. Returns the command. */\nexport function group(cmd: Command, name: string): Command {\n (cmd as unknown as Record<symbol, string>)[GROUP] = name;\n return cmd;\n}\n\nfunction groupOf(cmd: Command): string {\n return (cmd as unknown as Record<symbol, string>)[GROUP] ?? DEFAULT_GROUP;\n}\n\nfunction formatHelp(cmd: Command, helper: Help): string {\n const out: string[] = [];\n const desc = helper.commandDescription(cmd);\n if (desc) out.push(desc, \"\");\n\n out.push(\"USAGE\", ` ${helper.commandUsage(cmd)}`, \"\");\n\n const subs = helper.visibleCommands(cmd);\n if (subs.length > 0) {\n const width = Math.max(...subs.map((c) => helper.subcommandTerm(c).length));\n const sections = new Map<string, Command[]>();\n for (const c of subs) {\n const g = groupOf(c);\n const bucket = sections.get(g);\n if (bucket) bucket.push(c);\n else sections.set(g, [c]);\n }\n for (const [name, cmds] of sections) {\n out.push(name);\n for (const c of cmds) {\n out.push(` ${helper.subcommandTerm(c).padEnd(width)} ${helper.subcommandDescription(c)}`);\n }\n out.push(\"\");\n }\n }\n\n const opts = helper.visibleOptions(cmd);\n if (opts.length > 0) {\n const width = Math.max(...opts.map((o) => helper.optionTerm(o).length));\n out.push(\"FLAGS\");\n for (const o of opts) {\n out.push(` ${helper.optionTerm(o).padEnd(width)} ${helper.optionDescription(o)}`);\n }\n out.push(\"\");\n }\n\n return out.join(\"\\n\");\n}\n\n/**\n * Apply the grouped formatter to a command and every descendant. Call AFTER all\n * subcommands are added — commander's `configureHelp` is per-command and is not\n * inherited through `addCommand`, so we set it on each node explicitly.\n */\nexport function installGroupedHelp(root: Command): void {\n const apply = (cmd: Command): void => {\n cmd.configureHelp({ formatHelp });\n for (const child of cmd.commands) apply(child);\n };\n apply(root);\n}\n","/** Output helpers: clean JSON for scripts, aligned tables for humans. */\nimport Table from \"cli-table3\";\n\nexport interface OutputOptions {\n /** Emit machine-readable JSON instead of a table. */\n json?: boolean;\n /** Single-line JSON (implies json). */\n compact?: boolean;\n}\n\n/**\n * Primary output sink. With `--json`/`--compact` (the equivalence path) it\n * prints JSON. Otherwise it renders a human table when the payload is a list of\n * objects (unwrapping common envelopes like `entries`/`data`/`cases`), falling\n * back to pretty JSON for single objects / scalars.\n */\nexport function printJson(value: unknown, opts: OutputOptions = {}): void {\n if (opts.json || opts.compact) {\n process.stdout.write(`${JSON.stringify(value, null, opts.compact ? 0 : 2)}\\n`);\n return;\n }\n const rows = toRows(value);\n if (rows) {\n const columns = columnsOf(rows);\n if (columns.length > 0) {\n printTable(rows, columns);\n return;\n }\n }\n process.stdout.write(`${JSON.stringify(value, null, 2)}\\n`);\n}\n\nconst ROW_ENVELOPES = [\"entries\", \"data\", \"cases\", \"reports\", \"results\", \"list\", \"recurringRules\"];\n\n/** Find the primary array-of-objects in a value (unwrapping common envelopes). */\nfunction toRows(value: unknown): Array<Record<string, unknown>> | null {\n const isRowArray = (v: unknown): v is Array<Record<string, unknown>> =>\n Array.isArray(v) &&\n v.length > 0 &&\n v.every((x) => x !== null && typeof x === \"object\" && !Array.isArray(x));\n if (isRowArray(value)) return value;\n if (value && typeof value === \"object\") {\n for (const key of ROW_ENVELOPES) {\n const inner = (value as Record<string, unknown>)[key];\n if (isRowArray(inner)) return inner;\n }\n }\n return null;\n}\n\n/** Column set = union of row keys, in first-seen order. */\nfunction columnsOf(rows: Array<Record<string, unknown>>): string[] {\n const seen: string[] = [];\n for (const row of rows) {\n for (const k of Object.keys(row)) if (!seen.includes(k)) seen.push(k);\n }\n return seen;\n}\n\n/** Print rows as an aligned table, or as JSON when `--json`/`--compact` is set. */\nexport function printTable(\n rows: Array<Record<string, unknown>>,\n columns: string[],\n opts: OutputOptions = {},\n): void {\n if (opts.json || opts.compact) {\n printJson(rows, opts);\n return;\n }\n const table = new Table({ head: columns });\n for (const row of rows) {\n table.push(columns.map((c) => stringifyCell(row[c])));\n }\n process.stdout.write(`${table.toString()}\\n`);\n}\n\nconst CELL_MAX = 48;\n\nfunction stringifyCell(v: unknown): string {\n if (v === null || v === undefined) return \"\";\n const s = (typeof v === \"object\" ? JSON.stringify(v) : String(v)).replace(/\\s+/g, \" \").trim();\n return s.length > CELL_MAX ? `${s.slice(0, CELL_MAX - 1)}…` : s;\n}\n","/** Helpers shared by command modules: client construction + output options. */\nimport { readFileSync } from \"node:fs\";\nimport type { Command } from \"commander\";\nimport { type BknClient, createClient } from \"../client.js\";\nimport { InputError } from \"../utils/errors.js\";\nimport type { OutputOptions } from \"../utils/output.js\";\n\n/** Build a client from a command's merged (global + local) options. */\nexport function clientFrom(cmd: Command): BknClient {\n const o = cmd.optsWithGlobals();\n return createClient({\n baseUrl: o.baseUrl,\n token: o.token,\n user: o.user,\n businessDomain: o.bizDomain,\n insecure: o.insecure,\n });\n}\n\nexport function outputOptions(cmd: Command): OutputOptions {\n const o = cmd.optsWithGlobals();\n return { json: Boolean(o.json), compact: Boolean(o.compact) };\n}\n\n/** Parse a comma-separated flag value into a trimmed string list. */\nexport function csv(value: string | undefined): string[] | undefined {\n if (!value) return undefined;\n return value\n .split(\",\")\n .map((s) => s.trim())\n .filter(Boolean);\n}\n\n/** Resolve a request body from `--body '<json>'` or `--body-file <path>`. */\nexport function readBody(opts: { body?: string; bodyFile?: string }): unknown {\n const raw = opts.bodyFile ? readFileSync(opts.bodyFile, \"utf8\") : opts.body;\n if (!raw) throw new InputError(\"Provide --body '<json>' or --body-file <path>.\");\n try {\n return JSON.parse(raw);\n } catch {\n throw new InputError(\"Request body is not valid JSON.\");\n }\n}\n","/** `openbkn auth …` — login / session / token (store-backed). */\nimport { readFileSync } from \"node:fs\";\nimport { Command } from \"commander\";\nimport { changePassword } from \"../api/admin.js\";\nimport { browserLogin, passwordLogin } from \"../auth/oauth.js\";\nimport { resolveContext } from \"../config/resolve.js\";\nimport { group } from \"../help/grouped-help.js\";\nimport * as auth from \"../resources/auth.js\";\nimport { printJson } from \"../utils/output.js\";\nimport { outputOptions } from \"./_shared.js\";\n\n/** Register the auth leaves onto a parent (shared by top-level `auth` + `admin auth`). */\nexport function registerAuthLeaves(cmd: Command): void {\n cmd\n .command(\"login <url>\")\n .description(\"Log in to a platform (attach a token, or browser/password OAuth)\")\n .option(\"-u, --username <name>\", \"username for password signin\")\n .option(\"-p, --password <pwd>\", \"password for password signin\")\n .option(\"--token <token>\", \"provide a token directly (CI / headless)\")\n .option(\"--client-id <id>\", \"use a fixed OAuth2 client id (skip dynamic registration)\")\n .option(\"--client-secret <secret>\", \"OAuth2 client secret (omit for public/PKCE)\")\n .option(\"--port <n>\", \"local callback port\", (v) => Number.parseInt(v, 10))\n .option(\n \"--signin-public-key-file <path>\",\n \"override the RSA public key (PEM) for password signin\",\n )\n .option(\"--product <name>\", \"OAuth product query (default 'adp')\")\n .option(\"--no-browser\", \"headless: print the authorize URL instead of opening a browser\")\n .action(async (url: string, opts, cmd: Command) => {\n const g = cmd.optsWithGlobals();\n if (g.insecure) process.env.NODE_TLS_REJECT_UNAUTHORIZED = \"0\";\n const token = opts.token ?? g.token;\n if (token) {\n const r = auth.attachToken(url, token, { insecure: g.insecure });\n printJson({ loggedIn: true, ...r }, outputOptions(cmd));\n return;\n }\n const signinKey = opts.signinPublicKeyFile\n ? readFileSync(opts.signinPublicKeyFile, \"utf8\")\n : undefined;\n const tokens = opts.username\n ? await passwordLogin(url, opts.username, opts.password ?? \"\", {\n clientId: opts.clientId,\n port: opts.port,\n signinPublicKeyPem: signinKey,\n })\n : await browserLogin(url, {\n clientId: opts.clientId,\n port: opts.port,\n noBrowser: opts.browser === false,\n });\n const r = auth.attachToken(url, tokens.accessToken, {\n refreshToken: tokens.refreshToken,\n idToken: tokens.idToken,\n insecure: g.insecure,\n });\n printJson({ loggedIn: true, ...r }, outputOptions(cmd));\n });\n\n cmd\n .command(\"status\")\n .description(\"Show base URL and whether a token is configured\")\n .action((_opts, cmd: Command) => printJson(auth.status(), outputOptions(cmd)));\n\n cmd\n .command(\"token\")\n .description(\"Print the current access token (keep secret)\")\n .action(() => {\n process.stdout.write(`${auth.currentToken()}\\n`);\n });\n\n cmd\n .command(\"whoami [url]\")\n .description(\"Show current user identity (from the token)\")\n .option(\"--no-lookup\", \"skip the backend identity fallback (eacp/user/get)\")\n .action((_url: string | undefined, _opts, cmd: Command) =>\n printJson(auth.whoami(), outputOptions(cmd)),\n );\n\n cmd\n .command(\"list\")\n .alias(\"ls\")\n .description(\"List platforms with a saved session\")\n .action((_opts, cmd: Command) => printJson(auth.listPlatforms(), outputOptions(cmd)));\n\n cmd\n .command(\"use <url>\")\n .description(\"Switch the active platform\")\n .action((url: string, _opts, cmd: Command) => {\n auth.use(url);\n printJson(auth.status(), outputOptions(cmd));\n });\n\n cmd\n .command(\"logout\")\n .description(\"Remove the stored token for the active platform\")\n .action((_opts, cmd: Command) => printJson({ loggedOut: auth.logout() }, outputOptions(cmd)));\n\n cmd\n .command(\"delete <url>\")\n .description(\"Delete saved credentials for a platform\")\n .action((url: string, _opts, cmd: Command) =>\n printJson({ deleted: auth.deletePlatform(url) }, outputOptions(cmd)),\n );\n\n cmd\n .command(\"switch <url> <user-id>\")\n .description(\"Switch the active user for a platform\")\n .action((url: string, userId: string, _opts, cmd: Command) => {\n printJson(auth.switchUser(url, userId), outputOptions(cmd));\n });\n\n cmd\n .command(\"users <url>\")\n .description(\"List saved user profiles for a platform\")\n .action((url: string, _opts, cmd: Command) => {\n printJson(auth.usersOf(url), outputOptions(cmd));\n });\n\n cmd\n .command(\"export\")\n .description(\"Export the active session's tokens (for a headless host)\")\n .action((_opts, cmd: Command) => {\n printJson(auth.exportCreds(), outputOptions(cmd));\n });\n\n cmd\n .command(\"change-password [url]\")\n .description(\"Change your account password (EACP, RSA-encrypted in transit)\")\n .requiredOption(\"-a, --account <name>\", \"account / login name\")\n .requiredOption(\"--old-password <pwd>\", \"current password\")\n .requiredOption(\"--new-password <pwd>\", \"new password\")\n .option(\"--public-key-file <path>\", \"override the RSA public key (PEM) for password encryption\")\n .action(async (_url: string | undefined, opts, cmd: Command) => {\n const g = cmd.optsWithGlobals();\n const ctx = resolveContext({\n baseUrl: g.baseUrl,\n token: g.token,\n user: g.user,\n businessDomain: g.bizDomain,\n insecure: g.insecure,\n });\n printJson(\n await changePassword(ctx, opts.account, opts.oldPassword, opts.newPassword),\n outputOptions(cmd),\n );\n });\n}\n\nexport function authCommand(): Command {\n const cmd = new Command(\"auth\").description(\"Login, session, and token management\");\n registerAuthLeaves(cmd);\n return group(cmd, \"AUTHENTICATION & CONFIG\");\n}\n","/**\n * OAuth2 login flows for `openbkn auth login` — browser (PKCE + loopback\n * callback) and headless password sign-in (RSA-encrypted password → `/oauth2/signin`).\n * Ports the kweaver-admin flow: dynamic client registration (Hydra), authorize\n * redirect, code exchange. Returns a token triple; the command persists it.\n */\nimport { spawn } from \"node:child_process\";\nimport { createHash, constants as cryptoConstants, publicEncrypt, randomBytes } from \"node:crypto\";\nimport { type IncomingMessage, type ServerResponse, createServer } from \"node:http\";\nimport { InputError } from \"../utils/errors.js\";\n\nexport const DEFAULT_REDIRECT_PORT = 9010;\nexport const DEFAULT_SCOPE = \"openid offline all\";\n\n// Studioweb fixed RSA public key for `/oauth2/signin` password encryption\n// (kweaver deploy/auto_config LOGIN_PUBLIC_KEY).\nconst STUDIOWEB_LOGIN_PUBLIC_KEY_PEM = `-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsyOstgbYuubBi2PUqeVj\nGKlkwVUY6w1Y8d4k116dI2SkZI8fxcjHALv77kItO4jYLVplk9gO4HAtsisnNE2o\nwlYIqdmyEPMwupaeFFFcg751oiTXJiYbtX7ABzU5KQYPjRSEjMq6i5qu/mL67XTk\nhvKwrC83zme66qaKApmKupDODPb0RRkutK/zHfd1zL7sciBQ6psnNadh8pE24w8O\n2XVy1v2bgSNkGHABgncR7seyIg81JQ3c/Axxd6GsTztjLnlvGAlmT1TphE84mi99\nfUaGD2A1u1qdIuNc+XuisFeNcUW6fct0+x97eS2eEGRr/7qxWmO/P20sFVzXc2bF\n1QIDAQAB\n-----END PUBLIC KEY-----`;\n\nexport interface OAuthTokens {\n accessToken: string;\n refreshToken?: string;\n idToken?: string;\n}\n\nexport function normalizeBaseUrl(value: string): string {\n return value.replace(/\\/+$/, \"\");\n}\n\nfunction generatePkce(): { verifier: string; challenge: string } {\n const verifier = randomBytes(48).toString(\"base64url\");\n return { verifier, challenge: createHash(\"sha256\").update(verifier).digest(\"base64url\") };\n}\n\nfunction buildAuthorizeUrl(\n base: string,\n clientId: string,\n redirectUri: string,\n state: string,\n codeChallenge: string,\n scope = DEFAULT_SCOPE,\n): string {\n const params = new URLSearchParams({\n response_type: \"code\",\n client_id: clientId,\n redirect_uri: redirectUri,\n scope,\n state,\n \"x-forwarded-prefix\": \"\",\n lang: \"zh-cn\",\n product: \"adp\",\n code_challenge: codeChallenge,\n code_challenge_method: \"S256\",\n });\n return `${base}/oauth2/auth?${params.toString()}`;\n}\n\nfunction mapToken(data: {\n access_token: string;\n refresh_token?: string;\n id_token?: string;\n}): OAuthTokens {\n return {\n accessToken: data.access_token,\n refreshToken: data.refresh_token,\n idToken: data.id_token,\n };\n}\n\nexport interface RegisteredClient {\n clientId: string;\n clientSecret?: string;\n}\n\n/** Register an OAuth2 client with Hydra. Returns its id (+ secret if confidential). */\nexport async function registerClient(\n base: string,\n redirectUri: string,\n scope = DEFAULT_SCOPE,\n): Promise<RegisteredClient> {\n const res = await fetch(`${base}/oauth2/clients`, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\", Accept: \"application/json\" },\n body: JSON.stringify({\n client_name: \"openbkn-cli\",\n grant_types: [\"authorization_code\", \"implicit\", \"refresh_token\"],\n response_types: [\"token id_token\", \"code\", \"token\"],\n scope,\n redirect_uris: [redirectUri],\n post_logout_redirect_uris: [redirectUri.replace(\"/callback\", \"/successful-logout\")],\n metadata: { device: { name: \"openbkn-cli\", client_type: \"web\", description: \"openbkn CLI\" } },\n }),\n });\n if (!res.ok) {\n throw new Error(\n `Client registration failed (${res.status}): ${(await res.text()) || res.statusText}`,\n );\n }\n const data = (await res.json()) as { client_id: string; client_secret?: string };\n return { clientId: data.client_id, clientSecret: data.client_secret };\n}\n\nasync function exchangeCode(\n base: string,\n code: string,\n redirectUri: string,\n client: RegisteredClient,\n codeVerifier: string,\n): Promise<OAuthTokens> {\n const params: Record<string, string> = {\n grant_type: \"authorization_code\",\n code,\n redirect_uri: redirectUri,\n code_verifier: codeVerifier,\n };\n const headers: Record<string, string> = {\n \"Content-Type\": \"application/x-www-form-urlencoded\",\n Accept: \"application/json\",\n };\n if (client.clientSecret) {\n headers.Authorization = `Basic ${Buffer.from(`${client.clientId}:${client.clientSecret}`).toString(\"base64\")}`;\n } else {\n params.client_id = client.clientId;\n }\n const res = await fetch(`${base}/oauth2/token`, {\n method: \"POST\",\n headers,\n body: new URLSearchParams(params).toString(),\n });\n if (!res.ok) {\n throw new Error(\n `Token exchange failed (${res.status}): ${(await res.text()) || res.statusText}`,\n );\n }\n return mapToken((await res.json()) as { access_token: string });\n}\n\nfunction startCallbackServer(\n port: number,\n): Promise<{ code: string; state?: string; close: () => void }> {\n return new Promise((resolve, reject) => {\n const server = createServer((req: IncomingMessage, res: ServerResponse) => {\n const u = new URL(req.url ?? \"/\", `http://127.0.0.1:${port}`);\n if (u.pathname !== \"/callback\") {\n res.writeHead(404);\n res.end();\n return;\n }\n const code = u.searchParams.get(\"code\");\n const error = u.searchParams.get(\"error\");\n if (error) {\n res.writeHead(400, { \"content-type\": \"text/html\" });\n res.end(`<h1>Login failed</h1><p>${error}</p>`);\n server.close(() => reject(new Error(`OAuth error: ${error}`)));\n return;\n }\n if (!code) {\n res.writeHead(400);\n res.end(\"missing code\");\n return;\n }\n res.writeHead(200, { \"content-type\": \"text/html; charset=utf-8\" });\n res.end(\"<h1>Login successful</h1><p>You can close this window.</p>\");\n resolve({\n code,\n state: u.searchParams.get(\"state\") ?? undefined,\n close: () => server.close(),\n });\n });\n server.on(\"error\", reject);\n server.listen(port, \"127.0.0.1\");\n });\n}\n\nfunction openBrowser(url: string): void {\n const cmd =\n process.platform === \"darwin\" ? \"open\" : process.platform === \"win32\" ? \"start\" : \"xdg-open\";\n try {\n spawn(cmd, [url], {\n stdio: \"ignore\",\n detached: true,\n shell: process.platform === \"win32\",\n }).unref();\n } catch {\n /* fall through — URL is printed by the caller */\n }\n}\n\nexport interface BrowserLoginOptions {\n clientId?: string;\n port?: number;\n noBrowser?: boolean;\n scope?: string;\n}\n\n/** Browser PKCE login: resolve client → open authorize URL → catch callback → exchange. */\nexport async function browserLogin(\n baseUrl: string,\n opts: BrowserLoginOptions = {},\n): Promise<OAuthTokens> {\n const base = normalizeBaseUrl(baseUrl);\n const port = opts.port ?? DEFAULT_REDIRECT_PORT;\n const redirectUri = `http://127.0.0.1:${port}/callback`;\n const scope = opts.scope ?? DEFAULT_SCOPE;\n const client = opts.clientId\n ? { clientId: opts.clientId }\n : await registerClient(base, redirectUri, scope);\n const { verifier, challenge } = generatePkce();\n const state = randomBytes(12).toString(\"hex\");\n const authUrl = buildAuthorizeUrl(base, client.clientId, redirectUri, state, challenge, scope);\n\n const waiter = startCallbackServer(port);\n if (opts.noBrowser) {\n process.stderr.write(`Open this URL to log in:\\n${authUrl}\\n`);\n } else {\n process.stderr.write(`Opening browser for login…\\nIf it doesn't open, visit:\\n${authUrl}\\n`);\n openBrowser(authUrl);\n }\n const { code, state: returned, close } = await waiter;\n close();\n if (returned && returned !== state) throw new Error(\"OAuth state mismatch — possible CSRF.\");\n return exchangeCode(base, code, redirectUri, client, verifier);\n}\n\n// ── headless password sign-in ─────────────────────────────────────────────────\n\nfunction mergeCookies(existing: string, res: Response): string {\n const setCookies =\n typeof res.headers.getSetCookie === \"function\"\n ? res.headers.getSetCookie()\n : res.headers.get(\"set-cookie\")\n ? [res.headers.get(\"set-cookie\") as string]\n : [];\n const map = new Map<string, string>();\n const add = (pair: string) => {\n const eq = pair.indexOf(\"=\");\n if (eq > 0) map.set(pair.slice(0, eq), pair.slice(eq + 1));\n };\n for (const p of existing\n .split(\";\")\n .map((s) => s.trim())\n .filter(Boolean))\n add(p);\n for (const sc of setCookies) add(sc.split(\";\")[0]?.trim() ?? \"\");\n return [...map.entries()].map(([k, v]) => `${k}=${v}`).join(\"; \");\n}\n\nfunction parseSigninProps(html: string): {\n csrftoken: string;\n challenge?: string;\n remember?: boolean;\n} {\n const m = html.match(/<script[^>]*\\bid=[\"']__NEXT_DATA__[\"'][^>]*>([\\s\\S]*?)<\\/script>/i);\n if (!m?.[1]) throw new Error(\"Could not find __NEXT_DATA__ on /oauth2/signin.\");\n const data = JSON.parse(m[1]) as Record<string, unknown>;\n const pp = (data.props as Record<string, unknown> | undefined)?.pageProps as\n | Record<string, unknown>\n | undefined;\n const csrftoken = (pp?.csrftoken ?? pp?._csrf) as string | undefined;\n if (typeof csrftoken !== \"string\") throw new Error(\"Sign-in page did not expose csrftoken.\");\n return {\n csrftoken,\n challenge: typeof pp?.challenge === \"string\" ? pp.challenge : undefined,\n remember: pp?.remember === true || pp?.remember === \"true\",\n };\n}\n\nasync function followToCallback(\n startUrl: string,\n jar0: string,\n state: string,\n redirectUri: string,\n): Promise<string> {\n let url = startUrl;\n let jar = jar0;\n const cb = new URL(redirectUri);\n for (let hop = 0; hop < 40; hop++) {\n const resp = await fetch(url, {\n headers: { Cookie: jar, Accept: \"text/html,*/*;q=0.8\" },\n redirect: \"manual\",\n });\n jar = mergeCookies(jar, resp);\n if (![302, 303, 307, 308].includes(resp.status)) {\n throw new Error(`Unexpected OAuth response (HTTP ${resp.status}).`);\n }\n const loc = resp.headers.get(\"location\");\n if (!loc) throw new Error(`OAuth redirect missing Location (HTTP ${resp.status}).`);\n const next = new URL(loc, url);\n if (next.origin === cb.origin && next.pathname === cb.pathname) {\n const err = next.searchParams.get(\"error\");\n if (err) throw new Error(`Authorization failed: ${err}`);\n const code = next.searchParams.get(\"code\");\n if (next.searchParams.get(\"state\") !== state) throw new Error(\"OAuth state mismatch.\");\n if (!code) throw new Error(\"Callback missing authorization code.\");\n return code;\n }\n url = next.href;\n }\n throw new Error(\"Too many OAuth redirects.\");\n}\n\nexport interface PasswordLoginOptions {\n clientId?: string;\n port?: number;\n scope?: string;\n signinPublicKeyPem?: string;\n}\n\n/** Headless password login via RSA-encrypted `/oauth2/signin`. */\nexport async function passwordLogin(\n baseUrl: string,\n username: string,\n password: string,\n opts: PasswordLoginOptions = {},\n): Promise<OAuthTokens> {\n const base = normalizeBaseUrl(baseUrl);\n const port = opts.port ?? DEFAULT_REDIRECT_PORT;\n const redirectUri = `http://127.0.0.1:${port}/callback`;\n const scope = opts.scope ?? DEFAULT_SCOPE;\n const client = opts.clientId\n ? { clientId: opts.clientId }\n : await registerClient(base, redirectUri, scope);\n const { verifier, challenge } = generatePkce();\n const state = randomBytes(12).toString(\"hex\");\n\n let jar = \"\";\n const authResp = await fetch(\n buildAuthorizeUrl(base, client.clientId, redirectUri, state, challenge, scope),\n { redirect: \"manual\" },\n );\n jar = mergeCookies(jar, authResp);\n const authLoc = authResp.headers.get(\"location\");\n if (!authLoc) throw new Error(`/oauth2/auth did not redirect (HTTP ${authResp.status}).`);\n const signinUrl = new URL(authLoc, base);\n if (!signinUrl.pathname.includes(\"signin\")) {\n throw new Error(`Expected a sign-in redirect, got: ${authLoc}`);\n }\n\n const pageResp = await fetch(signinUrl.href, {\n headers: { Cookie: jar, Accept: \"text/html,*/*;q=0.8\" },\n redirect: \"manual\",\n });\n jar = mergeCookies(jar, pageResp);\n const props = parseSigninProps(await pageResp.text());\n const loginChallenge =\n signinUrl.searchParams.get(\"login_challenge\")?.trim() || props.challenge?.trim();\n if (!loginChallenge) throw new Error(\"Could not resolve the login challenge.\");\n\n const cipher = publicEncrypt(\n {\n key: opts.signinPublicKeyPem ?? STUDIOWEB_LOGIN_PUBLIC_KEY_PEM,\n padding: cryptoConstants.RSA_PKCS1_PADDING,\n },\n Buffer.from(password, \"utf8\"),\n ).toString(\"base64\");\n\n const postResp = await fetch(`${base}/oauth2/signin`, {\n method: \"POST\",\n headers: {\n Cookie: jar,\n \"Content-Type\": \"application/json\",\n Accept: \"application/json, text/plain, */*\",\n Origin: new URL(base).origin,\n Referer: signinUrl.href,\n },\n body: JSON.stringify({\n _csrf: props.csrftoken,\n challenge: loginChallenge,\n account: username,\n password: cipher,\n vcode: { id: \"\", content: \"\" },\n dualfactorauthinfo: { validcode: { vcode: \"\" }, OTP: { OTP: \"\" } },\n remember: props.remember ?? false,\n device: { name: \"\", description: \"\", client_type: \"console_web\", udids: [] },\n }),\n redirect: \"manual\",\n });\n jar = mergeCookies(jar, postResp);\n\n let code: string;\n if ([302, 303, 307].includes(postResp.status)) {\n const loc = postResp.headers.get(\"location\");\n if (!loc) throw new Error(\"Sign-in response missing Location.\");\n code = await followToCallback(new URL(loc, base).href, jar, state, redirectUri);\n } else if (postResp.status === 200) {\n const text = await postResp.text();\n let json: Record<string, unknown> | null = null;\n try {\n json = JSON.parse(text) as Record<string, unknown>;\n } catch {\n /* not JSON */\n }\n const redir = json && typeof json.redirect === \"string\" ? json.redirect : \"\";\n if (!redir) {\n const msg = json && typeof json.message === \"string\" ? json.message : text.slice(0, 300);\n throw new InputError(`Sign-in failed: ${msg}`);\n }\n code = await followToCallback(new URL(redir, base).href, jar, state, redirectUri);\n } else {\n throw new InputError(\n `Sign-in failed (HTTP ${postResp.status}): ${(await postResp.text()).slice(0, 300)}`,\n );\n }\n return exchangeCode(base, code, redirectUri, client, verifier);\n}\n","/** `openbkn agent …` — decision agents (read side + listings). */\nimport { Command } from \"commander\";\nimport { group } from \"../help/grouped-help.js\";\nimport { DEFAULT_LIST_LIMIT } from \"../types.js\";\nimport { printJson } from \"../utils/output.js\";\nimport { clientFrom, csv, outputOptions, readBody } from \"./_shared.js\";\n\nconst int = (v: string) => Number.parseInt(v, 10);\n\nexport function agentCommand(): Command {\n const cmd = new Command(\"agent\").description(\"Agent CRUD, chat, sessions, publish\");\n\n cmd\n .command(\"list\")\n .description(\"List published agents\")\n .option(\"--name <s>\", \"filter by name\")\n .option(\"--limit <n>\", \"page size\", int, DEFAULT_LIST_LIMIT)\n .option(\"--offset <n>\", \"page offset\", int, 0)\n .option(\"--category-id <id>\", \"filter by category\")\n .action(async (opts, cmd: Command) => {\n const data = await clientFrom(cmd).agents.list({\n name: opts.name,\n limit: opts.limit,\n offset: opts.offset,\n categoryId: opts.categoryId,\n });\n printJson(data, outputOptions(cmd));\n });\n\n cmd\n .command(\"personal-list\")\n .description(\"List personal-space agents\")\n .option(\"--name <s>\", \"filter by name\")\n .option(\"--limit <n>\", \"page size\", int, DEFAULT_LIST_LIMIT)\n .option(\"--offset <n>\", \"page offset\", int, 0)\n .action(async (opts, cmd: Command) => {\n const data = await clientFrom(cmd).agents.personalList({\n name: opts.name,\n limit: opts.limit,\n offset: opts.offset,\n });\n printJson(data, outputOptions(cmd));\n });\n\n cmd\n .command(\"category-list\")\n .description(\"List agent categories\")\n .action(async (_opts, cmd: Command) => {\n printJson(await clientFrom(cmd).agents.categoryList(), outputOptions(cmd));\n });\n\n cmd\n .command(\"template-list\")\n .description(\"List published agent templates\")\n .option(\"--name <s>\", \"filter by name\")\n .option(\"--limit <n>\", \"page size\", int, DEFAULT_LIST_LIMIT)\n .option(\"--offset <n>\", \"page offset\", int, 0)\n .action(async (opts, cmd: Command) => {\n const data = await clientFrom(cmd).agents.templateList({\n name: opts.name,\n limit: opts.limit,\n offset: opts.offset,\n });\n printJson(data, outputOptions(cmd));\n });\n\n cmd\n .command(\"template-get <id>\")\n .description(\"Get a published agent template\")\n .action(async (id: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).agents.templateGet(id), outputOptions(cmd));\n });\n\n cmd\n .command(\"get <id>\")\n .description(\"Get agent details\")\n .action(async (id: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).agents.get(id), outputOptions(cmd));\n });\n\n cmd\n .command(\"get-by-key <key>\")\n .description(\"Get an agent by key\")\n .action(async (key: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).agents.getByKey(key), outputOptions(cmd));\n });\n\n cmd\n .command(\"create\")\n .description(\"Create an agent (--body-file <json> or --body '<json>')\")\n .option(\"--body <json>\", \"agent definition JSON\")\n .option(\"--body-file <path>\", \"read agent definition JSON from a file\")\n .action(async (opts, cmd: Command) => {\n printJson(await clientFrom(cmd).agents.create(readBody(opts)), outputOptions(cmd));\n });\n\n cmd\n .command(\"update <id>\")\n .description(\"Update an agent (--body-file <json> or --body '<json>')\")\n .option(\"--body <json>\", \"agent definition JSON\")\n .option(\"--body-file <path>\", \"read agent definition JSON from a file\")\n .action(async (id: string, opts, cmd: Command) => {\n printJson(await clientFrom(cmd).agents.update(id, readBody(opts)), outputOptions(cmd));\n });\n\n cmd\n .command(\"delete <id>\")\n .description(\"Delete an agent\")\n .option(\"-y, --yes\", \"skip confirmation\")\n .action(async (id: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).agents.delete(id), outputOptions(cmd));\n });\n\n cmd\n .command(\"publish <id>\")\n .description(\"Publish an agent\")\n .action(async (id: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).agents.publish(id), outputOptions(cmd));\n });\n\n cmd\n .command(\"unpublish <id>\")\n .description(\"Unpublish an agent\")\n .action(async (id: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).agents.unpublish(id), outputOptions(cmd));\n });\n\n cmd\n .command(\"sessions <agent>\")\n .description(\"List conversations for an agent (by agent key)\")\n .option(\"--limit <n>\", \"page size\", int, DEFAULT_LIST_LIMIT)\n .option(\"--page <n>\", \"page\", int, 1)\n .action(async (agentKey: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).agents.sessions(agentKey, { size: opts.limit, page: opts.page }),\n outputOptions(cmd),\n );\n });\n\n cmd\n .command(\"history <agent> <conversation-id>\")\n .description(\"Show message history for a conversation\")\n .action(async (agentKey: string, conversationId: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).agents.history(agentKey, conversationId), outputOptions(cmd));\n });\n\n cmd\n .command(\"chat <agent-id>\")\n .description(\"Chat with an agent (SSE streaming with --stream)\")\n .requiredOption(\"-m, --message <text>\", \"user message\")\n .option(\"--version <v>\", \"agent version\", \"v0\")\n .option(\"--conversation-id <id>\", \"continue an existing conversation\")\n .option(\"--stream\", \"stream the reply to stdout as it arrives\")\n .action(async (agentId: string, opts, cmd: Command) => {\n const client = clientFrom(cmd);\n if (opts.stream) {\n const res = await client.agents.chat(agentId, opts.message, {\n version: opts.version,\n conversationId: opts.conversationId,\n stream: true,\n onDelta: (t) => process.stdout.write(t),\n });\n process.stdout.write(\"\\n\");\n if (res.conversationId) console.error(`conversation_id: ${res.conversationId}`);\n return;\n }\n printJson(\n await client.agents.chat(agentId, opts.message, {\n version: opts.version,\n conversationId: opts.conversationId,\n }),\n outputOptions(cmd),\n );\n });\n\n cmd\n .command(\"trace <conversation-id>\")\n .description(\"Get trace spans for a conversation (agent-scoped alias of `trace get`)\")\n .action(async (conversationId: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).trace.spans(conversationId), outputOptions(cmd));\n });\n\n const skill = cmd.command(\"skill\").description(\"Manage skills attached to an agent\");\n skill\n .command(\"list <agent-id>\")\n .description(\"List skill ids attached to an agent\")\n .action(async (agentId: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).agents.skillList(agentId), outputOptions(cmd));\n });\n skill\n .command(\"add <agent-id> <skill-ids>\")\n .description(\"Attach skill(s) to an agent (comma-joined ids)\")\n .action(async (agentId: string, ids: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).agents.skillAdd(agentId, csv(ids) ?? []), outputOptions(cmd));\n });\n skill\n .command(\"remove <agent-id> <skill-ids>\")\n .description(\"Detach skill(s) from an agent (comma-joined ids)\")\n .action(async (agentId: string, ids: string, _opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).agents.skillRemove(agentId, csv(ids) ?? []),\n outputOptions(cmd),\n );\n });\n\n return group(cmd, \"DECISION AGENT\");\n}\n","/** `openbkn bkn …` — knowledge networks (kept identical to legacy `kweaver bkn`). */\nimport { Command } from \"commander\";\nimport { group } from \"../help/grouped-help.js\";\nimport { DEFAULT_LIST_LIMIT } from \"../types.js\";\nimport { validateBknDirectory } from \"../utils/bkn-validate.js\";\nimport { printJson } from \"../utils/output.js\";\nimport { parseEmbeddingFields, parsePkMap } from \"../utils/pk-detection.js\";\nimport { clientFrom, csv, outputOptions, readBody } from \"./_shared.js\";\n\nconst int = (v: string) => Number.parseInt(v, 10);\n\nexport function bknCommand(): Command {\n const bkn = new Command(\"bkn\").description(\"Knowledge networks — list, query, schema, instances\");\n\n bkn\n .command(\"list\")\n .description(\"List knowledge networks\")\n .option(\"--limit <n>\", \"page size\", int, DEFAULT_LIST_LIMIT)\n .option(\"--offset <n>\", \"page offset\", int, 0)\n .option(\"--name-pattern <s>\", \"filter by name pattern\")\n .option(\"--tag <s>\", \"filter by tag\")\n .option(\"--sort <field>\", \"sort field\", \"update_time\")\n .option(\"--direction <dir>\", \"asc | desc\", \"desc\")\n .action(async (_opts, cmd: Command) => {\n const o = cmd.optsWithGlobals();\n const data = await clientFrom(cmd).kn.list({\n limit: o.limit,\n offset: o.offset,\n namePattern: o.namePattern,\n tag: o.tag,\n sort: o.sort,\n direction: o.direction,\n });\n printJson(data, outputOptions(cmd));\n });\n\n bkn\n .command(\"get <kn-id>\")\n .description(\"Get a knowledge network (use --stats or --export)\")\n .option(\"--stats\", \"include statistics\")\n .option(\"--export\", \"return the full export payload\")\n .action(async (knId: string, opts, cmd: Command) => {\n const data = await clientFrom(cmd).kn.get(knId, {\n stats: opts.stats,\n exportMode: opts.export,\n });\n printJson(data, outputOptions(cmd));\n });\n\n bkn\n .command(\"search <kn-id> <query>\")\n .description(\"Semantic search within a knowledge network\")\n .option(\"--max-concepts <n>\", \"max concepts to return\", int, 10)\n .option(\"--mode <mode>\", \"retrieval mode\", \"keyword_vector_retrieval\")\n .action(async (knId: string, query: string, opts, cmd: Command) => {\n const data = await clientFrom(cmd).kn.search(knId, query, {\n maxConcepts: opts.maxConcepts,\n mode: opts.mode,\n });\n printJson(data, outputOptions(cmd));\n });\n\n // Schema groups: real list; object-type/relation-type also get real CRUD.\n const schemaGroups: Array<\n [string, \"objectTypes\" | \"relationTypes\" | \"actionTypes\", \"objectType\" | \"relationType\" | null]\n > = [\n [\"object-type\", \"objectTypes\", \"objectType\"],\n [\"relation-type\", \"relationTypes\", \"relationType\"],\n [\"action-type\", \"actionTypes\", null],\n ];\n for (const [name, listMethod, crud] of schemaGroups) {\n const g = bkn.command(name).description(`${name} list/get/...`);\n g.command(\"list <kn-id>\")\n .description(`List ${name}s`)\n .option(\"--branch <b>\", \"branch\", \"main\")\n .action(async (knId: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).kn[listMethod](knId, { branch: opts.branch }),\n outputOptions(cmd),\n );\n });\n if (crud) {\n g.command(\"get <kn-id> <id>\")\n .description(`Get ${name}`)\n .action(async (knId: string, id: string, _o, cmd: Command) => {\n printJson(await clientFrom(cmd).kn[`${crud}Get`](knId, id), outputOptions(cmd));\n });\n g.command(\"create <kn-id>\")\n .description(`Create ${name} (--body / --body-file)`)\n .option(\"--body <json>\", \"body JSON\")\n .option(\"--body-file <path>\", \"read body JSON from a file\")\n .action(async (knId: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).kn[`${crud}Create`](knId, readBody(opts)),\n outputOptions(cmd),\n );\n });\n g.command(\"update <kn-id> <id>\")\n .description(`Update ${name} (--body / --body-file)`)\n .option(\"--body <json>\", \"body JSON\")\n .option(\"--body-file <path>\", \"read body JSON from a file\")\n .action(async (knId: string, id: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).kn[`${crud}Update`](knId, id, readBody(opts)),\n outputOptions(cmd),\n );\n });\n g.command(\"delete <kn-id> <id>\")\n .description(`Delete ${name}`)\n .option(\"-y, --yes\", \"skip confirmation\")\n .action(async (knId: string, id: string, _o, cmd: Command) => {\n printJson(await clientFrom(cmd).kn[`${crud}Delete`](knId, id), outputOptions(cmd));\n });\n }\n }\n\n // Real action-type query + execute on the action-type group.\n const actionType = bkn.commands.find((c) => c.name() === \"action-type\");\n actionType\n ?.command(\"query <kn-id> <at-id>\")\n .description(\"Query an action type (--body / --body-file JSON)\")\n .option(\"--body <json>\", \"query JSON\")\n .option(\"--body-file <path>\", \"read query JSON from a file\")\n .action(async (knId: string, atId: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).kn.actionTypeQuery(knId, atId, readBody(opts)),\n outputOptions(cmd),\n );\n });\n actionType\n ?.command(\"execute <kn-id> <at-id>\")\n .description(\"Execute an action type (--body / --body-file envelope JSON)\")\n .option(\"--body <json>\", \"execution envelope JSON\")\n .option(\"--body-file <path>\", \"read envelope JSON from a file\")\n .action(async (knId: string, atId: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).kn.actionTypeExecute(knId, atId, readBody(opts)),\n outputOptions(cmd),\n );\n });\n actionType\n ?.command(\"inputs <kn-id> <at-id>\")\n .description(\"Get an action type's input schema\")\n .action(async (knId: string, atId: string, _o, cmd: Command) => {\n printJson(await clientFrom(cmd).kn.actionTypeInputs(knId, atId), outputOptions(cmd));\n });\n actionType\n ?.command(\"get <kn-id> <at-id>\")\n .description(\"Get an action type\")\n .action(async (knId: string, atId: string, _o, cmd: Command) => {\n printJson(await clientFrom(cmd).kn.actionTypeGet(knId, atId), outputOptions(cmd));\n });\n\n // stats/export are aliases of `get --stats` / `get --export`.\n bkn\n .command(\"stats <kn-id>\")\n .description(\"Get knowledge-network statistics (alias for get --stats)\")\n .action(async (knId: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).kn.get(knId, { stats: true }), outputOptions(cmd));\n });\n bkn\n .command(\"export <kn-id>\")\n .description(\"Export a knowledge network (alias for get --export)\")\n .action(async (knId: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).kn.get(knId, { exportMode: true }), outputOptions(cmd));\n });\n\n // Real object-type instance query + properties (the rest are stubs above).\n const objectType = bkn.commands.find((c) => c.name() === \"object-type\");\n objectType\n ?.command(\"query <kn-id> <ot-id>\")\n .description(\"Query instances of an object type (--body / --body-file JSON)\")\n .option(\"--body <json>\", \"query JSON\")\n .option(\"--body-file <path>\", \"read query JSON from a file\")\n .action(async (knId: string, otId: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).kn.objectTypeQuery(knId, otId, readBody(opts)),\n outputOptions(cmd),\n );\n });\n objectType\n ?.command(\"properties <kn-id> <ot-id>\")\n .description(\"Get an object type's calculated properties\")\n .action(async (knId: string, otId: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).kn.objectTypeProperties(knId, otId), outputOptions(cmd));\n });\n\n bkn\n .command(\"create <name>\")\n .description(\"Create an (empty) knowledge network\")\n .option(\"--branch <b>\", \"branch\", \"main\")\n .action(async (name: string, opts, cmd: Command) => {\n printJson(await clientFrom(cmd).kn.create({ name, branch: opts.branch }), outputOptions(cmd));\n });\n\n bkn\n .command(\"update <kn-id>\")\n .description(\"Update a knowledge network (--body / --body-file)\")\n .option(\"--body <json>\", \"update body JSON\")\n .option(\"--body-file <path>\", \"read update body JSON from a file\")\n .action(async (knId: string, opts, cmd: Command) => {\n printJson(await clientFrom(cmd).kn.update(knId, readBody(opts)), outputOptions(cmd));\n });\n\n bkn\n .command(\"delete <kn-id>\")\n .description(\"Delete a knowledge network\")\n .option(\"-y, --yes\", \"skip confirmation\")\n .action(async (knId: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).kn.delete(knId), outputOptions(cmd));\n });\n\n bkn\n .command(\"subgraph <kn-id>\")\n .description(\"Query a subgraph (--body / --body-file JSON)\")\n .option(\"--body <json>\", \"subgraph query JSON\")\n .option(\"--body-file <path>\", \"read subgraph query JSON from a file\")\n .action(async (knId: string, opts, cmd: Command) => {\n printJson(await clientFrom(cmd).kn.subgraph(knId, readBody(opts)), outputOptions(cmd));\n });\n\n const actionLog = bkn.command(\"action-log\").description(\"Action logs — list/get/cancel\");\n actionLog\n .command(\"list <kn-id>\")\n .description(\"List action logs\")\n .option(\"--status <s>\", \"filter by status\")\n .option(\"--action-type-id <id>\", \"filter by action type\")\n .option(\"--limit <n>\", \"page size\", int, DEFAULT_LIST_LIMIT)\n .action(async (knId: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).kn.actionLogs(knId, {\n status: opts.status,\n actionTypeId: opts.actionTypeId,\n limit: opts.limit,\n }),\n outputOptions(cmd),\n );\n });\n actionLog\n .command(\"get <kn-id> <log-id>\")\n .description(\"Get an action log\")\n .action(async (knId: string, logId: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).kn.actionLog(knId, logId), outputOptions(cmd));\n });\n actionLog\n .command(\"cancel <kn-id> <log-id>\")\n .description(\"Cancel a running action\")\n .action(async (knId: string, logId: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).kn.cancelActionLog(knId, logId), outputOptions(cmd));\n });\n\n bkn\n .command(\"action-execution <kn-id> <execution-id>\")\n .description(\"Get action execution status\")\n .action(async (knId: string, execId: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).kn.actionExecution(knId, execId), outputOptions(cmd));\n });\n\n const metric = bkn.command(\"metric\").description(\"Metrics — query / dry-run\");\n metric\n .command(\"query <kn-id> <metric-id>\")\n .description(\"Query a metric's data (--body / --body-file JSON)\")\n .option(\"--body <json>\", \"query JSON\")\n .option(\"--body-file <path>\", \"read query JSON from a file\")\n .action(async (knId: string, metricId: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).kn.metricQuery(knId, metricId, readBody(opts)),\n outputOptions(cmd),\n );\n });\n metric\n .command(\"dry-run <kn-id>\")\n .description(\"Dry-run a metric definition (--body / --body-file JSON)\")\n .option(\"--body <json>\", \"metric definition JSON\")\n .option(\"--body-file <path>\", \"read metric definition JSON from a file\")\n .action(async (knId: string, opts, cmd: Command) => {\n printJson(await clientFrom(cmd).kn.metricDryRun(knId, readBody(opts)), outputOptions(cmd));\n });\n metric\n .command(\"list <kn-id>\")\n .description(\"List metrics\")\n .action(async (knId: string, _o, cmd: Command) => {\n printJson(await clientFrom(cmd).kn.metricList(knId), outputOptions(cmd));\n });\n metric\n .command(\"get <kn-id> <metric-id>\")\n .description(\"Get a metric\")\n .action(async (knId: string, id: string, _o, cmd: Command) => {\n printJson(await clientFrom(cmd).kn.metricGet(knId, id), outputOptions(cmd));\n });\n metric\n .command(\"create <kn-id>\")\n .description(\"Create a metric (--body / --body-file)\")\n .option(\"--body <json>\", \"body JSON\")\n .option(\"--body-file <path>\", \"read body JSON from a file\")\n .action(async (knId: string, opts, cmd: Command) => {\n printJson(await clientFrom(cmd).kn.metricCreate(knId, readBody(opts)), outputOptions(cmd));\n });\n metric\n .command(\"update <kn-id> <metric-id>\")\n .description(\"Update a metric (--body / --body-file)\")\n .option(\"--body <json>\", \"body JSON\")\n .option(\"--body-file <path>\", \"read body JSON from a file\")\n .action(async (knId: string, id: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).kn.metricUpdate(knId, id, readBody(opts)),\n outputOptions(cmd),\n );\n });\n metric\n .command(\"delete <kn-id> <metric-id>\")\n .description(\"Delete a metric\")\n .action(async (knId: string, id: string, _o, cmd: Command) => {\n printJson(await clientFrom(cmd).kn.metricDelete(knId, id), outputOptions(cmd));\n });\n metric\n .command(\"search <kn-id>\")\n .description(\"Search metrics (--body / --body-file)\")\n .option(\"--body <json>\", \"body JSON\")\n .option(\"--body-file <path>\", \"read body JSON from a file\")\n .action(async (knId: string, opts, cmd: Command) => {\n printJson(await clientFrom(cmd).kn.metricSearch(knId, readBody(opts)), outputOptions(cmd));\n });\n metric\n .command(\"validate <kn-id>\")\n .description(\"Validate a metric definition (--body / --body-file)\")\n .option(\"--body <json>\", \"body JSON\")\n .option(\"--body-file <path>\", \"read body JSON from a file\")\n .action(async (knId: string, opts, cmd: Command) => {\n printJson(await clientFrom(cmd).kn.metricValidate(knId, readBody(opts)), outputOptions(cmd));\n });\n\n const cg = bkn.command(\"concept-group\").description(\"Concept groups — list/get\");\n cg.command(\"list <kn-id>\")\n .description(\"List concept groups\")\n .action(async (knId: string, _o, cmd: Command) => {\n printJson(await clientFrom(cmd).kn.conceptGroups(knId), outputOptions(cmd));\n });\n cg.command(\"get <kn-id> <cg-id>\")\n .description(\"Get a concept group\")\n .action(async (knId: string, cgId: string, _o, cmd: Command) => {\n printJson(await clientFrom(cmd).kn.conceptGroup(knId, cgId), outputOptions(cmd));\n });\n cg.command(\"create <kn-id>\")\n .description(\"Create a concept group (--body / --body-file)\")\n .option(\"--body <json>\", \"body JSON\")\n .option(\"--body-file <path>\", \"read body JSON from a file\")\n .action(async (knId: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).kn.conceptGroupCreate(knId, readBody(opts)),\n outputOptions(cmd),\n );\n });\n cg.command(\"update <kn-id> <cg-id>\")\n .description(\"Update a concept group (--body / --body-file)\")\n .option(\"--body <json>\", \"body JSON\")\n .option(\"--body-file <path>\", \"read body JSON from a file\")\n .action(async (knId: string, cgId: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).kn.conceptGroupUpdate(knId, cgId, readBody(opts)),\n outputOptions(cmd),\n );\n });\n cg.command(\"delete <kn-id> <cg-id>\")\n .description(\"Delete a concept group\")\n .action(async (knId: string, cgId: string, _o, cmd: Command) => {\n printJson(await clientFrom(cmd).kn.conceptGroupDelete(knId, cgId), outputOptions(cmd));\n });\n cg.command(\"add-members <kn-id> <cg-id>\")\n .description(\"Add object types to a concept group (--body / --body-file)\")\n .option(\"--body <json>\", \"body JSON\")\n .option(\"--body-file <path>\", \"read body JSON from a file\")\n .action(async (knId: string, cgId: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).kn.conceptGroupAddMembers(knId, cgId, readBody(opts)),\n outputOptions(cmd),\n );\n });\n cg.command(\"remove-members <kn-id> <cg-id> <ot-ids>\")\n .description(\"Remove object types (comma-joined ids) from a concept group\")\n .action(async (knId: string, cgId: string, otIds: string, _o, cmd: Command) => {\n printJson(\n await clientFrom(cmd).kn.conceptGroupRemoveMembers(knId, cgId, otIds),\n outputOptions(cmd),\n );\n });\n\n const sched = bkn.command(\"action-schedule\").description(\"Action schedules — list/get\");\n sched\n .command(\"list <kn-id>\")\n .description(\"List action schedules\")\n .action(async (knId: string, _o, cmd: Command) => {\n printJson(await clientFrom(cmd).kn.actionSchedules(knId), outputOptions(cmd));\n });\n sched\n .command(\"get <kn-id> <schedule-id>\")\n .description(\"Get an action schedule\")\n .action(async (knId: string, sId: string, _o, cmd: Command) => {\n printJson(await clientFrom(cmd).kn.actionSchedule(knId, sId), outputOptions(cmd));\n });\n sched\n .command(\"create <kn-id>\")\n .description(\"Create an action schedule (--body / --body-file)\")\n .option(\"--body <json>\", \"body JSON\")\n .option(\"--body-file <path>\", \"read body JSON from a file\")\n .action(async (knId: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).kn.actionScheduleCreate(knId, readBody(opts)),\n outputOptions(cmd),\n );\n });\n sched\n .command(\"update <kn-id> <schedule-id>\")\n .description(\"Update an action schedule (--body / --body-file)\")\n .option(\"--body <json>\", \"body JSON\")\n .option(\"--body-file <path>\", \"read body JSON from a file\")\n .action(async (knId: string, sId: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).kn.actionScheduleUpdate(knId, sId, readBody(opts)),\n outputOptions(cmd),\n );\n });\n sched\n .command(\"set-status <kn-id> <schedule-id>\")\n .description(\"Set an action schedule's status (--body / --body-file)\")\n .option(\"--body <json>\", \"body JSON\")\n .option(\"--body-file <path>\", \"read body JSON from a file\")\n .action(async (knId: string, sId: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).kn.actionScheduleSetStatus(knId, sId, readBody(opts)),\n outputOptions(cmd),\n );\n });\n sched\n .command(\"delete <kn-id> <schedule-ids>\")\n .description(\"Delete action schedule(s) (comma-joined ids)\")\n .action(async (knId: string, ids: string, _o, cmd: Command) => {\n printJson(await clientFrom(cmd).kn.actionScheduleDelete(knId, ids), outputOptions(cmd));\n });\n\n const job = bkn.command(\"job\").description(\"Build jobs — list/get/tasks\");\n job\n .command(\"list <kn-id>\")\n .description(\"List jobs\")\n .action(async (knId: string, _o, cmd: Command) => {\n printJson(await clientFrom(cmd).kn.jobs(knId), outputOptions(cmd));\n });\n job\n .command(\"get <kn-id> <job-id>\")\n .description(\"Get a job\")\n .action(async (knId: string, jobId: string, _o, cmd: Command) => {\n printJson(await clientFrom(cmd).kn.job(knId, jobId), outputOptions(cmd));\n });\n job\n .command(\"tasks <kn-id> <job-id>\")\n .description(\"List a job's tasks\")\n .action(async (knId: string, jobId: string, _o, cmd: Command) => {\n printJson(await clientFrom(cmd).kn.jobTasks(knId, jobId), outputOptions(cmd));\n });\n job\n .command(\"delete <kn-id> <job-ids>\")\n .description(\"Delete job(s) (comma-joined ids)\")\n .action(async (knId: string, ids: string, _o, cmd: Command) => {\n printJson(await clientFrom(cmd).kn.jobDelete(knId, ids), outputOptions(cmd));\n });\n\n bkn\n .command(\"push <directory>\")\n .description(\"Pack a BKN directory into a tar and import it as a knowledge network\")\n .option(\"--branch <name>\", \"target branch\", \"main\")\n .option(\"--build\", \"submit a Vega build task for each object type declaring a vector index\")\n .option(\n \"--embedding-model <id>\",\n \"embedding model id for declared vector indexes (with --build)\",\n )\n .action(async (dir: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).kn.push(dir, {\n branch: opts.branch,\n build: Boolean(opts.build),\n embeddingModel: opts.embeddingModel,\n }),\n outputOptions(cmd),\n );\n });\n bkn\n .command(\"pull <kn-id> [directory]\")\n .description(\"Download a knowledge network as a BKN tar and extract it locally\")\n .option(\"--branch <name>\", \"source branch\", \"main\")\n .action(async (knId: string, dir: string | undefined, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).kn.pull(knId, dir ?? knId, { branch: opts.branch }),\n outputOptions(cmd),\n );\n });\n\n bkn\n .command(\"relation-type-paths <kn-id>\")\n .description(\"Query relation-type paths between object types (--body / --body-file JSON)\")\n .option(\"--body <json>\", \"request JSON\")\n .option(\"--body-file <path>\", \"read request JSON from a file\")\n .action(async (knId: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).kn.relationTypePaths(knId, readBody(opts)),\n outputOptions(cmd),\n );\n });\n\n bkn\n .command(\"resources\")\n .description(\"List BKN-backend resources\")\n .action(async (_opts, cmd: Command) => {\n printJson(await clientFrom(cmd).kn.bknResources(), outputOptions(cmd));\n });\n\n bkn\n .command(\"create-from-catalog <catalog-id>\")\n .description(\"Build a knowledge network from a Vega catalog's tables\")\n .requiredOption(\"--name <name>\", \"knowledge network name\")\n .option(\"--tables <list>\", \"comma-separated table names (default: all)\")\n .option(\"--pk-map <map>\", \"explicit primary keys: '<table>:<col>[,<table>:<col>...]'\")\n .option(\"--build\", \"submit a Vega build task per resource after creation\")\n .option(\n \"--embedding-fields <map>\",\n \"columns to vectorize per table (with --build): '<table>:<col>[+<col>...][,...]'\",\n )\n .option(\"--embedding-model <id>\", \"embedding model id for the vector index (with --build)\")\n .option(\"--no-rollback\", \"keep a partially-created KN on failure\")\n .action(async (catalogId: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).kn.createFromCatalog({\n catalogId,\n name: opts.name,\n tables: csv(opts.tables),\n pkMap: opts.pkMap ? parsePkMap(opts.pkMap) : undefined,\n build: Boolean(opts.build),\n embeddingFields: opts.embeddingFields\n ? parseEmbeddingFields(opts.embeddingFields)\n : undefined,\n embeddingModel: opts.embeddingModel,\n noRollback: opts.rollback === false,\n onProgress: (m) => console.error(m),\n }),\n outputOptions(cmd),\n );\n });\n\n bkn\n .command(\"validate <directory>\")\n .description(\"Validate a local BKN directory's structure (offline)\")\n .action(async (dir: string, _opts, cmd: Command) => {\n const result = validateBknDirectory(dir);\n printJson(result, outputOptions(cmd));\n if (!result.valid) process.exitCode = 1;\n });\n\n bkn\n .command(\"create-from-csv <catalog-id>\")\n .description(\"Import CSV files into a Vega catalog, then build a KN from them\")\n .requiredOption(\"--files <glob>\", \"CSV paths (comma-separated or glob)\")\n .requiredOption(\"--name <name>\", \"knowledge network name\")\n .option(\"--table-prefix <s>\", \"prefix for derived table names\", \"\")\n .option(\"--batch-size <n>\", \"rows per insert batch\", int, 500)\n .option(\"--tables <list>\", \"subset of imported tables to include in the KN\")\n .option(\"--pk-map <map>\", \"explicit primary keys: '<table>:<col>[,...]'\")\n .option(\"--build\", \"submit a Vega build task per resource after creation\")\n .option(\n \"--embedding-fields <map>\",\n \"columns to vectorize per table (with --build): '<table>:<col>[+<col>...][,...]'\",\n )\n .option(\"--embedding-model <id>\", \"embedding model id for the vector index (with --build)\")\n .option(\"--no-rollback\", \"keep a partially-created KN on failure\")\n .action(async (catalogId: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).kn.createFromCsv({\n catalogId,\n name: opts.name,\n files: opts.files,\n tablePrefix: opts.tablePrefix,\n batchSize: opts.batchSize,\n tables: csv(opts.tables),\n pkMap: opts.pkMap ? parsePkMap(opts.pkMap) : undefined,\n build: Boolean(opts.build),\n embeddingFields: opts.embeddingFields\n ? parseEmbeddingFields(opts.embeddingFields)\n : undefined,\n embeddingModel: opts.embeddingModel,\n noRollback: opts.rollback === false,\n onProgress: (m) => console.error(m),\n }),\n outputOptions(cmd),\n );\n });\n\n return group(bkn, \"AI DATA PLATFORM\");\n}\n","/**\n * Structural validation of a local BKN directory. This is a slim, dependency-free\n * check (the full `@kweaver-ai/bkn` network model is not vendored): it parses the\n * frontmatter of every `.bkn` file and verifies the network is internally\n * consistent enough to push — required files, well-formed frontmatter, object-type\n * name limits, unique ids, and relation endpoints that reference real object types.\n */\nimport { existsSync, readFileSync, readdirSync, statSync } from \"node:fs\";\nimport { join, resolve } from \"node:path\";\n\n// validateObjectName parity: ISF caps BKN object names at 40 utf-8 codepoints.\nexport const BKN_OBJECT_NAME_MAX_LENGTH = 40;\n\nexport interface ValidationResult {\n valid: boolean;\n dir: string;\n counts: { objectTypes: number; relationTypes: number; conceptGroups: number };\n errors: string[];\n warnings: string[];\n}\n\ninterface Frontmatter {\n type?: string;\n id?: string;\n name?: string;\n}\n\n/** Parse a leading `--- ... ---` YAML-ish frontmatter block (flat scalars only). */\nfunction parseFrontmatter(text: string): Frontmatter | null {\n if (!text.startsWith(\"---\")) return null;\n const end = text.indexOf(\"\\n---\", 3);\n if (end === -1) return null;\n const block = text.slice(3, end);\n const fm: Frontmatter = {};\n for (const line of block.split(\"\\n\")) {\n const m = line.match(/^\\s*(type|id|name)\\s*:\\s*(.+?)\\s*$/);\n if (m?.[1]) fm[m[1] as keyof Frontmatter] = m[2]?.replace(/^[\"']|[\"']$/g, \"\");\n }\n return fm;\n}\n\nfunction bknFiles(dir: string): string[] {\n if (!existsSync(dir) || !statSync(dir).isDirectory()) return [];\n return readdirSync(dir)\n .filter((f) => f.endsWith(\".bkn\"))\n .map((f) => join(dir, f));\n}\n\n/** Pull (source, target) object-type ids out of a relation file's Endpoint table. */\nfunction endpointRefs(text: string): Array<{ source: string; target: string }> {\n const refs: Array<{ source: string; target: string }> = [];\n const idx = text.indexOf(\"### Endpoint\");\n if (idx === -1) return refs;\n // Only the Endpoint section — stop at the next heading (e.g. Mapping Rules).\n const after = text.slice(idx + \"### Endpoint\".length);\n const next = after.indexOf(\"\\n###\");\n const section = next === -1 ? after : after.slice(0, next);\n for (const line of section.split(\"\\n\")) {\n const cells = line\n .split(\"|\")\n .map((c) => c.trim())\n .filter(Boolean);\n if (cells.length < 2) continue;\n const [source, target] = cells;\n if (!source || !target) continue;\n if (/^source$/i.test(source) || /^-+$/.test(source)) continue; // header / divider\n refs.push({ source, target });\n }\n return refs;\n}\n\nexport function validateBknDirectory(dirPath: string): ValidationResult {\n const dir = resolve(dirPath);\n const errors: string[] = [];\n const warnings: string[] = [];\n\n if (!existsSync(dir) || !statSync(dir).isDirectory()) {\n return {\n valid: false,\n dir,\n counts: { objectTypes: 0, relationTypes: 0, conceptGroups: 0 },\n errors: [`Not a directory: ${dir}`],\n warnings: [],\n };\n }\n\n // network.bkn — required, must declare a knowledge_network.\n const networkPath = join(dir, \"network.bkn\");\n if (!existsSync(networkPath)) {\n errors.push(\"Missing network.bkn at the BKN root.\");\n } else {\n const fm = parseFrontmatter(readFileSync(networkPath, \"utf8\"));\n if (!fm) errors.push(\"network.bkn has no frontmatter block.\");\n else {\n if (fm.type !== \"knowledge_network\")\n errors.push(`network.bkn type must be 'knowledge_network', got '${fm.type ?? \"\"}'.`);\n if (!fm.id) errors.push(\"network.bkn is missing 'id'.\");\n if (!fm.name) errors.push(\"network.bkn is missing 'name'.\");\n }\n }\n\n // Object types.\n const otIds = new Set<string>();\n const otFiles = bknFiles(join(dir, \"object_types\"));\n for (const file of otFiles) {\n const fm = parseFrontmatter(readFileSync(file, \"utf8\"));\n const rel = file.slice(dir.length + 1);\n if (!fm || fm.type !== \"object_type\") {\n errors.push(`${rel}: not a valid object_type (missing/wrong frontmatter type).`);\n continue;\n }\n if (!fm.id) errors.push(`${rel}: object_type missing 'id'.`);\n if (!fm.name) errors.push(`${rel}: object_type missing 'name'.`);\n if (fm.name && [...fm.name].length > BKN_OBJECT_NAME_MAX_LENGTH) {\n errors.push(\n `${rel}: object_type name exceeds ${BKN_OBJECT_NAME_MAX_LENGTH} codepoints ('${fm.name}').`,\n );\n }\n if (fm.id) {\n if (otIds.has(fm.id)) errors.push(`Duplicate object_type id '${fm.id}'.`);\n otIds.add(fm.id);\n }\n }\n\n // Relation types — validate frontmatter + endpoint references.\n const rtFiles = bknFiles(join(dir, \"relation_types\"));\n for (const file of rtFiles) {\n const text = readFileSync(file, \"utf8\");\n const fm = parseFrontmatter(text);\n const rel = file.slice(dir.length + 1);\n if (!fm || fm.type !== \"relation_type\") {\n errors.push(`${rel}: not a valid relation_type (missing/wrong frontmatter type).`);\n continue;\n }\n if (!fm.id) errors.push(`${rel}: relation_type missing 'id'.`);\n for (const { source, target } of endpointRefs(text)) {\n if (otIds.size > 0 && !otIds.has(source))\n warnings.push(`${rel}: endpoint source '${source}' is not a known object_type.`);\n if (otIds.size > 0 && !otIds.has(target))\n warnings.push(`${rel}: endpoint target '${target}' is not a known object_type.`);\n }\n }\n\n const cgFiles = bknFiles(join(dir, \"concept_groups\"));\n\n return {\n valid: errors.length === 0,\n dir,\n counts: {\n objectTypes: otFiles.length,\n relationTypes: rtFiles.length,\n conceptGroups: cgFiles.length,\n },\n errors,\n warnings,\n };\n}\n","/** `openbkn call`/`curl` — curl-style API passthrough with auth headers. */\nimport { Command } from \"commander\";\nimport { rawCall } from \"../api/call.js\";\nimport { resolveContext } from \"../config/resolve.js\";\nimport { group } from \"../help/grouped-help.js\";\nimport { printJson } from \"../utils/output.js\";\nimport { outputOptions } from \"./_shared.js\";\n\nfunction collect(value: string, prev: string[]): string[] {\n prev.push(value);\n return prev;\n}\n\nexport function callCommand(): Command {\n const cmd = new Command(\"call\")\n .alias(\"curl\")\n .description(\"Call an API with curl-style flags and auto-injected auth headers\")\n .argument(\"<url>\", \"API path (e.g. /api/...) or absolute URL\")\n .option(\"-X, --request <method>\", \"HTTP method\")\n .option(\"-H, --header <header>\", 'extra header \"Name: value\" (repeatable)', collect, [])\n .option(\"-d, --data <body>\", \"request body (sets JSON content-type if unset)\")\n .option(\"--data-raw <body>\", \"alias for --data\")\n .option(\n \"-F, --form <field>\",\n \"multipart field key=value or key=@file (repeatable)\",\n collect,\n [],\n )\n .option(\"-v, --verbose\", \"print request line to stderr\")\n .action(async (url: string, opts, cmd: Command) => {\n const g = cmd.optsWithGlobals();\n const ctx = resolveContext({\n baseUrl: g.baseUrl,\n token: g.token,\n user: g.user,\n businessDomain: g.bizDomain,\n insecure: g.insecure,\n });\n const res = await rawCall(ctx, url, {\n method: opts.request,\n header: opts.header,\n data: opts.data ?? opts.dataRaw,\n form: opts.form,\n businessDomain: g.bizDomain,\n verbose: opts.verbose,\n });\n\n // Pretty-print JSON bodies; pass anything else through verbatim.\n const out = outputOptions(cmd);\n try {\n printJson(JSON.parse(res.body), out);\n } catch {\n process.stdout.write(res.body.endsWith(\"\\n\") ? res.body : `${res.body}\\n`);\n }\n if (res.status >= 400) process.exitCode = 1;\n });\n\n return group(cmd, \"AUTHENTICATION & CONFIG\");\n}\n","/** `openbkn config …` — active platform + per-platform business domain. */\nimport { Command } from \"commander\";\nimport {\n activePlatform,\n readPlatformConfig,\n setActivePlatform,\n writePlatformConfig,\n} from \"../config/store.js\";\nimport { group } from \"../help/grouped-help.js\";\nimport { InputError } from \"../utils/errors.js\";\nimport { printJson } from \"../utils/output.js\";\nimport { outputOptions } from \"./_shared.js\";\n\nfunction requireActive(): string {\n const baseUrl = activePlatform();\n if (!baseUrl) throw new InputError(\"No active platform. Run `openbkn auth login <url>` first.\");\n return baseUrl;\n}\n\nexport function configCommand(): Command {\n const config = new Command(\"config\").description(\"Per-platform CLI configuration\");\n\n config\n .command(\"show\")\n .description(\"Show the active platform and business domain\")\n .action((_opts, cmd: Command) => {\n const baseUrl = activePlatform();\n printJson(\n {\n baseUrl,\n businessDomain: baseUrl ? readPlatformConfig(baseUrl).businessDomain : undefined,\n },\n outputOptions(cmd),\n );\n });\n\n config\n .command(\"set <key> <value>\")\n .description(\"Set a config value (baseUrl | businessDomain)\")\n .action((key: string, value: string, _opts, cmd: Command) => {\n if (key === \"baseUrl\") {\n setActivePlatform(value.replace(/\\/+$/, \"\"));\n } else if (key === \"businessDomain\") {\n writePlatformConfig(requireActive(), { businessDomain: value });\n } else {\n throw new InputError(`Unknown config key: ${key} (expected baseUrl | businessDomain)`);\n }\n printJson({ ok: true, key, value }, outputOptions(cmd));\n });\n\n config\n .command(\"set-bd <value>\")\n .description(\"Set the default business domain for the active platform\")\n .action((value: string, _opts, cmd: Command) => {\n const baseUrl = requireActive();\n writePlatformConfig(baseUrl, { businessDomain: value });\n printJson({ baseUrl, businessDomain: value }, outputOptions(cmd));\n });\n\n config\n .command(\"list-bd\")\n .description(\"List business domains (requires login)\")\n .action(() => {\n throw new InputError(\"Not yet implemented — requires backend business-domains API.\");\n });\n\n return group(config, \"AUTHENTICATION & CONFIG\");\n}\n","/** `openbkn context …` (alias of legacy context-loader) — MCP retrieval. */\nimport { Command } from \"commander\";\nimport { group } from \"../help/grouped-help.js\";\nimport { InputError } from \"../utils/errors.js\";\nimport { printJson } from \"../utils/output.js\";\nimport { clientFrom, outputOptions } from \"./_shared.js\";\n\nconst int = (v: string) => Number.parseInt(v, 10);\n\nexport function contextCommand(): Command {\n const cmd = new Command(\"context\").description(\n \"Context loader (MCP) — schema discovery, instance query, skill recall\",\n );\n\n cmd\n .command(\"search-schema <kn-id> <query>\")\n .description(\"Search object/relation/action/metric schemas\")\n .option(\"--scope <list>\", \"comma-separated scopes (object,relation,action,metric)\")\n .option(\"--max <n>\", \"max concepts\", int)\n .action(async (knId: string, query: string, opts, cmd: Command) => {\n const data = await clientFrom(cmd).context.searchSchema(knId, query, {\n searchScope: opts.scope ? String(opts.scope).split(\",\") : undefined,\n maxConcepts: opts.max,\n });\n printJson(data, outputOptions(cmd));\n });\n\n cmd\n .command(\"query-object-instance <kn-id>\")\n .description(\"Query object instances (provide --args as JSON)\")\n .requiredOption(\"--args <json>\", \"tool arguments as JSON\")\n .action(async (knId: string, opts, cmd: Command) => {\n let args: Record<string, unknown>;\n try {\n args = JSON.parse(opts.args);\n } catch {\n throw new InputError(\"--args must be valid JSON\");\n }\n printJson(await clientFrom(cmd).context.queryObjectInstance(knId, args), outputOptions(cmd));\n });\n\n cmd\n .command(\"find-skills <kn-id> <object-type-id>\")\n .description(\"Recall skills for an object type\")\n .option(\"--top-k <n>\", \"max skills (1-20)\", int)\n .action(async (knId: string, otId: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).context.findSkills(knId, otId, opts.topK),\n outputOptions(cmd),\n );\n });\n\n cmd\n .command(\"tools <kn-id>\")\n .description(\"List MCP tools\")\n .action(async (knId: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).context.tools(knId), outputOptions(cmd));\n });\n\n cmd\n .command(\"tool-call <kn-id> <name>\")\n .description(\"Call any MCP tool directly (--args JSON)\")\n .requiredOption(\"--args <json>\", \"tool arguments as JSON\")\n .action(async (knId: string, name: string, opts, cmd: Command) => {\n let args: Record<string, unknown>;\n try {\n args = JSON.parse(opts.args);\n } catch {\n throw new InputError(\"--args must be valid JSON\");\n }\n printJson(await clientFrom(cmd).context.toolCall(knId, name, args), outputOptions(cmd));\n });\n\n cmd\n .command(\"resources <kn-id>\")\n .description(\"List MCP resources\")\n .action(async (knId: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).context.resources(knId), outputOptions(cmd));\n });\n cmd\n .command(\"resource <kn-id> <uri>\")\n .description(\"Read one MCP resource by uri\")\n .action(async (knId: string, uri: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).context.resource(knId, uri), outputOptions(cmd));\n });\n cmd\n .command(\"templates <kn-id>\")\n .description(\"List MCP resource templates\")\n .action(async (knId: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).context.templates(knId), outputOptions(cmd));\n });\n cmd\n .command(\"prompts <kn-id>\")\n .description(\"List MCP prompts\")\n .action(async (knId: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).context.prompts(knId), outputOptions(cmd));\n });\n cmd\n .command(\"prompt <kn-id> <name>\")\n .description(\"Get one MCP prompt (--args JSON for prompt arguments)\")\n .option(\"--args <json>\", \"prompt arguments as JSON\")\n .action(async (knId: string, name: string, opts, cmd: Command) => {\n let args: Record<string, unknown> | undefined;\n if (opts.args) {\n try {\n args = JSON.parse(opts.args);\n } catch {\n throw new InputError(\"--args must be valid JSON\");\n }\n }\n printJson(await clientFrom(cmd).context.prompt(knId, name, args), outputOptions(cmd));\n });\n\n const jsonArgs = (raw: string): Record<string, unknown> => {\n try {\n return JSON.parse(raw);\n } catch {\n throw new InputError(\"--args must be valid JSON\");\n }\n };\n cmd\n .command(\"query-instance-subgraph <kn-id>\")\n .description(\"Layer-2: query an instance subgraph across relation-type paths\")\n .requiredOption(\"--args <json>\", \"tool arguments as JSON\")\n .action(async (knId: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).context.queryInstanceSubgraph(knId, jsonArgs(opts.args)),\n outputOptions(cmd),\n );\n });\n cmd\n .command(\"get-logic-properties <kn-id>\")\n .description(\"Layer-3: compute logic-property values for instances\")\n .requiredOption(\"--args <json>\", \"tool arguments as JSON\")\n .action(async (knId: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).context.logicProperties(knId, jsonArgs(opts.args)),\n outputOptions(cmd),\n );\n });\n cmd\n .command(\"get-action-info <kn-id>\")\n .description(\"Layer-3: fetch action info / dynamic tools for an instance\")\n .requiredOption(\"--args <json>\", \"tool arguments as JSON\")\n .action(async (knId: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).context.actionInfo(knId, jsonArgs(opts.args)),\n outputOptions(cmd),\n );\n });\n\n return group(cmd, \"AI DATA PLATFORM\");\n}\n","/** `openbkn dataflow …` — document/data flow workflows. */\nimport { Command } from \"commander\";\nimport { group } from \"../help/grouped-help.js\";\nimport { DEFAULT_LIST_LIMIT } from \"../types.js\";\nimport { printJson } from \"../utils/output.js\";\nimport { clientFrom, outputOptions, readBody } from \"./_shared.js\";\n\nconst int = (v: string) => Number.parseInt(v, 10);\n\nexport function dataflowCommand(): Command {\n const cmd = new Command(\"dataflow\").description(\"Dataflow document workflows — list, runs, logs\");\n\n cmd\n .command(\"list\")\n .description(\"List all dataflows\")\n .action(async (_opts, cmd: Command) => {\n printJson(await clientFrom(cmd).dataflows.list(), outputOptions(cmd));\n });\n\n cmd\n .command(\"runs <dagId>\")\n .description(\"List run records for one dataflow\")\n .option(\"--since <date>\", \"filter runs since a date\")\n .action(async (dagId: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).dataflows.runs(dagId, { since: opts.since }),\n outputOptions(cmd),\n );\n });\n\n cmd\n .command(\"logs <dagId> <instanceId>\")\n .description(\"Show logs for one run\")\n .option(\"--page <n>\", \"page\", int, 0)\n .option(\"--limit <n>\", \"page size\", int, DEFAULT_LIST_LIMIT)\n .action(async (dagId: string, instanceId: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).dataflows.logs(dagId, instanceId, {\n page: opts.page,\n limit: opts.limit,\n }),\n outputOptions(cmd),\n );\n });\n\n cmd\n .command(\"run <dagId>\")\n .description(\"Trigger a dataflow run from a remote file URL\")\n .requiredOption(\"--url <url>\", \"remote file URL\")\n .requiredOption(\"--name <name>\", \"file name\")\n .action(async (dagId: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).dataflows.run(dagId, opts.url, opts.name),\n outputOptions(cmd),\n );\n });\n\n cmd\n .command(\"create\")\n .description(\"Create a dataflow (DAG) from a full document body (--body / --body-file)\")\n .option(\"--body <json>\", \"dataflow document JSON\")\n .option(\"--body-file <path>\", \"read the dataflow document JSON from a file\")\n .action(async (opts, cmd: Command) => {\n printJson(await clientFrom(cmd).dataflows.create(readBody(opts)), outputOptions(cmd));\n });\n\n const parseSet = (pairs: string[] | undefined): Record<string, unknown> => {\n const out: Record<string, unknown> = {};\n for (const item of pairs ?? []) {\n const i = item.indexOf(\"=\");\n if (i > 0) out[item.slice(0, i)] = item.slice(i + 1);\n }\n return out;\n };\n cmd\n .command(\"templates\")\n .description(\"List available dataset/bkn/dataflow templates\")\n .action(async (_opts, cmd: Command) => {\n printJson(clientFrom(cmd).dataflows.templates(), outputOptions(cmd));\n });\n cmd\n .command(\"create-dataset\")\n .description(\"Create a dataset from a template (--template <name> --set k=v ...)\")\n .requiredOption(\"--template <name>\", \"template name\")\n .option(\n \"--set <kv...>\",\n \"set a template argument (key=value); repeatable\",\n (v, acc: string[]) => {\n acc.push(v);\n return acc;\n },\n [] as string[],\n )\n .action(async (opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).dataflows.createDataset(opts.template, parseSet(opts.set)),\n outputOptions(cmd),\n );\n });\n cmd\n .command(\"create-bkn\")\n .description(\"Create a knowledge network from a template (--template <name> --set k=v ...)\")\n .requiredOption(\"--template <name>\", \"template name\")\n .option(\n \"--set <kv...>\",\n \"set a template argument (key=value); repeatable\",\n (v, acc: string[]) => {\n acc.push(v);\n return acc;\n },\n [] as string[],\n )\n .action(async (opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).dataflows.createBkn(opts.template, parseSet(opts.set)),\n outputOptions(cmd),\n );\n });\n\n return group(cmd, \"AI DATA PLATFORM\");\n}\n","/**\n * `openbkn explore` — a minimal local web server exposing read-only JSON\n * endpoints for **bkn** and **vega** (no SPA bundle, no chat). Reuses the\n * configured client; meant for quick local data poking, not a full UI.\n */\nimport { type IncomingMessage, type ServerResponse, createServer } from \"node:http\";\nimport { Command } from \"commander\";\nimport type { BknClient } from \"../client.js\";\nimport { group } from \"../help/grouped-help.js\";\nimport { clientFrom } from \"./_shared.js\";\n\nconst int = (v: string) => Number.parseInt(v, 10);\n\ntype Handler = (\n client: BknClient,\n query: URLSearchParams,\n body: Record<string, unknown>,\n) => Promise<unknown>;\n\n/** Route table: `${METHOD} ${pathname}` → handler. bkn + vega read paths only. */\nconst ROUTES: Record<string, Handler> = {\n \"GET /api/bkn/meta\": (c, q) => c.kn.get(req(q, \"knId\")),\n \"POST /api/bkn/search\": (c, _q, b) =>\n c.kn.search(str(b.knId), str(b.query), {\n maxConcepts: typeof b.maxConcepts === \"number\" ? b.maxConcepts : undefined,\n }),\n \"POST /api/bkn/instances\": (c, _q, b) =>\n c.kn.objectTypeQuery(str(b.knId), str(b.objectTypeId), b.body ?? {}),\n \"POST /api/bkn/subgraph\": (c, _q, b) => c.kn.subgraph(str(b.knId), b.body ?? b),\n \"POST /api/bkn/properties\": (c, _q, b) =>\n c.kn.objectTypeProperties(str(b.knId), str(b.objectTypeId)),\n \"GET /api/vega/catalogs\": (c) => c.vega.catalogs(),\n \"GET /api/vega/catalog\": (c, q) => c.vega.getCatalog(req(q, \"catalogId\")),\n \"GET /api/vega/catalog-resources\": (c, q) =>\n c.vega.catalogResources(req(q, \"catalogId\"), q.get(\"category\") ?? undefined),\n \"GET /api/vega/connector-types\": (c) => c.vega.connectorTypes(),\n \"POST /api/vega/query\": (c, _q, b) => c.resource.query(str(b.resourceId), b.options ?? {}),\n};\n\nfunction str(v: unknown): string {\n return typeof v === \"string\" ? v : String(v ?? \"\");\n}\nfunction req(q: URLSearchParams, key: string): string {\n const v = q.get(key);\n if (!v) throw new Error(`missing query param: ${key}`);\n return v;\n}\n\nfunction readBody(reqMsg: IncomingMessage): Promise<Record<string, unknown>> {\n return new Promise((resolve, reject) => {\n let data = \"\";\n reqMsg.on(\"data\", (chunk) => {\n data += chunk;\n });\n reqMsg.on(\"end\", () => {\n if (!data.trim()) return resolve({});\n try {\n resolve(JSON.parse(data) as Record<string, unknown>);\n } catch {\n reject(new Error(\"invalid JSON body\"));\n }\n });\n reqMsg.on(\"error\", reject);\n });\n}\n\nconst INDEX = `<!doctype html><meta charset=\"utf-8\"><title>openbkn explore</title>\n<h1>openbkn explore</h1>\n<p>Read-only JSON endpoints for bkn + vega:</p>\n<ul>${Object.keys(ROUTES)\n .map((r) => `<li><code>${r}</code></li>`)\n .join(\"\")}</ul>`;\n\nexport function exploreCommand(): Command {\n const cmd = new Command(\"explore\").description(\n \"Start a local web server with read-only bkn + vega JSON endpoints\",\n );\n cmd\n .option(\"--port <n>\", \"port to listen on\", int, 7777)\n .option(\"--host <h>\", \"host to bind\", \"127.0.0.1\")\n .action(async (opts, command: Command) => {\n const client = clientFrom(command);\n const server = createServer((reqMsg, res) => {\n void handle(client, reqMsg, res);\n });\n server.listen(opts.port, opts.host, () => {\n console.error(`openbkn explore running at http://${opts.host}:${opts.port}/`);\n console.error(\"bkn + vega read endpoints only. Press Ctrl+C to stop.\");\n });\n });\n return group(cmd, \"FOUNDATION\");\n}\n\nasync function handle(\n client: BknClient,\n reqMsg: IncomingMessage,\n res: ServerResponse,\n): Promise<void> {\n const url = new URL(reqMsg.url ?? \"/\", \"http://localhost\");\n const method = reqMsg.method ?? \"GET\";\n if (method === \"GET\" && url.pathname === \"/\") {\n res.writeHead(200, { \"content-type\": \"text/html; charset=utf-8\" });\n res.end(INDEX);\n return;\n }\n const handler = ROUTES[`${method} ${url.pathname}`];\n if (!handler) {\n res.writeHead(404, { \"content-type\": \"application/json\" });\n res.end(JSON.stringify({ error: \"not found\" }));\n return;\n }\n try {\n const body = method === \"GET\" ? {} : await readBody(reqMsg);\n const data = await handler(client, url.searchParams, body);\n res.writeHead(200, { \"content-type\": \"application/json\" });\n res.end(JSON.stringify(data ?? null));\n } catch (err) {\n res.writeHead(500, { \"content-type\": \"application/json\" });\n res.end(JSON.stringify({ error: err instanceof Error ? err.message : String(err) }));\n }\n}\n","/** `openbkn model …` — model factory (llm / small-model). */\nimport { Command } from \"commander\";\nimport { group } from \"../help/grouped-help.js\";\nimport { DEFAULT_LIST_LIMIT } from \"../types.js\";\nimport { printJson } from \"../utils/output.js\";\nimport { clientFrom, csv, outputOptions, readBody } from \"./_shared.js\";\n\nconst int = (v: string) => Number.parseInt(v, 10);\n\n/** Management subcommands (add/edit/delete/test) wired to the model resource. */\nfunction addManagementCommands(parent: Command, kind: \"llm\" | \"small\"): void {\n parent\n .command(\"add\")\n .description(\"Register a model (definition JSON via --body / --body-file)\")\n .option(\"--body <json>\", \"model definition JSON\")\n .option(\"--body-file <path>\", \"read model definition JSON from a file\")\n .action(async (opts, cmd: Command) => {\n printJson(await clientFrom(cmd).models[kind].add(readBody(opts)), outputOptions(cmd));\n });\n parent\n .command(\"edit\")\n .description(\"Update a model definition (JSON via --body / --body-file)\")\n .option(\"--body <json>\", \"model definition JSON\")\n .option(\"--body-file <path>\", \"read model definition JSON from a file\")\n .action(async (opts, cmd: Command) => {\n printJson(await clientFrom(cmd).models[kind].edit(readBody(opts)), outputOptions(cmd));\n });\n parent\n .command(\"delete <model-ids>\")\n .description(\"Delete model(s) (comma-joined ids)\")\n .action(async (ids: string, _o, cmd: Command) => {\n printJson(await clientFrom(cmd).models[kind].delete(csv(ids) ?? []), outputOptions(cmd));\n });\n parent\n .command(\"test\")\n .description(\"Test a model's connectivity / inference (JSON via --body / --body-file)\")\n .option(\"--body <json>\", \"test request JSON\")\n .option(\"--body-file <path>\", \"read test request JSON from a file\")\n .action(async (opts, cmd: Command) => {\n printJson(await clientFrom(cmd).models[kind].test(readBody(opts)), outputOptions(cmd));\n });\n}\n\nexport function modelCommand(): Command {\n const model = new Command(\"model\").description(\"Model factory — LLM / small-model CRUD + chat\");\n\n const llm = model.command(\"llm\").description(\"Large language models\");\n llm\n .command(\"list\")\n .description(\"List LLM models\")\n .option(\"--name <s>\", \"filter by name\")\n .option(\"--type <t>\", \"model type filter\")\n .option(\"--limit <n>\", \"page size\", int, DEFAULT_LIST_LIMIT)\n .option(\"--page <n>\", \"page\", int, 1)\n .action(async (opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).models.llm.list({\n name: opts.name,\n modelType: opts.type,\n limit: opts.limit,\n page: opts.page,\n }),\n outputOptions(cmd),\n );\n });\n llm\n .command(\"get <modelId>\")\n .description(\"Get an LLM model\")\n .action(async (id: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).models.llm.get(id), outputOptions(cmd));\n });\n llm\n .command(\"chat <modelId>\")\n .description(\"OpenAI-compatible chat completion\")\n .requiredOption(\"-m, --message <text>\", \"user message\")\n .option(\"--stream\", \"stream the reply token-by-token to stdout\")\n .action(async (id: string, opts, cmd: Command) => {\n const messages = [{ role: \"user\", content: opts.message }];\n if (opts.stream) {\n await clientFrom(cmd).models.llm.chatStream(id, messages, (t) => process.stdout.write(t));\n process.stdout.write(\"\\n\");\n return;\n }\n printJson(await clientFrom(cmd).models.llm.chat(id, messages), outputOptions(cmd));\n });\n addManagementCommands(llm, \"llm\");\n\n const small = model.command(\"small\").description(\"Small models (embedding / reranker)\");\n small\n .command(\"list\")\n .description(\"List small models\")\n .option(\"--name <s>\", \"filter by name\")\n .option(\"--type <t>\", \"model type filter\")\n .option(\"--limit <n>\", \"page size\", int, DEFAULT_LIST_LIMIT)\n .option(\"--page <n>\", \"page\", int, 1)\n .action(async (opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).models.small.list({\n name: opts.name,\n modelType: opts.type,\n limit: opts.limit,\n page: opts.page,\n }),\n outputOptions(cmd),\n );\n });\n small\n .command(\"get <modelId>\")\n .description(\"Get a small model\")\n .action(async (id: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).models.small.get(id), outputOptions(cmd));\n });\n small\n .command(\"embeddings <modelId>\")\n .description(\"Compute embeddings\")\n .requiredOption(\"-i, --input <text>\", \"comma-separated input texts\")\n .action(async (id: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).models.small.embeddings(id, csv(opts.input) ?? []),\n outputOptions(cmd),\n );\n });\n small\n .command(\"rerank <modelId>\")\n .description(\"Rerank documents against a query\")\n .requiredOption(\"-q, --query <text>\", \"query\")\n .requiredOption(\"-d, --documents <list>\", \"comma-separated documents\")\n .action(async (id: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).models.small.rerank(id, opts.query, csv(opts.documents) ?? []),\n outputOptions(cmd),\n );\n });\n addManagementCommands(small, \"small\");\n\n return group(model, \"MODELS & SKILLS\");\n}\n","/** `openbkn resource` (alias `res`) — vega-backend resources. */\nimport { Command } from \"commander\";\nimport { group } from \"../help/grouped-help.js\";\nimport { DEFAULT_LIST_LIMIT, DEFAULT_QUERY_LIMIT } from \"../types.js\";\nimport { printJson } from \"../utils/output.js\";\nimport { clientFrom, outputOptions } from \"./_shared.js\";\n\nconst int = (v: string) => Number.parseInt(v, 10);\n\nexport function resourceCommand(): Command {\n const cmd = new Command(\"resource\")\n .alias(\"res\")\n .description(\"Resources — list, find, get, query, delete\");\n\n cmd\n .command(\"list\")\n .description(\"List resources under a datasource/catalog\")\n .option(\"--datasource-id <id>\", \"filter by datasource/catalog id\")\n .option(\"--type <category>\", \"resource category (table | logicview)\")\n .option(\"--limit <n>\", \"page size\", int, DEFAULT_LIST_LIMIT)\n .action(async (opts, cmd: Command) => {\n const data = await clientFrom(cmd).resource.list({\n datasourceId: opts.datasourceId,\n category: opts.type,\n limit: opts.limit,\n });\n printJson(data, outputOptions(cmd));\n });\n\n cmd\n .command(\"find\")\n .description(\"Search resources by name (fuzzy; --exact for strict)\")\n .requiredOption(\"--name <name>\", \"resource name to search\")\n .option(\"--exact\", \"exact name match\")\n .option(\"--datasource-id <id>\", \"limit to a datasource/catalog\")\n .action(async (opts, cmd: Command) => {\n const data = await clientFrom(cmd).resource.find(opts.name, {\n exact: opts.exact,\n datasourceId: opts.datasourceId,\n });\n printJson(data, outputOptions(cmd));\n });\n\n cmd\n .command(\"get <id>\")\n .description(\"Get resource details\")\n .action(async (id: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).resource.get(id), outputOptions(cmd));\n });\n\n cmd\n .command(\"query <id>\")\n .description(\"Fetch data rows from a resource\")\n .option(\"--limit <n>\", \"row limit\", int, DEFAULT_QUERY_LIMIT)\n .option(\"--offset <n>\", \"row offset\", int, 0)\n .option(\"--need-total\", \"include total count\")\n .action(async (id: string, opts, cmd: Command) => {\n const data = await clientFrom(cmd).resource.query(id, {\n limit: opts.limit,\n offset: opts.offset,\n needTotal: opts.needTotal,\n });\n printJson(data, outputOptions(cmd));\n });\n\n cmd\n .command(\"delete <id>\")\n .description(\"Delete a resource\")\n .option(\"-y, --yes\", \"skip confirmation\")\n .action(async (id: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).resource.delete(id), outputOptions(cmd));\n });\n\n return group(cmd, \"AI DATA PLATFORM\");\n}\n","/** `openbkn skill …` — skill registry and market. */\nimport { Command } from \"commander\";\nimport { group } from \"../help/grouped-help.js\";\nimport { DEFAULT_LIST_LIMIT } from \"../types.js\";\nimport { printJson } from \"../utils/output.js\";\nimport { clientFrom, outputOptions, readBody } from \"./_shared.js\";\n\nconst int = (v: string) => Number.parseInt(v, 10);\n\nexport function skillCommand(): Command {\n const cmd = new Command(\"skill\").description(\"Skill registry and market\");\n\n const listOpts = (c: Command) =>\n c\n .option(\"--name <s>\", \"filter by name\")\n .option(\"--source <s>\", \"filter by source\")\n .option(\"--status <s>\", \"filter by status\")\n .option(\"--limit <n>\", \"page size\", int, DEFAULT_LIST_LIMIT)\n .option(\"--page <n>\", \"page\", int, 1);\n\n listOpts(cmd.command(\"list\").description(\"List skills\"))\n .option(\"--create-user <s>\", \"filter by creator\")\n .action(async (opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).skills.list({\n name: opts.name,\n source: opts.source,\n status: opts.status,\n createUser: opts.createUser,\n pageSize: opts.limit,\n page: opts.page,\n }),\n outputOptions(cmd),\n );\n });\n\n cmd\n .command(\"get <skill-id>\")\n .description(\"Get a skill by id\")\n .action(async (id: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).skills.get(id), outputOptions(cmd));\n });\n\n listOpts(cmd.command(\"market\").description(\"Browse the skill market\")).action(\n async (opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).skills.market({\n name: opts.name,\n source: opts.source,\n pageSize: opts.limit,\n page: opts.page,\n }),\n outputOptions(cmd),\n );\n },\n );\n\n cmd\n .command(\"market-get <skill-id>\")\n .description(\"Get a market skill by id\")\n .action(async (id: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).skills.marketGet(id), outputOptions(cmd));\n });\n\n cmd\n .command(\"delete <skill-id>\")\n .description(\"Delete a skill\")\n .action(async (id: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).skills.delete(id), outputOptions(cmd));\n });\n\n cmd\n .command(\"content <skill-id>\")\n .description(\"Read a skill's SKILL.md content index\")\n .action(async (id: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).skills.content(id), outputOptions(cmd));\n });\n\n cmd\n .command(\"read-file <skill-id> <rel-path>\")\n .description(\"Read a file inside a skill (progressive)\")\n .action(async (id: string, relPath: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).skills.readFile(id, relPath), outputOptions(cmd));\n });\n\n cmd\n .command(\"history <skill-id>\")\n .description(\"Show a skill's version history\")\n .action(async (id: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).skills.history(id), outputOptions(cmd));\n });\n\n cmd\n .command(\"set-status <skill-id> <status>\")\n .description(\"Change status: unpublish | published | offline\")\n .action(async (id: string, status: string, _opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).skills.setStatus(id, status as \"unpublish\" | \"published\" | \"offline\"),\n outputOptions(cmd),\n );\n });\n\n cmd\n .command(\"register <directory>\")\n .description(\"Zip a local skill directory and register it\")\n .option(\"--source <s>\", \"source tag\")\n .option(\"--extend-info <json>\", \"extra metadata as JSON\")\n .action(async (dir: string, opts, cmd: Command) => {\n const extendInfo = opts.extendInfo ? JSON.parse(opts.extendInfo) : undefined;\n printJson(\n await clientFrom(cmd).skills.register(dir, { source: opts.source, extendInfo }),\n outputOptions(cmd),\n );\n });\n cmd\n .command(\"download <skill-id> [out-path]\")\n .description(\"Download a skill archive to a local .zip\")\n .action(async (skillId: string, outPath: string | undefined, _o, cmd: Command) => {\n printJson(await clientFrom(cmd).skills.download(skillId, outPath), outputOptions(cmd));\n });\n cmd\n .command(\"install <skill-id> [directory]\")\n .description(\"Download a skill archive and extract it locally\")\n .action(async (skillId: string, dir: string | undefined, _o, cmd: Command) => {\n printJson(await clientFrom(cmd).skills.install(skillId, dir), outputOptions(cmd));\n });\n cmd\n .command(\"update-metadata <skill-id>\")\n .description(\"Update a skill's metadata (--body / --body-file JSON)\")\n .option(\"--body <json>\", \"metadata JSON\")\n .option(\"--body-file <path>\", \"read metadata JSON from a file\")\n .action(async (skillId: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).skills.updateMetadata(skillId, readBody(opts)),\n outputOptions(cmd),\n );\n });\n cmd\n .command(\"update-package <skill-id> <directory>\")\n .description(\"Replace a skill's package from a local directory\")\n .action(async (skillId: string, dir: string, _o, cmd: Command) => {\n printJson(await clientFrom(cmd).skills.updatePackage(skillId, dir), outputOptions(cmd));\n });\n\n cmd\n .command(\"republish <skill-id>\")\n .description(\"Republish a previous skill version\")\n .requiredOption(\"--version <v>\", \"version to republish\")\n .action(async (skillId: string, opts, cmd: Command) => {\n printJson(await clientFrom(cmd).skills.republish(skillId, opts.version), outputOptions(cmd));\n });\n cmd\n .command(\"publish-history <skill-id>\")\n .description(\"Publish a historical skill version\")\n .requiredOption(\"--version <v>\", \"version to publish\")\n .action(async (skillId: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).skills.publishHistory(skillId, opts.version),\n outputOptions(cmd),\n );\n });\n\n return group(cmd, \"MODELS & SKILLS\");\n}\n","/** `openbkn toolbox …` and `openbkn tool …` — agent toolboxes + tools. */\nimport { Command } from \"commander\";\nimport { group } from \"../help/grouped-help.js\";\nimport { DEFAULT_LIST_LIMIT } from \"../types.js\";\nimport { InputError } from \"../utils/errors.js\";\nimport { printJson } from \"../utils/output.js\";\nimport { clientFrom, outputOptions } from \"./_shared.js\";\n\nconst int = (v: string) => Number.parseInt(v, 10);\n\nexport function toolboxCommand(): Command {\n const cmd = new Command(\"toolbox\").description(\"Agent toolbox lifecycle\");\n\n cmd\n .command(\"list\")\n .description(\"List toolboxes\")\n .option(\"--keyword <s>\", \"filter by keyword\")\n .option(\"--limit <n>\", \"page size\", int, DEFAULT_LIST_LIMIT)\n .option(\"--offset <n>\", \"page offset\", int, 0)\n .action(async (opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).toolboxes.list({\n keyword: opts.keyword,\n limit: opts.limit,\n offset: opts.offset,\n }),\n outputOptions(cmd),\n );\n });\n\n cmd\n .command(\"create\")\n .description(\"Create a toolbox\")\n .requiredOption(\"--name <name>\", \"toolbox name\")\n .requiredOption(\"--service-url <url>\", \"tool service URL\")\n .option(\"--description <d>\", \"description\")\n .action(async (opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).toolboxes.create({\n name: opts.name,\n serviceUrl: opts.serviceUrl,\n description: opts.description,\n }),\n outputOptions(cmd),\n );\n });\n\n cmd\n .command(\"publish <box-id>\")\n .description(\"Publish a toolbox\")\n .action(async (id: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).toolboxes.publish(id), outputOptions(cmd));\n });\n\n cmd\n .command(\"unpublish <box-id>\")\n .description(\"Unpublish a toolbox (status=draft)\")\n .action(async (id: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).toolboxes.unpublish(id), outputOptions(cmd));\n });\n\n cmd\n .command(\"delete <box-id>\")\n .description(\"Delete a toolbox\")\n .option(\"-y, --yes\", \"skip confirmation\")\n .action(async (id: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).toolboxes.delete(id), outputOptions(cmd));\n });\n\n cmd\n .command(\"export <box-id>\")\n .description(\"Export a toolbox config to a local .adp file\")\n .requiredOption(\"-o, --out <file>\", \"output .adp path\")\n .option(\"--type <t>\", \"impex type: toolbox | mcp | operator\", \"toolbox\")\n .action(async (boxId: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).toolboxes.export(boxId, opts.out, opts.type),\n outputOptions(cmd),\n );\n });\n cmd\n .command(\"import <file>\")\n .description(\"Import a toolbox config from a local .adp file\")\n .option(\"--type <t>\", \"impex type: toolbox | mcp | operator\", \"toolbox\")\n .action(async (file: string, opts, cmd: Command) => {\n printJson(await clientFrom(cmd).toolboxes.import(file, opts.type), outputOptions(cmd));\n });\n\n return group(cmd, \"DECISION AGENT\");\n}\n\nexport function toolCommand(): Command {\n const cmd = new Command(\"tool\").description(\"Tools inside a toolbox\");\n\n cmd\n .command(\"list\")\n .description(\"List tools in a toolbox\")\n .requiredOption(\"--toolbox <box-id>\", \"toolbox id\")\n .action(async (opts, cmd: Command) => {\n printJson(await clientFrom(cmd).toolboxes.tools(opts.toolbox), outputOptions(cmd));\n });\n\n cmd\n .command(\"enable <tool-ids...>\")\n .description(\"Enable one or more tools\")\n .requiredOption(\"--toolbox <box-id>\", \"toolbox id\")\n .action(async (toolIds: string[], opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).toolboxes.setToolStatus(opts.toolbox, toolIds, \"enabled\"),\n outputOptions(cmd),\n );\n });\n\n cmd\n .command(\"disable <tool-ids...>\")\n .description(\"Disable one or more tools\")\n .requiredOption(\"--toolbox <box-id>\", \"toolbox id\")\n .action(async (toolIds: string[], opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).toolboxes.setToolStatus(opts.toolbox, toolIds, \"disabled\"),\n outputOptions(cmd),\n );\n });\n\n const invokeOpts = (c: Command) =>\n c\n .requiredOption(\"--toolbox <box-id>\", \"toolbox id\")\n .option(\"--body <json>\", \"request body JSON\")\n .option(\"--header <json>\", \"headers map JSON\")\n .option(\"--query <json>\", \"query params JSON\")\n .option(\"--path <json>\", \"path params JSON\")\n .option(\"--timeout <s>\", \"per-call timeout seconds\", int);\n\n const parseJson = (s: string | undefined, label: string): Record<string, unknown> | undefined => {\n if (!s) return undefined;\n try {\n return JSON.parse(s);\n } catch {\n throw new InputError(`--${label} must be valid JSON`);\n }\n };\n\n const buildEnvelope = (opts: Record<string, string | undefined>) => ({\n body: opts.body ? JSON.parse(opts.body) : undefined,\n header: parseJson(opts.header, \"header\"),\n query: parseJson(opts.query, \"query\"),\n path: parseJson(opts.path, \"path\"),\n timeout: opts.timeout ? Number(opts.timeout) : undefined,\n });\n\n invokeOpts(\n cmd.command(\"execute <tool-id>\").description(\"Invoke a published+enabled tool\"),\n ).action(async (toolId: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).toolboxes.execute(opts.toolbox, toolId, buildEnvelope(opts)),\n outputOptions(cmd),\n );\n });\n invokeOpts(\n cmd.command(\"debug <tool-id>\").description(\"Invoke a tool (draft/disabled too)\"),\n ).action(async (toolId: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).toolboxes.debug(opts.toolbox, toolId, buildEnvelope(opts)),\n outputOptions(cmd),\n );\n });\n\n cmd\n .command(\"upload <file>\")\n .description(\"Upload a tool definition file (OpenAPI spec) into a toolbox\")\n .requiredOption(\"--toolbox <id>\", \"target toolbox id\")\n .option(\"--metadata-type <t>\", \"metadata type\", \"openapi\")\n .action(async (file: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).toolboxes.upload(opts.toolbox, file, opts.metadataType),\n outputOptions(cmd),\n );\n });\n\n return group(cmd, \"DECISION AGENT\");\n}\n","/** `openbkn trace …` — trace data (search/get) + diagnose + eval-set. */\nimport { readFileSync, writeFileSync } from \"node:fs\";\nimport { Command } from \"commander\";\nimport { group } from \"../help/grouped-help.js\";\nimport { renderReportMarkdown } from \"../trace-ai/diagnose.js\";\nimport { validateSchemaFile } from \"../trace-ai/schema-validate.js\";\nimport { printJson } from \"../utils/output.js\";\nimport { clientFrom, outputOptions, readBody } from \"./_shared.js\";\n\nexport function traceCommand(): Command {\n const cmd = new Command(\"trace\").description(\n \"Trace AI — fetch spans, diagnose (symbolic + LLM rubric), scan, eval-set, schema validate\",\n );\n\n cmd\n .command(\"get <conversation-id>\")\n .description(\"Fetch all trace spans for a conversation\")\n .option(\"--max-spans <n>\", \"max spans\", (v) => Number.parseInt(v, 10))\n .action(async (conversationId: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).trace.spans(conversationId, { maxSpans: opts.maxSpans }),\n outputOptions(cmd),\n );\n });\n\n cmd\n .command(\"search\")\n .description(\"Raw trace search (--body / --body-file OpenSearch JSON)\")\n .option(\"--body <json>\", \"search body JSON\")\n .option(\"--body-file <path>\", \"read search body JSON from a file\")\n .action(async (opts, cmd: Command) => {\n printJson(await clientFrom(cmd).trace.search(readBody(opts)), outputOptions(cmd));\n });\n\n cmd\n .command(\"diagnose <conversation-id>\")\n .description(\"Diagnose a conversation's trace (symbolic rules; --llm adds rubric judging)\")\n .option(\"--llm\", \"also run LLM-judged rubric rules via the local `claude` CLI\")\n .action(async (conversationId: string, opts, cmd: Command) => {\n const report = await clientFrom(cmd).trace.diagnose(conversationId, {\n llm: Boolean(opts.llm),\n });\n const out = outputOptions(cmd);\n if (out.json) printJson(report, out);\n else console.log(renderReportMarkdown(report));\n });\n\n cmd\n .command(\"scan <conversation-ids>\")\n .description(\"Batch-diagnose several conversations (comma-joined) + aggregate findings\")\n .option(\"--llm\", \"hybrid mode (rubric + synthesizer) per trace via local `claude`\")\n .action(async (ids: string, opts, cmd: Command) => {\n const list = ids\n .split(\",\")\n .map((s) => s.trim())\n .filter(Boolean);\n printJson(\n await clientFrom(cmd).trace.scan(list, { llm: Boolean(opts.llm) }),\n outputOptions(cmd),\n );\n });\n\n const evalSet = cmd.command(\"eval-set\").description(\"Build + run trace eval sets\");\n evalSet\n .command(\"build <queries-file>\")\n .description(\"Build eval cases from a queries JSON file\")\n .option(\"--out <file>\", \"write the cases JSON here (default: stdout)\")\n .action(async (queriesFile: string, opts, cmd: Command) => {\n const raw = JSON.parse(readFileSync(queriesFile, \"utf8\"));\n const cases = clientFrom(cmd).trace.evalSetBuild(raw);\n if (opts.out) {\n writeFileSync(opts.out, JSON.stringify({ cases }, null, 2));\n printJson({ out: opts.out, cases: cases.length }, outputOptions(cmd));\n } else {\n printJson({ cases }, outputOptions(cmd));\n }\n });\n evalSet\n .command(\"test <cases-file>\")\n .description(\"Run an eval set against an agent (--llm enables semantic_match)\")\n .requiredOption(\"--agent <id>\", \"agent id to run the queries against\")\n .option(\"--version <v>\", \"agent version\", \"v0\")\n .option(\"--llm\", \"enable semantic_match assertions via the local `claude` CLI\")\n .action(async (casesFile: string, opts, cmd: Command) => {\n const raw = JSON.parse(readFileSync(casesFile, \"utf8\"));\n const cases = clientFrom(cmd).trace.evalSetBuild(raw);\n const result = await clientFrom(cmd).trace.evalSetTest(opts.agent, cases, {\n version: opts.version,\n llm: Boolean(opts.llm),\n });\n printJson(result, outputOptions(cmd));\n if (result.failed > 0) process.exitCode = 1;\n });\n\n const schema = cmd.command(\"schema\").description(\"Validate eval-set / diagnosis-rule files\");\n schema\n .command(\"validate <file>\")\n .description(\"Validate an eval-set or diagnosis-rule file (JSON/YAML) against its schema\")\n .option(\"--kind <k>\", \"force schema kind: eval-set | rule (default: auto-detect)\")\n .action(async (file: string, opts, cmd: Command) => {\n const result = validateSchemaFile(file, opts.kind);\n printJson(result, outputOptions(cmd));\n if (!result.valid) process.exitCode = 1;\n });\n\n return group(cmd, \"TRACE AI\");\n}\n","/**\n * `trace schema validate` — validate a local eval-set or diagnosis-rule file\n * (JSON or YAML) against a zod schema. Catches malformed cases/rules before\n * `eval-set test` runs them or before a custom rule is shipped.\n */\nimport { readFileSync } from \"node:fs\";\nimport { extname } from \"node:path\";\nimport yaml from \"js-yaml\";\nimport { z } from \"zod\";\n\nconst Assertion = z\n .object({\n type: z.enum([\n \"contains\",\n \"not_contains\",\n \"regex\",\n \"tool_call_count\",\n \"tool_call_order\",\n \"latency_ms\",\n \"semantic_match\",\n ]),\n })\n .passthrough();\n\nconst EvalCase = z.object({\n query_id: z.string().optional(),\n query: z.string().optional(),\n input: z.object({ user_message: z.string() }).optional(),\n reference: z.object({ answer: z.string() }).optional(),\n assertions: z.array(Assertion).optional(),\n tags: z.array(z.string()).optional(),\n});\n\nconst EvalSetFile = z.union([\n z.array(EvalCase),\n z.object({ cases: z.array(EvalCase) }),\n z.object({ queries: z.array(EvalCase) }),\n]);\n\nconst DiagnosisRule = z.object({\n id: z.string(),\n severity: z.enum([\"low\", \"medium\", \"high\"]),\n symptom: z.string(),\n predicate: z.string().optional(),\n rubric: z.unknown().optional(),\n params: z.record(z.string(), z.unknown()).optional(),\n});\n\nexport type SchemaKind = \"eval-set\" | \"rule\";\n\nexport interface SchemaValidateResult {\n valid: boolean;\n kind: SchemaKind;\n file: string;\n errors: string[];\n}\n\nfunction parseFile(file: string): unknown {\n const text = readFileSync(file, \"utf8\");\n const ext = extname(file).toLowerCase();\n if (ext === \".yaml\" || ext === \".yml\") return yaml.load(text);\n return JSON.parse(text);\n}\n\n/** Infer the schema kind from the parsed shape when not given explicitly. */\nfunction inferKind(data: unknown): SchemaKind {\n if (data && typeof data === \"object\" && !Array.isArray(data)) {\n const o = data as Record<string, unknown>;\n if (\"predicate\" in o || \"rubric\" in o || (\"symptom\" in o && \"severity\" in o)) return \"rule\";\n }\n return \"eval-set\";\n}\n\nexport function validateSchemaFile(file: string, kind?: SchemaKind): SchemaValidateResult {\n let data: unknown;\n try {\n data = parseFile(file);\n } catch (e) {\n return {\n valid: false,\n kind: kind ?? \"eval-set\",\n file,\n errors: [`parse error: ${e instanceof Error ? e.message : String(e)}`],\n };\n }\n const resolved = kind ?? inferKind(data);\n const schema = resolved === \"rule\" ? DiagnosisRule : EvalSetFile;\n const result = schema.safeParse(data);\n if (result.success) return { valid: true, kind: resolved, file, errors: [] };\n return {\n valid: false,\n kind: resolved,\n file,\n errors: result.error.issues.map((i) => `${i.path.join(\".\") || \"(root)\"}: ${i.message}`),\n };\n}\n","/** `openbkn vega …` — Catalog reads + index BuildTask. */\nimport { Command } from \"commander\";\nimport { group } from \"../help/grouped-help.js\";\nimport { DEFAULT_LIST_LIMIT } from \"../types.js\";\nimport { printJson } from \"../utils/output.js\";\nimport { clientFrom, csv, outputOptions } from \"./_shared.js\";\n\nexport function vegaCommand(): Command {\n const vega = new Command(\"vega\").description(\n \"Vega observability — catalog, resources, index build tasks\",\n );\n\n const catalog = vega.command(\"catalog\").description(\"Catalog entries\");\n catalog\n .command(\"list\")\n .description(\"List catalog entries\")\n .option(\"--limit <n>\", \"page size\", (v) => Number.parseInt(v, 10), DEFAULT_LIST_LIMIT)\n .option(\"--offset <n>\", \"page offset\", (v) => Number.parseInt(v, 10), 0)\n .action(async (_opts, cmd: Command) => {\n const o = cmd.optsWithGlobals();\n const data = await clientFrom(cmd).vega.catalogs({ limit: o.limit, offset: o.offset });\n printJson(data, outputOptions(cmd));\n });\n catalog\n .command(\"get <id>\")\n .description(\"Get a catalog by id\")\n .action(async (id: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).vega.getCatalog(id), outputOptions(cmd));\n });\n catalog\n .command(\"resources <id>\")\n .description(\"List resources under a catalog\")\n .option(\"--category <c>\", \"filter by category (e.g. table)\")\n .action(async (id: string, opts, cmd: Command) => {\n printJson(await clientFrom(cmd).vega.catalogResources(id, opts.category), outputOptions(cmd));\n });\n catalog\n .command(\"health <ids...>\")\n .description(\"Health-status for one or more catalogs\")\n .action(async (ids: string[], _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).vega.catalogHealth(ids), outputOptions(cmd));\n });\n catalog\n .command(\"create\")\n .description(\"Create a catalog (data source)\")\n .requiredOption(\"--name <s>\", \"catalog name\")\n .requiredOption(\"--connector-type <s>\", \"connector type (e.g. mysql)\")\n .requiredOption(\"--connector-config <json>\", \"connector config JSON\")\n .option(\"--tags <t1,t2>\", \"comma-separated tags\")\n .option(\"--description <s>\", \"description\")\n .option(\"--enabled\", \"create enabled (default: disabled)\")\n .action(async (opts, cmd: Command) => {\n let connectorConfig: unknown;\n try {\n connectorConfig = JSON.parse(opts.connectorConfig);\n } catch {\n throw new Error(\"--connector-config must be valid JSON\");\n }\n printJson(\n await clientFrom(cmd).vega.createCatalog({\n name: opts.name,\n connectorType: opts.connectorType,\n connectorConfig,\n tags: opts.tags\n ? String(opts.tags)\n .split(\",\")\n .map((t) => t.trim())\n .filter(Boolean)\n : undefined,\n description: opts.description,\n enabled: opts.enabled ? true : undefined,\n }),\n outputOptions(cmd),\n );\n });\n catalog\n .command(\"enable <id>\")\n .description(\"Enable a catalog (required before discovery)\")\n .action(async (id: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).vega.enableCatalog(id), outputOptions(cmd));\n });\n catalog\n .command(\"discover <id>\")\n .description(\"Trigger catalog resource discovery\")\n .option(\"--wait\", \"wait for discovery to complete\")\n .action(async (id: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).vega.discoverCatalog(id, Boolean(opts.wait)),\n outputOptions(cmd),\n );\n });\n\n const connector = vega.command(\"connector-type\").description(\"Connector types\");\n connector\n .command(\"list\")\n .description(\"List connector types\")\n .action(async (_opts, cmd: Command) => {\n printJson(await clientFrom(cmd).vega.connectorTypes(), outputOptions(cmd));\n });\n connector\n .command(\"get <type>\")\n .description(\"Get a connector type\")\n .action(async (type: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).vega.connectorType(type), outputOptions(cmd));\n });\n\n const resource = vega.command(\"resource\").description(\"Vega-backend resources\");\n resource\n .command(\"list\")\n .description(\"List resources\")\n .option(\"--datasource-id <id>\", \"filter by catalog/datasource id\")\n .option(\"--catalog-id <id>\", \"alias of --datasource-id\")\n .option(\"--type <category>\", \"resource category\")\n .option(\"--category <category>\", \"alias of --type\")\n .option(\"--limit <n>\", \"page size\", (v) => Number.parseInt(v, 10), DEFAULT_LIST_LIMIT)\n .action(async (opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).resource.list({\n datasourceId: opts.datasourceId ?? opts.catalogId,\n category: opts.type ?? opts.category,\n limit: opts.limit,\n }),\n outputOptions(cmd),\n );\n });\n resource\n .command(\"get <id>\")\n .description(\"Get a resource\")\n .action(async (id: string, _opts, cmd: Command) => {\n printJson(await clientFrom(cmd).resource.get(id), outputOptions(cmd));\n });\n resource\n .command(\"query <id>\")\n .description(\"Fetch data rows from a resource\")\n .option(\"--limit <n>\", \"row limit\", (v) => Number.parseInt(v, 10), 50)\n .option(\"--offset <n>\", \"row offset\", (v) => Number.parseInt(v, 10), 0)\n .action(async (id: string, opts, cmd: Command) => {\n printJson(\n await clientFrom(cmd).resource.query(id, { limit: opts.limit, offset: opts.offset }),\n outputOptions(cmd),\n );\n });\n\n const dataset = vega.command(\"dataset\").description(\"Dataset index build tasks\");\n dataset\n .command(\"build <resource-id>\")\n .description(\"Build a resource's index (creates a BuildTask)\")\n .requiredOption(\"--mode <mode>\", \"build mode: batch | streaming\")\n .option(\"--embedding-fields <list>\", \"comma-separated fields to vectorize\")\n .option(\n \"--build-key-fields <list>\",\n \"comma-separated key fields (batch: time; streaming: row id)\",\n )\n .option(\"--embedding-model <id>\", \"embedding model id (default if omitted)\")\n .option(\"--model-dimensions <n>\", \"vector dimensions\", (v) => Number.parseInt(v, 10))\n .option(\"--wait\", \"poll until the build reaches a terminal state\")\n .option(\"--timeout <s>\", \"wait timeout in seconds\", (v) => Number.parseInt(v, 10), 300)\n .action(async (resourceId: string, _opts, cmd: Command) => {\n const o = cmd.optsWithGlobals();\n const task = await clientFrom(cmd).vega.build(\n {\n resource_id: resourceId,\n mode: o.mode,\n embedding_fields: csv(o.embeddingFields),\n build_key_fields: csv(o.buildKeyFields),\n embedding_model: o.embeddingModel,\n model_dimensions: o.modelDimensions,\n },\n { wait: Boolean(o.wait), timeoutMs: o.timeout * 1000 },\n );\n printJson(task, outputOptions(cmd));\n });\n\n dataset\n .command(\"build-status <resource-id> <task-id>\")\n .description(\"Show a BuildTask's state and progress\")\n .action(async (_resourceId: string, taskId: string, _opts, cmd: Command) => {\n const task = await clientFrom(cmd).vega.buildStatus(taskId);\n printJson(task, outputOptions(cmd));\n });\n\n return group(vega, \"AI DATA PLATFORM\");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,SAAS,WAAAA,iBAAe;;;ACLxB;AAAA,EACE,MAAQ;AAAA,EACR,SAAW;AAAA,EACX,aAAe;AAAA,EACf,MAAQ;AAAA,EACR,SAAW;AAAA,EACX,SAAW;AAAA,IACT,MAAQ;AAAA,EACV;AAAA,EACA,KAAO;AAAA,IACL,SAAW;AAAA,EACb;AAAA,EACA,MAAQ;AAAA,EACR,OAAS;AAAA,EACT,SAAW;AAAA,IACT,KAAK;AAAA,MACH,OAAS;AAAA,MACT,QAAU;AAAA,IACZ;AAAA,EACF;AAAA,EACA,OAAS,CAAC,QAAQ,aAAa,gBAAgB,SAAS;AAAA,EACxD,eAAiB;AAAA,IACf,QAA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BAAoB,+CAA+C,EAC1E,OAAO,UAAU,8BAA8B,EAC/C,OAAO,aAAa,yBAAyB,EAC7C,OAAO,oBAAoB,8BAA8B,EACzD,OAAO,kBAAkB,gDAAgD,EACzE,mBAAmB;AAGtB,QAAQ,WAAW,YAAY,CAAC;AAChC,QAAQ,WAAW,YAAY,CAAC;AAChC,QAAQ,WAAW,cAAc,CAAC;AAClC,QAAQ,WAAW,YAAY,CAAC;AAChC,QAAQ,WAAW,WAAW,CAAC;AAC/B,QAAQ,WAAW,gBAAgB,CAAC;AACpC,QAAQ,WAAW,gBAAgB,CAAC;AACpC,QAAQ,WAAW,eAAe,CAAC;AACnC,QAAQ,WAAW,aAAa,CAAC;AACjC,QAAQ,WAAW,aAAa,CAAC;AACjC,QAAQ,WAAW,aAAa,CAAC;AACjC,QAAQ,WAAW,eAAe,CAAC;AACnC,QAAQ,WAAW,YAAY,CAAC;AAChC,QAAQ,WAAW,aAAa,CAAC;AACjC,QAAQ,WAAW,aAAa,CAAC;AACjC,QAAQ,WAAW,eAAe,CAAC;AAGnC,mBAAmB,OAAO;AAI1B,IAAM,OAAO,QAAQ,KAAK,IAAI,CAAC,MAAO,MAAM,QAAQ,iBAAiB,CAAE;AAEvE,IAAI;AACF,QAAM,QAAQ,WAAW,IAAI;AAC/B,SAAS,KAAK;AACZ,UAAQ,MAAM,YAAY,GAAG,CAAC;AAC9B,UAAQ,KAAK,WAAW,GAAG,CAAC;AAC9B;","names":["Command","Command","readFileSync","resolve","req","cmd","r","readFileSync","Command","Command","int","Command","cmd","Command","readFileSync","int","Command","Command","Command","cmd","Command","Command","Command","int","Command","cmd","Command","int","Command","cmd","createServer","Command","int","readBody","resolve","Command","createServer","Command","int","Command","Command","int","Command","cmd","Command","int","Command","cmd","status","Command","int","Command","cmd","readFileSync","Command","readFileSync","Command","cmd","readFileSync","Command","Command","Command"]}