@neurcode-ai/contracts 0.1.2 → 0.1.3

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.
Files changed (82) hide show
  1. package/dist/admission/framing.d.ts +38 -0
  2. package/dist/admission/framing.d.ts.map +1 -0
  3. package/dist/admission/framing.js +78 -0
  4. package/dist/admission/framing.js.map +1 -0
  5. package/dist/admission/index.d.ts +4 -0
  6. package/dist/admission/index.d.ts.map +1 -0
  7. package/dist/admission/index.js +37 -0
  8. package/dist/admission/index.js.map +1 -0
  9. package/dist/admission/privacy.d.ts +23 -0
  10. package/dist/admission/privacy.d.ts.map +1 -0
  11. package/dist/admission/privacy.js +99 -0
  12. package/dist/admission/privacy.js.map +1 -0
  13. package/dist/admission/schema.d.ts +277 -0
  14. package/dist/admission/schema.d.ts.map +1 -0
  15. package/dist/admission/schema.js +156 -0
  16. package/dist/admission/schema.js.map +1 -0
  17. package/dist/index.d.ts +91 -11
  18. package/dist/index.d.ts.map +1 -1
  19. package/dist/index.js +182 -17
  20. package/dist/index.js.map +1 -1
  21. package/dist/intelligence.d.ts +522 -0
  22. package/dist/intelligence.d.ts.map +1 -0
  23. package/dist/intelligence.js +5 -0
  24. package/dist/intelligence.js.map +1 -0
  25. package/dist/remediation/capabilities.d.ts +36 -0
  26. package/dist/remediation/capabilities.d.ts.map +1 -0
  27. package/dist/remediation/capabilities.js +7 -0
  28. package/dist/remediation/capabilities.js.map +1 -0
  29. package/dist/remediation/index.d.ts +5 -0
  30. package/dist/remediation/index.d.ts.map +1 -0
  31. package/dist/remediation/index.js +3 -0
  32. package/dist/remediation/index.js.map +1 -0
  33. package/dist/remediation/request.d.ts +183 -0
  34. package/dist/remediation/request.d.ts.map +1 -0
  35. package/dist/remediation/request.js +15 -0
  36. package/dist/remediation/request.js.map +1 -0
  37. package/dist/remediation/response.d.ts +100 -0
  38. package/dist/remediation/response.d.ts.map +1 -0
  39. package/dist/remediation/response.js +11 -0
  40. package/dist/remediation/response.js.map +1 -0
  41. package/dist/remediation/validation.d.ts +87 -0
  42. package/dist/remediation/validation.d.ts.map +1 -0
  43. package/dist/remediation/validation.js +15 -0
  44. package/dist/remediation/validation.js.map +1 -0
  45. package/dist/status-vocabulary.d.ts +45 -0
  46. package/dist/status-vocabulary.d.ts.map +1 -0
  47. package/dist/status-vocabulary.js +101 -0
  48. package/dist/status-vocabulary.js.map +1 -0
  49. package/dist/verification/canonical-finding.d.ts +171 -0
  50. package/dist/verification/canonical-finding.d.ts.map +1 -0
  51. package/dist/verification/canonical-finding.js +3 -0
  52. package/dist/verification/canonical-finding.js.map +1 -0
  53. package/dist/verification/index.d.ts +6 -0
  54. package/dist/verification/index.d.ts.map +1 -0
  55. package/dist/verification/index.js +11 -0
  56. package/dist/verification/index.js.map +1 -0
  57. package/dist/verification/pipeline.d.ts +134 -0
  58. package/dist/verification/pipeline.d.ts.map +1 -0
  59. package/dist/verification/pipeline.js +57 -0
  60. package/dist/verification/pipeline.js.map +1 -0
  61. package/dist/verification/taxonomy.d.ts +10 -0
  62. package/dist/verification/taxonomy.d.ts.map +1 -0
  63. package/dist/verification/taxonomy.js +16 -0
  64. package/dist/verification/taxonomy.js.map +1 -0
  65. package/package.json +1 -1
  66. package/src/admission/admission-framing.test.ts +93 -0
  67. package/src/admission/framing.ts +78 -0
  68. package/src/admission/index.ts +58 -0
  69. package/src/admission/privacy.ts +93 -0
  70. package/src/admission/schema.ts +392 -0
  71. package/src/index.ts +266 -26
  72. package/src/intelligence.ts +698 -0
  73. package/src/remediation/capabilities.ts +53 -0
  74. package/src/remediation/index.ts +29 -0
  75. package/src/remediation/request.ts +236 -0
  76. package/src/remediation/response.ts +129 -0
  77. package/src/remediation/validation.ts +109 -0
  78. package/src/status-vocabulary.ts +125 -0
  79. package/src/verification/canonical-finding.ts +196 -0
  80. package/src/verification/index.ts +41 -0
  81. package/src/verification/pipeline.ts +199 -0
  82. package/src/verification/taxonomy.ts +46 -0
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Runtime Admission — canonical byte-safe framing (Phase A).
3
+ *
4
+ * Deterministic, length-prefixed framing for the delta and coverage hashes.
5
+ * Web-safe: uses Uint8Array + TextEncoder only (this package is imported by
6
+ * the dashboard and other non-Node surfaces). No Node Buffer, no crypto here —
7
+ * hashing of the framed bytes happens in the governance-runtime core.
8
+ *
9
+ * Why length-prefixed framing (and not a delimiter join):
10
+ * A delimiter such as "\0" or "\t" can appear inside a path, so a delimiter
11
+ * join lets two distinct field sets collapse to the same byte stream
12
+ * (e.g. ["a\tb"] vs ["a","b"]). Every field and every record here is prefixed
13
+ * with its exact byte length, so field and record boundaries are
14
+ * unambiguous and no path content can forge a boundary.
15
+ */
16
+ /** Schema/domain version for the framing contract. Bump only on a breaking framing change. */
17
+ export declare const ADMISSION_FRAMING_VERSION: "neurcode.admission-framing.v1";
18
+ /** Domain separators so delta and coverage hashes can never alias each other. */
19
+ export declare const ADMISSION_DELTA_HASH_DOMAIN: "neurcode.admission.delta.v1";
20
+ export declare const ADMISSION_COVERAGE_SET_HASH_DOMAIN: "neurcode.admission.coverage-set.v1";
21
+ /** Frame a single field as: u32be(byteLength) ‖ utf8(value). */
22
+ export declare function frameField(value: string): Uint8Array;
23
+ /** Frame an ordered list of fields. Order is preserved; the caller sorts records. */
24
+ export declare function frameFields(fields: readonly string[]): Uint8Array;
25
+ /**
26
+ * Frame a header plus an ordered set of records into one canonical byte stream.
27
+ *
28
+ * Layout:
29
+ * frameFields(header)
30
+ * for each record: u32be(recordByteLength) ‖ frameFields(record)
31
+ *
32
+ * Records must already be canonically sorted by the caller (the hash functions
33
+ * sort before calling this, which is what makes shuffled input produce an
34
+ * identical hash). Double length-prefixing (record length + per-field length)
35
+ * makes both record and field boundaries unambiguous.
36
+ */
37
+ export declare function frameRecordSet(header: readonly string[], records: readonly (readonly string[])[]): Uint8Array;
38
+ //# sourceMappingURL=framing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"framing.d.ts","sourceRoot":"","sources":["../../src/admission/framing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,8FAA8F;AAC9F,eAAO,MAAM,yBAAyB,EAAG,+BAAwC,CAAC;AAElF,iFAAiF;AACjF,eAAO,MAAM,2BAA2B,EAAG,6BAAsC,CAAC;AAClF,eAAO,MAAM,kCAAkC,EAAG,oCAA6C,CAAC;AA0BhG,gEAAgE;AAChE,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,CAGpD;AAED,qFAAqF;AACrF,wBAAgB,WAAW,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,UAAU,CAEjE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,EAAE,OAAO,EAAE,SAAS,CAAC,SAAS,MAAM,EAAE,CAAC,EAAE,GAAG,UAAU,CAO7G"}
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ /**
3
+ * Runtime Admission — canonical byte-safe framing (Phase A).
4
+ *
5
+ * Deterministic, length-prefixed framing for the delta and coverage hashes.
6
+ * Web-safe: uses Uint8Array + TextEncoder only (this package is imported by
7
+ * the dashboard and other non-Node surfaces). No Node Buffer, no crypto here —
8
+ * hashing of the framed bytes happens in the governance-runtime core.
9
+ *
10
+ * Why length-prefixed framing (and not a delimiter join):
11
+ * A delimiter such as "\0" or "\t" can appear inside a path, so a delimiter
12
+ * join lets two distinct field sets collapse to the same byte stream
13
+ * (e.g. ["a\tb"] vs ["a","b"]). Every field and every record here is prefixed
14
+ * with its exact byte length, so field and record boundaries are
15
+ * unambiguous and no path content can forge a boundary.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.ADMISSION_COVERAGE_SET_HASH_DOMAIN = exports.ADMISSION_DELTA_HASH_DOMAIN = exports.ADMISSION_FRAMING_VERSION = void 0;
19
+ exports.frameField = frameField;
20
+ exports.frameFields = frameFields;
21
+ exports.frameRecordSet = frameRecordSet;
22
+ /** Schema/domain version for the framing contract. Bump only on a breaking framing change. */
23
+ exports.ADMISSION_FRAMING_VERSION = 'neurcode.admission-framing.v1';
24
+ /** Domain separators so delta and coverage hashes can never alias each other. */
25
+ exports.ADMISSION_DELTA_HASH_DOMAIN = 'neurcode.admission.delta.v1';
26
+ exports.ADMISSION_COVERAGE_SET_HASH_DOMAIN = 'neurcode.admission.coverage-set.v1';
27
+ const textEncoder = new TextEncoder();
28
+ function u32be(value) {
29
+ if (!Number.isInteger(value) || value < 0 || value > 0xffffffff) {
30
+ throw new Error(`admission framing: length out of range: ${value}`);
31
+ }
32
+ const out = new Uint8Array(4);
33
+ const view = new DataView(out.buffer);
34
+ view.setUint32(0, value, false);
35
+ return out;
36
+ }
37
+ function concatBytes(parts) {
38
+ let total = 0;
39
+ for (const part of parts)
40
+ total += part.length;
41
+ const out = new Uint8Array(total);
42
+ let offset = 0;
43
+ for (const part of parts) {
44
+ out.set(part, offset);
45
+ offset += part.length;
46
+ }
47
+ return out;
48
+ }
49
+ /** Frame a single field as: u32be(byteLength) ‖ utf8(value). */
50
+ function frameField(value) {
51
+ const bytes = textEncoder.encode(value);
52
+ return concatBytes([u32be(bytes.length), bytes]);
53
+ }
54
+ /** Frame an ordered list of fields. Order is preserved; the caller sorts records. */
55
+ function frameFields(fields) {
56
+ return concatBytes(fields.map((field) => frameField(field)));
57
+ }
58
+ /**
59
+ * Frame a header plus an ordered set of records into one canonical byte stream.
60
+ *
61
+ * Layout:
62
+ * frameFields(header)
63
+ * for each record: u32be(recordByteLength) ‖ frameFields(record)
64
+ *
65
+ * Records must already be canonically sorted by the caller (the hash functions
66
+ * sort before calling this, which is what makes shuffled input produce an
67
+ * identical hash). Double length-prefixing (record length + per-field length)
68
+ * makes both record and field boundaries unambiguous.
69
+ */
70
+ function frameRecordSet(header, records) {
71
+ const parts = [frameFields(header)];
72
+ for (const record of records) {
73
+ const recordBytes = frameFields(record);
74
+ parts.push(u32be(recordBytes.length), recordBytes);
75
+ }
76
+ return concatBytes(parts);
77
+ }
78
+ //# sourceMappingURL=framing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"framing.js","sourceRoot":"","sources":["../../src/admission/framing.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAkCH,gCAGC;AAGD,kCAEC;AAcD,wCAOC;AA7DD,8FAA8F;AACjF,QAAA,yBAAyB,GAAG,+BAAwC,CAAC;AAElF,iFAAiF;AACpE,QAAA,2BAA2B,GAAG,6BAAsC,CAAC;AACrE,QAAA,kCAAkC,GAAG,oCAA6C,CAAC;AAEhG,MAAM,WAAW,GAAG,IAAI,WAAW,EAAE,CAAC;AAEtC,SAAS,KAAK,CAAC,KAAa;IAC1B,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC,IAAI,KAAK,GAAG,UAAU,EAAE,CAAC;QAChE,MAAM,IAAI,KAAK,CAAC,2CAA2C,KAAK,EAAE,CAAC,CAAC;IACtE,CAAC;IACD,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC;IAC9B,MAAM,IAAI,GAAG,IAAI,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACtC,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;IAChC,OAAO,GAAG,CAAC;AACb,CAAC;AAED,SAAS,WAAW,CAAC,KAAmB;IACtC,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,KAAK,MAAM,IAAI,IAAI,KAAK;QAAE,KAAK,IAAI,IAAI,CAAC,MAAM,CAAC;IAC/C,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC;IAClC,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QACtB,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC;IACxB,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,gEAAgE;AAChE,SAAgB,UAAU,CAAC,KAAa;IACtC,MAAM,KAAK,GAAG,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACxC,OAAO,WAAW,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;AACnD,CAAC;AAED,qFAAqF;AACrF,SAAgB,WAAW,CAAC,MAAyB;IACnD,OAAO,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAC/D,CAAC;AAED;;;;;;;;;;;GAWG;AACH,SAAgB,cAAc,CAAC,MAAyB,EAAE,OAAuC;IAC/F,MAAM,KAAK,GAAiB,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC;IAClD,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,MAAM,WAAW,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;QACxC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC,CAAC;IACrD,CAAC;IACD,OAAO,WAAW,CAAC,KAAK,CAAC,CAAC;AAC5B,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { ADMISSION_COVERAGE_MANIFEST_SCHEMA_VERSION, ADMISSION_CONSISTENCY_DECISION_SCHEMA_VERSION, SELF_ATTESTED_ADMISSION_RECORD_SCHEMA_VERSION, SELF_ATTESTED_ADMISSION_DISCLAIMER, GIT_MODE_ABSENT, GIT_MODE_BLOB, GIT_MODE_EXEC, GIT_MODE_SUBMODULE, GIT_MODE_SYMLINK, coverageEntryCanonicalFields, coverageEntryIdentityKey, deltaEntryCanonicalFields, isAdmissibleClassification, isGovernedClassification, isKnownGitMode, isStrictlyAdmissible, isValidObjectId, isZeroObjectId, objectIdHexLength, objectTypeForMode, zeroObjectId, type AdmissionCaptureDescriptor, type AdmissionCaptureMode, type AdmissionChangeType, type AdmissionEligibilityMode, type AdmissionEligibilityOptions, type AdmissionConsistencyDecision, type AdmissionConsistencyVerdict, type AdmissionCoverageClassification, type AdmissionCoverageEntry, type AdmissionCoverageManifest, type AdmissionDeltaEntry, type AdmissionObjectType, type AdmissionRepoIdentifiers, type AdmissionSessionRef, type GitObjectFormat, type RuntimeAdmissionAgentHost, type RuntimeAdmissionContext, type RuntimeAdmissionReceiptSummary, type RuntimeAdmissionTrustLevel, type SelfAttestedAdmissionRecord, } from './schema';
2
+ export { ADMISSION_COVERAGE_SET_HASH_DOMAIN, ADMISSION_DELTA_HASH_DOMAIN, ADMISSION_FRAMING_VERSION, frameField, frameFields, frameRecordSet, } from './framing';
3
+ export { ADMISSION_SOURCE_LIKE_KEYS, AdmissionSourceLeakError, assertSourceFreeAdmissionValue, } from './privacy';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/admission/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0CAA0C,EAC1C,6CAA6C,EAC7C,6CAA6C,EAC7C,kCAAkC,EAClC,eAAe,EACf,aAAa,EACb,aAAa,EACb,kBAAkB,EAClB,gBAAgB,EAChB,4BAA4B,EAC5B,wBAAwB,EACxB,yBAAyB,EACzB,0BAA0B,EAC1B,wBAAwB,EACxB,cAAc,EACd,oBAAoB,EACpB,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,YAAY,EACZ,KAAK,0BAA0B,EAC/B,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,wBAAwB,EAC7B,KAAK,2BAA2B,EAChC,KAAK,4BAA4B,EACjC,KAAK,2BAA2B,EAChC,KAAK,+BAA+B,EACpC,KAAK,sBAAsB,EAC3B,KAAK,yBAAyB,EAC9B,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,wBAAwB,EAC7B,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,EAC5B,KAAK,8BAA8B,EACnC,KAAK,0BAA0B,EAC/B,KAAK,2BAA2B,GACjC,MAAM,UAAU,CAAC;AAElB,OAAO,EACL,kCAAkC,EAClC,2BAA2B,EAC3B,yBAAyB,EACzB,UAAU,EACV,WAAW,EACX,cAAc,GACf,MAAM,WAAW,CAAC;AAEnB,OAAO,EACL,0BAA0B,EAC1B,wBAAwB,EACxB,8BAA8B,GAC/B,MAAM,WAAW,CAAC"}
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.assertSourceFreeAdmissionValue = exports.AdmissionSourceLeakError = exports.ADMISSION_SOURCE_LIKE_KEYS = exports.frameRecordSet = exports.frameFields = exports.frameField = exports.ADMISSION_FRAMING_VERSION = exports.ADMISSION_DELTA_HASH_DOMAIN = exports.ADMISSION_COVERAGE_SET_HASH_DOMAIN = exports.zeroObjectId = exports.objectTypeForMode = exports.objectIdHexLength = exports.isZeroObjectId = exports.isValidObjectId = exports.isStrictlyAdmissible = exports.isKnownGitMode = exports.isGovernedClassification = exports.isAdmissibleClassification = exports.deltaEntryCanonicalFields = exports.coverageEntryIdentityKey = exports.coverageEntryCanonicalFields = exports.GIT_MODE_SYMLINK = exports.GIT_MODE_SUBMODULE = exports.GIT_MODE_EXEC = exports.GIT_MODE_BLOB = exports.GIT_MODE_ABSENT = exports.SELF_ATTESTED_ADMISSION_DISCLAIMER = exports.SELF_ATTESTED_ADMISSION_RECORD_SCHEMA_VERSION = exports.ADMISSION_CONSISTENCY_DECISION_SCHEMA_VERSION = exports.ADMISSION_COVERAGE_MANIFEST_SCHEMA_VERSION = void 0;
4
+ var schema_1 = require("./schema");
5
+ Object.defineProperty(exports, "ADMISSION_COVERAGE_MANIFEST_SCHEMA_VERSION", { enumerable: true, get: function () { return schema_1.ADMISSION_COVERAGE_MANIFEST_SCHEMA_VERSION; } });
6
+ Object.defineProperty(exports, "ADMISSION_CONSISTENCY_DECISION_SCHEMA_VERSION", { enumerable: true, get: function () { return schema_1.ADMISSION_CONSISTENCY_DECISION_SCHEMA_VERSION; } });
7
+ Object.defineProperty(exports, "SELF_ATTESTED_ADMISSION_RECORD_SCHEMA_VERSION", { enumerable: true, get: function () { return schema_1.SELF_ATTESTED_ADMISSION_RECORD_SCHEMA_VERSION; } });
8
+ Object.defineProperty(exports, "SELF_ATTESTED_ADMISSION_DISCLAIMER", { enumerable: true, get: function () { return schema_1.SELF_ATTESTED_ADMISSION_DISCLAIMER; } });
9
+ Object.defineProperty(exports, "GIT_MODE_ABSENT", { enumerable: true, get: function () { return schema_1.GIT_MODE_ABSENT; } });
10
+ Object.defineProperty(exports, "GIT_MODE_BLOB", { enumerable: true, get: function () { return schema_1.GIT_MODE_BLOB; } });
11
+ Object.defineProperty(exports, "GIT_MODE_EXEC", { enumerable: true, get: function () { return schema_1.GIT_MODE_EXEC; } });
12
+ Object.defineProperty(exports, "GIT_MODE_SUBMODULE", { enumerable: true, get: function () { return schema_1.GIT_MODE_SUBMODULE; } });
13
+ Object.defineProperty(exports, "GIT_MODE_SYMLINK", { enumerable: true, get: function () { return schema_1.GIT_MODE_SYMLINK; } });
14
+ Object.defineProperty(exports, "coverageEntryCanonicalFields", { enumerable: true, get: function () { return schema_1.coverageEntryCanonicalFields; } });
15
+ Object.defineProperty(exports, "coverageEntryIdentityKey", { enumerable: true, get: function () { return schema_1.coverageEntryIdentityKey; } });
16
+ Object.defineProperty(exports, "deltaEntryCanonicalFields", { enumerable: true, get: function () { return schema_1.deltaEntryCanonicalFields; } });
17
+ Object.defineProperty(exports, "isAdmissibleClassification", { enumerable: true, get: function () { return schema_1.isAdmissibleClassification; } });
18
+ Object.defineProperty(exports, "isGovernedClassification", { enumerable: true, get: function () { return schema_1.isGovernedClassification; } });
19
+ Object.defineProperty(exports, "isKnownGitMode", { enumerable: true, get: function () { return schema_1.isKnownGitMode; } });
20
+ Object.defineProperty(exports, "isStrictlyAdmissible", { enumerable: true, get: function () { return schema_1.isStrictlyAdmissible; } });
21
+ Object.defineProperty(exports, "isValidObjectId", { enumerable: true, get: function () { return schema_1.isValidObjectId; } });
22
+ Object.defineProperty(exports, "isZeroObjectId", { enumerable: true, get: function () { return schema_1.isZeroObjectId; } });
23
+ Object.defineProperty(exports, "objectIdHexLength", { enumerable: true, get: function () { return schema_1.objectIdHexLength; } });
24
+ Object.defineProperty(exports, "objectTypeForMode", { enumerable: true, get: function () { return schema_1.objectTypeForMode; } });
25
+ Object.defineProperty(exports, "zeroObjectId", { enumerable: true, get: function () { return schema_1.zeroObjectId; } });
26
+ var framing_1 = require("./framing");
27
+ Object.defineProperty(exports, "ADMISSION_COVERAGE_SET_HASH_DOMAIN", { enumerable: true, get: function () { return framing_1.ADMISSION_COVERAGE_SET_HASH_DOMAIN; } });
28
+ Object.defineProperty(exports, "ADMISSION_DELTA_HASH_DOMAIN", { enumerable: true, get: function () { return framing_1.ADMISSION_DELTA_HASH_DOMAIN; } });
29
+ Object.defineProperty(exports, "ADMISSION_FRAMING_VERSION", { enumerable: true, get: function () { return framing_1.ADMISSION_FRAMING_VERSION; } });
30
+ Object.defineProperty(exports, "frameField", { enumerable: true, get: function () { return framing_1.frameField; } });
31
+ Object.defineProperty(exports, "frameFields", { enumerable: true, get: function () { return framing_1.frameFields; } });
32
+ Object.defineProperty(exports, "frameRecordSet", { enumerable: true, get: function () { return framing_1.frameRecordSet; } });
33
+ var privacy_1 = require("./privacy");
34
+ Object.defineProperty(exports, "ADMISSION_SOURCE_LIKE_KEYS", { enumerable: true, get: function () { return privacy_1.ADMISSION_SOURCE_LIKE_KEYS; } });
35
+ Object.defineProperty(exports, "AdmissionSourceLeakError", { enumerable: true, get: function () { return privacy_1.AdmissionSourceLeakError; } });
36
+ Object.defineProperty(exports, "assertSourceFreeAdmissionValue", { enumerable: true, get: function () { return privacy_1.assertSourceFreeAdmissionValue; } });
37
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/admission/index.ts"],"names":[],"mappings":";;;AAAA,mCA0CkB;AAzChB,oIAAA,0CAA0C,OAAA;AAC1C,uIAAA,6CAA6C,OAAA;AAC7C,uIAAA,6CAA6C,OAAA;AAC7C,4HAAA,kCAAkC,OAAA;AAClC,yGAAA,eAAe,OAAA;AACf,uGAAA,aAAa,OAAA;AACb,uGAAA,aAAa,OAAA;AACb,4GAAA,kBAAkB,OAAA;AAClB,0GAAA,gBAAgB,OAAA;AAChB,sHAAA,4BAA4B,OAAA;AAC5B,kHAAA,wBAAwB,OAAA;AACxB,mHAAA,yBAAyB,OAAA;AACzB,oHAAA,0BAA0B,OAAA;AAC1B,kHAAA,wBAAwB,OAAA;AACxB,wGAAA,cAAc,OAAA;AACd,8GAAA,oBAAoB,OAAA;AACpB,yGAAA,eAAe,OAAA;AACf,wGAAA,cAAc,OAAA;AACd,2GAAA,iBAAiB,OAAA;AACjB,2GAAA,iBAAiB,OAAA;AACjB,sGAAA,YAAY,OAAA;AAuBd,qCAOmB;AANjB,6HAAA,kCAAkC,OAAA;AAClC,sHAAA,2BAA2B,OAAA;AAC3B,oHAAA,yBAAyB,OAAA;AACzB,qGAAA,UAAU,OAAA;AACV,sGAAA,WAAW,OAAA;AACX,yGAAA,cAAc,OAAA;AAGhB,qCAImB;AAHjB,qHAAA,0BAA0B,OAAA;AAC1B,mHAAA,wBAAwB,OAAA;AACxB,yHAAA,8BAA8B,OAAA"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Runtime Admission — source-free privacy guard (Phase A).
3
+ *
4
+ * The admission artifact may contain only: paths, object ids, modes, hashes,
5
+ * classifications, timestamps, session ids, and version strings. It must never
6
+ * contain file content, diff hunks, patch text, excerpts, or secrets.
7
+ *
8
+ * This guard is a denylist on key names (mirrors the runtime-sync upload guard)
9
+ * plus a value-shape check. It is intentionally conservative: any source-like
10
+ * key anywhere in the structure throws.
11
+ */
12
+ /** Keys that would indicate source content / diffs / secrets leaked into the artifact. */
13
+ export declare const ADMISSION_SOURCE_LIKE_KEYS: ReadonlySet<string>;
14
+ export declare class AdmissionSourceLeakError extends Error {
15
+ readonly keyPath: string;
16
+ constructor(keyPath: string);
17
+ }
18
+ /**
19
+ * Walk a value and throw AdmissionSourceLeakError if any object key is a
20
+ * source-like key. Arrays and nested objects are walked recursively.
21
+ */
22
+ export declare function assertSourceFreeAdmissionValue(value: unknown, path?: string): void;
23
+ //# sourceMappingURL=privacy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"privacy.d.ts","sourceRoot":"","sources":["../../src/admission/privacy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,0FAA0F;AAC1F,eAAO,MAAM,0BAA0B,EAAE,WAAW,CAAC,MAAM,CAyCzD,CAAC;AAEH,qBAAa,wBAAyB,SAAQ,KAAK;aACrB,OAAO,EAAE,MAAM;gBAAf,OAAO,EAAE,MAAM;CAI5C;AAeD;;;GAGG;AACH,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,SAAc,GAAG,IAAI,CAYvF"}
@@ -0,0 +1,99 @@
1
+ "use strict";
2
+ /**
3
+ * Runtime Admission — source-free privacy guard (Phase A).
4
+ *
5
+ * The admission artifact may contain only: paths, object ids, modes, hashes,
6
+ * classifications, timestamps, session ids, and version strings. It must never
7
+ * contain file content, diff hunks, patch text, excerpts, or secrets.
8
+ *
9
+ * This guard is a denylist on key names (mirrors the runtime-sync upload guard)
10
+ * plus a value-shape check. It is intentionally conservative: any source-like
11
+ * key anywhere in the structure throws.
12
+ */
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.AdmissionSourceLeakError = exports.ADMISSION_SOURCE_LIKE_KEYS = void 0;
15
+ exports.assertSourceFreeAdmissionValue = assertSourceFreeAdmissionValue;
16
+ /** Keys that would indicate source content / diffs / secrets leaked into the artifact. */
17
+ exports.ADMISSION_SOURCE_LIKE_KEYS = new Set([
18
+ 'content',
19
+ 'fileContent',
20
+ 'file_content',
21
+ 'sourceText',
22
+ 'source_text',
23
+ 'sourceCode',
24
+ 'source_code',
25
+ 'source',
26
+ 'body',
27
+ 'text',
28
+ 'diff',
29
+ 'diffText',
30
+ 'diff_text',
31
+ 'diffHunk',
32
+ 'diffHunks',
33
+ 'patch',
34
+ 'patchText',
35
+ 'patchBody',
36
+ 'patch_body',
37
+ 'hunk',
38
+ 'hunks',
39
+ 'excerpt',
40
+ 'snippet',
41
+ 'before',
42
+ 'after',
43
+ 'blobContent',
44
+ 'contents',
45
+ 'prompt',
46
+ 'rawPrompt',
47
+ 'raw_prompt',
48
+ 'promptWithSource',
49
+ 'prompt_with_source',
50
+ 'commandBody',
51
+ 'command_body',
52
+ 'shellCommand',
53
+ 'shell_command',
54
+ 'secret',
55
+ 'secrets',
56
+ 'token',
57
+ 'password',
58
+ ]);
59
+ class AdmissionSourceLeakError extends Error {
60
+ keyPath;
61
+ constructor(keyPath) {
62
+ super(`admission artifact contains source-like key: ${keyPath}`);
63
+ this.keyPath = keyPath;
64
+ this.name = 'AdmissionSourceLeakError';
65
+ }
66
+ }
67
+ exports.AdmissionSourceLeakError = AdmissionSourceLeakError;
68
+ function isSourceLikeAdmissionKey(key) {
69
+ if (exports.ADMISSION_SOURCE_LIKE_KEYS.has(key))
70
+ return true;
71
+ const normalized = key.toLowerCase().replace(/[^a-z0-9_]/g, '');
72
+ const compact = normalized.replace(/_/g, '');
73
+ for (const blocked of exports.ADMISSION_SOURCE_LIKE_KEYS) {
74
+ const blockedNormalized = blocked.toLowerCase().replace(/[^a-z0-9_]/g, '');
75
+ if (normalized === blockedNormalized || compact === blockedNormalized.replace(/_/g, '')) {
76
+ return true;
77
+ }
78
+ }
79
+ return false;
80
+ }
81
+ /**
82
+ * Walk a value and throw AdmissionSourceLeakError if any object key is a
83
+ * source-like key. Arrays and nested objects are walked recursively.
84
+ */
85
+ function assertSourceFreeAdmissionValue(value, path = 'admission') {
86
+ if (Array.isArray(value)) {
87
+ value.forEach((item, index) => assertSourceFreeAdmissionValue(item, `${path}[${index}]`));
88
+ return;
89
+ }
90
+ if (!value || typeof value !== 'object')
91
+ return;
92
+ for (const [key, child] of Object.entries(value)) {
93
+ if (isSourceLikeAdmissionKey(key)) {
94
+ throw new AdmissionSourceLeakError(`${path}.${key}`);
95
+ }
96
+ assertSourceFreeAdmissionValue(child, `${path}.${key}`);
97
+ }
98
+ }
99
+ //# sourceMappingURL=privacy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"privacy.js","sourceRoot":"","sources":["../../src/admission/privacy.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AAsEH,wEAYC;AAhFD,0FAA0F;AAC7E,QAAA,0BAA0B,GAAwB,IAAI,GAAG,CAAC;IACrE,SAAS;IACT,aAAa;IACb,cAAc;IACd,YAAY;IACZ,aAAa;IACb,YAAY;IACZ,aAAa;IACb,QAAQ;IACR,MAAM;IACN,MAAM;IACN,MAAM;IACN,UAAU;IACV,WAAW;IACX,UAAU;IACV,WAAW;IACX,OAAO;IACP,WAAW;IACX,WAAW;IACX,YAAY;IACZ,MAAM;IACN,OAAO;IACP,SAAS;IACT,SAAS;IACT,QAAQ;IACR,OAAO;IACP,aAAa;IACb,UAAU;IACV,QAAQ;IACR,WAAW;IACX,YAAY;IACZ,kBAAkB;IAClB,oBAAoB;IACpB,aAAa;IACb,cAAc;IACd,cAAc;IACd,eAAe;IACf,QAAQ;IACR,SAAS;IACT,OAAO;IACP,UAAU;CACX,CAAC,CAAC;AAEH,MAAa,wBAAyB,SAAQ,KAAK;IACrB;IAA5B,YAA4B,OAAe;QACzC,KAAK,CAAC,gDAAgD,OAAO,EAAE,CAAC,CAAC;QADvC,YAAO,GAAP,OAAO,CAAQ;QAEzC,IAAI,CAAC,IAAI,GAA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,IAAI,IAAI,GAAG,EAAE,CAAC,CAAC;QACvD,CAAC;QACD,8BAA8B,CAAC,KAAK,EAAE,GAAG,IAAI,IAAI,GAAG,EAAE,CAAC,CAAC;IAC1D,CAAC;AACH,CAAC"}
@@ -0,0 +1,277 @@
1
+ /**
2
+ * Runtime Admission — Phase A schema (Provenance Core V1).
3
+ *
4
+ * Source-free, deterministic provenance types shared across CLI, the future
5
+ * OSS advisory Action, and future Enterprise enforcement. Phase A defines the
6
+ * normalized git tree-delta, the governed coverage manifest, the self-attested
7
+ * local artifact, and the consistency decision. No signing, no receipts, no
8
+ * backend, no Action here — those are later phases.
9
+ *
10
+ * Two distinct hashes by design (do not collapse them):
11
+ * - deltaHash: exact, base-specific tree-delta fingerprint (debugging /
12
+ * deterministic reproduction).
13
+ * - coverageSetHash: governed-effect set fingerprint used for squash/rebase-
14
+ * survivable, per-entry subset matching of a PR to sessions.
15
+ */
16
+ export declare const ADMISSION_COVERAGE_MANIFEST_SCHEMA_VERSION: "neurcode.admission-coverage.v1";
17
+ export declare const SELF_ATTESTED_ADMISSION_RECORD_SCHEMA_VERSION: "neurcode.admission-record.v1";
18
+ export declare const ADMISSION_CONSISTENCY_DECISION_SCHEMA_VERSION: "neurcode.admission-consistency.v1";
19
+ /**
20
+ * Mandatory honesty label. A locally committed artifact is authored by the same
21
+ * untrusted principal who authored the diff, so it can be fabricated with
22
+ * matching object ids. It is a claim, never proof.
23
+ */
24
+ export declare const SELF_ATTESTED_ADMISSION_DISCLAIMER: string;
25
+ /** Git object hash format. Determines object-id hex width (40 vs 64). */
26
+ export type GitObjectFormat = 'sha1' | 'sha256';
27
+ /** Post-image (or pre-image, for deletes) object kind, derived from git mode. */
28
+ export type AdmissionObjectType = 'blob' | 'symlink' | 'submodule' | 'absent';
29
+ /** Normalized change kind. Renames are normalized to delete + add (never a 'rename' type). */
30
+ export type AdmissionChangeType = 'added' | 'modified' | 'deleted' | 'typechanged';
31
+ /**
32
+ * Descriptive classification of a covered effect (source-free).
33
+ *
34
+ * NOTE: classification is descriptive, not an eligibility verdict. Strict
35
+ * runtime admission (see `isStrictlyAdmissible`) accepts only pre-write
36
+ * governance (`governed_prewrite`, `governed_delete`). `observed_postwrite`
37
+ * means the write was only observed after the fact — visible, but NOT strictly
38
+ * admissible. `generated` is admissible only under an explicit policy opt-in.
39
+ */
40
+ export type AdmissionCoverageClassification = 'governed_prewrite' | 'governed_delete' | 'observed_postwrite' | 'generated' | 'ungoverned';
41
+ /** Canonical git file modes used by this contract. */
42
+ export declare const GIT_MODE_BLOB: "100644";
43
+ export declare const GIT_MODE_EXEC: "100755";
44
+ export declare const GIT_MODE_SYMLINK: "120000";
45
+ export declare const GIT_MODE_SUBMODULE: "160000";
46
+ export declare const GIT_MODE_ABSENT: "000000";
47
+ /**
48
+ * Exact normalized tree-delta entry. Object ids are content-addressed git
49
+ * hashes (non-invertible); no file content is ever carried.
50
+ */
51
+ export interface AdmissionDeltaEntry {
52
+ /** Post-image path; for a delete, the deleted path. */
53
+ path: string;
54
+ changeType: AdmissionChangeType;
55
+ /** Object kind of the side that carries identity (new side, or old side for deletes). */
56
+ objectType: AdmissionObjectType;
57
+ /** Pre-image mode, or '000000' when absent (added). */
58
+ oldMode: string;
59
+ /** Post-image mode, or '000000' when absent (deleted). */
60
+ newMode: string;
61
+ /** Pre-image object id, or the all-zeros id when absent. */
62
+ oldObjectId: string;
63
+ /** Post-image object id, or the all-zeros id when absent. */
64
+ newObjectId: string;
65
+ }
66
+ /**
67
+ * A single governed effect. Identity fields per the matching contract:
68
+ * added/modified/typechanged → path + newMode + newObjectId
69
+ * deleted → path + oldMode + oldObjectId
70
+ * The identity mode/id are flattened into `mode`/`objectId` so matching is a
71
+ * simple per-entry set membership test. `classification` and `sessions` are
72
+ * annotations and are intentionally excluded from coverageSetHash.
73
+ */
74
+ export interface AdmissionCoverageEntry {
75
+ path: string;
76
+ changeType: AdmissionChangeType;
77
+ objectType: AdmissionObjectType;
78
+ /** Identity mode: newMode for non-deletes, oldMode for deletes. */
79
+ mode: string;
80
+ /** Identity object id: newObjectId for non-deletes, oldObjectId for deletes. */
81
+ objectId: string;
82
+ classification: AdmissionCoverageClassification;
83
+ /** Contributing governed session ids, sorted and de-duplicated. */
84
+ sessions: string[];
85
+ }
86
+ export interface AdmissionCoverageManifest {
87
+ schemaVersion: typeof ADMISSION_COVERAGE_MANIFEST_SCHEMA_VERSION;
88
+ objectFormat: GitObjectFormat;
89
+ framingVersion: string;
90
+ entryCount: number;
91
+ /** Exact, base-specific normalized tree-delta fingerprint (full SHA-256 hex). */
92
+ deltaHash: string;
93
+ /** Squash/rebase-survivable governed-effect set fingerprint (full SHA-256 hex). */
94
+ coverageSetHash: string;
95
+ /** Normalized delta entries, canonically sorted. */
96
+ delta: AdmissionDeltaEntry[];
97
+ /** Derived governed coverage entries, canonically sorted. */
98
+ coverage: AdmissionCoverageEntry[];
99
+ }
100
+ export interface AdmissionSessionRef {
101
+ sessionId: string;
102
+ replayHash?: string;
103
+ profileHash?: string;
104
+ }
105
+ export type AdmissionCaptureMode = 'worktree' | 'committed';
106
+ export interface AdmissionCaptureDescriptor {
107
+ mode: AdmissionCaptureMode;
108
+ capturedAt: string;
109
+ baseRef?: string;
110
+ headRef?: string;
111
+ }
112
+ /** Source-free repo identifiers. Hashes of local/remote paths, never the URL itself. */
113
+ export interface AdmissionRepoIdentifiers {
114
+ name?: string;
115
+ rootHash?: string;
116
+ remoteHash?: string;
117
+ }
118
+ export type RuntimeAdmissionTrustLevel = 'unsigned_local' | 'self_attested' | 'backend_signed';
119
+ export interface RuntimeAdmissionAgentHost {
120
+ adapter: string | null;
121
+ enforcementLevel: string | null;
122
+ controlLevel?: string | null;
123
+ automatic?: boolean;
124
+ }
125
+ export interface RuntimeAdmissionReceiptSummary {
126
+ present: boolean;
127
+ trustLevel: RuntimeAdmissionTrustLevel;
128
+ receiptId?: string;
129
+ keyId?: string | null;
130
+ replayHash?: string | null;
131
+ signatureStatus?: string | null;
132
+ verificationStatus?: string | null;
133
+ signedAt?: string | null;
134
+ verifier?: string | null;
135
+ }
136
+ export interface RuntimeAdmissionContext {
137
+ schemaVersion: 'neurcode.runtime-admission-context.v1';
138
+ trustLevel: RuntimeAdmissionTrustLevel;
139
+ createdAt: string;
140
+ sessionId: string;
141
+ sessionStatus: 'active' | 'finished' | string;
142
+ agentHost: RuntimeAdmissionAgentHost;
143
+ intentSummary: string | null;
144
+ scopeMode: string | null;
145
+ counts: {
146
+ changedPaths: number;
147
+ blockedPaths: number;
148
+ suggestedApprovalPaths: number;
149
+ approvedExactPaths: number;
150
+ deniedPaths: number;
151
+ approvalRequiredSurfaces: number;
152
+ owners: number;
153
+ preWriteChecks: number;
154
+ allowedChecks: number;
155
+ warningChecks: number;
156
+ };
157
+ paths: {
158
+ changed: string[];
159
+ blocked: string[];
160
+ suggestedApproval: string[];
161
+ approvedExact: string[];
162
+ denied: string[];
163
+ approvalRequiredSurfaces: string[];
164
+ };
165
+ owners: Array<{
166
+ owner: string;
167
+ count: number;
168
+ }>;
169
+ guard: {
170
+ status: string;
171
+ verifiedPrewrite: number;
172
+ deniedButChanged: number;
173
+ unverifiedWrites: number;
174
+ observedAfterOnly: number;
175
+ };
176
+ integrity: {
177
+ sourceFree: true;
178
+ replayHash: string | null;
179
+ replayHashStatus: 'present' | 'missing';
180
+ deltaHash: string;
181
+ coverageSetHash: string;
182
+ evidenceIntegrityStatus: 'local_self_attested' | 'backend_signed' | 'unsigned_local';
183
+ receipt: RuntimeAdmissionReceiptSummary;
184
+ };
185
+ }
186
+ /**
187
+ * The local runtime artifact, written to ignored runtime state under
188
+ * .neurcode/admission/<sessionId>.json. A selected record may later be exported
189
+ * explicitly for the OSS advisory Action. Self-attested by construction — see
190
+ * SELF_ATTESTED_ADMISSION_DISCLAIMER.
191
+ */
192
+ export interface SelfAttestedAdmissionRecord {
193
+ schemaVersion: typeof SELF_ATTESTED_ADMISSION_RECORD_SCHEMA_VERSION;
194
+ attestationKind: 'self-attested';
195
+ admissionContractVersion: string;
196
+ disclaimer: string;
197
+ sessionId: string;
198
+ sessionRefs: AdmissionSessionRef[];
199
+ repo: AdmissionRepoIdentifiers;
200
+ capture: AdmissionCaptureDescriptor;
201
+ manifest: AdmissionCoverageManifest;
202
+ runtimeContext?: RuntimeAdmissionContext;
203
+ }
204
+ export type AdmissionConsistencyVerdict = 'self_attested_complete' | 'self_attested_incomplete' | 'self_attested_inconsistent' | 'no_record';
205
+ /**
206
+ * Output of validating a self-attested record against a recomputed ground-truth
207
+ * delta. `trustLevel` is always 'self-attested' in Phase A; `notProof` is always
208
+ * true. Coverage verdict is decided by per-entry subset matching (squash/rebase
209
+ * survivable). `deltaHashMatches` is a diagnostic only and never gates coverage.
210
+ */
211
+ export interface AdmissionConsistencyDecision {
212
+ schemaVersion: typeof ADMISSION_CONSISTENCY_DECISION_SCHEMA_VERSION;
213
+ verdict: AdmissionConsistencyVerdict;
214
+ trustLevel: 'self-attested';
215
+ notProof: true;
216
+ /** True only when the PR delta is byte-identical to the captured delta (same base, no rebase). */
217
+ deltaHashMatches: boolean;
218
+ /** Ground-truth changed paths covered by an admission-eligible entry. */
219
+ coveredPaths: string[];
220
+ /** Ground-truth paths with no admission-eligible coverage (drift / post-session edits). */
221
+ uncoveredPaths: string[];
222
+ /** Coverage entries not present in the ground-truth delta (stale/multi-session/padding). */
223
+ unexpectedCoverage: string[];
224
+ reasons: string[];
225
+ }
226
+ export declare function objectIdHexLength(format: GitObjectFormat): number;
227
+ export declare function zeroObjectId(format: GitObjectFormat): string;
228
+ export declare function isZeroObjectId(objectId: string): boolean;
229
+ export declare function isValidObjectId(objectId: string, format: GitObjectFormat): boolean;
230
+ export declare function isKnownGitMode(mode: string): boolean;
231
+ export declare function objectTypeForMode(mode: string): AdmissionObjectType;
232
+ /**
233
+ * Canonical, ordered field list for a delta entry. The field ORDER is part of
234
+ * the hashing contract and must never be reordered.
235
+ */
236
+ export declare function deltaEntryCanonicalFields(entry: AdmissionDeltaEntry): string[];
237
+ /**
238
+ * Canonical, ordered identity field list for a coverage entry.
239
+ *
240
+ * Identity per the matching contract:
241
+ * present (added/modified/typechanged) → path + newMode + newObjectId
242
+ * deleted → path + oldMode + oldObjectId
243
+ *
244
+ * `mode`/`objectId` already hold the correct side. `changeType` collapses to a
245
+ * single present/deleted flag so a squash/rebase that reclassifies modified↔added
246
+ * (same resulting content) still matches. `objectType` is derived from `mode` and
247
+ * is excluded. `classification` and `sessions` are annotations and excluded.
248
+ */
249
+ export declare function coverageEntryCanonicalFields(entry: AdmissionCoverageEntry): string[];
250
+ /** Stable in-memory identity key for set/union operations (not a security hash). */
251
+ export declare function coverageEntryIdentityKey(entry: AdmissionCoverageEntry): string;
252
+ /**
253
+ * Descriptive test: did this effect have ANY governance evidence (pre- or
254
+ * post-write, or generated)? Use this for descriptive surfaces (telemetry,
255
+ * "what did the runtime observe"). It is NOT the admission eligibility test.
256
+ */
257
+ export declare function isGovernedClassification(classification: AdmissionCoverageClassification): boolean;
258
+ export type AdmissionEligibilityMode = 'strict' | 'descriptive';
259
+ export interface AdmissionEligibilityOptions {
260
+ /** 'strict' (default): pre-write governance only. 'descriptive': any evidence. */
261
+ mode?: AdmissionEligibilityMode;
262
+ /** When true, 'generated' counts as admissible under strict mode (explicit policy opt-in). */
263
+ allowGenerated?: boolean;
264
+ }
265
+ /**
266
+ * Strict runtime admission eligibility. Only pre-write governance is admissible:
267
+ * `governed_prewrite` and `governed_delete`. `observed_postwrite` is visible but
268
+ * NOT admissible (the write was only seen after it happened). `generated` is
269
+ * admissible only when `allowGenerated` is explicitly set by policy.
270
+ */
271
+ export declare function isStrictlyAdmissible(classification: AdmissionCoverageClassification, options?: AdmissionEligibilityOptions): boolean;
272
+ /**
273
+ * Eligibility predicate honoring the requested mode. Strict (default) uses
274
+ * `isStrictlyAdmissible`; descriptive uses `isGovernedClassification`.
275
+ */
276
+ export declare function isAdmissibleClassification(classification: AdmissionCoverageClassification, options?: AdmissionEligibilityOptions): boolean;
277
+ //# sourceMappingURL=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