@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,177 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Advertiser-visible anonymous opportunity object (CLAUDE.md section 9).
4
+ * MUST NOT contain subjectRef, internal intent DB id, or any PII.
5
+ */
6
+ export declare const harkOpportunitySchema: z.ZodObject<{
7
+ id: z.ZodString;
8
+ publisher: z.ZodObject<{
9
+ id: z.ZodString;
10
+ name: z.ZodString;
11
+ domain: z.ZodOptional<z.ZodString>;
12
+ }, "strip", z.ZodTypeAny, {
13
+ id: string;
14
+ name: string;
15
+ domain?: string | undefined;
16
+ }, {
17
+ id: string;
18
+ name: string;
19
+ domain?: string | undefined;
20
+ }>;
21
+ placement: z.ZodObject<{
22
+ id: z.ZodString;
23
+ name: z.ZodString;
24
+ format: z.ZodEnum<["card", "banner", "text"]>;
25
+ }, "strip", z.ZodTypeAny, {
26
+ id: string;
27
+ name: string;
28
+ format: "card" | "banner" | "text";
29
+ }, {
30
+ id: string;
31
+ name: string;
32
+ format: "card" | "banner" | "text";
33
+ }>;
34
+ intent: z.ZodObject<{
35
+ topics: z.ZodArray<z.ZodObject<{
36
+ id: z.ZodEffects<z.ZodString, string, string>;
37
+ confidence: z.ZodOptional<z.ZodNumber>;
38
+ }, "strip", z.ZodTypeAny, {
39
+ id: string;
40
+ confidence?: number | undefined;
41
+ }, {
42
+ id: string;
43
+ confidence?: number | undefined;
44
+ }>, "many">;
45
+ semanticSummary: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
46
+ assurances: z.ZodOptional<z.ZodArray<z.ZodObject<{
47
+ type: z.ZodString;
48
+ provider: z.ZodString;
49
+ level: z.ZodOptional<z.ZodString>;
50
+ issuedAt: z.ZodOptional<z.ZodString>;
51
+ expiresAt: z.ZodOptional<z.ZodString>;
52
+ }, "strip", z.ZodTypeAny, {
53
+ type: string;
54
+ provider: string;
55
+ level?: string | undefined;
56
+ issuedAt?: string | undefined;
57
+ expiresAt?: string | undefined;
58
+ }, {
59
+ type: string;
60
+ provider: string;
61
+ level?: string | undefined;
62
+ issuedAt?: string | undefined;
63
+ expiresAt?: string | undefined;
64
+ }>, "many">>;
65
+ expiresAt: z.ZodString;
66
+ }, "strip", z.ZodTypeAny, {
67
+ expiresAt: string;
68
+ topics: {
69
+ id: string;
70
+ confidence?: number | undefined;
71
+ }[];
72
+ semanticSummary?: string | undefined;
73
+ assurances?: {
74
+ type: string;
75
+ provider: string;
76
+ level?: string | undefined;
77
+ issuedAt?: string | undefined;
78
+ expiresAt?: string | undefined;
79
+ }[] | undefined;
80
+ }, {
81
+ expiresAt: string;
82
+ topics: {
83
+ id: string;
84
+ confidence?: number | undefined;
85
+ }[];
86
+ semanticSummary?: string | undefined;
87
+ assurances?: {
88
+ type: string;
89
+ provider: string;
90
+ level?: string | undefined;
91
+ issuedAt?: string | undefined;
92
+ expiresAt?: string | undefined;
93
+ }[] | undefined;
94
+ }>;
95
+ pricing: z.ZodObject<{
96
+ network: z.ZodLiteral<"hedera:testnet">;
97
+ asset: z.ZodLiteral<"0.0.0">;
98
+ amountTinybar: z.ZodString;
99
+ }, "strip", z.ZodTypeAny, {
100
+ network: "hedera:testnet";
101
+ asset: "0.0.0";
102
+ amountTinybar: string;
103
+ }, {
104
+ network: "hedera:testnet";
105
+ asset: "0.0.0";
106
+ amountTinybar: string;
107
+ }>;
108
+ expiresAt: z.ZodString;
109
+ }, "strip", z.ZodTypeAny, {
110
+ expiresAt: string;
111
+ id: string;
112
+ publisher: {
113
+ id: string;
114
+ name: string;
115
+ domain?: string | undefined;
116
+ };
117
+ placement: {
118
+ id: string;
119
+ name: string;
120
+ format: "card" | "banner" | "text";
121
+ };
122
+ intent: {
123
+ expiresAt: string;
124
+ topics: {
125
+ id: string;
126
+ confidence?: number | undefined;
127
+ }[];
128
+ semanticSummary?: string | undefined;
129
+ assurances?: {
130
+ type: string;
131
+ provider: string;
132
+ level?: string | undefined;
133
+ issuedAt?: string | undefined;
134
+ expiresAt?: string | undefined;
135
+ }[] | undefined;
136
+ };
137
+ pricing: {
138
+ network: "hedera:testnet";
139
+ asset: "0.0.0";
140
+ amountTinybar: string;
141
+ };
142
+ }, {
143
+ expiresAt: string;
144
+ id: string;
145
+ publisher: {
146
+ id: string;
147
+ name: string;
148
+ domain?: string | undefined;
149
+ };
150
+ placement: {
151
+ id: string;
152
+ name: string;
153
+ format: "card" | "banner" | "text";
154
+ };
155
+ intent: {
156
+ expiresAt: string;
157
+ topics: {
158
+ id: string;
159
+ confidence?: number | undefined;
160
+ }[];
161
+ semanticSummary?: string | undefined;
162
+ assurances?: {
163
+ type: string;
164
+ provider: string;
165
+ level?: string | undefined;
166
+ issuedAt?: string | undefined;
167
+ expiresAt?: string | undefined;
168
+ }[] | undefined;
169
+ };
170
+ pricing: {
171
+ network: "hedera:testnet";
172
+ asset: "0.0.0";
173
+ amountTinybar: string;
174
+ };
175
+ }>;
176
+ export type HarkOpportunity = z.infer<typeof harkOpportunitySchema>;
177
+ //# sourceMappingURL=opportunity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"opportunity.d.ts","sourceRoot":"","sources":["../../src/schemas/opportunity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB;;;GAGG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwBhC,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
@@ -0,0 +1,36 @@
1
+ import { z } from "zod";
2
+ import { assuranceSchema } from "./assurance.js";
3
+ import { intentTopicSchema, semanticSummarySchema } from "./intent.js";
4
+ import { placementFormatSchema } from "./publisher.js";
5
+ import { tinybarAmountSchema } from "./campaign.js";
6
+ import { HEDERA_TESTNET_NETWORK, HBAR_ASSET_ID } from "../constants.js";
7
+ /**
8
+ * Advertiser-visible anonymous opportunity object (CLAUDE.md section 9).
9
+ * MUST NOT contain subjectRef, internal intent DB id, or any PII.
10
+ */
11
+ export const harkOpportunitySchema = z.object({
12
+ id: z.string(),
13
+ publisher: z.object({
14
+ id: z.string(),
15
+ name: z.string(),
16
+ domain: z.string().optional(),
17
+ }),
18
+ placement: z.object({
19
+ id: z.string(),
20
+ name: z.string(),
21
+ format: placementFormatSchema,
22
+ }),
23
+ intent: z.object({
24
+ topics: z.array(intentTopicSchema),
25
+ semanticSummary: semanticSummarySchema.optional(),
26
+ assurances: z.array(assuranceSchema).optional(),
27
+ expiresAt: z.string().datetime(),
28
+ }),
29
+ pricing: z.object({
30
+ network: z.literal(HEDERA_TESTNET_NETWORK),
31
+ asset: z.literal(HBAR_ASSET_ID),
32
+ amountTinybar: tinybarAmountSchema,
33
+ }),
34
+ expiresAt: z.string().datetime(),
35
+ });
36
+ //# sourceMappingURL=opportunity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"opportunity.js","sourceRoot":"","sources":["../../src/schemas/opportunity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,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C,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACjC,CAAC,CAAC"}
@@ -0,0 +1,56 @@
1
+ import { z } from "zod";
2
+ export declare const publisherSchema: z.ZodObject<{
3
+ id: z.ZodString;
4
+ slug: z.ZodString;
5
+ name: z.ZodString;
6
+ domain: z.ZodOptional<z.ZodString>;
7
+ description: z.ZodOptional<z.ZodString>;
8
+ active: z.ZodBoolean;
9
+ createdAt: z.ZodString;
10
+ }, "strip", z.ZodTypeAny, {
11
+ id: string;
12
+ slug: string;
13
+ name: string;
14
+ active: boolean;
15
+ createdAt: string;
16
+ domain?: string | undefined;
17
+ description?: string | undefined;
18
+ }, {
19
+ id: string;
20
+ slug: string;
21
+ name: string;
22
+ active: boolean;
23
+ createdAt: string;
24
+ domain?: string | undefined;
25
+ description?: string | undefined;
26
+ }>;
27
+ export type Publisher = z.infer<typeof publisherSchema>;
28
+ export declare const placementFormatSchema: z.ZodEnum<["card", "banner", "text"]>;
29
+ export type PlacementFormat = z.infer<typeof placementFormatSchema>;
30
+ export declare const placementSchema: z.ZodObject<{
31
+ id: z.ZodString;
32
+ publisherId: z.ZodString;
33
+ slug: z.ZodString;
34
+ name: z.ZodString;
35
+ format: z.ZodEnum<["card", "banner", "text"]>;
36
+ description: z.ZodOptional<z.ZodString>;
37
+ active: z.ZodBoolean;
38
+ }, "strip", z.ZodTypeAny, {
39
+ id: string;
40
+ slug: string;
41
+ name: string;
42
+ active: boolean;
43
+ publisherId: string;
44
+ format: "card" | "banner" | "text";
45
+ description?: string | undefined;
46
+ }, {
47
+ id: string;
48
+ slug: string;
49
+ name: string;
50
+ active: boolean;
51
+ publisherId: string;
52
+ format: "card" | "banner" | "text";
53
+ description?: string | undefined;
54
+ }>;
55
+ export type Placement = z.infer<typeof placementSchema>;
56
+ //# sourceMappingURL=publisher.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"publisher.d.ts","sourceRoot":"","sources":["../../src/schemas/publisher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;EAQ1B,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAExD,eAAO,MAAM,qBAAqB,uCAAqC,CAAC;AACxE,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;EAQ1B,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC"}
@@ -0,0 +1,21 @@
1
+ import { z } from "zod";
2
+ export const publisherSchema = z.object({
3
+ id: z.string(),
4
+ slug: z.string(),
5
+ name: z.string(),
6
+ domain: z.string().optional(),
7
+ description: z.string().optional(),
8
+ active: z.boolean(),
9
+ createdAt: z.string().datetime(),
10
+ });
11
+ export const placementFormatSchema = z.enum(["card", "banner", "text"]);
12
+ export const placementSchema = z.object({
13
+ id: z.string(),
14
+ publisherId: z.string(),
15
+ slug: z.string(),
16
+ name: z.string(),
17
+ format: placementFormatSchema,
18
+ description: z.string().optional(),
19
+ active: z.boolean(),
20
+ });
21
+ //# sourceMappingURL=publisher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"publisher.js","sourceRoot":"","sources":["../../src/schemas/publisher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAClC,MAAM,EAAE,CAAC,CAAC,OAAO,EAAE;IACnB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACjC,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC;AAGxE,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,MAAM,EAAE,qBAAqB;IAC7B,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAClC,MAAM,EAAE,CAAC,CAAC,OAAO,EAAE;CACpB,CAAC,CAAC"}
@@ -0,0 +1,100 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * POST /v1/reach request body (CLAUDE.md section 12).
4
+ */
5
+ export declare const reachInputSchema: z.ZodObject<{
6
+ opportunityId: z.ZodString;
7
+ campaignId: z.ZodString;
8
+ }, "strip", z.ZodTypeAny, {
9
+ campaignId: string;
10
+ opportunityId: string;
11
+ }, {
12
+ campaignId: string;
13
+ opportunityId: string;
14
+ }>;
15
+ export type ReachInput = z.infer<typeof reachInputSchema>;
16
+ /**
17
+ * Advertiser-safe confirmation returned from POST /v1/reach.
18
+ * MUST NOT contain subjectRef, the internal intent id, or any PII.
19
+ */
20
+ export declare const reachConfirmationSchema: z.ZodObject<{
21
+ deliveryId: z.ZodString;
22
+ status: z.ZodEnum<["queued", "served", "dismissed"]>;
23
+ publisher: z.ZodObject<{
24
+ id: z.ZodString;
25
+ name: z.ZodString;
26
+ }, "strip", z.ZodTypeAny, {
27
+ id: string;
28
+ name: string;
29
+ }, {
30
+ id: string;
31
+ name: string;
32
+ }>;
33
+ placement: z.ZodObject<{
34
+ id: z.ZodString;
35
+ name: z.ZodString;
36
+ }, "strip", z.ZodTypeAny, {
37
+ id: string;
38
+ name: string;
39
+ }, {
40
+ id: string;
41
+ name: string;
42
+ }>;
43
+ payment: z.ZodObject<{
44
+ network: z.ZodLiteral<"hedera:testnet">;
45
+ asset: z.ZodLiteral<"0.0.0">;
46
+ amountTinybar: z.ZodString;
47
+ transactionId: z.ZodOptional<z.ZodString>;
48
+ payerAccountId: z.ZodOptional<z.ZodString>;
49
+ }, "strip", z.ZodTypeAny, {
50
+ network: "hedera:testnet";
51
+ asset: "0.0.0";
52
+ amountTinybar: string;
53
+ transactionId?: string | undefined;
54
+ payerAccountId?: string | undefined;
55
+ }, {
56
+ network: "hedera:testnet";
57
+ asset: "0.0.0";
58
+ amountTinybar: string;
59
+ transactionId?: string | undefined;
60
+ payerAccountId?: string | undefined;
61
+ }>;
62
+ }, "strip", z.ZodTypeAny, {
63
+ status: "queued" | "served" | "dismissed";
64
+ publisher: {
65
+ id: string;
66
+ name: string;
67
+ };
68
+ placement: {
69
+ id: string;
70
+ name: string;
71
+ };
72
+ payment: {
73
+ network: "hedera:testnet";
74
+ asset: "0.0.0";
75
+ amountTinybar: string;
76
+ transactionId?: string | undefined;
77
+ payerAccountId?: string | undefined;
78
+ };
79
+ deliveryId: string;
80
+ }, {
81
+ status: "queued" | "served" | "dismissed";
82
+ publisher: {
83
+ id: string;
84
+ name: string;
85
+ };
86
+ placement: {
87
+ id: string;
88
+ name: string;
89
+ };
90
+ payment: {
91
+ network: "hedera:testnet";
92
+ asset: "0.0.0";
93
+ amountTinybar: string;
94
+ transactionId?: string | undefined;
95
+ payerAccountId?: string | undefined;
96
+ };
97
+ deliveryId: string;
98
+ }>;
99
+ export type ReachConfirmation = z.infer<typeof reachConfirmationSchema>;
100
+ //# sourceMappingURL=reach.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reach.d.ts","sourceRoot":"","sources":["../../src/schemas/reach.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;EAG3B,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D;;;GAGG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAYlC,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC"}
@@ -0,0 +1,27 @@
1
+ import { z } from "zod";
2
+ import { deliveryPaymentSchema, deliveryStatusSchema } from "./delivery.js";
3
+ /**
4
+ * POST /v1/reach request body (CLAUDE.md section 12).
5
+ */
6
+ export const reachInputSchema = z.object({
7
+ opportunityId: z.string().min(1),
8
+ campaignId: z.string().min(1),
9
+ });
10
+ /**
11
+ * Advertiser-safe confirmation returned from POST /v1/reach.
12
+ * MUST NOT contain subjectRef, the internal intent id, or any PII.
13
+ */
14
+ export const reachConfirmationSchema = z.object({
15
+ deliveryId: z.string(),
16
+ status: deliveryStatusSchema,
17
+ publisher: z.object({
18
+ id: z.string(),
19
+ name: z.string(),
20
+ }),
21
+ placement: z.object({
22
+ id: z.string(),
23
+ name: z.string(),
24
+ }),
25
+ payment: deliveryPaymentSchema,
26
+ });
27
+ //# sourceMappingURL=reach.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reach.js","sourceRoot":"","sources":["../../src/schemas/reach.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAE5E;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAChC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CAC9B,CAAC,CAAC;AAGH;;;GAGG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;IACtB,MAAM,EAAE,oBAAoB;IAC5B,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC;QAClB,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;QACd,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;KACjB,CAAC;IACF,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC;QAClB,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;QACd,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;KACjB,CAAC;IACF,OAAO,EAAE,qBAAqB;CAC/B,CAAC,CAAC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Canonical Hark topic taxonomy (CLAUDE.md section 8).
3
+ * Represented as code for v0.1 - no on-chain topic registry.
4
+ */
5
+ export type TopicDefinition = {
6
+ id: string;
7
+ label: string;
8
+ parentId?: string;
9
+ };
10
+ export declare const TAXONOMY: ReadonlyMap<string, TopicDefinition>;
11
+ export declare function getTopic(id: string): TopicDefinition | undefined;
12
+ export declare function isValidTopicId(id: string): boolean;
13
+ export declare function listTopics(): TopicDefinition[];
14
+ /** True if `candidate` is the same topic as `target`, or a descendant of it. */
15
+ export declare function isSameOrDescendant(candidate: string, target: string): boolean;
16
+ /**
17
+ * Distance between two topics in the taxonomy tree, measured via their nearest
18
+ * common ancestor. Returns `Infinity` if the topics share no ancestor (including
19
+ * when either topic id is unknown).
20
+ */
21
+ export declare function topicDistance(a: string, b: string): number;
22
+ //# sourceMappingURL=taxonomy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"taxonomy.d.ts","sourceRoot":"","sources":["../src/taxonomy.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AA4CF,eAAO,MAAM,QAAQ,EAAE,WAAW,CAAC,MAAM,EAAE,eAAe,CAEzD,CAAC;AAEF,wBAAgB,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS,CAEhE;AAED,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAElD;AAED,wBAAgB,UAAU,IAAI,eAAe,EAAE,CAE9C;AAaD,gFAAgF;AAChF,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAE7E;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAkB1D"}
@@ -0,0 +1,81 @@
1
+ const rawTopics = [
2
+ { id: "electronics", label: "Electronics" },
3
+ { id: "electronics.computer", label: "Computers", parentId: "electronics" },
4
+ { id: "electronics.computer.laptop", label: "Laptops", parentId: "electronics.computer" },
5
+ { id: "electronics.computer.desktop", label: "Desktops", parentId: "electronics.computer" },
6
+ { id: "electronics.phone", label: "Phones", parentId: "electronics" },
7
+ { id: "electronics.tablet", label: "Tablets", parentId: "electronics" },
8
+ { id: "travel", label: "Travel" },
9
+ { id: "travel.flight", label: "Flights", parentId: "travel" },
10
+ { id: "travel.hotel", label: "Hotels", parentId: "travel" },
11
+ { id: "travel.package", label: "Travel Packages", parentId: "travel" },
12
+ { id: "automotive", label: "Automotive" },
13
+ { id: "automotive.car", label: "Cars", parentId: "automotive" },
14
+ { id: "automotive.motorcycle", label: "Motorcycles", parentId: "automotive" },
15
+ { id: "finance", label: "Finance" },
16
+ { id: "finance.insurance", label: "Insurance", parentId: "finance" },
17
+ { id: "finance.credit-card", label: "Credit Cards", parentId: "finance" },
18
+ { id: "finance.loan", label: "Loans", parentId: "finance" },
19
+ { id: "sports", label: "Sports" },
20
+ { id: "sports.running", label: "Running", parentId: "sports" },
21
+ { id: "sports.cycling", label: "Cycling", parentId: "sports" },
22
+ { id: "fitness", label: "Fitness" },
23
+ { id: "fitness.gym", label: "Gym", parentId: "fitness" },
24
+ { id: "home", label: "Home" },
25
+ { id: "home.furniture", label: "Furniture", parentId: "home" },
26
+ { id: "home.renovation", label: "Renovation", parentId: "home" },
27
+ { id: "education", label: "Education" },
28
+ { id: "education.course", label: "Courses", parentId: "education" },
29
+ {
30
+ id: "education.student-technology",
31
+ label: "Student Technology",
32
+ parentId: "education",
33
+ },
34
+ ];
35
+ export const TAXONOMY = new Map(rawTopics.map((topic) => [topic.id, topic]));
36
+ export function getTopic(id) {
37
+ return TAXONOMY.get(id);
38
+ }
39
+ export function isValidTopicId(id) {
40
+ return TAXONOMY.has(id);
41
+ }
42
+ export function listTopics() {
43
+ return [...TAXONOMY.values()];
44
+ }
45
+ /** Full ancestor chain for a topic, from itself up to the root, e.g. ["a.b.c", "a.b", "a"]. */
46
+ function ancestorChain(id) {
47
+ const chain = [];
48
+ let current = TAXONOMY.get(id);
49
+ while (current) {
50
+ chain.push(current.id);
51
+ current = current.parentId ? TAXONOMY.get(current.parentId) : undefined;
52
+ }
53
+ return chain;
54
+ }
55
+ /** True if `candidate` is the same topic as `target`, or a descendant of it. */
56
+ export function isSameOrDescendant(candidate, target) {
57
+ return ancestorChain(candidate).includes(target);
58
+ }
59
+ /**
60
+ * Distance between two topics in the taxonomy tree, measured via their nearest
61
+ * common ancestor. Returns `Infinity` if the topics share no ancestor (including
62
+ * when either topic id is unknown).
63
+ */
64
+ export function topicDistance(a, b) {
65
+ if (a === b)
66
+ return 0;
67
+ const chainA = ancestorChain(a);
68
+ const chainB = ancestorChain(b);
69
+ if (chainA.length === 0 || chainB.length === 0)
70
+ return Infinity;
71
+ const depthB = new Map(chainB.map((id, index) => [id, index]));
72
+ for (let indexA = 0; indexA < chainA.length; indexA += 1) {
73
+ const ancestor = chainA[indexA];
74
+ const indexB = depthB.get(ancestor);
75
+ if (indexB !== undefined) {
76
+ return indexA + indexB;
77
+ }
78
+ }
79
+ return Infinity;
80
+ }
81
+ //# sourceMappingURL=taxonomy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"taxonomy.js","sourceRoot":"","sources":["../src/taxonomy.ts"],"names":[],"mappings":"AAUA,MAAM,SAAS,GAAsB;IACnC,EAAE,EAAE,EAAE,aAAa,EAAE,KAAK,EAAE,aAAa,EAAE;IAC3C,EAAE,EAAE,EAAE,sBAAsB,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,aAAa,EAAE;IAC3E,EAAE,EAAE,EAAE,6BAA6B,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,sBAAsB,EAAE;IACzF,EAAE,EAAE,EAAE,8BAA8B,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,sBAAsB,EAAE;IAC3F,EAAE,EAAE,EAAE,mBAAmB,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,EAAE;IACrE,EAAE,EAAE,EAAE,oBAAoB,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,aAAa,EAAE;IAEvE,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE;IACjC,EAAE,EAAE,EAAE,eAAe,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE;IAC7D,EAAE,EAAE,EAAE,cAAc,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE;IAC3D,EA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AAC,SAAiB,EAAE,MAAc;IAClE,OAAO,aAAa,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AACnD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,CAAS,EAAE,CAAS;IAChD,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,CAAC,CAAC;IAEtB,MAAM,MAAM,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC;IAChC,MAAM,MAAM,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC;IAChC,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,QAAQ,CAAC;IAEhE,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IAE/D,KAAK,IAAI,MAAM,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,IAAI,CAAC,EAAE,CAAC;QACzD,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAW,CAAC;QAC1C,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACpC,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YACzB,OAAO,MAAM,GAAG,MAAM,CAAC;QACzB,CAAC;IACH,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -0,0 +1,4 @@
1
+ /** Tinybar amounts are opaque decimal strings - compare/add via BigInt, never as floats. */
2
+ export declare function tinybarLte(a: string, b: string): boolean;
3
+ export declare function tinybarAdd(a: string, b: string): string;
4
+ //# sourceMappingURL=tinybar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tinybar.d.ts","sourceRoot":"","sources":["../src/tinybar.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAExD;AAED,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAEvD"}
@@ -0,0 +1,8 @@
1
+ /** Tinybar amounts are opaque decimal strings - compare/add via BigInt, never as floats. */
2
+ export function tinybarLte(a, b) {
3
+ return BigInt(a) <= BigInt(b);
4
+ }
5
+ export function tinybarAdd(a, b) {
6
+ return (BigInt(a) + BigInt(b)).toString();
7
+ }
8
+ //# sourceMappingURL=tinybar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tinybar.js","sourceRoot":"","sources":["../src/tinybar.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,MAAM,UAAU,UAAU,CAAC,CAAS,EAAE,CAAS;IAC7C,OAAO,MAAM,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,CAAS,EAAE,CAAS;IAC7C,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;AAC5C,CAAC"}
package/package.json ADDED
@@ -0,0 +1,42 @@
1
+ {
2
+ "name": "@hark-protocol/protocol",
3
+ "version": "0.1.0",
4
+ "description": "Shared Zod schemas, taxonomy, and constants for the Hark Protocol intent-advertising ecosystem.",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/SiddharthaMadhav/ETHOnline-2026.git",
9
+ "directory": "packages/protocol"
10
+ },
11
+ "keywords": ["hark-protocol", "hedera", "x402", "intent-advertising"],
12
+ "type": "module",
13
+ "main": "./dist/index.js",
14
+ "types": "./dist/index.d.ts",
15
+ "files": ["dist"],
16
+ "publishConfig": {
17
+ "access": "public"
18
+ },
19
+ "exports": {
20
+ ".": {
21
+ "types": "./dist/index.d.ts",
22
+ "default": "./dist/index.js"
23
+ },
24
+ "./hcs14": {
25
+ "types": "./dist/hcs14.d.ts",
26
+ "default": "./dist/hcs14.js"
27
+ }
28
+ },
29
+ "scripts": {
30
+ "build": "tsc -p tsconfig.json",
31
+ "typecheck": "tsc --noEmit",
32
+ "test": "vitest run"
33
+ },
34
+ "dependencies": {
35
+ "zod": "^3.23.8"
36
+ },
37
+ "devDependencies": {
38
+ "@types/node": "^22.10.2",
39
+ "typescript": "^5.6.3",
40
+ "vitest": "^2.1.4"
41
+ }
42
+ }