> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hitheo.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# 技能构建器

> 以编程方式管理技能构建器 —— 创建、编译、测试和发布。

Canvas API 让你以编程方式管理 E.V.I. 可视化技能图。将技能设计为节点图，将其编译为清单（manifest），在沙箱中测试，然后发布到市场或你的组织中。

## 列出画布

```typescript theme={null}
const canvases = await theo.canvases();
```

## 获取画布

```typescript theme={null}
const canvas = await theo.canvas("canvas-uuid");
```

## 创建画布

```typescript theme={null}
const canvas = await theo.createCanvas({
  name: "Support Agent",
  description: "Customer service skill with knowledge base",
  graph_json: {
    nodes: [
      { id: "in", type: "input", position: { x: 300, y: 0 }, data: { type: "input", label: "Input", config: { triggerType: "manual" } } },
      { id: "p1", type: "prompt", position: { x: 280, y: 120 }, data: { type: "prompt", label: "Prompt", config: { content: "You are a helpful support agent." } } },
      { id: "m1", type: "model", position: { x: 300, y: 260 }, data: { type: "model", label: "Model", config: { modelId: "theo-1-flash" } } },
      { id: "out", type: "output", position: { x: 300, y: 400 }, data: { type: "output", label: "Output", config: { format: "text" } } },
    ],
    edges: [
      { id: "e1", source: "in", target: "p1" },
      { id: "e2", source: "p1", target: "m1" },
      { id: "e3", source: "m1", target: "out" },
    ],
  },
});
```

## 更新画布

```typescript theme={null}
await theo.updateCanvas(canvas.id, {
  name: "Updated Support Agent",
  graph_json: updatedGraph,
});
```

## 删除画布

```typescript theme={null}
await theo.deleteCanvas(canvas.id);
```

## 编译

校验图的拓扑结构，并将其编译为 `SkillManifest` 和 `WorkflowSteps`。

```typescript theme={null}
const result = await theo.compileCanvas(canvas.id);
if (result.compiled) {
  console.log("Manifest:", result.manifest);
  console.log("Steps:", result.steps);
} else {
  console.error("Errors:", result.errors);
}
```

## 测试（沙箱）

通过已编译的画布发送一条测试消息。工具调用会被模拟执行。

```typescript theme={null}
const test = await theo.testCanvas(canvas.id, "Check stock for SKU-1234");
console.log(test.response);
console.log(`Cost: ${test.cost_cents} cents`);
```

带历史记录的多轮测试：

```typescript theme={null}
const test = await theo.testCanvas(canvas.id, "What about SKU-5678?", [
  { role: "user", content: "Check stock for SKU-1234" },
  { role: "assistant", content: "SKU-1234 has 47 units in stock." },
]);
```

## 发布

编译、审核，然后作为技能发布。选择可见范围：

```typescript theme={null}
// Private — only you
await theo.publishCanvas(canvas.id, {
  slug: "my-agent",
  version: "1.0.0",
  author: { name: "Your Name" },
  visibility: "private",
});

// Organization — visible to your org members
await theo.publishCanvas(canvas.id, {
  slug: "team-agent",
  version: "1.0.0",
  author: { name: "Your Name" },
  visibility: "org",
  target_org_id: "org-uuid",
});

// Public marketplace
await theo.publishCanvas(canvas.id, {
  slug: "public-agent",
  version: "1.0.0",
  author: { name: "Your Name" },
  visibility: "public",
  readme: "# Public Agent\nA skill for everyone.",
});
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.