- Relocated compaction, branch-summarization, pruning, and utils from coding-agent to packages/agent/src/compaction. - Moved OpenAI remote compaction helpers from packages/ai to the new compaction module. - Added handoff.ts with extractHandoffDocument, createHandoffContext, and renderHandoffPrompt helpers. - Exposed new entries.ts with standalone SessionEntry types so coding-agent no longer owns them.
32 lines
1.3 KiB
TypeScript
32 lines
1.3 KiB
TypeScript
/**
|
|
* Compaction error types.
|
|
*
|
|
* `CompactionCancelledError` is the canonical signal raised when a compaction
|
|
* is explicitly aborted — operator Esc, extension hook returning `cancel`,
|
|
* programmatic `session.abortCompaction()` call, or any other deliberate
|
|
* abort source. Downstream callers (e.g. `executeCompaction`) discriminate
|
|
* cancellation from other failures via `instanceof CompactionCancelledError`
|
|
* rather than introspecting error messages or `name` fields — the typed
|
|
* sentinel makes classification source-agnostic and refactor-stable.
|
|
*/
|
|
|
|
export class CompactionCancelledError extends Error {
|
|
readonly name = "CompactionCancelledError" as const;
|
|
|
|
constructor(message = "Compaction cancelled") {
|
|
super(message);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Outcome of a compaction attempt, surfaced by `CommandController.executeCompaction`
|
|
* so callers (e.g. the plan-mode approval flow) can distinguish a deliberate abort
|
|
* from an unrelated failure.
|
|
*
|
|
* "ok" — compaction completed; transcript was summarized.
|
|
* "cancelled" — `CompactionCancelledError` was raised. Operator Esc, extension
|
|
* hook, programmatic abort — all source-agnostic.
|
|
* "failed" — any other rejection from `session.compact()`.
|
|
*/
|
|
export type CompactionOutcome = "ok" | "cancelled" | "failed";
|