@sonordev/contracts 2.25.0 → 2.27.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.
@@ -0,0 +1,131 @@
1
+ // src/contracts/quote-screen.ts
2
+ var QUOTE_MAX_LENGTH = 1e3;
3
+
4
+ // src/contracts/resonance-confirmation.ts
5
+ var CONFIRMATION_CODE_DIGITS = 6;
6
+ var CONFIRMATION_MINUTES = 10;
7
+ var CONFIRMATION_MAX_TRIES = 5;
8
+ var CONFIRMATION_PER_HOUR = 3;
9
+ var CONFIRMATION_PER_HOUR_ANY_PROJECT = 6;
10
+ var CONFIRMATION_PER_DAY = 15;
11
+ var CONFIRMATION_MIN_PLAN_MINUTES = 2;
12
+ var CONFIRMATION_LOCKS_PER_DAY = 3;
13
+ var CONFIRMATION_RETRY_MAX_SECONDS = 86400;
14
+ var CONFIRMATION_CONTRACT = "resonance-confirmation/1";
15
+ var ON_THEIR_WORD_CHANNEL = "mcp_chat";
16
+ var ON_THEIR_WORD_CONFIRMATION_CHANNEL = "email";
17
+ var ON_THEIR_WORD_QUOTE_MAX = QUOTE_MAX_LENGTH;
18
+ var CONFIRMATION_REQUEST_ROUTE = "campaigns/:campaignId/plans/:planId/mandate-confirmation";
19
+ var CONFIRMATION_REDEEM_ROUTE = "campaigns/:campaignId/mandate-confirmation/redeem";
20
+ function confirmationRequestPath(projectId, campaignId, planId) {
21
+ return `resonance/projects/${projectId}/campaigns/${campaignId}/plans/${planId}/mandate-confirmation`;
22
+ }
23
+ function confirmationRedeemPath(projectId, campaignId) {
24
+ return `resonance/projects/${projectId}/campaigns/${campaignId}/mandate-confirmation/redeem`;
25
+ }
26
+ var CONFIRMATION_MAIL_SUBJECT_TAG = "[Sonor budget confirmation]";
27
+ var CONFIRMATION_MAIL_HEADER = "X-Sonor-Confirmation";
28
+ var CONFIRMATION_MAIL_HEADER_VALUE = "resonance-mandate";
29
+ function isConfirmationMail(message) {
30
+ if (typeof message.subject === "string" && message.subject.includes(CONFIRMATION_MAIL_SUBJECT_TAG)) return true;
31
+ const headers = message.headers;
32
+ if (!headers) return false;
33
+ const wanted = CONFIRMATION_MAIL_HEADER.toLowerCase();
34
+ if (Array.isArray(headers)) return headers.some((h) => typeof h?.name === "string" && h.name.toLowerCase() === wanted && h.value === CONFIRMATION_MAIL_HEADER_VALUE);
35
+ return Object.entries(headers).some(([name, value]) => name.toLowerCase() === wanted && (Array.isArray(value) ? value.includes(CONFIRMATION_MAIL_HEADER_VALUE) : value === CONFIRMATION_MAIL_HEADER_VALUE));
36
+ }
37
+ var ConfirmationContractError = class extends Error {
38
+ constructor(message, failure = "invalid_request") {
39
+ super(message);
40
+ this.name = "ConfirmationContractError";
41
+ this.failure = failure;
42
+ }
43
+ };
44
+ var UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
45
+ var isUuid = (value) => typeof value === "string" && UUID.test(value);
46
+ var isRecord = (value) => !!value && typeof value === "object" && !Array.isArray(value);
47
+ function readConfirmationCode(typed) {
48
+ if (typeof typed !== "string" || typed.length > 32) return null;
49
+ const code = typed.replace(/[\s.\-–—]/g, "");
50
+ return new RegExp(`^\\d{${CONFIRMATION_CODE_DIGITS}}$`).test(code) ? code : null;
51
+ }
52
+ function parseConfirmationRedeemRequest(raw) {
53
+ if (!isRecord(raw) || Object.keys(raw).some((key) => !["confirmationId", "ledgerActionId", "code"].includes(key)) || !isUuid(raw.confirmationId) || !isUuid(raw.ledgerActionId)) {
54
+ throw new ConfirmationContractError("Pass the confirmation id, the ledger request it is for, and the six-digit code the person read back.");
55
+ }
56
+ const code = readConfirmationCode(raw.code);
57
+ if (code === null) throw new ConfirmationContractError("The code is six digits. Ask the person to read it back from the email.", "invalid_code");
58
+ return { confirmationId: raw.confirmationId.toLowerCase(), ledgerActionId: raw.ledgerActionId.toLowerCase(), code };
59
+ }
60
+ function parseConfirmationReceipt(raw) {
61
+ if (!isRecord(raw)) throw new ConfirmationContractError("The confirmation receipt is not an object.", "unavailable");
62
+ const { confirmationId, channel, sentTo, expiresAt, minutes, triesAllowed } = raw;
63
+ if (!isUuid(confirmationId) || channel !== ON_THEIR_WORD_CONFIRMATION_CHANNEL || typeof sentTo !== "string" || !/^[^\s@]{1,64}@[^\s@]{1,120}$/.test(sentTo) || typeof expiresAt !== "string" || !Number.isFinite(Date.parse(expiresAt)) || !Number.isSafeInteger(minutes) || minutes < 1 || minutes > 60 || !Number.isSafeInteger(triesAllowed) || triesAllowed < 1 || triesAllowed > 10) {
64
+ throw new ConfirmationContractError("The confirmation receipt is not the one the server sends.", "unavailable");
65
+ }
66
+ return { confirmationId: confirmationId.toLowerCase(), channel, sentTo, expiresAt, minutes, triesAllowed };
67
+ }
68
+ function parseConfirmationRedeemed(raw) {
69
+ const c = isRecord(raw) ? raw.confirmation : null;
70
+ if (!isRecord(c) || !isUuid(c.id) || c.channel !== ON_THEIR_WORD_CONFIRMATION_CHANNEL) throw new ConfirmationContractError("That is not a redeemed confirmation.", "unavailable");
71
+ return { confirmation: { id: c.id.toLowerCase(), channel: ON_THEIR_WORD_CONFIRMATION_CHANNEL } };
72
+ }
73
+ var ON_THEIR_WORD_EVIDENCE_KEYS = ["agent", "quote", "mandate_digest", "review_digest", "channel", "confirmation"];
74
+ var DIGEST = /^[a-f0-9]{64}$/;
75
+ var CONTROL = /[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/;
76
+ function parseOnTheirWordEvidence(value) {
77
+ if (!isRecord(value) || Object.keys(value).length !== ON_THEIR_WORD_EVIDENCE_KEYS.length) return null;
78
+ const { agent, quote, mandate_digest: mandate, review_digest: review, channel, confirmation } = value;
79
+ if (channel !== ON_THEIR_WORD_CHANNEL || typeof agent !== "string" || !isUuid(agent) || agent !== agent.toLowerCase() || typeof quote !== "string" || CONTROL.test(quote) || quote !== quote.trim() || quote.length > ON_THEIR_WORD_QUOTE_MAX || !/[\p{L}\p{N}]/u.test(quote) || typeof mandate !== "string" || !DIGEST.test(mandate) || typeof review !== "string" || !DIGEST.test(review)) return null;
80
+ if (!isRecord(confirmation) || Object.keys(confirmation).length !== 2 || !isUuid(confirmation.id) || confirmation.id !== confirmation.id.toLowerCase() || confirmation.channel !== ON_THEIR_WORD_CONFIRMATION_CHANNEL) return null;
81
+ return { agent, quote, mandate_digest: mandate, review_digest: review, channel, confirmation: { id: confirmation.id, channel: ON_THEIR_WORD_CONFIRMATION_CHANNEL } };
82
+ }
83
+ var CONFIRMATION_REFUSALS = {
84
+ RESONANCE_CONFIRMATION_COMMAND: { status: 400, failure: "invalid_request", message: "That confirmation request was malformed. Ask for a new code." },
85
+ RESONANCE_INVALID_CONFIRMATION: { status: 400, failure: "invalid_request", message: "Pass the confirmation id, the ledger request it is for, and the six-digit code the person read back." },
86
+ RESONANCE_INVALID_CONFIRMATION_CODE: { status: 400, failure: "invalid_code", message: "The code is six digits. Ask the person to read it back from the email." },
87
+ RESONANCE_QUOTE_TOO_LONG: { status: 400, failure: "quote_too_long", message: "Pass only the sentence where they said yes, in 1,000 characters or fewer." },
88
+ RESONANCE_QUOTE_HAS_SECRET: { status: 400, failure: "quote_has_secret", message: "That quote looks like it holds a key, password or card number. Pass only the sentence where they said yes, without it." },
89
+ RESONANCE_CONFIRMATION_REFUSED: { status: 403, failure: "refused", message: "That code can't be used for this budget. Ask for a new one." },
90
+ RESONANCE_CONFIRMATION_STANDING: { status: 403, failure: "not_allowed", message: "Only an owner or admin who can approve this budget can be asked to confirm it." },
91
+ RESONANCE_CONFIRMATION_AGENT: { status: 403, failure: "not_allowed", message: "This agent wasn't set up by the person it acts for. They need to create their own agent token in Sonor first." },
92
+ RESONANCE_CONFIRMATION_LOCKED: { status: 403, failure: "locked", message: "Too many wrong tries. Ask for a new code." },
93
+ RESONANCE_CONFIRMATION_WRONG_CODE: { status: 403, failure: "wrong_code", message: "That's not the code." },
94
+ RESONANCE_CONFIRMATION_EXPIRED: { status: 409, failure: "expired", message: "That code has expired. Ask for a new one." },
95
+ RESONANCE_CONFIRMATION_USED: { status: 409, failure: "used", message: "That code was already used for another budget. Ask for a new one." },
96
+ RESONANCE_CONFIRMATION_NO_VERIFIED_EMAIL: { status: 409, failure: "no_verified_email", message: "This person has no verified login email in Sonor, so a code can't be sent. They can approve the budget in Sonor instead." },
97
+ RESONANCE_CONFIRMATION_MAILBOX_AUTOMATED: { status: 409, failure: "mailbox_automated", message: "This person's login email is a mailbox Sonor reads for automation, so a code can't be sent there. They can approve the budget in Sonor instead." },
98
+ RESONANCE_CONFIRMATION_PLAN_EXPIRING: { status: 409, failure: "plan_expiring", message: "The prepared plan is about to expire, so a code could not be used in time. Prepare the plan again, then ask for a code." },
99
+ // The one limit the first version of the confirmation SQL answers with. The lockout version replaces it with the hourly and daily answers below; it stays here so
100
+ // a build of this table still reads the older SQL during the window between the two, and an older reader still takes any of the three as a 429.
101
+ RESONANCE_CONFIRMATION_RATE: { status: 429, failure: "rate_limited", message: "Too many confirmation emails for this person. Try again in an hour, or approve the budget in Sonor." },
102
+ RESONANCE_CONFIRMATION_RATE_HOURLY: { status: 429, failure: "rate_limited", message: "Too many confirmation emails for this person in the last hour. Ask again later, or approve the budget in Sonor." },
103
+ RESONANCE_CONFIRMATION_RATE_DAILY: { status: 429, failure: "rate_limited_daily", message: "Too many confirmation emails for this person today. Ask again later, or approve the budget in Sonor." },
104
+ RESONANCE_CONFIRMATION_PERSON_LOCKED: { status: 429, failure: "person_locked", message: "Several of this person's codes were locked by wrong tries today, so no new code will be sent for now. They can approve the budget in Sonor." },
105
+ RESONANCE_CONFIRMATION_EMAIL_FAILED: { status: 503, failure: "send_failed", message: "We couldn't send the code by email, so no code is active. Try again in a moment, or have the person approve the budget in Sonor." }
106
+ };
107
+ function confirmationWaitWords(seconds) {
108
+ if (typeof seconds !== "number" || !Number.isSafeInteger(seconds) || seconds < 1) return "a while";
109
+ const minutes = Math.ceil(seconds / 60);
110
+ if (minutes <= 1) return "a minute";
111
+ if (minutes < 60) return `about ${minutes} minutes`;
112
+ const hours = Math.ceil(minutes / 60);
113
+ return hours === 1 ? "about an hour" : `about ${hours} hours`;
114
+ }
115
+ function confirmationFailureOf(status, body) {
116
+ const record = isRecord(body) ? body : {};
117
+ const inner = isRecord(record.error) ? record.error : record;
118
+ const code = typeof inner.code === "string" ? inner.code : "";
119
+ const known = Object.prototype.hasOwnProperty.call(CONFIRMATION_REFUSALS, code) ? code : null;
120
+ const data = isRecord(inner.data) ? inner.data : {};
121
+ const left = data.attemptsLeft;
122
+ const attemptsLeft = known === "RESONANCE_CONFIRMATION_WRONG_CODE" && Number.isSafeInteger(left) && left >= 0 && left <= CONFIRMATION_MAX_TRIES ? left : null;
123
+ const wait = data.retryAfterSeconds;
124
+ const retryAfterSeconds = (known === "RESONANCE_CONFIRMATION_RATE_HOURLY" || known === "RESONANCE_CONFIRMATION_RATE_DAILY" || known === "RESONANCE_CONFIRMATION_PERSON_LOCKED") && Number.isSafeInteger(wait) && wait >= 1 && wait <= CONFIRMATION_RETRY_MAX_SECONDS ? wait : null;
125
+ if (known === "RESONANCE_CONFIRMATION_WRONG_CODE" && attemptsLeft === 0) return { failure: "locked", attemptsLeft: 0, code: known, retryAfterSeconds: null };
126
+ if (known) return { failure: CONFIRMATION_REFUSALS[known].failure, attemptsLeft, code: known, retryAfterSeconds };
127
+ if (status === 429) return { failure: "rate_limited", attemptsLeft: null, code: null, retryAfterSeconds: null };
128
+ return { failure: "unavailable", attemptsLeft: null, code: null, retryAfterSeconds: null };
129
+ }
130
+
131
+ export { CONFIRMATION_CODE_DIGITS, CONFIRMATION_CONTRACT, CONFIRMATION_LOCKS_PER_DAY, CONFIRMATION_MAIL_HEADER, CONFIRMATION_MAIL_HEADER_VALUE, CONFIRMATION_MAIL_SUBJECT_TAG, CONFIRMATION_MAX_TRIES, CONFIRMATION_MINUTES, CONFIRMATION_MIN_PLAN_MINUTES, CONFIRMATION_PER_DAY, CONFIRMATION_PER_HOUR, CONFIRMATION_PER_HOUR_ANY_PROJECT, CONFIRMATION_REDEEM_ROUTE, CONFIRMATION_REFUSALS, CONFIRMATION_REQUEST_ROUTE, CONFIRMATION_RETRY_MAX_SECONDS, ConfirmationContractError, ON_THEIR_WORD_CHANNEL, ON_THEIR_WORD_CONFIRMATION_CHANNEL, ON_THEIR_WORD_EVIDENCE_KEYS, ON_THEIR_WORD_QUOTE_MAX, confirmationFailureOf, confirmationRedeemPath, confirmationRequestPath, confirmationWaitWords, isConfirmationMail, parseConfirmationReceipt, parseConfirmationRedeemRequest, parseConfirmationRedeemed, parseOnTheirWordEvidence, readConfirmationCode };
@@ -85,7 +85,9 @@ declare const resolvedQualificationRule: Field<{
85
85
  endAt: string;
86
86
  maturityDelaySeconds: number;
87
87
  } & {};
88
- } & {}>;
88
+ } & {
89
+ eligibleBookingTypeIds?: string[] | undefined;
90
+ }>;
89
91
  export type ResonanceResolvedQualificationRule = Value<typeof resolvedQualificationRule>;
