@webskill/sdk 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/browser.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { H as SkillsLockfile, L as SkillManifest, P as SkillInstallSource, S as FileSystemProvider, W as VerifyResult, _ as RenderResultRequest, a as InteractionPolicy, c as LlmClient, d as LlmResponse, f as LlmStreamEvent, o as InteractionRequest, s as InteractionResponse, v as UiBridge, x as FileStat } from "./types-CgNC-oQu-Dq_A1yA-.js";
2
- import { K as ScriptExecutionContext, Y as ToolDefinition, Z as ToolResult, _ as ExternalToolSource, _t as parseBridgeRequest, c as ApprovalScope, d as BridgeRequest, f as BridgeResponse, g as ExternalSkillProvider, k as NetworkPolicy, l as BridgeCapabilities, ot as bridgeError, q as ScriptExecutor, rt as WebSkillApi } from "./index-oG5Nzgb9.js";
2
+ import { $ as ToolDefinition, N as NetworkPolicy, X as ScriptExecutionContext, Z as ScriptExecutor, d as BridgeCapabilities, m as BridgeResponse, p as BridgeRequest, st as WebSkillApi, tt as ToolResult, u as ApprovalScope, ut as bridgeError, v as ExternalSkillProvider, xt as parseBridgeRequest, y as ExternalToolSource } from "./index-CqMuvcb2.js";
3
3
  //#region ../browser/dist/index.d.ts
4
4
  //#region src/fs/featureDetection.d.ts
5
5
  /** 检测当前环境是否可用 OPFS(navigator.storage.getDirectory) */
package/dist/browser.js CHANGED
@@ -1,6 +1,6 @@
1
- import { D as verifyManifest, E as validateSkills, S as parseSkillPackManifest, T as resolveInsideRoot, _ as exportSkills, c as SkillDiscovery, d as buildCatalog, f as buildManifest, i as SKILL_MANIFEST_FILE, r as SKILLS_LOCKFILE, s as SKILL_PACK_FILE, u as WebSkillError, v as isValidSkillName, x as parseSkillMarkdown } from "./memoryArtifactStore-C9lFVqPF-U8nXvqL9.js";
2
- import { A as normalizeToolContent, C as createWebSkillApi, D as isNetworkAllowed, O as mergeCatalogEntries, _ as RUN_SNAPSHOT_SCHEMA_VERSION, a as CapabilityApproval, b as bridgeError, c as FsMemoryStore, f as OpenAiCompatibleClient, i as AgentLoop, j as parseBridgeRequest, k as networkUrlHost, l as FsRunSnapshotStore, p as ProgressiveRouter, s as FsArtifactStore } from "./dist-D5fsiETF.js";
3
- import { n as MockLlmClient } from "./testing-pn3NhXSV.js";
1
+ import { E as verifyManifest, T as validateSkills, _ as isValidSkillName, b as parseSkillMarkdown, d as buildManifest, g as exportSkills, l as WebSkillError, n as SKILLS_LOCKFILE, o as SKILL_PACK_FILE, r as SKILL_MANIFEST_FILE, s as SkillDiscovery, u as buildCatalog, w as resolveInsideRoot, x as parseSkillPackManifest } from "./dist-DS1sfgHa.js";
2
+ import { A as mergeCatalogEntries, M as normalizeToolContent, N as parseBridgeRequest, S as bridgeError, T as createWebSkillApi, c as FsArtifactStore, h as ProgressiveRouter, i as AgentLoop, j as networkUrlHost, k as isNetworkAllowed, l as FsMemoryStore, m as OpenAiCompatibleClient, o as CapabilityApproval, u as FsRunSnapshotStore, y as RUN_SNAPSHOT_SCHEMA_VERSION } from "./dist-DZobLFh6.js";
3
+ import { n as MockLlmClient } from "./testing-CbM6rJ-E.js";
4
4
  import { unzipSync } from "fflate";
5
5
 
6
6
  //#region ../browser/dist/index.js
