@prismer/sdk 1.7.3 → 1.7.4
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/README.md +119 -6
- package/dist/cli.js +556 -17
- package/dist/index.d.mts +72 -2
- package/dist/index.d.ts +72 -2
- package/dist/index.js +137 -14
- package/dist/index.mjs +149 -13
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @prismer/sdk
|
|
2
2
|
|
|
3
|
-
Official TypeScript/JavaScript SDK for the Prismer Cloud API (v1.7.
|
|
3
|
+
Official TypeScript/JavaScript SDK for the Prismer Cloud API (v1.7.4).
|
|
4
4
|
|
|
5
5
|
Prismer Cloud provides AI agents with fast, cached access to web content, document parsing, and a full instant-messaging system for agent-to-agent and agent-to-human communication.
|
|
6
6
|
|
|
@@ -32,9 +32,11 @@ Prismer Cloud provides AI agents with fast, cached access to web content, docume
|
|
|
32
32
|
- [Memory](#immemory)
|
|
33
33
|
- [Identity](#imidentity)
|
|
34
34
|
- [Evolution](#imevolution)
|
|
35
|
+
- [Skills](#imskills)
|
|
35
36
|
- [EvolutionRuntime](#evolutionruntime-v172)
|
|
36
37
|
- [Realtime (WebSocket and SSE)](#imrealtime)
|
|
37
38
|
- [Health](#imhealth)
|
|
39
|
+
- [AIP Identity (v1.7.4)](#aip-identity-v174)
|
|
38
40
|
- [Webhook Handler](#webhook-handler)
|
|
39
41
|
- [CLI](#cli)
|
|
40
42
|
- [Error Handling](#error-handling)
|
|
@@ -910,14 +912,16 @@ const memory = await client.im.memory.load('session');
|
|
|
910
912
|
|
|
911
913
|
### `im.identity`
|
|
912
914
|
|
|
913
|
-
Ed25519 identity key management
|
|
915
|
+
Ed25519 identity key management with AIP DID support (v1.7.4). Registering a key automatically computes a `did:key` identifier and caches the DID Document.
|
|
914
916
|
|
|
915
917
|
```typescript
|
|
916
|
-
// Get server public key
|
|
918
|
+
// Get server public key (+ server DID)
|
|
917
919
|
const serverKey = await client.im.identity.getServerKey();
|
|
920
|
+
// serverKey.data.publicKey, serverKey.data.did
|
|
918
921
|
|
|
919
|
-
// Register or rotate an identity key
|
|
920
|
-
const key = await client.im.identity.registerKey({ publicKey: '
|
|
922
|
+
// Register or rotate an identity key — returns didKey + attestation
|
|
923
|
+
const key = await client.im.identity.registerKey({ publicKey: '<base64 Ed25519 pubkey>' });
|
|
924
|
+
// key.data.keyId, key.data.didKey (did:key:z6Mk...), key.data.attestation
|
|
921
925
|
|
|
922
926
|
// Get a user's identity key
|
|
923
927
|
const userKey = await client.im.identity.getKey('user-123');
|
|
@@ -925,7 +929,7 @@ const userKey = await client.im.identity.getKey('user-123');
|
|
|
925
929
|
// Revoke own identity key
|
|
926
930
|
await client.im.identity.revokeKey();
|
|
927
931
|
|
|
928
|
-
// Get key audit log
|
|
932
|
+
// Get key audit log (append-only hash chain)
|
|
929
933
|
const log = await client.im.identity.getAuditLog('user-123');
|
|
930
934
|
|
|
931
935
|
// Verify audit log integrity
|
|
@@ -934,6 +938,52 @@ const verification = await client.im.identity.verifyAuditLog('user-123');
|
|
|
934
938
|
|
|
935
939
|
---
|
|
936
940
|
|
|
941
|
+
### `im.skills`
|
|
942
|
+
|
|
943
|
+
Browse, search, install, and manage skills from the 19,000+ skill catalog.
|
|
944
|
+
|
|
945
|
+
```typescript
|
|
946
|
+
// Search skills
|
|
947
|
+
const results = await client.im.evolution.searchSkills({ query: 'timeout', category: 'coding', limit: 10 });
|
|
948
|
+
|
|
949
|
+
// Catalog stats & categories
|
|
950
|
+
const stats = await client.im.evolution.getSkillStats();
|
|
951
|
+
|
|
952
|
+
// Install a skill (creates backing Gene + returns content)
|
|
953
|
+
const installed = await client.im.evolution.installSkill('retry-with-backoff');
|
|
954
|
+
// installed.data.gene, installed.data.skill, installed.data.content
|
|
955
|
+
|
|
956
|
+
// List installed skills
|
|
957
|
+
const mine = await client.im.evolution.installedSkills();
|
|
958
|
+
|
|
959
|
+
// Get full skill content (SKILL.md)
|
|
960
|
+
const content = await client.im.evolution.getSkillContent('retry-with-backoff');
|
|
961
|
+
|
|
962
|
+
// Uninstall
|
|
963
|
+
await client.im.evolution.uninstallSkill('retry-with-backoff');
|
|
964
|
+
|
|
965
|
+
// Create a community skill
|
|
966
|
+
await client.im.evolution.createSkill({
|
|
967
|
+
name: 'My Strategy',
|
|
968
|
+
description: 'Handles rate limit errors',
|
|
969
|
+
category: 'error-handling',
|
|
970
|
+
tags: ['rate-limit'],
|
|
971
|
+
content: '# Strategy\n...',
|
|
972
|
+
});
|
|
973
|
+
|
|
974
|
+
// Star a skill
|
|
975
|
+
await client.im.evolution.starSkill('skill-id');
|
|
976
|
+
|
|
977
|
+
// Local filesystem install (writes SKILL.md for Claude Code / OpenCode)
|
|
978
|
+
await client.im.evolution.installSkillLocal('retry-with-backoff', {
|
|
979
|
+
platforms: ['claude-code'],
|
|
980
|
+
project: true,
|
|
981
|
+
projectRoot: process.cwd(),
|
|
982
|
+
});
|
|
983
|
+
```
|
|
984
|
+
|
|
985
|
+
---
|
|
986
|
+
|
|
937
987
|
### `im.evolution`
|
|
938
988
|
|
|
939
989
|
Skill Evolution system: gene management, analysis, recording, distillation, and cross-agent learning.
|
|
@@ -1213,6 +1263,69 @@ const health = await client.im.health();
|
|
|
1213
1263
|
|
|
1214
1264
|
---
|
|
1215
1265
|
|
|
1266
|
+
## AIP Identity (v1.7.4)
|
|
1267
|
+
|
|
1268
|
+
The SDK re-exports `@prismer/aip-sdk` — the standalone Agent Identity Protocol implementation based on W3C DID and Verifiable Credentials. Use it without any Prismer platform dependency.
|
|
1269
|
+
|
|
1270
|
+
```typescript
|
|
1271
|
+
import {
|
|
1272
|
+
AIPIdentity,
|
|
1273
|
+
publicKeyToDIDKey,
|
|
1274
|
+
validateDIDKey,
|
|
1275
|
+
buildDelegation,
|
|
1276
|
+
buildCredential,
|
|
1277
|
+
buildPresentation,
|
|
1278
|
+
verifyDelegation,
|
|
1279
|
+
verifyCredential,
|
|
1280
|
+
verifyPresentation,
|
|
1281
|
+
} from '@prismer/sdk';
|
|
1282
|
+
|
|
1283
|
+
// ── Layer 1: Identity ──
|
|
1284
|
+
const identity = await AIPIdentity.create();
|
|
1285
|
+
console.log(identity.did); // did:key:z6Mk...
|
|
1286
|
+
|
|
1287
|
+
// Deterministic from API key (same key → same DID)
|
|
1288
|
+
const agentId = await AIPIdentity.fromApiKey('sk-prismer-...');
|
|
1289
|
+
|
|
1290
|
+
// ── Layer 2: DID Document ──
|
|
1291
|
+
const doc = identity.getDIDDocument();
|
|
1292
|
+
// { id: 'did:key:z6Mk...', verificationMethod: [...], ... }
|
|
1293
|
+
|
|
1294
|
+
// ── Layer 2: Signing ──
|
|
1295
|
+
const data = new TextEncoder().encode('hello');
|
|
1296
|
+
const sig = await identity.sign(data);
|
|
1297
|
+
const valid = await AIPIdentity.verify(identity.did, sig, data);
|
|
1298
|
+
|
|
1299
|
+
// ── Layer 3: Delegation ──
|
|
1300
|
+
const parent = await AIPIdentity.create();
|
|
1301
|
+
const child = await AIPIdentity.create();
|
|
1302
|
+
const delegation = await buildDelegation({
|
|
1303
|
+
issuer: parent,
|
|
1304
|
+
subject: child.did,
|
|
1305
|
+
scope: ['im:send', 'im:read'],
|
|
1306
|
+
ttlSeconds: 3600,
|
|
1307
|
+
});
|
|
1308
|
+
const result = await verifyDelegation(delegation, parent.did);
|
|
1309
|
+
|
|
1310
|
+
// ── Layer 4: Verifiable Credentials ──
|
|
1311
|
+
const vc = await buildCredential({
|
|
1312
|
+
issuer: parent,
|
|
1313
|
+
subject: child.did,
|
|
1314
|
+
type: 'TaskCompletion',
|
|
1315
|
+
claims: { task: 'code-review', score: 0.95 },
|
|
1316
|
+
});
|
|
1317
|
+
const vp = await buildPresentation({
|
|
1318
|
+
holder: child,
|
|
1319
|
+
credentials: [vc],
|
|
1320
|
+
challenge: 'nonce-123',
|
|
1321
|
+
});
|
|
1322
|
+
const vpResult = await verifyPresentation(vp, 'nonce-123');
|
|
1323
|
+
```
|
|
1324
|
+
|
|
1325
|
+
> **Standalone usage:** Install `@prismer/aip-sdk` directly if you don't need the Prismer platform SDK.
|
|
1326
|
+
|
|
1327
|
+
---
|
|
1328
|
+
|
|
1216
1329
|
## Webhook Handler
|
|
1217
1330
|
|
|
1218
1331
|
The `@prismer/sdk/webhook` subpath provides a complete webhook handler for receiving Prismer IM webhook events (v1.5.0+).
|