90
92
  /** Actual native snapshot shape only; the server verifies its source/config digest. */
91
93
  export declare const parseResonanceResolvedQualificationRule: (v: unknown) => ResonanceResolvedQualificationRule;
@@ -120,6 +122,7 @@ declare const objective: Field<{
120
122
  existingContactPolicy: "include_source_cohort";
121
123
  attributionModel: "first_party_last_touch_marker_v1";
122
124
  } & {}) | undefined;
125
+ eligibleBookingTypeIds?: string[] | undefined;
123
126
  }>;
124
127
  declare const destination: Field<({
125
128
  projectId: string;
@@ -577,6 +580,7 @@ declare const definition: Field<{
577
580
  existingContactPolicy: "include_source_cohort";
578
581
  attributionModel: "first_party_last_touch_marker_v1";
579
582
  } & {}) | undefined;
583
+ eligibleBookingTypeIds?: string[] | undefined;
580
584
  };
581
585
  brandRef: {
582
586
  projectId: string;
@@ -978,6 +982,7 @@ declare const draft: Field<{
978
982
  existingContactPolicy: "include_source_cohort";
979
983
  attributionModel: "first_party_last_touch_marker_v1";
980
984
  } & {}) | undefined;
985
+ eligibleBookingTypeIds?: string[] | undefined;
981
986
  }) | undefined;
