> ## 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.