@hark-protocol/protocol 0.1.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.
Files changed (54) hide show
  1. package/README.md +21 -0
  2. package/dist/constants.d.ts +25 -0
  3. package/dist/constants.d.ts.map +1 -0
  4. package/dist/constants.js +24 -0
  5. package/dist/constants.js.map +1 -0
  6. package/dist/hcs14.d.ts +32 -0
  7. package/dist/hcs14.d.ts.map +1 -0
  8. package/dist/hcs14.js +45 -0
  9. package/dist/hcs14.js.map +1 -0
  10. package/dist/index.d.ts +12 -0
  11. package/dist/index.d.ts.map +1 -0
  12. package/dist/index.js +12 -0
  13. package/dist/index.js.map +1 -0
  14. package/dist/pii.d.ts +2 -0
  15. package/dist/pii.d.ts.map +1 -0
  16. package/dist/pii.js +12 -0
  17. package/dist/pii.js.map +1 -0
  18. package/dist/schemas/assurance.d.ts +23 -0
  19. package/dist/schemas/assurance.d.ts.map +1 -0
  20. package/dist/schemas/assurance.js +10 -0
  21. package/dist/schemas/assurance.js.map +1 -0
  22. package/dist/schemas/campaign.d.ts +177 -0
  23. package/dist/schemas/campaign.d.ts.map +1 -0
  24. package/dist/schemas/campaign.js +47 -0
  25. package/dist/schemas/campaign.js.map +1 -0
  26. package/dist/schemas/delivery.d.ts +162 -0
  27. package/dist/schemas/delivery.d.ts.map +1 -0
  28. package/dist/schemas/delivery.js +35 -0
  29. package/dist/schemas/delivery.js.map +1 -0
  30. package/dist/schemas/intent.d.ts +244 -0
  31. package/dist/schemas/intent.d.ts.map +1 -0
  32. package/dist/schemas/intent.js +63 -0
  33. package/dist/schemas/intent.js.map +1 -0
  34. package/dist/schemas/opportunity.d.ts +177 -0
  35. package/dist/schemas/opportunity.d.ts.map +1 -0
  36. package/dist/schemas/opportunity.js +36 -0
  37. package/dist/schemas/opportunity.js.map +1 -0
  38. package/dist/schemas/publisher.d.ts +56 -0
  39. package/dist/schemas/publisher.d.ts.map +1 -0
  40. package/dist/schemas/publisher.js +21 -0
  41. package/dist/schemas/publisher.js.map +1 -0
  42. package/dist/schemas/reach.d.ts +100 -0
  43. package/dist/schemas/reach.d.ts.map +1 -0
  44. package/dist/schemas/reach.js +27 -0
  45. package/dist/schemas/reach.js.map +1 -0
  46. package/dist/taxonomy.d.ts +22 -0
  47. package/dist/taxonomy.d.ts.map +1 -0
  48. package/dist/taxonomy.js +81 -0
  49. package/dist/taxonomy.js.map +1 -0
  50. package/dist/tinybar.d.ts +4 -0
  51. package/dist/tinybar.d.ts.map +1 -0
  52. package/dist/tinybar.js +8 -0
  53. package/dist/tinybar.js.map +1 -0
  54. package/package.json +42 -0
