@webskill/sdk 0.0.1 → 0.0.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 +16 -13
- package/dist/browser.d.ts +1 -1
- package/dist/browser.js +1 -1
- package/dist/{dist-9fczg9Pa.js → dist-BMioPPri.js} +203 -3
- package/dist/{dist-B_ldNWwT.js → dist-BbyIk4vG.js} +38 -5
- package/dist/governance.d.ts +2 -2
- package/dist/governance.js +2 -2
- package/dist/{index-Bq-bTWh3.d.ts → index-DF5ea732.d.ts} +15 -2
- package/dist/{index-88KNOnbr.d.ts → index-j3Z3hbDk.d.ts} +19 -5
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/mcp.d.ts +1 -1
- package/dist/mcp.js +1 -1
- package/dist/node.d.ts +3 -3
- package/dist/node.js +3 -3
- package/dist/ui-react.d.ts +1 -1
- package/dist/ui-vue.d.ts +1 -1
- package/dist/ui.d.ts +1 -1
- package/dist/ui.js +1 -1
- package/package.json +5 -2
package/README.md
CHANGED
|
@@ -47,15 +47,18 @@ const runtime = new WebSkillRuntime({
|
|
|
47
47
|
llm: new OpenAiCompatibleClient({
|
|
48
48
|
baseUrl: 'https://your-llm-endpoint/v1',
|
|
49
49
|
apiKey: process.env.LLM_API_KEY!,
|
|
50
|
-
model: 'your-model'
|
|
50
|
+
model: 'your-model'
|
|
51
51
|
}),
|
|
52
52
|
executor: new NodeScriptExecutor(new NodeFS()),
|
|
53
|
-
artifactStore: new FileArtifactStore({ root: './.webskill/artifacts' })
|
|
53
|
+
artifactStore: new FileArtifactStore({ root: './.webskill/artifacts' })
|
|
54
54
|
});
|
|
55
55
|
|
|
56
56
|
// Discover skills and render the catalog
|
|
57
57
|
const { entries, issues } = await runtime.discover();
|
|
58
|
-
console.log(
|
|
58
|
+
console.log(
|
|
59
|
+
entries.map((e) => e.name),
|
|
60
|
+
issues
|
|
61
|
+
);
|
|
59
62
|
|
|
60
63
|
// Run the agent loop
|
|
61
64
|
const { output, run } = await runtime.run('Use the calculator skill to compute 2+3.');
|
|
@@ -64,16 +67,16 @@ console.log(output, run.status, run.trace.length);
|
|
|
64
67
|
|
|
65
68
|
## Subpath exports
|
|
66
69
|
|
|
67
|
-
| Subpath
|
|
68
|
-
|
|
|
69
|
-
| `@webskill/sdk`
|
|
70
|
-
| `@webskill/sdk/node`
|
|
71
|
-
| `@webskill/sdk/browser`
|
|
72
|
-
| `@webskill/sdk/mcp`
|
|
73
|
-
| `@webskill/sdk/ui`
|
|
74
|
-
| `@webskill/sdk/ui-react`
|
|
75
|
-
| `@webskill/sdk/ui-vue`
|
|
76
|
-
| `@webskill/sdk/governance` | Candidates, approval, audit, versioning, state policy, evaluation, scoring, documents
|
|
70
|
+
| Subpath | Contents |
|
|
71
|
+
| -------------------------- | -------------------------------------------------------------------------------------------------------------------- |
|
|
72
|
+
| `@webskill/sdk` | Core protocol + runtime engine (discovery, agent loop, LLM clients, routing, interaction, memory, artifacts, trace) |
|
|
73
|
+
| `@webskill/sdk/node` | Node host: NodeFS, script executors (in-process + sandboxed), file stores, skill manager, CLI UI bridge, env helpers |
|
|
74
|
+
| `@webskill/sdk/browser` | Browser host: OPFS provider, Web Worker script sandbox, worker runtime host/client |
|
|
75
|
+
| `@webskill/sdk/mcp` | MCP transports, endpoint registry, tool resolver, temporary skills, WebMCP adapter, runtime plugin |
|
|
76
|
+
| `@webskill/sdk/ui` | Framework-agnostic forms, result rendering, mini markdown, Vercel/OpenUI/A2UI adapters, A2UI Lit runtime |
|
|
77
|
+
| `@webskill/sdk/ui-react` | React bridge state + InteractionForm/ResultBlocks/StreamingText components |
|
|
78
|
+
| `@webskill/sdk/ui-vue` | Vue bridge state + equivalent components |
|
|
79
|
+
| `@webskill/sdk/governance` | Candidates, approval, audit, versioning, state policy, evaluation, scoring, documents |
|
|
77
80
|
|
|
78
81
|
## Requirements
|
|
79
82
|
|
package/dist/browser.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as InteractionRequest, M as LlmResponse, Mt as
|
|
1
|
+
import { C as InteractionRequest, M as LlmResponse, Mt as FileStat, N as LlmStreamEvent, Nt as FileSystemProvider, S as InteractionPolicy, Tt as parseBridgeRequest, X as RenderResultRequest, at as ScriptExecutor, d as BridgeResponse, it as ScriptExecutionContext, k as LlmClient, l as BridgeCapabilities, lt as ToolResult, m as ExternalToolSource, mt as UiBridge, p as ExternalSkillProvider, st as ToolDefinition, u as BridgeRequest, vt as bridgeError, w as InteractionResponse } from "./index-j3Z3hbDk.js";
|
|
2
2
|
//#region ../browser/dist/index.d.ts
|
|
3
3
|
//#region src/fs/featureDetection.d.ts
|
|
4
4
|
/** 检测当前环境是否可用 OPFS(navigator.storage.getDirectory) */
|
package/dist/browser.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as normalizeToolContent, E as mergeCatalogEntries, I as SkillDiscovery, O as parseBridgeRequest, R as WebSkillError, f as MockLlmClient, h as ProgressiveRouter, i as AgentLoop, m as OpenAiCompatibleClient, o as FsArtifactStore, s as FsMemoryStore, x as bridgeError, z as buildCatalog } from "./dist-
|
|
1
|
+
import { D as normalizeToolContent, E as mergeCatalogEntries, I as SkillDiscovery, O as parseBridgeRequest, R as WebSkillError, f as MockLlmClient, h as ProgressiveRouter, i as AgentLoop, m as OpenAiCompatibleClient, o as FsArtifactStore, s as FsMemoryStore, x as bridgeError, z as buildCatalog } from "./dist-BbyIk4vG.js";
|
|
2
2
|
|
|
3
3
|
//#region ../browser/dist/index.js
|
|
4
4
|
/** 检测当前环境是否可用 OPFS(navigator.storage.getDirectory) */
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { D as normalizeToolContent, G as parseSkillMarkdown, H as isValidSkillName, J as resolveInsideRoot, O as parseBridgeRequest, R as WebSkillError, Y as validateSkills, o as FsArtifactStore, s as FsMemoryStore, x as bridgeError } from "./dist-
|
|
1
|
+
import { D as normalizeToolContent, G as parseSkillMarkdown, H as isValidSkillName, J as resolveInsideRoot, O as parseBridgeRequest, R as WebSkillError, Y as validateSkills, o as FsArtifactStore, s as FsMemoryStore, x as bridgeError } from "./dist-BbyIk4vG.js";
|
|
2
2
|
import { existsSync, promises, readFileSync } from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
5
5
|
import { format, promisify } from "node:util";
|
|
6
6
|
import { Worker } from "node:worker_threads";
|
|
7
|
+
import { parseSync } from "oxc-parser";
|
|
7
8
|
import { createInterface } from "node:readline/promises";
|
|
8
9
|
import { mkdtemp } from "node:fs/promises";
|
|
9
10
|
import { tmpdir } from "node:os";
|
|
@@ -416,6 +417,178 @@ var SandboxedScriptExecutor = class {
|
|
|
416
417
|
}
|
|
417
418
|
}
|
|
418
419
|
};
|
|
420
|
+
const PLACEHOLDER_PREFIX = "Inferred placeholder (unsupported type: ";
|
|
421
|
+
const placeholder = (text) => ({
|
|
422
|
+
type: "string",
|
|
423
|
+
description: `${PLACEHOLDER_PREFIX}${text})`,
|
|
424
|
+
"x-inferred": true
|
|
425
|
+
});
|
|
426
|
+
/** 主路径映射:基础类型/数组/嵌套对象/可选/字面量 union;其余降级 placeholder */
|
|
427
|
+
var TypeMapper = class {
|
|
428
|
+
#decls = /* @__PURE__ */ new Map();
|
|
429
|
+
#source;
|
|
430
|
+
constructor(body, source) {
|
|
431
|
+
this.#source = source;
|
|
432
|
+
for (const node of body) {
|
|
433
|
+
if (node.type === "TSInterfaceDeclaration" || node.type === "TSTypeAliasDeclaration") this.#decls.set(node.id?.name, node);
|
|
434
|
+
if (node.type === "ExportNamedDeclaration" && (node.declaration?.type === "TSInterfaceDeclaration" || node.declaration?.type === "TSTypeAliasDeclaration")) this.#decls.set(node.declaration.id?.name, node.declaration);
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
objectSchema(t, seen) {
|
|
438
|
+
const mapped = this.map(t, seen);
|
|
439
|
+
return mapped?.type === "object" ? mapped : void 0;
|
|
440
|
+
}
|
|
441
|
+
map(t, seen) {
|
|
442
|
+
if (!t) return void 0;
|
|
443
|
+
switch (t.type) {
|
|
444
|
+
case "TSStringKeyword": return { type: "string" };
|
|
445
|
+
case "TSNumberKeyword": return { type: "number" };
|
|
446
|
+
case "TSBooleanKeyword": return { type: "boolean" };
|
|
447
|
+
case "TSAnyKeyword":
|
|
448
|
+
case "TSUnknownKeyword": return {};
|
|
449
|
+
case "TSArrayType": return {
|
|
450
|
+
type: "array",
|
|
451
|
+
items: this.map(t.elementType, seen) ?? {}
|
|
452
|
+
};
|
|
453
|
+
case "TSTypeLiteral": return this.#literalObject(t, seen);
|
|
454
|
+
case "TSLiteralType": return this.#literal(t);
|
|
455
|
+
case "TSUnionType": return this.#union(t, seen);
|
|
456
|
+
case "TSTypeReference": return this.#reference(t, seen);
|
|
457
|
+
case "TSParenthesizedType": return this.map(t.typeAnnotation, seen);
|
|
458
|
+
default: return placeholder(this.#text(t));
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
#literal(t) {
|
|
462
|
+
const value = t.literal?.value ?? t.value;
|
|
463
|
+
if (typeof value === "string") return {
|
|
464
|
+
type: "string",
|
|
465
|
+
enum: [value]
|
|
466
|
+
};
|
|
467
|
+
return placeholder(this.#text(t));
|
|
468
|
+
}
|
|
469
|
+
#union(t, seen) {
|
|
470
|
+
const values = [];
|
|
471
|
+
for (const member of t.types ?? []) {
|
|
472
|
+
const value = member.literal?.value ?? member.value;
|
|
473
|
+
if (member.type === "TSLiteralType" && typeof value === "string") values.push(value);
|
|
474
|
+
else return placeholder(this.#text(t));
|
|
475
|
+
}
|
|
476
|
+
return {
|
|
477
|
+
type: "string",
|
|
478
|
+
enum: values
|
|
479
|
+
};
|
|
480
|
+
}
|
|
481
|
+
#literalObject(t, seen) {
|
|
482
|
+
const properties = {};
|
|
483
|
+
const required = [];
|
|
484
|
+
for (const member of t.members ?? []) {
|
|
485
|
+
if (member.type !== "TSPropertySignature") continue;
|
|
486
|
+
const name = member.key?.name ?? member.key?.value;
|
|
487
|
+
if (typeof name !== "string") continue;
|
|
488
|
+
const annotation = member.typeAnnotation?.typeAnnotation;
|
|
489
|
+
properties[name] = annotation ? this.map(annotation, seen) ?? {} : { type: "string" };
|
|
490
|
+
if (!member.optional) required.push(name);
|
|
491
|
+
}
|
|
492
|
+
return {
|
|
493
|
+
type: "object",
|
|
494
|
+
properties,
|
|
495
|
+
...required.length ? { required } : {}
|
|
496
|
+
};
|
|
497
|
+
}
|
|
498
|
+
#reference(t, seen) {
|
|
499
|
+
const name = t.typeName?.name ?? t.typeName?.left?.name;
|
|
500
|
+
const params = t.typeArguments?.params ?? t.typeParameters?.params ?? [];
|
|
501
|
+
if (name === "Array" && params.length === 1) return {
|
|
502
|
+
type: "array",
|
|
503
|
+
items: this.map(params[0], seen) ?? {}
|
|
504
|
+
};
|
|
505
|
+
if (name === "string" || name === "number" || name === "boolean") return { type: name };
|
|
506
|
+
if (!name || params.length > 0) return placeholder(this.#text(t));
|
|
507
|
+
if (seen.has(name)) return placeholder(`recursive reference ${name}`);
|
|
508
|
+
const decl = this.#decls.get(name);
|
|
509
|
+
if (!decl) return placeholder(this.#text(t));
|
|
510
|
+
const nextSeen = new Set(seen).add(name);
|
|
511
|
+
if (decl.type === "TSInterfaceDeclaration") return this.#literalObject({ members: decl.body?.body ?? [] }, nextSeen);
|
|
512
|
+
return this.map(decl.typeAnnotation, nextSeen) ?? placeholder(this.#text(t));
|
|
513
|
+
}
|
|
514
|
+
#text(t) {
|
|
515
|
+
if (typeof t.start === "number" && typeof t.end === "number") return this.#source.slice(t.start, t.end);
|
|
516
|
+
return String(t.type);
|
|
517
|
+
}
|
|
518
|
+
};
|
|
519
|
+
const findRunFunction = (body) => {
|
|
520
|
+
for (const node of body) {
|
|
521
|
+
if (node.type !== "ExportNamedDeclaration") continue;
|
|
522
|
+
const decl = node.declaration;
|
|
523
|
+
if (!decl) continue;
|
|
524
|
+
if (decl.type === "FunctionDeclaration" && decl.id?.name === "run") return decl;
|
|
525
|
+
if (decl.type === "VariableDeclaration") {
|
|
526
|
+
for (const d of decl.declarations ?? []) if (d.id?.name === "run" && (d.init?.type === "ArrowFunctionExpression" || d.init?.type === "FunctionExpression")) return d.init;
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
};
|
|
530
|
+
/** JSDoc 辅路径:@param {type} input.name - desc(点形式)与 @param {{...}} input(对象形式) */
|
|
531
|
+
function inferFromJsDoc(jsdoc, mapper, reparse) {
|
|
532
|
+
const properties = {};
|
|
533
|
+
const required = [];
|
|
534
|
+
const objectForm = /@param\s+\{\{([\s\S]+?)\}\}\s+input(?:\s+-\s+(.*))?/.exec(jsdoc);
|
|
535
|
+
if (objectForm) {
|
|
536
|
+
const alias = reparse(`{${objectForm[1]}}`);
|
|
537
|
+
if (!alias) return void 0;
|
|
538
|
+
const schema = mapper.map(alias, /* @__PURE__ */ new Set());
|
|
539
|
+
return schema?.type === "object" ? schema : void 0;
|
|
540
|
+
}
|
|
541
|
+
const dotForm = /@param\s+\{([^}]+)\}\s+input\.(\w+)(?:\s+-\s+([^\n*]+))?/g;
|
|
542
|
+
let matched = false;
|
|
543
|
+
for (const m of jsdoc.matchAll(dotForm)) {
|
|
544
|
+
const [, typeText, name, desc] = m;
|
|
545
|
+
if (!typeText || !name) continue;
|
|
546
|
+
matched = true;
|
|
547
|
+
const alias = reparse(typeText.trim());
|
|
548
|
+
const schema = alias ? mapper.map(alias, /* @__PURE__ */ new Set()) ?? {} : { type: "string" };
|
|
549
|
+
if (desc?.trim()) schema.description = desc.trim();
|
|
550
|
+
properties[name] = schema;
|
|
551
|
+
required.push(name);
|
|
552
|
+
}
|
|
553
|
+
if (!matched) return void 0;
|
|
554
|
+
return {
|
|
555
|
+
type: "object",
|
|
556
|
+
properties,
|
|
557
|
+
required
|
|
558
|
+
};
|
|
559
|
+
}
|
|
560
|
+
/**
|
|
561
|
+
* D2 Schema 推导(OXC 静态文本分析,宿主侧执行,不进沙箱)。
|
|
562
|
+
* TS 类型标注为主路径,JSDoc @param 为辅路径;不支持类型降级 string 并标 'x-inferred'。
|
|
563
|
+
*/
|
|
564
|
+
var OxcSchemaInferer = class {
|
|
565
|
+
inferSchemaFromSource(source, options) {
|
|
566
|
+
let program;
|
|
567
|
+
let comments;
|
|
568
|
+
try {
|
|
569
|
+
const result = parseSync(options?.fileName ?? "script.ts", source);
|
|
570
|
+
if (result.errors?.length > 0) return void 0;
|
|
571
|
+
program = result.program;
|
|
572
|
+
comments = result.comments ?? [];
|
|
573
|
+
} catch {
|
|
574
|
+
return;
|
|
575
|
+
}
|
|
576
|
+
const runFn = findRunFunction(program.body ?? []);
|
|
577
|
+
if (!runFn) return void 0;
|
|
578
|
+
const annotation = (runFn.params?.[0] ?? runFn.params?.items?.[0])?.typeAnnotation?.typeAnnotation;
|
|
579
|
+
const mapper = new TypeMapper(program.body ?? [], source);
|
|
580
|
+
if (annotation) return mapper.objectSchema(annotation, /* @__PURE__ */ new Set());
|
|
581
|
+
const runStart = runFn.start ?? Number.MAX_SAFE_INTEGER;
|
|
582
|
+
const jsdoc = comments.filter((c) => c.type === "Block" && typeof c.value === "string" && c.value.includes("@param") && typeof c.end === "number" && c.end <= runStart).sort((a, b) => b.end - a.end)[0];
|
|
583
|
+
if (!jsdoc) return void 0;
|
|
584
|
+
const reparse = (typeText) => {
|
|
585
|
+
const r = parseSync("__t.ts", `type __T = ${typeText};`);
|
|
586
|
+
if (r.errors?.length > 0) return void 0;
|
|
587
|
+
return r.program.body.find((n) => n.type === "TSTypeAliasDeclaration")?.typeAnnotation;
|
|
588
|
+
};
|
|
589
|
+
return inferFromJsDoc(jsdoc.value, mapper, reparse);
|
|
590
|
+
}
|
|
591
|
+
};
|
|
419
592
|
/**
|
|
420
593
|
* FileArtifactStore:兼容别名,语义同阶段 2-4。
|
|
421
594
|
* 实现已上移到 runtime 的 FsArtifactStore;node 侧保留 NodeFS 默认值。
|
|
@@ -920,10 +1093,13 @@ var SkillManager = class {
|
|
|
920
1093
|
#managedRoot;
|
|
921
1094
|
#fs;
|
|
922
1095
|
#fetchImpl;
|
|
1096
|
+
#schemaInference;
|
|
1097
|
+
#schemaInferer = new OxcSchemaInferer();
|
|
923
1098
|
constructor(deps) {
|
|
924
1099
|
this.#managedRoot = deps.managedRoot.replace(/\/+$/, "");
|
|
925
1100
|
this.#fs = deps.fs ?? new NodeFS();
|
|
926
1101
|
this.#fetchImpl = deps.fetchImpl;
|
|
1102
|
+
this.#schemaInference = deps.schemaInference ?? true;
|
|
927
1103
|
}
|
|
928
1104
|
async install(source, options) {
|
|
929
1105
|
const fs = this.#fs;
|
|
@@ -971,6 +1147,7 @@ var SkillManager = class {
|
|
|
971
1147
|
targetDir = `${this.#managedRoot}/${name}`;
|
|
972
1148
|
if (await fs.exists(targetDir)) await fs.remove(targetDir, { recursive: true });
|
|
973
1149
|
await copyDir(fs, finalDir, targetDir);
|
|
1150
|
+
await this.#inferSkillSchemas(targetDir);
|
|
974
1151
|
const manifest = await createManifest(fs, targetDir, {
|
|
975
1152
|
name,
|
|
976
1153
|
...version ? { version } : {},
|
|
@@ -990,6 +1167,28 @@ var SkillManager = class {
|
|
|
990
1167
|
await removeDirQuiet(fs, stagingRoot);
|
|
991
1168
|
}
|
|
992
1169
|
}
|
|
1170
|
+
/**
|
|
1171
|
+
* D2 安装期预推导:scripts/ 下无显式 inputSchema 导出且无 sidecar 的脚本,
|
|
1172
|
+
* 经 OXC 推导写 sidecar(计入 manifest.files;重装重新生成)
|
|
1173
|
+
*/
|
|
1174
|
+
async #inferSkillSchemas(skillRoot) {
|
|
1175
|
+
if (!this.#schemaInference) return;
|
|
1176
|
+
const fs = this.#fs;
|
|
1177
|
+
const scriptsDir = `${skillRoot}/scripts`;
|
|
1178
|
+
if (!await fs.exists(scriptsDir)) return;
|
|
1179
|
+
for (const entry of await fs.list(scriptsDir)) {
|
|
1180
|
+
if (entry.type !== "file") continue;
|
|
1181
|
+
const match = /^(.*)\.(ts|js)$/.exec(entry.path.split("/").pop() ?? "");
|
|
1182
|
+
if (!match?.[1]) continue;
|
|
1183
|
+
const scriptName = match[1];
|
|
1184
|
+
const sidecar = `${scriptsDir}/${scriptName}.schema.json`;
|
|
1185
|
+
if (await fs.exists(sidecar)) continue;
|
|
1186
|
+
const source = await fs.readText(entry.path);
|
|
1187
|
+
if (/export\s+(?:const|let|var)\s+inputSchema/.test(source)) continue;
|
|
1188
|
+
const inferred = this.#schemaInferer.inferSchemaFromSource(source, { fileName: `${scriptName}.${match[2]}` });
|
|
1189
|
+
if (inferred) await fs.writeText(sidecar, JSON.stringify(inferred, null, 2));
|
|
1190
|
+
}
|
|
1191
|
+
}
|
|
993
1192
|
async uninstall(name) {
|
|
994
1193
|
if (!isValidSkillName(name)) throw new WebSkillError("UNINSTALL_FAILED", `Invalid skill name (path traversal rejected): ${JSON.stringify(name)}`);
|
|
995
1194
|
const targetDir = `${this.#managedRoot}/${name}`;
|
|
@@ -1099,7 +1298,8 @@ async function doProbeLlmCapabilities(config) {
|
|
|
1099
1298
|
}),
|
|
1100
1299
|
signal: AbortSignal.timeout(15e3)
|
|
1101
1300
|
});
|
|
1102
|
-
|
|
1301
|
+
const contentType = res.headers.get("content-type") ?? "";
|
|
1302
|
+
if (res.ok && !contentType.includes("text/event-stream")) return {
|
|
1103
1303
|
available: true,
|
|
1104
1304
|
nonStreaming: true
|
|
1105
1305
|
};
|
|
@@ -1119,4 +1319,4 @@ async function doProbeLlmCapabilities(config) {
|
|
|
1119
1319
|
}
|
|
1120
1320
|
|
|
1121
1321
|
//#endregion
|
|
1122
|
-
export { NodeScriptExecutor as a,
|
|
1322
|
+
export { NodeScriptExecutor as a, SKILL_MANIFEST_FILE as c, loadLlmConfigFromEnv as d, probeLlmCapabilities as f, NodeFS as i, SandboxedScriptExecutor as l, FileArtifactStore as n, OxcSchemaInferer as o, readArchiveManifest as p, FileMemoryStore as r, SKILLS_LOCKFILE as s, CliUiBridge as t, SkillManager as u };
|
|
@@ -182,6 +182,8 @@ function isValidSkillName(name) {
|
|
|
182
182
|
return name.length <= 64 && SKILL_NAME_PATTERN.test(name);
|
|
183
183
|
}
|
|
184
184
|
const SCRIPT_EXTENSION_RE = /\.(ts|js)$/;
|
|
185
|
+
/** D2 schema sidecar(scripts/<name>.schema.json)属于协议内文件,不算非法脚本 */
|
|
186
|
+
const SCHEMA_SIDECAR_RE = /\.schema\.json$/;
|
|
185
187
|
/**
|
|
186
188
|
* 技能合规规则的唯一实现。SkillDiscovery 与 validateSkills 都必须调用本函数,
|
|
187
189
|
* 禁止各自重复实现规则(避免两套规则漂移)。
|
|
@@ -217,10 +219,10 @@ function checkSkillRules(input) {
|
|
|
217
219
|
message: `Duplicate skill name ${JSON.stringify(metadata.name)}`
|
|
218
220
|
});
|
|
219
221
|
}
|
|
220
|
-
for (const fileName of input.scriptFileNames ?? []) if (!SCRIPT_EXTENSION_RE.test(fileName)) issues.push({
|
|
222
|
+
for (const fileName of input.scriptFileNames ?? []) if (!SCRIPT_EXTENSION_RE.test(fileName) && !SCHEMA_SIDECAR_RE.test(fileName)) issues.push({
|
|
221
223
|
code: "SKILL_UNSUPPORTED_SCRIPT",
|
|
222
224
|
severity: "error",
|
|
223
|
-
message: `Unsupported script file in scripts/ of directory ${dirName}: ${fileName} (only .ts/.js allowed)`
|
|
225
|
+
message: `Unsupported script file in scripts/ of directory ${dirName}: ${fileName} (only .ts/.js and .schema.json sidecars allowed)`
|
|
224
226
|
});
|
|
225
227
|
return issues;
|
|
226
228
|
}
|
|
@@ -1329,7 +1331,10 @@ var AgentLoop = class {
|
|
|
1329
1331
|
#config;
|
|
1330
1332
|
#policy;
|
|
1331
1333
|
constructor(deps, config = {}) {
|
|
1332
|
-
this.#deps =
|
|
1334
|
+
this.#deps = {
|
|
1335
|
+
...deps,
|
|
1336
|
+
artifactStore: deps.artifactStore ?? new MemoryArtifactStore()
|
|
1337
|
+
};
|
|
1333
1338
|
this.#config = {
|
|
1334
1339
|
maxTurns: config.maxTurns ?? 10,
|
|
1335
1340
|
totalTimeoutMs: config.totalTimeoutMs ?? 12e4,
|
|
@@ -1344,7 +1349,8 @@ var AgentLoop = class {
|
|
|
1344
1349
|
};
|
|
1345
1350
|
}
|
|
1346
1351
|
async run(input) {
|
|
1347
|
-
const
|
|
1352
|
+
const llm = this.#deps.llm;
|
|
1353
|
+
const artifactStore = this.#deps.artifactStore;
|
|
1348
1354
|
const now = this.#deps.clock?.now ?? (() => (/* @__PURE__ */ new Date()).toISOString());
|
|
1349
1355
|
const runId = input.runId ?? `run-${Math.random().toString(36).slice(2, 10)}`;
|
|
1350
1356
|
const trace = new TraceRecorder(runId, this.#deps.clock);
|
|
@@ -1734,6 +1740,8 @@ var AgentLoop = class {
|
|
|
1734
1740
|
await this.#writeActivationMemory(skillName, state);
|
|
1735
1741
|
const root = this.#deps.skillIndex.get(skillName);
|
|
1736
1742
|
if (!root) return "";
|
|
1743
|
+
const executor = this.#deps.executor;
|
|
1744
|
+
if (!executor) return "";
|
|
1737
1745
|
const loaded = [];
|
|
1738
1746
|
let scriptFiles = [];
|
|
1739
1747
|
try {
|
|
@@ -1745,13 +1753,36 @@ var AgentLoop = class {
|
|
|
1745
1753
|
const match = /^(.*)\.(ts|js)$/.exec(file);
|
|
1746
1754
|
if (!match?.[1]) continue;
|
|
1747
1755
|
try {
|
|
1748
|
-
const def = await
|
|
1756
|
+
const def = await executor.loadDefinition(root, match[1]);
|
|
1757
|
+
await this.#enrichDefinition(root, match[1], def, state);
|
|
1749
1758
|
state.activatedTools.set(def.name, def);
|
|
1750
1759
|
loaded.push(def.name);
|
|
1751
1760
|
} catch {}
|
|
1752
1761
|
}
|
|
1753
1762
|
return loaded.length ? `\n\nActivated tools: ${loaded.join(", ")}` : "";
|
|
1754
1763
|
}
|
|
1764
|
+
/**
|
|
1765
|
+
* D2 Schema 兜底链(同一 run 内激活时只算一次):
|
|
1766
|
+
* 显式 inputSchema > sidecar scripts/<name>.schema.json > schemaInferer 推导 > schemaUnavailable
|
|
1767
|
+
*/
|
|
1768
|
+
async #enrichDefinition(skillRoot, scriptName, def, state) {
|
|
1769
|
+
if (def.inputSchema) return;
|
|
1770
|
+
const sidecar = `${skillRoot}/scripts/${scriptName}.schema.json`;
|
|
1771
|
+
if (await this.#deps.fs.exists(sidecar)) try {
|
|
1772
|
+
def.inputSchema = JSON.parse(await this.#deps.fs.readText(sidecar));
|
|
1773
|
+
return;
|
|
1774
|
+
} catch (e) {
|
|
1775
|
+
state.trace.record("run.warning", { message: `Failed to parse schema sidecar ${sidecar}: ${messageOf(e)}` });
|
|
1776
|
+
}
|
|
1777
|
+
if (!this.#deps.schemaInferer) return;
|
|
1778
|
+
for (const ext of ["ts", "js"]) {
|
|
1779
|
+
const scriptPath = `${skillRoot}/scripts/${scriptName}.${ext}`;
|
|
1780
|
+
if (!await this.#deps.fs.exists(scriptPath)) continue;
|
|
1781
|
+
const inferred = this.#deps.schemaInferer.inferSchemaFromSource(await this.#deps.fs.readText(scriptPath), { fileName: `${scriptName}.${ext}` });
|
|
1782
|
+
if (inferred) def.inputSchema = inferred;
|
|
1783
|
+
return;
|
|
1784
|
+
}
|
|
1785
|
+
}
|
|
1755
1786
|
async #handleScriptTool(call, skillName, scriptName, state) {
|
|
1756
1787
|
const root = this.#deps.skillIndex.get(skillName);
|
|
1757
1788
|
if (!root) return toolError("TOOL_NOT_FOUND", `Skill "${skillName}" is not in the catalog`);
|
|
@@ -1776,6 +1807,7 @@ var AgentLoop = class {
|
|
|
1776
1807
|
if (e instanceof BridgeRequestError) return toolError("UI_UNAVAILABLE", `Parameter form failed: ${e.message}`);
|
|
1777
1808
|
throw e;
|
|
1778
1809
|
}
|
|
1810
|
+
if (!this.#deps.executor) return toolError("TOOL_UNSUPPORTED", `No script executor is configured; script tool "${call.name}" cannot run`);
|
|
1779
1811
|
const context = createScriptContext({
|
|
1780
1812
|
fs: this.#deps.fs,
|
|
1781
1813
|
artifactStore: this.#deps.artifactStore,
|
|
@@ -1937,6 +1969,7 @@ var WebSkillRuntime = class {
|
|
|
1937
1969
|
const result = await new AgentLoop({
|
|
1938
1970
|
llm: this.#deps.llm,
|
|
1939
1971
|
executor: this.#deps.executor,
|
|
1972
|
+
schemaInferer: this.#deps.schemaInferer,
|
|
1940
1973
|
artifactStore: this.#deps.artifactStore,
|
|
1941
1974
|
fs: this.#deps.fs,
|
|
1942
1975
|
skillIndex: cache.index,
|
package/dist/governance.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Nt as FileSystemProvider, gt as WebSkillRuntime, j as LlmMessage, k as LlmClient, mt as UiBridge, tt as RuntimeRun, zt as SkillCatalogEntry } from "./index-j3Z3hbDk.js";
|
|
2
|
+
import { m as SkillManifest, p as SkillManager } from "./index-DF5ea732.js";
|
|
3
3
|
//#region ../governance/dist/index.d.ts
|
|
4
4
|
//#region src/types.d.ts
|
|
5
5
|
type CandidateStatus = 'draft' | 'pending-review' | 'approved' | 'published' | 'rejected';
|
package/dist/governance.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { H as isValidSkillName, J as resolveInsideRoot, R as WebSkillError, Y as validateSkills } from "./dist-
|
|
2
|
-
import { i as NodeFS } from "./dist-
|
|
1
|
+
import { H as isValidSkillName, J as resolveInsideRoot, R as WebSkillError, Y as validateSkills } from "./dist-BbyIk4vG.js";
|
|
2
|
+
import { i as NodeFS } from "./dist-BMioPPri.js";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { mkdtemp } from "node:fs/promises";
|
|
5
5
|
import { tmpdir } from "node:os";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as InteractionRequest, Mt as FileSystemProvider, X as RenderResultRequest, _ as FsMemoryStore,
|
|
1
|
+
import { C as InteractionRequest, Mt as FileStat, Nt as FileSystemProvider, Pt as JsonSchema, X as RenderResultRequest, _ as FsMemoryStore, at as ScriptExecutor, g as FsArtifactStore, it as ScriptExecutionContext, l as BridgeCapabilities, lt as ToolResult, mt as UiBridge, rt as SchemaInferer, st as ToolDefinition, w as InteractionResponse } from "./index-j3Z3hbDk.js";
|
|
2
2
|
import { Readable, Writable } from "node:stream";
|
|
3
3
|
//#region ../node/dist/index.d.ts
|
|
4
4
|
//#region src/fs/nodeFs.d.ts
|
|
@@ -67,6 +67,17 @@ declare class SandboxedScriptExecutor implements ScriptExecutor {
|
|
|
67
67
|
}): Promise<ToolResult>;
|
|
68
68
|
}
|
|
69
69
|
//#endregion
|
|
70
|
+
//#region src/schema/oxcSchemaInferer.d.ts
|
|
71
|
+
/**
|
|
72
|
+
* D2 Schema 推导(OXC 静态文本分析,宿主侧执行,不进沙箱)。
|
|
73
|
+
* TS 类型标注为主路径,JSDoc @param 为辅路径;不支持类型降级 string 并标 'x-inferred'。
|
|
74
|
+
*/
|
|
75
|
+
declare class OxcSchemaInferer implements SchemaInferer {
|
|
76
|
+
inferSchemaFromSource(source: string, options?: {
|
|
77
|
+
fileName?: string;
|
|
78
|
+
}): JsonSchema | undefined;
|
|
79
|
+
}
|
|
80
|
+
//#endregion
|
|
70
81
|
//#region src/artifacts/fileArtifactStore.d.ts
|
|
71
82
|
/**
|
|
72
83
|
* FileArtifactStore:兼容别名,语义同阶段 2-4。
|
|
@@ -173,6 +184,8 @@ declare class SkillManager {
|
|
|
173
184
|
managedRoot: string;
|
|
174
185
|
fs?: FileSystemProvider;
|
|
175
186
|
fetchImpl?: typeof fetch;
|
|
187
|
+
/** D2 安装期 schema 预推导(默认 true,可关) */
|
|
188
|
+
schemaInference?: boolean;
|
|
176
189
|
});
|
|
177
190
|
install(source: SkillSource, options?: {
|
|
178
191
|
expectedSha256?: string;
|
|
@@ -216,4 +229,4 @@ interface LlmCapabilities {
|
|
|
216
229
|
*/
|
|
217
230
|
declare function probeLlmCapabilities(config: LlmEnvConfig): Promise<LlmCapabilities>;
|
|
218
231
|
//#endregion
|
|
219
|
-
export {
|
|
232
|
+
export { VerifyResult as _, LlmEnvConfig as a, readArchiveManifest as b, OxcSchemaInferer as c, SandboxOptions as d, SandboxedScriptExecutor as f, SkillsLockfile as g, SkillSource as h, LlmCapabilities as i, SKILLS_LOCKFILE as l, SkillManifest as m, FileArtifactStore as n, NodeFS as o, SkillManager as p, FileMemoryStore as r, NodeScriptExecutor as s, CliUiBridge as t, SKILL_MANIFEST_FILE as u, loadLlmConfigFromEnv as v, probeLlmCapabilities as y };
|
|
@@ -403,6 +403,12 @@ interface ScriptExecutionContext {
|
|
|
403
403
|
/** 脚本主动请求人在环确认;策略见 InteractionPolicy.confirmations */
|
|
404
404
|
confirm?(message: string): Promise<boolean>;
|
|
405
405
|
}
|
|
406
|
+
/** Schema 推导 port:纯文本静态分析脚本源码 → JSON Schema(best-effort) */
|
|
407
|
+
interface SchemaInferer {
|
|
408
|
+
inferSchemaFromSource(source: string, options?: {
|
|
409
|
+
fileName?: string;
|
|
410
|
+
}): JsonSchema | undefined;
|
|
411
|
+
}
|
|
406
412
|
interface ScriptExecutor {
|
|
407
413
|
loadDefinition(skillRoot: string, scriptName: string): Promise<ToolDefinition>;
|
|
408
414
|
execute(input: {
|
|
@@ -867,8 +873,12 @@ declare function mergeCatalogEntries(localEntries: SkillCatalogEntry[], provider
|
|
|
867
873
|
//#region src/engine/agentLoop.d.ts
|
|
868
874
|
interface AgentLoopDeps {
|
|
869
875
|
llm: LlmClient;
|
|
870
|
-
executor
|
|
871
|
-
|
|
876
|
+
/** 可选:无 executor 时激活技能照常但不注册脚本工具(调用回喂 TOOL_UNSUPPORTED) */
|
|
877
|
+
executor?: ScriptExecutor;
|
|
878
|
+
/** D2 Schema 推导 port(inputSchema 为空且 sidecar 缺失时的兜底) */
|
|
879
|
+
schemaInferer?: SchemaInferer;
|
|
880
|
+
/** 缺省 MemoryArtifactStore */
|
|
881
|
+
artifactStore?: ArtifactStore;
|
|
872
882
|
fs: FileSystemProvider;
|
|
873
883
|
/** name → skillRoot(来自发现结果) */
|
|
874
884
|
skillIndex: Map<string, string>;
|
|
@@ -915,8 +925,12 @@ interface WebSkillRuntimeDeps {
|
|
|
915
925
|
llm: LlmClient;
|
|
916
926
|
/** 缺省 ProgressiveRouter */
|
|
917
927
|
router?: SkillRouter;
|
|
918
|
-
|
|
919
|
-
|
|
928
|
+
/** 可选:缺省无脚本执行能力(脚本调用回喂 TOOL_UNSUPPORTED) */
|
|
929
|
+
executor?: ScriptExecutor;
|
|
930
|
+
/** D2 Schema 推导 port(node 侧 OxcSchemaInferer;浏览器经 sidecar 获取) */
|
|
931
|
+
schemaInferer?: SchemaInferer;
|
|
932
|
+
/** 缺省 MemoryArtifactStore */
|
|
933
|
+
artifactStore?: ArtifactStore;
|
|
920
934
|
config?: AgentLoopConfig;
|
|
921
935
|
model?: string;
|
|
922
936
|
uiBridge?: UiBridge;
|
|
@@ -952,4 +966,4 @@ declare class WebSkillRuntime {
|
|
|
952
966
|
run(userPrompt: string): Promise<RunResult>;
|
|
953
967
|
}
|
|
954
968
|
//#endregion
|
|
955
|
-
export { RunTerminationReason as $,
|
|
969
|
+
export { RunTerminationReason as $, isValidSkillName as $t, LlmCompleteInput as A, CatalogRenderer as At, MockLlmQueueItem as B, SkillDiscovery as Bt, InteractionRequest as C, mergeCatalogEntries as Ct, LifecycleHookContext as D, schemaToForm as Dt, LifecycleHook as E, resolveToolName as Et, LlmToolSpec as F, MemoryFS as Ft, ProgressiveRouter as G, SkillReader as Gt, MockUiBridge as H, SkillIssue as Ht, MemoryArtifactStore as I, SKILL_NAME_MAX_LENGTH as It, READ_SKILL_FILE_TOOL_NAME as J, WebSkillError as Jt, READ_SKILL_FILE_INPUT_SCHEMA as K, SkillSource as Kt, MemoryStore as L, SKILL_NAME_PATTERN as Lt, LlmResponse as M, FileStat as Mt, LlmStreamEvent as N, FileSystemProvider as Nt, LifecycleListener as O, toLlmToolSpec as Ot, LlmToolCall as P, JsonSchema as Pt, RunResult as Q, escapeXml as Qt, MockLlmClient as R, SkillCatalog as Rt, InteractionPolicy as S, fromVercelStreamPart as St, LifecycleEvent as T, parseBridgeRequest as Tt, OpenAiCompatibleClient as U, SkillLocation as Ut, MockUiAnswer as V, SkillDocument as Vt, OpenAiCompatibleClientConfig as W, SkillMetadata as Wt, RenderResultRequest as X, buildCatalog as Xt, RenderBlock as Y, WebSkillErrorCode as Yt, RouteResult as Z, checkSkillRules as Zt, FsMemoryStore as _, WebSkillRuntimeDeps as _t, AgentLoopConfig as a, resolveInsideRoot as an, ScriptExecutor as at, HookRunnerOptions as b, createScriptContext as bt, ArtifactStore as c, ToolResolution as ct, BridgeResponse as d, TraceEvent as dt, jsonRenderer as en, RuntimePhase as et, EventBus as f, TraceEventType as ft, FsArtifactStore as g, WebSkillRuntime as gt, FormField as h, VercelToolSpec as ht, AgentLoop as i, renderCatalogJson as in, ScriptExecutionContext as it, LlmMessage as j, DiscoveryResult as jt, LlmClient as k, toVercelToolSpecs as kt, BridgeCapabilities as l, ToolResult as lt, ExternalToolSource as m, UiBridge as mt, ASK_USER_TOOL as n, parseSkillMarkdown as nn, RuntimeSession as nt, AgentLoopDeps as o, validateSkills as on, SkillRouter as ot, ExternalSkillProvider as p, TraceRecorder as pt, READ_SKILL_FILE_TOOL as q, ValidationReport as qt, ASK_USER_TOOL_NAME as r, renderAvailableSkillsXml as rn, SchemaInferer as rt, Artifact as s, xmlRenderer as sn, ToolDefinition as st, ASK_USER_INPUT_SCHEMA as t, normalizePath as tn, RuntimeRun as tt, BridgeRequest as u, TraceClock as ut, FullDisclosureRouter as v, bridgeError as vt, InteractionResponse as w, normalizeToolContent as wt, InMemoryStore as x, fromVercelResult as xt, HookRunner as y, buildRenderResult as yt, MockLlmHandler as z, SkillCatalogEntry as zt };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as RunTerminationReason, $t as
|
|
2
|
-
export { ASK_USER_INPUT_SCHEMA, ASK_USER_TOOL, ASK_USER_TOOL_NAME, AgentLoop, type AgentLoopConfig, type AgentLoopDeps, type Artifact, type ArtifactStore, type BridgeCapabilities, type BridgeRequest, type BridgeResponse, type CatalogRenderer, type DiscoveryResult, EventBus, type ExternalSkillProvider, type ExternalToolSource, type FileStat, type FileSystemProvider, type FormField, FsArtifactStore, FsMemoryStore, FullDisclosureRouter, HookRunner, type HookRunnerOptions, InMemoryStore, type InteractionPolicy, type InteractionRequest, type InteractionResponse, type JsonSchema, type LifecycleEvent, type LifecycleHook, type LifecycleHookContext, type LifecycleListener, type LlmClient, type LlmCompleteInput, type LlmMessage, type LlmResponse, type LlmStreamEvent, type LlmToolCall, type LlmToolSpec, MemoryArtifactStore, MemoryFS, type MemoryStore, MockLlmClient, type MockLlmHandler, type MockLlmQueueItem, type MockUiAnswer, MockUiBridge, OpenAiCompatibleClient, type OpenAiCompatibleClientConfig, ProgressiveRouter, READ_SKILL_FILE_INPUT_SCHEMA, READ_SKILL_FILE_TOOL, READ_SKILL_FILE_TOOL_NAME, type RenderBlock, type RenderResultRequest, type RouteResult, type RunResult, type RunTerminationReason, type RuntimePhase, type RuntimeRun, type RuntimeSession, SKILL_NAME_MAX_LENGTH, SKILL_NAME_PATTERN, type ScriptExecutionContext, type ScriptExecutor, type SkillCatalog, type SkillCatalogEntry, SkillDiscovery, type SkillDocument, type SkillIssue, type SkillLocation, type SkillMetadata, SkillReader, type SkillRouter, type SkillSource, type ToolDefinition, type ToolResolution, type ToolResult, type TraceClock, type TraceEvent, type TraceEventType, TraceRecorder, type UiBridge, type ValidationReport, type VercelToolSpec, WebSkillError, type WebSkillErrorCode, WebSkillRuntime, type WebSkillRuntimeDeps, bridgeError, buildCatalog, buildRenderResult, checkSkillRules, createScriptContext, escapeXml, fromVercelResult, fromVercelStreamPart, isValidSkillName, jsonRenderer, mergeCatalogEntries, normalizePath, normalizeToolContent, parseBridgeRequest, parseSkillMarkdown, renderAvailableSkillsXml, renderCatalogJson, resolveInsideRoot, resolveToolName, schemaToForm, toLlmToolSpec, toVercelToolSpecs, validateSkills, xmlRenderer };
|
|
1
|
+
import { $ as RunTerminationReason, $t as isValidSkillName, A as LlmCompleteInput, At as CatalogRenderer, B as MockLlmQueueItem, Bt as SkillDiscovery, C as InteractionRequest, Ct as mergeCatalogEntries, D as LifecycleHookContext, Dt as schemaToForm, E as LifecycleHook, Et as resolveToolName, F as LlmToolSpec, Ft as MemoryFS, G as ProgressiveRouter, Gt as SkillReader, H as MockUiBridge, Ht as SkillIssue, I as MemoryArtifactStore, It as SKILL_NAME_MAX_LENGTH, J as READ_SKILL_FILE_TOOL_NAME, Jt as WebSkillError, K as READ_SKILL_FILE_INPUT_SCHEMA, Kt as SkillSource, L as MemoryStore, Lt as SKILL_NAME_PATTERN, M as LlmResponse, Mt as FileStat, N as LlmStreamEvent, Nt as FileSystemProvider, O as LifecycleListener, Ot as toLlmToolSpec, P as LlmToolCall, Pt as JsonSchema, Q as RunResult, Qt as escapeXml, R as MockLlmClient, Rt as SkillCatalog, S as InteractionPolicy, St as fromVercelStreamPart, T as LifecycleEvent, Tt as parseBridgeRequest, U as OpenAiCompatibleClient, Ut as SkillLocation, V as MockUiAnswer, Vt as SkillDocument, W as OpenAiCompatibleClientConfig, Wt as SkillMetadata, X as RenderResultRequest, Xt as buildCatalog, Y as RenderBlock, Yt as WebSkillErrorCode, Z as RouteResult, Zt as checkSkillRules, _ as FsMemoryStore, _t as WebSkillRuntimeDeps, a as AgentLoopConfig, an as resolveInsideRoot, at as ScriptExecutor, b as HookRunnerOptions, bt as createScriptContext, c as ArtifactStore, ct as ToolResolution, d as BridgeResponse, dt as TraceEvent, en as jsonRenderer, et as RuntimePhase, f as EventBus, ft as TraceEventType, g as FsArtifactStore, gt as WebSkillRuntime, h as FormField, ht as VercelToolSpec, i as AgentLoop, in as renderCatalogJson, it as ScriptExecutionContext, j as LlmMessage, jt as DiscoveryResult, k as LlmClient, kt as toVercelToolSpecs, l as BridgeCapabilities, lt as ToolResult, m as ExternalToolSource, mt as UiBridge, n as ASK_USER_TOOL, nn as parseSkillMarkdown, nt as RuntimeSession, o as AgentLoopDeps, on as validateSkills, ot as SkillRouter, p as ExternalSkillProvider, pt as TraceRecorder, q as READ_SKILL_FILE_TOOL, qt as ValidationReport, r as ASK_USER_TOOL_NAME, rn as renderAvailableSkillsXml, rt as SchemaInferer, s as Artifact, sn as xmlRenderer, st as ToolDefinition, t as ASK_USER_INPUT_SCHEMA, tn as normalizePath, tt as RuntimeRun, u as BridgeRequest, ut as TraceClock, v as FullDisclosureRouter, vt as bridgeError, w as InteractionResponse, wt as normalizeToolContent, x as InMemoryStore, xt as fromVercelResult, y as HookRunner, yt as buildRenderResult, z as MockLlmHandler, zt as SkillCatalogEntry } from "./index-j3Z3hbDk.js";
|
|
2
|
+
export { ASK_USER_INPUT_SCHEMA, ASK_USER_TOOL, ASK_USER_TOOL_NAME, AgentLoop, type AgentLoopConfig, type AgentLoopDeps, type Artifact, type ArtifactStore, type BridgeCapabilities, type BridgeRequest, type BridgeResponse, type CatalogRenderer, type DiscoveryResult, EventBus, type ExternalSkillProvider, type ExternalToolSource, type FileStat, type FileSystemProvider, type FormField, FsArtifactStore, FsMemoryStore, FullDisclosureRouter, HookRunner, type HookRunnerOptions, InMemoryStore, type InteractionPolicy, type InteractionRequest, type InteractionResponse, type JsonSchema, type LifecycleEvent, type LifecycleHook, type LifecycleHookContext, type LifecycleListener, type LlmClient, type LlmCompleteInput, type LlmMessage, type LlmResponse, type LlmStreamEvent, type LlmToolCall, type LlmToolSpec, MemoryArtifactStore, MemoryFS, type MemoryStore, MockLlmClient, type MockLlmHandler, type MockLlmQueueItem, type MockUiAnswer, MockUiBridge, OpenAiCompatibleClient, type OpenAiCompatibleClientConfig, ProgressiveRouter, READ_SKILL_FILE_INPUT_SCHEMA, READ_SKILL_FILE_TOOL, READ_SKILL_FILE_TOOL_NAME, type RenderBlock, type RenderResultRequest, type RouteResult, type RunResult, type RunTerminationReason, type RuntimePhase, type RuntimeRun, type RuntimeSession, SKILL_NAME_MAX_LENGTH, SKILL_NAME_PATTERN, type SchemaInferer, type ScriptExecutionContext, type ScriptExecutor, type SkillCatalog, type SkillCatalogEntry, SkillDiscovery, type SkillDocument, type SkillIssue, type SkillLocation, type SkillMetadata, SkillReader, type SkillRouter, type SkillSource, type ToolDefinition, type ToolResolution, type ToolResult, type TraceClock, type TraceEvent, type TraceEventType, TraceRecorder, type UiBridge, type ValidationReport, type VercelToolSpec, WebSkillError, type WebSkillErrorCode, WebSkillRuntime, type WebSkillRuntimeDeps, bridgeError, buildCatalog, buildRenderResult, checkSkillRules, createScriptContext, escapeXml, fromVercelResult, fromVercelStreamPart, isValidSkillName, jsonRenderer, mergeCatalogEntries, normalizePath, normalizeToolContent, parseBridgeRequest, parseSkillMarkdown, renderAvailableSkillsXml, renderCatalogJson, resolveInsideRoot, resolveToolName, schemaToForm, toLlmToolSpec, toVercelToolSpecs, validateSkills, xmlRenderer };
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { A as schemaToForm, B as checkSkillRules, C as createScriptContext, D as normalizeToolContent, E as mergeCatalogEntries, F as SKILL_NAME_PATTERN, G as parseSkillMarkdown, H as isValidSkillName, I as SkillDiscovery, J as resolveInsideRoot, K as renderAvailableSkillsXml, L as SkillReader, M as toVercelToolSpecs, N as MemoryFS, O as parseBridgeRequest, P as SKILL_NAME_MAX_LENGTH, R as WebSkillError, S as buildRenderResult, T as fromVercelStreamPart, U as jsonRenderer, V as escapeXml, W as normalizePath, X as xmlRenderer, Y as validateSkills, _ as READ_SKILL_FILE_TOOL, a as EventBus, b as WebSkillRuntime, c as FullDisclosureRouter, d as MemoryArtifactStore, f as MockLlmClient, g as READ_SKILL_FILE_INPUT_SCHEMA, h as ProgressiveRouter, i as AgentLoop, j as toLlmToolSpec, k as resolveToolName, l as HookRunner, m as OpenAiCompatibleClient, n as ASK_USER_TOOL, o as FsArtifactStore, p as MockUiBridge, q as renderCatalogJson, r as ASK_USER_TOOL_NAME, s as FsMemoryStore, t as ASK_USER_INPUT_SCHEMA, u as InMemoryStore, v as READ_SKILL_FILE_TOOL_NAME, w as fromVercelResult, x as bridgeError, y as TraceRecorder, z as buildCatalog } from "./dist-
|
|
1
|
+
import { A as schemaToForm, B as checkSkillRules, C as createScriptContext, D as normalizeToolContent, E as mergeCatalogEntries, F as SKILL_NAME_PATTERN, G as parseSkillMarkdown, H as isValidSkillName, I as SkillDiscovery, J as resolveInsideRoot, K as renderAvailableSkillsXml, L as SkillReader, M as toVercelToolSpecs, N as MemoryFS, O as parseBridgeRequest, P as SKILL_NAME_MAX_LENGTH, R as WebSkillError, S as buildRenderResult, T as fromVercelStreamPart, U as jsonRenderer, V as escapeXml, W as normalizePath, X as xmlRenderer, Y as validateSkills, _ as READ_SKILL_FILE_TOOL, a as EventBus, b as WebSkillRuntime, c as FullDisclosureRouter, d as MemoryArtifactStore, f as MockLlmClient, g as READ_SKILL_FILE_INPUT_SCHEMA, h as ProgressiveRouter, i as AgentLoop, j as toLlmToolSpec, k as resolveToolName, l as HookRunner, m as OpenAiCompatibleClient, n as ASK_USER_TOOL, o as FsArtifactStore, p as MockUiBridge, q as renderCatalogJson, r as ASK_USER_TOOL_NAME, s as FsMemoryStore, t as ASK_USER_INPUT_SCHEMA, u as InMemoryStore, v as READ_SKILL_FILE_TOOL_NAME, w as fromVercelResult, x as bridgeError, y as TraceRecorder, z as buildCatalog } from "./dist-BbyIk4vG.js";
|
|
2
2
|
|
|
3
3
|
export { ASK_USER_INPUT_SCHEMA, ASK_USER_TOOL, ASK_USER_TOOL_NAME, AgentLoop, EventBus, FsArtifactStore, FsMemoryStore, FullDisclosureRouter, HookRunner, InMemoryStore, MemoryArtifactStore, MemoryFS, MockLlmClient, MockUiBridge, OpenAiCompatibleClient, ProgressiveRouter, READ_SKILL_FILE_INPUT_SCHEMA, READ_SKILL_FILE_TOOL, READ_SKILL_FILE_TOOL_NAME, SKILL_NAME_MAX_LENGTH, SKILL_NAME_PATTERN, SkillDiscovery, SkillReader, TraceRecorder, WebSkillError, WebSkillRuntime, bridgeError, buildCatalog, buildRenderResult, checkSkillRules, createScriptContext, escapeXml, fromVercelResult, fromVercelStreamPart, isValidSkillName, jsonRenderer, mergeCatalogEntries, normalizePath, normalizeToolContent, parseBridgeRequest, parseSkillMarkdown, renderAvailableSkillsXml, renderCatalogJson, resolveInsideRoot, resolveToolName, schemaToForm, toLlmToolSpec, toVercelToolSpecs, validateSkills, xmlRenderer };
|
package/dist/mcp.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Ct as mergeCatalogEntries, F as LlmToolSpec, Pt as JsonSchema, Vt as SkillDocument, lt as ToolResult, m as ExternalToolSource, p as ExternalSkillProvider, zt as SkillCatalogEntry } from "./index-j3Z3hbDk.js";
|
|
2
2
|
import { Transport } from "@modelcontextprotocol/sdk/shared/transport.js";
|
|
3
3
|
import { JSONRPCMessage } from "@modelcontextprotocol/sdk/types.js";
|
|
4
4
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
package/dist/mcp.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as normalizeToolContent, E as mergeCatalogEntries, R as WebSkillError } from "./dist-
|
|
1
|
+
import { D as normalizeToolContent, E as mergeCatalogEntries, R as WebSkillError } from "./dist-BbyIk4vG.js";
|
|
2
2
|
import { fromJSONSchema } from "zod";
|
|
3
3
|
|
|
4
4
|
//#region ../mcp/dist/index.js
|
package/dist/node.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { _ as
|
|
3
|
-
export { CliUiBridge, FileArtifactStore, FileMemoryStore, type LlmCapabilities, type LlmEnvConfig, NodeFS, NodeScriptExecutor, SKILLS_LOCKFILE, SKILL_MANIFEST_FILE, type SandboxOptions, SandboxedScriptExecutor, SkillManager, type SkillManifest, type SkillSource, type SkillsLockfile, type VerifyResult, createScriptContext, loadLlmConfigFromEnv, probeLlmCapabilities, readArchiveManifest };
|
|
1
|
+
import { bt as createScriptContext } from "./index-j3Z3hbDk.js";
|
|
2
|
+
import { _ as VerifyResult, a as LlmEnvConfig, b as readArchiveManifest, c as OxcSchemaInferer, d as SandboxOptions, f as SandboxedScriptExecutor, g as SkillsLockfile, h as SkillSource, i as LlmCapabilities, l as SKILLS_LOCKFILE, m as SkillManifest, n as FileArtifactStore, o as NodeFS, p as SkillManager, r as FileMemoryStore, s as NodeScriptExecutor, t as CliUiBridge, u as SKILL_MANIFEST_FILE, v as loadLlmConfigFromEnv, y as probeLlmCapabilities } from "./index-DF5ea732.js";
|
|
3
|
+
export { CliUiBridge, FileArtifactStore, FileMemoryStore, type LlmCapabilities, type LlmEnvConfig, NodeFS, NodeScriptExecutor, OxcSchemaInferer, SKILLS_LOCKFILE, SKILL_MANIFEST_FILE, type SandboxOptions, SandboxedScriptExecutor, SkillManager, type SkillManifest, type SkillSource, type SkillsLockfile, type VerifyResult, createScriptContext, loadLlmConfigFromEnv, probeLlmCapabilities, readArchiveManifest };
|
package/dist/node.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as createScriptContext } from "./dist-
|
|
2
|
-
import { a as NodeScriptExecutor, c as
|
|
1
|
+
import { C as createScriptContext } from "./dist-BbyIk4vG.js";
|
|
2
|
+
import { a as NodeScriptExecutor, c as SKILL_MANIFEST_FILE, d as loadLlmConfigFromEnv, f as probeLlmCapabilities, i as NodeFS, l as SandboxedScriptExecutor, n as FileArtifactStore, o as OxcSchemaInferer, p as readArchiveManifest, r as FileMemoryStore, s as SKILLS_LOCKFILE, t as CliUiBridge, u as SkillManager } from "./dist-BMioPPri.js";
|
|
3
3
|
|
|
4
|
-
export { CliUiBridge, FileArtifactStore, FileMemoryStore, NodeFS, NodeScriptExecutor, SKILLS_LOCKFILE, SKILL_MANIFEST_FILE, SandboxedScriptExecutor, SkillManager, createScriptContext, loadLlmConfigFromEnv, probeLlmCapabilities, readArchiveManifest };
|
|
4
|
+
export { CliUiBridge, FileArtifactStore, FileMemoryStore, NodeFS, NodeScriptExecutor, OxcSchemaInferer, SKILLS_LOCKFILE, SKILL_MANIFEST_FILE, SandboxedScriptExecutor, SkillManager, createScriptContext, loadLlmConfigFromEnv, probeLlmCapabilities, readArchiveManifest };
|
package/dist/ui-react.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as InteractionRequest, X as RenderResultRequest,
|
|
1
|
+
import { C as InteractionRequest, X as RenderResultRequest, mt as UiBridge, w as InteractionResponse } from "./index-j3Z3hbDk.js";
|
|
2
2
|
//#region ../ui-react/dist/index.d.ts
|
|
3
3
|
//#region src/bridgeState.d.ts
|
|
4
4
|
/**
|
package/dist/ui-vue.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as InteractionRequest, X as RenderResultRequest,
|
|
1
|
+
import { C as InteractionRequest, X as RenderResultRequest, mt as UiBridge, w as InteractionResponse } from "./index-j3Z3hbDk.js";
|
|
2
2
|
import { PropType } from "vue";
|
|
3
3
|
//#region ../ui-vue/dist/index.d.ts
|
|
4
4
|
//#region src/bridgeState.d.ts
|
package/dist/ui.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as InteractionRequest, X as RenderResultRequest, Y as RenderBlock,
|
|
1
|
+
import { C as InteractionRequest, X as RenderResultRequest, Y as RenderBlock, mt as UiBridge, w as InteractionResponse, yt as buildRenderResult } from "./index-j3Z3hbDk.js";
|
|
2
2
|
//#region ../ui/dist/index.d.ts
|
|
3
3
|
//#region src/model/formModel.d.ts
|
|
4
4
|
interface FormModel {
|
package/dist/ui.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as buildRenderResult } from "./dist-
|
|
1
|
+
import { S as buildRenderResult } from "./dist-BbyIk4vG.js";
|
|
2
2
|
import { C as toOpenUiLang, S as toA2uiMessages, _ as interactionToFormModel, a as LitRendererBridge, b as renderRenderResult, c as VERCEL_INTERACTION_TOOL_NAME, d as WebFormBridge, f as collectValues, g as fromVercelToolResult, h as fromOpenUiAction, i as A2UI_VERSION, l as VercelUiBridge, m as fromA2uiAction, n as A2UI_CANCEL_ACTION, o as OPENUI_CANCEL_ACTION, p as ensureStyles, r as A2UI_SUBMIT_ACTION, s as OPENUI_SUBMIT_ACTION, t as A2UI_BASIC_CATALOG_ID, u as WEBSKILL_STYLES_CSS, v as renderBlocks, w as toVercelToolInvocation, x as shapeInteractionValue, y as renderMiniMarkdown } from "./dist-RcqvzAGF.js";
|
|
3
3
|
|
|
4
4
|
export { A2UI_BASIC_CATALOG_ID, A2UI_CANCEL_ACTION, A2UI_SUBMIT_ACTION, A2UI_VERSION, LitRendererBridge, OPENUI_CANCEL_ACTION, OPENUI_SUBMIT_ACTION, VERCEL_INTERACTION_TOOL_NAME, VercelUiBridge, WEBSKILL_STYLES_CSS, WebFormBridge, buildRenderResult, collectValues, ensureStyles, fromA2uiAction, fromOpenUiAction, fromVercelToolResult, interactionToFormModel, renderBlocks, renderMiniMarkdown, renderRenderResult, shapeInteractionValue, toA2uiMessages, toOpenUiLang, toVercelToolInvocation };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webskill/sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"description": "WebSkill — browser/Node agent skill runtime (skills, tools, MCP, governance, UI)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -42,7 +42,9 @@
|
|
|
42
42
|
},
|
|
43
43
|
"./package.json": "./package.json"
|
|
44
44
|
},
|
|
45
|
-
"files": [
|
|
45
|
+
"files": [
|
|
46
|
+
"dist"
|
|
47
|
+
],
|
|
46
48
|
"publishConfig": {
|
|
47
49
|
"access": "public"
|
|
48
50
|
},
|
|
@@ -54,6 +56,7 @@
|
|
|
54
56
|
"dependencies": {
|
|
55
57
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
56
58
|
"fflate": "0.8.3",
|
|
59
|
+
"oxc-parser": "0.141.0",
|
|
57
60
|
"tar": "7.5.21",
|
|
58
61
|
"yaml": "^2.9.0",
|
|
59
62
|
"zod": "^4.4.3"
|