@sonordev/contracts 2.27.0 → 2.29.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/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.29.0
4
+
5
+ - Preserve native concurrency timestamps, including numeric timezone offsets and all six fractional digits, in both delegated claim and original policy recovery requests.
6
+ - Add an original preparation lookup contract for inspecting a saved request without starting or resuming its work.
7
+ - Add explicit unpublished-preparation retirement request and receipt contracts, preserving bounded retained and unrecorded inventory.
8
+ - Add bounded Google campaign diagnostic reports with separate section coverage, nullable metrics and untrusted provider text.
9
+ - Add explicit diagnostics request and original action payload parsers, with complete ad group criterion identity for keyword text.
10
+ - Add the `delegated-command` entry with bounded owner-controlled execution policies, safe capability observations, four named Resonance effect families and truthful native agent attribution.
11
+
12
+ ## 2.28.0
13
+
14
+ - Add an optional signed reporting deadline for late attribution reads after a campaign's original flight. The server derives the deadline from approved attribution while finance and write authority keep their existing expiry.
15
+ - Add a standing operating policy to Resonance's existing mandate. The policy names the agent and verified principal, and limits Google Search changes to specific reviewed targeting and ad copy.
16
+ - Add the Google Search content update selector and command profile. Preparation names one existing ad. The command carries its exact approved text changes, current policy receipt and prior content fingerprint.
17
+ - Key an operating policy approval to the accepted campaign and its exact predecessor receipt so that returning to earlier terms requires a fresh approval.
18
+
3
19
  ## 2.27.0
4
20
 
