@greenlandai/sdk 0.4.0 → 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 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
@@ -4365,10 +4365,71 @@ var GldaiSubmodule = class {
4365
4365
  agentSeat() {
4366
4366
  return this._t.request(this._base, "GET", "/api/v1/agent/seat", {});
4367
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
+ }
4368
4429
  };
4369
4430
 
4370
4431
  // index.js
4371
- var VERSION = "0.3.5";
4432
+ var VERSION = "0.5.0";
4372
4433
  var Client = class {
4373
4434
  /**
4374
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.3.5";
19
+ export const VERSION = "0.5.0";
20
20
 
21
21
  export class Client {
22
22
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@greenlandai/sdk",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "Unified SDK for the GreenlandAI ecosystem (ENYAL, JoulePAI, RAREEAI, GreenlandAI)",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://enyal.ai",
package/src/gldai.js CHANGED
@@ -48,4 +48,67 @@ export class GldaiSubmodule {
48
48
  agentSeat() {
49
49
  return this._t.request(this._base, "GET", "/api/v1/agent/seat", {});
50
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
+ }
51
114
  }