@sonordev/contracts 2.27.0 → 2.28.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,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.28.0
4
+
5
+ - 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.
6
+ - 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.
7
+ - 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.
8
+ - Key an operating policy approval to the accepted campaign and its exact predecessor receipt so that returning to earlier terms requires a fresh approval.
9
+
3
10
  ## 2.27.0
4
11
 
5
12
  - 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,34 @@ 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
+ ### Standing Google Search content policy
1484
+
1485
+ A Resonance mandate can include an `operatingPolicy` naming its agent and
1486
+ verified human principal. Use `parseResonanceOperatingPolicySelection` for
1487
+ draft input and `parseResonanceOperatingPolicy` for the resolved policy.
1488
+ Each entry names an existing channel, ad group and ad. It carries up to 20
1489
+ owned phrase negatives to remove, up to 20 exact keywords to add, and an
1490
+ optional full set of RSA headlines and descriptions with their creative
1491
+ reference. The policy sets a cooldown that applies to these changes.
1492
+
1493
+ Pass `googleContentUpdate` with the target keys to prepare an update. The
1494
+ prepared command adds the exact bounded change, operating policy receipt and
1495
+ prior content fingerprint. Targeting terms are normalized and sorted for
1496
+ canonical identity. Headline and description order is preserved. Sonor
1497
+ checks current authority, scope, cooldown and provider state at dispatch.
1498
+
1499
+ An operating policy activation uses the existing mandate approval. Its
1500
+ `operatingPolicyBase` binds the accepted campaign and the previous policy
1501
+ receipt. The first activation uses a null predecessor. An absent
1502
+ `operatingPolicy` preserves the original mandate's wire shape.
1503
+
1504
+ For operating policy filing and recovery, hash the exact UTF-8 output of
1505
+ `resonanceOperatingPolicyActionDigestInput({ mandateDigest, operatingPolicyBase })`
1506
+ with SHA-256 and use its lowercase hex digest. The same approved terms and base
1507
+ produce the same action key. Repeating those terms after a different policy
1508
+ receipt produces a new key. Legacy mandate lookup and policy receipts still use
1509
+ the original mandate digest.
1510
+
1483
1511
  ### Delivering a qualified Google conversion
1484
1512
 
1485
1513
  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 +1735,9 @@ Pagination follows native-row UUID order, with at most 100 native rows and 500 e
1707
1735
 
1708
1736
  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
1737
 
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.
1738
+ 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.
1739
+
1740
+ 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
1741
 
