@greenlandai/sdk 0.5.4 → 0.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +135 -24
- package/package.json +1 -1
- package/src/gldai.js +51 -13
- package/src/joulepai.js +24 -1
- package/src/rareeai.js +42 -10
package/dist/index.cjs
CHANGED
|
@@ -3995,36 +3995,53 @@ var GldaiSubmodule = class {
|
|
|
3995
3995
|
this._t = transport;
|
|
3996
3996
|
this._base = baseUrl;
|
|
3997
3997
|
}
|
|
3998
|
+
/** GET /api/v1/companies (Class C, metered): charged_joules + the metering block (file header — read metering.settlement to know whether you paid). */
|
|
3998
3999
|
companies({ idempotencyKey, ...params } = {}) {
|
|
3999
4000
|
return this._t.request(this._base, "GET", "/api/v1/companies", { params, idempotencyKey });
|
|
4000
4001
|
}
|
|
4002
|
+
/** GET /api/v1/companies/{id} — metered: charged_joules + metering block (file header). */
|
|
4001
4003
|
company(companyId) {
|
|
4002
4004
|
return this._t.request(this._base, "GET", "/api/v1/companies/{cid}", { pathParams: { cid: companyId } });
|
|
4003
4005
|
}
|
|
4006
|
+
/** GET /api/v1/deposits — list resource deposits (Class C, metered). Filters via the params object
|
|
4007
|
+
* (API names, passed through): resource_type, country, status, owner_country, max_port_km, search,
|
|
4008
|
+
* limit (<=100), offset, and `commodity`. ⚠ `commodity` filters by the commodity GRAPH, not the
|
|
4009
|
+
* resource_type string: it matches a deposit that CONTAINS the commodity directly, OR CONTAINS a group
|
|
4010
|
+
* the commodity is MEMBER_OF — so commodity:"neodymium" returns EVERY rare-earth-element deposit,
|
|
4011
|
+
* including ones whose name never says "neodymium" (it would look broken otherwise). The top-level
|
|
4012
|
+
* `commodity_filter` {query, matched_directly, matched_via_group} tells you which (matched_via_group
|
|
4013
|
+
* names the group). Each deposit carries `commodities[]` {name, role:primary|byproduct, group};
|
|
4014
|
+
* resource_type stays primary. The response also carries `charged_joules` (all-in metered cost; null
|
|
4015
|
+
* for a quota caller) and the metering block (file header). R6-C, 2026-09-22. */
|
|
4004
4016
|
deposits({ idempotencyKey, ...params } = {}) {
|
|
4005
4017
|
return this._t.request(this._base, "GET", "/api/v1/deposits", { params, idempotencyKey });
|
|
4006
4018
|
}
|
|
4019
|
+
/** GET /api/v1/deposits/{id} — metered: charged_joules + metering block (file header). */
|
|
4007
4020
|
deposit(depositId) {
|
|
4008
4021
|
return this._t.request(this._base, "GET", "/api/v1/deposits/{did}", { pathParams: { did: depositId } });
|
|
4009
4022
|
}
|
|
4023
|
+
/** GET /api/v1/infrastructure (Class C, metered): charged_joules + metering block (file header). */
|
|
4010
4024
|
infrastructureList({ idempotencyKey, ...params } = {}) {
|
|
4011
4025
|
return this._t.request(this._base, "GET", "/api/v1/infrastructure", { params, idempotencyKey });
|
|
4012
4026
|
}
|
|
4027
|
+
/** GET /api/v1/infrastructure/{id} — metered: charged_joules + metering block (file header). */
|
|
4013
4028
|
infrastructure(infraId) {
|
|
4014
4029
|
return this._t.request(this._base, "GET", "/api/v1/infrastructure/{iid}", { pathParams: { iid: infraId } });
|
|
4015
4030
|
}
|
|
4016
|
-
/** GET /api/v1/query — the natural-language intelligence query
|
|
4017
|
-
*
|
|
4018
|
-
*
|
|
4019
|
-
*
|
|
4020
|
-
*
|
|
4021
|
-
*
|
|
4031
|
+
/** GET /api/v1/query — the natural-language intelligence query. CLOSED TO ALL CALLERS TODAY (2026-09-22,
|
|
4032
|
+
* operator ruling): to agents by the August 2026 ruling (not part of the agent launch — the meter refuses
|
|
4033
|
+
* an agent 403 BEFORE any charge), to human sessions on capacity grounds (HUMAN_QUERY_ENABLED). It reopens
|
|
4034
|
+
* when there are servers for it. Nothing is charged for a refused call. Use the structured surface instead:
|
|
4035
|
+
* companies / deposits / infrastructure / projects / relationships / lookFrom / nearby / mapViewport. Kept
|
|
4036
|
+
* so the method resolves; matches the served llms.txt and spec. */
|
|
4022
4037
|
query(q, { idempotencyKey, ...params } = {}) {
|
|
4023
4038
|
return this._t.request(this._base, "GET", "/api/v1/query", { params: { q, ...params }, idempotencyKey });
|
|
4024
4039
|
}
|
|
4040
|
+
/** GET /api/v1/projects (Class C, metered): charged_joules + metering block (file header). */
|
|
4025
4041
|
projects({ idempotencyKey, ...params } = {}) {
|
|
4026
4042
|
return this._t.request(this._base, "GET", "/api/v1/projects", { params, idempotencyKey });
|
|
4027
4043
|
}
|
|
4044
|
+
/** GET /api/v1/projects/{id} — metered: charged_joules + metering block (file header). */
|
|
4028
4045
|
project(projectId) {
|
|
4029
4046
|
return this._t.request(this._base, "GET", "/api/v1/projects/{pid}", { pathParams: { pid: projectId } });
|
|
4030
4047
|
}
|
|
@@ -4052,7 +4069,9 @@ var GldaiSubmodule = class {
|
|
|
4052
4069
|
* (entityType+id). Metered against the CALLING agent's wallet (base + 0.5% rail; quote with
|
|
4053
4070
|
* billingQuote). entityType behaves two ways (backend 2026-09-14): entityType ALONE (with lat/lng)
|
|
4054
4071
|
* FILTERS the frame to that type; entityType + id ANCHORS the pose at that entity and keeps ALL types;
|
|
4055
|
-
* an unknown entityType is a 400 before any charge.
|
|
4072
|
+
* an unknown entityType is a 400 before any charge. Response: top-level charged_joules (the all-in debit —
|
|
4073
|
+
* the same figure as price.charged_joules; the price block stays as the breakdown) + the metering block
|
|
4074
|
+
* (file header). Same as the MCP `look_from` tool. */
|
|
4056
4075
|
lookFrom({
|
|
4057
4076
|
lat,
|
|
4058
4077
|
lng,
|
|
@@ -4071,7 +4090,8 @@ var GldaiSubmodule = class {
|
|
|
4071
4090
|
return this._t.request(this._base, "GET", "/api/v1/look.from", { params, idempotencyKey });
|
|
4072
4091
|
}
|
|
4073
4092
|
/** GET /api/v1/nearby — entities near a location; here entityType IS a content filter. Metered against
|
|
4074
|
-
* the CALLING agent's wallet (quote with billingQuote)
|
|
4093
|
+
* the CALLING agent's wallet (quote with billingQuote): charged_joules + metering block (file header).
|
|
4094
|
+
* Same as the MCP `nearby` tool. */
|
|
4075
4095
|
nearby({
|
|
4076
4096
|
lat,
|
|
4077
4097
|
lng,
|
|
@@ -4087,8 +4107,12 @@ var GldaiSubmodule = class {
|
|
|
4087
4107
|
}
|
|
4088
4108
|
/** GET /api/v1/relationships — labelled relationship hops (the MCP `hops` tool). `entity` is the START
|
|
4089
4109
|
* NODE, matched as a case-insensitive SUBSTRING of an entity NAME (never an id: "3" matches any name
|
|
4090
|
-
* containing "3"), so pass a full, distinctive name. `hops` = depth 1-10.
|
|
4091
|
-
*
|
|
4110
|
+
* containing "3"), so pass a full, distinctive name. `hops` = depth 1-10. relationType (one relation label,
|
|
4111
|
+
* e.g. OPERATES, CONTAINS, MEMBER_OF) is checked against the API's allow-list on BOTH paths (with or without
|
|
4112
|
+
* entity, backend a3c97f9): an unknown label is a 400 naming the allowed set, BEFORE any charge — never an
|
|
4113
|
+
* empty 200. Metered per hop against the CALLING agent's wallet (quote with
|
|
4114
|
+
* billingQuote("/api/v1/relationships", n)): the response carries charged_joules (the settled all-in — 0 for
|
|
4115
|
+
* an empty result) + the metering block (file header). */
|
|
4092
4116
|
relationships({ entity, hops = 1, relationType, search, limit = 50, offset = 0, idempotencyKey } = {}) {
|
|
4093
4117
|
const params = { hops, limit, offset };
|
|
4094
4118
|
if (entity) params.entity = entity;
|
|
@@ -4101,7 +4125,9 @@ var GldaiSubmodule = class {
|
|
|
4101
4125
|
* minLat/minLng/maxLat/maxLng (the bbox), entityType (deposit|infrastructure|company|project — default
|
|
4102
4126
|
* all four), energy (default false), includeCountryCentroids (default false). AGENT KEYS ONLY; metered
|
|
4103
4127
|
* against the CALLING agent's wallet (quote with billingQuote); pins do NOT count against your entity
|
|
4104
|
-
* cap.
|
|
4128
|
+
* cap. Response: top-level charged_joules (= price.charged_joules; the price block stays as the breakdown) +
|
|
4129
|
+
* the metering block (file header). Same as the MCP `map_viewport` tool. Use this — the old /mapdata bulk
|
|
4130
|
+
* surface is CLOSED. */
|
|
4105
4131
|
mapViewport({
|
|
4106
4132
|
minLat,
|
|
4107
4133
|
minLng,
|
|
@@ -4125,7 +4151,9 @@ var GldaiSubmodule = class {
|
|
|
4125
4151
|
* against the CALLING agent's wallet — its own price line (~150 J; quote with
|
|
4126
4152
|
* billingQuote("/api/v1/look.at")). On a hit returns { available: true, content_type: "image/jpeg",
|
|
4127
4153
|
* image_jpeg: Uint8Array, provenance: { X-* headers — scene date, source, … } }; on a cloudy/missing
|
|
4128
|
-
* scene a { available: false, … } object (the charge is refunded server-side
|
|
4154
|
+
* scene a { available: false, … } object carrying charged_joules (0 — the charge is refunded server-side;
|
|
4155
|
+
* the price block stays as the breakdown) + the metering block; on the image path the same facts ride the
|
|
4156
|
+
* provenance headers (X-Price-Charged-Joules, X-Metering-Attempt, X-Metering-Status). Same as the MCP
|
|
4129
4157
|
* `look_at` tool. */
|
|
4130
4158
|
async lookAt({ lat, lng, entityType, id, idempotencyKey } = {}) {
|
|
4131
4159
|
const params = {};
|
|
@@ -4248,7 +4276,9 @@ var JoulepaiSubmodule = class {
|
|
|
4248
4276
|
if (handle) body.handle = handle;
|
|
4249
4277
|
return this._t.request(this._base, "POST", "/wallet/create", { body });
|
|
4250
4278
|
}
|
|
4251
|
-
/** Absorbs pay() (index.js:117). ENFORCED class D — dispatch auto-generates the key.
|
|
4279
|
+
/** Absorbs pay() (index.js:117). ENFORCED class D — dispatch auto-generates the key. If you pass your own
|
|
4280
|
+
* idempotencyKey, never a settlement-shaped one (release|refund|dispute_release|dispute_split:<match_id>:...)
|
|
4281
|
+
* — the backend refuses those 403 unless the caller is the marketplace service; use a fresh opaque key. */
|
|
4252
4282
|
async transfer(destination, amount, {
|
|
4253
4283
|
platform = "rareeai",
|
|
4254
4284
|
note,
|
|
@@ -4268,9 +4298,29 @@ var JoulepaiSubmodule = class {
|
|
|
4268
4298
|
pay(...args) {
|
|
4269
4299
|
return this.transfer(...args);
|
|
4270
4300
|
}
|
|
4301
|
+
/** Status of ONE transfer — GET /wallet/transfer/{id}/status. PARTY-TO-THE-LEG: you see only a transfer
|
|
4302
|
+
* you're a party to (e.g. your own deposit into a trade), NOT the trade's other legs. For the whole
|
|
4303
|
+
* trade's settlement (payout, fees, refunds across every leg) use tradeSettlement(matchId). */
|
|
4271
4304
|
transferStatus(transferId) {
|
|
4272
4305
|
return this._t.request(this._base, "GET", "/wallet/transfer/{tid}/status", { pathParams: { tid: transferId } });
|
|
4273
4306
|
}
|
|
4307
|
+
/** YOUR OWN trade's settlement — every leg of a marketplace trade you were the BUYER or SELLER of
|
|
4308
|
+
* (GET /wallet/trade/{matchId}/settlement). Party-gated: 404 if you were not a party (which also hides
|
|
4309
|
+
* whether the match exists). Returns { your_role (buyer|seller), settled (true once the provider is paid),
|
|
4310
|
+
* leg_count, legs[] } where each leg is { type, recipient_role (a ROLE — provider/oracle/treasury/
|
|
4311
|
+
* fee-collection/buyer, NEVER a wallet id; the sentinel "unknown" marks a leg type the backend does not
|
|
4312
|
+
* map yet — logged loudly on their side, never money to the platform), amount, status, txid, anchor }; plus
|
|
4313
|
+
* top-level all_anchored (bool). status is the LEDGER state of the leg; txid is written at BROADCAST, not
|
|
4314
|
+
* confirmation — a leg can be settled with txid null (not broadcast yet, OR the anchor dead-lettered) or
|
|
4315
|
+
* carry a txid not yet on chain. anchor is the state to act on: queued | confirming | confirmed → poll
|
|
4316
|
+
* (~30 s; txid may be null while queued); anchored → verify via the PUBLIC GET /transfer/{transfer_id}/proof;
|
|
4317
|
+
* failed | cancelled → the ledger leg settled but the anchor dead-lettered and will NOT reach the chain by
|
|
4318
|
+
* itself (escalate); none → no anchor attempted; unknown → a queue status the view does not recognise. A null
|
|
4319
|
+
* txid on a fresh read is NOT a missing or failed leg — read anchor. The trade-WIDE view — transferStatus()
|
|
4320
|
+
* and depositStatus() show only your own leg. Parity with the MCP `trade_settlement` tool. Backend d9a8e60. */
|
|
4321
|
+
tradeSettlement(matchId) {
|
|
4322
|
+
return this._t.request(this._base, "GET", "/wallet/trade/{mid}/settlement", { pathParams: { mid: matchId } });
|
|
4323
|
+
}
|
|
4274
4324
|
/** FIAT/CARD funding — POST /wallet/fund. method="stripe" returns a Stripe Checkout URL for a human to
|
|
4275
4325
|
* complete (card; 3.5% markup; amountFiat 10-100). The backend also accepts method="usdc" (1% markup),
|
|
4276
4326
|
* but the IN-BAND AGENT USDC rail is the deposit-address flow, NOT this endpoint: an agent funds by
|
|
@@ -4456,16 +4506,73 @@ var JoulepaiSubmodule = class {
|
|
|
4456
4506
|
// src/rareeai.js
|
|
4457
4507
|
var RAREEAI_BASE = "https://greenlandai.ai";
|
|
4458
4508
|
var RAREEAI_PREFIX = "/api/v1/marketplace";
|
|
4459
|
-
var RareeaiSubmodule = class {
|
|
4509
|
+
var RareeaiSubmodule = class _RareeaiSubmodule {
|
|
4460
4510
|
constructor(transport, baseUrl = RAREEAI_BASE) {
|
|
4461
4511
|
this._t = transport;
|
|
4462
4512
|
this._base = baseUrl;
|
|
4463
4513
|
this._p = RAREEAI_PREFIX;
|
|
4464
4514
|
}
|
|
4515
|
+
// Body field lists = the backend models (rareeai schemas.py: ProviderCreate / RequestCreate /
|
|
4516
|
+
// DisputeCreate / ResolveCreate; deliver, approve, reject, extend-dispute take NO body — their inputs
|
|
4517
|
+
// are path/query). Extra keys are refused HERE with a clear error rather than sent: the backend is
|
|
4518
|
+
// moving to strict models, and a silently-dropped or 422'd key is worse than a TypeError.
|
|
4519
|
+
static BODY_FIELDS = {
|
|
4520
|
+
provide: /* @__PURE__ */ new Set([
|
|
4521
|
+
"wallet_id",
|
|
4522
|
+
"frontier",
|
|
4523
|
+
"resource_type",
|
|
4524
|
+
"unit_type",
|
|
4525
|
+
"price_joules_per_unit",
|
|
4526
|
+
"capacity_total",
|
|
4527
|
+
"min_units",
|
|
4528
|
+
"max_units_per_match",
|
|
4529
|
+
"endpoint_url",
|
|
4530
|
+
"sla",
|
|
4531
|
+
"speed",
|
|
4532
|
+
"timeout_hours",
|
|
4533
|
+
"timeout_minutes",
|
|
4534
|
+
"stake_amount",
|
|
4535
|
+
"oracle_verified",
|
|
4536
|
+
"idempotency_key"
|
|
4537
|
+
]),
|
|
4538
|
+
request: /* @__PURE__ */ new Set([
|
|
4539
|
+
"wallet_id",
|
|
4540
|
+
"frontier",
|
|
4541
|
+
"resource_type",
|
|
4542
|
+
"unit_type",
|
|
4543
|
+
"units_needed",
|
|
4544
|
+
"max_price_per_unit",
|
|
4545
|
+
"priority",
|
|
4546
|
+
"requirements",
|
|
4547
|
+
"ttl_seconds",
|
|
4548
|
+
"speed",
|
|
4549
|
+
"privacy_mode",
|
|
4550
|
+
"contract_escrow",
|
|
4551
|
+
"idempotency_key"
|
|
4552
|
+
]),
|
|
4553
|
+
dispute: /* @__PURE__ */ new Set(["reason"]),
|
|
4554
|
+
resolve: /* @__PURE__ */ new Set(["resolution", "split_pct"]),
|
|
4555
|
+
deliver: /* @__PURE__ */ new Set(),
|
|
4556
|
+
approve: /* @__PURE__ */ new Set(),
|
|
4557
|
+
reject: /* @__PURE__ */ new Set(),
|
|
4558
|
+
extend_dispute: /* @__PURE__ */ new Set()
|
|
4559
|
+
};
|
|
4560
|
+
/** Keep only fields the backend model for `kind` accepts; refuse the rest by name. */
|
|
4561
|
+
static _body(kind, fields) {
|
|
4562
|
+
const allowed = _RareeaiSubmodule.BODY_FIELDS[kind];
|
|
4563
|
+
const bad = Object.keys(fields || {}).filter((k) => !allowed.has(k)).sort();
|
|
4564
|
+
if (bad.length) {
|
|
4565
|
+
throw new TypeError(`${kind}: unknown field(s) ${JSON.stringify(bad)}; allowed: ${allowed.size ? JSON.stringify([...allowed].sort()) : "none (no request body)"}`);
|
|
4566
|
+
}
|
|
4567
|
+
return { ...fields || {} };
|
|
4568
|
+
}
|
|
4465
4569
|
// Pattern B
|
|
4466
|
-
|
|
4467
|
-
|
|
4468
|
-
|
|
4570
|
+
/** `capacityTotal` is the backend field (units on offer); `capacity` is a deprecated alias — earlier
|
|
4571
|
+
* SDKs sent a `capacity` key the backend never read. */
|
|
4572
|
+
createProvider({ resourceType, capacityTotal, capacity, idempotencyKey, retry = true, ...fields }) {
|
|
4573
|
+
const body = { resource_type: resourceType, ..._RareeaiSubmodule._body("provide", fields) };
|
|
4574
|
+
const cap = capacityTotal ?? capacity;
|
|
4575
|
+
if (cap != null) body.capacity_total = cap;
|
|
4469
4576
|
return this._t.request(this._base, "POST", `${this._p}/provide`, { body, idempotencyKey, retry });
|
|
4470
4577
|
}
|
|
4471
4578
|
// ENFORCED-WHEN-PRESENT / BEST-EFFORT-keyless (routes.py:1282 guard; SDK dispatch
|
|
@@ -4475,7 +4582,7 @@ var RareeaiSubmodule = class {
|
|
|
4475
4582
|
this._base,
|
|
4476
4583
|
"POST",
|
|
4477
4584
|
`${this._p}/request`,
|
|
4478
|
-
{ body: { resource_type: resourceType, ...fields }, idempotencyKey, retry }
|
|
4585
|
+
{ body: { resource_type: resourceType, ..._RareeaiSubmodule._body("request", fields) }, idempotencyKey, retry }
|
|
4479
4586
|
);
|
|
4480
4587
|
}
|
|
4481
4588
|
// 0.3.3: delivery enters the post-delivery hold (no inline release); the
|
|
@@ -4492,7 +4599,7 @@ var RareeaiSubmodule = class {
|
|
|
4492
4599
|
`${this._p}/deliver/{match_id}`,
|
|
4493
4600
|
{
|
|
4494
4601
|
pathParams: { match_id: matchId },
|
|
4495
|
-
body: fields,
|
|
4602
|
+
body: _RareeaiSubmodule._body("deliver", fields),
|
|
4496
4603
|
params: Object.keys(params).length ? params : void 0,
|
|
4497
4604
|
idempotencyKey,
|
|
4498
4605
|
retry
|
|
@@ -4514,7 +4621,7 @@ var RareeaiSubmodule = class {
|
|
|
4514
4621
|
this._base,
|
|
4515
4622
|
"POST",
|
|
4516
4623
|
`${this._p}/match/{match_id}/resolve`,
|
|
4517
|
-
{ pathParams: { match_id: matchId }, body: fields, idempotencyKey, retry }
|
|
4624
|
+
{ pathParams: { match_id: matchId }, body: _RareeaiSubmodule._body("resolve", fields), idempotencyKey, retry }
|
|
4518
4625
|
);
|
|
4519
4626
|
}
|
|
4520
4627
|
// FSM transitions — NOT SUPPORTED (auto-retry OFF)
|
|
@@ -4523,7 +4630,7 @@ var RareeaiSubmodule = class {
|
|
|
4523
4630
|
this._base,
|
|
4524
4631
|
"POST",
|
|
4525
4632
|
`${this._p}/match/{match_id}/approve`,
|
|
4526
|
-
{ pathParams: { match_id: matchId }, body: fields }
|
|
4633
|
+
{ pathParams: { match_id: matchId }, body: _RareeaiSubmodule._body("approve", fields) }
|
|
4527
4634
|
);
|
|
4528
4635
|
}
|
|
4529
4636
|
reject(matchId, fields = {}) {
|
|
@@ -4531,7 +4638,7 @@ var RareeaiSubmodule = class {
|
|
|
4531
4638
|
this._base,
|
|
4532
4639
|
"POST",
|
|
4533
4640
|
`${this._p}/match/{match_id}/reject`,
|
|
4534
|
-
{ pathParams: { match_id: matchId }, body: fields }
|
|
4641
|
+
{ pathParams: { match_id: matchId }, body: _RareeaiSubmodule._body("reject", fields) }
|
|
4535
4642
|
);
|
|
4536
4643
|
}
|
|
4537
4644
|
dispute(matchId, fields = {}) {
|
|
@@ -4539,7 +4646,7 @@ var RareeaiSubmodule = class {
|
|
|
4539
4646
|
this._base,
|
|
4540
4647
|
"POST",
|
|
4541
4648
|
`${this._p}/match/{match_id}/dispute`,
|
|
4542
|
-
{ pathParams: { match_id: matchId }, body: fields }
|
|
4649
|
+
{ pathParams: { match_id: matchId }, body: _RareeaiSubmodule._body("dispute", fields) }
|
|
4543
4650
|
);
|
|
4544
4651
|
}
|
|
4545
4652
|
extendDispute(matchId, fields = {}) {
|
|
@@ -4547,7 +4654,7 @@ var RareeaiSubmodule = class {
|
|
|
4547
4654
|
this._base,
|
|
4548
4655
|
"POST",
|
|
4549
4656
|
`${this._p}/match/{match_id}/extend-dispute`,
|
|
4550
|
-
{ pathParams: { match_id: matchId }, body: fields }
|
|
4657
|
+
{ pathParams: { match_id: matchId }, body: _RareeaiSubmodule._body("extend_dispute", fields) }
|
|
4551
4658
|
);
|
|
4552
4659
|
}
|
|
4553
4660
|
// reads
|
|
@@ -4618,6 +4725,10 @@ var RareeaiSubmodule = class {
|
|
|
4618
4725
|
// 50-5,000 joules total, split across the match's oracles — deducted from the trade at
|
|
4619
4726
|
// settlement. Assess within the 48-hour deadline. NOT auto-retried (no verified server
|
|
4620
4727
|
// idempotency claim on this path).
|
|
4728
|
+
// 409 = LATE: the match already advanced (oracle_status verified/failed/disputed, or it left
|
|
4729
|
+
// escrowed/delivered) — your verdict is moot; do not retry, read the match. Consensus is a MAJORITY
|
|
4730
|
+
// of assigned oracles (floor 2), not all-must-report: once a majority lands the trade settles and
|
|
4731
|
+
// remaining assignments EXPIRE (a late assess then 409s).
|
|
4621
4732
|
oracleAssess(matchId, { verdict, qualityScore, notes = "", executionTrace, ...fields }) {
|
|
4622
4733
|
const body = { verdict, quality_score: qualityScore, notes, ...fields };
|
|
4623
4734
|
if (executionTrace !== void 0) body.execution_trace = executionTrace;
|
package/package.json
CHANGED
package/src/gldai.js
CHANGED
|
@@ -8,43 +8,70 @@
|
|
|
8
8
|
* client.joulepai.balance() and check affordability with client.joulepai.deficit(cost).
|
|
9
9
|
* The live map/graph read surface is wrapped here too — lookFrom, nearby, relationships
|
|
10
10
|
* (the MCP `hops` tool) — alongside companies/deposits/infrastructure/projects/mapdata/
|
|
11
|
-
* query; helper names match the MCP tools. Nothing on this surface is MCP-only.
|
|
11
|
+
* query; helper names match the MCP tools. Nothing on this surface is MCP-only.
|
|
12
|
+
* METERED RESPONSES (0.5.5, backend b1b587d / 43ff414 / a3c97f9, 2026-09-22): every metered JSON response
|
|
13
|
+
* carries ONE top-level `charged_joules` (the all-in debit for THIS call = base + the 0.5% rail fee; the
|
|
14
|
+
* posed routes lookFrom / mapViewport / lookAt ALSO keep their `price` block as the breakdown, with
|
|
15
|
+
* price.charged_joules == charged_joules) AND a `metering` block written AFTER the settle has run:
|
|
16
|
+
* { attempt_id, settlement: settled | settled_zero | settle_failed | released, settled_joules (what actually
|
|
17
|
+
* left the wallet — 0 unless settled), check: "GET /api/v1/billing/attempts" }. Read metering.settlement,
|
|
18
|
+
* not charged_joules, to know whether you paid: settle_failed = delivered but unpaid (the wallet is then
|
|
19
|
+
* locked by the debt gate until the retry clears — the 402 you get next names the attempt, the amount and
|
|
20
|
+
* what clears it); settled_zero = an empty result, nothing moved. The same facts ride the headers
|
|
21
|
+
* X-Metering-Attempt / X-Metering-Status. billingAttempts() shows every attempt's state afterwards. */
|
|
12
22
|
export const GLDAI_BASE = "https://greenlandai.ai";
|
|
13
23
|
|
|
14
24
|
export class GldaiSubmodule {
|
|
15
25
|
constructor(transport, baseUrl = GLDAI_BASE) {
|
|
16
26
|
this._t = transport; this._base = baseUrl;
|
|
17
27
|
}
|
|
28
|
+
/** GET /api/v1/companies (Class C, metered): charged_joules + the metering block (file header — read metering.settlement to know whether you paid). */
|
|
18
29
|
companies({ idempotencyKey, ...params } = {}) {
|
|
19
30
|
return this._t.request(this._base, "GET", "/api/v1/companies", { params, idempotencyKey });
|
|
20
31
|
}
|
|
32
|
+
/** GET /api/v1/companies/{id} — metered: charged_joules + metering block (file header). */
|
|
21
33
|
company(companyId) {
|
|
22
34
|
return this._t.request(this._base, "GET", "/api/v1/companies/{cid}", { pathParams: { cid: companyId } });
|
|
23
35
|
}
|
|
36
|
+
/** GET /api/v1/deposits — list resource deposits (Class C, metered). Filters via the params object
|
|
37
|
+
* (API names, passed through): resource_type, country, status, owner_country, max_port_km, search,
|
|
38
|
+
* limit (<=100), offset, and `commodity`. ⚠ `commodity` filters by the commodity GRAPH, not the
|
|
39
|
+
* resource_type string: it matches a deposit that CONTAINS the commodity directly, OR CONTAINS a group
|
|
40
|
+
* the commodity is MEMBER_OF — so commodity:"neodymium" returns EVERY rare-earth-element deposit,
|
|
41
|
+
* including ones whose name never says "neodymium" (it would look broken otherwise). The top-level
|
|
42
|
+
* `commodity_filter` {query, matched_directly, matched_via_group} tells you which (matched_via_group
|
|
43
|
+
* names the group). Each deposit carries `commodities[]` {name, role:primary|byproduct, group};
|
|
44
|
+
* resource_type stays primary. The response also carries `charged_joules` (all-in metered cost; null
|
|
45
|
+
* for a quota caller) and the metering block (file header). R6-C, 2026-09-22. */
|
|
24
46
|
deposits({ idempotencyKey, ...params } = {}) {
|
|
25
47
|
return this._t.request(this._base, "GET", "/api/v1/deposits", { params, idempotencyKey });
|
|
26
48
|
}
|
|
49
|
+
/** GET /api/v1/deposits/{id} — metered: charged_joules + metering block (file header). */
|
|
27
50
|
deposit(depositId) {
|
|
28
51
|
return this._t.request(this._base, "GET", "/api/v1/deposits/{did}", { pathParams: { did: depositId } });
|
|
29
52
|
}
|
|
53
|
+
/** GET /api/v1/infrastructure (Class C, metered): charged_joules + metering block (file header). */
|
|
30
54
|
infrastructureList({ idempotencyKey, ...params } = {}) {
|
|
31
55
|
return this._t.request(this._base, "GET", "/api/v1/infrastructure", { params, idempotencyKey });
|
|
32
56
|
}
|
|
57
|
+
/** GET /api/v1/infrastructure/{id} — metered: charged_joules + metering block (file header). */
|
|
33
58
|
infrastructure(infraId) {
|
|
34
59
|
return this._t.request(this._base, "GET", "/api/v1/infrastructure/{iid}", { pathParams: { iid: infraId } });
|
|
35
60
|
}
|
|
36
|
-
/** GET /api/v1/query — the natural-language intelligence query
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
61
|
+
/** GET /api/v1/query — the natural-language intelligence query. CLOSED TO ALL CALLERS TODAY (2026-09-22,
|
|
62
|
+
* operator ruling): to agents by the August 2026 ruling (not part of the agent launch — the meter refuses
|
|
63
|
+
* an agent 403 BEFORE any charge), to human sessions on capacity grounds (HUMAN_QUERY_ENABLED). It reopens
|
|
64
|
+
* when there are servers for it. Nothing is charged for a refused call. Use the structured surface instead:
|
|
65
|
+
* companies / deposits / infrastructure / projects / relationships / lookFrom / nearby / mapViewport. Kept
|
|
66
|
+
* so the method resolves; matches the served llms.txt and spec. */
|
|
42
67
|
query(q, { idempotencyKey, ...params } = {}) {
|
|
43
68
|
return this._t.request(this._base, "GET", "/api/v1/query", { params: { q, ...params }, idempotencyKey });
|
|
44
69
|
}
|
|
70
|
+
/** GET /api/v1/projects (Class C, metered): charged_joules + metering block (file header). */
|
|
45
71
|
projects({ idempotencyKey, ...params } = {}) {
|
|
46
72
|
return this._t.request(this._base, "GET", "/api/v1/projects", { params, idempotencyKey });
|
|
47
73
|
}
|
|
74
|
+
/** GET /api/v1/projects/{id} — metered: charged_joules + metering block (file header). */
|
|
48
75
|
project(projectId) {
|
|
49
76
|
return this._t.request(this._base, "GET", "/api/v1/projects/{pid}", { pathParams: { pid: projectId } });
|
|
50
77
|
}
|
|
@@ -73,7 +100,9 @@ export class GldaiSubmodule {
|
|
|
73
100
|
* (entityType+id). Metered against the CALLING agent's wallet (base + 0.5% rail; quote with
|
|
74
101
|
* billingQuote). entityType behaves two ways (backend 2026-09-14): entityType ALONE (with lat/lng)
|
|
75
102
|
* FILTERS the frame to that type; entityType + id ANCHORS the pose at that entity and keeps ALL types;
|
|
76
|
-
* an unknown entityType is a 400 before any charge.
|
|
103
|
+
* an unknown entityType is a 400 before any charge. Response: top-level charged_joules (the all-in debit —
|
|
104
|
+
* the same figure as price.charged_joules; the price block stays as the breakdown) + the metering block
|
|
105
|
+
* (file header). Same as the MCP `look_from` tool. */
|
|
77
106
|
lookFrom({ lat, lng, entityType, id, radiusKm = 100, energy = false,
|
|
78
107
|
includeCountryCentroids = false, idempotencyKey } = {}) {
|
|
79
108
|
const params = { radius_km: radiusKm, energy, include_country_centroids: includeCountryCentroids };
|
|
@@ -84,7 +113,8 @@ export class GldaiSubmodule {
|
|
|
84
113
|
return this._t.request(this._base, "GET", "/api/v1/look.from", { params, idempotencyKey });
|
|
85
114
|
}
|
|
86
115
|
/** GET /api/v1/nearby — entities near a location; here entityType IS a content filter. Metered against
|
|
87
|
-
* the CALLING agent's wallet (quote with billingQuote)
|
|
116
|
+
* the CALLING agent's wallet (quote with billingQuote): charged_joules + metering block (file header).
|
|
117
|
+
* Same as the MCP `nearby` tool. */
|
|
88
118
|
nearby({ lat, lng, radiusKm = 100, entityType, limit = 20,
|
|
89
119
|
includeCountryCentroids = false, idempotencyKey } = {}) {
|
|
90
120
|
const params = { lat, lng, radius_km: radiusKm, limit, include_country_centroids: includeCountryCentroids };
|
|
@@ -93,8 +123,12 @@ export class GldaiSubmodule {
|
|
|
93
123
|
}
|
|
94
124
|
/** GET /api/v1/relationships — labelled relationship hops (the MCP `hops` tool). `entity` is the START
|
|
95
125
|
* NODE, matched as a case-insensitive SUBSTRING of an entity NAME (never an id: "3" matches any name
|
|
96
|
-
* containing "3"), so pass a full, distinctive name. `hops` = depth 1-10.
|
|
97
|
-
*
|
|
126
|
+
* containing "3"), so pass a full, distinctive name. `hops` = depth 1-10. relationType (one relation label,
|
|
127
|
+
* e.g. OPERATES, CONTAINS, MEMBER_OF) is checked against the API's allow-list on BOTH paths (with or without
|
|
128
|
+
* entity, backend a3c97f9): an unknown label is a 400 naming the allowed set, BEFORE any charge — never an
|
|
129
|
+
* empty 200. Metered per hop against the CALLING agent's wallet (quote with
|
|
130
|
+
* billingQuote("/api/v1/relationships", n)): the response carries charged_joules (the settled all-in — 0 for
|
|
131
|
+
* an empty result) + the metering block (file header). */
|
|
98
132
|
relationships({ entity, hops = 1, relationType, search, limit = 50, offset = 0, idempotencyKey } = {}) {
|
|
99
133
|
const params = { hops, limit, offset };
|
|
100
134
|
if (entity) params.entity = entity;
|
|
@@ -107,7 +141,9 @@ export class GldaiSubmodule {
|
|
|
107
141
|
* minLat/minLng/maxLat/maxLng (the bbox), entityType (deposit|infrastructure|company|project — default
|
|
108
142
|
* all four), energy (default false), includeCountryCentroids (default false). AGENT KEYS ONLY; metered
|
|
109
143
|
* against the CALLING agent's wallet (quote with billingQuote); pins do NOT count against your entity
|
|
110
|
-
* cap.
|
|
144
|
+
* cap. Response: top-level charged_joules (= price.charged_joules; the price block stays as the breakdown) +
|
|
145
|
+
* the metering block (file header). Same as the MCP `map_viewport` tool. Use this — the old /mapdata bulk
|
|
146
|
+
* surface is CLOSED. */
|
|
111
147
|
mapViewport({ minLat, minLng, maxLat, maxLng, entityType, energy = false,
|
|
112
148
|
includeCountryCentroids = false, idempotencyKey } = {}) {
|
|
113
149
|
const params = { energy, include_country_centroids: includeCountryCentroids };
|
|
@@ -123,7 +159,9 @@ export class GldaiSubmodule {
|
|
|
123
159
|
* against the CALLING agent's wallet — its own price line (~150 J; quote with
|
|
124
160
|
* billingQuote("/api/v1/look.at")). On a hit returns { available: true, content_type: "image/jpeg",
|
|
125
161
|
* image_jpeg: Uint8Array, provenance: { X-* headers — scene date, source, … } }; on a cloudy/missing
|
|
126
|
-
* scene a { available: false, … } object (the charge is refunded server-side
|
|
162
|
+
* scene a { available: false, … } object carrying charged_joules (0 — the charge is refunded server-side;
|
|
163
|
+
* the price block stays as the breakdown) + the metering block; on the image path the same facts ride the
|
|
164
|
+
* provenance headers (X-Price-Charged-Joules, X-Metering-Attempt, X-Metering-Status). Same as the MCP
|
|
127
165
|
* `look_at` tool. */
|
|
128
166
|
async lookAt({ lat, lng, entityType, id, idempotencyKey } = {}) {
|
|
129
167
|
const params = {};
|
package/src/joulepai.js
CHANGED
|
@@ -29,7 +29,9 @@ export class JoulepaiSubmodule {
|
|
|
29
29
|
return this._t.request(this._base, "POST", "/wallet/create", { body });
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
/** Absorbs pay() (index.js:117). ENFORCED class D — dispatch auto-generates the key.
|
|
32
|
+
/** Absorbs pay() (index.js:117). ENFORCED class D — dispatch auto-generates the key. If you pass your own
|
|
33
|
+
* idempotencyKey, never a settlement-shaped one (release|refund|dispute_release|dispute_split:<match_id>:...)
|
|
34
|
+
* — the backend refuses those 403 unless the caller is the marketplace service; use a fresh opaque key. */
|
|
33
35
|
async transfer(destination, amount, { platform = "rareeai", note, privacyMode,
|
|
34
36
|
registrationId, idempotencyKey, retry = true } = {}) {
|
|
35
37
|
const body = { from_wallet_id: await this._ensureId(), amount, platform };
|
|
@@ -43,10 +45,31 @@ export class JoulepaiSubmodule {
|
|
|
43
45
|
|
|
44
46
|
pay(...args) { return this.transfer(...args); }
|
|
45
47
|
|
|
48
|
+
/** Status of ONE transfer — GET /wallet/transfer/{id}/status. PARTY-TO-THE-LEG: you see only a transfer
|
|
49
|
+
* you're a party to (e.g. your own deposit into a trade), NOT the trade's other legs. For the whole
|
|
50
|
+
* trade's settlement (payout, fees, refunds across every leg) use tradeSettlement(matchId). */
|
|
46
51
|
transferStatus(transferId) {
|
|
47
52
|
return this._t.request(this._base, "GET", "/wallet/transfer/{tid}/status", { pathParams: { tid: transferId } });
|
|
48
53
|
}
|
|
49
54
|
|
|
55
|
+
/** YOUR OWN trade's settlement — every leg of a marketplace trade you were the BUYER or SELLER of
|
|
56
|
+
* (GET /wallet/trade/{matchId}/settlement). Party-gated: 404 if you were not a party (which also hides
|
|
57
|
+
* whether the match exists). Returns { your_role (buyer|seller), settled (true once the provider is paid),
|
|
58
|
+
* leg_count, legs[] } where each leg is { type, recipient_role (a ROLE — provider/oracle/treasury/
|
|
59
|
+
* fee-collection/buyer, NEVER a wallet id; the sentinel "unknown" marks a leg type the backend does not
|
|
60
|
+
* map yet — logged loudly on their side, never money to the platform), amount, status, txid, anchor }; plus
|
|
61
|
+
* top-level all_anchored (bool). status is the LEDGER state of the leg; txid is written at BROADCAST, not
|
|
62
|
+
* confirmation — a leg can be settled with txid null (not broadcast yet, OR the anchor dead-lettered) or
|
|
63
|
+
* carry a txid not yet on chain. anchor is the state to act on: queued | confirming | confirmed → poll
|
|
64
|
+
* (~30 s; txid may be null while queued); anchored → verify via the PUBLIC GET /transfer/{transfer_id}/proof;
|
|
65
|
+
* failed | cancelled → the ledger leg settled but the anchor dead-lettered and will NOT reach the chain by
|
|
66
|
+
* itself (escalate); none → no anchor attempted; unknown → a queue status the view does not recognise. A null
|
|
67
|
+
* txid on a fresh read is NOT a missing or failed leg — read anchor. The trade-WIDE view — transferStatus()
|
|
68
|
+
* and depositStatus() show only your own leg. Parity with the MCP `trade_settlement` tool. Backend d9a8e60. */
|
|
69
|
+
tradeSettlement(matchId) {
|
|
70
|
+
return this._t.request(this._base, "GET", "/wallet/trade/{mid}/settlement", { pathParams: { mid: matchId } });
|
|
71
|
+
}
|
|
72
|
+
|
|
50
73
|
/** FIAT/CARD funding — POST /wallet/fund. method="stripe" returns a Stripe Checkout URL for a human to
|
|
51
74
|
* complete (card; 3.5% markup; amountFiat 10-100). The backend also accepts method="usdc" (1% markup),
|
|
52
75
|
* but the IN-BAND AGENT USDC rail is the deposit-address flow, NOT this endpoint: an agent funds by
|
package/src/rareeai.js
CHANGED
|
@@ -34,17 +34,45 @@ export class RareeaiSubmodule {
|
|
|
34
34
|
this._t = transport; this._base = baseUrl; this._p = RAREEAI_PREFIX;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
// Body field lists = the backend models (rareeai schemas.py: ProviderCreate / RequestCreate /
|
|
38
|
+
// DisputeCreate / ResolveCreate; deliver, approve, reject, extend-dispute take NO body — their inputs
|
|
39
|
+
// are path/query). Extra keys are refused HERE with a clear error rather than sent: the backend is
|
|
40
|
+
// moving to strict models, and a silently-dropped or 422'd key is worse than a TypeError.
|
|
41
|
+
static BODY_FIELDS = {
|
|
42
|
+
provide: new Set(["wallet_id", "frontier", "resource_type", "unit_type", "price_joules_per_unit",
|
|
43
|
+
"capacity_total", "min_units", "max_units_per_match", "endpoint_url", "sla", "speed",
|
|
44
|
+
"timeout_hours", "timeout_minutes", "stake_amount", "oracle_verified", "idempotency_key"]),
|
|
45
|
+
request: new Set(["wallet_id", "frontier", "resource_type", "unit_type", "units_needed",
|
|
46
|
+
"max_price_per_unit", "priority", "requirements", "ttl_seconds", "speed", "privacy_mode",
|
|
47
|
+
"contract_escrow", "idempotency_key"]),
|
|
48
|
+
dispute: new Set(["reason"]),
|
|
49
|
+
resolve: new Set(["resolution", "split_pct"]),
|
|
50
|
+
deliver: new Set(), approve: new Set(), reject: new Set(), extend_dispute: new Set(),
|
|
51
|
+
};
|
|
52
|
+
/** Keep only fields the backend model for `kind` accepts; refuse the rest by name. */
|
|
53
|
+
static _body(kind, fields) {
|
|
54
|
+
const allowed = RareeaiSubmodule.BODY_FIELDS[kind];
|
|
55
|
+
const bad = Object.keys(fields || {}).filter((k) => !allowed.has(k)).sort();
|
|
56
|
+
if (bad.length) {
|
|
57
|
+
throw new TypeError(`${kind}: unknown field(s) ${JSON.stringify(bad)}; allowed: ${allowed.size ? JSON.stringify([...allowed].sort()) : "none (no request body)"}`);
|
|
58
|
+
}
|
|
59
|
+
return { ...(fields || {}) };
|
|
60
|
+
}
|
|
61
|
+
|
|
37
62
|
// Pattern B
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
63
|
+
/** `capacityTotal` is the backend field (units on offer); `capacity` is a deprecated alias — earlier
|
|
64
|
+
* SDKs sent a `capacity` key the backend never read. */
|
|
65
|
+
createProvider({ resourceType, capacityTotal, capacity, idempotencyKey, retry = true, ...fields }) {
|
|
66
|
+
const body = { resource_type: resourceType, ...RareeaiSubmodule._body("provide", fields) };
|
|
67
|
+
const cap = capacityTotal ?? capacity;
|
|
68
|
+
if (cap != null) body.capacity_total = cap;
|
|
41
69
|
return this._t.request(this._base, "POST", `${this._p}/provide`, { body, idempotencyKey, retry });
|
|
42
70
|
}
|
|
43
71
|
// ENFORCED-WHEN-PRESENT / BEST-EFFORT-keyless (routes.py:1282 guard; SDK dispatch
|
|
44
72
|
// always auto-gens a key → SDK callers effectively enforced; keyless gap raw-HTTP-only).
|
|
45
73
|
createRequest({ resourceType, idempotencyKey, retry = true, ...fields }) {
|
|
46
74
|
return this._t.request(this._base, "POST", `${this._p}/request`,
|
|
47
|
-
{ body: { resource_type: resourceType, ...fields }, idempotencyKey, retry });
|
|
75
|
+
{ body: { resource_type: resourceType, ...RareeaiSubmodule._body("request", fields) }, idempotencyKey, retry });
|
|
48
76
|
}
|
|
49
77
|
// 0.3.3: delivery enters the post-delivery hold (no inline release); the
|
|
50
78
|
// buyer accepts via accept(), disputes, or the hold expires. resultHash /
|
|
@@ -55,7 +83,7 @@ export class RareeaiSubmodule {
|
|
|
55
83
|
if (resultHash) params.result_hash = resultHash;
|
|
56
84
|
if (resultUri) params.result_uri = resultUri;
|
|
57
85
|
return this._t.request(this._base, "POST", `${this._p}/deliver/{match_id}`,
|
|
58
|
-
{ pathParams: { match_id: matchId }, body: fields,
|
|
86
|
+
{ pathParams: { match_id: matchId }, body: RareeaiSubmodule._body("deliver", fields),
|
|
59
87
|
params: Object.keys(params).length ? params : undefined, idempotencyKey, retry });
|
|
60
88
|
}
|
|
61
89
|
// 0.3.3: the PRIMARY settlement path — buyer-only immediate release of a
|
|
@@ -66,25 +94,25 @@ export class RareeaiSubmodule {
|
|
|
66
94
|
}
|
|
67
95
|
resolve(matchId, { idempotencyKey, retry = true, ...fields } = {}) {
|
|
68
96
|
return this._t.request(this._base, "POST", `${this._p}/match/{match_id}/resolve`,
|
|
69
|
-
{ pathParams: { match_id: matchId }, body: fields, idempotencyKey, retry });
|
|
97
|
+
{ pathParams: { match_id: matchId }, body: RareeaiSubmodule._body("resolve", fields), idempotencyKey, retry });
|
|
70
98
|
}
|
|
71
99
|
|
|
72
100
|
// FSM transitions — NOT SUPPORTED (auto-retry OFF)
|
|
73
101
|
approve(matchId, fields = {}) {
|
|
74
102
|
return this._t.request(this._base, "POST", `${this._p}/match/{match_id}/approve`,
|
|
75
|
-
{ pathParams: { match_id: matchId }, body: fields });
|
|
103
|
+
{ pathParams: { match_id: matchId }, body: RareeaiSubmodule._body("approve", fields) });
|
|
76
104
|
}
|
|
77
105
|
reject(matchId, fields = {}) {
|
|
78
106
|
return this._t.request(this._base, "POST", `${this._p}/match/{match_id}/reject`,
|
|
79
|
-
{ pathParams: { match_id: matchId }, body: fields });
|
|
107
|
+
{ pathParams: { match_id: matchId }, body: RareeaiSubmodule._body("reject", fields) });
|
|
80
108
|
}
|
|
81
109
|
dispute(matchId, fields = {}) {
|
|
82
110
|
return this._t.request(this._base, "POST", `${this._p}/match/{match_id}/dispute`,
|
|
83
|
-
{ pathParams: { match_id: matchId }, body: fields });
|
|
111
|
+
{ pathParams: { match_id: matchId }, body: RareeaiSubmodule._body("dispute", fields) });
|
|
84
112
|
}
|
|
85
113
|
extendDispute(matchId, fields = {}) {
|
|
86
114
|
return this._t.request(this._base, "POST", `${this._p}/match/{match_id}/extend-dispute`,
|
|
87
|
-
{ pathParams: { match_id: matchId }, body: fields });
|
|
115
|
+
{ pathParams: { match_id: matchId }, body: RareeaiSubmodule._body("extend_dispute", fields) });
|
|
88
116
|
}
|
|
89
117
|
|
|
90
118
|
// reads
|
|
@@ -134,6 +162,10 @@ export class RareeaiSubmodule {
|
|
|
134
162
|
// 50-5,000 joules total, split across the match's oracles — deducted from the trade at
|
|
135
163
|
// settlement. Assess within the 48-hour deadline. NOT auto-retried (no verified server
|
|
136
164
|
// idempotency claim on this path).
|
|
165
|
+
// 409 = LATE: the match already advanced (oracle_status verified/failed/disputed, or it left
|
|
166
|
+
// escrowed/delivered) — your verdict is moot; do not retry, read the match. Consensus is a MAJORITY
|
|
167
|
+
// of assigned oracles (floor 2), not all-must-report: once a majority lands the trade settles and
|
|
168
|
+
// remaining assignments EXPIRE (a late assess then 409s).
|
|
137
169
|
oracleAssess(matchId, { verdict, qualityScore, notes = "", executionTrace, ...fields }) {
|
|
138
170
|
const body = { verdict, quality_score: qualityScore, notes, ...fields };
|
|
139
171
|
if (executionTrace !== undefined) body.execution_trace = executionTrace;
|