@basou/core 0.9.0 → 0.11.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 +398 -130
- package/dist/index.js +1128 -667
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1411,12 +1411,14 @@ declare const SessionMetricsSchema: z.ZodObject<{
|
|
|
1411
1411
|
/** Inferred runtime type for {@link SessionMetricsSchema}. */
|
|
1412
1412
|
type SessionMetrics = z.infer<typeof SessionMetricsSchema>;
|
|
1413
1413
|
/**
|
|
1414
|
-
* Tamper-evidence head anchor for
|
|
1415
|
-
*
|
|
1416
|
-
*
|
|
1417
|
-
*
|
|
1418
|
-
*
|
|
1419
|
-
*
|
|
1414
|
+
* Tamper-evidence head anchor for a session whose `events.jsonl` is hash
|
|
1415
|
+
* chained: `head_hash` is the hex sha-256 of the last written event line
|
|
1416
|
+
* (excluding the trailing newline), `event_count` the number of chained lines.
|
|
1417
|
+
* Written by the import / in-place re-import writers and, for a live session
|
|
1418
|
+
* (`exec` / `run` / ad-hoc), by the finalize once it reaches a terminal status.
|
|
1419
|
+
* Absent on a still-live session (the anchor is stamped at finalize) and on a
|
|
1420
|
+
* pre-feature unchained session. Additive optional => no schema_version bump.
|
|
1421
|
+
* `.strict()` because the writers fully own the shape.
|
|
1420
1422
|
*/
|
|
1421
1423
|
declare const SessionIntegritySchema: z.ZodObject<{
|
|
1422
1424
|
head_hash: z.ZodString;
|
|
@@ -1553,6 +1555,35 @@ declare function enumerateSessionDirs(paths: BasouPaths): Promise<string[]>;
|
|
|
1553
1555
|
* or the zod error).
|
|
1554
1556
|
*/
|
|
1555
1557
|
declare function readSessionYaml(paths: BasouPaths, sessionId: string): Promise<Session>;
|
|
1558
|
+
/**
|
|
1559
|
+
* Apply a terminal-status mutation to a live session's `session.yaml` AND, in
|
|
1560
|
+
* the same locked write, stamp the tamper-evidence head anchor derived from the
|
|
1561
|
+
* on-disk `events.jsonl` tail. Used by the `exec` / `run` orchestrators for
|
|
1562
|
+
* BOTH terminal writers (the normal end-of-run finalize and the spawn-failure
|
|
1563
|
+
* `failed` finalize).
|
|
1564
|
+
*
|
|
1565
|
+
* Why locked + anchor-from-tail: live appends chain the LOG only and leave the
|
|
1566
|
+
* anchor for finalize. Reading the final tail under the session lock means a
|
|
1567
|
+
* foreign line appended just before finalize (e.g. a `decision record` attached
|
|
1568
|
+
* to a still-running session) is included in the anchor, and a foreign attach
|
|
1569
|
+
* that arrives after the terminal status is set is rejected by the attach gate
|
|
1570
|
+
* — so the anchor can never disagree with the at-rest log. The whole-document
|
|
1571
|
+
* read-modify-write also preserves any field a foreign locked writer set (e.g.
|
|
1572
|
+
* a task attach's `task_id`).
|
|
1573
|
+
*
|
|
1574
|
+
* The anchor is written only when the log is actually chained with at least one
|
|
1575
|
+
* line; a legacy unchained session (and an empty log) is left with no
|
|
1576
|
+
* `integrity` anchor, matching the import writers. The mutator receives the
|
|
1577
|
+
* full {@link Session} document and typically sets
|
|
1578
|
+
* `session.session.status` / `ended_at` / `invocation.exit_code` /
|
|
1579
|
+
* `related_files`.
|
|
1580
|
+
*
|
|
1581
|
+
* Throws the {@link inspectChainTail} errors (torn / mixed log), the
|
|
1582
|
+
* {@link readSessionYaml} errors, a zod error if the mutation produces an
|
|
1583
|
+
* invalid document, or `Error("Failed to overwrite YAML file")` on a disk
|
|
1584
|
+
* failure.
|
|
1585
|
+
*/
|
|
1586
|
+
declare function finalizeSessionYaml(paths: BasouPaths, sessionId: string, mutate: (session: Session) => void): Promise<void>;
|
|
1556
1587
|
/**
|
|
1557
1588
|
* Classify a `running` session as suspect using one of two rules:
|
|
1558
1589
|
*
|
|
@@ -1680,6 +1711,86 @@ declare function chainEvents(events: ReadonlyArray<Event>, sessionId: string): C
|
|
|
1680
1711
|
*/
|
|
1681
1712
|
declare function chainRawJsonLines(rawLines: ReadonlyArray<string>, sessionId: string): ChainedEvents;
|
|
1682
1713
|
|
|
1714
|
+
/**
|
|
1715
|
+
* The chain state of an existing `events.jsonl`, as needed by the live append
|
|
1716
|
+
* and finalize paths.
|
|
1717
|
+
*
|
|
1718
|
+
* - `chained` — whether the NEXT line written to this log must carry a
|
|
1719
|
+
* `prev_hash`. True for an empty / not-yet-created log (a fresh session
|
|
1720
|
+
* chains from its genesis) and for a log whose FIRST complete line already
|
|
1721
|
+
* carries `prev_hash`. False for a legacy / pre-feature log whose first line
|
|
1722
|
+
* is unchained (so it stays unchained — we never half-chain a file).
|
|
1723
|
+
* - `head` — the `prev_hash` value the next line carries when `chained`:
|
|
1724
|
+
* `genesisHash(sessionId)` for an empty log, otherwise `lineHash` of the LAST
|
|
1725
|
+
* complete line's raw bytes. Meaningless (set to the genesis hash) when
|
|
1726
|
+
* `chained` is false.
|
|
1727
|
+
* - `count` — number of complete (newline-terminated) lines on disk; the
|
|
1728
|
+
* `event_count` an integrity anchor records.
|
|
1729
|
+
*/
|
|
1730
|
+
type ChainTailState = {
|
|
1731
|
+
chained: boolean;
|
|
1732
|
+
head: string;
|
|
1733
|
+
count: number;
|
|
1734
|
+
};
|
|
1735
|
+
/**
|
|
1736
|
+
* Inspect `<sessions>/<sessionId>/events.jsonl` to decide how the next append
|
|
1737
|
+
* (or the finalize anchor) must treat the chain. READ-ONLY; the caller MUST
|
|
1738
|
+
* already hold the session lock so the inspected tail cannot move underneath a
|
|
1739
|
+
* subsequent append.
|
|
1740
|
+
*
|
|
1741
|
+
* Chained-ness is decided from the FIRST complete line (does the log claim to
|
|
1742
|
+
* be chained), and the head pointer is taken from the LAST complete line. If
|
|
1743
|
+
* the first and last lines DISAGREE — a mixed / partially-tampered file — the
|
|
1744
|
+
* call THROWS rather than extending a broken chain; verify is the detector, the
|
|
1745
|
+
* writer must not deepen a break. An unterminated final line (a torn tail from
|
|
1746
|
+
* a crashed prior append) also THROWS so a new line is never glued onto a
|
|
1747
|
+
* fragment.
|
|
1748
|
+
*
|
|
1749
|
+
* Throws `Error("Failed to read events.jsonl")` for non-ENOENT I/O,
|
|
1750
|
+
* `Error("Unterminated final line in events.jsonl")` for a torn tail, and
|
|
1751
|
+
* `Error("events.jsonl is partially chained")` for a mixed first/last line.
|
|
1752
|
+
*/
|
|
1753
|
+
declare function inspectChainTail(paths: BasouPaths, sessionId: string): Promise<ChainTailState>;
|
|
1754
|
+
/**
|
|
1755
|
+
* Append one event to `<sessions>/<sessionId>/events.jsonl`, threading the
|
|
1756
|
+
* tamper-evidence hash chain. The caller MUST already hold the session lock
|
|
1757
|
+
* (`acquireLock(paths, "session", sessionId)`); this function does NOT acquire
|
|
1758
|
+
* it, so it composes inside a larger caller-owned critical section (the
|
|
1759
|
+
* convention used by `decision record`, `session note`, task attach and
|
|
1760
|
+
* approval resolution) without re-entrant lock deadlock.
|
|
1761
|
+
*
|
|
1762
|
+
* The event is validated against {@link EventSchema}, then — if the existing
|
|
1763
|
+
* log is chained (or empty) — written with a `prev_hash` back-pointer derived
|
|
1764
|
+
* from the real on-disk tail (see {@link inspectChainTail}); a legacy unchained
|
|
1765
|
+
* log keeps receiving plain unchained lines. The single serializer
|
|
1766
|
+
* ({@link serializeEventLine}) is shared with the bulk writers so the bytes a
|
|
1767
|
+
* chain hashes can never diverge from another path's bytes.
|
|
1768
|
+
*
|
|
1769
|
+
* Does NOT touch `session.yaml.integrity`: the head anchor is written once, at
|
|
1770
|
+
* the terminal-status finalize, by {@link finalizeSessionYaml}. A still-live
|
|
1771
|
+
* session therefore has a chained log but no anchor yet, which `verify` reports
|
|
1772
|
+
* as the benign `in_progress`.
|
|
1773
|
+
*
|
|
1774
|
+
* Throws `"Invalid Basou event payload"` on validation failure, the
|
|
1775
|
+
* {@link inspectChainTail} errors on a torn / mixed log, or `"Failed to append
|
|
1776
|
+
* event to events.jsonl"` on a disk failure. The native error is attached as
|
|
1777
|
+
* `cause`.
|
|
1778
|
+
*/
|
|
1779
|
+
declare function appendChainedEventLocked(paths: BasouPaths, sessionId: string, event: unknown): Promise<{
|
|
1780
|
+
chained: boolean;
|
|
1781
|
+
}>;
|
|
1782
|
+
/**
|
|
1783
|
+
* Self-locking wrapper around {@link appendChainedEventLocked} for callers that
|
|
1784
|
+
* do NOT already hold the session lock (the `exec` / `run` orchestrators, which
|
|
1785
|
+
* append one event at a time to a session they own). Acquires the session lock,
|
|
1786
|
+
* appends, and releases. Each append is a short-lived lock hold — the lock is
|
|
1787
|
+
* NEVER held across a child process — so a foreign attach can interleave safely
|
|
1788
|
+
* and the next append chains onto the true tail.
|
|
1789
|
+
*/
|
|
1790
|
+
declare function appendChainedEvent(paths: BasouPaths, sessionId: string, event: unknown): Promise<{
|
|
1791
|
+
chained: boolean;
|
|
1792
|
+
}>;
|
|
1793
|
+
|
|
1683
1794
|
/**
|
|
1684
1795
|
* Append a single Basou event to `<sessionDir>/events.jsonl`.
|
|
1685
1796
|
*
|
|
@@ -1688,10 +1799,13 @@ declare function chainRawJsonLines(rawLines: ReadonlyArray<string>, sessionId: s
|
|
|
1688
1799
|
* Validation enforces the per-variant contract (required fields, source
|
|
1689
1800
|
* vocabulary, strict variants such as `adapter_output`).
|
|
1690
1801
|
*
|
|
1691
|
-
*
|
|
1692
|
-
*
|
|
1693
|
-
*
|
|
1694
|
-
*
|
|
1802
|
+
* This LOW-LEVEL writer does NOT hash-chain — it writes the validated event as
|
|
1803
|
+
* a plain line. Hash-chained appends go through `appendChainedEvent` /
|
|
1804
|
+
* `appendChainedEventLocked` (the live `exec` / `run` / attach / approval
|
|
1805
|
+
* paths), and the bulk import writers chain via {@link writeEventsBulk} with
|
|
1806
|
+
* `chain: true`. A direct caller of this raw export can still add an unchained
|
|
1807
|
+
* line to a chained log; that is DETECTED by `basou verify`
|
|
1808
|
+
* (`missing_prev_hash`), not prevented — a documented boundary.
|
|
1695
1809
|
*
|
|
1696
1810
|
* Atomicity: writes go through `appendFile` which uses `O_APPEND`. Lines up
|
|
1697
1811
|
* to `PIPE_BUF` bytes (Linux 4096 / macOS 512) are written atomically by the
|
|
@@ -1758,10 +1872,15 @@ declare function writeEventsBulk(sessionDir: string, events: Event[], options?:
|
|
|
1758
1872
|
* (an import crashed between the events write and the yaml write, or the
|
|
1759
1873
|
* yaml was deleted out of band). Benign: a re-import / `--force` repairs it.
|
|
1760
1874
|
* - `tampered` — a real integrity break (see {@link ChainBreakReason}).
|
|
1875
|
+
* - `in_progress` — a chained log whose session is still LIVE (a non-terminal
|
|
1876
|
+
* status: initialized / running / waiting_approval). The internal
|
|
1877
|
+
* back-pointer chain is fully verified, but the tail and head anchor are
|
|
1878
|
+
* forgiven because a live session's log is legitimately still growing and its
|
|
1879
|
+
* anchor is not written until the terminal finalize. Informational, exit 0.
|
|
1761
1880
|
* - `verified` — every back-pointer, genesis, session-id and line-discipline
|
|
1762
1881
|
* check passed AND the head anchor matches the on-disk log.
|
|
1763
1882
|
*/
|
|
1764
|
-
type ChainVerdictStatus = "verified" | "unchained" | "empty" | "incomplete" | "tampered";
|
|
1883
|
+
type ChainVerdictStatus = "verified" | "unchained" | "empty" | "incomplete" | "in_progress" | "tampered";
|
|
1765
1884
|
/** Machine-readable detail for a `tampered` (or `incomplete`) verdict. */
|
|
1766
1885
|
type ChainBreakReason =
|
|
1767
1886
|
/** The file does not end with `\n`; chained writers always terminate the last line. */
|
|
@@ -1818,6 +1937,11 @@ type ChainVerdict = {
|
|
|
1818
1937
|
* and finally the head anchor (`incomplete` when `session.yaml` is entirely
|
|
1819
1938
|
* absent; `tampered` when it is present without a matching anchor).
|
|
1820
1939
|
*
|
|
1940
|
+
* - When the chained log belongs to a LIVE session (a non-terminal status),
|
|
1941
|
+
* the internal chain is verified but a torn tail / absent / mismatching
|
|
1942
|
+
* anchor is FORGIVEN as `in_progress`: a live session's tail is legitimately
|
|
1943
|
+
* still growing and its anchor is written only at the terminal finalize.
|
|
1944
|
+
*
|
|
1821
1945
|
* NON-CRYPTOGRAPHIC: the anchor lives in `session.yaml`, which is itself
|
|
1822
1946
|
* editable; an attacker rewriting BOTH files consistently is not detected.
|
|
1823
1947
|
* Signing is a follow-up.
|
|
@@ -1825,6 +1949,12 @@ type ChainVerdict = {
|
|
|
1825
1949
|
* Throws `Error("Failed to read events.jsonl")` only for non-ENOENT I/O
|
|
1826
1950
|
* failures (EACCES etc.) — an unreadable file is an environment problem, not
|
|
1827
1951
|
* a verdict.
|
|
1952
|
+
*
|
|
1953
|
+
* READ-ONLY and lock-free: a session being finalized concurrently can leave the
|
|
1954
|
+
* two files momentarily out of step (old events read before a finalize, new
|
|
1955
|
+
* anchor read after it). A strict `anchor_mismatch` is therefore re-snapshotted
|
|
1956
|
+
* ONCE before being returned — a genuine mismatch is deterministic across the
|
|
1957
|
+
* retry, while a finalize-in-flight resolves within it.
|
|
1828
1958
|
*/
|
|
1829
1959
|
declare function verifyEventsChain(paths: BasouPaths, sessionId: string): Promise<ChainVerdict>;
|
|
1830
1960
|
|
|
@@ -2006,8 +2136,8 @@ declare function isValidPrefixedId(value: string): boolean;
|
|
|
2006
2136
|
* Self-edges are rejected so the audit trail stays monotonic.
|
|
2007
2137
|
*/
|
|
2008
2138
|
declare const TaskStatusSchema: z.ZodEnum<{
|
|
2009
|
-
planned: "planned";
|
|
2010
2139
|
in_progress: "in_progress";
|
|
2140
|
+
planned: "planned";
|
|
2011
2141
|
done: "done";
|
|
2012
2142
|
cancelled: "cancelled";
|
|
2013
2143
|
}>;
|
|
@@ -2027,8 +2157,8 @@ declare const TaskSchema: z.ZodObject<{
|
|
|
2027
2157
|
title: z.ZodString;
|
|
2028
2158
|
label: z.ZodOptional<z.ZodString>;
|
|
2029
2159
|
status: z.ZodEnum<{
|
|
2030
|
-
planned: "planned";
|
|
2031
2160
|
in_progress: "in_progress";
|
|
2161
|
+
planned: "planned";
|
|
2032
2162
|
done: "done";
|
|
2033
2163
|
cancelled: "cancelled";
|
|
2034
2164
|
}>;
|
|
@@ -2778,6 +2908,13 @@ declare function renderHandoff(input: HandoffRendererInput): Promise<HandoffRend
|
|
|
2778
2908
|
*/
|
|
2779
2909
|
declare function parseDuration(input: string): number;
|
|
2780
2910
|
|
|
2911
|
+
/**
|
|
2912
|
+
* Coarse human duration from milliseconds: "3h 05m" / "12m 30s" / "8s".
|
|
2913
|
+
* Shared by the work-stats surfaces (`basou stats`, `basou session show`) and
|
|
2914
|
+
* the report renderer so they format identically.
|
|
2915
|
+
*/
|
|
2916
|
+
declare function formatDurationMs(ms: number): string;
|
|
2917
|
+
|
|
2781
2918
|
/**
|
|
2782
2919
|
* Resolve a possibly-truncated session id prefix to a full session id by
|
|
2783
2920
|
* scanning `<paths.sessions>/`. Existing message contract (carried over
|
|
@@ -2889,122 +3026,6 @@ type SanitizeRelatedFilesResult = {
|
|
|
2889
3026
|
*/
|
|
2890
3027
|
declare function sanitizeRelatedFiles(paths: ReadonlyArray<string>, opts: SanitizePathOptions): SanitizeRelatedFilesResult;
|
|
2891
3028
|
|
|
2892
|
-
/**
|
|
2893
|
-
* Internal abstraction over child-process execution.
|
|
2894
|
-
*
|
|
2895
|
-
* The v0.1 implementation is intentionally minimal:
|
|
2896
|
-
* - Optional UTF-8 stdout/stderr capture (`capture: "buffer"`, default) or
|
|
2897
|
-
* pass-through to the parent's stdio (`capture: "none"`).
|
|
2898
|
-
* - No stream callbacks for partial chunks.
|
|
2899
|
-
* - No event emission. Callers wire any event flow separately.
|
|
2900
|
-
*
|
|
2901
|
-
* The boundary is internal: ProcessRunner is not part of the public
|
|
2902
|
-
* adapter surface. Adapters do not import or instantiate it directly;
|
|
2903
|
-
* CLI / Core orchestration owns construction and invocation.
|
|
2904
|
-
*/
|
|
2905
|
-
/**
|
|
2906
|
-
* Output capture mode.
|
|
2907
|
-
*
|
|
2908
|
-
* - `"buffer"` (default): pipe stdout/stderr to the runner and accumulate
|
|
2909
|
-
* the full UTF-8 string into {@link RunResult}.
|
|
2910
|
-
* - `"none"`: inherit the parent's stdio. The child writes directly to the
|
|
2911
|
-
* parent terminal in real time and {@link RunResult.stdout} /
|
|
2912
|
-
* {@link RunResult.stderr} are empty strings. `stdin` cannot be combined
|
|
2913
|
-
* with `"none"` because the child has no writable stdin pipe.
|
|
2914
|
-
*/
|
|
2915
|
-
type CaptureMode = "buffer" | "none";
|
|
2916
|
-
type RunOptions = {
|
|
2917
|
-
/**
|
|
2918
|
-
* Working directory for the child process. Required: callers resolve
|
|
2919
|
-
* the workspace root themselves; the runner does not validate cwd
|
|
2920
|
-
* existence and surfaces native spawn errors via classification.
|
|
2921
|
-
*/
|
|
2922
|
-
readonly cwd: string;
|
|
2923
|
-
/**
|
|
2924
|
-
* Environment variables for the child. When omitted, the parent's
|
|
2925
|
-
* `process.env` is inherited verbatim. Callers wanting a sanitized
|
|
2926
|
-
* environment must build it explicitly.
|
|
2927
|
-
*/
|
|
2928
|
-
readonly env?: NodeJS.ProcessEnv;
|
|
2929
|
-
/**
|
|
2930
|
-
* External cancellation. Aborting the signal triggers a two-stage
|
|
2931
|
-
* kill (SIGTERM, then SIGKILL after a short grace period).
|
|
2932
|
-
*/
|
|
2933
|
-
readonly signal?: AbortSignal;
|
|
2934
|
-
/**
|
|
2935
|
-
* Internal timeout in milliseconds. Must be a positive finite number.
|
|
2936
|
-
* Triggers the same two-stage kill as `signal`.
|
|
2937
|
-
*/
|
|
2938
|
-
readonly timeout_ms?: number;
|
|
2939
|
-
/**
|
|
2940
|
-
* Optional input written to the child's stdin. The pipe is closed
|
|
2941
|
-
* after the value is written. Incompatible with `capture: "none"`.
|
|
2942
|
-
*/
|
|
2943
|
-
readonly stdin?: string | Buffer;
|
|
2944
|
-
/**
|
|
2945
|
-
* Output capture mode. Defaults to `"buffer"`. See {@link CaptureMode}.
|
|
2946
|
-
*/
|
|
2947
|
-
readonly capture?: CaptureMode;
|
|
2948
|
-
/**
|
|
2949
|
-
* Invoked synchronously immediately after the child has been spawned,
|
|
2950
|
-
* before the runner waits for completion. Callers use this to retain a
|
|
2951
|
-
* reference for parent-side cleanup (e.g. an `exit` hook that SIGKILLs
|
|
2952
|
-
* the child if the parent is forcibly terminated). The runner takes no
|
|
2953
|
-
* action if the callback throws.
|
|
2954
|
-
*/
|
|
2955
|
-
readonly onSpawn?: (child: ChildProcess) => void;
|
|
2956
|
-
};
|
|
2957
|
-
type RunResult = {
|
|
2958
|
-
readonly command: string;
|
|
2959
|
-
readonly args: readonly string[];
|
|
2960
|
-
readonly cwd: string;
|
|
2961
|
-
/** `null` when the process was killed by a signal. */
|
|
2962
|
-
readonly exit_code: number | null;
|
|
2963
|
-
readonly signal: NodeJS.Signals | null;
|
|
2964
|
-
readonly stdout: string;
|
|
2965
|
-
readonly stderr: string;
|
|
2966
|
-
/** ISO 8601 timestamp captured before spawn. */
|
|
2967
|
-
readonly started_at: string;
|
|
2968
|
-
/** ISO 8601 timestamp captured on the `close` event. */
|
|
2969
|
-
readonly ended_at: string;
|
|
2970
|
-
readonly duration_ms: number;
|
|
2971
|
-
readonly pid: number | null;
|
|
2972
|
-
};
|
|
2973
|
-
type ProcessRunner = {
|
|
2974
|
-
run(command: string, args: readonly string[], options: RunOptions): Promise<RunResult>;
|
|
2975
|
-
};
|
|
2976
|
-
|
|
2977
|
-
/**
|
|
2978
|
-
* Spawn-based ProcessRunner implementation.
|
|
2979
|
-
*
|
|
2980
|
-
* Behavior:
|
|
2981
|
-
* - `shell: false` and `detached: false`. The process group is not
|
|
2982
|
-
* detached, but the OS does not guarantee the child is reaped when
|
|
2983
|
-
* the parent terminates abruptly; callers handle SIGINT/SIGTERM/exit
|
|
2984
|
-
* hooks themselves.
|
|
2985
|
-
* - `capture: "buffer"` (default): `stdio: ['pipe', 'pipe', 'pipe']`,
|
|
2986
|
-
* stdout / stderr are decoded as UTF-8 and accumulated as full
|
|
2987
|
-
* strings (no streaming callbacks).
|
|
2988
|
-
* - `capture: "none"`: `stdio: ['inherit', 'inherit', 'inherit']`, the
|
|
2989
|
-
* child writes directly to the parent terminal in real time and
|
|
2990
|
-
* `RunResult.stdout` / `stderr` are empty strings. `stdin` is
|
|
2991
|
-
* incompatible with this mode (the child has no writable stdin pipe)
|
|
2992
|
-
* and the combination is rejected before spawn.
|
|
2993
|
-
* - `timeout_ms` and `AbortSignal` both trigger a two-stage kill:
|
|
2994
|
-
* `SIGTERM`, then `SIGKILL` after `DEFAULT_KILL_GRACE_MS` (5_000 ms).
|
|
2995
|
-
* - A non-zero `exit_code` does not throw; it is returned via
|
|
2996
|
-
* `RunResult`. Spawn-time errors throw with a pathless message and
|
|
2997
|
-
* the original error attached as `cause`.
|
|
2998
|
-
*
|
|
2999
|
-
* Error message contract: messages never include `cwd` or absolute
|
|
3000
|
-
* command paths. The original errno (and any nested wrapping) is
|
|
3001
|
-
* preserved on `Error.cause`, allowing callers to classify with
|
|
3002
|
-
* `findErrorCode` when needed.
|
|
3003
|
-
*/
|
|
3004
|
-
declare class ChildProcessRunner implements ProcessRunner {
|
|
3005
|
-
run(command: string, args: readonly string[], options: RunOptions): Promise<RunResult>;
|
|
3006
|
-
}
|
|
3007
|
-
|
|
3008
3029
|
/**
|
|
3009
3030
|
* Schema version of the on-disk Basou v0.1 formats these JSON Schemas describe.
|
|
3010
3031
|
* It tracks {@link SchemaVersionSchema} (the `schema_version` field), NOT the
|
|
@@ -3342,6 +3363,253 @@ declare function computeWorkStats(input: WorkStatsInput): Promise<WorkStatsResul
|
|
|
3342
3363
|
*/
|
|
3343
3364
|
declare function sessionWorkStatsFromEvents(sessionId: string, inner: Session["session"], events: ReadonlyArray<Event>, now: Date, eventsUnreadable?: boolean): SessionWorkStats;
|
|
3344
3365
|
|
|
3366
|
+
type ReportRendererInput = {
|
|
3367
|
+
paths: BasouPaths;
|
|
3368
|
+
/** ISO timestamp stamped into the report header and used as the clock. */
|
|
3369
|
+
nowIso: string;
|
|
3370
|
+
/** Optional subject line surfaced in the report title. */
|
|
3371
|
+
title?: string;
|
|
3372
|
+
/**
|
|
3373
|
+
* IANA timezone passed through to {@link computeWorkStats} (it labels the
|
|
3374
|
+
* time figures with the zone). The CLI omits this (host default); tests and
|
|
3375
|
+
* the SDK pass a fixed value for deterministic output. [Codex #5]
|
|
3376
|
+
*/
|
|
3377
|
+
timeZone?: string;
|
|
3378
|
+
onWarning?: (warning: ReplayWarning, sessionId: string) => void;
|
|
3379
|
+
onSessionSkip?: (sessionId: string, reason: SessionSkipReason) => void;
|
|
3380
|
+
onTaskSkip?: (taskId: string, reason: TaskSkipReason) => void;
|
|
3381
|
+
};
|
|
3382
|
+
type ReportSessionItem = {
|
|
3383
|
+
id: string;
|
|
3384
|
+
label: string | null;
|
|
3385
|
+
status: SessionStatus;
|
|
3386
|
+
source: SessionSourceKind;
|
|
3387
|
+
startedAt: string;
|
|
3388
|
+
activeMs: number;
|
|
3389
|
+
outputTokens: number;
|
|
3390
|
+
};
|
|
3391
|
+
type ReportDecisionItem = {
|
|
3392
|
+
id: string;
|
|
3393
|
+
title: string;
|
|
3394
|
+
occurredAt: string;
|
|
3395
|
+
};
|
|
3396
|
+
type ReportTaskItem = {
|
|
3397
|
+
id: string;
|
|
3398
|
+
title: string;
|
|
3399
|
+
status: TaskStatus;
|
|
3400
|
+
};
|
|
3401
|
+
type ReportApprovalItem = {
|
|
3402
|
+
id: string;
|
|
3403
|
+
reason: string;
|
|
3404
|
+
status: ApprovalStatus;
|
|
3405
|
+
riskLevel: RiskLevel;
|
|
3406
|
+
};
|
|
3407
|
+
type TaskStatusCount = {
|
|
3408
|
+
status: TaskStatus;
|
|
3409
|
+
count: number;
|
|
3410
|
+
};
|
|
3411
|
+
/**
|
|
3412
|
+
* Curated, purpose-built structured shape behind `basou report generate
|
|
3413
|
+
* --json`. Deliberately NOT the full {@link WorkStatsResult} — report's JSON
|
|
3414
|
+
* stays a stable contract decoupled from the stats schema. Field names avoid
|
|
3415
|
+
* the word "billable": a report is a neutral work-explanation export, not a
|
|
3416
|
+
* billing artifact. [Codex #2]
|
|
3417
|
+
*/
|
|
3418
|
+
type ReportData = {
|
|
3419
|
+
generatedAt: string;
|
|
3420
|
+
title?: string;
|
|
3421
|
+
/** Earliest session start .. latest session end (or `now` for open sessions). */
|
|
3422
|
+
period: {
|
|
3423
|
+
from: string | null;
|
|
3424
|
+
to: string | null;
|
|
3425
|
+
};
|
|
3426
|
+
sessions: {
|
|
3427
|
+
total: number;
|
|
3428
|
+
byStatus: StatusCount[];
|
|
3429
|
+
items: ReportSessionItem[];
|
|
3430
|
+
};
|
|
3431
|
+
volume: {
|
|
3432
|
+
outputTokens: number;
|
|
3433
|
+
reasoningTokens: number;
|
|
3434
|
+
commandCount: number;
|
|
3435
|
+
fileChangedCount: number;
|
|
3436
|
+
decisionCount: number;
|
|
3437
|
+
tokensAvailable: boolean;
|
|
3438
|
+
};
|
|
3439
|
+
time: {
|
|
3440
|
+
activeMs: number;
|
|
3441
|
+
machineActiveMs: number;
|
|
3442
|
+
machineAvailable: boolean;
|
|
3443
|
+
spanMs: number;
|
|
3444
|
+
commandTimeMs: number;
|
|
3445
|
+
timeZone: string;
|
|
3446
|
+
};
|
|
3447
|
+
decisions: {
|
|
3448
|
+
count: number;
|
|
3449
|
+
items: ReportDecisionItem[];
|
|
3450
|
+
};
|
|
3451
|
+
approvals: {
|
|
3452
|
+
pending: number;
|
|
3453
|
+
approved: number;
|
|
3454
|
+
rejected: number;
|
|
3455
|
+
expired: number;
|
|
3456
|
+
items: ReportApprovalItem[];
|
|
3457
|
+
};
|
|
3458
|
+
tasks: {
|
|
3459
|
+
total: number;
|
|
3460
|
+
byStatus: TaskStatusCount[];
|
|
3461
|
+
items: ReportTaskItem[];
|
|
3462
|
+
};
|
|
3463
|
+
/** Union of related files across non-`import` sessions (full; markdown truncates). */
|
|
3464
|
+
changedFiles: string[];
|
|
3465
|
+
integrity: {
|
|
3466
|
+
total: number;
|
|
3467
|
+
verified: number;
|
|
3468
|
+
unchained: number;
|
|
3469
|
+
empty: number;
|
|
3470
|
+
incomplete: number;
|
|
3471
|
+
in_progress: number;
|
|
3472
|
+
tampered: number;
|
|
3473
|
+
/** Session ids whose chain is `tampered`, surfaced for follow-up. */
|
|
3474
|
+
tamperedSessions: string[];
|
|
3475
|
+
};
|
|
3476
|
+
};
|
|
3477
|
+
type ReportRendererResult = {
|
|
3478
|
+
body: string;
|
|
3479
|
+
data: ReportData;
|
|
3480
|
+
};
|
|
3481
|
+
/**
|
|
3482
|
+
* Render a neutral "work report" — a point-in-time export that explains the
|
|
3483
|
+
* work captured in a workspace: how much, what was decided / approved /
|
|
3484
|
+
* undertaken, which files changed, and whether the local provenance is
|
|
3485
|
+
* internally consistent. It composes existing read primitives only and writes
|
|
3486
|
+
* nothing; the caller chooses where `body` goes (stdout / a file) and whether
|
|
3487
|
+
* to emit the structured `data` as JSON.
|
|
3488
|
+
*
|
|
3489
|
+
* Warning surfaces mirror the sibling renderers: `loadSessionEntries` (suspect
|
|
3490
|
+
* classification) and the decision-aggregation replay (with the same
|
|
3491
|
+
* unreadable-skip wrapper as `decisions-renderer.ts`) report through the
|
|
3492
|
+
* callbacks. {@link computeWorkStats} runs SILENTLY here — it re-reads the same
|
|
3493
|
+
* sessions/events, so surfacing its warnings too would double-emit. [Codex #6]
|
|
3494
|
+
*/
|
|
3495
|
+
declare function renderReport(input: ReportRendererInput): Promise<ReportRendererResult>;
|
|
3496
|
+
|
|
3497
|
+
/**
|
|
3498
|
+
* Internal abstraction over child-process execution.
|
|
3499
|
+
*
|
|
3500
|
+
* The v0.1 implementation is intentionally minimal:
|
|
3501
|
+
* - Optional UTF-8 stdout/stderr capture (`capture: "buffer"`, default) or
|
|
3502
|
+
* pass-through to the parent's stdio (`capture: "none"`).
|
|
3503
|
+
* - No stream callbacks for partial chunks.
|
|
3504
|
+
* - No event emission. Callers wire any event flow separately.
|
|
3505
|
+
*
|
|
3506
|
+
* The boundary is internal: ProcessRunner is not part of the public
|
|
3507
|
+
* adapter surface. Adapters do not import or instantiate it directly;
|
|
3508
|
+
* CLI / Core orchestration owns construction and invocation.
|
|
3509
|
+
*/
|
|
3510
|
+
/**
|
|
3511
|
+
* Output capture mode.
|
|
3512
|
+
*
|
|
3513
|
+
* - `"buffer"` (default): pipe stdout/stderr to the runner and accumulate
|
|
3514
|
+
* the full UTF-8 string into {@link RunResult}.
|
|
3515
|
+
* - `"none"`: inherit the parent's stdio. The child writes directly to the
|
|
3516
|
+
* parent terminal in real time and {@link RunResult.stdout} /
|
|
3517
|
+
* {@link RunResult.stderr} are empty strings. `stdin` cannot be combined
|
|
3518
|
+
* with `"none"` because the child has no writable stdin pipe.
|
|
3519
|
+
*/
|
|
3520
|
+
type CaptureMode = "buffer" | "none";
|
|
3521
|
+
type RunOptions = {
|
|
3522
|
+
/**
|
|
3523
|
+
* Working directory for the child process. Required: callers resolve
|
|
3524
|
+
* the workspace root themselves; the runner does not validate cwd
|
|
3525
|
+
* existence and surfaces native spawn errors via classification.
|
|
3526
|
+
*/
|
|
3527
|
+
readonly cwd: string;
|
|
3528
|
+
/**
|
|
3529
|
+
* Environment variables for the child. When omitted, the parent's
|
|
3530
|
+
* `process.env` is inherited verbatim. Callers wanting a sanitized
|
|
3531
|
+
* environment must build it explicitly.
|
|
3532
|
+
*/
|
|
3533
|
+
readonly env?: NodeJS.ProcessEnv;
|
|
3534
|
+
/**
|
|
3535
|
+
* External cancellation. Aborting the signal triggers a two-stage
|
|
3536
|
+
* kill (SIGTERM, then SIGKILL after a short grace period).
|
|
3537
|
+
*/
|
|
3538
|
+
readonly signal?: AbortSignal;
|
|
3539
|
+
/**
|
|
3540
|
+
* Internal timeout in milliseconds. Must be a positive finite number.
|
|
3541
|
+
* Triggers the same two-stage kill as `signal`.
|
|
3542
|
+
*/
|
|
3543
|
+
readonly timeout_ms?: number;
|
|
3544
|
+
/**
|
|
3545
|
+
* Optional input written to the child's stdin. The pipe is closed
|
|
3546
|
+
* after the value is written. Incompatible with `capture: "none"`.
|
|
3547
|
+
*/
|
|
3548
|
+
readonly stdin?: string | Buffer;
|
|
3549
|
+
/**
|
|
3550
|
+
* Output capture mode. Defaults to `"buffer"`. See {@link CaptureMode}.
|
|
3551
|
+
*/
|
|
3552
|
+
readonly capture?: CaptureMode;
|
|
3553
|
+
/**
|
|
3554
|
+
* Invoked synchronously immediately after the child has been spawned,
|
|
3555
|
+
* before the runner waits for completion. Callers use this to retain a
|
|
3556
|
+
* reference for parent-side cleanup (e.g. an `exit` hook that SIGKILLs
|
|
3557
|
+
* the child if the parent is forcibly terminated). The runner takes no
|
|
3558
|
+
* action if the callback throws.
|
|
3559
|
+
*/
|
|
3560
|
+
readonly onSpawn?: (child: ChildProcess) => void;
|
|
3561
|
+
};
|
|
3562
|
+
type RunResult = {
|
|
3563
|
+
readonly command: string;
|
|
3564
|
+
readonly args: readonly string[];
|
|
3565
|
+
readonly cwd: string;
|
|
3566
|
+
/** `null` when the process was killed by a signal. */
|
|
3567
|
+
readonly exit_code: number | null;
|
|
3568
|
+
readonly signal: NodeJS.Signals | null;
|
|
3569
|
+
readonly stdout: string;
|
|
3570
|
+
readonly stderr: string;
|
|
3571
|
+
/** ISO 8601 timestamp captured before spawn. */
|
|
3572
|
+
readonly started_at: string;
|
|
3573
|
+
/** ISO 8601 timestamp captured on the `close` event. */
|
|
3574
|
+
readonly ended_at: string;
|
|
3575
|
+
readonly duration_ms: number;
|
|
3576
|
+
readonly pid: number | null;
|
|
3577
|
+
};
|
|
3578
|
+
type ProcessRunner = {
|
|
3579
|
+
run(command: string, args: readonly string[], options: RunOptions): Promise<RunResult>;
|
|
3580
|
+
};
|
|
3581
|
+
|
|
3582
|
+
/**
|
|
3583
|
+
* Spawn-based ProcessRunner implementation.
|
|
3584
|
+
*
|
|
3585
|
+
* Behavior:
|
|
3586
|
+
* - `shell: false` and `detached: false`. The process group is not
|
|
3587
|
+
* detached, but the OS does not guarantee the child is reaped when
|
|
3588
|
+
* the parent terminates abruptly; callers handle SIGINT/SIGTERM/exit
|
|
3589
|
+
* hooks themselves.
|
|
3590
|
+
* - `capture: "buffer"` (default): `stdio: ['pipe', 'pipe', 'pipe']`,
|
|
3591
|
+
* stdout / stderr are decoded as UTF-8 and accumulated as full
|
|
3592
|
+
* strings (no streaming callbacks).
|
|
3593
|
+
* - `capture: "none"`: `stdio: ['inherit', 'inherit', 'inherit']`, the
|
|
3594
|
+
* child writes directly to the parent terminal in real time and
|
|
3595
|
+
* `RunResult.stdout` / `stderr` are empty strings. `stdin` is
|
|
3596
|
+
* incompatible with this mode (the child has no writable stdin pipe)
|
|
3597
|
+
* and the combination is rejected before spawn.
|
|
3598
|
+
* - `timeout_ms` and `AbortSignal` both trigger a two-stage kill:
|
|
3599
|
+
* `SIGTERM`, then `SIGKILL` after `DEFAULT_KILL_GRACE_MS` (5_000 ms).
|
|
3600
|
+
* - A non-zero `exit_code` does not throw; it is returned via
|
|
3601
|
+
* `RunResult`. Spawn-time errors throw with a pathless message and
|
|
3602
|
+
* the original error attached as `cause`.
|
|
3603
|
+
*
|
|
3604
|
+
* Error message contract: messages never include `cwd` or absolute
|
|
3605
|
+
* command paths. The original errno (and any nested wrapping) is
|
|
3606
|
+
* preserved on `Error.cause`, allowing callers to classify with
|
|
3607
|
+
* `findErrorCode` when needed.
|
|
3608
|
+
*/
|
|
3609
|
+
declare class ChildProcessRunner implements ProcessRunner {
|
|
3610
|
+
run(command: string, args: readonly string[], options: RunOptions): Promise<RunResult>;
|
|
3611
|
+
}
|
|
3612
|
+
|
|
3345
3613
|
type AppendBasouGitignoreResult = {
|
|
3346
3614
|
/** True if the block was appended (or the file was newly created). */
|
|
3347
3615
|
readonly appended: boolean;
|
|
@@ -3754,4 +4022,4 @@ declare function overwriteYamlFile(filePath: string, value: unknown): Promise<vo
|
|
|
3754
4022
|
*/
|
|
3755
4023
|
declare const BASOU_CORE_VERSION = "0.1.0";
|
|
3756
4024
|
|
|
3757
|
-
export { ACTIVE_GAP_CAP_MS, type ActiveTimeBasis, type AdapterOutputEvent, type AppendBasouGitignoreResult, type AppendEventToExistingInput, type AppendEventToExistingResult, type Approval, type ApprovalApprovedEvent, type ApprovalExpiredEvent, ApprovalIdSchema, type ApprovalLocation, type ApprovalRejectedEvent, type ApprovalRequestedEvent, ApprovalSchema, type ApprovalStatus, ApprovalStatusSchema, 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 ChainVerdict, type ChainVerdictStatus, type ChainedEvents, ChildProcessRunner, type ClaudeTranscriptRecord, type ClaudeTranscriptToPayloadOptions, type CodexRolloutRecord, type CodexRolloutToPayloadOptions, type CommandExecutedEvent, type CommandLookup, type CreateAdHocSessionInput, type CreateAdHocSessionResult, type CreateAdHocTaskInput, type CreateManifestInput, type CreateTaskInput, type CreateTaskResult, type DayWorkStats, DecisionIdSchema, type DecisionRecordedEvent, type DecisionsRendererInput, type DecisionsRendererResult, type DeleteTaskInput, type DeleteTaskResult, type DiffResult, type EditTaskInput, type EditTaskResult, type Event, EventIdSchema, EventSchema, EventSourceSchema, FailedToFinalizeError, type FileChange, type FileChangeStatus, type FileChangedEvent, GENERATED_END, GENERATED_START, type GitSnapshot, type GitSnapshotEvent, type HandoffRendererInput, type HandoffRendererResult, ID_PREFIXES, type IdPrefix, type ImportSessionOptions, type ImportSessionResult, IsoTimestampSchema, JSON_SCHEMA_VERSION, type JsonSchemaArtifact, type LoadSessionEntriesOptions, type LoadTaskEntriesOptions, type LoadedApproval, type LockHandle, type LockScope, type Manifest, ManifestSchema, type MarkerSection, type MeasureAvailability, type NoteAddedEvent, type PrefixedId, type ProcessRunner, 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 ReplayOptions, type ReplayWarning, type RiskLevel, RiskLevelSchema, 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 SourceWorkStats, type StatusCount, StatusSchema, type StatusSnapshot, type SuspectReason, type Task, type TaskArchivedEvent, type TaskCreatedEvent, type TaskDeletedEvent, type TaskDocument, TaskIdSchema, type TaskLinkageRefreshedEvent, type TaskReconciledEvent, TaskSchema, type TaskSkipReason, type TaskStatus, type TaskStatusChangedEvent, TaskStatusSchema, TaskWriteAfterEventError, type TaskWriteAfterEventPhase, type TokenTotals, type UpdateAdHocTaskStatusInput, type UpdateTaskStatusInput, type UpdateTaskStatusResult, type WorkStatsInput, type WorkStatsResult, type WorkStatsTotals, WorkspaceIdSchema, type WriteEventsBulkOptions, type WriteTaskFileMode, acquireLock, appendBasouGitignore, appendEvent, appendEventToExistingSession, archiveTask, assertBasouRootSafe, basouPaths, buildJsonSchemas, buildStatusSnapshot, chainEvents, chainRawJsonLines, classifySuspect, claudeCodeAdapterMetadata, claudeTranscriptToImportPayload, codexRolloutToImportPayload, computeWorkStats, createAdHocSessionWithEvent, createManifest, createTaskWithEvent, deleteTask, editTask, ensureBasouDirectory, enumerateApprovals, enumerateArchivedTaskIds, enumerateSessionDirs, enumerateTaskIds, findErrorCode, genesisHash, getDiff, getSnapshot, importSessionFromJson, isImportDerivedSource, isLazyExpired, isValidPrefixedId, lineHash, linkYamlFile, loadApproval, loadSessionEntries, loadTaskEntries, overwriteYamlFile, parseDuration, parseMarkers, prefixedUlid, readAllEvents, readManifest, readMarkdownFile, readSessionYaml, readStatus, readTaskFile, readTaskFileWithArchiveFallback, readYamlFile, rechainSessionInPlace, reconcileAllTasks, reconcileTask, refreshTaskLinkedSessions, reimportPreservingId, renderDecisions, renderHandoff, renderWithMarkers, replayEvents, resolveClaudeCodeCommand, resolveRepositoryRoot, resolveSessionId, resolveTaskId, sanitizePath, sanitizeRelatedFiles, sanitizeWorkingDirectory, serializeEventLine, serializeJsonSchema, sessionWorkStatsFromEvents, summarizeAdapterOutput, tryRemoteUrl, ulid, updateTaskStatusWithEvent, verifyEventsChain, writeEventsBulk, writeManifest, writeMarkdownFile, writeStatus, writeTaskFile, writeYamlFile };
|
|
4025
|
+
export { ACTIVE_GAP_CAP_MS, type ActiveTimeBasis, type AdapterOutputEvent, type AppendBasouGitignoreResult, type AppendEventToExistingInput, type AppendEventToExistingResult, type Approval, type ApprovalApprovedEvent, type ApprovalExpiredEvent, ApprovalIdSchema, type ApprovalLocation, type ApprovalRejectedEvent, type ApprovalRequestedEvent, ApprovalSchema, type ApprovalStatus, ApprovalStatusSchema, 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 ClaudeTranscriptRecord, type ClaudeTranscriptToPayloadOptions, type CodexRolloutRecord, type CodexRolloutToPayloadOptions, type CommandExecutedEvent, type CommandLookup, type CreateAdHocSessionInput, type CreateAdHocSessionResult, type CreateAdHocTaskInput, type CreateManifestInput, type CreateTaskInput, type CreateTaskResult, type DayWorkStats, DecisionIdSchema, type DecisionRecordedEvent, type DecisionsRendererInput, type DecisionsRendererResult, type DeleteTaskInput, type DeleteTaskResult, type DiffResult, type EditTaskInput, type EditTaskResult, type Event, EventIdSchema, EventSchema, EventSourceSchema, FailedToFinalizeError, type FileChange, type FileChangeStatus, type FileChangedEvent, GENERATED_END, GENERATED_START, type GitSnapshot, type GitSnapshotEvent, type HandoffRendererInput, type HandoffRendererResult, ID_PREFIXES, type IdPrefix, type ImportSessionOptions, type ImportSessionResult, IsoTimestampSchema, JSON_SCHEMA_VERSION, type JsonSchemaArtifact, type LoadSessionEntriesOptions, type LoadTaskEntriesOptions, type LoadedApproval, type LockHandle, type LockScope, type Manifest, ManifestSchema, type MarkerSection, type MeasureAvailability, type NoteAddedEvent, type PrefixedId, type ProcessRunner, 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 ReplayOptions, type ReplayWarning, type ReportApprovalItem, type ReportData, type ReportDecisionItem, type ReportRendererInput, type ReportRendererResult, type ReportSessionItem, type ReportTaskItem, type RiskLevel, RiskLevelSchema, 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 SourceWorkStats, type StatusCount, StatusSchema, type StatusSnapshot, type SuspectReason, 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 WorkStatsInput, type WorkStatsResult, type WorkStatsTotals, WorkspaceIdSchema, type WriteEventsBulkOptions, type WriteTaskFileMode, acquireLock, appendBasouGitignore, appendChainedEvent, appendChainedEventLocked, appendEvent, appendEventToExistingSession, archiveTask, assertBasouRootSafe, basouPaths, buildJsonSchemas, buildStatusSnapshot, chainEvents, chainRawJsonLines, classifySuspect, claudeCodeAdapterMetadata, claudeTranscriptToImportPayload, codexRolloutToImportPayload, computeWorkStats, createAdHocSessionWithEvent, createManifest, createTaskWithEvent, deleteTask, editTask, ensureBasouDirectory, enumerateApprovals, enumerateArchivedTaskIds, enumerateSessionDirs, enumerateTaskIds, finalizeSessionYaml, findErrorCode, formatDurationMs, genesisHash, getDiff, getSnapshot, importSessionFromJson, inspectChainTail, isImportDerivedSource, isLazyExpired, isValidPrefixedId, lineHash, linkYamlFile, loadApproval, loadSessionEntries, loadTaskEntries, overwriteYamlFile, parseDuration, parseMarkers, prefixedUlid, readAllEvents, readManifest, readMarkdownFile, readSessionYaml, readStatus, readTaskFile, readTaskFileWithArchiveFallback, readYamlFile, rechainSessionInPlace, reconcileAllTasks, reconcileTask, refreshTaskLinkedSessions, reimportPreservingId, renderDecisions, renderHandoff, renderReport, renderWithMarkers, replayEvents, resolveClaudeCodeCommand, resolveRepositoryRoot, resolveSessionId, resolveTaskId, sanitizePath, sanitizeRelatedFiles, sanitizeWorkingDirectory, serializeEventLine, serializeJsonSchema, sessionWorkStatsFromEvents, summarizeAdapterOutput, tryRemoteUrl, ulid, updateTaskStatusWithEvent, verifyEventsChain, writeEventsBulk, writeManifest, writeMarkdownFile, writeStatus, writeTaskFile, writeYamlFile };
|