@ixo/openhands-sdk 0.2.0 → 0.3.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 (97) hide show
  1. package/dist/cjs/chain/entityShape.d.ts +208 -0
  2. package/dist/cjs/chain/entityShape.d.ts.map +1 -0
  3. package/dist/cjs/chain/entityShape.js +201 -0
  4. package/dist/cjs/chain/entityShape.js.map +1 -0
  5. package/dist/cjs/chain/env.d.ts +73 -6
  6. package/dist/cjs/chain/env.d.ts.map +1 -1
  7. package/dist/cjs/chain/env.js +156 -14
  8. package/dist/cjs/chain/env.js.map +1 -1
  9. package/dist/cjs/config.d.ts +29 -3
  10. package/dist/cjs/config.d.ts.map +1 -1
  11. package/dist/cjs/config.js +7 -2
  12. package/dist/cjs/config.js.map +1 -1
  13. package/dist/cjs/data/agent.d.ts.map +1 -1
  14. package/dist/cjs/data/agent.js +5 -4
  15. package/dist/cjs/data/agent.js.map +1 -1
  16. package/dist/cjs/data/queue.d.ts.map +1 -1
  17. package/dist/cjs/data/queue.js +3 -2
  18. package/dist/cjs/data/queue.js.map +1 -1
  19. package/dist/cjs/data/receipt.d.ts.map +1 -1
  20. package/dist/cjs/data/receipt.js +6 -2
  21. package/dist/cjs/data/receipt.js.map +1 -1
  22. package/dist/cjs/data/threads.d.ts.map +1 -1
  23. package/dist/cjs/data/threads.js +8 -3
  24. package/dist/cjs/data/threads.js.map +1 -1
  25. package/dist/cjs/geo/geohash.d.ts +14 -0
  26. package/dist/cjs/geo/geohash.d.ts.map +1 -0
  27. package/dist/cjs/geo/geohash.js +64 -0
  28. package/dist/cjs/geo/geohash.js.map +1 -0
  29. package/dist/cjs/rubric/marketPlan.d.ts +144 -0
  30. package/dist/cjs/rubric/marketPlan.d.ts.map +1 -0
  31. package/dist/cjs/rubric/marketPlan.js +319 -0
  32. package/dist/cjs/rubric/marketPlan.js.map +1 -0
  33. package/dist/cjs/rubric/observation.d.ts +53 -0
  34. package/dist/cjs/rubric/observation.d.ts.map +1 -0
  35. package/dist/cjs/rubric/observation.js +38 -0
  36. package/dist/cjs/rubric/observation.js.map +1 -0
  37. package/dist/cjs/rubric/pingLink.d.ts +45 -0
  38. package/dist/cjs/rubric/pingLink.d.ts.map +1 -0
  39. package/dist/cjs/rubric/pingLink.js +74 -0
  40. package/dist/cjs/rubric/pingLink.js.map +1 -0
  41. package/dist/cjs/rubric/pingMatch.d.ts +73 -0
  42. package/dist/cjs/rubric/pingMatch.d.ts.map +1 -0
  43. package/dist/cjs/rubric/pingMatch.js +65 -0
  44. package/dist/cjs/rubric/pingMatch.js.map +1 -0
  45. package/dist/cjs/rubric/terms.d.ts +8 -0
  46. package/dist/cjs/rubric/terms.d.ts.map +1 -1
  47. package/dist/cjs/rubric/terms.js +2 -0
  48. package/dist/cjs/rubric/terms.js.map +1 -1
  49. package/dist/esm/chain/entityShape.d.ts +208 -0
  50. package/dist/esm/chain/entityShape.d.ts.map +1 -0
  51. package/dist/esm/chain/entityShape.js +184 -0
  52. package/dist/esm/chain/entityShape.js.map +1 -0
  53. package/dist/esm/chain/env.d.ts +73 -6
  54. package/dist/esm/chain/env.d.ts.map +1 -1
  55. package/dist/esm/chain/env.js +146 -12
  56. package/dist/esm/chain/env.js.map +1 -1
  57. package/dist/esm/config.d.ts +29 -3
  58. package/dist/esm/config.d.ts.map +1 -1
  59. package/dist/esm/config.js +7 -3
  60. package/dist/esm/config.js.map +1 -1
  61. package/dist/esm/data/agent.d.ts.map +1 -1
  62. package/dist/esm/data/agent.js +5 -4
  63. package/dist/esm/data/agent.js.map +1 -1
  64. package/dist/esm/data/queue.d.ts.map +1 -1
  65. package/dist/esm/data/queue.js +3 -2
  66. package/dist/esm/data/queue.js.map +1 -1
  67. package/dist/esm/data/receipt.d.ts.map +1 -1
  68. package/dist/esm/data/receipt.js +6 -2
  69. package/dist/esm/data/receipt.js.map +1 -1
  70. package/dist/esm/data/threads.d.ts.map +1 -1
  71. package/dist/esm/data/threads.js +8 -3
  72. package/dist/esm/data/threads.js.map +1 -1
  73. package/dist/esm/geo/geohash.d.ts +14 -0
  74. package/dist/esm/geo/geohash.d.ts.map +1 -0
  75. package/dist/esm/geo/geohash.js +60 -0
  76. package/dist/esm/geo/geohash.js.map +1 -0
  77. package/dist/esm/rubric/marketPlan.d.ts +144 -0
  78. package/dist/esm/rubric/marketPlan.d.ts.map +1 -0
  79. package/dist/esm/rubric/marketPlan.js +305 -0
  80. package/dist/esm/rubric/marketPlan.js.map +1 -0
  81. package/dist/esm/rubric/observation.d.ts +53 -0
  82. package/dist/esm/rubric/observation.d.ts.map +1 -0
  83. package/dist/esm/rubric/observation.js +33 -0
  84. package/dist/esm/rubric/observation.js.map +1 -0
  85. package/dist/esm/rubric/pingLink.d.ts +45 -0
  86. package/dist/esm/rubric/pingLink.d.ts.map +1 -0
  87. package/dist/esm/rubric/pingLink.js +69 -0
  88. package/dist/esm/rubric/pingLink.js.map +1 -0
  89. package/dist/esm/rubric/pingMatch.d.ts +73 -0
  90. package/dist/esm/rubric/pingMatch.d.ts.map +1 -0
  91. package/dist/esm/rubric/pingMatch.js +60 -0
  92. package/dist/esm/rubric/pingMatch.js.map +1 -0
  93. package/dist/esm/rubric/terms.d.ts +8 -0
  94. package/dist/esm/rubric/terms.d.ts.map +1 -1
  95. package/dist/esm/rubric/terms.js +2 -0
  96. package/dist/esm/rubric/terms.js.map +1 -1
  97. package/package.json +1 -1
