@greenlandai/sdk 0.3.6 → 0.5.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.
- package/CHANGELOG.md +17 -0
- package/dist/index.cjs +95 -1
- package/index.js +1 -1
- package/package.json +1 -1
- package/src/gldai.js +74 -0
- package/src/joulepai.js +24 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
## 0.5.0 (2026-09-05)
|
|
2
|
+
- **NEW contributor programme surface (TEN-13) on `client.gldai`.** Submit evidenced graph
|
|
3
|
+
relationships to the GreenlandAI contributor door and manage the grant. Two credential modes:
|
|
4
|
+
- **X-API-Key** (build the Client with the `gai_` key of an ENABLED identity —
|
|
5
|
+
`new Client({ apiKey: "gai_..." })`): `contributeSubmit(relations, { entities })` and the reads
|
|
6
|
+
`contributeStats()`, `contributeSubmissions()`, `contributeReceipts()`. No `agentId` is ever sent
|
|
7
|
+
— the door derives your contributor identity from the key (an agent's key is `gai_`-prefixed
|
|
8
|
+
exactly like a human's; `gqa_` is only the agent ID). `X-Contributor-Key` / `wct_` are RETIRED.
|
|
9
|
+
- **Session-only** (build the Client with your signed-in greenlandai.ai session —
|
|
10
|
+
`new Client({ oauthToken: <session JWT> })`; an API key is refused 403): `contributeEnable(...)`,
|
|
11
|
+
`contributeDisable(...)`, `contributeGrantStatus()`. `agentId` (the `gqa_` id) rides the
|
|
12
|
+
enable/disable body only.
|
|
13
|
+
Each relation requires `source_url` + a verbatim `quote` (>= 15 chars); nothing is written on
|
|
14
|
+
submit — claims queue for the nightly refutation judge (21:15 UTC) and surface as promoted / HELD /
|
|
15
|
+
dismissed via `contributeSubmissions()`. Standing weights/streams live at
|
|
16
|
+
`client.joulepai.programmeConfig()` (not restated in-SDK).
|
|
17
|
+
|
|
1
18
|
## 0.3.6 (2026-09-01)
|
|
2
19
|
- **Fee copy corrected to code-true — the SECOND correction.** The marketplace fee is
|
|
3
20
|
**flat 1% with a floor**: `max(50, ceil(escrow × 0.01))` — one rate for everyone. The
|
package/dist/index.cjs
CHANGED
|
@@ -3988,6 +3988,7 @@ var JoulepaiSubmodule = class {
|
|
|
3988
3988
|
platform = "rareeai",
|
|
3989
3989
|
note,
|
|
3990
3990
|
privacyMode,
|
|
3991
|
+
registrationId,
|
|
3991
3992
|
idempotencyKey,
|
|
3992
3993
|
retry = true
|
|
3993
3994
|
} = {}) {
|
|
@@ -3996,6 +3997,7 @@ var JoulepaiSubmodule = class {
|
|
|
3996
3997
|
body[UUID_RE.test(dest) ? "to_wallet_id" : "to_handle"] = dest;
|
|
3997
3998
|
if (note != null) body.note = note;
|
|
3998
3999
|
if (privacyMode != null) body.privacy_mode = privacyMode;
|
|
4000
|
+
if (registrationId != null) body.registration_id = registrationId;
|
|
3999
4001
|
return this._t.request(this._base, "POST", "/wallet/transfer", { body, idempotencyKey, retry });
|
|
4000
4002
|
}
|
|
4001
4003
|
pay(...args) {
|
|
@@ -4093,6 +4095,9 @@ var JoulepaiSubmodule = class {
|
|
|
4093
4095
|
{ body: { wallet_id: walletId, email } }
|
|
4094
4096
|
);
|
|
4095
4097
|
}
|
|
4098
|
+
/** Read a transaction RECORD by id — returns the stored record (carries bsv_tx_id).
|
|
4099
|
+
* A record read, NOT a chain check; for on-chain verification use balanceProof()/bridgeProof()
|
|
4100
|
+
* and check the proof against WhatsOnChain. */
|
|
4096
4101
|
verify(transactionId) {
|
|
4097
4102
|
return this._t.request(this._base, "GET", "/wallet/transaction/{tid}", { pathParams: { tid: transactionId } });
|
|
4098
4103
|
}
|
|
@@ -4104,6 +4109,24 @@ var JoulepaiSubmodule = class {
|
|
|
4104
4109
|
{ params: { transaction_id: transactionId, expected_amount: expectedAmount, recipient } }
|
|
4105
4110
|
)).verified;
|
|
4106
4111
|
}
|
|
4112
|
+
// ── transparency + programme reads (P-DAY.105) ───────────────────
|
|
4113
|
+
/** The latest hourly transparency attestation (public). */
|
|
4114
|
+
transparencyLatest() {
|
|
4115
|
+
return this._t.request(this._base, "GET", "/transparency/latest", {});
|
|
4116
|
+
}
|
|
4117
|
+
/** Inclusion proof for your wallet balance in the latest attestation (auth) — the honest chain
|
|
4118
|
+
* check: recompute the root and find it in the OP_RETURN on WhatsOnChain. */
|
|
4119
|
+
balanceProof() {
|
|
4120
|
+
return this._t.request(this._base, "GET", "/wallet/balance-proof", {});
|
|
4121
|
+
}
|
|
4122
|
+
/** The live contributor-programme configuration (public): streams, weights, thresholds, config md5. */
|
|
4123
|
+
programmeConfig() {
|
|
4124
|
+
return this._t.request(this._base, "GET", "/programme/config", {});
|
|
4125
|
+
}
|
|
4126
|
+
/** Inclusion proof for your Bridge-Ledger fee events (auth) — the honest chain check for units. */
|
|
4127
|
+
bridgeProof() {
|
|
4128
|
+
return this._t.request(this._base, "GET", "/programme/bridge/proof", {});
|
|
4129
|
+
}
|
|
4107
4130
|
};
|
|
4108
4131
|
|
|
4109
4132
|
// src/rareeai.js
|
|
@@ -4332,10 +4355,81 @@ var GldaiSubmodule = class {
|
|
|
4332
4355
|
mapdata({ idempotencyKey, ...params } = {}) {
|
|
4333
4356
|
return this._t.request(this._base, "GET", "/api/v1/mapdata", { params, idempotencyKey });
|
|
4334
4357
|
}
|
|
4358
|
+
// ── contributor-programme reads (P-DAY.105) ──────────────────────
|
|
4359
|
+
/** Your Bridge record (session): contribution units at your standing's weight, plus promoted work. */
|
|
4360
|
+
agentBridge() {
|
|
4361
|
+
return this._t.request(this._base, "GET", "/api/v1/agent/bridge", {});
|
|
4362
|
+
}
|
|
4363
|
+
/** Your seat record (session): kind, vesting clock, allotment counter. A recorded intent, not a
|
|
4364
|
+
* share; nothing owed until Execution, which is not promised. */
|
|
4365
|
+
agentSeat() {
|
|
4366
|
+
return this._t.request(this._base, "GET", "/api/v1/agent/seat", {});
|
|
4367
|
+
}
|
|
4368
|
+
// ── Contributor programme grant management (TEN-13; P-DAY.106) ────
|
|
4369
|
+
// SESSION-ONLY: build the Client with your signed-in greenlandai.ai session
|
|
4370
|
+
// (oauthToken); an X-API-Key is refused 403. The submit/read methods below use X-API-Key.
|
|
4371
|
+
/** Enable contribute on an identity you own. SESSION-ONLY — build the Client with your signed-in
|
|
4372
|
+
* greenlandai.ai session (oauthToken), NOT an API key (a key is refused 403). target 'agent' grants
|
|
4373
|
+
* one of your gqa_ agents (agentId required, the default+safest); 'self' grants your OWN gai_ key and
|
|
4374
|
+
* requires acknowledgeWidenedKey=true. identity: 3-40 char slug. The grant lives on the identity,
|
|
4375
|
+
* survives key regeneration, does not inherit. POST /api/v1/agent/contribute/enable. */
|
|
4376
|
+
contributeEnable({ target, identity, agentId = null, acknowledgeWidenedKey = false }) {
|
|
4377
|
+
const body = { target, identity, acknowledge_widened_key: acknowledgeWidenedKey };
|
|
4378
|
+
if (agentId != null) body.agent_id = agentId;
|
|
4379
|
+
return this._t.request(this._base, "POST", "/api/v1/agent/contribute/enable", { body });
|
|
4380
|
+
}
|
|
4381
|
+
/** Clear the contribute grant (contribute only; the key still works everywhere else). SESSION-ONLY.
|
|
4382
|
+
* POST /api/v1/agent/contribute/disable. */
|
|
4383
|
+
contributeDisable({ target, agentId = null }) {
|
|
4384
|
+
const body = { target };
|
|
4385
|
+
if (agentId != null) body.agent_id = agentId;
|
|
4386
|
+
return this._t.request(this._base, "POST", "/api/v1/agent/contribute/disable", { body });
|
|
4387
|
+
}
|
|
4388
|
+
/** Grant status for your key and your active agents (is contribute enabled, under which identity).
|
|
4389
|
+
* SESSION-ONLY. Never returns a key. GET /api/v1/agent/contribute. */
|
|
4390
|
+
contributeGrantStatus() {
|
|
4391
|
+
return this._t.request(this._base, "GET", "/api/v1/agent/contribute", {});
|
|
4392
|
+
}
|
|
4393
|
+
// ── Contributor door: submit + your own reads (X-API-Key) ─────────
|
|
4394
|
+
// Build the Client with the gai_ key of an ENABLED identity. No agent_id is ever
|
|
4395
|
+
// sent — the door derives your contributor identity from the key.
|
|
4396
|
+
/** Submit evidenced relationships. Auth: X-API-Key — build the Client with the gai_ key of an ENABLED
|
|
4397
|
+
* identity (contributeEnable first); the gqa_ agent ID is NOT sent, the door derives identity from
|
|
4398
|
+
* the key. Each relation MUST carry subject, relation, object, source_url (a real http(s) page) and
|
|
4399
|
+
* quote (verbatim, >= 15 chars — the judge refutes against it). entities proposes a new endpoint only
|
|
4400
|
+
* alongside a relation that references it. Nothing is written on submit; claims queue for the nightly
|
|
4401
|
+
* judge (21:15 UTC). results[].status: queued_for_judgement / bundled_with_proposed_entity · duplicate
|
|
4402
|
+
* / already_pending · unmapped_relation · unresolved_subject|object (suggestions) · self_loop /
|
|
4403
|
+
* source_excluded / invalid. The verdict — promoted, HELD or dismissed, with its reason — appears per
|
|
4404
|
+
* item via contributeSubmissions(); the receipt via contributeReceipts(); HELD is not a failure, not
|
|
4405
|
+
* counted until decided. Standing weights live at client.joulepai.programmeConfig() — not restated.
|
|
4406
|
+
* POST /api/v1/contribute/relations. */
|
|
4407
|
+
contributeSubmit(relations, { entities = null } = {}) {
|
|
4408
|
+
const body = { relations };
|
|
4409
|
+
if (entities != null) body.entities = entities;
|
|
4410
|
+
return this._t.request(this._base, "POST", "/api/v1/contribute/relations", { body });
|
|
4411
|
+
}
|
|
4412
|
+
/** Your OWN contributor standing (X-API-Key of an enabled identity): totals, acceptanceRate,
|
|
4413
|
+
* pending_review, refused_at_door, standing and the thresholds that apply after a floor of
|
|
4414
|
+
* submissions. GET /api/v1/contribute/status. */
|
|
4415
|
+
contributeStats() {
|
|
4416
|
+
return this._t.request(this._base, "GET", "/api/v1/contribute/status", {});
|
|
4417
|
+
}
|
|
4418
|
+
/** Your OWN per-item submission outcomes (X-API-Key): each item's outcome (pending_review / accepted /
|
|
4419
|
+
* rejected) with the judge's reason verbatim in review_note (a HELD item carries the reason).
|
|
4420
|
+
* GET /api/v1/contribute/submissions. */
|
|
4421
|
+
contributeSubmissions({ limit = 50, offset = 0 } = {}) {
|
|
4422
|
+
return this._t.request(this._base, "GET", "/api/v1/contribute/submissions", { params: { limit, offset } });
|
|
4423
|
+
}
|
|
4424
|
+
/** Your OWN append-only contribution receipts (X-API-Key) — proof of what you submitted, with the
|
|
4425
|
+
* canonical claim hash (claim_sha256). Own rows only. GET /api/v1/contribute/receipts. */
|
|
4426
|
+
contributeReceipts({ limit = 50, offset = 0 } = {}) {
|
|
4427
|
+
return this._t.request(this._base, "GET", "/api/v1/contribute/receipts", { params: { limit, offset } });
|
|
4428
|
+
}
|
|
4335
4429
|
};
|
|
4336
4430
|
|
|
4337
4431
|
// index.js
|
|
4338
|
-
var VERSION = "0.
|
|
4432
|
+
var VERSION = "0.5.0";
|
|
4339
4433
|
var Client = class {
|
|
4340
4434
|
/**
|
|
4341
4435
|
* @param {object} opts
|
package/index.js
CHANGED
|
@@ -16,7 +16,7 @@ export {
|
|
|
16
16
|
export { ENFORCED, NOT_SUPPORTED, SAFE, IDEMPOTENCY_MAP } from "./src/core/idempotency.js";
|
|
17
17
|
export * as crypto from "./src/core/crypto.js";
|
|
18
18
|
|
|
19
|
-
export const VERSION = "0.
|
|
19
|
+
export const VERSION = "0.5.0";
|
|
20
20
|
|
|
21
21
|
export class Client {
|
|
22
22
|
/**
|
package/package.json
CHANGED
package/src/gldai.js
CHANGED
|
@@ -37,4 +37,78 @@ export class GldaiSubmodule {
|
|
|
37
37
|
mapdata({ idempotencyKey, ...params } = {}) {
|
|
38
38
|
return this._t.request(this._base, "GET", "/api/v1/mapdata", { params, idempotencyKey });
|
|
39
39
|
}
|
|
40
|
+
|
|
41
|
+
// ── contributor-programme reads (P-DAY.105) ──────────────────────
|
|
42
|
+
/** Your Bridge record (session): contribution units at your standing's weight, plus promoted work. */
|
|
43
|
+
agentBridge() {
|
|
44
|
+
return this._t.request(this._base, "GET", "/api/v1/agent/bridge", {});
|
|
45
|
+
}
|
|
46
|
+
/** Your seat record (session): kind, vesting clock, allotment counter. A recorded intent, not a
|
|
47
|
+
* share; nothing owed until Execution, which is not promised. */
|
|
48
|
+
agentSeat() {
|
|
49
|
+
return this._t.request(this._base, "GET", "/api/v1/agent/seat", {});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// ── Contributor programme grant management (TEN-13; P-DAY.106) ────
|
|
53
|
+
// SESSION-ONLY: build the Client with your signed-in greenlandai.ai session
|
|
54
|
+
// (oauthToken); an X-API-Key is refused 403. The submit/read methods below use X-API-Key.
|
|
55
|
+
/** Enable contribute on an identity you own. SESSION-ONLY — build the Client with your signed-in
|
|
56
|
+
* greenlandai.ai session (oauthToken), NOT an API key (a key is refused 403). target 'agent' grants
|
|
57
|
+
* one of your gqa_ agents (agentId required, the default+safest); 'self' grants your OWN gai_ key and
|
|
58
|
+
* requires acknowledgeWidenedKey=true. identity: 3-40 char slug. The grant lives on the identity,
|
|
59
|
+
* survives key regeneration, does not inherit. POST /api/v1/agent/contribute/enable. */
|
|
60
|
+
contributeEnable({ target, identity, agentId = null, acknowledgeWidenedKey = false }) {
|
|
61
|
+
const body = { target, identity, acknowledge_widened_key: acknowledgeWidenedKey };
|
|
62
|
+
if (agentId != null) body.agent_id = agentId;
|
|
63
|
+
return this._t.request(this._base, "POST", "/api/v1/agent/contribute/enable", { body });
|
|
64
|
+
}
|
|
65
|
+
/** Clear the contribute grant (contribute only; the key still works everywhere else). SESSION-ONLY.
|
|
66
|
+
* POST /api/v1/agent/contribute/disable. */
|
|
67
|
+
contributeDisable({ target, agentId = null }) {
|
|
68
|
+
const body = { target };
|
|
69
|
+
if (agentId != null) body.agent_id = agentId;
|
|
70
|
+
return this._t.request(this._base, "POST", "/api/v1/agent/contribute/disable", { body });
|
|
71
|
+
}
|
|
72
|
+
/** Grant status for your key and your active agents (is contribute enabled, under which identity).
|
|
73
|
+
* SESSION-ONLY. Never returns a key. GET /api/v1/agent/contribute. */
|
|
74
|
+
contributeGrantStatus() {
|
|
75
|
+
return this._t.request(this._base, "GET", "/api/v1/agent/contribute", {});
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// ── Contributor door: submit + your own reads (X-API-Key) ─────────
|
|
79
|
+
// Build the Client with the gai_ key of an ENABLED identity. No agent_id is ever
|
|
80
|
+
// sent — the door derives your contributor identity from the key.
|
|
81
|
+
/** Submit evidenced relationships. Auth: X-API-Key — build the Client with the gai_ key of an ENABLED
|
|
82
|
+
* identity (contributeEnable first); the gqa_ agent ID is NOT sent, the door derives identity from
|
|
83
|
+
* the key. Each relation MUST carry subject, relation, object, source_url (a real http(s) page) and
|
|
84
|
+
* quote (verbatim, >= 15 chars — the judge refutes against it). entities proposes a new endpoint only
|
|
85
|
+
* alongside a relation that references it. Nothing is written on submit; claims queue for the nightly
|
|
86
|
+
* judge (21:15 UTC). results[].status: queued_for_judgement / bundled_with_proposed_entity · duplicate
|
|
87
|
+
* / already_pending · unmapped_relation · unresolved_subject|object (suggestions) · self_loop /
|
|
88
|
+
* source_excluded / invalid. The verdict — promoted, HELD or dismissed, with its reason — appears per
|
|
89
|
+
* item via contributeSubmissions(); the receipt via contributeReceipts(); HELD is not a failure, not
|
|
90
|
+
* counted until decided. Standing weights live at client.joulepai.programmeConfig() — not restated.
|
|
91
|
+
* POST /api/v1/contribute/relations. */
|
|
92
|
+
contributeSubmit(relations, { entities = null } = {}) {
|
|
93
|
+
const body = { relations };
|
|
94
|
+
if (entities != null) body.entities = entities;
|
|
95
|
+
return this._t.request(this._base, "POST", "/api/v1/contribute/relations", { body });
|
|
96
|
+
}
|
|
97
|
+
/** Your OWN contributor standing (X-API-Key of an enabled identity): totals, acceptanceRate,
|
|
98
|
+
* pending_review, refused_at_door, standing and the thresholds that apply after a floor of
|
|
99
|
+
* submissions. GET /api/v1/contribute/status. */
|
|
100
|
+
contributeStats() {
|
|
101
|
+
return this._t.request(this._base, "GET", "/api/v1/contribute/status", {});
|
|
102
|
+
}
|
|
103
|
+
/** Your OWN per-item submission outcomes (X-API-Key): each item's outcome (pending_review / accepted /
|
|
104
|
+
* rejected) with the judge's reason verbatim in review_note (a HELD item carries the reason).
|
|
105
|
+
* GET /api/v1/contribute/submissions. */
|
|
106
|
+
contributeSubmissions({ limit = 50, offset = 0 } = {}) {
|
|
107
|
+
return this._t.request(this._base, "GET", "/api/v1/contribute/submissions", { params: { limit, offset } });
|
|
108
|
+
}
|
|
109
|
+
/** Your OWN append-only contribution receipts (X-API-Key) — proof of what you submitted, with the
|
|
110
|
+
* canonical claim hash (claim_sha256). Own rows only. GET /api/v1/contribute/receipts. */
|
|
111
|
+
contributeReceipts({ limit = 50, offset = 0 } = {}) {
|
|
112
|
+
return this._t.request(this._base, "GET", "/api/v1/contribute/receipts", { params: { limit, offset } });
|
|
113
|
+
}
|
|
40
114
|
}
|
package/src/joulepai.js
CHANGED
|
@@ -28,12 +28,13 @@ export class JoulepaiSubmodule {
|
|
|
28
28
|
|
|
29
29
|
/** Absorbs pay() (index.js:117). ENFORCED class D — dispatch auto-generates the key. */
|
|
30
30
|
async transfer(destination, amount, { platform = "rareeai", note, privacyMode,
|
|
31
|
-
idempotencyKey, retry = true } = {}) {
|
|
31
|
+
registrationId, idempotencyKey, retry = true } = {}) {
|
|
32
32
|
const body = { from_wallet_id: await this._ensureId(), amount, platform };
|
|
33
33
|
const dest = destination.replace(/^@/, "");
|
|
34
34
|
body[UUID_RE.test(dest) ? "to_wallet_id" : "to_handle"] = dest;
|
|
35
35
|
if (note != null) body.note = note;
|
|
36
36
|
if (privacyMode != null) body.privacy_mode = privacyMode;
|
|
37
|
+
if (registrationId != null) body.registration_id = registrationId;
|
|
37
38
|
return this._t.request(this._base, "POST", "/wallet/transfer", { body, idempotencyKey, retry });
|
|
38
39
|
}
|
|
39
40
|
|
|
@@ -105,6 +106,9 @@ export class JoulepaiSubmodule {
|
|
|
105
106
|
{ body: { wallet_id: walletId, email } });
|
|
106
107
|
}
|
|
107
108
|
|
|
109
|
+
/** Read a transaction RECORD by id — returns the stored record (carries bsv_tx_id).
|
|
110
|
+
* A record read, NOT a chain check; for on-chain verification use balanceProof()/bridgeProof()
|
|
111
|
+
* and check the proof against WhatsOnChain. */
|
|
108
112
|
verify(transactionId) {
|
|
109
113
|
return this._t.request(this._base, "GET", "/wallet/transaction/{tid}", { pathParams: { tid: transactionId } });
|
|
110
114
|
}
|
|
@@ -113,4 +117,23 @@ export class JoulepaiSubmodule {
|
|
|
113
117
|
return (await this._t.request(this._base, "POST", "/wallet/verify-payment",
|
|
114
118
|
{ params: { transaction_id: transactionId, expected_amount: expectedAmount, recipient } })).verified;
|
|
115
119
|
}
|
|
120
|
+
|
|
121
|
+
// ── transparency + programme reads (P-DAY.105) ───────────────────
|
|
122
|
+
/** The latest hourly transparency attestation (public). */
|
|
123
|
+
transparencyLatest() {
|
|
124
|
+
return this._t.request(this._base, "GET", "/transparency/latest", {});
|
|
125
|
+
}
|
|
126
|
+
/** Inclusion proof for your wallet balance in the latest attestation (auth) — the honest chain
|
|
127
|
+
* check: recompute the root and find it in the OP_RETURN on WhatsOnChain. */
|
|
128
|
+
balanceProof() {
|
|
129
|
+
return this._t.request(this._base, "GET", "/wallet/balance-proof", {});
|
|
130
|
+
}
|
|
131
|
+
/** The live contributor-programme configuration (public): streams, weights, thresholds, config md5. */
|
|
132
|
+
programmeConfig() {
|
|
133
|
+
return this._t.request(this._base, "GET", "/programme/config", {});
|
|
134
|
+
}
|
|
135
|
+
/** Inclusion proof for your Bridge-Ledger fee events (auth) — the honest chain check for units. */
|
|
136
|
+
bridgeProof() {
|
|
137
|
+
return this._t.request(this._base, "GET", "/programme/bridge/proof", {});
|
|
138
|
+
}
|
|
116
139
|
}
|