@cat-factory/gatekeeper-worker 0.3.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.
Files changed (63) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +276 -0
  3. package/dist/approvals.d.ts +90 -0
  4. package/dist/approvals.d.ts.map +1 -0
  5. package/dist/approvals.js +193 -0
  6. package/dist/approvals.js.map +1 -0
  7. package/dist/capability.d.ts +61 -0
  8. package/dist/capability.d.ts.map +1 -0
  9. package/dist/capability.js +125 -0
  10. package/dist/capability.js.map +1 -0
  11. package/dist/env.d.ts +45 -0
  12. package/dist/env.d.ts.map +1 -0
  13. package/dist/env.js +90 -0
  14. package/dist/env.js.map +1 -0
  15. package/dist/errors.d.ts +22 -0
  16. package/dist/errors.d.ts.map +1 -0
  17. package/dist/errors.js +30 -0
  18. package/dist/errors.js.map +1 -0
  19. package/dist/gatekeeper.d.ts +78 -0
  20. package/dist/gatekeeper.d.ts.map +1 -0
  21. package/dist/gatekeeper.js +162 -0
  22. package/dist/gatekeeper.js.map +1 -0
  23. package/dist/index.d.ts +11 -0
  24. package/dist/index.d.ts.map +1 -0
  25. package/dist/index.js +23 -0
  26. package/dist/index.js.map +1 -0
  27. package/dist/keys.d.ts +62 -0
  28. package/dist/keys.d.ts.map +1 -0
  29. package/dist/keys.js +152 -0
  30. package/dist/keys.js.map +1 -0
  31. package/dist/masking.d.ts +9 -0
  32. package/dist/masking.d.ts.map +1 -0
  33. package/dist/masking.js +43 -0
  34. package/dist/masking.js.map +1 -0
  35. package/dist/policy/compile.d.ts +88 -0
  36. package/dist/policy/compile.d.ts.map +1 -0
  37. package/dist/policy/compile.js +170 -0
  38. package/dist/policy/compile.js.map +1 -0
  39. package/dist/policy/decisions.d.ts +93 -0
  40. package/dist/policy/decisions.d.ts.map +1 -0
  41. package/dist/policy/decisions.js +659 -0
  42. package/dist/policy/decisions.js.map +1 -0
  43. package/dist/policy/index.d.ts +6 -0
  44. package/dist/policy/index.d.ts.map +1 -0
  45. package/dist/policy/index.js +17 -0
  46. package/dist/policy/index.js.map +1 -0
  47. package/dist/state.d.ts +150 -0
  48. package/dist/state.d.ts.map +1 -0
  49. package/dist/state.js +229 -0
  50. package/dist/state.js.map +1 -0
  51. package/dist/webhook/delivery.d.ts +102 -0
  52. package/dist/webhook/delivery.d.ts.map +1 -0
  53. package/dist/webhook/delivery.js +162 -0
  54. package/dist/webhook/delivery.js.map +1 -0
  55. package/dist/webhook/signature.d.ts +17 -0
  56. package/dist/webhook/signature.d.ts.map +1 -0
  57. package/dist/webhook/signature.js +73 -0
  58. package/dist/webhook/signature.js.map +1 -0
  59. package/dist/worker.d.ts +21 -0
  60. package/dist/worker.d.ts.map +1 -0
  61. package/dist/worker.js +155 -0
  62. package/dist/worker.js.map +1 -0
  63. package/package.json +62 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decisions.js","sourceRoot":"","sources":["../../src/policy/decisions.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,EAAE;AACF,iGAAiG;AACjG,+FAA+F;AAC/F,8FAA8F;AAC9F,gGAAgG;AAChG,iGAAiG;AACjG,2BAA2B;AAC3B,EAAE;AACF,8FAA8F;AAC9F,kGAAkG;AAClG,4FAA4F;AAC5F,+FAA+F;AAC/F,gFAAgF;AAChF,EAAE;AACF,8BAA8B;AAC9B,EAAE;AACF,gGAAgG;AAChG,+FAA+F;AAC/F,kFAAkF;AAClF,gGAAgG;AAChG,kGAAkG;AAClG,8FAA8F;AAC9F,gFAAgF;AAIhF,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AA6E9C,gGAAgG;AAEhG,SAAS,MAAM,CAAC,KAAa,EAAE,QAAgB;IAC7C,MAAM,IAAI,eAAe,CACvB,gBAAgB,EAChB,sBAAsB,KAAK,MAAM,QAAQ,wCAAwC;QAC/E,wFAAwF;QACxF,gCAAgC,CACnC,CAAA;AACH,CAAC;AAED,mCAAmC;AACnC,SAAS,IAAI,CAA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F,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAC3C,CACF;CACF,CAAA;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAmB,QAAQ,CAAA"}