@@ -0,0 +1,208 @@
1
+ /**
2
+ * The shape of every entity Openhands mints, as plain data (W2 of the IXO
3
+ * alignment plan). Pure functions, no chain client, no `node:` builtin, so the
4
+ * `chain` barrel stays isomorphic and the same builders serve the browser's
5
+ * poster, the worker, the MCP and every script. The caller wraps the result
6
+ * in `MsgCreateEntity.fromPartial` / `LinkedResource.fromPartial`.
7
+ *
8
+ * What "the IXO shape" is (verified on chain and in the portal's own
9
+ * `createEntity.ts`, 2026-10-09):
10
+ *
11
+ * - `context` is `[{ixo: https://w3id.org/ixo/context/v1}, {class: <protocol DID>}]`;
12
+ * the class is the `protocol/...` the entity is created from.
13
+ * - `service` carries `#matrix` (type `MatrixHomeServer` — what the portal and
14
+ * the evals-engine match on) and, while the claim lane still serves public
15
+ * CIDs, `#ipfs`. Never `#cellnode`.
16
+ * - `linkedResource` carries `#pro` (type `Settings`, description `Profile`)
17
+ * and `#dmn` (type `domainCard`) on every entity; `#done`, `#rub`, `#vct`
18
+ * where the kind calls for them. `serviceEndpoint` is where the bytes are,
19
+ * `proof` their content address.
20
+ * - `linkedEntity` links a deed to its claim protocol (`verifiableClaim`) and
21
+ * a campaign ask to its campaign protocol (`partOf`). No link to any DAO.
22
+ */
23
+ export declare const IXO_CONTEXT_URL = "https://w3id.org/ixo/context/v1";
24
+ /** A DID of the entity module's shape, `did:ixo:entity:<32 hex>`. */
25
+ export declare const isEntityDid: (value: unknown) => value is string;
26
+ export type EntityKind = "deed/request" | "protocol/deed" | "protocol/verifiableClaim" | "oracle";
27
+ export interface ContextEntry {
28
+ key: string;
29
+ val: string;
30
+ }
31
+ /** The JSON-LD context every classed entity carries: the ixo vocabulary and the class it was created from. */
32
+ export declare function classContext(classDid: string): ContextEntry[];
33
+ export interface ServiceShape {
34
+ id: string;
35
+ type: string;
36
+ serviceEndpoint: string;
37
+ }
38
+ /** `{id}#matrix`, the type readers match on (`MatrixHomeServer`), the homeserver without a trailing slash. */
39
+ export declare const matrixService: (homeserver: string) => ServiceShape;
40
+ /** `{id}#ipfs` — kept only while claim bodies and attachments are served as public CIDs. */
41
+ export declare const ipfsGatewayService: (gatewayUrl: string) => ServiceShape;
42
+ export interface ResourceShape {
43
+ id: string;
44
+ type: string;
45
+ description: string;
46
+ mediaType: string;
47
+ serviceEndpoint: string;
48
+ proof: string;
49
+ encrypted: "false";
50
+ right: "";
51
+ }
52
+ /** Where a document lives and its content address. */
53
+ export interface DocRef {
54
+ url: string;
55
+ proof: string;
56
+ }
57
+ /** `#pro` — blocksync surfaces it as `settings.Profile`; Trace, the portal and `data/profiles.ts` read the name from it. */
58
+ export declare const profileResource: (doc: DocRef) => ResourceShape;
59
+ /** `#dmn` — the domain card; the indexer finds it by this type. */
60
+ export declare const domainCardResource: (doc: DocRef) => ResourceShape;
61
+ /** `#done` — the ask's terms; readers match the type, not the fragment. */
62
+ export declare const doneMeansResource: (doc: DocRef) => ResourceShape;
63
+ /** `#rub` — the evals-engine rubric; the engine matches `type === "rubric"` at an id ending `#rub`, and the proof is its hex sha256. */
64
+ export declare const rubricResource: (doc: DocRef) => ResourceShape;
65
+ /** `#vct` — the claim form a rubric binds to; the engine finds it by id suffix on the collection's protocol. */
66
+ export declare const claimFormResource: (doc: DocRef) => ResourceShape;
67
+ export interface LinkedEntityShape {
68
+ id: string;
69
+ type: string;
70
+ relationship: string;
71
+ service: "";
72
+ }
73
+ /** A deed → the `protocol/verifiableClaim` its collections point at. */
74
+ export declare const verifiableClaimLink: (protocolDid: string) => LinkedEntityShape;
75
+ /** A campaign ask → its campaign `protocol/deed`. Never a DAO: the only `partOf` this estate writes. */
76
+ export declare const campaignLink: (campaignProtocolDid: string) => LinkedEntityShape;
77
+ export interface ProfileInput {
78
+ name: string;
79
+ description?: string;
80
+ orgName?: string;
81
+ brand?: string;
82
+ location?: string;
83
+ image?: string;
84
+ logo?: string;
85
+ }
86
+ /** The `#pro` document, exactly the shape the portal writes (`createEntity.ts`) and every reader expects (`type: "profile"`, `name`). */
87
+ export declare function buildProfile(input: ProfileInput): {
88
+ "@context": {
89
+ ixo: string;
90
+ "@id": string;
91
+ type: string;
92
+ "@protected": boolean;
93
+ };
94
+ id: string;
95
+ type: string;
96
+ orgName: string;
97
+ name: string;
98
+ image: string;
99
+ logo: string;
100
+ brand: string;
101
+ location: string;
102
+ description: string;
103
+ attributes: {
104
+ key: string;
105
+ value: string;
106
+ }[];
107
+ metrics: unknown[];
108
+ };
109
+ export type DomainCardSubjectType = "ixo:Deed" | "ixo:Protocol" | "ixo:Oracle";
110
+ export interface DomainCardInput {
111
+ /** The entity the card describes (also its issuer unless `issuer` is given). */
112
+ did: string;
113
+ issuer?: string;
114
+ type: DomainCardSubjectType;
115
+ name: string;
116
+ description: string;
117
+ /** The ask's or protocol's page. */
118
+ url?: string;
119
+ logo?: string;
120
+ /** Cover images, first is the hero. */
121
+ image?: string[];
122
+ keywords?: string[];
123
+ /** The `#done` terms (or any document the card is about). */
124
+ relatedDocument?: string;
125
+ /** Campaign, poster, protocol — `{ type, id, relationship }` as the card spec lays them out. */
126
+ relationships?: {
127
+ type: string;
128
+ id: string;
129
+ relationship: string;
130
+ }[];
131
+ geo?: {
132
+ latitude: number;
133
+ longitude: number;
134
+ };
135
+ validFrom?: string;
136
+ }
137
+ /**
138
+ * The `#dmn` document: a Verifiable Credential of type `ixo:DomainCard` per
139
+ * `ixoworld/domainCards` (`schemas/ixo-domain-card-1.json`). Unsigned here —
140
+ * the indexer and the portal never verify a proof; a signer can add one.
141
+ */
142
+ export declare function buildDomainCard(input: DomainCardInput): {
143
+ "@context": readonly ["https://www.w3.org/ns/credentials/v2", "https://w3id.org/ixo/context/v1", {
144
+ readonly attribute: "https://w3id.org/ixo/attributes/v1/";
145
+ readonly schema: "https://schema.org/";
146
+ readonly ixo: "https://w3id.org/ixo/vocab/v1";
147
+ readonly prov: "http://www.w3.org/ns/prov#";
148
+ readonly proj: "https://linked.data.gov.au/def/project#";
149
+ readonly xsd: "http://www.w3.org/2001/XMLSchema#";
150
+ readonly id: "@id";
151
+ readonly type: "@type";
152
+ readonly "@protected": true;
153
+ }];
154
+ id: string;
155
+ type: string[];
156
+ issuer: {
157
+ id: string;
158
+ };
159
+ validFrom: string;
160
+ credentialSchema: {
161
+ id: string;
162
+ type: string;
163
+ };
164
+ credentialSubject: Record<string, unknown>;
165
+ };
166
+ export interface EntityMessageInput {
167
+ kind: EntityKind;
168
+ /** The protocol this entity is created from. */
169
+ classDid: string;
170
+ relayerNode: string;
171
+ ownerAddress: string;
172
+ ownerDid: string;
173
+ /** Verification methods for the owner, as the chain SDK builds them (`createIidVerificationMethods`); passed through. */
174
+ verification: unknown[];
175
+ services: ServiceShape[];
176
+ resources: ResourceShape[];
177
+ linkedEntities?: LinkedEntityShape[];
178
+ /** The title — kept for the readers that still look here; 140 chars at most. */
179
+ alsoKnownAs?: string;
180
+ startDate: Date;
181
+ /** Default: a hundred years on, the portal's convention. */
182
+ endDate?: Date;
183
+ }
184
+ /**
185
+ * The `MsgCreateEntity` body, minus the proto wrapping. Refuses the shapes
186
+ * the plan retired: a `dao` ask, an empty context, a cellnode service, a
187
+ * relayer that is not an entity DID.
188
+ */
189
+ export declare function buildEntityMessage(input: EntityMessageInput): {
190
+ entityType: EntityKind;
191
+ entityStatus: number;
192
+ context: ContextEntry[];
193
+ verification: unknown[];
194
+ controller: string[];
195
+ ownerAddress: string;
196
+ ownerDid: string;
197
+ relayerNode: string;
198
+ alsoKnownAs: string;
199
+ service: ServiceShape[];
200
+ linkedResource: ResourceShape[];
201
+ linkedEntity: LinkedEntityShape[];
202
+ accordedRight: unknown[];
203
+ linkedClaim: unknown[];
204
+ startDate: Date;
205
+ endDate: Date;
206
+ };
207
+ export type EntityMessageShape = ReturnType<typeof buildEntityMessage>;
208
+ //# sourceMappingURL=entityShape.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entityShape.d.ts","sourceRoot":"","sources":["../../../src/chain/entityShape.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,eAAO,MAAM,eAAe,oCAAoC,CAAC;AAEjE,qEAAqE;AACrE,eAAO,MAAM,WAAW,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,MAAkF,CAAC;AAEzI,MAAM,MAAM,UAAU,GAAG,cAAc,GAAG,eAAe,GAAG,0BAA0B,GAAG,QAAQ,CAAC;AAElG,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;CACb;AAED,8GAA8G;AAC9G,wBAAgB,YAAY,CAAC,QAAQ,EAAE,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AAE,EAAE,CAAC;IACrE,GAAG,CAAC,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;IAC9C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAoBD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,eAAe;;;;;;;;;;;;;;;;;;;;;;;EA6BrD;AAID,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,UAAU,CAAC;IACjB,gDAAgD;IAChD,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,yHAAyH;IACzH,YAAY,EAAE,OAAO,EAAE,CAAC;IACxB,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,SAAS,EAAE,aAAa,EAAE,CAAC;IAC3B,cAAc,CAAC,EAAE,iBAAiB,EAAE,CAAC;IACrC,gFAAgF;IAChF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,IAAI,CAAC;IAChB,4DAA4D;IAC5D,OAAO,CAAC,EAAE,IAAI,CAAC;CAChB;AAID;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,kBAAkB;;;;;;;;;;;;;mBAqBnC,OAAO,EAAE;iBACX,OAAO,EAAE;;;EAI/B;AAED,MAAM,MAAM,kBAAkB,GAAG,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
@@ -0,0 +1,201 @@
1
+ "use strict";
2
+ /**
3
+ * The shape of every entity Openhands mints, as plain data (W2 of the IXO
4
+ * alignment plan). Pure functions, no chain client, no `node:` builtin, so the
5
+ * `chain` barrel stays isomorphic and the same builders serve the browser's
6
+ * poster, the worker, the MCP and every script. The caller wraps the result
7
+ * in `MsgCreateEntity.fromPartial` / `LinkedResource.fromPartial`.
8
+ *
9
+ * What "the IXO shape" is (verified on chain and in the portal's own
10
+ * `createEntity.ts`, 2026-10-09):
11
+ *
12
+ * - `context` is `[{ixo: https://w3id.org/ixo/context/v1}, {class: <protocol DID>}]`;
13
+ * the class is the `protocol/...` the entity is created from.
14
+ * - `service` carries `#matrix` (type `MatrixHomeServer` — what the portal and
15
+ * the evals-engine match on) and, while the claim lane still serves public
16
+ * CIDs, `#ipfs`. Never `#cellnode`.
17
+ * - `linkedResource` carries `#pro` (type `Settings`, description `Profile`)
18
+ * and `#dmn` (type `domainCard`) on every entity; `#done`, `#rub`, `#vct`
19
+ * where the kind calls for them. `serviceEndpoint` is where the bytes are,
20
+ * `proof` their content address.
21
+ * - `linkedEntity` links a deed to its claim protocol (`verifiableClaim`) and
22
+ * a campaign ask to its campaign protocol (`partOf`). No link to any DAO.
23
+ */
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ exports.campaignLink = exports.verifiableClaimLink = exports.claimFormResource = exports.rubricResource = exports.doneMeansResource = exports.domainCardResource = exports.profileResource = exports.ipfsGatewayService = exports.matrixService = exports.isEntityDid = exports.IXO_CONTEXT_URL = void 0;
26
+ exports.classContext = classContext;
27
+ exports.buildProfile = buildProfile;
28
+ exports.buildDomainCard = buildDomainCard;
29
+ exports.buildEntityMessage = buildEntityMessage;
30
+ exports.IXO_CONTEXT_URL = "https://w3id.org/ixo/context/v1";
31
+ /** A DID of the entity module's shape, `did:ixo:entity:<32 hex>`. */
32
+ const isEntityDid = (value) => typeof value === "string" && /^did:ixo:entity:[0-9a-f]{32}$/.test(value);
33
+ exports.isEntityDid = isEntityDid;
34
+ /** The JSON-LD context every classed entity carries: the ixo vocabulary and the class it was created from. */
35
+ function classContext(classDid) {
36
+ if (!(0, exports.isEntityDid)(classDid))
37
+ throw new Error(`a class must be an entity DID, got ${JSON.stringify(classDid)}`);
38
+ return [
39
+ { key: "ixo", val: exports.IXO_CONTEXT_URL },
40
+ { key: "class", val: classDid }
41
+ ];
42
+ }
43
+ /** `{id}#matrix`, the type readers match on (`MatrixHomeServer`), the homeserver without a trailing slash. */
44
+ const matrixService = (homeserver) => ({ id: "{id}#matrix", type: "MatrixHomeServer", serviceEndpoint: homeserver.replace(/\/+$/, "") });
45
+ exports.matrixService = matrixService;
46
+ /** `{id}#ipfs` — kept only while claim bodies and attachments are served as public CIDs. */
47
+ const ipfsGatewayService = (gatewayUrl) => ({ id: "{id}#ipfs", type: "Ipfs", serviceEndpoint: `${gatewayUrl.replace(/\/+$/, "")}/ipfs/` });
48
+ exports.ipfsGatewayService = ipfsGatewayService;
49
+ const resource = (fragment, type, description, mediaType, doc) => {
50
+ if (!doc.url?.trim() || !doc.proof?.trim())
51
+ throw new Error(`#${fragment} needs both a url and a proof`);
52
+ return { id: `{id}#${fragment}`, type, description, mediaType, serviceEndpoint: doc.url.trim(), proof: doc.proof.trim(), encrypted: "false", right: "" };
53
+ };
54
+ /** `#pro` — blocksync surfaces it as `settings.Profile`; Trace, the portal and `data/profiles.ts` read the name from it. */
55
+ const profileResource = (doc) => resource("pro", "Settings", "Profile", "application/ld+json", doc);
56
+ exports.profileResource = profileResource;
57
+ /** `#dmn` — the domain card; the indexer finds it by this type. */
58
+ const domainCardResource = (doc) => resource("dmn", "domainCard", "Domain card", "application/ld+json", doc);
59
+ exports.domainCardResource = domainCardResource;
60
+ /** `#done` — the ask's terms; readers match the type, not the fragment. */
61
+ const doneMeansResource = (doc) => resource("done", "DoneMeans", "What would count as done, published before the work", "application/json", doc);
62
+ exports.doneMeansResource = doneMeansResource;
63
+ /** `#rub` — the evals-engine rubric; the engine matches `type === "rubric"` at an id ending `#rub`, and the proof is its hex sha256. */
64
+ const rubricResource = (doc) => resource("rub", "rubric", "The same terms, in the evals-engine's rubric format", "application/ld+json", doc);
65
+ exports.rubricResource = rubricResource;
66
+ /** `#vct` — the claim form a rubric binds to; the engine finds it by id suffix on the collection's protocol. */
67
+ const claimFormResource = (doc) => resource("vct", "surveyTemplate", "The claim form this protocol's rubrics are bound to", "application/ld+json", doc);
68
+ exports.claimFormResource = claimFormResource;
69
+ /** A deed → the `protocol/verifiableClaim` its collections point at. */
70
+ const verifiableClaimLink = (protocolDid) => {
71
+ if (!(0, exports.isEntityDid)(protocolDid))
72
+ throw new Error(`verifiableClaim link needs an entity DID, got ${JSON.stringify(protocolDid)}`);
73
+ return { id: protocolDid, type: "protocol/verifiableClaim", relationship: "verifiableClaim", service: "" };
74
+ };
75
+ exports.verifiableClaimLink = verifiableClaimLink;
76
+ /** A campaign ask → its campaign `protocol/deed`. Never a DAO: the only `partOf` this estate writes. */
77
+ const campaignLink = (campaignProtocolDid) => {
78
+ if (!(0, exports.isEntityDid)(campaignProtocolDid))
79
+ throw new Error(`partOf link needs an entity DID, got ${JSON.stringify(campaignProtocolDid)}`);
80
+ return { id: campaignProtocolDid, type: "protocol/deed", relationship: "partOf", service: "" };
81
+ };
82
+ exports.campaignLink = campaignLink;
83
+ /** The `#pro` document, exactly the shape the portal writes (`createEntity.ts`) and every reader expects (`type: "profile"`, `name`). */
84
+ function buildProfile(input) {
85
+ const name = input.name.trim();
86
+ if (!name)
87
+ throw new Error("a profile needs a name");
88
+ return {
89
+ "@context": { ixo: "https://w3id.org/ixo/ns/protocol/", "@id": "@type", type: "@type", "@protected": true },
90
+ id: "ixo:entity#profile",
91
+ type: "profile",
92
+ orgName: (input.orgName ?? "Openhands").trim(),
93
+ name,
94
+ image: input.image ?? "",
95
+ logo: input.logo ?? "",
96
+ brand: (input.brand ?? "Openhands").trim(),
97
+ location: (input.location ?? "Global").trim(),
98
+ description: (input.description ?? "").trim(),
99
+ attributes: [],
100
+ metrics: []
101
+ };
102
+ }
103
+ const CARD_CONTEXT = [
104
+ "https://www.w3.org/ns/credentials/v2",
105
+ "https://w3id.org/ixo/context/v1",
106
+ {
107
+ attribute: "https://w3id.org/ixo/attributes/v1/",
108
+ schema: "https://schema.org/",
109
+ ixo: "https://w3id.org/ixo/vocab/v1",
110
+ prov: "http://www.w3.org/ns/prov#",
111
+ proj: "https://linked.data.gov.au/def/project#",
112
+ xsd: "http://www.w3.org/2001/XMLSchema#",
113
+ id: "@id",
114
+ type: "@type",
115
+ "@protected": true
116
+ }
117
+ ];
118
+ const imageObject = (url) => ({ type: "schema:ImageObject", id: url, contentUrl: url });
119
+ /**
120
+ * The `#dmn` document: a Verifiable Credential of type `ixo:DomainCard` per
121
+ * `ixoworld/domainCards` (`schemas/ixo-domain-card-1.json`). Unsigned here —
122
+ * the indexer and the portal never verify a proof; a signer can add one.
123
+ */
124
+ function buildDomainCard(input) {
125
+ if (!(0, exports.isEntityDid)(input.did))
126
+ throw new Error(`a domain card needs the entity's DID, got ${JSON.stringify(input.did)}`);
127
+ const name = input.name.trim();
128
+ if (!name)
129
+ throw new Error("a domain card needs a name");
130
+ const subject = {
131
+ id: input.did,
132
+ type: [input.type],
133
+ name,
134
+ description: input.description.trim()
135
+ };
136
+ if (input.url)
137
+ subject.url = input.url;
138
+ if (input.logo)
139
+ subject.logo = { ...imageObject(input.logo), "schema:additionalProperty": [
140
+ { type: "schema:PropertyValue", name: "logoLight", value: imageObject(input.logo) },
141
+ { type: "schema:PropertyValue", name: "logoDark", value: imageObject(input.logo) }
142
+ ] };
143
+ if (input.image?.length)
144
+ subject.image = input.image.map(imageObject);
145
+ if (input.keywords?.length)
146
+ subject.keywords = input.keywords;
147
+ if (input.geo)
148
+ subject.geoCoordinates = { latitude: String(input.geo.latitude), longitude: String(input.geo.longitude) };
149
+ if (input.relatedDocument)
150
+ subject.relatedDocument = { type: "schema:CreativeWork", id: input.relatedDocument };
151
+ if (input.relationships?.length)
152
+ subject.relationships = input.relationships;
153
+ return {
154
+ "@context": CARD_CONTEXT,
155
+ id: `${input.did}#dmn`,
156
+ type: ["VerifiableCredential", "ixo:DomainCard"],
157
+ issuer: { id: input.issuer ?? input.did },
158
+ validFrom: input.validFrom ?? new Date().toISOString().slice(0, 19) + "Z",
159
+ credentialSchema: { id: "https://w3id.org/ixo/protocol/schema/v1#domainCard", type: "JsonSchema" },
160
+ credentialSubject: subject
161
+ };
162
+ }
163
+ const HUNDRED_YEARS_MS = 100 * 365 * 24 * 3600 * 1000;
164
+ /**
165
+ * The `MsgCreateEntity` body, minus the proto wrapping. Refuses the shapes
166
+ * the plan retired: a `dao` ask, an empty context, a cellnode service, a
167
+ * relayer that is not an entity DID.
168
+ */
169
+ function buildEntityMessage(input) {
170
+ if (!(0, exports.isEntityDid)(input.relayerNode))
171
+ throw new Error(`relayerNode must be an entity DID, got ${JSON.stringify(input.relayerNode)}`);
172
+ if (input.services.some((service) => service.type === "Cellnode" || /#cellnode$/.test(service.id)))
173
+ throw new Error("no #cellnode service: documents live on Matrix media (rule of 2026-10-09)");
174
+ if (!input.services.some((service) => service.type === "MatrixHomeServer"))
175
+ throw new Error("every entity declares its Matrix homeserver as a MatrixHomeServer service");
176
+ if (!input.resources.some((item) => item.id === "{id}#pro"))
177
+ throw new Error("every entity carries a #pro profile — it is the only name Trace reads");
178
+ const ids = input.resources.map((item) => item.id);
179
+ const duplicate = ids.find((id, index) => ids.indexOf(id) !== index);
180
+ if (duplicate)
181
+ throw new Error(`linked resource ${duplicate} appears twice`);
182
+ return {
183
+ entityType: input.kind,
184
+ entityStatus: 0,
185
+ context: classContext(input.classDid),
186
+ verification: input.verification,
187
+ controller: [input.ownerDid],
188
+ ownerAddress: input.ownerAddress,
189
+ ownerDid: input.ownerDid,
190
+ relayerNode: input.relayerNode,
191
+ alsoKnownAs: (input.alsoKnownAs ?? "").slice(0, 140),
192
+ service: input.services,
193
+ linkedResource: input.resources,
194
+ linkedEntity: input.linkedEntities ?? [],
195
+ accordedRight: [],
196
+ linkedClaim: [],
197
+ startDate: input.startDate,
198
+ endDate: input.endDate ?? new Date(input.startDate.getTime() + HUNDRED_YEARS_MS)
199
+ };
200
+ }
201
+ //# sourceMappingURL=entityShape.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entityShape.js","sourceRoot":"","sources":["../../../src/chain/entityShape.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;GAqB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c,IAAI,EAAE;QACxC,aAAa,EAAE,EAAe;QAC9B,WAAW,EAAE,EAAe;QAC5B,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,OAAO,EAAE,KAAK,CAAC,OAAO,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,OAAO,EAAE,GAAG,gBAAgB,CAAC;KACjF,CAAC;AACJ,CAAC"}
@@ -1,14 +1,47 @@
1
1
  import { type Network, network } from "../network.ts";
2
2
  export { network };
3
+ /**
4
+ * The relayer nodes Openhands may name. Two, by decision (2026-10-13):
5
+ * Qi.Space is the launch relayer and the default; Yoma is the secondary. No
6
+ * other node is offered — the per-network "whatever the index happened to
7
+ * use" defaults that stood here before (Impacts DAO on testnet, and the WRONG
8
+ * Impacts DAO on mainnet, which every deployment had to override) are gone.
9
+ *
10
+ * Why it matters: a portal lists an entity only when its `relayerNode` is
11
+ * the portal's own DAO and `entityVerified` is true, and
12
+ * `MsgUpdateEntityVerified` must be signed by a key with `authentication` on
13
+ * that node's IID. So the relayer decides who can see an ask and who can
14
+ * verify it. The chain itself only checks that the DID has an IID document,
15
+ * which is why a wrong value was accepted silently for a year.
16
+ */
17
+ export declare const RELAYER_NAMES: readonly ["qi-space", "yoma"];
18
+ export type RelayerName = (typeof RELAYER_NAMES)[number];
19
+ /** What `relayerChoice()` answers: a named node, or a DID the deployment set by hand. */
20
+ export type RelayerChoice = RelayerName | "custom";
3
21
  /** The chain endpoints each network uses when nothing overrides them. The only copy of this table. */
4
22
  export interface ChainEndpoints {
5
23
  rpcUrl: string;
6
24
  restUrl: string;
7
25
  graphqlUrl: string;
8
- relayerNodeDid: string;
9
26
  faucetUrl: string | null;
27
+ /** The relayer nodes by name; `null` where that operator has no node on this network. */
28
+ relayers: Readonly<Record<RelayerName, string | null>>;
29
+ /** Which of `relayers` is used when neither `configure()` nor the environment chooses (not consulted on mainnet, see `relayerNode()`). */
30
+ defaultRelayer: RelayerName;
31
+ /** The default relayer's DID — what `relayerNode()` answers when nothing overrides it. */
32
+ relayerNodeDid: string;
33
+ /** The `protocol/deed` root an ask deed is classed under (chain-verified, 2026-10-09). */
34
+ deedClassDid: string;
35
+ /** The `protocol/verifiableClaim` class a claim protocol is classed under; `null` where unconfirmed (devnet). */
36
+ verifiableClaimClassDid: string | null;
37
+ /** The Matrix homeserver whose media repo holds every linked document (`#dmn`, `#pro`, `#done`, `#rub`, `#vct`). */
38
+ matrixHomeserver: string;
10
39
  }
11
40
  export declare const chainEndpointsFor: (net: Network) => Readonly<ChainEndpoints>;
41
+ /** The DID of a named relayer on a network, or `null` when that operator has no node there. */
42
+ export declare const relayerNodeFor: (net: Network, name: RelayerName) => string | null;
43
+ /** `true` for the two names this SDK offers; anything else (including `""`) is not a relayer name. */
44
+ export declare const isRelayerName: (value: unknown) => value is RelayerName;
12
45
  /**
13
46
  * Where we talk to the chain.
14
47
  *
@@ -41,10 +74,44 @@ export declare const faucetUrl: () => string | null;
41
74
  */
42
75
  export declare const graphqlUrl: () => string;
43
76
  /**
44
- * The relayer node every entity we mint names. A DID, so it cannot be
45
- * guessed from the network name the way a URL can — hence the table. The
46
- * testnet value used to be hardcoded everywhere, which meant a devnet
47
- * deployment minted entities that pointed at a relayer on another chain.
77
+ * Which relayer this deployment posts under: the configured name, else
78
+ * `"custom"` when a DID was set by hand, else the network's default
79
+ * (`qi-space` everywhere).
80
+ */
81
+ export declare function relayerChoice(): RelayerChoice;
82
+ /**
83
+ * The relayer node every entity we mint names — or `null` when this
84
+ * deployment has not said which, on a network where it must.
85
+ *
86
+ * Order: `configure({ relayerNodeDid })` / `NEXT_PUBLIC_RELAYER_NODE_DID`
87
+ * (an explicit DID always wins; it is the deployment's own choice), then
88
+ * `configure({ relayer })` / `NEXT_PUBLIC_RELAYER` (a name from the table),
89
+ * then the network's default. **Mainnet has no default**: real entities on
90
+ * the wrong node are invisible to every portal and unverifiable by the keys
91
+ * we hold, so an unconfigured mainnet answers `null` here and `relayerNode()`
92
+ * throws before anything is signed. A named relayer without a node on this
93
+ * network is `null` too.
94
+ */
95
+ export declare function relayerNodeIfConfigured(): string | null;
96
+ /**
97
+ * The relayer node to put on a `MsgCreateEntity`. Throws, naming the setting
98
+ * to fix, when `relayerNodeIfConfigured()` has no answer — the message is
99
+ * meant to be read by whoever deploys, before a single signature.
100
+ */
101
+ export declare function relayerNode(): string;
102
+ /** The `protocol/deed` class a new ask deed is created under. `NEXT_PUBLIC_DEED_CLASS_DID` overrides the network's. */
103
+ export declare const deedClassDid: () => string;
104
+ /** The `protocol/verifiableClaim` class, or `null` where the network's is unconfirmed (devnet) and nothing overrides it. */
105
+ export declare const verifiableClaimClassDidIfConfigured: () => string | null;
106
+ /** The `protocol/verifiableClaim` class a new claim protocol is created under. Throws where the network's is unconfirmed and nothing overrides it. */
107
+ export declare function verifiableClaimClassDid(): string;
108
+ /**
109
+ * The Matrix homeserver whose media repo holds every linked document:
110
+ * `configure({ matrixHomeserver })`, then `NEXT_PUBLIC_MATRIX_HOMESERVER`, then
111
+ * the network's. No trailing slash. Never the Worker's `MATRIX_HOMESERVER`
112
+ * binding: a `MATRIX_*` read marks a module server-only, and this one is
113
+ * reachable from every public barrel (barrels.test.ts). A Worker that wants
114
+ * its binding honoured passes it through `configure()`.
48
115
  */
49
- export declare const relayerNode: () => string;
116
+ export declare const matrixHomeserver: () => string;
50
117
  //# sourceMappingURL=env.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../../src/chain/env.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAOtD,OAAO,EAAE,OAAO,EAAE,CAAC;AAEnB,sGAAsG;AACtG,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,GAAG,IA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