@hydraharness/harness-client-ui-tool 0.1.1-rc.6

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 (32) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +56 -0
  3. package/lib/client.js +1999 -0
  4. package/lib/index.js +6 -0
  5. package/lib/invariant.js +23 -0
  6. package/lib/types/client/apply.d.ts +9 -0
  7. package/lib/types/client/contract/slots.d.ts +71 -0
  8. package/lib/types/client/index.d.ts +4 -0
  9. package/lib/types/client/locale.d.ts +3 -0
  10. package/lib/types/client/tool/MediaGeneration.d.ts +8 -0
  11. package/lib/types/client/tool/ToolCallTree.d.ts +9 -0
  12. package/lib/types/client/tool/ToolDetails.d.ts +9 -0
  13. package/lib/types/client/tool/components/ToolRow.d.ts +79 -0
  14. package/lib/types/client/tool/models/diff-card-model.d.ts +58 -0
  15. package/lib/types/client/tool/models/read-card-model.d.ts +46 -0
  16. package/lib/types/client/tool/models/search-card-model.d.ts +89 -0
  17. package/lib/types/client/tool/models/terminal-card-model.d.ts +71 -0
  18. package/lib/types/client/tool/models/tool-call-model.d.ts +58 -0
  19. package/lib/types/client/tool/models/web-card-model.d.ts +39 -0
  20. package/lib/types/client/tool/toolviews/GenericToolCard.d.ts +7 -0
  21. package/lib/types/client/tool/toolviews/ask-question-row.d.ts +23 -0
  22. package/lib/types/client/tool/toolviews/bash-sample.d.ts +26 -0
  23. package/lib/types/client/tool/toolviews/file-mutation-row.d.ts +31 -0
  24. package/lib/types/client/tool/toolviews/plan-summary.d.ts +48 -0
  25. package/lib/types/client/tool/toolviews/read-row.d.ts +26 -0
  26. package/lib/types/client/tool/toolviews/search-row.d.ts +31 -0
  27. package/lib/types/client/tool/toolviews/subagent-row.d.ts +26 -0
  28. package/lib/types/client/tool/toolviews/todo-row.d.ts +25 -0
  29. package/lib/types/client/tool/toolviews/web-row.d.ts +26 -0
  30. package/lib/types/index.d.ts +4 -0
  31. package/lib/types/invariant.d.ts +16 -0
  32. package/package.json +87 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 DeepSeek
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,56 @@
1
+ # @hydraharness/harness-client-ui-tool
2
+
3
+ Client Tool presentation plugin. `ui-conversation` dispatches each ordered `tool-call` Conversation Node through the matching key of `conversation.chat.node`; this package renders its root and Code Dispatch children, then dispatches every atomic call through the keyed `tool.call.toolview` slot. Unregistered Tool names use the generic card.
4
+
5
+ `card: 'media'` call/result intents become separate `media-generation` Chat Nodes. They remain outside activity disclosures and use one image/video treatment: authored prompt, animated pending preview, completion or failure, actual model, and a generation-details action. Reduced-motion preferences disable the placeholder animation. Images use the existing attachment gallery; MP4/WebM references use native video controls and download without autoplay. Reload resolves stored references through session authorization, including when the generating tool is unavailable. The [media output decision](../../../.agents/notes/implemented/feature/2026-10-03-standalone-media-generation-output.md) owns placement and persistence.
6
+
7
+ Business UI packages register only their wire Tool names and atomic views. They do not pair Session events, rebuild the transcript, or own root/subcall topology. The Runtime remains authoritative for call/result pairing, lifecycle, and recursive `subCalls` projection; the conversation view remains authoritative for ChatFlow placement.
8
+
9
+ Pending previews use the call's optional positive `aspectRatio` (requested width divided by height); provider-selected dimensions remain unspecified until output arrives. Generated images and pending previews fill the card width while preserving their ratios without cropping. Video controls use intrinsic video dimensions with a 480px height bound.
10
+
11
+ The model caption resolves the actual result's model ID through its provider catalog and displays only its name; an unavailable catalog or removed model retains the ID. Provider identity remains in the recorded result and generation details. The authored prompt is selectable and has a copy action. Generation details open the Trajectory inspector, whose Payload and Result copy controls preserve the complete recorded text.
12
+
13
+ ## Rendering contract
14
+
15
+ `ToolCallTree` receives one root `ToolCallBlock` that already contains recursive `subCalls`, selection state, the session `cwd`, and Host callbacks for opening files and inspecting calls. It recursively walks the standard call blocks and sends the root and children at every depth through the same atomic dispatch path, without subscribing to a separate parent-to-children map.
16
+
17
+ Each root and child wrapper preserves the `data-chat-anchor-key="call:<id>"` and `data-chat-call-id` DOM contract used for paging and selection.
18
+
19
+ Successful generic result views may contain image blocks for chat presentation. The call tree passes their references to the conversation owner's `renderMessageImages` callback, which selects the shared attachment gallery through its slot. Tool presentation does not import gallery components or resolve image bytes itself.
20
+
21
+ The package also fills `conversation.details.tool` with `ToolDetails`. The row and details renderers share the same pure card models for `terminal`, `read`, `diff`, `search`, and `web` render intents. Unknown intent tags and malformed wire card data fall back to flattened Tool result text.
22
+
23
+ Generic rows classify known Tool names into search, read, shell, write, edit, code, or generic variants. Running, successful, failed, and interrupted lifecycle states come only from the frozen call/result slice. File paths resolve against the session `cwd` only when the user invokes the Host open-file callback; presentation code does not read Session services.
24
+
25
+ ## Atomic Tool views
26
+
27
+ An owning business package registers its wire Tool name into `tool.call.toolview`:
28
+
29
+ ```ts ignore-check
30
+ ctx.slots.inject('tool.call.toolview', () =>
31
+ ctx.slots.register({
32
+ name: 'tool.call.toolview',
33
+ key: '<wire tool name>',
34
+ }, BusinessToolRow))
35
+ ```
36
+
37
+ The owner payload is `ToolCallOwnerProps`: `callId`, `toolName`, the frozen `block`, optional `cwd` and `home`, and plain `openFile`/`inspect` callbacks. Path summaries relativize to the session cwd first, then replace a leftover POSIX host home with `~`; `filePath` and Host open keep the authored filesystem path. The registration receives the normal session slot runtime share. It does not receive React nodes, Runtime services, or root/subcall knowledge.
38
+
39
+ This package currently owns the generic fallback and the built-in shell/pwsh, read, write/edit, grep/glob, web, todo, question, and Code Dispatch presentations. `ui-skill` demonstrates a business-owned registration for `skill`.
40
+
41
+ Card-specific limits and fallback rules remain in the owning [terminal](../../../.agents/notes/implemented/feature/2026-07-28-web-terminal-card.md), [diff](../../../.agents/notes/implemented/feature/2026-07-30-web-diff-card.md), [read](../../../.agents/notes/implemented/feature/2026-07-30-web-read-card-frontend.md), [search](../../../.agents/notes/implemented/feature/2026-07-30-web-search-card.md), and [web](../../../.agents/notes/implemented/feature/2026-07-30-web-result-card-frontend.md) notes.
42
+
43
+ ## Model Experience
44
+
45
+ None, as this package renders already logged Tool calls and results without altering model requests, Tool execution, or session events.
46
+
47
+ #### KV Cache effect
48
+
49
+ None. The package is client-only presentation.
50
+
51
+ ## Known Limitations and Deferred Work
52
+
53
+ - The Host excludes `run_code` from Code Mode program bindings, so production events produce one dispatch level; the recursive Runtime/UI contract supports nesting.
54
+ - First-party Tool views are colocated here and can move to their owning business packages independently through the keyed slot.
55
+ - Tool copy reuses the `ui-conversation` locale namespace.
56
+ - Video loading buffers the session attachment response; large provider videos need a streamed read route. Video provider submission/polling is outside this presentation plugin.