meowtail 0.1.0 → 0.2.0-alpha.1

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.
Files changed (130) hide show
  1. package/AGENT-COMPONENTS.md +117 -0
  2. package/ASSISTANT.md +39 -19
  3. package/JSON.md +12 -5
  4. package/README.md +462 -349
  5. package/THIRD_PARTY_NOTICES.md +8 -0
  6. package/dist/src/chat/assistant-composer.js +3 -5
  7. package/dist/src/chat/assistant-content.d.ts +2 -0
  8. package/dist/src/chat/assistant-content.js +51 -3
  9. package/dist/src/chat/assistant-types.d.ts +39 -1
  10. package/dist/src/chat/assistant.d.ts +1 -1
  11. package/dist/src/chat/assistant.js +6 -3
  12. package/dist/src/chat/attachments.js +9 -5
  13. package/dist/src/chat/composer-panel.d.ts +17 -0
  14. package/dist/src/chat/composer-panel.js +12 -0
  15. package/dist/src/chat/composer.d.ts +2 -0
  16. package/dist/src/chat/composer.js +5 -2
  17. package/dist/src/chat/conversation.d.ts +4 -1
  18. package/dist/src/chat/conversation.js +7 -4
  19. package/dist/src/chat/index.d.ts +5 -2
  20. package/dist/src/chat/index.js +2 -0
  21. package/dist/src/chat/message-list.js +1 -1
  22. package/dist/src/chat/message.js +3 -3
  23. package/dist/src/chat/question.js +1 -1
  24. package/dist/src/chat/sources.js +1 -1
  25. package/dist/src/chat/task.d.ts +29 -0
  26. package/dist/src/chat/task.js +53 -0
  27. package/dist/src/chat/tool-call.d.ts +33 -8
  28. package/dist/src/chat/tool-call.js +70 -26
  29. package/dist/src/components/action-rail.d.ts +19 -0
  30. package/dist/src/components/action-rail.js +13 -0
  31. package/dist/src/components/add-button.js +1 -1
  32. package/dist/src/components/alert.d.ts +2 -0
  33. package/dist/src/components/alert.js +2 -1
  34. package/dist/src/components/app-bar.d.ts +17 -0
  35. package/dist/src/components/app-bar.js +10 -0
  36. package/dist/src/components/breadcrumb.js +1 -1
  37. package/dist/src/components/choice-select.js +1 -1
  38. package/dist/src/components/code-block.js +6 -6
  39. package/dist/src/components/credential-source.js +12 -12
  40. package/dist/src/components/diff-block.js +1 -1
  41. package/dist/src/components/grid.js +1 -0
  42. package/dist/src/components/hover-card.js +2 -2
  43. package/dist/src/components/image-lightbox.js +3 -3
  44. package/dist/src/components/image-preview.js +1 -1
  45. package/dist/src/components/index.d.ts +4 -0
  46. package/dist/src/components/index.js +4 -0
  47. package/dist/src/components/inline.js +1 -0
  48. package/dist/src/components/json-block.js +2 -2
  49. package/dist/src/components/json-tree.js +3 -3
  50. package/dist/src/components/layout-item.js +2 -1
  51. package/dist/src/components/layout-types.d.ts +1 -1
  52. package/dist/src/components/list-group.d.ts +1 -1
  53. package/dist/src/components/menu.js +5 -5
  54. package/dist/src/components/meta-row.d.ts +33 -0
  55. package/dist/src/components/meta-row.js +45 -0
  56. package/dist/src/components/output-block.d.ts +5 -3
  57. package/dist/src/components/output-block.js +35 -25
  58. package/dist/src/components/page-frame.d.ts +6 -2
  59. package/dist/src/components/page-frame.js +2 -2
  60. package/dist/src/components/path-picker.js +4 -4
  61. package/dist/src/components/process-group.d.ts +2 -2
  62. package/dist/src/components/rail-item.d.ts +2 -2
  63. package/dist/src/components/rail-section.d.ts +1 -1
  64. package/dist/src/components/read-block.js +2 -2
  65. package/dist/src/components/resource-card.d.ts +1 -1
  66. package/dist/src/components/resource-link.d.ts +1 -1
  67. package/dist/src/components/search-block.js +2 -3
  68. package/dist/src/components/stack.js +1 -0
  69. package/dist/src/components/status.d.ts +16 -0
  70. package/dist/src/components/status.js +8 -0
  71. package/dist/src/components/terminal-block.js +6 -6
  72. package/dist/src/components/web-block.js +3 -3
  73. package/dist/src/components/work-card.d.ts +2 -2
  74. package/dist/src/components/work-card.js +1 -1
  75. package/dist/src/icons/README.md +13 -2
  76. package/dist/src/icons/icon-frame.d.ts +11 -0
  77. package/dist/src/icons/icon-frame.js +4 -0
  78. package/dist/src/icons/icon-source.d.ts +17 -0
  79. package/dist/src/icons/icon-source.js +6 -0
  80. package/dist/src/icons/icon.d.ts +44 -37
  81. package/dist/src/icons/icon.js +55 -128
  82. package/dist/src/icons/index.d.ts +1 -0
  83. package/dist/src/icons/index.js +1 -0
  84. package/dist/src/icons/lucide.d.ts +1 -0
  85. package/dist/src/icons/lucide.js +4 -0
  86. package/dist/src/json/catalog.d.ts +88 -2
  87. package/dist/src/json/catalog.js +33 -1
  88. package/dist/src/registry/index.d.ts +54 -4
  89. package/dist/src/registry/index.js +16 -2
  90. package/dist/src/shared/execution-state.d.ts +7 -0
  91. package/dist/src/shared/execution-state.js +36 -0
  92. package/dist/src/theme/base.styles.js +15 -0
  93. package/dist/src/theme/chat/assistant.styles.js +21 -9
  94. package/dist/src/theme/chat/composer-panel.styles.d.ts +1 -0
  95. package/dist/src/theme/chat/composer-panel.styles.js +44 -0
  96. package/dist/src/theme/chat/composer.styles.js +39 -7
  97. package/dist/src/theme/chat/conversation.styles.js +15 -7
  98. package/dist/src/theme/chat/records.styles.js +79 -7
  99. package/dist/src/theme/chat/task.styles.d.ts +1 -0
  100. package/dist/src/theme/chat/task.styles.js +87 -0
  101. package/dist/src/theme/components/action-rail.styles.d.ts +1 -0
  102. package/dist/src/theme/components/action-rail.styles.js +47 -0
  103. package/dist/src/theme/components/alert.styles.js +42 -1
  104. package/dist/src/theme/components/app-bar.styles.d.ts +1 -0
  105. package/dist/src/theme/components/app-bar.styles.js +48 -0
  106. package/dist/src/theme/components/card.styles.js +9 -3
  107. package/dist/src/theme/components/code-block.styles.js +7 -0
  108. package/dist/src/theme/components/dialog.styles.js +7 -0
  109. package/dist/src/theme/components/field.styles.js +4 -0
  110. package/dist/src/theme/components/list-group.styles.js +10 -11
  111. package/dist/src/theme/components/meta-row.styles.d.ts +1 -0
  112. package/dist/src/theme/components/meta-row.styles.js +66 -0
  113. package/dist/src/theme/components/output-block.styles.js +17 -0
  114. package/dist/src/theme/components/page-frame.styles.js +7 -1
  115. package/dist/src/theme/components/page-header.styles.js +7 -0
  116. package/dist/src/theme/components/resource-card.styles.js +15 -3
  117. package/dist/src/theme/components/status.styles.d.ts +1 -0
  118. package/dist/src/theme/components/status.styles.js +25 -0
  119. package/dist/src/theme/components/tag.styles.js +3 -3
  120. package/dist/src/theme/components/toolbar.styles.js +7 -0
  121. package/dist/src/theme/index.d.ts +148 -0
  122. package/dist/src/theme/index.js +173 -159
  123. package/dist/src/theme/palette.d.ts +1 -1
  124. package/dist/src/theme/palette.js +1 -1
  125. package/dist/src/theme/shared/code-highlight.styles.js +1 -1
  126. package/dist/src/theme/shared/code-highlight.tokens.d.ts +6 -6
  127. package/dist/src/theme/shared/code-highlight.tokens.js +6 -6
  128. package/dist/src/theme/tokens.d.ts +7 -7
  129. package/dist/src/theme/tokens.js +14 -8
  130. package/package.json +17 -6