@@ -0,0 +1,6 @@
1
+ export { compilePolicy, describeBinding, tierForActor, type CompiledPolicy, type CompiledTier, type GatekeeperPolicy, type TierPolicy, type WithheldBinding, type WithheldReason, } from './compile.js';
2
+ export { ANSWERABLE_DECISION_KINDS, answererFor, DECISION_BINDINGS, DECISION_KEY_SCOPE, type DecisionAnswerer, type DecisionCall, type DecisionField, type DecisionVerb, type LiveDecision, type ParkedDecisionKind, } from './decisions.js';
3
+ export { GatekeeperError, PolicyError, type GatekeeperReason } from '../errors.js';
4
+ export { applyMask, MASKED } from '../masking.js';
5
+ export type { GatekeeperBinding, PublicApiScope } from '@cat-factory/gatekeeper-bindings';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/policy/index.ts"],"names":[],"mappings":"AAWA,OAAO,EACL,aAAa,EACb,eAAe,EACf,YAAY,EACZ,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,cAAc,GACpB,MAAM,cAAc,CAAA;AAErB,OAAO,EACL,yBAAyB,EACzB,WAAW,EACX,iBAAiB,EACjB,kBAAkB,EAClB,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,kBAAkB,GACxB,MAAM,gBAAgB,CAAA;AAIvB,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAClF,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAKjD,YAAY,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAA"}
@@ -0,0 +1,17 @@
1
+ // The POLICY surface: everything a deployment needs to WRITE its policy, and nothing that needs a
2
+ // Worker runtime to import.
3
+ //
4
+ // It is a separate entry point (`@cat-factory/gatekeeper-worker/policy`) for one reason: the
5
+ // package's main entry reaches `cloudflare:workers` for the Durable Object, so a policy file that
6
+ // imported through it could only be loaded inside workerd. A policy is the one thing an operator
7
+ // authors, reviews and tests, and none of those should need a Worker isolate to run.
8
+ //
9
+ // Everything here is re-exported from the main entry too, so a deployment that does not care can
10
+ // import from one place.
11
+ export { compilePolicy, describeBinding, tierForActor, } from './compile.js';
12
+ export { ANSWERABLE_DECISION_KINDS, answererFor, DECISION_BINDINGS, DECISION_KEY_SCOPE, } from './decisions.js';
13
+ // A policy is refused by a `PolicyError` and MASKED paths are the other half of a tier, so both
14
+ // belong to the vocabulary a policy file and its tests speak.
15
+ export { GatekeeperError, PolicyError } from '../errors.js';
16
+ export { applyMask, MASKED } from '../masking.js';
17
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/policy/index.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAClG,4BAA4B;AAC5B,EAAE;AACF,6FAA6F;AAC7F,kGAAkG;AAClG,iGAAiG;AACjG,qFAAqF;AACrF,EAAE;AACF,iGAAiG;AACjG,yBAAyB;AAEzB,OAAO,EACL,aAAa,EACb,eAAe,EACf,YAAY,GAOb,MAAM,cAAc,CAAA;AAErB,OAAO,EACL,yBAAyB,EACzB,WAAW,EACX,iBAAiB,EACjB,kBAAkB,GAOnB,MAAM,gBAAgB,CAAA;AAEvB,gGAAgG;AAChG,8DAA8D;AAC9D,OAAO,EAAE,eAAe,EAAE,WAAW,EAAyB,MAAM,cAAc,CAAA;AAClF,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA"}
@@ -0,0 +1,150 @@
1
+ import { DurableObject } from 'cloudflare:workers';
2
+ /** A parked cat-factory decision, as the OS shows it. */
3
+ export interface ApprovalCard {
4
+ /** The delivery that raised it. Also the id the OS answers on. */
5
+ cardId: string;
6
+ runId: string;
7
+ taskId: string | null;
8
+ /** The notification type the platform raised (`merge_review`, `requirement_review`, …). */
9
+ type: string;
10
+ /**
11
+ * Whether this card can be ANSWERED from here, or only reported.
12
+ *
13
+ * Stamped at delivery time from the type, so an inbox can render the difference without asking
14
+ * this Gatekeeper anything else. A `notice` is not a lesser card: it is a run waiting on a
15
+ * person in the cat-factory app, and saying so is the whole point of separating it from a card
16
+ * whose first answer attempt would otherwise come back `stale`.
17
+ */
18
+ disposition: 'decision' | 'notice';
19
+ title: string;
20
+ body: string;
21
+ raisedAt: number;
22
+ /** Epoch ms when this Gatekeeper settled it, or null while it is open. */
23
+ resolvedAt: number | null;
24
+ /** What settled it: an action name, or `superseded` when the platform resolved the card. */
25
+ resolution: string | null;
26
+ }
27
+ /** The last lifecycle transition a delivery reported for one run. */
28
+ export interface RunState {
29
+ runId: string;
30
+ /** `run.started` / `run.completed` / `run.failed`, as the platform spells it. */
31
+ event: string;
32
+ /** Whether the run has reached a terminal event. */
33
+ terminal: boolean;
34
+ /** The run projection the delivery carried, verbatim. */
35
+ run: Record<string, unknown>;
36
+ updatedAt: number;
37
+ }
38
+ /** A minted per-actor key, as it is held here. */
39
+ export interface StoredKey {
40
+ keyId: string;
41
+ secret: string;
42
+ mintedAt: number;
43
+ }
44
+ /**
45
+ * A claim on the right to mint one actor+scope key.
46
+ *
47
+ * `POST /api/v1/keys` is a real, non-idempotent side effect that returns its secret exactly once,
48
+ * so two pipelined calls that both read "no key yet" would both mint and the loser's credential
49
+ * would stay live upstream with nothing here recording that it exists. The claim is taken BEFORE
50
+ * the mint, atomically, and it EXPIRES so a Worker that dies mid-mint does not wedge the actor
51
+ * out of the Gatekeeper forever.
52
+ */
53
+ export interface MintClaim {
54
+ claimedAt: number;
55
+ }
56
+ /** What `claimKeyMint` answers: the key that already exists, or permission to make one. */
57
+ export type MintTicket = {
58
+ outcome: 'existing';
59
+ key: StoredKey;
60
+ } | {
61
+ outcome: 'claimed';
62
+ } | {
63
+ outcome: 'in_flight';
64
+ retryAfterMs: number;
65
+ };
66
+ /** What one delivery asks this object to do, decided in the Worker from the delivery's shape. */
67
+ export type DeliveryEffect = {
68
+ kind: 'open';
69
+ card: ApprovalCard;
70
+ } | {
71
+ kind: 'supersede';
72
+ cardId: string;
73
+ } | {
74
+ kind: 'run-event';
75
+ state: Omit<RunState, 'updatedAt'>;
76
+ } | {
77
+ kind: 'none';
78
+ };
79
+ /** What taking one delivery did to durable state. */
80
+ export type DeliveryApplication = {
81
+ applied: false;
82
+ reason: 'duplicate';
83
+ } | {
84
+ applied: true;
85
+ effect: 'opened' | 'superseded' | 'run-event' | 'none';
86
+ };
87
+ export declare class GatekeeperState extends DurableObject {
88
+ #private;
89
+ /**
90
+ * Take one delivery: dedupe and act, as ONE durable write.
91
+ *
92
+ * The marker and the effect land in a single `put`, so there is no window in which the platform
93
+ * would see a duplicate for work that never happened. A delivery whose effect is `none` still
94
+ * records the marker: an unrecognised family is a message this Gatekeeper HAS handled, and
95
+ * re-deriving that on every replay would spend the platform's retry budget on it.
96
+ */
97
+ applyDelivery(deliveryId: string, effect: DeliveryEffect, now: number): Promise<DeliveryApplication>;
98
+ /** Settle a card this Gatekeeper answered. A card already settled keeps its first resolution. */
99
+ resolveCard(cardId: string, resolution: string, now: number): Promise<ApprovalCard | null>;
100
+ getCard(cardId: string): Promise<ApprovalCard | null>;
101
+ /** Every card, newest first. Resolved ones are included: the OS decides what it renders. */
102
+ listCards(): Promise<ApprovalCard[]>;
103
+ /** The latest lifecycle state of every run a delivery has mentioned, newest first. */
104
+ listRunStates(): Promise<RunState[]>;
105
+ /**
106
+ * Either the actor's existing key, or an exclusive claim on minting one.
107
+ *
108
+ * Read-and-claim in one turn, which is the whole point: the alternative (read here, mint in the
109
+ * Worker, write back) is a race two pipelined calls lose in the direction that leaks a live
110
+ * credential. `in_flight` is a real third answer rather than a wait, because a Durable Object
111
+ * that blocked on a peer's outbound HTTP call would serialise every actor behind the slowest.
112
+ */
113
+ claimKeyMint(actorId: string, scope: string, now: number): Promise<MintTicket>;
114
+ /**
115
+ * Record the key a claim produced, releasing the claim in the same turn.
116
+ *
117
+ * Both operations are ISSUED before either is awaited, so Durable Object storage commits them
118
+ * together: a crash cannot leave the key stored with the claim still held (which would cost the
119
+ * next caller the TTL for nothing) or the claim released with the key unstored (which would let
120
+ * a second caller mint a duplicate).
121
+ */
122
+ commitKeyMint(actorId: string, scope: string, key: StoredKey): Promise<void>;
123
+ /** Release a claim whose mint failed, so the next caller may take it without waiting out the TTL. */
124
+ releaseKeyMint(actorId: string, scope: string): Promise<void>;
125
+ /**
126
+ * Drop one stored key, so the next call mints a fresh one.
127
+ *
128
+ * Takes the key ID the caller was USING and drops the row only if it still holds that key. Two
129
+ * concurrent calls can both meet a 401 on the same stale secret, and a blind delete would have
130
+ * the second one throw away the replacement the first had just minted, which reads to a caller
131
+ * as a Gatekeeper that mints a key per call.
132
+ */
133
+ forgetKeyIfCurrent(actorId: string, scope: string, keyId: string): Promise<boolean>;
134
+ /** Every key minted for an actor, whatever scope it was minted at. */
135
+ listKeys(actorId: string): Promise<{
136
+ scope: string;
137
+ key: StoredKey;
138
+ }[]>;
139
+ /**
140
+ * Forget the NAMED keys, and only those.
141
+ *
142
+ * Named rather than "all this actor's", which is what it used to do: the caller revokes upstream
143
+ * first and then forgets, so forgetting a key it had not revoked would leave a live cat-factory
144
+ * credential with no record here that it exists. That is precisely the leak the revoke order
145
+ * exists to prevent, arriving through the other half of the pair.
146
+ */
147
+ forgetKeys(actorId: string, scopes: readonly string[]): Promise<void>;
148
+ alarm(): Promise<void>;
149
+ }
150
+ //# sourceMappingURL=state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../src/state.ts"],"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,GAAG,OAAO,CAAC,UAAU,CAAC,CAYnF;IAED;;;;;;;OAOG;IACG,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAIjF;IAED,qGAAqG;IAC/F,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAElE;IAED;;;;;;;OAOG;IACG,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAMxF;IAED,sEAAsE;IAChE,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,SAAS,CAAA;KAAE,EAAE,CAAC,CAM5E;IAED;;;;;;;OAOG;IACG,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAG1E;IAEc,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAepC;CA2BF"}
package/dist/state.js ADDED
@@ -0,0 +1,229 @@
1
+ // The Gatekeeper's durable state: one object per paired workspace, holding the four things a
2
+ // stateless Worker cannot.
3
+ //
4
+ // 1. WHICH DELIVERIES HAVE BEEN SEEN. The platform's terminal run events are at-least-once and
5
+ // a replay re-stamps `sentAt`, so two deliveries of one transition are not byte-identical
6
+ // and only `deliveryId` collapses them. Dedupe has to be durable, and it has to be shared
7
+ // across isolates, which is what makes it a Durable Object rather than a per-isolate Map.
8
+ // 2. THE OPEN APPROVAL CARDS. A parked run waits indefinitely, so the card outlives every
9
+ // invocation that could have held it in memory.
10
+ // 3. THE LATEST LIFECYCLE STATE OF EACH RUN a delivery has mentioned, so a status Gadget reads
11
+ // what happened without polling, and a card whose run has ended stops standing in an inbox
12
+ // demanding an answer nobody can give.
13
+ // 4. THE MINTED PER-ACTOR KEYS. `POST /api/v1/keys` returns a raw secret EXACTLY ONCE; a
14
+ // Gatekeeper that forgets it has minted one mints another on the next call and leaves a
15
+ // trail of live credentials nobody revokes.
16
+ //
17
+ // The dedupe marker and the effect it guards are written TOGETHER, in one multi-key `put`, which
18
+ // is the reason `applyDelivery` lives here rather than being composed from two calls in the
19
+ // Worker. Durable Object storage commits the writes of one turn atomically, and only that makes
20
+ // the pair safe: committing the marker first turns a failed card write into a `duplicate` on the
21
+ // platform's retry, so the approval never reaches the inbox and nothing reports that it did not.
22
+ //
23
+ // Custody note, because it is the reason this design is defensible at all: the provisioning key
24
+ // is a Worker SECRET and never leaves the platform's secret store, while the per-actor keys it
25
+ // mints live here, in this object's storage. Both are outside every agent's reach; what an agent
26
+ // holds is a capability whose methods are the ones policy granted. Storage is the narrowest place
27
+ // a minted secret can live and still be reusable, but it IS at rest in your account: if that is
28
+ // not acceptable for your deployment, mint per call and revoke after, at the cost of a key row
29
+ // per operation.
30
+ import { DurableObject } from 'cloudflare:workers';
31
+ const DELIVERY_PREFIX = 'delivery:';
32
+ const CARD_PREFIX = 'card:';
33
+ const KEY_PREFIX = 'key:';
34
+ const CLAIM_PREFIX = 'mint:';
35
+ const RUN_PREFIX = 'run:';
36
+ /**
37
+ * How long a `deliveryId` is remembered for dedupe purposes.
38
+ *
39
+ * Long enough to cover a durable replay (the platform re-drives a settled run from a sweeper, not
40
+ * from a queue that gives up in minutes) and short enough that the object does not accumulate one
41
+ * row per event forever. Cards are NOT pruned on this schedule: an open card is live state, and a
42
+ * resolved one is the record of an answer this Gatekeeper gave.
43
+ */
44
+ const DELIVERY_RETENTION_MS = 30 * 24 * 60 * 60 * 1000;
45
+ /** How long the record of a finished run is kept for a status Gadget to read. */
46
+ const RUN_STATE_RETENTION_MS = 30 * 24 * 60 * 60 * 1000;
47
+ /**
48
+ * How long a mint claim holds before another caller may take it.
49
+ *
50
+ * Sized against the one call it covers (`POST /api/v1/keys` behind the SDK's own retries), not
51
+ * against a request budget: shorter and two callers mint anyway, which is the leak; longer and a
52
+ * Worker that died mid-mint locks the actor out for that long. A caller that meets a live claim
53
+ * is told to retry rather than served a key, because serving one would mean minting a second.
54
+ */
55
+ const MINT_CLAIM_TTL_MS = 30_000;
56
+ /** How often the prune alarm runs. */
57
+ const PRUNE_INTERVAL_MS = 24 * 60 * 60 * 1000;
58
+ export class GatekeeperState extends DurableObject {
59
+ /**
60
+ * Take one delivery: dedupe and act, as ONE durable write.
61
+ *
62
+ * The marker and the effect land in a single `put`, so there is no window in which the platform
63
+ * would see a duplicate for work that never happened. A delivery whose effect is `none` still
64
+ * records the marker: an unrecognised family is a message this Gatekeeper HAS handled, and
65
+ * re-deriving that on every replay would spend the platform's retry budget on it.
66
+ */
67
+ async applyDelivery(deliveryId, effect, now) {
68
+ const marker = `${DELIVERY_PREFIX}${deliveryId}`;
69
+ if ((await this.ctx.storage.get(marker)) !== undefined) {
70
+ return { applied: false, reason: 'duplicate' };
71
+ }
72
+ const writes = { [marker]: now };
73
+ if (effect.kind === 'open') {
74
+ writes[`${CARD_PREFIX}${effect.card.cardId}`] = effect.card;
75
+ }
76
+ else if (effect.kind === 'supersede') {
77
+ const key = `${CARD_PREFIX}${effect.cardId}`;
78
+ const card = await this.ctx.storage.get(key);
79
+ if (card !== undefined && card.resolvedAt === null) {
80
+ writes[key] = { ...card, resolvedAt: now, resolution: 'superseded' };
81
+ }
82
+ }
83
+ else if (effect.kind === 'run-event') {
84
+ writes[`${RUN_PREFIX}${effect.state.runId}`] = { ...effect.state, updatedAt: now };
85
+ // A run that ended answers nothing more, so its open cards stop asking. Doing it here rather
86
+ // than lazily at read time is what keeps the inbox honest for an OS that renders the list
87
+ // without asking this Gatekeeper anything else.
88
+ if (effect.state.terminal) {
89
+ for (const [key, card] of await this.#openCardsFor(effect.state.runId)) {
90
+ writes[key] = { ...card, resolvedAt: now, resolution: `run_${effect.state.event}` };
91
+ }
92
+ }
93
+ }
94
+ await this.ctx.storage.put(writes);
95
+ await this.#ensureAlarm(now);
96
+ return { applied: true, effect: effect.kind === 'none' ? 'none' : effectName(effect.kind) };
97
+ }
98
+ /** Settle a card this Gatekeeper answered. A card already settled keeps its first resolution. */
99
+ async resolveCard(cardId, resolution, now) {
100
+ const key = `${CARD_PREFIX}${cardId}`;
101
+ const card = await this.ctx.storage.get(key);
102
+ if (card === undefined || card.resolvedAt !== null)
103
+ return card ?? null;
104
+ const resolved = { ...card, resolvedAt: now, resolution };
105
+ await this.ctx.storage.put(key, resolved);
106
+ return resolved;
107
+ }
108
+ async getCard(cardId) {
109
+ return (await this.ctx.storage.get(`${CARD_PREFIX}${cardId}`)) ?? null;
110
+ }
111
+ /** Every card, newest first. Resolved ones are included: the OS decides what it renders. */
112
+ async listCards() {
113
+ const rows = await this.ctx.storage.list({ prefix: CARD_PREFIX });
114
+ return [...rows.values()].sort((a, b) => b.raisedAt - a.raisedAt);
115
+ }
116
+ /** The latest lifecycle state of every run a delivery has mentioned, newest first. */
117
+ async listRunStates() {
118
+ const rows = await this.ctx.storage.list({ prefix: RUN_PREFIX });
119
+ return [...rows.values()].sort((a, b) => b.updatedAt - a.updatedAt);
120
+ }
121
+ /**
122
+ * Either the actor's existing key, or an exclusive claim on minting one.
123
+ *
124
+ * Read-and-claim in one turn, which is the whole point: the alternative (read here, mint in the
125
+ * Worker, write back) is a race two pipelined calls lose in the direction that leaks a live
126
+ * credential. `in_flight` is a real third answer rather than a wait, because a Durable Object
127
+ * that blocked on a peer's outbound HTTP call would serialise every actor behind the slowest.
128
+ */
129
+ async claimKeyMint(actorId, scope, now) {
130
+ const existing = await this.ctx.storage.get(keyRow(actorId, scope));
131
+ if (existing !== undefined)
132
+ return { outcome: 'existing', key: existing };
133
+ const claimKey = `${CLAIM_PREFIX}${actorId}:${scope}`;
134
+ const claim = await this.ctx.storage.get(claimKey);
135
+ if (claim !== undefined && now - claim.claimedAt < MINT_CLAIM_TTL_MS) {
136
+ return { outcome: 'in_flight', retryAfterMs: MINT_CLAIM_TTL_MS - (now - claim.claimedAt) };
137
+ }
138
+ await this.ctx.storage.put(claimKey, { claimedAt: now });
139
+ return { outcome: 'claimed' };
140
+ }
141
+ /**
142
+ * Record the key a claim produced, releasing the claim in the same turn.
143
+ *
144
+ * Both operations are ISSUED before either is awaited, so Durable Object storage commits them
145
+ * together: a crash cannot leave the key stored with the claim still held (which would cost the
146
+ * next caller the TTL for nothing) or the claim released with the key unstored (which would let
147
+ * a second caller mint a duplicate).
148
+ */
149
+ async commitKeyMint(actorId, scope, key) {
150
+ const stored = this.ctx.storage.put(keyRow(actorId, scope), key);
151
+ const released = this.ctx.storage.delete(`${CLAIM_PREFIX}${actorId}:${scope}`);
152
+ await Promise.all([stored, released]);
153
+ }
154
+ /** Release a claim whose mint failed, so the next caller may take it without waiting out the TTL. */
155
+ async releaseKeyMint(actorId, scope) {
156
+ await this.ctx.storage.delete(`${CLAIM_PREFIX}${actorId}:${scope}`);
157
+ }
158
+ /**
159
+ * Drop one stored key, so the next call mints a fresh one.
160
+ *
161
+ * Takes the key ID the caller was USING and drops the row only if it still holds that key. Two
162
+ * concurrent calls can both meet a 401 on the same stale secret, and a blind delete would have
163
+ * the second one throw away the replacement the first had just minted, which reads to a caller
164
+ * as a Gatekeeper that mints a key per call.
165
+ */
166
+ async forgetKeyIfCurrent(actorId, scope, keyId) {
167
+ const row = keyRow(actorId, scope);
168
+ const stored = await this.ctx.storage.get(row);
169
+ if (stored === undefined || stored.keyId !== keyId)
170
+ return false;
171
+ await this.ctx.storage.delete(row);
172
+ return true;
173
+ }
174
+ /** Every key minted for an actor, whatever scope it was minted at. */
175
+ async listKeys(actorId) {
176
+ const rows = await this.ctx.storage.list({ prefix: `${KEY_PREFIX}${actorId}:` });
177
+ return [...rows.entries()].map(([row, key]) => ({
178
+ scope: row.slice(`${KEY_PREFIX}${actorId}:`.length),
179
+ key,
180
+ }));
181
+ }
182
+ /**
183
+ * Forget the NAMED keys, and only those.
184
+ *
185
+ * Named rather than "all this actor's", which is what it used to do: the caller revokes upstream
186
+ * first and then forgets, so forgetting a key it had not revoked would leave a live cat-factory
187
+ * credential with no record here that it exists. That is precisely the leak the revoke order
188
+ * exists to prevent, arriving through the other half of the pair.
189
+ */
190
+ async forgetKeys(actorId, scopes) {
191
+ if (scopes.length === 0)
192
+ return;
193
+ await this.ctx.storage.delete(scopes.map((scope) => keyRow(actorId, scope)));
194
+ }
195
+ async alarm() {
196
+ const now = Date.now();
197
+ await this.#pruneOlderThan(DELIVERY_PREFIX, DELIVERY_RETENTION_MS, now, (seenAt) => seenAt);
198
+ await this.#pruneOlderThan(RUN_PREFIX, RUN_STATE_RETENTION_MS, now, (state) => state.updatedAt);
199
+ await this.ctx.storage.setAlarm(now + PRUNE_INTERVAL_MS);
200
+ }
201
+ async #openCardsFor(runId) {
202
+ const rows = await this.ctx.storage.list({ prefix: CARD_PREFIX });
203
+ return [...rows.entries()].filter(([, card]) => card.runId === runId && card.resolvedAt === null);
204
+ }
205
+ async #ensureAlarm(now) {
206
+ if ((await this.ctx.storage.getAlarm()) === null) {
207
+ await this.ctx.storage.setAlarm(now + PRUNE_INTERVAL_MS);
208
+ }
209
+ }
210
+ async #pruneOlderThan(prefix, retentionMs, now, stampOf) {
211
+ const rows = await this.ctx.storage.list({ prefix });
212
+ const stale = [...rows.entries()]
213
+ .filter(([, value]) => now - stampOf(value) > retentionMs)
214
+ .map(([key]) => key);
215
+ if (stale.length > 0)
216
+ await this.ctx.storage.delete(stale);
217
+ }
218
+ }
219
+ function effectName(kind) {
220
+ if (kind === 'open')
221
+ return 'opened';
222
+ if (kind === 'supersede')
223
+ return 'superseded';
224
+ return 'run-event';
225
+ }
226
+ function keyRow(actorId, scope) {
227
+ return `${KEY_PREFIX}${actorId}:${scope}`;
228
+ }
229
+ //# sourceMappingURL=state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state.js","sourceRoot":"","sources":["../src/state.ts"],"names":[],"mapp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G,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAA;QACtB,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC;YAAE,MAAM,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;IAC5D,CAAC;CACF;AAED,SAAS,UAAU,CACjB,IAAwC;IAExC,IAAI,IAAI,KAAK,MAAM;QAAE,OAAO,QAAQ,CAAA;IACpC,IAAI,IAAI,KAAK,WAAW;QAAE,OAAO,YAAY,CAAA;IAC7C,OAAO,WAAW,CAAA;AACpB,CAAC;AAED,SAAS,MAAM,CAAC,OAAe,EAAE,KAAa;IAC5C,OAAO,GAAG,UAAU,GAAG,OAAO,IAAI,KAAK,EAAE,CAAA;AAC3C,CAAC"}
@@ -0,0 +1,102 @@
1
+ import type { NotificationType } from '@cat-factory/sdk';
2
+ import type { DeliveryEffect } from '../state.js';
3
+ /** One delivery, classified. `unrecognised` is a real outcome, not an error. */
4
+ export type Delivery = {
5
+ family: 'notification';
6
+ deliveryId: string;
7
+ sentAt: number;
8
+ runId: string | null;
9
+ taskId: string | null;
10
+ notification: DeliveredNotification;
11
+ } | {
12
+ family: 'run';
13
+ deliveryId: string;
14
+ sentAt: number;
15
+ event: string;
16
+ run: Record<string, unknown>;
17
+ } | {
18
+ family: 'alert';
19
+ deliveryId: string;
20
+ sentAt: number;
21
+ event: string;
22
+ alert: Record<string, unknown>;
23
+ } | {
24
+ family: 'unrecognised';
25
+ deliveryId: string;
26
+ sentAt: number;
27
+ };
28
+ /** The card fields this Gatekeeper reads. Everything else on the card stays on the platform. */
29
+ interface DeliveredNotification {
30
+ id: string;
31
+ type: string;
32
+ status: string;
33
+ title: string;
34
+ body: string;
35
+ }
36
+ /**
37
+ * What raising a card of a given type actually offers the person who opens it.
38
+ *
39
+ * The distinction is load-bearing and it used to be missing. Every subscribed type raised a card
40
+ * that looked answerable, but `merge_review` is settled by an actual MERGE (`notifications_act`),
41
+ * which this Gatekeeper deliberately does not grant to any tier: the merge policy wants a person
42
+ * the platform can name (ADR 0037/0039). Presenting that as an answerable approval is the reverse
43
+ * of the error the type list was written to prevent (a card nobody can answer), and it arrived
44
+ * anyway, as a card that reported `stale` on the first attempt.
45
+ *
46
+ * - `decision`: the run parks on a `/runs/:runId/decisions` entry, which `approvals_answer`
47
+ * settles through the caller's own granted bindings.
48
+ * - `notice`: the run is waiting on something no `/api/v1` verb this Gatekeeper holds can do.
49
+ * The card is worth raising (somebody has to know) and is worth saying so on.
50
+ */
51
+ export type CardDisposition = 'decision' | 'notice';
52
+ /**
53
+ * The card types that mean "a run is parked and a person has to answer", with what answering one
54
+ * would take.
55
+ *
56
+ * Deliberately a SMALL map rather than "anything with a runId": `pipeline_complete` and
57
+ * `ci_failed` also carry one and are reports, not questions. Raising an approval card for a report
58
+ * trains people to dismiss cards, which is how a real one gets missed. A deployment that registers
59
+ * its own gate and wants its card here adds the type; that is an edit to this constant, in review,
60
+ * rather than a behaviour that widens on its own.
61
+ *
62
+ * It is keyed by the SDK's own `NotificationType`, so a type this deployment retires fails the
63
+ * build here rather than becoming a card that silently stops arriving. Its keys are also the list
64
+ * `enroll()` SUBSCRIBES to, so what a Gatekeeper asks for and what it can act on are one value.
65
+ */
66
+ export declare const PARKED_DECISION_CARD_TYPES: Readonly<Partial<Record<NotificationType, CardDisposition>>>;
67
+ /** Every type this Gatekeeper subscribes to, answerable or not. */
68
+ export declare const SUBSCRIBED_CARD_TYPES: readonly NotificationType[];
69
+ /**
70
+ * How a delivered card type is dispositioned, or `null` for one this Gatekeeper raises nothing for.
71
+ *
72
+ * Takes a plain `string` because the wire vocabulary grows additively: a deployment one release
73
+ * ahead of this package delivers a type the SDK's union has never heard of, and narrowing the
74
+ * ARGUMENT would make that a type error at the one place that must instead answer "no, not one of
75
+ * mine" and pass the delivery through.
76
+ */
77
+ export declare function dispositionOf(type: string): CardDisposition | null;
78
+ /**
79
+ * Classify a parsed delivery body.
80
+ *
81
+ * Returns `null` only when the envelope itself is unusable (no `deliveryId`), which is the one
82
+ * case where nothing can be done with it at all: the id is what dedupe keys on, so a delivery
83
+ * without one cannot be admitted safely even as unrecognised.
84
+ */
85
+ export declare function readDelivery(body: unknown): Delivery | null;
86
+ /**
87
+ * Decide what a delivery asks durable state to do.
88
+ *
89
+ * A card is keyed on the NOTIFICATION id rather than the delivery id, because the platform
90
+ * re-delivers the same card as it resolves (`ntf_123-open` then `ntf_123-acted`) and those two
91
+ * deliveries are one question with an answer, not two questions. Dedupe still runs on the delivery
92
+ * id upstream of this: the two ids do different jobs and collapsing them would either drop the
93
+ * resolution or re-raise the card.
94
+ *
95
+ * A `run` delivery lands as a lifecycle record rather than nothing. That leg is why the
96
+ * subscription asks for all three run events: a status Gadget reads `runs_watched()` instead of
97
+ * polling, and a terminal event settles the run's open cards, so an inbox never holds a question
98
+ * about a run that has ended.
99
+ */
100
+ export declare function cardEffectOf(delivery: Delivery): DeliveryEffect;
101
+ export {};
102
+ //# sourceMappingURL=delivery.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delivery.d.ts","sourceRoot":"","sources":["../../src/webhook/delivery.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AACxD,OAAO,KAAK,EAAgB,cAAc,EAAE,MAAM,aAAa,CAAA;AAE/D,gFAAgF;AAChF,MAAM,MAAM,QAAQ,GAChB;IACE,MAAM,EAAE,cAAc,CAAA;IACtB,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,YAAY,EAAE,qBAAqB,CAAA;CACpC,GACD;IACE,MAAM,EAAE,KAAK,CAAA;IACb,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;IACb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