@amalgm/automations 0.2.5 → 0.2.6

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/AXIOMS.md CHANGED
@@ -25,10 +25,11 @@
25
25
  permanent run history. A definition edit or deletion never rewrites prior
26
26
  runs.
27
27
  10. A webhook URL is a rotatable bearer capability for exactly one trigger.
28
- Possession plus any configured provider proof admits that trigger; source
29
- and event labels never form a second routing gate. Its random locator is not
30
- sufficient without the hosted service's HMAC, and caller input never
31
- supplies an owner or target.
28
+ It resolves the owner and target; the trigger's declared source and event
29
+ decide whether an authenticated delivery is one of its occurrences and
30
+ never route to a different trigger. Its random locator is not sufficient
31
+ without the hosted service's HMAC, and caller input never supplies an owner
32
+ or target.
32
33
  11. Optional provider signing secrets are persisted but write-only: normal
33
34
  reads reveal only that a secret is configured.
34
35
  12. Run history is read-only in the control plane and always scoped to its
package/PURPOSE.md CHANGED
@@ -49,10 +49,11 @@ trigger owns one opaque URL under `automations.amalgm.ai`; the URL resolves the
49
49
  trigger, owner, and target, so a caller never supplies routing identity. The
50
50
  adapter bounds and parses the body, optionally verifies the provider's signing
51
51
  secret, deduplicates explicit provider delivery ids, and returns only after the
52
- run has been stored in Supabase. Provider source and event labels describe the
53
- occurrence; they are not a second routing gate after the URL has selected the
54
- trigger. The signed URL can be rotated without changing the automation, and its
55
- usable bearer token cannot be reconstructed from the database alone.
52
+ run has been stored in Supabase. The URL selects one trigger; that trigger's
53
+ declared source and event then decide whether the authenticated delivery is an
54
+ occurrence. They never select an owner, target, or different trigger. The signed
55
+ URL can be rotated without changing the automation, and its usable bearer token
56
+ cannot be reconstructed from the database alone.
56
57
 
57
58
  Amalgm supplies a resolved authenticated principal from its user session or
58
59
  HMAC-refresh flow; future API keys resolve to the same principal capability.
package/README.md CHANGED
@@ -99,8 +99,9 @@ Public webhook admission uses the URL returned on each webhook trigger:
99
99
  POST https://automations.amalgm.ai/e/<opaque-capability>
100
100
  ```
101
101
 
102
- That URL selects the exact trigger. Provider source and event labels are
103
- recorded as occurrence metadata, not used as another routing condition.
102
+ That URL selects the exact trigger and its owner/target. The trigger's declared
103
+ provider source and event decide whether the authenticated delivery is one of
104
+ its occurrences; a GitHub `ping` therefore cannot fire a `push` trigger.
104
105
  `Idempotency-Key` and common provider delivery-id headers deduplicate retries
105
106
  against the same trigger. The caller never supplies a user or target id.
106
107
 
@@ -34,6 +34,9 @@ export class Automations {
34
34
  ? { primary: { source: input.source, event: input.event } }
35
35
  : eventReferences(input.headers, input.payload);
36
36
  const reference = references.primary;
37
+ if (!matches(reference.source, trigger.source) || !matches(reference.event, trigger.event)) {
38
+ return { run: null, ...reference };
39
+ }
37
40
  const now = input.now || new Date();
38
41
  const runInput = { kind: 'event', ...reference, payload: input.payload };
39
42
  const run = await this.store.enqueueEvent(trigger, runInput, now, input.deliveryKey);
@@ -77,6 +80,9 @@ export class Automations {
77
80
  }
78
81
  }
79
82
  }
83
+ function matches(actual, configured) {
84
+ return configured === '*' || configured === actual;
85
+ }
80
86
  function assertJson(value, label) {
81
87
  if (value === null || typeof value === 'string' || typeof value === 'boolean')
82
88
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amalgm/automations",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
4
4
  "description": "Amalgm's automation SDK: durable trigger admission and target-machine execution.",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {