@sharedcontext/sdk 0.0.0-stage → 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.
- package/LICENSE-APACHE +201 -0
- package/LICENSE-MIT +21 -0
- package/NOTICE +8 -0
- package/README.md +94 -2
- package/dist/canonical.d.ts +47 -0
- package/dist/canonical.js +257 -0
- package/dist/client.d.ts +96 -0
- package/dist/client.js +205 -0
- package/dist/constants.d.ts +19 -0
- package/dist/constants.js +21 -0
- package/dist/event.d.ts +104 -0
- package/dist/event.js +173 -0
- package/dist/generated/content.d.ts +588 -0
- package/dist/generated/content.js +3 -0
- package/dist/generated/schemas.d.ts +10 -0
- package/dist/generated/schemas.js +22 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +8 -0
- package/dist/reasons.d.ts +14 -0
- package/dist/reasons.js +142 -0
- package/dist/schema.d.ts +45 -0
- package/dist/schema.js +285 -0
- package/dist/types.d.ts +230 -0
- package/dist/types.js +3 -0
- package/package.json +46 -4
- package/schemas/sharedcontext-1/changes.schema.json +128 -0
- package/schemas/sharedcontext-1/content.schema.json +2076 -0
- package/schemas/sharedcontext-1/context.schema.json +218 -0
- package/schemas/sharedcontext-1/event.schema.json +55 -0
- package/schemas/sharedcontext-1/execution.schema.json +342 -0
- package/schemas/sharedcontext-1/history/content-1.0.schema.json +1915 -0
- package/schemas/sharedcontext-1/lineage.schema.json +753 -0
- package/schemas/sharedcontext-1/mcp-tools.schema.json +1357 -0
- package/schemas/sharedcontext-1/stored-event.schema.json +14 -0
- package/schemas/sharedcontext-directory-1/members.schema.json +52 -0
- package/schemas/sharedcontext-directory-1/memberships.schema.json +32 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "sharedcontext/1 stored event",
|
|
4
|
+
"description": "An event as the log stores and serves it: the signed event plus the server-side fields, which are never hashed or signed. seq is the one fold order; received_at (unix seconds) is the lease clock; policy_version is the hash of the policy version the log checked the event against. One line of the fixture log after its header.",
|
|
5
|
+
"$comment": "Source: crates/sharedcontext/src/signed/event.rs struct StoredEvent {seq, received_at, policy_version (optional: absent only for events stored before the log recorded policy versions), event}; fixture line format {seq, received_at, policy_version, event} (crates/sharedcontext/fixtures/README.md).",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": ["seq", "received_at", "event"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"seq": { "type": "integer", "minimum": 1 },
|
|
10
|
+
"received_at": { "type": "integer", "minimum": 0 },
|
|
11
|
+
"policy_version": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$", "$comment": "crates/sharedcontext/src/work/org.rs policy_version" },
|
|
12
|
+
"event": { "$ref": "event.schema.json" }
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "urn:sharedcontext-directory:1:members",
|
|
4
|
+
"title": "sharedcontext-directory/1 member page",
|
|
5
|
+
"$comment": "The 200 body of GET {base}/orgs/{org_id}/members?limit={n}[&cursor={c}] (required route). A client follows next_cursor until it is null, empty or absent; a repeated cursor is an error. The pages together are the org's complete listing, or the server answers an error: never a silently partial listing (a member missing from it reads as gone from the org). Fields not named here are ignored by a client (additive changes stay v1; a breaking change is v2). Contract: docs/directory-http.md. Client: src/directory/http.rs.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": ["members"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"members": {
|
|
10
|
+
"type": "array",
|
|
11
|
+
"items": { "$ref": "#/$defs/Member" }
|
|
12
|
+
},
|
|
13
|
+
"next_cursor": { "$ref": "#/$defs/NextCursor" }
|
|
14
|
+
},
|
|
15
|
+
"$defs": {
|
|
16
|
+
"NextCursor": {
|
|
17
|
+
"type": ["string", "null"],
|
|
18
|
+
"maxLength": 1024,
|
|
19
|
+
"$comment": "Opaque to the client, which sends it back as ?cursor= (percent-encoded) with the same org and limit, and never parses it. null, empty or absent: this is the last page. A server may answer a cursor issued for another org 400."
|
|
20
|
+
},
|
|
21
|
+
"Id": { "type": "string", "minLength": 1, "maxLength": 256 },
|
|
22
|
+
"Member": {
|
|
23
|
+
"type": "object",
|
|
24
|
+
"required": ["member_id", "org_id", "user_id", "kind", "role", "lifecycle", "teams", "keys"],
|
|
25
|
+
"properties": {
|
|
26
|
+
"member_id": { "$ref": "#/$defs/Id", "description": "The member's id in the directory; stable for the member's life." },
|
|
27
|
+
"org_id": { "$ref": "#/$defs/Id", "description": "Always the org of the request: a member of another org fails the whole read." },
|
|
28
|
+
"user_id": { "type": "string", "maxLength": 256, "description": "The user behind a person member; may be empty for an agent." },
|
|
29
|
+
"kind": { "enum": ["person", "agent"] },
|
|
30
|
+
"role": { "type": "string", "maxLength": 128, "description": "The org role (owner, admin, member or a custom role), or several comma-separated; may be empty (read as member)." },
|
|
31
|
+
"title": { "type": ["string", "null"], "maxLength": 256 },
|
|
32
|
+
"lifecycle": { "enum": ["active", "paused", "retired"] },
|
|
33
|
+
"sponsor_member_id": { "type": ["string", "null"], "maxLength": 256, "description": "Agents: the sponsoring member (a person of the same org)." },
|
|
34
|
+
"teams": { "type": "array", "items": { "$ref": "#/$defs/Id" }, "description": "Team ids." },
|
|
35
|
+
"keys": { "type": "array", "items": { "$ref": "#/$defs/Key" }, "description": "The member's Nostr keys, revoked ones included (with revoked_at); at most one unrevoked." },
|
|
36
|
+
"sponsor_active": { "type": ["boolean", "null"], "description": "Agents: the directory's own view of whether the sponsor is active (read for drift only)." }
|
|
37
|
+
},
|
|
38
|
+
"if": { "required": ["kind"], "properties": { "kind": { "const": "agent" } } },
|
|
39
|
+
"then": { "required": ["sponsor_member_id"], "properties": { "sponsor_member_id": { "type": "string", "minLength": 1 } } },
|
|
40
|
+
"$comment": "Optional fields (title, sponsor_member_id, sponsor_active, a key's revoked_at) are best omitted; a client accepts null too. An agent always carries its sponsor_member_id."
|
|
41
|
+
},
|
|
42
|
+
"Key": {
|
|
43
|
+
"type": "object",
|
|
44
|
+
"required": ["pubkey", "custody"],
|
|
45
|
+
"properties": {
|
|
46
|
+
"pubkey": { "type": "string", "pattern": "^[0-9a-f]{64}$", "description": "x-only public key, 64 lowercase hex." },
|
|
47
|
+
"custody": { "enum": ["self", "directory"], "description": "self: the member holds it (a person); directory: the directory holds it and signs with it (an agent's minted key)." },
|
|
48
|
+
"revoked_at": { "type": ["string", "null"], "maxLength": 64, "description": "Set when the key was revoked (RFC 3339); a revoked key maps to nothing." }
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "urn:sharedcontext-directory:1:memberships",
|
|
4
|
+
"title": "sharedcontext-directory/1 membership page",
|
|
5
|
+
"$comment": "The 200 body of GET {base}/users/{user_id}/memberships?limit={n}[&cursor={c}] (optional route: 404 or 501 means the directory does not offer it). Paged like the member listing (members.schema.json), with the same complete-or-error rule. Fields not named here are ignored by a client. Contract: docs/directory-http.md. Client: src/directory/http.rs.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": ["memberships"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"memberships": {
|
|
10
|
+
"type": "array",
|
|
11
|
+
"items": { "$ref": "#/$defs/Membership" }
|
|
12
|
+
},
|
|
13
|
+
"next_cursor": {
|
|
14
|
+
"type": ["string", "null"],
|
|
15
|
+
"maxLength": 1024,
|
|
16
|
+
"$comment": "As in members.schema.json: opaque; null, empty or absent on the last page."
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"$defs": {
|
|
20
|
+
"Membership": {
|
|
21
|
+
"type": "object",
|
|
22
|
+
"required": ["org_id", "member_id", "kind", "role", "lifecycle"],
|
|
23
|
+
"properties": {
|
|
24
|
+
"org_id": { "type": "string", "minLength": 1, "maxLength": 256 },
|
|
25
|
+
"member_id": { "type": "string", "minLength": 1, "maxLength": 256 },
|
|
26
|
+
"kind": { "enum": ["person", "agent"] },
|
|
27
|
+
"role": { "type": "string", "maxLength": 128 },
|
|
28
|
+
"lifecycle": { "enum": ["active", "paused", "retired"] }
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|