982
987
  brandRef?: ({
983
988
  projectId: string;
@@ -1556,6 +1561,7 @@ declare const mandateScope: Field<{
1556
1561
  existingContactPolicy: "include_source_cohort";
1557
1562
  attributionModel: "first_party_last_touch_marker_v1";
1558
1563
  } & {}) | undefined;
1564
+ eligibleBookingTypeIds?: string[] | undefined;
1559
1565
  };
1560
1566
  allowedOperations: ("deliver_conversion" | "launch" | "optimize" | "resume" | "update")[];
1561
1567
  allowedTransformationRef: ({
@@ -2307,6 +2313,7 @@ declare const prepared: Field<{
2307
2313
  existingContactPolicy: "include_source_cohort";
2308
2314
  attributionModel: "first_party_last_touch_marker_v1";
2309
2315
  } & {}) | undefined;
2316
+ eligibleBookingTypeIds?: string[] | undefined;
2310
2317
  };
2311
2318
  brandRef: {
2312
2319
  projectId: string;
@@ -2810,7 +2817,9 @@ declare const prepared: Field<{
2810
2817
  endAt: string;
2811
2818
  maturityDelaySeconds: number;
2812
2819
  } & {};
2813
- } & {}) | null;
2820
+ } & {
2821
+ eligibleBookingTypeIds?: string[] | undefined;
2822
+ }) | null;
2814
2823
  accounts: ({
2815
2824
  id: string;
2816
2825
  projectId: string;
@@ -3177,6 +3186,7 @@ declare const view: Field<{
3177
3186
  existingContactPolicy: "include_source_cohort";
3178
3187
  attributionModel: "first_party_last_touch_marker_v1";
3179
3188
  } & {}) | undefined;
3189
+ eligibleBookingTypeIds?: string[] | undefined;
3180
3190
  }) | undefined;