@@ -0,0 +1,117 @@
1
+ # Agent display components and composition
2
+
3
+ Meowtail is a component library, not an Agent execution framework. Tool calls, delegation, messages, permissions, networking, persistence, and real execution facts are provided by the host; components organize these facts into a readable, operable interface. What users call meowface corresponds to `meowtail` in this repository; no separate package name exists.
4
+
5
+ This round fills two high-frequency joints: extending the existing `ChatToolCall` state, lazy input/output, and resume intent; and adding `ChatTask` to present execution, public reply, and grounded progress separately. Messages, activity, questions, attachments, sources, code, and the composer continue to use existing components. No Agent-specific layout language, OpenUI runtime, streaming protocol, or other design scale was introduced.
6
+
7
+ ## Capability matrix
8
+
9
+ "Existing" means the current repository already implements it, not that this round reworked it; "Added this round" means new or extended in this round; "Host / later" describes the current finite boundary.
10
+
11
+ | Lifecycle / reading task | Existing capability | Added this round | Host / later boundary |
12
+ | ----------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
13
+ | Message role, author, time, streaming text | `ChatMessage`, `ChatMessageList`, `ChatConversation`, `AssistantView`; stable id updates messages | Assistant default parts connect tools and tasks | The host normalizes events and updates data; it does not parse server streaming protocols |
14
+ | Markdown and code | Assistant `text` is safe Markdown by default, `code` reuses `CodeBlock`; unknown languages stay plain text | Tool input/output are displayed separately as raw text | Tool strings are not executed as Markdown or HTML; code is not executed |
15
+ | Public execution summary | `ChatProcess`, `ProcessGroup/ProcessStep`, Assistant process/activity | `ChatTask` description, executionText | Display publicly shareable activity facts; do not require or assume disclosure of private model reasoning |
16
+ | Tool call state | `ChatToolCall`, `ChatStatus`, `StatusDot` | queued/running/waiting/success/error/cancelled/unknown; complete stays compatible | State comes from the host; success/failure is not inferred from output presence, timeouts, or lack of reply |
17
+ | Input, output, and long results | `ReadBlock`, `TerminalBlock`, `JsonBlock/JsonTree`, etc.; internally reuses OutputBlock | `ChatToolCall` reactive input/output/outputSummary, collapse, and full copy | `maxLines` is a display window, not data truncation; merging streaming chunks is the host's responsibility |
18
+ | Multimodal tool results | `ChatAttachments`, `ImagePreview/ImageLightbox`, media and resource components | Tool children keep an ordinary composition outlet | The host provides alternative descriptions, sources, and supported resources; arbitrary binary formats are not guessed |
19
+ | Delegation, nesting, and concurrent tasks | Assistant activity/work, `WorkCard`, shared layout and process groups | `ChatTask` and the Assistant task part | Compose trees with children and `ChatProcess`; there is no task scheduler or general tree protocol |
20
+ | Execution completion and reply delivery | AssistantWork already wires executionText/replyText separately | `ChatTask` and the task part are equally explicit | success can simultaneously show "public reply not received" without becoming error |
21
+ | plan / todo / progress | native ol/li, `ProcessGroup/ProcessStep`, Assistant steps | `ChatTask` labeled native progress | Values must have a real basis; omit them when unknown, and do not invent percentages or countdowns; the plan editor stays with the host |
22
+ | Waiting for users, options, and authorization display | `ChatQuestion`, `ChoiceGroup`, Assistant questions; `RiskConfirmation` when needed | Composition demos with waiting tasks | The UI does not define authorization policy; unanswered questions, replies being submitted, and execution failures are modeled separately |
23
+ | error / retry / cancel / interrupt | `Button variant="stop"`, feedback, Assistant readState and recovery drafts | Tool onRetry/onCancel intent and disabled states; Assistant onToolAction | Callbacks do not automatically retry or stop tasks; cancel, interrupt, retry eligibility, and concurrency conflicts are decided by the host |
24
+ | Cited sources | `ChatSources`, safe Markdown links, `ResourceLink` | Composition examples make source and artifact ownership explicit | The host verifies sources; tools and tasks do not search or generate citations automatically |
25
+ | Attachments, file artifacts, and code diffs | `ChatAttachments`, `ResourceLink`, `DiffBlock`, `CodeBlock` | Compose with task footer / Assistant local slots | No upload and no patch application; protected resource addresses and download authorization stay with the host |
26
+ | Metadata such as timing / usage | `DescriptionList/DescriptionItem`, `Inline`, tags | Reuse demos without adding another Agent metadata API | Numbers and times come from the host; unknown values are not shown as zero; no billing or usage calculations |
27
+ | composer, attachments, send, and stop | `ChatComposer`, complete Assistant draft/attachments/model/trailing; submission acceptance and draft consumption are separate | Continue reusing them; the tool cancel button is independent of send state | A streaming response does not automatically equal send pending; the host places the stop button in trailing and binds an explicit intent |
28
+ | Empty state, initial load, refresh failure | Assistant readState loading/ready/error, EmptyState | Tool empty strings are separate from missing results; Task defaults to unknown | refresh error keeps the read body; no data does not imply execution failure |
29
+ | Connection interruption and stale data | Assistant readFeedback/work feedback, explicit status text | Examples use unknown + last known output | Keep the last result and make clear "current state unknown"; reconnection and stale-time policies come from the host |
30
+ | Keyboard, focus, and narrow containers | native buttons/details, shared layout, Assistant reading anchors and narrow-container activity dialog | New compositions preserve expansion, long I/O, 320px local width, and nested tasks across updates | No global shortcuts; reduced motion follows the shared theme; see the receipt for the actual verification scope |
31
+
32
+ ## Tool calls: separate data from execution actions
33
+
34
+ ```tsx
35
+ import { h, signal } from "meowjsx";
36
+ import { ChatToolCall, type ChatExecutionState } from "meowtail/chat";
37
+
38
+ const state = signal<ChatExecutionState>("queued");
39
+ const output = signal<string | undefined>(undefined);
40
+
41
+ const view = (
42
+ <ChatToolCall
43
+ label="Read file"
44
+ summary="docs/layout.md"
45
+ state={state}
46
+ input={'{"path":"docs/layout.md"}'}
47
+ output={output}
48
+ outputSummary="Short result provided by the host"
49
+ maxLines={8}
50
+ collapsible
51
+ onCancel={() => hostRequestCancel()}
52
+ />
53
+ );
54
+ ```
55
+
56
+ `label` names the action, `summary` is the short target still visible when collapsed, and `statusLabel` adds the specific progress or the object being waited for. Input/output titles, empty content, and retry/cancel text can be overridden locally through `labels`. When `input/output` is `undefined`, that section is omitted; an empty string explicitly shows empty data. While queued or running, missing output never means an error. `outputSummary` is the expanded body summary supplied by the host and is visible only while the tool body is expanded; content that must remain visible when collapsed goes in `summary`. The component does not trim, reason about, or rewrite tool results.
57
+
58
+ `maxLines` defaults to the internally shared `OutputBlock` (no new public export); when content exceeds it, the beginning and end are kept, the middle expands through native disclosure, and copying uses the full original payload. Text I/O wraps by default; dedicated structures such as code and terminals continue to use their corresponding components. The tool's overall disclosure and the output's middle-lines disclosure keep their own expansion state separately.
59
+
60
+ `onRetry` and `onCancel` express user intent only. The component does not turn error into running on its own, does not silently drop existing results, and does not claim the task succeeded because a callback returned. The Assistant part's `canRetry/canCancel` only decide whether entries are shown and grant no execution permission; the host must still check eligibility. The host can prevent duplicate operations with reactive `retryDisabled/cancelDisabled` and must update state explicitly. When `onActivate` chooses a host navigation action, the tool row does not also toggle its internal disclosure; do not wrap the entire row button in another clickable card.
61
+
62
+ For compatibility with existing calls, using `ChatToolCall` alone and omitting state still follows `complete`; new calls should pass facts explicitly and use `unknown` when they are unknown. The Assistant tool part uses unknown when state is omitted, so a missing fact does not become completion. `complete` and success are both spellings of execution completion and do not mean the public reply was delivered.
63
+
64
+ ## Tasks: execution, progress, and waiting are separately visible
65
+
66
+ ```tsx
67
+ import { h } from "meowjsx";
68
+ import { ChatTask, ChatToolCall } from "meowtail/chat";
69
+ import { Button, Inline } from "meowtail";
70
+
71
+ const view = (
72
+ <ChatTask
73
+ title="Independent keyboard review"
74
+ state="success"
75
+ statusLabel="Execution succeeded · waiting for public reply"
76
+ executionText="Execution returned; 5 checks completed."
77
+ replyText="Public reply not yet received."
78
+ progress={{ value: 5, max: 5, label: "Checked 5 / 5 items" }}
79
+ footer={
80
+ <Inline>
81
+ <Button variant="outline">View review record</Button>
82
+ </Inline>
83
+ }
84
+ >
85
+ <ChatToolCall label="Check focus order" state="success" summary="5 interaction entry points" />
86
+ </ChatTask>
87
+ );
88
+ ```
89
+
90
+ `ChatTask` is a semantic section with state and optional content; its default state is unknown, and it is not an execution container or a whole-card button. `title/state/statusLabel/description/executionText/replyText/progress` can all be updated by Signals. `progress` accepts only finite valid numbers, requiring `0 <= value <= max` and `max > 0`, and explicitly throws otherwise; when not provided, no progress bar is shown.
91
+
92
+ waiting should say "who and what it is waiting for": waiting for a user option, waiting for scheduling, and waiting for an external result are different facts. queued means not yet started; running should have a current activity fact; unknown fits a state that cannot be confirmed after a connection interruption. No result, no new message, and no public reply are not automatic failure conditions.
93
+
94
+ ## Composition rules
95
+
96
+ - Use `Stack`, `Inline`, `Grid`, and `LayoutItem` in one workspace. Parallel tasks can use `Grid columns="auto" minColumnWidth="wide"` to arrange themselves by host width; a fixed column count keeps that explicit count and does not silently become a mobile template.
97
+ - The parent layout allocates gaps between groups; Task owns the internal rhythm of its header/body/footer; tools own their own expanded indentation. By default, the Task body marks content ownership with a single low-contrast start edge and `spaceSection` indentation; child-task footers stay inside that boundary, and the parent-task footer returns to the parent axis, so adjacent actions are not confused. Ordinary tasks do not get an extra Card wrapper, and tool groups do not add another ring of panel padding. Nested tasks collapse low-frequency records through `ChatProcess`, so every level does not expand into a long wall.
98
+ - Collapse low-frequency raw results by default and keep actions, targets, states, and short results. Expand only the one or two tools currently worth reading; collapsing must not hide failures, the object being waited for, or the current activity state. The display window for long output and full copy share the same data.
99
+ - footer holds ordinary `Button`, `ResourceLink`, and `Inline`; the body does not align actions with spaces or `space-between`. Tool retry/cancel actions live in the expanded body; a footer placed inside collapsible content is also hidden when its ancestor collapses. A global Stop / interrupt that must always be reachable belongs outside the collapsible region in an ordinary action group or the Assistant `headerActions/composerTrailing`; do not hide it in task details. Tasks of different lengths keep their natural height; if the host needs equal-height cards, the host should allocate space explicitly rather than faking content with placeholder text.
100
+ - Public plans use native ol/li or process components. A Task can contain child Tasks, but the tree's ids, ordering, parent/child relationships, and permissions are still decided by the host; do not execute a task title as a program path.
101
+ - Visible states always have text; the status dot is only decoration. Native details, button, and progress keep their keyboard semantics; updating state does not move user focus on its own. Large output can be read with the keyboard in its own region.
102
+ - Tool input/output are lazy strings. Do not hand payloads to `innerHTML`, event attributes, or a script interpreter. The safe Markdown policy for Assistant default text and the tool text policy hold separately; the security of a custom `renderPart` remains the extension author's responsibility.
103
+ - Files, URLs, callback names, state enums, and confirmation displays by themselves grant no permissions. Cite sources with `ChatSources` or safe links and artifacts with `ResourceLink` / `ChatAttachments`; download, read, and authorization are handled by the host.
104
+
105
+ ## Complete Assistant and local outlets
106
+
107
+ Assistant messages add typed parts with `kind: "tool"` and `kind: "task"`. The tool part provides label/summary/state/input/output/outputSummary/maxLines/defaultOpen, action entry visibility, and disabled fields; `onToolAction(messageId, partId, "retry" | "cancel")` is handed to the host. The Task part provides a title, separate execution/reply text, progress, and optional steps. Arrays update immutably by the same stable id; the same id/kind preserves the default component instance and native expansion state, while changing kind rebuilds that part. `defaultOpen` means initially expanded, not a forced control on every message update.
108
+
109
+ Content beyond the default parts continues to use `renderPart`; do not replace the whole Assistant page for one kind of artifact. The complete Assistant's drafts, attachment acceptance, submission snapshots, activity details, questions, and reading anchors follow the [existing contract](ASSISTANT.md). This round also adds finite tool/task message branches and an `onToolAction` action schema to the existing `AssistantView` JSON catalog, still rendering the same components; it adds no separate `ChatTask/ChatToolCall` JSON entry, recursive task tree, or arbitrary object interpretation capability. See the [JSON contract](JSON.md) for the supported field set; network protocols and actual execution remain the host's responsibility.
110
+
111
+ Meowbook scenes:
112
+
113
+ - `agent-workflow`: concurrent runs, queuing, waiting for the user, and successful execution without a received reply; includes nested tasks, native plans, optional metadata, artifacts, attachments, and diffs.
114
+ - `agent-workflow-narrow`: the same composition placed in a 320px local host inside a wide viewport, checking long Chinese and English text and paths without spaces.
115
+ - `agent-workflow-assistant`: default tool/task parts coexist with safe Markdown, activity, unanswered questions, attachments, sources, and the composer; buttons drive local output appends, retries, and cancellations without making external requests.
116
+
117
+ This page describes capabilities and usage boundaries; actual run, independent review, screenshots, and installed-state results are governed by the verification receipt for that round. Browsers, screen readers, and real backend adapters that were not run are not considered passing just because the capabilities are listed here.
package/ASSISTANT.md CHANGED
@@ -1,8 +1,8 @@
1
- # 完整 Assistant 组合
1
+ # Complete Assistant composition
2
2
 
