agent-stream-nesting-logic
- Repo stars 2,521
- Author updated Live
- Author repo wanwu
- Domain
- AI
- Compatible agents
-
- Claude Code
- Cursor
- Cline
- Codex
- Windsurf
- Gemini CLI
- +20
- Trust score
- 88 / 100 · community maintained
- Author / version / license
- @UnicomAI · no license declared
- Token usage
- Lean
- Setup complexity
- Plug-and-play
- External API key
- Not required
- Operating systems
- Unspecified (assume cross-platform)
- Runtime requirements
- No special requirements
- Permissions
-
- Read-only
- Write / modify
- Network behavior
- Local-only
- Install commands
- 26 variants
Profile is derived at build time from SKILL.md and install vectors. Subject to drift from author intent.
Heads up: 未限定 allowed-tools,默认拥有全部工具权限。
---
name: agent-stream-nesting-logic
description: 本指南针对万悟平台中「主消息 -> 子会话 (Skill/Tool/Knowledge) -> 孙级会话」的递归序列化渲染标准,定义了 AI 助手及后续维护者必须遵守的底层逻辑。 为了支持正文…
category: ai
runtime: no special runtime
---
# agent-stream-nesting-logic output preview
## PART A: Task fit
- Use case: 本指南针对万悟平台中「主消息 -> 子会话 (Skill/Tool/Knowledge) -> 孙级会话」的递归序列化渲染标准,定义了 AI 助手及后续维护者必须遵守的底层逻辑。 为了支持正文与多个子会话(工具调用、知识库)的任意插空排列,我们不再按类型分块渲染,而是通过 messageSequence 数组实现“三明治”交错结构。 runs entirely locally. Works with Claude Code, Cursor, Cline and 23 more..
- Inputs: target material, constraints, expected output, and acceptance criteria.
- Evidence boundary: follow “1. 核心模型:三明治序列 (The Sandwich Sequence) / 核心映射逻辑: / 2. 时序法则:Order 绝对排序” and do not present inference as author intent.
## PART B: Execution result
- **01** The card summarizes the use case; runtime output centers on “本指南针对万悟平台中「主消息 -> 子会话 (Skill/Tool/Knowledge) -> 孙级会话」的递归序列化渲染标准,定义了 AI 助手及后续维护者必须遵守的底层逻辑。 为了支持正文与多个子会话(工具调用、知识库)的任意插空排列,我们不再按类型分块渲染,而是通过 messageSequence 数组实现“三明治”交错结构。 runs entirely locally. Works with Claude Code, Cursor, Cline and 23 more.”.
- **02** When the source has headings, the agent prioritizes “1. 核心模型:三明治序列 (The Sandwich Sequence) / 核心映射逻辑: / 2. 时序法则:Order 绝对排序” so the result follows the author’s structure.
- **03** Typical output includes task judgment, concrete steps, required commands or file edits, validation, and follow-up options.
- **04** Risk context follows the fingerprint: read files, write/modify files; mostly runs locally; usually needs no extra API key.
## Running Rules
- read files, write/modify files; mostly runs locally; usually needs no extra API key.
- Validate with a small sample before expanding scope.
- Return the result, validation criteria, and next iteration options. The source does not require a stable slash command. After installation, invoke the skill by name and describe the task.
Name target files or source material, expected output, forbidden changes, and whether network or shell access is allowed. Permission fingerprint: read files, write/modify files.
Start with a small task and check whether the result follows “1. 核心模型:三明治序列 (The Sandwich Sequence) / 核心映射逻辑: / 2. 时序法则:Order 绝对排序”. Inspect diffs, logs, previews, or tests before expanding scope.
Confirm the final output includes a concrete result, evidence, and next action. If it stays generic, tighten inputs, boundaries, and acceptance criteria.
---
name: agent-stream-nesting-logic
description: 本指南针对万悟平台中「主消息 -> 子会话 (Skill/Tool/Knowledge) -> 孙级会话」的递归序列化渲染标准,定义了 AI 助手及后续维护者必须遵守的底层逻辑。 为了支持正文…
category: ai
source: UnicomAI/wanwu
---
# agent-stream-nesting-logic
## When to use
- 本指南针对万悟平台中「主消息 -> 子会话 (Skill/Tool/Knowledge) -> 孙级会话」的递归序列化渲染标准,定义了 AI 助手及后续维护者必须遵守的底层逻辑。 为了支持正文与多个子会话(工具调用、知识库)的任意插空排…
- Use it when the task has clear inputs, repeatable steps, and validation criteria.
## What to provide
- Target material, scope, expected result, and forbidden changes.
- Whether network, commands, file writes, or external services are allowed.
## Execution rules
- Organize steps around “1. 核心模型:三明治序列 (The Sandwich Sequence) / 核心映射逻辑: / 2. 时序法则:Order 绝对排序” and keep inference separate from source facts.
- read files, write/modify files; mostly runs locally; usually needs no extra API key.
- Validate with a small sample before expanding the task.
## Output requirements
- Return the deliverable, key evidence, validation method, and next action.
- Mark missing information as unknown; do not invent commands, platforms, or dependencies. The author source anchors workflow facts; repository files anchor sources and commands; Fluxly only adds fit, limitations, and quality judgment.
skill "agent-stream-nesting-logic" {
input -> user goal + target files + boundaries + acceptance criteria
context -> 1. 核心模型:三明治序列 (The Sandwich Sequence) / 核心映射逻辑: / 2. 时序法则:Order 绝对排序
rules -> SKILL.md triggers / order / output contract
runtime -> no special runtime | read files, write/modify files | mostly runs locally
guardrails -> usually needs no extra API key + small-sample validation + diff/log review
output -> copyable result + checklist + next iteration
} 子会话递归嵌套渲染架构协议 (Nesting Architecture Protocol)
本指南针对万悟平台中「主消息 -> 子会话 (Skill/Tool/Knowledge) -> 孙级会话」的递归序列化渲染标准,定义了 AI 助手及后续维护者必须遵守的底层逻辑。
1. 核心模型:三明治序列 (The Sandwich Sequence)
为了支持正文与多个子会话(工具调用、知识库)的任意插空排列,我们不再按类型分块渲染,而是通过 messageSequence 数组实现**“三明治”交错结构**。
type: 'main': 文本片段。直接由StreamProcessor驱动打字机渲染。type: 'sub': 子会话卡片。触发SubConversion.vue组件递归渲染。
核心映射逻辑:
- 顶级子会话:
parentId为空的包,进入主消息的messageSequence。 - 嵌套子会话: 具有
parentId的包,必须由对应的父组件 ID “领养”,存入其自身的messageSequence中。
2. 时序法则:Order 绝对排序
- 局部闭包排序: 在每一个
messageSequence内部,必须以order字段为唯一权重进行升序排列。 - 同 Order 追加协定: 若同一个 ID 下出现多个 Order 相同的数据包,前端视为“内容的物理追加”而非“组件的新增”。
3. 动力学:动静 Chunk 分层
在渲染 main 片段时,必须区分两种状态以防止打字时界面闪烁:
stableChunks: 已完成 Markdown 语法闭环解析并生成的 HTML 块集合。activeResponse: 正在缓冲区排队、尚未完成闭环解析的输入文本(打字动画部分)。
4. 引用溯源:Data Attributes 协议
所有生成的子会话 DOM 必须携带以下身份锚点,以支持「引文角标点击」的事件冒泡定位:
data-sub-id: 该段文字所属的原子消息 ID(若是吸收片段,则为分片 ID)。data-parent-id: 视觉所属的容器组件 ID(父卡片 ID)。
5. 响应式红线 (CRITICAL) - Vue 2 专供
[!IMPORTANT] 绝对禁止使用浅拷贝或快照!
在将子会话(尤其是
agentSkillText正文分段)注册进父组件序列时,必须直接传递原始响应式对象的引用(即parentSub.messageSequence.push(subConversion))。
- 原因: 只有保持引用一致,外部
StreamProcessor对activeResponse的实时增长才能无缝穿透进多层嵌套的子组件 UI 中。若使用{...subConversion}浅拷贝,会导致打字效果丢失或不连续。
6. 生命周期管理
- 状态单向锁: 状态
status: 3/4(结束/失败)一旦更新,不再受后续包干扰回退。 - ID 纠错逻辑: 若后端返回
id === parentId(自引用死循环),必须在sseMethod.js拦截层将其重刷 ID 为content_前缀的分片包。
Decide Fit First
Design Intent
How To Use It
Boundaries And Review