@adhd/backlog 0.1.4 → 0.1.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adhd/backlog",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "bin": {
5
5
  "backlog": "index.js"
6
6
  },
@@ -13,10 +13,11 @@
13
13
  "@adhd/apigen-plugin-ir-cache": "^0.1.0",
14
14
  "@adhd/apigen-plugin-mcp": "^0.2.3",
15
15
  "@adhd/apigen-plugin-openapi": "^0.2.2",
16
- "@adhd/environment": "^0.1.3",
16
+ "@adhd/environment": "^0.1.5",
17
17
  "@adhd/environment-base-spec": "^0.1.0",
18
- "@adhd/sox-graph-store": "^0.3.0",
19
- "better-sqlite3": "^12.10.0",
18
+ "@adhd/sox-graph-store": "^0.8.3",
19
+ "@adhd/sox-store-adapter": "^0.5.7",
20
+ "@adhd/sox-telemetry": "^0.2.0",
20
21
  "pino": "10.3.1",
21
22
  "pino-pretty": "13.1.3",
22
23
  "yaml": "1.10.3"
package/server.d.ts CHANGED
@@ -60,7 +60,7 @@ export interface StartOpts {
60
60
  * and never touch `ctx` at all, so a lazy caller can defer opening the real
61
61
  * backing store until a command that actually needs it is dispatched.
62
62
  */
63
- export declare function buildBacklogApigenPackage(ctx: BacklogCtx | (() => BacklogCtx)): Promise<{
63
+ export declare function buildBacklogApigenPackage(ctx: BacklogCtx | (() => BacklogCtx | Promise<BacklogCtx>)): Promise<{
64
64
  pkg: {
65
65
  id: string;
66
66
  schemas: ReturnType<typeof composeSchemas>;
@@ -10,7 +10,7 @@ export declare const BACKLOG_AUDIT_EVENT_TAG = "backlog-audit-event";
10
10
  * byte-identical events (e.g. two items independently transitioning
11
11
  * `OPEN`→`IN_PROGRESS` with no `by`/`reason` at all) into ONE node.
12
12
  */
13
- export declare function writeAuditEvent(store: GraphBacklogStore, itemNodeId: number, repo: string, humanId: string, kind: AuditTrailEntry['kind'], detail: Record<string, unknown>): void;
13
+ export declare function writeAuditEvent(store: GraphBacklogStore, itemNodeId: number, repo: string, humanId: string, kind: AuditTrailEntry['kind'], detail: Record<string, unknown>): Promise<void>;
14
14
  /** Every persisted event for `itemNodeId`, oldest first — ready to merge
15
15
  * straight into `auditTrail()`'s `history` array. */
16
- export declare function queryAuditEvents(store: GraphBacklogStore, itemNodeId: number): AuditTrailEntry[];
16
+ export declare function queryAuditEvents(store: GraphBacklogStore, itemNodeId: number): Promise<AuditTrailEntry[]>;
package/store/claim.d.ts CHANGED
@@ -15,10 +15,10 @@ export declare class ClaimContentionError extends Error {
15
15
  * by !== claimedBy, age > staleAfterMin -> reclaimed-stale
16
16
  * by !== claimedBy, opts.force -> proceeds anyway (reclaimed-stale-shaped)
17
17
  */
18
- export declare function claimItemNode(store: GraphBacklogStore, nodeId: number, by: string, opts?: ClaimOpts): ClaimResult;
18
+ export declare function claimItemNode(store: GraphBacklogStore, nodeId: number, by: string, opts?: ClaimOpts): Promise<ClaimResult>;
19
19
  /** SPEC.md §5.3 — "always succeeds (bumps claimedAt), no contention check, ever." */
20
- export declare function renewClaimNode(store: GraphBacklogStore, nodeId: number, by: string): ClaimResult;
20
+ export declare function renewClaimNode(store: GraphBacklogStore, nodeId: number, by: string): Promise<ClaimResult>;
21
21
  /** DESIGN.md §4.2 — releasing an already-unclaimed item is a no-op, never an error. */
22
22
  export declare function releaseClaimNode(store: GraphBacklogStore, nodeId: number, by: string, opts?: {
23
23
  force?: boolean;
24
- }): ReleaseResult;
24
+ }): Promise<ReleaseResult>;
package/store/crud.d.ts CHANGED
@@ -34,9 +34,9 @@ import { BacklogItem, CreateItemInput, CreateItemResult, UpdateItemInput } from
34
34
  * exactly the false-positive shape this bug reports and must NOT pass.
35
35
  */
36
36
  export declare const TITLE_OVERLAP_MIN_FRACTION = 0.5;
37
- declare function dedupeScan(store: GraphBacklogStore, repo: string, input: CreateItemInput): BacklogItem[];
38
- export declare function createItemNode(store: GraphBacklogStore, input: CreateItemInput): CreateItemResult;
39
- export declare function getItemNode(store: GraphBacklogStore, repo: string, humanId: string): BacklogItem | null;
37
+ declare function dedupeScan(store: GraphBacklogStore, repo: string, input: CreateItemInput): Promise<BacklogItem[]>;
38
+ export declare function createItemNode(store: GraphBacklogStore, input: CreateItemInput): Promise<CreateItemResult>;
39
+ export declare function getItemNode(store: GraphBacklogStore, repo: string, humanId: string): Promise<BacklogItem | null>;
40
40
  /**
41
41
  * DEVIATION (mitigated — DEBT-BACKLOG-CONTENT-IMMUTABLE-001): `@adhd/sox-graph-store`
42
42
  * exposes no PUBLIC primitive to update a node's `content` column after
@@ -46,15 +46,17 @@ export declare function getItemNode(store: GraphBacklogStore, repo: string, huma
46
46
  * column (source of truth for the API) AND `metadata.title`; `body` updates
47
47
  * `metadata.body` (source of truth for the API). Below, a title/body change
48
48
  * ALSO re-synchronizes the FTS-indexed `content`/`content_hash` columns
49
- * directly via raw SQL on the store-owned `db` handle — the same DESIGN.md
50
- * §14-sanctioned escape hatch `structure.ts`'s `removeDependencyNode` already
51
- * uses for the one other gap (`edge` deletion) the `GraphBackend` API lacks.
49
+ * directly via `adapter.executeRun` on the store-owned `adapter` handle —
50
+ * the same DESIGN.md §14-sanctioned escape hatch `structure.ts`'s
51
+ * `removeDependencyNode` already uses for the one other gap (`edge`
52
+ * deletion) the `GraphBackend` API lacks, now routed through the store-
53
+ * adapter's query surface (F-01/F-02: the raw `store.db` handle is gone).
52
54
  * This is safe specifically because `fts_node_au` (the real schema's `AFTER
53
55
  * UPDATE ON node` trigger — `~/dev/ai/sox-ecosystem/libs/data/graph/graph-store/
54
56
  * src/index.ts`'s `FTS_TRIGGERS`) re-indexes `fts_node` automatically on
55
57
  * ANY write to `node.content`/`name`/`summary`, so no separate FTS statement
56
58
  * is needed here.
57
59
  */
58
- export declare function updateItemNode(store: GraphBacklogStore, repo: string, humanId: string, patch: UpdateItemInput): BacklogItem;
59
- export declare function softDeleteItemNode(store: GraphBacklogStore, repo: string, humanId: string, reason: string): void;
60
+ export declare function updateItemNode(store: GraphBacklogStore, repo: string, humanId: string, patch: UpdateItemInput): Promise<BacklogItem>;
61
+ export declare function softDeleteItemNode(store: GraphBacklogStore, repo: string, humanId: string, reason: string): Promise<void>;
60
62
  export { dedupeScan };
@@ -1,20 +1,36 @@
1
1
  import { GraphBackend } from '@adhd/sox-graph-store';
2
- import { default as Database } from 'better-sqlite3';
2
+ import { StoreAdapter } from '@adhd/sox-store-adapter';
3
3
 
4
4
  export interface GraphBacklogStore {
5
- /** Raw handle — ONLY for the CAS transaction wrapper (mutate-metadata.ts / ids.ts). */
6
- readonly db: Database.Database;
5
+ /** Store-adapter handle — ONLY for the CAS transaction wrapper (mutate-metadata.ts / ids.ts). */
6
+ readonly adapter: StoreAdapter;
7
7
  /** All non-CAS reads/writes go through this. */
8
8
  readonly graph: GraphBackend;
9
9
  }
10
10
  /**
11
11
  * @param busyTimeoutMs SQLite `busy_timeout` (ms) — how long a blocked
12
- * `.immediate()` waits for a contended lock before throwing `SQLITE_BUSY`
13
- * (DEBT-BACKLOG-CONCURRENCY-BUSY-RETRY-001). Callers reading from
14
- * `BacklogConfig` should pass `env.config.db.busyTimeoutMs`; the default
15
- * here (5000) matches that config field's own default, for callers (tests,
16
- * ad-hoc scripts) that open a store directly without going through
17
- * `buildBacklogEnv`.
12
+ * `.transaction(fn, { mode: 'immediate' })` waits for a contended lock
13
+ * before throwing `SQLITE_BUSY` (DEBT-BACKLOG-CONCURRENCY-BUSY-RETRY-001).
14
+ * BUG-SOXGRAPH-002 moved busy_timeout ownership OUT of graph-store into the
15
+ * adapters (SqliteAdapter hardcodes 3000 at connect; graph-store's
16
+ * `PRAGMAS` no longer touches it), and `AdapterConfig` exposes no
17
+ * busy_timeout field — so the caller's value is routed through the
18
+ * adapter's own `pragmaSet('busy_timeout', N)` surface, which both
19
+ * adapters honor (verified: read-back works on turso and sqlite). Callers
20
+ * reading from `BacklogConfig` should pass `env.config.db.busyTimeoutMs`;
21
+ * the default here (5000) matches that config field's own default, for
22
+ * callers (tests, ad-hoc scripts) that open a store directly without going
23
+ * through `buildBacklogEnv`.
18
24
  */
19
- export declare function openGraphBacklogStore(dbPath: string, busyTimeoutMs?: number): GraphBacklogStore;
20
- export declare function closeGraphBacklogStore(store: GraphBacklogStore): void;
25
+ export declare function openGraphBacklogStore(dbPath: string, busyTimeoutMs?: number): Promise<GraphBacklogStore>;
26
+ export declare function closeGraphBacklogStore(store: GraphBacklogStore): Promise<void>;
27
+ /**
28
+ * Best-effort close for teardown finally-paths (cli.ts / server.ts).
29
+ * closeGraphBacklogStore may throw only in the extreme edge where the
30
+ * driver's own db.close() fails (every checkpoint/verify failure is already
31
+ * caught and logged inside the adapter — turso-adapter close()). On that edge
32
+ * this logs and returns so a close failure can never mask a command/transport
33
+ * error or turn a successful command into a failed exit. The adapter's own
34
+ * logs are the durable record; the client never rethrows here.
35
+ */
36
+ export declare function closeGraphBacklogStoreSafe(store: GraphBacklogStore | undefined): Promise<void>;
package/store/ids.d.ts CHANGED
@@ -12,7 +12,7 @@ import { NodeRecord } from '@adhd/sox-graph-store';
12
12
  * short-circuit on a non-null `existing` exactly like `createItemNode`'s
13
13
  * documented idempotent-reimport behavior, but now race-free.
14
14
  */
15
- export declare function allocateHumanIdAndInsert<T>(store: GraphBacklogStore, repo: string, family: string, idOverride: string | undefined, insert: (humanId: string, existing: NodeRecord | null) => T): T;
15
+ export declare function allocateHumanIdAndInsert<T>(store: GraphBacklogStore, repo: string, family: string, idOverride: string | undefined, insert: (humanId: string, existing: NodeRecord | null) => T): Promise<T>;
16
16
  /**
17
17
  * @deprecated kept ONLY as a standalone id-generator for any caller that does
18
18
  * not need an atomic insert alongside it. `createItemNode`/
@@ -21,4 +21,4 @@ export declare function allocateHumanIdAndInsert<T>(store: GraphBacklogStore, re
21
21
  * concurrency). Still correct in isolation — just NOT TOCTOU-safe when the
22
22
  * caller's own insert happens in a separate, later transaction.
23
23
  */
24
- export declare function allocateHumanId(store: GraphBacklogStore, repo: string, family: string): string;
24
+ export declare function allocateHumanId(store: GraphBacklogStore, repo: string, family: string): Promise<string>;
@@ -1,27 +1,32 @@
1
1
  /**
2
2
  * immediate-retry.ts — bounded, jittered exponential-backoff retry wrapper
3
- * around a `db.transaction(fn).immediate()` call (DEBT-BACKLOG-CONCURRENCY-
4
- * BUSY-RETRY-001). `mutate-metadata.ts` / `ids.ts` are the ONLY two write
5
- * paths that call `.immediate()` directly (DESIGN.md §3/§4.3) and both funnel
6
- * through this wrapper — retrying ONLY the specific `SQLITE_BUSY`/
7
- * `SQLITE_BUSY_TIMEOUT`/`SQLITE_BUSY_SNAPSHOT` error `better-sqlite3` throws
8
- * when a `BEGIN IMMEDIATE`'s wait exceeds `busy_timeout`. Any other thrown
9
- * error (including `NotFoundError`, `ClaimContentionError`) propagates
10
- * immediately, unretried — and the semantic `'held'` claim-contention RESULT
11
- * (claim.ts) is a normal RETURN VALUE, never an exception, so it is never
12
- * touched by this wrapper either.
3
+ * around `adapter.transaction(fn, { mode: 'immediate' })` (DEBT-BACKLOG-
4
+ * CONCURRENCY-BUSY-RETRY-001). `mutate-metadata.ts` / `ids.ts` are the ONLY
5
+ * two write paths that call `.immediate()` directly (DESIGN.md §3/§4.3) and
6
+ * both funnel through this wrapper — retrying ONLY busy-shaped errors, using
7
+ * store-adapter's portable `isBusyError`/`isConcurrentConflict` duck-type
8
+ * checks (the same helpers the adapter's own retry loop uses) so BOTH
9
+ * adapter error shapes are covered: the legacy SQLite adapter's
10
+ * `SQLITE_BUSY`/`SQLITE_BUSY_SNAPSHOT` codes and the turso driver's
11
+ * `GenericFailure` with a
12
+ * "database is locked"/"database is busy" message. Any other thrown error
13
+ * (including `NotFoundError`, `ClaimContentionError`) propagates immediately,
14
+ * unretried — and the semantic `'held'` claim-contention RESULT (claim.ts) is
15
+ * a normal RETURN VALUE, never an exception, so it is never touched by this
16
+ * wrapper either.
13
17
  */
14
18
  export interface ImmediateRetryOpts {
15
19
  /** Total attempts (first try + retries). Default 5. */
16
20
  maxAttempts?: number;
17
21
  }
18
22
  /**
19
- * Runs `attempt()` (expected to be `() => db.transaction(fn).immediate()`),
20
- * retrying up to `maxAttempts` times ONLY when it throws a SQLITE_BUSY-shaped
21
- * error, with jittered exponential backoff between attempts (20ms, 40ms,
22
- * 80ms, 160ms, capped at 500ms). Any other error propagates immediately.
23
- * After the final attempt still fails, the last SQLITE_BUSY error is
24
- * re-thrown (a genuine, sustained pileup is still a real failure — this
25
- * bounds the wait, it doesn't hide contention forever).
23
+ * Runs `attempt()` (expected to be
24
+ * `() => adapter.transaction(fn, { mode: 'immediate' })`), retrying up to
25
+ * `maxAttempts` times ONLY when it throws a busy-shaped error, with jittered
26
+ * exponential backoff between attempts (20ms, 40ms, 80ms, 160ms, capped at
27
+ * 500ms). Any other error propagates immediately. After the final attempt
28
+ * still fails, the last busy error is re-thrown (a genuine, sustained pileup
29
+ * is still a real failure — this bounds the wait, it doesn't hide contention
30
+ * forever).
26
31
  */
27
- export declare function withImmediateRetry<T>(attempt: () => T, opts?: ImmediateRetryOpts): T;
32
+ export declare function withImmediateRetry<T>(attempt: () => Promise<T>, opts?: ImmediateRetryOpts): Promise<T>;
@@ -1,18 +1,18 @@
1
1
  import { GraphBacklogStore } from './graph-backlog-store.js';
2
2
  import { ArchiveOpts, BacklogItem, BacklogStatus, Citation, StatsScope, TransitionOpts } from '../model.js';
3
3
 
4
- export declare function transitionStatusNode(store: GraphBacklogStore, repo: string, humanId: string, status: BacklogStatus, opts: TransitionOpts): BacklogItem;
4
+ export declare function transitionStatusNode(store: GraphBacklogStore, repo: string, humanId: string, status: BacklogStatus, opts: TransitionOpts): Promise<BacklogItem>;
5
5
  /** Sugar for transitionStatus into any terminal status (SPEC.md §5.4). */
6
- export declare function resolveItemNode(store: GraphBacklogStore, repo: string, humanId: string, status: BacklogStatus, opts: TransitionOpts): BacklogItem;
6
+ export declare function resolveItemNode(store: GraphBacklogStore, repo: string, humanId: string, status: BacklogStatus, opts: TransitionOpts): Promise<BacklogItem>;
7
7
  /**
8
8
  * `transitionStatus(id, 'IN_PROGRESS', ...)` + an implicit `claimItem(id, by)`.
9
9
  * If the item is actively claimed (not stale) by someone else, the claim
10
10
  * step returns `held` and startWork refuses — starting work on a
11
11
  * contended item would silently override the claim protocol otherwise.
12
12
  */
13
- export declare function startWorkNode(store: GraphBacklogStore, repo: string, humanId: string, by: string): BacklogItem;
14
- export declare function addCitationNode(store: GraphBacklogStore, repo: string, humanId: string, citation: Citation): BacklogItem;
15
- export declare function appendNoteNode(store: GraphBacklogStore, repo: string, humanId: string, by: string, text: string): BacklogItem;
13
+ export declare function startWorkNode(store: GraphBacklogStore, repo: string, humanId: string, by: string): Promise<BacklogItem>;
14
+ export declare function addCitationNode(store: GraphBacklogStore, repo: string, humanId: string, citation: Citation): Promise<BacklogItem>;
15
+ export declare function appendNoteNode(store: GraphBacklogStore, repo: string, humanId: string, by: string, text: string): Promise<BacklogItem>;
16
16
  /**
17
17
  * Marks every terminal, non-excluded item in scope as archived
18
18
  * (`metadata.archivedAt`) and returns them — the graph node itself is NEVER
@@ -20,4 +20,4 @@ export declare function appendNoteNode(store: GraphBacklogStore, repo: string, h
20
20
  * CHANGELOG.md-formatted markdown is `client.ts`'s job (via `markdown.ts`) —
21
21
  * store/* never depends on markdown.ts (DESIGN.md §1 layering).
22
22
  */
23
- export declare function archiveTerminalItems(store: GraphBacklogStore, scope: StatsScope, opts?: ArchiveOpts): BacklogItem[];
23
+ export declare function archiveTerminalItems(store: GraphBacklogStore, scope: StatsScope, opts?: ArchiveOpts): Promise<BacklogItem[]>;
@@ -5,4 +5,4 @@ export declare class NotFoundError extends Error {
5
5
  readonly nodeId: number;
6
6
  constructor(nodeId: number);
7
7
  }
8
- export declare function mutateMetadata<M = BacklogNodeMeta>(store: GraphBacklogStore, nodeId: number, updater: (current: M) => M): M;
8
+ export declare function mutateMetadata<M = BacklogNodeMeta>(store: GraphBacklogStore, nodeId: number, updater: (current: M) => M): Promise<M>;
package/store/query.d.ts CHANGED
@@ -4,8 +4,8 @@ import { AuditTrailResult, BacklogFilter, BacklogItem, DependencyGraph, StatsSco
4
4
  import { NodeRecord } from '@adhd/sox-graph-store';
5
5
 
6
6
  /** Raw NodeRecord query — used internally where the full node (not just the mapped BacklogItem) is needed. */
7
- export declare function queryItemNodes(store: GraphBacklogStore, filter?: BacklogFilter): NodeRecord[];
8
- export declare function listItems(store: GraphBacklogStore, filter?: BacklogFilter): BacklogItem[];
7
+ export declare function queryItemNodes(store: GraphBacklogStore, filter?: BacklogFilter): Promise<NodeRecord[]>;
8
+ export declare function listItems(store: GraphBacklogStore, filter?: BacklogFilter): Promise<BacklogItem[]>;
9
9
  /**
10
10
  * BUG-BACKLOG-HUMANID-COLLISION-001 fix #2: this is THE shared `(repo,
11
11
  * humanId) -> NodeRecord` lookup every store module funnels through
@@ -20,7 +20,7 @@ export declare function listItems(store: GraphBacklogStore, filter?: BacklogFilt
20
20
  * that finds >1 live match now throws `AmbiguousHumanIdError` instead of
21
21
  * guessing.
22
22
  */
23
- export declare function findItemNode(store: GraphBacklogStore, repo: string, humanId: string): NodeRecord | null;
23
+ export declare function findItemNode(store: GraphBacklogStore, repo: string, humanId: string): Promise<NodeRecord | null>;
24
24
  /**
25
25
  * Finds every LIVE node carrying this `humanId`, across ALL repos (no
26
26
  * `namespace` filter) — BUG-BACKLOG-REPO-LOOKUP-UX-001's "did you mean repo
@@ -29,7 +29,7 @@ export declare function findItemNode(store: GraphBacklogStore, repo: string, hum
29
29
  * passed." Used only on the miss path (`buildNotFoundError`) — never on the
30
30
  * hot successful-lookup path, so it costs nothing when a lookup is correct.
31
31
  */
32
- export declare function findHumanIdInAnyRepo(store: GraphBacklogStore, humanId: string): NodeRecord[];
32
+ export declare function findHumanIdInAnyRepo(store: GraphBacklogStore, humanId: string): Promise<NodeRecord[]>;
33
33
  /**
34
34
  * Every distinct repo value any LIVE backlog item is currently filed under.
35
35
  * Used by `createItemNode`'s soft repo-drift warning (write-time half of
@@ -37,7 +37,7 @@ export declare function findHumanIdInAnyRepo(store: GraphBacklogStore, humanId:
37
37
  * "known" repos, so the very first item filed under any repo string never
38
38
  * triggers a false-positive warning.
39
39
  */
40
- export declare function knownRepos(store: GraphBacklogStore): Set<string>;
40
+ export declare function knownRepos(store: GraphBacklogStore): Promise<Set<string>>;
41
41
  /**
42
42
  * Builds the `BacklogItemNotFoundError` every miss site throws — the single
43
43
  * place that decides whether a "did you mean repo X?" hint is warranted
@@ -46,14 +46,14 @@ export declare function knownRepos(store: GraphBacklogStore): Set<string>;
46
46
  * re-queries WITHOUT the `namespace` restriction to see if the humanId lives
47
47
  * under a different repo string instead.
48
48
  */
49
- export declare function buildNotFoundError(store: GraphBacklogStore, repo: string, humanId: string): BacklogItemNotFoundError;
50
- export declare function computeStats(store: GraphBacklogStore, scope?: StatsScope): import('../model.js').BacklogStats;
51
- export declare function spotlight(store: GraphBacklogStore, scope?: StatsScope, limit?: number): BacklogItem[];
52
- export declare function blockers(store: GraphBacklogStore, repo: string, humanId: string): BacklogItem[];
53
- export declare function readyItems(store: GraphBacklogStore, scope?: StatsScope): BacklogItem[];
54
- export declare function dependencyGraph(store: GraphBacklogStore, scope?: StatsScope): DependencyGraph;
55
- export declare function topoOrder(store: GraphBacklogStore, scope?: StatsScope): TopoOrderResult;
56
- export declare function staleClaims(store: GraphBacklogStore, maxAgeMin: number, scope?: StatsScope): BacklogItem[];
49
+ export declare function buildNotFoundError(store: GraphBacklogStore, repo: string, humanId: string): Promise<BacklogItemNotFoundError>;
50
+ export declare function computeStats(store: GraphBacklogStore, scope?: StatsScope): Promise<import('../model.js').BacklogStats>;
51
+ export declare function spotlight(store: GraphBacklogStore, scope?: StatsScope, limit?: number): Promise<BacklogItem[]>;
52
+ export declare function blockers(store: GraphBacklogStore, repo: string, humanId: string): Promise<BacklogItem[]>;
53
+ export declare function readyItems(store: GraphBacklogStore, scope?: StatsScope): Promise<BacklogItem[]>;
54
+ export declare function dependencyGraph(store: GraphBacklogStore, scope?: StatsScope): Promise<DependencyGraph>;
55
+ export declare function topoOrder(store: GraphBacklogStore, scope?: StatsScope): Promise<TopoOrderResult>;
56
+ export declare function staleClaims(store: GraphBacklogStore, maxAgeMin: number, scope?: StatsScope): Promise<BacklogItem[]>;
57
57
  /**
58
58
  * Bi-temporal history + supersession chain (SPEC.md §5.6, DESIGN.md §2.3).
59
59
  * DEVIATION: the store does not persist a full mutation event log (no
@@ -64,5 +64,5 @@ export declare function staleClaims(store: GraphBacklogStore, maxAgeMin: number,
64
64
  * `item.updatedAt` as their timestamp since `Citation` carries no `at` field
65
65
  * of its own. Filed as DEBT-BACKLOG-AUDIT-TRAIL-PARTIAL-001.
66
66
  */
67
- export declare function auditTrail(store: GraphBacklogStore, repo: string, humanId: string): AuditTrailResult;
67
+ export declare function auditTrail(store: GraphBacklogStore, repo: string, humanId: string): Promise<AuditTrailResult>;
68
68
  export type { BacklogNodeMeta };
@@ -1,16 +1,18 @@
1
1
  import { GraphBacklogStore } from './graph-backlog-store.js';
2
2
  import { BacklogItem, CreateItemInput, Priority } from '../model.js';
3
3
 
4
- export declare function addDependencyNode(store: GraphBacklogStore, repo: string, humanId: string, dependsOnHumanId: string): void;
4
+ export declare function addDependencyNode(store: GraphBacklogStore, repo: string, humanId: string, dependsOnHumanId: string): Promise<void>;
5
5
  /**
6
6
  * `@adhd/sox-graph-store` exposes no edge-delete primitive (only
7
7
  * `invalidate()` for nodes, bi-temporal) — DESIGN.md §14 explicitly sanctions
8
- * a raw `DELETE` on the store-owned `db` handle as the one place the adapter
8
+ * a raw `DELETE` on the store-owned handle as the one place the adapter
9
9
  * reaches past the `GraphBackend` API, confirmed against the real `edge`
10
- * table column names (`src`/`dst`/`rel`).
10
+ * table column names (`src`/`dst`/`rel`). F-01/F-02: routed through the
11
+ * store-adapter's `executeRun` query surface (the raw `store.db` handle is
12
+ * gone) — same SQL, same semantics.
11
13
  */
12
- export declare function removeDependencyNode(store: GraphBacklogStore, repo: string, humanId: string, dependsOnHumanId: string): void;
13
- export declare function linkRelatedNode(store: GraphBacklogStore, repo: string, humanIdA: string, humanIdB: string): void;
14
+ export declare function removeDependencyNode(store: GraphBacklogStore, repo: string, humanId: string, dependsOnHumanId: string): Promise<void>;
15
+ export declare function linkRelatedNode(store: GraphBacklogStore, repo: string, humanIdA: string, humanIdB: string): Promise<void>;
14
16
  /**
15
17
  * DESIGN.md §14 point 2 (CONFIRMED against the real source): `supersede(oldId,
16
18
  * newContent, meta)` writes `SUPERSEDES` new -> old, sets `is_superseded=1`
@@ -21,18 +23,18 @@ export declare function linkRelatedNode(store: GraphBacklogStore, repo: string,
21
23
  * invalidation — `touch()`/`mutateMetadata` throw once `t_invalid` is set)
22
24
  * and a final `invalidate(oldId, reason)`.
23
25
  */
24
- export declare function supersedeItemNode(store: GraphBacklogStore, repo: string, oldHumanId: string, newInput: CreateItemInput, reason: string): BacklogItem;
26
+ export declare function supersedeItemNode(store: GraphBacklogStore, repo: string, oldHumanId: string, newInput: CreateItemInput, reason: string): Promise<BacklogItem>;
25
27
  /** Creates N children, each linked child PART_OF parent. Parent is left open. */
26
- export declare function splitItemNode(store: GraphBacklogStore, repo: string, parentHumanId: string, children: CreateItemInput[]): BacklogItem[];
28
+ export declare function splitItemNode(store: GraphBacklogStore, repo: string, parentHumanId: string, children: CreateItemInput[]): Promise<BacklogItem[]>;
27
29
  /**
28
30
  * `SAME_AS(drop -> keep)` per DESIGN.md §14 point 2 (obsolete -> canonical,
29
31
  * matching the `supersede()` convention), then `invalidate(drop, reason)`.
30
32
  * Returns the KEPT item.
31
33
  */
32
- export declare function mergeItemsNode(store: GraphBacklogStore, repo: string, keepHumanId: string, dropHumanId: string, reason: string): BacklogItem;
33
- export declare function setPriorityNode(store: GraphBacklogStore, repo: string, humanId: string, priority: Priority): BacklogItem;
34
- export declare function attachToPlanNode(store: GraphBacklogStore, repo: string, humanId: string, planSlug: string): void;
35
- export declare function assignItemNode(store: GraphBacklogStore, repo: string, humanId: string, to: string, by: string): BacklogItem;
34
+ export declare function mergeItemsNode(store: GraphBacklogStore, repo: string, keepHumanId: string, dropHumanId: string, reason: string): Promise<BacklogItem>;
35
+ export declare function setPriorityNode(store: GraphBacklogStore, repo: string, humanId: string, priority: Priority): Promise<BacklogItem>;
36
+ export declare function attachToPlanNode(store: GraphBacklogStore, repo: string, humanId: string, planSlug: string): Promise<void>;
37
+ export declare function assignItemNode(store: GraphBacklogStore, repo: string, humanId: string, to: string, by: string): Promise<BacklogItem>;
36
38
  /**
37
39
  * BUG-BACKLOG-HUMANID-COLLISION-001 fix #3 (repair primitive): re-ids a
38
40
  * single, `nodeId`-scoped live backlog item to a new `humanId` within the
@@ -61,4 +63,4 @@ export declare function assignItemNode(store: GraphBacklogStore, repo: string, h
61
63
  * `buildNodeContent`) so the renamed node is indistinguishable from one
62
64
  * that was always minted under `newHumanId`.
63
65
  */
64
- export declare function renameHumanIdNode(store: GraphBacklogStore, repo: string, nodeId: number, oldHumanId: string, newHumanId: string): BacklogItem;
66
+ export declare function renameHumanIdNode(store: GraphBacklogStore, repo: string, nodeId: number, oldHumanId: string, newHumanId: string): Promise<BacklogItem>;