Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
160 commits
Select commit Hold shift + click to select a range
f2b6235
feat(host-service): add account provenance to terminal binding schema
ozeitis Oct 9, 2026
abe4ca2
feat(desktop): choose an account for new agent terminals
ozeitis Oct 10, 2026
f739417
feat(chat): persist account launch context and recovery receipts
ozeitis Oct 10, 2026
2d25d0e
feat(host-service): validate saved Claude and Codex conversation iden…
ozeitis Oct 10, 2026
c12a208
feat(desktop): resume ended native conversations with a selected account
ozeitis Oct 10, 2026
775790a
fix(chat): retain composer drafts until submission is accepted
ozeitis Oct 10, 2026
34a360c
feat(desktop): bind native chats to explicit accounts
ozeitis Oct 10, 2026
cc3ceb6
test(desktop): use supported role query options for stop confirmation
ozeitis Oct 10, 2026
874f65e
chore(i18n): normalize extracted account chat catalogs
ozeitis Oct 10, 2026
9e588c1
fix(chat): retain account-bound queued messages after a stopped agent
ozeitis Oct 13, 2026
cf3414d
feat(chat): persist account launch context and recovery receipts
ozeitis Oct 10, 2026
8e8b20a
fix(desktop): distinguish resume and usage header keys
ozeitis Oct 13, 2026
2322b1e
refactor(host-service): keep saved identity scoped to native history
ozeitis Oct 13, 2026
3134380
test(chat-runtime): verify receipt constraint errors and nullable com…
ozeitis Oct 13, 2026
b2c4fa2
fix(chat): preserve intentional queue steering and publish pauses
ozeitis Oct 13, 2026
4ce5fad
fix(chat): discover native accounts independently of terminal flags
ozeitis Oct 13, 2026
dae241f
perf(host-service): validate exact recovery history in the host worke…
ozeitis Oct 13, 2026
c4efb8a
fix(desktop): recover the durable successor after a lost resume response
ozeitis Oct 13, 2026
619584a
test(desktop): type the recovered successor cache assertion
ozeitis Oct 13, 2026
b2b1861
fix(chat): route native account discovery by surface
ozeitis Oct 13, 2026
59293c7
fix(i18n): clarify account sign-in and terminal terminology
ozeitis Oct 13, 2026
a249ef8
fix(i18n): clarify native chat account sign-in in Spanish
ozeitis Oct 13, 2026
101ad48
fix(host-service): compare durable account routing context
ozeitis Oct 13, 2026
3e44f79
fix(host-service): retain verified account attribution across hook races
ozeitis Oct 13, 2026
d3bb948
fix(i18n): clarify account sign-in and terminal terminology
ozeitis Oct 13, 2026
7504093
fix(host-service): prepare selected profile hooks and preserve ambien…
ozeitis Oct 13, 2026
96d673d
fix(chat-ui): retain history-saved drafts during pending sends
ozeitis Oct 13, 2026
f5577b9
merge reviewed prerequisites for native-base
ozeitis Oct 13, 2026
31523d4
merge reviewed native chat account prerequisites
ozeitis Oct 13, 2026
77e8e6f
fix(desktop): settle submitted drafts after composer unmount
ozeitis Oct 13, 2026
cc7e338
fix(host-service): clean up refused new recovery terminals only
ozeitis Oct 13, 2026
7b08860
fix(desktop): avoid restoring an accepted composer draft seed
ozeitis Oct 13, 2026
eb2e3cf
merge qualified prerequisites for exact-qualified
ozeitis Oct 13, 2026
a24899d
fix(desktop): synchronize cleared seeds across mounted composers
ozeitis Oct 13, 2026
c942bf9
test(chat-ui): set explicit caret positions for draft history regression
ozeitis Oct 13, 2026
7a2de9d
test(chat): require pinned Codex discovery marker
ozeitis Oct 13, 2026
f605268
fix(host-service): reconcile same-launch account capture
ozeitis Oct 14, 2026
3d02a45
fix(host-service): respect disabled hooks for account launches
ozeitis Oct 14, 2026
376379f
fix(desktop): trap focus in account terminal picker
ozeitis Oct 14, 2026
5c40d7a
fix(host-service): distinguish user preferences from managed account …
ozeitis Oct 14, 2026
f44cbc0
Merge branch 'work/pr8460' into work/pr8461
ozeitis Oct 14, 2026
6d1ded0
fix(desktop): share the editor draft receipt with persisted clearing
ozeitis Oct 14, 2026
7b1ddf1
fix(i18n): clarify Vietnamese account terminal labels
ozeitis Oct 14, 2026
4121446
fix(host-service): keep Claude recovery traversal within project roots
ozeitis Oct 14, 2026
4ed97b6
perf(host-service): compile native rollout filename pattern once
ozeitis Oct 14, 2026
e7ef953
fix(desktop): preserve definitive account resume refusals
ozeitis Oct 14, 2026
75a6d0e
Merge branch 'work/pr8460' into work/pr8462
ozeitis Oct 14, 2026
7b6e3d2
test(chat-runtime): retain recovery guard after failed provider disposal
ozeitis Oct 14, 2026
8a4e9f1
style(desktop): format native account picker integration
ozeitis Oct 14, 2026
8990ac3
test(desktop): preserve native chat account picker focus
ozeitis Oct 14, 2026
6795553
Merge commit 'cc31d024c8f266caad52ea15d14311f5d22ba5cc' into work/pr8462
ozeitis Oct 14, 2026
e098cb8
test: align review regression formatting with repository checks
ozeitis Oct 14, 2026
0ce9f39
test: align review regression formatting with repository checks
ozeitis Oct 14, 2026
1be3b18
fix(desktop): retain terminal account picker return focus
ozeitis Oct 14, 2026
28bb0dd
fix(desktop): guard pending sends across composer remounts
ozeitis Oct 14, 2026
824c016
fix(host-service): preserve exact terminal attribution across restarts
ozeitis Oct 14, 2026
9fbc74f
Merge exact attribution hardening for PR8461
ozeitis Oct 14, 2026
6b4cf0c
Merge exact attribution hardening for PR8462
ozeitis Oct 14, 2026
25aa885
chore(chat): reconcile account schema with current upstream
ozeitis Oct 25, 2026
f1f4369
fix(host-service): reconcile terminal account migrations with current…
ozeitis Oct 25, 2026
6cc2faf
Merge current terminal provenance and preserve account launch UI
ozeitis Oct 25, 2026
f205231
Preserve composer submission receipts with current pasted context and…
ozeitis Oct 25, 2026
8904f7d
fix(desktop): verify recommended launch picker and complete its trans…
ozeitis Oct 25, 2026
0a05741
fix(host-service): revalidate exact conversation history at resume ad…
ozeitis Oct 25, 2026
ebd1750
fix(host-service): preserve worker entrypoint while testing transcrip…
ozeitis Oct 25, 2026
eff6548
feat(host-service): reconnect exact live Claude background conversations
ozeitis Oct 25, 2026
f49517f
Merge account schema and terminal recovery prerequisites
ozeitis Oct 25, 2026
083352c
feat(chat): integrate account-bound native conversations with current…
ozeitis Oct 25, 2026
47d27c0
fix(host-service): preserve verified quota across credential and prov…
ozeitis Oct 25, 2026
cad3884
fix(chat): render the account action label as an expression
ozeitis Oct 25, 2026
2ea7c3a
fix(chat): preserve validated account handoff labels and translations
ozeitis Oct 25, 2026
dfcffe9
Merge current upstream sign-in and sidebar-group fixes
ozeitis Oct 25, 2026
6c0d722
Merge current upstream sign-in and sidebar-group fixes
ozeitis Oct 25, 2026
e531316
Merge current upstream sign-in and sidebar-group fixes
ozeitis Oct 25, 2026
4462cd7
Merge current upstream sign-in and sidebar-group fixes
ozeitis Oct 25, 2026
751b36f
Merge current upstream sign-in and sidebar-group fixes
ozeitis Oct 25, 2026
696ca24
Merge current upstream sign-in and sidebar-group fixes
ozeitis Oct 25, 2026
64a4827
fix(chat): narrow the current source after handoff refusal
ozeitis Oct 25, 2026
d785d47
fix(desktop): preserve native chat picker mode and nullable session f…
ozeitis Oct 25, 2026
ac12d45
test(chat): keep saved-session fixtures compatible with nullable prov…
ozeitis Oct 25, 2026
ea6f359
fix(i18n): translate native chat launch action
ozeitis Oct 25, 2026
182d02d
Merge verified account freshness prerequisite
ozeitis Oct 25, 2026
0321ad1
fix(desktop): judge each account quota window by its own source and age
ozeitis Oct 25, 2026
bb183f4
Merge verified account freshness prerequisite
ozeitis Oct 25, 2026
1c0895e
Merge verified account freshness prerequisite
ozeitis Oct 25, 2026
593ea74
fix(desktop): evaluate refreshed account readings against the current…
ozeitis Oct 25, 2026
b304d7c
Merge refreshed account-picker clock fix
ozeitis Oct 25, 2026
4dbb213
fix(desktop): keep newly refreshed quota visible before the age timer
ozeitis Oct 25, 2026
f9cba9e
Merge refreshed account-picker clock fix
ozeitis Oct 25, 2026
cd39d6d
Merge account-bound chat and shared quota prerequisites
ozeitis Oct 25, 2026
442d4ad
feat(usage): capture passive quota from selected Claude sessions
ozeitis Oct 25, 2026
882e08c
fix(usage): preserve trusted native receipt dates through asynchronou…
ozeitis Oct 25, 2026
404838b
fix(usage): bind native freshness to receipt time before queued valid…
ozeitis Oct 25, 2026
06dd991
Merge reviewed native cache freshness prerequisite
ozeitis Oct 25, 2026
d6c46f0
style(usage): format integrated passive quota adapters
ozeitis Oct 25, 2026
e3420a7
test(usage): keep injected native feed tests from replacing shared mo…
ozeitis Oct 25, 2026
ff14555
test(usage): restore scoped reader spies after native integration checks
ozeitis Oct 25, 2026
813a5a8
Merge isolated native-reader regression prerequisite
ozeitis Oct 25, 2026
b01aa1e
Merge shared inventory failure classification
ozeitis Oct 25, 2026
84756e4
fix(usage): keep a failed provider inventory distinct from discovered…
ozeitis Oct 25, 2026
857d224
fix(usage): collect native status without waiting for a custom status…
ozeitis Oct 25, 2026
a8178dd
fix(usage): declare the pinned TOML reader on the independent quota b…
ozeitis Oct 25, 2026
563631d
Declare quota parser dependency in the integrated feature
ozeitis Oct 25, 2026
b16cea5
Retain strict worker ownership proof assertions
ozeitis Oct 25, 2026
e12a3a6
test(host-service): assert both saved-history store bindings
ozeitis Oct 25, 2026
88cbafb
test(usage): assert failed inventory has no identity field
ozeitis Oct 25, 2026
c2e6181
Keep inventory absence assertion valid on the independent quota found…
ozeitis Oct 25, 2026
ba3423b
Retain exact reserved-successor authorization in the feature stack
ozeitis Oct 25, 2026
0d41189
fix(host-service): authorize only the exact reserved resume successor
ozeitis Oct 25, 2026
bf9e134
refactor(chat): remove unused account recovery state
ozeitis Oct 25, 2026
3a576f7
Retain final account recovery guards and lint cleanup
ozeitis Oct 25, 2026
adbb88a
test(agent-setup): isolate Codex exit fixtures from delayed launch re…
ozeitis Oct 25, 2026
477f13b
Keep independent wrapper lifecycle fixtures in the composed feature
ozeitis Oct 25, 2026
c7c54f5
Keep independent wrapper lifecycle fixtures in the composed feature
ozeitis Oct 25, 2026
464a53e
Merge published account and quota prerequisites for native Claude usa…
ozeitis Oct 25, 2026
72fdf73
test(usage): qualify native Claude collector configuration
ozeitis Oct 25, 2026
7f2a262
fix(usage): compare Claude reset windows at documented second precision
ozeitis Oct 25, 2026
4205c07
fix(usage): preserve precise resets across native Claude feeds
ozeitis Oct 25, 2026
1dc81aa
Merge reviewed prerequisite fixes for #8400
ozeitis Oct 26, 2026
c0d2b20
Merge reviewed prerequisite fixes for #8460
ozeitis Oct 26, 2026
6b1e4e5
fix(chat): acknowledge child steering without waiting for turn comple…
ozeitis Oct 26, 2026
2e88e00
Merge reviewed prerequisite fixes for #8464
ozeitis Oct 26, 2026
d8558bd
fix: address verified review findings for #8460
ozeitis Oct 26, 2026
4ed7ec2
Merge reviewed prerequisite fixes for #8461
ozeitis Oct 26, 2026
b5bc584
fix: address verified review findings for #8464
ozeitis Oct 26, 2026
d5f8d92
Merge reviewed prerequisite fixes for #8462
ozeitis Oct 26, 2026
4007fe4
fix: address verified review findings for #8461
ozeitis Oct 26, 2026
40cf699
Merge reviewed prerequisite fixes for #8462
ozeitis Oct 26, 2026
74d2a95
Merge reviewed prerequisite fixes for #8888
ozeitis Oct 26, 2026
7472d64
Merge reviewed prerequisite fixes for #8888
ozeitis Oct 26, 2026
5e1f584
fix: address verified review findings for #8464
ozeitis Oct 26, 2026
e0f45ad
test(usage): preserve healthy sibling account history
ozeitis Oct 26, 2026
e3492ca
test(chat): cover account identity changes during steering
ozeitis Oct 26, 2026
80c4db1
Merge reviewed prerequisite fixes for #8888
ozeitis Oct 26, 2026
357717d
Merge reviewed prerequisite fixes for #8888
ozeitis Oct 26, 2026
f0af13d
Merge reviewed prerequisite fixes for #8888
ozeitis Oct 26, 2026
ef5e01f
test(usage): compare persisted provider windows with compatible types
ozeitis Oct 26, 2026
e0817dc
Merge reviewed prerequisite fixes for #8888
ozeitis Oct 26, 2026
537290b
test(usage): compare persisted provider windows with compatible types
ozeitis Oct 26, 2026
4c2da2f
style(desktop): format terminal-only quota refresh calls
ozeitis Oct 26, 2026
66239d5
Merge reviewed prerequisite fixes for #8461
ozeitis Oct 26, 2026
6ef0839
Merge reviewed prerequisite fixes for #8462
ozeitis Oct 26, 2026
8ce2ec1
Merge reviewed prerequisite fixes for #8888
ozeitis Oct 26, 2026
4a169a6
merge: reconcile account selection with current upstream
ozeitis Oct 26, 2026
92f6ff8
fix(accounts): expose quota refresh failures without blocking manual …
ozeitis Oct 26, 2026
2abcb7c
merge: propagate reviewed account selection prerequisites
ozeitis Oct 26, 2026
9bcfd7f
fix(accounts): preserve exact recovery across hooks and rejected auth…
ozeitis Oct 26, 2026
59748f1
merge: propagate reviewed exact recovery prerequisites
ozeitis Oct 26, 2026
428794a
fix(chat): retain account replay and clean explicitly closed drafts
ozeitis Oct 26, 2026
f345e2d
fix(chat): restrict draft disposal to explicit close cleanup
ozeitis Oct 26, 2026
7635307
merge: align quota prerequisite with current upstream parser
ozeitis Oct 26, 2026
043d981
fix(usage): pace active account reads and expose invalidation hints
ozeitis Oct 26, 2026
363d2e7
merge: propagate reviewed contribution prerequisites
ozeitis Oct 26, 2026
fba3613
merge: align native usage with pacing and invalidation protocol
ozeitis Oct 26, 2026
2ff4542
fix(usage): prove native samples with bounded reads and owned resumes
ozeitis Oct 26, 2026
76a5bad
fix(chat): keep saved-history browsing in its separate contribution
ozeitis Oct 26, 2026
917d9eb
merge: propagate reviewed contribution prerequisites
ozeitis Oct 26, 2026
a2aa060
chore(i18n): regenerate scoped contribution catalogs
ozeitis Oct 26, 2026
ae9fced
style(desktop): format scoped account-form fallback
ozeitis Oct 26, 2026
1bbb42d
merge: propagate reviewed contribution prerequisites
ozeitis Oct 26, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/build-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ jobs:
sleep "$((attempt * 10))"
done

