@zq-silk/yui 0.15.8 → 0.15.9
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/ARCHITECTURE.md +2 -0
- package/ARCHITECTURE.zh-CN.md +151 -0
- package/README.md +211 -14
- package/dist/artifacts/artifactCapability.js +74 -0
- package/dist/artifacts/artifactCommitLock.js +249 -0
- package/dist/artifacts/artifactPaths.js +151 -0
- package/dist/artifacts/gitArtifactRef.js +146 -0
- package/dist/artifacts/managedGit.js +332 -0
- package/dist/artifacts/taskArtifactRepository.js +277 -0
- package/dist/cli/commandCatalog.js +14 -10
- package/dist/cli.js +67 -0
- package/dist/commands/operatorCommands.js +33 -2
- package/dist/commands/taskActivationCommands.js +22 -0
- package/dist/commands/taskCommands.js +342 -79
- package/dist/context/runContextPack.js +28 -16
- package/dist/context/taskContext.js +26 -3
- package/dist/controller/controller.js +8 -2
- package/dist/kernel/builtinCapabilities.js +32 -24
- package/dist/message/message.js +56 -0
- package/dist/plugins/pluginService.js +11 -3
- package/dist/resources/projectResource.js +0 -48
- package/dist/resources/projectResourceService.js +3 -81
- package/dist/setup/setupCommand.js +3 -8
- package/dist/storage/migrations/artifactsToGit.js +338 -0
- package/dist/storage/migrations/submitIntent.js +126 -0
- package/dist/storage/sqliteSchema.js +37 -3
- package/dist/storage/sqliteStore.js +1 -21
- package/dist/storage/storageVersions.js +1 -1
- package/dist/storage/storeRpc.js +1 -1
- package/dist/task/taskActivation.js +26 -0
- package/dist/task/taskActivationService.js +85 -69
- package/dist/task/taskSubmission.js +236 -0
- package/dist/web/assets/client/app.js +3 -2
- package/dist/web/assets/client/taskSurface.js +96 -7
- package/dist/web/webServer.js +18 -3
- package/dist/web/webTaskSurface.js +6 -6
- package/dist/workItem/workItem.js +14 -10
- package/docs/agent-result-consumption.md +2 -0
- package/docs/agent-result-consumption.zh-CN.md +81 -0
- package/docs/agent-runtime-drivers.md +2 -0
- package/docs/agent-runtime-drivers.zh-CN.md +77 -0
- package/docs/architecture/README.md +44 -32
- package/docs/architecture/README.zh-CN.md +43 -0
- package/docs/architecture/capabilities-and-resources.md +118 -79
- package/docs/architecture/capabilities-and-resources.zh-CN.md +83 -0
- package/docs/managed-turn-and-session-runtime.md +2 -0
- package/docs/managed-turn-and-session-runtime.zh-CN.md +180 -0
- package/docs/observability/README.md +2 -0
- package/docs/observability/README.zh-CN.md +71 -0
- package/docs/plugin-sdk.md +320 -217
- package/docs/plugin-sdk.zh-CN.md +293 -0
- package/docs/provider-runtime.md +2 -0
- package/docs/provider-runtime.zh-CN.md +132 -0
- package/docs/release-workflow.md +2 -0
- package/docs/release-workflow.zh-CN.md +237 -0
- package/docs/roles-and-configuration.md +2 -0
- package/docs/roles-and-configuration.zh-CN.md +96 -0
- package/docs/sqlite-control-plane-design.md +2 -0
- package/docs/sqlite-control-plane-design.zh-CN.md +62 -0
- package/docs/task-dag-semantics.md +80 -57
- package/docs/task-dag-semantics.zh-CN.md +59 -0
- package/docs/task-delivery.md +2 -0
- package/docs/task-delivery.zh-CN.md +82 -0
- package/docs/task-local-identity.md +2 -0
- package/docs/task-local-identity.zh-CN.md +58 -0
- package/docs/testing/verification-levels.md +2 -0
- package/docs/testing/verification-levels.zh-CN.md +69 -0
- package/i18n/README.zh-CN.md +199 -10
- package/package.json +2 -1
- package/skills/yui-leader/SKILL.md +88 -331
- package/skills/yui-leader/references/execution.md +303 -0
- package/skills/yui-leader/references/planning.md +109 -0
- package/skills/yui-leader/references/task-plugins.md +8 -4
- package/skills/yui-operator/SKILL.md +16 -3
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { validateGitArtifactRef } from "../artifacts/gitArtifactRef.js";
|
|
1
2
|
import { normalizedUniqueIdentities, normalizedUniqueText, requireIdentity, requireText, requireTimestamp } from "../domain/validation.js";
|
|
2
3
|
import { validateReviewConfig } from "../review/reviewConfig.js";
|
|
3
4
|
import { taskFinalReviewConfig, validateTaskFinalReviewContract } from "../review/taskFinalReviewContract.js";
|
|
@@ -112,7 +113,7 @@ export function submitWorkItemCandidate(workItem, input, now) {
|
|
|
112
113
|
...(input.taskMainSnapshot === undefined
|
|
113
114
|
? {}
|
|
114
115
|
: { taskMainSnapshot: input.taskMainSnapshot }),
|
|
115
|
-
...(input.artifactRefs === undefined ? {} : { artifactRefs: input.artifactRefs.map((ref) => (
|
|
116
|
+
...(input.artifactRefs === undefined ? {} : { artifactRefs: input.artifactRefs.map((ref) => validateGitArtifactRef(ref)) }),
|
|
116
117
|
createdAt: now.toISOString()
|
|
117
118
|
});
|
|
118
119
|
const { outcome: _outcome, endedAt: _endedAt, ...base } = workItem;
|
|
@@ -502,17 +503,20 @@ export function validateWorkItemCandidate(candidate) {
|
|
|
502
503
|
if (candidate.artifactRefs !== undefined) {
|
|
503
504
|
if (!Array.isArray(candidate.artifactRefs))
|
|
504
505
|
throw new Error("Candidate Artifact refs must be an array.");
|
|
505
|
-
const
|
|
506
|
+
const identities = new Set();
|
|
506
507
|
for (const ref of candidate.artifactRefs) {
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
if (
|
|
512
|
-
|
|
513
|
-
throw new Error("Candidate Artifact digest is invalid.");
|
|
508
|
+
// Pure, no-I/O shape check: the commit self-certifies the frozen bytes,
|
|
509
|
+
// so a valid pinned reference is complete evidence on its own. Existence
|
|
510
|
+
// is proven lazily when the bytes are resolved on the async read path.
|
|
511
|
+
const valid = validateGitArtifactRef(ref);
|
|
512
|
+
if (valid.taskId !== candidate.taskId) {
|
|
513
|
+
throw new Error("Candidate Artifact scope, commit or path is invalid.");
|
|
514
514
|
}
|
|
515
|
-
|
|
515
|
+
const identity = `${valid.commit}:${valid.relativePath}`;
|
|
516
|
+
if (identities.has(identity)) {
|
|
517
|
+
throw new Error("Candidate Artifact scope, commit or path is invalid.");
|
|
518
|
+
}
|
|
519
|
+
identities.add(identity);
|
|
516
520
|
}
|
|
517
521
|
}
|
|
518
522
|
if (typeof candidate.source !== "object" || candidate.source === null) {
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
<p align="right"><a href="./agent-result-consumption.md">English</a> | <strong>简体中文</strong></p>
|
|
2
|
+
|
|
3
|
+
# Agent 结果消费
|
|
4
|
+
|
|
5
|
+
每一次显式派发的 AgentRun 都产生一个持久的原始结果。普通通知和原生对话不会
|
|
6
|
+
隐式创建 Run。所有权链上的下一个 Agent 读取这个精确结果并判断它意味着什么。
|
|
7
|
+
|
|
8
|
+
## 唯一的原始结果
|
|
9
|
+
|
|
10
|
+
`AgentRunResult.output` 是 Agent 撰写的报告。Core 保留其字节,不解析、不分类、
|
|
11
|
+
也不校验语义内容。Markdown、JSON 和普通散文都是合法的;缺少标题或结论不够有力
|
|
12
|
+
都是质量证据,而不是运行时失败。
|
|
13
|
+
|
|
14
|
+
Core 另外记录 Provider 身份/状态、完成时间、诊断、失败原因和系统拥有的工作区
|
|
15
|
+
证据。非空输出必须符合当前传输上限且不含 NUL。缺失或不可传输的文本会让 Run
|
|
16
|
+
失败,而不编造散文。当之后某个 Core 拥有的边界失败时,一份已到达的报告仍可以
|
|
17
|
+
留在一个 failed 的 Run 上。
|
|
18
|
+
|
|
19
|
+
终态结果会附带保存一条引用 Message。`task message show <task/message>` 和
|
|
20
|
+
Context inspect 展开同一个 `resultRef`。ReviewRound 不持有第二份报告。文件和
|
|
21
|
+
持久业务产物归 Artifact 或受管 Git 结果。
|
|
22
|
+
|
|
23
|
+
## 执行不等于验收
|
|
24
|
+
|
|
25
|
+
Run 生命周期是 `active / completed / failed`。Provider 结果、输入接受和资源静止
|
|
26
|
+
是彼此独立的事实。Run completed 只表示它所需的 Core 执行边界成功,而不表示答案
|
|
27
|
+
正确或 WorkItem 已验收。
|
|
28
|
+
|
|
29
|
+
可写的 replicated Lane 需要其精确的、Core 拥有的工作区证据。分支错误、快照脏、
|
|
30
|
+
owner 不符或范围不符都会让该边界失败,但不会替换一份已到达的原始报告。
|
|
31
|
+
|
|
32
|
+
只有 Leader 决定证据是否足以验收、继续工作、再审查或放弃。Core 从不从 Agent
|
|
33
|
+
文本中推导 findings、投票或修复拓扑。
|
|
34
|
+
|
|
35
|
+
## 直接执行与复制执行
|
|
36
|
+
|
|
37
|
+
直接的 WorkItem 执行使用一个 main Run,没有 ExecutionGroup。直接 Review 同样
|
|
38
|
+
使用一个 main Reviewer Run。
|
|
39
|
+
|
|
40
|
+
复制执行在一个冻结 Assignment 上使用彼此不同的 Producer Lane。每个 Producer
|
|
41
|
+
保留自己的原始结果和精确血缘。Leader 显式地把彼此不同的终态来源 Run 引用交给
|
|
42
|
+
综合。来源必须属于确切的 Group/Lane 且有结果,可以是 completed 或 failed。不存在
|
|
43
|
+
自动综合、投票、最少成功 Producer 数,也不要求在选择来源前等待所有 Lane。
|
|
44
|
+
|
|
45
|
+
综合快照保留所选来源顺序,以及它们原始输出、诊断和来源的有界视图,不复制完整
|
|
46
|
+
transcript。只有 main 综合结果能提供 WorkItem Candidate 或权威的 replicated
|
|
47
|
+
Review 结果。Producer 从不直接进入 Integration 或验收。重试针对失败的那次精确
|
|
48
|
+
执行,不会静默重跑已成功的 Producer。
|
|
49
|
+
|
|
50
|
+
## Review
|
|
51
|
+
|
|
52
|
+
ReviewRound 拥有冻结的 Candidate 或 Task-head 身份、工作区来源、执行拓扑、精确
|
|
53
|
+
的 main Reviewer Run、生命周期和 Core 诊断。它的 completed 状态是结构性执行证据,
|
|
54
|
+
而不是从报告里提取出来的“通过”。
|
|
55
|
+
|
|
56
|
+
Candidate 审查遵循其捕获的审查规则。Task-final 审查可以被显式请求,或由不可变的
|
|
57
|
+
final-review 合同要求。一次被请求的审查是证据,而不是要求此后每次改动都审查的
|
|
58
|
+
自动新策略。当前交付需要审查时,它必须覆盖确切的治理候选或 head 以及 completed
|
|
59
|
+
的 main Run。
|
|
60
|
+
|
|
61
|
+
Reviewer 应检查完整的有界范围,并把重要 findings 一并报告。Leader 读取完整报告,
|
|
62
|
+
把 findings 路由给原 owner,直接修复 Task-main 上的小问题,只为有独立价值的实质
|
|
63
|
+
工作创建新的 WorkItem。
|
|
64
|
+
|
|
65
|
+
## Leader 消费
|
|
66
|
+
|
|
67
|
+
唤醒窗口指向带结果的事件,包括在窗口之前创建、但在窗口之内完成的 Run。读取精确
|
|
68
|
+
来源:
|
|
69
|
+
|
|
70
|
+
```sh
|
|
71
|
+
yui task wake show <task> <wake>
|
|
72
|
+
yui task run show <task/run>
|
|
73
|
+
yui task message show <task/message>
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
一个可选的报告结构是:结果、改动/发现、验证、不确定性和下一步动作。它是沟通
|
|
77
|
+
建议,不是机器协议。
|
|
78
|
+
|
|
79
|
+
验收与 Task 完成仍是显式操作,并带有当前 Git、审查、范围和资源检查。参见
|
|
80
|
+
[执行与会话](managed-turn-and-session-runtime.zh-CN.md)和
|
|
81
|
+
[Task 依赖](task-dag-semantics.zh-CN.md)。
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
<p align="right"><a href="./agent-runtime-drivers.md">English</a> | <strong>简体中文</strong></p>
|
|
2
|
+
|
|
3
|
+
# Agent 运行时 Driver
|
|
4
|
+
|
|
5
|
+
AgentEndpoint 提供通用执行边界。Driver 把原生事件、错误和受支持的观察来源翻译
|
|
6
|
+
成 `RuntimeObservation`;Controller、Store、CLI 和 Web 消费这份共享合同。
|
|
7
|
+
|
|
8
|
+
## 职责
|
|
9
|
+
|
|
10
|
+
连接实现拥有启动、协议、prompt 投递、resume 和中断。Driver 拥有原生身份提取、
|
|
11
|
+
观察能力、事件/错误映射和用量归一化。Core 拥有权威、精确的请求关联、持久归并
|
|
12
|
+
和投影;Agent 选择恢复方式并判断语义进展。
|
|
13
|
+
|
|
14
|
+
内置 Driver 身份为 `openai/codex`、`anthropic/claude-code` 和
|
|
15
|
+
`acp/agent-client-protocol`。ACP 是协议 Driver,不是产品标签。接入一个 ACP peer
|
|
16
|
+
不需要另一套业务状态模型。
|
|
17
|
+
|
|
18
|
+
能力必须如实声明。未知的 resume、取消、活动或用量行为不能从产品名推断。
|
|
19
|
+
|
|
20
|
+
## 观察路径
|
|
21
|
+
|
|
22
|
+
原生结构化事实通过精确的 Session/请求围栏,进入运行时收件箱,并归并为持久观察
|
|
23
|
+
和原始结果。一个单独采样的用量来源可以馈入同一份规范合同。Driver 不能选择另一个
|
|
24
|
+
actor、指派后继 Run,也不能绕过围栏。
|
|
25
|
+
|
|
26
|
+
Yui Run 身份与 Provider 原生 Turn 身份不可互换。一个显式派发的 Run 保留其已接受
|
|
27
|
+
的原生关联;直接的原生对话不是另一个隐式 Run。重放按精确事实身份去重,迟到事件
|
|
28
|
+
不能终结一个后继。
|
|
29
|
+
|
|
30
|
+
受管 Codex 使用 App Server 事件。Claude 映射其结构化流以及受支持的 Hook/来源
|
|
31
|
+
负载。ACP 映射协议 Session 更新和 prompt 响应。终端文本、信任对话框和 prompt
|
|
32
|
+
字形都不是生命周期事实。
|
|
33
|
+
|
|
34
|
+
## 状态与错误证据
|
|
35
|
+
|
|
36
|
+
持久 Run 生命周期是 `active / completed / failed`。输入处置、原生等待/活动、Goal、
|
|
37
|
+
Session 生命周期和进程存在回答的是不同问题。UI 投影不得把一个排队中的请求当作
|
|
38
|
+
Agent 忙碌的证明,也不得把一个存活进程当作接受。
|
|
39
|
+
|
|
40
|
+
标准 Agent 错误保留 source、phase、category、code、输入处置、Session 处置以及
|
|
41
|
+
序列化的原生错误。类别包括 availability、rate-limit、transport、access、
|
|
42
|
+
invalid-request、context、session、runtime、conflict、cancelled 和 unknown。
|
|
43
|
+
映射报告证据,而不是重试策略。无法识别的错误保持 unknown。
|
|
44
|
+
|
|
45
|
+
运行时活动与工作流进展使用彼此独立的证据。一个工具边界可能显示原生活动;一个
|
|
46
|
+
持久且被接受的结果才显示语义进展。token、CPU、RSS 和面板存在都不能替代接受或
|
|
47
|
+
Task 完成。
|
|
48
|
+
|
|
49
|
+
## 用量
|
|
50
|
+
|
|
51
|
+
用量是只读的,范围限定在确切的原生 Session。输入/输出总量与缓存/推理分解、请求
|
|
52
|
+
上下文和剩余容量区分开来。稳定的 activity ID 对请求快照去重;累计增量只在具备
|
|
53
|
+
有效有序的同 Session 证据时使用。
|
|
54
|
+
|
|
55
|
+
缺失、部分、混合或已回滚的观察保持“未观察”,而不是猜测。增量观察者报告健康度
|
|
56
|
+
和覆盖度;采样不阻塞生命周期事件。度量绝不触发模型选择、唤醒、重试、资源释放
|
|
57
|
+
或接受。
|
|
58
|
+
|
|
59
|
+
## 原生子代
|
|
60
|
+
|
|
61
|
+
原生 subagent 是父对话内部的协作,不是 Yui Role、Lane 或独立的受管工作区 owner。
|
|
62
|
+
当 Provider 暴露血缘和结果引用时,continuation 观察可以记录它们。
|
|
63
|
+
|
|
64
|
+
尽力而为的子代结果通过父代返回。只有持久化的内容回执才支持 `durable-result`;
|
|
65
|
+
存活的子代或声称的成功都不行。被报告的结果仍是不受信任数据。一段丢失的尽力而为
|
|
66
|
+
对话可能需要重做工作。当需要独立的持久性和验收时,选择受管的 WorkItem 执行;
|
|
67
|
+
复制是另一个单独的选择。
|
|
68
|
+
|
|
69
|
+
## 接入与验证
|
|
70
|
+
|
|
71
|
+
一个新的连接实现必须提供如实的控制/观察能力,并把它们与精确的身份、错误和终态
|
|
72
|
+
映射配对。Provider 专有的协议细节留在边缘,不进入 Task 规划、Store 语义或 Web
|
|
73
|
+
业务规则。
|
|
74
|
+
|
|
75
|
+
针对变更的一次性证据应覆盖被改动的关联、权限、取消或观察边界。永久测试保持在
|
|
76
|
+
[验证策略](testing/verification-levels.zh-CN.md)中的主要路径。真实
|
|
77
|
+
Provider/模型验证需要显式授权,并且必须把原生进程证据与夹具输出区分开。
|
|
@@ -1,38 +1,50 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="right"><strong>English</strong> | <a href="./README.zh-CN.md">简体中文</a></p>
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
# Architecture and documentation map
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
These documents describe the current source contracts. A capability boundary is
|
|
6
|
+
not a claim that every real Provider scenario has been validated.
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
- [中文 README](../../i18n/README.zh-CN.md):同一产品入口的中文说明。
|
|
9
|
-
- [总体架构](../../ARCHITECTURE.md):职责、权威和端到端流程。
|
|
10
|
-
- [能力、资源与 Surface](capabilities-and-resources.md):扩展入口、实例所有权和资源效果。
|
|
8
|
+
## Start here
|
|
11
9
|
|
|
12
|
-
|
|
10
|
+
- [README](../../README.md): install, configure and everyday use.
|
|
11
|
+
- [Chinese README](../../i18n/README.zh-CN.md): the same product entry in
|
|
12
|
+
Simplified Chinese.
|
|
13
|
+
- [Architecture overview](../../ARCHITECTURE.md): responsibilities, authority and
|
|
14
|
+
the end-to-end flow.
|
|
15
|
+
- [Capabilities, resources and Surfaces](capabilities-and-resources.md): the
|
|
16
|
+
extension ingress, instance ownership and resource effects.
|
|
13
17
|
|
|
14
|
-
|
|
18
|
+
## Domain contracts
|
|
19
|
+
|
|
20
|
+
| Question | Current document |
|
|
15
21
|
| --- | --- |
|
|
16
|
-
| Session
|
|
17
|
-
|
|
|
18
|
-
| WorkItem
|
|
19
|
-
| Task
|
|
20
|
-
|
|
|
21
|
-
|
|
|
22
|
-
| Provider
|
|
23
|
-
|
|
|
24
|
-
|
|
|
25
|
-
|
|
|
26
|
-
|
|
|
27
|
-
|
|
|
28
|
-
|
|
|
29
|
-
|
|
30
|
-
##
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
`src/cli/commandCatalog.ts`
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
22
|
+
| How do Session, AgentRun, messages and activation fit together? | [Session and AgentRun runtime](../managed-turn-and-session-runtime.md) |
|
|
23
|
+
| Who consumes results, synthesis and review? | [Result consumption](../agent-result-consumption.md) |
|
|
24
|
+
| When is a WorkItem dependency satisfied? | [Task dependencies](../task-dag-semantics.md) |
|
|
25
|
+
| How are records referenced inside a Task? | [Task-local identity](../task-local-identity.md) |
|
|
26
|
+
| How do Roles, Profiles and run configuration take effect? | [Roles and configuration](../roles-and-configuration.md) |
|
|
27
|
+
| How do delivery, integration and archive work? | [Task delivery](../task-delivery.md) |
|
|
28
|
+
| How do Provider, ACP and configuration facts connect? | [Provider runtime](../provider-runtime.md) |
|
|
29
|
+
| Who interprets runtime observations and errors? | [Agent Drivers](../agent-runtime-drivers.md) |
|
|
30
|
+
| How are plugins created, validated and adopted? | [Plugin SDK](../plugin-sdk.md) |
|
|
31
|
+
| What are the data, upgrade and concurrency boundaries? | [SQLite control plane](../sqlite-control-plane-design.md) |
|
|
32
|
+
| How do authorized release operations run? | [Release workflow](../release-workflow.md) |
|
|
33
|
+
| How do I read current runtime evidence? | [Observability](../observability/README.md) |
|
|
34
|
+
| Which checks should be kept permanently? | [Verification policy](../testing/verification-levels.md) |
|
|
35
|
+
|
|
36
|
+
## Maintenance conventions
|
|
37
|
+
|
|
38
|
+
When behavior changes, update the owning contract and any entry-point text in the
|
|
39
|
+
same change. The exact CLI flags are defined by `src/cli/commandCatalog.ts` and
|
|
40
|
+
the command handlers; public domain types follow the running source. We do not
|
|
41
|
+
maintain a separate target model or a generated offline copy.
|
|
42
|
+
|
|
43
|
+
Each document is bilingual: `X.md` is the English version and `X.zh-CN.md` is the
|
|
44
|
+
Simplified Chinese one. When behavior changes, update both language versions
|
|
45
|
+
together so they stay in sync.
|
|
46
|
+
|
|
47
|
+
The Project Skill owns Yui's development and validation rules; the generic Role
|
|
48
|
+
Skills own how an Agent uses Yui. Repository documents do not replace the Project
|
|
49
|
+
Knowledge maintained under `YUI_HOME`, and they do not grant execution access to
|
|
50
|
+
shared environments, real models or external systems.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<p align="right"><a href="./README.md">English</a> | <strong>简体中文</strong></p>
|
|
2
|
+
|
|
3
|
+
# 当前架构与文档导航
|
|
4
|
+
|
|
5
|
+
以下文档描述当前源码合同。能力边界不等于所有真实 Provider 场景已经验证。
|
|
6
|
+
|
|
7
|
+
## 阅读入口
|
|
8
|
+
|
|
9
|
+
- [English README](../../README.md):安装、配置和日常使用。
|
|
10
|
+
- [中文 README](../../i18n/README.zh-CN.md):同一产品入口的中文说明。
|
|
11
|
+
- [总体架构](../../ARCHITECTURE.md):职责、权威和端到端流程(英文)。
|
|
12
|
+
- [能力、资源与 Surface](capabilities-and-resources.zh-CN.md):扩展入口、实例所有权和资源效果。
|
|
13
|
+
|
|
14
|
+
## 领域合同
|
|
15
|
+
|
|
16
|
+
| 问题 | 当前文档 |
|
|
17
|
+
| --- | --- |
|
|
18
|
+
| Session、AgentRun、消息和激活如何配合? | [执行与会话](../managed-turn-and-session-runtime.zh-CN.md) |
|
|
19
|
+
| 谁消费结果、综合与审查? | [结果消费](../agent-result-consumption.zh-CN.md) |
|
|
20
|
+
| WorkItem 依赖何时满足? | [Task 依赖](../task-dag-semantics.zh-CN.md) |
|
|
21
|
+
| Task 内记录如何引用? | [局部身份](../task-local-identity.zh-CN.md) |
|
|
22
|
+
| Role、Profile 与运行配置如何生效? | [角色与配置](../roles-and-configuration.zh-CN.md) |
|
|
23
|
+
| 怎样交付、集成和归档? | [交付生命周期](../task-delivery.zh-CN.md) |
|
|
24
|
+
| Provider、ACP 与配置事实如何接入? | [Provider Runtime](../provider-runtime.zh-CN.md) |
|
|
25
|
+
| 运行观察和错误由谁解释? | [Agent Drivers](../agent-runtime-drivers.zh-CN.md) |
|
|
26
|
+
| 如何创建、验证与采用插件? | [插件 SDK](../plugin-sdk.zh-CN.md) |
|
|
27
|
+
| 数据、升级与并发的边界是什么? | [SQLite Store](../sqlite-control-plane-design.zh-CN.md) |
|
|
28
|
+
| 如何执行获授权的发布操作? | [发布流程](../release-workflow.zh-CN.md) |
|
|
29
|
+
| 如何查看当前运行证据? | [可观察性](../observability/README.zh-CN.md) |
|
|
30
|
+
| 哪些验证应长期保留? | [验证策略](../testing/verification-levels.zh-CN.md) |
|
|
31
|
+
|
|
32
|
+
## 维护约定
|
|
33
|
+
|
|
34
|
+
行为变更同步修改所属合同和必要的入口说明。具体 CLI 参数以
|
|
35
|
+
`src/cli/commandCatalog.ts` 和命令处理器为准;公开领域类型以运行源码为准,
|
|
36
|
+
不另外维护一套目标模型或生成的离线副本。
|
|
37
|
+
|
|
38
|
+
每篇文档保持中英双语:`X.md` 为英文,`X.zh-CN.md` 为对应中文。行为变更时
|
|
39
|
+
一并更新两种语言版本,保持内容一致。
|
|
40
|
+
|
|
41
|
+
Project Skill 管理 Yui 的开发与验证规则;通用 Role Skills 管理 Agent 使用
|
|
42
|
+
Yui 的职责。仓库文档不替代 `YUI_HOME` 中维护的 Project Knowledge,也不授予
|
|
43
|
+
共享环境、真实模型或外部系统的执行权限。
|
|
@@ -1,79 +1,118 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
1
|
+
<p align="right"><strong>English</strong> | <a href="./capabilities-and-resources.zh-CN.md">简体中文</a></p>
|
|
2
|
+
|
|
3
|
+
# Capabilities, resources and Surfaces
|
|
4
|
+
|
|
5
|
+
## One ingress, original facts
|
|
6
|
+
|
|
7
|
+
The Controller hosts the CapabilityRegistry and InstanceHost. `capability
|
|
8
|
+
search`, `describe` and `call` use one authenticated ingress: it first resolves
|
|
9
|
+
the current Session identity and Task scope, then checks capability and resource
|
|
10
|
+
permissions. An actor supplied in the input, or a self-declared user scope,
|
|
11
|
+
cannot grant permission.
|
|
12
|
+
|
|
13
|
+
A descriptor carries its name, contract version, Provider, scope, input/output
|
|
14
|
+
schema, effect and requiredPermissions. A query shows only the authorized
|
|
15
|
+
catalog; when a Provider or version is ambiguous, the caller selects explicitly
|
|
16
|
+
rather than relying on load order. The schema is a bounded dialect, and unknown
|
|
17
|
+
keywords are rejected.
|
|
18
|
+
|
|
19
|
+
The current catalog covers context, message, artifact, environment, resource,
|
|
20
|
+
project, plugin and selected task/job operations. Task lifecycle and some CLI/Web
|
|
21
|
+
writes share domain commands directly; these are not a second business state and
|
|
22
|
+
do not pretend to have run through the Registry.
|
|
23
|
+
|
|
24
|
+
## Effects and operation facts
|
|
25
|
+
|
|
26
|
+
A capability's return value is separate from its real effect. A call can produce
|
|
27
|
+
a confirmed sub-operation even when its output validation fails, so the returned
|
|
28
|
+
result must preserve the original owner's operationRef and receipt. Unknown must
|
|
29
|
+
not be read as "did not run," and there is no automatic fallback.
|
|
30
|
+
|
|
31
|
+
A nested call rechecks current permissions and cannot widen the permissions or
|
|
32
|
+
effect the parent call declared. A requestId identifies the call; it does not
|
|
33
|
+
supply universal idempotency for every downstream operation — an owner such as a
|
|
34
|
+
Job runs its own exact idempotency contract. After an error, read the original
|
|
35
|
+
operation facts before deciding the next step.
|
|
36
|
+
|
|
37
|
+
## Implementation instances
|
|
38
|
+
|
|
39
|
+
InstanceHost manages attach, acquire, release, detach and the actual references.
|
|
40
|
+
After a replacement is published, new calls select the new implementation while
|
|
41
|
+
existing references stay bound to the original one and can be disposed only once
|
|
42
|
+
drained. A query is an observation; it does not start or recover code. A cleanup
|
|
43
|
+
failure keeps its diagnosis, does not reverse a new publication into a failure,
|
|
44
|
+
and does not fake a drain.
|
|
45
|
+
|
|
46
|
+
A Session's long-lived reference is pinned by the actual AgentHost to the
|
|
47
|
+
implementation it loaded. The Controller carries an existing pin forward and does
|
|
48
|
+
not silently move a live Session onto different code. Ending a client and the
|
|
49
|
+
shared Provider's physical quiescence are judged separately.
|
|
50
|
+
|
|
51
|
+
## Projects and workspaces
|
|
52
|
+
|
|
53
|
+
A Project stores its reference checkout, Knowledge and resource references. The
|
|
54
|
+
stable checkout is read-only; Task delivery happens in a managed worktree. A
|
|
55
|
+
multi-Project Task uses independent Git roots and explicit write scopes. A
|
|
56
|
+
workspace owner is a Task, WorkItem, ReviewRound or IntegrationAttempt. A Role
|
|
57
|
+
only selects execution configuration; it does not independently own a separate
|
|
58
|
+
workspace state.
|
|
59
|
+
|
|
60
|
+
Git integration captures an exact ChangeSet and advances the target by
|
|
61
|
+
compare-and-swap after its checks pass in a candidate worktree. A conflict,
|
|
62
|
+
failed check, moved target or rejection never advances the target, and the Agent
|
|
63
|
+
chooses the next action.
|
|
64
|
+
|
|
65
|
+
## Artifacts and environments
|
|
66
|
+
|
|
67
|
+
- `artifact.save/read/list` maintains file/directory deliverables — complete
|
|
68
|
+
plans, prototypes, charts, reports — in the Task's own local-only Git
|
|
69
|
+
repository. `save` writes a `relativePath` and commits exactly that path,
|
|
70
|
+
returning a self-certifying `commit + relativePath` reference; `read` resolves
|
|
71
|
+
HEAD or a pinned commit for frozen evidence; `list` is an ordinary current
|
|
72
|
+
read. A reference is not a fixed delivery result; a final result cannot select
|
|
73
|
+
a missing or cross-Task artifact.
|
|
74
|
+
- `environment.prepare` prepares an empty, scratch or authorized local directory
|
|
75
|
+
without adopting it automatically.
|
|
76
|
+
- `environment.adopt` rechecks identity, resource intent, permissions and
|
|
77
|
+
conflicts, then records ownership.
|
|
78
|
+
- `environment.bind` selects a Role's next native execution environment; `null`
|
|
79
|
+
returns to the managed workspace.
|
|
80
|
+
- `environment.release` checks the real references and quiescence evidence and
|
|
81
|
+
never deletes a user directory.
|
|
82
|
+
|
|
83
|
+
An adopted native launch retains the directory's identity, access, isolation and
|
|
84
|
+
preparation reference, and rechecks them at launch, resume and the Yui input
|
|
85
|
+
boundary. Revoking a grant cannot silently re-adopt an old environment on the
|
|
86
|
+
strength of a new grant. Read-only environment support depends on the adapter; a
|
|
87
|
+
directory access label is not a general OS sandbox.
|
|
88
|
+
|
|
89
|
+
## Plugins and self-extension
|
|
90
|
+
|
|
91
|
+
A Task Leader or the global Operator can manage that Task's plugins; a
|
|
92
|
+
Worker/Reviewer cannot self-manage or self-trust them. A declarative plugin runs
|
|
93
|
+
no arbitrary code; executing a trusted-local plugin additionally requires a grant
|
|
94
|
+
scoped to the exact source or artifact digest, environment and phase.
|
|
95
|
+
|
|
96
|
+
The Store keeps the enabled intent and validation artifacts, and the Host keeps
|
|
97
|
+
the actual instances. After a restart the enabled selection is still readable,
|
|
98
|
+
the actual instance can be empty, and activation must be explicit. The original
|
|
99
|
+
Task can discover and call the new capability without rewriting its own native
|
|
100
|
+
tool schema. A business result should be saved as an Artifact rather than
|
|
101
|
+
depending on the plugin staying alive.
|
|
102
|
+
|
|
103
|
+
See the [Plugin SDK](../plugin-sdk.md) for the full authoring, authorization and
|
|
104
|
+
failure contract.
|
|
105
|
+
|
|
106
|
+
## CLI and Web
|
|
107
|
+
|
|
108
|
+
A Surface contribution is derived from the Registry's currently authorized
|
|
109
|
+
catalog; there is no second catalog or Host. A CLI contribution uses the
|
|
110
|
+
capability's original name. A Web panel accepts only controlled text, an HTTP(S)
|
|
111
|
+
link or a JSON query description — not author scripts or arbitrary HTML.
|
|
112
|
+
|
|
113
|
+
The Web listener is started and stopped by the Controller and allows loopback
|
|
114
|
+
only. A browser write goes through an existing domain transaction, and its error
|
|
115
|
+
distinguishes a definite non-commit from a committed-but-unknown result. A query
|
|
116
|
+
panel cannot use the browser's identity to run a mutation or manage plugins. A
|
|
117
|
+
terminal connection only attaches a client; it does not take over durable
|
|
118
|
+
ownership of the native conversation.
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
<p align="right"><a href="./capabilities-and-resources.md">English</a> | <strong>简体中文</strong></p>
|
|
2
|
+
|
|
3
|
+
# 能力、资源与 Surface
|
|
4
|
+
|
|
5
|
+
## 唯一入口与原始事实
|
|
6
|
+
|
|
7
|
+
Controller 承载 CapabilityRegistry 和 InstanceHost。`capability search`、
|
|
8
|
+
`describe`、`call` 使用同一认证入口,先解析当前 Session 身份和 Task 范围,
|
|
9
|
+
再检查能力与资源权限。输入中的 actor 或自称的 user scope 不能授予权限。
|
|
10
|
+
|
|
11
|
+
描述符包含名称、合同版本、Provider、scope、输入输出 schema、effect 和
|
|
12
|
+
requiredPermissions。查询只展示获授权的目录;同名 Provider 或版本有歧义时,
|
|
13
|
+
调用者明确选择,不按加载顺序决定。Schema 是有界方言,未知关键词拒绝。
|
|
14
|
+
|
|
15
|
+
当前目录覆盖 context、message、artifact、environment、resource、project、
|
|
16
|
+
plugin 和部分 task/job 操作。Task 生命周期与部分 CLI/Web 写入直接共享
|
|
17
|
+
领域命令;这些不是另一份业务状态,也不假称已经通过 Registry 执行。
|
|
18
|
+
|
|
19
|
+
## 效果与操作事实
|
|
20
|
+
|
|
21
|
+
能力返回值与真实效果分开。一次调用即使输出校验失败,也可能已产生确认的
|
|
22
|
+
子操作;返回结果必须保留原 owner 的 operationRef 和 receipt。Unknown
|
|
23
|
+
不能解释为未执行,不进行自动 fallback。
|
|
24
|
+
|
|
25
|
+
嵌套调用重新检查当前权限,不能扩大父调用声明的权限与效果。requestId 标识
|
|
26
|
+
调用,不自动提供所有业务的通用幂等性;Job 等 owner 执行自己的精确幂等合同。
|
|
27
|
+
错误后先读取原操作事实再决定下一步。
|
|
28
|
+
|
|
29
|
+
## 实现实例
|
|
30
|
+
|
|
31
|
+
InstanceHost 管理 attach、acquire、release、detach 与实际引用。替换发布后,
|
|
32
|
+
新调用选择新实现;已有引用继续绑定原实现,排空后才能 dispose。查询是观察,
|
|
33
|
+
不启动或恢复代码。清理失败保留诊断,不把新发布反转为失败,也不伪造排空。
|
|
34
|
+
|
|
35
|
+
Session 的长引用由实际 AgentHost 固定到所加载实现。Controller 传递已有 pin,
|
|
36
|
+
不把活 Session 静默搬到另一份代码。结束客户端与共享 Provider 物理静止分别判断。
|
|
37
|
+
|
|
38
|
+
## Project 与工作区
|
|
39
|
+
|
|
40
|
+
Project 保存参考 checkout、Knowledge 与资源引用。稳定 checkout 只读;Task
|
|
41
|
+
交付发生在受管 worktree。多 Project Task 使用独立 Git 根和明确写范围。
|
|
42
|
+
工作区 owner 属于 Task、WorkItem、ReviewRound 或 IntegrationAttempt。
|
|
43
|
+
Role 仅选择执行配置,不独立拥有另一份工作区状态。
|
|
44
|
+
|
|
45
|
+
Git 集成捕获精确 ChangeSet,在候选 worktree 检查后 CAS 推进目标。
|
|
46
|
+
冲突、检查失败、目标移动与拒绝都不更新目标,Agent 决定下一次操作。
|
|
47
|
+
|
|
48
|
+
## Artifact 与环境
|
|
49
|
+
|
|
50
|
+
- `artifact.save/read/list` 在 Task 自有的本地专用 Git 仓库中维护文件/目录交付物
|
|
51
|
+
(完整方案、原型、图表、报告)。`save` 写入 `relativePath` 并只提交该路径,
|
|
52
|
+
返回自证的 `commit + relativePath` 引用;`read` 解析 HEAD 或固定 commit 以取冻结证据;
|
|
53
|
+
`list` 为普通当前读取。Reference 不等于固定交付成果;最终结果不能选择缺失或跨 Task Artifact。
|
|
54
|
+
- `environment.prepare` 准备 empty、scratch 或获授权 local 目录,不自动采用。
|
|
55
|
+
- `environment.adopt` 复核身份、资源意图、权限与冲突后保存所有权。
|
|
56
|
+
- `environment.bind` 选择 Role 下一次原生执行环境;`null` 返回 managed workspace。
|
|
57
|
+
- `environment.release` 检查真实引用和静止证据,不删除用户目录。
|
|
58
|
+
|
|
59
|
+
Adopted native launch 保留目录身份、access、isolation 与 preparation 引用,
|
|
60
|
+
在 launch、resume 和 Yui 输入边界复核。撤权不能靠新 grant 静默重新采用旧环境。
|
|
61
|
+
Read-only 环境的支持取决于实现;不能将目录 access 标签视为通用 OS 沙箱。
|
|
62
|
+
|
|
63
|
+
## 插件与自扩展
|
|
64
|
+
|
|
65
|
+
Task Leader 或 global Operator 可以管理该 Task 的插件;Worker/Reviewer 不能
|
|
66
|
+
自行管理或授信。声明式插件不执行任意代码;trusted-local 插件执行还需要精确
|
|
67
|
+
源码或产物摘要、环境和阶段的 grant。
|
|
68
|
+
|
|
69
|
+
Store 保存 enabled 意图及验证产物,Host 保存实际实例。重启后 enabled 仍可读,
|
|
70
|
+
actual 可以为空,必须显式激活。原 Task 可以发现并调用新能力,不必修改自身
|
|
71
|
+
原生工具 schema。业务结果应保存为 Artifact,而不是依赖插件继续存活。
|
|
72
|
+
|
|
73
|
+
完整作者、授权及失败合同见[插件 SDK](../plugin-sdk.zh-CN.md)。
|
|
74
|
+
|
|
75
|
+
## CLI 与 Web
|
|
76
|
+
|
|
77
|
+
Surface contribution 由 Registry 当前获授权目录派生,没有第二份目录或 Host。
|
|
78
|
+
CLI contribution 使用能力原名称。Web panel 只接受受控 text、HTTP(S) link 或
|
|
79
|
+
JSON query 描述,不接受作者脚本或任意 HTML。
|
|
80
|
+
|
|
81
|
+
Web listener 由 Controller 启停,仅允许 loopback。浏览器写入通过现有领域
|
|
82
|
+
事务,错误区分确定未提交与提交结果未知。查询面板不能借浏览器身份执行 mutation
|
|
83
|
+
或插件管理。终端连接只 attach 客户端,不接管原生对话的持久所有权。
|