@basou/core 0.28.0 → 0.30.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -2,6 +2,13 @@ import { z } from 'zod';
2
2
  import { SimpleGit } from 'simple-git';
3
3
  import { ChildProcess } from 'node:child_process';
4
4
 
5
+ /**
6
+ * Predicate deciding whether a candidate executable is reachable on PATH.
7
+ * Exposed as a parameter on the per-tool `resolve*Command` helpers so tests can
8
+ * substitute a deterministic mock; production callers rely on {@link isOnPath}.
9
+ */
10
+ type CommandLookup = (command: string) => Promise<boolean>;
11
+
5
12
  /**
6
13
  * Static metadata identifying the claude-code adapter as the session source.
7
14
  * Consumed by the CLI orchestration when populating `session.yaml.source`
@@ -13,13 +20,6 @@ declare const claudeCodeAdapterMetadata: {
13
20
  readonly kind: "claude-code-adapter";
14
21
  readonly version: "0.1.0";
15
22
  };
16
- /**
17
- * Lookup predicate used by {@link resolveClaudeCodeCommand} to decide
18
- * whether a candidate executable is reachable on PATH. Exposed as a
19
- * parameter so tests can substitute a deterministic mock; production
20
- * callers should omit it and rely on the default `which`-based lookup.
21
- */
22
- type CommandLookup = (command: string) => Promise<boolean>;
23
23
  /**
24
24
  * Resolve the Claude Code CLI executable name. Tries `claude-code` first
25
25
  * and falls back to `claude`; the first candidate found on PATH wins.
@@ -45,6 +45,67 @@ declare function resolveClaudeCodeCommand(lookup?: CommandLookup): Promise<{
45
45
  */
46
46
  declare function summarizeAdapterOutput(_stream: "stdout" | "stderr", _raw: string): string;
47
47
 
48
+ /**
49
+ * Pure transforms for registering / removing basou's Stop hook inside a parsed
50
+ * Claude Code settings.json object. No disk or environment access: the CLI reads
51
+ * and writes the file, parses the JSON, and passes the object here so the
52
+ * merge/removal logic stays deterministic and unit-testable.
53
+ *
54
+ * settings.json holds many unrelated keys (permissions, model, other hooks);
55
+ * these functions clone the input and touch ONLY the `hooks.Stop` entry that
56
+ * basou owns, preserving everything else byte-for-byte through the round-trip.
57
+ */
58
+ /** Seconds before Claude Code kills the hook process. Matches the documented orient (SessionStart) hook. */
59
+ declare const STOP_HOOK_TIMEOUT_SECONDS = 20;
60
+ declare function isBasouStopHookCommand(command: string): boolean;
61
+ type BuildStopHookCommandOptions = {
62
+ /** Absolute path to the CLI entry to invoke (the running dist/index.js). */
63
+ cliEntry: string;
64
+ /** Register the blocking (opt-in enforcement) form. */
65
+ block?: boolean;
66
+ /** Enable the opt-in review gate (adds `--require-review`). */
67
+ requireReview?: boolean;
68
+ /** Override the file-edit threshold passed to `hook stop`. */
69
+ minEdits?: number;
70
+ };
71
+ /**
72
+ * Build the shell command basou registers as a Stop hook. Uses the node path
73
+ * (not the `basou` alias, which is often absent from a non-interactive hook's
74
+ * PATH) and a `2>/dev/null || true` wrapper so a stale/incorrect dist path or
75
+ * any crash fails open — no per-turn error noise. The wrapper is safe for the
76
+ * blocking form because that emits `decision:"block"` on stdout with exit 0;
77
+ * `|| true` would defeat an exit-2 block but leaves the JSON form intact.
78
+ *
79
+ * The entry path is shell-quoted so a home/project directory containing spaces
80
+ * or shell metacharacters still invokes correctly (an unquoted path with a
81
+ * space would split into the wrong argv and the hook would silently no-op).
82
+ */
83
+ declare function buildStopHookCommand(options: BuildStopHookCommandOptions): string;
84
+ type ClaudeSettings = Record<string, unknown>;
85
+ type StopHookUpsert = {
86
+ settings: ClaudeSettings;
87
+ /** `installed` = a new entry was appended; `updated` = an existing basou entry was rewritten; `unchanged` = already canonical. */
88
+ action: "installed" | "updated" | "unchanged";
89
+ };
90
+ type StopHookRemoval = {
91
+ settings: ClaudeSettings;
92
+ action: "removed" | "absent";
93
+ };
94
+ /**
95
+ * Register (or upgrade in place) basou's Stop hook. Idempotent: an existing
96
+ * basou Stop hook is rewritten to the canonical command + timeout; a foreign
97
+ * Stop hook or any other settings key is left untouched.
98
+ */
99
+ declare function upsertStopHook(settings: unknown, command: string): StopHookUpsert;
100
+ /**
101
+ * Remove every basou-owned Stop hook. A group emptied by the removal is dropped;
102
+ * a now-empty `hooks.Stop` / `hooks` container is deleted so the file does not
103
+ * accumulate empty scaffolding. Foreign hooks and other keys are preserved.
104
+ */
105
+ declare function removeStopHook(settings: unknown): StopHookRemoval;
106
+ /** Return the installed basou Stop hook command, or null if none is registered. */
107
+ declare function findBasouStopHookCommand(settings: unknown): string | null;
108
+
48
109
  /**
49
110
  * Schema for `.basou/manifest.yaml`. The minimal manifest carries
50
111
  * schema_version, basou_version, workspace metadata, project info, enabled
@@ -160,6 +221,7 @@ declare const SessionInnerImportSchema: z.ZodObject<{
160
221
  "claude-code-adapter": "claude-code-adapter";
161
222
  import: "import";
162
223
  "claude-code-import": "claude-code-import";
224
+ "codex-adapter": "codex-adapter";
163
225
  "codex-import": "codex-import";
164
226
  human: "human";
165
227
  terminal: "terminal";
@@ -225,6 +287,7 @@ declare const SessionImportPayloadSchema: z.ZodObject<{
225
287
  "claude-code-adapter": "claude-code-adapter";
226
288
  import: "import";
227
289
  "claude-code-import": "claude-code-import";
290
+ "codex-adapter": "codex-adapter";
228
291
  "codex-import": "codex-import";
229
292
  human: "human";
230
293
  terminal: "terminal";
@@ -507,6 +570,39 @@ declare const SessionImportPayloadSchema: z.ZodObject<{
507
570
  note: "note";
508
571
  next_step: "next_step";
509
572
  }>>;
573
+ }, z.core.$strip>, z.ZodObject<{
574
+ schema_version: z.ZodLiteral<"0.1.0">;
575
+ id: z.ZodString & z.ZodType<`evt_${string}`, string, z.core.$ZodTypeInternals<`evt_${string}`, string>>;
576
+ session_id: z.ZodString & z.ZodType<`ses_${string}`, string, z.core.$ZodTypeInternals<`ses_${string}`, string>>;
577
+ occurred_at: z.ZodString;
578
+ source: z.ZodString;
579
+ prev_hash: z.ZodOptional<z.ZodString>;
580
+ type: z.ZodLiteral<"review_recorded">;
581
+ reviewer: z.ZodString;
582
+ target: z.ZodString;
583
+ verdict: z.ZodOptional<z.ZodEnum<{
584
+ pass: "pass";
585
+ "needs-attention": "needs-attention";
586
+ fail: "fail";
587
+ }>>;
588
+ findings: z.ZodOptional<z.ZodArray<z.ZodObject<{
589
+ title: z.ZodString;
590
+ severity: z.ZodOptional<z.ZodEnum<{
591
+ low: "low";
592
+ medium: "medium";
593
+ high: "high";
594
+ }>>;
595
+ location: z.ZodOptional<z.ZodString>;
596
+ summary: z.ZodOptional<z.ZodString>;
597
+ }, z.core.$strip>>>;
598
+ blocked: z.ZodOptional<z.ZodArray<z.ZodObject<{
599
+ title: z.ZodString;
600
+ reason: z.ZodEnum<{
601
+ "spec-deviation": "spec-deviation";
602
+ "design-reversal": "design-reversal";
603
+ }>;
604
+ why: z.ZodOptional<z.ZodString>;
605
+ }, z.core.$strip>>>;
510
606
  }, z.core.$strip>, z.ZodObject<{
511
607
  schema_version: z.ZodLiteral<"0.1.0">;
512
608
  id: z.ZodString & z.ZodType<`evt_${string}`, string, z.core.$ZodTypeInternals<`evt_${string}`, string>>;
@@ -623,6 +719,31 @@ type StopHookEvaluationInput = {
623
719
  };
624
720
  /** Why the hook stayed silent (useful for tests and `--json` introspection). */