- name: Build macOS executable verifier
if: startsWith(matrix.target, 'darwin-')
working-directory: packages/macos-process-metrics
run: npx --yes node-gyp@12.4.0 rebuild

- name: Build distribution
working-directory: packages/cli
env:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
import { expect, test } from "bun:test";
import { continueNativeBackground } from "./continue-native-background";

const input = {
workspaceId: "workspace",
terminalId: "old",
expectedRevision: "captured-source",
};
test("Continue prefers the existing background view and never requests another account", async () => {
let reads = 0;
let resumes = 0;
const result = await continueNativeBackground(input, {
reconnect: async () => ({
reconnected: true,
terminalId: "view",
label: "Claude",
}),
source: async () => {
reads++;
return null;
},
resume: async () => {
resumes++;
return { resumed: false };
},
});
expect(result).toEqual({ terminalId: "view", label: "Claude" });
expect(reads).toBe(0);
expect(resumes).toBe(0);
});
test("a cleanly ended conversation can resume only its same immutable original account", async () => {
const requested: unknown[] = [];
const result = await continueNativeBackground(input, {
reconnect: async () => ({ reconnected: false }),
source: async () => ({
provider: "claude",
ready: true,
revision: input.expectedRevision,
account: { selection: "/original/profile", identity: "exact-original" },
}),
resume: async (request) => {
requested.push(request);
return { resumed: true, terminalId: "exact-replay", label: "Claude" };
},
});
expect(result?.terminalId).toBe("exact-replay");
expect(requested).toEqual([
{
...input,
account: { selection: "/original/profile", identity: "exact-original" },
},
]);
});
test("changed or incomplete source context cannot become a default-account resume", async () => {
for (const saved of [
null,
{
provider: "claude",
ready: false,
revision: input.expectedRevision,
account: { selection: null, identity: "account" },
},
{
provider: "claude",
ready: true,
revision: "changed",
account: { selection: "/different", identity: "new" },
},
]) {
let resumes = 0;
expect(
await continueNativeBackground(input, {
reconnect: async () => ({ reconnected: false }),
source: async () => saved,
resume: async () => {
resumes++;
return { resumed: false };
},
}),
).toBeNull();
expect(resumes).toBe(0);
}
});
test("a lost attachment response cannot fall through and launch a second worker", async () => {
let resumes = 0;
await expect(
continueNativeBackground(input, {
reconnect: async () => {
throw new Error("offline");
},
source: async () => null,
resume: async () => {
resumes++;
return { resumed: false };
},
}),
).rejects.toThrow("offline");
expect(resumes).toBe(0);
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
interface Input {
workspaceId: string;
terminalId: string;
expectedRevision: string;
}
interface Successor {
terminalId: string;
label: string;
}
interface Account {
selection: string | null;
identity: string;
}
interface ContinueNativeIO {
reconnect(
input: Input,
): Promise<
| { reconnected: false }
| ({ reconnected: true } & Successor)
| ({ reconnected: false; attachmentPending: true } & Successor)
>;
source(input: { workspaceId: string; terminalId: string }): Promise<{
provider: string;
ready: boolean;
revision: string;
account: Account | null;
} | null>;
resume(
input: Input & { account: Account },
): Promise<{ resumed: false } | ({ resumed: true } & Successor)>;
}
export async function continueNativeBackground(
input: Input,
io: ContinueNativeIO,
): Promise<Successor | null> {
const live = await io.reconnect(input);
if (live.reconnected || "attachmentPending" in live)
return { terminalId: live.terminalId, label: live.label };
const saved = await io.source(input);
if (
!saved?.ready ||
saved.provider !== "claude" ||
saved.revision !== input.expectedRevision ||
!saved.account
)
return null;
const result = await io.resume({
...input,
account: {
selection: saved.account.selection,
identity: saved.account.identity,
},
});
return result.resumed
? { terminalId: result.terminalId, label: result.label }
: null;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
import { expect, test } from "bun:test";
import { resumeWithBackgroundReconnect } from "./resume-with-background-reconnect";

function fixture() {
let resumes = 0;
let attaches = 0;
const input = { workspaceId: "workspace", terminalId: "original" };
const resume = async () => {
resumes++;
return { resumed: false as const };
};
const recovery = {
capabilities: async () => ({ version: 1, claudeLiveAttach: true }),
source: async () => ({ provider: "claude", revision: "a".repeat(64) }),
reconnect: async (_input: typeof input & { expectedRevision: string }) => {
attaches++;
return {
reconnected: true as const,
terminalId: "existing-worker-view",
label: "Claude",
};
},
};
return { input, resume, recovery, counts: () => ({ resumes, attaches }) };
}
test("Continue focuses the confirmed existing worker and never launches a resume", async () => {
const f = fixture();
expect(
await resumeWithBackgroundReconnect(
f.input,
"claude",
f.recovery,
f.resume,
),
).toEqual({
resumed: true,
terminalId: "existing-worker-view",
label: "Claude",
});
expect(f.counts()).toEqual({ resumes: 0, attaches: 1 });
});
test("older hosts fall back only on a missing additive capability", async () => {
const f = fixture();
f.recovery.capabilities = async () => {
throw { data: { code: "NOT_FOUND" } };
};
expect(
await resumeWithBackgroundReconnect(
f.input,
"claude",
f.recovery,
f.resume,
),
).toEqual({ resumed: false });
expect(f.counts()).toEqual({ resumes: 1, attaches: 0 });
});
test("transport, permission and malformed capability failures never launch another worker", async () => {
for (const error of [
new Error("offline"),
{ data: { code: "UNAUTHORIZED" } },
{ code: "NOT_FOUND" },
]) {
const f = fixture();
f.recovery.capabilities = async () => {
throw error;
};
await expect(
resumeWithBackgroundReconnect(f.input, "claude", f.recovery, f.resume),
).rejects.toBe(error);
expect(f.counts().resumes).toBe(0);
}
});
test("verification failure after supported capability never falls through", async () => {
const f = fixture();
f.recovery.reconnect = async () => {
throw new Error("worker changed");
};
await expect(
resumeWithBackgroundReconnect(f.input, "claude", f.recovery, f.resume),
).rejects.toThrow("worker changed");
expect(f.counts().resumes).toBe(0);
});
test("an explicit no-background result preserves ordinary resume", async () => {
const f = fixture();
const recovery = {
...f.recovery,
reconnect: async () => ({ reconnected: false as const }),
};
expect(
await resumeWithBackgroundReconnect(f.input, "claude", recovery, f.resume),
).toEqual({ resumed: false });
expect(f.counts().resumes).toBe(1);
});
test("an unconfirmed view is opened but never presented as confirmed identity", async () => {
const f = fixture();
const recovery = {
...f.recovery,
reconnect: async () => ({
reconnected: false as const,
attachmentPending: true as const,
terminalId: "pending-view",
label: "Claude",
}),
};
expect(
await resumeWithBackgroundReconnect(f.input, "claude", recovery, f.resume),
).toMatchObject({ resumed: true, terminalId: "pending-view" });
expect(f.counts().resumes).toBe(0);
});
test("Codex does not receive Claude capability or attachment calls", async () => {
const f = fixture();
f.recovery.capabilities = async () => {
throw new Error("should not run");
};
await resumeWithBackgroundReconnect(f.input, "codex", f.recovery, f.resume);
expect(f.counts()).toEqual({ resumes: 1, attaches: 0 });
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
interface ResumeInput {
workspaceId: string;
terminalId: string;
}
type ResumeResult =
| { resumed: false }
| { resumed: true; terminalId: string; label: string };
interface BackgroundRecovery {
capabilities(): Promise<{ version: number; claudeLiveAttach: boolean }>;
source(
input: ResumeInput,
): Promise<{ provider: string; revision: string } | null>;
reconnect(input: ResumeInput & { expectedRevision: string }): Promise<
| { reconnected: false }
| { reconnected: true; terminalId: string; label: string }
| {
reconnected: false;
attachmentPending: true;
terminalId: string;
label: string;
}
>;
}
function missingProcedure(error: unknown): boolean {
if (!error || typeof error !== "object" || !("data" in error)) return false;
const data = error.data;
return (
!!data &&
typeof data === "object" &&
"code" in data &&
data.code === "NOT_FOUND"
);
}
/** Network/verification failures never fall through to a second worker launch. */
export async function resumeWithBackgroundReconnect(
input: ResumeInput,
provider: string,
recovery: BackgroundRecovery,
resume: (input: ResumeInput) => Promise<ResumeResult>,
): Promise<ResumeResult> {
if (provider !== "claude") return resume(input);
let capability: Awaited<ReturnType<BackgroundRecovery["capabilities"]>>;
try {
capability = await recovery.capabilities();
} catch (error) {
if (missingProcedure(error)) return resume(input);
throw error;
}
if (capability.version !== 1 || !capability.claudeLiveAttach)
return resume(input);
const source = await recovery.source(input);
if (!source || source.provider !== "claude") return resume(input);
const result = await recovery.reconnect({
...input,
expectedRevision: source.revision,
});
if (result.reconnected || "attachmentPending" in result)
return {
resumed: true,
terminalId: result.terminalId,
label: result.label,
};
return resume(input);
}
Loading
Loading