@webskill/sdk 0.4.0 → 0.5.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.
@@ -1,4 +1,4 @@
1
- import { G as mountEchart, I as A2UI_CHILDREN_PROP, K as renderMiniMarkdown, U as chartSpecFromProps, V as a2uiComponentShapes, q as uiCatalog, z as WEBSKILL_A2UI_CATALOG_ID } from "./dist-D9Lcn5Pp.js";
1
+ import { J as WEBSKILL_A2UI_CATALOG_ID, Q as chartSpecFromProps, W as A2UI_CHILDREN_PROP, X as a2uiComponentShapes, et as mountEchart, nt as uiCatalog, tt as renderMiniMarkdown } from "./dist-bewtXYlO.js";
2
2
  import { A2uiController, A2uiLitElement } from "@a2ui/lit/v0_9";
3
3
  import { Catalog } from "@a2ui/web_core/v0_9";
4
4
  import { z } from "zod/v3";
@@ -1419,7 +1419,7 @@ var f = class extends i {
1419
1419
  };
1420
1420
 
1421
1421
  //#endregion
1422
- //#region ../ui/dist/webskillLitCatalog-CSTbhBe_.js
1422
+ //#region ../ui/dist/webskillLitCatalog-_mugzRHx.js
1423
1423
  /**
1424
1424
  * Lit 元素上的 echarts 挂载指令。
1425
1425
  * A2UI 档的 catalog `Chart` 渲染在 shadow root 里,实例必须随元素断开而 dispose,
@@ -1598,6 +1598,33 @@ const sharedStyles = i$4`
1598
1598
  .error {
1599
1599
  color: var(--destructive);
1600
1600
  }
1601
+ .tabs {
1602
+ display: flex;
1603
+ gap: 0.25rem;
1604
+ border-bottom: 1px solid var(--border);
1605
+ }
1606
+ .grid {
1607
+ display: grid;
1608
+ gap: 0.75rem;
1609
+ }
1610
+ ol.timeline {
1611
+ display: flex;
1612
+ flex-direction: column;
1613
+ gap: 0.5rem;
1614
+ margin: 0;
1615
+ padding-left: 1rem;
1616
+ }
1617
+ .bar {
1618
+ height: 0.5rem;
1619
+ border-radius: 999px;
1620
+ background: var(--secondary);
1621
+ overflow: hidden;
1622
+ }
1623
+ .bar > span {
1624
+ display: block;
1625
+ height: 100%;
1626
+ background: var(--foreground);
1627
+ }
1601
1628
  `;
1602
1629
  const str = (props, key, fallback = "") => typeof props[key] === "string" ? props[key] : fallback;
1603
1630
  const list = (value) => Array.isArray(value) ? value : [];
@@ -1618,6 +1645,34 @@ const renderers = {
1618
1645
  </section>
1619
1646
  `,
1620
1647
  Separator: () => T`<hr />`,
1648
+ Tabs: (props, host) => {
1649
+ const labels = list(props["labels"]);
1650
+ const panels = props.children ?? [];
1651
+ const active = Math.min(host.view["tab"] ?? 0, Math.max(panels.length - 1, 0));
1652
+ return T`
1653
+ <div class="stack" data-direction="vertical">
1654
+ <div class="tabs" role="tablist">
1655
+ ${labels.map((label, index) => T`<button
1656
+ type="button"
1657
+ role="tab"
1658
+ aria-selected=${index === active ? "true" : "false"}
1659
+ @click=${() => {
1660
+ host.view["tab"] = index;
1661
+ host.refresh();
1662
+ }}
1663
+ >
1664
+ ${label}
1665
+ </button>`)}
1666
+ </div>
1667
+ ${panels[active] ? host.renderChild(panels[active]) : A}
1668
+ </div>
1669
+ `;
1670
+ },
1671
+ Grid: (props, host) => T`
1672
+ <div class="grid" style=${`grid-template-columns: repeat(${Number(props["columns"] ?? 2)}, minmax(0, 1fr))`}>
1673
+ ${children(props, host)}
1674
+ </div>
1675
+ `,
1621
1676
  Heading: (props) => {
1622
1677
  const text = str(props, "text");
1623
1678
  if (props["level"] === 2) return T`<h2>${text}</h2>`;
@@ -1651,6 +1706,33 @@ const renderers = {
1651
1706
  </div>
1652
1707
  `,
1653
1708
  Chart: (props) => T`<div class="chart" ${echart(chartSpecFromProps(props))}></div>`,
1709
+ Timeline: (props) => T`
1710
+ <ol class="timeline">
1711
+ ${list(props["items"]).map((item) => T`<li>
1712
+ <strong>${String(item["title"] ?? "")}</strong>
1713
+ ${item["time"] ? T`<p class="muted">${String(item["time"])}</p>` : A}
1714
+ ${item["description"] ? T`<p>${String(item["description"])}</p>` : A}
1715
+ </li>`)}
1716
+ </ol>
1717
+ `,
1718
+ Progress: (props) => {
1719
+ const value = Math.max(0, Math.min(100, Number(props["value"] ?? 0)));
1720
+ return T`
1721
+ <div class="metric">
1722
+ ${props["label"] ? T`<span class="muted">${str(props, "label")}</span>` : A}
1723
+ <div
1724
+ class="bar"
1725
+ role="progressbar"
1726
+ aria-valuenow=${value}
1727
+ aria-valuemin="0"
1728
+ aria-valuemax="100"
1729
+ aria-label=${str(props, "label", "Progress")}
1730
+ >
1731
+ <span style=${`width: ${value}%`}></span>
1732
+ </div>
1733
+ </div>
1734
+ `;
1735
+ },
1654
1736
  FileLink: (props) => T`<p>${str(props, "label", str(props, "path"))}</p>`,
1655
1737
  Form: (props, host) => T`
1656
1738
  <form @submit=${(event) => event.preventDefault()}>
@@ -1752,12 +1834,16 @@ function apiSchema(shape) {
1752
1834
  function defineElement(api, render) {
1753
1835
  class WebSkillA2uiElement extends A2uiLitElement {
1754
1836
  static styles = sharedStyles;
1837
+ view = {};
1755
1838
  createController() {
1756
1839
  return new A2uiController(this, api);
1757
1840
  }
1758
1841
  renderChild(ref) {
1759
1842
  return this.renderNode(ref);
1760
1843
  }
1844
+ refresh() {
1845
+ this.requestUpdate();
1846
+ }
1761
1847
  render() {
1762
1848
  const props = this.controller?.props;
1763
1849
  return props ? render(props, this) : A;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webskill/sdk",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "WebSkill \u2014 browser/Node agent skill runtime (skills, tools, MCP, governance, UI)",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -40,6 +40,10 @@
40
40
  "types": "./dist/governance.d.ts",
41
41
  "import": "./dist/governance.js"
42
42
  },
43
+ "./agent": {
44
+ "types": "./dist/agent.d.ts",
45
+ "import": "./dist/agent.js"
46
+ },
43
47
  "./testing": {
44
48
  "types": "./dist/testing.d.ts",
45
49
  "import": "./dist/testing.js"
@@ -92,6 +96,7 @@
92
96
  },
93
97
  "devDependencies": {
94
98
  "@types/node": "24.13.3",
99
+ "@webskill/agent": "workspace:*",
95
100
  "@webskill/browser": "workspace:*",
96
101
  "@webskill/core": "workspace:*",
97
102
  "@webskill/governance": "workspace:*",