@openbkn/bkn-sdk 0.1.1-alpha.12 → 0.1.1-alpha.14
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/{chunk-3FVB6VFQ.js → chunk-2GNQU4XH.js} +26 -3
- package/dist/chunk-2GNQU4XH.js.map +1 -0
- package/dist/cli.js +54 -7
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +17 -0
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-3FVB6VFQ.js.map +0 -1
package/dist/cli.js
CHANGED
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
use,
|
|
38
38
|
whoami,
|
|
39
39
|
writePlatformConfig
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-2GNQU4XH.js";
|
|
41
41
|
|
|
42
42
|
// src/cli.ts
|
|
43
43
|
import { Command as Command17 } from "commander";
|
|
@@ -45,7 +45,7 @@ import { Command as Command17 } from "commander";
|
|
|
45
45
|
// package.json
|
|
46
46
|
var package_default = {
|
|
47
47
|
name: "@openbkn/bkn-sdk",
|
|
48
|
-
version: "0.1.1-alpha.
|
|
48
|
+
version: "0.1.1-alpha.14",
|
|
49
49
|
description: "Unified TypeScript SDK + CLI for the BKN (Business Knowledge Network) platform.",
|
|
50
50
|
type: "module",
|
|
51
51
|
license: "Apache-2.0",
|
|
@@ -973,7 +973,14 @@ function adminCommand() {
|
|
|
973
973
|
import { Command as Command3 } from "commander";
|
|
974
974
|
var int2 = (v) => Number.parseInt(v, 10);
|
|
975
975
|
function agentCommand() {
|
|
976
|
-
const cmd = new Command3("agent").description(
|
|
976
|
+
const cmd = new Command3("agent").description(
|
|
977
|
+
"[DEPRECATED] Decision Agent \u2014 CRUD, chat, sessions, publish (being phased out)"
|
|
978
|
+
);
|
|
979
|
+
cmd.hook("preAction", () => {
|
|
980
|
+
process.stderr.write(
|
|
981
|
+
"\u26A0\uFE0F `openbkn agent` is deprecated and may be removed in a future release.\n"
|
|
982
|
+
);
|
|
983
|
+
});
|
|
977
984
|
cmd.command("list").description("List published agents").option("--name <s>", "filter by name").option("--limit <n>", "page size", int2, DEFAULT_LIST_LIMIT).option("--offset <n>", "page offset", int2, 0).option("--category-id <id>", "filter by category").action(async (opts, cmd2) => {
|
|
978
985
|
const data = await clientFrom(cmd2).agents.list({
|
|
979
986
|
name: opts.name,
|
|
@@ -1976,6 +1983,12 @@ async function handle(client, reqMsg, res) {
|
|
|
1976
1983
|
// src/commands/model.ts
|
|
1977
1984
|
import { Command as Command11 } from "commander";
|
|
1978
1985
|
var int8 = (v) => Number.parseInt(v, 10);
|
|
1986
|
+
async function resolveLlmModelName(client, model) {
|
|
1987
|
+
if (!/^\d+$/.test(model)) return model;
|
|
1988
|
+
const detail = await client.models.llm.get(model);
|
|
1989
|
+
if (!detail?.model_name) throw new InputError(`No LLM found with id ${model}.`);
|
|
1990
|
+
return detail.model_name;
|
|
1991
|
+
}
|
|
1979
1992
|
function addManagementCommands(parent, kind) {
|
|
1980
1993
|
parent.command("add").description("Register a model (definition JSON via --body / --body-file)").option("--body <json>", "model definition JSON").option("--body-file <path>", "read model definition JSON from a file").action(async (opts, cmd) => {
|
|
1981
1994
|
printJson(await clientFrom(cmd).models[kind].add(readBody(opts)), outputOptions(cmd));
|
|
@@ -1991,7 +2004,9 @@ function addManagementCommands(parent, kind) {
|
|
|
1991
2004
|
});
|
|
1992
2005
|
}
|
|
1993
2006
|
function modelCommand() {
|
|
1994
|
-
const model = new Command11("model").description(
|
|
2007
|
+
const model = new Command11("model").description(
|
|
2008
|
+
"Model factory \u2014 LLM / small-model CRUD, chat / embeddings / rerank, default selection"
|
|
2009
|
+
);
|
|
1995
2010
|
const llm = model.command("llm").description("Large language models");
|
|
1996
2011
|
llm.command("list").description("List LLM models").option("--name <s>", "filter by name").option("--type <t>", "model type filter").option("--limit <n>", "page size", int8, DEFAULT_LIST_LIMIT).option("--page <n>", "page", int8, 1).action(async (opts, cmd) => {
|
|
1997
2012
|
printJson(
|
|
@@ -2007,14 +2022,22 @@ function modelCommand() {
|
|
|
2007
2022
|
llm.command("get <modelId>").description("Get an LLM model").action(async (id, _opts, cmd) => {
|
|
2008
2023
|
printJson(await clientFrom(cmd).models.llm.get(id), outputOptions(cmd));
|
|
2009
2024
|
});
|
|
2010
|
-
llm.command("chat <
|
|
2025
|
+
llm.command("chat <model>").description("OpenAI-compatible chat completion (<model> = model name or numeric id)").requiredOption("-m, --message <text>", "user message").option("--stream", "stream the reply token-by-token to stdout").action(async (model2, opts, cmd) => {
|
|
2026
|
+
const client = clientFrom(cmd);
|
|
2027
|
+
const name = await resolveLlmModelName(client, model2);
|
|
2011
2028
|
const messages = [{ role: "user", content: opts.message }];
|
|
2012
2029
|
if (opts.stream) {
|
|
2013
|
-
await
|
|
2030
|
+
await client.models.llm.chatStream(name, messages, (t) => process.stdout.write(t));
|
|
2014
2031
|
process.stdout.write("\n");
|
|
2015
2032
|
return;
|
|
2016
2033
|
}
|
|
2017
|
-
printJson(await
|
|
2034
|
+
printJson(await client.models.llm.chat(name, messages), outputOptions(cmd));
|
|
2035
|
+
});
|
|
2036
|
+
llm.command("set-default <modelId>").description("Set this LLM as the system default (admin)").action(async (id, _opts, cmd) => {
|
|
2037
|
+
printJson(await clientFrom(cmd).models.llm.setDefault(id, true), outputOptions(cmd));
|
|
2038
|
+
});
|
|
2039
|
+
llm.command("unset-default <modelId>").description("Clear this LLM as the system default (admin)").action(async (id, _opts, cmd) => {
|
|
2040
|
+
printJson(await clientFrom(cmd).models.llm.setDefault(id, false), outputOptions(cmd));
|
|
2018
2041
|
});
|
|
2019
2042
|
addManagementCommands(llm, "llm");
|
|
2020
2043
|
const small = model.command("small").description("Small models (embedding / reranker)");
|
|
@@ -2044,7 +2067,31 @@ function modelCommand() {
|
|
|
2044
2067
|
outputOptions(cmd)
|
|
2045
2068
|
);
|
|
2046
2069
|
});
|
|
2070
|
+
small.command("get-default").description("Show the system default small model for a type").option("--type <t>", "model type: embedding | reranker", "embedding").action(async (opts, cmd) => {
|
|
2071
|
+
printJson(await clientFrom(cmd).models.small.getDefault(opts.type), outputOptions(cmd));
|
|
2072
|
+
});
|
|
2073
|
+
small.command("set-default <modelId>").description("Set this small model as the system default for its type (admin)").action(async (id, _opts, cmd) => {
|
|
2074
|
+
printJson(await clientFrom(cmd).models.small.setDefault(id, true), outputOptions(cmd));
|
|
2075
|
+
});
|
|
2076
|
+
small.command("unset-default <modelId>").description("Clear this small model as the system default (admin)").action(async (id, _opts, cmd) => {
|
|
2077
|
+
printJson(await clientFrom(cmd).models.small.setDefault(id, false), outputOptions(cmd));
|
|
2078
|
+
});
|
|
2047
2079
|
addManagementCommands(small, "small");
|
|
2080
|
+
model.addHelpText(
|
|
2081
|
+
"after",
|
|
2082
|
+
`
|
|
2083
|
+
Identifiers:
|
|
2084
|
+
\u2022 get / set-default / delete take the numeric model id (e.g. 2071747547839467520).
|
|
2085
|
+
\u2022 chat takes a model NAME, but also accepts a numeric id (resolved to its name).
|
|
2086
|
+
|
|
2087
|
+
Examples:
|
|
2088
|
+
$ openbkn model llm list # ids + the 'default' flag
|
|
2089
|
+
$ openbkn model llm chat deepseek_v4_flash -m hi # by name
|
|
2090
|
+
$ openbkn model llm chat 2071747547839467520 -m hi --stream # by id, streamed
|
|
2091
|
+
$ openbkn model llm set-default 2071747547839467520 # system default LLM
|
|
2092
|
+
$ openbkn model small get-default --type embedding # current default
|
|
2093
|
+
$ openbkn model small set-default <id> # default embedding/reranker`
|
|
2094
|
+
);
|
|
2048
2095
|
return group(model, "MODELS & SKILLS");
|
|
2049
2096
|
}
|
|
2050
2097
|
|