3
- 状态:新增组合已实现,作者的局部行为回归与独立源码/页面验收进行中;第一阶段五包 tarball 不含本页新能力,不能用其安装通过代替本组合验收。当前尚未正式发布,也未切换 Rossovia 的消费。
3
+ Status: the new composition is implemented, and the author's local behavior regression plus independent source/page acceptance are in progress; the first-stage five-package tarball does not contain the capabilities on this page, so its installed-state pass cannot stand in for acceptance of this composition. Nothing is officially released yet, and Rossovia's consumption has not been switched.
4
4
 
5
- `meowtail/chat` 的 `AssistantView` 提供消息、安全 Markdown、代码、过程、输入框、附件、模型与思考选项、当前活动、后台工作详情及待答问题。默认结构和视觉都在库中;Meowbook 的 `assistant-complete` 场景只提供本地数据和动作。
5
+ `AssistantView` from `meowtail/chat` provides messages, safe Markdown, code, processes, inputs, attachments, model and thinking options, current activity, background work details, and unanswered questions. The default structure and visuals live in the library; the `assistant-complete` scene in Meowbook only supplies local data and actions.
6
6
 
7
7
  ```tsx
8
8
  import { h, signal } from "meowjsx";
@@ -26,27 +26,47 @@ const view = (
26
26
  );
27
27
  ```
