@izagood/avcs 0.1.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/LICENSE +201 -0
- package/README.md +221 -0
- package/dist/api/repo.d.ts +616 -0
- package/dist/api/repo.d.ts.map +1 -0
- package/dist/api/repo.js +1772 -0
- package/dist/api/repo.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +660 -0
- package/dist/cli.js.map +1 -0
- package/dist/concurrency/lease.d.ts +27 -0
- package/dist/concurrency/lease.d.ts.map +1 -0
- package/dist/concurrency/lease.js +63 -0
- package/dist/concurrency/lease.js.map +1 -0
- package/dist/core/canonical.d.ts +16 -0
- package/dist/core/canonical.d.ts.map +1 -0
- package/dist/core/canonical.js +66 -0
- package/dist/core/canonical.js.map +1 -0
- package/dist/core/cbor.d.ts +9 -0
- package/dist/core/cbor.d.ts.map +1 -0
- package/dist/core/cbor.js +213 -0
- package/dist/core/cbor.js.map +1 -0
- package/dist/core/clock.d.ts +18 -0
- package/dist/core/clock.d.ts.map +1 -0
- package/dist/core/clock.js +32 -0
- package/dist/core/clock.js.map +1 -0
- package/dist/core/identity.d.ts +34 -0
- package/dist/core/identity.d.ts.map +1 -0
- package/dist/core/identity.js +62 -0
- package/dist/core/identity.js.map +1 -0
- package/dist/hub/hubClient.d.ts +38 -0
- package/dist/hub/hubClient.d.ts.map +1 -0
- package/dist/hub/hubClient.js +157 -0
- package/dist/hub/hubClient.js.map +1 -0
- package/dist/hub/hubServer.d.ts +28 -0
- package/dist/hub/hubServer.d.ts.map +1 -0
- package/dist/hub/hubServer.js +365 -0
- package/dist/hub/hubServer.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/objects/types.d.ts +352 -0
- package/dist/objects/types.d.ts.map +1 -0
- package/dist/objects/types.js +17 -0
- package/dist/objects/types.js.map +1 -0
- package/dist/observe/logger.d.ts +27 -0
- package/dist/observe/logger.d.ts.map +1 -0
- package/dist/observe/logger.js +37 -0
- package/dist/observe/logger.js.map +1 -0
- package/dist/observe/metrics.d.ts +20 -0
- package/dist/observe/metrics.d.ts.map +1 -0
- package/dist/observe/metrics.js +42 -0
- package/dist/observe/metrics.js.map +1 -0
- package/dist/policy/owners.d.ts +5 -0
- package/dist/policy/owners.d.ts.map +1 -0
- package/dist/policy/owners.js +38 -0
- package/dist/policy/owners.js.map +1 -0
- package/dist/policy/reliability.d.ts +7 -0
- package/dist/policy/reliability.d.ts.map +1 -0
- package/dist/policy/reliability.js +41 -0
- package/dist/policy/reliability.js.map +1 -0
- package/dist/query/diff.d.ts +16 -0
- package/dist/query/diff.d.ts.map +1 -0
- package/dist/query/diff.js +32 -0
- package/dist/query/diff.js.map +1 -0
- package/dist/reducer/incremental.d.ts +2 -0
- package/dist/reducer/incremental.d.ts.map +1 -0
- package/dist/reducer/incremental.js +14 -0
- package/dist/reducer/incremental.js.map +1 -0
- package/dist/reducer/policy.d.ts +17 -0
- package/dist/reducer/policy.d.ts.map +1 -0
- package/dist/reducer/policy.js +143 -0
- package/dist/reducer/policy.js.map +1 -0
- package/dist/reducer/reducer.d.ts +155 -0
- package/dist/reducer/reducer.d.ts.map +1 -0
- package/dist/reducer/reducer.js +849 -0
- package/dist/reducer/reducer.js.map +1 -0
- package/dist/release/sbom.d.ts +7 -0
- package/dist/release/sbom.d.ts.map +1 -0
- package/dist/release/sbom.js +26 -0
- package/dist/release/sbom.js.map +1 -0
- package/dist/semantic/contract.d.ts +32 -0
- package/dist/semantic/contract.d.ts.map +1 -0
- package/dist/semantic/contract.js +150 -0
- package/dist/semantic/contract.js.map +1 -0
- package/dist/semantic/symbols.d.ts +45 -0
- package/dist/semantic/symbols.d.ts.map +1 -0
- package/dist/semantic/symbols.js +323 -0
- package/dist/semantic/symbols.js.map +1 -0
- package/dist/store/applyRedactions.d.ts +16 -0
- package/dist/store/applyRedactions.d.ts.map +1 -0
- package/dist/store/applyRedactions.js +60 -0
- package/dist/store/applyRedactions.js.map +1 -0
- package/dist/store/lock.d.ts +12 -0
- package/dist/store/lock.d.ts.map +1 -0
- package/dist/store/lock.js +63 -0
- package/dist/store/lock.js.map +1 -0
- package/dist/store/objectStore.d.ts +127 -0
- package/dist/store/objectStore.d.ts.map +1 -0
- package/dist/store/objectStore.js +549 -0
- package/dist/store/objectStore.js.map +1 -0
- package/dist/validation/repair.d.ts +31 -0
- package/dist/validation/repair.d.ts.map +1 -0
- package/dist/validation/repair.js +37 -0
- package/dist/validation/repair.js.map +1 -0
- package/dist/validation/runner.d.ts +20 -0
- package/dist/validation/runner.d.ts.map +1 -0
- package/dist/validation/runner.js +90 -0
- package/dist/validation/runner.js.map +1 -0
- package/package.json +83 -0
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
export type ObjectType = "blob" | "intent" | "session" | "operation" | "evidence" | "decision" | "checkpoint" | "view" | "policy" | "lease" | "release" | "line" | "membership" | "protection" | "promotion" | "redaction" | "override" | "approval";
|
|
2
|
+
/** ed25519 signature over an object's oid. Excluded from the oid hash. */
|
|
3
|
+
export interface Signature {
|
|
4
|
+
keyId: string;
|
|
5
|
+
alg: "ed25519";
|
|
6
|
+
sig: string;
|
|
7
|
+
}
|
|
8
|
+
export interface BaseObject {
|
|
9
|
+
type: ObjectType;
|
|
10
|
+
/** Content address. Filled in by the store on write; absent while building. */
|
|
11
|
+
oid?: string;
|
|
12
|
+
/** Optional signature by the producing actor over this object's oid (Phase 3). */
|
|
13
|
+
sig?: Signature;
|
|
14
|
+
}
|
|
15
|
+
export type ActorKind = "human" | "ai_agent" | "ci_bot";
|
|
16
|
+
export interface Actor {
|
|
17
|
+
kind: ActorKind;
|
|
18
|
+
/** Stable id, e.g. "human:jinbin" or "ai:claude-code". */
|
|
19
|
+
id: string;
|
|
20
|
+
/** For ai_agent: model identifier. */
|
|
21
|
+
model?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface Blob extends BaseObject {
|
|
24
|
+
type: "blob";
|
|
25
|
+
/** Base64 of the raw bytes (empty for a chunked manifest). */
|
|
26
|
+
data: string;
|
|
27
|
+
encoding: "base64";
|
|
28
|
+
/**
|
|
29
|
+
* Phase 9b: a large blob is split into chunk blobs and stored as a manifest
|
|
30
|
+
* (data="", chunked=true, chunks=[oids]). Identical chunks dedup by oid, and
|
|
31
|
+
* reads stream chunk-by-chunk instead of inflating one huge JSON object.
|
|
32
|
+
*/
|
|
33
|
+
chunked?: boolean;
|
|
34
|
+
chunks?: string[];
|
|
35
|
+
/** Phase 12: set once a Redaction evicted the original bytes (oid preserved). */
|
|
36
|
+
redacted?: boolean;
|
|
37
|
+
redactionOid?: string;
|
|
38
|
+
}
|
|
39
|
+
export type IntentKind = "feature" | "bugfix" | "refactor" | "formatting" | "generated";
|
|
40
|
+
/** A symbol/file/glob scope the intent is allowed to touch. */
|
|
41
|
+
export type ScopeRef = string;
|
|
42
|
+
/** Machine-checkable invariants. `constraints` (NL) is human prose; these are enforced. */
|
|
43
|
+
export type ConstraintKind = "forbid_public_api_break" | "forbid_behavior_change" | "require_tests";
|
|
44
|
+
export interface Intent extends BaseObject {
|
|
45
|
+
type: "intent";
|
|
46
|
+
title: string;
|
|
47
|
+
owner: string;
|
|
48
|
+
kind: IntentKind;
|
|
49
|
+
priority: "low" | "normal" | "high" | "critical";
|
|
50
|
+
constraints: string[];
|
|
51
|
+
/** Structured, enforced invariants. Take precedence over NL `constraints`. */
|
|
52
|
+
constraintKinds?: ConstraintKind[];
|
|
53
|
+
successCriteria: string[];
|
|
54
|
+
allowedScopes: ScopeRef[];
|
|
55
|
+
createdAt: string;
|
|
56
|
+
}
|
|
57
|
+
export interface Session extends BaseObject {
|
|
58
|
+
type: "session";
|
|
59
|
+
intentOid: string;
|
|
60
|
+
actor: Actor;
|
|
61
|
+
baseViewOid: string | null;
|
|
62
|
+
/** Distilled, redaction-safe context. Raw transcripts live out of band. */
|
|
63
|
+
summary: string;
|
|
64
|
+
openedEntities: ScopeRef[];
|
|
65
|
+
toolCalls: string[];
|
|
66
|
+
startedAt: string;
|
|
67
|
+
}
|
|
68
|
+
export type OperationKind = "put_file" | "delete_file" | "rename_file" | "set_symbol" | "rename_symbol" | "move_symbol" | "note";
|
|
69
|
+
export interface OperationTarget {
|
|
70
|
+
/** What conceptual entity this op changes. */
|
|
71
|
+
entityKind: "file" | "symbol" | "contract" | "config" | "test";
|
|
72
|
+
/** Stable entity id. file: the path. symbol: `<path>#<symbolName>`. */
|
|
73
|
+
entityId: string;
|
|
74
|
+
}
|
|
75
|
+
export interface OperationBody {
|
|
76
|
+
kind: OperationKind;
|
|
77
|
+
/** put_file / rename_file / set_symbol destination path. */
|
|
78
|
+
path?: string;
|
|
79
|
+
/** rename_file source path. */
|
|
80
|
+
fromPath?: string;
|
|
81
|
+
/** put_file content, or set_symbol's new symbol text. */
|
|
82
|
+
blobOid?: string;
|
|
83
|
+
/** set_symbol / rename_symbol: the top-level symbol name (the OLD name for rename). */
|
|
84
|
+
symbolName?: string;
|
|
85
|
+
/** rename_symbol: the new symbol name. */
|
|
86
|
+
newName?: string;
|
|
87
|
+
}
|
|
88
|
+
export interface Operation extends BaseObject {
|
|
89
|
+
type: "operation";
|
|
90
|
+
sessionOid: string;
|
|
91
|
+
intentOid: string;
|
|
92
|
+
actor: Actor;
|
|
93
|
+
target: OperationTarget;
|
|
94
|
+
body: OperationBody;
|
|
95
|
+
/** Direct causal predecessors (this op was authored "after" seeing these). */
|
|
96
|
+
causalDeps: string[];
|
|
97
|
+
/** Human/agent statement of purpose for this single op. */
|
|
98
|
+
declaredPurpose: string;
|
|
99
|
+
/** Declared reads/effects — used by the semantic-conflict detector. */
|
|
100
|
+
effects?: {
|
|
101
|
+
reads?: ScopeRef[];
|
|
102
|
+
changesBehavior?: boolean;
|
|
103
|
+
breaksPublicApi?: boolean;
|
|
104
|
+
};
|
|
105
|
+
/** Lamport time for deterministic tie-break of concurrent ops. */
|
|
106
|
+
lamport: number;
|
|
107
|
+
createdAt: string;
|
|
108
|
+
/** Self-reported confidence; advisory, never authoritative. */
|
|
109
|
+
confidence?: number;
|
|
110
|
+
/**
|
|
111
|
+
* Lineage (Phase 8). Which line this op was authored on; absent ⇒ "main". A line
|
|
112
|
+
* materializes only its own ops + everything inherited from its fork checkpoint, so
|
|
113
|
+
* two lines can hold intentionally different content on the same entity without
|
|
114
|
+
* contending. See docs/09 G1.
|
|
115
|
+
*/
|
|
116
|
+
line?: string;
|
|
117
|
+
/** Provenance for a ported/backported/cherry-picked op: the source op's oid. */
|
|
118
|
+
derivedFrom?: string;
|
|
119
|
+
/** The op this one reverts (forward-only inverse). */
|
|
120
|
+
revertOf?: string;
|
|
121
|
+
/** Additional authors (git Co-authored-by). The signing `actor` stays single. */
|
|
122
|
+
coAuthors?: Actor[];
|
|
123
|
+
/** Stash: kept local — excluded from gossip/pull until promoted to shared. */
|
|
124
|
+
private?: boolean;
|
|
125
|
+
}
|
|
126
|
+
export type OperationStatus = "proposed" | "validating" | "accepted" | "rejected" | "superseded" | "needs_decision" | "quarantined";
|
|
127
|
+
export type EvidenceKind = "parse" | "typecheck" | "lint" | "unit_test" | "integration_test" | "benchmark" | "security_scan" | "api_compat";
|
|
128
|
+
export type EvidenceResult = "pass" | "fail" | "partial" | "not_run";
|
|
129
|
+
export interface Evidence extends BaseObject {
|
|
130
|
+
type: "evidence";
|
|
131
|
+
forOps: string[];
|
|
132
|
+
kind: EvidenceKind;
|
|
133
|
+
result: EvidenceResult;
|
|
134
|
+
command?: string;
|
|
135
|
+
detail?: string;
|
|
136
|
+
producedBy: Actor;
|
|
137
|
+
createdAt: string;
|
|
138
|
+
/**
|
|
139
|
+
* Phase 11: produced by a secret-less, network-isolated runner over untrusted code.
|
|
140
|
+
* Such evidence is NOT trusted for the policy gate (you must re-run in the trusted
|
|
141
|
+
* lane after promotion) — it's the pull_request_target hazard guard.
|
|
142
|
+
*/
|
|
143
|
+
fromUntrustedRunner?: boolean;
|
|
144
|
+
}
|
|
145
|
+
export interface Decision extends BaseObject {
|
|
146
|
+
type: "decision";
|
|
147
|
+
conflictId: string;
|
|
148
|
+
chosenOps: string[];
|
|
149
|
+
rejectedOps: string[];
|
|
150
|
+
reason: string;
|
|
151
|
+
decidedBy: Actor;
|
|
152
|
+
/** Optional reusable rule distilled from this decision. */
|
|
153
|
+
futurePolicy?: string;
|
|
154
|
+
createdAt: string;
|
|
155
|
+
}
|
|
156
|
+
export interface ViewQuery {
|
|
157
|
+
/** Only ops in these statuses are candidates (post-reduction). */
|
|
158
|
+
includeStatuses: OperationStatus[];
|
|
159
|
+
/** Restrict to these intents (empty = all). */
|
|
160
|
+
intentOids?: string[];
|
|
161
|
+
/** Restrict to these sessions (empty = all). */
|
|
162
|
+
sessionOids?: string[];
|
|
163
|
+
/** Hard-exclude specific ops. */
|
|
164
|
+
excludeOps?: string[];
|
|
165
|
+
/** Lineage (Phase 8): which line to materialize. Absent ⇒ "main". */
|
|
166
|
+
line?: string;
|
|
167
|
+
}
|
|
168
|
+
export interface View extends BaseObject {
|
|
169
|
+
type: "view";
|
|
170
|
+
name: string;
|
|
171
|
+
baseViewOid: string | null;
|
|
172
|
+
query: ViewQuery;
|
|
173
|
+
createdAt: string;
|
|
174
|
+
}
|
|
175
|
+
export interface Checkpoint extends BaseObject {
|
|
176
|
+
type: "checkpoint";
|
|
177
|
+
viewOid: string;
|
|
178
|
+
/** Frontier operation ids that define this state. */
|
|
179
|
+
headOps: string[];
|
|
180
|
+
treeHash: string;
|
|
181
|
+
policyOid: string;
|
|
182
|
+
materializerVersion: string;
|
|
183
|
+
evidence: Partial<Record<EvidenceKind, EvidenceResult>>;
|
|
184
|
+
status: "draft" | "verified" | "released";
|
|
185
|
+
summary: string;
|
|
186
|
+
createdAt: string;
|
|
187
|
+
}
|
|
188
|
+
export interface PolicyRule {
|
|
189
|
+
name: string;
|
|
190
|
+
/** Coarse trigger; the engine matches these against each conflict/op. */
|
|
191
|
+
when: {
|
|
192
|
+
opKind?: OperationKind;
|
|
193
|
+
breaksPublicApi?: boolean;
|
|
194
|
+
changesBehavior?: boolean;
|
|
195
|
+
onConflict?: boolean;
|
|
196
|
+
};
|
|
197
|
+
/** Effect on priority/decision. */
|
|
198
|
+
effect: {
|
|
199
|
+
type: "require_human";
|
|
200
|
+
} | {
|
|
201
|
+
type: "require_evidence";
|
|
202
|
+
evidence: EvidenceKind;
|
|
203
|
+
result: EvidenceResult;
|
|
204
|
+
} | {
|
|
205
|
+
type: "priority";
|
|
206
|
+
weight: number;
|
|
207
|
+
} | {
|
|
208
|
+
type: "prefer_actor";
|
|
209
|
+
kind: ActorKind;
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
/** Maps a scope pattern to the actor ids that must approve changes there (Phase 5). */
|
|
213
|
+
export interface OwnerRule {
|
|
214
|
+
scope: ScopeRef;
|
|
215
|
+
owners: string[];
|
|
216
|
+
}
|
|
217
|
+
export interface Policy extends BaseObject {
|
|
218
|
+
type: "policy";
|
|
219
|
+
version: string;
|
|
220
|
+
/** Ordered actor trust ladder (higher index = more trusted). */
|
|
221
|
+
actorTrust: ActorKind[];
|
|
222
|
+
rules: PolicyRule[];
|
|
223
|
+
/** Code ownership: who must sign off on changes to which scopes. */
|
|
224
|
+
owners?: OwnerRule[];
|
|
225
|
+
createdAt: string;
|
|
226
|
+
}
|
|
227
|
+
export interface WorkLease extends BaseObject {
|
|
228
|
+
type: "lease";
|
|
229
|
+
intentOid: string;
|
|
230
|
+
sessionOid: string;
|
|
231
|
+
actor: Actor;
|
|
232
|
+
/** Scopes this lease reserves for writing, e.g. "symbol:mod.ts#alpha", "file:a.ts". */
|
|
233
|
+
writeScopes: ScopeRef[];
|
|
234
|
+
mode: "exclusive" | "shared";
|
|
235
|
+
acquiredAt: string;
|
|
236
|
+
expiresAt: string;
|
|
237
|
+
/** Set when explicitly released before expiry. */
|
|
238
|
+
releasedAt?: string;
|
|
239
|
+
}
|
|
240
|
+
export interface SbomComponent {
|
|
241
|
+
type: "file" | "library";
|
|
242
|
+
name: string;
|
|
243
|
+
version?: string;
|
|
244
|
+
/** sha256 of the file content, for "file" components. */
|
|
245
|
+
hash?: string;
|
|
246
|
+
}
|
|
247
|
+
export interface Sbom {
|
|
248
|
+
bomFormat: "CycloneDX";
|
|
249
|
+
specVersion: string;
|
|
250
|
+
components: SbomComponent[];
|
|
251
|
+
}
|
|
252
|
+
/** A built artifact tied to this release (container image, bundle, firmware…). */
|
|
253
|
+
export interface ArtifactRef {
|
|
254
|
+
type: string;
|
|
255
|
+
ref: string;
|
|
256
|
+
digest?: string;
|
|
257
|
+
}
|
|
258
|
+
export interface Release extends BaseObject {
|
|
259
|
+
type: "release";
|
|
260
|
+
checkpointOid: string;
|
|
261
|
+
treeHash: string;
|
|
262
|
+
sbom: Sbom;
|
|
263
|
+
artifacts: ArtifactRef[];
|
|
264
|
+
/** Aggregated evidence of the verified checkpoint. */
|
|
265
|
+
evidence: Partial<Record<EvidenceKind, EvidenceResult>>;
|
|
266
|
+
/** Actor ids that signed off on this release. */
|
|
267
|
+
signedBy: string[];
|
|
268
|
+
status: "draft" | "released";
|
|
269
|
+
/** Semantic version + support lifecycle (Phase 6 follow-up). */
|
|
270
|
+
version?: string;
|
|
271
|
+
supportStatus?: "supported" | "maintenance" | "eol";
|
|
272
|
+
createdAt: string;
|
|
273
|
+
}
|
|
274
|
+
export interface Line extends BaseObject {
|
|
275
|
+
type: "line";
|
|
276
|
+
name: string;
|
|
277
|
+
baseLine: string | null;
|
|
278
|
+
forkCheckpointOid: string | null;
|
|
279
|
+
createdAt: string;
|
|
280
|
+
}
|
|
281
|
+
export type RoleName = "reader" | "proposer" | "reviewer" | "maintainer" | "admin";
|
|
282
|
+
/** Root-signed membership: federates trust and grants a role. See docs/08. */
|
|
283
|
+
export interface Membership extends BaseObject {
|
|
284
|
+
type: "membership";
|
|
285
|
+
actorId: string;
|
|
286
|
+
publicKey: string;
|
|
287
|
+
role: RoleName;
|
|
288
|
+
scopes?: ScopeRef[];
|
|
289
|
+
issuedBy: string;
|
|
290
|
+
createdAt: string;
|
|
291
|
+
revokedAt?: string;
|
|
292
|
+
}
|
|
293
|
+
/** Branch-protection-equivalent rule on a protected view. */
|
|
294
|
+
export interface Protection extends BaseObject {
|
|
295
|
+
type: "protection";
|
|
296
|
+
view: string;
|
|
297
|
+
requiredApprovals: number;
|
|
298
|
+
requireOwnerApproval: boolean;
|
|
299
|
+
requiredChecks: EvidenceKind[];
|
|
300
|
+
finalizeRole: "maintainer" | "admin";
|
|
301
|
+
requireSignedOps: boolean;
|
|
302
|
+
requireUpToDate: boolean;
|
|
303
|
+
allowForcePush: boolean;
|
|
304
|
+
createdAt: string;
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Phase 11: a reviewer's promotion of quarantined (outsider) ops into the normal
|
|
308
|
+
* accepted flow — the GitHub "maintainer accepts a fork PR" moment.
|
|
309
|
+
*/
|
|
310
|
+
export interface Promotion extends BaseObject {
|
|
311
|
+
type: "promotion";
|
|
312
|
+
ops: string[];
|
|
313
|
+
by: string;
|
|
314
|
+
reason?: string;
|
|
315
|
+
createdAt: string;
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* Admin-signed tombstone that evicts a blob's bytes (e.g. a leaked secret) while
|
|
319
|
+
* preserving its oid — so the Merkle DAG, causalDeps, and treeHash references stay
|
|
320
|
+
* valid and verifiable, but the plaintext is gone from every replica. GitHub's
|
|
321
|
+
* secret-purge/BFG analog for an append-only, content-addressed store.
|
|
322
|
+
*/
|
|
323
|
+
export interface Redaction extends BaseObject {
|
|
324
|
+
type: "redaction";
|
|
325
|
+
blobOid: string;
|
|
326
|
+
sha256: string;
|
|
327
|
+
length: number;
|
|
328
|
+
reason: string;
|
|
329
|
+
by: string;
|
|
330
|
+
createdAt: string;
|
|
331
|
+
}
|
|
332
|
+
/** A reviewer's sign-off on a checkpoint (= PR approve). Gates finalize. */
|
|
333
|
+
export interface Approval extends BaseObject {
|
|
334
|
+
type: "approval";
|
|
335
|
+
checkpointOid: string;
|
|
336
|
+
by: string;
|
|
337
|
+
verdict: "approve" | "request_changes";
|
|
338
|
+
reason?: string;
|
|
339
|
+
createdAt: string;
|
|
340
|
+
}
|
|
341
|
+
/** Break-glass: a signed, EXPIRING waiver of specific required checks for a view. */
|
|
342
|
+
export interface Override extends BaseObject {
|
|
343
|
+
type: "override";
|
|
344
|
+
view: string;
|
|
345
|
+
waiveChecks: EvidenceKind[];
|
|
346
|
+
reason: string;
|
|
347
|
+
by: string;
|
|
348
|
+
expiresAt: string;
|
|
349
|
+
createdAt: string;
|
|
350
|
+
}
|
|
351
|
+
export type AnyObject = Blob | Intent | Session | Operation | Evidence | Decision | View | Checkpoint | Policy | WorkLease | Release | Line | Membership | Protection | Promotion | Redaction | Override | Approval;
|
|
352
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/objects/types.ts"],"names":[],"mappings":"AAgBA,MAAM,MAAM,UAAU,GAClB,MAAM,GACN,QAAQ,GACR,SAAS,GACT,WAAW,GACX,UAAU,GACV,UAAU,GACV,YAAY,GACZ,MAAM,GACN,QAAQ,GACR,OAAO,GACP,SAAS,GACT,MAAM,GACN,YAAY,GACZ,YAAY,GACZ,WAAW,GACX,WAAW,GACX,UAAU,GACV,UAAU,CAAC;AAEf,0EAA0E;AAC1E,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,SAAS,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,UAAU,CAAC;IACjB,+EAA+E;IAC/E,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,kFAAkF;IAClF,GAAG,CAAC,EAAE,SAAS,CAAC;CACjB;AAGD,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,UAAU,GAAG,QAAQ,CAAC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AM,EAAE,MAAM,CAAC;IACf,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,4EAA4E;AAC5E,MAAM,WAAW,QAAS,SAAQ,UAAU;IAC1C,IAAI,EAAE,UAAU,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,SAAS,GAAG,iBAAiB,CAAC;IACvC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,qFAAqF;AACrF,MAAM,WAAW,QAAS,SAAQ,UAAU;IAC1C,IAAI,EAAE,UAAU,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,YAAY,EAAE,CAAC;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,MAAM,SAAS,GACjB,IAAI,GACJ,MAAM,GACN,OAAO,GACP,SAAS,GACT,QAAQ,GACR,QAAQ,GACR,IAAI,GACJ,UAAU,GACV,MAAM,GACN,SAAS,GACT,OAAO,GACP,IAAI,GACJ,UAAU,GACV,UAAU,GACV,SAAS,GACT,SAAS,GACT,QAAQ,GACR,QAAQ,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// The AVCS object model.
|
|
2
|
+
//
|
|
3
|
+
// Everything that matters is a content-addressed, append-only object. Code is NOT
|
|
4
|
+
// stored as commits; it is a *projection* computed from the operation graph. The
|
|
5
|
+
// seven first-class object kinds:
|
|
6
|
+
//
|
|
7
|
+
// intent — why a change is being made (goal + constraints + scope)
|
|
8
|
+
// session — an agent/human work episode against an intent
|
|
9
|
+
// operation — a single semantic change unit (the real history)
|
|
10
|
+
// evidence — machine-checkable proof attached to operations
|
|
11
|
+
// decision — a recorded resolution of a conflict / design choice
|
|
12
|
+
// checkpoint — a verified (ops + policy + materializer) state vector
|
|
13
|
+
// view — a query over the operation graph (replaces branches)
|
|
14
|
+
//
|
|
15
|
+
// Plus `blob` for raw content and `policy` for the merge rules.
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/objects/types.ts"],"names":[],"mappings":"AAAA,yBAAyB;AACzB,EAAE;AACF,kFAAkF;AAClF,iFAAiF;AACjF,kCAAkC;AAClC,EAAE;AACF,yEAAyE;AACzE,+DAA+D;AAC/D,kEAAkE;AAClE,gEAAgE;AAChE,qEAAqE;AACrE,uEAAuE;AACvE,sEAAsE;AACtE,EAAE;AACF,gEAAgE"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export type LogLevel = "debug" | "info" | "warn" | "error";
|
|
2
|
+
export interface LogEntry {
|
|
3
|
+
ts: string;
|
|
4
|
+
level: LogLevel;
|
|
5
|
+
event: string;
|
|
6
|
+
[field: string]: unknown;
|
|
7
|
+
}
|
|
8
|
+
export declare class Logger {
|
|
9
|
+
#private;
|
|
10
|
+
constructor(opts?: {
|
|
11
|
+
sink?: (e: LogEntry) => void;
|
|
12
|
+
level?: LogLevel;
|
|
13
|
+
base?: Record<string, unknown>;
|
|
14
|
+
});
|
|
15
|
+
log(level: LogLevel, event: string, fields?: Record<string, unknown>): void;
|
|
16
|
+
debug(event: string, fields?: Record<string, unknown>): void;
|
|
17
|
+
info(event: string, fields?: Record<string, unknown>): void;
|
|
18
|
+
warn(event: string, fields?: Record<string, unknown>): void;
|
|
19
|
+
error(event: string, fields?: Record<string, unknown>): void;
|
|
20
|
+
/** A logger that adds `fields` to every entry (request/actor context). */
|
|
21
|
+
child(fields: Record<string, unknown>): Logger;
|
|
22
|
+
}
|
|
23
|
+
/** Silent (default for libraries/tests). */
|
|
24
|
+
export declare function silentLogger(): Logger;
|
|
25
|
+
/** Emit one JSON object per line to stderr (default for CLI/servers). */
|
|
26
|
+
export declare function consoleLogger(level?: LogLevel): Logger;
|
|
27
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/observe/logger.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAC3D,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,QAAQ,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;CAC1B;AAID,qBAAa,MAAM;;gBAKL,IAAI,GAAE;QAAE,IAAI,CAAC,EAAE,CAAC,CAAC,EAAE,QAAQ,KAAK,IAAI,CAAC;QAAC,KAAK,CAAC,EAAE,QAAQ,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAO;IAMzG,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GAAG,IAAI;IAI/E,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAC5D,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAC3D,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAC3D,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAE5D,0EAA0E;IAC1E,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM;CAI/C;AAED,4CAA4C;AAC5C,wBAAgB,YAAY,IAAI,MAAM,CAErC;AACD,yEAAyE;AACzE,wBAAgB,aAAa,CAAC,KAAK,GAAE,QAAiB,GAAG,MAAM,CAE9D"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// Structured logging (docs/10 WS-F). JSON entries with a level + event + fields, sent
|
|
2
|
+
// to a pluggable sink. Production wires a console/OTel sink at the entry point (CLI/
|
|
3
|
+
// hub/MCP); the Repo defaults to silent so the test suite stays quiet.
|
|
4
|
+
const ORDER = { debug: 0, info: 1, warn: 2, error: 3 };
|
|
5
|
+
export class Logger {
|
|
6
|
+
#sink;
|
|
7
|
+
#min;
|
|
8
|
+
#base;
|
|
9
|
+
constructor(opts = {}) {
|
|
10
|
+
this.#sink = opts.sink ?? (() => { });
|
|
11
|
+
this.#min = ORDER[opts.level ?? "info"];
|
|
12
|
+
this.#base = opts.base ?? {};
|
|
13
|
+
}
|
|
14
|
+
log(level, event, fields = {}) {
|
|
15
|
+
if (ORDER[level] < this.#min)
|
|
16
|
+
return;
|
|
17
|
+
this.#sink({ ts: new Date().toISOString(), level, event, ...this.#base, ...fields });
|
|
18
|
+
}
|
|
19
|
+
debug(event, fields) { this.log("debug", event, fields); }
|
|
20
|
+
info(event, fields) { this.log("info", event, fields); }
|
|
21
|
+
warn(event, fields) { this.log("warn", event, fields); }
|
|
22
|
+
error(event, fields) { this.log("error", event, fields); }
|
|
23
|
+
/** A logger that adds `fields` to every entry (request/actor context). */
|
|
24
|
+
child(fields) {
|
|
25
|
+
const c = new Logger({ sink: this.#sink, base: { ...this.#base, ...fields } });
|
|
26
|
+
return c;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/** Silent (default for libraries/tests). */
|
|
30
|
+
export function silentLogger() {
|
|
31
|
+
return new Logger();
|
|
32
|
+
}
|
|
33
|
+
/** Emit one JSON object per line to stderr (default for CLI/servers). */
|
|
34
|
+
export function consoleLogger(level = "info") {
|
|
35
|
+
return new Logger({ level, sink: (e) => process.stderr.write(JSON.stringify(e) + "\n") });
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/observe/logger.ts"],"names":[],"mappings":"AAAA,sFAAsF;AACtF,qFAAqF;AACrF,uEAAuE;AAUvE,MAAM,KAAK,GAA6B,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;AAEjF,MAAM,OAAO,MAAM;IACjB,KAAK,CAAwB;IAC7B,IAAI,CAAS;IACb,KAAK,CAA0B;IAE/B,YAAY,OAA2F,EAAE;QACvG,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,IAAI,IAAI,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;QACrC,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,IAAI,MAAM,CAAC,CAAC;QACxC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC;IAC/B,CAAC;IAED,GAAG,CAAC,KAAe,EAAE,KAAa,EAAE,SAAkC,EAAE;QACtE,IAAI,KAAK,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,IAAI;YAAE,OAAO;QACrC,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,KAAK,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC;IACvF,CAAC;IACD,KAAK,CAAC,KAAa,EAAE,MAAgC,IAAU,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;IAClG,IAAI,CAAC,KAAa,EAAE,MAAgC,IAAU,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;IAChG,IAAI,CAAC,KAAa,EAAE,MAAgC,IAAU,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;IAChG,KAAK,CAAC,KAAa,EAAE,MAAgC,IAAU,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;IAElG,0EAA0E;IAC1E,KAAK,CAAC,MAA+B;QACnC,MAAM,CAAC,GAAG,IAAI,MAAM,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,GAAG,IAAI,CAAC,KAAK,EAAE,GAAG,MAAM,EAAE,EAAE,CAAC,CAAC;QAC/E,OAAO,CAAC,CAAC;IACX,CAAC;CACF;AAED,4CAA4C;AAC5C,MAAM,UAAU,YAAY;IAC1B,OAAO,IAAI,MAAM,EAAE,CAAC;AACtB,CAAC;AACD,yEAAyE;AACzE,MAAM,UAAU,aAAa,CAAC,QAAkB,MAAM;IACpD,OAAO,IAAI,MAAM,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC;AAC5F,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface Timing {
|
|
2
|
+
count: number;
|
|
3
|
+
totalMs: number;
|
|
4
|
+
maxMs: number;
|
|
5
|
+
}
|
|
6
|
+
export declare class Metrics {
|
|
7
|
+
#private;
|
|
8
|
+
inc(name: string, by?: number): void;
|
|
9
|
+
observe(name: string, ms: number): void;
|
|
10
|
+
/** Time an async operation, recording its duration under `name`. */
|
|
11
|
+
time<T>(name: string, fn: () => Promise<T>): Promise<T>;
|
|
12
|
+
snapshot(): {
|
|
13
|
+
counters: Record<string, number>;
|
|
14
|
+
timings: Record<string, Timing & {
|
|
15
|
+
avgMs: number;
|
|
16
|
+
}>;
|
|
17
|
+
};
|
|
18
|
+
reset(): void;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=metrics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metrics.d.ts","sourceRoot":"","sources":["../../src/observe/metrics.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,MAAM;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,qBAAa,OAAO;;IAIlB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,SAAI,GAAG,IAAI;IAI/B,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,IAAI;IAQvC,oEAAoE;IAC9D,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAS7D,QAAQ,IAAI;QAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG;YAAE,KAAK,EAAE,MAAM,CAAA;SAAE,CAAC,CAAA;KAAE;IAUrG,KAAK,IAAI,IAAI;CAId"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// Phase/M4 (docs/10 WS-F): minimal in-process metrics. Counters for events and
|
|
2
|
+
// timings for latencies, with a JSON snapshot for /metrics-style scraping or a CLI.
|
|
3
|
+
// No dependency, no I/O — production would forward `snapshot()` to Prometheus/OTel.
|
|
4
|
+
export class Metrics {
|
|
5
|
+
#counters = new Map();
|
|
6
|
+
#timings = new Map();
|
|
7
|
+
inc(name, by = 1) {
|
|
8
|
+
this.#counters.set(name, (this.#counters.get(name) ?? 0) + by);
|
|
9
|
+
}
|
|
10
|
+
observe(name, ms) {
|
|
11
|
+
const t = this.#timings.get(name) ?? { count: 0, totalMs: 0, maxMs: 0 };
|
|
12
|
+
t.count += 1;
|
|
13
|
+
t.totalMs += ms;
|
|
14
|
+
t.maxMs = Math.max(t.maxMs, ms);
|
|
15
|
+
this.#timings.set(name, t);
|
|
16
|
+
}
|
|
17
|
+
/** Time an async operation, recording its duration under `name`. */
|
|
18
|
+
async time(name, fn) {
|
|
19
|
+
const start = performance.now();
|
|
20
|
+
try {
|
|
21
|
+
return await fn();
|
|
22
|
+
}
|
|
23
|
+
finally {
|
|
24
|
+
this.observe(name, performance.now() - start);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
snapshot() {
|
|
28
|
+
const counters = {};
|
|
29
|
+
for (const [k, v] of [...this.#counters].sort())
|
|
30
|
+
counters[k] = v;
|
|
31
|
+
const timings = {};
|
|
32
|
+
for (const [k, t] of [...this.#timings].sort()) {
|
|
33
|
+
timings[k] = { ...t, avgMs: t.count ? t.totalMs / t.count : 0 };
|
|
34
|
+
}
|
|
35
|
+
return { counters, timings };
|
|
36
|
+
}
|
|
37
|
+
reset() {
|
|
38
|
+
this.#counters.clear();
|
|
39
|
+
this.#timings.clear();
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=metrics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metrics.js","sourceRoot":"","sources":["../../src/observe/metrics.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,oFAAoF;AACpF,oFAAoF;AAQpF,MAAM,OAAO,OAAO;IAClB,SAAS,GAAG,IAAI,GAAG,EAAkB,CAAC;IACtC,QAAQ,GAAG,IAAI,GAAG,EAAkB,C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C;QAC/D,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC;YAC/C,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAClE,CAAC;QACD,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;IAC/B,CAAC;IAED,KAAK;QACH,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;QACvB,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;IACxB,CAAC;CACF"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { OwnerRule } from "../objects/types.ts";
|
|
2
|
+
export type { OwnerRule };
|
|
3
|
+
/** The distinct owners responsible for a contended key, most specific rules first. */
|
|
4
|
+
export declare function ownersFor(key: string, rules: OwnerRule[]): string[];
|
|
5
|
+
//# sourceMappingURL=owners.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"owners.d.ts","sourceRoot":"","sources":["../../src/policy/owners.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,SAAS,EAAY,MAAM,qBAAqB,CAAC;AAC/D,YAAY,EAAE,SAAS,EAAE,CAAC;AAkB1B,sFAAsF;AACtF,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,MAAM,EAAE,CAQnE"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// Phase 5: code ownership.
|
|
2
|
+
//
|
|
3
|
+
// A `require_human` decision shouldn't go to "any human" — public-API and schema
|
|
4
|
+
// changes have *owners*. Owner rules map a scope pattern to the actor ids that must
|
|
5
|
+
// sign off, so the conflict queue can route a break to the right person instead of
|
|
6
|
+
// a generic prompt.
|
|
7
|
+
function matches(rule, key) {
|
|
8
|
+
const pat = rule.replace(/\*+$/, "");
|
|
9
|
+
const isPrefix = rule.endsWith("*") || pat.endsWith("/");
|
|
10
|
+
if (pat === key)
|
|
11
|
+
return true;
|
|
12
|
+
if (isPrefix && key.startsWith(pat))
|
|
13
|
+
return true;
|
|
14
|
+
// A file scope also owns symbols within (or under) it: rewrite the symbol key to
|
|
15
|
+
// its file form and match again, so "file:src/api/" covers "symbol:src/api/x.ts#f".
|
|
16
|
+
if (pat.startsWith("file:") && key.startsWith("symbol:")) {
|
|
17
|
+
const symFile = key.slice("symbol:".length).split("#")[0] ?? "";
|
|
18
|
+
const fileScope = `file:${symFile}`;
|
|
19
|
+
if (pat === fileScope)
|
|
20
|
+
return true;
|
|
21
|
+
if (isPrefix && fileScope.startsWith(pat))
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
/** The distinct owners responsible for a contended key, most specific rules first. */
|
|
27
|
+
export function ownersFor(key, rules) {
|
|
28
|
+
const hits = rules
|
|
29
|
+
.filter((r) => matches(r.scope, key))
|
|
30
|
+
// longer (more specific) scope patterns win ordering
|
|
31
|
+
.sort((a, b) => b.scope.length - a.scope.length);
|
|
32
|
+
const seen = new Set();
|
|
33
|
+
for (const h of hits)
|
|
34
|
+
for (const o of h.owners)
|
|
35
|
+
seen.add(o);
|
|
36
|
+
return [...seen];
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=owners.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"owners.js","sourceRoot":"","sources":["../../src/policy/owners.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,EAAE;AACF,iFAAiF;AACjF,oFAAoF;AACpF,mFAAmF;AACnF,oBAAoB;AAKpB,SAAS,OAAO,CAAC,IAAc,EAAE,GAAW;IAC1C,MAAM,GAAG,GAAG,IA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I,IAAI;QAAE,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM;YAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAC5D,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Decision, Evidence, Operation } from "../objects/types.ts";
|
|
2
|
+
/**
|
|
3
|
+
* actorId → reliability in [-CAP, CAP]. +1 per op with trusted passing evidence,
|
|
4
|
+
* −1 per op a human explicitly rejected. Trust-filter the evidence before passing.
|
|
5
|
+
*/
|
|
6
|
+
export declare function computeReliability(ops: Operation[], evidence: Evidence[], decisions: Decision[]): Map<string, number>;
|
|
7
|
+
//# sourceMappingURL=reliability.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reliability.d.ts","sourceRoot":"","sources":["../../src/policy/reliability.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAKzE;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,SAAS,EAAE,EAChB,QAAQ,EAAE,QAAQ,EAAE,EACpB,SAAS,EAAE,QAAQ,EAAE,GACpB,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAuBrB"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// Phase 5: actor trust learning.
|
|
2
|
+
//
|
|
3
|
+
// A fixed actorTrust ladder treats every AI agent the same forever. In practice an
|
|
4
|
+
// agent earns or loses standing: ops it produced that humans rejected, or that
|
|
5
|
+
// failed checks, should weigh less next time; ops with passing trusted evidence
|
|
6
|
+
// should weigh slightly more. This computes a bounded per-actor reliability signal
|
|
7
|
+
// from history (decisions + evidence) — acyclic, so it never feeds back into itself.
|
|
8
|
+
/** Bounded so it nudges ties without overpowering the policy ladder (cf. the C1 bug). */
|
|
9
|
+
const CAP = 3;
|
|
10
|
+
/**
|
|
11
|
+
* actorId → reliability in [-CAP, CAP]. +1 per op with trusted passing evidence,
|
|
12
|
+
* −1 per op a human explicitly rejected. Trust-filter the evidence before passing.
|
|
13
|
+
*/
|
|
14
|
+
export function computeReliability(ops, evidence, decisions) {
|
|
15
|
+
const opActor = new Map(ops.map((o) => [o.oid, o.actor.id]));
|
|
16
|
+
const raw = new Map();
|
|
17
|
+
const bump = (actor, d) => raw.set(actor, (raw.get(actor) ?? 0) + d);
|
|
18
|
+
for (const e of evidence) {
|
|
19
|
+
if (e.result !== "pass")
|
|
20
|
+
continue;
|
|
21
|
+
if (e.producedBy.kind === "ai_agent")
|
|
22
|
+
continue; // self-reports don't build trust
|
|
23
|
+
for (const op of e.forOps) {
|
|
24
|
+
const a = opActor.get(op);
|
|
25
|
+
if (a)
|
|
26
|
+
bump(a, 1);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
for (const d of decisions) {
|
|
30
|
+
for (const op of d.rejectedOps) {
|
|
31
|
+
const a = opActor.get(op);
|
|
32
|
+
if (a)
|
|
33
|
+
bump(a, -1);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
const clamped = new Map();
|
|
37
|
+
for (const [actor, v] of raw)
|
|
38
|
+
clamped.set(actor, Math.max(-CAP, Math.min(CAP, v)));
|
|
39
|
+
return clamped;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=reliability.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reliability.js","sourceRoot":"","sources":["../../src/policy/reliability.ts"],"names":[],"mappings":"AAAA,iCAAiC;AACjC,EAAE;AACF,mFAAmF;AACnF,+EAA+E;AAC/E,gFAAgF;AAChF,mFAAmF;AACnF,qFAAqF;AAIrF,yFAAyF;AACzF,MAAM,GAAG,GAAG,CAAC,CAAC;AAEd;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAChC,GAAgB,EAChB,QAAoB,EACpB,SAAqB;IAErB,MAAM,OAAO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