Fabric AI Framework — 平台架构、计费与治理

基于 fabric-ai-framework 仓库的 Spec 文档分析:Copilot Item、服务架构、Skills/Plugin、Billing、Governance

📦 fabric-ai-framework repo 📋 Spec Analysis 📅 2026-05-20

返回 Framework Deep Dive 主页
§1

Feature 全景 · Platform Feature Map (F1–F18)

Fabric AI Framework 的 specs/features/ 目录定义了 18 个 Feature 领域,覆盖从前端集成到后端治理的完整平台能力。以下是全景索引。

📄 specs/features/*.md

IDFeature核心内容本文详述
F1Portal IntegrationCopilot 面板在 Fabric Portal 中的嵌入、路由、iframe 托管
F2Conversations多轮对话、消息渲染、SSE streaming
F3Session Storage会话持久化、OneLake / DB 双后端
F4Session Context上下文注入:workspace、artifact、user profile
F5Session Instructions共享 workspace 级指令 artifact
F6Agent SelectionAgent Mode vs Ask Mode 切换
F7Model Support多模型获取策略:Capacity / BYOG / BYOM§7
F8Change ApprovalApproval Cards、post-execution review toolbar
F9Copilot ItemCopilot Item 作为存储/配置/计费容器§2
F10Workload Frontend Session API编程式 pane/session 控制
F11Workload Extension SkillsWorkload 贡献 skill 的注册与治理§4
F12Workload Extension Remote MCP远程 MCP server 注册与 auth 注入§4
F13Inline Tool UI PlatformRich in-chat 组件(图表、表格、表单)
F14Workload Extension EvaluationSkills/Tools 回归测试平台
F15Agent Execution EnvironmentADC sandbox、SDK 集成、工具清单§5
F16Billing & MeteringCU-based 计费、token 计量、PAYG§6
F17Copilot GovernanceTenant/Workspace 治理策略、模型/Skills 审批§7
F18Telemetry & ObservabilityOCV 反馈、usage dashboards、tracing

📌 本页聚焦 F9、F11/F12、F15、F16、F17 以及跨 Feature 的架构设计,UX 层(F1–F4、F8、F13)详见 UX 代码分析

§2

Copilot Item 与 Session · Copilot Item & Session Model

Copilot Item 是 Fabric AI Framework 中的核心 artifact,承担三个角色。

📄 specs/building-blocks/copilot-item.md · specs/features/09-copilot-item.md · engineering/010-architecture/010-!!-architecture.md

2.1 Copilot Item 的三重角色

存储容器 Session 数据(消息、状态、附件)持久化到 Copilot Item 下的 OneLake 路径。每个 workspace 自动创建一个 Copilot Item(auto-create on first use)。

配置载体 Copilot Item 承载 workspace 级配置:可用模型、启用的 skills、session instructions、权限策略。

计费锚点 所有 session 计费归属到 Copilot Item 所在的 workspace capacity。Copilot Item = 计费上下文的 root。

2.2 Copilot Item 配置维度

维度内容说明
PermissionsRBAC 权限模型继承 workspace 角色:Admin / Member / Contributor / Viewer 映射到 Copilot 操作权限
MetadataItem 元数据Display name、description、Git integration(CI/CD 支持版本控制)
Identity身份与 authDelegated identity(用户身份传递到 backend)或 service identity
Model Config模型选择默认模型、可用模型列表、BYOM endpoint 配置
Plugin ConfigSkills 启用启用/禁用的 skills 列表、workload extension skills 注册

2.3 Session 设计原则

💡 D-12: Sessions are private by default. — Session 数据默认仅对创建者可见。Admin 可通过治理策略获得访问权,但需要显式授权。

  • Session 与 Copilot Item 的关系:1 Copilot Item → N Sessions。Session 归属于创建时的 Copilot Item,不可迁移。
  • Session 与 User 的关系:Session 绑定创建者 identity。其他用户无法访问(除非 admin 显式配置共享)。
  • Session 状态隔离:每个 Session 有独立的 conversation history、tool state、agent context,互不干扰。

2.4 Session 生命周期状态机

┌──────────────┐ │ Provisioning │ ← 用户首次打开 Copilot / 创建新 session └──────┬───────┘ │ container ready ▼ ┌──────────────┐ │ Active │ ← 用户交互中,agent 运行中 └──────┬───────┘ │ idle timeout (configurable) ▼ ┌──────────────┐ │ Suspended │ ← container 释放,session 数据保留在 OneLake └──────┬───────┘ │ user resumes ▼ ┌──────────────┐ │ Active │ ← 重新分配 container,恢复 session 状态 └──────────────┘ 状态转换: Provisioning → Active : sandbox container 就绪 + SDK 初始化完成 Active → Suspended : idle 超时(sweeper 检测),释放 compute 资源 Suspended → Active : 用户发送新消息,触发 container re-provision Active → Teardown : 显式删除 session 或 workspace 删除 Suspended → Teardown : session 过期 / admin 清理

📌 Auto-suspend 是成本优化的关键机制 — active session 的 compute 按 CU-seconds 计费,suspend 后仅计 storage 费用。

§3

服务架构与职责分工 · Service Architecture & Responsibilities

Fabric Copilot 的服务架构分为四层,每层有明确的职责边界。

📄 engineering/010-architecture/010-!!-architecture.md · engineering/010-architecture/011-sessions-responsibilities.md

3.1 四层架构

┌─────────────────────────────────────────────────────────────┐ │ Browser Layer │ │ Fabric Portal (Angular) → iframe → fabric-chat (React) │ │ PostMessage bridge: tokens, theme, context, navigation │ └────────────────────────┬────────────────────────────────────┘ │ REST / SSE ┌────────────────────────▼────────────────────────────────────┐ │ Shared Services Layer │ │ MWC (Managed Workload Controller) │ │ Sessions CRUD · Auth · Routing · Billing Events │ │ ADC provisioning · OneLake storage │ └────────────────────────┬────────────────────────────────────┘ │ Container API (app-only token) ┌────────────────────────▼────────────────────────────────────┐ │ Container Layer (ADC Sandbox) │ │ GitHub Copilot SDK · Agent Runtime · Tool Execution │ │ Skills loading · MCP server · FUSE filesystem │ └────────────────────────┬────────────────────────────────────┘ │ Egress proxy (SecretRef) ┌────────────────────────▼────────────────────────────────────┐ │ External Services │ │ LLM providers · Fabric APIs · OneLake · Graph API │ └─────────────────────────────────────────────────────────────┘

3.2 职责划分

层级组件职责
Shared Services MWC / ADC Platform Session CRUD、用户认证(MSAL token 验证)、请求路由到正确 container、billing event 上报、OneLake 持久化
MWC Managed Workload Controller Copilot Item 管理、session 生命周期、container 编排、capacity 检查(HTTP 402 拦截)、message routing
Container ADC Sandbox GitHub Copilot SDK 运行、agent conversation loop、tool invocation、skill loading、MCP server hosting、代码执行
Browser fabric-chat React App UI 渲染、SSE 消费、PostMessage bridge 与 Angular shell 通信、用户输入处理

3.3 通信路径与认证

路径协议认证方式说明
Browser → Shared REST + SSE MSAL Bearer Token (delegated) 用户身份,从 Angular shell 通过 PostMessage 获取 token
Shared → Container Container API (REST) App-only Token 系统身份,非用户 token。Container 内部所有操作都在隔离 sandbox 中
Container → External HTTPS (egress proxy) SecretRef Token Injection ADC egress proxy 自动注入 secrets。Container 本身无持久化 credential
Browser ↔ Angular Shell PostMessage Origin 校验 Token 获取、theme、artifact search、navigation、OneDrive picker

💡 安全边界:Container 是零信任的 — 不持有任何长期 credential,所有外部调用通过 egress proxy 注入 token。这确保了即使 container 被攻破,攻击面也被限制在单个 session 的生命周期内。

§4

Skills & Plugin 模型 · Skills & Plugin Architecture

Fabric AI Framework 采用 单一 Plugin 模型(Single Plugin Model),所有 skill 通过统一注册和路由机制加载到 agent。

📄 specs/building-blocks/plugin.md · specs/building-blocks/plugin-contribution.md · engineering/060-agent/066-skills-loading.md

4.1 单一 Plugin 模型(D-8)

💡 D-8: Single Plugin Model. — 每个 Copilot session 加载一个统一的 Plugin,该 Plugin 内部包含所有可用的 skills。不存在多 Plugin 并行的架构。

这意味着:

  • 所有 workload 贡献的 skills 被合并到单一 Plugin 中
  • Agent 看到的是一个扁平的 tool 列表,不感知 skill 来源
  • Skill 的启用/禁用通过 Copilot Item 配置控制

4.2 Context-Aware Skill 路由

上下文信号路由行为示例
Active Artifact 优先加载与当前打开 artifact 类型匹配的 skills 打开 Notebook → 加载 Spark/Python skills;打开 Report → 加载 DAX/Visualization skills
Workspace Workloads 根据 workspace 中已安装的 workload 加载对应 skills Workspace 有 Data Factory → 加载 Pipeline skills
User Role 根据用户在 workspace 中的角色过滤可用 skills Viewer 角色 → 隐藏写操作相关 skills
Governance Policy 根据 tenant/workspace 治理策略过滤 skills Admin 禁用了某些 skills → 不加载

4.3 SKILL.md 格式

每个 skill 通过 SKILL.md 文件定义,使用 YAML frontmatter + Markdown body:

---
name: fabric-sql-query
description: Execute SQL queries against Fabric SQL endpoints
version: 1.2.0
workload: data-warehouse
requires:
  - mcp-server: fabric-sql-endpoint
permissions:
  - read:warehouse
  - execute:query
---

# Fabric SQL Query Skill

You can execute SQL queries against any Fabric SQL endpoint
in the current workspace.

## Usage
- User asks to query data → use `execute_sql` tool
- Always validate query before execution
- Return results in markdown table format

4.4 Skills vs MCP Tools vs Agent Tools

概念定义注册方式生命周期
Skills 高层业务能力,包含 instructions + tool 组合 SKILL.md 文件,通过 virtual FS 或 workload extension 注册 Session 级动态加载,可按上下文切换
MCP Tools MCP 协议定义的标准工具接口 MCP Server 注册,远程或本地 Container 级,随 container 启动加载
Agent Tools Agent 运行时内置工具 SDK 内置,不可外部注册 永久可用,所有 session 共享

⚠️ 动态 Skill 切换尚未解决engineering/060-agent/067-skills-dynamic-switching.md 标记为 unresolved。当前 skill 在 session 创建时加载,运行中切换存在状态一致性问题。

§5

Agent 运行时 & 工具 · Agent Runtime & Tools

Agent 运行在 ADC(Azure Data Container)sandbox 中,基于 GitHub Copilot SDK 构建。

📄 engineering/060-agent/063-agent-tools.md · engineering/060-agent/065-agent-design.md · specs/features/15-agent-execution-environment.md

5.1 默认工具清单(16 Tools)

#工具名类别功能
1report_intentAgent 协调向用户报告当前意图,更新 UI 状态
2sql数据操作执行 SQL 查询(Fabric SQL endpoint)
3taskAgent 协调启动子 agent 执行复杂任务
4read_agentAgent 协调读取后台 agent 结果
5write_agentAgent 协调向 idle agent 发送消息
6list_agentsAgent 协调列出所有活跃后台 agent
7grep文件系统在文件内容中搜索模式
8glob文件系统按模式查找文件
9view文件系统查看文件/目录内容
10edit文件系统编辑文件(string replacement)
11create文件系统创建新文件
12powershell执行环境运行 PowerShell / bash 命令
13web_fetch网络获取 URL 内容(HTML → Markdown)
14web_search网络AI-powered web 搜索
15manage_schedule调度创建/管理定时任务
16skillSkills调用注册的 skill

5.2 执行环境详情

Runtime
ADC (Azure Data Container) — 隔离 sandbox 环境
SDK
GitHub Copilot SDK — conversation loop, tool invocation, streaming
Filesystem
FUSE-based Virtual Fabric Filesystem — 动态挂载 workspace 资源
Image
Versioned container image — 支持 rollback(tag-based versioning)
Networking
Egress-only via proxy — 无入站连接,所有外部调用通过 egress proxy
Lifecycle
Session-bound — container 随 session 创建分配,idle 后 suspend/释放

5.3 Virtual Fabric Filesystem (FUSE)

Container 内部通过 FUSE 挂载一个虚拟文件系统,将 Fabric 资源映射为文件路径:

/fabric/
├── workspace/
│   ├── artifacts/          # Workspace 中的 artifacts 列表
│   │   ├── notebook-1.ipynb
│   │   ├── report-1.pbix
│   │   └── ...
│   ├── skills/             # 已注册的 skills(SKILL.md 文件)
│   │   ├── sql-query/SKILL.md
│   │   ├── spark-execute/SKILL.md
│   │   └── ...
│   └── config/             # Copilot Item 配置
│       ├── models.json
│       └── governance.json
├── session/
│   ├── history/            # 当前 session 的对话历史
│   └── state/              # Session state(tool state, checkpoints)
└── user/
    └── profile.json        # 用户 profile 信息

📌 FUSE 文件系统让 agent 可以使用标准文件操作(viewgrepglob)来发现和访问 Fabric 资源,无需 workload-specific API 集成。

§6

Billing 计费架构 · Billing & Metering

Fabric AI Framework 的计费体系涵盖三类资源的成本归属和计量。以下内容基于 fabric-ai-framework 仓库中的 spec 文档。

📄 specs/building-blocks/billing.md · specs/features/16-billing-platform.md · engineering/900-fundamentals/904-fundamentals-billing.md

6.1 计费核心原则

💡 All billing happens in the context of the workspace where the session is stored. — 所有计费都发生在 session 所在 workspace 的上下文中。Cost 归属遵循 workspace → capacity → tenant 层级链。

6.2 三类计费资源 (Billable Resource Categories)

资源类别计量单位计费来源说明
Model Inference
(LLM 推理)
Input/Output tokens LLM provider response metadata Fabric Capacity Models 走 Fabric 计费(消耗 CU);BYOG/BYOM 路径不走 Fabric 计费
MCP Tool & API 操作 现有资源计量 各 Fabric 资源自有 billing AI 触发的操作 等同于用户直接触发,无额外 AI 附加费。MCP tool 执行本身不单独计费
Compute 执行 CU-seconds (CPU × 时长) ADC sandbox 运行时间 Spark job、SQL 查询等后端计算,每 60 秒上报一次 CU-seconds

另外,Session Storage(会话历史存储)也产生计费,按 GB 计量,会话删除后停止计费。

6.3 模型获取策略 vs 计费路径

获取策略Billing Model说明
Fabric Capacity Models Billed through Capacity 消耗 workspace Fabric capacity 的 Capacity Units (CUs)唯一产生 Fabric 收入的模型路径
Bring Your Own GitHub Copilot (BYOG) BYOL 用户使用自有 GitHub Copilot 订阅。无 Fabric 计费,成本归属于 GitHub 订阅
Bring Your Own Model Endpoint (BYOM) BYOL 用户自带 Azure AI Foundry 或 Cloud Foundry 实例。无 Fabric 计费,成本归属于外部服务

⚠️ Key Rule:只有 Fabric Capacity Models 通过 Fabric capacity 计费。所有其他模型获取策略的 LLM 费用对 Fabric 计费系统透明。Finance 和 PM 必须确保计费模型能处理同一 tenant 使用多种获取策略的混合场景。

6.4 容量要求 & 准入控制

  • 最低容量:Session 创建需要 workspace 所在 capacity 为 F0 (PAYG)F64+
  • 无 Capacity 时拦截:若 Copilot item 未分配 Fabric Capacity,session 创建被 HTTP 402 拒绝,并显示错误信息 + capacity 设置链接
  • Copilot Capacitytenant 级别的,跨 capacities 共享,admin 通过 security groups 映射

6.5 计费事件上报 (Feature Spec User Stories)

Story场景行为
F16-S2 LLM Token 计量 每次 LLM 调用后:Fabric Capacity Model → post llm_tokens billing event;BYOG/BYOM → 不发送 Fabric billing event。从 LLM response metadata 提取 token count,计量准确率 ≥99%
F16-S3 Compute 计量 Session active 期间每 60 秒向 Fabric Billing API 上报 Compute CU-seconds。计费时钟从 environment active 开始,到 idle/teardown 结束
F16-S4 Storage 计量 会话历史存在期间,workload 按标准间隔 post storage metering events。删除 session 立即停止 storage 计费
F16-S5 消费归属 所有 CU 和 token 消费 归属到 Copilot item 所在 capacity。无 fallback 到 tenant 级 capacity
F16-S6 报表可见性 AI token 和 CU 消费 出现在标准 Fabric capacity utilization report 中,含 per-workspace breakdown,无需额外配置

6.6 避免双重收费 (No Double-Charging)

这是计费设计中的 核心约束

  • MCP tool 触发的 Fabric API 操作 按现有规则计费(如 DW 查询消耗 CU),不额外加收 AI 附加费
  • 只有 最近的 emitting operation 应该收费 — parent/child 或跨 API 调用不能重复计量
  • BYOG Copilot 和 BYOM 路径 仅计 compute + storage,不计 LLM token 费用

6.7 Itemless / Workspace-less 挑战

Unified Copilot 的一大计费挑战是 session 不绑定单一 item 或 workspace

  • OneLake 目前是 item-centric → 对 session 级存储有摩擦
  • 解决方案:引入 virtual artifact / virtual workspace 概念,用于在没有传统 Fabric item 的情况下进行计量
  • 跨 workspace 操作必须显式处理 cost attribution

6.8 待解决问题 (Open Questions)

OQ-5 Cross-Charge Billing & CU Metering

  • 谁付费? — user capacity / workspace capacity / tenant?
  • CU 计量粒度? — LLM 推理 vs 数据处理的 CU 消耗比率
  • 跨 workspace 场景 — skill 跨多个 workload / resource 时的 cost attribution

Prerequisite: Cost Attribution ID 基础设施(telemetry contract)必须先实现

OQ-6 Pay-As-You-Go (PAYG) 定价模型

  • 什么触发 PAYG 计费? — per-token? per-execution? per-compute-job?
  • PAYG 与 Capacity-based 的关系? — 并存还是替代?
  • 定价透明度? — 执行前是否需要估算 token 成本?
  • 计费频率? — per-session / daily / monthly?

Impact: PAYG 需要实时成本估算、用户通知、budget caps/alerts

6.9 约束与要求

级别要求
Must计费始终在 session 所在 workspace 上下文中发生
Must仅 Fabric Capacity Models 通过 Fabric 计费 — BYOG/BYOM 外部处理
MustCost attribution telemetry 必须标记 workspace ID、session ID、user identity
MustSkills 触发的 compute 必须归属到 session 的 workspace capacity
Should向 workspace 管理员提供 cost visibility(AI 相关 CU 消耗 dashboard)
Should支持 budget alerts — 接近 capacity 限制时预警
Should执行前向用户展示预估成本(如果 PAYG 模型可行)
Avoid无用户同意的跨 workspace 计费
Avoid无上限的成本暴露 — PAYG 必须有 caps/alerts/approval workflows
Avoid不透明计费 — 用户应能追溯到具体 session 或 skill 执行

6.10 已确认决策 (2026-04-20 Meeting)

#决策说明
1CU-based billingCopilot 所有资源(compute、storage、LLM)统一使用 CU 计费
2Virtual artifact / workspace为 itemless Copilot 探索 virtual artifact 模型以支持计量
3Capacity-based > ServerlessCapacity-based 计费优先于 serverless,保证可预测性和隔离性
4Public Preview 必须有 billing不可例外 — 无计费不能发 public preview

📌 Owner: Teddy Bercovitz(Billing spec owner),与 Finance + GitHub PM 协作。详见 specs/building-blocks/billing.mdmeetings/2026-04-20 Fabric Copilot Billing.md

§7

Governance & 模型管理 · Governance & Model Management

Fabric AI Framework 的治理体系覆盖从 tenant 到 workspace 的三层控制,以及模型获取的三条路径。

📄 specs/building-blocks/governance.md · specs/building-blocks/models.md · specs/features/17-copilot-governance.md

7.1 三层治理层级

┌─────────────────────────────────────────────┐ │ Tenant Level │ │ Admin Portal → Global Policies │ │ - Enable/Disable Copilot for tenant │ │ - Approved model list │ │ - Data residency requirements │ └──────────────────┬──────────────────────────┘ │ inherit + override ┌──────────────────▼──────────────────────────┐ │ Workspace Level │ │ Workspace Admin → Workspace Policies │ │ - Enable/Disable specific skills │ │ - Model selection (within tenant allowed) │ │ - Session instruction artifacts │ └──────────────────┬──────────────────────────┘ │ apply ┌──────────────────▼──────────────────────────┐ │ Session Level │ │ Runtime enforcement │ │ - Filtered tool list based on policies │ │ - Model routing based on config │ │ - Audit logging of all actions │ └─────────────────────────────────────────────┘

7.2 治理域 (6 Domains)

Domain治理范围控制粒度示例
Copilot Access 谁能使用 Copilot Tenant / Workspace Admin 可完全禁用 Copilot for tenant,或限制特定 workspace
Model Governance 哪些模型可用 Tenant / Workspace Approved model list、BYOM endpoint 白名单、默认模型设置
Skills Governance 哪些 skills 可用 Tenant / Workspace 启用/禁用特定 workload skills、第三方 skills 审批
Data Governance 数据访问范围 Workspace / Session Agent 可访问的 artifact 范围、数据分类标签遵从
Action Governance 哪些操作需要审批 Workspace / Session 写操作需要 approval card 确认、高风险操作需要 admin 审批
Audit & Compliance 操作记录与合规 Tenant 所有 agent 操作的 audit log、数据驻留合规、retention 策略

7.3 模型获取策略 (3 Paths)

策略模型来源计费治理
Fabric Capacity Models Fabric 内置 LLM 服务 CU-based(Fabric capacity 扣减) Fabric 管理模型版本与可用性
BYOG 用户 GitHub Copilot 订阅 GitHub 订阅计费 用户自行管理订阅,Fabric 仅校验 token 有效性
BYOM Azure AI Foundry / Cloud Foundry 外部服务计费 Admin 配置 endpoint + credentials,tenant 级白名单

💡 BYOM-first 策略的理由:Private Preview 阶段优先支持 BYOM,因为 (1) 无需 Fabric billing 集成即可上线,(2) 企业客户通常已有 Azure AI 资源,(3) 模型选择灵活性满足不同 compliance 需求。Fabric Capacity Models 随 GA 逐步推出。

§8

生态集成 & 边界 · Ecosystem Integration & Boundaries

Fabric AI Framework 定义了清晰的 Builder / Consumer 角色边界,以及与 GitHub Copilot 生态的集成关系。

📄 specs/building-blocks/ecosystem-integration.md · engineering/300-frontend/300-!!-frontend-dev-design.md

8.1 Builder vs Consumer 角色

维度Builder(Workload 团队)Consumer(终端用户)
身份 Fabric workload 开发者、ISV 合作伙伴 Fabric workspace 中的数据分析师、工程师
接触面 Skills SDK、MCP server 注册、Plugin contribution API Copilot chat pane、Approval Cards、session management
治理角色 提交 skills/tools 供审批,遵从 quality gates 使用 admin 批准的 skills/models,遵从 workspace 策略
Billing 视角 Skill 执行 compute 计入 consumer 的 workspace capacity 承担 session 产生的所有费用(LLM + compute + storage)
开发工具 VS Code + Copilot CLI(本地开发/测试 skills) Fabric Portal(浏览器内 Copilot 交互)

8.2 与 GitHub Copilot 的边界 (D-7)

💡 D-7: GitHub Copilot = SDK provider, not a competing product. — Fabric Copilot 使用 GitHub Copilot SDK 作为核心引擎,但 UX、session 管理、billing、governance 完全由 Fabric 控制。

能力GitHub Copilot SDK 提供Fabric 平台提供
Conversation Loop ✅ 消息处理、tool invocation、streaming Session 管理、持久化、resume
Model Access ✅ BYOG 路径(GitHub token) Fabric Capacity Models、BYOM 路径
Tool Framework ✅ Tool registration、invocation protocol Fabric-specific tools(SQL、OneLake、governance)
UX ❌ 不提供 — SDK 是 headless ✅ 完整 Chat UX(fabric-chat React app)
Billing ❌ 不涉及 Fabric billing ✅ CU-based billing、capacity management
Governance ❌ 无 enterprise governance ✅ Tenant/Workspace 级治理策略

8.3 前端 CopilotHostService 架构

Fabric Portal 前端通过 CopilotHostService 为 workload 提供编程式 Copilot 集成:

┌──────────────────────────────────────────────────────┐ │ Fabric Portal (Angular) │ │ │ │ ┌─────────────────────────────────────────────┐ │ │ │ CopilotHostService │ │ │ │ ├─ openCopilotPane(config) │ │ │ │ ├─ closeCopilotPane() │ │ │ │ ├─ sendMessage(text, context) │ │ │ │ ├─ onSessionCreated(callback) │ │ │ │ └─ setSessionContext(artifactContext) │ │ │ └──────────────────┬──────────────────────────┘ │ │ │ PostMessage │ │ ┌──────────────────▼──────────────────────────┐ │ │ │ fabric-chat (iframe, React App) │ │ │ │ ├─ Receives context from host │ │ │ │ ├─ Manages session lifecycle │ │ │ │ └─ Renders chat UI (SSE streaming) │ │ │ └─────────────────────────────────────────────┘ │ │ │ │ Workload Frontend SDK (F10) │ │ ├─ Workload can call CopilotHostService │ │ ├─ Inject artifact-specific context │ │ └─ Register inline tool UI components │ └──────────────────────────────────────────────────────┘

通过 CopilotHostService,workload 前端可以:

  • 打开/关闭 Copilot 面板,并传入特定上下文
  • 发送预填充消息(如 "Diagnose this error" + error context)
  • 监听 session 事件(创建、结束、approval 请求)
  • 注入 artifact context(当前打开的 notebook/report/pipeline 信息)

📌 关键集成模式:Workload 不直接与 agent 通信 — 所有交互通过 CopilotHostService → PostMessage → fabric-chat → Shared Services 链路。这保证了安全隔离和统一治理。