28
28
 
29
- 组件由父容器取得受约束高度;标准安装仍需 `createMeowUI` 与 `standardTheme.cssText`,不依赖 Rossovia 的 CSS 或 controller。消息和 composer 使用同一阅读列,回最新只锚定消息区域。活动在宽容器旁显,在窄容器变为同一个原生模态对话框,不重挂消息和草稿。
29
+ The component takes a constrained height from its parent container; standard installation still needs `createMeowUI` and `standardTheme.cssText`, and does not depend on Rossovia's CSS or controller. Messages and the composer share one reading column, and the return-to-latest action anchors only to the message region. Activity appears beside the container when wide and becomes a single native modal dialog when narrow, without re-mounting messages and drafts.
30
+ The return-to-latest action uses normal layout flow below the message viewport; while shown it claims its natural height, and when hidden it returns that space. Historical body text is never covered by the button, and the composer still has its own region.
30
31
 
31
- ## 数据与动作的归属
32
+ ## Ownership of data and actions
32
33
 
33
- - 传 `draft` 时,宿主是唯一 owner,必须给 `onDraftChange` 或显式 `readOnly`。组件不直接写传入 Signal;不传 `draft` 时,`defaultDraft` 初始化组件自己的临时草稿。宿主拥有持久化。
34
- - `onSubmit` 必须显式返回 `{accepted: true}` 才消费已提交快照。等待时允许继续编辑;没有新编辑的文本可清空,原快照中的附件单独消费,后来添加或替换的附件保留。拒绝和异常保留草稿并显示反馈。该接纳只代表宿主接纳消息,不代表 Agent 已处理或任务完成。
35
- - 默认选文件只在本地保留 `File` 和预览 URL,不上传、不执行、不持久化。宿主提供 `onAttach` 时可返回归一化附件;也可以直接更新受控草稿并返回空值。不要在同一回调中既追加草稿又返回相同附件。预览 URL 由组件卸载时释放;持久消息附件应由宿主换成自己的资源地址。
36
- - 只支持已有序列化附件的宿主可设 `allowAttachments={false}`,不呈现本地文件选择入口;已有附件仍可显示、移除和随消息提交。JSON catalog 的首片使用这一明确边界,不把 File 混入 JSON 草稿。
37
- - `messages`、`activity`、`work`、`questions`、模型与思考选项支持 `MaybeSignal`。用不可变数组更新驱动视图。同一消息和 part 的稳定 `id` 保留其节点;改变 part 的 `kind` 会重建该 part。
38
- - 工作的 `statusText`、`executionText`、`replyText` 都由宿主提供;UI 不将 pending 解释成 running,不把 returned 当目标完成,也不从执行结果推断公开答复已发布。状态点只辅助对应文字。
39
- - 问题状态由宿主的 `open/submitting/answered/unavailable` 事实决定。`onAnswer` 返回不自动把问题标为 answered;异常保留局部答案。`onDismissQuestion` 只通知宿主,没有隐式业务关闭或重试。
40
- - `readState="error"` 保留已给消息并显示失败;`loading`、真实空消息与刷新失败分别呈现。工作详情 `error` 保留正文;`unavailable` 隐去正文。授权与数据撤回仍是宿主职责。
34
+ - When `draft` is passed, the host is the only owner and must provide `onDraftChange` or an explicit `readOnly`. The component does not write to the passed Signal directly; when `draft` is not passed, `defaultDraft` initializes the component's own temporary draft. The host owns persistence.
35
+ - `onSubmit` must explicitly return `{accepted: true}` to consume the submitted snapshot. Editing can continue while waiting; text with no new edits can be cleared, attachments from the original snapshot are consumed separately, and attachments added or replaced later are kept. Rejection and exceptions keep the draft and show feedback. That acceptance only means the host accepted the message; it does not mean the Agent has processed it or that the task is complete.
36
+ - The default file selection only keeps a `File` and preview URL locally; it does not upload, execute, or persist. When the host provides `onAttach`, it can return normalized attachments; it can also update a controlled draft directly and return null. Do not both append to the draft and return the same attachment in one callback. Preview URLs are released when the component unmounts; persisted message attachments should be replaced by the host with its own resource addresses.
37
+ - Hosts that only support existing serialized attachments can set `allowAttachments={false}` to remove the local file selection entry; existing attachments can still be displayed, removed, and submitted with the message. The first slice of the JSON catalog uses this explicit boundary and does not mix File into JSON drafts.
38
+ - `messages`, `activity`, `work`, `questions`, model and thinking options support `MaybeSignal`. Drive the view with immutable array updates. A stable `id` for the same message and part preserves its node; changing a part's `kind` rebuilds that part.
39
+ - Work's `statusText`, `executionText`, and `replyText` are all provided by the host; the UI does not interpret pending as running, does not treat returned as goal completion, and does not infer from execution results that a public reply has been published. The status dot only supports the corresponding text.
40
+ - Question state is determined by the host's `open/submitting/answered/unavailable` facts. A return from `onAnswer` does not automatically mark the question answered; exceptions keep local answers. `onDismissQuestion` only notifies the host; there is no implicit business close or retry.
41
+ - `readState="error"` keeps the messages already given and shows the failure; `loading`, truly empty messages, and refresh failure render separately. Work details keep the body on `error` and hide the body on `unavailable`. Authorization and data withdrawal remain the host's responsibility.
41
42
 