@@ -1,5 +1,5 @@
1
- import { D as verifyManifest, E as validateSkills, S as parseSkillPackManifest, T as resolveInsideRoot, _ as exportSkills, f as buildManifest, i as SKILL_MANIFEST_FILE, r as SKILLS_LOCKFILE, s as SKILL_PACK_FILE, u as WebSkillError, v as isValidSkillName, x as parseSkillMarkdown } from "./memoryArtifactStore-C9lFVqPF-U8nXvqL9.js";
2
- import { A as normalizeToolContent, D as isNetworkAllowed, a as CapabilityApproval, b as bridgeError, c as FsMemoryStore, j as parseBridgeRequest, k as networkUrlHost, s as FsArtifactStore } from "./dist-D5fsiETF.js";
1
+ import { E as verifyManifest, T as validateSkills, _ as isValidSkillName, b as parseSkillMarkdown, d as buildManifest, g as exportSkills, l as WebSkillError, n as SKILLS_LOCKFILE, o as SKILL_PACK_FILE, r as SKILL_MANIFEST_FILE, w as resolveInsideRoot, x as parseSkillPackManifest } from "./dist-DS1sfgHa.js";
2
+ import { M as normalizeToolContent, N as parseBridgeRequest, S as bridgeError, c as FsArtifactStore, j as networkUrlHost, k as isNetworkAllowed, l as FsMemoryStore, o as CapabilityApproval } from "./dist-DZobLFh6.js";
3
3
  import { unzipSync, zipSync } from "fflate";
4
4
  import { existsSync, promises, readFileSync } from "node:fs";
5
5
  import path from "node:path";
@@ -1328,11 +1328,8 @@ var SkillManager = class {
1328
1328
  return options.outPath;
1329
1329
  }
1330
1330
  };