1712
1742
  `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
1743
 
@@ -1458,6 +1458,7 @@ declare const providerReportingGrant: Field<{
1458
1458
  actionReportTime: "conversion";
1459
1459
  basis: "explicit_query";
1460
1460
  } & {})[] | undefined;
1461
+ reportingUntil?: string | undefined;
1461
1462
  }>;
1462
1463
  export type ResonanceMetaReportingQuery = Value<typeof metaReportingQuery>;
1463
1464
  export type ResonanceProviderReportingSelection = Value<typeof providerReportingSelection>;
@@ -1466,6 +1467,123 @@ export declare const parseResonanceProviderReportingSelection: (v: unknown) => R
1466
1467
  export declare const parseResonanceProviderReportingGrant: (v: unknown) => ResonanceProviderReportingGrant;
1467
1468
  export declare const RESONANCE_PROVIDER_REPORTING_SELECTION_JSON_SCHEMA: import("./wire-schema").JsonSchema;
1468
1469
  export declare const RESONANCE_PROVIDER_REPORTING_GRANT_JSON_SCHEMA: import("./wire-schema").JsonSchema;
1470
+ export declare const RESONANCE_PROVIDER_REPORTING_MAX_TAIL_DAYS = 92;
1471
+ export declare const normalizeResonanceGoogleCriterionText: (value: string) => string;
1472
+ declare const operatingPolicySelection: Field<{
1473
+ schemaVersion: 1;
1474
+ agentContactId: string;
1475
+ googleSearchContent: ({
1476
+ channelId: string;
1477
+ adGroupLocalKey: string;
1478
+ adLocalKey: string;
1479
+ negativeRemovals: string[];
1480
+ exactAdditions: string[];
1481
+ rsa: ({
1482
+ creativeRef: {
1483
+ projectId: string;
1484
+ site: string;
1485
+ module: "booking" | "broadcast" | "business_brain" | "commerce" | "crm" | "experiment" | "files" | "forms" | "funnel" | "outreach" | "prepared_plan" | "publication";
1486
+ id: string;
1487
+ revision: string;
1488
+ digest: string;
1489
+ } & {};
1490
+ headlines: string[];
1491
+ descriptions: string[];
1492
+ } & {}) | null;
1493
+ } & {})[];
1494
+ cooldownSeconds: number;
1495
+ } & {}>;
1496
+ declare const operatingPolicy: Field<{
1497
+ schemaVersion: 1;
1498
+ agentContactId: string;
1499
+ googleSearchContent: ({
1500
+ channelId: string;
1501
+ adGroupLocalKey: string;
1502
+ adLocalKey: string;
1503
+ negativeRemovals: string[];
1504
+ exactAdditions: string[];
1505
+ rsa: ({
1506
+ creativeRef: {
1507
+ projectId: string;
1508
+ site: string;
1509
+ module: "booking" | "broadcast" | "business_brain" | "commerce" | "crm" | "experiment" | "files" | "forms" | "funnel" | "outreach" | "prepared_plan" | "publication";
1510
+ id: string;
1511
+ revision: string;
1512
+ digest: string;
1513
+ } & {};
1514
+ headlines: string[];
1515
+ descriptions: string[];
1516
+ } & {}) | null;
1517
+ } & {})[];
1518
+ cooldownSeconds: number;
1519
+ principalContactId: string;
1520
+ } & {}>;
1521
+ declare const operatingPolicyRef: Field<{
1522
+ ledgerActionId: string;
1523
+ receiptId: string;
1524
+ digest: string;
1525
+ } & {}>;
1526
+ declare const operatingPolicyBase: Field<{
1527
+ ledgerActionId: string;
1528
+ acceptanceReceiptId: string;
1529
+ expectedKillRevision: number;
1530
+ previousOperatingPolicyRef: ({
1531
+ ledgerActionId: string;
1532
+ receiptId: string;
1533
+ digest: string;
1534
+ } & {}) | null;
1535
+ } & {}>;
1536
+ declare const googleContentUpdateSelection: Field<{
1537
+ channelId: string;
1538
+ adGroupLocalKey: string;
1539
+ adLocalKey: string;
1540
+ } & {}>;
1541
+ declare const googleContentUpdate: Field<{
1542
+ channelId: string;
1543
+ adGroupLocalKey: string;
1544
+ adLocalKey: string;
1545
+ negativeRemovals: string[];
1546
+ exactAdditions: string[];
1547
+ rsa: ({
1548
+ creativeRef: {
1549
+ projectId: string;
1550
+ site: string;
1551
+ module: "booking" | "broadcast" | "business_brain" | "commerce" | "crm" | "experiment" | "files" | "forms" | "funnel" | "outreach" | "prepared_plan" | "publication";
1552
+ id: string;
1553
+ revision: string;
1554
+ digest: string;
1555
+ } & {};
1556
+ headlines: string[];
1557
+ descriptions: string[];
1558
+ } & {}) | null;
1559
+ policyRef: {
1560
+ ledgerActionId: string;
1561
+ receiptId: string;
1562
+ digest: string;
1563
+ } & {};
1564
+ beforeDigest: string;
1565
+ } & {}>;
1566
+ export type ResonanceOperatingPolicy = Value<typeof operatingPolicy>;
1567
+ export type ResonanceOperatingPolicySelection = Value<typeof operatingPolicySelection>;
1568
+ export type ResonanceOperatingPolicyBase = Value<typeof operatingPolicyBase>;
1569
+ export type ResonanceOperatingPolicyRef = Value<typeof operatingPolicyRef>;
1570
+ export type ResonanceGoogleContentUpdateSelection = Value<typeof googleContentUpdateSelection>;
1571
+ export type ResonanceGoogleContentUpdate = Value<typeof googleContentUpdate>;
1572
+ export declare const parseResonanceOperatingPolicy: (v: unknown) => ResonanceOperatingPolicy;
1573
+ export declare const parseResonanceOperatingPolicySelection: (v: unknown) => ResonanceOperatingPolicySelection;
1574
+ export declare const parseResonanceOperatingPolicyBase: (v: unknown) => ResonanceOperatingPolicyBase;
1575
+ export declare const parseResonanceOperatingPolicyRef: (v: unknown) => ResonanceOperatingPolicyRef;
1576
+ export declare const parseResonanceGoogleContentUpdateSelection: (v: unknown) => ResonanceGoogleContentUpdateSelection;
1577
+ export declare const parseResonanceGoogleContentUpdate: (v: unknown) => ResonanceGoogleContentUpdate;
1578
+ export declare const resonanceOperatingPolicyDigestInput: (v: unknown) => string;
1579
+ /** SHA-256 this UTF-8 input for operating-policy action filing and recovery. */
1580
+ export declare function resonanceOperatingPolicyActionDigestInput(v: unknown): string;
1581
+ export declare const RESONANCE_OPERATING_POLICY_JSON_SCHEMA: import("./wire-schema").JsonSchema;
1582
+ export declare const RESONANCE_OPERATING_POLICY_SELECTION_JSON_SCHEMA: import("./wire-schema").JsonSchema;
1583
+ export declare const RESONANCE_OPERATING_POLICY_BASE_JSON_SCHEMA: import("./wire-schema").JsonSchema;
1584
+ export declare const RESONANCE_OPERATING_POLICY_REF_JSON_SCHEMA: import("./wire-schema").JsonSchema;
1585
+ export declare const RESONANCE_GOOGLE_CONTENT_UPDATE_SELECTION_JSON_SCHEMA: import("./wire-schema").JsonSchema;
1586
+ export declare const RESONANCE_GOOGLE_CONTENT_UPDATE_JSON_SCHEMA: import("./wire-schema").JsonSchema;
1469
1587
  declare const mandateScope: Field<{
1470
1588
  projectId: string;
1471
1589
  campaignId: string;
@@ -1608,7 +1726,33 @@ declare const mandateScope: Field<{
1608
1726
  actionReportTime: "conversion";
1609
1727
  basis: "explicit_query";
1610
1728
  } & {})[] | undefined;
1729
+ reportingUntil?: string | undefined;
1611
1730
  }) | undefined;
1731
+ operatingPolicy?: ({
1732
+ schemaVersion: 1;
1733
+ agentContactId: string;
1734
+ googleSearchContent: ({
1735
+ channelId: string;
1736
+ adGroupLocalKey: string;
1737
+ adLocalKey: string;
1738
+ negativeRemovals: string[];
1739
+ exactAdditions: string[];
1740
+ rsa: ({
1741
+ creativeRef: {
1742
+ projectId: string;
1743
+ site: string;
1744
+ module: "booking" | "broadcast" | "business_brain" | "commerce" | "crm" | "experiment" | "files" | "forms" | "funnel" | "outreach" | "prepared_plan" | "publication";
1745
+ id: string;
1746
+ revision: string;
1747
+ digest: string;
1748
+ } & {};
1749
+ headlines: string[];
1750
+ descriptions: string[];
1751
+ } & {}) | null;
1752
+ } & {})[];
1753
+ cooldownSeconds: number;
1754
+ principalContactId: string;
1755
+ } & {}) | undefined;
1612
1756
  }>;
1613
1757
  export type ResonanceMandateScope = Value<typeof mandateScope>;
1614
1758
  export declare function parseResonanceMandateScope(v: unknown, preparedPlan?: unknown): ResonanceMandateScope;
@@ -3022,6 +3166,52 @@ declare const command: Field<({
3022
3166
  channelId: string;
3023
3167
  digest: string;
3024
3168
  } & {})[];
3169
+ } & {}) | ({
3170
+ schemaVersion: 1;
3171
+ campaignId: string;
3172
+ expectedRevision: number;
3173
+ idempotencyKey: string;
3174
+ operation: "update";
3175
+ preparedPlanId: string;
3176
+ reviewDigest: string;
3177
+ mandateRef: {
3178
+ ledgerActionId: string;
3179
+ campaignId: string;
3180
+ preparedPlanId: string;
3181
+ reviewDigest: string;
3182
+ mandateDigest: string;
3183
+ expectedKillRevision: number;
3184
+ } & {};
3185
+ channelIds: string[];
3186
+ expectedRemoteSnapshots: ({
3187
+ channelId: string;
3188
+ digest: string;
3189
+ } & {})[];
3190
+ googleContentUpdate: {
3191
+ channelId: string;
3192
+ adGroupLocalKey: string;
3193
+ adLocalKey: string;
3194
+ negativeRemovals: string[];
3195
+ exactAdditions: string[];
3196
+ rsa: ({
3197
+ creativeRef: {
3198
+ projectId: string;
3199
+ site: string;
3200
+ module: "booking" | "broadcast" | "business_brain" | "commerce" | "crm" | "experiment" | "files" | "forms" | "funnel" | "outreach" | "prepared_plan" | "publication";
3201
+ id: string;
3202
+ revision: string;
3203
+ digest: string;
3204
+ } & {};
3205
+ headlines: string[];
3206
+ descriptions: string[];
3207
+ } & {}) | null;
3208
+ policyRef: {
3209
+ ledgerActionId: string;
3210
+ receiptId: string;
3211
+ digest: string;
3212
+ } & {};
3213
+ beforeDigest: string;
3214
+ } & {};
3025
3215
  } & {}) | ({
3026
3216
  schemaVersion: 1;
3027
3217
  campaignId: string;
@@ -3920,9 +4110,46 @@ declare const mandateApproval: Field<{
3920
4110
  actionReportTime: "conversion";
3921
4111
  basis: "explicit_query";
3922
4112
  } & {})[] | undefined;
4113
+ reportingUntil?: string | undefined;
3923
4114
  }) | undefined;
4115
+ operatingPolicy?: ({
4116
+ schemaVersion: 1;
4117
+ agentContactId: string;
4118
+ googleSearchContent: ({
4119
+ channelId: string;
4120
+ adGroupLocalKey: string;
4121
+ adLocalKey: string;
4122
+ negativeRemovals: string[];
4123
+ exactAdditions: string[];
4124
+ rsa: ({
4125
+ creativeRef: {
4126
+ projectId: string;
4127
+ site: string;
4128
+ module: "booking" | "broadcast" | "business_brain" | "commerce" | "crm" | "experiment" | "files" | "forms" | "funnel" | "outreach" | "prepared_plan" | "publication";
4129
+ id: string;
4130
+ revision: string;
4131
+ digest: string;
4132
+ } & {};
4133
+ headlines: string[];
4134
+ descriptions: string[];
4135
+ } & {}) | null;
4136
+ } & {})[];
4137
+ cooldownSeconds: number;
4138
+ principalContactId: string;
4139
+ } & {}) | undefined;
3924
4140
  };
3925
- } & {}>;
4141
+ } & {
4142
+ operatingPolicyBase?: ({
4143
+ ledgerActionId: string;
4144
+ acceptanceReceiptId: string;
4145
+ expectedKillRevision: number;
4146
+ previousOperatingPolicyRef: ({
4147
+ ledgerActionId: string;
4148
+ receiptId: string;
4149
+ digest: string;
4150
+ } & {}) | null;
4151
+ } & {}) | undefined;
4152
+ }>;
3926
4153
  export type ResonanceMandateApprovalPayload = Value<typeof mandateApproval>;
3927
4154
  export type ResonanceMandateTarget = Value<typeof mandateTarget>;
3928
4155
  export declare const RESONANCE_MANDATE_APPROVAL_JSON_SCHEMA: import("./wire-schema").JsonSchema;
@@ -4183,7 +4410,13 @@ export declare const RESONANCE_POSITIONING_CONSISTENCY_ASSESSMENT_JSON_SCHEMA: i
4183
4410
  declare const prepareCommand: Field<{
4184
4411
  expectedRevision: number;
4185
4412
  idempotencyKey: string;
4186
- } & {}>;
4413
+ } & {
4414
+ googleContentUpdate?: ({
4415
+ channelId: string;
4416
+ adGroupLocalKey: string;
4417
+ adLocalKey: string;
4418
+ } & {}) | undefined;
4419
+ }>;
4187
4420
  export type ResonanceCommandPrepareRequest = Value<typeof prepareCommand>;
4188
4421
  export declare const parseResonancePrepareCommand: (v: unknown) => ResonanceCommandPrepareRequest;
4189
4422
  /** Same strict revision/key request for API-owned launch/update/resume command preparation. */
@@ -4210,6 +4443,52 @@ declare const commandPreparation: Field<{
4210
4443
  channelId: string;
4211
4444
  digest: string;
4212
4445
  } & {})[];
4446
+ } & {}) | ({
4447
+ schemaVersion: 1;
4448
+ campaignId: string;
4449
+ expectedRevision: number;
4450
+ idempotencyKey: string;
4451
+ operation: "update";
4452
+ preparedPlanId: string;
4453
+ reviewDigest: string;
4454
+ mandateRef: {
4455
+ ledgerActionId: string;
4456
+ campaignId: string;
4457
+ preparedPlanId: string;
4458
+ reviewDigest: string;
4459
+ mandateDigest: string;
4460
+ expectedKillRevision: number;
4461
+ } & {};
4462
+ channelIds: string[];
4463
+ expectedRemoteSnapshots: ({
4464
+ channelId: string;
4465
+ digest: string;
4466
+ } & {})[];
4467
+ googleContentUpdate: {
4468
+ channelId: string;
4469
+ adGroupLocalKey: string;
4470
+ adLocalKey: string;
4471
+ negativeRemovals: string[];
4472
+ exactAdditions: string[];
4473
+ rsa: ({
4474
+ creativeRef: {
4475
+ projectId: string;
4476
+ site: string;
4477
+ module: "booking" | "broadcast" | "business_brain" | "commerce" | "crm" | "experiment" | "files" | "forms" | "funnel" | "outreach" | "prepared_plan" | "publication";
4478
+ id: string;
4479
+ revision: string;
4480
+ digest: string;
4481
+ } & {};
4482
+ headlines: string[];
4483
+ descriptions: string[];
4484
+ } & {}) | null;
4485
+ policyRef: {
4486
+ ledgerActionId: string;
4487
+ receiptId: string;
4488
+ digest: string;
4489
+ } & {};
4490
+ beforeDigest: string;
4491
+ } & {};
4213
4492
  } & {}) | ({
4214
4493
  schemaVersion: 1;
4215
4494
  campaignId: string;
@@ -9039,6 +9318,31 @@ declare const mandateDraftRequest: Field<{
9039
9318
  basis: "explicit_query";
9040
9319
  } & {})[] | undefined;
9041
9320
  }) | undefined;
9321
+ operatingPolicySelection?: ({
9322
+ schemaVersion: 1;
9323
+ agentContactId: string;
9324
+ googleSearchContent: ({
9325
+ channelId: string;
9326
+ adGroupLocalKey: string;
9327
+ adLocalKey: string;
9328
+ negativeRemovals: string[];
9329
+ exactAdditions: string[];
9330
+ rsa: ({
9331
+ creativeRef: {
9332
+ projectId: string;
9333
+ site: string;
9334
+ module: "booking" | "broadcast" | "business_brain" | "commerce" | "crm" | "experiment" | "files" | "forms" | "funnel" | "outreach" | "prepared_plan" | "publication";
9335
+ id: string;
9336
+ revision: string;
9337
+ digest: string;
9338
+ } & {};
9339
+ headlines: string[];
9340
+ descriptions: string[];
9341
+ } & {}) | null;
9342
+ } & {})[];
9343
+ cooldownSeconds: number;
9344
+ } & {}) | undefined;
9345
+ activation?: "operating_policy" | undefined;
9042
9346
  }>;
9043
9347
  export type ResonanceMandateDraftRequest = Value<typeof mandateDraftRequest>;
9044
9348
  export declare const parseResonanceMandateDraftRequest: (v: unknown) => ResonanceMandateDraftRequest;
@@ -9193,9 +9497,46 @@ declare const feedReview: Field<{
9193
9497
  actionReportTime: "conversion";
9194
9498
  basis: "explicit_query";
9195
9499
  } & {})[] | undefined;
9500
+ reportingUntil?: string | undefined;
9196
9501
  }) | undefined;
9502
+ operatingPolicy?: ({
9503
+ schemaVersion: 1;
9504
+ agentContactId: string;
9505
+ googleSearchContent: ({
9506
+ channelId: string;
9507
+ adGroupLocalKey: string;
9508
+ adLocalKey: string;
9509
+ negativeRemovals: string[];
9510
+ exactAdditions: string[];
9511
+ rsa: ({
9512
+ creativeRef: {
9513
+ projectId: string;
9514
+ site: string;
9515
+ module: "booking" | "broadcast" | "business_brain" | "commerce" | "crm" | "experiment" | "files" | "forms" | "funnel" | "outreach" | "prepared_plan" | "publication";
9516
+ id: string;
9517
+ revision: string;
9518
+ digest: string;
9519
+ } & {};
9520
+ headlines: string[];
9521
+ descriptions: string[];
9522
+ } & {}) | null;
9523
+ } & {})[];
9524
+ cooldownSeconds: number;
9525
+ principalContactId: string;
9526
+ } & {}) | undefined;
9197
9527
  };
9198
- } & {};
9528
+ } & {
9529
+ operatingPolicyBase?: ({
9530
+ ledgerActionId: string;
9531
+ acceptanceReceiptId: string;
9532
+ expectedKillRevision: number;
9533
+ previousOperatingPolicyRef: ({
9534
+ ledgerActionId: string;
9535
+ receiptId: string;
9536
+ digest: string;
9537
+ } & {}) | null;
9538
+ } & {}) | undefined;
9539
+ };
9199
9540
  mandateRef: {
9200
9541
  ledgerActionId: string;
9201
9542
  campaignId: string;
package/dist/resonance.js CHANGED
@@ -641,7 +641,7 @@ function checkReportingQuerySubset(v, p) {
641
641
  if (v.metaQueries?.some((query) => !v.channelIds.some((id) => id.toLowerCase() === query.channelId.toLowerCase()))) fail2(p + ".metaQueries", "query channel must be selected");
642
642
  }
643
643
  var providerReportingSelection = refine2(object2({ agentContactId: uuid, channelIds: providerReportingChannelIds, metaQueries: optional2(providerReportingMetaQueries) }), checkReportingQuerySubset);
644
- var providerReportingGrant = refine2(object2({ purpose: literal2("provider_reporting_refresh"), orgId: uuid, projectId: uuid, agentContactId: uuid, principalContactId: uuid, channelIds: providerReportingChannelIds, metaQueries: optional2(providerReportingMetaQueries) }), (v, p) => {
644
+ var providerReportingGrant = refine2(object2({ purpose: literal2("provider_reporting_refresh"), orgId: uuid, projectId: uuid, agentContactId: uuid, principalContactId: uuid, channelIds: providerReportingChannelIds, metaQueries: optional2(providerReportingMetaQueries), reportingUntil: optional2(instant) }), (v, p) => {
645
645
  if (v.agentContactId.toLowerCase() === v.principalContactId.toLowerCase()) fail2(p + ".principalContactId", "agent and human principal must remain distinct");
646
646
  checkReportingQuerySubset(v, p);
647
647
  });
@@ -649,7 +649,94 @@ var parseResonanceProviderReportingSelection = (v) => providerReportingSelection
649
649
  var parseResonanceProviderReportingGrant = (v) => providerReportingGrant.read(v, "providerReportingGrant");
650
650
  var RESONANCE_PROVIDER_REPORTING_SELECTION_JSON_SCHEMA = providerReportingSelection.schema;
651
651
  var RESONANCE_PROVIDER_REPORTING_GRANT_JSON_SCHEMA = providerReportingGrant.schema;
652
- var mandateScope = object2({ projectId: uuid, campaignId: uuid, preparedPlanId: uuid, reviewDigest: digest, accountBindingIds: list2(uuid, 100), sites: list2(site, 50, 1), budget, creativeRefs: list2(creative, 100, 1), audienceRuleRefs: list2(audience, 100), goal: objective, allowedOperations: mandateAllowedOperations, allowedTransformationRef: nullable2(resource), expiresAt: instant, websiteVisitFeed: optional2(websiteVisitFeed), providerReporting: optional2(providerReportingGrant) });
652
+ var RESONANCE_PROVIDER_REPORTING_MAX_TAIL_DAYS = 92;
653
+ var googleContentTarget = { channelId: uuid, adGroupLocalKey: text2(80), adLocalKey: text2(80) };
654
+ var normalizeResonanceGoogleCriterionText = (value) => value.trim().replace(/\s+/gu, " ").toLowerCase().normalize("NFC");
655
+ var googleCriterionText = text2(80, /^(?! +$)[^\x00-\x1f\x7f]+$/);
656
+ var googleExactText = text2(80, /^(?! +$)[^\x00-\x1f\x7f\\\[\]"]+$/);
657
+ var googleContentKeywords = (criterion) => refine2(list2(criterion, 20), (items, p) => {
658
+ const normalized = items.map(normalizeResonanceGoogleCriterionText);
659
+ if (normalized.some((value) => !value || value.length > 80)) fail2(p, "requires nonempty bounded criterion text");
660
+ unique(normalized, p);
661
+ items.splice(0, items.length, ...normalized.sort());
662
+ });
663
+ var rsaAsset = (length) => refine2(text2(length, /^[^\x00-\x1f\x7f]+$/), (asset, p) => {
664
+ if (!asset.trim() || asset.trim() !== asset) fail2(p, "requires trimmed, nonempty asset text");
665
+ });
666
+ var googleContentRsa = object2({
667
+ creativeRef: resource,
668
+ headlines: uniqueList(rsaAsset(30), 15, 3),
669
+ descriptions: uniqueList(rsaAsset(90), 4, 2)
670
+ });
671
+ var googleContentMaterial = {
672
+ negativeRemovals: googleContentKeywords(googleCriterionText),
673
+ exactAdditions: googleContentKeywords(googleExactText),
674
+ rsa: nullable2(googleContentRsa)
675
+ };
676
+ var googleContentEntry = refine2(object2({ ...googleContentTarget, ...googleContentMaterial }), (entry, p) => {
677
+ if (!entry.negativeRemovals.length && !entry.exactAdditions.length && !entry.rsa) fail2(p, "must select at least one bounded content effect");
678
+ });
679
+ var googleSearchContent = refine2(list2(googleContentEntry, 100), (entries, p) => {
680
+ const identity = (entry) => JSON.stringify([entry.channelId.toLowerCase(), entry.adGroupLocalKey, entry.adLocalKey]);
681
+ unique(entries.map(identity), p);
682
+ entries.sort((a, b) => identity(a) < identity(b) ? -1 : identity(a) > identity(b) ? 1 : 0);
683
+ });
684
+ var operatingPolicyFields = {
685
+ schemaVersion: literal2(1),
686
+ agentContactId: uuid,
687
+ googleSearchContent,
688
+ cooldownSeconds: integer2(3600, 2592e3)
689
+ };
690
+ var operatingPolicySelection = object2(operatingPolicyFields);
691
+ var operatingPolicy = refine2(object2({ ...operatingPolicyFields, principalContactId: uuid }), (policy, p) => {
692
+ if (policy.agentContactId.toLowerCase() === policy.principalContactId.toLowerCase()) {
693
+ fail2(p + ".principalContactId", "agent and human principal must remain distinct");
694
+ }
695
+ });
696
+ var operatingPolicyRef = object2({ ledgerActionId: uuid, receiptId: uuid, digest });
697
+ var operatingPolicyBase = object2({
698
+ ledgerActionId: uuid,
699
+ acceptanceReceiptId: uuid,
700
+ expectedKillRevision: integer2(0),
701
+ previousOperatingPolicyRef: nullable2(operatingPolicyRef)
702
+ });
703
+ var operatingPolicyActionIdentity = object2({ mandateDigest: digest, operatingPolicyBase });
704
+ var googleContentUpdateSelection = object2(googleContentTarget);
705
+ var googleContentUpdate = refine2(object2({ ...googleContentTarget, ...googleContentMaterial, policyRef: operatingPolicyRef, beforeDigest: digest }), (update2, p) => {
706
+ if (!update2.negativeRemovals.length && !update2.exactAdditions.length && !update2.rsa) fail2(p, "must select at least one bounded content effect");
707
+ });
708
+ var parseResonanceOperatingPolicy = (v) => operatingPolicy.read(v, "operatingPolicy");
709
+ var parseResonanceOperatingPolicySelection = (v) => operatingPolicySelection.read(v, "operatingPolicySelection");
710
+ var parseResonanceOperatingPolicyBase = (v) => operatingPolicyBase.read(v, "operatingPolicyBase");
711
+ var parseResonanceOperatingPolicyRef = (v) => operatingPolicyRef.read(v, "operatingPolicyRef");
712
+ var parseResonanceGoogleContentUpdateSelection = (v) => googleContentUpdateSelection.read(v, "googleContentUpdateSelection");
713
+ var parseResonanceGoogleContentUpdate = (v) => googleContentUpdate.read(v, "googleContentUpdate");
714
+ var resonanceOperatingPolicyDigestInput = (v) => canonical(parseResonanceOperatingPolicy(v));
715
+ function resonanceOperatingPolicyActionDigestInput(v) {
716
+ const { mandateDigest, operatingPolicyBase: base } = operatingPolicyActionIdentity.read(v, "operatingPolicyActionIdentity");
717
+ const previous = base.previousOperatingPolicyRef;
718
+ return canonical({
719
+ kind: "resonance_operating_policy_activation_v1",
720
+ mandateDigest,
721
+ operatingPolicyBase: {
722
+ ...base,
723
+ ledgerActionId: base.ledgerActionId.toLowerCase(),
724
+ acceptanceReceiptId: base.acceptanceReceiptId.toLowerCase(),
725
+ previousOperatingPolicyRef: previous && {
726
+ ...previous,
727
+ ledgerActionId: previous.ledgerActionId.toLowerCase(),
728
+ receiptId: previous.receiptId.toLowerCase()
729
+ }
730
+ }
731
+ });
732
+ }
733
+ var RESONANCE_OPERATING_POLICY_JSON_SCHEMA = operatingPolicy.schema;
734
+ var RESONANCE_OPERATING_POLICY_SELECTION_JSON_SCHEMA = operatingPolicySelection.schema;
735
+ var RESONANCE_OPERATING_POLICY_BASE_JSON_SCHEMA = operatingPolicyBase.schema;
736
+ var RESONANCE_OPERATING_POLICY_REF_JSON_SCHEMA = operatingPolicyRef.schema;
737
+ var RESONANCE_GOOGLE_CONTENT_UPDATE_SELECTION_JSON_SCHEMA = googleContentUpdateSelection.schema;
738
+ var RESONANCE_GOOGLE_CONTENT_UPDATE_JSON_SCHEMA = googleContentUpdate.schema;
739
+ var mandateScope = object2({ projectId: uuid, campaignId: uuid, preparedPlanId: uuid, reviewDigest: digest, accountBindingIds: list2(uuid, 100), sites: list2(site, 50, 1), budget, creativeRefs: list2(creative, 100, 1), audienceRuleRefs: list2(audience, 100), goal: objective, allowedOperations: mandateAllowedOperations, allowedTransformationRef: nullable2(resource), expiresAt: instant, websiteVisitFeed: optional2(websiteVisitFeed), providerReporting: optional2(providerReportingGrant), operatingPolicy: optional2(operatingPolicy) });
653
740
  function parseResonanceMandateScope(v, preparedPlan) {
654
741
  const r = mandateScope.read(v, "mandateScope");
655
742
  scoped(r, r.projectId, r.sites, "mandateScope");
@@ -657,10 +744,36 @@ function parseResonanceMandateScope(v, preparedPlan) {
657
744
  unique(r.websiteVisitFeed.channels.map((c) => c.channelId), "mandateScope.websiteVisitFeed.channels");
658
745
  for (const c of r.websiteVisitFeed.channels) unique(c.resourceRuleRefs.map((rule) => rule.id), "mandateScope.websiteVisitFeed.resourceRuleRefs");
659
746
  }
747
+ if (r.operatingPolicy) {
748
+ const p = "mandateScope.operatingPolicy";
749
+ if (Date.parse(r.expiresAt) <= Date.parse(r.budget.startAt) || Date.parse(r.expiresAt) > Date.parse(r.budget.endAt)) {
750
+ fail2(p, "operating policy remains inside the original mandate flight and expiry");
751
+ }
752
+ if (r.operatingPolicy.googleSearchContent.length && !r.allowedOperations.includes("update")) {
753
+ fail2(p, "Google content requires the update operation");
754
+ }
755
+ if (preparedPlan !== void 0) {
756
+ const plan = parseResonancePreparedPlan(preparedPlan);
757
+ if (r.projectId !== plan.projectId || r.campaignId !== plan.campaignId || r.preparedPlanId !== plan.id || r.reviewDigest !== plan.reviewDigest || canonical(r.goal) !== canonical(plan.definition.objective) || canonical(r.budget) !== canonical(plan.definition.budget)) fail2(p, "requires the exact original plan, review, goal and flight");
758
+ for (const entry of r.operatingPolicy.googleSearchContent) {
759
+ const channel2 = plan.definition.channels.find((item) => item.id.toLowerCase() === entry.channelId.toLowerCase());
760
+ if (channel2?.kind !== "google_search") return fail2(p, "requires an original Google Search channel");
761
+ const group = channel2.adGroups.find((item) => item.localKey === entry.adGroupLocalKey);
762
+ if (!r.sites.includes(channel2.site) || !r.accountBindingIds.includes(channel2.accountBindingId) || !group?.ads.some((ad) => ad.localKey === entry.adLocalKey) || entry.rsa && entry.rsa.creativeRef.site !== channel2.site) fail2(p, "requires the original account, site, ad group and ad");
763
+ }
764
+ }
765
+ }
660
766
  if (r.providerReporting) {
661
767
  const grant = r.providerReporting, p = "mandateScope.providerReporting";
662
768
  if (grant.projectId !== r.projectId) fail2(p + ".projectId", "must match the original mandate project");
663
- if (Date.parse(r.expiresAt) <= Date.parse(r.budget.startAt) || Date.parse(r.expiresAt) > Date.parse(r.budget.endAt)) fail2(p, "reporting remains inside the original mandate flight and expiry");
769
+ const flightEnd = Date.parse(r.budget.endAt);
770
+ if (Date.parse(r.expiresAt) <= Date.parse(r.budget.startAt) || Date.parse(r.expiresAt) > flightEnd) fail2(p, "mandate expiry remains inside the original flight");
771
+ if (grant.reportingUntil !== void 0) {
772
+ const deadline = Date.parse(grant.reportingUntil);
773
+ if (deadline <= flightEnd || deadline > flightEnd + RESONANCE_PROVIDER_REPORTING_MAX_TAIL_DAYS * 864e5) {
774
+ fail2(p + ".reportingUntil", "must follow the original flight by no more than 92 elapsed days");
775
+ }
776
+ }
664
777
  if (preparedPlan !== void 0) {
665
778
  const plan = parseResonancePreparedPlan(preparedPlan);
666
779
  if (r.projectId !== plan.projectId || r.campaignId !== plan.campaignId || r.preparedPlanId !== plan.id || r.reviewDigest !== plan.reviewDigest || canonical(r.goal) !== canonical(plan.definition.objective) || canonical(r.budget) !== canonical(plan.definition.budget)) fail2(p, "requires the exact original plan, review, goal and flight");
@@ -886,15 +999,43 @@ function parseResonancePreparedPlan(v) {
886
999
  }
887
1000
  var commandBase = { schemaVersion: literal2(1), campaignId: uuid, expectedRevision: integer2(1), idempotencyKey: operationKey, channelIds: list2(uuid, 100) };
888
1001
  var effect = object2({ ...commandBase, operation: choice2("launch", "update", "resume"), preparedPlanId: uuid, reviewDigest: digest, mandateRef, expectedRemoteSnapshots: list2(object2({ channelId: uuid, digest }), 100) });
1002
+ var googleContentEffect = refine2(object2({
1003
+ ...commandBase,
1004
+ operation: literal2("update"),
1005
+ preparedPlanId: uuid,
1006
+ reviewDigest: digest,
1007
+ mandateRef,
1008
+ channelIds: list2(uuid, 1, 1),
1009
+ expectedRemoteSnapshots: list2(object2({ channelId: uuid, digest }), 1, 1),
1010
+ googleContentUpdate
1011
+ }), (command2, p) => {
1012
+ const update2 = command2.googleContentUpdate, remote = command2.expectedRemoteSnapshots[0];
1013
+ if (command2.channelIds[0] !== update2.channelId || remote.channelId !== update2.channelId || remote.digest !== update2.beforeDigest) {
1014
+ fail2(p + ".googleContentUpdate", "requires the same single channel and before snapshot");
1015
+ }
1016
+ });
889
1017
  var optimize = object2({ ...commandBase, operation: literal2("optimize"), preparedPlanId: uuid, reviewDigest: digest, mandateRef, decisionRef: object2({ id: uuid, revision, evidenceDigest: digest }), expectedRemoteSnapshots: list2(object2({ channelId: uuid, digest }), 100) });
890
1018
  var safety = object2({ ...commandBase, operation: choice2("pause", "finish", "reconcile") });
891
1019
  var deliverConversion = object2({ ...commandBase, operation: literal2("deliver_conversion"), channelIds: list2(uuid, 1, 1), preparedPlanId: uuid, reviewDigest: digest, mandateRef, conversionId: uuid });
892
1020
  var deliverWebsiteVisit = object2({ ...commandBase, operation: literal2("deliver_website_visit"), channelIds: list2(uuid, 1, 1), preparedPlanId: uuid, reviewDigest: digest, mandateRef, occurrenceId: uuid });
893
- var command = union2(effect, optimize, safety, deliverConversion, deliverWebsiteVisit);
1021
+ var command = union2(effect, googleContentEffect, optimize, safety, deliverConversion, deliverWebsiteVisit);
894
1022
  function parseResonanceCommand(v, context) {
895
1023
  const r = command.read(v, "command");
896
1024
  unique(r.channelIds, "command.channelIds");
897
1025
  if ("mandateRef" in r && (r.mandateRef.campaignId !== r.campaignId || r.mandateRef.preparedPlanId !== r.preparedPlanId || r.mandateRef.reviewDigest !== r.reviewDigest)) fail2("command.mandateRef", "snapshot mismatch");
1026
+ if ("googleContentUpdate" in r && context) {
1027
+ const p = "command.googleContentUpdate", update2 = r.googleContentUpdate;
1028
+ const plan = parseResonancePreparedPlan(context.preparedPlan);
1029
+ const grant = parseResonanceMandateScope(context.mandate, plan);
1030
+ const now = Date.parse(instant.read(context.now, "command.context.now"));
1031
+ if (r.expectedRevision !== plan.expectedRevision || r.campaignId !== plan.campaignId || r.preparedPlanId !== plan.id || r.reviewDigest !== plan.reviewDigest || grant.projectId !== plan.projectId || grant.campaignId !== plan.campaignId || grant.preparedPlanId !== plan.id || grant.reviewDigest !== plan.reviewDigest || !grant.allowedOperations.includes("update") || canonical(grant.goal) !== canonical(plan.definition.objective) || canonical(grant.budget) !== canonical(plan.definition.budget) || now < Date.parse(grant.budget.startAt) || now >= Date.parse(grant.budget.endAt) || now >= Date.parse(grant.expiresAt)) {
1032
+ fail2(p, "requires the current original Google mandate and flight");
1033
+ }
1034
+ const channel2 = plan.definition.channels.find((item) => item.id === update2.channelId);
1035
+ if (channel2?.kind !== "google_search" || !grant.sites.includes(channel2.site) || !grant.accountBindingIds.includes(channel2.accountBindingId) || !channel2.adGroups.some((group) => group.localKey === update2.adGroupLocalKey && group.ads.some((ad) => ad.localKey === update2.adLocalKey))) {
1036
+ fail2(p, "requires an original Google Search group and ad in scope");
1037
+ } else if (update2.rsa) scoped(update2.rsa, plan.projectId, [channel2.site], p + ".rsa");
1038
+ }
898
1039
  if ((r.operation === "deliver_conversion" || r.operation === "deliver_website_visit") && context) {
899
1040
  const plan = parseResonancePreparedPlan(context.preparedPlan), grant = parseResonanceMandateScope(context.mandate);
900
1041
  const now = Date.parse(instant.read(context.now, "command.context.now"));
@@ -989,13 +1130,16 @@ var RESONANCE_METRIC_JSON_SCHEMA = metric.schema;
989
1130
  var RESONANCE_CONSENT_JSON_SCHEMA = consent.schema;
990
1131
  var parseResonanceExperimentExposure = (v) => exposure.read(v, "exposure");
991
1132
  var mandateTarget = object2({ project_id: uuid, campaign_id: uuid });
992
- var mandateApproval = object2({ schemaVersion: literal2(1), expectedRevision: integer2(1), preparedPlanId: uuid, reviewDigest: digest, mandateDigest: digest, mandate: mandateScope });
1133
+ var mandateApproval = object2({ schemaVersion: literal2(1), expectedRevision: integer2(1), preparedPlanId: uuid, reviewDigest: digest, mandateDigest: digest, mandate: mandateScope, operatingPolicyBase: optional2(operatingPolicyBase) });
993
1134
  var RESONANCE_MANDATE_APPROVAL_JSON_SCHEMA = mandateApproval.schema;
994
1135
  var RESONANCE_MANDATE_TARGET_JSON_SCHEMA = mandateTarget.schema;
995
1136
  var RESONANCE_MANDATE_ACTION_KIND = "resonance_mandate";
996
1137
  function parseResonanceMandateApprovalPayload(v, target) {
997
1138
  const r = mandateApproval.read(v, "mandateApproval"), t = mandateTarget.read(target, "target_ref");
998
1139
  parseResonanceMandateScope(r.mandate);
1140
+ if (r.operatingPolicyBase && !r.mandate.operatingPolicy && !r.mandate.providerReporting) {
1141
+ fail2("mandateApproval.operatingPolicyBase", "requires explicit prospective operating or reporting scope");
1142
+ }
999
1143
  if (r.mandate.projectId !== t.project_id || r.mandate.campaignId !== t.campaign_id || r.preparedPlanId !== r.mandate.preparedPlanId || r.reviewDigest !== r.mandate.reviewDigest) fail2("mandateApproval", "target or snapshot mismatch");
1000
1144
  return r;
1001
1145
  }
@@ -1225,7 +1369,7 @@ function parseResonancePositioningConsistencyAssessment(value, expected) {
1225
1369
  return assessment;
1226
1370
  }
1227
1371
  var RESONANCE_POSITIONING_CONSISTENCY_ASSESSMENT_JSON_SCHEMA = positioningConsistencyAssessment.schema;
1228
- var prepareCommand = object2({ expectedRevision: integer2(1), idempotencyKey: operationKey });
1372
+ var prepareCommand = object2({ expectedRevision: integer2(1), idempotencyKey: operationKey, googleContentUpdate: optional2(googleContentUpdateSelection) });
1229
1373
  var parseResonancePrepareCommand = (v) => prepareCommand.read(v, "prepare");
1230
1374
  var parseResonanceCommandPrepareRequest = parseResonancePrepareCommand;
1231
1375
  var commandPreparation = object2({ command: nullable2(command), covered: bool, approvalRequirement: nullable2(choice2("existing_mandate", "current_owner")), reasonCodes: list2(text2(200), 100) });
@@ -2377,7 +2521,7 @@ var feedSelection = refine2(object2({ channels: list2(object2({ channelId: uuid,
2377
2521
  unique(v.channels.map((c) => c.channelId), p + ".channels");
2378
2522
  for (const c of v.channels) unique(c.resourceRuleRefs.map((ref) => ref.id), p + ".resourceRuleRefs");
2379
2523
  });
2380
- var mandateDraftRequest = object2({ expectedRevision: integer2(1), allowedOperations: mandateAllowedOperations, expiresAt: instant, websiteVisitFeedSelection: optional2(feedSelection), providerReporting: optional2(providerReportingSelection) });
2524
+ var mandateDraftRequest = object2({ expectedRevision: integer2(1), allowedOperations: mandateAllowedOperations, expiresAt: instant, websiteVisitFeedSelection: optional2(feedSelection), providerReporting: optional2(providerReportingSelection), operatingPolicySelection: optional2(operatingPolicySelection), activation: optional2(literal2("operating_policy")) });
2381
2525
  var parseResonanceMandateDraftRequest = (v) => mandateDraftRequest.read(v, "mandateDraftRequest");
2382
2526
  var RESONANCE_MANDATE_DRAFT_REQUEST_JSON_SCHEMA = mandateDraftRequest.schema;
2383
2527
  var feedReview = object2({ schemaVersion: literal2(1), approval: mandateApproval, mandateRef, configurations: list2(metaSnapshot, 100), current: object2({ state: choice2("not_enabled", "eligible", "invalidated", "unavailable"), checkedAt: instant, expiresAt: nullable2(instant), reasonCodes: uniqueList(text2(200), 100) }) });
@@ -2724,6 +2868,8 @@ exports.RESONANCE_GOOGLE_CONFIGURATION_SAVE_COMMAND_JSON_SCHEMA = RESONANCE_GOOG
2724
2868
  exports.RESONANCE_GOOGLE_CONFIGURATION_SAVE_RESPONSE_JSON_SCHEMA = RESONANCE_GOOGLE_CONFIGURATION_SAVE_RESPONSE_JSON_SCHEMA;
2725
2869
  exports.RESONANCE_GOOGLE_CONFIGURATION_SNAPSHOT_JSON_SCHEMA = RESONANCE_GOOGLE_CONFIGURATION_SNAPSHOT_JSON_SCHEMA;
2726
2870
  exports.RESONANCE_GOOGLE_CONFIGURATION_VIEW_JSON_SCHEMA = RESONANCE_GOOGLE_CONFIGURATION_VIEW_JSON_SCHEMA;
2871
+ exports.RESONANCE_GOOGLE_CONTENT_UPDATE_JSON_SCHEMA = RESONANCE_GOOGLE_CONTENT_UPDATE_JSON_SCHEMA;
2872
+ exports.RESONANCE_GOOGLE_CONTENT_UPDATE_SELECTION_JSON_SCHEMA = RESONANCE_GOOGLE_CONTENT_UPDATE_SELECTION_JSON_SCHEMA;
2727
2873
  exports.RESONANCE_GOOGLE_SETUP_SPEC_JSON_SCHEMA = RESONANCE_GOOGLE_SETUP_SPEC_JSON_SCHEMA;
2728
2874
  exports.RESONANCE_GOOGLE_SIGNAL_SEMANTICS = RESONANCE_GOOGLE_SIGNAL_SEMANTICS;
2729
2875
  exports.RESONANCE_GOOGLE_SOURCE_CATEGORIES = RESONANCE_GOOGLE_SOURCE_CATEGORIES;
@@ -2764,6 +2910,10 @@ exports.RESONANCE_METRIC_JSON_SCHEMA = RESONANCE_METRIC_JSON_SCHEMA;
2764
2910
  exports.RESONANCE_OBSERVATIONS_PAGE_JSON_SCHEMA = RESONANCE_OBSERVATIONS_PAGE_JSON_SCHEMA;
2765
2911
  exports.RESONANCE_OBSERVATION_SUPPORT_JSON_SCHEMA = RESONANCE_OBSERVATION_SUPPORT_JSON_SCHEMA;
2766
2912
  exports.RESONANCE_OCCURRENCE_RESPONSE_JSON_SCHEMA = RESONANCE_OCCURRENCE_RESPONSE_JSON_SCHEMA;
2913
+ exports.RESONANCE_OPERATING_POLICY_BASE_JSON_SCHEMA = RESONANCE_OPERATING_POLICY_BASE_JSON_SCHEMA;
2914
+ exports.RESONANCE_OPERATING_POLICY_JSON_SCHEMA = RESONANCE_OPERATING_POLICY_JSON_SCHEMA;
2915
+ exports.RESONANCE_OPERATING_POLICY_REF_JSON_SCHEMA = RESONANCE_OPERATING_POLICY_REF_JSON_SCHEMA;
2916
+ exports.RESONANCE_OPERATING_POLICY_SELECTION_JSON_SCHEMA = RESONANCE_OPERATING_POLICY_SELECTION_JSON_SCHEMA;
2767
2917
  exports.RESONANCE_OPTIMIZATION_DECISION_JSON_SCHEMA = RESONANCE_OPTIMIZATION_DECISION_JSON_SCHEMA;
2768
2918
  exports.RESONANCE_OPTIMIZATION_EVIDENCE_JSON_SCHEMA = RESONANCE_OPTIMIZATION_EVIDENCE_JSON_SCHEMA;
2769
2919
  exports.RESONANCE_OPTIMIZATION_POLICY_JSON_SCHEMA = RESONANCE_OPTIMIZATION_POLICY_JSON_SCHEMA;
@@ -2777,6 +2927,7 @@ exports.RESONANCE_POSITIONING_RESULT_JSON_SCHEMA = RESONANCE_POSITIONING_RESULT_
2777
2927
  exports.RESONANCE_PREPARED_PLAN_JSON_SCHEMA = RESONANCE_PREPARED_PLAN_JSON_SCHEMA;
2778
2928
  exports.RESONANCE_PROVIDER_METRIC_NAMES = RESONANCE_PROVIDER_METRIC_NAMES;
2779
2929
  exports.RESONANCE_PROVIDER_REPORTING_GRANT_JSON_SCHEMA = RESONANCE_PROVIDER_REPORTING_GRANT_JSON_SCHEMA;
2930
+ exports.RESONANCE_PROVIDER_REPORTING_MAX_TAIL_DAYS = RESONANCE_PROVIDER_REPORTING_MAX_TAIL_DAYS;
2780
2931
  exports.RESONANCE_PROVIDER_REPORTING_SELECTION_JSON_SCHEMA = RESONANCE_PROVIDER_REPORTING_SELECTION_JSON_SCHEMA;
2781
2932
  exports.RESONANCE_PUBLIC_OBSERVATION_METRIC_JSON_SCHEMA = RESONANCE_PUBLIC_OBSERVATION_METRIC_JSON_SCHEMA;
2782
2933
  exports.RESONANCE_QUALIFICATION_RULE_JSON_SCHEMA = RESONANCE_QUALIFICATION_RULE_JSON_SCHEMA;
@@ -2810,6 +2961,7 @@ exports.googleUploadClicksSetupSemantics = googleUploadClicksSetupSemantics;
2810
2961
  exports.metaExclusionPolicy = metaExclusionPolicy;
2811
2962
  exports.moneyFromProviderUnits = moneyFromProviderUnits;
2812
2963
  exports.moneyToProviderUnits = moneyToProviderUnits;
2964
+ exports.normalizeResonanceGoogleCriterionText = normalizeResonanceGoogleCriterionText;
2813
2965
  exports.parseMoney = parseMoney;
2814
2966
  exports.parseResonanceAcceptCommand = parseResonanceAcceptCommand;
2815
2967
  exports.parseResonanceAccountCapability = parseResonanceAccountCapability;
@@ -2840,6 +2992,8 @@ exports.parseResonanceGoogleConfigurationSaveCommand = parseResonanceGoogleConfi
2840
2992
  exports.parseResonanceGoogleConfigurationSaveResponse = parseResonanceGoogleConfigurationSaveResponse;
2841
2993
  exports.parseResonanceGoogleConfigurationSnapshot = parseResonanceGoogleConfigurationSnapshot;
2842
2994
  exports.parseResonanceGoogleConfigurationView = parseResonanceGoogleConfigurationView;
2995
+ exports.parseResonanceGoogleContentUpdate = parseResonanceGoogleContentUpdate;
2996
+ exports.parseResonanceGoogleContentUpdateSelection = parseResonanceGoogleContentUpdateSelection;
2843
2997
  exports.parseResonanceGoogleUploadClicksCustomGoalSpec = parseResonanceGoogleUploadClicksCustomGoalSpec;
2844
2998
  exports.parseResonanceMandateApprovalPayload = parseResonanceMandateApprovalPayload;
2845
2999
  exports.parseResonanceMandateDraftRequest = parseResonanceMandateDraftRequest;
@@ -2875,6 +3029,10 @@ exports.parseResonanceMetricObservation = parseResonanceMetricObservation;
2875
3029
  exports.parseResonanceObservationSupport = parseResonanceObservationSupport;
2876
3030
  exports.parseResonanceObservationsPage = parseResonanceObservationsPage;
2877
3031
  exports.parseResonanceOccurrenceResponse = parseResonanceOccurrenceResponse;
3032
+ exports.parseResonanceOperatingPolicy = parseResonanceOperatingPolicy;
3033
+ exports.parseResonanceOperatingPolicyBase = parseResonanceOperatingPolicyBase;
3034
+ exports.parseResonanceOperatingPolicyRef = parseResonanceOperatingPolicyRef;
3035
+ exports.parseResonanceOperatingPolicySelection = parseResonanceOperatingPolicySelection;
2878
3036
  exports.parseResonanceOptimizationDecision = parseResonanceOptimizationDecision;
2879
3037
  exports.parseResonanceOptimizationEvidence = parseResonanceOptimizationEvidence;
2880
3038
  exports.parseResonanceOptimizationPolicy = parseResonanceOptimizationPolicy;
@@ -2918,6 +3076,8 @@ exports.resonanceMetaAudienceSetupReceiptDigestInput = resonanceMetaAudienceSetu
2918
3076
  exports.resonanceMetaConfigurationDigestInput = resonanceMetaConfigurationDigestInput;
2919
3077
  exports.resonanceMetaConfigurationSaveDigestInput = resonanceMetaConfigurationSaveDigestInput;
2920
3078
  exports.resonanceMetaDatasetSetupDigestInput = resonanceMetaDatasetSetupDigestInput;
3079
+ exports.resonanceOperatingPolicyActionDigestInput = resonanceOperatingPolicyActionDigestInput;
3080
+ exports.resonanceOperatingPolicyDigestInput = resonanceOperatingPolicyDigestInput;
2921
3081
  exports.resonanceOptimizationDecisionDigestInput = resonanceOptimizationDecisionDigestInput;
2922
3082
  exports.resonanceOptimizationEvidenceDigestInput = resonanceOptimizationEvidenceDigestInput;
2923
3083
  exports.resonanceOptimizationPolicyDigestInput = resonanceOptimizationPolicyDigestInput;
@@ -639,7 +639,7 @@ function checkReportingQuerySubset(v, p) {
639
639
  if (v.metaQueries?.some((query) => !v.channelIds.some((id) => id.toLowerCase() === query.channelId.toLowerCase()))) fail2(p + ".metaQueries", "query channel must be selected");
640
640
  }
641
641
  var providerReportingSelection = refine2(object2({ agentContactId: uuid, channelIds: providerReportingChannelIds, metaQueries: optional2(providerReportingMetaQueries) }), checkReportingQuerySubset);
642
- var providerReportingGrant = refine2(object2({ purpose: literal2("provider_reporting_refresh"), orgId: uuid, projectId: uuid, agentContactId: uuid, principalContactId: uuid, channelIds: providerReportingChannelIds, metaQueries: optional2(providerReportingMetaQueries) }), (v, p) => {
642
+ var providerReportingGrant = refine2(object2({ purpose: literal2("provider_reporting_refresh"), orgId: uuid, projectId: uuid, agentContactId: uuid, principalContactId: uuid, channelIds: providerReportingChannelIds, metaQueries: optional2(providerReportingMetaQueries), reportingUntil: optional2(instant) }), (v, p) => {
643
643
  if (v.agentContactId.toLowerCase() === v.principalContactId.toLowerCase()) fail2(p + ".principalContactId", "agent and human principal must remain distinct");
644
644
  checkReportingQuerySubset(v, p);
645
645
  });
@@ -647,7 +647,94 @@ var parseResonanceProviderReportingSelection = (v) => providerReportingSelection
647
647
  var parseResonanceProviderReportingGrant = (v) => providerReportingGrant.read(v, "providerReportingGrant");
648
648
  var RESONANCE_PROVIDER_REPORTING_SELECTION_JSON_SCHEMA = providerReportingSelection.schema;
649
649
  var RESONANCE_PROVIDER_REPORTING_GRANT_JSON_SCHEMA = providerReportingGrant.schema;
650
- var mandateScope = object2({ projectId: uuid, campaignId: uuid, preparedPlanId: uuid, reviewDigest: digest, accountBindingIds: list2(uuid, 100), sites: list2(site, 50, 1), budget, creativeRefs: list2(creative, 100, 1), audienceRuleRefs: list2(audience, 100), goal: objective, allowedOperations: mandateAllowedOperations, allowedTransformationRef: nullable2(resource), expiresAt: instant, websiteVisitFeed: optional2(websiteVisitFeed), providerReporting: optional2(providerReportingGrant) });
650
+ var RESONANCE_PROVIDER_REPORTING_MAX_TAIL_DAYS = 92;
651
+ var googleContentTarget = { channelId: uuid, adGroupLocalKey: text2(80), adLocalKey: text2(80) };
652
+ var normalizeResonanceGoogleCriterionText = (value) => value.trim().replace(/\s+/gu, " ").toLowerCase().normalize("NFC");
653
+ var googleCriterionText = text2(80, /^(?! +$)[^\x00-\x1f\x7f]+$/);
654
+ var googleExactText = text2(80, /^(?! +$)[^\x00-\x1f\x7f\\\[\]"]+$/);
655
+ var googleContentKeywords = (criterion) => refine2(list2(criterion, 20), (items, p) => {
656
+ const normalized = items.map(normalizeResonanceGoogleCriterionText);
657
+ if (normalized.some((value) => !value || value.length > 80)) fail2(p, "requires nonempty bounded criterion text");
658
+ unique(normalized, p);
659
+ items.splice(0, items.length, ...normalized.sort());
660
+ });
661
+ var rsaAsset = (length) => refine2(text2(length, /^[^\x00-\x1f\x7f]+$/), (asset, p) => {
662
+ if (!asset.trim() || asset.trim() !== asset) fail2(p, "requires trimmed, nonempty asset text");
663
+ });
664
+ var googleContentRsa = object2({
665
+ creativeRef: resource,
666
+ headlines: uniqueList(rsaAsset(30), 15, 3),
667
+ descriptions: uniqueList(rsaAsset(90), 4, 2)
668
+ });
669
+ var googleContentMaterial = {
670
+ negativeRemovals: googleContentKeywords(googleCriterionText),
671
+ exactAdditions: googleContentKeywords(googleExactText),
672
+ rsa: nullable2(googleContentRsa)
673
+ };
674
+ var googleContentEntry = refine2(object2({ ...googleContentTarget, ...googleContentMaterial }), (entry, p) => {
675
+ if (!entry.negativeRemovals.length && !entry.exactAdditions.length && !entry.rsa) fail2(p, "must select at least one bounded content effect");
676
+ });
677
+ var googleSearchContent = refine2(list2(googleContentEntry, 100), (entries, p) => {
678
+ const identity = (entry) => JSON.stringify([entry.channelId.toLowerCase(), entry.adGroupLocalKey, entry.adLocalKey]);
679
+ unique(entries.map(identity), p);
680
+ entries.sort((a, b) => identity(a) < identity(b) ? -1 : identity(a) > identity(b) ? 1 : 0);
681
+ });
682
+ var operatingPolicyFields = {
683
+ schemaVersion: literal2(1),
684
+ agentContactId: uuid,
685
+ googleSearchContent,
686
+ cooldownSeconds: integer2(3600, 2592e3)
687
+ };
688
+ var operatingPolicySelection = object2(operatingPolicyFields);
689
+ var operatingPolicy = refine2(object2({ ...operatingPolicyFields, principalContactId: uuid }), (policy, p) => {
690
+ if (policy.agentContactId.toLowerCase() === policy.principalContactId.toLowerCase()) {
691
+ fail2(p + ".principalContactId", "agent and human principal must remain distinct");
692
+ }
693
+ });
694
+ var operatingPolicyRef = object2({ ledgerActionId: uuid, receiptId: uuid, digest });
695
+ var operatingPolicyBase = object2({
696
+ ledgerActionId: uuid,
697
+ acceptanceReceiptId: uuid,
698
+ expectedKillRevision: integer2(0),
699
+ previousOperatingPolicyRef: nullable2(operatingPolicyRef)
700
+ });
701
+ var operatingPolicyActionIdentity = object2({ mandateDigest: digest, operatingPolicyBase });
702
+ var googleContentUpdateSelection = object2(googleContentTarget);
703
+ var googleContentUpdate = refine2(object2({ ...googleContentTarget, ...googleContentMaterial, policyRef: operatingPolicyRef, beforeDigest: digest }), (update2, p) => {
704
+ if (!update2.negativeRemovals.length && !update2.exactAdditions.length && !update2.rsa) fail2(p, "must select at least one bounded content effect");
705
+ });
706
+ var parseResonanceOperatingPolicy = (v) => operatingPolicy.read(v, "operatingPolicy");
707
+ var parseResonanceOperatingPolicySelection = (v) => operatingPolicySelection.read(v, "operatingPolicySelection");
708
+ var parseResonanceOperatingPolicyBase = (v) => operatingPolicyBase.read(v, "operatingPolicyBase");
709
+ var parseResonanceOperatingPolicyRef = (v) => operatingPolicyRef.read(v, "operatingPolicyRef");
710
+ var parseResonanceGoogleContentUpdateSelection = (v) => googleContentUpdateSelection.read(v, "googleContentUpdateSelection");
711
+ var parseResonanceGoogleContentUpdate = (v) => googleContentUpdate.read(v, "googleContentUpdate");
712
+ var resonanceOperatingPolicyDigestInput = (v) => canonical(parseResonanceOperatingPolicy(v));
713
+ function resonanceOperatingPolicyActionDigestInput(v) {
714
+ const { mandateDigest, operatingPolicyBase: base } = operatingPolicyActionIdentity.read(v, "operatingPolicyActionIdentity");
715
+ const previous = base.previousOperatingPolicyRef;
716
+ return canonical({
717
+ kind: "resonance_operating_policy_activation_v1",
718
+ mandateDigest,
719
+ operatingPolicyBase: {
720
+ ...base,
721
+ ledgerActionId: base.ledgerActionId.toLowerCase(),
722
+ acceptanceReceiptId: base.acceptanceReceiptId.toLowerCase(),
723
+ previousOperatingPolicyRef: previous && {
724
+ ...previous,
725
+ ledgerActionId: previous.ledgerActionId.toLowerCase(),
726
+ receiptId: previous.receiptId.toLowerCase()
727
+ }
728
+ }
729
+ });
730
+ }
731
+ var RESONANCE_OPERATING_POLICY_JSON_SCHEMA = operatingPolicy.schema;
732
+ var RESONANCE_OPERATING_POLICY_SELECTION_JSON_SCHEMA = operatingPolicySelection.schema;
733
+ var RESONANCE_OPERATING_POLICY_BASE_JSON_SCHEMA = operatingPolicyBase.schema;
734
+ var RESONANCE_OPERATING_POLICY_REF_JSON_SCHEMA = operatingPolicyRef.schema;
735
+ var RESONANCE_GOOGLE_CONTENT_UPDATE_SELECTION_JSON_SCHEMA = googleContentUpdateSelection.schema;
736
+ var RESONANCE_GOOGLE_CONTENT_UPDATE_JSON_SCHEMA = googleContentUpdate.schema;
737
+ var mandateScope = object2({ projectId: uuid, campaignId: uuid, preparedPlanId: uuid, reviewDigest: digest, accountBindingIds: list2(uuid, 100), sites: list2(site, 50, 1), budget, creativeRefs: list2(creative, 100, 1), audienceRuleRefs: list2(audience, 100), goal: objective, allowedOperations: mandateAllowedOperations, allowedTransformationRef: nullable2(resource), expiresAt: instant, websiteVisitFeed: optional2(websiteVisitFeed), providerReporting: optional2(providerReportingGrant), operatingPolicy: optional2(operatingPolicy) });
651
738
  function parseResonanceMandateScope(v, preparedPlan) {
652
739
  const r = mandateScope.read(v, "mandateScope");
653
740
  scoped(r, r.projectId, r.sites, "mandateScope");
@@ -655,10 +742,36 @@ function parseResonanceMandateScope(v, preparedPlan) {
655
742
  unique(r.websiteVisitFeed.channels.map((c) => c.channelId), "mandateScope.websiteVisitFeed.channels");
656
743
  for (const c of r.websiteVisitFeed.channels) unique(c.resourceRuleRefs.map((rule) => rule.id), "mandateScope.websiteVisitFeed.resourceRuleRefs");
657
744
  }
745
+ if (r.operatingPolicy) {
746
+ const p = "mandateScope.operatingPolicy";
747
+ if (Date.parse(r.expiresAt) <= Date.parse(r.budget.startAt) || Date.parse(r.expiresAt) > Date.parse(r.budget.endAt)) {
748
+ fail2(p, "operating policy remains inside the original mandate flight and expiry");
749
+ }
750
+ if (r.operatingPolicy.googleSearchContent.length && !r.allowedOperations.includes("update")) {
751
+ fail2(p, "Google content requires the update operation");
752
+ }
753
+ if (preparedPlan !== void 0) {
754
+ const plan = parseResonancePreparedPlan(preparedPlan);
755
+ if (r.projectId !== plan.projectId || r.campaignId !== plan.campaignId || r.preparedPlanId !== plan.id || r.reviewDigest !== plan.reviewDigest || canonical(r.goal) !== canonical(plan.definition.objective) || canonical(r.budget) !== canonical(plan.definition.budget)) fail2(p, "requires the exact original plan, review, goal and flight");
756
+ for (const entry of r.operatingPolicy.googleSearchContent) {
757
+ const channel2 = plan.definition.channels.find((item) => item.id.toLowerCase() === entry.channelId.toLowerCase());
758
+ if (channel2?.kind !== "google_search") return fail2(p, "requires an original Google Search channel");
759
+ const group = channel2.adGroups.find((item) => item.localKey === entry.adGroupLocalKey);
760
+ if (!r.sites.includes(channel2.site) || !r.accountBindingIds.includes(channel2.accountBindingId) || !group?.ads.some((ad) => ad.localKey === entry.adLocalKey) || entry.rsa && entry.rsa.creativeRef.site !== channel2.site) fail2(p, "requires the original account, site, ad group and ad");
761
+ }
762
+ }
763
+ }
658
764
  if (r.providerReporting) {
659
765
  const grant = r.providerReporting, p = "mandateScope.providerReporting";
660
766
  if (grant.projectId !== r.projectId) fail2(p + ".projectId", "must match the original mandate project");
661
- if (Date.parse(r.expiresAt) <= Date.parse(r.budget.startAt) || Date.parse(r.expiresAt) > Date.parse(r.budget.endAt)) fail2(p, "reporting remains inside the original mandate flight and expiry");
767
+ const flightEnd = Date.parse(r.budget.endAt);
768
+ if (Date.parse(r.expiresAt) <= Date.parse(r.budget.startAt) || Date.parse(r.expiresAt) > flightEnd) fail2(p, "mandate expiry remains inside the original flight");
769
+ if (grant.reportingUntil !== void 0) {
770
+ const deadline = Date.parse(grant.reportingUntil);
771
+ if (deadline <= flightEnd || deadline > flightEnd + RESONANCE_PROVIDER_REPORTING_MAX_TAIL_DAYS * 864e5) {
772
+ fail2(p + ".reportingUntil", "must follow the original flight by no more than 92 elapsed days");
773
+ }
774
+ }
662
775
  if (preparedPlan !== void 0) {
663
776
  const plan = parseResonancePreparedPlan(preparedPlan);
664
777
  if (r.projectId !== plan.projectId || r.campaignId !== plan.campaignId || r.preparedPlanId !== plan.id || r.reviewDigest !== plan.reviewDigest || canonical(r.goal) !== canonical(plan.definition.objective) || canonical(r.budget) !== canonical(plan.definition.budget)) fail2(p, "requires the exact original plan, review, goal and flight");
@@ -884,15 +997,43 @@ function parseResonancePreparedPlan(v) {
884
997
  }
885
998
  var commandBase = { schemaVersion: literal2(1), campaignId: uuid, expectedRevision: integer2(1), idempotencyKey: operationKey, channelIds: list2(uuid, 100) };
886
999
  var effect = object2({ ...commandBase, operation: choice2("launch", "update", "resume"), preparedPlanId: uuid, reviewDigest: digest, mandateRef, expectedRemoteSnapshots: list2(object2({ channelId: uuid, digest }), 100) });
1000
+ var googleContentEffect = refine2(object2({
1001
+ ...commandBase,
1002
+ operation: literal2("update"),
1003
+ preparedPlanId: uuid,
1004
+ reviewDigest: digest,
1005
+ mandateRef,
1006
+ channelIds: list2(uuid, 1, 1),
1007
+ expectedRemoteSnapshots: list2(object2({ channelId: uuid, digest }), 1, 1),
1008
+ googleContentUpdate
1009
+ }), (command2, p) => {
1010
+ const update2 = command2.googleContentUpdate, remote = command2.expectedRemoteSnapshots[0];
1011
+ if (command2.channelIds[0] !== update2.channelId || remote.channelId !== update2.channelId || remote.digest !== update2.beforeDigest) {
1012
+ fail2(p + ".googleContentUpdate", "requires the same single channel and before snapshot");
1013
+ }
1014
+ });
887
1015
  var optimize = object2({ ...commandBase, operation: literal2("optimize"), preparedPlanId: uuid, reviewDigest: digest, mandateRef, decisionRef: object2({ id: uuid, revision, evidenceDigest: digest }), expectedRemoteSnapshots: list2(object2({ channelId: uuid, digest }), 100) });
888
1016
  var safety = object2({ ...commandBase, operation: choice2("pause", "finish", "reconcile") });
889
1017
  var deliverConversion = object2({ ...commandBase, operation: literal2("deliver_conversion"), channelIds: list2(uuid, 1, 1), preparedPlanId: uuid, reviewDigest: digest, mandateRef, conversionId: uuid });
890
1018
  var deliverWebsiteVisit = object2({ ...commandBase, operation: literal2("deliver_website_visit"), channelIds: list2(uuid, 1, 1), preparedPlanId: uuid, reviewDigest: digest, mandateRef, occurrenceId: uuid });
891
- var command = union2(effect, optimize, safety, deliverConversion, deliverWebsiteVisit);
1019
+ var command = union2(effect, googleContentEffect, optimize, safety, deliverConversion, deliverWebsiteVisit);
892
1020
  function parseResonanceCommand(v, context) {
893
1021
  const r = command.read(v, "command");
894
1022
  unique(r.channelIds, "command.channelIds");
895
1023
  if ("mandateRef" in r && (r.mandateRef.campaignId !== r.campaignId || r.mandateRef.preparedPlanId !== r.preparedPlanId || r.mandateRef.reviewDigest !== r.reviewDigest)) fail2("command.mandateRef", "snapshot mismatch");
1024
+ if ("googleContentUpdate" in r && context) {
1025
+ const p = "command.googleContentUpdate", update2 = r.googleContentUpdate;
1026
+ const plan = parseResonancePreparedPlan(context.preparedPlan);
1027
+ const grant = parseResonanceMandateScope(context.mandate, plan);
1028
+ const now = Date.parse(instant.read(context.now, "command.context.now"));
1029
+ if (r.expectedRevision !== plan.expectedRevision || r.campaignId !== plan.campaignId || r.preparedPlanId !== plan.id || r.reviewDigest !== plan.reviewDigest || grant.projectId !== plan.projectId || grant.campaignId !== plan.campaignId || grant.preparedPlanId !== plan.id || grant.reviewDigest !== plan.reviewDigest || !grant.allowedOperations.includes("update") || canonical(grant.goal) !== canonical(plan.definition.objective) || canonical(grant.budget) !== canonical(plan.definition.budget) || now < Date.parse(grant.budget.startAt) || now >= Date.parse(grant.budget.endAt) || now >= Date.parse(grant.expiresAt)) {
1030
+ fail2(p, "requires the current original Google mandate and flight");
1031
+ }
1032
+ const channel2 = plan.definition.channels.find((item) => item.id === update2.channelId);
1033
+ if (channel2?.kind !== "google_search" || !grant.sites.includes(channel2.site) || !grant.accountBindingIds.includes(channel2.accountBindingId) || !channel2.adGroups.some((group) => group.localKey === update2.adGroupLocalKey && group.ads.some((ad) => ad.localKey === update2.adLocalKey))) {
1034
+ fail2(p, "requires an original Google Search group and ad in scope");
1035
+ } else if (update2.rsa) scoped(update2.rsa, plan.projectId, [channel2.site], p + ".rsa");
1036
+ }
896
1037
  if ((r.operation === "deliver_conversion" || r.operation === "deliver_website_visit") && context) {
897
1038
  const plan = parseResonancePreparedPlan(context.preparedPlan), grant = parseResonanceMandateScope(context.mandate);
898
1039
  const now = Date.parse(instant.read(context.now, "command.context.now"));
@@ -987,13 +1128,16 @@ var RESONANCE_METRIC_JSON_SCHEMA = metric.schema;
987
1128
  var RESONANCE_CONSENT_JSON_SCHEMA = consent.schema;
988
1129
  var parseResonanceExperimentExposure = (v) => exposure.read(v, "exposure");
989
1130
  var mandateTarget = object2({ project_id: uuid, campaign_id: uuid });
990
- var mandateApproval = object2({ schemaVersion: literal2(1), expectedRevision: integer2(1), preparedPlanId: uuid, reviewDigest: digest, mandateDigest: digest, mandate: mandateScope });
1131
+ var mandateApproval = object2({ schemaVersion: literal2(1), expectedRevision: integer2(1), preparedPlanId: uuid, reviewDigest: digest, mandateDigest: digest, mandate: mandateScope, operatingPolicyBase: optional2(operatingPolicyBase) });
991
1132
  var RESONANCE_MANDATE_APPROVAL_JSON_SCHEMA = mandateApproval.schema;
992
1133
  var RESONANCE_MANDATE_TARGET_JSON_SCHEMA = mandateTarget.schema;
993
1134
  var RESONANCE_MANDATE_ACTION_KIND = "resonance_mandate";
994
1135
  function parseResonanceMandateApprovalPayload(v, target) {
995
1136
  const r = mandateApproval.read(v, "mandateApproval"), t = mandateTarget.read(target, "target_ref");
996
1137
  parseResonanceMandateScope(r.mandate);
1138
+ if (r.operatingPolicyBase && !r.mandate.operatingPolicy && !r.mandate.providerReporting) {
1139
+ fail2("mandateApproval.operatingPolicyBase", "requires explicit prospective operating or reporting scope");
1140
+ }
997
1141
  if (r.mandate.projectId !== t.project_id || r.mandate.campaignId !== t.campaign_id || r.preparedPlanId !== r.mandate.preparedPlanId || r.reviewDigest !== r.mandate.reviewDigest) fail2("mandateApproval", "target or snapshot mismatch");
998
1142
  return r;
999
1143
  }
@@ -1223,7 +1367,7 @@ function parseResonancePositioningConsistencyAssessment(value, expected) {
1223
1367
  return assessment;
1224
1368
  }
1225
1369
  var RESONANCE_POSITIONING_CONSISTENCY_ASSESSMENT_JSON_SCHEMA = positioningConsistencyAssessment.schema;
1226
- var prepareCommand = object2({ expectedRevision: integer2(1), idempotencyKey: operationKey });
1370
+ var prepareCommand = object2({ expectedRevision: integer2(1), idempotencyKey: operationKey, googleContentUpdate: optional2(googleContentUpdateSelection) });
1227
1371
  var parseResonancePrepareCommand = (v) => prepareCommand.read(v, "prepare");
1228
1372
  var parseResonanceCommandPrepareRequest = parseResonancePrepareCommand;
1229
1373
  var commandPreparation = object2({ command: nullable2(command), covered: bool, approvalRequirement: nullable2(choice2("existing_mandate", "current_owner")), reasonCodes: list2(text2(200), 100) });
@@ -2375,7 +2519,7 @@ var feedSelection = refine2(object2({ channels: list2(object2({ channelId: uuid,
2375
2519
  unique(v.channels.map((c) => c.channelId), p + ".channels");
2376
2520
  for (const c of v.channels) unique(c.resourceRuleRefs.map((ref) => ref.id), p + ".resourceRuleRefs");
2377
2521
  });
2378
- var mandateDraftRequest = object2({ expectedRevision: integer2(1), allowedOperations: mandateAllowedOperations, expiresAt: instant, websiteVisitFeedSelection: optional2(feedSelection), providerReporting: optional2(providerReportingSelection) });
2522
+ var mandateDraftRequest = object2({ expectedRevision: integer2(1), allowedOperations: mandateAllowedOperations, expiresAt: instant, websiteVisitFeedSelection: optional2(feedSelection), providerReporting: optional2(providerReportingSelection), operatingPolicySelection: optional2(operatingPolicySelection), activation: optional2(literal2("operating_policy")) });
2379
2523
  var parseResonanceMandateDraftRequest = (v) => mandateDraftRequest.read(v, "mandateDraftRequest");
2380
2524
  var RESONANCE_MANDATE_DRAFT_REQUEST_JSON_SCHEMA = mandateDraftRequest.schema;
2381
2525
  var feedReview = object2({ schemaVersion: literal2(1), approval: mandateApproval, mandateRef, configurations: list2(metaSnapshot, 100), current: object2({ state: choice2("not_enabled", "eligible", "invalidated", "unavailable"), checkedAt: instant, expiresAt: nullable2(instant), reasonCodes: uniqueList(text2(200), 100) }) });
@@ -2685,4 +2829,4 @@ function deriveProviderRatios(items) {
2685
2829
  return { frequency, costPerResult, reasonCodes: reasons };
2686
2830
  }
2687
2831
 
2688
- export { MAX_MONEY_MICROS, META_AUDIENCE_RULE_LIMIT, META_CALL_TO_ACTIONS, META_SAC_CUSTOM_AUDIENCE_EXCLUSION_VERIFIED, META_WEBSITE_AUDIENCE_MAX_RETENTION_DAYS, MONEY_EXPONENT, MONEY_JSON_SCHEMA, RESONANCE_ACCEPT_COMMAND_JSON_SCHEMA, RESONANCE_ACCOUNT_CAPABILITY_JSON_SCHEMA, RESONANCE_ATTRIBUTION_MODEL, RESONANCE_AUDIENCE_DRAFT_SAVE_COMMAND_JSON_SCHEMA, RESONANCE_AUDIENCE_RULE_REF_JSON_SCHEMA, RESONANCE_BINDING_COMMAND_JSON_SCHEMA, RESONANCE_CAMPAIGN_DEFINITION_JSON_SCHEMA, RESONANCE_CAMPAIGN_DRAFT_JSON_SCHEMA, RESONANCE_CAMPAIGN_VIEW_JSON_SCHEMA, RESONANCE_CLICK_IDENTIFIERS_JSON_SCHEMA, RESONANCE_COMMAND_JSON_SCHEMA, RESONANCE_COMMAND_PREPARE_REQUEST_JSON_SCHEMA, RESONANCE_COMMAND_PREPARE_RESPONSE_JSON_SCHEMA, RESONANCE_CONSENT_JSON_SCHEMA, RESONANCE_CONSENT_RESPONSE_JSON_SCHEMA, RESONANCE_CONSENT_UPDATE_JSON_SCHEMA, RESONANCE_CONVERSION_JSON_SCHEMA, RESONANCE_CPQL_UNCERTAINTY_METHOD, RESONANCE_CURRENCIES, RESONANCE_EXPERIMENT_COMPLETE_COMMAND_JSON_SCHEMA, RESONANCE_EXPERIMENT_CREATE_COMMAND_JSON_SCHEMA, RESONANCE_EXPERIMENT_LIFECYCLE_COMMAND_JSON_SCHEMA, RESONANCE_EXPERIMENT_LINK_COMMAND_JSON_SCHEMA, RESONANCE_EXPERIMENT_REF_JSON_SCHEMA, RESONANCE_EXPERIMENT_UPDATE_COMMAND_JSON_SCHEMA, RESONANCE_GOOGLE_CONFIGURATION_REVIEW_JSON_SCHEMA, RESONANCE_GOOGLE_CONFIGURATION_SAVE_COMMAND_JSON_SCHEMA, RESONANCE_GOOGLE_CONFIGURATION_SAVE_RESPONSE_JSON_SCHEMA, RESONANCE_GOOGLE_CONFIGURATION_SNAPSHOT_JSON_SCHEMA, RESONANCE_GOOGLE_CONFIGURATION_VIEW_JSON_SCHEMA, RESONANCE_GOOGLE_SETUP_SPEC_JSON_SCHEMA, RESONANCE_GOOGLE_SIGNAL_SEMANTICS, RESONANCE_GOOGLE_SOURCE_CATEGORIES, RESONANCE_MANDATE_ACTION_KIND, RESONANCE_MANDATE_APPROVAL_JSON_SCHEMA, RESONANCE_MANDATE_DRAFT_REQUEST_JSON_SCHEMA, RESONANCE_MANDATE_REF_JSON_SCHEMA, RESONANCE_MANDATE_SCOPE_JSON_SCHEMA, RESONANCE_MANDATE_TARGET_JSON_SCHEMA, RESONANCE_MAX_CHANNELS_PER_GROUP, RESONANCE_MEASUREMENT_CONFIGURATION_CURRENT_JSON_SCHEMA, RESONANCE_MEASUREMENT_CONFIGURATION_SAVE_COMMAND_JSON_SCHEMA, RESONANCE_MEASUREMENT_CONFIGURATION_SAVE_RESPONSE_JSON_SCHEMA, RESONANCE_MEASUREMENT_CONFIGURATION_SNAPSHOT_JSON_SCHEMA, RESONANCE_MEASUREMENT_CONFIG_JSON_SCHEMA, RESONANCE_MEASUREMENT_OCCURRENCE_JSON_SCHEMA, RESONANCE_META_AUDIENCE_REASONS, RESONANCE_META_AUDIENCE_SETUP_LIST_JSON_SCHEMA, RESONANCE_META_AUDIENCE_SETUP_PREPARE_REQUEST_JSON_SCHEMA, RESONANCE_META_AUDIENCE_SETUP_READINESS_JSON_SCHEMA, RESONANCE_META_AUDIENCE_SETUP_RECEIPT_JSON_SCHEMA, RESONANCE_META_AUDIENCE_SETUP_REVIEW_JSON_SCHEMA, RESONANCE_META_AUDIENCE_SETUP_STATUS_JSON_SCHEMA, RESONANCE_META_AUDIENCE_VERDICTS, RESONANCE_META_CONFIGURATION_SAVE_COMMAND_JSON_SCHEMA, RESONANCE_META_CONFIGURATION_SAVE_RESPONSE_JSON_SCHEMA, RESONANCE_META_CONFIGURATION_SNAPSHOT_JSON_SCHEMA, RESONANCE_META_CONFIGURATION_VIEW_JSON_SCHEMA, RESONANCE_META_DATASET_NAME_MAX_LENGTH, RESONANCE_META_DATASET_SELECTION_REQUEST_JSON_SCHEMA, RESONANCE_META_DATASET_SELECTION_WITNESS_JSON_SCHEMA, RESONANCE_META_DATASET_SETUP_PREPARE_REQUEST_JSON_SCHEMA, RESONANCE_META_DATASET_SETUP_RECEIPT_JSON_SCHEMA, RESONANCE_META_DATASET_SETUP_REVIEW_JSON_SCHEMA, RESONANCE_META_QUERY_ATTRIBUTION_WINDOWS, RESONANCE_META_RETARGETING_READINESS_JSON_SCHEMA, RESONANCE_METRIC_JSON_SCHEMA, RESONANCE_OBSERVATIONS_PAGE_JSON_SCHEMA, RESONANCE_OBSERVATION_SUPPORT_JSON_SCHEMA, RESONANCE_OCCURRENCE_RESPONSE_JSON_SCHEMA, RESONANCE_OPTIMIZATION_DECISION_JSON_SCHEMA, RESONANCE_OPTIMIZATION_EVIDENCE_JSON_SCHEMA, RESONANCE_OPTIMIZATION_POLICY_JSON_SCHEMA, RESONANCE_POSITIONING_APPLY_REQUEST_JSON_SCHEMA, RESONANCE_POSITIONING_CONSISTENCY_ASSESSMENT_JSON_SCHEMA, RESONANCE_POSITIONING_CONTEXT_JSON_SCHEMA, RESONANCE_POSITIONING_METHOD_VERSION, RESONANCE_POSITIONING_PREVIEW_JSON_SCHEMA, RESONANCE_POSITIONING_PREVIEW_REQUEST_JSON_SCHEMA, RESONANCE_POSITIONING_RESULT_JSON_SCHEMA, RESONANCE_PREPARED_PLAN_JSON_SCHEMA, RESONANCE_PROVIDER_METRIC_NAMES, RESONANCE_PROVIDER_REPORTING_GRANT_JSON_SCHEMA, RESONANCE_PROVIDER_REPORTING_SELECTION_JSON_SCHEMA, RESONANCE_PUBLIC_OBSERVATION_METRIC_JSON_SCHEMA, RESONANCE_QUALIFICATION_RULE_JSON_SCHEMA, RESONANCE_RECEIPT_JSON_SCHEMA, RESONANCE_RESOLVED_QUALIFICATION_RULE_JSON_SCHEMA, RESONANCE_RESOURCE_REF_JSON_SCHEMA, RESONANCE_SAVE_COMMAND_JSON_SCHEMA, RESONANCE_SCHEMA_VERSION, RESONANCE_SOURCE_MARKER_JSON_SCHEMA, RESONANCE_SOURCE_MARKER_PARAMETER, RESONANCE_SUBJECT_HEADER, RESONANCE_SUBJECT_RENEW_COMMAND_JSON_SCHEMA, RESONANCE_WEBSITE_VISIT_FEED_JSON_SCHEMA, RESONANCE_WEBSITE_VISIT_FEED_REVIEW_JSON_SCHEMA, RESONANCE_WEBSITE_VISIT_PROFILE, RESONANCE_WEBSITE_VISIT_SETUP_DELIVERY_COMMAND_JSON_SCHEMA, RESONANCE_WEBSITE_VISIT_SETUP_GRANT_ACCEPTED_VISITS_JSON_SCHEMA, RESONANCE_WEBSITE_VISIT_SETUP_GRANT_PROOF_JSON_SCHEMA, RESONANCE_WEBSITE_VISIT_SETUP_GRANT_STATUS_JSON_SCHEMA, ResonanceValidationError, addMoney, checkAudienceBand, checkChannelGroups, compareMoney, cpqlMissingOutcomeBound, deriveProviderRatios, expandPropertyChannels, formatMoney, googleConversionActionSemantics, googleUploadClicksSetupSemantics, metaExclusionPolicy, moneyFromProviderUnits, moneyToProviderUnits, parseMoney, parseResonanceAcceptCommand, parseResonanceAccountCapability, parseResonanceAudienceDraftSaveCommand, parseResonanceAudienceRuleRef, parseResonanceBindingCommand, parseResonanceCampaignDefinition, parseResonanceCampaignDraft, parseResonanceCampaignSaveCommand, parseResonanceCampaignView, parseResonanceClickIdentifiers, parseResonanceCommand, parseResonanceCommandPrepareRequest, parseResonanceCommandPrepareResponse, parseResonanceConsentResponse, parseResonanceConsentSnapshot, parseResonanceConsentUpdate, parseResonanceConversionEnvelope, parseResonanceExperimentCompleteCommand, parseResonanceExperimentCreateCommand, parseResonanceExperimentExposure, parseResonanceExperimentLifecycleCommand, parseResonanceExperimentLinkCommand, parseResonanceExperimentRef, parseResonanceExperimentUpdateCommand, parseResonanceGoogleConfigurationReview, parseResonanceGoogleConfigurationSaveCommand, parseResonanceGoogleConfigurationSaveResponse, parseResonanceGoogleConfigurationSnapshot, parseResonanceGoogleConfigurationView, parseResonanceGoogleUploadClicksCustomGoalSpec, parseResonanceMandateApprovalPayload, parseResonanceMandateDraftRequest, parseResonanceMandateRef, parseResonanceMandateScope, parseResonanceMandateTarget, parseResonanceMeasurementConfig, parseResonanceMeasurementConfigurationCurrent, parseResonanceMeasurementConfigurationSaveCommand, parseResonanceMeasurementConfigurationSaveResponse, parseResonanceMeasurementConfigurationSnapshot, parseResonanceMeasurementOccurrence, parseResonanceMetaAudienceSetupIntent, parseResonanceMetaAudienceSetupList, parseResonanceMetaAudienceSetupPrepareRequest, parseResonanceMetaAudienceSetupReadiness, parseResonanceMetaAudienceSetupReceipt, parseResonanceMetaAudienceSetupReview, parseResonanceMetaAudienceSetupStatus, parseResonanceMetaConfigurationSaveCommand, parseResonanceMetaConfigurationSaveResponse, parseResonanceMetaConfigurationSnapshot, parseResonanceMetaConfigurationView, parseResonanceMetaDatasetName, parseResonanceMetaDatasetSelectionRequest, parseResonanceMetaDatasetSelectionWitness, parseResonanceMetaDatasetSetupIntent, parseResonanceMetaDatasetSetupPrepareRequest, parseResonanceMetaDatasetSetupReceipt, parseResonanceMetaDatasetSetupReview, parseResonanceMetaRetargetingReadiness, parseResonanceMetricObservation, parseResonanceObservationSupport, parseResonanceObservationsPage, parseResonanceOccurrenceResponse, parseResonanceOptimizationDecision, parseResonanceOptimizationEvidence, parseResonanceOptimizationPolicy, parseResonancePositioningApplyRequest, parseResonancePositioningConsistencyAssessment, parseResonancePositioningContext, parseResonancePositioningPreview, parseResonancePositioningPreviewRequest, parseResonancePositioningResult, parseResonancePrepareCommand, parseResonancePreparedPlan, parseResonanceProviderReportingGrant, parseResonanceProviderReportingSelection, parseResonancePublicObservationMetric, parseResonanceQualificationRule, parseResonanceReceipt, parseResonanceResolvedQualificationRule, parseResonanceResourceRef, parseResonanceSourceMarker, parseResonanceSubjectRenewCommand, parseResonanceWebsiteVisitFeedReview, parseResonanceWebsiteVisitSetupDeliveryCommand, parseResonanceWebsiteVisitSetupGrant, parseResonanceWebsiteVisitSetupGrantAcceptedVisits, parseResonanceWebsiteVisitSetupGrantProof, parseResonanceWebsiteVisitSetupGrantStatus, parseResonanceWebsiteVisitSetupOrigin, projectResonanceGoogleConfiguration, projectResonanceMeasurementConfiguration, projectResonanceMetaConfiguration, projectResonancePositioningConsistencyEvidence, reportedCpqlMissingOutcomeBound, resonanceCommandDigestInput, resonanceGoogleConfigurationDigestInput, resonanceGoogleSetupDigestInput, resonanceMandateDigestInput, resonanceMeasurementConfigDigestInput, resonanceMeasurementConfigurationSaveDigestInput, resonanceMetaAudienceSetupDigestInput, resonanceMetaAudienceSetupReceiptDigestInput, resonanceMetaConfigurationDigestInput, resonanceMetaConfigurationSaveDigestInput, resonanceMetaDatasetSetupDigestInput, resonanceOptimizationDecisionDigestInput, resonanceOptimizationEvidenceDigestInput, resonanceOptimizationPolicyDigestInput, resonancePlanIssues, resonancePositioningConsistencyEvidenceDigestInput, resonancePositioningContextDigestInput, resonancePositioningEvidenceDigestInput, resonancePositioningResultDigestInput, resonanceWebsiteVisitEventTime, resonanceWebsiteVisitProfileDigestInput, resonanceWebsiteVisitSetupDeliveryDigestInput, resonanceWebsiteVisitSetupEventTime, splitBudget, subtractMoney, suggestPropertyWeights };
2832
+ export { MAX_MONEY_MICROS, META_AUDIENCE_RULE_LIMIT, META_CALL_TO_ACTIONS, META_SAC_CUSTOM_AUDIENCE_EXCLUSION_VERIFIED, META_WEBSITE_AUDIENCE_MAX_RETENTION_DAYS, MONEY_EXPONENT, MONEY_JSON_SCHEMA, RESONANCE_ACCEPT_COMMAND_JSON_SCHEMA, RESONANCE_ACCOUNT_CAPABILITY_JSON_SCHEMA, RESONANCE_ATTRIBUTION_MODEL, RESONANCE_AUDIENCE_DRAFT_SAVE_COMMAND_JSON_SCHEMA, RESONANCE_AUDIENCE_RULE_REF_JSON_SCHEMA, RESONANCE_BINDING_COMMAND_JSON_SCHEMA, RESONANCE_CAMPAIGN_DEFINITION_JSON_SCHEMA, RESONANCE_CAMPAIGN_DRAFT_JSON_SCHEMA, RESONANCE_CAMPAIGN_VIEW_JSON_SCHEMA, RESONANCE_CLICK_IDENTIFIERS_JSON_SCHEMA, RESONANCE_COMMAND_JSON_SCHEMA, RESONANCE_COMMAND_PREPARE_REQUEST_JSON_SCHEMA, RESONANCE_COMMAND_PREPARE_RESPONSE_JSON_SCHEMA, RESONANCE_CONSENT_JSON_SCHEMA, RESONANCE_CONSENT_RESPONSE_JSON_SCHEMA, RESONANCE_CONSENT_UPDATE_JSON_SCHEMA, RESONANCE_CONVERSION_JSON_SCHEMA, RESONANCE_CPQL_UNCERTAINTY_METHOD, RESONANCE_CURRENCIES, RESONANCE_EXPERIMENT_COMPLETE_COMMAND_JSON_SCHEMA, RESONANCE_EXPERIMENT_CREATE_COMMAND_JSON_SCHEMA, RESONANCE_EXPERIMENT_LIFECYCLE_COMMAND_JSON_SCHEMA, RESONANCE_EXPERIMENT_LINK_COMMAND_JSON_SCHEMA, RESONANCE_EXPERIMENT_REF_JSON_SCHEMA, RESONANCE_EXPERIMENT_UPDATE_COMMAND_JSON_SCHEMA, RESONANCE_GOOGLE_CONFIGURATION_REVIEW_JSON_SCHEMA, RESONANCE_GOOGLE_CONFIGURATION_SAVE_COMMAND_JSON_SCHEMA, RESONANCE_GOOGLE_CONFIGURATION_SAVE_RESPONSE_JSON_SCHEMA, RESONANCE_GOOGLE_CONFIGURATION_SNAPSHOT_JSON_SCHEMA, RESONANCE_GOOGLE_CONFIGURATION_VIEW_JSON_SCHEMA, RESONANCE_GOOGLE_CONTENT_UPDATE_JSON_SCHEMA, RESONANCE_GOOGLE_CONTENT_UPDATE_SELECTION_JSON_SCHEMA, RESONANCE_GOOGLE_SETUP_SPEC_JSON_SCHEMA, RESONANCE_GOOGLE_SIGNAL_SEMANTICS, RESONANCE_GOOGLE_SOURCE_CATEGORIES, RESONANCE_MANDATE_ACTION_KIND, RESONANCE_MANDATE_APPROVAL_JSON_SCHEMA, RESONANCE_MANDATE_DRAFT_REQUEST_JSON_SCHEMA, RESONANCE_MANDATE_REF_JSON_SCHEMA, RESONANCE_MANDATE_SCOPE_JSON_SCHEMA, RESONANCE_MANDATE_TARGET_JSON_SCHEMA, RESONANCE_MAX_CHANNELS_PER_GROUP, RESONANCE_MEASUREMENT_CONFIGURATION_CURRENT_JSON_SCHEMA, RESONANCE_MEASUREMENT_CONFIGURATION_SAVE_COMMAND_JSON_SCHEMA, RESONANCE_MEASUREMENT_CONFIGURATION_SAVE_RESPONSE_JSON_SCHEMA, RESONANCE_MEASUREMENT_CONFIGURATION_SNAPSHOT_JSON_SCHEMA, RESONANCE_MEASUREMENT_CONFIG_JSON_SCHEMA, RESONANCE_MEASUREMENT_OCCURRENCE_JSON_SCHEMA, RESONANCE_META_AUDIENCE_REASONS, RESONANCE_META_AUDIENCE_SETUP_LIST_JSON_SCHEMA, RESONANCE_META_AUDIENCE_SETUP_PREPARE_REQUEST_JSON_SCHEMA, RESONANCE_META_AUDIENCE_SETUP_READINESS_JSON_SCHEMA, RESONANCE_META_AUDIENCE_SETUP_RECEIPT_JSON_SCHEMA, RESONANCE_META_AUDIENCE_SETUP_REVIEW_JSON_SCHEMA, RESONANCE_META_AUDIENCE_SETUP_STATUS_JSON_SCHEMA, RESONANCE_META_AUDIENCE_VERDICTS, RESONANCE_META_CONFIGURATION_SAVE_COMMAND_JSON_SCHEMA, RESONANCE_META_CONFIGURATION_SAVE_RESPONSE_JSON_SCHEMA, RESONANCE_META_CONFIGURATION_SNAPSHOT_JSON_SCHEMA, RESONANCE_META_CONFIGURATION_VIEW_JSON_SCHEMA, RESONANCE_META_DATASET_NAME_MAX_LENGTH, RESONANCE_META_DATASET_SELECTION_REQUEST_JSON_SCHEMA, RESONANCE_META_DATASET_SELECTION_WITNESS_JSON_SCHEMA, RESONANCE_META_DATASET_SETUP_PREPARE_REQUEST_JSON_SCHEMA, RESONANCE_META_DATASET_SETUP_RECEIPT_JSON_SCHEMA, RESONANCE_META_DATASET_SETUP_REVIEW_JSON_SCHEMA, RESONANCE_META_QUERY_ATTRIBUTION_WINDOWS, RESONANCE_META_RETARGETING_READINESS_JSON_SCHEMA, RESONANCE_METRIC_JSON_SCHEMA, RESONANCE_OBSERVATIONS_PAGE_JSON_SCHEMA, RESONANCE_OBSERVATION_SUPPORT_JSON_SCHEMA, RESONANCE_OCCURRENCE_RESPONSE_JSON_SCHEMA, RESONANCE_OPERATING_POLICY_BASE_JSON_SCHEMA, RESONANCE_OPERATING_POLICY_JSON_SCHEMA, RESONANCE_OPERATING_POLICY_REF_JSON_SCHEMA, RESONANCE_OPERATING_POLICY_SELECTION_JSON_SCHEMA, RESONANCE_OPTIMIZATION_DECISION_JSON_SCHEMA, RESONANCE_OPTIMIZATION_EVIDENCE_JSON_SCHEMA, RESONANCE_OPTIMIZATION_POLICY_JSON_SCHEMA, RESONANCE_POSITIONING_APPLY_REQUEST_JSON_SCHEMA, RESONANCE_POSITIONING_CONSISTENCY_ASSESSMENT_JSON_SCHEMA, RESONANCE_POSITIONING_CONTEXT_JSON_SCHEMA, RESONANCE_POSITIONING_METHOD_VERSION, RESONANCE_POSITIONING_PREVIEW_JSON_SCHEMA, RESONANCE_POSITIONING_PREVIEW_REQUEST_JSON_SCHEMA, RESONANCE_POSITIONING_RESULT_JSON_SCHEMA, RESONANCE_PREPARED_PLAN_JSON_SCHEMA, RESONANCE_PROVIDER_METRIC_NAMES, RESONANCE_PROVIDER_REPORTING_GRANT_JSON_SCHEMA, RESONANCE_PROVIDER_REPORTING_MAX_TAIL_DAYS, RESONANCE_PROVIDER_REPORTING_SELECTION_JSON_SCHEMA, RESONANCE_PUBLIC_OBSERVATION_METRIC_JSON_SCHEMA, RESONANCE_QUALIFICATION_RULE_JSON_SCHEMA, RESONANCE_RECEIPT_JSON_SCHEMA, RESONANCE_RESOLVED_QUALIFICATION_RULE_JSON_SCHEMA, RESONANCE_RESOURCE_REF_JSON_SCHEMA, RESONANCE_SAVE_COMMAND_JSON_SCHEMA, RESONANCE_SCHEMA_VERSION, RESONANCE_SOURCE_MARKER_JSON_SCHEMA, RESONANCE_SOURCE_MARKER_PARAMETER, RESONANCE_SUBJECT_HEADER, RESONANCE_SUBJECT_RENEW_COMMAND_JSON_SCHEMA, RESONANCE_WEBSITE_VISIT_FEED_JSON_SCHEMA, RESONANCE_WEBSITE_VISIT_FEED_REVIEW_JSON_SCHEMA, RESONANCE_WEBSITE_VISIT_PROFILE, RESONANCE_WEBSITE_VISIT_SETUP_DELIVERY_COMMAND_JSON_SCHEMA, RESONANCE_WEBSITE_VISIT_SETUP_GRANT_ACCEPTED_VISITS_JSON_SCHEMA, RESONANCE_WEBSITE_VISIT_SETUP_GRANT_PROOF_JSON_SCHEMA, RESONANCE_WEBSITE_VISIT_SETUP_GRANT_STATUS_JSON_SCHEMA, ResonanceValidationError, addMoney, checkAudienceBand, checkChannelGroups, compareMoney, cpqlMissingOutcomeBound, deriveProviderRatios, expandPropertyChannels, formatMoney, googleConversionActionSemantics, googleUploadClicksSetupSemantics, metaExclusionPolicy, moneyFromProviderUnits, moneyToProviderUnits, normalizeResonanceGoogleCriterionText, parseMoney, parseResonanceAcceptCommand, parseResonanceAccountCapability, parseResonanceAudienceDraftSaveCommand, parseResonanceAudienceRuleRef, parseResonanceBindingCommand, parseResonanceCampaignDefinition, parseResonanceCampaignDraft, parseResonanceCampaignSaveCommand, parseResonanceCampaignView, parseResonanceClickIdentifiers, parseResonanceCommand, parseResonanceCommandPrepareRequest, parseResonanceCommandPrepareResponse, parseResonanceConsentResponse, parseResonanceConsentSnapshot, parseResonanceConsentUpdate, parseResonanceConversionEnvelope, parseResonanceExperimentCompleteCommand, parseResonanceExperimentCreateCommand, parseResonanceExperimentExposure, parseResonanceExperimentLifecycleCommand, parseResonanceExperimentLinkCommand, parseResonanceExperimentRef, parseResonanceExperimentUpdateCommand, parseResonanceGoogleConfigurationReview, parseResonanceGoogleConfigurationSaveCommand, parseResonanceGoogleConfigurationSaveResponse, parseResonanceGoogleConfigurationSnapshot, parseResonanceGoogleConfigurationView, parseResonanceGoogleContentUpdate, parseResonanceGoogleContentUpdateSelection, parseResonanceGoogleUploadClicksCustomGoalSpec, parseResonanceMandateApprovalPayload, parseResonanceMandateDraftRequest, parseResonanceMandateRef, parseResonanceMandateScope, parseResonanceMandateTarget, parseResonanceMeasurementConfig, parseResonanceMeasurementConfigurationCurrent, parseResonanceMeasurementConfigurationSaveCommand, parseResonanceMeasurementConfigurationSaveResponse, parseResonanceMeasurementConfigurationSnapshot, parseResonanceMeasurementOccurrence, parseResonanceMetaAudienceSetupIntent, parseResonanceMetaAudienceSetupList, parseResonanceMetaAudienceSetupPrepareRequest, parseResonanceMetaAudienceSetupReadiness, parseResonanceMetaAudienceSetupReceipt, parseResonanceMetaAudienceSetupReview, parseResonanceMetaAudienceSetupStatus, parseResonanceMetaConfigurationSaveCommand, parseResonanceMetaConfigurationSaveResponse, parseResonanceMetaConfigurationSnapshot, parseResonanceMetaConfigurationView, parseResonanceMetaDatasetName, parseResonanceMetaDatasetSelectionRequest, parseResonanceMetaDatasetSelectionWitness, parseResonanceMetaDatasetSetupIntent, parseResonanceMetaDatasetSetupPrepareRequest, parseResonanceMetaDatasetSetupReceipt, parseResonanceMetaDatasetSetupReview, parseResonanceMetaRetargetingReadiness, parseResonanceMetricObservation, parseResonanceObservationSupport, parseResonanceObservationsPage, parseResonanceOccurrenceResponse, parseResonanceOperatingPolicy, parseResonanceOperatingPolicyBase, parseResonanceOperatingPolicyRef, parseResonanceOperatingPolicySelection, parseResonanceOptimizationDecision, parseResonanceOptimizationEvidence, parseResonanceOptimizationPolicy, parseResonancePositioningApplyRequest, parseResonancePositioningConsistencyAssessment, parseResonancePositioningContext, parseResonancePositioningPreview, parseResonancePositioningPreviewRequest, parseResonancePositioningResult, parseResonancePrepareCommand, parseResonancePreparedPlan, parseResonanceProviderReportingGrant, parseResonanceProviderReportingSelection, parseResonancePublicObservationMetric, parseResonanceQualificationRule, parseResonanceReceipt, parseResonanceResolvedQualificationRule, parseResonanceResourceRef, parseResonanceSourceMarker, parseResonanceSubjectRenewCommand, parseResonanceWebsiteVisitFeedReview, parseResonanceWebsiteVisitSetupDeliveryCommand, parseResonanceWebsiteVisitSetupGrant, parseResonanceWebsiteVisitSetupGrantAcceptedVisits, parseResonanceWebsiteVisitSetupGrantProof, parseResonanceWebsiteVisitSetupGrantStatus, parseResonanceWebsiteVisitSetupOrigin, projectResonanceGoogleConfiguration, projectResonanceMeasurementConfiguration, projectResonanceMetaConfiguration, projectResonancePositioningConsistencyEvidence, reportedCpqlMissingOutcomeBound, resonanceCommandDigestInput, resonanceGoogleConfigurationDigestInput, resonanceGoogleSetupDigestInput, resonanceMandateDigestInput, resonanceMeasurementConfigDigestInput, resonanceMeasurementConfigurationSaveDigestInput, resonanceMetaAudienceSetupDigestInput, resonanceMetaAudienceSetupReceiptDigestInput, resonanceMetaConfigurationDigestInput, resonanceMetaConfigurationSaveDigestInput, resonanceMetaDatasetSetupDigestInput, resonanceOperatingPolicyActionDigestInput, resonanceOperatingPolicyDigestInput, resonanceOptimizationDecisionDigestInput, resonanceOptimizationEvidenceDigestInput, resonanceOptimizationPolicyDigestInput, resonancePlanIssues, resonancePositioningConsistencyEvidenceDigestInput, resonancePositioningContextDigestInput, resonancePositioningEvidenceDigestInput, resonancePositioningResultDigestInput, resonanceWebsiteVisitEventTime, resonanceWebsiteVisitProfileDigestInput, resonanceWebsiteVisitSetupDeliveryDigestInput, resonanceWebsiteVisitSetupEventTime, splitBudget, subtractMoney, suggestPropertyWeights };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sonordev/contracts",
3
- "version": "2.27.0",
3
+ "version": "2.28.0",
4
4
  "description": "The rules Sonor's sites, APIs and dashboard share: popup blocks and site design tokens, site hosts, SEO page identity, title quality, llms.txt sanitizers, shared form validation, fleet heartbeats, slot content and signing, site cache tags, portfolio metrics, the house voice's contraction rule, how a proposal's site plan counts its pages, what separates an error page from a page's content, which stored JSON-LD is a template's unfilled placeholder, where prose splits into sentences, which Sonor records Signal reads into a project's knowledge and the address each one is stored under, what outbound email and text may claim about a business and whether a sent email arrived intact, what a segment of outreach is and who may turn one on, a page's own name taken from its title or its slug, which Broadcast card layouts and review compositions are drawn and what a retired one draws as, what a publication's branding may hold, which literal hosts are refused as public fetch destinations, which inbox cards are decisions a bulk action leaves alone, what a rep's call outcome (positive, negative or left voicemail) changes on a prospect, which buying role a job title says (owner, decision maker, influencer or gatekeeper), and what a booking may ask a guest about their business. Pure functions, no dependencies.",
5
5
  "license": "MIT",
6
6
  "repository": {