Skip to content

feat: experimental debug hooks across host-api, host-container, host-papp#154

Merged
valentinfernandez1 merged 6 commits into
mainfrom
feat/experimental-debug-hooks
May 15, 2026
Merged

feat: experimental debug hooks across host-api, host-container, host-papp#154
valentinfernandez1 merged 6 commits into
mainfrom
feat/experimental-debug-hooks

Conversation

@valentinfernandez1

Copy link
Copy Markdown
Contributor

Upstreams the experimental debug hooks dotli has been carrying in vendor/truapi-debug/ (vendored via package.json overrides) into the official packages. Once this ships, dotli can drop the override block and depend directly on host-api, host-container, and host-papp.

Original implementation and product context: dotli PR LINK.

Three commits, one per package:

feat(host-api): adds Transport.onDebugMessage(callback) for raw host ↔ product traffic in decoded form. The underlying provider subscription is lazy, so there's no per-message cost while nothing is listening. Each listener is wrapped in its own try/catch so a throwing subscriber can't block other listeners or message delivery.

feat(host-container): adds a productId option on createContainer, a container-level onDebugMessage, and a process-global onHostApiDebugMessage aggregator. Every event the global bus emits is tagged with the productId of the container it came from.

feat(host-papp): adds a ./debug subpath export carrying a structured event bus for SSO pairing, guest attestation, and session activity. The subpath split keeps verifiablejs WASM out of debug-only consumers; that WASM doesn't initialise cleanly in test runners or some older browsers.

The surface was validated end-to-end via dotli's vendored copy (built from this branch).

Adds Transport.onDebugMessage(callback) for host-side observability:
every message crossing the transport in either direction is surfaced
in decoded (non-SCALE) form. Lazy under the hood — wires up through
messageProvider so there is no per-message cost while no listener is
attached.
Adds onDebugMessage to Container and a process-global
onHostApiDebugMessage bus that aggregates traffic across every
container, tagged with the productId passed to createContainer.
Builds on host-api's transport-level debug hook
Adds a ./debug subpath export so host applications can subscribe
to pairing, attestation, and session activity — intended for
in-app debug panels and bug reports. The subpath is split from
the main entry so consumers can subscribe without loading the
verifiablejs WASM the main entry depends on
@valentinfernandez1

Copy link
Copy Markdown
Contributor Author

@johnthecat can we get a review on this 🙏🏻

…ug-hooks

# Conflicts:
#	packages/host-container/package.json
#	packages/host-papp/src/sso/auth/impl.ts
#	packages/host-papp/src/sso/sessionManager/impl.ts
#	packages/host-papp/src/sso/sessionManager/userSession.ts

@Imod7 Imod7 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Worth adding a test per file for the emit sites in attestationService.ts, auth/impl.ts, sessionManager/impl.ts, and userSession.ts. Keeps a future refactor from silently dropping them.

Comment thread packages/host-container/src/createContainer.ts Outdated
Comment thread packages/host-papp/src/debugBus.ts
Comment thread packages/host-api/src/transport.ts
Comment thread packages/host-papp/src/debugTypes.ts Outdated
Comment thread packages/host-papp/src/sso/sessionManager/userSession.ts
@valentinfernandez1 valentinfernandez1 requested a review from Imod7 May 14, 2026 18:50

@Imod7 Imod7 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM!

@valentinfernandez1 valentinfernandez1 merged commit a65ed3e into main May 15, 2026
5 checks passed
@johnthecat johnthecat deleted the feat/experimental-debug-hooks branch June 11, 2026 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants