feat(ext/sw): get_vault_status handler + cached sync state (Plan C Phase 6)

Returns cached ahead/behind/lastSyncAt from the GitHost plus a live count of
active (non-trashed) manifest items. No network call — sync is user-initiated;
the sync handler records lastSyncAt (unix seconds). ahead/behind stay 0 in the
extension (writes go straight to the host, no local commit graph) and exist
for parity with relicario status.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
adlee-was-taken
2026-05-31 15:24:02 -04:00
parent 3121431a7e
commit 61275574d4
6 changed files with 105 additions and 4 deletions

View File

@@ -130,6 +130,8 @@ export async function handle(
const handle = session.getCurrent();
if (!handle || !state.gitHost) return { ok: false, error: 'vault_locked' };
state.manifest = await vault.fetchAndDecryptManifest(state.gitHost, handle);
// Record sync time (unix SECONDS) for the get_vault_status indicator.
state.gitHost.lastSyncAt = Math.floor(Date.now() / 1000);
return { ok: true };
}
@@ -634,9 +636,9 @@ export async function handle(
case 'attach_vault':
return vault.handleAttachVault(msg, state);
// get_vault_status lands in Phase 6 (Dev-C).
// Until each case lands, an unhandled popup message returns an explicit
// error rather than falling through with no return.
case 'get_vault_status':
return vault.handleGetVaultStatus(state);
default:
return { ok: false, error: `unhandled popup message: ${(msg as { type: string }).type}` };
}