42
- ## 内容与局部定制
43
+ ## Content and local customization
43
44
 
44
- 消息 `parts` 包含 `text`、`code`、`process` 和 `attachments`。`text` 默认安全 Markdown:原始 HTML 与图片作为文字,只有明确的 HTTP、HTTPS、mailto 链接可导航;代码 part 使用共享 `CodeBlock`。过程使用原生 disclosure,过程步骤只接归一化的标题、说明、状态文字与视觉 tone。
45
+ Message `parts` include `text`, `code`, `process`, `attachments`, `tool`, and `task`. `text` is safe Markdown by default: raw HTML and images are shown as text, and only explicit HTTP, HTTPS, and mailto links navigate; code parts use the shared `CodeBlock`. Processes use native disclosure, and process steps take only normalized titles, descriptions, status text, and visual tone.
45
46
 
46
- `renderPart` 可只替换一个 part,返回 `undefined` 使用默认实现;`renderWorkDetail` 只替换详情正文。`composerTrailing` 和 `headerActions` 放局部控件,无需替换整页。自定义组件仍在原渲染树中消费祖先 Context,不另建 renderer root。
47
+ `renderPart` can replace just one part, and returning `undefined` uses the default implementation; `renderWorkDetail` replaces only the detail body. `composerTrailing` and `headerActions` hold local controls without replacing the whole page. Custom components still consume ancestor Context in the original render tree and do not create another renderer root.
47
48
 
