@kweaver-ai/kweaver-sdk 0.7.4 → 0.8.2
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 +39 -5
- package/README.zh.md +37 -5
- 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/agent-observability.d.ts +51 -0
- package/dist/api/agent-observability.js +108 -0
- package/dist/api/context-loader.d.ts +1 -0
- package/dist/api/conversations.d.ts +4 -8
- package/dist/api/conversations.js +16 -58
- package/dist/api/datasources.d.ts +2 -20
- package/dist/api/datasources.js +7 -123
- 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 +49 -0
- package/dist/api/trace.js +85 -0
- package/dist/api/vega.d.ts +53 -0
- package/dist/api/vega.js +144 -0
- package/dist/cli.js +12 -5
- package/dist/commands/agent/mode.d.ts +6 -0
- package/dist/commands/agent/mode.js +75 -0
- package/dist/commands/agent.js +101 -29
- package/dist/commands/bkn-ops.js +12 -6
- package/dist/commands/bkn-utils.d.ts +9 -0
- package/dist/commands/bkn-utils.js +17 -0
- package/dist/commands/context-loader.js +608 -38
- package/dist/commands/ds.js +7 -2
- package/dist/commands/skill.d.ts +21 -1
- package/dist/commands/skill.js +389 -1
- package/dist/commands/trace.d.ts +39 -0
- package/dist/commands/trace.js +668 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/resources/bkn.d.ts +5 -0
- package/dist/resources/bkn.js +5 -0
- package/dist/resources/datasources.js +2 -1
- 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/excessive-tool-calls-per-turn.d.ts +2 -0
- package/dist/trace-ai/diagnose/builtin-rules/excessive-tool-calls-per-turn.js +15 -0
- package/dist/trace-ai/diagnose/builtin-rules/excessive-tool-calls-per-turn.yaml +16 -0
- package/dist/trace-ai/diagnose/builtin-rules/llm-response-truncated-no-continue.d.ts +2 -0
- package/dist/trace-ai/diagnose/builtin-rules/llm-response-truncated-no-continue.js +44 -0
- package/dist/trace-ai/diagnose/builtin-rules/llm-response-truncated-no-continue.yaml +15 -0
- package/dist/trace-ai/diagnose/builtin-rules/register.d.ts +1 -0
- package/dist/trace-ai/diagnose/builtin-rules/register.js +11 -0
- package/dist/trace-ai/diagnose/builtin-rules/retrieval-empty-no-fallback.d.ts +2 -0
- package/dist/trace-ai/diagnose/builtin-rules/retrieval-empty-no-fallback.js +29 -0
- package/dist/trace-ai/diagnose/builtin-rules/retrieval-empty-no-fallback.yaml +15 -0
- package/dist/trace-ai/diagnose/builtin-rules/tool-error-swallowed.d.ts +2 -0
- package/dist/trace-ai/diagnose/builtin-rules/tool-error-swallowed.js +45 -0
- package/dist/trace-ai/diagnose/builtin-rules/tool-error-swallowed.yaml +15 -0
- package/dist/trace-ai/diagnose/builtin-rules/tool-loop-no-state-change.d.ts +2 -0
- package/dist/trace-ai/diagnose/builtin-rules/tool-loop-no-state-change.js +38 -0
- package/dist/trace-ai/diagnose/builtin-rules/tool-loop-no-state-change.yaml +16 -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/predicate-registry.d.ts +7 -0
- package/dist/trace-ai/diagnose/predicate-registry.js +30 -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-ai/diagnose/report-assembler.js +100 -0
- package/dist/trace-ai/diagnose/report-markdown.d.ts +18 -0
- package/dist/trace-ai/diagnose/report-markdown.js +192 -0
- package/dist/trace-ai/diagnose/rule-loader.d.ts +11 -0
- package/dist/trace-ai/diagnose/rule-loader.js +120 -0
- package/dist/trace-ai/diagnose/schemas.d.ts +184 -0
- 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-ai/diagnose/synthesizer-template.d.ts +2 -0
- package/dist/trace-ai/diagnose/synthesizer-template.js +49 -0
- package/dist/trace-ai/diagnose/trace-shaper.d.ts +3 -0
- package/dist/trace-ai/diagnose/trace-shaper.js +73 -0
- package/dist/trace-ai/diagnose/types.d.ts +173 -0
- package/dist/trace-ai/diagnose/types.js +1 -0
- 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 +14 -4
package/dist/commands/ds.js
CHANGED
|
@@ -3,9 +3,11 @@ import { statSync } from "node:fs";
|
|
|
3
3
|
import { glob } from "node:fs/promises";
|
|
4
4
|
import { resolve as resolvePath } from "node:path";
|
|
5
5
|
import { ensureValidToken, formatHttpError, with401RefreshRetry } from "../auth/oauth.js";
|
|
6
|
-
import { testDatasource, createDatasource, listDatasources, getDatasource, deleteDatasource,
|
|
6
|
+
import { testDatasource, createDatasource, listDatasources, getDatasource, deleteDatasource, } from "../api/datasources.js";
|
|
7
|
+
import { listTablesWithColumns, scanMetadata } from "../api/vega.js";
|
|
7
8
|
import { formatCallOutput } from "./call.js";
|
|
8
9
|
import { resolveBusinessDomain } from "../config/store.js";
|
|
10
|
+
import { assertVegaCatalogId } from "./bkn-utils.js";
|
|
9
11
|
import { parseCsvFile, buildTableName, splitBatches, buildFieldMappings, buildDagBody, } from "./import-csv.js";
|
|
10
12
|
import { executeDataflow } from "../api/dataflow.js";
|
|
11
13
|
function confirmYes(prompt) {
|
|
@@ -196,9 +198,12 @@ async function runDsTablesCommand(args) {
|
|
|
196
198
|
id = arg;
|
|
197
199
|
}
|
|
198
200
|
if (!id) {
|
|
199
|
-
console.error("Usage: kweaver ds tables <id> [--keyword X]"
|
|
201
|
+
console.error("Usage: kweaver ds tables <vega-catalog-id> [--keyword X]\n" +
|
|
202
|
+
" <vega-catalog-id> is a vega catalog id (use `kweaver vega catalog list` to find one;\n" +
|
|
203
|
+
" legacy data-connection datasource UUIDs are no longer accepted).");
|
|
200
204
|
return 1;
|
|
201
205
|
}
|
|
206
|
+
assertVegaCatalogId(id);
|
|
202
207
|
const token = await ensureValidToken();
|
|
203
208
|
const body = await listTablesWithColumns({
|
|
204
209
|
baseUrl: token.baseUrl,
|
package/dist/commands/skill.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type SkillStatus } from "../api/skills.js";
|
|
1
|
+
import { type SkillCategory, type SkillStatus } from "../api/skills.js";
|
|
2
2
|
interface BaseOptions {
|
|
3
3
|
businessDomain: string;
|
|
4
4
|
pretty: boolean;
|
|
@@ -20,7 +20,27 @@ interface RegisterOptions extends BaseOptions {
|
|
|
20
20
|
source?: string;
|
|
21
21
|
extendInfo?: Record<string, unknown>;
|
|
22
22
|
}
|
|
23
|
+
interface UpdateMetadataOptions extends BaseOptions {
|
|
24
|
+
skillId: string;
|
|
25
|
+
name: string;
|
|
26
|
+
description: string;
|
|
27
|
+
category: SkillCategory;
|
|
28
|
+
source?: string;
|
|
29
|
+
extendInfo?: Record<string, unknown>;
|
|
30
|
+
}
|
|
31
|
+
interface UpdatePackageOptions extends BaseOptions {
|
|
32
|
+
skillId: string;
|
|
33
|
+
contentFile?: string;
|
|
34
|
+
zipFile?: string;
|
|
35
|
+
}
|
|
36
|
+
interface HistoryVersionOptions extends BaseOptions {
|
|
37
|
+
skillId: string;
|
|
38
|
+
version: string;
|
|
39
|
+
}
|
|
23
40
|
export declare function parseSkillListArgs(args: string[]): ListOptions;
|
|
24
41
|
export declare function parseSkillRegisterArgs(args: string[]): RegisterOptions;
|
|
42
|
+
export declare function parseSkillUpdateMetadataArgs(args: string[]): UpdateMetadataOptions;
|
|
43
|
+
export declare function parseSkillUpdatePackageArgs(args: string[]): UpdatePackageOptions;
|
|
44
|
+
export declare function parseSkillHistoryVersionArgs(args: string[], commandName: string): HistoryVersionOptions;
|
|
25
45
|
export declare function runSkillCommand(args: string[]): Promise<number>;
|
|
26
46
|
export {};
|
package/dist/commands/skill.js
CHANGED
|
@@ -2,7 +2,7 @@ import { mkdirSync, readFileSync, statSync, writeFileSync } from "node:fs";
|
|
|
2
2
|
import { basename, dirname, resolve } from "node:path";
|
|
3
3
|
import { ensureValidToken, formatHttpError, with401RefreshRetry } from "../auth/oauth.js";
|
|
4
4
|
import { resolveBusinessDomain } from "../config/store.js";
|
|
5
|
-
import { deleteSkill, downloadSkill, fetchSkillContent, fetchSkillFile, getSkill, getSkillContentIndex, installSkillArchive, listSkillMarket, listSkills, readSkillFile, registerSkillZip, updateSkillStatus, } from "../api/skills.js";
|
|
5
|
+
import { deleteSkill, downloadSkill, downloadSkillManagementArchive, fetchSkillContent, fetchSkillFile, getSkill, getSkillMarketDetail, getSkillContentIndex, getSkillManagementContent, installSkillArchive, listSkillMarket, listSkillHistory, listSkills, publishSkillHistory, readSkillFile, readSkillManagementFile, republishSkillHistory, registerSkillZip, updateSkillMetadata, updateSkillPackageContent, updateSkillPackageZip, updateSkillStatus, } from "../api/skills.js";
|
|
6
6
|
import { bundleSkillDirectoryToZip, bundleSkillFileToZip } from "../utils/skill-bundle.js";
|
|
7
7
|
function printSkillHelp(subcommand) {
|
|
8
8
|
if (subcommand === "list") {
|
|
@@ -19,6 +19,10 @@ function printSkillHelp(subcommand) {
|
|
|
19
19
|
console.log("kweaver skill get <skill-id> [-bd value] [--pretty|--compact]");
|
|
20
20
|
return;
|
|
21
21
|
}
|
|
22
|
+
if (subcommand === "market-get") {
|
|
23
|
+
console.log("kweaver skill market-get <skill-id> [-bd value] [--pretty|--compact]");
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
22
26
|
if (subcommand === "register") {
|
|
23
27
|
console.log(`kweaver skill register (--content-file <path> | --zip-file <path>)
|
|
24
28
|
[--source src] [--extend-info json] [-bd value] [--pretty|--compact]
|
|
@@ -40,6 +44,28 @@ function printSkillHelp(subcommand) {
|
|
|
40
44
|
console.log("kweaver skill delete <skill-id> [-y|--yes] [-bd value] [--pretty|--compact]");
|
|
41
45
|
return;
|
|
42
46
|
}
|
|
47
|
+
if (subcommand === "update-metadata") {
|
|
48
|
+
console.log(`kweaver skill update-metadata <skill-id> --name <name> --description <text> --category <other_category|system>
|
|
49
|
+
[--source <custom|internal>] [--extend-info json] [-bd value] [--pretty|--compact]`);
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
if (subcommand === "update-package") {
|
|
53
|
+
console.log(`kweaver skill update-package <skill-id> (--content-file <path> | --zip-file <path>)
|
|
54
|
+
[-bd value] [--pretty|--compact]`);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
if (subcommand === "history") {
|
|
58
|
+
console.log("kweaver skill history <skill-id> [-bd value] [--pretty|--compact]");
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
if (subcommand === "republish") {
|
|
62
|
+
console.log("kweaver skill republish <skill-id> --version <version> [-bd value] [--pretty|--compact]");
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
if (subcommand === "publish-history") {
|
|
66
|
+
console.log("kweaver skill publish-history <skill-id> --version <version> [-bd value] [--pretty|--compact]");
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
43
69
|
if (subcommand === "content") {
|
|
44
70
|
console.log("kweaver skill content <skill-id> [--raw] [--output file] [-bd value] [--pretty|--compact]");
|
|
45
71
|
return;
|
|
@@ -56,24 +82,48 @@ function printSkillHelp(subcommand) {
|
|
|
56
82
|
console.log("kweaver skill install <skill-id> [directory] [--force] [-bd value] [--pretty|--compact]");
|
|
57
83
|
return;
|
|
58
84
|
}
|
|
85
|
+
if (subcommand === "management-content") {
|
|
86
|
+
console.log("kweaver skill management-content <skill-id> [--raw] [--response-mode url|content] [--output file] [-bd value] [--pretty|--compact]");
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
if (subcommand === "management-read-file") {
|
|
90
|
+
console.log("kweaver skill management-read-file <skill-id> <rel-path> [--response-mode url|content] [--output file] [-bd value] [--pretty|--compact]");
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
if (subcommand === "management-download") {
|
|
94
|
+
console.log("kweaver skill management-download <skill-id> [--response-mode url|content] [--output file] [-bd value] [--pretty|--compact]");
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
59
97
|
console.log(`kweaver skill
|
|
60
98
|
|
|
61
99
|
Subcommands:
|
|
62
100
|
list [--name kw] [--status status] [--page N] [--page-size N] [-bd value]
|
|
63
101
|
market [--name kw] [--source src] [--page N] [--page-size N] [-bd value]
|
|
64
102
|
get <skill-id> [-bd value]
|
|
103
|
+
market-get <skill-id> [-bd value]
|
|
65
104
|
register --content-file <path> | --zip-file <path> [--source src] [--extend-info json]
|
|
66
105
|
(--content-file accepts a file named SKILL.md or a directory; both auto-zip)
|
|
67
106
|
set-status <skill-id> <unpublish|published|offline> [-bd value]
|
|
68
107
|
delete <skill-id> [-y] [-bd value]
|
|
108
|
+
update-metadata <skill-id> --name <name> --description <text> --category <other_category|system> [--source <custom|internal>] [--extend-info json]
|
|
109
|
+
update-package <skill-id> (--content-file <path> | --zip-file <path>) [-bd value]
|
|
110
|
+
history <skill-id> [-bd value]
|
|
111
|
+
republish <skill-id> --version <version> [-bd value]
|
|
112
|
+
publish-history <skill-id> --version <version> [-bd value]
|
|
69
113
|
content <skill-id> [--raw] [--output file] [-bd value]
|
|
70
114
|
read-file <skill-id> <rel-path> [--raw] [--output file] [-bd value]
|
|
71
115
|
download <skill-id> [--output file] [-bd value]
|
|
72
116
|
install <skill-id> [directory] [--force] [-bd value]
|
|
117
|
+
management-content <skill-id> [--raw] [--response-mode url|content] [--output file] [-bd value]
|
|
118
|
+
management-read-file <skill-id> <rel-path> [--response-mode url|content] [--output file] [-bd value]
|
|
119
|
+
management-download <skill-id> [--response-mode url|content] [--output file] [-bd value]
|
|
73
120
|
|
|
74
121
|
Examples:
|
|
75
122
|
kweaver skill list --name kweaver
|
|
76
123
|
kweaver skill register --zip-file ./demo-skill.zip --source upload_zip
|
|
124
|
+
kweaver skill update-metadata skill-123 --name "Demo" --description "Demo skill" --category system
|
|
125
|
+
kweaver skill update-package skill-123 --content-file ./SKILL.md
|
|
126
|
+
kweaver skill history skill-123
|
|
77
127
|
kweaver skill content skill-123 --raw
|
|
78
128
|
kweaver skill read-file skill-123 references/guide.md --output ./guide.md
|
|
79
129
|
kweaver skill install skill-123 ./skills/demo-skill --force`);
|
|
@@ -276,6 +326,108 @@ function parseSkillGetArgs(args) {
|
|
|
276
326
|
}
|
|
277
327
|
return { ...base.opts, skillId };
|
|
278
328
|
}
|
|
329
|
+
export function parseSkillUpdateMetadataArgs(args) {
|
|
330
|
+
const skillId = args[0];
|
|
331
|
+
if (!skillId || skillId.startsWith("-"))
|
|
332
|
+
throw new Error("Missing skill-id");
|
|
333
|
+
let name;
|
|
334
|
+
let description;
|
|
335
|
+
let category;
|
|
336
|
+
let source;
|
|
337
|
+
let extendInfo;
|
|
338
|
+
const base = parseBaseArgs(args, 1);
|
|
339
|
+
for (let i = 1; i < base.args.length; i += 1) {
|
|
340
|
+
const arg = base.args[i];
|
|
341
|
+
if (arg === "--help" || arg === "-h")
|
|
342
|
+
throw new Error("help");
|
|
343
|
+
if (arg === "--name") {
|
|
344
|
+
name = base.args[i + 1];
|
|
345
|
+
i += 1;
|
|
346
|
+
continue;
|
|
347
|
+
}
|
|
348
|
+
if (arg === "--description") {
|
|
349
|
+
description = base.args[i + 1];
|
|
350
|
+
i += 1;
|
|
351
|
+
continue;
|
|
352
|
+
}
|
|
353
|
+
if (arg === "--category") {
|
|
354
|
+
const value = base.args[i + 1];
|
|
355
|
+
if (value !== "other_category" && value !== "system") {
|
|
356
|
+
throw new Error("Invalid --category. Expected other_category|system");
|
|
357
|
+
}
|
|
358
|
+
category = value;
|
|
359
|
+
i += 1;
|
|
360
|
+
continue;
|
|
361
|
+
}
|
|
362
|
+
if (arg === "--source") {
|
|
363
|
+
source = base.args[i + 1];
|
|
364
|
+
i += 1;
|
|
365
|
+
continue;
|
|
366
|
+
}
|
|
367
|
+
if (arg === "--extend-info") {
|
|
368
|
+
extendInfo = parseJsonFlag(base.args[i + 1], "--extend-info");
|
|
369
|
+
i += 1;
|
|
370
|
+
continue;
|
|
371
|
+
}
|
|
372
|
+
throw new Error(`Unsupported skill update-metadata argument: ${arg}`);
|
|
373
|
+
}
|
|
374
|
+
if (!name)
|
|
375
|
+
throw new Error("Missing --name");
|
|
376
|
+
if (!description)
|
|
377
|
+
throw new Error("Missing --description");
|
|
378
|
+
if (!category)
|
|
379
|
+
throw new Error("Missing --category");
|
|
380
|
+
return { ...base.opts, skillId, name, description, category, source, extendInfo };
|
|
381
|
+
}
|
|
382
|
+
export function parseSkillUpdatePackageArgs(args) {
|
|
383
|
+
const skillId = args[0];
|
|
384
|
+
if (!skillId || skillId.startsWith("-"))
|
|
385
|
+
throw new Error("Missing skill-id");
|
|
386
|
+
let contentFile;
|
|
387
|
+
let zipFile;
|
|
388
|
+
const base = parseBaseArgs(args, 1);
|
|
389
|
+
for (let i = 1; i < base.args.length; i += 1) {
|
|
390
|
+
const arg = base.args[i];
|
|
391
|
+
if (arg === "--help" || arg === "-h")
|
|
392
|
+
throw new Error("help");
|
|
393
|
+
if (arg === "--content-file") {
|
|
394
|
+
contentFile = base.args[i + 1];
|
|
395
|
+
i += 1;
|
|
396
|
+
continue;
|
|
397
|
+
}
|
|
398
|
+
if (arg === "--zip-file") {
|
|
399
|
+
zipFile = base.args[i + 1];
|
|
400
|
+
i += 1;
|
|
401
|
+
continue;
|
|
402
|
+
}
|
|
403
|
+
throw new Error(`Unsupported skill update-package argument: ${arg}`);
|
|
404
|
+
}
|
|
405
|
+
if ((contentFile ? 1 : 0) + (zipFile ? 1 : 0) !== 1) {
|
|
406
|
+
throw new Error("Use exactly one of --content-file or --zip-file");
|
|
407
|
+
}
|
|
408
|
+
return { ...base.opts, skillId, contentFile, zipFile };
|
|
409
|
+
}
|
|
410
|
+
export function parseSkillHistoryVersionArgs(args, commandName) {
|
|
411
|
+
const skillId = args[0];
|
|
412
|
+
if (!skillId || skillId.startsWith("-"))
|
|
413
|
+
throw new Error("Missing skill-id");
|
|
414
|
+
let version;
|
|
415
|
+
const base = parseBaseArgs(args, 1);
|
|
416
|
+
for (let i = 1; i < base.args.length; i += 1) {
|
|
417
|
+
const arg = base.args[i];
|
|
418
|
+
if (arg === "--help" || arg === "-h")
|
|
419
|
+
throw new Error("help");
|
|
420
|
+
if (arg === "--version") {
|
|
421
|
+
version = base.args[i + 1];
|
|
422
|
+
i += 1;
|
|
423
|
+
continue;
|
|
424
|
+
}
|
|
425
|
+
throw new Error(`Unsupported skill ${commandName} argument: ${arg}`);
|
|
426
|
+
}
|
|
427
|
+
if (!version)
|
|
428
|
+
throw new Error("Missing --version");
|
|
429
|
+
return { ...base.opts, skillId, version };
|
|
430
|
+
}
|
|
279
431
|
function parseSkillReadFileArgs(args) {
|
|
280
432
|
const skillId = args[0];
|
|
281
433
|
const relPath = args[1];
|
|
@@ -325,6 +477,101 @@ function parseSkillInstallArgs(args) {
|
|
|
325
477
|
}
|
|
326
478
|
return { ...base.opts, skillId, directory, force };
|
|
327
479
|
}
|
|
480
|
+
function parseManagementContentArgs(args) {
|
|
481
|
+
const skillId = args[0];
|
|
482
|
+
if (!skillId || skillId.startsWith("-"))
|
|
483
|
+
throw new Error("Missing skill-id");
|
|
484
|
+
let responseMode;
|
|
485
|
+
let fetchRaw = false;
|
|
486
|
+
let output;
|
|
487
|
+
const base = parseBaseArgs(args, 1);
|
|
488
|
+
for (let i = 1; i < base.args.length; i += 1) {
|
|
489
|
+
const arg = base.args[i];
|
|
490
|
+
if (arg === "--help" || arg === "-h")
|
|
491
|
+
throw new Error("help");
|
|
492
|
+
if (arg === "--raw") {
|
|
493
|
+
fetchRaw = true;
|
|
494
|
+
continue;
|
|
495
|
+
}
|
|
496
|
+
if (arg === "--response-mode") {
|
|
497
|
+
const value = base.args[i + 1];
|
|
498
|
+
if (value !== "url" && value !== "content") {
|
|
499
|
+
throw new Error("Invalid --response-mode. Expected url|content");
|
|
500
|
+
}
|
|
501
|
+
responseMode = value;
|
|
502
|
+
i += 1;
|
|
503
|
+
continue;
|
|
504
|
+
}
|
|
505
|
+
if (arg === "--output" || arg === "-o") {
|
|
506
|
+
output = base.args[i + 1];
|
|
507
|
+
i += 1;
|
|
508
|
+
continue;
|
|
509
|
+
}
|
|
510
|
+
throw new Error(`Unsupported skill management-content argument: ${arg}`);
|
|
511
|
+
}
|
|
512
|
+
return { ...base.opts, skillId, responseMode, fetchRaw, output };
|
|
513
|
+
}
|
|
514
|
+
function parseManagementReadFileArgs(args) {
|
|
515
|
+
const skillId = args[0];
|
|
516
|
+
const relPath = args[1];
|
|
517
|
+
if (!skillId || skillId.startsWith("-"))
|
|
518
|
+
throw new Error("Missing skill-id");
|
|
519
|
+
if (!relPath || relPath.startsWith("-"))
|
|
520
|
+
throw new Error("Missing rel-path");
|
|
521
|
+
let responseMode;
|
|
522
|
+
let output;
|
|
523
|
+
const base = parseBaseArgs(args, 2);
|
|
524
|
+
for (let i = 2; i < base.args.length; i += 1) {
|
|
525
|
+
const arg = base.args[i];
|
|
526
|
+
if (arg === "--help" || arg === "-h")
|
|
527
|
+
throw new Error("help");
|
|
528
|
+
if (arg === "--response-mode") {
|
|
529
|
+
const value = base.args[i + 1];
|
|
530
|
+
if (value !== "url" && value !== "content") {
|
|
531
|
+
throw new Error("Invalid --response-mode. Expected url|content");
|
|
532
|
+
}
|
|
533
|
+
responseMode = value;
|
|
534
|
+
i += 1;
|
|
535
|
+
continue;
|
|
536
|
+
}
|
|
537
|
+
if (arg === "--output" || arg === "-o") {
|
|
538
|
+
output = base.args[i + 1];
|
|
539
|
+
i += 1;
|
|
540
|
+
continue;
|
|
541
|
+
}
|
|
542
|
+
throw new Error(`Unsupported skill management-read-file argument: ${arg}`);
|
|
543
|
+
}
|
|
544
|
+
return { ...base.opts, skillId, relPath, responseMode, output };
|
|
545
|
+
}
|
|
546
|
+
function parseManagementDownloadArgs(args) {
|
|
547
|
+
const skillId = args[0];
|
|
548
|
+
if (!skillId || skillId.startsWith("-"))
|
|
549
|
+
throw new Error("Missing skill-id");
|
|
550
|
+
let responseMode;
|
|
551
|
+
let output;
|
|
552
|
+
const base = parseBaseArgs(args, 1);
|
|
553
|
+
for (let i = 1; i < base.args.length; i += 1) {
|
|
554
|
+
const arg = base.args[i];
|
|
555
|
+
if (arg === "--help" || arg === "-h")
|
|
556
|
+
throw new Error("help");
|
|
557
|
+
if (arg === "--response-mode") {
|
|
558
|
+
const value = base.args[i + 1];
|
|
559
|
+
if (value !== "url" && value !== "content") {
|
|
560
|
+
throw new Error("Invalid --response-mode. Expected url|content");
|
|
561
|
+
}
|
|
562
|
+
responseMode = value;
|
|
563
|
+
i += 1;
|
|
564
|
+
continue;
|
|
565
|
+
}
|
|
566
|
+
if (arg === "--output" || arg === "-o") {
|
|
567
|
+
output = base.args[i + 1];
|
|
568
|
+
i += 1;
|
|
569
|
+
continue;
|
|
570
|
+
}
|
|
571
|
+
throw new Error(`Unsupported skill management-download argument: ${arg}`);
|
|
572
|
+
}
|
|
573
|
+
return { ...base.opts, skillId, responseMode, output };
|
|
574
|
+
}
|
|
328
575
|
function parseStatusArgs(args) {
|
|
329
576
|
const skillId = args[0];
|
|
330
577
|
const status = args[1];
|
|
@@ -401,6 +648,16 @@ export async function runSkillCommand(args) {
|
|
|
401
648
|
console.log(format(result, opts.pretty));
|
|
402
649
|
return 0;
|
|
403
650
|
}
|
|
651
|
+
if (subcommand === "market-get") {
|
|
652
|
+
const opts = parseSkillGetArgs(rest);
|
|
653
|
+
const result = await getSkillMarketDetail({
|
|
654
|
+
...token,
|
|
655
|
+
businessDomain: opts.businessDomain,
|
|
656
|
+
skillId: opts.skillId,
|
|
657
|
+
});
|
|
658
|
+
console.log(format(result, opts.pretty));
|
|
659
|
+
return 0;
|
|
660
|
+
}
|
|
404
661
|
if (subcommand === "register") {
|
|
405
662
|
const opts = parseSkillRegisterArgs(rest);
|
|
406
663
|
if (opts.contentFile) {
|
|
@@ -463,6 +720,79 @@ export async function runSkillCommand(args) {
|
|
|
463
720
|
console.log(format(result, opts.pretty));
|
|
464
721
|
return 0;
|
|
465
722
|
}
|
|
723
|
+
if (subcommand === "update-metadata") {
|
|
724
|
+
const opts = parseSkillUpdateMetadataArgs(rest);
|
|
725
|
+
const result = await updateSkillMetadata({
|
|
726
|
+
...token,
|
|
727
|
+
businessDomain: opts.businessDomain,
|
|
728
|
+
skillId: opts.skillId,
|
|
729
|
+
name: opts.name,
|
|
730
|
+
description: opts.description,
|
|
731
|
+
category: opts.category,
|
|
732
|
+
source: opts.source,
|
|
733
|
+
extendInfo: opts.extendInfo,
|
|
734
|
+
});
|
|
735
|
+
console.log(format(result, opts.pretty));
|
|
736
|
+
return 0;
|
|
737
|
+
}
|
|
738
|
+
if (subcommand === "update-package") {
|
|
739
|
+
const opts = parseSkillUpdatePackageArgs(rest);
|
|
740
|
+
if (opts.contentFile) {
|
|
741
|
+
const content = readFileSync(resolve(opts.contentFile), "utf8");
|
|
742
|
+
const result = await updateSkillPackageContent({
|
|
743
|
+
...token,
|
|
744
|
+
businessDomain: opts.businessDomain,
|
|
745
|
+
skillId: opts.skillId,
|
|
746
|
+
content,
|
|
747
|
+
});
|
|
748
|
+
console.log(format(result, opts.pretty));
|
|
749
|
+
return 0;
|
|
750
|
+
}
|
|
751
|
+
if (opts.zipFile) {
|
|
752
|
+
const bytes = new Uint8Array(readFileSync(resolve(opts.zipFile)));
|
|
753
|
+
const result = await updateSkillPackageZip({
|
|
754
|
+
...token,
|
|
755
|
+
businessDomain: opts.businessDomain,
|
|
756
|
+
skillId: opts.skillId,
|
|
757
|
+
filename: basename(resolve(opts.zipFile)),
|
|
758
|
+
bytes,
|
|
759
|
+
});
|
|
760
|
+
console.log(format(result, opts.pretty));
|
|
761
|
+
return 0;
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
if (subcommand === "history") {
|
|
765
|
+
const opts = parseSkillGetArgs(rest);
|
|
766
|
+
const result = await listSkillHistory({
|
|
767
|
+
...token,
|
|
768
|
+
businessDomain: opts.businessDomain,
|
|
769
|
+
skillId: opts.skillId,
|
|
770
|
+
});
|
|
771
|
+
console.log(format(result, opts.pretty));
|
|
772
|
+
return 0;
|
|
773
|
+
}
|
|
774
|
+
if (subcommand === "republish") {
|
|
775
|
+
const opts = parseSkillHistoryVersionArgs(rest, "republish");
|
|
776
|
+
const result = await republishSkillHistory({
|
|
777
|
+
...token,
|
|
778
|
+
businessDomain: opts.businessDomain,
|
|
779
|
+
skillId: opts.skillId,
|
|
780
|
+
version: opts.version,
|
|
781
|
+
});
|
|
782
|
+
console.log(format(result, opts.pretty));
|
|
783
|
+
return 0;
|
|
784
|
+
}
|
|
785
|
+
if (subcommand === "publish-history") {
|
|
786
|
+
const opts = parseSkillHistoryVersionArgs(rest, "publish-history");
|
|
787
|
+
const result = await publishSkillHistory({
|
|
788
|
+
...token,
|
|
789
|
+
businessDomain: opts.businessDomain,
|
|
790
|
+
skillId: opts.skillId,
|
|
791
|
+
version: opts.version,
|
|
792
|
+
});
|
|
793
|
+
console.log(format(result, opts.pretty));
|
|
794
|
+
return 0;
|
|
795
|
+
}
|
|
466
796
|
if (subcommand === "content") {
|
|
467
797
|
const opts = parseSkillContentArgs(rest);
|
|
468
798
|
if (opts.fetchRaw || opts.output) {
|
|
@@ -533,6 +863,64 @@ export async function runSkillCommand(args) {
|
|
|
533
863
|
console.log(`Installed ${opts.skillId} to ${result.directory}`);
|
|
534
864
|
return 0;
|
|
535
865
|
}
|
|
866
|
+
if (subcommand === "management-content") {
|
|
867
|
+
const opts = parseManagementContentArgs(rest);
|
|
868
|
+
if (opts.fetchRaw || opts.responseMode === "content" || opts.output) {
|
|
869
|
+
const result = await getSkillManagementContent({
|
|
870
|
+
...token,
|
|
871
|
+
businessDomain: opts.businessDomain,
|
|
872
|
+
skillId: opts.skillId,
|
|
873
|
+
responseMode: opts.responseMode,
|
|
874
|
+
});
|
|
875
|
+
if (opts.output && result.content) {
|
|
876
|
+
ensureDirectoryForFile(resolve(opts.output));
|
|
877
|
+
writeFileSync(resolve(opts.output), result.content, "utf8");
|
|
878
|
+
console.log(`Saved ${opts.skillId} management content to ${resolve(opts.output)}`);
|
|
879
|
+
}
|
|
880
|
+
else if (opts.fetchRaw && result.content) {
|
|
881
|
+
process.stdout.write(result.content);
|
|
882
|
+
if (!result.content.endsWith("\n"))
|
|
883
|
+
process.stdout.write("\n");
|
|
884
|
+
}
|
|
885
|
+
else {
|
|
886
|
+
console.log(format(result, opts.pretty));
|
|
887
|
+
}
|
|
888
|
+
return 0;
|
|
889
|
+
}
|
|
890
|
+
const result = await getSkillManagementContent({
|
|
891
|
+
...token,
|
|
892
|
+
businessDomain: opts.businessDomain,
|
|
893
|
+
skillId: opts.skillId,
|
|
894
|
+
responseMode: opts.responseMode,
|
|
895
|
+
});
|
|
896
|
+
console.log(format(result, opts.pretty));
|
|
897
|
+
return 0;
|
|
898
|
+
}
|
|
899
|
+
if (subcommand === "management-read-file") {
|
|
900
|
+
const opts = parseManagementReadFileArgs(rest);
|
|
901
|
+
const result = await readSkillManagementFile({
|
|
902
|
+
...token,
|
|
903
|
+
businessDomain: opts.businessDomain,
|
|
904
|
+
skillId: opts.skillId,
|
|
905
|
+
relPath: opts.relPath,
|
|
906
|
+
});
|
|
907
|
+
console.log(format(result, opts.pretty));
|
|
908
|
+
return 0;
|
|
909
|
+
}
|
|
910
|
+
if (subcommand === "management-download") {
|
|
911
|
+
const opts = parseManagementDownloadArgs(rest);
|
|
912
|
+
const result = await downloadSkillManagementArchive({
|
|
913
|
+
...token,
|
|
914
|
+
businessDomain: opts.businessDomain,
|
|
915
|
+
skillId: opts.skillId,
|
|
916
|
+
responseMode: opts.responseMode,
|
|
917
|
+
});
|
|
918
|
+
const output = resolve(opts.output ?? result.fileName);
|
|
919
|
+
ensureDirectoryForFile(output);
|
|
920
|
+
writeFileSync(output, result.bytes);
|
|
921
|
+
console.log(`Saved ${opts.skillId} management archive to ${output}`);
|
|
922
|
+
return 0;
|
|
923
|
+
}
|
|
536
924
|
console.error(`Unknown skill subcommand: ${subcommand}`);
|
|
537
925
|
return 1;
|
|
538
926
|
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export interface ParsedTraceArgs {
|
|
2
|
+
subcommand: "diagnose" | "rules-validate" | "eval-set-build" | "eval-set-test" | "schema-validate" | "help";
|
|
3
|
+
mode?: "single" | "batch";
|
|
4
|
+
conversationId?: string;
|
|
5
|
+
traces?: string;
|
|
6
|
+
rulePath?: string;
|
|
7
|
+
out: string | null;
|
|
8
|
+
rulesDir: string | null;
|
|
9
|
+
noBuiltin: boolean;
|
|
10
|
+
noLlm: boolean;
|
|
11
|
+
noArtifacts: boolean;
|
|
12
|
+
maxParallel: number;
|
|
13
|
+
format: 'yaml' | 'markdown' | 'both' | null;
|
|
14
|
+
lang: 'en' | 'zh' | null;
|
|
15
|
+
baseUrl: string | null;
|
|
16
|
+
token: string | null;
|
|
17
|
+
businessDomain: string | null;
|
|
18
|
+
queriesPath?: string;
|
|
19
|
+
diagnosisPath?: string;
|
|
20
|
+
onConflict?: "fail" | "skip" | "overwrite";
|
|
21
|
+
redactionRules?: string;
|
|
22
|
+
evalSetId?: string;
|
|
23
|
+
schemaValidatePath?: string;
|
|
24
|
+
schemaKind?: string;
|
|
25
|
+
evalSetPath?: string;
|
|
26
|
+
candidateAgentId?: string;
|
|
27
|
+
candidateAgentVersion?: string;
|
|
28
|
+
}
|
|
29
|
+
export declare function parseTraceArgs(argv: string[]): ParsedTraceArgs;
|
|
30
|
+
export declare function runTraceCommand(rest: string[]): Promise<number>;
|
|
31
|
+
export declare class SchemaKindRequiredError extends Error {
|
|
32
|
+
constructor(filePath: string);
|
|
33
|
+
}
|
|
34
|
+
export declare function inferKind(filePath: string): string | null;
|
|
35
|
+
export interface RunSchemaValidateOpts {
|
|
36
|
+
filePath: string;
|
|
37
|
+
kind: string | undefined;
|
|
38
|
+
}
|
|
39
|
+
export declare function runSchemaValidate(opts: RunSchemaValidateOpts): Promise<number>;
|