1331
- /**
1332
- * 解析 .env(简单 KEY=VALUE 行解析,不引依赖),
1333
- * 读取 VITE_BASE_URL / VITE_API_KEY / VITE_MODEL_NAME;缺项返回 undefined 供测试 skip 判断。
1334
- */
1335
- function loadLlmConfigFromEnv(dotenvPath = ".env") {
1331
+ /** 解析 .env(简单 KEY=VALUE 行解析,不引依赖);文件缺失返回 undefined */
1332
+ function readEnvVars(dotenvPath) {
1336
1333
  let raw;
1337
1334
  try {
1338
1335
  raw = readFileSync(dotenvPath, "utf8");
@@ -1350,6 +1347,14 @@ function loadLlmConfigFromEnv(dotenvPath = ".env") {
1350
1347
  if (value.startsWith("\"") && value.endsWith("\"") || value.startsWith("'") && value.endsWith("'")) value = value.slice(1, -1);
1351
1348
  vars.set(key, value);
1352
1349
  }
1350
+ return vars;
1351
+ }
1352
+ /**
1353
+ * 读取 VITE_BASE_URL / VITE_API_KEY / VITE_MODEL_NAME;缺项返回 undefined 供测试 skip 判断。
1354
+ */
1355
+ function loadLlmConfigFromEnv(dotenvPath = ".env") {
1356
+ const vars = readEnvVars(dotenvPath);
1357
+ if (!vars) return void 0;
1353
1358
  const baseUrl = vars.get("VITE_BASE_URL");
1354
1359
  const apiKey = vars.get("VITE_API_KEY");
1355
1360
  const model = vars.get("VITE_MODEL_NAME");
@@ -1360,6 +1365,34 @@ function loadLlmConfigFromEnv(dotenvPath = ".env") {
1360
1365
  model
1361
1366
  };
1362
1367
  }
1368
+ /** ANTHROPIC_API_KEY / ANTHROPIC_MODEL(可选 ANTHROPIC_BASE_URL);缺项返回 undefined */
1369
+ function loadAnthropicConfigFromEnv(dotenvPath = ".env") {
1370
+ const vars = readEnvVars(dotenvPath);
1371
+ if (!vars) return void 0;
1372
+ const apiKey = vars.get("ANTHROPIC_API_KEY");
1373
+ const model = vars.get("ANTHROPIC_MODEL");
1374
+ if (!apiKey || !model) return void 0;
1375
+ const baseUrl = vars.get("ANTHROPIC_BASE_URL");
1376
+ return {
1377
+ apiKey,
1378
+ model,
1379
+ ...baseUrl ? { baseUrl } : {}
1380
+ };
1381
+ }
1382
+ /** GOOGLE_API_KEY / GOOGLE_MODEL(可选 GOOGLE_BASE_URL);缺项返回 undefined */
1383
+ function loadGoogleConfigFromEnv(dotenvPath = ".env") {
1384
+ const vars = readEnvVars(dotenvPath);
1385
+ if (!vars) return void 0;
1386
+ const apiKey = vars.get("GOOGLE_API_KEY");
1387
+ const model = vars.get("GOOGLE_MODEL");
1388
+ if (!apiKey || !model) return void 0;
1389
+ const baseUrl = vars.get("GOOGLE_BASE_URL");
1390
+ return {
1391
+ apiKey,
1392
+ model,
1393
+ ...baseUrl ? { baseUrl } : {}
1394
+ };
1395
+ }
1363
1396
  let capabilitiesCache;
1364
1397
  /**
1365
1398
  * 探测 LLM 能力(结果模块级缓存):
@@ -1433,4 +1466,4 @@ async function doProbeLlmCapabilities(config) {
1433
1466
  }
1434
1467
 
1435
1468
  //#endregion
1436
- export { NodeScriptExecutor as a, SkillManager as c, readArchiveManifest as d, NodeFS as i, loadLlmConfigFromEnv as l, FileArtifactStore as n, OxcSchemaInferer as o, FileMemoryStore as r, SandboxedScriptExecutor as s, CliUiBridge as t, probeLlmCapabilities as u };
1469
+ export { NodeScriptExecutor as a, SkillManager as c, loadLlmConfigFromEnv as d, probeLlmCapabilities as f, NodeFS as i, loadAnthropicConfigFromEnv as l, FileArtifactStore as n, OxcSchemaInferer as o, readArchiveManifest as p, FileMemoryStore as r, SandboxedScriptExecutor as s, CliUiBridge as t, loadGoogleConfigFromEnv as u };
@@ -587,51 +587,4 @@ const xmlRenderer = {
587
587
  };
588
588
 
589
589
  //#endregion
590
- //#region ../runtime/dist/memoryArtifactStore-C9lFVqPF.js
591
- /** 内存 ArtifactStore:测试与浏览器降级用;索引随进程生命周期存在 */
592
- var MemoryArtifactStore = class {
593
- #byRun = /* @__PURE__ */ new Map();
594
- #seq = 0;
595
- async createTextArtifact(input) {
596
- return this.#record({
597
- runId: input.runId,
598
- path: input.path,
599
- type: "text",
600
- size: new TextEncoder().encode(input.content).length,
601
- mimeType: input.mimeType,
602
- metadata: input.metadata
603
- });
604
- }
605
- async createBinaryArtifact(input) {
606
- return this.#record({
607
- runId: input.runId,
608
- path: input.path,
609
- type: "binary",
610
- size: input.content.length,
611
- mimeType: input.mimeType,
612
- metadata: input.metadata
613
- });
614
- }
615
- async listArtifacts(runId) {
616
- return [...this.#byRun.get(runId) ?? []];
617
- }
618
- #record(input) {
619
- const artifact = {
620
- id: `art-${++this.#seq}`,
621
- runId: input.runId,
622
- path: input.path,
623
- type: input.type,
624
- mimeType: input.mimeType,
625
- size: input.size,
626
- createdAt: (/* @__PURE__ */ new Date()).toISOString(),
627
- metadata: input.metadata
628
- };
629
- const list = this.#byRun.get(input.runId) ?? [];
630
- list.push(artifact);
631
- this.#byRun.set(input.runId, list);
632
- return artifact;
633
- }
634
- };
635
-
636
- //#endregion
637
- export { renderAvailableSkillsXml as C, verifyManifest as D, validateSkills as E, xmlRenderer as O, parseSkillPackManifest as S, resolveInsideRoot as T, exportSkills as _, SKILL_NAME_MAX_LENGTH as a, normalizePath as b, SkillDiscovery as c, buildCatalog as d, buildManifest as f, escapeXml as g, computeDigest as h, SKILL_MANIFEST_FILE as i, SkillReader as l, checkSkillRules as m, MemoryFS as n, SKILL_NAME_PATTERN as o, checkDependencyCycles as p, SKILLS_LOCKFILE as r, SKILL_PACK_FILE as s, MemoryArtifactStore as t, WebSkillError as u, isValidSkillName as v, renderCatalogJson as w, parseSkillMarkdown as x, jsonRenderer as y };
590
+ export { renderCatalogJson as C, xmlRenderer as D, verifyManifest as E, renderAvailableSkillsXml as S, validateSkills as T, isValidSkillName as _, SKILL_NAME_PATTERN as a, parseSkillMarkdown as b, SkillReader as c, buildManifest as d, checkDependencyCycles as f, exportSkills as g, escapeXml as h, SKILL_NAME_MAX_LENGTH as i, WebSkillError as l, computeDigest as m, SKILLS_LOCKFILE as n, SKILL_PACK_FILE as o, checkSkillRules as p, SKILL_MANIFEST_FILE as r, SkillDiscovery as s, MemoryFS as t, buildCatalog as u, jsonRenderer as v, resolveInsideRoot as w, parseSkillPackManifest as x, normalizePath as y };