@cat-factory/gatekeeper-worker 0.4.3 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +100 -13
- package/dist/arguments.d.ts +18 -0
- package/dist/arguments.d.ts.map +1 -0
- package/dist/arguments.js +75 -0
- package/dist/arguments.js.map +1 -0
- package/dist/capability.d.ts +55 -0
- package/dist/capability.d.ts.map +1 -1
- package/dist/capability.js +99 -5
- package/dist/capability.js.map +1 -1
- package/dist/env.d.ts +10 -0
- package/dist/env.d.ts.map +1 -1
- package/dist/env.js +12 -0
- package/dist/env.js.map +1 -1
- package/dist/errors.d.ts +32 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +11 -0
- package/dist/errors.js.map +1 -1
- package/dist/gatekeeper.d.ts +78 -3
- package/dist/gatekeeper.d.ts.map +1 -1
- package/dist/gatekeeper.js +127 -13
- package/dist/gatekeeper.js.map +1 -1
- package/dist/index.d.ts +18 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -1
- package/dist/markdown.d.ts +12 -0
- package/dist/markdown.d.ts.map +1 -0
- package/dist/markdown.js +28 -0
- package/dist/markdown.js.map +1 -0
- package/dist/os/account.d.ts +27 -0
- package/dist/os/account.d.ts.map +1 -0
- package/dist/os/account.js +130 -0
- package/dist/os/account.js.map +1 -0
- package/dist/os/descriptions.d.ts +43 -0
- package/dist/os/descriptions.d.ts.map +1 -0
- package/dist/os/descriptions.js +100 -0
- package/dist/os/descriptions.js.map +1 -0
- package/dist/os/discoverability.d.ts +42 -0
- package/dist/os/discoverability.d.ts.map +1 -0
- package/dist/os/discoverability.js +63 -0
- package/dist/os/discoverability.js.map +1 -0
- package/dist/os/exports.d.ts +55 -0
- package/dist/os/exports.d.ts.map +1 -0
- package/dist/os/exports.js +93 -0
- package/dist/os/exports.js.map +1 -0
- package/dist/os/hook-controller.d.ts +14 -0
- package/dist/os/hook-controller.d.ts.map +1 -0
- package/dist/os/hook-controller.js +53 -0
- package/dist/os/hook-controller.js.map +1 -0
- package/dist/os/hooks.d.ts +200 -0
- package/dist/os/hooks.d.ts.map +1 -0
- package/dist/os/hooks.js +253 -0
- package/dist/os/hooks.js.map +1 -0
- package/dist/os/protocol.d.ts +193 -0
- package/dist/os/protocol.d.ts.map +1 -0
- package/dist/os/protocol.js +22 -0
- package/dist/os/protocol.js.map +1 -0
- package/dist/os/queue.d.ts +99 -0
- package/dist/os/queue.d.ts.map +1 -0
- package/dist/os/queue.js +240 -0
- package/dist/os/queue.js.map +1 -0
- package/dist/os/resource-core.d.ts +115 -0
- package/dist/os/resource-core.d.ts.map +1 -0
- package/dist/os/resource-core.js +172 -0
- package/dist/os/resource-core.js.map +1 -0
- package/dist/os/resource.d.ts +16 -0
- package/dist/os/resource.d.ts.map +1 -0
- package/dist/os/resource.js +70 -0
- package/dist/os/resource.js.map +1 -0
- package/dist/os/resources.d.ts +11 -0
- package/dist/os/resources.d.ts.map +1 -0
- package/dist/os/resources.js +26 -0
- package/dist/os/resources.js.map +1 -0
- package/dist/os/session-types.d.ts +6 -0
- package/dist/os/session-types.d.ts.map +1 -0
- package/dist/os/session-types.js +110 -0
- package/dist/os/session-types.js.map +1 -0
- package/dist/os/sharing.d.ts +35 -0
- package/dist/os/sharing.d.ts.map +1 -0
- package/dist/os/sharing.js +135 -0
- package/dist/os/sharing.js.map +1 -0
- package/dist/os/vendor.d.ts +14 -0
- package/dist/os/vendor.d.ts.map +1 -0
- package/dist/os/vendor.js +102 -0
- package/dist/os/vendor.js.map +1 -0
- package/dist/policy/compile.d.ts +38 -0
- package/dist/policy/compile.d.ts.map +1 -1
- package/dist/policy/compile.js +42 -4
- package/dist/policy/compile.js.map +1 -1
- package/dist/policy/index.d.ts +1 -1
- package/dist/policy/index.d.ts.map +1 -1
- package/dist/policy/index.js +1 -1
- package/dist/policy/index.js.map +1 -1
- package/dist/state.d.ts +80 -1
- package/dist/state.d.ts.map +1 -1
- package/dist/state.js +234 -6
- package/dist/state.js.map +1 -1
- package/dist/worker.d.ts.map +1 -1
- package/dist/worker.js +28 -6
- package/dist/worker.js.map +1 -1
- package/package.json +3 -3
package/dist/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAcA,uEAAuE;AACvE,qBAAa,WAAY,SAAQ,KAAK;IACpC,YAAY,OAAO,EAAE,MAAM,EAG1B;CACF;AAED,mEAAmE;AACnE,MAAM,MAAM,gBAAgB,GACxB,eAAe,GACf,cAAc,GACd,qBAAqB,GACrB,gBAAgB,GAChB,uBAAuB,GACvB,oBAAoB;AACtB,mFAAmF;GACjF,gBAAgB;AAClB,sEAAsE;GACpE,cAAc;AAChB,0EAA0E;GACxE,gBAAgB;AAClB,uFAAuF;GACrF,oBAAoB;AACtB,kFAAkF;GAChF,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAcA,uEAAuE;AACvE,qBAAa,WAAY,SAAQ,KAAK;IACpC,YAAY,OAAO,EAAE,MAAM,EAG1B;CACF;AAED,mEAAmE;AACnE,MAAM,MAAM,gBAAgB,GACxB,eAAe,GACf,cAAc,GACd,qBAAqB,GACrB,gBAAgB,GAChB,uBAAuB,GACvB,oBAAoB;AACtB,mFAAmF;GACjF,gBAAgB;AAClB,sEAAsE;GACpE,cAAc;AAChB,0EAA0E;GACxE,gBAAgB;AAClB,uFAAuF;GACrF,oBAAoB;AACtB,kFAAkF;GAChF,qBAAqB;AACvB,mFAAmF;GACjF,iBAAiB;AACnB,gGAAgG;GAC9F,gBAAgB;AAClB,sFAAsF;GACpF,eAAe;AACjB,yEAAyE;GACvE,kBAAkB;AACpB,iGAAiG;GAC/F,iBAAiB;AACnB,+EAA+E;GAC7E,sBAAsB;AACxB,kGAAkG;GAChG,qBAAqB;AACvB,yDAAyD;GACvD,kBAAkB;AACpB,gFAAgF;GAC9E,mBAAmB;AACrB,0EAA0E;GACxE,mBAAmB;AACrB,yFAAyF;GACvF,gBAAgB,CAAA;AAEpB,wEAAwE;AACxE,qBAAa,eAAgB,SAAQ,KAAK;IACxC,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAA;IAEjC,YAAY,MAAM,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,EAIpD;CACF;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAEpD"}
|
package/dist/errors.js
CHANGED
|
@@ -27,4 +27,15 @@ export class GatekeeperError extends Error {
|
|
|
27
27
|
this.reason = reason;
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* A failure as a refusal or a record carries it: one line, never an object nothing can render.
|
|
32
|
+
*
|
|
33
|
+
* Here rather than beside each caller because three of them (a hook push, a bind the workspace did
|
|
34
|
+
* not take, a verifier that could not be questioned) fold a cause into prose a person reads, and
|
|
35
|
+
* three copies of the same two lines is how they drift into disagreeing about what an
|
|
36
|
+
* `AggregateError` or a thrown string looks like.
|
|
37
|
+
*/
|
|
38
|
+
export function describeError(error) {
|
|
39
|
+
return error instanceof Error ? `${error.name}: ${error.message}` : String(error);
|
|
40
|
+
}
|
|
30
41
|
//# sourceMappingURL=errors.js.map
|
package/dist/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,qFAAqF;AACrF,EAAE;AACF,4FAA4F;AAC5F,+FAA+F;AAC/F,6FAA6F;AAC7F,mGAAmG;AACnG,mGAAmG;AACnG,2EAA2E;AAC3E,EAAE;AACF,gGAAgG;AAChG,kGAAkG;AAClG,iGAAiG;AACjG,oEAAoE;AAEpE,uEAAuE;AACvE,MAAM,OAAO,WAAY,SAAQ,KAAK;IACpC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,aAAa,CAAA;IAC3B,CAAC;CACF;
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,qFAAqF;AACrF,EAAE;AACF,4FAA4F;AAC5F,+FAA+F;AAC/F,6FAA6F;AAC7F,mGAAmG;AACnG,mGAAmG;AACnG,2EAA2E;AAC3E,EAAE;AACF,gGAAgG;AAChG,kGAAkG;AAClG,iGAAiG;AACjG,oEAAoE;AAEpE,uEAAuE;AACvE,MAAM,OAAO,WAAY,SAAQ,KAAK;IACpC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,aAAa,CAAA;IAC3B,CAAC;CACF;AA2CD,wEAAwE;AACxE,MAAM,OAAO,eAAgB,SAAQ,KAAK;IAC/B,MAAM,CAAkB;IAEjC,YAAY,MAAwB,EAAE,OAAe;QACnD,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAA;QAC7B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;CACF;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa,CAAC,KAAc;IAC1C,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;AACnF,CAAC"}
|
package/dist/gatekeeper.d.ts
CHANGED
|
@@ -1,11 +1,28 @@
|
|
|
1
|
+
import { type SessionGovernance } from './capability.js';
|
|
1
2
|
import { type GatekeeperEnv } from './env.js';
|
|
2
3
|
import { type Actor } from './keys.js';
|
|
3
|
-
import {
|
|
4
|
+
import type { HookTopic } from './os/hooks.js';
|
|
5
|
+
import { type CompiledTier, type GatekeeperPolicy } from './policy/compile.js';
|
|
4
6
|
import { type VerificationResult } from './webhook/signature.js';
|
|
5
7
|
/** Why a delivery was refused, drawn from the verifier so the two cannot drift. */
|
|
6
8
|
type RejectionReason = Extract<VerificationResult, {
|
|
7
9
|
ok: false;
|
|
8
10
|
}>['reason'];
|
|
11
|
+
/**
|
|
12
|
+
* What the receiver handed to the hook fan-out, which is DISPATCH and never delivery.
|
|
13
|
+
*
|
|
14
|
+
* The distinction is the whole reason this shape changed. The fan-out runs behind the
|
|
15
|
+
* acknowledgement, so at the moment this is reported no push has been made and any count of them
|
|
16
|
+
* would be a zero standing in for a number nobody has yet: the one reading a receiver must never
|
|
17
|
+
* offer, because it is indistinguishable from a delivery no hook took. What each push DID land on
|
|
18
|
+
* its own registration's counters, which `hooks_bound()` publishes.
|
|
19
|
+
*/
|
|
20
|
+
export interface HookDispatchReceipt {
|
|
21
|
+
/** How many payloads this delivery produced. Zero when no topic covers it. */
|
|
22
|
+
pushes: number;
|
|
23
|
+
/** The distinct topics they carry, so the platform's delivery log names what was dispatched. */
|
|
24
|
+
topics: HookTopic[];
|
|
25
|
+
}
|
|
9
26
|
/** What taking delivery of one webhook POST did. */
|
|
10
27
|
export type DeliveryOutcome = {
|
|
11
28
|
handled: 'rejected';
|
|
@@ -19,6 +36,7 @@ export type DeliveryOutcome = {
|
|
|
19
36
|
handled: 'accepted';
|
|
20
37
|
deliveryId: string;
|
|
21
38
|
effect: 'opened' | 'superseded' | 'run-event' | 'none';
|
|
39
|
+
hooks: HookDispatchReceipt;
|
|
22
40
|
};
|
|
23
41
|
export declare class Gatekeeper {
|
|
24
42
|
#private;
|
|
@@ -40,7 +58,60 @@ export declare class Gatekeeper {
|
|
|
40
58
|
* The tier is resolved from the Gatekeeper's OWN policy, never from anything the caller sent:
|
|
41
59
|
* an agent that could name its tier would be its own authorization.
|
|
42
60
|
*/
|
|
43
|
-
capabilityFor(actor: Actor): import("capnweb").RpcTarget;
|
|
61
|
+
capabilityFor(actor: Actor, governance?: SessionGovernance): import("capnweb").RpcTarget;
|
|
62
|
+
/**
|
|
63
|
+
* The capability for an auto-provisioned Cloudflare OS account.
|
|
64
|
+
*
|
|
65
|
+
* A sibling of `capabilityFor` rather than a flag on it, because the two doors resolve a tier
|
|
66
|
+
* from different halves of the policy: `/rpc` names a person the OS asserts, and an account was
|
|
67
|
+
* minted here with no name at all. Everything after the resolution is the one implementation.
|
|
68
|
+
*/
|
|
69
|
+
capabilityForAccount(accountId: string, governance: SessionGovernance): import("capnweb").RpcTarget;
|
|
70
|
+
/**
|
|
71
|
+
* The compiled tier an actor holds, or a refusal naming what an operator has to change.
|
|
72
|
+
*
|
|
73
|
+
* Exposed beside `capabilityFor` because the OS object model asks about a tier without building
|
|
74
|
+
* a session from it: the resource's TypeScript types and its auto-approvable action kinds are
|
|
75
|
+
* both projections of the tier, and both are read before any session exists.
|
|
76
|
+
*/
|
|
77
|
+
tierFor(actorId: string): CompiledTier;
|
|
78
|
+
/**
|
|
79
|
+
* The tier an auto-provisioned Cloudflare OS account holds, or a refusal naming the knob.
|
|
80
|
+
*
|
|
81
|
+
* Separate from {@link tierFor} because the refusal has to name the right thing: a deployment
|
|
82
|
+
* that has not opted into OS discovery has not misconfigured anything, and telling its operator
|
|
83
|
+
* to add an actor to `grants` would be telling them to write a line for an id that did not exist
|
|
84
|
+
* when they were reading.
|
|
85
|
+
*/
|
|
86
|
+
tierForAccount(accountId: string): CompiledTier;
|
|
87
|
+
/**
|
|
88
|
+
* The tier EVERY auto-provisioned account falls to, asked without an account.
|
|
89
|
+
*
|
|
90
|
+
* The vendor is questioned before any account exists (its published session types are the ones a
|
|
91
|
+
* new account will get), and that question has an answer of its own. Asking it by minting a
|
|
92
|
+
* throwaway id would resolve the same tier and, when there is none, refuse by naming an
|
|
93
|
+
* `acct_…` that appears nowhere in the operator's policy.
|
|
94
|
+
*/
|
|
95
|
+
tierForNewAccount(): CompiledTier;
|
|
96
|
+
/**
|
|
97
|
+
* The tier NAME a policy nominates for auto-provisioned accounts, or `null`.
|
|
98
|
+
*
|
|
99
|
+
* The raw knob rather than the compiled tier, because the one caller that wants it is `/health`,
|
|
100
|
+
* reporting whether this deployment has opted into Cloudflare OS discovery at all. A refusal
|
|
101
|
+
* would be the wrong shape there: not having opted in is a state, not a fault.
|
|
102
|
+
*/
|
|
103
|
+
get autoProvisionedTierName(): string | null;
|
|
104
|
+
/**
|
|
105
|
+
* Whether this deployment minted the named account.
|
|
106
|
+
*
|
|
107
|
+
* Asked by the ONE caller that is handed an account id from outside (`addObserver`, over an
|
|
108
|
+
* observer's verifier) and has to resolve a tier for it. Every other account id in this package
|
|
109
|
+
* arrives on `ctx.props` of a stub this Gatekeeper handed the workspace, so it was minted here
|
|
110
|
+
* by construction and asking again would be a lookup with no question behind it.
|
|
111
|
+
*/
|
|
112
|
+
recognizesAccount(accountId: string): Promise<boolean>;
|
|
113
|
+
/** The origin of the cat-factory deployment this Gatekeeper is paired with. */
|
|
114
|
+
get deployment(): string;
|
|
44
115
|
/**
|
|
45
116
|
* Retire an actor: revoke every key this Gatekeeper minted for them, upstream and here.
|
|
46
117
|
*
|
|
@@ -71,8 +142,12 @@ export declare class Gatekeeper {
|
|
|
71
142
|
* Deduping in a call of its own would be worse than useless: a marker committed before the card
|
|
72
143
|
* write turns a failed write into a `duplicate` on the platform's retry, so the approval never
|
|
73
144
|
* reaches the inbox and nothing anywhere reports that it did not.
|
|
145
|
+
*
|
|
146
|
+
* `defer` is how the fan-out is kept OFF that path, and it is a parameter rather than something
|
|
147
|
+
* read here because the lifetime being extended is the Worker invocation's, which only the
|
|
148
|
+
* handler holds.
|
|
74
149
|
*/
|
|
75
|
-
takeDelivery(request: Request, now: number): Promise<DeliveryOutcome>;
|
|
150
|
+
takeDelivery(request: Request, now: number, defer: (work: Promise<unknown>) => void): Promise<DeliveryOutcome>;
|
|
76
151
|
}
|
|
77
152
|
export {};
|
|
78
153
|
//# sourceMappingURL=gatekeeper.d.ts.map
|
package/dist/gatekeeper.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gatekeeper.d.ts","sourceRoot":"","sources":["../src/gatekeeper.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"gatekeeper.d.ts","sourceRoot":"","sources":["../src/gatekeeper.ts"],"names":[],"mappings":"AAWA,OAAO,EAAmB,KAAK,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AACzE,OAAO,EAAwB,KAAK,aAAa,EAAE,MAAM,UAAU,CAAA;AAEnE,OAAO,EAAa,KAAK,KAAK,EAAE,MAAM,WAAW,CAAA;AACjD,OAAO,KAAK,EAAkB,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9D,OAAO,EAML,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACtB,MAAM,qBAAqB,CAAA;AAG5B,OAAO,EAAkB,KAAK,kBAAkB,EAAE,MAAM,wBAAwB,CAAA;AAgBhF,mFAAmF;AACnF,KAAK,eAAe,GAAG,OAAO,CAAC,kBAAkB,EAAE;IAAE,EAAE,EAAE,KAAK,CAAA;CAAE,CAAC,CAAC,QAAQ,CAAC,CAAA;AAE3E;;;;;;;;GAQG;AACH,MAAM,WAAW,mBAAmB;IAClC,8EAA8E;IAC9E,MAAM,EAAE,MAAM,CAAA;IACd,gGAAgG;IAChG,MAAM,EAAE,SAAS,EAAE,CAAA;CACpB;AAED,oDAAoD;AACpD,MAAM,MAAM,eAAe,GACvB;IAAE,OAAO,EAAE,UAAU,CAAC;IAAC,MAAM,EAAE,eAAe,CAAA;CAAE,GAChD;IAAE,OAAO,EAAE,aAAa,CAAA;CAAE,GAC1B;IAAE,OAAO,EAAE,WAAW,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GAC5C;IACE,OAAO,EAAE,UAAU,CAAA;IACnB,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,QAAQ,GAAG,YAAY,GAAG,WAAW,GAAG,MAAM,CAAA;IACtD,KAAK,EAAE,mBAAmB,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AAI,EAAE,OAAO,CAAC,OAAO,CAAC,KAAK,IAAI,GACtC,OAAO,CAAC,eAAe,CAAC,CAoC1B;CACF"}
|
package/dist/gatekeeper.js
CHANGED
|
@@ -9,14 +9,23 @@
|
|
|
9
9
|
// forking it.
|
|
10
10
|
import { CatFactoryClient } from '@cat-factory/sdk';
|
|
11
11
|
import { buildCapability } from './capability.js';
|
|
12
|
-
import { requireVar } from './env.js';
|
|
12
|
+
import { requireVar, stateFor } from './env.js';
|
|
13
13
|
import { GatekeeperError } from './errors.js';
|
|
14
14
|
import { KeyBroker } from './keys.js';
|
|
15
|
-
import { compilePolicy, tierForActor, } from './policy/compile.js';
|
|
15
|
+
import { autoProvisionedTier, compilePolicy, tierForAccount, tierForActor, } from './policy/compile.js';
|
|
16
16
|
import { cardEffectOf, readDelivery, SUBSCRIBED_CARD_TYPES } from './webhook/delivery.js';
|
|
17
17
|
import { verifyDelivery } from './webhook/signature.js';
|
|
18
18
|
/** Identifies this integration in the deployment's logs, beside the SDK's own version. */
|
|
19
19
|
const USER_AGENT = 'cat-factory-gatekeeper';
|
|
20
|
+
/**
|
|
21
|
+
* The one remedy both auto-provisioning refusals end on.
|
|
22
|
+
*
|
|
23
|
+
* Stated once because the two refusals differ only in what they could not do (open a session for a
|
|
24
|
+
* named account, describe the session a new one would get) and never in the fix.
|
|
25
|
+
*/
|
|
26
|
+
const AUTO_PROVISIONED_TIER_REMEDY = "Name a tier as the policy's autoProvisionedTier to turn Cloudflare OS discovery on; it is " +
|
|
27
|
+
'deliberately separate from defaultTier, because an account the workspace minted carries no ' +
|
|
28
|
+
'identity your grants could have named.';
|
|
20
29
|
export class Gatekeeper {
|
|
21
30
|
#env;
|
|
22
31
|
#policy;
|
|
@@ -27,10 +36,7 @@ export class Gatekeeper {
|
|
|
27
36
|
this.#policy = policy;
|
|
28
37
|
const baseUrl = requireVar(env, 'CAT_FACTORY_BASE_URL');
|
|
29
38
|
const clientFor = (apiKey) => new CatFactoryClient({ baseUrl, apiKey, userAgent: USER_AGENT });
|
|
30
|
-
|
|
31
|
-
// is the pairing's own identity, so pointing this Worker at a different cat-factory gets a
|
|
32
|
-
// different object rather than inheriting the previous one's cards and minted keys.
|
|
33
|
-
this.#state = env.STATE.get(env.STATE.idFromName(baseUrl));
|
|
39
|
+
this.#state = stateFor(env);
|
|
34
40
|
this.#keys = new KeyBroker({
|
|
35
41
|
state: this.#state,
|
|
36
42
|
provisioning: clientFor(requireVar(env, 'PROVISIONING_KEY')),
|
|
@@ -61,13 +67,99 @@ export class Gatekeeper {
|
|
|
61
67
|
* The tier is resolved from the Gatekeeper's OWN policy, never from anything the caller sent:
|
|
62
68
|
* an agent that could name its tier would be its own authorization.
|
|
63
69
|
*/
|
|
64
|
-
capabilityFor(actor) {
|
|
65
|
-
|
|
70
|
+
capabilityFor(actor, governance) {
|
|
71
|
+
return this.#capability(actor, this.tierFor(actor.id), governance);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* The capability for an auto-provisioned Cloudflare OS account.
|
|
75
|
+
*
|
|
76
|
+
* A sibling of `capabilityFor` rather than a flag on it, because the two doors resolve a tier
|
|
77
|
+
* from different halves of the policy: `/rpc` names a person the OS asserts, and an account was
|
|
78
|
+
* minted here with no name at all. Everything after the resolution is the one implementation.
|
|
79
|
+
*/
|
|
80
|
+
capabilityForAccount(accountId, governance) {
|
|
81
|
+
return this.#capability({ id: accountId, label: accountId }, this.tierForAccount(accountId), governance);
|
|
82
|
+
}
|
|
83
|
+
#capability(actor, tier, governance) {
|
|
84
|
+
return buildCapability({
|
|
85
|
+
actor,
|
|
86
|
+
tier,
|
|
87
|
+
keys: this.#keys,
|
|
88
|
+
state: this.#state,
|
|
89
|
+
...(governance ? { governance } : {}),
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* The compiled tier an actor holds, or a refusal naming what an operator has to change.
|
|
94
|
+
*
|
|
95
|
+
* Exposed beside `capabilityFor` because the OS object model asks about a tier without building
|
|
96
|
+
* a session from it: the resource's TypeScript types and its auto-approvable action kinds are
|
|
97
|
+
* both projections of the tier, and both are read before any session exists.
|
|
98
|
+
*/
|
|
99
|
+
tierFor(actorId) {
|
|
100
|
+
const tier = tierForActor(this.#policy, actorId);
|
|
66
101
|
if (tier === null) {
|
|
67
|
-
throw new GatekeeperError('unknown_actor', `No tier is granted to '${
|
|
102
|
+
throw new GatekeeperError('unknown_actor', `No tier is granted to '${actorId}'. Add them to this Gatekeeper's policy under ` +
|
|
68
103
|
'grants, or set a defaultTier if this deployment means every OS user to have one.');
|
|
69
104
|
}
|
|
70
|
-
return
|
|
105
|
+
return tier;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* The tier an auto-provisioned Cloudflare OS account holds, or a refusal naming the knob.
|
|
109
|
+
*
|
|
110
|
+
* Separate from {@link tierFor} because the refusal has to name the right thing: a deployment
|
|
111
|
+
* that has not opted into OS discovery has not misconfigured anything, and telling its operator
|
|
112
|
+
* to add an actor to `grants` would be telling them to write a line for an id that did not exist
|
|
113
|
+
* when they were reading.
|
|
114
|
+
*/
|
|
115
|
+
tierForAccount(accountId) {
|
|
116
|
+
const tier = tierForAccount(this.#policy, accountId);
|
|
117
|
+
if (tier === null) {
|
|
118
|
+
throw new GatekeeperError('unknown_actor', 'This Gatekeeper serves no auto-provisioned accounts, so it cannot open a session for ' +
|
|
119
|
+
`'${accountId}'. ${AUTO_PROVISIONED_TIER_REMEDY}`);
|
|
120
|
+
}
|
|
121
|
+
return tier;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* The tier EVERY auto-provisioned account falls to, asked without an account.
|
|
125
|
+
*
|
|
126
|
+
* The vendor is questioned before any account exists (its published session types are the ones a
|
|
127
|
+
* new account will get), and that question has an answer of its own. Asking it by minting a
|
|
128
|
+
* throwaway id would resolve the same tier and, when there is none, refuse by naming an
|
|
129
|
+
* `acct_…` that appears nowhere in the operator's policy.
|
|
130
|
+
*/
|
|
131
|
+
tierForNewAccount() {
|
|
132
|
+
const tier = autoProvisionedTier(this.#policy);
|
|
133
|
+
if (tier === null) {
|
|
134
|
+
throw new GatekeeperError('unknown_actor', 'This Gatekeeper serves no auto-provisioned accounts, so there is no session for it to ' +
|
|
135
|
+
`describe. ${AUTO_PROVISIONED_TIER_REMEDY}`);
|
|
136
|
+
}
|
|
137
|
+
return tier;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* The tier NAME a policy nominates for auto-provisioned accounts, or `null`.
|
|
141
|
+
*
|
|
142
|
+
* The raw knob rather than the compiled tier, because the one caller that wants it is `/health`,
|
|
143
|
+
* reporting whether this deployment has opted into Cloudflare OS discovery at all. A refusal
|
|
144
|
+
* would be the wrong shape there: not having opted in is a state, not a fault.
|
|
145
|
+
*/
|
|
146
|
+
get autoProvisionedTierName() {
|
|
147
|
+
return this.#policy.autoProvisionedTier;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Whether this deployment minted the named account.
|
|
151
|
+
*
|
|
152
|
+
* Asked by the ONE caller that is handed an account id from outside (`addObserver`, over an
|
|
153
|
+
* observer's verifier) and has to resolve a tier for it. Every other account id in this package
|
|
154
|
+
* arrives on `ctx.props` of a stub this Gatekeeper handed the workspace, so it was minted here
|
|
155
|
+
* by construction and asking again would be a lookup with no question behind it.
|
|
156
|
+
*/
|
|
157
|
+
async recognizesAccount(accountId) {
|
|
158
|
+
return await this.#state.hasAccount(accountId);
|
|
159
|
+
}
|
|
160
|
+
/** The origin of the cat-factory deployment this Gatekeeper is paired with. */
|
|
161
|
+
get deployment() {
|
|
162
|
+
return requireVar(this.#env, 'CAT_FACTORY_BASE_URL');
|
|
71
163
|
}
|
|
72
164
|
/**
|
|
73
165
|
* Retire an actor: revoke every key this Gatekeeper minted for them, upstream and here.
|
|
@@ -122,8 +214,12 @@ export class Gatekeeper {
|
|
|
122
214
|
* Deduping in a call of its own would be worse than useless: a marker committed before the card
|
|
123
215
|
* write turns a failed write into a `duplicate` on the platform's retry, so the approval never
|
|
124
216
|
* reaches the inbox and nothing anywhere reports that it did not.
|
|
217
|
+
*
|
|
218
|
+
* `defer` is how the fan-out is kept OFF that path, and it is a parameter rather than something
|
|
219
|
+
* read here because the lifetime being extended is the Worker invocation's, which only the
|
|
220
|
+
* handler holds.
|
|
125
221
|
*/
|
|
126
|
-
async takeDelivery(request, now) {
|
|
222
|
+
async takeDelivery(request, now, defer) {
|
|
127
223
|
const rawBody = await request.text();
|
|
128
224
|
const verdict = await verifyDelivery(request.headers, rawBody, requireVar(this.#env, 'WEBHOOK_SECRET'), now);
|
|
129
225
|
if (!verdict.ok)
|
|
@@ -138,12 +234,30 @@ export class Gatekeeper {
|
|
|
138
234
|
const delivery = readDelivery(parsed);
|
|
139
235
|
if (delivery === null)
|
|
140
236
|
return { handled: 'unparseable' };
|
|
141
|
-
const
|
|
237
|
+
const effect = cardEffectOf(delivery);
|
|
238
|
+
const applied = await this.#state.applyDelivery(delivery.deliveryId, effect, now);
|
|
142
239
|
if (!applied.applied)
|
|
143
240
|
return { handled: 'duplicate', deliveryId: delivery.deliveryId };
|
|
144
|
-
|
|
241
|
+
// AFTER the write and BESIDE the acknowledgement, never in front of it. The card is the
|
|
242
|
+
// durable truth and the push is the accelerator over it, so a workspace that hangs or refuses
|
|
243
|
+
// must cost a notification and never the record. Awaiting the fan-out here made it cost both:
|
|
244
|
+
// one slow workspace times the delivery out, the platform retries to protect a write that had
|
|
245
|
+
// already committed, and the retry is deduped into pushing nothing at all, so the notification
|
|
246
|
+
// the wait was supposed to guarantee is the one thing certain to be lost.
|
|
247
|
+
if (applied.pushes.length > 0)
|
|
248
|
+
defer(this.#state.dispatchHooks(applied.pushes, now));
|
|
249
|
+
return {
|
|
250
|
+
handled: 'accepted',
|
|
251
|
+
deliveryId: delivery.deliveryId,
|
|
252
|
+
effect: applied.effect,
|
|
253
|
+
hooks: receiptFor(applied.pushes),
|
|
254
|
+
};
|
|
145
255
|
}
|
|
146
256
|
}
|
|
257
|
+
/** What was handed to the fan-out, summarised for the platform's own delivery log. */
|
|
258
|
+
function receiptFor(pushes) {
|
|
259
|
+
return { pushes: pushes.length, topics: [...new Set(pushes.map((push) => push.topic))] };
|
|
260
|
+
}
|
|
147
261
|
/**
|
|
148
262
|
* Compare two secrets without an early exit on the first differing character.
|
|
149
263
|
*
|
package/dist/gatekeeper.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gatekeeper.js","sourceRoot":"","sources":["../src/gatekeeper.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,EAAE;AACF,0FAA0F;AAC1F,6FAA6F;AAC7F,EAAE;AACF,+FAA+F;AAC/F,6FAA6F;AAC7F,2FAA2F;AAC3F,cAAc;AAEd,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,EAAE,eAAe,
|
|
1
|
+
{"version":3,"file":"gatekeeper.js","sourceRoot":"","sources":["../src/gatekeeper.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,EAAE;AACF,0FAA0F;AAC1F,6FAA6F;AAC7F,EAAE;AACF,+FAA+F;AAC/F,6FAA6F;AAC7F,2FAA2F;AAC3F,cAAc;AAEd,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,EAAE,eAAe,EAA0B,MAAM,iBAAiB,CAAA;AACzE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAsB,MAAM,UAAU,CAAA;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,EAAE,SAAS,EAAc,MAAM,WAAW,CAAA;AAEjD,OAAO,EACL,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,YAAY,GAIb,MAAM,qBAAqB,CAAA;AAE5B,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAA;AACzF,OAAO,EAAE,cAAc,EAA2B,MAAM,wBAAwB,CAAA;AAEhF,0FAA0F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E,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAA;AAC1F,CAAC;AAED;;;;;;GAMG;AACH,SAAS,sBAAsB,CAAC,CAAS,EAAE,CAAS;IAClD,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM;QAAE,OAAO,KAAK,CAAA;IACvC,IAAI,IAAI,GAAG,CAAC,CAAA;IACZ,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE;QAAE,IAAI,IAAI,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAA;IAC5E,OAAO,IAAI,KAAK,CAAC,CAAA;AACnB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { createGatekeeperWorker, type GatekeeperWorkerOptions } from './worker.js';
|
|
2
|
-
export { Gatekeeper, type DeliveryOutcome } from './gatekeeper.js';
|
|
2
|
+
export { Gatekeeper, type DeliveryOutcome, type HookDispatchReceipt } from './gatekeeper.js';
|
|
3
3
|
export { GatekeeperState, type ApprovalCard, type DeliveryApplication, type DeliveryEffect, type MintClaim, type MintTicket, type RunState, type StoredKey, } from './state.js';
|
|
4
4
|
export { ConfigError, type GatekeeperEnv } from './env.js';
|
|
5
5
|
export { buildCapability, type CardInspection, type SessionDependencies, type TierSummary, } from './capability.js';
|
|
@@ -7,5 +7,22 @@ export { KeyBroker, type Actor, type KeyBrokerDependencies, type LeasedClient }
|
|
|
7
7
|
export { answerCard, assertAnswerable, describeStale, pendingParks, type AnswerInput, type AnswerOutcome, type BindingInvoker, type DecisionListShape, type PendingPark, } from './approvals.js';
|
|
8
8
|
export { cardEffectOf, dispositionOf, PARKED_DECISION_CARD_TYPES, readDelivery, SUBSCRIBED_CARD_TYPES, type CardDisposition, type Delivery, } from './webhook/delivery.js';
|
|
9
9
|
export { DEFAULT_MAX_SKEW_MS, verifyDelivery, type VerificationResult, } from './webhook/signature.js';
|
|
10
|
+
export { createGatekeeperVendor } from './os/vendor.js';
|
|
11
|
+
export { createGatekeeperAccount, createGatekeeperVerifier, type AccountProps, } from './os/account.js';
|
|
12
|
+
export { createGatekeeperResource } from './os/resource.js';
|
|
13
|
+
export { ResourceCore, type ResourceDependencies, type ResourceProps } from './os/resource-core.js';
|
|
14
|
+
export { createGatekeeperHookController, type HookControllerProps } from './os/hook-controller.js';
|
|
15
|
+
export { applyPushOutcome, describeHook, describeHookDelivery, holdInitiator, HOOK_TOPICS, HOOK_TOPIC_NAMES, pushToHook, registrationKey, type HookDispatchReport, type HookPayload, type HookPushOutcome, type HookPushTarget, type HookRecord, type HookRegistration, type HookTopic, } from './os/hooks.js';
|
|
16
|
+
export { assertObserverMaySee, identifyObserver, type ObserverRecognition } from './os/sharing.js';
|
|
17
|
+
export { checkedArguments, declaredArguments } from './arguments.js';
|
|
18
|
+
export { OS_EXPORTS, OS_EXPORT_REQUIREMENT, missingOsExports, type OsExportRequirement, type OsExportRole, } from './os/exports.js';
|
|
19
|
+
export { describeDiscoverability, type DiscoverabilityReport, type DiscoveryBlocker, type DiscoveryBlockerReason, } from './os/discoverability.js';
|
|
20
|
+
export { supportedResourceFor } from './os/resources.js';
|
|
21
|
+
export { SESSION_INTERFACE_NAME, renderTierSessionTypes } from './os/session-types.js';
|
|
22
|
+
export { ActionLedger, holdQueue, queueGovernance, type LedgerSession } from './os/queue.js';
|
|
23
|
+
export { actionKindOf, describeAction, describeObservation, type CallSubject, } from './os/descriptions.js';
|
|
24
|
+
export { fenced } from './markdown.js';
|
|
25
|
+
export type { AccountDescription, AccountEntrypoint, ActionDescription, ActionKind, ApprovalQueue, AvatarImage, HookController, HookDescription, HookInitiator, HookTargetMetadata, ObservationAuthorizer, ObservationDescription, ResourceDescription, ResourceObject, SupportedResource, VendorDescription, VendorEntrypoint, VerifierEntrypoint, } from './os/protocol.js';
|
|
26
|
+
export type { SessionGovernance } from './capability.js';
|
|
10
27
|
export * from './policy/index.js';
|
|
11
28
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,sBAAsB,EAAE,KAAK,uBAAuB,EAAE,MAAM,aAAa,CAAA;AAClF,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,sBAAsB,EAAE,KAAK,uBAAuB,EAAE,MAAM,aAAa,CAAA;AAClF,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,KAAK,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAI5F,OAAO,EACL,eAAe,EACf,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,QAAQ,EACb,KAAK,SAAS,GACf,MAAM,YAAY,CAAA;AAEnB,OAAO,EAAE,WAAW,EAAE,KAAK,aAAa,EAAE,MAAM,UAAU,CAAA;AAC1D,OAAO,EACL,eAAe,EACf,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,KAAK,WAAW,GACjB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAE,SAAS,EAAE,KAAK,KAAK,EAAE,KAAK,qBAAqB,EAAE,KAAK,YAAY,EAAE,MAAM,WAAW,CAAA;AAEhG,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,WAAW,GACjB,MAAM,gBAAgB,CAAA;AAEvB,OAAO,EACL,YAAY,EACZ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MAAM,mBAAmB,CAAA;AACxD,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAA;AACtF,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,eAAe,EAAE,KAAK,aAAa,EAAE,MAAM,eAAe,CAAA;AAC5F,OAAO,EACL,YAAY,EACZ,cAAc,EACd,mBAAmB,EACnB,KAAK,WAAW,GACjB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AACtC,YAAY,EACV,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,UAAU,EACV,aAAa,EACb,WAAW,EACX,cAAc,EACd,eAAe,EACf,aAAa,EACb,kBAAkB,EAClB,qBAAqB,EACrB,sBAAsB,EACtB,mBAAmB,EACnB,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,kBAAkB,CAAA;AACzB,YAAY,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAIxD,cAAc,mBAAmB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -17,6 +17,25 @@ export { KeyBroker } from './keys.js';
|
|
|
17
17
|
export { answerCard, assertAnswerable, describeStale, pendingParks, } from './approvals.js';
|
|
18
18
|
export { cardEffectOf, dispositionOf, PARKED_DECISION_CARD_TYPES, readDelivery, SUBSCRIBED_CARD_TYPES, } from './webhook/delivery.js';
|
|
19
19
|
export { DEFAULT_MAX_SKEW_MS, verifyDelivery, } from './webhook/signature.js';
|
|
20
|
+
// The Cloudflare OS object model: a second door onto the rooms above, never a fork of them. The
|
|
21
|
+
// workspace discovers a `GatekeeperVendor` entrypoint over a service binding, mints an account,
|
|
22
|
+
// binds the paired workspace as a resource, and opens a session whose every call passes through the
|
|
23
|
+
// approval queue it supplied. `/rpc` and the admin routes are unchanged and still bearer-gated.
|
|
24
|
+
export { createGatekeeperVendor } from './os/vendor.js';
|
|
25
|
+
export { createGatekeeperAccount, createGatekeeperVerifier, } from './os/account.js';
|
|
26
|
+
export { createGatekeeperResource } from './os/resource.js';
|
|
27
|
+
export { ResourceCore } from './os/resource-core.js';
|
|
28
|
+
export { createGatekeeperHookController } from './os/hook-controller.js';
|
|
29
|
+
export { applyPushOutcome, describeHook, describeHookDelivery, holdInitiator, HOOK_TOPICS, HOOK_TOPIC_NAMES, pushToHook, registrationKey, } from './os/hooks.js';
|
|
30
|
+
export { assertObserverMaySee, identifyObserver } from './os/sharing.js';
|
|
31
|
+
export { checkedArguments, declaredArguments } from './arguments.js';
|
|
32
|
+
export { OS_EXPORTS, OS_EXPORT_REQUIREMENT, missingOsExports, } from './os/exports.js';
|
|
33
|
+
export { describeDiscoverability, } from './os/discoverability.js';
|
|
34
|
+
export { supportedResourceFor } from './os/resources.js';
|
|
35
|
+
export { SESSION_INTERFACE_NAME, renderTierSessionTypes } from './os/session-types.js';
|
|
36
|
+
export { ActionLedger, holdQueue, queueGovernance } from './os/queue.js';
|
|
37
|
+
export { actionKindOf, describeAction, describeObservation, } from './os/descriptions.js';
|
|
38
|
+
export { fenced } from './markdown.js';
|
|
20
39
|
// The policy vocabulary, also reachable on its own at `@cat-factory/gatekeeper-worker/policy` for
|
|
21
40
|
// a policy file that should not have to load a Worker runtime to be read or tested.
|
|
22
41
|
export * from './policy/index.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAClG,uFAAuF;AACvF,EAAE;AACF,mGAAmG;AACnG,kGAAkG;AAClG,kGAAkG;AAClG,iGAAiG;AACjG,wCAAwC;AAExC,OAAO,EAAE,sBAAsB,EAAgC,MAAM,aAAa,CAAA;AAClF,OAAO,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAClG,uFAAuF;AACvF,EA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AgB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AACpE,OAAO,EACL,UAAU,EACV,qBAAqB,EACrB,gBAAgB,GAGjB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EACL,uBAAuB,GAIxB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAA;AACxD,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAA;AACtF,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,eAAe,EAAsB,MAAM,eAAe,CAAA;AAC5F,OAAO,EACL,YAAY,EACZ,cAAc,EACd,mBAAmB,GAEpB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAuBtC,kGAAkG;AAClG,oFAAoF;AACpF,cAAc,mBAAmB,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fence a payload so it cannot break out of the code block that holds it.
|
|
3
|
+
*
|
|
4
|
+
* Sized one backtick longer than the longest run the payload contains, which is what makes it
|
|
5
|
+
* total: a payload holding ```` closes a ``` fence and everything after it, including the rest of
|
|
6
|
+
* the description, renders as prose the reader takes for ours.
|
|
7
|
+
*
|
|
8
|
+
* The language tag is the caller's, because a JSON argument bag and a free-text title are both
|
|
9
|
+
* fenced and only one of them is JSON.
|
|
10
|
+
*/
|
|
11
|
+
export declare function fenced(payload: string, language?: string): string;
|
|
12
|
+
//# sourceMappingURL=markdown.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../src/markdown.ts"],"names":[],"mappings":"AAaA;;;;;;;;;GASG;AACH,wBAAgB,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,SAAS,GAAG,MAAM,CAOjE"}
|
package/dist/markdown.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// The one Markdown-safety primitive this Worker needs.
|
|
2
|
+
//
|
|
3
|
+
// Every description this Gatekeeper composes is MARKDOWN rendered to a person who is about to
|
|
4
|
+
// decide something, and several of the holes in it carry text an agent or a task author wrote: the
|
|
5
|
+
// argument bag of a call, the title of an approval card. Those are parsed surfaces, not inert
|
|
6
|
+
// string sinks, and the failure is not cosmetic: an unbalanced fence swallows everything after it,
|
|
7
|
+
// so a payload closing the block early makes the rest of OUR prose render as the payload's, right
|
|
8
|
+
// where "here is what you are approving" is being said.
|
|
9
|
+
//
|
|
10
|
+
// It sits beside `masking.ts` rather than inside `os/` because both doors compose descriptions and
|
|
11
|
+
// neither owns the rule. It is the same sizing rule the platform's own `fencedOutput` uses for
|
|
12
|
+
// captured command output reaching a model.
|
|
13
|
+
/**
|
|
14
|
+
* Fence a payload so it cannot break out of the code block that holds it.
|
|
15
|
+
*
|
|
16
|
+
* Sized one backtick longer than the longest run the payload contains, which is what makes it
|
|
17
|
+
* total: a payload holding ```` closes a ``` fence and everything after it, including the rest of
|
|
18
|
+
* the description, renders as prose the reader takes for ours.
|
|
19
|
+
*
|
|
20
|
+
* The language tag is the caller's, because a JSON argument bag and a free-text title are both
|
|
21
|
+
* fenced and only one of them is JSON.
|
|
22
|
+
*/
|
|
23
|
+
export function fenced(payload, language = 'json') {
|
|
24
|
+
const longestRun = [...payload.matchAll(/`+/g)].reduce((longest, match) => Math.max(longest, match[0].length), 0);
|
|
25
|
+
const fence = '`'.repeat(Math.max(3, longestRun + 1));
|
|
26
|
+
return `${fence}${language}\n${payload}\n${fence}`;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=markdown.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markdown.js","sourceRoot":"","sources":["../src/markdown.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,EAAE;AACF,8FAA8F;AAC9F,mGAAmG;AACnG,8FAA8F;AAC9F,mGAAmG;AACnG,kGAAkG;AAClG,wDAAwD;AACxD,EAAE;AACF,mGAAmG;AACnG,+FAA+F;AAC/F,4CAA4C;AAE5C;;;;;;;;;GASG;AACH,MAAM,UAAU,MAAM,CAAC,OAAe,EAAE,QAAQ,GAAG,MAAM;IACvD,MAAM,UAAU,GAAG,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CACpD,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,EACtD,CAAC,CACF,CAAA;IACD,MAAM,KAAK,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,UAAU,GAAG,CAAC,CAAC,CAAC,CAAA;IACrD,OAAO,GAAG,KAAK,GAAG,QAAQ,KAAK,OAAO,KAAK,KAAK,EAAE,CAAA;AACpD,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { GatekeeperEnv } from '../env.js';
|
|
2
|
+
import type { GatekeeperPolicy } from '../policy/compile.js';
|
|
3
|
+
import type { AccountEntrypoint, VerifierEntrypoint } from './protocol.js';
|
|
4
|
+
/** What the vendor imbues an account with. The id IS the account; nothing else is stored. */
|
|
5
|
+
export interface AccountProps {
|
|
6
|
+
accountId: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* The account entrypoint over a deployment's policy.
|
|
10
|
+
*
|
|
11
|
+
* Stateless by construction: the workspace holds the stub, the stub holds the id, and everything
|
|
12
|
+
* else is resolved from the policy and the paired deployment on each call. There is no account
|
|
13
|
+
* table to fall out of step with the workspace's own.
|
|
14
|
+
*/
|
|
15
|
+
export declare function createGatekeeperAccount(options: {
|
|
16
|
+
policy: GatekeeperPolicy;
|
|
17
|
+
}): new (ctx: ExecutionContext<AccountProps>, env: GatekeeperEnv) => AccountEntrypoint;
|
|
18
|
+
/**
|
|
19
|
+
* The verifier: an identity token with no authority.
|
|
20
|
+
*
|
|
21
|
+
* The contract's own interface is empty, because what is being passed IS the identity: another
|
|
22
|
+
* gatekeeper asks the workspace whether the holder of this stub may see something, and never calls
|
|
23
|
+
* a method on it. `describe()` is here so a human looking at a share prompt sees which account is
|
|
24
|
+
* being named rather than an opaque stub.
|
|
25
|
+
*/
|
|
26
|
+
export declare function createGatekeeperVerifier(): new (ctx: ExecutionContext<AccountProps>, env: GatekeeperEnv) => VerifierEntrypoint;
|
|
27
|
+
//# sourceMappingURL=account.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../../src/os/account.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AAG9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAE5D,OAAO,KAAK,EAEV,iBAAiB,EAEjB,kBAAkB,EACnB,MAAM,eAAe,CAAA;AAItB,6FAA6F;AAC7F,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,CAAA;CAClB;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE;IAC/C,MAAM,EAAE,gBAAgB,CAAA;CACzB,GAAG,KAAK,GAAG,EAAE,gBAAgB,CAAC,YAAY,CAAC,EAAE,GAAG,EAAE,aAAa,KAAK,iBAAiB,CA8FrF;AAED;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,IAAI,KAC1C,GAAG,EAAE,gBAAgB,CAAC,YAAY,CAAC,EACnC,GAAG,EAAE,aAAa,KACf,kBAAkB,CAMtB"}
|