@kweaver-ai/kweaver-sdk 0.8.1 → 0.8.3
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/README.md +40 -52
- package/README.zh.md +41 -46
- package/dist/agent-providers/index.d.ts +7 -0
- package/dist/agent-providers/index.js +5 -0
- package/dist/agent-providers/prompt-template.d.ts +62 -0
- package/dist/agent-providers/prompt-template.js +105 -0
- package/dist/agent-providers/prompts/rubric-judge-v1.prompt.md +51 -0
- package/dist/agent-providers/prompts/within-trace-synthesizer-v1.prompt.md +60 -0
- package/dist/agent-providers/providers/claude-code-subprocess.d.ts +74 -0
- package/dist/agent-providers/providers/claude-code-subprocess.js +259 -0
- package/dist/agent-providers/providers/stub.d.ts +47 -0
- package/dist/agent-providers/providers/stub.js +77 -0
- package/dist/agent-providers/registry.d.ts +45 -0
- package/dist/agent-providers/registry.js +77 -0
- package/dist/agent-providers/types.d.ts +91 -0
- package/dist/agent-providers/types.js +25 -0
- package/dist/api/agent-chat.js +8 -6
- package/dist/api/context-loader.d.ts +1 -0
- package/dist/api/resources.d.ts +94 -0
- package/dist/api/resources.js +166 -0
- package/dist/api/semantic-search.d.ts +5 -0
- package/dist/api/semantic-search.js +5 -0
- package/dist/api/skills.d.ts +75 -2
- package/dist/api/skills.js +108 -12
- package/dist/api/trace.d.ts +5 -0
- package/dist/api/trace.js +4 -0
- package/dist/cli.js +109 -15
- package/dist/client.d.ts +3 -3
- package/dist/client.js +5 -5
- package/dist/commands/agent/mode.d.ts +6 -0
- package/dist/commands/agent/mode.js +75 -0
- package/dist/commands/agent-members.js +27 -11
- package/dist/commands/agent.js +469 -286
- package/dist/commands/auth.js +184 -71
- package/dist/commands/bkn-metric.js +37 -16
- package/dist/commands/bkn-ops.js +164 -86
- package/dist/commands/bkn-query.js +99 -31
- package/dist/commands/bkn-schema.d.ts +3 -3
- package/dist/commands/bkn-schema.js +127 -86
- package/dist/commands/bkn.js +153 -114
- package/dist/commands/call.js +23 -13
- package/dist/commands/config.js +22 -12
- package/dist/commands/context-loader.js +625 -49
- package/dist/commands/dataflow.js +14 -6
- package/dist/commands/ds.js +52 -30
- package/dist/commands/explore.js +18 -15
- package/dist/commands/model.js +53 -42
- package/dist/commands/resource.d.ts +1 -0
- package/dist/commands/{dataview.js → resource.js} +62 -84
- package/dist/commands/skill.d.ts +21 -1
- package/dist/commands/skill.js +567 -43
- package/dist/commands/token.js +11 -0
- package/dist/commands/tool.js +46 -29
- package/dist/commands/toolbox.js +31 -15
- package/dist/commands/trace.d.ts +26 -1
- package/dist/commands/trace.js +515 -15
- package/dist/commands/vega.js +466 -250
- package/dist/help/format.d.ts +65 -0
- package/dist/help/format.js +141 -0
- package/dist/index.d.ts +5 -5
- package/dist/index.js +3 -3
- package/dist/resources/bkn.d.ts +5 -0
- package/dist/resources/bkn.js +5 -0
- package/dist/resources/{dataviews.d.ts → resources.d.ts} +10 -11
- package/dist/resources/{dataviews.js → resources.js} +12 -13
- package/dist/resources/skills.d.ts +17 -1
- package/dist/resources/skills.js +32 -1
- package/dist/trace-ai/diagnose/agent-binding.d.ts +67 -0
- package/dist/trace-ai/diagnose/agent-binding.js +257 -0
- package/dist/trace-ai/diagnose/builtin-rules/tool-retry-intent-mismatch.yaml +68 -0
- package/dist/trace-ai/diagnose/index.d.ts +32 -0
- package/dist/trace-ai/diagnose/index.js +246 -0
- package/dist/trace-ai/diagnose/output-schema-converter.d.ts +24 -0
- package/dist/trace-ai/diagnose/output-schema-converter.js +81 -0
- package/dist/trace-ai/diagnose/query-extractor.d.ts +14 -0
- package/dist/trace-ai/diagnose/query-extractor.js +45 -0
- package/dist/trace-ai/diagnose/report-assembler.d.ts +31 -0
- package/dist/{trace-core → trace-ai}/diagnose/report-assembler.js +19 -9
- package/dist/trace-ai/diagnose/report-markdown.d.ts +18 -0
- package/dist/trace-ai/diagnose/report-markdown.js +192 -0
- package/dist/{trace-core → trace-ai}/diagnose/rule-loader.js +42 -8
- package/dist/{trace-core → trace-ai}/diagnose/schemas.d.ts +77 -2
- package/dist/trace-ai/diagnose/schemas.js +154 -0
- package/dist/trace-ai/diagnose/signal-probe.d.ts +17 -0
- package/dist/trace-ai/diagnose/signal-probe.js +39 -0
- package/dist/trace-ai/diagnose/synthesizer-agent.d.ts +40 -0
- package/dist/trace-ai/diagnose/synthesizer-agent.js +158 -0
- package/dist/{trace-core → trace-ai}/diagnose/trace-shaper.js +1 -0
- package/dist/{trace-core → trace-ai}/diagnose/types.d.ts +55 -6
- package/dist/trace-ai/eval-set/assertion-evaluator.d.ts +29 -0
- package/dist/trace-ai/eval-set/assertion-evaluator.js +100 -0
- package/dist/trace-ai/eval-set/builder.d.ts +36 -0
- package/dist/trace-ai/eval-set/builder.js +126 -0
- package/dist/trace-ai/eval-set/index.d.ts +15 -0
- package/dist/trace-ai/eval-set/index.js +10 -0
- package/dist/trace-ai/eval-set/output-writer.d.ts +27 -0
- package/dist/trace-ai/eval-set/output-writer.js +126 -0
- package/dist/trace-ai/eval-set/query-picker.d.ts +37 -0
- package/dist/trace-ai/eval-set/query-picker.js +147 -0
- package/dist/trace-ai/eval-set/redactor.d.ts +42 -0
- package/dist/trace-ai/eval-set/redactor.js +133 -0
- package/dist/trace-ai/eval-set/rubric-templates/answer-match-reference.prompt.md +19 -0
- package/dist/trace-ai/eval-set/schemas.d.ts +136 -0
- package/dist/trace-ai/eval-set/schemas.js +130 -0
- package/dist/trace-ai/eval-set/semantic-match-provider.d.ts +33 -0
- package/dist/trace-ai/eval-set/semantic-match-provider.js +51 -0
- package/dist/trace-ai/eval-set/test-runner.d.ts +34 -0
- package/dist/trace-ai/eval-set/test-runner.js +153 -0
- package/dist/trace-ai/eval-set/types.d.ts +46 -0
- package/dist/trace-ai/eval-set/types.js +8 -0
- package/dist/trace-ai/exp/bundle-writer.d.ts +10 -0
- package/dist/trace-ai/exp/bundle-writer.js +54 -0
- package/dist/trace-ai/exp/claude-binary.d.ts +5 -0
- package/dist/trace-ai/exp/claude-binary.js +30 -0
- package/dist/trace-ai/exp/coordinator.d.ts +45 -0
- package/dist/trace-ai/exp/coordinator.js +203 -0
- package/dist/trace-ai/exp/eval-runner.d.ts +14 -0
- package/dist/trace-ai/exp/eval-runner.js +47 -0
- package/dist/trace-ai/exp/exp-store/abort-signal.d.ts +3 -0
- package/dist/trace-ai/exp/exp-store/abort-signal.js +27 -0
- package/dist/trace-ai/exp/exp-store/candidate-lineage-yaml.d.ts +4 -0
- package/dist/trace-ai/exp/exp-store/candidate-lineage-yaml.js +37 -0
- package/dist/trace-ai/exp/exp-store/events-jsonl.d.ts +17 -0
- package/dist/trace-ai/exp/exp-store/events-jsonl.js +60 -0
- package/dist/trace-ai/exp/exp-store/exp-registry.d.ts +6 -0
- package/dist/trace-ai/exp/exp-store/exp-registry.js +41 -0
- package/dist/trace-ai/exp/exp-store/index.d.ts +46 -0
- package/dist/trace-ai/exp/exp-store/index.js +59 -0
- package/dist/trace-ai/exp/exp-store/lock.d.ts +3 -0
- package/dist/trace-ai/exp/exp-store/lock.js +73 -0
- package/dist/trace-ai/exp/exp-store/mission-md.d.ts +3 -0
- package/dist/trace-ai/exp/exp-store/mission-md.js +37 -0
- package/dist/trace-ai/exp/exp-store/readme-template.d.ts +5 -0
- package/dist/trace-ai/exp/exp-store/readme-template.js +25 -0
- package/dist/trace-ai/exp/exp-store/round-yaml.d.ts +3 -0
- package/dist/trace-ai/exp/exp-store/round-yaml.js +33 -0
- package/dist/trace-ai/exp/index.d.ts +8 -0
- package/dist/trace-ai/exp/index.js +238 -0
- package/dist/trace-ai/exp/info.d.ts +35 -0
- package/dist/trace-ai/exp/info.js +120 -0
- package/dist/trace-ai/exp/patch/agent-config.d.ts +1 -0
- package/dist/trace-ai/exp/patch/agent-config.js +26 -0
- package/dist/trace-ai/exp/patch/index.d.ts +2 -0
- package/dist/trace-ai/exp/patch/index.js +13 -0
- package/dist/trace-ai/exp/patch/skill.d.ts +1 -0
- package/dist/trace-ai/exp/patch/skill.js +24 -0
- package/dist/trace-ai/exp/providers/synthesizer-client.d.ts +14 -0
- package/dist/trace-ai/exp/providers/synthesizer-client.js +39 -0
- package/dist/trace-ai/exp/providers/triage-client.d.ts +19 -0
- package/dist/trace-ai/exp/providers/triage-client.js +51 -0
- package/dist/trace-ai/exp/schemas.d.ts +147 -0
- package/dist/trace-ai/exp/schemas.js +50 -0
- package/dist/trace-ai/exp/scoring.d.ts +2 -0
- package/dist/trace-ai/exp/scoring.js +46 -0
- package/dist/trace-ai/scan/aggregator.d.ts +20 -0
- package/dist/trace-ai/scan/aggregator.js +26 -0
- package/dist/trace-ai/scan/artifacts/paths.d.ts +12 -0
- package/dist/trace-ai/scan/artifacts/paths.js +18 -0
- package/dist/trace-ai/scan/artifacts/writer.d.ts +67 -0
- package/dist/trace-ai/scan/artifacts/writer.js +96 -0
- package/dist/trace-ai/scan/batched-rubric.d.ts +55 -0
- package/dist/trace-ai/scan/batched-rubric.js +159 -0
- package/dist/trace-ai/scan/cross-trace-synthesizer.d.ts +24 -0
- package/dist/trace-ai/scan/cross-trace-synthesizer.js +93 -0
- package/dist/trace-ai/scan/index.d.ts +31 -0
- package/dist/trace-ai/scan/index.js +390 -0
- package/dist/trace-ai/scan/prompts/builtin/cross-trace-synthesizer-v1.prompt.md +44 -0
- package/dist/trace-ai/scan/prompts/builtin/rubric-judge-batch-v1.prompt.md +44 -0
- package/dist/trace-ai/scan/runner.d.ts +25 -0
- package/dist/trace-ai/scan/runner.js +42 -0
- package/dist/trace-ai/scan/sampler.d.ts +18 -0
- package/dist/trace-ai/scan/sampler.js +81 -0
- package/dist/trace-ai/scan/scan-summary-markdown.d.ts +2 -0
- package/dist/trace-ai/scan/scan-summary-markdown.js +71 -0
- package/dist/trace-ai/scan/scan-summary-schema.d.ts +73 -0
- package/dist/trace-ai/scan/scan-summary-schema.js +61 -0
- package/dist/trace-ai/scan/single-agent-validator.d.ts +23 -0
- package/dist/trace-ai/scan/single-agent-validator.js +42 -0
- package/dist/trace-ai/scan/traces-list-parser.d.ts +15 -0
- package/dist/trace-ai/scan/traces-list-parser.js +46 -0
- package/package.json +2 -2
- package/dist/api/dataviews.d.ts +0 -117
- package/dist/api/dataviews.js +0 -265
- package/dist/commands/dataview.d.ts +0 -8
- package/dist/trace-core/diagnose/index.d.ts +0 -9
- package/dist/trace-core/diagnose/index.js +0 -104
- package/dist/trace-core/diagnose/report-assembler.d.ts +0 -12
- package/dist/trace-core/diagnose/schemas.js +0 -94
- package/dist/trace-core/diagnose/signal-probe.d.ts +0 -5
- package/dist/trace-core/diagnose/signal-probe.js +0 -21
- /package/dist/{trace-core → trace-ai}/diagnose/builtin-rules/excessive-tool-calls-per-turn.d.ts +0 -0
- /package/dist/{trace-core → trace-ai}/diagnose/builtin-rules/excessive-tool-calls-per-turn.js +0 -0
- /package/dist/{trace-core → trace-ai}/diagnose/builtin-rules/excessive-tool-calls-per-turn.yaml +0 -0
- /package/dist/{trace-core → trace-ai}/diagnose/builtin-rules/llm-response-truncated-no-continue.d.ts +0 -0
- /package/dist/{trace-core → trace-ai}/diagnose/builtin-rules/llm-response-truncated-no-continue.js +0 -0
- /package/dist/{trace-core → trace-ai}/diagnose/builtin-rules/llm-response-truncated-no-continue.yaml +0 -0
- /package/dist/{trace-core → trace-ai}/diagnose/builtin-rules/register.d.ts +0 -0
- /package/dist/{trace-core → trace-ai}/diagnose/builtin-rules/register.js +0 -0
- /package/dist/{trace-core → trace-ai}/diagnose/builtin-rules/retrieval-empty-no-fallback.d.ts +0 -0
- /package/dist/{trace-core → trace-ai}/diagnose/builtin-rules/retrieval-empty-no-fallback.js +0 -0
- /package/dist/{trace-core → trace-ai}/diagnose/builtin-rules/retrieval-empty-no-fallback.yaml +0 -0
- /package/dist/{trace-core → trace-ai}/diagnose/builtin-rules/tool-error-swallowed.d.ts +0 -0
- /package/dist/{trace-core → trace-ai}/diagnose/builtin-rules/tool-error-swallowed.js +0 -0
- /package/dist/{trace-core → trace-ai}/diagnose/builtin-rules/tool-error-swallowed.yaml +0 -0
- /package/dist/{trace-core → trace-ai}/diagnose/builtin-rules/tool-loop-no-state-change.d.ts +0 -0
- /package/dist/{trace-core → trace-ai}/diagnose/builtin-rules/tool-loop-no-state-change.js +0 -0
- /package/dist/{trace-core → trace-ai}/diagnose/builtin-rules/tool-loop-no-state-change.yaml +0 -0
- /package/dist/{trace-core → trace-ai}/diagnose/predicate-registry.d.ts +0 -0
- /package/dist/{trace-core → trace-ai}/diagnose/predicate-registry.js +0 -0
- /package/dist/{trace-core → trace-ai}/diagnose/rule-loader.d.ts +0 -0
- /package/dist/{trace-core → trace-ai}/diagnose/synthesizer-template.d.ts +0 -0
- /package/dist/{trace-core → trace-ai}/diagnose/synthesizer-template.js +0 -0
- /package/dist/{trace-core → trace-ai}/diagnose/trace-shaper.d.ts +0 -0
- /package/dist/{trace-core → trace-ai}/diagnose/types.js +0 -0
package/dist/cli.js
CHANGED
|
@@ -9,14 +9,93 @@ import { runContextLoaderCommand } from "./commands/context-loader.js";
|
|
|
9
9
|
import { runDataflowCommand } from "./commands/dataflow.js";
|
|
10
10
|
import { runDsCommand } from "./commands/ds.js";
|
|
11
11
|
import { runExploreCommand } from "./commands/explore.js";
|
|
12
|
-
import {
|
|
12
|
+
import { runResourceCommand } from "./commands/resource.js";
|
|
13
13
|
import { runModelCommand } from "./commands/model.js";
|
|
14
14
|
import { runSkillCommand } from "./commands/skill.js";
|
|
15
15
|
import { runTokenCommand } from "./commands/token.js";
|
|
16
16
|
import { runToolboxCommand } from "./commands/toolbox.js";
|
|
17
17
|
import { runToolCommand } from "./commands/tool.js";
|
|
18
18
|
import { runVegaCommand } from "./commands/vega.js";
|
|
19
|
+
import { renderHelp } from "./help/format.js";
|
|
19
20
|
function printHelp() {
|
|
21
|
+
console.log(renderHelp({
|
|
22
|
+
tagline: "KWeaver SDK — operate KWeaver platform from CLI",
|
|
23
|
+
usage: [
|
|
24
|
+
"kweaver [global flags] <command> <subcommand> [flags]",
|
|
25
|
+
"kweaver --version | -V",
|
|
26
|
+
"kweaver --help | -h",
|
|
27
|
+
],
|
|
28
|
+
sections: [
|
|
29
|
+
{
|
|
30
|
+
title: "AUTHENTICATION & CONFIG",
|
|
31
|
+
items: [
|
|
32
|
+
{ name: "auth", desc: "Login / switch / list saved platform credentials" },
|
|
33
|
+
{ name: "token", desc: "Print current access token (auto-refresh)" },
|
|
34
|
+
{ name: "config", desc: "Per-platform business-domain config" },
|
|
35
|
+
],
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
title: "DECISION AGENT",
|
|
39
|
+
items: [
|
|
40
|
+
{ name: "agent", desc: "Agent CRUD, chat, sessions, publish" },
|
|
41
|
+
{ name: "toolbox", desc: "Agent toolbox lifecycle" },
|
|
42
|
+
{ name: "tool", desc: "Tools inside toolbox" },
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
title: "AI DATA PLATFORM",
|
|
47
|
+
items: [
|
|
48
|
+
{ name: "bkn", desc: "Knowledge network — build, query, action, metric" },
|
|
49
|
+
{ name: "ds", desc: "Datasource (list, get, connect, tables)" },
|
|
50
|
+
{ name: "resource (res)", desc: "Resources — list, find, get, query, delete" },
|
|
51
|
+
{ name: "dataflow", desc: "Dataflow document workflows (run, runs, logs)" },
|
|
52
|
+
{ name: "vega", desc: "Vega observability — catalog, resource, query" },
|
|
53
|
+
{ name: "context-loader (context)", desc: "MCP/HTTP context loader (reads BKN schema/instances)" },
|
|
54
|
+
],
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
title: "TRACE AI",
|
|
58
|
+
items: [
|
|
59
|
+
{ name: "trace", desc: "Diagnose conversations / build eval-sets / schema validate" },
|
|
60
|
+
],
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
title: "FOUNDATION",
|
|
64
|
+
items: [
|
|
65
|
+
{ name: "call (curl)", desc: "curl-style API call with auto-injected auth headers" },
|
|
66
|
+
{ name: "explore", desc: "Interactive web UI" },
|
|
67
|
+
{ name: "model", desc: "Model factory — LLM / small-model CRUD + chat" },
|
|
68
|
+
{ name: "skill", desc: "Skill registry / market" },
|
|
69
|
+
{ name: "help", desc: "Show help — use `help all` for full signatures" },
|
|
70
|
+
],
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
flags: [
|
|
74
|
+
{ name: "--base-url <url>", desc: "Override platform URL (env: KWEAVER_BASE_URL)" },
|
|
75
|
+
{ name: "--token <value>", desc: "Override access token (env: KWEAVER_TOKEN; disables write commands)" },
|
|
76
|
+
{ name: "--user <id|name>", desc: "Use specific user credentials (env: KWEAVER_USER)" },
|
|
77
|
+
{ name: "--pretty", desc: "Pretty-print JSON output (default)" },
|
|
78
|
+
{ name: "--compact", desc: "Compact JSON output (pipeline-friendly)" },
|
|
79
|
+
{ name: "--help, -h", desc: "Show help" },
|
|
80
|
+
{ name: "--version, -V", desc: "Show version" },
|
|
81
|
+
],
|
|
82
|
+
environment: [
|
|
83
|
+
{ name: "KWEAVER_PROFILE", desc: "Isolate active-platform/user state per shell" },
|
|
84
|
+
{ name: "KWEAVERC_CONFIG_DIR", desc: "Override config root (~/.kweaver)" },
|
|
85
|
+
],
|
|
86
|
+
examples: [
|
|
87
|
+
"kweaver auth https://platform.example.com",
|
|
88
|
+
"kweaver agent chat <agent_id> -m \"hello\"",
|
|
89
|
+
"kweaver bkn build <kn-id> --wait",
|
|
90
|
+
],
|
|
91
|
+
learnMore: [
|
|
92
|
+
"Use `kweaver <command> --help` for command-specific help",
|
|
93
|
+
"Use `kweaver help all` for full command signatures (migration fallback)",
|
|
94
|
+
"For agents/multi-terminal: prefer `--user <id>` over `auth switch`",
|
|
95
|
+
],
|
|
96
|
+
}));
|
|
97
|
+
}
|
|
98
|
+
function printHelpFull() {
|
|
20
99
|
console.log(`kweaver
|
|
21
100
|
|
|
22
101
|
Usage:
|
|
@@ -76,11 +155,11 @@ Usage:
|
|
|
76
155
|
kweaver model small list|get|add|edit|delete|test|embeddings|rerank|--template ...
|
|
77
156
|
kweaver model --help
|
|
78
157
|
|
|
79
|
-
kweaver
|
|
80
|
-
kweaver
|
|
81
|
-
kweaver
|
|
82
|
-
kweaver
|
|
83
|
-
kweaver
|
|
158
|
+
kweaver resource list [--datasource-id id] [--type table|logicview] [--limit n] [-bd value]
|
|
159
|
+
kweaver resource find --name <name> [--exact] [--datasource-id id] [--wait] [--timeout ms] [-bd value]
|
|
160
|
+
kweaver resource get <id> [-bd value]
|
|
161
|
+
kweaver resource query <id> [--limit n] [--offset n] [--need-total] [-bd value]
|
|
162
|
+
kweaver resource delete <id> [-y] [-bd value]
|
|
84
163
|
|
|
85
164
|
kweaver bkn list [options]
|
|
86
165
|
kweaver bkn get <kn-id> [options]
|
|
@@ -108,8 +187,9 @@ Usage:
|
|
|
108
187
|
kweaver config list-bd
|
|
109
188
|
kweaver config show
|
|
110
189
|
|
|
111
|
-
kweaver skill list|get|register|status|delete [options]
|
|
190
|
+
kweaver skill list|get|market-get|register|status|delete [options]
|
|
112
191
|
kweaver skill market [options]
|
|
192
|
+
kweaver skill update-metadata|update-package|history|republish|publish-history [options]
|
|
113
193
|
kweaver skill content <skill-id> [--raw] [--output file]
|
|
114
194
|
kweaver skill read-file <skill-id> <rel-path> [--raw] [--output file]
|
|
115
195
|
kweaver skill download|install <skill-id> [path] [options]
|
|
@@ -134,14 +214,15 @@ Usage:
|
|
|
134
214
|
kweaver vega query execute|sql [options]
|
|
135
215
|
kweaver vega connector-type list|get [options]
|
|
136
216
|
|
|
217
|
+
kweaver context-loader help <subcommand>
|
|
137
218
|
kweaver context-loader config set|use|list|remove|show [options] (deprecated; not supported with --token)
|
|
138
219
|
kweaver context-loader tools|resources|templates|prompts <kn-id> [--cursor]
|
|
139
220
|
kweaver context-loader resource <kn-id> <uri>
|
|
140
221
|
kweaver context-loader prompt <kn-id> <name> [--args json]
|
|
141
|
-
kweaver context-loader search-schema <kn-id> <query> [--scope object,relation,action,metric] [--max N]
|
|
222
|
+
kweaver context-loader search-schema <kn-id> <query> [--scope object,relation,action,metric] [--concept-groups ids] [--max N]
|
|
142
223
|
kweaver context-loader tool-call <kn-id> <name> --args '<json>'
|
|
143
|
-
kweaver context-loader kn-search <kn-id> <query> [--only-schema] (
|
|
144
|
-
kweaver context-loader kn-schema-search <kn-id> <query> [--max N] (
|
|
224
|
+
kweaver context-loader kn-search <kn-id> <query> [--only-schema] (deprecated; use search-schema)
|
|
225
|
+
kweaver context-loader kn-schema-search <kn-id> <query> [--max N] (deprecated; use search-schema)
|
|
145
226
|
kweaver context-loader query-object-instance|query-instance-subgraph|get-logic-properties|get-action-info|find-skills <kn-id> ...
|
|
146
227
|
(omit <kn-id> to fall back to deprecated saved config)
|
|
147
228
|
(alias: kweaver context ...)
|
|
@@ -174,11 +255,11 @@ Commands:
|
|
|
174
255
|
ds Manage datasources (list, get, delete, tables, connect)
|
|
175
256
|
dataflow Dataflow document workflows (list, run, runs, logs)
|
|
176
257
|
model Model factory: LLM/small-model CRUD (manager) and llm chat (OpenAI-compatible API)
|
|
177
|
-
|
|
258
|
+
resource|res List, find, get, query, delete vega-backend resources (table / logicview)
|
|
178
259
|
bkn Knowledge network (CRUD, build, validate, export, stats, push/pull,
|
|
179
260
|
object-type, relation-type, subgraph, action-type, action-execution, action-log)
|
|
180
261
|
config Per-platform configuration (business domain)
|
|
181
|
-
skill Skill registry and market (register,
|
|
262
|
+
skill Skill registry and market (register, edit, history, progressive read, download/install)
|
|
182
263
|
toolbox Agent toolbox lifecycle (create, list, publish, delete, export, import)
|
|
183
264
|
tool Tools inside a toolbox (upload OpenAPI spec, list, enable/disable)
|
|
184
265
|
vega Vega observability (catalog, resource, query/sql, connector-type, health/stats/inspect)
|
|
@@ -236,10 +317,23 @@ export async function run(argv) {
|
|
|
236
317
|
console.log(pkg.version);
|
|
237
318
|
return 0;
|
|
238
319
|
}
|
|
239
|
-
if (argv.length === 0 || !command || command === "--help" || command === "-h"
|
|
320
|
+
if (argv.length === 0 || !command || command === "--help" || command === "-h") {
|
|
240
321
|
printHelp();
|
|
241
322
|
return 0;
|
|
242
323
|
}
|
|
324
|
+
if (command === "help") {
|
|
325
|
+
const topic = rest[0];
|
|
326
|
+
if (!topic) {
|
|
327
|
+
printHelp();
|
|
328
|
+
return 0;
|
|
329
|
+
}
|
|
330
|
+
if (topic === "all") {
|
|
331
|
+
printHelpFull();
|
|
332
|
+
return 0;
|
|
333
|
+
}
|
|
334
|
+
// `help <command>` → forward to `<command> --help`
|
|
335
|
+
return run([...rest, "--help"]);
|
|
336
|
+
}
|
|
243
337
|
if (command === "auth") {
|
|
244
338
|
return runAuthCommand(rest);
|
|
245
339
|
}
|
|
@@ -255,8 +349,8 @@ export async function run(argv) {
|
|
|
255
349
|
if (command === "model") {
|
|
256
350
|
return runModelCommand(rest);
|
|
257
351
|
}
|
|
258
|
-
if (command === "
|
|
259
|
-
return
|
|
352
|
+
if (command === "resource" || command === "res") {
|
|
353
|
+
return runResourceCommand(rest);
|
|
260
354
|
}
|
|
261
355
|
if (command === "token") {
|
|
262
356
|
return runTokenCommand(rest);
|
package/dist/client.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { ConversationsResource } from "./resources/conversations.js";
|
|
|
3
3
|
import { ContextLoaderResource } from "./resources/context-loader.js";
|
|
4
4
|
import { DataflowsResource } from "./resources/dataflows.js";
|
|
5
5
|
import { DataSourcesResource } from "./resources/datasources.js";
|
|
6
|
-
import {
|
|
6
|
+
import { ResourcesResource } from "./resources/resources.js";
|
|
7
7
|
import { KnowledgeNetworksResource } from "./resources/knowledge-networks.js";
|
|
8
8
|
import { BknResource } from "./resources/bkn.js";
|
|
9
9
|
import { SkillsResource } from "./resources/skills.js";
|
|
@@ -98,8 +98,8 @@ export declare class KWeaverClient implements ClientContext {
|
|
|
98
98
|
readonly dataflows: DataflowsResource;
|
|
99
99
|
/** Data source management (connect, test, list tables). */
|
|
100
100
|
readonly datasources: DataSourcesResource;
|
|
101
|
-
/**
|
|
102
|
-
readonly
|
|
101
|
+
/** Vega-backend resource management (table/logicview resources under a catalog). */
|
|
102
|
+
readonly resources: ResourcesResource;
|
|
103
103
|
/** Vega observability platform (catalogs, resources, connector types). */
|
|
104
104
|
readonly vega: VegaResource;
|
|
105
105
|
/** ADP/KWeaver skill registry, market, progressive read, and install helpers. */
|
package/dist/client.js
CHANGED
|
@@ -8,7 +8,7 @@ import { ConversationsResource } from "./resources/conversations.js";
|
|
|
8
8
|
import { ContextLoaderResource } from "./resources/context-loader.js";
|
|
9
9
|
import { DataflowsResource } from "./resources/dataflows.js";
|
|
10
10
|
import { DataSourcesResource } from "./resources/datasources.js";
|
|
11
|
-
import {
|
|
11
|
+
import { ResourcesResource } from "./resources/resources.js";
|
|
12
12
|
import { KnowledgeNetworksResource } from "./resources/knowledge-networks.js";
|
|
13
13
|
import { BknResource } from "./resources/bkn.js";
|
|
14
14
|
import { SkillsResource } from "./resources/skills.js";
|
|
@@ -60,8 +60,8 @@ export class KWeaverClient {
|
|
|
60
60
|
dataflows;
|
|
61
61
|
/** Data source management (connect, test, list tables). */
|
|
62
62
|
datasources;
|
|
63
|
-
/**
|
|
64
|
-
|
|
63
|
+
/** Vega-backend resource management (table/logicview resources under a catalog). */
|
|
64
|
+
resources;
|
|
65
65
|
/** Vega observability platform (catalogs, resources, connector types). */
|
|
66
66
|
vega;
|
|
67
67
|
/** ADP/KWeaver skill registry, market, progressive read, and install helpers. */
|
|
@@ -100,7 +100,7 @@ export class KWeaverClient {
|
|
|
100
100
|
this.conversations = new ConversationsResource(this);
|
|
101
101
|
this.dataflows = new DataflowsResource(this);
|
|
102
102
|
this.datasources = new DataSourcesResource(this);
|
|
103
|
-
this.
|
|
103
|
+
this.resources = new ResourcesResource(this);
|
|
104
104
|
this.vega = new VegaResource(this);
|
|
105
105
|
this.skills = new SkillsResource(this);
|
|
106
106
|
this.toolboxes = new ToolboxesResource(this);
|
|
@@ -156,7 +156,7 @@ export class KWeaverClient {
|
|
|
156
156
|
this.conversations = new ConversationsResource(this);
|
|
157
157
|
this.dataflows = new DataflowsResource(this);
|
|
158
158
|
this.datasources = new DataSourcesResource(this);
|
|
159
|
-
this.
|
|
159
|
+
this.resources = new ResourcesResource(this);
|
|
160
160
|
this.vega = new VegaResource(this);
|
|
161
161
|
this.skills = new SkillsResource(this);
|
|
162
162
|
this.toolboxes = new ToolboxesResource(this);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const AGENT_MODES: readonly ["default", "dolphin", "react"];
|
|
2
|
+
export type AgentMode = typeof AGENT_MODES[number];
|
|
3
|
+
export declare const AGENT_MODE_HELP = " --mode <mode> Agent mode: default, dolphin, react (default: default)\n\nAgent mode config:\n config.mode accepts \"default\", \"dolphin\", or \"react\".\n If --mode is provided, it overrides config.mode.\n If neither --mode nor config.mode is provided, the CLI sends config.mode=\"default\".\n\nReAct config:\n react_config is only valid when mode is \"react\".\n Provide it through --config or --config-path, for example:\n {\n \"mode\": \"react\",\n \"react_config\": {\n \"disable_history_in_a_conversation\": false,\n \"disable_llm_cache\": false\n }\n }";
|
|
4
|
+
export declare function parseAgentMode(value: string, flagName?: string): AgentMode;
|
|
5
|
+
export declare function normalizeAgentConfigInput(value: unknown): Record<string, unknown>;
|
|
6
|
+
export declare function applyAgentModeToConfig(config: Record<string, unknown>, explicitMode?: AgentMode): void;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
export const AGENT_MODES = ["default", "dolphin", "react"];
|
|
2
|
+
const AGENT_MODE_SET = new Set(AGENT_MODES);
|
|
3
|
+
export const AGENT_MODE_HELP = ` --mode <mode> Agent mode: default, dolphin, react (default: default)
|
|
4
|
+
|
|
5
|
+
Agent mode config:
|
|
6
|
+
config.mode accepts "default", "dolphin", or "react".
|
|
7
|
+
If --mode is provided, it overrides config.mode.
|
|
8
|
+
If neither --mode nor config.mode is provided, the CLI sends config.mode="default".
|
|
9
|
+
|
|
10
|
+
ReAct config:
|
|
11
|
+
react_config is only valid when mode is "react".
|
|
12
|
+
Provide it through --config or --config-path, for example:
|
|
13
|
+
{
|
|
14
|
+
"mode": "react",
|
|
15
|
+
"react_config": {
|
|
16
|
+
"disable_history_in_a_conversation": false,
|
|
17
|
+
"disable_llm_cache": false
|
|
18
|
+
}
|
|
19
|
+
}`;
|
|
20
|
+
function formatModeValue(value) {
|
|
21
|
+
return typeof value === "string" ? value : JSON.stringify(value);
|
|
22
|
+
}
|
|
23
|
+
function isRecord(value) {
|
|
24
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
25
|
+
}
|
|
26
|
+
function looksLikeAgentConfig(value) {
|
|
27
|
+
return [
|
|
28
|
+
"mode",
|
|
29
|
+
"input",
|
|
30
|
+
"output",
|
|
31
|
+
"llms",
|
|
32
|
+
"react_config",
|
|
33
|
+
"system_prompt",
|
|
34
|
+
"data_source",
|
|
35
|
+
"skills",
|
|
36
|
+
"memory",
|
|
37
|
+
"conversation_history_config",
|
|
38
|
+
].some((field) => field in value);
|
|
39
|
+
}
|
|
40
|
+
export function parseAgentMode(value, flagName = "--mode") {
|
|
41
|
+
const mode = value.trim();
|
|
42
|
+
if (!AGENT_MODE_SET.has(mode)) {
|
|
43
|
+
throw new Error(`${flagName} must be one of: ${AGENT_MODES.join(", ")}`);
|
|
44
|
+
}
|
|
45
|
+
return mode;
|
|
46
|
+
}
|
|
47
|
+
export function normalizeAgentConfigInput(value) {
|
|
48
|
+
if (!isRecord(value)) {
|
|
49
|
+
throw new Error("Agent config file must contain a JSON object.");
|
|
50
|
+
}
|
|
51
|
+
const nestedConfig = value.config;
|
|
52
|
+
if (isRecord(nestedConfig) && !looksLikeAgentConfig(value)) {
|
|
53
|
+
return nestedConfig;
|
|
54
|
+
}
|
|
55
|
+
return value;
|
|
56
|
+
}
|
|
57
|
+
export function applyAgentModeToConfig(config, explicitMode) {
|
|
58
|
+
if (explicitMode) {
|
|
59
|
+
config.mode = explicitMode;
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
const currentMode = config.mode;
|
|
63
|
+
if (currentMode === undefined || currentMode === null || currentMode === "") {
|
|
64
|
+
config.mode = "default";
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
if (typeof currentMode !== "string") {
|
|
68
|
+
throw new Error(`config.mode must be one of: ${AGENT_MODES.join(", ")}; got ${formatModeValue(currentMode)}`);
|
|
69
|
+
}
|
|
70
|
+
const mode = currentMode.trim();
|
|
71
|
+
if (!AGENT_MODE_SET.has(mode)) {
|
|
72
|
+
throw new Error(`config.mode must be one of: ${AGENT_MODES.join(", ")}; got ${formatModeValue(currentMode)}`);
|
|
73
|
+
}
|
|
74
|
+
config.mode = mode;
|
|
75
|
+
}
|
|
@@ -6,6 +6,7 @@ import { getAgent, updateAgent } from "../api/agent-list.js";
|
|
|
6
6
|
import { getSkill } from "../api/skills.js";
|
|
7
7
|
import { ensureValidToken, formatHttpError } from "../auth/oauth.js";
|
|
8
8
|
import { resolveBusinessDomain } from "../config/store.js";
|
|
9
|
+
import { renderHelp } from "../help/format.js";
|
|
9
10
|
/** Deep-clone a JSON-serializable object so mutations don't leak to callers. */
|
|
10
11
|
function clone(value) {
|
|
11
12
|
return JSON.parse(JSON.stringify(value));
|
|
@@ -353,17 +354,32 @@ async function runSkillList(args) {
|
|
|
353
354
|
export async function runAgentSkillCommand(args) {
|
|
354
355
|
const [verb, ...rest] = args;
|
|
355
356
|
if (!verb || verb === "--help" || verb === "-h") {
|
|
356
|
-
console.log(
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
357
|
+
console.log(renderHelp({
|
|
358
|
+
tagline: "Manage skills attached to an agent",
|
|
359
|
+
usage: "kweaver agent skill <subcommand> [flags]",
|
|
360
|
+
sections: [{
|
|
361
|
+
title: "AVAILABLE COMMANDS",
|
|
362
|
+
items: [
|
|
363
|
+
{ name: "add", desc: "Attach skills to an agent" },
|
|
364
|
+
{ name: "remove", desc: "Detach skills from an agent" },
|
|
365
|
+
{ name: "list", desc: "List skills attached to an agent" },
|
|
366
|
+
],
|
|
367
|
+
}],
|
|
368
|
+
flags: [
|
|
369
|
+
{ name: "--strict", desc: "On add, reject skills that exist but are not in 'published' status. Default behaviour: warn and continue." },
|
|
370
|
+
{ name: "-bd <bd>", desc: "Business domain" },
|
|
371
|
+
{ name: "--pretty|--compact", desc: "Output formatting for list" },
|
|
372
|
+
],
|
|
373
|
+
inheritedFlags: "--base-url, --token, --user, --help",
|
|
374
|
+
examples: [
|
|
375
|
+
"kweaver agent skill add <agent-id> <skill-id>... [--strict] [-bd <bd>]",
|
|
376
|
+
"kweaver agent skill remove <agent-id> <skill-id>... [-bd <bd>]",
|
|
377
|
+
"kweaver agent skill list <agent-id> [--pretty|--compact] [-bd <bd>]",
|
|
378
|
+
],
|
|
379
|
+
learnMore: [
|
|
380
|
+
"Dedupe is automatic for add; remove silently skips not-attached ids.",
|
|
381
|
+
],
|
|
382
|
+
}));
|
|
367
383
|
return 0;
|
|
368
384
|
}
|
|
369
385
|
try {
|