48
- 新增默认文案集中在 `assistantCopy`;宿主可用 `labels={{ latest: "回到最新", send: "发送" }}` 覆盖局部文字,不需要另装国际化运行时。数据中的标题、状态与说明仍由宿主提供。
49
+ New default copy is centralized in `assistantCopy`; hosts can override local text with `labels={{ latest: "Back to latest", send: "Send" }}` without installing a separate internationalization runtime. Titles, statuses, and descriptions in the data are still provided by the host.
49
50
 
50
- 宿主传历史消息时直接前插 `messages`,组件保留可见消息锚点;向上阅读时追加与流式更新不强制跳到底。`onLoadOlder` 只请求宿主加载,UI 不拥有分页、网络或记录权限。列表使用同一 MeowJSX keyed 机制;删除项释放其组件生命周期。
51
+ When the host passes historical messages, prepend them to `messages` directly, and the component keeps the visible message anchor; appending and streaming updates do not force a jump to the bottom while reading upward. `onLoadOlder` only asks the host to load; the UI does not own pagination, networking, or record permissions. The list uses the same keyed mechanism as MeowJSX; removed items release their component lifecycles.
51
52
 
52
- 模型选择、文件、路径、URL、回调名字及 UI 状态都不授予后端权限。连接、上传、执行、停止、发布、授权与恢复由应用 adapter 接入;这里没有 Agent 执行框架。
53
+ Model selection, files, paths, URLs, callback names, and UI state grant no backend permissions. Connection, upload, execution, stop, publish, authorization, and recovery are wired in by the application adapter; there is no Agent execution framework here.
54
+
55
+ ## Standard Agent content
56
+
57
+ The `tool` part reuses `ChatToolCall` by default: action and target, explicit execution state, lazy input/output, outputSummary,
58
+ long-result window, and default expansion. outputSummary appears only in the expanded body; the collapsed summary uses summary.
59
+ `canRetry/canCancel` only decide whether the corresponding entry exists and grant no execution permission.
60
+ `retryDisabled/cancelDisabled` only disable entries; `onToolAction(messageId, partId, action)`
61
+ notifies the host of a retry or cancel intent; it does not execute the tool or switch state on its own. Actions are hidden when the tool body collapses;
62
+ global stop/interrupt should be placed by the host outside the collapsible region in headerActions, composerTrailing, or an ordinary action group. A missing tool state uses unknown,
63
+ and neither missing output nor an unanswered public reply is automatically treated as failure.
64
+
65
+ The `task` part reuses `ChatTask`; execution state, executionText, replyText, and labeled progress are each provided by the host,
66
+ and existing process steps can be attached. Execution success and "public reply not yet received" can coexist.
67
+ Stable ids and kinds for the same message/part preserve the component instance, native expansion, and focus; immutable data updates are enough,
68
+ and the whole conversation does not need to be recreated. defaultOpen only means initially expanded; later output updates do not force it to collapse again.
69
+
70
+ See [Agent components](AGENT-COMPONENTS.md) for the standard composition and the full capability matrix. This round also extends typed JSX/Assistant parts and the finite tool/task schema and onToolAction action of the existing AssistantView JSON catalog.
71
+ JSON still provides no separate ChatTask/ChatToolCall entry, recursive task tree, arbitrary object interpretation, execution protocol, or requirement to disclose private reasoning;
72
+ see the [JSON contract](JSON.md) for the exact fields.
package/JSON.md CHANGED
@@ -1,6 +1,6 @@
1
- # 有限 JSON UI catalog
1
+ # Finite JSON UI catalog
2
2
 