625
721
  type StopHookSilentReason = "stop_hook_active" | "not_substantive" | "already_captured";
722
+ /**
723
+ * Why the review gate stayed silent. The gate fires only when a SHIP act, a
724
+ * substantive-code edit, and the ABSENCE of a review record all hold; each
725
+ * reason names the first of those three that did not.
726
+ * - `stop_hook_active`: loop guard — a continuation turn never fires.
727
+ * - `no_ship_act`: nothing was shipped this turn (review is a pre-ship act, so
728
+ * a turn that did not push / open / merge owes no review).
729
+ * - `not_substantive_code`: shipped, but fewer than `minEdits` file edits.
730
+ * - `already_reviewed`: a `basou review record` ran this session.
731
+ */
732
+ type ReviewGateSilentReason = "stop_hook_active" | "no_ship_act" | "not_substantive_code" | "already_reviewed";
733
+ /**
734
+ * The review gate's verdict, computed INDEPENDENTLY of the capture gate in the
735
+ * same transcript pass: a session can have captured its decisions yet still owe
736
+ * a review (it shipped code without recording one), and vice versa. Returned
737
+ * alongside the capture verdict; no caller renders it yet — a follow-on slice
738
+ * will have the CLI compose it with the capture signal into the nudge / block.
739
+ */
740
+ type ReviewGateResult = {
741
+ fires: false;
742
+ reason: ReviewGateSilentReason;
743
+ } | {
744
+ fires: true;
745
+ additionalContext: string;
746
+ };
626
747
  type StopHookCounts = {
627
748
  /** Bash tool uses (informational — does NOT drive the trigger). */
628
749
  commandCount: number;
@@ -634,9 +755,11 @@ type StopHookCounts = {
634
755
  type StopHookEvaluation = ({
635
756
  kind: "silent";
636
757
  reason: StopHookSilentReason;
758
+ review: ReviewGateResult;
637
759
  } & StopHookCounts) | ({
638
760
  kind: "nudge";
639
761
  additionalContext: string;
762
+ review: ReviewGateResult;
640
763
  } & StopHookCounts);
641
764
  /**
642
765
  * Decide whether a finished turn warrants a non-blocking capture nudge.
@@ -658,9 +781,42 @@ type StopHookEvaluation = ({
658
781
  * - no capture verb (`basou decision capture` / `decision record` / `note`)
659
782
  * was run this session, so a session that already recorded its intent is
660
783
  * left alone.
784
+ *
785
+ * It ALSO computes a second, independent verdict: the {@link ReviewGateResult}
786
+ * (whether a substantive-code session shipped — push / PR / merge — without
787
+ * recording a review). The two are computed in one transcript pass and returned
788
+ * together; the CLI composes them. The review verdict is purely additive here —
789
+ * the capture `kind` / `additionalContext` / `reason` are byte-identical to
790
+ * before, so consumers that read only the capture signal are unaffected.
661
791
  */
662
792
  declare function evaluateStopHook(input: StopHookEvaluationInput): StopHookEvaluation;
663
793
 
794
+ /** Alias kept for API symmetry with the claude-code adapter's `CommandLookup`. */
795
+ type CodexCommandLookup = CommandLookup;
796
+ /**
797
+ * Static metadata identifying a live `basou run codex` session source. The twin
798
+ * of {@link import("../claude-code/claude-code-adapter.js").claudeCodeAdapterMetadata};
799
+ * `kind` is part of the wire format defined by the session schema
800
+ * (`SessionSourceKindSchema`), so do not change it without a coordinated schema
801
+ * migration. Distinct from `codex-import` (the after-the-fact rollout importer).
802
+ */
803
+ declare const codexAdapterMetadata: {
804
+ readonly kind: "codex-adapter";
805
+ readonly version: "0.1.0";
806
+ };
807
+ /**
808
+ * Resolve the Codex CLI executable name. Only `codex` is a candidate (unlike
809
+ * claude-code's `claude-code`/`claude` pair, Codex ships a single binary name).
810
+ *
811
+ * Throws a fixed-message Error when it is not reachable, so callers can present
812
+ * a single user-facing prompt to install the CLI.
813
+ *
814
+ * @throws Error("Codex CLI not found in PATH. Install codex first.")
815
+ */
816
+ declare function resolveCodexCommand(lookup?: CommandLookup): Promise<{
817
+ command: string;
818
+ }>;
819
+
664
820
  /**
665
821
  * The `source` string stamped on every event derived from an OpenAI Codex
666
822
  * native rollout log, and the matching session `source.kind`.
@@ -1133,6 +1289,58 @@ declare const NoteAddedEventSchema: z.ZodObject<{
1133
1289
  next_step: "next_step";
1134
1290
  }>>;
1135
1291
  }, z.core.$strip>;
1292
+ declare const ReviewFindingSchema: z.ZodObject<{
1293
+ title: z.ZodString;
1294
+ severity: z.ZodOptional<z.ZodEnum<{
1295
+ low: "low";
1296
+ medium: "medium";
1297
+ high: "high";
1298
+ }>>;
1299
+ location: z.ZodOptional<z.ZodString>;
1300
+ summary: z.ZodOptional<z.ZodString>;
1301
+ }, z.core.$strip>;
1302
+ declare const ReviewBlockedSchema: z.ZodObject<{
1303
+ title: z.ZodString;
1304
+ reason: z.ZodEnum<{
1305
+ "spec-deviation": "spec-deviation";
1306
+ "design-reversal": "design-reversal";
1307
+ }>;
1308
+ why: z.ZodOptional<z.ZodString>;
1309
+ }, z.core.$strip>;
1310
+ declare const ReviewRecordedEventSchema: z.ZodObject<{
1311
+ schema_version: z.ZodLiteral<"0.1.0">;
1312
+ id: z.ZodString & z.ZodType<`evt_${string}`, string, z.core.$ZodTypeInternals<`evt_${string}`, string>>;
1313
+ session_id: z.ZodString & z.ZodType<`ses_${string}`, string, z.core.$ZodTypeInternals<`ses_${string}`, string>>;
1314
+ occurred_at: z.ZodString;
1315
+ source: z.ZodString;
1316
+ prev_hash: z.ZodOptional<z.ZodString>;
1317
+ type: z.ZodLiteral<"review_recorded">;
1318
+ reviewer: z.ZodString;
1319
+ target: z.ZodString;
1320
+ verdict: z.ZodOptional<z.ZodEnum<{
1321
+ pass: "pass";
1322
+ "needs-attention": "needs-attention";
1323
+ fail: "fail";
1324
+ }>>;
1325
+ findings: z.ZodOptional<z.ZodArray<z.ZodObject<{
1326
+ title: z.ZodString;
1327
+ severity: z.ZodOptional<z.ZodEnum<{
1328
+ low: "low";
1329
+ medium: "medium";
1330
+ high: "high";
1331
+ }>>;
1332
+ location: z.ZodOptional<z.ZodString>;
1333
+ summary: z.ZodOptional<z.ZodString>;
1334
+ }, z.core.$strip>>>;
1335
+ blocked: z.ZodOptional<z.ZodArray<z.ZodObject<{
1336
+ title: z.ZodString;
1337
+ reason: z.ZodEnum<{
1338
+ "spec-deviation": "spec-deviation";
1339
+ "design-reversal": "design-reversal";
1340
+ }>;
1341
+ why: z.ZodOptional<z.ZodString>;
1342
+ }, z.core.$strip>>>;
1343
+ }, z.core.$strip>;
1136
1344
  declare const AdapterOutputEventSchema: z.ZodObject<{
1137
1345
  schema_version: z.ZodLiteral<"0.1.0">;
1138
1346
  id: z.ZodString & z.ZodType<`evt_${string}`, string, z.core.$ZodTypeInternals<`evt_${string}`, string>>;
@@ -1388,6 +1596,39 @@ declare const EventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1388
1596
  note: "note";
1389
1597
  next_step: "next_step";
1390
1598
  }>>;
1599
+ }, z.core.$strip>, z.ZodObject<{
1600
+ schema_version: z.ZodLiteral<"0.1.0">;
1601
+ id: z.ZodString & z.ZodType<`evt_${string}`, string, z.core.$ZodTypeInternals<`evt_${string}`, string>>;
1602
+ session_id: z.ZodString & z.ZodType<`ses_${string}`, string, z.core.$ZodTypeInternals<`ses_${string}`, string>>;
1603
+ occurred_at: z.ZodString;
1604
+ source: z.ZodString;
1605
+ prev_hash: z.ZodOptional<z.ZodString>;
1606
+ type: z.ZodLiteral<"review_recorded">;
1607
+ reviewer: z.ZodString;
1608
+ target: z.ZodString;
1609
+ verdict: z.ZodOptional<z.ZodEnum<{
1610
+ pass: "pass";
1611
+ "needs-attention": "needs-attention";
1612
+ fail: "fail";
1613
+ }>>;
1614
+ findings: z.ZodOptional<z.ZodArray<z.ZodObject<{
1615
+ title: z.ZodString;
1616
+ severity: z.ZodOptional<z.ZodEnum<{
1617
+ low: "low";
1618
+ medium: "medium";
1619
+ high: "high";
1620
+ }>>;
1621
+ location: z.ZodOptional<z.ZodString>;
1622
+ summary: z.ZodOptional<z.ZodString>;
1623
+ }, z.core.$strip>>>;
1624
+ blocked: z.ZodOptional<z.ZodArray<z.ZodObject<{
1625
+ title: z.ZodString;
1626
+ reason: z.ZodEnum<{
1627
+ "spec-deviation": "spec-deviation";
1628
+ "design-reversal": "design-reversal";
1629
+ }>;
1630
+ why: z.ZodOptional<z.ZodString>;
1631
+ }, z.core.$strip>>>;
1391
1632
  }, z.core.$strip>, z.ZodObject<{
1392
1633
  schema_version: z.ZodLiteral<"0.1.0">;
1393
1634
  id: z.ZodString & z.ZodType<`evt_${string}`, string, z.core.$ZodTypeInternals<`evt_${string}`, string>>;
@@ -1442,6 +1683,12 @@ type TaskDeletedEvent = z.infer<typeof TaskDeletedEventSchema>;
1442
1683
  type TaskArchivedEvent = z.infer<typeof TaskArchivedEventSchema>;
1443
1684
  /** Narrowed runtime type for the `note_added` event variant. */
1444
1685
  type NoteAddedEvent = z.infer<typeof NoteAddedEventSchema>;
1686
+ /** Narrowed runtime type for the `review_recorded` event variant. */
1687
+ type ReviewRecordedEvent = z.infer<typeof ReviewRecordedEventSchema>;
1688
+ /** One finding surfaced by a `review_recorded` event. */
1689
+ type ReviewFinding = z.infer<typeof ReviewFindingSchema>;
1690
+ /** One blocked finding (spec-deviation / design-reversal) of a `review_recorded` event. */
1691
+ type ReviewBlocked = z.infer<typeof ReviewBlockedSchema>;
1445
1692
  /** Narrowed runtime type for the `adapter_output` event variant (.strict()). */
1446
1693
  type AdapterOutputEvent = z.infer<typeof AdapterOutputEventSchema>;
1447
1694
 
@@ -1520,6 +1767,7 @@ type SessionStatus = z.infer<typeof SessionStatusSchema>;
1520
1767
  * - `claude-code-adapter` — a live `basou run claude-code` process wrap.
1521
1768
  * - `claude-code-import` — derived after the fact from a Claude Code native
1522
1769
  * transcript (`~/.claude/projects/*.jsonl`) by `basou import claude-code`.
1770
+ * - `codex-adapter` — a live `basou run codex` process wrap.
1523
1771
  * - `codex-import` — derived after the fact from an OpenAI Codex native
1524
1772
  * rollout log (date-partitioned `~/.codex/sessions`) by `basou import codex`.
1525
1773
  * - `import` — a round-trip of a Basou-format export (`basou session import`).
@@ -1529,6 +1777,7 @@ declare const SessionSourceKindSchema: z.ZodEnum<{
1529
1777
  "claude-code-adapter": "claude-code-adapter";
1530
1778
  import: "import";
1531
1779
  "claude-code-import": "claude-code-import";
1780
+ "codex-adapter": "codex-adapter";
1532
1781
  "codex-import": "codex-import";
1533
1782
  human: "human";
1534
1783
  terminal: "terminal";
@@ -1613,6 +1862,7 @@ declare const SessionSchema: z.ZodObject<{
1613
1862
  "claude-code-adapter": "claude-code-adapter";
1614
1863
  import: "import";
1615
1864
  "claude-code-import": "claude-code-import";
1865
+ "codex-adapter": "codex-adapter";
1616
1866
  "codex-import": "codex-import";
1617
1867
  human: "human";
1618
1868
  terminal: "terminal";
@@ -5266,6 +5516,63 @@ type ReviewGapsInput = {
5266
5516
  */
5267
5517
  declare function findReviewGaps(input: ReviewGapsInput): Promise<ReviewGapsSummary>;
5268
5518
 
5519
+ /**
5520
+ * The deterministic writer for `basou review record` — the twin of
5521
+ * `basou decision capture`. The in-loop agent runs a review (with a
5522
+ * vendor-specific command), then pipes a JSON object describing what ran;
5523
+ * basou parses + validates it here and writes a `review_recorded` event,
5524
+ * with NO runtime LLM. Keeping parse + build in core (rather than the CLI,
5525
+ * where `decision capture` happens to live) makes the writer unit-testable
5526
+ * on its own and reusable by the read-only `review-gaps` surfacer.
5527
+ *
5528
+ * This is a self-report: basou records that a review happened; it does not
5529
+ * verify the review actually executed. Cryptographic enforcement is the
5530
+ * bridle's (mcp-bridle) concern — core stays read-only/advisory.
5531
+ */
5532
+ /** A finding in the review record input (the on-wire `findings[]` shape). */
5533
+ type ReviewRecordFindingInput = ReviewFinding;
5534
+ /** A blocked finding in the review record input (the on-wire `blocked[]` shape). */
5535
+ type ReviewRecordBlockedInput = ReviewBlocked;
5536
+ /** A parsed + validated review record: required minimum + optional rich fields. */
5537
+ type ReviewRecordInput = {
5538
+ /** What/who reviewed (e.g. "codex", a model name, "self"). Required. */
5539
+ reviewer: string;
5540
+ /** What was reviewed (e.g. "working-tree", a git ref, "PR #145"). Required. */
5541
+ target: string;
5542
+ /** Overall outcome. Optional. */
5543
+ verdict?: "pass" | "needs-attention" | "fail";
5544
+ /** Findings surfaced by the review. Optional. */
5545
+ findings?: ReviewRecordFindingInput[];
5546
+ /**
5547
+ * Findings blocked as spec-deviation / design-reversal. Optional, but an
5548
+ * explicit empty array is encouraged — it records "I blocked nothing" as the
5549
+ * adversarial-review protocol requires.
5550
+ */
5551
+ blocked?: ReviewRecordBlockedInput[];
5552
+ };
5553
+ /** Actionable hint shown when nothing is piped in. */
5554
+ declare const REVIEW_RECORD_NO_INPUT_HINT = "No input: pipe a JSON object describing the review to stdin or pass --file <path>.";
5555
+ /**
5556
+ * Parse + validate the review record input — a SINGLE JSON object (one
5557
+ * invocation = one review), unlike `decision capture`'s array. Errors name the
5558
+ * offending field (e.g. `findings[2].severity must be ...`) so the in-loop
5559
+ * agent can self-correct without guessing. Pure: no disk/environment access.
5560
+ */
5561
+ declare function parseReviewRecordInput(raw: string): ReviewRecordInput;
5562
+ /**
5563
+ * Build the `review_recorded` event from a validated input. Mirrors
5564
+ * `buildDecisionEvent`: optional fields are spread only when present so an
5565
+ * event with just the required minimum round-trips byte-identically.
5566
+ */
5567
+ declare function buildReviewRecordedEvent(input: {
5568
+ eventId: PrefixedId<"evt">;
5569
+ sessionId: PrefixedId<"ses">;
5570
+ occurredAt: string;
5571
+ review: ReviewRecordInput;
5572
+ }): Event;
5573
+ /** Ad-hoc session label for a recorded review: `Ad-hoc review: <reviewer> -> <target>`. */
5574
+ declare function buildReviewRecordLabel(review: ReviewRecordInput): string;
5575
+
5269
5576
  /**
5270
5577
  * Internal abstraction over child-process execution.
5271
5578
  *
@@ -5509,6 +5816,10 @@ declare const GENERATED_END = "<!-- BASOU:GENERATED:END -->";
5509
5816
  declare const PROTOCOL_START = "<!-- BASOU:PROTOCOLS:START -->";
5510
5817
  /** Marker line that ends a managed protocol block. */
5511
5818
  declare const PROTOCOL_END = "<!-- BASOU:PROTOCOLS:END -->";
5819
+ /** Marker line that begins a managed orientation block in a vendor context face (e.g. ~/.codex/AGENTS.md). */
5820
+ declare const ORIENTATION_START = "<!-- BASOU:ORIENTATION:START -->";
5821
+ /** Marker line that ends a managed orientation block. */
5822
+ declare const ORIENTATION_END = "<!-- BASOU:ORIENTATION:END -->";
5512
5823
  /** A start/end marker pair. Both lines are matched whole-line, exact. */
5513
5824
  type Markers = {
5514
5825
  start: string;
@@ -5827,4 +6138,4 @@ declare function overwriteYamlFile(filePath: string, value: unknown): Promise<vo
5827
6138
  */
5828
6139
  declare const BASOU_CORE_VERSION = "0.1.0";
5829
6140
 
5830
- export { ACTIVE_GAP_CAP_MS, AGENT_INFRA_DIRS, type ActiveTimeBasis, type AdapterOutputEvent, type AdoptCandidate, type AdoptCandidateKind, type AppendBasouGitignoreOptions, type AppendBasouGitignoreResult, type AppendEventToExistingInput, type AppendEventToExistingResult, type Approval, type ApprovalApprovedEvent, type ApprovalExpiredEvent, ApprovalIdSchema, type ApprovalLocation, type ApprovalRejectedEvent, type ApprovalRequestedEvent, ApprovalSchema, type ApprovalStatus, ApprovalStatusSchema, type ArchivePlan, type ArchiveTaskInput, type ArchiveTaskResult, type AttachTaskInput, type AttachUpdateTaskStatusInput, type AttachableStatus, BASOU_CORE_VERSION, type BasouPaths, type BulkChainResult, CLAUDE_IMPORT_SOURCE, CODEX_IMPORT_SOURCE, type CaptureMode, type ChainBreakReason, type ChainTailState, type ChainVerdict, type ChainVerdictStatus, type ChainedEvents, ChildProcessRunner, type CitedReview, type ClaudeTranscriptRecord, type ClaudeTranscriptToPayloadOptions, type CodexRolloutRecord, type CodexRolloutToPayloadOptions, type CommandExecutedEvent, type CommandLookup, type CreateAdHocSessionInput, type CreateAdHocSessionResult, type CreateAdHocTaskInput, type CreateManifestInput, type CreateTaskInput, type CreateTaskResult, DEFAULT_STOP_HOOK_MIN_EDITS, type DayWorkStats, DecisionIdSchema, type DecisionRecordedEvent, type DecisionsRendererInput, type DecisionsRendererResult, type DeleteTaskInput, type DeleteTaskResult, type DiffResult, type EditTaskInput, type EditTaskResult, type Event, EventIdSchema, EventSchema, EventSourceSchema, type ExistingViewLink, FailedToFinalizeError, type FederatedRoot, type FileChange, type FileChangeStatus, type FileChangedEvent, GENERATED_END, GENERATED_START, type GitSnapshot, type GitSnapshotEvent, type GitignorePlanSummary, type HandoffRendererInput, type HandoffRendererResult, ID_PREFIXES, type IdPrefix, type ImportSessionOptions, type ImportSessionResult, type InstructionFileFact, type InstructionSymlinkFact, type InstructionSymlinkState, IsoTimestampSchema, JSON_SCHEMA_VERSION, type JsonSchemaArtifact, type LoadFederatedOptions, type LoadSessionEntriesOptions, type LoadTaskEntriesOptions, type LoadedApproval, type LockHandle, type LockScope, type Manifest, ManifestSchema, type MarkerSection, type Markers, type MeasureAvailability, type NoteAddedEvent, type OrientationRendererInput, type OrientationRendererResult, type OrientationSummary, PROTOCOL_END, PROTOCOL_START, type PrefixedId, type PresetAction, type PresetCollision, type PresetMarkerConflict, type PresetMarkerKind, type PresetPlanSummary, type PresetRepo, type ProcessRunner, type PublishKind, type PublishTarget, type RechainOptions, type RechainResult, type ReconcileAllResult, type ReconcileAllTasksInput, type ReconcileAllTasksOptions, type ReconcileFailure, type ReconcileResult, type ReconcileTaskInput, type RefreshLinkageInput, type RefreshLinkageResult, type ReimportOptions, type ReimportResult, type RenamePlan, type ReplayOptions, type ReplayWarning, type RepoEntry, type RepoGitignoreFacts, type RepoGitignorePlan, type RepoInstructions, type RepoLanguage, type RepoPresetFacts, type RepoPresetPlan, type RepoSymlinkFacts, type RepoSymlinkPlan, type RepoVisibility, type RepoWiringFacts, type ReportApprovalItem, type ReportData, type ReportDecisionItem, type ReportRendererInput, type ReportRendererResult, type ReportSessionItem, type ReportTaskItem, type RetrofitAction, type RetrofitAgentsState, type RetrofitFacts, type RetrofitPlan, type RetrofitReason, type ReviewGapRepoSummary, type ReviewGapUnit, type ReviewGapVerdict, type ReviewGapsInput, type ReviewGapsSummary, type RiskLevel, RiskLevelSchema, type RosterAdoptionPlan, type RosterDriftSummary, type RunOptions, type RunResult, STUCK_THRESHOLD_MS, type SanitizePathOptions, type SanitizeRelatedFilesResult, SchemaVersionSchema, type Session, type SessionEndedEvent, type SessionEntry, SessionIdSchema, type SessionImportPayload, SessionImportPayloadSchema, type SessionInnerImportInput, SessionInnerImportSchema, type SessionIntegrity, SessionIntegritySchema, type SessionMetrics, SessionMetricsSchema, SessionSchema, type SessionSkipReason, type SessionSourceKind, SessionSourceKindSchema, type SessionStartedEvent, type SessionStatus, type SessionStatusChangedEvent, SessionStatusSchema, type SessionWorkStats, type SourceRootScope, type SourceRootsReconcile, type SourceWorkStats, type StatusCount, StatusSchema, type StatusSnapshot, type StopHookEvaluation, type StopHookEvaluationInput, type StopHookSilentReason, type SuspectReason, type SymlinkCollision, type SymlinkConflict, type SymlinkPlanSummary, type Task, type TaskArchivedEvent, type TaskCreatedEvent, type TaskDeletedEvent, type TaskDocument, TaskIdSchema, type TaskLinkageRefreshedEvent, type TaskReconciledEvent, TaskSchema, type TaskSkipReason, type TaskStatus, type TaskStatusChangedEvent, type TaskStatusCount, TaskStatusSchema, TaskWriteAfterEventError, type TaskWriteAfterEventPhase, type TokenTotals, type UpdateAdHocTaskStatusInput, type UpdateTaskStatusInput, type UpdateTaskStatusResult, type ViewCollision, type ViewConflict, type ViewLinkState, type ViewRepoFact, type ViewStrayUnknown, type WiringRisk, type WiringSummary, type WorkStatsInput, type WorkStatsResult, type WorkStatsTotals, WorkspaceIdSchema, type WorkspaceViewPlan, type WriteEventsBulkOptions, type WriteTaskFileMode, acquireLock, appendBasouGitignore, appendChainedEvent, appendChainedEventLocked, appendEvent, appendEventToExistingSession, archiveTask, assertBasouRootSafe, basouPaths, buildJsonSchemas, buildStatusSnapshot, chainEvents, chainRawJsonLines, classifyFilesBySourceRoot, classifyRetrofit, classifySuspect, claudeCodeAdapterMetadata, claudeTranscriptToImportPayload, codexRolloutToImportPayload, computeWorkStats, createAdHocSessionWithEvent, createManifest, createTaskWithEvent, deleteTask, editTask, ensureBasouDirectory, enumerateApprovals, enumerateArchivedTaskIds, enumerateSessionDirs, enumerateTaskIds, evaluateStopHook, finalizeSessionYaml, findErrorCode, findReviewGaps, formatDurationMs, genesisHash, getDiff, getSnapshot, importSessionFromJson, inspectChainTail, instructionMode, isGitNotFound, isImportDerivedSource, isLazyExpired, isRenderable, isValidPrefixedId, lineHash, linkYamlFile, loadApproval, loadFederatedSessionEntries, loadSessionEntries, loadTaskEntries, normalizeRepoKey, normalizeRepoPath, overwriteYamlFile, parseDuration, parseMarkers, pathBasename, planArchive, planGitignore, planRename, planRosterAdoption, planWorkspaceView, prefixedUlid, readAllEvents, readManifest, readMarkdownFile, readSessionYaml, readStatus, readTaskFile, readTaskFileWithArchiveFallback, readYamlFile, rechainSessionInPlace, reconcileAllTasks, reconcileSourceRoots, reconcileTask, refreshTaskLinkedSessions, reimportPreservingId, removeMarkerSection, renderDecisions, renderHandoff, renderOrientation, renderPresetBlock, renderReport, renderWithMarkers, replayEvents, resolveBasouRepositoryRoot, resolveClaudeCodeCommand, resolveRepositoryRoot, resolveSessionId, resolveTaskId, safeSimpleGit, sanitizePath, sanitizeRelatedFiles, sanitizeWorkingDirectory, serializeEventLine, serializeJsonSchema, sessionWorkStatsFromEvents, summarizeAdapterOutput, summarizeOrientation, summarizePresetPlan, summarizeRosterDrift, summarizeSymlinkPlan, summarizeWiring, tryRemoteUrl, ulid, unknownManifestKeys, updateTaskStatusWithEvent, verifyEventsChain, writeEventsBulk, writeManifest, writeMarkdownFile, writeStatus, writeTaskFile, writeYamlFile };
6141
+ export { ACTIVE_GAP_CAP_MS, AGENT_INFRA_DIRS, type ActiveTimeBasis, type AdapterOutputEvent, type AdoptCandidate, type AdoptCandidateKind, type AppendBasouGitignoreOptions, type AppendBasouGitignoreResult, type AppendEventToExistingInput, type AppendEventToExistingResult, type Approval, type ApprovalApprovedEvent, type ApprovalExpiredEvent, ApprovalIdSchema, type ApprovalLocation, type ApprovalRejectedEvent, type ApprovalRequestedEvent, ApprovalSchema, type ApprovalStatus, ApprovalStatusSchema, type ArchivePlan, type ArchiveTaskInput, type ArchiveTaskResult, type AttachTaskInput, type AttachUpdateTaskStatusInput, type AttachableStatus, BASOU_CORE_VERSION, type BasouPaths, type BuildStopHookCommandOptions, type BulkChainResult, CLAUDE_IMPORT_SOURCE, CODEX_IMPORT_SOURCE, type CaptureMode, type ChainBreakReason, type ChainTailState, type ChainVerdict, type ChainVerdictStatus, type ChainedEvents, ChildProcessRunner, type CitedReview, type ClaudeSettings, type ClaudeTranscriptRecord, type ClaudeTranscriptToPayloadOptions, type CodexCommandLookup, type CodexRolloutRecord, type CodexRolloutToPayloadOptions, type CommandExecutedEvent, type CommandLookup, type CreateAdHocSessionInput, type CreateAdHocSessionResult, type CreateAdHocTaskInput, type CreateManifestInput, type CreateTaskInput, type CreateTaskResult, DEFAULT_STOP_HOOK_MIN_EDITS, type DayWorkStats, DecisionIdSchema, type DecisionRecordedEvent, type DecisionsRendererInput, type DecisionsRendererResult, type DeleteTaskInput, type DeleteTaskResult, type DiffResult, type EditTaskInput, type EditTaskResult, type Event, EventIdSchema, EventSchema, EventSourceSchema, type ExistingViewLink, FailedToFinalizeError, type FederatedRoot, type FileChange, type FileChangeStatus, type FileChangedEvent, GENERATED_END, GENERATED_START, type GitSnapshot, type GitSnapshotEvent, type GitignorePlanSummary, type HandoffRendererInput, type HandoffRendererResult, ID_PREFIXES, type IdPrefix, type ImportSessionOptions, type ImportSessionResult, type InstructionFileFact, type InstructionSymlinkFact, type InstructionSymlinkState, IsoTimestampSchema, JSON_SCHEMA_VERSION, type JsonSchemaArtifact, type LoadFederatedOptions, type LoadSessionEntriesOptions, type LoadTaskEntriesOptions, type LoadedApproval, type LockHandle, type LockScope, type Manifest, ManifestSchema, type MarkerSection, type Markers, type MeasureAvailability, type NoteAddedEvent, ORIENTATION_END, ORIENTATION_START, type OrientationRendererInput, type OrientationRendererResult, type OrientationSummary, PROTOCOL_END, PROTOCOL_START, type PrefixedId, type PresetAction, type PresetCollision, type PresetMarkerConflict, type PresetMarkerKind, type PresetPlanSummary, type PresetRepo, type ProcessRunner, type PublishKind, type PublishTarget, REVIEW_RECORD_NO_INPUT_HINT, type RechainOptions, type RechainResult, type ReconcileAllResult, type ReconcileAllTasksInput, type ReconcileAllTasksOptions, type ReconcileFailure, type ReconcileResult, type ReconcileTaskInput, type RefreshLinkageInput, type RefreshLinkageResult, type ReimportOptions, type ReimportResult, type RenamePlan, type ReplayOptions, type ReplayWarning, type RepoEntry, type RepoGitignoreFacts, type RepoGitignorePlan, type RepoInstructions, type RepoLanguage, type RepoPresetFacts, type RepoPresetPlan, type RepoSymlinkFacts, type RepoSymlinkPlan, type RepoVisibility, type RepoWiringFacts, type ReportApprovalItem, type ReportData, type ReportDecisionItem, type ReportRendererInput, type ReportRendererResult, type ReportSessionItem, type ReportTaskItem, type RetrofitAction, type RetrofitAgentsState, type RetrofitFacts, type RetrofitPlan, type RetrofitReason, type ReviewBlocked, type ReviewFinding, type ReviewGapRepoSummary, type ReviewGapUnit, type ReviewGapVerdict, type ReviewGapsInput, type ReviewGapsSummary, type ReviewGateResult, type ReviewGateSilentReason, type ReviewRecordBlockedInput, type ReviewRecordFindingInput, type ReviewRecordInput, type ReviewRecordedEvent, type RiskLevel, RiskLevelSchema, type RosterAdoptionPlan, type RosterDriftSummary, type RunOptions, type RunResult, STOP_HOOK_TIMEOUT_SECONDS, STUCK_THRESHOLD_MS, type SanitizePathOptions, type SanitizeRelatedFilesResult, SchemaVersionSchema, type Session, type SessionEndedEvent, type SessionEntry, SessionIdSchema, type SessionImportPayload, SessionImportPayloadSchema, type SessionInnerImportInput, SessionInnerImportSchema, type SessionIntegrity, SessionIntegritySchema, type SessionMetrics, SessionMetricsSchema, SessionSchema, type SessionSkipReason, type SessionSourceKind, SessionSourceKindSchema, type SessionStartedEvent, type SessionStatus, type SessionStatusChangedEvent, SessionStatusSchema, type SessionWorkStats, type SourceRootScope, type SourceRootsReconcile, type SourceWorkStats, type StatusCount, StatusSchema, type StatusSnapshot, type StopHookEvaluation, type StopHookEvaluationInput, type StopHookRemoval, type StopHookSilentReason, type StopHookUpsert, type SuspectReason, type SymlinkCollision, type SymlinkConflict, type SymlinkPlanSummary, type Task, type TaskArchivedEvent, type TaskCreatedEvent, type TaskDeletedEvent, type TaskDocument, TaskIdSchema, type TaskLinkageRefreshedEvent, type TaskReconciledEvent, TaskSchema, type TaskSkipReason, type TaskStatus, type TaskStatusChangedEvent, type TaskStatusCount, TaskStatusSchema, TaskWriteAfterEventError, type TaskWriteAfterEventPhase, type TokenTotals, type UpdateAdHocTaskStatusInput, type UpdateTaskStatusInput, type UpdateTaskStatusResult, type ViewCollision, type ViewConflict, type ViewLinkState, type ViewRepoFact, type ViewStrayUnknown, type WiringRisk, type WiringSummary, type WorkStatsInput, type WorkStatsResult, type WorkStatsTotals, WorkspaceIdSchema, type WorkspaceViewPlan, type WriteEventsBulkOptions, type WriteTaskFileMode, acquireLock, appendBasouGitignore, appendChainedEvent, appendChainedEventLocked, appendEvent, appendEventToExistingSession, archiveTask, assertBasouRootSafe, basouPaths, buildJsonSchemas, buildReviewRecordLabel, buildReviewRecordedEvent, buildStatusSnapshot, buildStopHookCommand, chainEvents, chainRawJsonLines, classifyFilesBySourceRoot, classifyRetrofit, classifySuspect, claudeCodeAdapterMetadata, claudeTranscriptToImportPayload, codexAdapterMetadata, codexRolloutToImportPayload, computeWorkStats, createAdHocSessionWithEvent, createManifest, createTaskWithEvent, deleteTask, editTask, ensureBasouDirectory, enumerateApprovals, enumerateArchivedTaskIds, enumerateSessionDirs, enumerateTaskIds, evaluateStopHook, finalizeSessionYaml, findBasouStopHookCommand, findErrorCode, findReviewGaps, formatDurationMs, genesisHash, getDiff, getSnapshot, importSessionFromJson, inspectChainTail, instructionMode, isBasouStopHookCommand, isGitNotFound, isImportDerivedSource, isLazyExpired, isRenderable, isValidPrefixedId, lineHash, linkYamlFile, loadApproval, loadFederatedSessionEntries, loadSessionEntries, loadTaskEntries, normalizeRepoKey, normalizeRepoPath, overwriteYamlFile, parseDuration, parseMarkers, parseReviewRecordInput, pathBasename, planArchive, planGitignore, planRename, planRosterAdoption, planWorkspaceView, prefixedUlid, readAllEvents, readManifest, readMarkdownFile, readSessionYaml, readStatus, readTaskFile, readTaskFileWithArchiveFallback, readYamlFile, rechainSessionInPlace, reconcileAllTasks, reconcileSourceRoots, reconcileTask, refreshTaskLinkedSessions, reimportPreservingId, removeMarkerSection, removeStopHook, renderDecisions, renderHandoff, renderOrientation, renderPresetBlock, renderReport, renderWithMarkers, replayEvents, resolveBasouRepositoryRoot, resolveClaudeCodeCommand, resolveCodexCommand, resolveRepositoryRoot, resolveSessionId, resolveTaskId, safeSimpleGit, sanitizePath, sanitizeRelatedFiles, sanitizeWorkingDirectory, serializeEventLine, serializeJsonSchema, sessionWorkStatsFromEvents, summarizeAdapterOutput, summarizeOrientation, summarizePresetPlan, summarizeRosterDrift, summarizeSymlinkPlan, summarizeWiring, tryRemoteUrl, ulid, unknownManifestKeys, updateTaskStatusWithEvent, upsertStopHook, verifyEventsChain, writeEventsBulk, writeManifest, writeMarkdownFile, writeStatus, writeTaskFile, writeYamlFile };