Agent Zero backend + streaming client; Hermes-via-Tailscale seed; pre-existing test fixes#26
Open
Ripnrip wants to merge 11 commits into
Open
Agent Zero backend + streaming client; Hermes-via-Tailscale seed; pre-existing test fixes#26Ripnrip wants to merge 11 commits into
Ripnrip wants to merge 11 commits into
Conversation
…Callback - package.json: 2.1.0 -> 3.0.0 (matches app.json marketing version) - App.tsx: tolerate a missing office-game/dist/office-inline.js bundle so dev builds without office assets don't hard-crash; fall back to an empty doc - ChatTab/YouMindChatTab/ConfigScreen/auto-app-review: replace InteractionManager.runAfterInteractions with requestIdleCallback. RN's InteractionManager can stall on busy animations; requestIdleCallback yields cleanly. - SceneDelegate.swift: scene lifecycle stub for iOS deep-linking + lifecycle events generated by Expo prebuild.
…rsion - usage-format.formatDayLabel: pass timeZone: 'UTC' to toLocaleDateString. The input "2024-01-15" was being rendered as "Jan 14" by viewers west of UTC because Date.UTC + local toLocaleDateString shifted the day backward. - app-update-announcement.test: replace the hardcoded "2.1.0" assertion with `APP_PACKAGE_VERSION` so the storage-key test stops breaking every version bump; replace the "3.0.0 not in history" probe with "99.99.99" so the test doesn't lie when 3.0.0 actually gets a release entry. Both tests were red on main; they're green now.
The seed Hermes (Binary Bros) connection was pointing at the Mac Studio's
raw Tailscale IP (100.89.167.39). That worked, but:
- the bridge actually runs on agent-habitat now, not the studio
- tryCloudflare tunnel URLs that previously hosted the bridge expire
after a few hours and stranded the iOS app on dead endpoints
Repointing the seed at the habitat VM via MagicDNS so it survives IP
shuffles and tunnel turnover:
ws://agent-habitat.tail48d4cc.ts.net:4319/v1/hermes/ws?token=...
Add a 3.0.0 release announcement entry covering the same change so users
upgrading from 2.x see the new connection flow on first launch.
…aming
Adds Agent Zero as a third product backend alongside OpenClaw and Hermes.
Scope of this pass:
Backend metadata:
- types.GatewayBackendKind gains 'agentzero'; new AgentZeroGatewayConfig
(bridgeUrl + optional projectName) on GatewayConfig/SavedGatewayConfig.
- gateway-backends: AGENTZERO_CAPABILITIES (chat-only — console screens
stay off until per-screen adapters land); registry entry; widened
isGatewayBackendKind, resolveGatewayBackendKind, selectByBackend (with
fall-through to openclaw at call sites that haven't opted in yet),
resolveGlobalMainSessionKey ('main'), getGatewayModeLabel,
buildGatewayDefaultName, toLegacyGatewayMode. 6 new unit tests.
- Call sites widened to accept the new union: useAppBootstrap.buildAgentPreview,
ConfigScreenLayout.getBackendLabels, qrPayload (excludes 'agentzero' from
the transport-kind filter), PairingPendingCard.connectionMode.
Transport (services/agentzero-client.ts, 14 + 6 tests):
- sendMessage(): one-shot POST /api/api_message, returns
{ contextId, response }. Matches what the a0 CLI and the habitat
health-check cron use.
- streamMessage(req, onLogItem): real progressive streaming.
1. POST /api/api_message_async to kick off the agent and capture
context_id immediately.
2. Poll /api/api_log_get every ~400ms, emit each new log item via
onLogItem.
3. Resolve when progress_active=false AND a 'response'-type item
arrived. Hard maxStreamMs watchdog returns AgentZeroError(408).
AbortSignal threads through both phases.
- AgentZeroError class so call sites can `instanceof` and inspect status.
- createAgentZeroClient(config, token) factory bound to
AgentZeroGatewayConfig.
NOTE: api_message_async is a tiny key-authed clone of AZ's web-auth-only
message_async, deployed on the AZ instance as api/api_message_async.py
(persisted under habitat:~/clawket-credentials/agentzero-patches/, auto-
restored on AZ launch — see habitat:~/clawket-credentials/README.md).
gateway.ts is NOT touched in this pass; agent-zero-native screens import
createAgentZeroClient directly. The transport API stays stable when the
poll loop is later swapped for socket.io-client.
Lockfile catches up to changes that landed in the working tree before this session (apps/bridge-cli 0.6.3 -> 0.6.4, @expo/ui removal). The 3.0.0 version bumps in apps/mobile and root will surface on the next `npm install`; the build verified in this session does not depend on them.
…streaming
Builds on top of the agentzero backendKind + AgentZeroClient scaffolding so
users can actually create + chat with an Agent Zero connection from the app.
AddConnection editor:
- 'Agent Zero' becomes a third option in the backend pill alongside OpenClaw
and Hermes.
- New deriveAgentZeroConfig() normalizes whatever the user pastes (http://,
https://, even ws://… by accident) down to a clean base URL with no path.
- editorRequiresDirectAuth widened to require token entry for agentzero —
AZ's X-API-KEY rides on the existing `token` field on SavedGatewayConfig.
- saveEditor threads `agentzero` into both create + edit paths.
- normalizeEditorTransportKind pins agentzero to 'custom' transport (no
relay/local/tailscale variants — just HTTP to the AZ web server).
- toRuntimeConfig passes agentzero through to the runtime config.
- 2 new tests on useGatewayConfigForm: a happy-path save and the
missing-token rejection.
Chat:
- New AgentZeroChatTab — self-contained, doesn't share the OpenClaw/Hermes
WS gateway. Uses createAgentZeroClient + streamMessage to render each
log item as a bubble keyed by the framework's `no` cursor. Persists the
AZ contextId in component state so subsequent turns continue the same
chat. Bubble color/border varies by AZ log type (user/agent/tool/error).
- Inline minimal header (the shared ChatHeader is shaped around OpenClaw
connection-state events that don't apply to AZ's HTTP polling model).
- 'Reset Chat' button discards the contextId so the next message opens a
fresh AZ context.
- Streaming UX: 'Agent Zero is working…' indicator while progress_active
is true; bubble list auto-scrolls to bottom on each new item.
- Component unmount aborts any in-flight stream via AbortController.
- Dispatched from ChatTab via a sibling `if (backendKind === 'agentzero')`
branch next to the existing youmind branch.
i18n:
- 1 new key in `config` namespace ("Agent Zero") + 9 new keys in `chat`
namespace across all 6 locales (en, zh-Hans, ja, ko, de, es). Product
name stays untranslated; surrounding copy is localized.
Tests: 1363/1363 pass (was 1361 before this branch). Typecheck clean.
Out of scope (still parked for later):
- Project switcher / a0 CLI's /project foo flow
- Slash commands (/new, /code) as first-class UI
- Persistent contextId across app restarts (currently in-memory only)
- AZ-specific drawer with past contexts
- AZ chat history pre-load on open
…ab bar useTabBarHeight() must be added to the composer's bottom padding (and to the KeyboardAvoidingView offset) so the input row clears the iOS native tabs overlay. Without it, the composer rendered below the tab bar and was unreachable on first launch. Mirrors how YouMindChatTab handles the same.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.