更新资源协议文档,新增registry子标签的定义与示例,明确资源注册与抽象引用机制,提升文档的清晰度和实用性。同时,删除不再使用的执行流程部分,优化文档结构。
This commit is contained in:
48
core/execution/deal-at-reference.execution.md
Normal file
48
core/execution/deal-at-reference.execution.md
Normal file
@ -0,0 +1,48 @@
|
||||
<execution>
|
||||
<process>
|
||||
# 资源处理流程
|
||||
|
||||
```mermaid
|
||||
flowchart TD
|
||||
A[识别资源引用] --> B{判断加载语义}
|
||||
B -->|@!前缀| C[立即执行工具调用]
|
||||
B -->|@?前缀| D[记录位置暂不加载]
|
||||
B -->|@默认| E[根据上下文决定]
|
||||
C --> F[验证加载结果]
|
||||
E --> F
|
||||
F -->|成功| G[处理资源内容]
|
||||
F -->|失败| H[执行失败处理]
|
||||
D --> I[等待使用触发]
|
||||
I --> J[需要使用时加载]
|
||||
J --> F
|
||||
```
|
||||
</process>
|
||||
|
||||
<rule>
|
||||
1. AI必须主动使用工具调用获取资源,不等待系统自动加载
|
||||
2. 遇到@!前缀资源必须立即执行工具调用获取内容
|
||||
3. 遇到@?前缀资源应记录位置但暂不加载
|
||||
4. 必须验证资源是否成功加载并处理失败情况
|
||||
</rule>
|
||||
|
||||
<constraint>
|
||||
1. 工具调用能力限制(不同AI系统支持的工具不同)
|
||||
2. 资源访问权限限制
|
||||
3. 资源大小和格式限制
|
||||
</constraint>
|
||||
|
||||
<guideline>
|
||||
1. 优先处理关键资源,确保核心功能不受资源加载问题影响
|
||||
2. 资源内容应适当缓存,避免重复加载
|
||||
3. 大型资源考虑分段加载以优化性能
|
||||
</guideline>
|
||||
|
||||
<criteria>
|
||||
| 指标 | 通过标准 | 不通过标准 |
|
||||
|------|---------|-----------|
|
||||
| 加载及时性 | @!资源被立即加载 | 忽略加载语义前缀 |
|
||||
| 错误处理 | 妥善处理加载失败 | 加载失败无响应 |
|
||||
| 懒加载执行 | @?资源仅在需要时加载 | 过早加载或完全不加载 |
|
||||
| 完整性 | 资源内容完整获取 | 内容截断或损坏 |
|
||||
</criteria>
|
||||
</execution>
|
||||
19
core/resource/execution.resource.md
Normal file
19
core/resource/execution.resource.md
Normal file
@ -0,0 +1,19 @@
|
||||
|
||||
|
||||
<resource protocol="execution">
|
||||
<location>
|
||||
执行模式资源位置使用以下格式:
|
||||
|
||||
```ebnf
|
||||
location ::= execution://{execution_id}
|
||||
execution_id ::= [a-zA-Z][a-zA-Z0-9_-]*
|
||||
```
|
||||
</location>
|
||||
|
||||
<registry>
|
||||
<!-- 执行模式ID到文件路径的映射表 -->
|
||||
| 执行ID | 文件路径 |
|
||||
|--------|---------|
|
||||
| deal-at-reference | @file://PromptX/core/execution/deal-at-reference.execution.md |
|
||||
</registry>
|
||||
</resource>
|
||||
16
core/resource/thought.resource.md
Normal file
16
core/resource/thought.resource.md
Normal file
@ -0,0 +1,16 @@
|
||||
<resource protocol="thought">
|
||||
<location>
|
||||
思维模式资源位置使用以下格式:
|
||||
|
||||
```ebnf
|
||||
location ::= thought://{thought_id}
|
||||
thought_id ::= [a-zA-Z][a-zA-Z0-9_-]*
|
||||
```
|
||||
</location>
|
||||
|
||||
<registry>
|
||||
<!-- 思维模式ID到文件路径的映射表 -->
|
||||
| 思维ID | 文件路径 |
|
||||
|--------|---------|
|
||||
</registry>
|
||||
</resource>
|
||||
Reference in New Issue
Block a user