5
21
  - Add the `booking-intake` entry: what a booking may ask a guest about their business. A booking type's step is `off`, `optional` or `required` (`parseBookingBusinessStep` reads anything unknown as `off`), and `checkBookingBusinessAnswers` is the one check the booking widget, the app's booking page and the API all run, with the guest-facing words in `BOOKING_BUSINESS_ERROR_TEXT`. `normalizeBookingCompany` removes control and format characters (bidi overrides, zero-width marks) and lone surrogates and never truncates; `normalizeGuestWebsite` returns a public `http` or `https` address with no query, fragment, port or credentials, keeps the path, and refuses IP addresses, the literal local names `localhost`, `.local` and `.internal`, and other schemes (it runs no DNS, so anything that fetches the address must check it itself, and the `url` must be HTML-escaped wherever it's rendered). A required company is refused for every source except `portal` with `verifiedMember: true`, which the API sets from its authenticated context and never from the request body; a missing or unknown source is held to the answers. `bookingBusinessDetails` is the one reader for the answers on every surface a host sees, and `BOOKING_INTAKE_JSON_SCHEMA` describes the three wire fields for an agent. The browser-safe part is its own module so the widget doesn't bundle the schema or the reader. `stripWww` moved into the `sites` leaf module and is still exported from `sites`.
package/README.md CHANGED
@@ -1480,6 +1480,169 @@ doesn't replace those authority checks.
1480
1480
 
1481
1481
  `@sonordev/contracts/resonance-constants` exports `RESONANCE_SUBJECT_HEADER`, `RESONANCE_SOURCE_MARKER_PARAMETER` and `RESONANCE_ATTRIBUTION_MODEL` without loading campaign schemas. The main Resonance entry re-exports these same literals. Browser adapters can use the constants entry when they don't need a parser.
1482
1482
 
1483
+ Use `parseResonancePreparationLookupRequest` and
1484
+ `parseResonancePreparationLookupResponse` for an original preparation read.
1485
+ The closed selector carries the saved `expectedRevision` and
1486
+ `idempotencyKey`. It rejects additional preparation input. The response keeps
1487
+ confirmed absence, current work, required recovery and terminal outcomes
1488
+ distinct. A completed plan must match the original request and operation.
1489
+ A recovery hint describes the observed state. The owner still checks authority
1490
+ before resuming through the existing preparation path.
1491
+
1492
+ `parseResonancePreparationRetireRequest` reads the explicit cancellation input
1493
+ `{ expectedRevision, reason: 'retain_unpublished_artifacts' }`.
1494
+ `parseResonancePreparationRetireResponse` reads the original cancellation
1495
+ receipt and separates retained artifacts from unrecorded slots. Their total
1496
+ is bounded to 512. The native owner verifies eligibility and preserves those
1497
+ artifacts through its compare-and-set operation. A lookup never retires work.
1498
+
1499
+ ### Interactive Google campaign diagnostics
1500
+
1501
+ `parseResonanceGoogleCampaignDiagnosticsRequest` reads the exact HTTP body:
1502
+ `{ channelId, startDate, endDate, sections, directive }`. The directive must
1503
+ contain text, the dates span one to 31 calendar days, and sections are a
1504
+ nonempty unique selection from `RESONANCE_GOOGLE_DIAGNOSTICS_SECTIONS`.
1505
+ The native owner checks that the dates are completed days in the account's
1506
+ timezone. `parseResonanceGoogleCampaignDiagnosticsPayload` reads the stored
1507
+ business payload, adding `schemaVersion: 1`, `campaignId`, `expectedRevision`,
1508
+ `accountBindingId`, `site` and `idempotencyKey`. Native admission checks these
1509
+ values against the original action. Callers cannot supply an execution deadline
1510
+ or authorization proof through either shape.
1511
+
1512
+ `parseResonanceGoogleCampaignDiagnosticsReport` validates a bounded report
1513
+ for one owned campaign and channel over up to 31 completed advertiser-local
1514
+ days. Campaign configuration, totals, daily metrics, keywords, disclosed search
1515
+ terms, conversion goals and upload diagnostics have separate section states.
1516
+ Unavailable values stay null. Spend uses integer micros strings, while
1517
+ provider-attributed conversions retain decimal strings.
1518
+
1519
+ Provider-authored text travels under `providerAuthored`, keyed to the rows
1520
+ it describes. Keyword text uses the complete `adGroupId` and `criterionId`
1521
+ pair. Treat it as untrusted data when displaying it to an agent.
1522
+ Search-term coverage can include an integer remainder only when compatible
1523
+ campaign totals and all disclosed rows are available. Conversion remainders
1524
+ stay null.
1525
+
1526
+ The API authorizes a one-off read from the current delegated session and the
1527
+ submitted directive, with explicit sections, scope and deadline. The report
1528
+ parser validates data shape. It supplies no read authority. The ordinary
1529
+ daily reporting grant keeps its existing scope.
1530
+
1531
+ ### Direct commands under delegated authority
1532
+
1533
+ `@sonordev/contracts/delegated-command` defines the owner-controlled
1534
+ `AgentExecutionPolicy`, its compare-and-set update, a safe authority summary
1535
+ and native delegation attribution. It initially covers four named families:
1536
+ `resonance.mandate`, `resonance.operating_policy`, `resonance.optimize` and
1537
+ `resonance.diagnostics`. Other existing actions keep their native controls.
1538
+ `delegatedCommandFamilyForAction` classifies these families from the stored
1539
+ kind and payload. Unknown actions return null. Classification isn't admission.
1540
+
1541
+ `parseAgentExecutionPolicy` reads explicit project, account binding and site
1542
+ lists, campaign selection, named families, validity, campaign and outstanding spend
1543
+ ceilings, currency, change limits, flight limits and a maximum operation count.
1544
+ The campaign selection is `{ mode: 'selected', campaignIds: uuid[] }` or
1545
+ `{ mode: 'all_in_projects' }`. Selected empty IDs grant nothing. The explicit
1546
+ `all_in_projects` branch includes current and future campaigns within the
1547
+ selected projects, sites and accounts. Owners can choose this preset once
1548
+ without selecting each new campaign. All target dimensions intersect, and
1549
+ empty project, site or account lists grant nothing. Native checks
1550
+ must cover every affected target and intersect the policy with current
1551
+ membership, accepted limits, campaign state and kill controls.
1552
+
1553
+ `parseAgentExecutionPolicyUpdate` reads `{ expectedRevision, policy }`.
1554
+ Revision zero means no saved policy. A null policy requests revocation.
1555
+ Only an authenticated native owner control can save this update. Existing
1556
+ tokens without a policy gain no new direct authority.
1557
+
1558
+ `parseDelegatedCommandAuthoritySummary` reads a native observation with the
1559
+ actual agent, its human principal, policy state and revision, and one capability
1560
+ for each family. Each capability reports `direct`, `propose_only` or
1561
+ `unavailable`, closed reasons and its effective limits. Operation usage is
1562
+ counted once per original action and effect key over the policy revision's
1563
+ lifetime. Uncertain work keeps its reservation. Policy rotation doesn't erase
1564
+ existing financial exposure. The native owner rechecks live authority before
1565
+ claiming and before each effect or provider request.
1566
+
1567
+ `parseDelegatedCommandApproval` reads the native stored attribution:
1568
+ `{ by, via: 'mcp', at, basis: 'delegated_agent', delegation }`. Here `by` is
1569
+ the actual agent. The delegation reference contains `schemaVersion: 1`,
1570
+ `tokenId`, `policyRevision`, `ledgerActionId` and `payloadDigest`. A native
1571
+ immutable admission must bind that reference to the full original action,
1572
+ authenticated identities, complete target set and effect key. A parser-valid
1573
+ reference supplied by a caller grants no authority. Keep it private.
1574
+
1575
+ An explicitly requested command within current delegated authority can execute
1576
+ without another per-action human confirmation. The receipt records the agent's
1577
+ action on behalf of its principal. It doesn't invent a human reviewer or grant
1578
+ unattended execution. These parsers define transport shapes. Native admission,
1579
+ atomic reservations, revocation and effect checks remain required.
1580
+
1581
+ The native claim route is `DELEGATED_COMMAND_CLAIM_ROUTE`:
1582
+ `/agents/me/execution-actions/:ledgerId/claim`. Its POST body is read by
1583
+ `parseDelegatedCommandClaimRequest`: `{ projectId, expectedUpdatedAt,
1584
+ expectedPolicyRevision }`. `parseNativeCasTimestamp` is shared with the
1585
+ recovery request and exported from both `resonance` and `delegated-command`.
1586
+ It accepts strict RFC3339 UTC or numeric-offset timestamps with up to six
1587
+ fractional digits and returns the exact input. Forward the original database
1588
+ `updated_at` unchanged. Converting it through `Date.toISOString()` would lose
1589
+ microseconds. Ordinary authority observation instants keep their UTC format.
1590
+
1591
+ `parseDelegatedCommandAdmission` reads the native admission observation,
1592
+ including all affected channel and account binding IDs and sites. Its proof
1593
+ reference must match its original action, token, policy revision and digest.
1594
+ `parseDelegatedCommandClaimResponse(value, parseNativeAction)` reads
1595
+ `{ action, admission, replayed }` using the supplied native Ledger row parser.
1596
+ Only the POST winner with explicit `replayed: false` may enter execution.
1597
+ Read-only GET and replay responses never dispatch. Admission may be null for
1598
+ an unadmitted original read. A lost claim reply requires that original read,
1599
+ without redispatching the effect. The native owner must bind the action row
1600
+ and admission to the current authenticated request.
1601
+
1602
+ The separate `RESONANCE_OPERATING_POLICY_RECOVERY_ROUTE` identifies recovery
1603
+ of an original failed policy action whose human review is preserved.
1604
+ `parseResonanceOperatingPolicyRecoveryRequest` reads only
1605
+ `{ expectedUpdatedAt }`. Current token, original revision and policy authority
1606
+ come from the native authenticated request. Its admission uses
1607
+ `basis: 'human_review_recovery'` and `originalReview: { reviewerContactId,
1608
+ reviewedAt, approvalDigest }`, binding the unchanged original human approval.
1609
+ An agent recovery has `executorKind: 'agent'` and retains its exact token,
1610
+ policy revision and proof reference. An actual human owner recovery has
1611
+ `executorKind: 'human'`, equal actor and principal, and null token, policy
1612
+ revision and proof. Native authenticated identity selects this branch.
1613
+ Recovery requires native proof
1614
+ of non-effect and the current predecessor. It uses the same response envelope
1615
+ and winner-only dispatch rule, without turning the original review into a new
1616
+ agent approval. Fresh OrgAgents claims remain separate from this recovery.
1617
+
1618
+ ### Standing Google Search content policy
1619
+
1620
+ A Resonance mandate can include an `operatingPolicy` naming its agent and
1621
+ verified human principal. Use `parseResonanceOperatingPolicySelection` for
1622
+ draft input and `parseResonanceOperatingPolicy` for the resolved policy.
1623
+ Each entry names an existing channel, ad group and ad. It carries up to 20
1624
+ owned phrase negatives to remove, up to 20 exact keywords to add, and an
1625
+ optional full set of RSA headlines and descriptions with their creative
1626
+ reference. The policy sets a cooldown that applies to these changes.
1627
+
1628
+ Pass `googleContentUpdate` with the target keys to prepare an update. The
1629
+ prepared command adds the exact bounded change, operating policy receipt and
1630
+ prior content fingerprint. Targeting terms are normalized and sorted for
1631
+ canonical identity. Headline and description order is preserved. Sonor
1632
+ checks current authority, scope, cooldown and provider state at dispatch.
1633
+
1634
+ An operating policy activation uses the existing mandate approval. Its
1635
+ `operatingPolicyBase` binds the accepted campaign and the previous policy
1636
+ receipt. The first activation uses a null predecessor. An absent
1637
+ `operatingPolicy` preserves the original mandate's wire shape.
1638
+
1639
+ For operating policy filing and recovery, hash the exact UTF-8 output of
1640
+ `resonanceOperatingPolicyActionDigestInput({ mandateDigest, operatingPolicyBase })`
1641
+ with SHA-256 and use its lowercase hex digest. The same approved terms and base
1642
+ produce the same action key. Repeating those terms after a different policy
1643
+ receipt produces a new key. Legacy mandate lookup and policy receipts still use
1644
+ the original mandate digest.
1645
+
1483
1646
  ### Delivering a qualified Google conversion
1484
1647
 
1485
1648
  The existing `ResonanceCommand` union adds `operation: 'deliver_conversion'`. It requires the usual schema version, campaign, prepared plan, review digest, expected revision, idempotency key and mandate reference, plus `channelIds` with exactly one original Google channel and `conversionId` for the persisted canonical qualified fact. The command carries no click identifiers, personal data, provider payload, values, timestamps, native destination or approval flags.
@@ -1707,7 +1870,9 @@ Pagination follows native-row UUID order, with at most 100 native rows and 500 e
1707
1870
 
1708
1871
  The existing mandate draft request accepts optional `providerReporting: {agentContactId, channelIds}`. This closed selector contains only the selected invited agent and explicit channels. It rejects purpose, organization, project, principal and approval fields. Absence stays omitted; null and the superseded Selection-suffix field are invalid. The server must derive the actual organization, project and current invited-agent acts-for principal, never a default agent or the reviewer identity.
1709
1872
 
1710
- The resolved original mandate has optional `providerReporting: {purpose: 'provider_reporting_refresh', orgId, projectId, agentContactId, principalContactId, channelIds}`. All six fields are required when present. Channels are a unique nonempty UUID list, maximum 100; agent and human principal remain distinct. The grant project must equal the parent mandate project. The original mandate, review payload and canonical digest include the exact resolved binding. No field is backfilled into old mandates and their absent-field digest bytes stay unchanged.
1873
+ The resolved original mandate has optional `providerReporting: {purpose: 'provider_reporting_refresh', orgId, projectId, agentContactId, principalContactId, channelIds}`. All six binding fields are required when present. Channels are a unique nonempty UUID list with a maximum of 100. The agent and human principal remain distinct. The grant project must equal the parent mandate project. The original mandate, review payload and canonical digest include the exact resolved binding. Omitted fields stay out of the digest for older mandates.
1874
+
1875
+ The server can add a signed `reportingUntil` UTC deadline to the resolved grant. It derives the deadline from the original flight end, the approved attribution window and two elapsed days for provider processing, with a maximum of 92 elapsed days after the flight. Reads stop at the deadline. The mandate's finance expiry still applies to spend and provider changes. Grants without a deadline keep their original reporting expiry.
1711
1876
 
1712
1877
  `ResonanceProviderReportingSelection` and `ResonanceProviderReportingGrant` have separate parser/schema exports. Existing mandate request/scope/approval parsers remain the entry points. Passing the actual prepared plan as the optional second argument to `parseResonanceMandateScope` also checks original plan/review/goal/flight identity and the selected paid channels within mandate sites/accounts and expiry. A public prepared plan has no organization field: exact parent organization equality and real current identities must be established by the protected native owner, not inferred from a project string or parser result.
1713
1878
 
@@ -0,0 +1,271 @@
1
+ /** Pure delegation wire contracts. Parsed data never proves live execution authority. */
2
+ import { type Value } from './wire-schema';
3
+ export { parseNativeCasTimestamp, NATIVE_CAS_TIMESTAMP_JSON_SCHEMA, NativeCasTimestampValidationError } from './wire-native-cas';
4
+ export declare class DelegatedCommandValidationError extends Error {
5
+ readonly path: string;
6
+ constructor(path: string, reason: string);
7
+ }
8
+ export declare const DELEGATED_COMMAND_FAMILIES: readonly ['resonance.mandate', 'resonance.operating_policy', 'resonance.optimize', 'resonance.diagnostics'];
9
+ export type DelegatedCommandFamily = typeof DELEGATED_COMMAND_FAMILIES[number];
10
+ export declare const DELEGATED_COMMAND_REASON_CODES: readonly ['POLICY_MISSING', 'POLICY_DISABLED', 'POLICY_NOT_YET_VALID', 'POLICY_EXPIRED', 'POLICY_REVOKED', 'POLICY_REVISION_CHANGED', 'TOKEN_REVOKED', 'ACTOR_INACTIVE', 'PRINCIPAL_INACTIVE', 'MEMBERSHIP_REQUIRED', 'SCOPE_MISMATCH', 'FAMILY_NOT_GRANTED', 'NATIVE_AUTHORITY_REQUIRED', 'STATE_CONFLICT', 'KILL_ACTIVE', 'CURRENCY_MISMATCH', 'CAMPAIGN_CEILING_EXCEEDED', 'OUTSTANDING_CEILING_EXCEEDED', 'CHANGE_LIMIT_EXCEEDED', 'FLIGHT_LIMIT_EXCEEDED', 'OPERATION_LIMIT_EXCEEDED', 'ACTION_DIGEST_MISMATCH', 'UNKNOWN_ACTION_KIND'];
11
+ export type DelegatedCommandReasonCode = typeof DELEGATED_COMMAND_REASON_CODES[number];
12
+ declare const executionPolicy: import("./wire-schema").Field<{
13
+ projects: string[];
14
+ campaignScope: ({
15
+ mode: "selected";
16
+ campaignIds: string[];
17
+ } & {}) | ({
18
+ mode: "all_in_projects";
19
+ } & {});
20
+ accountBindingIds: string[];
21
+ sites: string[];
22
+ schemaVersion: 1;
23
+ enabled: boolean;
24
+ actionFamilies: ("resonance.diagnostics" | "resonance.mandate" | "resonance.operating_policy" | "resonance.optimize")[];
25
+ notBefore: string;
26
+ expiresAt: string;
27
+ financialLimits: {
28
+ currency: "AED" | "AFN" | "ALL" | "AMD" | "ANG" | "AOA" | "ARS" | "AUD" | "AWG" | "AZN" | "BAM" | "BBD" | "BDT" | "BGN" | "BHD" | "BIF" | "BMD" | "BND" | "BOB" | "BRL" | "BSD" | "BTN" | "BWP" | "BYN" | "BZD" | "CAD" | "CDF" | "CHF" | "CLP" | "CNY" | "COP" | "CRC" | "CUC" | "CUP" | "CVE" | "CZK" | "DJF" | "DKK" | "DOP" | "DZD" | "EGP" | "ERN" | "ETB" | "EUR" | "FJD" | "FKP" | "GBP" | "GEL" | "GHS" | "GIP" | "GMD" | "GNF" | "GTQ" | "GYD" | "HKD" | "HNL" | "HRK" | "HTG" | "HUF" | "IDR" | "ILS" | "INR" | "IQD" | "IRR" | "ISK" | "JMD" | "JOD" | "JPY" | "KES" | "KGS" | "KHR" | "KMF" | "KPW" | "KRW" | "KWD" | "KYD" | "KZT" | "LAK" | "LBP" | "LKR" | "LRD" | "LSL" | "LYD" | "MAD" | "MDL" | "MGA" | "MKD" | "MMK" | "MNT" | "MOP" | "MRU" | "MUR" | "MVR" | "MWK" | "MXN" | "MYR" | "MZN" | "NAD" | "NGN" | "NIO" | "NOK" | "NPR" | "NZD" | "OMR" | "PAB" | "PEN" | "PGK" | "PHP" | "PKR" | "PLN" | "PYG" | "QAR" | "RON" | "RSD" | "RUB" | "RWF" | "SAR" | "SBD" | "SCR" | "SDG" | "SEK" | "SGD" | "SHP" | "SLE" | "SLL" | "SOS" | "SRD" | "SSP" | "STN" | "SVC" | "SYP" | "SZL" | "THB" | "TJS" | "TMT" | "TND" | "TOP" | "TRY" | "TTD" | "TWD" | "TZS" | "UAH" | "UGX" | "USD" | "UYU" | "UZS" | "VES" | "VND" | "VUV" | "WST" | "XAF" | "XCD" | "XCG" | "XDR" | "XOF" | "XPF" | "XSU" | "YER" | "ZAR" | "ZMW" | "ZWG" | "ZWL";
29
+ maxCampaignBudgetMicros: string;
30
+ maxOutstandingMicros: string;
31
+ maxChangeBasisPoints: number;
32
+ } & {};
33
+ maxOperations: number;
34
+ maxFlightDays: number;
35
+ } & {}>;
36
+ export type AgentExecutionPolicy = Value<typeof executionPolicy>;
37
+ /** Owner-controlled policy. Empty scope arrays grant nothing; every dimension intersects. */
38
+ export declare const parseAgentExecutionPolicy: (v: unknown) => AgentExecutionPolicy;
39
+ export declare const AGENT_EXECUTION_POLICY_JSON_SCHEMA: import("./wire-schema").JsonSchema;
40
+ declare const policyUpdate: import("./wire-schema").Field<{
41
+ expectedRevision: number;
42
+ policy: ({
43
+ projects: string[];
44
+ campaignScope: ({
45
+ mode: "selected";
46
+ campaignIds: string[];
47
+ } & {}) | ({
48
+ mode: "all_in_projects";
49
+ } & {});
50
+ accountBindingIds: string[];
51
+ sites: string[];
52
+ schemaVersion: 1;
53
+ enabled: boolean;
54
+ actionFamilies: ("resonance.diagnostics" | "resonance.mandate" | "resonance.operating_policy" | "resonance.optimize")[];
55
+ notBefore: string;
56
+ expiresAt: string;
57
+ financialLimits: {
58
+ currency: "AED" | "AFN" | "ALL" | "AMD" | "ANG" | "AOA" | "ARS" | "AUD" | "AWG" | "AZN" | "BAM" | "BBD" | "BDT" | "BGN" | "BHD" | "BIF" | "BMD" | "BND" | "BOB" | "BRL" | "BSD" | "BTN" | "BWP" | "BYN" | "BZD" | "CAD" | "CDF" | "CHF" | "CLP" | "CNY" | "COP" | "CRC" | "CUC" | "CUP" | "CVE" | "CZK" | "DJF" | "DKK" | "DOP" | "DZD" | "EGP" | "ERN" | "ETB" | "EUR" | "FJD" | "FKP" | "GBP" | "GEL" | "GHS" | "GIP" | "GMD" | "GNF" | "GTQ" | "GYD" | "HKD" | "HNL" | "HRK" | "HTG" | "HUF" | "IDR" | "ILS" | "INR" | "IQD" | "IRR" | "ISK" | "JMD" | "JOD" | "JPY" | "KES" | "KGS" | "KHR" | "KMF" | "KPW" | "KRW" | "KWD" | "KYD" | "KZT" | "LAK" | "LBP" | "LKR" | "LRD" | "LSL" | "LYD" | "MAD" | "MDL" | "MGA" | "MKD" | "MMK" | "MNT" | "MOP" | "MRU" | "MUR" | "MVR" | "MWK" | "MXN" | "MYR" | "MZN" | "NAD" | "NGN" | "NIO" | "NOK" | "NPR" | "NZD" | "OMR" | "PAB" | "PEN" | "PGK" | "PHP" | "PKR" | "PLN" | "PYG" | "QAR" | "RON" | "RSD" | "RUB" | "RWF" | "SAR" | "SBD" | "SCR" | "SDG" | "SEK" | "SGD" | "SHP" | "SLE" | "SLL" | "SOS" | "SRD" | "SSP" | "STN" | "SVC" | "SYP" | "SZL" | "THB" | "TJS" | "TMT" | "TND" | "TOP" | "TRY" | "TTD" | "TWD" | "TZS" | "UAH" | "UGX" | "USD" | "UYU" | "UZS" | "VES" | "VND" | "VUV" | "WST" | "XAF" | "XCD" | "XCG" | "XDR" | "XOF" | "XPF" | "XSU" | "YER" | "ZAR" | "ZMW" | "ZWG" | "ZWL";
59
+ maxCampaignBudgetMicros: string;
60
+ maxOutstandingMicros: string;
61
+ maxChangeBasisPoints: number;
62
+ } & {};
63
+ maxOperations: number;
64
+ maxFlightDays: number;
65
+ } & {}) | null;
66
+ } & {}>;
67
+ export type AgentExecutionPolicyUpdate = Value<typeof policyUpdate>;
68
+ /** Compare-and-set update. A null policy revokes; only the native owner route may persist it. */
69
+ export declare const parseAgentExecutionPolicyUpdate: (v: unknown) => AgentExecutionPolicyUpdate;
70
+ export declare const AGENT_EXECUTION_POLICY_UPDATE_JSON_SCHEMA: import("./wire-schema").JsonSchema;
71
+ declare const authoritySummary: import("./wire-schema").Field<{
72
+ schemaVersion: 1;
73
+ actorContactId: string;
74
+ principalContactId: string;
75
+ organizationId: string;
76
+ policyRevision: number | null;
77
+ policyState: "active" | "disabled" | "expired" | "missing" | "not_yet_valid" | "revoked";
78
+ capabilities: ({
79
+ family: "resonance.diagnostics" | "resonance.mandate" | "resonance.operating_policy" | "resonance.optimize";
80
+ mode: "direct" | "propose_only" | "unavailable";
81
+ reasonCodes: ("ACTION_DIGEST_MISMATCH" | "ACTOR_INACTIVE" | "CAMPAIGN_CEILING_EXCEEDED" | "CHANGE_LIMIT_EXCEEDED" | "CURRENCY_MISMATCH" | "FAMILY_NOT_GRANTED" | "FLIGHT_LIMIT_EXCEEDED" | "KILL_ACTIVE" | "MEMBERSHIP_REQUIRED" | "NATIVE_AUTHORITY_REQUIRED" | "OPERATION_LIMIT_EXCEEDED" | "OUTSTANDING_CEILING_EXCEEDED" | "POLICY_DISABLED" | "POLICY_EXPIRED" | "POLICY_MISSING" | "POLICY_NOT_YET_VALID" | "POLICY_REVISION_CHANGED" | "POLICY_REVOKED" | "PRINCIPAL_INACTIVE" | "SCOPE_MISMATCH" | "STATE_CONFLICT" | "TOKEN_REVOKED" | "UNKNOWN_ACTION_KIND")[];
82
+ effectiveScope: ({
83
+ projects: string[];
84
+ campaignScope: ({
85
+ mode: "selected";
86
+ campaignIds: string[];
87
+ } & {}) | ({
88
+ mode: "all_in_projects";
89
+ } & {});
90
+ accountBindingIds: string[];
91
+ sites: string[];
92
+ financialLimits: {
93
+ currency: "AED" | "AFN" | "ALL" | "AMD" | "ANG" | "AOA" | "ARS" | "AUD" | "AWG" | "AZN" | "BAM" | "BBD" | "BDT" | "BGN" | "BHD" | "BIF" | "BMD" | "BND" | "BOB" | "BRL" | "BSD" | "BTN" | "BWP" | "BYN" | "BZD" | "CAD" | "CDF" | "CHF" | "CLP" | "CNY" | "COP" | "CRC" | "CUC" | "CUP" | "CVE" | "CZK" | "DJF" | "DKK" | "DOP" | "DZD" | "EGP" | "ERN" | "ETB" | "EUR" | "FJD" | "FKP" | "GBP" | "GEL" | "GHS" | "GIP" | "GMD" | "GNF" | "GTQ" | "GYD" | "HKD" | "HNL" | "HRK" | "HTG" | "HUF" | "IDR" | "ILS" | "INR" | "IQD" | "IRR" | "ISK" | "JMD" | "JOD" | "JPY" | "KES" | "KGS" | "KHR" | "KMF" | "KPW" | "KRW" | "KWD" | "KYD" | "KZT" | "LAK" | "LBP" | "LKR" | "LRD" | "LSL" | "LYD" | "MAD" | "MDL" | "MGA" | "MKD" | "MMK" | "MNT" | "MOP" | "MRU" | "MUR" | "MVR" | "MWK" | "MXN" | "MYR" | "MZN" | "NAD" | "NGN" | "NIO" | "NOK" | "NPR" | "NZD" | "OMR" | "PAB" | "PEN" | "PGK" | "PHP" | "PKR" | "PLN" | "PYG" | "QAR" | "RON" | "RSD" | "RUB" | "RWF" | "SAR" | "SBD" | "SCR" | "SDG" | "SEK" | "SGD" | "SHP" | "SLE" | "SLL" | "SOS" | "SRD" | "SSP" | "STN" | "SVC" | "SYP" | "SZL" | "THB" | "TJS" | "TMT" | "TND" | "TOP" | "TRY" | "TTD" | "TWD" | "TZS" | "UAH" | "UGX" | "USD" | "UYU" | "UZS" | "VES" | "VND" | "VUV" | "WST" | "XAF" | "XCD" | "XCG" | "XDR" | "XOF" | "XPF" | "XSU" | "YER" | "ZAR" | "ZMW" | "ZWG" | "ZWL";
94
+ maxCampaignBudgetMicros: string;
95
+ maxOutstandingMicros: string;
96
+ maxChangeBasisPoints: number;
97
+ } & {};
98
+ notBefore: string;
99
+ expiresAt: string;
100
+ maxOperations: number;
101
+ operationsUsed: number;
102
+ operationsRemaining: number;
103
+ maxFlightDays: number;
104
+ } & {}) | null;
105
+ } & {})[];
106
+ observedAt: string;
107
+ } & {}>;
108
+ export type DelegatedCommandAuthoritySummary = Value<typeof authoritySummary>;
109
+ /** Safe native observation; consumers must re-resolve authority before each effect. No bearer token or provider text. */
110
+ export declare const parseDelegatedCommandAuthoritySummary: (v: unknown) => DelegatedCommandAuthoritySummary;
111
+ export declare const DELEGATED_COMMAND_AUTHORITY_SUMMARY_JSON_SCHEMA: import("./wire-schema").JsonSchema;
112
+ declare const delegation: import("./wire-schema").Field<{
113
+ schemaVersion: 1;
114
+ tokenId: string;
115
+ policyRevision: number;
116
+ ledgerActionId: string;
117
+ payloadDigest: string;
118
+ } & {}>;
119
+ export type DelegatedCommandProofReference = Value<typeof delegation>;
120
+ export declare const parseDelegatedCommandProofReference: (v: unknown) => DelegatedCommandProofReference;
121
+ export declare const DELEGATED_COMMAND_PROOF_REFERENCE_JSON_SCHEMA: import("./wire-schema").JsonSchema;
122
+ declare const approval: import("./wire-schema").Field<{
123
+ by: string;
124
+ via: "mcp";
125
+ at: string;
126
+ basis: "delegated_agent";
127
+ delegation: {
128
+ schemaVersion: 1;
129
+ tokenId: string;
130
+ policyRevision: number;
131
+ ledgerActionId: string;
132
+ payloadDigest: string;
133
+ } & {};
134
+ } & {}>;
135
+ export type DelegatedCommandApproval = Value<typeof approval>;
136
+ /** Stored native _approval, attributed to the actual agent. A matching immutable admission is still required. */
137
+ export declare const parseDelegatedCommandApproval: (v: unknown) => DelegatedCommandApproval;
138
+ export declare const DELEGATED_COMMAND_APPROVAL_JSON_SCHEMA: import("./wire-schema").JsonSchema;
139
+ export declare const DELEGATED_COMMAND_CLAIM_ROUTE: '/agents/me/execution-actions/:ledgerId/claim';
140
+ declare const claimRequest: import("./wire-schema").Field<{
141
+ projectId: string;
142
+ expectedUpdatedAt: string;
143
+ expectedPolicyRevision: number;
144
+ } & {}>;
145
+ export type DelegatedCommandClaimRequest = Value<typeof claimRequest>;
146
+ export declare const parseDelegatedCommandClaimRequest: (v: unknown) => DelegatedCommandClaimRequest;
147
+ export declare const DELEGATED_COMMAND_CLAIM_REQUEST_JSON_SCHEMA: import("./wire-schema").JsonSchema;
148
+ export declare const RESONANCE_OPERATING_POLICY_RECOVERY_ROUTE: '/resonance/projects/:projectId/campaigns/:campaignId/operating-policies/:actionId/recover';
149
+ declare const policyRecoveryRequest: import("./wire-schema").Field<{
150
+ expectedUpdatedAt: string;
151
+ } & {}>;
152
+ export type ResonanceOperatingPolicyRecoveryRequest = Value<typeof policyRecoveryRequest>;
153
+ /** Current delegated identity and policy revision are native-derived; the original human review remains intact. */
154
+ export declare const parseResonanceOperatingPolicyRecoveryRequest: (v: unknown) => ResonanceOperatingPolicyRecoveryRequest;
155
+ export declare const RESONANCE_OPERATING_POLICY_RECOVERY_REQUEST_JSON_SCHEMA: import("./wire-schema").JsonSchema;
156
+ declare const admission: import("./wire-schema").Field<({
157
+ schemaVersion: 1;
158
+ tokenId: string;
159
+ actorContactId: string;
160
+ principalContactId: string;
161
+ organizationId: string;
162
+ projectId: string;
163
+ campaignId: string;
164
+ policyRevision: number;
165
+ ledgerActionId: string;
166
+ actionKind: "resonance_diagnostics" | "resonance_mandate" | "resonance_operation";
167
+ family: "resonance.diagnostics" | "resonance.mandate" | "resonance.operating_policy" | "resonance.optimize";
168
+ effectKey: string;
169
+ payloadDigest: string;
170
+ targetScope: {
171
+ accountBindingIds: string[];
172
+ sites: string[];
173
+ channelIds: string[];
174
+ preparedPlanId: string;
175
+ } & {};
176
+ expectedRevision: number;
177
+ expectedKillRevision: number;
178
+ admittedAt: string;
179
+ expiresAt: string;
180
+ proof: {
181
+ schemaVersion: 1;
182
+ tokenId: string;
183
+ policyRevision: number;
184
+ ledgerActionId: string;
185
+ payloadDigest: string;
186
+ } & {};
187
+ basis: "delegated_agent";
188
+ } & {}) | ({
189
+ schemaVersion: 1;
190
+ tokenId: string;
191
+ actorContactId: string;
192
+ principalContactId: string;
193
+ organizationId: string;
194
+ projectId: string;
195
+ campaignId: string;
196
+ policyRevision: number;
197
+ ledgerActionId: string;
198
+ actionKind: "resonance_diagnostics" | "resonance_mandate" | "resonance_operation";
199
+ family: "resonance.diagnostics" | "resonance.mandate" | "resonance.operating_policy" | "resonance.optimize";
200
+ effectKey: string;
201
+ payloadDigest: string;
202
+ targetScope: {
203
+ accountBindingIds: string[];
204
+ sites: string[];
205
+ channelIds: string[];
206
+ preparedPlanId: string;
207
+ } & {};
208
+ expectedRevision: number;
209
+ expectedKillRevision: number;
210
+ admittedAt: string;
211
+ expiresAt: string;
212
+ proof: {
213
+ schemaVersion: 1;
214
+ tokenId: string;
215
+ policyRevision: number;
216
+ ledgerActionId: string;
217
+ payloadDigest: string;
218
+ } & {};
219
+ basis: "human_review_recovery";
220
+ executorKind: "agent";
221
+ originalReview: {
222
+ reviewerContactId: string;
223
+ reviewedAt: string;
224
+ approvalDigest: string;
225
+ } & {};
226
+ } & {}) | ({
227
+ schemaVersion: 1;
228
+ actorContactId: string;
229
+ principalContactId: string;
230
+ organizationId: string;
231
+ projectId: string;
232
+ campaignId: string;
233
+ ledgerActionId: string;
234
+ actionKind: "resonance_diagnostics" | "resonance_mandate" | "resonance_operation";
235
+ family: "resonance.diagnostics" | "resonance.mandate" | "resonance.operating_policy" | "resonance.optimize";
236
+ effectKey: string;
237
+ payloadDigest: string;
238
+ targetScope: {
239
+ accountBindingIds: string[];
240
+ sites: string[];
241
+ channelIds: string[];
242
+ preparedPlanId: string;
243
+ } & {};
244
+ expectedRevision: number;
245
+ expectedKillRevision: number;
246
+ admittedAt: string;
247
+ expiresAt: string;
248
+ basis: "human_review_recovery";
249
+ executorKind: "human";
250
+ tokenId: null;
251
+ policyRevision: null;
252
+ proof: null;
253
+ originalReview: {
254
+ reviewerContactId: string;
255
+ reviewedAt: string;
256
+ approvalDigest: string;
257
+ } & {};
258
+ } & {})>;
259
+ export type DelegatedCommandAdmission = Value<typeof admission>;
260
+ /** Native observation only. Reconcile this against the immutable admission and live session before effects. */
261
+ export declare const parseDelegatedCommandAdmission: (v: unknown) => DelegatedCommandAdmission;
262
+ export declare const DELEGATED_COMMAND_ADMISSION_JSON_SCHEMA: import("./wire-schema").JsonSchema;
263
+ export interface DelegatedCommandClaimResponse<T> {
264
+ action: T;
265
+ admission: DelegatedCommandAdmission | null;
266
+ replayed: boolean;
267
+ }
268
+ /** Required native Ledger parser keeps that row's contract at its existing owner. Only POST replayed:false may dispatch. */
269
+ export declare function parseDelegatedCommandClaimResponse<T>(v: unknown, parseNativeAction: (v: unknown) => T): DelegatedCommandClaimResponse<T>;
270
+ /** Closed initial family registry. Other existing kinds retain their native controls. Never use this as authorization. */
271
+ export declare function delegatedCommandFamilyForAction(kind: unknown, payload: unknown): DelegatedCommandFamily | null;