3
- `meowtail/json` 的 `createMeowUICatalog()` 注册原有 `AssistantView`、`Button`、`Input`、`Stack`,由 `meowjsx/json` 构造同一 MeowJSX VNode。它不复制 renderer、主题、组件实现或业务 store,不从 TypeScript 开放 Props 反射任意属性。
3
+ `createMeowUICatalog()` from `meowtail/json` registers the existing `AssistantView`, `Button`, `Input`, and `Stack`, and builds the same MeowJSX VNodes through `meowjsx/json`. It does not copy the renderer, theme, component implementations, or business stores, and does not reflect arbitrary properties from TypeScript's open Props.
4
4
 
5
5
  ```ts
6
6
  import { createJsonView, parseJsonView } from "meowjsx/json";
@@ -41,8 +41,15 @@ const child = createJsonView(view, {
41
41
  });
42
42
  ```
43
43
 
44
- `messages` 是必填项。消息支持 text/code/process/attachments 四个明确分支;过程步骤、活动、后台工作、问题、模型选项、读取状态、草稿和发送快照使用有限 schema。`assistantJsonSchemas` 与 catalog 复用相同定义,校验、描述与类型关联不会各维护一份。controlled 草稿必须接 `onDraftChange` 或设只读;发送是否接受仍由宿主显式返回 `{accepted:true}` 决定。
44
+ `messages` is required. Messages support six explicit branches: text/code/process/attachments/tool/task; process steps, activity, background work, questions, model options, read state, drafts, and submission snapshots use finite schemas. `assistantJsonSchemas` and the catalog reuse the same definitions, so validation, descriptions, and type associations are not maintained in separate copies. A controlled draft must be wired to `onDraftChange` or set to read-only; whether a submission is accepted is still decided by the host explicitly returning `{accepted:true}`.
45
45
 
