@atcn/core 1.3.2 → 1.4.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.
@@ -1,5 +1,10 @@
1
- import type { ObligationTerms, RecordedEvent } from "@atcn/schema";
1
+ import { type DeclaredExecution, type ObligationTerms, type RecordedEvent } from "@atcn/schema";
2
2
  import { type EvidenceInput } from "./clearing.js";
3
+ /**
4
+ * Runs the counterparty declared in its signed obligation.started events. A descriptor naming another agent is
5
+ * ignored. The digest covers the descriptor exactly as signed.
6
+ */
7
+ export declare function declaredExecutions(events: RecordedEvent[], counterpartyAgentId: string | null): DeclaredExecution[];
3
8
  /**
4
9
  * Builds clearing evidence inputs from an obligation's recorded events. Used by both
5
10
  * the hosted service and the offline verifier so both see the same evidence set.
package/dist/evidence.js CHANGED
@@ -1,4 +1,19 @@
1
+ import { digestOf, ExecutionDescriptorSchema } from "@atcn/schema";
1
2
  import { producerRole } from "./clearing.js";
3
+ /**
4
+ * Runs the counterparty declared in its signed obligation.started events. A descriptor naming another agent is
5
+ * ignored. The digest covers the descriptor exactly as signed.
6
+ */
7
+ export function declaredExecutions(events, counterpartyAgentId) {
8
+ return events
9
+ .filter((e) => e.payload.event_type === "obligation.started" && e.payload.actor_id === counterpartyAgentId)
10
+ .flatMap((e) => {
11
+ const parsed = ExecutionDescriptorSchema.safeParse(e.payload.data.execution);
12
+ if (!parsed.success || parsed.data.agent.agent_id !== e.payload.actor_id)
13
+ return [];
14
+ return [{ execution_id: parsed.data.execution_id, execution_digest: digestOf(e.payload.data.execution), started_event_id: e.payload.event_id, descriptor: parsed.data }];
15
+ });
16
+ }
2
17
  /**
3
18
  * Builds clearing evidence inputs from an obligation's recorded events. Used by both
4
19
  * the hosted service and the offline verifier so both see the same evidence set.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atcn/core",
3
- "version": "1.3.2",
3
+ "version": "1.4.0",
4
4
  "description": "Deterministic ATCN logic: delegation bounds, clearing policy evaluation, allocation, journal balance, closure-package verification",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -32,6 +32,6 @@
32
32
  "build": "tsc -p tsconfig.build.json"
33
33
  },
34
34
  "dependencies": {
35
- "@atcn/schema": "1.3.2"
35
+ "@atcn/schema": "1.4.0"
36
36
  }
37
37
  }