@@ -0,0 +1,162 @@
1
+ import { z } from "zod";
2
+ export declare const deliveryStatusSchema: z.ZodEnum<["queued", "served", "dismissed"]>;
3
+ export type DeliveryStatus = z.infer<typeof deliveryStatusSchema>;
4
+ export declare const deliveryPaymentSchema: z.ZodObject<{
5
+ network: z.ZodLiteral<"hedera:testnet">;
6
+ asset: z.ZodLiteral<"0.0.0">;
7
+ amountTinybar: z.ZodString;
8
+ transactionId: z.ZodOptional<z.ZodString>;
9
+ payerAccountId: z.ZodOptional<z.ZodString>;
10
+ }, "strip", z.ZodTypeAny, {
11
+ network: "hedera:testnet";
12
+ asset: "0.0.0";
13
+ amountTinybar: string;
14
+ transactionId?: string | undefined;
15
+ payerAccountId?: string | undefined;
16
+ }, {
17
+ network: "hedera:testnet";
18
+ asset: "0.0.0";
19
+ amountTinybar: string;
20
+ transactionId?: string | undefined;
21
+ payerAccountId?: string | undefined;
22
+ }>;
23
+ export type DeliveryPayment = z.infer<typeof deliveryPaymentSchema>;
24
+ /**
25
+ * Internal Hark delivery record (CLAUDE.md section 9).
26
+ * `intentId` and `subjectRef` are internal-only and MUST NOT be serialized
27
+ * to advertiser-facing responses.
28
+ */
29
+ export declare const deliverySchema: z.ZodObject<{
30
+ id: z.ZodString;
31
+ campaignId: z.ZodString;
32
+ publisherId: z.ZodString;
33
+ placementId: z.ZodString;
34
+ intentId: z.ZodString;
35
+ subjectRef: z.ZodString;
36
+ status: z.ZodEnum<["queued", "served", "dismissed"]>;
37
+ payment: z.ZodObject<{
38
+ network: z.ZodLiteral<"hedera:testnet">;
39
+ asset: z.ZodLiteral<"0.0.0">;
40
+ amountTinybar: z.ZodString;
41
+ transactionId: z.ZodOptional<z.ZodString>;
42
+ payerAccountId: z.ZodOptional<z.ZodString>;
43
+ }, "strip", z.ZodTypeAny, {
44
+ network: "hedera:testnet";
45
+ asset: "0.0.0";
46
+ amountTinybar: string;
47
+ transactionId?: string | undefined;
48
+ payerAccountId?: string | undefined;
49
+ }, {
50
+ network: "hedera:testnet";
51
+ asset: "0.0.0";
52
+ amountTinybar: string;
53
+ transactionId?: string | undefined;
54
+ payerAccountId?: string | undefined;
55
+ }>;
56
+ createdAt: z.ZodString;
57
+ servedAt: z.ZodOptional<z.ZodString>;
58
+ }, "strip", z.ZodTypeAny, {
59
+ status: "queued" | "served" | "dismissed";
60
+ id: string;
61
+ createdAt: string;
62
+ publisherId: string;
63
+ subjectRef: string;
64
+ campaignId: string;
65
+ placementId: string;
66
+ intentId: string;
67
+ payment: {
68
+ network: "hedera:testnet";
69
+ asset: "0.0.0";
70
+ amountTinybar: string;
71
+ transactionId?: string | undefined;
72
+ payerAccountId?: string | undefined;
73
+ };
74
+ servedAt?: string | undefined;
75
+ }, {
76
+ status: "queued" | "served" | "dismissed";
77
+ id: string;
78
+ createdAt: string;
79
+ publisherId: string;
80
+ subjectRef: string;
81
+ campaignId: string;
82
+ placementId: string;
83
+ intentId: string;
84
+ payment: {
85
+ network: "hedera:testnet";
86
+ asset: "0.0.0";
87
+ amountTinybar: string;
88
+ transactionId?: string | undefined;
89
+ payerAccountId?: string | undefined;
90
+ };
91
+ servedAt?: string | undefined;
92
+ }>;
93
+ export type Delivery = z.infer<typeof deliverySchema>;
94
+ /**
95
+ * Publisher-facing delivery view returned from GET /v1/feed/:subjectRef.
96
+ * Excludes internal intentId (publisher already knows its own subjectRef,
97
+ * but the internal Hark intent database id is never exposed).
98
+ */
99
+ export declare const feedDeliverySchema: z.ZodObject<Omit<{
100
+ id: z.ZodString;
101
+ campaignId: z.ZodString;
102
+ publisherId: z.ZodString;
103
+ placementId: z.ZodString;
104
+ intentId: z.ZodString;
105
+ subjectRef: z.ZodString;
106
+ status: z.ZodEnum<["queued", "served", "dismissed"]>;
107
+ payment: z.ZodObject<{
108
+ network: z.ZodLiteral<"hedera:testnet">;
109
+ asset: z.ZodLiteral<"0.0.0">;
110
+ amountTinybar: z.ZodString;
111
+ transactionId: z.ZodOptional<z.ZodString>;
112
+ payerAccountId: z.ZodOptional<z.ZodString>;
113
+ }, "strip", z.ZodTypeAny, {
114
+ network: "hedera:testnet";
115
+ asset: "0.0.0";
116
+ amountTinybar: string;
117
+ transactionId?: string | undefined;
118
+ payerAccountId?: string | undefined;
119
+ }, {
120
+ network: "hedera:testnet";
121
+ asset: "0.0.0";
122
+ amountTinybar: string;
123
+ transactionId?: string | undefined;
124
+ payerAccountId?: string | undefined;
125
+ }>;
126
+ createdAt: z.ZodString;
127
+ servedAt: z.ZodOptional<z.ZodString>;
128
+ }, "intentId">, "strip", z.ZodTypeAny, {
129
+ status: "queued" | "served" | "dismissed";
130
+ id: string;
131
+ createdAt: string;
132
+ publisherId: string;
133
+ subjectRef: string;
134
+ campaignId: string;
135
+ placementId: string;
136
+ payment: {
137
+ network: "hedera:testnet";
138
+ asset: "0.0.0";
139
+ amountTinybar: string;
140
+ transactionId?: string | undefined;
141
+ payerAccountId?: string | undefined;
142
+ };
143
+ servedAt?: string | undefined;
144
+ }, {
145
+ status: "queued" | "served" | "dismissed";
146
+ id: string;
147
+ createdAt: string;
148
+ publisherId: string;
149
+ subjectRef: string;
150
+ campaignId: string;
151
+ placementId: string;
152
+ payment: {
153
+ network: "hedera:testnet";
154
+ asset: "0.0.0";
155
+ amountTinybar: string;
156
+ transactionId?: string | undefined;
157
+ payerAccountId?: string | undefined;
158
+ };
159
+ servedAt?: string | undefined;
160
+ }>;
161
+ export type FeedDelivery = z.infer<typeof feedDeliverySchema>;
162
+ //# sourceMappingURL=delivery.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delivery.d.ts","sourceRoot":"","sources":["../../src/schemas/delivery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,oBAAoB,8CAA4C,CAAC;AAC9E,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;EAMhC,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE;;;;GAIG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAWzB,CAAC;AACH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAEtD;;;;GAIG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAA0C,CAAC;AAC1E,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
@@ -0,0 +1,35 @@
1
+ import { z } from "zod";
2
+ import { tinybarAmountSchema } from "./campaign.js";
3
+ import { HEDERA_TESTNET_NETWORK, HBAR_ASSET_ID } from "../constants.js";
4
+ export const deliveryStatusSchema = z.enum(["queued", "served", "dismissed"]);
5
+ export const deliveryPaymentSchema = z.object({
6
+ network: z.literal(HEDERA_TESTNET_NETWORK),
7
+ asset: z.literal(HBAR_ASSET_ID),
8
+ amountTinybar: tinybarAmountSchema,
9
+ transactionId: z.string().optional(),
10
+ payerAccountId: z.string().optional(),
11
+ });
12
+ /**
13
+ * Internal Hark delivery record (CLAUDE.md section 9).
14
+ * `intentId` and `subjectRef` are internal-only and MUST NOT be serialized
15
+ * to advertiser-facing responses.
16
+ */
17
+ export const deliverySchema = z.object({
18
+ id: z.string(),
19
+ campaignId: z.string(),
20
+ publisherId: z.string(),
21
+ placementId: z.string(),
22
+ intentId: z.string(),
23
+ subjectRef: z.string(),
24
+ status: deliveryStatusSchema,
25
+ payment: deliveryPaymentSchema,
26
+ createdAt: z.string().datetime(),
27
+ servedAt: z.string().datetime().optional(),
28
+ });
29
+ /**
30
+ * Publisher-facing delivery view returned from GET /v1/feed/:subjectRef.
31
+ * Excludes internal intentId (publisher already knows its own subjectRef,
32
+ * but the internal Hark intent database id is never exposed).
33
+ */
34
+ export const feedDeliverySchema = deliverySchema.omit({ intentId: true });
35
+ //# sourceMappingURL=delivery.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delivery.js","sourceRoot":"","sources":["../../src/schemas/delivery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAExE,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC;AAG9E,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,sBAAsB,CAAC;IAC1C,KAAK,EAAE,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC;IAC/B,aAAa,EAAE,mBAAmB;IAClC,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACpC,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACtC,CAAC,CAAC;AAGH;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IACrC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;IACtB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;IACtB,MAAM,EAAE,oBAAoB;IAC5B,OAAO,EAAE,qBAAqB;IAC9B,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAChC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;CAC3C,CAAC,CAAC;AAGH;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,cAAc,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC"}
@@ -0,0 +1,244 @@
1
+ import { z } from "zod";
2
+ export declare const intentTopicSchema: z.ZodObject<{
3
+ id: z.ZodEffects<z.ZodString, string, string>;
4
+ confidence: z.ZodOptional<z.ZodNumber>;
5
+ }, "strip", z.ZodTypeAny, {
6
+ id: string;
7
+ confidence?: number | undefined;
8
+ }, {
9
+ id: string;
10
+ confidence?: number | undefined;
11
+ }>;
12
+ export type IntentTopic = z.infer<typeof intentTopicSchema>;
13
+ export declare const semanticSummarySchema: z.ZodEffects<z.ZodString, string, string>;
14
+ export declare const revokeReasonSchema: z.ZodEnum<["fulfilled", "user_requested", "issuer_invalidated", "other"]>;
15
+ export type RevokeReason = z.infer<typeof revokeReasonSchema>;
16
+ /** Canonical Hark intent object (CLAUDE.md section 9). */
17
+ export declare const harkIntentSchema: z.ZodObject<{
18
+ id: z.ZodString;
19
+ publisherId: z.ZodString;
20
+ subjectRef: z.ZodString;
21
+ placementIds: z.ZodArray<z.ZodString, "many">;
22
+ topics: z.ZodArray<z.ZodObject<{
23
+ id: z.ZodEffects<z.ZodString, string, string>;
24
+ confidence: z.ZodOptional<z.ZodNumber>;
25
+ }, "strip", z.ZodTypeAny, {
26
+ id: string;
27
+ confidence?: number | undefined;
28
+ }, {
29
+ id: string;
30
+ confidence?: number | undefined;
31
+ }>, "many">;
32
+ semanticSummary: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
33
+ assurances: z.ZodOptional<z.ZodArray<z.ZodObject<{
34
+ type: z.ZodString;
35
+ provider: z.ZodString;
36
+ level: z.ZodOptional<z.ZodString>;
37
+ issuedAt: z.ZodOptional<z.ZodString>;
38
+ expiresAt: z.ZodOptional<z.ZodString>;
39
+ }, "strip", z.ZodTypeAny, {
40
+ type: string;
41
+ provider: string;
42
+ level?: string | undefined;
43
+ issuedAt?: string | undefined;
44
+ expiresAt?: string | undefined;
45
+ }, {
46
+ type: string;
47
+ provider: string;
48
+ level?: string | undefined;
49
+ issuedAt?: string | undefined;
50
+ expiresAt?: string | undefined;
51
+ }>, "many">>;
52
+ createdAt: z.ZodString;
53
+ expiresAt: z.ZodString;
54
+ revokedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
55
+ revokeReason: z.ZodOptional<z.ZodNullable<z.ZodEnum<["fulfilled", "user_requested", "issuer_invalidated", "other"]>>>;
56
+ }, "strip", z.ZodTypeAny, {
57
+ expiresAt: string;
58
+ id: string;
59
+ createdAt: string;
60
+ publisherId: string;
61
+ subjectRef: string;
62
+ placementIds: string[];
63
+ topics: {
64
+ id: string;
65
+ confidence?: number | undefined;
66
+ }[];
67
+ semanticSummary?: string | undefined;
68
+ assurances?: {
69
+ type: string;
70
+ provider: string;
71
+ level?: string | undefined;
72
+ issuedAt?: string | undefined;
73
+ expiresAt?: string | undefined;
74
+ }[] | undefined;
75
+ revokedAt?: string | null | undefined;
76
+ revokeReason?: "fulfilled" | "user_requested" | "issuer_invalidated" | "other" | null | undefined;
77
+ }, {
78
+ expiresAt: string;
79
+ id: string;
80
+ createdAt: string;
81
+ publisherId: string;
82
+ subjectRef: string;
83
+ placementIds: string[];
84
+ topics: {
85
+ id: string;
86
+ confidence?: number | undefined;
87
+ }[];
88
+ semanticSummary?: string | undefined;
89
+ assurances?: {
90
+ type: string;
91
+ provider: string;
92
+ level?: string | undefined;
93
+ issuedAt?: string | undefined;
94
+ expiresAt?: string | undefined;
95
+ }[] | undefined;
96
+ revokedAt?: string | null | undefined;
97
+ revokeReason?: "fulfilled" | "user_requested" | "issuer_invalidated" | "other" | null | undefined;
98
+ }>;
99
+ export type HarkIntent = z.infer<typeof harkIntentSchema>;
100
+ /** POST /v1/intents request body. */
101
+ export declare const createIntentInputSchema: z.ZodObject<{
102
+ subjectRef: z.ZodString;
103
+ placementIds: z.ZodArray<z.ZodString, "many">;
104
+ topics: z.ZodArray<z.ZodObject<{
105
+ id: z.ZodEffects<z.ZodString, string, string>;
106
+ confidence: z.ZodOptional<z.ZodNumber>;
107
+ }, "strip", z.ZodTypeAny, {
108
+ id: string;
109
+ confidence?: number | undefined;
110
+ }, {
111
+ id: string;
112
+ confidence?: number | undefined;
113
+ }>, "many">;
114
+ semanticSummary: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
115
+ assurances: z.ZodOptional<z.ZodArray<z.ZodObject<{
116
+ type: z.ZodString;
117
+ provider: z.ZodString;
118
+ level: z.ZodOptional<z.ZodString>;
119
+ issuedAt: z.ZodOptional<z.ZodString>;
120
+ expiresAt: z.ZodOptional<z.ZodString>;
121
+ }, "strip", z.ZodTypeAny, {
122
+ type: string;
123
+ provider: string;
124
+ level?: string | undefined;
125
+ issuedAt?: string | undefined;
126
+ expiresAt?: string | undefined;
127
+ }, {
128
+ type: string;
129
+ provider: string;
130
+ level?: string | undefined;
131
+ issuedAt?: string | undefined;
132
+ expiresAt?: string | undefined;
133
+ }>, "many">>;
134
+ expiresInSeconds: z.ZodDefault<z.ZodNumber>;
135
+ }, "strip", z.ZodTypeAny, {
136
+ subjectRef: string;
137
+ placementIds: string[];
138
+ topics: {
139
+ id: string;
140
+ confidence?: number | undefined;
141
+ }[];
142
+ expiresInSeconds: number;
143
+ semanticSummary?: string | undefined;
144
+ assurances?: {
145
+ type: string;
146
+ provider: string;
147
+ level?: string | undefined;
148
+ issuedAt?: string | undefined;
149
+ expiresAt?: string | undefined;
150
+ }[] | undefined;
151
+ }, {
152
+ subjectRef: string;
153
+ placementIds: string[];
154
+ topics: {
155
+ id: string;
156
+ confidence?: number | undefined;
157
+ }[];
158
+ semanticSummary?: string | undefined;
159
+ assurances?: {
160
+ type: string;
161
+ provider: string;
162
+ level?: string | undefined;
163
+ issuedAt?: string | undefined;
164
+ expiresAt?: string | undefined;
165
+ }[] | undefined;
166
+ expiresInSeconds?: number | undefined;
167
+ }>;
168
+ export type CreateIntentInput = z.infer<typeof createIntentInputSchema>;
169
+ /** PATCH /v1/intents/:intentId request body. */
170
+ export declare const updateIntentInputSchema: z.ZodObject<{
171
+ placementIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
172
+ topics: z.ZodOptional<z.ZodArray<z.ZodObject<{
173
+ id: z.ZodEffects<z.ZodString, string, string>;
174
+ confidence: z.ZodOptional<z.ZodNumber>;
175
+ }, "strip", z.ZodTypeAny, {
176
+ id: string;
177
+ confidence?: number | undefined;
178
+ }, {
179
+ id: string;
180
+ confidence?: number | undefined;
181
+ }>, "many">>;
182
+ semanticSummary: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>>;
183
+ assurances: z.ZodOptional<z.ZodArray<z.ZodObject<{
184
+ type: z.ZodString;
185
+ provider: z.ZodString;
186
+ level: z.ZodOptional<z.ZodString>;
187
+ issuedAt: z.ZodOptional<z.ZodString>;
188
+ expiresAt: z.ZodOptional<z.ZodString>;
189
+ }, "strip", z.ZodTypeAny, {
190
+ type: string;
191
+ provider: string;
192
+ level?: string | undefined;
193
+ issuedAt?: string | undefined;
194
+ expiresAt?: string | undefined;
195
+ }, {
196
+ type: string;
197
+ provider: string;
198
+ level?: string | undefined;
199
+ issuedAt?: string | undefined;
200
+ expiresAt?: string | undefined;
201
+ }>, "many">>;
202
+ expiresInSeconds: z.ZodOptional<z.ZodNumber>;
203
+ }, "strip", z.ZodTypeAny, {
204
+ placementIds?: string[] | undefined;
205
+ topics?: {
206
+ id: string;
207
+ confidence?: number | undefined;
208
+ }[] | undefined;
209
+ semanticSummary?: string | null | undefined;
210
+ assurances?: {
211
+ type: string;
212
+ provider: string;
213
+ level?: string | undefined;
214
+ issuedAt?: string | undefined;
215
+ expiresAt?: string | undefined;
216
+ }[] | undefined;
217
+ expiresInSeconds?: number | undefined;
218
+ }, {
219
+ placementIds?: string[] | undefined;
220
+ topics?: {
221
+ id: string;
222
+ confidence?: number | undefined;
223
+ }[] | undefined;
224
+ semanticSummary?: string | null | undefined;
225
+ assurances?: {
226
+ type: string;
227
+ provider: string;
228
+ level?: string | undefined;
229
+ issuedAt?: string | undefined;
230
+ expiresAt?: string | undefined;
231
+ }[] | undefined;
232
+ expiresInSeconds?: number | undefined;
233
+ }>;
234
+ export type UpdateIntentInput = z.infer<typeof updateIntentInputSchema>;
235
+ /** DELETE /v1/intents/:intentId request body. */
236
+ export declare const revokeIntentInputSchema: z.ZodObject<{
237
+ reason: z.ZodDefault<z.ZodEnum<["fulfilled", "user_requested", "issuer_invalidated", "other"]>>;
238
+ }, "strip", z.ZodTypeAny, {
239
+ reason: "fulfilled" | "user_requested" | "issuer_invalidated" | "other";
240
+ }, {
241
+ reason?: "fulfilled" | "user_requested" | "issuer_invalidated" | "other" | undefined;
242
+ }>;
243
+ export type RevokeIntentInput = z.infer<typeof revokeIntentInputSchema>;
244
+ //# sourceMappingURL=intent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"intent.d.ts","sourceRoot":"","sources":["../../src/schemas/intent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,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FAULT_TTL_SECONDS, INTENT_MAX_TTL_SECONDS, SEMANTIC_SUMMARY_MAX_LENGTH, } from "../constants.js";
5
+ import { isValidTopicId } from "../taxonomy.js";
6
+ export const intentTopicSchema = z.object({
7
+ id: z.string().refine(isValidTopicId, { message: "Unknown topic id" }),
8
+ confidence: z.number().min(0).max(1).optional(),
9
+ });
10
+ export const semanticSummarySchema = z
11
+ .string()
12
+ .max(SEMANTIC_SUMMARY_MAX_LENGTH)
13
+ .refine((value) => !containsObviousPii(value), {
14
+ message: "Semantic summary appears to contain PII (email or phone number)",
15
+ });
16
+ export const revokeReasonSchema = z.enum([
17
+ "fulfilled",
18
+ "user_requested",
19
+ "issuer_invalidated",
20
+ "other",
21
+ ]);
22
+ /** Canonical Hark intent object (CLAUDE.md section 9). */
23
+ export const harkIntentSchema = z.object({
24
+ id: z.string(),
25
+ publisherId: z.string(),
26
+ // Opaque, publisher-scoped reference. Never returned from advertiser-facing endpoints.
27
+ subjectRef: z.string(),
28
+ placementIds: z.array(z.string()),
29
+ topics: z.array(intentTopicSchema).min(1),
30
+ semanticSummary: semanticSummarySchema.optional(),
31
+ assurances: z.array(assuranceSchema).optional(),
32
+ createdAt: z.string().datetime(),
33
+ expiresAt: z.string().datetime(),
34
+ revokedAt: z.string().datetime().nullable().optional(),
35
+ revokeReason: revokeReasonSchema.nullable().optional(),
36
+ });
37
+ /** POST /v1/intents request body. */
38
+ export const createIntentInputSchema = z.object({
39
+ subjectRef: z.string().min(1),
40
+ placementIds: z.array(z.string()).min(1),
41
+ topics: z.array(intentTopicSchema).min(1),
42
+ semanticSummary: semanticSummarySchema.optional(),
43
+ assurances: z.array(assuranceSchema).optional(),
44
+ expiresInSeconds: z
45
+ .number()
46
+ .int()
47
+ .positive()
48
+ .max(INTENT_MAX_TTL_SECONDS)
49
+ .default(INTENT_DEFAULT_TTL_SECONDS),
50
+ });
51
+ /** PATCH /v1/intents/:intentId request body. */
52
+ export const updateIntentInputSchema = z.object({
53
+ placementIds: z.array(z.string()).min(1).optional(),
54
+ topics: z.array(intentTopicSchema).min(1).optional(),
55
+ semanticSummary: semanticSummarySchema.nullable().optional(),
56
+ assurances: z.array(assuranceSchema).optional(),
57
+ expiresInSeconds: z.number().int().positive().max(INTENT_MAX_TTL_SECONDS).optional(),
58
+ });
59
+ /** DELETE /v1/intents/:intentId request body. */
60
+ export const revokeIntentInputSchema = z.object({
61
+ reason: revokeReasonSchema.default("other"),
62
+ });
63
+ //# sourceMappingURL=intent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"intent.js","sourceRoot":"","sources":["../../src/schemas/intent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EACL,0BAA0B,EAC1B,sBAAsB,EACtB,2BAA2B,GAC5B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEhD,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,cAAc,EAAE,EAAE,OAAO,EAAE,kBAAkB,EAAE,CAAC;IACtE,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;CAChD,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC;KACnC,MAAM,EAAE;KACR,GAAG,CAAC,2BAA2B,CAAC;KAChC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,kBAAkB,CAAC,KAAK,CAAC,EAAE;IAC7C,OAAO,EAAE,iEAAiE;CAC3E,CAAC,CAAC;AAEL,MAAM,CA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