46
- 本片支持序列化附件元数据(id/name/url/mediaType/sizeBytes),不支持 File、本地文件上传、附件回调、renderPart/renderWorkDetail、headerActions/composerTrailing slots。需要这些能力时使用完整 `meowtail/chat` JSX API。JSON 不提供 `onAttach`,并用有限 `allowAttachments: false` 默认值关闭本地文件选择入口,显式 true 会被拒绝;文本编辑、发送和已有附件的显示/移除仍可使用。网络、权限、持久化、数据协议和上传始终属于宿主。
46
+ The tool branch accepts label/summary/state/statusLabel, lazy input/output/outputSummary, maxLines/defaultOpen,
47
+ and canRetry/canCancel plus retryDisabled/cancelDisabled. outputSummary is visible only in the expanded body; the collapsed summary uses summary.
48
+ canRetry/canCancel only control action visibility and grant no permission; the `onToolAction` action passes only the validated messageId, partId, and
49
+ `"retry" | "cancel"`; execution eligibility and result updates are the host's responsibility. The task branch accepts title, state, description, separate executionText/replyText,
50
+ labeled progress, and finite steps, and renders the same `ChatTask`. This is not a separate ChatTask/ChatToolCall JSON entry,
51
+ and it provides no recursive task tree, children/footer slots, or arbitrary object interpretation.
47
52
 
48
- Button 的点击 action 不传原生事件;Input 的 input action 只传经校验的当前字符串值。仅列出的属性可用,开放 JSX native props、HTML 标签名、ref/raw HTML、任意事件对象、任意代码、路径表达式、动态 import 均不在 catalog 内。其他 MeowUI 组件尚未提供 JSON metadata;本片不声称完整 UI 属性自动序列化。
53
+ This slice supports serialized attachment metadata (id/name/url/mediaType/sizeBytes) and does not support File, local file upload, attachment callbacks, renderPart/renderWorkDetail, or headerActions/composerTrailing slots. Use the full `meowtail/chat` JSX API when these capabilities are needed. JSON provides no `onAttach` and turns off the local file selection entry with the finite default `allowAttachments: false`; an explicit true is rejected. Text editing, sending, and displaying/removing existing attachments still work. Networking, permissions, persistence, data protocols, and uploads always belong to the host.
54
+
55
+ Button click actions pass no native event; the Input input action passes only the validated current string value. Only the listed properties are available; open JSX native props, HTML tag names, ref/raw HTML, arbitrary event objects, arbitrary code, path expressions, and dynamic import are not in the catalog. Other MeowUI components do not yet provide JSON metadata; this slice does not claim automatic serialization of every UI property.