@cleocode/contracts 2026.5.101 → 2026.5.103

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.
@@ -0,0 +1,166 @@
1
+ /**
2
+ * Boundary Registry — SSoT for per-module Rust/TS layering decisions across cleocode.
3
+ *
4
+ * Every module (crate, package, harness adapter, archived target) declares a
5
+ * {@link BoundaryEntry} in {@link BOUNDARY_REGISTRY}. CI gates (lint-boundary-registry,
6
+ * lint-dual-implementation, perf-budget bench gate) validate the registry against
7
+ * filesystem reality and enforce declared budgets at build time.
8
+ *
9
+ * Intent is expressed along two axes: workload shape ({@link WorkloadIntent}) and
10
+ * quantitative {@link PerfBudget} / {@link SafetyBudget} thresholds. The pair derives
11
+ * the language choice mechanically — it is not an aesthetic call.
12
+ *
13
+ * The registry is **static-with-amendment**: declared at module creation; subsequent
14
+ * changes require an ADR amendment + PR. This data file is populated by T10197;
15
+ * gates land in T10198 / T10199.
16
+ *
17
+ * @see ADR-078 — Boundary Registry as SSoT for Rust/TS layering
18
+ * @see D010 — vendor worktrunk → crates/worktrunk-core (reference impl)
19
+ * @see Saga T10176 (SG-BOUNDARY-REGISTRY)
20
+ */
21
+ /**
22
+ * Workload shape declaration for a module. Derived from what the code DOES,
23
+ * not from what convention says it should look like.
24
+ *
25
+ * - `cpu-bound` — Hot path; Rust required (parsing, graph ops, vector math, FFI hot loops).
26
+ * - `io-coordination` — Event-loop-friendly orchestration; TS preferred (async I/O glue, fetch/DB orchestration).
27
+ * - `ffi-surface` — Multi-runtime consumers; Rust core + napi binding (publishable as a Rust lib).
28
+ * - `orchestration-glue` — TS-only (CLI dispatch, agent harness, lifecycle hooks).
29
+ * - `data-manifest` — TS-only zero-dep config or registry data (no logic).
30
+ * - `harness-adapter` — TS-only provider-specific glue (claude-code, gemini, openai bridges).
31
+ * - `frontend` — SvelteKit / browser code; TS always.
32
+ * - `scaffold-pending-consumer` — Rust impl exists but has no consumer yet; {@link BoundaryEntry.plannedConsumerEta} REQUIRED.
33
+ * - `migration-pending` — Currently lives here; destination declared in {@link BoundaryEntry.canonicalHome}.
34
+ * - `migrated-out` — Reference-only entry pointing to the new external canonical home.
35
+ *
36
+ * @see ADR-078 §"Two-axis intent system"
37
+ */
38
+ export type WorkloadIntent = 'cpu-bound' | 'io-coordination' | 'ffi-surface' | 'orchestration-glue' | 'data-manifest' | 'harness-adapter' | 'frontend' | 'scaffold-pending-consumer' | 'migration-pending' | 'migrated-out';
39
+ /**
40
+ * Throughput threshold expressed as a unit + value pair (e.g. `{ unit: 'ops/s', value: 5000 }`).
41
+ *
42
+ * @see PerfBudget.throughput_min
43
+ */
44
+ export interface ThroughputThreshold {
45
+ /** Throughput unit string (e.g. `'ops/s'`, `'bytes/s'`, `'rows/s'`). */
46
+ unit: string;
47
+ /** Minimum acceptable value in `unit`. CI fails if a measured bench is below this. */
48
+ value: number;
49
+ }
50
+ /**
51
+ * Declared performance ceiling for a module. CI perf-budget gate fails the build when a
52
+ * criterion bench measures p50/p99/throughput/memory/startup outside these thresholds.
53
+ * Each field is optional — modules declare only what they care about.
54
+ *
55
+ * A TS module exceeding its `latency_p50_ms` is auto-flagged as a Rust-port candidate.
56
+ *
57
+ * @see ADR-078 §"Two-axis intent system"
58
+ */
59
+ export interface PerfBudget {
60
+ /** Hard ceiling on median (p50) operation latency in milliseconds. */
61
+ latency_p50_ms?: number;
62
+ /** Hard ceiling on tail (p99) operation latency in milliseconds. */
63
+ latency_p99_ms?: number;
64
+ /** Minimum sustained throughput the module must meet. */
65
+ throughput_min?: ThroughputThreshold;
66
+ /** Hard ceiling on resident memory in megabytes. */
67
+ memory_max_mb?: number;
68
+ /** Hard ceiling on cold startup time in milliseconds. */
69
+ startup_max_ms?: number;
70
+ }
71
+ /**
72
+ * Declared safety posture for a module. Each axis is enforced by a corresponding lint
73
+ * or static-analysis gate (e.g. `cargo clippy -D clippy::panic` for `panic_unwind: 'forbidden'`).
74
+ *
75
+ * A Rust module whose `panic_unwind` is `'forbidden'` MUST NOT compile with any reachable
76
+ * `panic!()` / `unwrap()` / `expect()` outside test code.
77
+ *
78
+ * @see ADR-078 §"Two-axis intent system"
79
+ */
80
+ export interface SafetyBudget {
81
+ /**
82
+ * Whether the module may panic.
83
+ * - `'forbidden'` — no reachable panic in production code paths (enforced via clippy).
84
+ * - `'allowed-with-recovery'` — panics permitted IFF the caller installs a recovery boundary.
85
+ */
86
+ panic_unwind?: 'forbidden' | 'allowed-with-recovery';
87
+ /**
88
+ * Whether the module may escape its declared filesystem root.
89
+ * - `'forbidden'` — operations confined to the declared root (path-jail enforced).
90
+ * - `'allowed-with-justification'` — root escapes permitted with documented rationale + audit log.
91
+ */
92
+ root_escape?: 'forbidden' | 'allowed-with-justification';
93
+ /**
94
+ * Whether the module may originate outbound network traffic.
95
+ * - `'allowed'` — egress permitted.
96
+ * - `'sandbox-required'` — must run under a network-blocking sandbox in production.
97
+ */
98
+ network_egress?: 'allowed' | 'sandbox-required';
99
+ /**
100
+ * Whether the module may write outside its declared root.
101
+ * - `'forbidden'` — writes outside root are a hard error.
102
+ * - `'audited'` — writes permitted but must be appended to the audit log.
103
+ */
104
+ fs_writes_outside_root?: 'forbidden' | 'audited';
105
+ }
106
+ /**
107
+ * Declared canonical home for a module. Modules that don't live in cleocode (e.g.
108
+ * signaldock-* modules migrating to `/mnt/projects/signaldock/`, or signaldock-runtime
109
+ * at a standalone repo) appear in this registry ONLY as a reference pointer via the
110
+ * `{ external: string }` variant.
111
+ *
112
+ * @see ADR-078 §"Canonical homes recorded explicitly"
113
+ */
114
+ export type CanonicalHome = 'cleocode' | 'signaldock-monorepo' | 'signaldock-runtime-repo' | 'archived' | {
115
+ external: string;
116
+ };
117
+ /**
118
+ * One row in {@link BOUNDARY_REGISTRY}. Declares per-module Rust/TS layering intent,
119
+ * canonical home, and perf/safety budgets. CI gates derived from these rows reject
120
+ * orphan modules, modules whose implementation contradicts the declared `intent`,
121
+ * and dual implementations (Rust + TS shipping the same primitive).
122
+ *
123
+ * `plannedConsumerEta` is REQUIRED when `intent === 'scaffold-pending-consumer'`.
124
+ *
125
+ * @see ADR-078 §"Registry shape"
126
+ */
127
+ export interface BoundaryEntry {
128
+ /** Stable module identifier (e.g. `'worktree'`, `'cant'`, `'lafs'`). One word, kebab-case. */
129
+ module: string;
130
+ /** Declared workload intent — see {@link WorkloadIntent}. */
131
+ intent: WorkloadIntent;
132
+ /** Path to `crates/<X>-core` (if a Rust core exists). Relative to repo root. */
133
+ rustCore?: string;
134
+ /** Path to `crates/<X>-napi` (if a napi binding exists). Relative to repo root. */
135
+ napiBinding?: string;
136
+ /** Path to `packages/<X>` (if a TS wrapper / package exists). Relative to repo root. */
137
+ tsWrapper?: string;
138
+ /** Where the module canonically lives — see {@link CanonicalHome}. */
139
+ canonicalHome: CanonicalHome;
140
+ /** Declared performance ceiling — see {@link PerfBudget}. */
141
+ perfBudget: PerfBudget;
142
+ /** Declared safety posture — see {@link SafetyBudget}. */
143
+ safetyBudget: SafetyBudget;
144
+ /** ADR slugs that have touched this entry (e.g. `['adr-077-worktreeinclude', 'adr-078-boundary-registry']`). */
145
+ amendments: string[];
146
+ /** 1-3 sentence rationale for the per-module decision. Required even for migrated-out entries. */
147
+ rationale: string;
148
+ /** ISO date (YYYY-MM-DD). REQUIRED when `intent === 'scaffold-pending-consumer'`; ignored otherwise. */
149
+ plannedConsumerEta?: string;
150
+ }
151
+ /**
152
+ * Canonical Boundary Registry for cleocode. Skeleton shipped in T10196; populated
153
+ * with per-module entries by T10197 from the verified decision matrices
154
+ * (`sg-boundary-crates-decision-matrix` + `sg-boundary-packages-decision-matrix`).
155
+ * CI gates over this data ship in T10198 / T10199.
156
+ *
157
+ * Entry order: crates first (19 entries), then packages (20 entries). Within each
158
+ * group entries are alphabetical by `module` for diff-friendliness.
159
+ *
160
+ * Entries are added/modified ONLY via ADR amendment + PR per the static-with-amendment
161
+ * policy declared in ADR-078.
162
+ *
163
+ * @see ADR-078 — Boundary Registry as SSoT for Rust/TS layering
164
+ */
165
+ export declare const BOUNDARY_REGISTRY: readonly BoundaryEntry[];
166
+ //# sourceMappingURL=boundary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"boundary.d.ts","sourceRoot":"","sources":["../src/boundary.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAMH;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,cAAc,GACtB,WAAW,GACX,iBAAiB,GACjB,aAAa,GACb,oBAAoB,GACpB,eAAe,GACf,iBAAiB,GACjB,UAAU,GACV,2BAA2B,GAC3B,mBAAmB,GACnB,cAAc,CAAC;AAMnB;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC,wEAAwE;IACxE,IAAI,EAAE,MAAM,CAAC;IACb,sFAAsF;IACtF,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,UAAU;IACzB,sEAAsE;IACtE,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,oEAAoE;IACpE,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,yDAAyD;IACzD,cAAc,CAAC,EAAE,mBAAmB,CAAC;IACrC,oDAAoD;IACpD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,yDAAyD;IACzD,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAMD;;;;;;;;GAQG;AACH,MAAM,WAAW,YAAY;IAC3B;;;;OAIG;IACH,YAAY,CAAC,EAAE,WAAW,GAAG,uBAAuB,CAAC;IACrD;;;;OAIG;IACH,WAAW,CAAC,EAAE,WAAW,GAAG,4BAA4B,CAAC;IACzD;;;;OAIG;IACH,cAAc,CAAC,EAAE,SAAS,GAAG,kBAAkB,CAAC;IAChD;;;;OAIG;IACH,sBAAsB,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;CAClD;AAMD;;;;;;;GAOG;AACH,MAAM,MAAM,aAAa,GACrB,UAAU,GACV,qBAAqB,GACrB,yBAAyB,GACzB,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