@webskill/sdk 0.10.0 → 0.11.0
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/agent.d.ts +3 -2
- package/dist/agent.js +3 -1102
- package/dist/browser.d.ts +258 -11
- package/dist/browser.js +758 -46
- package/dist/{catalogComponents-DTcYfpLQ-CcoOaz-Z.js → catalogComponents-BFoqpT1v-CjUBZ3bc.js} +253 -14
- package/dist/{dist-BViUeszk.js → dist-B-cOu08W.js} +526 -76
- package/dist/{dist-1OFC-zax.js → dist-DTHZS2k1.js} +520 -28
- package/dist/dist-qnlI2Iup.js +1280 -0
- package/dist/{eventTypes-s2uwAcLG-Go3l_dUe.js → eventTypes-FllCrX-Z-DNDeHWoG.js} +6 -2
- package/dist/governance.d.ts +7 -3
- package/dist/governance.js +1 -1
- package/dist/{index-DtFdMKBX.d.ts → index-D3mONFHD.d.ts} +220 -7
- package/dist/{index-B0QPLWPZ.d.ts → index-DACk2_XZ.d.ts} +110 -7
- package/dist/{index-BF4E1a9j.d.ts → index-DWbs58LF.d.ts} +227 -14
- package/dist/index.d.ts +4 -4
- package/dist/index.js +3 -3
- package/dist/mcp.d.ts +35 -7
- package/dist/mcp.js +88 -21
- package/dist/node.d.ts +3 -3
- package/dist/node.js +52 -2
- package/dist/{openUiLibrary-CIrV--Ad-B8zG_91e.js → openUiLibrary-D5u8oIvx-BLOAQCho.js} +3 -3
- package/dist/processSandboxEntry.js +6 -0
- package/dist/sandboxWorkerEntry.js +6 -0
- package/dist/{skillVersionStore-D-qHk9ZE-DBsYYCWn.d.ts → skillVersionStore-D-qHk9ZE-BcmFLykd.d.ts} +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/{types-CrRcT-LM-DZAp8sWv.d.ts → types-C26b05fW-CdrRCRDb.d.ts} +20 -4
- package/dist/ui-react.d.ts +2 -2
- package/dist/ui-react.js +28 -10
- package/dist/ui-vue.d.ts +1 -1
- package/dist/ui-vue.js +2 -2
- package/dist/ui.d.ts +4 -4
- package/dist/ui.js +3 -3
- package/dist/{webskillLitCatalog-BJrphK0y-SGmRXaaO.js → webskillLitCatalog-DME6PBkV-CmYNLlIT.js} +135 -16
- package/package.json +1 -1
package/dist/mcp.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { M as messageOf, g as assertRemoteUrlAllowed, h as WebSkillError } from "./dist-Bev6i6Ip.js";
|
|
2
|
-
import {
|
|
2
|
+
import { mt as mergeCatalogEntries, yt as normalizeToolContent } from "./dist-B-cOu08W.js";
|
|
3
3
|
|
|
4
4
|
//#region ../mcp/dist/index.js
|
|
5
5
|
/**
|
|
@@ -249,6 +249,11 @@ var McpToolResolver = class {
|
|
|
249
249
|
return failure$1("TOOL_EXECUTION_FAILED", text || "MCP tool returned an error");
|
|
250
250
|
}
|
|
251
251
|
for (const item of content) if (item.text !== void 0 && item.text.length > MAX_MCP_RESULT_TEXT_BYTES) item.text = `${item.text.slice(0, MAX_MCP_RESULT_TEXT_BYTES)}…[truncated ${item.text.length - MAX_MCP_RESULT_TEXT_BYTES} chars]`;
|
|
252
|
+
const structured = result?.structuredContent;
|
|
253
|
+
if (typeof structured === "object" && structured !== null) content.push({
|
|
254
|
+
type: "json",
|
|
255
|
+
data: structured
|
|
256
|
+
});
|
|
252
257
|
return {
|
|
253
258
|
ok: true,
|
|
254
259
|
content
|
|
@@ -267,11 +272,35 @@ function parseEndpointToolLlmName(endpoint, llmName) {
|
|
|
267
272
|
const prefix = `${endpoint}__`;
|
|
268
273
|
return llmName.startsWith(prefix) && llmName.length > prefix.length ? llmName.slice(prefix.length) : void 0;
|
|
269
274
|
}
|
|
270
|
-
|
|
271
|
-
|
|
275
|
+
/**
|
|
276
|
+
* 来源标识的长度上限(分册 26 §2.2)。
|
|
277
|
+
*
|
|
278
|
+
* 前缀计入工具名,而工具名进**每一次**请求 —— 长 sourceId 是持续成本。
|
|
279
|
+
* 装配期校验并给出可读错误,比运行时被 provider 拒掉好查。
|
|
280
|
+
*/
|
|
281
|
+
const WEB_MCP_SOURCE_ID_MAX = 24;
|
|
282
|
+
/**
|
|
283
|
+
* WebMCP 工具的 LLM 可见名。
|
|
284
|
+
*
|
|
285
|
+
* 多来源时带来源前缀(FR-26.2):三个文档都注册 `get_current_date` 是常态,
|
|
286
|
+
* 「首个来源优先」是**静默歧义** —— 模型选中的到底是哪个,谁也说不清。
|
|
287
|
+
* 不传 sourceId 时保持 0.10.0 的旧名,单来源宿主无感。
|
|
288
|
+
*/
|
|
289
|
+
function webMcpToolLlmName(toolName, sourceId) {
|
|
290
|
+
return sourceId === void 0 ? `mcp__${toolName}` : `mcp__${sourceId}__${toolName}`;
|
|
272
291
|
}
|
|
273
|
-
|
|
274
|
-
|
|
292
|
+
/** 解析回 `{ sourceId?, toolName }`;旧名(无来源段)解析出 `sourceId: undefined` */
|
|
293
|
+
function parseWebMcpToolLlmName(llmName, sourceIds = []) {
|
|
294
|
+
if (!llmName.startsWith("mcp__") || llmName.length <= 5) return void 0;
|
|
295
|
+
const rest = llmName.slice(5);
|
|
296
|
+
for (const sourceId of sourceIds) {
|
|
297
|
+
const sourcePrefix = `${sourceId}__`;
|
|
298
|
+
if (rest.startsWith(sourcePrefix) && rest.length > sourcePrefix.length) return {
|
|
299
|
+
sourceId,
|
|
300
|
+
toolName: rest.slice(sourcePrefix.length)
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
return { toolName: rest };
|
|
275
304
|
}
|
|
276
305
|
const textOfContent = (content) => {
|
|
277
306
|
if (typeof content === "string") return content;
|
|
@@ -354,6 +383,10 @@ async function loadFromJSONSchema() {
|
|
|
354
383
|
throw new WebSkillError("MCP_ENDPOINT_UNAVAILABLE", "The \"zod\" package is required to serve skills as MCP tools; install it first (npm i zod)", e);
|
|
355
384
|
}
|
|
356
385
|
}
|
|
386
|
+
/** MCP 的 structuredContent 必须是对象(规范用 `z.record`):数组与标量不适用 */
|
|
387
|
+
function isPlainObject(value) {
|
|
388
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
389
|
+
}
|
|
357
390
|
/** 注册端:在页面 MCP server 上一行声明动态技能(prompt + resources + tools) */
|
|
358
391
|
async function serveSkillAsMcp(server, skill) {
|
|
359
392
|
server.registerPrompt(skill.name, { description: skill.description }, async () => ({ messages: [{
|
|
@@ -372,13 +405,18 @@ async function serveSkillAsMcp(server, skill) {
|
|
|
372
405
|
description: tool.description ?? "",
|
|
373
406
|
...tool.inputSchema ? { inputSchema: (await loadFromJSONSchema())(tool.inputSchema) } : {}
|
|
374
407
|
}, async (args) => {
|
|
375
|
-
|
|
408
|
+
const value = await tool.handler(args ?? {});
|
|
409
|
+
const content = normalizeToolContent(value).map((item) => item.type === "text" ? {
|
|
376
410
|
type: "text",
|
|
377
411
|
text: item.text ?? ""
|
|
378
412
|
} : {
|
|
379
413
|
type: "text",
|
|
380
414
|
text: JSON.stringify(item.data ?? null)
|
|
381
|
-
})
|
|
415
|
+
});
|
|
416
|
+
return isPlainObject(value) ? {
|
|
417
|
+
content,
|
|
418
|
+
structuredContent: value
|
|
419
|
+
} : { content };
|
|
382
420
|
});
|
|
383
421
|
}
|
|
384
422
|
/**
|
|
@@ -394,6 +432,14 @@ const failure = (code, message) => ({
|
|
|
394
432
|
message
|
|
395
433
|
}
|
|
396
434
|
});
|
|
435
|
+
/**
|
|
436
|
+
* `executeTool` 按 MCP 规范返回 `{ content: [...] }`,但也有页面直接返回分片数组或裸值。
|
|
437
|
+
* 先解包 `content` 再归一——不解包的话规范形状会被整体序列化成一段 JSON 文本,
|
|
438
|
+
* 模型读到的不是工具答案而是一层信封。与 McpToolResolver 同一口径。
|
|
439
|
+
*/
|
|
440
|
+
function unwrapToolContent(raw) {
|
|
441
|
+
return normalizeToolContent((typeof raw === "object" && raw !== null ? raw.content : void 0) ?? raw);
|
|
442
|
+
}
|
|
397
443
|
/** getTools() 返回的工具 → 描述符:inputSchema 为 JSON 字符串时解析为对象,并保留原始对象 */
|
|
398
444
|
function toDescriptor(raw) {
|
|
399
445
|
if (typeof raw !== "object" || raw === null) return void 0;
|
|
@@ -437,9 +483,19 @@ function extractToolDescriptors(raw) {
|
|
|
437
483
|
var ExperimentalWebMcpAdapter = class {
|
|
438
484
|
#resolveApi;
|
|
439
485
|
#enabled;
|
|
486
|
+
/**
|
|
487
|
+
* 多来源时的消歧标识(分册 26 FR-26.2)。不设即沿用 0.10.0 的旧工具名,
|
|
488
|
+
* 单来源宿主无感;**两个以上来源必须各自设**,否则同名工具会撞车。
|
|
489
|
+
*/
|
|
490
|
+
sourceId;
|
|
440
491
|
constructor(api, options) {
|
|
441
492
|
this.#resolveApi = typeof api === "function" ? api : () => api;
|
|
442
493
|
this.#enabled = options?.enabled ?? false;
|
|
494
|
+
if (options?.sourceId !== void 0) {
|
|
495
|
+
if (!/^[a-zA-Z0-9-]+$/.test(options.sourceId)) throw new WebSkillError("VALIDATION_FAILED", `WebMCP sourceId "${options.sourceId}" may only contain letters, digits and hyphens.`);
|
|
496
|
+
if (options.sourceId.length > 24) throw new WebSkillError("VALIDATION_FAILED", `WebMCP sourceId "${options.sourceId}" is longer than 24 characters; it is prefixed onto every tool name and therefore costs tokens on every request.`);
|
|
497
|
+
this.sourceId = options.sourceId;
|
|
498
|
+
}
|
|
443
499
|
}
|
|
444
500
|
/**
|
|
445
501
|
* 宿主能力检测(FR-19.2/19.4):**只**看 `document.modelContext.executeTool` 是否存在,
|
|
@@ -486,7 +542,7 @@ var ExperimentalWebMcpAdapter = class {
|
|
|
486
542
|
const tool = match?.raw ?? { name: toolName };
|
|
487
543
|
return {
|
|
488
544
|
ok: true,
|
|
489
|
-
content:
|
|
545
|
+
content: unwrapToolContent(await api.executeTool(tool, argsJson))
|
|
490
546
|
};
|
|
491
547
|
} catch (e) {
|
|
492
548
|
return failure("TOOL_EXECUTION_FAILED", `WebMCP tool "${toolName}" failed: ${messageOf(e)}`);
|
|
@@ -494,7 +550,7 @@ var ExperimentalWebMcpAdapter = class {
|
|
|
494
550
|
try {
|
|
495
551
|
return {
|
|
496
552
|
ok: true,
|
|
497
|
-
content:
|
|
553
|
+
content: unwrapToolContent(await api.executeTool(toolName, argsJson))
|
|
498
554
|
};
|
|
499
555
|
} catch (e) {
|
|
500
556
|
return failure("TOOL_EXECUTION_FAILED", `WebMCP tool "${toolName}" failed: ${messageOf(e)}`);
|
|
@@ -517,6 +573,11 @@ var McpRuntimePlugin = class {
|
|
|
517
573
|
kind = "mcp";
|
|
518
574
|
#registry;
|
|
519
575
|
#resolver;
|
|
576
|
+
/**
|
|
577
|
+
* 多来源(分册 26 FR-26.1):**不做聚合适配器**。
|
|
578
|
+
* 聚合会让「部分来源可用」无法回答,把 0.9.0 刚理清的
|
|
579
|
+
* 「不支持 / 未启用」二分重新搅浑。这里逐个问,不合并成一个布尔。
|
|
580
|
+
*/
|
|
520
581
|
#webMcp;
|
|
521
582
|
#visibility;
|
|
522
583
|
#configuredEndpoints;
|
|
@@ -524,7 +585,7 @@ var McpRuntimePlugin = class {
|
|
|
524
585
|
constructor(deps) {
|
|
525
586
|
this.#registry = deps.registry;
|
|
526
587
|
this.#resolver = deps.resolver ?? new McpToolResolver(deps.registry);
|
|
527
|
-
this.#webMcp = deps.webMcp;
|
|
588
|
+
this.#webMcp = deps.webMcp ?? [];
|
|
528
589
|
this.#visibility = deps.visibility;
|
|
529
590
|
this.#configuredEndpoints = deps.endpoints ?? [];
|
|
530
591
|
this.#onWarning = deps.onWarning ?? ((message) => console.warn(message));
|
|
@@ -570,12 +631,13 @@ var McpRuntimePlugin = class {
|
|
|
570
631
|
this.#onWarning(`[webskill] MCP endpoint "${endpoint}" is unavailable; its tools are omitted from this turn: ${e instanceof Error ? e.message : String(e)}`);
|
|
571
632
|
}
|
|
572
633
|
}
|
|
573
|
-
|
|
574
|
-
|
|
634
|
+
for (const source of this.#webMcp) {
|
|
635
|
+
if (!source.isEnabled()) continue;
|
|
636
|
+
const tools = await source.listTools();
|
|
575
637
|
for (const tool of tools ?? []) {
|
|
576
|
-
if (!this.#visible(() => this.#visibility?.isWebMcpToolEnabled?.(tool.name))) continue;
|
|
638
|
+
if (!this.#visible(() => this.#visibility?.isWebMcpToolEnabled?.(tool.name, source.sourceId))) continue;
|
|
577
639
|
specs.push({
|
|
578
|
-
name: webMcpToolLlmName(tool.name),
|
|
640
|
+
name: webMcpToolLlmName(tool.name, source.sourceId),
|
|
579
641
|
description: tool.description ?? `[webmcp] ${tool.name}`,
|
|
580
642
|
inputSchema: typeof tool.inputSchema === "object" && tool.inputSchema !== null ? tool.inputSchema : {
|
|
581
643
|
type: "object",
|
|
@@ -586,14 +648,19 @@ var McpRuntimePlugin = class {
|
|
|
586
648
|
}
|
|
587
649
|
return specs;
|
|
588
650
|
}
|
|
651
|
+
/** 已知来源标识;解析工具名时用它切分,避免把工具名里的 `__` 当成来源分隔 */
|
|
652
|
+
#sourceIds() {
|
|
653
|
+
return this.#webMcp.map((source) => source.sourceId).filter((id) => id !== void 0);
|
|
654
|
+
}
|
|
589
655
|
canHandle(llmToolName) {
|
|
590
|
-
if (parseWebMcpToolLlmName(llmToolName) !== void 0) return true;
|
|
656
|
+
if (parseWebMcpToolLlmName(llmToolName, this.#sourceIds()) !== void 0) return true;
|
|
591
657
|
return this.#endpoints().some((endpoint) => parseEndpointToolLlmName(endpoint, llmToolName) !== void 0);
|
|
592
658
|
}
|
|
593
659
|
async call(llmToolName, args) {
|
|
594
|
-
const
|
|
595
|
-
if (
|
|
596
|
-
|
|
660
|
+
const parsed = parseWebMcpToolLlmName(llmToolName, this.#sourceIds());
|
|
661
|
+
if (parsed !== void 0) {
|
|
662
|
+
const source = parsed.sourceId === void 0 ? this.#webMcp.find((candidate) => candidate.sourceId === void 0) : this.#webMcp.find((candidate) => candidate.sourceId === parsed.sourceId);
|
|
663
|
+
if (source === void 0) return {
|
|
597
664
|
ok: false,
|
|
598
665
|
content: [],
|
|
599
666
|
error: {
|
|
@@ -601,8 +668,8 @@ var McpRuntimePlugin = class {
|
|
|
601
668
|
message: "WebMCP adapter is not configured"
|
|
602
669
|
}
|
|
603
670
|
};
|
|
604
|
-
if (!this.#visible(() => this.#visibility?.isWebMcpToolEnabled?.(
|
|
605
|
-
return
|
|
671
|
+
if (!this.#visible(() => this.#visibility?.isWebMcpToolEnabled?.(parsed.toolName, source.sourceId))) return disabledResult(llmToolName);
|
|
672
|
+
return source.call(parsed.toolName, args);
|
|
606
673
|
}
|
|
607
674
|
for (const endpoint of this.#endpoints()) {
|
|
608
675
|
const toolName = parseEndpointToolLlmName(endpoint, llmToolName);
|
|
@@ -893,4 +960,4 @@ async function connectRemoteEndpoint(registry, config) {
|
|
|
893
960
|
}
|
|
894
961
|
|
|
895
962
|
//#endregion
|
|
896
|
-
export { EndpointRegistry, ExperimentalWebMcpAdapter, McpRuntimePlugin, McpToolResolver, MessageChannelTransport, TemporarySkillProvider, catalogMerge, connectRemoteEndpoint, createMemoryOAuthStores, createOAuthProvider, endpointToolLlmName, parseEndpointToolLlmName, parseWebMcpToolLlmName, serveSkillAsMcp, validateJsonRpcMessage, webMcpToolLlmName };
|
|
963
|
+
export { EndpointRegistry, ExperimentalWebMcpAdapter, McpRuntimePlugin, McpToolResolver, MessageChannelTransport, TemporarySkillProvider, WEB_MCP_SOURCE_ID_MAX, catalogMerge, connectRemoteEndpoint, createMemoryOAuthStores, createOAuthProvider, endpointToolLlmName, parseEndpointToolLlmName, parseWebMcpToolLlmName, serveSkillAsMcp, validateJsonRpcMessage, webMcpToolLlmName };
|
package/dist/node.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { $ as SignatureAuditSink, B as JsonSchema, Ct as VerifyResult, J as SKILL_MANIFEST_FILE, L as FileStat, M as ArchiveLimits, R as FileSystemProvider, S as UiBridge, _t as SkillsLockfile, b as RenderResultRequest, c as InteractionResponse, dt as SkillManifest, q as SKILLS_LOCKFILE, s as InteractionRequest, st as SkillInstallSource, ut as SkillManagerPort, xt as UnsignedPolicy, yt as TrustedKeyStore } from "./types-
|
|
2
|
-
import {
|
|
3
|
-
import { a as AuditLog, b as SkillVersionStore, d as CandidateSkill, m as CandidateStore, r as ApprovalPolicy } from "./skillVersionStore-D-qHk9ZE-
|
|
1
|
+
import { $ as SignatureAuditSink, B as JsonSchema, Ct as VerifyResult, J as SKILL_MANIFEST_FILE, L as FileStat, M as ArchiveLimits, R as FileSystemProvider, S as UiBridge, _t as SkillsLockfile, b as RenderResultRequest, c as InteractionResponse, dt as SkillManifest, q as SKILLS_LOCKFILE, s as InteractionRequest, st as SkillInstallSource, ut as SkillManagerPort, xt as UnsignedPolicy, yt as TrustedKeyStore } from "./types-C26b05fW-CdrRCRDb.js";
|
|
2
|
+
import { Dn as WebSkillRuntimeDeps, En as WebSkillRuntime, Ft as SchemaInferer, It as ScriptExecutionContext, L as FsArtifactStore, Lt as ScriptExecutor, Mn as createScriptContext, R as FsMemoryStore, an as ToolDefinition, m as ApprovalScope, nt as NetworkPolicy, sn as ToolResult, y as BridgeCapabilities } from "./index-D3mONFHD.js";
|
|
3
|
+
import { a as AuditLog, b as SkillVersionStore, d as CandidateSkill, m as CandidateStore, r as ApprovalPolicy } from "./skillVersionStore-D-qHk9ZE-BcmFLykd.js";
|
|
4
4
|
import { n as LlmEnvConfig, s as probeLlmCapabilities, t as LlmCapabilities } from "./env-AK3cSMEA-Dli6QU5E.js";
|
|
5
5
|
import { Readable, Writable } from "node:stream";
|
|
6
6
|
//#region ../node/dist/index.d.ts
|
package/dist/node.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { B as resolveArchiveLimits, D as exportSkills, F as parseSkillPackManifest, G as unzipWithLimits, I as readResponseWithLimit, J as verifySkillSignature, K as validateSkills, L as readSkillSignature, M as messageOf, O as isAtomicTempPath, P as parseSkillMarkdown, V as resolveInsideRoot, _ as assertSafePathSegment, b as buildManifest, c as SKILL_MANIFEST_FILE, d as SKILL_PACK_FILE, g as assertRemoteUrlAllowed, h as WebSkillError, i as MANIFEST_EXCLUDED_FILES, k as isValidSkillName, q as verifyManifest, s as SKILLS_LOCKFILE, v as atomicWriteText } from "./dist-Bev6i6Ip.js";
|
|
2
|
-
import {
|
|
2
|
+
import { Q as createScriptContext, X as bridgeError, b as FsMemoryStore, bt as normalizeToolError, gt as networkPolicyLibSource, q as WebSkillRuntime, u as CapabilityApproval, xt as parseBridgeRequest, y as FsArtifactStore, yt as normalizeToolContent } from "./dist-B-cOu08W.js";
|
|
3
3
|
import { i as probeLlmCapabilities } from "./env-8cY40DXB-CGnEVZby.js";
|
|
4
|
-
import { t as AUDIT_EVENT_TYPES } from "./eventTypes-
|
|
4
|
+
import { t as AUDIT_EVENT_TYPES } from "./eventTypes-FllCrX-Z-DNDeHWoG.js";
|
|
5
5
|
import { createRequire } from "node:module";
|
|
6
6
|
import { unzipSync, zipSync } from "fflate";
|
|
7
7
|
import { existsSync, promises, realpathSync } from "node:fs";
|
|
@@ -336,6 +336,8 @@ var SandboxedScriptExecutor = class {
|
|
|
336
336
|
this.#options = options;
|
|
337
337
|
this.#capabilities = {
|
|
338
338
|
readReference: options.capabilities?.readReference ?? true,
|
|
339
|
+
readAsset: options.capabilities?.readAsset ?? true,
|
|
340
|
+
fetchData: options.capabilities?.fetchData ?? false,
|
|
339
341
|
writeArtifact: options.capabilities?.writeArtifact ?? true,
|
|
340
342
|
confirm: options.capabilities?.confirm ?? true
|
|
341
343
|
};
|
|
@@ -509,6 +511,29 @@ var SandboxedScriptExecutor = class {
|
|
|
509
511
|
value: await context.readReference(request.path)
|
|
510
512
|
};
|
|
511
513
|
}
|
|
514
|
+
case "readAsset":
|
|
515
|
+
case "readAssetBinary": {
|
|
516
|
+
const read = request.kind === "readAsset" ? context.readAsset : context.readAssetBinary;
|
|
517
|
+
if (!read) return bridgeError(request.id, "TOOL_UNSUPPORTED", "Capability \"readAsset\" is disabled");
|
|
518
|
+
const denied = await gate("readAsset", `Script "${context.skillName}" wants to read asset "${request.path}"`, { path: request.path });
|
|
519
|
+
if (denied) return denied;
|
|
520
|
+
const value = await read(request.path);
|
|
521
|
+
return {
|
|
522
|
+
id: request.id,
|
|
523
|
+
ok: true,
|
|
524
|
+
value: typeof value === "string" ? value : Array.from(value)
|
|
525
|
+
};
|
|
526
|
+
}
|
|
527
|
+
case "fetchData": {
|
|
528
|
+
if (!context.fetchData) return bridgeError(request.id, "TOOL_UNSUPPORTED", "Capability \"fetchData\" is disabled");
|
|
529
|
+
const denied = await gate("fetchData", `Script "${context.skillName}" wants to fetch data source "${request.sourceId}"`, { sourceId: request.sourceId });
|
|
530
|
+
if (denied) return denied;
|
|
531
|
+
return {
|
|
532
|
+
id: request.id,
|
|
533
|
+
ok: true,
|
|
534
|
+
value: await context.fetchData(request.sourceId, request.params)
|
|
535
|
+
};
|
|
536
|
+
}
|
|
512
537
|
case "writeArtifact": {
|
|
513
538
|
const denied = await gate("writeArtifact", `Script "${context.skillName}" wants to write artifact "${request.path}"`, {
|
|
514
539
|
path: request.path,
|
|
@@ -578,6 +603,8 @@ var ProcessSandboxExecutor = class {
|
|
|
578
603
|
this.#options = options;
|
|
579
604
|
this.#capabilities = {
|
|
580
605
|
readReference: options.capabilities?.readReference ?? true,
|
|
606
|
+
readAsset: options.capabilities?.readAsset ?? true,
|
|
607
|
+
fetchData: options.capabilities?.fetchData ?? false,
|
|
581
608
|
writeArtifact: options.capabilities?.writeArtifact ?? true,
|
|
582
609
|
confirm: options.capabilities?.confirm ?? true
|
|
583
610
|
};
|
|
@@ -858,6 +885,29 @@ var ProcessSandboxExecutor = class {
|
|
|
858
885
|
value: await context.readReference(request.path)
|
|
859
886
|
};
|
|
860
887
|
}
|
|
888
|
+
case "readAsset":
|
|
889
|
+
case "readAssetBinary": {
|
|
890
|
+
const read = request.kind === "readAsset" ? context.readAsset : context.readAssetBinary;
|
|
891
|
+
if (!read) return bridgeError(request.id, "TOOL_UNSUPPORTED", "Capability \"readAsset\" is disabled");
|
|
892
|
+
const denied = await gate("readAsset", `Script "${context.skillName}" wants to read asset "${request.path}"`, { path: request.path });
|
|
893
|
+
if (denied) return denied;
|
|
894
|
+
const value = await read(request.path);
|
|
895
|
+
return {
|
|
896
|
+
id: request.id,
|
|
897
|
+
ok: true,
|
|
898
|
+
value: typeof value === "string" ? value : Array.from(value)
|
|
899
|
+
};
|
|
900
|
+
}
|
|
901
|
+
case "fetchData": {
|
|
902
|
+
if (!context.fetchData) return bridgeError(request.id, "TOOL_UNSUPPORTED", "Capability \"fetchData\" is disabled");
|
|
903
|
+
const denied = await gate("fetchData", `Script "${context.skillName}" wants to fetch data source "${request.sourceId}"`, { sourceId: request.sourceId });
|
|
904
|
+
if (denied) return denied;
|
|
905
|
+
return {
|
|
906
|
+
id: request.id,
|
|
907
|
+
ok: true,
|
|
908
|
+
value: await context.fetchData(request.sourceId, request.params)
|
|
909
|
+
};
|
|
910
|
+
}
|
|
861
911
|
case "writeArtifact": {
|
|
862
912
|
const denied = await gate("writeArtifact", `Script "${context.skillName}" wants to write artifact "${request.path}"`, {
|
|
863
913
|
path: request.path,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as CatalogNode } from "./catalogComponents-
|
|
1
|
+
import { St as uiCatalog } from "./dist-DTHZS2k1.js";
|
|
2
|
+
import { t as CatalogNode } from "./catalogComponents-BFoqpT1v-CjUBZ3bc.js";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { Component, Fragment, createContext, useCallback, useContext, useEffect, useInsertionEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -3761,7 +3761,7 @@ function Renderer({ response, library, isStreaming = false, onAction, onStateUpd
|
|
|
3761
3761
|
const FormValidationContext = createContext(null);
|
|
3762
3762
|
|
|
3763
3763
|
//#endregion
|
|
3764
|
-
//#region ../ui-react/dist/openUiLibrary-
|
|
3764
|
+
//#region ../ui-react/dist/openUiLibrary-D5u8oIvx.js
|
|
3765
3765
|
const propsFor = (props, container) => container ? props.extend({ children: z.array(z.any()).optional() }) : props;
|
|
3766
3766
|
/**
|
|
3767
3767
|
* catalog 的 OpenUI 投影:`defineComponent` 复用同一份 zod schema 与描述,
|
|
@@ -165,6 +165,12 @@ async function main(task) {
|
|
|
165
165
|
skillName: task.skillName ?? "",
|
|
166
166
|
runId: task.runId ?? "",
|
|
167
167
|
readReference: (path) => callCapability("readReference", { path }),
|
|
168
|
+
readAsset: (path) => callCapability("readAsset", { path }),
|
|
169
|
+
fetchData: (sourceId, params) => callCapability("fetchData", {
|
|
170
|
+
sourceId,
|
|
171
|
+
params
|
|
172
|
+
}),
|
|
173
|
+
readAssetBinary: async (path) => new Uint8Array(await callCapability("readAssetBinary", { path })),
|
|
168
174
|
writeArtifact: (path, content, options) => callCapability("writeArtifact", {
|
|
169
175
|
path,
|
|
170
176
|
content: typeof content === "string" ? content : Array.from(content ?? []),
|
|
@@ -226,6 +226,12 @@ async function main() {
|
|
|
226
226
|
skillName: task.skillName ?? "",
|
|
227
227
|
runId: task.runId ?? "",
|
|
228
228
|
readReference: (path) => callCapability("readReference", { path }),
|
|
229
|
+
readAsset: (path) => callCapability("readAsset", { path }),
|
|
230
|
+
fetchData: (sourceId, params) => callCapability("fetchData", {
|
|
231
|
+
sourceId,
|
|
232
|
+
params
|
|
233
|
+
}),
|
|
234
|
+
readAssetBinary: async (path) => new Uint8Array(await callCapability("readAssetBinary", { path })),
|
|
229
235
|
writeArtifact: (path, content, options) => callCapability("writeArtifact", {
|
|
230
236
|
path,
|
|
231
237
|
content: typeof content === "string" ? content : Array.from(content ?? []),
|
package/dist/{skillVersionStore-D-qHk9ZE-DBsYYCWn.d.ts → skillVersionStore-D-qHk9ZE-BcmFLykd.d.ts}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { R as FileSystemProvider, U as Page, W as PageQuery, dt as SkillManifest, it as SkillCatalogEntry } from "./types-
|
|
1
|
+
import { R as FileSystemProvider, U as Page, W as PageQuery, dt as SkillManifest, it as SkillCatalogEntry } from "./types-C26b05fW-CdrRCRDb.js";
|
|
2
2
|
//#region ../governance/dist/skillVersionStore-D-qHk9ZE.d.ts
|
|
3
3
|
//#region src/types.d.ts
|
|
4
4
|
type CandidateStatus = 'draft' | 'pending-review' | 'approved' | 'published' | 'rejected';
|
package/dist/testing.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as UiBridge, c as InteractionResponse, l as LlmClient, m as LlmStreamEvent, n as ArtifactStore, p as LlmResponse, s as InteractionRequest, t as Artifact, u as LlmCompleteInput, v as MemoryStore } from "./types-
|
|
1
|
+
import { S as UiBridge, c as InteractionResponse, l as LlmClient, m as LlmStreamEvent, n as ArtifactStore, p as LlmResponse, s as InteractionRequest, t as Artifact, u as LlmCompleteInput, v as MemoryStore } from "./types-C26b05fW-CdrRCRDb.js";
|
|
2
2
|
import { a as loadGoogleConfigFromEnv, i as loadAnthropicConfigFromEnv, n as LlmEnvConfig, o as loadLlmConfigFromEnv, r as ProviderEnvConfig } from "./env-AK3cSMEA-Dli6QU5E.js";
|
|
3
3
|
//#region ../runtime/dist/testing.d.ts
|
|
4
4
|
//#region src/llm/mockLlmClient.d.ts
|
|
@@ -2,7 +2,15 @@
|
|
|
2
2
|
//#region src/errors.d.ts
|
|
3
3
|
type WebSkillErrorCode = 'FS_NOT_FOUND' | 'FS_PATH_OUTSIDE_ROOT' | 'SKILL_NOT_FOUND' | 'SKILL_INVALID_METADATA' | 'SKILL_INVALID_NAME' | 'SKILL_DUPLICATE_NAME' | 'SKILL_UNSUPPORTED_SCRIPT' | 'SKILL_MANIFEST_PROTECTED' | 'VALIDATION_FAILED' | 'TOOL_NOT_FOUND' | 'TOOL_EXECUTION_FAILED' | 'NETWORK_BLOCKED' | 'TOOL_UNSUPPORTED' | 'TOOL_NOT_ALLOWED' | 'TOOL_SCHEMA_UNAVAILABLE' | 'TOOL_RESOLUTION_EXHAUSTED' | 'RUN_TIMEOUT' | 'RUN_MAX_TURNS_EXCEEDED' | 'RUN_FAILED' | 'RUN_CANCELLED' | 'RUN_INTERACTION_TIMEOUT' |
|
|
4
4
|
/** 历史里有未应答的工具调用,但当初为何中断已无从得知(分册 11 读取侧补齐) */
|
|
5
|
-
'RUN_INTERRUPTED' | 'UI_UNAVAILABLE' | 'LLM_UNAVAILABLE' | 'LLM_REQUEST_FAILED' | 'INSTALL_FAILED' | 'UNINSTALL_FAILED' | 'EXPORT_FAILED' | 'INTEGRITY_FAILED' | 'FS_PERMISSION_DENIED' | 'MCP_ENDPOINT_UNAVAILABLE' | 'MCP_TOOL_NOT_FOUND' | 'CANDIDATE_INVALID' | 'APPROVAL_REQUIRED' | 'SKILL_QUARANTINED' | 'SKILL_DISABLED' | 'SKILL_UNKNOWN_ALLOWED_TOOL' | 'SKILL_UNKNOWN_DEPENDENCY' | 'SKILL_CIRCULAR_DEPENDENCY' | 'GOVERNANCE_FAILED' | 'RUN_SNAPSHOT_NOT_FOUND' | 'RUN_SNAPSHOT_EXPIRED' | 'RUN_SNAPSHOT_INCOMPATIBLE' | 'RUN_SNAPSHOT_SCHEMA_UNSUPPORTED' | 'RUN_TRACE_INCOMPATIBLE' | 'SESSION_INCOMPATIBLE' | 'SIGNATURE_MISSING' | 'SIGNATURE_MALFORMED' | 'SIGNATURE_UNTRUSTED_KEY' | 'SIGNATURE_MISMATCH' | 'SIGNATURE_UNSUPPORTED' | 'MCP_STDIO_SPAWN_FAILED' | 'MCP_STDIO_EXITED' | 'MCP_STDIO_TIMEOUT' | 'MCP_OAUTH_REQUIRED' | 'MCP_OAUTH_FAILED' | 'MCP_OAUTH_NOT_CONFIGURED' | 'PAGE_ACTION_OUT_OF_SCOPE' | 'PAGE_ACTION_STALE_REF' | 'PAGE_ACTION_DECLINED' |
|
|
5
|
+
'RUN_INTERRUPTED' | 'UI_UNAVAILABLE' | 'LLM_UNAVAILABLE' | 'LLM_REQUEST_FAILED' | 'INSTALL_FAILED' | 'UNINSTALL_FAILED' | 'EXPORT_FAILED' | 'INTEGRITY_FAILED' | 'FS_PERMISSION_DENIED' | 'MCP_ENDPOINT_UNAVAILABLE' | 'MCP_TOOL_NOT_FOUND' | 'CANDIDATE_INVALID' | 'APPROVAL_REQUIRED' | 'SKILL_QUARANTINED' | 'SKILL_DISABLED' | 'SKILL_UNKNOWN_ALLOWED_TOOL' | 'SKILL_UNKNOWN_DEPENDENCY' | 'SKILL_CIRCULAR_DEPENDENCY' | 'GOVERNANCE_FAILED' | 'RUN_SNAPSHOT_NOT_FOUND' | 'RUN_SNAPSHOT_EXPIRED' | 'RUN_SNAPSHOT_INCOMPATIBLE' | 'RUN_SNAPSHOT_SCHEMA_UNSUPPORTED' | 'RUN_TRACE_INCOMPATIBLE' | 'SESSION_INCOMPATIBLE' | 'SIGNATURE_MISSING' | 'SIGNATURE_MALFORMED' | 'SIGNATURE_UNTRUSTED_KEY' | 'SIGNATURE_MISMATCH' | 'SIGNATURE_UNSUPPORTED' | 'MCP_STDIO_SPAWN_FAILED' | 'MCP_STDIO_EXITED' | 'MCP_STDIO_TIMEOUT' | 'MCP_OAUTH_REQUIRED' | 'MCP_OAUTH_FAILED' | 'MCP_OAUTH_NOT_CONFIGURED' | 'PAGE_ACTION_OUT_OF_SCOPE' | 'PAGE_ACTION_STALE_REF' | 'PAGE_ACTION_DECLINED' |
|
|
6
|
+
/** 0.11.0 分册 18:用户拒绝把数据交给文档投放面 */
|
|
7
|
+
'DOCUMENT_SURFACE_DECLINED' |
|
|
8
|
+
/** 0.11.0 分册 18:viewer 未在期限内回报就绪(路由挂了 / 外壳脚本没跑起来) */
|
|
9
|
+
'DOCUMENT_SURFACE_UNAVAILABLE' | 'TS_RESOURCE_URL_REJECTED' | 'TS_TRANSPILER_UNAVAILABLE' | 'TS_TRANSPILE_FAILED' | 'TODO_LIST_INVALID' | 'TODO_ITEM_NOT_FOUND' | 'SKILL_GENERATION_DISABLED' | 'SKILL_GENERATION_LIMIT_EXCEEDED' | 'SKILL_GENERATION_VALIDATION_FAILED' | 'DELEGATION_UNAVAILABLE' | 'DELEGATION_IN_PROGRESS' | 'DELEGATION_BUDGET_EXCEEDED' | 'PROFILE_IMPORT_INVALID' | 'PROFILE_IMPORT_VERSION_UNSUPPORTED' | 'PROFILE_IMPORT_CREDENTIAL_REJECTED' | 'PROFILE_KEY_UNAVAILABLE' | 'DICTATION_UNAVAILABLE' | 'DICTATION_PERMISSION_DENIED' | 'DICTATION_FAILED' | 'PERCEPTION_NOT_ENABLED' | 'PERCEPTION_FAILED' | 'MODEL_IMAGE_UNSUPPORTED' | 'MODEL_DOCUMENT_UNSUPPORTED' | 'MODEL_TOOLS_UNSUPPORTED' | 'ATTACHMENT_TOO_LARGE' | 'ATTACHMENT_TYPE_REJECTED' |
|
|
10
|
+
/** 脚本取了宿主未声明的数据源;拒绝发生在发出任何请求之前(0.11.0 分册 16) */
|
|
11
|
+
'DATA_SOURCE_NOT_FOUND' |
|
|
12
|
+
/** 取数结果超预算。与 ATTACHMENT_TOO_LARGE 同口径:拒绝而不截断 */
|
|
13
|
+
'DATA_SOURCE_TOO_LARGE';
|
|
6
14
|
/**
|
|
7
15
|
* 所有公开 API 抛出的结构化错误,code 供上层可编程处理
|
|
8
16
|
* @stable
|
|
@@ -629,7 +637,7 @@ declare function escapeXml(text: string): string;
|
|
|
629
637
|
declare function renderAvailableSkillsXml(catalog: SkillCatalog): string;
|
|
630
638
|
declare const xmlRenderer: CatalogRenderer;
|
|
631
639
|
//#endregion
|
|
632
|
-
//#region ../runtime/dist/types-
|
|
640
|
+
//#region ../runtime/dist/types-C26b05fW.d.ts
|
|
633
641
|
//#region src/llm/streamTypes.d.ts
|
|
634
642
|
/** 流式 LLM 事件(OpenAI SSE / Vercel fullStream 统一映射) */
|
|
635
643
|
type LlmStreamEvent = {
|
|
@@ -696,6 +704,14 @@ interface LlmToolCall {
|
|
|
696
704
|
arguments: Record<string, unknown>;
|
|
697
705
|
/** 流式拼接后的 arguments 不是合法 JSON 时的错误描述;设置时 arguments 不可信 */
|
|
698
706
|
argumentsParseError?: string;
|
|
707
|
+
/**
|
|
708
|
+
* 供应商自己的不透明随车数据,原样回放给**同一家**供应商。
|
|
709
|
+
*
|
|
710
|
+
* Gemini 的 thinking 模型会随 `functionCall` 下发 `thoughtSignature`,
|
|
711
|
+
* 下一轮不带回去就直接 400——丢掉它的后果是多轮工具调用整条链跑不通(UI-UX8 D5)。
|
|
712
|
+
* 内容对引擎不透明,也不得跨供应商传递。
|
|
713
|
+
*/
|
|
714
|
+
vendor?: Record<string, unknown>;
|
|
699
715
|
}
|
|
700
716
|
/**
|
|
701
717
|
* 一次模型调用的 token 用量(0.10.0 UI-UX5 #47)。
|
|
@@ -842,7 +858,7 @@ type InteractionRequest = {
|
|
|
842
858
|
*/
|
|
843
859
|
type: 'authorize';
|
|
844
860
|
id: string;
|
|
845
|
-
capability: 'readReference' | 'writeArtifact' | 'confirm' | 'pageAction';
|
|
861
|
+
capability: 'readReference' | 'readAsset' | 'writeArtifact' | 'confirm' | 'fetchData' | 'pageAction' | 'readLinkedDocument';
|
|
846
862
|
message: string;
|
|
847
863
|
details?: unknown;
|
|
848
864
|
});
|
|
@@ -1008,7 +1024,7 @@ interface FormField {
|
|
|
1008
1024
|
name: string;
|
|
1009
1025
|
label: string;
|
|
1010
1026
|
/** `password` 的值不进 paramHistory、不进行为记录、不落会话(FR-23.7) */
|
|
1011
|
-
type: 'text' | 'number' | 'boolean' | 'select' | 'textarea' | 'file' | 'password';
|
|
1027
|
+
type: 'text' | 'number' | 'boolean' | 'select' | 'textarea' | 'file' | 'password' | 'date';
|
|
1012
1028
|
required?: boolean;
|
|
1013
1029
|
description?: string;
|
|
1014
1030
|
defaultValue?: unknown;
|
package/dist/ui-react.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as UiSpecActionCapability, D as UiSpecSnapshot, O as UiSurfaceActionRequest, S as UiBridge, T as UiSpecEvent, b as RenderResultRequest, bt as UiSpecNode, c as InteractionResponse, k as UiSurfaceActionResponse, s as InteractionRequest, w as UiSpecDrafts } from "./types-
|
|
2
|
-
import {
|
|
1
|
+
import { C as UiSpecActionCapability, D as UiSpecSnapshot, O as UiSurfaceActionRequest, S as UiBridge, T as UiSpecEvent, b as RenderResultRequest, bt as UiSpecNode, c as InteractionResponse, k as UiSurfaceActionResponse, s as InteractionRequest, w as UiSpecDrafts } from "./types-C26b05fW-CdrRCRDb.js";
|
|
2
|
+
import { W as SurfaceFormTexts, j as InteractionSpecLabels } from "./index-DACk2_XZ.js";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import React$1, { ComponentType, ReactNode } from "react";
|
|
5
5
|
import "react/jsx-runtime";
|
package/dist/ui-react.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { r as __exportAll$1 } from "./rolldown-runtime-BOF7iYI8.js";
|
|
2
2
|
import { h as WebSkillError } from "./dist-Bev6i6Ip.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { C as
|
|
3
|
+
import { Bt as validateUiSpecNode, zt as validateUiSpecEvent } from "./dist-B-cOu08W.js";
|
|
4
|
+
import { C as applySuggestion, K as resolveColumnWidths, L as interactionToUiSpec, O as collectValues, St as uiCatalog, V as normalizeColumnWidths, W as renderMiniChart, X as toOpenUiSpecLang, Y as toJsonRenderSpec, gt as interactionToFormModel, mt as chartSpecFromProps, ot as DEFAULT_SURFACE_FORM_TEXTS, vt as renderMiniMarkdown, xt as shapeInteractionValue } from "./dist-DTHZS2k1.js";
|
|
5
|
+
import { A as Badge, C as catalogComponentImpls, D as useCatalogSurfaceForm, E as surfaceThemeOf, F as DropdownMenuContent, I as DropdownMenuTrigger, L as Input, M as DataTable, N as DropdownMenu, O as useSurfaceForm, P as DropdownMenuCheckboxItem, R as Markdown, S as cardLayoutProps, T as str, _ as SurfaceButton, a as SpecCallout, b as SurfaceFormButtons, c as SpecGrid, d as SpecKeyValue, f as SpecProgress, g as SpecTimeline, h as SpecTabs, i as SpecAccordion, j as Button, k as useSurfaceFormTexts, l as SpecIcon, m as SpecSplit, n as CatalogSurfaceProvider, o as SpecCarousel, p as SpecQuote, r as EChart, s as SpecGauge, u as SpecImage, v as SurfaceField, w as paletteClass, x as SurfaceFormTextsProvider, y as SurfaceFieldArray, z as Separator } from "./catalogComponents-BFoqpT1v-CjUBZ3bc.js";
|
|
6
6
|
import { z } from "zod";
|
|
7
7
|
import * as React$1 from "react";
|
|
8
8
|
import React, { createContext, useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
@@ -6810,7 +6810,7 @@ function Control({ control, invalid }) {
|
|
|
6810
6810
|
label,
|
|
6811
6811
|
description,
|
|
6812
6812
|
/* @__PURE__ */ jsx("input", {
|
|
6813
|
-
type: control.control === "number" ? "number" : "text",
|
|
6813
|
+
type: control.control === "number" ? "number" : control.control === "date" ? "date" : "text",
|
|
6814
6814
|
id: controlId,
|
|
6815
6815
|
"aria-invalid": invalid || void 0,
|
|
6816
6816
|
className: "webskill-form__input",
|
|
@@ -7187,7 +7187,7 @@ function renderNode(node, context, key, scope) {
|
|
|
7187
7187
|
children
|
|
7188
7188
|
}, key);
|
|
7189
7189
|
case "Card": return /* @__PURE__ */ jsxs("section", {
|
|
7190
|
-
className:
|
|
7190
|
+
className: `webskill-spec-card flex flex-col gap-2 rounded-lg border border-border bg-card ${cardLayoutProps(props).className} ${paletteClass(props)}`,
|
|
7191
7191
|
children: [
|
|
7192
7192
|
/* @__PURE__ */ jsx("h3", {
|
|
7193
7193
|
className: "text-sm font-semibold text-ink",
|
|
@@ -7202,7 +7202,7 @@ function renderNode(node, context, key, scope) {
|
|
|
7202
7202
|
}, key);
|
|
7203
7203
|
case "Separator": return /* @__PURE__ */ jsx(Separator, {}, key);
|
|
7204
7204
|
case "Heading": return /* @__PURE__ */ jsx(props["level"] === 2 ? "h2" : props["level"] === 4 ? "h4" : "h3", {
|
|
7205
|
-
className:
|
|
7205
|
+
className: `text-sm font-semibold text-ink ${paletteClass(props)}`,
|
|
7206
7206
|
children: str(props, "text")
|
|
7207
7207
|
}, key);
|
|
7208
7208
|
case "Text": return /* @__PURE__ */ jsx("p", {
|
|
@@ -7212,7 +7212,7 @@ function renderNode(node, context, key, scope) {
|
|
|
7212
7212
|
case "Markdown": return /* @__PURE__ */ jsx(Markdown, { children: str(props, "text") }, key);
|
|
7213
7213
|
case "Badge": return /* @__PURE__ */ jsx(Badge, {
|
|
7214
7214
|
tone: "neutral",
|
|
7215
|
-
className: TONE_CLASS[str(props, "tone", "neutral")]
|
|
7215
|
+
className: `${TONE_CLASS[str(props, "tone", "neutral")]} ${paletteClass(props)}`,
|
|
7216
7216
|
children: str(props, "text")
|
|
7217
7217
|
}, key);
|
|
7218
7218
|
case "Metric": return /* @__PURE__ */ jsxs("div", {
|
|
@@ -7252,7 +7252,19 @@ function renderNode(node, context, key, scope) {
|
|
|
7252
7252
|
props,
|
|
7253
7253
|
children
|
|
7254
7254
|
}, key);
|
|
7255
|
+
case "Split": return /* @__PURE__ */ jsx(SpecSplit, {
|
|
7256
|
+
props,
|
|
7257
|
+
children
|
|
7258
|
+
}, key);
|
|
7255
7259
|
case "Timeline": return /* @__PURE__ */ jsx(SpecTimeline, { props }, key);
|
|
7260
|
+
case "Icon": return /* @__PURE__ */ jsx(SpecIcon, { props }, key);
|
|
7261
|
+
case "Image": return /* @__PURE__ */ jsx(SpecImage, { props }, key);
|
|
7262
|
+
case "Quote": return /* @__PURE__ */ jsx(SpecQuote, { props }, key);
|
|
7263
|
+
case "Callout": return /* @__PURE__ */ jsx(SpecCallout, { props }, key);
|
|
7264
|
+
case "KeyValue": return /* @__PURE__ */ jsx(SpecKeyValue, { props }, key);
|
|
7265
|
+
case "Gauge": return /* @__PURE__ */ jsx(SpecGauge, { props }, key);
|
|
7266
|
+
case "Accordion": return /* @__PURE__ */ jsx(SpecAccordion, { props }, key);
|
|
7267
|
+
case "Carousel": return /* @__PURE__ */ jsx(SpecCarousel, { props }, key);
|
|
7256
7268
|
case "Progress": return /* @__PURE__ */ jsx(SpecProgress, { props }, key);
|
|
7257
7269
|
case "FileLink": return /* @__PURE__ */ jsxs("div", {
|
|
7258
7270
|
className: "flex items-center gap-2 text-sm",
|
|
@@ -7279,7 +7291,10 @@ function renderNode(node, context, key, scope) {
|
|
|
7279
7291
|
className: "text-sm font-semibold text-ink",
|
|
7280
7292
|
children: str(props, "title")
|
|
7281
7293
|
}) : null,
|
|
7282
|
-
|
|
7294
|
+
/* @__PURE__ */ jsx("div", {
|
|
7295
|
+
className: "webskill-spec-form__fields",
|
|
7296
|
+
children
|
|
7297
|
+
}),
|
|
7283
7298
|
/* @__PURE__ */ jsx(SurfaceFormButtons, {
|
|
7284
7299
|
form: context,
|
|
7285
7300
|
props,
|
|
@@ -7368,9 +7383,12 @@ function NativeSpecSurface({ surfaceId, spec, actions, registry, runId, draft, o
|
|
|
7368
7383
|
};
|
|
7369
7384
|
const texts = useSurfaceFormTexts();
|
|
7370
7385
|
const { node, degradations } = sanitized;
|
|
7386
|
+
const framed = shell !== "none" && node?.component !== "Table";
|
|
7387
|
+
const theme = surfaceThemeOf(node);
|
|
7371
7388
|
return /* @__PURE__ */ jsxs("div", {
|
|
7372
|
-
className:
|
|
7389
|
+
className: framed ? "webskill-surface webskill-surface--spec" : "webskill-surface--spec",
|
|
7373
7390
|
"data-testid": "native-spec-surface",
|
|
7391
|
+
...theme ? { "data-webskill-theme": theme } : {},
|
|
7374
7392
|
children: [
|
|
7375
7393
|
node ? renderNode(node, context, "root") : null,
|
|
7376
7394
|
form.readOnly && actions.length > 0 ? /* @__PURE__ */ jsx("p", {
|
|
@@ -7671,7 +7689,7 @@ function OpenUiSpecSurface({ spec, surfaceId, actions, onAction }) {
|
|
|
7671
7689
|
const [unavailable, setUnavailable] = useState(false);
|
|
7672
7690
|
useEffect(() => {
|
|
7673
7691
|
let cancelled = false;
|
|
7674
|
-
import("./openUiLibrary-
|
|
7692
|
+
import("./openUiLibrary-D5u8oIvx-BLOAQCho.js").then((loaded) => {
|
|
7675
7693
|
if (!cancelled) setModule(loaded);
|
|
7676
7694
|
}).catch(() => {
|
|
7677
7695
|
if (!cancelled) setUnavailable(true);
|
package/dist/ui-vue.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as UiBridge, b as RenderResultRequest, c as InteractionResponse, s as InteractionRequest } from "./types-
|
|
1
|
+
import { S as UiBridge, b as RenderResultRequest, c as InteractionResponse, s as InteractionRequest } from "./types-C26b05fW-CdrRCRDb.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-vue.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { C as applySuggestion, O as collectValues, W as renderMiniChart, gt as interactionToFormModel, ot as DEFAULT_SURFACE_FORM_TEXTS, vt as renderMiniMarkdown, xt as shapeInteractionValue } from "./dist-DTHZS2k1.js";
|
|
2
2
|
import { defineComponent, h, reactive, ref } from "vue";
|
|
3
3
|
|
|
4
4
|
//#region ../ui-vue/dist/index.js
|
|
@@ -104,7 +104,7 @@ function renderControl(control, invalid) {
|
|
|
104
104
|
});
|
|
105
105
|
break;
|
|
106
106
|
default: input = h("input", {
|
|
107
|
-
type: control.control === "number" ? "number" : "text",
|
|
107
|
+
type: control.control === "number" ? "number" : control.control === "date" ? "date" : "text",
|
|
108
108
|
id: controlId,
|
|
109
109
|
"aria-invalid": invalid || void 0,
|
|
110
110
|
class: "webskill-form__input",
|
package/dist/ui.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { bt as UiSpecNode } from "./types-
|
|
2
|
-
import {
|
|
3
|
-
import { $ as
|
|
4
|
-
export { A2UI_BASIC_CATALOG_ID, A2UI_COMMON_TYPES, A2UI_SPEC_ACTION, A2UI_SPEC_FORM_PATH, A2UI_SURFACE_ACTION, A2UI_VERSION, type A2uiCatalogComponent, type A2uiCatalogDefinition, type A2uiCatalogHandle, type A2uiComponentShape, type A2uiMessage, type A2uiSpecActionEvent, type A2uiSpecMessageOptions, CHART_PALETTE, type CollectedValues, type ColumnWidthsRejection, type ControlModel, DEFAULT_INTERACTION_TEXTS, DEFAULT_SURFACE_FORM_TEXTS, DESCRIBE_UI_PRESET_TOOL, type EchartHandle, type EvaluateFieldConditionOptions, type FieldCondition, type FieldConditionResult, type FormModel, type InteractionSpecLabels, type InteractionTexts, type JsonRenderSpec, type LoadedOpenUiPeers, MAX_CONDITION_DEPTH, type NormalizedColumnWidths, type OpenUiRendererProps, type OpenUiRuntime, RENDER_UI_TOOL, SPEC_TABLE_MIN_COLUMN_VAR, SPEC_TABLE_MIN_COLUMN_WIDTH, type SpecColumnMeta, type SurfaceFormTexts, UI_CATALOG_GROUPS, UI_CATALOG_PROMPT_BUDGET_BYTES, UI_PRESETS, UI_PRESET_NAMES, type UiActionDef, type UiCatalog, type UiCatalogInput, type UiCatalogPromptOptions, type UiCatalogToolSourceOptions, type UiComponentDef, type UiFormScope, type UiPreset, type UiPresetName, type UiSpecDegradation, type UiSpecIssue, type UiSpecNode, type UiSpecSanitization, type UiSpecValidation, type UiSurfaceActionDispatch, VERCEL_INTERACTION_TOOL_NAME, type VercelToolInvocation, VercelUiBridge, WEBSKILL_A2UI_CATALOG_ID, WEBSKILL_STYLES_CSS, WEBSKILL_SURFACE_ACTION, WebFormBridge, type ZodRuntime, a2uiComponentSchema, a2uiComponentShapes, applySuggestion, buildA2uiCatalogDefinition, buildRenderResult, chartSpecFromProps, chartToTable, collectFormScopes, collectScopedValues, collectSpecActions, collectValues, createUiCatalogToolSource, defineUiCatalog, ensureStyles, evaluateFieldCondition, fromA2uiSpecAction, fromA2uiSurfaceAction, fromUiSurfaceActionDispatch, fromVercelToolResult, interactionToFormModel, interactionToUiSpec, loadOpenUiPeers, loadWebSkillLitCatalog, mountEchart, normalizeColumnWidths, qualifyFieldName, renderBlocks, renderMiniChart, renderMiniMarkdown, renderRenderResult, resolveColumnWidths, resolveInteractionTexts, resolveSurfaceFormTexts, shapeInteractionValue, toA2uiSpecMessages, toA2uiSurfaceAction, toJsonRenderSpec, toOpenUiSpecLang, toUiSurfaceActionDispatch, toVercelToolInvocation, uiCatalog, uiPreset };
|
|
1
|
+
import { bt as UiSpecNode } from "./types-C26b05fW-CdrRCRDb.js";
|
|
2
|
+
import { jn as buildRenderResult } from "./index-D3mONFHD.js";
|
|
3
|
+
import { $ as UiCatalogToolSourceOptions, $t as resolveColumnWidths, A as FormModel, At as collectSpecActions, B as RENDER_UI_TOOL, Bt as gaugePercent, C as DESCRIBE_UI_PRESET_TOOL, Ct as a2uiComponentShapes, D as EvaluateFieldConditionOptions, Dt as chartToTable, E as EchartHandle, Et as chartSpecFromProps, F as MAX_CONDITION_DEPTH, Ft as evaluateFieldCondition, G as UI_CATALOG_GROUPS, Gt as mountEchart, H as SPEC_TABLE_MIN_COLUMN_WIDTH, Ht as interactionToUiSpec, I as NormalizedColumnWidths, It as fromA2uiSpecAction, J as UI_PRESET_NAMES, Jt as qualifyFieldName, K as UI_CATALOG_PROMPT_BUDGET_BYTES, Kt as mountViewerComponents, L as OpenUiRendererProps, Lt as fromA2uiSurfaceAction, M as InteractionTexts, Mt as createUiCatalogToolSource, N as JsonRenderSpec, Nt as defineUiCatalog, O as FieldCondition, Ot as collectFormScopes, P as LoadedOpenUiPeers, Pt as ensureStyles, Q as UiCatalogPromptOptions, Qt as renderRenderResult, R as OpenUiRuntime, Rt as fromUiSurfaceActionDispatch, S as DEFAULT_SURFACE_FORM_TEXTS, St as a2uiComponentSchema, T as DocumentComponentName, Tt as buildA2uiCatalogDefinition, U as SpecColumnMeta, Ut as loadOpenUiPeers, V as SPEC_TABLE_MIN_COLUMN_VAR, Vt as interactionToFormModel, W as SurfaceFormTexts, Wt as loadWebSkillLitCatalog, X as UiCatalog, Xt as renderMiniChart, Y as UiActionDef, Yt as renderBlocks, Z as UiCatalogInput, Zt as renderMiniMarkdown, _ as CHART_PALETTE, _t as WEBSKILL_A2UI_CATALOG_ID, a as A2UI_SURFACE_ACTION, an as toJsonRenderSpec, at as UiSpecDegradationCode, b as ControlModel, bt as WebFormBridge, c as A2uiCatalogDefinition, cn as toVercelToolInvocation, ct as UiSpecValidation, d as A2uiMessage, dt as VIEWER_COMPONENT_ATTR, en as resolveInteractionTexts, et as UiComponentDef, f as A2uiSpecActionEvent, ft as VIEWER_FALLBACK_ATTR, g as CATALOG_SCHEMA_MAX, gt as ViewerComponentsHandle, h as CATALOG_PROMPT_MAX, ht as VercelUiBridge, i as A2UI_SPEC_FORM_PATH, in as toA2uiSurfaceAction, it as UiSpecDegradation, j as InteractionSpecLabels, jt as collectValues, k as FieldConditionResult, kt as collectScopedValues, l as A2uiCatalogHandle, ln as uiCatalog, lt as UiSurfaceActionDispatch, m as CATALOG_BUDGET_STAGE, mt as VercelToolInvocation, n as A2UI_COMMON_TYPES, nn as shapeInteractionValue, nt as UiPreset, o as A2UI_VERSION, on as toOpenUiSpecLang, ot as UiSpecIssue, p as A2uiSpecMessageOptions, pt as VIEWER_PROPS_ATTR, q as UI_PRESETS, qt as normalizeColumnWidths, r as A2UI_SPEC_ACTION, rn as toA2uiSpecMessages, rt as UiPresetName, s as A2uiCatalogComponent, sn as toUiSurfaceActionDispatch, st as UiSpecSanitization, t as A2UI_BASIC_CATALOG_ID, tn as resolveSurfaceFormTexts, tt as UiFormScope, u as A2uiComponentShape, un as uiPreset, ut as VERCEL_INTERACTION_TOOL_NAME, v as CollectedValues, vt as WEBSKILL_STYLES_CSS, w as DOCUMENT_COMPONENTS, wt as applySuggestion, x as DEFAULT_INTERACTION_TEXTS, xt as ZodRuntime, y as ColumnWidthsRejection, yt as WEBSKILL_SURFACE_ACTION, z as PLANNED_INCREMENT, zt as fromVercelToolResult } from "./index-DACk2_XZ.js";
|
|
4
|
+
export { A2UI_BASIC_CATALOG_ID, A2UI_COMMON_TYPES, A2UI_SPEC_ACTION, A2UI_SPEC_FORM_PATH, A2UI_SURFACE_ACTION, A2UI_VERSION, type A2uiCatalogComponent, type A2uiCatalogDefinition, type A2uiCatalogHandle, type A2uiComponentShape, type A2uiMessage, type A2uiSpecActionEvent, type A2uiSpecMessageOptions, CATALOG_BUDGET_STAGE, CATALOG_PROMPT_MAX, CATALOG_SCHEMA_MAX, CHART_PALETTE, type CollectedValues, type ColumnWidthsRejection, type ControlModel, DEFAULT_INTERACTION_TEXTS, DEFAULT_SURFACE_FORM_TEXTS, DESCRIBE_UI_PRESET_TOOL, DOCUMENT_COMPONENTS, type DocumentComponentName, type EchartHandle, type EvaluateFieldConditionOptions, type FieldCondition, type FieldConditionResult, type FormModel, type InteractionSpecLabels, type InteractionTexts, type JsonRenderSpec, type LoadedOpenUiPeers, MAX_CONDITION_DEPTH, type NormalizedColumnWidths, type OpenUiRendererProps, type OpenUiRuntime, PLANNED_INCREMENT, RENDER_UI_TOOL, SPEC_TABLE_MIN_COLUMN_VAR, SPEC_TABLE_MIN_COLUMN_WIDTH, type SpecColumnMeta, type SurfaceFormTexts, UI_CATALOG_GROUPS, UI_CATALOG_PROMPT_BUDGET_BYTES, UI_PRESETS, UI_PRESET_NAMES, type UiActionDef, type UiCatalog, type UiCatalogInput, type UiCatalogPromptOptions, type UiCatalogToolSourceOptions, type UiComponentDef, type UiFormScope, type UiPreset, type UiPresetName, type UiSpecDegradation, type UiSpecDegradationCode, type UiSpecIssue, type UiSpecNode, type UiSpecSanitization, type UiSpecValidation, type UiSurfaceActionDispatch, VERCEL_INTERACTION_TOOL_NAME, VIEWER_COMPONENT_ATTR, VIEWER_FALLBACK_ATTR, VIEWER_PROPS_ATTR, type VercelToolInvocation, VercelUiBridge, type ViewerComponentsHandle, WEBSKILL_A2UI_CATALOG_ID, WEBSKILL_STYLES_CSS, WEBSKILL_SURFACE_ACTION, WebFormBridge, type ZodRuntime, a2uiComponentSchema, a2uiComponentShapes, applySuggestion, buildA2uiCatalogDefinition, buildRenderResult, chartSpecFromProps, chartToTable, collectFormScopes, collectScopedValues, collectSpecActions, collectValues, createUiCatalogToolSource, defineUiCatalog, ensureStyles, evaluateFieldCondition, fromA2uiSpecAction, fromA2uiSurfaceAction, fromUiSurfaceActionDispatch, fromVercelToolResult, gaugePercent, interactionToFormModel, interactionToUiSpec, loadOpenUiPeers, loadWebSkillLitCatalog, mountEchart, mountViewerComponents, normalizeColumnWidths, qualifyFieldName, renderBlocks, renderMiniChart, renderMiniMarkdown, renderRenderResult, resolveColumnWidths, resolveInteractionTexts, resolveSurfaceFormTexts, shapeInteractionValue, toA2uiSpecMessages, toA2uiSurfaceAction, toJsonRenderSpec, toOpenUiSpecLang, toUiSurfaceActionDispatch, toVercelToolInvocation, uiCatalog, uiPreset };
|