Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

feat(harness): @assistant-ui/harness with tap-based core, useHarness hook, Harness class, and multi-harness manager#5073

Open
Yonom wants to merge 11 commits into
mainassistant-ui/assistant-ui:mainfrom
uh-2-harness-packageassistant-ui/assistant-ui:uh-2-harness-packageCopy head branch name to clipboard
Open

feat(harness): @assistant-ui/harness with tap-based core, useHarness hook, Harness class, and multi-harness manager#5073
Yonom wants to merge 11 commits into
mainassistant-ui/assistant-ui:mainfrom
uh-2-harness-packageassistant-ui/assistant-ui:uh-2-harness-packageCopy head branch name to clipboard

Conversation

@Yonom

@Yonom Yonom commented Jul 20, 2026

Copy link
Copy Markdown
Member

What

A new private package @assistant-ui/harness: a minimal client for deep-agent backends (todos, files, subagents, PTC, interrupts, queued sends) speaking the assistant-transport wire. Implements task uh-2 from the harness design doc.

Architecture

Built on tap, following the harness-sdk pattern: all logic lives in a single tap resource, and every public surface is a thin binding over it.

  • HarnessResource: the core. A plain HarnessCore class owns the command queue, single-flight run loop, optimistic sends, and cooperative cancel; the resource hook wires it to React state and derives views.
  • useHarness(options): useResource(HarnessResource(options)), SSR-safe.
  • new Harness(options): declarative alternative via createTapRoot, with getState/subscribe/dispose and flushTapSync-wrapped methods.
  • HarnessManager: keyed multi-harness lookup with stable identity per id.

State and commands

  • Canonical server-owned HarnessState: id-keyed message tree, queue, files, todos, status, interrupt, error, title, typed extras. Snapshots replace wholesale.
  • One nesting primitive: a message's parentId may be a tool call id, rooting a nested transcript. Task subagents and programmatic tool-call sub-calls both stream through this path; the client derives a recursive subagents record. No separate PTC concept.
  • Command vocabulary: send-message (with queue/steer behavior), add-tool-result, resume, cancel, cancel-queued, send-now, plus a HarnessCustomCommands module-augmentation slot.
  • Echo-based optimistic reconciliation: client-generated send ids make optimistic-to-committed an identity merge; optimistic entries drop when their id appears in messages or queue, or when the carrying batch settles.
  • Run loop: single-flight with same-tick batching and follow-up coalescing; stop() closes the stream locally and delivers {type:"cancel"} on the immediate follow-up request.

Transport

HarnessTransport is two methods (run, optional resume) yielding state snapshots. HttpHarnessTransport implements the assistant-transport wire (POST {commands, state, threadId}, data-stream or assistant-transport protocol) via assistant-stream's decoder and accumulator.

Deliberately out of scope

  • The assistant-ui ExternalThread bridge component (separate task per the design doc)
  • WebSocket transport and auto-reconnect
  • Python backend changes

Cuts for minimalism

Dropped from the original sketch: regenerate/edit (no command for it yet), threads/switchTo views (the recursive subagents record covers nesting), approve() sugar (resume covers it), separate enqueue/steer commands (send-message.behavior carries it), a status-probe endpoint (resume() covers snapshot-on-connect), attachment/image parts, initialExtras, a React subpath export, and TExtras generics on options/transport (generics only where state is read).

Testing

  • 9 vitest tests against a mock transport: optimistic flow and echo merge, mid-run queue reconciliation, same-tick batching, error surfacing and clearing, stop/cancel, interrupt/resume, resume-on-mount, recursive subagent derivation, manager identity/dispose.
  • pnpm turbo build --filter=@assistant-ui/harness, pnpm --filter @assistant-ui/harness test, pnpm lint, and pnpm check:resource-memo all pass.

🤖 Generated with Claude Code

Review in cubic

…hook, Harness class, and multi-harness manager
@Yonom
Yonom requested a review from a team July 20, 2026 15:01
@changeset-bot

