@cat-factory/gatekeeper-worker 0.5.0 → 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 +43 -2
- 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 +10 -0
- package/dist/capability.d.ts.map +1 -1
- package/dist/capability.js +39 -1
- 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 +20 -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 +31 -1
- package/dist/gatekeeper.d.ts.map +1 -1
- package/dist/gatekeeper.js +38 -8
- package/dist/gatekeeper.js.map +1 -1
- package/dist/index.d.ts +8 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/os/discoverability.d.ts +13 -1
- package/dist/os/discoverability.d.ts.map +1 -1
- package/dist/os/discoverability.js +23 -6
- package/dist/os/discoverability.js.map +1 -1
- package/dist/os/exports.d.ts +27 -0
- package/dist/os/exports.d.ts.map +1 -1
- package/dist/os/exports.js +25 -0
- package/dist/os/exports.js.map +1 -1
- 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 +43 -0
- package/dist/os/protocol.d.ts.map +1 -1
- package/dist/os/queue.d.ts +9 -0
- package/dist/os/queue.d.ts.map +1 -1
- package/dist/os/queue.js +44 -1
- package/dist/os/queue.js.map +1 -1
- package/dist/os/resource-core.d.ts +25 -10
- package/dist/os/resource-core.d.ts.map +1 -1
- package/dist/os/resource-core.js +31 -14
- package/dist/os/resource-core.js.map +1 -1
- package/dist/os/resource.d.ts.map +1 -1
- package/dist/os/resource.js +7 -1
- package/dist/os/resource.js.map +1 -1
- package/dist/os/session-types.d.ts.map +1 -1
- package/dist/os/session-types.js +28 -0
- package/dist/os/session-types.js.map +1 -1
- 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 +1 -1
- package/dist/os/vendor.d.ts.map +1 -1
- package/dist/os/vendor.js +8 -1
- package/dist/os/vendor.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 +4 -1
- package/dist/worker.js.map +1 -1
- package/package.json +3 -3
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,EAA0B,MAAM,iBAAiB,CAAA;AACzE,OAAO,EAAE,UAAU,EAAsB,MAAM,UAAU,CAAA;
|
|
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;AA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0EAA0E;QAC1E,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC;YAAE,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAA;QACpF,OAAO;YACL,OAAO,EAAE,UAAU;YACnB,UAAU,EAAE,QAAQ,CAAC,UAAU;YAC/B,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,KAAK,EAAE,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC;SAClC,CAAA;IACH,CAAC;CACF;AAED,sFAAsF;AACtF,SAAS,UAAU,CAAC,MAAiC;IACnD,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,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';
|
|
@@ -10,15 +10,19 @@ export { DEFAULT_MAX_SKEW_MS, verifyDelivery, type VerificationResult, } from '.
|
|
|
10
10
|
export { createGatekeeperVendor } from './os/vendor.js';
|
|
11
11
|
export { createGatekeeperAccount, createGatekeeperVerifier, type AccountProps, } from './os/account.js';
|
|
12
12
|
export { createGatekeeperResource } from './os/resource.js';
|
|
13
|
-
export { ResourceCore, type ResourceProps } from './os/resource-core.js';
|
|
14
|
-
export {
|
|
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';
|
|
15
19
|
export { describeDiscoverability, type DiscoverabilityReport, type DiscoveryBlocker, type DiscoveryBlockerReason, } from './os/discoverability.js';
|
|
16
20
|
export { supportedResourceFor } from './os/resources.js';
|
|
17
21
|
export { SESSION_INTERFACE_NAME, renderTierSessionTypes } from './os/session-types.js';
|
|
18
22
|
export { ActionLedger, holdQueue, queueGovernance, type LedgerSession } from './os/queue.js';
|
|
19
23
|
export { actionKindOf, describeAction, describeObservation, type CallSubject, } from './os/descriptions.js';
|
|
20
24
|
export { fenced } from './markdown.js';
|
|
21
|
-
export type { AccountDescription, AccountEntrypoint, ActionDescription, ActionKind, ApprovalQueue, AvatarImage, ObservationAuthorizer, ObservationDescription, ResourceDescription, ResourceObject, SupportedResource, VendorDescription, VendorEntrypoint, VerifierEntrypoint, } from './os/protocol.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';
|
|
22
26
|
export type { SessionGovernance } from './capability.js';
|
|
23
27
|
export * from './policy/index.js';
|
|
24
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,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25
25
|
export { createGatekeeperAccount, createGatekeeperVerifier, } from './os/account.js';
|
|
26
26
|
export { createGatekeeperResource } from './os/resource.js';
|
|
27
27
|
export { ResourceCore } from './os/resource-core.js';
|
|
28
|
-
export {
|
|
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';
|
|
29
33
|
export { describeDiscoverability, } from './os/discoverability.js';
|
|
30
34
|
export { supportedResourceFor } from './os/resources.js';
|
|
31
35
|
export { SESSION_INTERFACE_NAME, renderTierSessionTypes } from './os/session-types.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,EAAE;AACF,mGAAmG;AACnG,kGAAkG;AAClG,kGAAkG;AAClG,iGAAiG;AACjG,wCAAwC;AAExC,OAAO,EAAE,sBAAsB,EAAgC,MAAM,aAAa,CAAA;AAClF,OAAO,EAAE,UAAU,EAAkD,MAAM,iBAAiB,CAAA;AAE5F,0FAA0F;AAC1F,6FAA6F;AAC7F,OAAO,EACL,eAAe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xD,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"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/** Why a Cloudflare OS deployment could not finish installing this Gatekeeper. */
|
|
2
|
-
export type DiscoveryBlockerReason = 'missing_exports' | 'no_auto_provisioned_tier'
|
|
2
|
+
export type DiscoveryBlockerReason = 'missing_exports' | 'no_auto_provisioned_tier'
|
|
3
|
+
/** Installs and serves; only the hook push is missing. Reported as a LIMITATION, never a blocker. */
|
|
4
|
+
| 'hooks_unavailable';
|
|
3
5
|
/** One thing standing between this Worker and a workspace that could use it. */
|
|
4
6
|
export interface DiscoveryBlocker {
|
|
5
7
|
reason: DiscoveryBlockerReason;
|
|
@@ -14,6 +16,16 @@ export interface DiscoveryBlocker {
|
|
|
14
16
|
export interface DiscoverabilityReport {
|
|
15
17
|
discoverable: boolean;
|
|
16
18
|
blockers: DiscoveryBlocker[];
|
|
19
|
+
/**
|
|
20
|
+
* What a workspace COULD install and would find missing once it had.
|
|
21
|
+
*
|
|
22
|
+
* Separate from `blockers` because the remedies are alike and the urgency is not: a blocker is a
|
|
23
|
+
* workspace that never finishes installing, and a limitation is one that installs, works, and
|
|
24
|
+
* refuses one capability. Folding the second into the first would turn a deployment that never
|
|
25
|
+
* wanted hooks red; leaving it out entirely would let a deployment that does want them discover
|
|
26
|
+
* the gap from an agent's failed subscribe.
|
|
27
|
+
*/
|
|
28
|
+
limitations: DiscoveryBlocker[];
|
|
17
29
|
}
|
|
18
30
|
/**
|
|
19
31
|
* Ask both questions in ONE pass.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discoverability.d.ts","sourceRoot":"","sources":["../../src/os/discoverability.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"discoverability.d.ts","sourceRoot":"","sources":["../../src/os/discoverability.ts"],"names":[],"mappings":"AAyBA,kFAAkF;AAClF,MAAM,MAAM,sBAAsB,GAC9B,iBAAiB,GACjB,0BAA0B;AAC5B,qGAAqG;GACnG,mBAAmB,CAAA;AAEvB,gFAAgF;AAChF,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,sBAAsB,CAAA;IAC9B,MAAM,EAAE,MAAM,CAAA;CACf;AAED;;;;;GAKG;AACH,MAAM,WAAW,qBAAqB;IACpC,YAAY,EAAE,OAAO,CAAA;IACrB,QAAQ,EAAE,gBAAgB,EAAE,CAAA;IAC5B;;;;;;;;OAQG;IACH,WAAW,EAAE,gBAAgB,EAAE,CAAA;CAChC;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE;IAC5C,kFAAkF;IAClF,OAAO,EAAE,OAAO,CAAA;IAChB,mFAAmF;IACnF,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAA;CACnC,GAAG,qBAAqB,CAuCxB"}
|
|
@@ -12,9 +12,15 @@
|
|
|
12
12
|
// asked it, which is the same failure as the health route that reported only the bindings its
|
|
13
13
|
// request path happened to read: a monitor saying something the operator cannot act on.
|
|
14
14
|
//
|
|
15
|
-
// So the
|
|
16
|
-
//
|
|
17
|
-
|
|
15
|
+
// So the facts are reported side by side, each naming its own remedy, and a deployment that wants
|
|
16
|
+
// discovery keys a monitor on `os.discoverable` while one that does not ignores it.
|
|
17
|
+
//
|
|
18
|
+
// The same reasoning splits the report a second time. A workspace can install this Gatekeeper and
|
|
19
|
+
// still find one capability missing (the hook controller is reached only when a session binds a
|
|
20
|
+
// hook), and that is a LIMITATION rather than a blocker: reporting it as one would say a serving
|
|
21
|
+
// deployment is undiscoverable, and omitting it would leave the gap to be discovered from an
|
|
22
|
+
// agent's failed call.
|
|
23
|
+
import { missingOsExports, OS_EXPORTS, OS_EXPORT_REQUIREMENT } from './exports.js';
|
|
18
24
|
/**
|
|
19
25
|
* Ask both questions in ONE pass.
|
|
20
26
|
*
|
|
@@ -23,15 +29,26 @@ import { missingOsExports, OS_EXPORTS } from './exports.js';
|
|
|
23
29
|
*/
|
|
24
30
|
export function describeDiscoverability(deps) {
|
|
25
31
|
const blockers = [];
|
|
32
|
+
const limitations = [];
|
|
26
33
|
const missing = missingOsExports(deps.exports);
|
|
27
|
-
|
|
34
|
+
const missingModel = missing.filter((role) => OS_EXPORT_REQUIREMENT[role] === 'install');
|
|
35
|
+
if (missingModel.length > 0) {
|
|
28
36
|
blockers.push({
|
|
29
37
|
reason: 'missing_exports',
|
|
30
|
-
detail: `This Worker's entry module does not export ${
|
|
38
|
+
detail: `This Worker's entry module does not export ${missingModel.map((role) => OS_EXPORTS[role]).join(', ')}. ` +
|
|
31
39
|
'The Cloudflare OS object model resolves each by name against this Worker ' +
|
|
32
40
|
'(deploy/gatekeeper/src/index.ts is the template).',
|
|
33
41
|
});
|
|
34
42
|
}
|
|
43
|
+
if (missing.includes('hookController')) {
|
|
44
|
+
limitations.push({
|
|
45
|
+
reason: 'hooks_unavailable',
|
|
46
|
+
detail: `This Worker's entry module does not export ${OS_EXPORTS.hookController}, so a session ` +
|
|
47
|
+
'cannot bind a hook and nothing is pushed. Everything else works, and a workspace reads ' +
|
|
48
|
+
'the same cards and runs from approvals_list() and runs_watched(); add the export to ' +
|
|
49
|
+
'turn the push on.',
|
|
50
|
+
});
|
|
51
|
+
}
|
|
35
52
|
if (deps.autoProvisionedTier === null) {
|
|
36
53
|
blockers.push({
|
|
37
54
|
reason: 'no_auto_provisioned_tier',
|
|
@@ -41,6 +58,6 @@ export function describeDiscoverability(deps) {
|
|
|
41
58
|
'deliberately separate from defaultTier, which governs the /rpc door.',
|
|
42
59
|
});
|
|
43
60
|
}
|
|
44
|
-
return { discoverable: blockers.length === 0, blockers };
|
|
61
|
+
return { discoverable: blockers.length === 0, blockers, limitations };
|
|
45
62
|
}
|
|
46
63
|
//# sourceMappingURL=discoverability.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discoverability.js","sourceRoot":"","sources":["../../src/os/discoverability.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,EAAE;AACF,8FAA8F;AAC9F,wFAAwF;AACxF,iGAAiG;AACjG,6FAA6F;AAC7F,EAAE;AACF,iGAAiG;AACjG,yFAAyF;AACzF,iGAAiG;AACjG,+FAA+F;AAC/F,8FAA8F;AAC9F,wFAAwF;AACxF,EAAE;AACF,gGAAgG;AAChG,
|
|
1
|
+
{"version":3,"file":"discoverability.js","sourceRoot":"","sources":["../../src/os/discoverability.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,EAAE;AACF,8FAA8F;AAC9F,wFAAwF;AACxF,iGAAiG;AACjG,6FAA6F;AAC7F,EAAE;AACF,iGAAiG;AACjG,yFAAyF;AACzF,iGAAiG;AACjG,+FAA+F;AAC/F,8FAA8F;AAC9F,wFAAwF;AACxF,EAAE;AACF,kGAAkG;AAClG,oFAAoF;AACpF,EAAE;AACF,kGAAkG;AAClG,gGAAgG;AAChG,iGAAiG;AACjG,6FAA6F;AAC7F,uBAAuB;AAEvB,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAA;AAoClF;;;;;GAKG;AACH,MAAM,UAAU,uBAAuB,CAAC,IAKvC;IACC,MAAM,QAAQ,GAAuB,EAAE,CAAA;IACvC,MAAM,WAAW,GAAuB,EAAE,CAAA;IAE1C,MAAM,OAAO,GAAG,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IAC9C,MAAM,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,qBAAqB,CAAC,IAAI,CAAC,KAAK,SAAS,CAAC,CAAA;IACxF,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC5B,QAAQ,CAAC,IAAI,CAAC;YACZ,MAAM,EAAE,iBAAiB;YACzB,MAAM,EACJ,8CAA8C,YAAY,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI;gBACzG,2EAA2E;gBAC3E,mDAAmD;SACtD,CAAC,CAAA;IACJ,CAAC;IAED,IAAI,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,CAAC;QACvC,WAAW,CAAC,IAAI,CAAC;YACf,MAAM,EAAE,mBAAmB;YAC3B,MAAM,EACJ,8CAA8C,UAAU,CAAC,cAAc,iBAAiB;gBACxF,yFAAyF;gBACzF,sFAAsF;gBACtF,mBAAmB;SACtB,CAAC,CAAA;IACJ,CAAC;IAED,IAAI,IAAI,CAAC,mBAAmB,KAAK,IAAI,EAAE,CAAC;QACtC,QAAQ,CAAC,IAAI,CAAC;YACZ,MAAM,EAAE,0BAA0B;YAClC,MAAM,EACJ,0FAA0F;gBAC1F,wFAAwF;gBACxF,0FAA0F;gBAC1F,sEAAsE;SACzE,CAAC,CAAA;IACJ,CAAC;IAED,OAAO,EAAE,YAAY,EAAE,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAA;AACvE,CAAC"}
|
package/dist/os/exports.d.ts
CHANGED
|
@@ -12,9 +12,36 @@ export declare const OS_EXPORTS: {
|
|
|
12
12
|
* account itself would hand over `revoke()` and the resource classes with it.
|
|
13
13
|
*/
|
|
14
14
|
readonly verifier: 'CatFactoryVerifier';
|
|
15
|
+
/**
|
|
16
|
+
* The handle a workspace turns one bound hook on and off by.
|
|
17
|
+
*
|
|
18
|
+
* Its own export for the same reason the verifier is: what the workspace persists here must
|
|
19
|
+
* carry the authority to disable ONE registration and nothing else. A session or an account
|
|
20
|
+
* handed over instead would carry a capability, a key broker and every other hook with it.
|
|
21
|
+
*/
|
|
22
|
+
readonly hookController: 'CatFactoryHookController';
|
|
15
23
|
};
|
|
16
24
|
/** A role in the object model, spelled as {@link OS_EXPORTS} keys it. */
|
|
17
25
|
export type OsExportRole = keyof typeof OS_EXPORTS;
|
|
26
|
+
/** What a deployment loses by not exporting one role: the whole OS door, or one capability of it. */
|
|
27
|
+
export type OsExportRequirement = 'install' | 'hooks';
|
|
28
|
+
/**
|
|
29
|
+
* What each role's absence actually costs, which is not the same answer for all of them.
|
|
30
|
+
*
|
|
31
|
+
* The four object-model roles are walked while a workspace installs this Gatekeeper, so a missing
|
|
32
|
+
* one is a workspace that never finishes installing. The hook controller is reached only when a
|
|
33
|
+
* session binds a hook, so a deployment without it installs, serves and answers exactly as before
|
|
34
|
+
* and loses pushes. Reporting the two as one number would do the damage this file's own health
|
|
35
|
+
* rule names in both directions at once: an operator told their Gatekeeper is undiscoverable when
|
|
36
|
+
* it is serving, or told nothing at all about a capability that will refuse.
|
|
37
|
+
*/
|
|
38
|
+
export declare const OS_EXPORT_REQUIREMENT: {
|
|
39
|
+
readonly vendor: 'install';
|
|
40
|
+
readonly account: 'install';
|
|
41
|
+
readonly resource: 'install';
|
|
42
|
+
readonly verifier: 'install';
|
|
43
|
+
readonly hookController: 'hooks';
|
|
44
|
+
};
|
|
18
45
|
/**
|
|
19
46
|
* Resolve one of this Worker's own exports, imbued with the props it should carry.
|
|
20
47
|
*
|
package/dist/os/exports.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["../../src/os/exports.ts"],"names":[],"mappings":"AAkBA,mFAAmF;AACnF,eAAO,MAAM,UAAU;IACrB,2FAA2F;qBACnF,kBAAkB;IAC1B,6FAA6F;sBACpF,mBAAmB;IAC5B,8EAA8E;uBACpE,oBAAoB;IAC9B;;;;OAIG;uBACO,oBAAoB;
|
|
1
|
+
{"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["../../src/os/exports.ts"],"names":[],"mappings":"AAkBA,mFAAmF;AACnF,eAAO,MAAM,UAAU;IACrB,2FAA2F;qBACnF,kBAAkB;IAC1B,6FAA6F;sBACpF,mBAAmB;IAC5B,8EAA8E;uBACpE,oBAAoB;IAC9B;;;;OAIG;uBACO,oBAAoB;IAC9B;;;;;;OAMG;6BACa,0BAA0B;CACD,CAAA;AAE3C,yEAAyE;AACzE,MAAM,MAAM,YAAY,GAAG,MAAM,OAAO,UAAU,CAAA;AAElD,qGAAqG;AACrG,MAAM,MAAM,mBAAmB,GAAG,SAAS,GAAG,OAAO,CAAA;AAErD;;;;;;;;;GASG;AACH,eAAO,MAAM,qBAAqB;qBACxB,SAAS;sBACR,SAAS;uBACR,SAAS;uBACT,SAAS;6BACH,OAAO;CACqC,CAAA;AAmB9D;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,OAAO,GAAG,CAAC,CAYzF;AAED,mFAAmF;AACnF,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,YAAY,EAAE,CAGjE"}
|
package/dist/os/exports.js
CHANGED
|
@@ -28,6 +28,31 @@ export const OS_EXPORTS = {
|
|
|
28
28
|
* account itself would hand over `revoke()` and the resource classes with it.
|
|
29
29
|
*/
|
|
30
30
|
verifier: 'CatFactoryVerifier',
|
|
31
|
+
/**
|
|
32
|
+
* The handle a workspace turns one bound hook on and off by.
|
|
33
|
+
*
|
|
34
|
+
* Its own export for the same reason the verifier is: what the workspace persists here must
|
|
35
|
+
* carry the authority to disable ONE registration and nothing else. A session or an account
|
|
36
|
+
* handed over instead would carry a capability, a key broker and every other hook with it.
|
|
37
|
+
*/
|
|
38
|
+
hookController: 'CatFactoryHookController',
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* What each role's absence actually costs, which is not the same answer for all of them.
|
|
42
|
+
*
|
|
43
|
+
* The four object-model roles are walked while a workspace installs this Gatekeeper, so a missing
|
|
44
|
+
* one is a workspace that never finishes installing. The hook controller is reached only when a
|
|
45
|
+
* session binds a hook, so a deployment without it installs, serves and answers exactly as before
|
|
46
|
+
* and loses pushes. Reporting the two as one number would do the damage this file's own health
|
|
47
|
+
* rule names in both directions at once: an operator told their Gatekeeper is undiscoverable when
|
|
48
|
+
* it is serving, or told nothing at all about a capability that will refuse.
|
|
49
|
+
*/
|
|
50
|
+
export const OS_EXPORT_REQUIREMENT = {
|
|
51
|
+
vendor: 'install',
|
|
52
|
+
account: 'install',
|
|
53
|
+
resource: 'install',
|
|
54
|
+
verifier: 'install',
|
|
55
|
+
hookController: 'hooks',
|
|
31
56
|
};
|
|
32
57
|
/**
|
|
33
58
|
* Read one factory out of a bag that may not be one.
|
package/dist/os/exports.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exports.js","sourceRoot":"","sources":["../../src/os/exports.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,EAAE;AACF,oFAAoF;AACpF,mGAAmG;AACnG,iGAAiG;AACjG,0FAA0F;AAC1F,+FAA+F;AAC/F,8EAA8E;AAC9E,EAAE;AACF,oGAAoG;AACpG,oGAAoG;AACpG,EAAE;AACF,6FAA6F;AAC7F,iGAAiG;AACjG,mFAAmF;AAEnF,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAE9C,mFAAmF;AACnF,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,2FAA2F;IAC3F,MAAM,EAAE,kBAAkB;IAC1B,6FAA6F;IAC7F,OAAO,EAAE,mBAAmB;IAC5B,8EAA8E;IAC9E,QAAQ,EAAE,oBAAoB;IAC9B;;;;OAIG;IACH,QAAQ,EAAE,oBAAoB;
|
|
1
|
+
{"version":3,"file":"exports.js","sourceRoot":"","sources":["../../src/os/exports.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5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AI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,MAAM,IAAI,eAAe,CACvB,gBAAgB,EAChB,+CAA+C,IAAI,oCAAoC;YACrF,6BAA6B,IAAI,uDAAuD;YACxF,yCAAyC,CAC5C,CAAA;IACH,CAAC;IACD,OAAO,OAAO,CAAC,EAAE,KAAK,EAAE,CAAM,CAAA;AAChC,CAAC;AAED,mFAAmF;AACnF,MAAM,UAAU,gBAAgB,CAAC,OAAgB;IAC/C,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAmB,CAAA;IACvD,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC,KAAK,SAAS,CAAC,CAAA;AACpF,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type GatekeeperEnv } from '../env.js';
|
|
2
|
+
import type { HookControllerProps } from './hooks.js';
|
|
3
|
+
import type { HookController } from './protocol.js';
|
|
4
|
+
export type { HookControllerProps } from './hooks.js';
|
|
5
|
+
/**
|
|
6
|
+
* Build the hook controller class a deployment exports.
|
|
7
|
+
*
|
|
8
|
+
* No policy argument, like the verifier: nothing here resolves a tier or compiles a grant. The
|
|
9
|
+
* tier a delivery is described at was resolved by the session that bound the hook and rides the
|
|
10
|
+
* props, because re-resolving it here would silently re-tier a live hook the day an operator edits
|
|
11
|
+
* the policy, with the workspace still believing it enabled the one it was shown.
|
|
12
|
+
*/
|
|
13
|
+
export declare function createGatekeeperHookController(): new (ctx: ExecutionContext<HookControllerProps>, env: GatekeeperEnv) => HookController;
|
|
14
|
+
//# sourceMappingURL=hook-controller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hook-controller.d.ts","sourceRoot":"","sources":["../../src/os/hook-controller.ts"],"names":[],"mappings":"AAeA,OAAO,EAAY,KAAK,aAAa,EAAE,MAAM,WAAW,CAAA;AACxD,OAAO,KAAK,EAAE,mBAAmB,EAAc,MAAM,YAAY,CAAA;AACjE,OAAO,KAAK,EAAE,cAAc,EAAqC,MAAM,eAAe,CAAA;AAEtF,YAAY,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAErD;;;;;;;GAOG;AACH,wBAAgB,8BAA8B,IAAI,KAChD,GAAG,EAAE,gBAAgB,CAAC,mBAAmB,CAAC,EAC1C,GAAG,EAAE,aAAa,KACf,cAAc,CAgClB"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// The handle a workspace turns one bound hook on and off by.
|
|
2
|
+
//
|
|
3
|
+
// It is a fifth named export for the same reason the verifier is a fourth: what the workspace has
|
|
4
|
+
// to hold is not what the workspace has to be able to DO. A controller carries no capability, no
|
|
5
|
+
// key and no session; it names one registration, and its two methods are the only two things
|
|
6
|
+
// anybody may do to that registration from outside. Handing over a session or an account instead
|
|
7
|
+
// would hand over everything they carry along with the ability to disable a hook.
|
|
8
|
+
//
|
|
9
|
+
// Its props ARE the registration's identity, which is what keeps this class stateless: the
|
|
10
|
+
// workspace persists the controller, so the id, the topic, the account and the tier ride back in
|
|
11
|
+
// on `enable` without this Gatekeeper keeping a table of hooks nobody has approved yet. That is
|
|
12
|
+
// also the contract's own instruction ("avoid storing any state until the hook is enabled") read
|
|
13
|
+
// literally rather than approximately.
|
|
14
|
+
import { WorkerEntrypoint } from 'cloudflare:workers';
|
|
15
|
+
import { stateFor } from '../env.js';
|
|
16
|
+
/**
|
|
17
|
+
* Build the hook controller class a deployment exports.
|
|
18
|
+
*
|
|
19
|
+
* No policy argument, like the verifier: nothing here resolves a tier or compiles a grant. The
|
|
20
|
+
* tier a delivery is described at was resolved by the session that bound the hook and rides the
|
|
21
|
+
* props, because re-resolving it here would silently re-tier a live hook the day an operator edits
|
|
22
|
+
* the policy, with the workspace still believing it enabled the one it was shown.
|
|
23
|
+
*/
|
|
24
|
+
export function createGatekeeperHookController() {
|
|
25
|
+
return class CatFactoryHookController extends WorkerEntrypoint {
|
|
26
|
+
/**
|
|
27
|
+
* The workspace approved the hook: record it, and hold the initiator it handed over.
|
|
28
|
+
*
|
|
29
|
+
* Re-enabling an already-enabled hook REPLACES the initiator, which the contract asks for, and
|
|
30
|
+
* the store keeps the counters this call zeroes (see `enableHook`): they are the
|
|
31
|
+
* registration's history rather than that stub's, so resetting them would erase the record of
|
|
32
|
+
* the deliveries a workspace missed at exactly the moment it is re-arming to stop missing them.
|
|
33
|
+
*/
|
|
34
|
+
async enable(initiator, target) {
|
|
35
|
+
const record = {
|
|
36
|
+
...this.ctx.props,
|
|
37
|
+
target,
|
|
38
|
+
enabledAt: Date.now(),
|
|
39
|
+
deliveries: 0,
|
|
40
|
+
missed: 0,
|
|
41
|
+
failures: 0,
|
|
42
|
+
lastDeliveryAt: null,
|
|
43
|
+
lastError: null,
|
|
44
|
+
};
|
|
45
|
+
await stateFor(this.env).enableHook(record, initiator);
|
|
46
|
+
}
|
|
47
|
+
/** The workspace withdrew the hook: the record and the live half both go, permanently. */
|
|
48
|
+
async disable() {
|
|
49
|
+
await stateFor(this.env).disableHook(this.ctx.props.hookId);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=hook-controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hook-controller.js","sourceRoot":"","sources":["../../src/os/hook-controller.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,EAAE;AACF,kGAAkG;AAClG,iGAAiG;AACjG,6FAA6F;AAC7F,iGAAiG;AACjG,kFAAkF;AAClF,EAAE;AACF,2FAA2F;AAC3F,iGAAiG;AACjG,gGAAgG;AAChG,iGAAiG;AACjG,uCAAuC;AAEvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EAAE,QAAQ,EAAsB,MAAM,WAAW,CAAA;AAMxD;;;;;;;GAOG;AACH,MAAM,UAAU,8BAA8B;IAI5C,OAAO,MAAM,wBAAyB,SAAQ,gBAG7C;QACC;;;;;;;WAOG;QACH,KAAK,CAAC,MAAM,CAAC,SAAwB,EAAE,MAA0B;YAC/D,MAAM,MAAM,GAAe;gBACzB,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK;gBACjB,MAAM;gBACN,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;gBACrB,UAAU,EAAE,CAAC;gBACb,MAAM,EAAE,CAAC;gBACT,QAAQ,EAAE,CAAC;gBACX,cAAc,EAAE,IAAI;gBACpB,SAAS,EAAE,IAAI;aAChB,CAAA;YACD,MAAM,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,UAAU,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;QACxD,CAAC;QAED,0FAA0F;QAC1F,KAAK,CAAC,OAAO;YACX,MAAM,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;QAC7D,CAAC;KACF,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import type { ApprovalCard, RunState } from '../state.js';
|
|
2
|
+
import type { HookDescription, HookInitiator, HookTargetMetadata, ObservationDescription } from './protocol.js';
|
|
3
|
+
/** What a workspace can be pushed. */
|
|
4
|
+
export type HookTopic = 'approval_card' | 'run_event';
|
|
5
|
+
/**
|
|
6
|
+
* The two topics, as an exhaustive `Record`, so a third one cannot be half-added.
|
|
7
|
+
*
|
|
8
|
+
* A topic is a delivery FAMILY this Gatekeeper already receives and projects, never a new
|
|
9
|
+
* subscription upstream: what the platform sends is decided by `enroll()`, and a hook that pushed
|
|
10
|
+
* something the webhook does not carry would be a promise no delivery could keep.
|
|
11
|
+
*/
|
|
12
|
+
export declare const HOOK_TOPICS: {
|
|
13
|
+
readonly approval_card: {
|
|
14
|
+
readonly sessionMethod: 'approvals_subscribe';
|
|
15
|
+
readonly callbackMethod: 'onApprovalCard';
|
|
16
|
+
readonly title: 'Push cat-factory approval cards as they are raised';
|
|
17
|
+
readonly description: string;
|
|
18
|
+
};
|
|
19
|
+
readonly run_event: {
|
|
20
|
+
readonly sessionMethod: 'runs_subscribe';
|
|
21
|
+
readonly callbackMethod: 'onRunEvent';
|
|
22
|
+
readonly title: 'Push cat-factory run lifecycle transitions';
|
|
23
|
+
readonly description: string;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
/** Every topic, for a caller that has to cover all of them. */
|
|
27
|
+
export declare const HOOK_TOPIC_NAMES: HookTopic[];
|
|
28
|
+
/** What a hook's controller is imbued with when a session binds it. */
|
|
29
|
+
export interface HookControllerProps {
|
|
30
|
+
hookId: string;
|
|
31
|
+
topic: HookTopic;
|
|
32
|
+
/** The account whose session bound it. A session reads back only its own account's hooks. */
|
|
33
|
+
accountId: string;
|
|
34
|
+
/** The policy tier that account resolved to, for the delivery's own description. */
|
|
35
|
+
tier: string;
|
|
36
|
+
/** The paired deployment, so the record can describe a delivery without resolving config. */
|
|
37
|
+
deployment: string;
|
|
38
|
+
}
|
|
39
|
+
/** One enabled hook, as it is stored. Written on `enable`, deleted on `disable`. */
|
|
40
|
+
export interface HookRecord extends HookControllerProps {
|
|
41
|
+
/** The workspace the hook was enabled from, and the gadget within it where there is one. */
|
|
42
|
+
target: HookTargetMetadata;
|
|
43
|
+
enabledAt: number;
|
|
44
|
+
/** Deliveries this hook has taken. */
|
|
45
|
+
deliveries: number;
|
|
46
|
+
/**
|
|
47
|
+
* Deliveries that found no live initiator, so nothing was pushed.
|
|
48
|
+
*
|
|
49
|
+
* The one number that must never be inferred from silence: it is what tells a workspace that
|
|
50
|
+
* its hook stopped receiving without anybody deciding it should.
|
|
51
|
+
*/
|
|
52
|
+
missed: number;
|
|
53
|
+
/** Deliveries the workspace's own side refused or failed. */
|
|
54
|
+
failures: number;
|
|
55
|
+
lastDeliveryAt: number | null;
|
|
56
|
+
/** The most recent failure, kept so a reader has something to act on beyond a count. */
|
|
57
|
+
lastError: string | null;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* What IDENTIFIES a registration in storage: the place its deliveries land.
|
|
61
|
+
*
|
|
62
|
+
* Not the hook id, which is the wrong key for the one lifecycle a workspace is documented to run.
|
|
63
|
+
* The live half of a registration cannot be stored, so a durable object evicted between two
|
|
64
|
+
* deliveries keeps the record and loses the stub, and the remedy is to bind again. A bind mints a
|
|
65
|
+
* FRESH hook id, so a hook-id-keyed row made every one of those cycles a new row: the dead
|
|
66
|
+
* registration stayed forever, never live, counting a `missed` against every delivery for the rest
|
|
67
|
+
* of the deployment's life, and no reader could tell it from a hook that had genuinely gone quiet.
|
|
68
|
+
*
|
|
69
|
+
* Keying on the target makes re-binding what it reads as: the same registration, re-armed. The row
|
|
70
|
+
* is replaced, its counters carry forward (the `missed` count is the evidence the workspace acted
|
|
71
|
+
* on, so re-arming must not erase it), and the set of rows stays bounded by the gadgets a
|
|
72
|
+
* workspace actually runs rather than by how many times one was re-armed.
|
|
73
|
+
*
|
|
74
|
+
* The account comes first and is never the caller's to assert, so no target a workspace names can
|
|
75
|
+
* collide with another account's row; the remaining parts are escaped so a separator inside one of
|
|
76
|
+
* them cannot make two different targets share a key.
|
|
77
|
+
*/
|
|
78
|
+
export declare function registrationKey(record: {
|
|
79
|
+
accountId: string;
|
|
80
|
+
topic: HookTopic;
|
|
81
|
+
target: HookTargetMetadata;
|
|
82
|
+
}): string;
|
|
83
|
+
/**
|
|
84
|
+
* One hook as a session reads it back, which is the record PLUS the fact it cannot store.
|
|
85
|
+
*
|
|
86
|
+
* `live` is computed at read time from whether the initiator is still held, never persisted: a
|
|
87
|
+
* stored flag would say "live" from before the eviction that made it false, which is the one
|
|
88
|
+
* reading that must not be available.
|
|
89
|
+
*/
|
|
90
|
+
export interface HookRegistration extends HookRecord {
|
|
91
|
+
live: boolean;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* What one fan-out did, summed over every push it made.
|
|
95
|
+
*
|
|
96
|
+
* It carries no topic: a change can produce payloads for more than one (a terminal run event
|
|
97
|
+
* settles the run's open cards as it records the transition), and one number per outcome across
|
|
98
|
+
* all of them is what a caller acts on. WHICH topics were dispatched is the receiver's to report,
|
|
99
|
+
* because it is knowable before any push is made.
|
|
100
|
+
*/
|
|
101
|
+
export interface HookDispatchReport {
|
|
102
|
+
delivered: number;
|
|
103
|
+
/** Registrations whose live half was lost, so nothing was pushed and the record counted it. */
|
|
104
|
+
stale: number;
|
|
105
|
+
failed: number;
|
|
106
|
+
}
|
|
107
|
+
/** What a topic pushes, as the callback receives it. */
|
|
108
|
+
export type HookPayload = {
|
|
109
|
+
topic: 'approval_card';
|
|
110
|
+
card: ApprovalCard;
|
|
111
|
+
} | {
|
|
112
|
+
topic: 'run_event';
|
|
113
|
+
state: RunState;
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* One thing a committed write left to push, named by its id rather than carried whole.
|
|
117
|
+
*
|
|
118
|
+
* The fan-out runs in the durable object and the write is reported out of it, so what crosses that
|
|
119
|
+
* boundary is a list of ids and the dispatcher reads each row back. Two reasons, and the second is
|
|
120
|
+
* the one that decides it. A `RunState` carries the run projection verbatim as an open record,
|
|
121
|
+
* which a Durable Object stub's serialization type will not carry (the same constraint
|
|
122
|
+
* `runs_watched()` annotates around), so a payload cannot make the trip. And re-reading is the
|
|
123
|
+
* more correct half anyway: a card that has been answered between the commit and the push is
|
|
124
|
+
* pushed as it now stands, rather than as the delivery left it.
|
|
125
|
+
*/
|
|
126
|
+
export type HookPushTarget = {
|
|
127
|
+
topic: 'approval_card';
|
|
128
|
+
cardId: string;
|
|
129
|
+
} | {
|
|
130
|
+
topic: 'run_event';
|
|
131
|
+
runId: string;
|
|
132
|
+
};
|
|
133
|
+
/** What the approver is asked when a workspace binds a hook. */
|
|
134
|
+
export declare function describeHook(topic: HookTopic, subject: {
|
|
135
|
+
accountId: string;
|
|
136
|
+
tier: string;
|
|
137
|
+
deployment: string;
|
|
138
|
+
}): HookDescription;
|
|
139
|
+
/**
|
|
140
|
+
* What the queue is asked before ONE delivery is pushed.
|
|
141
|
+
*
|
|
142
|
+
* A hook delivery is an observation and is authorized as one, which the contract asks for and
|
|
143
|
+
* which is also the only reading that holds: the bytes are a card the paired deployment raised,
|
|
144
|
+
* and that they arrived here over a webhook rather than over a read is an implementation detail of
|
|
145
|
+
* how they got here. The refusal path is what makes it matter: a workspace that has withdrawn a
|
|
146
|
+
* person's access can stop the push without this Gatekeeper having to be told.
|
|
147
|
+
*/
|
|
148
|
+
export declare function describeHookDelivery(payload: HookPayload, record: HookRecord): ObservationDescription;
|
|
149
|
+
/** The live half of a registration: the workspace's initiator, held past the call it arrived on. */
|
|
150
|
+
export type HookRegistry = Map<string, HookInitiator>;
|
|
151
|
+
/**
|
|
152
|
+
* Take a reference to a stub that outlives the call it arrived on.
|
|
153
|
+
*
|
|
154
|
+
* The same loan rule `holdQueue` documents, arriving on the other parameter the contract hands
|
|
155
|
+
* over: the runtime disposes a parameter stub when the method returns, and an initiator kept for
|
|
156
|
+
* the next delivery is used long after that. The optional call is the in-process case, where the
|
|
157
|
+
* "stub" is an ordinary object with nothing to duplicate.
|
|
158
|
+
*/
|
|
159
|
+
export declare function holdInitiator(initiator: HookInitiator): HookInitiator;
|
|
160
|
+
/** Give back a held reference. Paired with {@link holdInitiator} and kept beside it. */
|
|
161
|
+
export declare function releaseInitiator(initiator: HookInitiator): void;
|
|
162
|
+
/**
|
|
163
|
+
* What one push did, SEPARATE from the record it will be counted on.
|
|
164
|
+
*
|
|
165
|
+
* The split is the whole safety property of the fan-out. A push awaits a call into another Worker,
|
|
166
|
+
* which is not a storage operation, so the durable object's input gate is open across it and the
|
|
167
|
+
* record read before the push is a snapshot that may be stale by the time it resolves: a
|
|
168
|
+
* concurrent `disable` may have removed the registration, and a concurrent delivery may have moved
|
|
169
|
+
* the very counters this one is about to bump. Reporting the outcome and folding it onto whatever
|
|
170
|
+
* is stored AFTERWARDS is what keeps both of those true, where writing back a modified snapshot
|
|
171
|
+
* resurrected the withdrawn registration and lost the sibling's increments.
|
|
172
|
+
*/
|
|
173
|
+
export type HookPushOutcome = {
|
|
174
|
+
outcome: 'delivered';
|
|
175
|
+
}
|
|
176
|
+
/** The registration's live half was lost, so there was nothing to push through. */
|
|
177
|
+
| {
|
|
178
|
+
outcome: 'stale';
|
|
179
|
+
} | {
|
|
180
|
+
outcome: 'failed';
|
|
181
|
+
error: string;
|
|
182
|
+
};
|
|
183
|
+
/**
|
|
184
|
+
* Push one payload to one enabled hook, and report what that did.
|
|
185
|
+
*
|
|
186
|
+
* Every outcome is a REPORT rather than a throw, because the caller is a fan-out on behalf of a
|
|
187
|
+
* delivery whose record has already committed: a workspace that refuses, breaks or hangs costs a
|
|
188
|
+
* notification, and must never cost the acknowledgement the platform's retry is protecting.
|
|
189
|
+
*/
|
|
190
|
+
export declare function pushToHook(payload: HookPayload, record: HookRecord, initiator: HookInitiator | undefined): Promise<HookPushOutcome>;
|
|
191
|
+
/**
|
|
192
|
+
* Fold one push's outcome onto the record as it stands NOW.
|
|
193
|
+
*
|
|
194
|
+
* Pure, and takes the current record rather than the one the push was described from, so a caller
|
|
195
|
+
* can re-read between the two. `lastError` is cleared by a delivery on purpose: it is what a
|
|
196
|
+
* reader acts on beside `failures`, and a stale one beside a hook that has since recovered points
|
|
197
|
+
* at a fix nobody needs to make.
|
|
198
|
+
*/
|
|
199
|
+
export declare function applyPushOutcome(record: HookRecord, result: HookPushOutcome, now: number): HookRecord;
|
|
200
|
+
//# sourceMappingURL=hooks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/os/hooks.ts"],"names":[],"mappings":"AAsCA,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAGzD,OAAO,KAAK,EACV,eAAe,EACf,aAAa,EACb,kBAAkB,EAClB,sBAAsB,EACvB,MAAM,eAAe,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