3181
3191
  brandRef?: ({
3182
3192
  projectId: string;
@@ -3863,6 +3873,7 @@ declare const mandateApproval: Field<{
3863
3873
  existingContactPolicy: "include_source_cohort";
3864
3874
  attributionModel: "first_party_last_touch_marker_v1";
3865
3875
  } & {}) | undefined;
3876
+ eligibleBookingTypeIds?: string[] | undefined;
3866
3877
  };
3867
3878
  allowedOperations: ("deliver_conversion" | "launch" | "optimize" | "resume" | "update")[];
3868
3879
  allowedTransformationRef: ({
@@ -3923,6 +3934,252 @@ export declare function parseResonanceMandateApprovalPayload(v: unknown, target:
3923
3934
  export declare const resonanceMandateDigestInput: (v: unknown) => string;
3924
3935
  export declare const resonanceCommandDigestInput: (v: unknown) => string;
3925
3936
  export declare const parseResonanceMandateTarget: (v: unknown) => ResonanceMandateTarget;
3937
+ declare const positioningRequest: Field<{
3938
+ schemaVersion: 1;
3939
+ expectedRevision: number;
3940
+ site: string;
3941
+ target: ({
3942
+ kind: "broadcast";
3943
+ channelId: string;
3944
+ } & {}) | ({
3945
+ kind: "meta";
3946
+ channelId: string;
3947
+ creativeId: string;
3948
+ } & {}) | ({
3949
+ kind: "google_search";
3950
+ channelId: string;
3951
+ adGroupKey: string;
3952
+ adKey: string;
3953
+ } & {});
3954
+ } & {
3955
+ destination?: ({
3956
+ kind: "existing_page" | "funnel";
3957
+ id: string;
3958
+ } & {}) | undefined;
3959
+ offerId?: string | undefined;
3960
+ }>;
3961
+ declare const positioningContext: Field<{
3962
+ schemaVersion: 1;
3963
+ projectId: string;
3964
+ campaignId: string;
3965
+ request: {
3966
+ schemaVersion: 1;
3967
+ expectedRevision: number;
3968
+ site: string;
3969
+ target: ({
3970
+ kind: "broadcast";
3971
+ channelId: string;
3972
+ } & {}) | ({
3973
+ kind: "meta";
3974
+ channelId: string;
3975
+ creativeId: string;
3976
+ } & {}) | ({
3977
+ kind: "google_search";
3978
+ channelId: string;
3979
+ adGroupKey: string;
3980
+ adKey: string;
3981
+ } & {});
3982
+ } & {
3983
+ destination?: ({
3984
+ kind: "existing_page" | "funnel";
3985
+ id: string;
3986
+ } & {}) | undefined;
3987
+ offerId?: string | undefined;
3988
+ };
3989
+ observedAt: string;
3990
+ expiresAt: string;
3991
+ orgId: string;
3992
+ evidence: ({
3993
+ id: string;
3994
+ kind: "brain" | "buyer" | "funnel" | "offer" | "page" | "proof";
3995
+ sourceId: string;
3996
+ revision: string;
3997
+ observedAt: string;
3998
+ expiresAt: string;
3999
+ permission: "private" | "public";
4000
+ certainty: "conflicting" | "reported" | "verified";
4001
+ text: string;
4002
+ } & {})[];
4003
+ } & {}>;
4004
+ export declare const RESONANCE_POSITIONING_METHOD_VERSION: 'positioning_v1';
4005
+ declare const positioningResult: Field<{
4006
+ methodVersion: "positioning_v1";
4007
+ state: "no_fit" | "provisional" | "ready";
4008
+ reasonCodes: ("brain_unavailable" | "buyer_evidence_sparse" | "channel_mismatch" | "destination_missing" | "destination_unverified" | "evidence_conflicting" | "fit_not_established" | "generation_unavailable" | "offer_conflicting" | "offer_unverified" | "public_proof_unavailable" | "source_stale" | "status_quo_sufficient")[];
4009
+ alternatives: ({
4010
+ text: string;
4011
+ kind: "alternative" | "status_quo";
4012
+ basis: "evidence" | "hypothesis";
4013
+ evidenceIds: string[];
4014
+ } & {})[];
4015
+ claims: ({
4016
+ attribute: string;
4017
+ value: string;
4018
+ evidenceIds: string[];
4019
+ publicProofIds: string[];
4020
+ } & {})[];
4021
+ bestFit: ({
4022
+ text: string;
4023
+ evidenceIds: string[];
4024
+ } & {})[];
4025
+ category: ({
4026
+ text: string;
4027
+ style: "existing_category" | "focused_subcategory" | "new_category";
4028
+ evidenceIds: string[];
4029
+ } & {}) | null;
4030
+ timelyContext: ({
4031
+ text: string;
4032
+ evidenceIds: string[];
4033
+ } & {}) | null;
4034
+ unknowns: string[];
4035
+ questions: string[];
4036
+ copy: ({
4037
+ kind: "broadcast";
4038
+ caption: string;
4039
+ claimIndexes: number[];
4040
+ } & {}) | ({
4041
+ kind: "meta";
4042
+ primaryText: string;
4043
+ headline: string;
4044
+ body: string;
4045
+ claimIndexes: number[];
4046
+ } & {}) | ({
4047
+ kind: "google_search";
4048
+ headlines: string[];
4049
+ descriptions: string[];
4050
+ claimIndexes: number[];
4051
+ } & {}) | null;
4052
+ } & {}>;
4053
+ declare const positioningPreview: Field<{
4054
+ schemaVersion: 1;
4055
+ projectId: string;
4056
+ campaignId: string;
4057
+ request: {
4058
+ schemaVersion: 1;
4059
+ expectedRevision: number;
4060
+ site: string;
4061
+ target: ({
4062
+ kind: "broadcast";
4063
+ channelId: string;
4064
+ } & {}) | ({
4065
+ kind: "meta";
4066
+ channelId: string;
4067
+ creativeId: string;
4068
+ } & {}) | ({
4069
+ kind: "google_search";
4070
+ channelId: string;
4071
+ adGroupKey: string;
4072
+ adKey: string;
4073
+ } & {});
4074
+ } & {
4075
+ destination?: ({
4076
+ kind: "existing_page" | "funnel";
4077
+ id: string;
4078
+ } & {}) | undefined;
4079
+ offerId?: string | undefined;
4080
+ };
4081
+ observedAt: string;
4082
+ expiresAt: string;
4083
+ evidence: ({
4084
+ id: string;
4085
+ kind: "brain" | "buyer" | "funnel" | "offer" | "page" | "proof";
4086
+ sourceId: string;
4087
+ revision: string;
4088
+ observedAt: string;
4089
+ expiresAt: string;
4090
+ permission: "private" | "public";
4091
+ certainty: "conflicting" | "reported" | "verified";
4092
+ } & {})[];
4093
+ result: {
4094
+ methodVersion: "positioning_v1";
4095
+ state: "no_fit" | "provisional" | "ready";
4096
+ reasonCodes: ("brain_unavailable" | "buyer_evidence_sparse" | "channel_mismatch" | "destination_missing" | "destination_unverified" | "evidence_conflicting" | "fit_not_established" | "generation_unavailable" | "offer_conflicting" | "offer_unverified" | "public_proof_unavailable" | "source_stale" | "status_quo_sufficient")[];
4097
+ alternatives: ({
4098
+ text: string;
4099
+ kind: "alternative" | "status_quo";
4100
+ basis: "evidence" | "hypothesis";
4101
+ evidenceIds: string[];
4102
+ } & {})[];
4103
+ claims: ({
4104
+ attribute: string;
4105
+ value: string;
4106
+ evidenceIds: string[];
4107
+ publicProofIds: string[];
4108
+ } & {})[];
4109
+ bestFit: ({
4110
+ text: string;
4111
+ evidenceIds: string[];
4112
+ } & {})[];
4113
+ category: ({
4114
+ text: string;
4115
+ style: "existing_category" | "focused_subcategory" | "new_category";
4116
+ evidenceIds: string[];
4117
+ } & {}) | null;
4118
+ timelyContext: ({
4119
+ text: string;
4120
+ evidenceIds: string[];
4121
+ } & {}) | null;
4122
+ unknowns: string[];
4123
+ questions: string[];
4124
+ copy: ({
4125
+ kind: "broadcast";
4126
+ caption: string;
4127
+ claimIndexes: number[];
4128
+ } & {}) | ({
4129
+ kind: "meta";
4130
+ primaryText: string;
4131
+ headline: string;
4132
+ body: string;
4133
+ claimIndexes: number[];
4134
+ } & {}) | ({
4135
+ kind: "google_search";
4136
+ headlines: string[];
4137
+ descriptions: string[];
4138
+ claimIndexes: number[];
4139
+ } & {}) | null;
4140
+ } & {};
4141
+ applicationToken: string | null;
4142
+ } & {}>;
4143
+ declare const positioningApplyRequest: Field<{
4144
+ applicationToken: string;
4145
+ } & {}>;
4146
+ export type ResonancePositioningPreviewRequest = Value<typeof positioningRequest>;
4147
+ export type ResonancePositioningContext = Value<typeof positioningContext>;
4148
+ export type ResonancePositioningResult = Value<typeof positioningResult>;
4149
+ export type ResonancePositioningPreview = Value<typeof positioningPreview>;
4150
+ export type ResonancePositioningApplyRequest = Value<typeof positioningApplyRequest>;
4151
+ export declare const parseResonancePositioningPreviewRequest: (value: unknown) => ResonancePositioningPreviewRequest;
4152
+ export declare const parseResonancePositioningContext: (value: unknown) => ResonancePositioningContext;
4153
+ export declare function parseResonancePositioningResult(value: unknown, context?: ResonancePositioningContext): ResonancePositioningResult;
4154
+ export declare const parseResonancePositioningPreview: (value: unknown) => ResonancePositioningPreview;
4155
+ export declare const parseResonancePositioningApplyRequest: (value: unknown) => ResonancePositioningApplyRequest;
4156
+ export declare const resonancePositioningContextDigestInput: (value: unknown) => string;
4157
+ /**
4158
+ * Compare exact owner evidence across reads without letting the read time change its identity.
4159
+ * The application owner separately enforces original and current observation windows.
4160
+ */
4161
+ export declare function resonancePositioningEvidenceDigestInput(value: unknown): string;
4162
+ export declare const resonancePositioningResultDigestInput: (value: unknown) => string;
4163
+ export declare const RESONANCE_POSITIONING_PREVIEW_REQUEST_JSON_SCHEMA: import("./wire-schema").JsonSchema;
4164
+ export declare const RESONANCE_POSITIONING_CONTEXT_JSON_SCHEMA: import("./wire-schema").JsonSchema;
4165
+ export declare const RESONANCE_POSITIONING_RESULT_JSON_SCHEMA: import("./wire-schema").JsonSchema;
4166
+ export declare const RESONANCE_POSITIONING_PREVIEW_JSON_SCHEMA: import("./wire-schema").JsonSchema;
4167
+ export declare const RESONANCE_POSITIONING_APPLY_REQUEST_JSON_SCHEMA: import("./wire-schema").JsonSchema;
4168
+ /** Exact source rows the consistency assessor is allowed to read. */
4169
+ export declare function projectResonancePositioningConsistencyEvidence(value: unknown): ResonancePositioningContext['evidence'];
4170
+ export declare const resonancePositioningConsistencyEvidenceDigestInput: (value: unknown) => string;
4171
+ declare const positioningConsistencyAssessment: Field<{
4172
+ state: "compatible" | "conflicting" | "unknown";
4173
+ evidenceDigest: string;
4174
+ coveredSourceIds: string[];
4175
+ } & {}>;
4176
+ export type ResonancePositioningConsistencyAssessment = Value<typeof positioningConsistencyAssessment>;
4177
+ /** The owner computes the expected SHA-256 over its exact permitted projection before calling this parser. */
4178
+ export declare function parseResonancePositioningConsistencyAssessment(value: unknown, expected: {
4179
+ context: unknown;
4180
+ evidenceDigest: string;
4181
+ }): ResonancePositioningConsistencyAssessment;
4182
+ export declare const RESONANCE_POSITIONING_CONSISTENCY_ASSESSMENT_JSON_SCHEMA: import("./wire-schema").JsonSchema;
3926
4183
  declare const prepareCommand: Field<{
3927
4184
  expectedRevision: number;
3928
4185
  idempotencyKey: string;
@@ -4080,6 +4337,7 @@ declare const saveCommand: Field<{
4080
4337
  existingContactPolicy: "include_source_cohort";
4081
4338
  attributionModel: "first_party_last_touch_marker_v1";
4082
4339
  } & {}) | undefined;
4340
+ eligibleBookingTypeIds?: string[] | undefined;
4083
4341
  }) | undefined;
4084
4342
  brandRef?: ({
4085
4343
  projectId: string;
@@ -4576,6 +4834,7 @@ declare const reportedOptimizationEvidence: Field<{
4576
4834
  existingContactPolicy: "include_source_cohort";
4577
4835
  attributionModel: "first_party_last_touch_marker_v1";
4578
4836
  } & {}) | undefined;
4837
+ eligibleBookingTypeIds?: string[] | undefined;
4579
4838
  };
4580
4839
  policyDigest: string;
4581
4840
  trackingState: "blocked" | "healthy" | "unknown";
@@ -4819,6 +5078,7 @@ declare const finiteOptimizationEvidence: Field<{
4819
5078
  existingContactPolicy: "include_source_cohort";
4820
5079
  attributionModel: "first_party_last_touch_marker_v1";
4821
5080
  } & {}) | undefined;
