@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.
Files changed (214) hide show
  1. package/README.md +40 -52
  2. package/README.zh.md +41 -46
  3. package/dist/agent-providers/index.d.ts +7 -0
  4. package/dist/agent-providers/index.js +5 -0
  5. package/dist/agent-providers/prompt-template.d.ts +62 -0
  6. package/dist/agent-providers/prompt-template.js +105 -0
  7. package/dist/agent-providers/prompts/rubric-judge-v1.prompt.md +51 -0
  8. package/dist/agent-providers/prompts/within-trace-synthesizer-v1.prompt.md +60 -0
  9. package/dist/agent-providers/providers/claude-code-subprocess.d.ts +74 -0
  10. package/dist/agent-providers/providers/claude-code-subprocess.js +259 -0
  11. package/dist/agent-providers/providers/stub.d.ts +47 -0
  12. package/dist/agent-providers/providers/stub.js +77 -0
  13. package/dist/agent-providers/registry.d.ts +45 -0
  14. package/dist/agent-providers/registry.js +77 -0
  15. package/dist/agent-providers/types.d.ts +91 -0
  16. package/dist/agent-providers/types.js +25 -0
  17. package/dist/api/agent-chat.js +8 -6
  18. package/dist/api/context-loader.d.ts +1 -0
  19. package/dist/api/resources.d.ts +94 -0
  20. package/dist/api/resources.js +166 -0
  21. package/dist/api/semantic-search.d.ts +5 -0
  22. package/dist/api/semantic-search.js +5 -0
  23. package/dist/api/skills.d.ts +75 -2
  24. package/dist/api/skills.js +108 -12
  25. package/dist/api/trace.d.ts +5 -0
  26. package/dist/api/trace.js +4 -0
  27. package/dist/cli.js +109 -15
  28. package/dist/client.d.ts +3 -3
  29. package/dist/client.js +5 -5
  30. package/dist/commands/agent/mode.d.ts +6 -0
  31. package/dist/commands/agent/mode.js +75 -0
  32. package/dist/commands/agent-members.js +27 -11
  33. package/dist/commands/agent.js +469 -286
  34. package/dist/commands/auth.js +184 -71
  35. package/dist/commands/bkn-metric.js +37 -16
  36. package/dist/commands/bkn-ops.js +164 -86
  37. package/dist/commands/bkn-query.js +99 -31
  38. package/dist/commands/bkn-schema.d.ts +3 -3
  39. package/dist/commands/bkn-schema.js +127 -86
  40. package/dist/commands/bkn.js +153 -114
  41. package/dist/commands/call.js +23 -13
  42. package/dist/commands/config.js +22 -12
  43. package/dist/commands/context-loader.js +625 -49
  44. package/dist/commands/dataflow.js +14 -6
  45. package/dist/commands/ds.js +52 -30
  46. package/dist/commands/explore.js +18 -15
  47. package/dist/commands/model.js +53 -42
  48. package/dist/commands/resource.d.ts +1 -0
  49. package/dist/commands/{dataview.js → resource.js} +62 -84
  50. package/dist/commands/skill.d.ts +21 -1
  51. package/dist/commands/skill.js +567 -43
  52. package/dist/commands/token.js +11 -0
  53. package/dist/commands/tool.js +46 -29
  54. package/dist/commands/toolbox.js +31 -15
  55. package/dist/commands/trace.d.ts +26 -1
  56. package/dist/commands/trace.js +515 -15
  57. package/dist/commands/vega.js +466 -250
  58. package/dist/help/format.d.ts +65 -0
  59. package/dist/help/format.js +141 -0
  60. package/dist/index.d.ts +5 -5
  61. package/dist/index.js +3 -3
  62. package/dist/resources/bkn.d.ts +5 -0
  63. package/dist/resources/bkn.js +5 -0
  64. package/dist/resources/{dataviews.d.ts → resources.d.ts} +10 -11
  65. package/dist/resources/{dataviews.js → resources.js} +12 -13
  66. package/dist/resources/skills.d.ts +17 -1
  67. package/dist/resources/skills.js +32 -1
  68. package/dist/trace-ai/diagnose/agent-binding.d.ts +67 -0
  69. package/dist/trace-ai/diagnose/agent-binding.js +257 -0
  70. package/dist/trace-ai/diagnose/builtin-rules/tool-retry-intent-mismatch.yaml +68 -0
  71. package/dist/trace-ai/diagnose/index.d.ts +32 -0
  72. package/dist/trace-ai/diagnose/index.js +246 -0
  73. package/dist/trace-ai/diagnose/output-schema-converter.d.ts +24 -0
  74. package/dist/trace-ai/diagnose/output-schema-converter.js +81 -0
  75. package/dist/trace-ai/diagnose/query-extractor.d.ts +14 -0
  76. package/dist/trace-ai/diagnose/query-extractor.js +45 -0
  77. package/dist/trace-ai/diagnose/report-assembler.d.ts +31 -0
  78. package/dist/{trace-core → trace-ai}/diagnose/report-assembler.js +19 -9
  79. package/dist/trace-ai/diagnose/report-markdown.d.ts +18 -0
  80. package/dist/trace-ai/diagnose/report-markdown.js +192 -0
  81. package/dist/{trace-core → trace-ai}/diagnose/rule-loader.js +42 -8
  82. package/dist/{trace-core → trace-ai}/diagnose/schemas.d.ts +77 -2
  83. package/dist/trace-ai/diagnose/schemas.js +154 -0
  84. package/dist/trace-ai/diagnose/signal-probe.d.ts +17 -0
  85. package/dist/trace-ai/diagnose/signal-probe.js +39 -0
  86. package/dist/trace-ai/diagnose/synthesizer-agent.d.ts +40 -0
  87. package/dist/trace-ai/diagnose/synthesizer-agent.js +158 -0
  88. package/dist/{trace-core → trace-ai}/diagnose/trace-shaper.js +1 -0
  89. package/dist/{trace-core → trace-ai}/diagnose/types.d.ts +55 -6
  90. package/dist/trace-ai/eval-set/assertion-evaluator.d.ts +29 -0
  91. package/dist/trace-ai/eval-set/assertion-evaluator.js +100 -0
  92. package/dist/trace-ai/eval-set/builder.d.ts +36 -0
  93. package/dist/trace-ai/eval-set/builder.js +126 -0
  94. package/dist/trace-ai/eval-set/index.d.ts +15 -0
  95. package/dist/trace-ai/eval-set/index.js +10 -0
  96. package/dist/trace-ai/eval-set/output-writer.d.ts +27 -0
  97. package/dist/trace-ai/eval-set/output-writer.js +126 -0
  98. package/dist/trace-ai/eval-set/query-picker.d.ts +37 -0
  99. package/dist/trace-ai/eval-set/query-picker.js +147 -0
  100. package/dist/trace-ai/eval-set/redactor.d.ts +42 -0
  101. package/dist/trace-ai/eval-set/redactor.js +133 -0
  102. package/dist/trace-ai/eval-set/rubric-templates/answer-match-reference.prompt.md +19 -0
  103. package/dist/trace-ai/eval-set/schemas.d.ts +136 -0
  104. package/dist/trace-ai/eval-set/schemas.js +130 -0
  105. package/dist/trace-ai/eval-set/semantic-match-provider.d.ts +33 -0
  106. package/dist/trace-ai/eval-set/semantic-match-provider.js +51 -0
  107. package/dist/trace-ai/eval-set/test-runner.d.ts +34 -0
  108. package/dist/trace-ai/eval-set/test-runner.js +153 -0
  109. package/dist/trace-ai/eval-set/types.d.ts +46 -0
  110. package/dist/trace-ai/eval-set/types.js +8 -0
  111. package/dist/trace-ai/exp/bundle-writer.d.ts +10 -0
  112. package/dist/trace-ai/exp/bundle-writer.js +54 -0
  113. package/dist/trace-ai/exp/claude-binary.d.ts +5 -0
  114. package/dist/trace-ai/exp/claude-binary.js +30 -0
  115. package/dist/trace-ai/exp/coordinator.d.ts +45 -0
  116. package/dist/trace-ai/exp/coordinator.js +203 -0
  117. package/dist/trace-ai/exp/eval-runner.d.ts +14 -0
  118. package/dist/trace-ai/exp/eval-runner.js +47 -0
  119. package/dist/trace-ai/exp/exp-store/abort-signal.d.ts +3 -0
  120. package/dist/trace-ai/exp/exp-store/abort-signal.js +27 -0
  121. package/dist/trace-ai/exp/exp-store/candidate-lineage-yaml.d.ts +4 -0
  122. package/dist/trace-ai/exp/exp-store/candidate-lineage-yaml.js +37 -0
  123. package/dist/trace-ai/exp/exp-store/events-jsonl.d.ts +17 -0
  124. package/dist/trace-ai/exp/exp-store/events-jsonl.js +60 -0
  125. package/dist/trace-ai/exp/exp-store/exp-registry.d.ts +6 -0
  126. package/dist/trace-ai/exp/exp-store/exp-registry.js +41 -0
  127. package/dist/trace-ai/exp/exp-store/index.d.ts +46 -0
  128. package/dist/trace-ai/exp/exp-store/index.js +59 -0
  129. package/dist/trace-ai/exp/exp-store/lock.d.ts +3 -0
  130. package/dist/trace-ai/exp/exp-store/lock.js +73 -0
  131. package/dist/trace-ai/exp/exp-store/mission-md.d.ts +3 -0
  132. package/dist/trace-ai/exp/exp-store/mission-md.js +37 -0
  133. package/dist/trace-ai/exp/exp-store/readme-template.d.ts +5 -0
  134. package/dist/trace-ai/exp/exp-store/readme-template.js +25 -0
  135. package/dist/trace-ai/exp/exp-store/round-yaml.d.ts +3 -0
  136. package/dist/trace-ai/exp/exp-store/round-yaml.js +33 -0
  137. package/dist/trace-ai/exp/index.d.ts +8 -0
  138. package/dist/trace-ai/exp/index.js +238 -0
  139. package/dist/trace-ai/exp/info.d.ts +35 -0
  140. package/dist/trace-ai/exp/info.js +120 -0
  141. package/dist/trace-ai/exp/patch/agent-config.d.ts +1 -0
  142. package/dist/trace-ai/exp/patch/agent-config.js +26 -0
  143. package/dist/trace-ai/exp/patch/index.d.ts +2 -0
  144. package/dist/trace-ai/exp/patch/index.js +13 -0
  145. package/dist/trace-ai/exp/patch/skill.d.ts +1 -0
  146. package/dist/trace-ai/exp/patch/skill.js +24 -0
  147. package/dist/trace-ai/exp/providers/synthesizer-client.d.ts +14 -0
  148. package/dist/trace-ai/exp/providers/synthesizer-client.js +39 -0
  149. package/dist/trace-ai/exp/providers/triage-client.d.ts +19 -0
  150. package/dist/trace-ai/exp/providers/triage-client.js +51 -0
  151. package/dist/trace-ai/exp/schemas.d.ts +147 -0
  152. package/dist/trace-ai/exp/schemas.js +50 -0
  153. package/dist/trace-ai/exp/scoring.d.ts +2 -0
  154. package/dist/trace-ai/exp/scoring.js +46 -0
  155. package/dist/trace-ai/scan/aggregator.d.ts +20 -0
  156. package/dist/trace-ai/scan/aggregator.js +26 -0
  157. package/dist/trace-ai/scan/artifacts/paths.d.ts +12 -0
  158. package/dist/trace-ai/scan/artifacts/paths.js +18 -0
  159. package/dist/trace-ai/scan/artifacts/writer.d.ts +67 -0
  160. package/dist/trace-ai/scan/artifacts/writer.js +96 -0
  161. package/dist/trace-ai/scan/batched-rubric.d.ts +55 -0
  162. package/dist/trace-ai/scan/batched-rubric.js +159 -0
  163. package/dist/trace-ai/scan/cross-trace-synthesizer.d.ts +24 -0
  164. package/dist/trace-ai/scan/cross-trace-synthesizer.js +93 -0
  165. package/dist/trace-ai/scan/index.d.ts +31 -0
  166. package/dist/trace-ai/scan/index.js +390 -0
  167. package/dist/trace-ai/scan/prompts/builtin/cross-trace-synthesizer-v1.prompt.md +44 -0
  168. package/dist/trace-ai/scan/prompts/builtin/rubric-judge-batch-v1.prompt.md +44 -0
  169. package/dist/trace-ai/scan/runner.d.ts +25 -0
  170. package/dist/trace-ai/scan/runner.js +42 -0
  171. package/dist/trace-ai/scan/sampler.d.ts +18 -0
  172. package/dist/trace-ai/scan/sampler.js +81 -0
  173. package/dist/trace-ai/scan/scan-summary-markdown.d.ts +2 -0
  174. package/dist/trace-ai/scan/scan-summary-markdown.js +71 -0
  175. package/dist/trace-ai/scan/scan-summary-schema.d.ts +73 -0
  176. package/dist/trace-ai/scan/scan-summary-schema.js +61 -0
  177. package/dist/trace-ai/scan/single-agent-validator.d.ts +23 -0
  178. package/dist/trace-ai/scan/single-agent-validator.js +42 -0
  179. package/dist/trace-ai/scan/traces-list-parser.d.ts +15 -0
  180. package/dist/trace-ai/scan/traces-list-parser.js +46 -0
  181. package/package.json +2 -2
  182. package/dist/api/dataviews.d.ts +0 -117
  183. package/dist/api/dataviews.js +0 -265
  184. package/dist/commands/dataview.d.ts +0 -8
  185. package/dist/trace-core/diagnose/index.d.ts +0 -9
  186. package/dist/trace-core/diagnose/index.js +0 -104
  187. package/dist/trace-core/diagnose/report-assembler.d.ts +0 -12
  188. package/dist/trace-core/diagnose/schemas.js +0 -94
  189. package/dist/trace-core/diagnose/signal-probe.d.ts +0 -5
  190. package/dist/trace-core/diagnose/signal-probe.js +0 -21
  191. /package/dist/{trace-core → trace-ai}/diagnose/builtin-rules/excessive-tool-calls-per-turn.d.ts +0 -0
  192. /package/dist/{trace-core → trace-ai}/diagnose/builtin-rules/excessive-tool-calls-per-turn.js +0 -0
  193. /package/dist/{trace-core → trace-ai}/diagnose/builtin-rules/excessive-tool-calls-per-turn.yaml +0 -0
  194. /package/dist/{trace-core → trace-ai}/diagnose/builtin-rules/llm-response-truncated-no-continue.d.ts +0 -0
  195. /package/dist/{trace-core → trace-ai}/diagnose/builtin-rules/llm-response-truncated-no-continue.js +0 -0
  196. /package/dist/{trace-core → trace-ai}/diagnose/builtin-rules/llm-response-truncated-no-continue.yaml +0 -0
  197. /package/dist/{trace-core → trace-ai}/diagnose/builtin-rules/register.d.ts +0 -0
  198. /package/dist/{trace-core → trace-ai}/diagnose/builtin-rules/register.js +0 -0
  199. /package/dist/{trace-core → trace-ai}/diagnose/builtin-rules/retrieval-empty-no-fallback.d.ts +0 -0
  200. /package/dist/{trace-core → trace-ai}/diagnose/builtin-rules/retrieval-empty-no-fallback.js +0 -0
  201. /package/dist/{trace-core → trace-ai}/diagnose/builtin-rules/retrieval-empty-no-fallback.yaml +0 -0
  202. /package/dist/{trace-core → trace-ai}/diagnose/builtin-rules/tool-error-swallowed.d.ts +0 -0
  203. /package/dist/{trace-core → trace-ai}/diagnose/builtin-rules/tool-error-swallowed.js +0 -0
  204. /package/dist/{trace-core → trace-ai}/diagnose/builtin-rules/tool-error-swallowed.yaml +0 -0
  205. /package/dist/{trace-core → trace-ai}/diagnose/builtin-rules/tool-loop-no-state-change.d.ts +0 -0
  206. /package/dist/{trace-core → trace-ai}/diagnose/builtin-rules/tool-loop-no-state-change.js +0 -0
  207. /package/dist/{trace-core → trace-ai}/diagnose/builtin-rules/tool-loop-no-state-change.yaml +0 -0
  208. /package/dist/{trace-core → trace-ai}/diagnose/predicate-registry.d.ts +0 -0
  209. /package/dist/{trace-core → trace-ai}/diagnose/predicate-registry.js +0 -0
  210. /package/dist/{trace-core → trace-ai}/diagnose/rule-loader.d.ts +0 -0
  211. /package/dist/{trace-core → trace-ai}/diagnose/synthesizer-template.d.ts +0 -0
  212. /package/dist/{trace-core → trace-ai}/diagnose/synthesizer-template.js +0 -0
  213. /package/dist/{trace-core → trace-ai}/diagnose/trace-shaper.d.ts +0 -0
  214. /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 { runDataviewCommand } from "./commands/dataview.js";
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 dataview list [--datasource-id id] [--type atomic|custom] [--limit n] [-bd value]
80
- kweaver dataview find --name <name> [--exact] [--datasource-id id] [--wait] [--timeout ms] [-bd value]
81
- kweaver dataview get <id> [-bd value]
82
- kweaver dataview query <id> [--sql sql] [--limit n] [--offset n] [--need-total] [--raw-sql] [-bd value]
83
- kweaver dataview delete <id> [-y] [-bd value]
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] (compat HTTP)
144
- kweaver context-loader kn-schema-search <kn-id> <query> [--max N] (compat HTTP)
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
- dataview|dv List, find, get, query (SQL), delete data views (atomic / custom)
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, search, progressive read, download/install)
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" || command === "help") {
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 === "dataview" || command === "dv") {
259
- return runDataviewCommand(rest);
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 { DataViewsResource } from "./resources/dataviews.js";
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
- /** Data view creation and retrieval. */
102
- readonly dataviews: DataViewsResource;
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 { DataViewsResource } from "./resources/dataviews.js";
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
- /** Data view creation and retrieval. */
64
- dataviews;
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.dataviews = new DataViewsResource(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.dataviews = new DataViewsResource(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(`kweaver agent skill
357
-
358
- Subcommands:
359
- add <agent-id> <skill-id>... [--strict] [-bd <bd>] Attach skills to an agent
360
- remove <agent-id> <skill-id>... [-bd <bd>] Detach skills from an agent
361
- list <agent-id> [--pretty|--compact] [-bd <bd>] List skills attached to an agent
362
-
363
- Notes:
364
- --strict On add, reject skills that exist but are not in 'published' status.
365
- Default behaviour: warn and continue.
366
- Dedupe is automatic for add; remove silently skips not-attached ids.`);
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 {