@agenticprimitives/fabric 0.0.0-alpha.1 → 0.0.0-alpha.11
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/CLAUDE.md +26 -30
- package/README.md +16 -16
- package/dist/case-emissions.d.ts +95 -0
- package/dist/case-emissions.d.ts.map +1 -0
- package/dist/case-emissions.js +208 -0
- package/dist/case-emissions.js.map +1 -0
- package/dist/case-machine.d.ts +28 -2
- package/dist/case-machine.d.ts.map +1 -1
- package/dist/case-machine.js +34 -7
- package/dist/case-machine.js.map +1 -1
- package/dist/cloudflare/authority-verdict-cache.d.ts +28 -1
- package/dist/cloudflare/authority-verdict-cache.d.ts.map +1 -1
- package/dist/cloudflare/authority-verdict-cache.js +32 -1
- package/dist/cloudflare/authority-verdict-cache.js.map +1 -1
- package/dist/cloudflare/index.d.ts +4 -1
- package/dist/cloudflare/index.d.ts.map +1 -1
- package/dist/cloudflare/index.js +7 -1
- package/dist/cloudflare/index.js.map +1 -1
- package/dist/cloudflare/interaction-store.d.ts +55 -0
- package/dist/cloudflare/interaction-store.d.ts.map +1 -0
- package/dist/cloudflare/interaction-store.js +230 -0
- package/dist/cloudflare/interaction-store.js.map +1 -0
- package/dist/cloudflare/principal-gateway-do.d.ts +136 -2
- package/dist/cloudflare/principal-gateway-do.d.ts.map +1 -1
- package/dist/cloudflare/principal-gateway-do.js +190 -8
- package/dist/cloudflare/principal-gateway-do.js.map +1 -1
- package/dist/cloudflare/vault-exchange-store.d.ts +47 -0
- package/dist/cloudflare/vault-exchange-store.d.ts.map +1 -0
- package/dist/cloudflare/vault-exchange-store.js +118 -0
- package/dist/cloudflare/vault-exchange-store.js.map +1 -0
- package/dist/cloudflare/vault-interaction-store.d.ts +44 -0
- package/dist/cloudflare/vault-interaction-store.d.ts.map +1 -0
- package/dist/cloudflare/vault-interaction-store.js +245 -0
- package/dist/cloudflare/vault-interaction-store.js.map +1 -0
- package/dist/communicative-act.d.ts +24 -1
- package/dist/communicative-act.d.ts.map +1 -1
- package/dist/communicative-act.js +28 -0
- package/dist/communicative-act.js.map +1 -1
- package/dist/delivery-envelope.d.ts.map +1 -1
- package/dist/delivery-envelope.js +0 -1
- package/dist/delivery-envelope.js.map +1 -1
- package/dist/enum-retirement.d.ts +43 -0
- package/dist/enum-retirement.d.ts.map +1 -0
- package/dist/enum-retirement.js +93 -0
- package/dist/enum-retirement.js.map +1 -0
- package/dist/exchange-record.d.ts +35 -4
- package/dist/exchange-record.d.ts.map +1 -1
- package/dist/exchange-record.js.map +1 -1
- package/dist/exchange-reducer.d.ts +32 -4
- package/dist/exchange-reducer.d.ts.map +1 -1
- package/dist/exchange-reducer.js +75 -1
- package/dist/exchange-reducer.js.map +1 -1
- package/dist/exchange-state.d.ts +30 -8
- package/dist/exchange-state.d.ts.map +1 -1
- package/dist/exchange-state.js +12 -10
- package/dist/exchange-state.js.map +1 -1
- package/dist/inbox-doc.d.ts +2 -2
- package/dist/inbox-doc.d.ts.map +1 -1
- package/dist/inbox-doc.js.map +1 -1
- package/dist/inbox-projection.d.ts +2 -2
- package/dist/inbox-projection.d.ts.map +1 -1
- package/dist/inbox-projection.js.map +1 -1
- package/dist/inbox-revision.d.ts +42 -0
- package/dist/inbox-revision.d.ts.map +1 -0
- package/dist/inbox-revision.js +57 -0
- package/dist/inbox-revision.js.map +1 -0
- package/dist/index.d.ts +24 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +37 -2
- package/dist/index.js.map +1 -1
- package/dist/interaction-machines.d.ts +136 -0
- package/dist/interaction-machines.d.ts.map +1 -0
- package/dist/interaction-machines.js +174 -0
- package/dist/interaction-machines.js.map +1 -0
- package/dist/interaction-profile.d.ts +126 -0
- package/dist/interaction-profile.d.ts.map +1 -0
- package/dist/interaction-profile.js +192 -0
- package/dist/interaction-profile.js.map +1 -0
- package/dist/interaction-record.d.ts +168 -0
- package/dist/interaction-record.d.ts.map +1 -0
- package/dist/interaction-record.js +108 -0
- package/dist/interaction-record.js.map +1 -0
- package/dist/interactions/machine.d.ts +2 -2
- package/dist/interactions/machine.d.ts.map +1 -1
- package/dist/interactions/machine.js +2 -2
- package/dist/interactions/machine.js.map +1 -1
- package/dist/interactions/open-case.d.ts +60 -0
- package/dist/interactions/open-case.d.ts.map +1 -0
- package/dist/interactions/open-case.js +83 -0
- package/dist/interactions/open-case.js.map +1 -0
- package/dist/interactions/store.d.ts +9 -0
- package/dist/interactions/store.d.ts.map +1 -1
- package/dist/interactions/store.js +57 -2
- package/dist/interactions/store.js.map +1 -1
- package/dist/messaging/board.d.ts +86 -6
- package/dist/messaging/board.d.ts.map +1 -1
- package/dist/messaging/board.js +100 -9
- package/dist/messaging/board.js.map +1 -1
- package/dist/messaging/consult-routing.d.ts +289 -0
- package/dist/messaging/consult-routing.d.ts.map +1 -0
- package/dist/messaging/consult-routing.js +455 -0
- package/dist/messaging/consult-routing.js.map +1 -0
- package/dist/messaging/consult.d.ts +158 -0
- package/dist/messaging/consult.d.ts.map +1 -0
- package/dist/messaging/consult.js +141 -0
- package/dist/messaging/consult.js.map +1 -0
- package/dist/messaging/conversation-interaction.d.ts +66 -0
- package/dist/messaging/conversation-interaction.d.ts.map +1 -0
- package/dist/messaging/conversation-interaction.js +139 -0
- package/dist/messaging/conversation-interaction.js.map +1 -0
- package/dist/messaging/delivery.d.ts +2 -2
- package/dist/messaging/delivery.d.ts.map +1 -1
- package/dist/messaging/delivery.js +8 -1
- package/dist/messaging/delivery.js.map +1 -1
- package/dist/messaging/directory.d.ts +16 -0
- package/dist/messaging/directory.d.ts.map +1 -1
- package/dist/messaging/directory.js.map +1 -1
- package/dist/messaging/envelope.d.ts +7 -3
- package/dist/messaging/envelope.d.ts.map +1 -1
- package/dist/messaging/envelope.js +18 -1
- package/dist/messaging/envelope.js.map +1 -1
- package/dist/messaging/hash.d.ts +8 -2
- package/dist/messaging/hash.d.ts.map +1 -1
- package/dist/messaging/hash.js +6 -0
- package/dist/messaging/hash.js.map +1 -1
- package/dist/messaging/inbox-assistant.d.ts +80 -0
- package/dist/messaging/inbox-assistant.d.ts.map +1 -0
- package/dist/messaging/inbox-assistant.js +125 -0
- package/dist/messaging/inbox-assistant.js.map +1 -0
- package/dist/messaging/index.d.ts +10 -3
- package/dist/messaging/index.d.ts.map +1 -1
- package/dist/messaging/index.js +20 -2
- package/dist/messaging/index.js.map +1 -1
- package/dist/messaging/outbound-message.d.ts +42 -0
- package/dist/messaging/outbound-message.d.ts.map +1 -0
- package/dist/messaging/outbound-message.js +64 -0
- package/dist/messaging/outbound-message.js.map +1 -0
- package/dist/messaging/projector.d.ts +3 -3
- package/dist/messaging/projector.d.ts.map +1 -1
- package/dist/messaging/projector.js.map +1 -1
- package/dist/messaging/receipts.d.ts +3 -3
- package/dist/messaging/receipts.d.ts.map +1 -1
- package/dist/messaging/receipts.js.map +1 -1
- package/dist/messaging/rules.d.ts +10 -3
- package/dist/messaging/rules.d.ts.map +1 -1
- package/dist/messaging/rules.js +8 -1
- package/dist/messaging/rules.js.map +1 -1
- package/dist/messaging/store.d.ts +4 -4
- package/dist/messaging/store.d.ts.map +1 -1
- package/dist/messaging/store.js +5 -3
- package/dist/messaging/store.js.map +1 -1
- package/dist/messaging/types.d.ts +52 -0
- package/dist/messaging/types.d.ts.map +1 -1
- package/dist/messaging/types.js +18 -1
- package/dist/messaging/types.js.map +1 -1
- package/dist/messaging/vault-store.d.ts +35 -2
- package/dist/messaging/vault-store.d.ts.map +1 -1
- package/dist/messaging/vault-store.js +53 -5
- package/dist/messaging/vault-store.js.map +1 -1
- package/dist/protocol-binding.d.ts +71 -0
- package/dist/protocol-binding.d.ts.map +1 -0
- package/dist/protocol-binding.js +0 -0
- package/dist/protocol-binding.js.map +1 -0
- package/dist/record-catalog.d.ts.map +1 -1
- package/dist/record-catalog.js +24 -0
- package/dist/record-catalog.js.map +1 -1
- package/package.json +7 -7
|
@@ -23,5 +23,32 @@ export interface AuthorityVerdictCache {
|
|
|
23
23
|
/** Deployment-epoch change (spec 311): drop every verdict NOT on `currentEpoch`. */
|
|
24
24
|
sweepEpoch(currentEpoch: string): Promise<void>;
|
|
25
25
|
}
|
|
26
|
-
|
|
26
|
+
/**
|
|
27
|
+
* How long a cached verdict may be reused before the cold path must run again.
|
|
28
|
+
*
|
|
29
|
+
* 60s mirrors `InteractionsDO`'s existing positive-verdict cache (NEW-H4/FAB-A2A-1), which was sized as
|
|
30
|
+
* an RPC-429 mitigation for high-frequency non-sensitive reads. Matching it keeps ONE number in the
|
|
31
|
+
* deployment rather than two that drift.
|
|
32
|
+
*/
|
|
33
|
+
export declare const VERDICT_TTL_MS = 60000;
|
|
34
|
+
export interface VerdictCacheOptions {
|
|
35
|
+
/** Bounded reuse window. `0` disables caching entirely (every get misses ⇒ cold path every call). */
|
|
36
|
+
ttlMs?: number;
|
|
37
|
+
now?: () => number;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* BOUNDED REUSE IS PART OF THE VERDICT, NOT AN OPTIMISATION KNOB.
|
|
41
|
+
*
|
|
42
|
+
* Verdict (A) asserts "this delegation was valid AND UNREVOKED at `verifiedAt`". Serving it later without
|
|
43
|
+
* regard to age silently upgrades that into "is valid and unrevoked", which is a claim the cold path never
|
|
44
|
+
* made. Before this, `verified_at` was written and never read: a verdict cached once stayed warm forever,
|
|
45
|
+
* and a revoked delegation kept passing (A) until something called `invalidateDelegation` — a revocation
|
|
46
|
+
* NOTICE that has to be delivered by a second mechanism and may simply never arrive. Revocation that only
|
|
47
|
+
* works when someone remembers to push it is not revocation.
|
|
48
|
+
*
|
|
49
|
+
* Expiry is a MISS, not an error: `invokeFast` refuses on a miss and the caller re-runs `verifyAndCache`,
|
|
50
|
+
* which re-checks the signature and `isRevoked` on-chain. So the ceiling on serving a revoked delegation
|
|
51
|
+
* is `ttlMs`, and the mechanism is the same one throughout (ADR-0013) — the cold path, run again.
|
|
52
|
+
*/
|
|
53
|
+
export declare function createDurableObjectAuthorityVerdictCache(sql: SqlStorage, opts?: VerdictCacheOptions): AuthorityVerdictCache;
|
|
27
54
|
//# sourceMappingURL=authority-verdict-cache.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authority-verdict-cache.d.ts","sourceRoot":"","sources":["../../src/cloudflare/authority-verdict-cache.ts"],"names":[],"mappings":"AA6BA;4GAC4G;AAC5G,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,kGAAkG;IAClG,KAAK,EAAE,MAAM,CAAC;IACd,uEAAuE;IACvE,OAAO,EAAE,MAAM,CAAC;IAChB,4EAA4E;IAC5E,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,mBAAmB,GAAG,IAAI,CAAC,gBAAgB,EAAE,YAAY,GAAG,gBAAgB,GAAG,OAAO,GAAG,SAAS,CAAC,CAAC;AAYhH,MAAM,WAAW,qBAAqB;IACpC,yDAAyD;IACzD,GAAG,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9C;mGAC+F;IAC/F,GAAG,CAAC,GAAG,EAAE,mBAAmB,GAAG,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAAC;IAChE,uFAAuF;IACvF,oBAAoB,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5D,oFAAoF;IACpF,UAAU,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACjD;AAKD,wBAAgB,wCAAwC,
|
|
1
|
+
{"version":3,"file":"authority-verdict-cache.d.ts","sourceRoot":"","sources":["../../src/cloudflare/authority-verdict-cache.ts"],"names":[],"mappings":"AA6BA;4GAC4G;AAC5G,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,kGAAkG;IAClG,KAAK,EAAE,MAAM,CAAC;IACd,uEAAuE;IACvE,OAAO,EAAE,MAAM,CAAC;IAChB,4EAA4E;IAC5E,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,mBAAmB,GAAG,IAAI,CAAC,gBAAgB,EAAE,YAAY,GAAG,gBAAgB,GAAG,OAAO,GAAG,SAAS,CAAC,CAAC;AAYhH,MAAM,WAAW,qBAAqB;IACpC,yDAAyD;IACzD,GAAG,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9C;mGAC+F;IAC/F,GAAG,CAAC,GAAG,EAAE,mBAAmB,GAAG,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAAC;IAChE,uFAAuF;IACvF,oBAAoB,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5D,oFAAoF;IACpF,UAAU,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACjD;AAKD;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,QAAS,CAAC;AAErC,MAAM,WAAW,mBAAmB;IAClC,qGAAqG;IACrG,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,wCAAwC,CACtD,GAAG,EAAE,UAAU,EACf,IAAI,CAAC,EAAE,mBAAmB,GACzB,qBAAqB,CAsDvB"}
|
|
@@ -26,10 +26,34 @@ const CREATE_TABLE = `CREATE TABLE IF NOT EXISTS authority_verdicts (
|
|
|
26
26
|
const CREATE_IDX_DELEG = `CREATE INDEX IF NOT EXISTS idx_authority_verdicts_deleg ON authority_verdicts (delegation_hash)`;
|
|
27
27
|
const CREATE_IDX_EPOCH = `CREATE INDEX IF NOT EXISTS idx_authority_verdicts_epoch ON authority_verdicts (epoch)`;
|
|
28
28
|
const keyOf = (k) => `${k.sessionKey.toLowerCase()}|${k.delegationHash.toLowerCase()}|${k.epoch}|${k.manager.toLowerCase()}`;
|
|
29
|
-
|
|
29
|
+
/**
|
|
30
|
+
* How long a cached verdict may be reused before the cold path must run again.
|
|
31
|
+
*
|
|
32
|
+
* 60s mirrors `InteractionsDO`'s existing positive-verdict cache (NEW-H4/FAB-A2A-1), which was sized as
|
|
33
|
+
* an RPC-429 mitigation for high-frequency non-sensitive reads. Matching it keeps ONE number in the
|
|
34
|
+
* deployment rather than two that drift.
|
|
35
|
+
*/
|
|
36
|
+
export const VERDICT_TTL_MS = 60_000;
|
|
37
|
+
/**
|
|
38
|
+
* BOUNDED REUSE IS PART OF THE VERDICT, NOT AN OPTIMISATION KNOB.
|
|
39
|
+
*
|
|
40
|
+
* Verdict (A) asserts "this delegation was valid AND UNREVOKED at `verifiedAt`". Serving it later without
|
|
41
|
+
* regard to age silently upgrades that into "is valid and unrevoked", which is a claim the cold path never
|
|
42
|
+
* made. Before this, `verified_at` was written and never read: a verdict cached once stayed warm forever,
|
|
43
|
+
* and a revoked delegation kept passing (A) until something called `invalidateDelegation` — a revocation
|
|
44
|
+
* NOTICE that has to be delivered by a second mechanism and may simply never arrive. Revocation that only
|
|
45
|
+
* works when someone remembers to push it is not revocation.
|
|
46
|
+
*
|
|
47
|
+
* Expiry is a MISS, not an error: `invokeFast` refuses on a miss and the caller re-runs `verifyAndCache`,
|
|
48
|
+
* which re-checks the signature and `isRevoked` on-chain. So the ceiling on serving a revoked delegation
|
|
49
|
+
* is `ttlMs`, and the mechanism is the same one throughout (ADR-0013) — the cold path, run again.
|
|
50
|
+
*/
|
|
51
|
+
export function createDurableObjectAuthorityVerdictCache(sql, opts) {
|
|
30
52
|
sql.exec(CREATE_TABLE);
|
|
31
53
|
sql.exec(CREATE_IDX_DELEG);
|
|
32
54
|
sql.exec(CREATE_IDX_EPOCH);
|
|
55
|
+
const ttlMs = opts?.ttlMs ?? VERDICT_TTL_MS;
|
|
56
|
+
const now = opts?.now ?? (() => Date.now());
|
|
33
57
|
return {
|
|
34
58
|
async put(v) {
|
|
35
59
|
sql.exec(`INSERT INTO authority_verdicts (cache_key, principal, session_key, delegation_hash, epoch, manager, verified_at)
|
|
@@ -46,6 +70,13 @@ export function createDurableObjectAuthorityVerdictCache(sql) {
|
|
|
46
70
|
const r = rows[0];
|
|
47
71
|
if (!r)
|
|
48
72
|
return null;
|
|
73
|
+
// Age it out. An unparseable `verified_at` counts as EXPIRED: a row whose age cannot be established
|
|
74
|
+
// is one whose freshness cannot be established, and the safe reading of "I don't know" is a miss.
|
|
75
|
+
const verifiedAtMs = Date.parse(r.verified_at);
|
|
76
|
+
if (!Number.isFinite(verifiedAtMs) || now() - verifiedAtMs >= ttlMs) {
|
|
77
|
+
sql.exec('DELETE FROM authority_verdicts WHERE cache_key = ?', keyOf(key));
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
49
80
|
return {
|
|
50
81
|
principal: r.principal,
|
|
51
82
|
sessionKey: r.session_key,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authority-verdict-cache.js","sourceRoot":"","sources":["../../src/cloudflare/authority-verdict-cache.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD,uEAAuE;AACvE,EAAE;AACF,0FAA0F;AAC1F,2GAA2G;AAC3G,oGAAoG;AACpG,iGAAiG;AACjG,4GAA4G;AAC5G,qDAAqD;AACrD,wGAAwG;AACxG,yGAAyG;AACzG,wGAAwG;AACxG,4GAA4G;AAC5G,oGAAoG;AACpG,EAAE;AACF,0GAA0G;AAE1G,MAAM,YAAY,GAAG;;;;;;;;EAQnB,CAAC;AACH,MAAM,gBAAgB,GAAG,iGAAiG,CAAC;AAC3H,MAAM,gBAAgB,GAAG,uFAAuF,CAAC;AAwCjH,MAAM,KAAK,GAAG,CAAC,CAAsB,EAAU,EAAE,CAC/C,GAAG,CAAC,CAAC,UAAU,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC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AC;QACJ,CAAC;QACD,KAAK,CAAC,oBAAoB,CAAC,cAAc;YACvC,GAAG,CAAC,IAAI,CAAC,0DAA0D,EAAE,cAAc,CAAC,WAAW,EAAE,CAAC,CAAC;QACrG,CAAC;QACD,KAAK,CAAC,UAAU,CAAC,YAAY;YAC3B,GAAG,CAAC,IAAI,CAAC,iDAAiD,EAAE,YAAY,CAAC,CAAC;QAC5E,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
export { createDurableObjectSqlVault } from './sql-vault.js';
|
|
2
2
|
export { createDurableObjectExchangeStore, type ExchangeStore } from './exchange-store.js';
|
|
3
|
+
export { createDurableObjectInteractionStore, type InteractionStore, type SnapshotPutResult, } from './interaction-store.js';
|
|
3
4
|
export { createDurableObjectOutboxStore, type OutboxStore, type OutboxEntry } from './outbox-store.js';
|
|
4
5
|
export { createDurableObjectProvenanceStore, type ProvenanceStore } from './provenance-store.js';
|
|
5
6
|
export { createDurableObjectChannelStore, projectionAuthorizes, type ChannelStore, type ChannelV1, type ConversationRoleProjection, type ConversationRoleAction, } from './channel-store.js';
|
|
6
|
-
export { createDurableObjectAuthorityVerdictCache, type AuthorityVerdictCache, type AuthorityVerdict, type AuthorityVerdictKey, } from './authority-verdict-cache.js';
|
|
7
|
+
export { createDurableObjectAuthorityVerdictCache, VERDICT_TTL_MS, type VerdictCacheOptions, type AuthorityVerdictCache, type AuthorityVerdict, type AuthorityVerdictKey, } from './authority-verdict-cache.js';
|
|
7
8
|
export { createDurableObjectRequestIdLedger, type RequestIdLedger, type RequestIdReservation } from './request-id-ledger.js';
|
|
8
9
|
export { createDurableObjectReceiptSigner, verifyDeliveryReceipt, type DeliveryReceiptSigner, type DeliveryReceiptInput, type SignedDeliveryReceiptV1, } from './receipt-signer.js';
|
|
9
10
|
export { PrincipalGatewayDO, type PrincipalGatewayEnv, type GatewayDeps } from './principal-gateway-do.js';
|
|
10
11
|
export { buildVaultTools, createToolRegistry, type GatewayTool, type GatewayToolContext, type GatewayToolRegistry, } from './gateway-tools.js';
|
|
11
12
|
export { runGatewayOrchestration, gatewayToolSpecs, bindGatewayToolInvoker } from './orchestration-runtime.js';
|
|
13
|
+
export { createVaultExchangeStore, exchangeResource, EXCHANGE_INDEX_RESOURCE, type VaultExchangeStore, type ExchangeIndexV1, } from './vault-exchange-store.js';
|
|
14
|
+
export { createVaultInteractionStore, interactionResource, decisionResource, commitmentResource, snapshotResource, inboxEntryResource, INTERACTION_INDEX_RESOURCE, type VaultInteractionStore, type InteractionIndexV1, } from './vault-interaction-store.js';
|
|
12
15
|
export declare const FABRIC_CLOUDFLARE_ADAPTER_STATUS: "w2-coresident-mcp";
|
|
13
16
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cloudflare/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,gCAAgC,EAAE,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cloudflare/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,gCAAgC,EAAE,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAI3F,OAAO,EACL,mCAAmC,EACnC,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,GACvB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,8BAA8B,EAAE,KAAK,WAAW,EAAE,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACvG,OAAO,EAAE,kCAAkC,EAAE,KAAK,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACjG,OAAO,EACL,+BAA+B,EAAE,oBAAoB,EACrD,KAAK,YAAY,EAAE,KAAK,SAAS,EAAE,KAAK,0BAA0B,EAAE,KAAK,sBAAsB,GAChG,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,wCAAwC,EACxC,cAAc,EACd,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,GACzB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,kCAAkC,EAAE,KAAK,eAAe,EAAE,KAAK,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC7H,OAAO,EACL,gCAAgC,EAChC,qBAAqB,EACrB,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,KAAK,uBAAuB,GAC7B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,kBAAkB,EAAE,KAAK,mBAAmB,EAAE,KAAK,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAC3G,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,GACzB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAC/G,OAAO,EACL,wBAAwB,EACxB,gBAAgB,EAChB,uBAAuB,EACvB,KAAK,kBAAkB,EACvB,KAAK,eAAe,GACrB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,2BAA2B,EAC3B,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,0BAA0B,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,GACxB,MAAM,8BAA8B,CAAC;AAEtC,eAAO,MAAM,gCAAgC,EAAG,mBAA4B,CAAC"}
|
package/dist/cloudflare/index.js
CHANGED
|
@@ -7,14 +7,20 @@
|
|
|
7
7
|
// absorption follow in subsequent W2 steps.
|
|
8
8
|
export { createDurableObjectSqlVault } from './sql-vault.js';
|
|
9
9
|
export { createDurableObjectExchangeStore } from './exchange-store.js';
|
|
10
|
+
// The interaction spine's durable home (spec 340 W6) — interactions, context snapshots, decisions,
|
|
11
|
+
// commitments and per-viewer inbox state. Five tables, because the six machines answer to different
|
|
12
|
+
// parties at different times and one row would make them one write.
|
|
13
|
+
export { createDurableObjectInteractionStore, } from './interaction-store.js';
|
|
10
14
|
export { createDurableObjectOutboxStore } from './outbox-store.js';
|
|
11
15
|
export { createDurableObjectProvenanceStore } from './provenance-store.js';
|
|
12
16
|
export { createDurableObjectChannelStore, projectionAuthorizes, } from './channel-store.js';
|
|
13
|
-
export { createDurableObjectAuthorityVerdictCache, } from './authority-verdict-cache.js';
|
|
17
|
+
export { createDurableObjectAuthorityVerdictCache, VERDICT_TTL_MS, } from './authority-verdict-cache.js';
|
|
14
18
|
export { createDurableObjectRequestIdLedger } from './request-id-ledger.js';
|
|
15
19
|
export { createDurableObjectReceiptSigner, verifyDeliveryReceipt, } from './receipt-signer.js';
|
|
16
20
|
export { PrincipalGatewayDO } from './principal-gateway-do.js';
|
|
17
21
|
export { buildVaultTools, createToolRegistry, } from './gateway-tools.js';
|
|
18
22
|
export { runGatewayOrchestration, gatewayToolSpecs, bindGatewayToolInvoker } from './orchestration-runtime.js';
|
|
23
|
+
export { createVaultExchangeStore, exchangeResource, EXCHANGE_INDEX_RESOURCE, } from './vault-exchange-store.js';
|
|
24
|
+
export { createVaultInteractionStore, interactionResource, decisionResource, commitmentResource, snapshotResource, inboxEntryResource, INTERACTION_INDEX_RESOURCE, } from './vault-interaction-store.js';
|
|
19
25
|
export const FABRIC_CLOUDFLARE_ADAPTER_STATUS = 'w2-coresident-mcp';
|
|
20
26
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cloudflare/index.ts"],"names":[],"mappings":"AAAA,0GAA0G;AAC1G,EAAE;AACF,wGAAwG;AACxG,wGAAwG;AACxG,yGAAyG;AACzG,yGAA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AAgB,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAC/G,OAAO,EACL,wBAAwB,EACxB,gBAAgB,EAChB,uBAAuB,GAGxB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,2BAA2B,EAC3B,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,0BAA0B,GAG3B,MAAM,8BAA8B,CAAC;AAEtC,MAAM,CAAC,MAAM,gCAAgC,GAAG,mBAA4B,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { InteractionRecordV1, InteractionId, ContextSnapshotV1 } from '../interaction-record.js';
|
|
2
|
+
import { type InteractionLifecycleV1, type InteractionTransition, type DecisionRecordV1, type DecisionTransition, type CommitmentRecordV1, type CommitmentTransition, type InboxEntryV1, type InboxTransition, type MachineResult } from '../interaction-machines.js';
|
|
3
|
+
import { type ProtocolBindingV1, type BindingResolution } from '../protocol-binding.js';
|
|
4
|
+
import type { CanonicalAgentId } from '@agenticprimitives/types';
|
|
5
|
+
export type SnapshotPutResult = {
|
|
6
|
+
ok: true;
|
|
7
|
+
stored: 'new' | 'identical';
|
|
8
|
+
} | {
|
|
9
|
+
ok: false;
|
|
10
|
+
reason: 'digest-mismatch';
|
|
11
|
+
};
|
|
12
|
+
export interface InteractionStore {
|
|
13
|
+
putInteraction(record: InteractionRecordV1): Promise<void>;
|
|
14
|
+
getInteraction(id: InteractionId | string): Promise<InteractionRecordV1 | null>;
|
|
15
|
+
listInteractions(): Promise<InteractionRecordV1[]>;
|
|
16
|
+
/** Drive the interaction lifecycle THROUGH its machine. `null` when the interaction is unknown. */
|
|
17
|
+
transitionInteraction(id: InteractionId | string, event: {
|
|
18
|
+
transition: InteractionTransition;
|
|
19
|
+
actor: CanonicalAgentId;
|
|
20
|
+
at: string;
|
|
21
|
+
}): Promise<MachineResult<InteractionLifecycleV1> | null>;
|
|
22
|
+
/** Index a foreign correlator. Duplicates across interactions are KEPT — that is the ambiguity. */
|
|
23
|
+
bindProtocolTo(id: InteractionId, binding: ProtocolBindingV1): Promise<void>;
|
|
24
|
+
resolveByBinding(protocol: string, field: string, value: string): Promise<BindingResolution>;
|
|
25
|
+
/** Content-addressed. Verifies the digest against the bytes before storing — which IS the
|
|
26
|
+
* immutability guarantee: forged content cannot reach a digest it does not hash to. */
|
|
27
|
+
putContextSnapshot(snapshot: ContextSnapshotV1): Promise<SnapshotPutResult>;
|
|
28
|
+
getContextSnapshot(digest: string): Promise<ContextSnapshotV1 | null>;
|
|
29
|
+
putDecision(record: DecisionRecordV1): Promise<void>;
|
|
30
|
+
getDecision(id: string): Promise<DecisionRecordV1 | null>;
|
|
31
|
+
transitionDecision(id: string, event: {
|
|
32
|
+
transition: DecisionTransition;
|
|
33
|
+
actor: CanonicalAgentId;
|
|
34
|
+
at: string;
|
|
35
|
+
subject?: string;
|
|
36
|
+
}): Promise<MachineResult<DecisionRecordV1> | null>;
|
|
37
|
+
putCommitment(record: CommitmentRecordV1): Promise<void>;
|
|
38
|
+
getCommitment(id: string): Promise<CommitmentRecordV1 | null>;
|
|
39
|
+
/** Open obligations — the query "what is still owed" that a single `case` field could not answer. */
|
|
40
|
+
listOpenCommitments(): Promise<CommitmentRecordV1[]>;
|
|
41
|
+
transitionCommitment(id: string, event: {
|
|
42
|
+
transition: CommitmentTransition;
|
|
43
|
+
actor: CanonicalAgentId;
|
|
44
|
+
at: string;
|
|
45
|
+
}): Promise<MachineResult<CommitmentRecordV1> | null>;
|
|
46
|
+
putInboxEntry(entry: InboxEntryV1): Promise<void>;
|
|
47
|
+
getInboxEntry(viewer: CanonicalAgentId, exchangeId: string): Promise<InboxEntryV1 | null>;
|
|
48
|
+
transitionInbox(viewer: CanonicalAgentId, exchangeId: string, event: {
|
|
49
|
+
transition: InboxTransition;
|
|
50
|
+
actor: CanonicalAgentId;
|
|
51
|
+
at: string;
|
|
52
|
+
}): Promise<MachineResult<InboxEntryV1> | null>;
|
|
53
|
+
}
|
|
54
|
+
export declare function createDurableObjectInteractionStore(sql: SqlStorage): InteractionStore;
|
|
55
|
+
//# sourceMappingURL=interaction-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interaction-store.d.ts","sourceRoot":"","sources":["../../src/cloudflare/interaction-store.ts"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EAAE,mBAAmB,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAEtG,OAAO,EAKL,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,aAAa,EACnB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAGL,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACvB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AA8CjE,MAAM,MAAM,iBAAiB,GACzB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,KAAK,GAAG,WAAW,CAAA;CAAE,GACzC;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,iBAAiB,CAAA;CAAE,CAAC;AAE7C,MAAM,WAAW,gBAAgB;IAC/B,cAAc,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3D,cAAc,CAAC,EAAE,EAAE,aAAa,GAAG,MAAM,GAAG,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC,CAAC;IAChF,gBAAgB,IAAI,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAAC;IACnD,mGAAmG;IACnG,qBAAqB,CACnB,EAAE,EAAE,aAAa,GAAG,MAAM,EAC1B,KAAK,EAAE;QAAE,UAAU,EAAE,qBAAqB,CAAC;QAA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AAoB,CAClB,EAAE,EAAE,MAAM,EACV,KAAK,EAAE;QAAE,UAAU,EAAE,oBAAoB,CAAC;QAAC,KAAK,EAAE,gBAAgB,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,GAC/E,OAAO,CAAC,aAAa,CAAC,kBAAkB,CAAC,GAAG,IAAI,CAAC,CAAC;IAErD,aAAa,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAClD,aAAa,CAAC,MAAM,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC;IAC1F,eAAe,CACb,MAAM,EAAE,gBAAgB,EACxB,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE;QAAE,UAAU,EAAE,eAAe,CAAC;QAAC,KAAK,EAAE,gBAAgB,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,GAC1E,OAAO,CAAC,aAAa,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC,CAAC;CAChD;AAKD,wBAAgB,mCAAmC,CAAC,GAAG,EAAE,UAAU,GAAG,gBAAgB,CA4LrF"}
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
/// <reference types="@cloudflare/workers-types" />
|
|
2
|
+
// DO-local InteractionStore (spec 340 W6) — durable homes for the records W2–W5 defined and nothing
|
|
3
|
+
// wrote. The `PrincipalGatewayDO` is the single writer for its principal, so no cross-writer races.
|
|
4
|
+
//
|
|
5
|
+
// Five tables, and the reason they are five rather than one wide row is the reason there are six state
|
|
6
|
+
// machines: an interaction's lifecycle, a decision, a commitment and a viewer's inbox state are
|
|
7
|
+
// answered by different parties at different times, and one row would make them one write.
|
|
8
|
+
//
|
|
9
|
+
// TWO INVARIANTS THIS LAYER OWNS, both about immutability rather than authority:
|
|
10
|
+
//
|
|
11
|
+
// 1. A ContextSnapshot is CONTENT-ADDRESSED, and the digest check IS the immutability guarantee.
|
|
12
|
+
// `putContextSnapshot` verifies the digest against the bytes before storing, so a party cannot
|
|
13
|
+
// rewrite what an evaluator saw while every Exchange still pins the same hash — the forged
|
|
14
|
+
// snapshot is refused at the door, not detected later.
|
|
15
|
+
//
|
|
16
|
+
// There is deliberately no separate `immutable-conflict` outcome. It was written first and was
|
|
17
|
+
// BOTH dead and wrong: dead, because content that differs necessarily fails the digest check
|
|
18
|
+
// already; and wrong, because it compared `JSON.stringify` output, so the same snapshot re-put
|
|
19
|
+
// with a different key insertion order would have been rejected as a conflicting overwrite. A
|
|
20
|
+
// verified digest with a row already at it means the content is the same — that is what
|
|
21
|
+
// content-addressing means — so the re-put is a no-op.
|
|
22
|
+
// 2. Every transition goes through its machine. The store never sets a state directly, so "the
|
|
23
|
+
// creditor discharges, not the debtor" cannot be bypassed by writing the row.
|
|
24
|
+
//
|
|
25
|
+
// It confers nothing. Persisting a commitment does not make it owed; persisting a decision does not
|
|
26
|
+
// authorize anything. Authority is `delegation` + `entitlements` + `tool-policy` at the moment of
|
|
27
|
+
// acting (ADR-0041, ADR-0043).
|
|
28
|
+
import { verifyContextSnapshot } from '../interaction-record.js';
|
|
29
|
+
import { applyInteractionTransition, applyDecisionTransition, applyCommitmentTransition, applyInboxTransition, } from '../interaction-machines.js';
|
|
30
|
+
import { bindingKey, resolveInteractionByBinding, } from '../protocol-binding.js';
|
|
31
|
+
const CREATE_TABLES = [
|
|
32
|
+
`CREATE TABLE IF NOT EXISTS interaction_records (
|
|
33
|
+
interaction_id TEXT PRIMARY KEY,
|
|
34
|
+
record_json TEXT NOT NULL,
|
|
35
|
+
state TEXT NOT NULL,
|
|
36
|
+
rev INTEGER NOT NULL,
|
|
37
|
+
updated_at TEXT NOT NULL
|
|
38
|
+
)`,
|
|
39
|
+
// Keyed by the binding, not by the interaction: the lookup direction is foreign → ours, and a
|
|
40
|
+
// duplicate key across two interactions is the AMBIGUITY the resolver must be able to see. A UNIQUE
|
|
41
|
+
// constraint here would silently drop the second one and manufacture a confident wrong answer.
|
|
42
|
+
`CREATE TABLE IF NOT EXISTS interaction_bindings (
|
|
43
|
+
binding_key TEXT NOT NULL,
|
|
44
|
+
interaction_id TEXT NOT NULL,
|
|
45
|
+
binding_json TEXT NOT NULL,
|
|
46
|
+
PRIMARY KEY (binding_key, interaction_id)
|
|
47
|
+
)`,
|
|
48
|
+
`CREATE TABLE IF NOT EXISTS context_snapshots (
|
|
49
|
+
digest TEXT PRIMARY KEY,
|
|
50
|
+
snapshot_json TEXT NOT NULL
|
|
51
|
+
)`,
|
|
52
|
+
`CREATE TABLE IF NOT EXISTS decision_records (
|
|
53
|
+
decision_id TEXT PRIMARY KEY,
|
|
54
|
+
record_json TEXT NOT NULL,
|
|
55
|
+
updated_at TEXT NOT NULL
|
|
56
|
+
)`,
|
|
57
|
+
`CREATE TABLE IF NOT EXISTS commitment_records (
|
|
58
|
+
commitment_id TEXT PRIMARY KEY,
|
|
59
|
+
record_json TEXT NOT NULL,
|
|
60
|
+
state TEXT NOT NULL,
|
|
61
|
+
updated_at TEXT NOT NULL
|
|
62
|
+
)`,
|
|
63
|
+
`CREATE TABLE IF NOT EXISTS inbox_entries (
|
|
64
|
+
viewer TEXT NOT NULL,
|
|
65
|
+
exchange_id TEXT NOT NULL,
|
|
66
|
+
record_json TEXT NOT NULL,
|
|
67
|
+
PRIMARY KEY (viewer, exchange_id)
|
|
68
|
+
)`,
|
|
69
|
+
];
|
|
70
|
+
/** States an obligation is still live in. `discharged`/`breached`/`void` are ended, differently. */
|
|
71
|
+
const OPEN_COMMITMENT_STATES = ['proposed', 'active', 'fulfilment-claimed'];
|
|
72
|
+
export function createDurableObjectInteractionStore(sql) {
|
|
73
|
+
for (const ddl of CREATE_TABLES)
|
|
74
|
+
sql.exec(ddl);
|
|
75
|
+
const one = (query, ...binds) => {
|
|
76
|
+
const rows = sql.exec(query, ...binds).toArray();
|
|
77
|
+
return rows[0] ? JSON.parse(rows[0].record_json) : null;
|
|
78
|
+
};
|
|
79
|
+
const saveInteraction = (record) => {
|
|
80
|
+
sql.exec(`INSERT INTO interaction_records (interaction_id, record_json, state, rev, updated_at)
|
|
81
|
+
VALUES (?, ?, ?, ?, ?)
|
|
82
|
+
ON CONFLICT(interaction_id) DO UPDATE SET
|
|
83
|
+
record_json = excluded.record_json, state = excluded.state,
|
|
84
|
+
rev = excluded.rev, updated_at = excluded.updated_at`, record.interactionId, JSON.stringify(record), lifecycleStateOf(record), record.rev, record.updatedAt);
|
|
85
|
+
};
|
|
86
|
+
const saveCommitment = (record) => {
|
|
87
|
+
sql.exec(`INSERT INTO commitment_records (commitment_id, record_json, state, updated_at)
|
|
88
|
+
VALUES (?, ?, ?, ?)
|
|
89
|
+
ON CONFLICT(commitment_id) DO UPDATE SET
|
|
90
|
+
record_json = excluded.record_json, state = excluded.state, updated_at = excluded.updated_at`, record.commitmentId, JSON.stringify(record), record.state, record.updatedAt);
|
|
91
|
+
};
|
|
92
|
+
const store = {
|
|
93
|
+
async putInteraction(record) {
|
|
94
|
+
saveInteraction(record);
|
|
95
|
+
for (const b of record.protocolBindings ?? []) {
|
|
96
|
+
sql.exec(`INSERT INTO interaction_bindings (binding_key, interaction_id, binding_json) VALUES (?, ?, ?)
|
|
97
|
+
ON CONFLICT(binding_key, interaction_id) DO UPDATE SET binding_json = excluded.binding_json`, bindingKey(b.protocol, b.field, b.value), record.interactionId, JSON.stringify(b));
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
async getInteraction(id) {
|
|
101
|
+
return one('SELECT record_json FROM interaction_records WHERE interaction_id = ?', String(id));
|
|
102
|
+
},
|
|
103
|
+
async listInteractions() {
|
|
104
|
+
return sql
|
|
105
|
+
.exec('SELECT record_json FROM interaction_records ORDER BY updated_at DESC')
|
|
106
|
+
.toArray()
|
|
107
|
+
.map((r) => JSON.parse(r.record_json));
|
|
108
|
+
},
|
|
109
|
+
async transitionInteraction(id, event) {
|
|
110
|
+
const record = await this.getInteraction(id);
|
|
111
|
+
if (!record)
|
|
112
|
+
return null;
|
|
113
|
+
const result = applyInteractionTransition(lifecycleOf(record), event);
|
|
114
|
+
// Fail-closed: a rejection leaves the row exactly as it was. The store never sets state itself,
|
|
115
|
+
// so "concluding is custodial" cannot be bypassed by writing the row directly.
|
|
116
|
+
if (result.ok) {
|
|
117
|
+
saveInteraction({
|
|
118
|
+
...record,
|
|
119
|
+
lifecycleState: result.next.state,
|
|
120
|
+
updatedAt: event.at,
|
|
121
|
+
rev: record.rev + 1,
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
return result;
|
|
125
|
+
},
|
|
126
|
+
async bindProtocolTo(id, binding) {
|
|
127
|
+
sql.exec(`INSERT INTO interaction_bindings (binding_key, interaction_id, binding_json) VALUES (?, ?, ?)
|
|
128
|
+
ON CONFLICT(binding_key, interaction_id) DO UPDATE SET binding_json = excluded.binding_json`, bindingKey(binding.protocol, binding.field, binding.value), id, JSON.stringify(binding));
|
|
129
|
+
},
|
|
130
|
+
async resolveByBinding(protocol, field, value) {
|
|
131
|
+
const key = bindingKey(protocol, field, value);
|
|
132
|
+
const ids = sql
|
|
133
|
+
.exec('SELECT interaction_id FROM interaction_bindings WHERE binding_key = ?', key)
|
|
134
|
+
.toArray()
|
|
135
|
+
.map((r) => r.interaction_id);
|
|
136
|
+
// Reuses the in-memory resolver over a one-key index so SQL and non-SQL callers cannot disagree
|
|
137
|
+
// about what "ambiguous" means — one definition, two backing stores.
|
|
138
|
+
return resolveInteractionByBinding(new Map([[key, ids]]), protocol, field, value);
|
|
139
|
+
},
|
|
140
|
+
async putContextSnapshot(snapshot) {
|
|
141
|
+
// A snapshot whose digest does not match its bytes is not evidence, and storing it would let a
|
|
142
|
+
// later `verifyContextSnapshot` fail on a record that arrived corrupt rather than was tampered.
|
|
143
|
+
if (!(await verifyContextSnapshot(snapshot)))
|
|
144
|
+
return { ok: false, reason: 'digest-mismatch' };
|
|
145
|
+
const existing = sql
|
|
146
|
+
.exec('SELECT snapshot_json FROM context_snapshots WHERE digest = ?', snapshot.digest)
|
|
147
|
+
.toArray()[0];
|
|
148
|
+
// The digest verified and a row is already here, so the content is the same — two parties
|
|
149
|
+
// observing one context legitimately store it twice. A no-op, and the stored bytes win.
|
|
150
|
+
if (existing)
|
|
151
|
+
return { ok: true, stored: 'identical' };
|
|
152
|
+
sql.exec('INSERT INTO context_snapshots (digest, snapshot_json) VALUES (?, ?)', snapshot.digest, JSON.stringify(snapshot));
|
|
153
|
+
return { ok: true, stored: 'new' };
|
|
154
|
+
},
|
|
155
|
+
async getContextSnapshot(digest) {
|
|
156
|
+
const rows = sql
|
|
157
|
+
.exec('SELECT snapshot_json FROM context_snapshots WHERE digest = ?', digest)
|
|
158
|
+
.toArray();
|
|
159
|
+
return rows[0] ? JSON.parse(rows[0].snapshot_json) : null;
|
|
160
|
+
},
|
|
161
|
+
async putDecision(record) {
|
|
162
|
+
sql.exec(`INSERT INTO decision_records (decision_id, record_json, updated_at) VALUES (?, ?, ?)
|
|
163
|
+
ON CONFLICT(decision_id) DO UPDATE SET record_json = excluded.record_json, updated_at = excluded.updated_at`, record.decisionId, JSON.stringify(record), record.updatedAt);
|
|
164
|
+
},
|
|
165
|
+
async getDecision(id) {
|
|
166
|
+
return one('SELECT record_json FROM decision_records WHERE decision_id = ?', id);
|
|
167
|
+
},
|
|
168
|
+
async transitionDecision(id, event) {
|
|
169
|
+
const record = await this.getDecision(id);
|
|
170
|
+
if (!record)
|
|
171
|
+
return null;
|
|
172
|
+
const result = applyDecisionTransition(record, event);
|
|
173
|
+
if (result.ok)
|
|
174
|
+
await this.putDecision(result.next);
|
|
175
|
+
return result;
|
|
176
|
+
},
|
|
177
|
+
async putCommitment(record) {
|
|
178
|
+
saveCommitment(record);
|
|
179
|
+
},
|
|
180
|
+
async getCommitment(id) {
|
|
181
|
+
return one('SELECT record_json FROM commitment_records WHERE commitment_id = ?', id);
|
|
182
|
+
},
|
|
183
|
+
async listOpenCommitments() {
|
|
184
|
+
return sql
|
|
185
|
+
.exec(`SELECT record_json FROM commitment_records WHERE state IN (?, ?, ?) ORDER BY updated_at DESC`, ...OPEN_COMMITMENT_STATES)
|
|
186
|
+
.toArray()
|
|
187
|
+
.map((r) => JSON.parse(r.record_json));
|
|
188
|
+
},
|
|
189
|
+
async transitionCommitment(id, event) {
|
|
190
|
+
const record = await this.getCommitment(id);
|
|
191
|
+
if (!record)
|
|
192
|
+
return null;
|
|
193
|
+
const result = applyCommitmentTransition(record, event);
|
|
194
|
+
if (result.ok)
|
|
195
|
+
saveCommitment(result.next);
|
|
196
|
+
return result;
|
|
197
|
+
},
|
|
198
|
+
async putInboxEntry(entry) {
|
|
199
|
+
sql.exec(`INSERT INTO inbox_entries (viewer, exchange_id, record_json) VALUES (?, ?, ?)
|
|
200
|
+
ON CONFLICT(viewer, exchange_id) DO UPDATE SET record_json = excluded.record_json`, entry.viewer, entry.exchangeId, JSON.stringify(entry));
|
|
201
|
+
},
|
|
202
|
+
async getInboxEntry(viewer, exchangeId) {
|
|
203
|
+
return one('SELECT record_json FROM inbox_entries WHERE viewer = ? AND exchange_id = ?', viewer, exchangeId);
|
|
204
|
+
},
|
|
205
|
+
async transitionInbox(viewer, exchangeId, event) {
|
|
206
|
+
const entry = await this.getInboxEntry(viewer, exchangeId);
|
|
207
|
+
if (!entry)
|
|
208
|
+
return null;
|
|
209
|
+
const result = applyInboxTransition(entry, event);
|
|
210
|
+
if (result.ok)
|
|
211
|
+
await this.putInboxEntry(result.next);
|
|
212
|
+
return result;
|
|
213
|
+
},
|
|
214
|
+
};
|
|
215
|
+
return store;
|
|
216
|
+
}
|
|
217
|
+
/** The lifecycle facet of a stored interaction, for the machine to operate on. */
|
|
218
|
+
function lifecycleOf(record) {
|
|
219
|
+
return {
|
|
220
|
+
interactionId: record.interactionId,
|
|
221
|
+
state: lifecycleStateOf(record),
|
|
222
|
+
principal: record.principal,
|
|
223
|
+
participations: record.participations,
|
|
224
|
+
updatedAt: record.updatedAt,
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
function lifecycleStateOf(record) {
|
|
228
|
+
return record.lifecycleState;
|
|
229
|
+
}
|
|
230
|
+
//# sourceMappingURL=interaction-store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interaction-store.js","sourceRoot":"","sources":["../../src/cloudflare/interaction-store.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD,oGAAoG;AACpG,oGAAoG;AACpG,EAAE;AACF,uGAAuG;AACvG,gGAAgG;AAChG,2FAA2F;AAC3F,EAAE;AACF,iFAAiF;AACjF,EAAE;AACF,mGAAmG;AACnG,oGAAoG;AACpG,gGAAgG;AAChG,4DAA4D;AAC5D,EAAE;AACF,oGAAoG;AACpG,kGAAkG;AAClG,oGAAoG;AACpG,mGAAmG;AACnG,6FAA6F;AAC7F,4DAA4D;AAC5D,iGAAiG;AACjG,mFAAmF;AACnF,EAAE;AACF,oGAAoG;AACpG,kGAAkG;AAClG,+BAA+B;AAG/B,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EACL,0BAA0B,EAC1B,uBAAuB,EACvB,yBAAyB,EACzB,oBAAoB,GAUrB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,UAAU,EACV,2BAA2B,GAG5B,MAAM,wBAAwB,CAAC;AAGhC,MAAM,aAAa,GAAG;IACpB;;;;;;KAMG;IACH,8FAA8F;IAC9F,oGAAoG;IACpG,+FAA+F;IAC/F;;;;;KAKG;IACH;;;KAGG;IACH;;;;KAIG;IACH;;;;;KAKG;IACH;;;;;KAKG;CACJ,CAAC;AAsDF,oGAAoG;AACpG,MAAM,sBAAsB,GAAG,CAAC,UAAU,EAAE,QAAQ,EAAE,oBAAoB,CAAU,CAAC;AAErF,MAAM,UAAU,mCAAmC,CAAC,GAAe;IACjE,KAAK,MAAM,GAAG,IAAI,aAAa;QAAE,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAE/C,MAAM,GAAG,GAAG,CAAI,KAAa,EAAE,GAAG,KAAgB,EAAY,E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