5081
+ eligibleBookingTypeIds?: string[] | undefined;
4822
5082
  };
4823
5083
  policyDigest: string;
4824
5084
  resolvedPolicy: {
@@ -5122,6 +5382,7 @@ declare const optimizationEvidence: Field<({
5122
5382
  existingContactPolicy: "include_source_cohort";
5123
5383
  attributionModel: "first_party_last_touch_marker_v1";
5124
5384
  } & {}) | undefined;
5385
+ eligibleBookingTypeIds?: string[] | undefined;
5125
5386
  };
5126
5387
  policyDigest: string;
5127
5388
  trackingState: "blocked" | "healthy" | "unknown";
@@ -5339,6 +5600,7 @@ declare const optimizationEvidence: Field<({
5339
5600
  existingContactPolicy: "include_source_cohort";
5340
5601
  attributionModel: "first_party_last_touch_marker_v1";
5341
5602
  } & {}) | undefined;
5603
+ eligibleBookingTypeIds?: string[] | undefined;
5342
5604
  };
5343
5605
  policyDigest: string;
5344
5606
  trackingState: "blocked" | "healthy" | "unknown";
@@ -5575,6 +5837,7 @@ declare const optimizationEvidence: Field<({
5575
5837
  existingContactPolicy: "include_source_cohort";
5576
5838
  attributionModel: "first_party_last_touch_marker_v1";
5577
5839
  } & {}) | undefined;
5840
+ eligibleBookingTypeIds?: string[] | undefined;
5578
5841
  };
5579
5842
  policyDigest: string;
5580
5843
  resolvedPolicy: {
@@ -8883,6 +9146,7 @@ declare const feedReview: Field<{
8883
9146
  existingContactPolicy: "include_source_cohort";
8884
9147
  attributionModel: "first_party_last_touch_marker_v1";
8885
9148
  } & {}) | undefined;
9149
+ eligibleBookingTypeIds?: string[] | undefined;
8886
9150
  };
8887
9151
  allowedOperations: ("deliver_conversion" | "launch" | "optimize" | "resume" | "update")[];
8888
9152
  allowedTransformationRef: ({