changeset-bot Bot commented Jul 20, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 01cf642

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@rupic-app rupic-app Bot added stage/needs-review No reviews yet; waiting for a maintainer pkg/harness Changes a package under packages/ R1 Actionable, normal priority type/feature New feature or capability labels Jul 20, 2026
@claude

claude Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Claude finished @Yonom's task in 3m 51s —— View job


Reviewing this PR…

  • Gather context (CI status, previous reviews, diff since last review)
  • Verify fixes for previously raised issues
  • Review new commits for issues introduced by fixes
  • Full-package re-check (correctness, tests, changeset/docs requirements)
  • Collect simplify agent findings
  • Post final review

@rupic-app rupic-app Bot added stage/awaiting-author Changes requested or CI failing; ball is with the author R2 Ball is in the author's court; not actionable today and removed stage/needs-review No reviews yet; waiting for a maintainer R1 Actionable, normal priority labels Jul 20, 2026
@greptile-apps

greptile-apps Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Reviews (1): Last reviewed commit: "feat(harness): @assistant-ui/harness wit..." | Re-trigger Greptile

Comment thread packages/harness/src/HarnessResource.ts Outdated
@rupic-app rupic-app Bot added stage/awaiting-reviewer Has reviews but not approved; reviewer follow-up needed R1 Actionable, normal priority stage/awaiting-author Changes requested or CI failing; ball is with the author R2 Ball is in the author's court; not actionable today and removed stage/awaiting-author Changes requested or CI failing; ball is with the author R2 Ball is in the author's court; not actionable today stage/awaiting-reviewer Has reviews but not approved; reviewer follow-up needed R1 Actionable, normal priority labels Jul 20, 2026

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review completed against the latest diff

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread packages/harness/src/transport/HttpHarnessTransport.ts Outdated
Comment thread packages/harness/src/views.ts Outdated
@rupic-app rupic-app Bot added stage/awaiting-reviewer Has reviews but not approved; reviewer follow-up needed R1 Actionable, normal priority and removed stage/awaiting-author Changes requested or CI failing; ball is with the author R2 Ball is in the author's court; not actionable today stage/awaiting-reviewer Has reviews but not approved; reviewer follow-up needed labels Jul 20, 2026
@rupic-app rupic-app Bot added stage/awaiting-reviewer Has reviews but not approved; reviewer follow-up needed R1 Actionable, normal priority and removed stage/awaiting-author Changes requested or CI failing; ball is with the author R2 Ball is in the author's court; not actionable today labels Jul 20, 2026
Comment thread packages/harness/src/Harness.ts Outdated
Comment thread packages/harness/src/HarnessResource.ts
Comment thread packages/harness/src/types.ts Outdated
Comment thread packages/harness/src/HarnessResource.ts
Comment thread packages/harness/src/types.ts
Comment thread packages/harness/src/HarnessResource.ts Outdated
Comment thread packages/harness/src/transport/HttpHarnessTransport.ts
Comment thread packages/harness/src/HarnessResource.ts Outdated
@rupic-app rupic-app Bot added stage/awaiting-author Changes requested or CI failing; ball is with the author R2 Ball is in the author's court; not actionable today and removed stage/awaiting-reviewer Has reviews but not approved; reviewer follow-up needed R1 Actionable, normal priority labels Jul 20, 2026

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 6 files (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread packages/harness/src/types.ts
@rupic-app rupic-app Bot added stage/awaiting-reviewer Has reviews but not approved; reviewer follow-up needed R1 Actionable, normal priority stage/awaiting-author Changes requested or CI failing; ball is with the author R2 Ball is in the author's court; not actionable today and removed stage/awaiting-author Changes requested or CI failing; ball is with the author R2 Ball is in the author's court; not actionable today stage/awaiting-reviewer Has reviews but not approved; reviewer follow-up needed R1 Actionable, normal priority labels Jul 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg/harness Changes a package under packages/ R2 Ball is in the author's court; not actionable today stage/awaiting-author Changes requested or CI failing; ball is with the author type/feature New feature or capability

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Morty Proxy This is a proxified and sanitized view of the page, visit original site.