@emilia-protocol/gate 0.16.1 → 0.18.1
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/CHANGELOG.md +65 -0
- package/README.md +65 -0
- package/admission-store-postgres.js +4 -0
- package/admission-store.js +4 -0
- package/autonomy-control-plane-profile.js +2 -0
- package/dist/admission-store-postgres.d.ts +66 -0
- package/dist/admission-store-postgres.d.ts.map +1 -0
- package/dist/admission-store-postgres.js +537 -0
- package/dist/admission-store-postgres.js.map +1 -0
- package/dist/admission-store.d.ts +292 -0
- package/dist/admission-store.d.ts.map +1 -0
- package/dist/admission-store.js +777 -0
- package/dist/admission-store.js.map +1 -0
- package/dist/autonomy-control-plane-profile.d.ts +18 -0
- package/dist/autonomy-control-plane-profile.d.ts.map +1 -0
- package/dist/autonomy-control-plane-profile.js +352 -0
- package/dist/autonomy-control-plane-profile.js.map +1 -0
- package/dist/gate-qualification-v2.d.ts +225 -0
- package/dist/gate-qualification-v2.d.ts.map +1 -0
- package/dist/gate-qualification-v2.js +1011 -0
- package/dist/gate-qualification-v2.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/gate-qualification-v2.js +4 -0
- package/package.json +24 -3
- package/src/admission-store-postgres.ts +695 -0
- package/src/admission-store.ts +1065 -0
- package/src/autonomy-control-plane-profile.ts +371 -0
- package/src/gate-qualification-v2.ts +1534 -0
- package/src/index.ts +4 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,71 @@
|
|
|
4
4
|
All notable changes to `@emilia-protocol/gate` are documented here.
|
|
5
5
|
This package follows [Semantic Versioning](https://semver.org/).
|
|
6
6
|
|
|
7
|
+
## 0.18.1 (2026-07-27)
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- Repinned the release dependency to the exact published
|
|
12
|
+
`@emilia-protocol/verify@3.16.0` registry tarball. No runtime or API behavior
|
|
13
|
+
changed from 0.18.0; the protected 0.18.0 tag was never published.
|
|
14
|
+
|
|
15
|
+
## 0.18.0 (2026-07-26)
|
|
16
|
+
|
|
17
|
+
### Added
|
|
18
|
+
|
|
19
|
+
- `./gate-qualification-v2`, with pure qualification/AEB/AEC/local-policy
|
|
20
|
+
composition plus shadow, enforcement, and evidence-only reconciliation
|
|
21
|
+
orchestration around a protected adapter.
|
|
22
|
+
- `./admission-store`, a unified immutable admission snapshot, CAS-owned
|
|
23
|
+
lifecycle, one-time execution right, operation/resource fencing,
|
|
24
|
+
predecessor-digest journal, supersession, and remedy reference contract.
|
|
25
|
+
- `./admission-store-postgres`, a deployment-bound PostgreSQL RPC adapter for
|
|
26
|
+
the unified store with single-tenant construction, exact output validation,
|
|
27
|
+
bounded transaction retries, and ambiguous-begin readback handling.
|
|
28
|
+
- Root-package re-exports, generated declarations, compatibility entry points,
|
|
29
|
+
and focused package tests for the qualification and admission modules.
|
|
30
|
+
|
|
31
|
+
### Security
|
|
32
|
+
|
|
33
|
+
- Qualification remains non-authorizing and cannot replace AEB, AEC, or the
|
|
34
|
+
relying party's local authorization policy.
|
|
35
|
+
- Authority is consumed before provider entry; uncertain outcomes remain
|
|
36
|
+
reconciliation-required and cannot be blindly retried.
|
|
37
|
+
- The checked-in memory store is an explicit test-only, non-durable reference.
|
|
38
|
+
The orchestrator and PostgreSQL adapter consume the canonical unified
|
|
39
|
+
`AdmissionStore` contract.
|
|
40
|
+
- Enforcement requires authoritative immediate remeasurement of the candidate,
|
|
41
|
+
qualification status, AEB, AEC, local policy, and protected request before
|
|
42
|
+
transactional consumption. It also requires protected restart-safe custody
|
|
43
|
+
for owner and reconciliation capabilities; memory custody is test-only.
|
|
44
|
+
- Qualification decisions bind the exact protected-request digest and cannot
|
|
45
|
+
be replayed across another otherwise-valid admission.
|
|
46
|
+
- The PostgreSQL adapter is a single-tenant public reference. Managed
|
|
47
|
+
tenant-principal mapping, deployment migrations, federated atomicity, and
|
|
48
|
+
managed service operation are not claimed.
|
|
49
|
+
|
|
50
|
+
## 0.17.0 (2026-07-26)
|
|
51
|
+
|
|
52
|
+
### Added
|
|
53
|
+
|
|
54
|
+
- `./autonomy-control-plane-profile`, a closed compiler from a human-signed
|
|
55
|
+
root objective into one existing Gate Trust Program per exact child action.
|
|
56
|
+
- Typed containment for child actions, audiences, expiries, per-child and
|
|
57
|
+
aggregate sibling budgets, exact code-diff bindings, independent
|
|
58
|
+
proposer/evaluator/executor roles, pinned fitness evidence, bounded canary
|
|
59
|
+
promotion, current suspension status, and separately authorized rollback.
|
|
60
|
+
- A bounded TLA+ model and deliberately unsafe self-expansion configuration;
|
|
61
|
+
the safe model checks authority conservation while the negative control
|
|
62
|
+
falsifies it when an agent can grant itself a new action and budget.
|
|
63
|
+
|
|
64
|
+
### Security
|
|
65
|
+
|
|
66
|
+
- Unknown profile fields, cyclic goal derivation, role collapse, stale or
|
|
67
|
+
unpinned fitness/status evidence, promotion without canary evidence, and
|
|
68
|
+
rollback under a reused CAID fail closed.
|
|
69
|
+
- The claim boundary explicitly excludes natural-language goal entailment,
|
|
70
|
+
provider truth, test adequacy, clocks, storage, and deployment completion.
|
|
71
|
+
|
|
7
72
|
## 0.16.1 (2026-07-26)
|
|
8
73
|
|
|
9
74
|
### Fixed
|
package/README.md
CHANGED
|
@@ -59,6 +59,57 @@ if (!out.ok) throw out.body; // 428 Receipt Required
|
|
|
59
59
|
console.log(out.packet.verdict); // "rely"
|
|
60
60
|
```
|
|
61
61
|
|
|
62
|
+
## Gate Qualification v2
|
|
63
|
+
|
|
64
|
+
Gate Qualification v2 treats model or agent qualification as one input to a
|
|
65
|
+
consequence-owning Gate. Qualification never substitutes for AEB, AEC, or the
|
|
66
|
+
relying party's local authorization policy.
|
|
67
|
+
|
|
68
|
+
```js
|
|
69
|
+
import {
|
|
70
|
+
GateQualificationV2,
|
|
71
|
+
composeQualificationDecisionV2,
|
|
72
|
+
createMemoryInvocationAuthorityCustodyV2,
|
|
73
|
+
} from '@emilia-protocol/gate/gate-qualification-v2';
|
|
74
|
+
import {
|
|
75
|
+
createAdmissionSnapshot,
|
|
76
|
+
createMemoryAdmissionStore,
|
|
77
|
+
} from '@emilia-protocol/gate/admission-store';
|
|
78
|
+
import {
|
|
79
|
+
createAdmissionPostgresStore,
|
|
80
|
+
} from '@emilia-protocol/gate/admission-store-postgres';
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
`composeQualificationDecisionV2()` is pure and non-mutating. In enforcement
|
|
84
|
+
mode, `GateQualificationV2` requires matching qualification, AEB, AEC, and
|
|
85
|
+
local-policy legs. It requires an authoritative invocation remeasurement and
|
|
86
|
+
protected restart-safe capability custody, then atomically consumes authority
|
|
87
|
+
before entering a caller-supplied protected adapter. Provider commitment and observed effect remain separately
|
|
88
|
+
authenticated facts; an uncertain outcome stays reconciliation-required and
|
|
89
|
+
cannot be retried as fresh work.
|
|
90
|
+
|
|
91
|
+
`createMemoryAdmissionStore()` is a test-only, non-durable, single-process
|
|
92
|
+
reference for the unified immutable snapshot, CAS-owned lifecycle, operation
|
|
93
|
+
and resource fencing, journal, supersession, and remedy contracts.
|
|
94
|
+
It refuses `beginInvocation()` without an explicit currentness oracle;
|
|
95
|
+
`createMemoryInvocationAuthorityCustodyV2()` is likewise test-only and
|
|
96
|
+
non-durable.
|
|
97
|
+
`GateQualificationV2` consumes that canonical `AdmissionStore` contract and
|
|
98
|
+
requires both a durable production store and durable protected authority
|
|
99
|
+
custody unless explicitly constructed for tests.
|
|
100
|
+
|
|
101
|
+
`createAdmissionPostgresStore()` is a deployment-bound, locally atomic and
|
|
102
|
+
durable adapter to an externally installed PostgreSQL RPC contract. Each store
|
|
103
|
+
instance is bound to exactly one deployment and one tenant. This public
|
|
104
|
+
reference does not provide or claim managed tenant-principal mapping, a
|
|
105
|
+
deployment migration, cross-tenant operation, federated atomicity, or managed
|
|
106
|
+
service operation; callers remain responsible for database roles, RPC
|
|
107
|
+
installation, backups, monitoring, and recovery procedures.
|
|
108
|
+
|
|
109
|
+
A `QUALIFIED` verifier result by itself is non-authorizing. It does not grant
|
|
110
|
+
permission, reserve or consume authority, invoke a provider, or establish
|
|
111
|
+
legality or business suitability.
|
|
112
|
+
|
|
62
113
|
## Proposal to effect
|
|
63
114
|
|
|
64
115
|
`@emilia-protocol/gate/proposal-to-effect` closes the loop from an agent's
|
|
@@ -750,3 +801,17 @@ conformance infrastructure. `createPostgresAuthorityAllocationStore()` and
|
|
|
750
801
|
`AUTHORITY_ALLOCATION_DDL` define the durable transactional boundary; they are
|
|
751
802
|
reference code and a database contract, not evidence that any deployment uses
|
|
752
803
|
or correctly operates that boundary.
|
|
804
|
+
|
|
805
|
+
## Autonomy Control Plane
|
|
806
|
+
|
|
807
|
+
`@emilia-protocol/gate/autonomy-control-plane-profile` compiles a closed,
|
|
808
|
+
human-rooted autonomy profile into one existing Gate Trust Program per exact
|
|
809
|
+
child action. It rejects action/audience/expiry widening, aggregate sibling
|
|
810
|
+
budget expansion, cyclic goals, proposer/evaluator/executor role collapse,
|
|
811
|
+
unpinned fitness evidence, promotion without a bounded canary, stale status,
|
|
812
|
+
and rollback without a new CAID and authorization policy.
|
|
813
|
+
|
|
814
|
+
The compiler validates typed authority and evidence bindings. It does not infer
|
|
815
|
+
natural-language goal entailment or prove that tests, providers, storage,
|
|
816
|
+
clocks, deployments, or humans are truthful. See
|
|
817
|
+
`docs/protocol/autonomy-control-plane-profile-v1.md` for the complete boundary.
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deployment-bound PostgreSQL Admission Store.
|
|
3
|
+
*
|
|
4
|
+
* Every mutation is one PostgreSQL function call. The SQL functions use
|
|
5
|
+
* explicit row locks and permanent unique fences; this adapter retries only
|
|
6
|
+
* SQLSTATE 40001 (serialization failure) and 40P01 (deadlock), with the same
|
|
7
|
+
* caller-generated capabilities. It never retries an ambiguous provider
|
|
8
|
+
* effect. A lost beginInvocation acknowledgement is recovered only when an
|
|
9
|
+
* authoritative read proves that this exact invocation-token digest committed.
|
|
10
|
+
*/
|
|
11
|
+
import { type AdmissionStore } from './admission-store.js';
|
|
12
|
+
export interface AdmissionPostgresQueryResult {
|
|
13
|
+
rowCount: number;
|
|
14
|
+
rows?: Array<Record<string, unknown>>;
|
|
15
|
+
}
|
|
16
|
+
export type AdmissionPostgresQuery = (text: string, params: readonly unknown[]) => Promise<AdmissionPostgresQueryResult>;
|
|
17
|
+
export interface CreateAdmissionPostgresStoreOptions {
|
|
18
|
+
query: AdmissionPostgresQuery;
|
|
19
|
+
deploymentId: string;
|
|
20
|
+
tenantId: string;
|
|
21
|
+
/** Test seam only. Production callers should use the cryptographic default. */
|
|
22
|
+
ownerTokenFactory?: () => string;
|
|
23
|
+
/** Test seam only. Production callers should use the cryptographic default. */
|
|
24
|
+
invocationTokenFactory?: () => string;
|
|
25
|
+
/** Number of retries after the first attempt for SQLSTATE 40001/40P01. */
|
|
26
|
+
maxTransactionRetries?: number;
|
|
27
|
+
}
|
|
28
|
+
export interface AdmissionPostgresStore extends AdmissionStore {
|
|
29
|
+
readonly guaranteeClass: 'local_atomic';
|
|
30
|
+
readonly singleTenant: true;
|
|
31
|
+
readonly deploymentBound: true;
|
|
32
|
+
readonly managedTenantPrincipalMapping: false;
|
|
33
|
+
readonly maxTransactionRetries: number;
|
|
34
|
+
}
|
|
35
|
+
export declare const ADMISSION_POSTGRES_SQL: Readonly<{
|
|
36
|
+
reserve: "SELECT public.ep_gate_admission_reserve($1::text, $2::text, $3::jsonb, $4::text) AS result";
|
|
37
|
+
release: "SELECT public.ep_gate_admission_release($1::text, $2::text, $3::text, $4::bigint, $5::text, $6::text) AS result";
|
|
38
|
+
expire: "SELECT public.ep_gate_admission_expire($1::text, $2::text, $3::text, $4::bigint, $5::text) AS result";
|
|
39
|
+
supersede: "SELECT public.ep_gate_admission_supersede($1::text, $2::text, $3::text, $4::bigint, $5::text, $6::jsonb, $7::text) AS result";
|
|
40
|
+
beginInvocation: "SELECT public.ep_gate_admission_begin_invocation($1::text, $2::text, $3::text, $4::bigint, $5::text, $6::text) AS result";
|
|
41
|
+
recoverIndeterminate: "SELECT public.ep_gate_admission_recover_indeterminate($1::text, $2::text, $3::text, $4::text, $5::text) AS result";
|
|
42
|
+
recordProviderOutcome: "SELECT public.ep_gate_admission_record_provider_outcome($1::text, $2::text, $3::text, $4::bigint, $5::text, $6::text, $7::text, $8::text, $9::text) AS result";
|
|
43
|
+
recordEffectRelation: "SELECT public.ep_gate_admission_record_effect_relation($1::text, $2::text, $3::text, $4::bigint, $5::text, $6::text, $7::text, $8::text, $9::text) AS result";
|
|
44
|
+
read: "SELECT public.ep_gate_admission_read($1::text, $2::text, $3::text) AS result";
|
|
45
|
+
readByOperation: "SELECT public.ep_gate_admission_read_by_operation($1::text, $2::text, $3::text) AS result";
|
|
46
|
+
readSnapshot: "SELECT public.ep_gate_admission_read_snapshot($1::text, $2::text, $3::text) AS result";
|
|
47
|
+
journal: "SELECT public.ep_gate_admission_journal($1::text, $2::text, $3::text) AS result";
|
|
48
|
+
checkInvariants: "SELECT public.ep_gate_admission_check_invariants($1::text, $2::text) AS result";
|
|
49
|
+
}>;
|
|
50
|
+
export declare class AdmissionPostgresProtocolError extends Error {
|
|
51
|
+
constructor(message: string, options?: ErrorOptions);
|
|
52
|
+
}
|
|
53
|
+
export declare class AdmissionPostgresAmbiguousBeginError extends Error {
|
|
54
|
+
readonly admissionId: string;
|
|
55
|
+
constructor(admissionId: string, message: string, options?: ErrorOptions);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Creates a durable single-tenant store bound to one installed deployment row.
|
|
59
|
+
* The SQL deliberately has no session-user-to-tenant mapping: database access
|
|
60
|
+
* is the deployment boundary and every RPC rechecks the singleton binding.
|
|
61
|
+
*/
|
|
62
|
+
export declare function createAdmissionPostgresStore(options: CreateAdmissionPostgresStoreOptions): AdmissionPostgresStore;
|
|
63
|
+
/** Compatibility alias following the noun-first naming used by some stores. */
|
|
64
|
+
export declare const createPostgresAdmissionStore: typeof createAdmissionPostgresStore;
|
|
65
|
+
export default createAdmissionPostgresStore;
|
|
66
|
+
//# sourceMappingURL=admission-store-postgres.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admission-store-postgres.d.ts","sourceRoot":"","sources":["../src/admission-store-postgres.ts"],"names":[],"mappings":"AACA;;;;;;;;;GASG;AAIH,OAAO,EAoBL,KAAK,cAAc,EAIpB,MAAM,sBAAsB,CAAC;AAI9B,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACvC;AAED,MAAM,MAAM,sBAAsB,GAAG,CACnC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,SAAS,OAAO,EAAE,KACvB,OAAO,CAAC,4BAA4B,CAAC,CAAC;AAE3C,MAAM,WAAW,mCAAmC;IAClD,KAAK,EAAE,sBAAsB,CAAC;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,+EAA+E;IAC/E,iBAAiB,CAAC,EAAE,MAAM,MAAM,CAAC;IACjC,+EAA+E;IAC/E,sBAAsB,CAAC,EAAE,MAAM,MAAM,CAAC;IACtC,0EAA0E;IAC1E,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC;AAED,MAAM,WAAW,sBAAuB,SAAQ,cAAc;IAC5D,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAC;IACxC,QAAQ,CAAC,YAAY,EAAE,IAAI,CAAC;IAC5B,QAAQ,CAAC,eAAe,EAAE,IAAI,CAAC;IAC/B,QAAQ,CAAC,6BAA6B,EAAE,KAAK,CAAC;IAC9C,QAAQ,CAAC,qBAAqB,EAAE,MAAM,CAAC;CACxC;AAED,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;EAcjC,CAAC;AAQH,qBAAa,8BAA+B,SAAQ,KAAK;gBAC3C,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY;CAIpD;AAED,qBAAa,oCAAqC,SAAQ,KAAK;IAC7D,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;gBACjB,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY;CAKzE;AAoMD;;;;GAIG;AACH,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,mCAAmC,GAC3C,sBAAsB,CA0XxB;AAED,+EAA+E;AAC/E,eAAO,MAAM,4BAA4B,qCAA+B,CAAC;AAEzE,eAAe,4BAA4B,CAAC"}
|