merge: hapi upstream main 2026-10-19 (34 commits past v0.30.7)

Bring in the post-0.30.7 upstream work while keeping local team, macaron,
requirement, DSH and deployment features:

- runner/hub: cross-platform orphan reap on archive and tracking loss,
  machine-spawn preallocated stubs, keepalive-only sessions reconcile to idle
- hub: prepared-statement cache, stale/canceled permission request handling
- cli: Codex compaction announcements, dynamic Kimi models, MCP bridge reap
- web: session toolbar icon shedding, mark-all-read, unread/active sections,
  Russian locale, external-link preference, 48px search chrome
- ios/android: locale and font-size updates

Conflict resolution keeps local-only behavior (agent team spawns, macaron
skins, collapsible sidebar, workspace markdown images) layered on the new
upstream toolbar and session lifecycle plumbing.

Test infrastructure: skip the Docker-only pwsh integration test quickly when
Docker is unavailable, and exclude the Bun-only usageScan test from vitest.

via [HAPI](https://hapi.run)

Co-Authored-By: HAPI <noreply@hapi.run>
Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
2026-10-23 12:44:05 +08:00
co-authored by HAPI Claude Code
279 changed files with 23126 additions and 1620 deletions
+24 -3
View File
@@ -186,10 +186,31 @@ describe('runOpencode set-session-config handler', () => {
return configHandler![1] as (payload: unknown) => Promise<unknown>;
}
it('carries the runner preallocated id from CLI args through parse into bootstrapExistingSession', async () => {
it('routes reservedSessionId from buildCliArgs into bootstrapSession (adopt, not reopen)', async () => {
const runnerArgs = buildCliArgs('opencode', {
directory: '/tmp/project',
existingSessionId: 'preallocated-hapi-id'
reservedSessionId: 'aaaaaaaa-bbbb-4ccc-8ddd-eeeeeeeeeeee'
});
const parsed = parseRemoteAgentCommandOptions(runnerArgs.slice(1), OPENCODE_PERMISSION_MODES);
expect(parsed.reservedSessionId).toBe('aaaaaaaa-bbbb-4ccc-8ddd-eeeeeeeeeeee');
expect(parsed.existingSessionId).toBeUndefined();
await runOpencode({ ...parsed, workingDirectory: '/tmp/project' });
expect(harness.bootstrapExistingArgs).toEqual([]);
expect(harness.bootstrapArgs).toEqual([expect.objectContaining({
flavor: 'opencode',
startedBy: 'runner',
workingDirectory: '/tmp/project',
reservedSessionId: 'aaaaaaaa-bbbb-4ccc-8ddd-eeeeeeeeeeee'
})]);
});
it('routes --existing-session-id reopen into bootstrapExistingSession', async () => {
const runnerArgs = buildCliArgs('opencode', {
directory: '/tmp/project',
existingSessionId: 'live-hub-row'
});
const parsed = parseRemoteAgentCommandOptions(runnerArgs.slice(1), OPENCODE_PERMISSION_MODES);
@@ -197,7 +218,7 @@ describe('runOpencode set-session-config handler', () => {
expect(harness.bootstrapArgs).toEqual([]);
expect(harness.bootstrapExistingArgs).toEqual([{
sessionId: 'preallocated-hapi-id',
sessionId: 'live-hub-row',
flavor: 'opencode',
startedBy: 'runner',
workingDirectory: '/tmp/project'
+5 -2
View File
@@ -27,6 +27,8 @@ export async function runOpencode(opts: {
modelReasoningEffort?: string | null;
resumeSessionId?: string;
existingSessionId?: string;
/** Fresh machine-spawn stub (`--hapi-session-id`); adopt via bootstrapSession. */
reservedSessionId?: string;
workingDirectory?: string;
} = {}): Promise<void> {
const workingDirectory = opts.workingDirectory ?? getInvokedCwd();
@@ -69,7 +71,8 @@ export async function runOpencode(opts: {
workingDirectory,
agentState: initialState,
model: initialModel ?? undefined,
modelReasoningEffort: initialModelReasoningEffort ?? undefined
modelReasoningEffort: initialModelReasoningEffort ?? undefined,
reservedSessionId: opts.reservedSessionId
});
const { api, session } = bootstrap;
@@ -150,7 +153,7 @@ export async function runOpencode(opts: {
});
lifecycle.registerProcessHandlers();
registerKillSessionHandler(session.rpcHandlerManager, lifecycle);
registerKillSessionHandler(session.rpcHandlerManager, lifecycle, session);
registerLocalHandoffHandler(session.rpcHandlerManager, lifecycle);
const syncSessionMode = () => {