@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/dist/index.d.mts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export { AIPIdentity, DIDDocument, SignedPayload } from '@prismer/aip-sdk';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Prismer Cloud Real-Time Client — WebSocket & SSE transports.
|
|
3
5
|
*
|
|
@@ -1621,8 +1623,17 @@ declare class E2EEncryption {
|
|
|
1621
1623
|
/**
|
|
1622
1624
|
* Initialize encryption with user passphrase.
|
|
1623
1625
|
* Derives a master key via PBKDF2 and generates an ECDH key pair.
|
|
1626
|
+
*
|
|
1627
|
+
* @param passphrase - User passphrase for master key derivation
|
|
1628
|
+
* @param salt - Optional Base64-encoded salt. If omitted, a random 16-byte salt is generated.
|
|
1629
|
+
* Store the salt (via exportSalt()) so you can re-derive the same master key later.
|
|
1630
|
+
*/
|
|
1631
|
+
init(passphrase: string, salt?: string): Promise<void>;
|
|
1632
|
+
/**
|
|
1633
|
+
* Export the salt as Base64 string for persistent storage.
|
|
1634
|
+
* You must store this and pass it back to init() to re-derive the same master key.
|
|
1624
1635
|
*/
|
|
1625
|
-
|
|
1636
|
+
exportSalt(): string;
|
|
1626
1637
|
/**
|
|
1627
1638
|
* Export public key for sharing with conversation peers.
|
|
1628
1639
|
*/
|
|
@@ -1664,6 +1675,45 @@ declare class E2EEncryption {
|
|
|
1664
1675
|
* Clear all keys and reset state.
|
|
1665
1676
|
*/
|
|
1666
1677
|
destroy(): void;
|
|
1678
|
+
private messageCount;
|
|
1679
|
+
private static readonly KEY_ROTATION_THRESHOLD;
|
|
1680
|
+
private static readonly KEY_ROTATION_INTERVAL_MS;
|
|
1681
|
+
private lastRotation;
|
|
1682
|
+
/**
|
|
1683
|
+
* High-level encrypt-for-send pipeline.
|
|
1684
|
+
* Encrypts content, builds metadata, and handles key rotation.
|
|
1685
|
+
*
|
|
1686
|
+
* Returns { encryptedContent, metadata } ready to send.
|
|
1687
|
+
*/
|
|
1688
|
+
encryptForSend(conversationId: string, content: string): Promise<{
|
|
1689
|
+
encryptedContent: string;
|
|
1690
|
+
metadata: Record<string, any>;
|
|
1691
|
+
}>;
|
|
1692
|
+
/**
|
|
1693
|
+
* High-level decrypt-on-receive pipeline.
|
|
1694
|
+
* Decrypts content and validates metadata.
|
|
1695
|
+
*/
|
|
1696
|
+
decryptOnReceive(conversationId: string, encryptedContent: string, metadata?: Record<string, any>): Promise<string>;
|
|
1697
|
+
/**
|
|
1698
|
+
* High-level file encryption pipeline.
|
|
1699
|
+
*/
|
|
1700
|
+
encryptFile(conversationId: string, fileData: ArrayBuffer): Promise<{
|
|
1701
|
+
encryptedData: string;
|
|
1702
|
+
metadata: Record<string, any>;
|
|
1703
|
+
}>;
|
|
1704
|
+
/**
|
|
1705
|
+
* High-level file decryption pipeline.
|
|
1706
|
+
*/
|
|
1707
|
+
decryptFile(conversationId: string, encryptedData: string): Promise<ArrayBuffer>;
|
|
1708
|
+
/**
|
|
1709
|
+
* Check if key rotation is needed (1000 messages or 24 hours).
|
|
1710
|
+
*/
|
|
1711
|
+
private shouldRotateKey;
|
|
1712
|
+
/**
|
|
1713
|
+
* Perform key rotation: generate new ECDH keypair and reset counters.
|
|
1714
|
+
* The caller is responsible for re-exchanging keys with peers.
|
|
1715
|
+
*/
|
|
1716
|
+
rotateKeys(): Promise<JsonWebKey>;
|
|
1667
1717
|
}
|
|
1668
1718
|
|
|
1669
1719
|
/**
|
|
@@ -2340,6 +2390,22 @@ declare class EvolutionClient {
|
|
|
2340
2390
|
installedSkills(): Promise<IMResult<IMAgentSkillRecord[]>>;
|
|
2341
2391
|
/** Get full skill content (SKILL.md + package info) */
|
|
2342
2392
|
getSkillContent(slugOrId: string): Promise<IMResult<IMSkillContent>>;
|
|
2393
|
+
/** Create/submit a community skill */
|
|
2394
|
+
createSkill(input: {
|
|
2395
|
+
name: string;
|
|
2396
|
+
description: string;
|
|
2397
|
+
category: string;
|
|
2398
|
+
tags?: string[];
|
|
2399
|
+
content?: string;
|
|
2400
|
+
signals?: Array<{
|
|
2401
|
+
type: string;
|
|
2402
|
+
}>;
|
|
2403
|
+
author?: string;
|
|
2404
|
+
}): Promise<IMResult<any>>;
|
|
2405
|
+
/** Star a skill (increment community rating) */
|
|
2406
|
+
starSkill(skillId: string): Promise<IMResult<{
|
|
2407
|
+
stars: number;
|
|
2408
|
+
}>>;
|
|
2343
2409
|
/**
|
|
2344
2410
|
* Install a skill and write SKILL.md to local filesystem.
|
|
2345
2411
|
* Combines cloud install + local file sync for Claude Code / OpenClaw / OpenCode.
|
|
@@ -2400,6 +2466,10 @@ declare class EvolutionClient {
|
|
|
2400
2466
|
pullSince?: number;
|
|
2401
2467
|
}): Promise<IMResult<any>>;
|
|
2402
2468
|
}
|
|
2469
|
+
/** Sanitize a slug/id to prevent path traversal (removes slashes, .., and null bytes) */
|
|
2470
|
+
declare function safeSlug(input: string): string;
|
|
2471
|
+
/** Map file extension to MIME type (no external deps) */
|
|
2472
|
+
declare function guessMimeType(fileName: string): string;
|
|
2403
2473
|
/** File upload management (presign → upload → confirm) */
|
|
2404
2474
|
declare class FilesClient {
|
|
2405
2475
|
private _r;
|
|
@@ -2530,4 +2600,4 @@ declare class PrismerClient {
|
|
|
2530
2600
|
|
|
2531
2601
|
declare function createClient(config: PrismerConfig): PrismerClient;
|
|
2532
2602
|
|
|
2533
|
-
export { AccountClient, AttachmentQueue, type AuthenticatedPayload, type BatchSummary, type BatchUrlCost, BindingsClient, ContactsClient, ConversationsClient, CreditsClient, type DecryptResult, type DerivationMode, DirectClient, type DisconnectedPayload, E2EEncryption, ENVIRONMENTS, type EncryptedContextResult, type EncryptedFileResult, type EncryptedMessage, type Environment, type ErrorPayload, EvolutionCache, EvolutionClient, EvolutionRuntime, type EvolutionRuntimeConfig, type EvolutionSession, type EvolutionSyncDelta, type EvolutionSyncSnapshot, type ExecutionContext, type FileInput, FilesClient, type GeneCategory, type GeneSelectionResult, type GeneVisibility, GroupsClient, type IMAgentCard, type IMAgentPersonality, type IMAgentSkillRecord, type IMAnalyzeOptions, type IMAnalyzeResult, type IMAutocompleteResult, type IMBinding, type IMBindingData, type IMCapsule, IMClient, type IMCompactOptions, type IMCompactionSummary, type IMCompleteTaskOptions, type IMConfirmResult, type IMContact, type IMConversation, type IMConversationsOptions, type IMCreateBindingOptions, type IMCreateGeneOptions, type IMCreateGroupOptions, type IMCreateMemoryFileOptions, type IMCreateTaskOptions, type IMCreditsData, type IMDiscoverAgent, type IMDiscoverOptions, type IMEvolutionEdge, type IMEvolutionStats, type IMFileQuota, type IMForkGeneOptions, type IMGene, type IMGeneListOptions, type IMGroupData, type IMGroupMember, type IMIdentityKey, type IMKeyAuditEntry, type IMKeyVerifyResult, type IMMeData, type IMMemoryFile, type IMMemoryFileDetail, type IMMemoryLoadResult, type IMMessage, type IMMessageData, type IMMultipartInitResult, type IMPaginationOptions, type IMPresignOptions, type IMPresignResult, IMRealtimeClient, type IMRecordOutcomeOptions, type IMRegisterData, type IMRegisterKeyOptions, type IMRegisterOptions, type IMResult, type IMRouting, type IMSendOptions, type IMSkillContent, type IMSkillInfo, type IMSkillInstallResult, type IMTask, type IMTaskDetail, type IMTaskListOptions, type IMTaskLog, type IMTokenData, type IMTransaction, type IMUpdateMemoryFileOptions, type IMUpdateTaskOptions, type IMUser, type IMWorkspaceData, type IMWorkspaceInitGroupOptions, type IMWorkspaceInitOptions, IdentityClient, IndexedDBStorage, type LoadOptions, type LoadResult, type LoadResultItem, MemoryClient, MemoryStorage, type MessageDeletedPayload, type MessageEditPayload, type MessageNewPayload, MessagesClient, type OfflineConfig, type OfflineEventMap, type OfflineEventType, OfflineManager, type OutboxOperation, type ParseCost, type ParseCostBreakdown, type ParseDocument, type ParseDocumentImage, type ParseOptions, type ParseResult, type ParseUsage, type PongPayload, type PresenceChangedPayload, PrismerClient, type PrismerConfig, type QueryCost, type QuerySummary, type QueuedAttachment, type RankingFactors, type RealtimeCommand, type RealtimeConfig, type RealtimeEventMap, type RealtimeEventType, RealtimeSSEClient, type RealtimeState, RealtimeWSClient, type ReconnectingPayload, type RequestFn, SQLiteStorage, type SaveBatchOptions, type SaveOptions, type SaveResult, type ScheduleType, SecurityClient, type SendFileOptions, type SendFileResult, type SessionMetrics, type SignalEnrichmentConfig, type SignalTag, type SingleUrlCost, type StorageAdapter, type StoredContact, type StoredConversation, type StoredMessage, type Suggestion, type SyncEvent, type SyncResult, TabCoordinator, type TaskStatus, TasksClient, type TypingIndicatorPayload, type UploadOptions, type UploadResult, WorkspaceClient, createClient, createEnrichedExtractor, decryptContext, decryptFile, decryptMessages, decryptOnReceive, PrismerClient as default, encryptContext, encryptFile, encryptForSend, extractSignals };
|
|
2603
|
+
export { AccountClient, AttachmentQueue, type AuthenticatedPayload, type BatchSummary, type BatchUrlCost, BindingsClient, ContactsClient, ConversationsClient, CreditsClient, type DecryptResult, type DerivationMode, DirectClient, type DisconnectedPayload, E2EEncryption, ENVIRONMENTS, type EncryptedContextResult, type EncryptedFileResult, type EncryptedMessage, type Environment, type ErrorPayload, EvolutionCache, EvolutionClient, EvolutionRuntime, type EvolutionRuntimeConfig, type EvolutionSession, type EvolutionSyncDelta, type EvolutionSyncSnapshot, type ExecutionContext, type FileInput, FilesClient, type GeneCategory, type GeneSelectionResult, type GeneVisibility, GroupsClient, type IMAgentCard, type IMAgentPersonality, type IMAgentSkillRecord, type IMAnalyzeOptions, type IMAnalyzeResult, type IMAutocompleteResult, type IMBinding, type IMBindingData, type IMCapsule, IMClient, type IMCompactOptions, type IMCompactionSummary, type IMCompleteTaskOptions, type IMConfirmResult, type IMContact, type IMConversation, type IMConversationsOptions, type IMCreateBindingOptions, type IMCreateGeneOptions, type IMCreateGroupOptions, type IMCreateMemoryFileOptions, type IMCreateTaskOptions, type IMCreditsData, type IMDiscoverAgent, type IMDiscoverOptions, type IMEvolutionEdge, type IMEvolutionStats, type IMFileQuota, type IMForkGeneOptions, type IMGene, type IMGeneListOptions, type IMGroupData, type IMGroupMember, type IMIdentityKey, type IMKeyAuditEntry, type IMKeyVerifyResult, type IMMeData, type IMMemoryFile, type IMMemoryFileDetail, type IMMemoryLoadResult, type IMMessage, type IMMessageData, type IMMultipartInitResult, type IMPaginationOptions, type IMPresignOptions, type IMPresignResult, IMRealtimeClient, type IMRecordOutcomeOptions, type IMRegisterData, type IMRegisterKeyOptions, type IMRegisterOptions, type IMResult, type IMRouting, type IMSendOptions, type IMSkillContent, type IMSkillInfo, type IMSkillInstallResult, type IMTask, type IMTaskDetail, type IMTaskListOptions, type IMTaskLog, type IMTokenData, type IMTransaction, type IMUpdateMemoryFileOptions, type IMUpdateTaskOptions, type IMUser, type IMWorkspaceData, type IMWorkspaceInitGroupOptions, type IMWorkspaceInitOptions, IdentityClient, IndexedDBStorage, type LoadOptions, type LoadResult, type LoadResultItem, MemoryClient, MemoryStorage, type MessageDeletedPayload, type MessageEditPayload, type MessageNewPayload, MessagesClient, type OfflineConfig, type OfflineEventMap, type OfflineEventType, OfflineManager, type OutboxOperation, type ParseCost, type ParseCostBreakdown, type ParseDocument, type ParseDocumentImage, type ParseOptions, type ParseResult, type ParseUsage, type PongPayload, type PresenceChangedPayload, PrismerClient, type PrismerConfig, type QueryCost, type QuerySummary, type QueuedAttachment, type RankingFactors, type RealtimeCommand, type RealtimeConfig, type RealtimeEventMap, type RealtimeEventType, RealtimeSSEClient, type RealtimeState, RealtimeWSClient, type ReconnectingPayload, type RequestFn, SQLiteStorage, type SaveBatchOptions, type SaveOptions, type SaveResult, type ScheduleType, SecurityClient, type SendFileOptions, type SendFileResult, type SessionMetrics, type SignalEnrichmentConfig, type SignalTag, type SingleUrlCost, type StorageAdapter, type StoredContact, type StoredConversation, type StoredMessage, type Suggestion, type SyncEvent, type SyncResult, TabCoordinator, type TaskStatus, TasksClient, type TypingIndicatorPayload, type UploadOptions, type UploadResult, WorkspaceClient, createClient, createEnrichedExtractor, decryptContext, decryptFile, decryptMessages, decryptOnReceive, PrismerClient as default, encryptContext, encryptFile, encryptForSend, extractSignals, guessMimeType, safeSlug };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export { AIPIdentity, DIDDocument, SignedPayload } from '@prismer/aip-sdk';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Prismer Cloud Real-Time Client — WebSocket & SSE transports.
|
|
3
5
|
*
|
|
@@ -1621,8 +1623,17 @@ declare class E2EEncryption {
|
|
|
1621
1623
|
/**
|
|
1622
1624
|
* Initialize encryption with user passphrase.
|
|
1623
1625
|
* Derives a master key via PBKDF2 and generates an ECDH key pair.
|
|
1626
|
+
*
|
|
1627
|
+
* @param passphrase - User passphrase for master key derivation
|
|
1628
|
+
* @param salt - Optional Base64-encoded salt. If omitted, a random 16-byte salt is generated.
|
|
1629
|
+
* Store the salt (via exportSalt()) so you can re-derive the same master key later.
|
|
1630
|
+
*/
|
|
1631
|
+
init(passphrase: string, salt?: string): Promise<void>;
|
|
1632
|
+
/**
|
|
1633
|
+
* Export the salt as Base64 string for persistent storage.
|
|
1634
|
+
* You must store this and pass it back to init() to re-derive the same master key.
|
|
1624
1635
|
*/
|
|
1625
|
-
|
|
1636
|
+
exportSalt(): string;
|
|
1626
1637
|
/**
|
|
1627
1638
|
* Export public key for sharing with conversation peers.
|
|
1628
1639
|
*/
|
|
@@ -1664,6 +1675,45 @@ declare class E2EEncryption {
|
|
|
1664
1675
|
* Clear all keys and reset state.
|
|
1665
1676
|
*/
|
|
1666
1677
|
destroy(): void;
|
|
1678
|
+
private messageCount;
|
|
1679
|
+
private static readonly KEY_ROTATION_THRESHOLD;
|
|
1680
|
+
private static readonly KEY_ROTATION_INTERVAL_MS;
|
|
1681
|
+
private lastRotation;
|
|
1682
|
+
/**
|
|
1683
|
+
* High-level encrypt-for-send pipeline.
|
|
1684
|
+
* Encrypts content, builds metadata, and handles key rotation.
|
|
1685
|
+
*
|
|
1686
|
+
* Returns { encryptedContent, metadata } ready to send.
|
|
1687
|
+
*/
|
|
1688
|
+
encryptForSend(conversationId: string, content: string): Promise<{
|
|
1689
|
+
encryptedContent: string;
|
|
1690
|
+
metadata: Record<string, any>;
|
|
1691
|
+
}>;
|
|
1692
|
+
/**
|
|
1693
|
+
* High-level decrypt-on-receive pipeline.
|
|
1694
|
+
* Decrypts content and validates metadata.
|
|
1695
|
+
*/
|
|
1696
|
+
decryptOnReceive(conversationId: string, encryptedContent: string, metadata?: Record<string, any>): Promise<string>;
|
|
1697
|
+
/**
|
|
1698
|
+
* High-level file encryption pipeline.
|
|
1699
|
+
*/
|
|
1700
|
+
encryptFile(conversationId: string, fileData: ArrayBuffer): Promise<{
|
|
1701
|
+
encryptedData: string;
|
|
1702
|
+
metadata: Record<string, any>;
|
|
1703
|
+
}>;
|
|
1704
|
+
/**
|
|
1705
|
+
* High-level file decryption pipeline.
|
|
1706
|
+
*/
|
|
1707
|
+
decryptFile(conversationId: string, encryptedData: string): Promise<ArrayBuffer>;
|
|
1708
|
+
/**
|
|
1709
|
+
* Check if key rotation is needed (1000 messages or 24 hours).
|
|
1710
|
+
*/
|
|
1711
|
+
private shouldRotateKey;
|
|
1712
|
+
/**
|
|
1713
|
+
* Perform key rotation: generate new ECDH keypair and reset counters.
|
|
1714
|
+
* The caller is responsible for re-exchanging keys with peers.
|
|
1715
|
+
*/
|
|
1716
|
+
rotateKeys(): Promise<JsonWebKey>;
|
|
1667
1717
|
}
|
|
1668
1718
|
|
|
1669
1719
|
/**
|
|
@@ -2340,6 +2390,22 @@ declare class EvolutionClient {
|
|
|
2340
2390
|
installedSkills(): Promise<IMResult<IMAgentSkillRecord[]>>;
|
|
2341
2391
|
/** Get full skill content (SKILL.md + package info) */
|
|
2342
2392
|
getSkillContent(slugOrId: string): Promise<IMResult<IMSkillContent>>;
|
|
2393
|
+
/** Create/submit a community skill */
|
|
2394
|
+
createSkill(input: {
|
|
2395
|
+
name: string;
|
|
2396
|
+
description: string;
|
|
2397
|
+
category: string;
|
|
2398
|
+
tags?: string[];
|
|
2399
|
+
content?: string;
|
|
2400
|
+
signals?: Array<{
|
|
2401
|
+
type: string;
|
|
2402
|
+
}>;
|
|
2403
|
+
author?: string;
|
|
2404
|
+
}): Promise<IMResult<any>>;
|
|
2405
|
+
/** Star a skill (increment community rating) */
|
|
2406
|
+
starSkill(skillId: string): Promise<IMResult<{
|
|
2407
|
+
stars: number;
|
|
2408
|
+
}>>;
|
|
2343
2409
|
/**
|
|
2344
2410
|
* Install a skill and write SKILL.md to local filesystem.
|
|
2345
2411
|
* Combines cloud install + local file sync for Claude Code / OpenClaw / OpenCode.
|
|
@@ -2400,6 +2466,10 @@ declare class EvolutionClient {
|
|
|
2400
2466
|
pullSince?: number;
|
|
2401
2467
|
}): Promise<IMResult<any>>;
|
|
2402
2468
|
}
|
|
2469
|
+
/** Sanitize a slug/id to prevent path traversal (removes slashes, .., and null bytes) */
|
|
2470
|
+
declare function safeSlug(input: string): string;
|
|
2471
|
+
/** Map file extension to MIME type (no external deps) */
|
|
2472
|
+
declare function guessMimeType(fileName: string): string;
|
|
2403
2473
|
/** File upload management (presign → upload → confirm) */
|
|
2404
2474
|
declare class FilesClient {
|
|
2405
2475
|
private _r;
|
|
@@ -2530,4 +2600,4 @@ declare class PrismerClient {
|
|
|
2530
2600
|
|
|
2531
2601
|
declare function createClient(config: PrismerConfig): PrismerClient;
|
|
2532
2602
|
|
|
2533
|
-
export { AccountClient, AttachmentQueue, type AuthenticatedPayload, type BatchSummary, type BatchUrlCost, BindingsClient, ContactsClient, ConversationsClient, CreditsClient, type DecryptResult, type DerivationMode, DirectClient, type DisconnectedPayload, E2EEncryption, ENVIRONMENTS, type EncryptedContextResult, type EncryptedFileResult, type EncryptedMessage, type Environment, type ErrorPayload, EvolutionCache, EvolutionClient, EvolutionRuntime, type EvolutionRuntimeConfig, type EvolutionSession, type EvolutionSyncDelta, type EvolutionSyncSnapshot, type ExecutionContext, type FileInput, FilesClient, type GeneCategory, type GeneSelectionResult, type GeneVisibility, GroupsClient, type IMAgentCard, type IMAgentPersonality, type IMAgentSkillRecord, type IMAnalyzeOptions, type IMAnalyzeResult, type IMAutocompleteResult, type IMBinding, type IMBindingData, type IMCapsule, IMClient, type IMCompactOptions, type IMCompactionSummary, type IMCompleteTaskOptions, type IMConfirmResult, type IMContact, type IMConversation, type IMConversationsOptions, type IMCreateBindingOptions, type IMCreateGeneOptions, type IMCreateGroupOptions, type IMCreateMemoryFileOptions, type IMCreateTaskOptions, type IMCreditsData, type IMDiscoverAgent, type IMDiscoverOptions, type IMEvolutionEdge, type IMEvolutionStats, type IMFileQuota, type IMForkGeneOptions, type IMGene, type IMGeneListOptions, type IMGroupData, type IMGroupMember, type IMIdentityKey, type IMKeyAuditEntry, type IMKeyVerifyResult, type IMMeData, type IMMemoryFile, type IMMemoryFileDetail, type IMMemoryLoadResult, type IMMessage, type IMMessageData, type IMMultipartInitResult, type IMPaginationOptions, type IMPresignOptions, type IMPresignResult, IMRealtimeClient, type IMRecordOutcomeOptions, type IMRegisterData, type IMRegisterKeyOptions, type IMRegisterOptions, type IMResult, type IMRouting, type IMSendOptions, type IMSkillContent, type IMSkillInfo, type IMSkillInstallResult, type IMTask, type IMTaskDetail, type IMTaskListOptions, type IMTaskLog, type IMTokenData, type IMTransaction, type IMUpdateMemoryFileOptions, type IMUpdateTaskOptions, type IMUser, type IMWorkspaceData, type IMWorkspaceInitGroupOptions, type IMWorkspaceInitOptions, IdentityClient, IndexedDBStorage, type LoadOptions, type LoadResult, type LoadResultItem, MemoryClient, MemoryStorage, type MessageDeletedPayload, type MessageEditPayload, type MessageNewPayload, MessagesClient, type OfflineConfig, type OfflineEventMap, type OfflineEventType, OfflineManager, type OutboxOperation, type ParseCost, type ParseCostBreakdown, type ParseDocument, type ParseDocumentImage, type ParseOptions, type ParseResult, type ParseUsage, type PongPayload, type PresenceChangedPayload, PrismerClient, type PrismerConfig, type QueryCost, type QuerySummary, type QueuedAttachment, type RankingFactors, type RealtimeCommand, type RealtimeConfig, type RealtimeEventMap, type RealtimeEventType, RealtimeSSEClient, type RealtimeState, RealtimeWSClient, type ReconnectingPayload, type RequestFn, SQLiteStorage, type SaveBatchOptions, type SaveOptions, type SaveResult, type ScheduleType, SecurityClient, type SendFileOptions, type SendFileResult, type SessionMetrics, type SignalEnrichmentConfig, type SignalTag, type SingleUrlCost, type StorageAdapter, type StoredContact, type StoredConversation, type StoredMessage, type Suggestion, type SyncEvent, type SyncResult, TabCoordinator, type TaskStatus, TasksClient, type TypingIndicatorPayload, type UploadOptions, type UploadResult, WorkspaceClient, createClient, createEnrichedExtractor, decryptContext, decryptFile, decryptMessages, decryptOnReceive, PrismerClient as default, encryptContext, encryptFile, encryptForSend, extractSignals };
|
|
2603
|
+
export { AccountClient, AttachmentQueue, type AuthenticatedPayload, type BatchSummary, type BatchUrlCost, BindingsClient, ContactsClient, ConversationsClient, CreditsClient, type DecryptResult, type DerivationMode, DirectClient, type DisconnectedPayload, E2EEncryption, ENVIRONMENTS, type EncryptedContextResult, type EncryptedFileResult, type EncryptedMessage, type Environment, type ErrorPayload, EvolutionCache, EvolutionClient, EvolutionRuntime, type EvolutionRuntimeConfig, type EvolutionSession, type EvolutionSyncDelta, type EvolutionSyncSnapshot, type ExecutionContext, type FileInput, FilesClient, type GeneCategory, type GeneSelectionResult, type GeneVisibility, GroupsClient, type IMAgentCard, type IMAgentPersonality, type IMAgentSkillRecord, type IMAnalyzeOptions, type IMAnalyzeResult, type IMAutocompleteResult, type IMBinding, type IMBindingData, type IMCapsule, IMClient, type IMCompactOptions, type IMCompactionSummary, type IMCompleteTaskOptions, type IMConfirmResult, type IMContact, type IMConversation, type IMConversationsOptions, type IMCreateBindingOptions, type IMCreateGeneOptions, type IMCreateGroupOptions, type IMCreateMemoryFileOptions, type IMCreateTaskOptions, type IMCreditsData, type IMDiscoverAgent, type IMDiscoverOptions, type IMEvolutionEdge, type IMEvolutionStats, type IMFileQuota, type IMForkGeneOptions, type IMGene, type IMGeneListOptions, type IMGroupData, type IMGroupMember, type IMIdentityKey, type IMKeyAuditEntry, type IMKeyVerifyResult, type IMMeData, type IMMemoryFile, type IMMemoryFileDetail, type IMMemoryLoadResult, type IMMessage, type IMMessageData, type IMMultipartInitResult, type IMPaginationOptions, type IMPresignOptions, type IMPresignResult, IMRealtimeClient, type IMRecordOutcomeOptions, type IMRegisterData, type IMRegisterKeyOptions, type IMRegisterOptions, type IMResult, type IMRouting, type IMSendOptions, type IMSkillContent, type IMSkillInfo, type IMSkillInstallResult, type IMTask, type IMTaskDetail, type IMTaskListOptions, type IMTaskLog, type IMTokenData, type IMTransaction, type IMUpdateMemoryFileOptions, type IMUpdateTaskOptions, type IMUser, type IMWorkspaceData, type IMWorkspaceInitGroupOptions, type IMWorkspaceInitOptions, IdentityClient, IndexedDBStorage, type LoadOptions, type LoadResult, type LoadResultItem, MemoryClient, MemoryStorage, type MessageDeletedPayload, type MessageEditPayload, type MessageNewPayload, MessagesClient, type OfflineConfig, type OfflineEventMap, type OfflineEventType, OfflineManager, type OutboxOperation, type ParseCost, type ParseCostBreakdown, type ParseDocument, type ParseDocumentImage, type ParseOptions, type ParseResult, type ParseUsage, type PongPayload, type PresenceChangedPayload, PrismerClient, type PrismerConfig, type QueryCost, type QuerySummary, type QueuedAttachment, type RankingFactors, type RealtimeCommand, type RealtimeConfig, type RealtimeEventMap, type RealtimeEventType, RealtimeSSEClient, type RealtimeState, RealtimeWSClient, type ReconnectingPayload, type RequestFn, SQLiteStorage, type SaveBatchOptions, type SaveOptions, type SaveResult, type ScheduleType, SecurityClient, type SendFileOptions, type SendFileResult, type SessionMetrics, type SignalEnrichmentConfig, type SignalTag, type SingleUrlCost, type StorageAdapter, type StoredContact, type StoredConversation, type StoredMessage, type Suggestion, type SyncEvent, type SyncResult, TabCoordinator, type TaskStatus, TasksClient, type TypingIndicatorPayload, type UploadOptions, type UploadResult, WorkspaceClient, createClient, createEnrichedExtractor, decryptContext, decryptFile, decryptMessages, decryptOnReceive, PrismerClient as default, encryptContext, encryptFile, encryptForSend, extractSignals, guessMimeType, safeSlug };
|
package/dist/index.js
CHANGED
|
@@ -30,6 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
|
+
AIPIdentity: () => import_aip_sdk.AIPIdentity,
|
|
33
34
|
AccountClient: () => AccountClient,
|
|
34
35
|
AttachmentQueue: () => AttachmentQueue,
|
|
35
36
|
BindingsClient: () => BindingsClient,
|
|
@@ -70,7 +71,9 @@ __export(index_exports, {
|
|
|
70
71
|
encryptContext: () => encryptContext,
|
|
71
72
|
encryptFile: () => encryptFile,
|
|
72
73
|
encryptForSend: () => encryptForSend,
|
|
73
|
-
extractSignals: () => extractSignals
|
|
74
|
+
extractSignals: () => extractSignals,
|
|
75
|
+
guessMimeType: () => guessMimeType,
|
|
76
|
+
safeSlug: () => safeSlug
|
|
74
77
|
});
|
|
75
78
|
module.exports = __toCommonJS(index_exports);
|
|
76
79
|
|
|
@@ -1279,6 +1282,12 @@ var ENVIRONMENTS = {
|
|
|
1279
1282
|
production: "https://prismer.cloud"
|
|
1280
1283
|
};
|
|
1281
1284
|
|
|
1285
|
+
// src/aip.ts
|
|
1286
|
+
var import_aip_sdk = require("@prismer/aip-sdk");
|
|
1287
|
+
var import_aip_sdk2 = require("@prismer/aip-sdk");
|
|
1288
|
+
var import_aip_sdk3 = require("@prismer/aip-sdk");
|
|
1289
|
+
var import_aip_sdk4 = require("@prismer/aip-sdk");
|
|
1290
|
+
|
|
1282
1291
|
// src/storage.ts
|
|
1283
1292
|
var MemoryStorage = class {
|
|
1284
1293
|
constructor() {
|
|
@@ -2163,20 +2172,27 @@ var PBKDF2_ITERATIONS = 1e5;
|
|
|
2163
2172
|
var SALT_LENGTH = 16;
|
|
2164
2173
|
var IV_LENGTH = 12;
|
|
2165
2174
|
var KEY_LENGTH = 256;
|
|
2166
|
-
var
|
|
2175
|
+
var _E2EEncryption = class _E2EEncryption {
|
|
2167
2176
|
constructor() {
|
|
2168
2177
|
this.masterKey = null;
|
|
2169
2178
|
this.keyPair = null;
|
|
2170
2179
|
this.sessionKeys = /* @__PURE__ */ new Map();
|
|
2171
2180
|
// conversationId → AES key
|
|
2172
2181
|
this.salt = null;
|
|
2182
|
+
// ─── Pipeline Functions ──────────────────────────────────
|
|
2183
|
+
this.messageCount = 0;
|
|
2184
|
+
this.lastRotation = Date.now();
|
|
2173
2185
|
}
|
|
2174
2186
|
/**
|
|
2175
2187
|
* Initialize encryption with user passphrase.
|
|
2176
2188
|
* Derives a master key via PBKDF2 and generates an ECDH key pair.
|
|
2189
|
+
*
|
|
2190
|
+
* @param passphrase - User passphrase for master key derivation
|
|
2191
|
+
* @param salt - Optional Base64-encoded salt. If omitted, a random 16-byte salt is generated.
|
|
2192
|
+
* Store the salt (via exportSalt()) so you can re-derive the same master key later.
|
|
2177
2193
|
*/
|
|
2178
|
-
async init(passphrase) {
|
|
2179
|
-
this.salt = getRandomValues(new Uint8Array(SALT_LENGTH));
|
|
2194
|
+
async init(passphrase, salt) {
|
|
2195
|
+
this.salt = salt ? new Uint8Array(base64ToArrayBuffer(salt)) : getRandomValues(new Uint8Array(SALT_LENGTH));
|
|
2180
2196
|
const passphraseKey = await subtle().importKey(
|
|
2181
2197
|
"raw",
|
|
2182
2198
|
new TextEncoder().encode(passphrase),
|
|
@@ -2187,7 +2203,7 @@ var E2EEncryption = class {
|
|
|
2187
2203
|
this.masterKey = await subtle().deriveKey(
|
|
2188
2204
|
{
|
|
2189
2205
|
name: "PBKDF2",
|
|
2190
|
-
salt: this.salt,
|
|
2206
|
+
salt: new Uint8Array(this.salt.buffer, this.salt.byteOffset, this.salt.byteLength).buffer,
|
|
2191
2207
|
iterations: PBKDF2_ITERATIONS,
|
|
2192
2208
|
hash: "SHA-256"
|
|
2193
2209
|
},
|
|
@@ -2202,6 +2218,14 @@ var E2EEncryption = class {
|
|
|
2202
2218
|
["deriveKey"]
|
|
2203
2219
|
);
|
|
2204
2220
|
}
|
|
2221
|
+
/**
|
|
2222
|
+
* Export the salt as Base64 string for persistent storage.
|
|
2223
|
+
* You must store this and pass it back to init() to re-derive the same master key.
|
|
2224
|
+
*/
|
|
2225
|
+
exportSalt() {
|
|
2226
|
+
if (!this.salt) throw new Error("E2E not initialized. Call init() first.");
|
|
2227
|
+
return arrayBufferToBase64(this.salt.buffer);
|
|
2228
|
+
}
|
|
2205
2229
|
/**
|
|
2206
2230
|
* Export public key for sharing with conversation peers.
|
|
2207
2231
|
*/
|
|
@@ -2314,8 +2338,93 @@ var E2EEncryption = class {
|
|
|
2314
2338
|
this.keyPair = null;
|
|
2315
2339
|
this.sessionKeys.clear();
|
|
2316
2340
|
this.salt = null;
|
|
2341
|
+
this.messageCount = 0;
|
|
2342
|
+
}
|
|
2343
|
+
/**
|
|
2344
|
+
* High-level encrypt-for-send pipeline.
|
|
2345
|
+
* Encrypts content, builds metadata, and handles key rotation.
|
|
2346
|
+
*
|
|
2347
|
+
* Returns { encryptedContent, metadata } ready to send.
|
|
2348
|
+
*/
|
|
2349
|
+
async encryptForSend(conversationId, content) {
|
|
2350
|
+
if (!this.hasSessionKey(conversationId)) {
|
|
2351
|
+
throw new Error("No session key for this conversation. Call deriveSessionKey() first.");
|
|
2352
|
+
}
|
|
2353
|
+
const needsRotation = this.shouldRotateKey();
|
|
2354
|
+
const encryptedContent = await this.encrypt(conversationId, content);
|
|
2355
|
+
this.messageCount++;
|
|
2356
|
+
return {
|
|
2357
|
+
encryptedContent,
|
|
2358
|
+
metadata: {
|
|
2359
|
+
encrypted: true,
|
|
2360
|
+
encryptionVersion: 1,
|
|
2361
|
+
...needsRotation && { keyRotationRequested: true }
|
|
2362
|
+
}
|
|
2363
|
+
};
|
|
2364
|
+
}
|
|
2365
|
+
/**
|
|
2366
|
+
* High-level decrypt-on-receive pipeline.
|
|
2367
|
+
* Decrypts content and validates metadata.
|
|
2368
|
+
*/
|
|
2369
|
+
async decryptOnReceive(conversationId, encryptedContent, metadata) {
|
|
2370
|
+
if (!this.hasSessionKey(conversationId)) {
|
|
2371
|
+
throw new Error("No session key for this conversation. Call deriveSessionKey() first.");
|
|
2372
|
+
}
|
|
2373
|
+
return this.decrypt(conversationId, encryptedContent);
|
|
2374
|
+
}
|
|
2375
|
+
/**
|
|
2376
|
+
* High-level file encryption pipeline.
|
|
2377
|
+
*/
|
|
2378
|
+
async encryptFile(conversationId, fileData) {
|
|
2379
|
+
const base64Data = arrayBufferToBase64(fileData);
|
|
2380
|
+
const encryptedData = await this.encrypt(conversationId, base64Data);
|
|
2381
|
+
return {
|
|
2382
|
+
encryptedData,
|
|
2383
|
+
metadata: {
|
|
2384
|
+
encrypted: true,
|
|
2385
|
+
encryptionVersion: 1,
|
|
2386
|
+
fileEncrypted: true
|
|
2387
|
+
}
|
|
2388
|
+
};
|
|
2389
|
+
}
|
|
2390
|
+
/**
|
|
2391
|
+
* High-level file decryption pipeline.
|
|
2392
|
+
*/
|
|
2393
|
+
async decryptFile(conversationId, encryptedData) {
|
|
2394
|
+
const base64Data = await this.decrypt(conversationId, encryptedData);
|
|
2395
|
+
return base64ToArrayBuffer(base64Data);
|
|
2396
|
+
}
|
|
2397
|
+
/**
|
|
2398
|
+
* Check if key rotation is needed (1000 messages or 24 hours).
|
|
2399
|
+
*/
|
|
2400
|
+
shouldRotateKey() {
|
|
2401
|
+
if (this.messageCount >= _E2EEncryption.KEY_ROTATION_THRESHOLD) {
|
|
2402
|
+
return true;
|
|
2403
|
+
}
|
|
2404
|
+
if (Date.now() - this.lastRotation >= _E2EEncryption.KEY_ROTATION_INTERVAL_MS) {
|
|
2405
|
+
return true;
|
|
2406
|
+
}
|
|
2407
|
+
return false;
|
|
2408
|
+
}
|
|
2409
|
+
/**
|
|
2410
|
+
* Perform key rotation: generate new ECDH keypair and reset counters.
|
|
2411
|
+
* The caller is responsible for re-exchanging keys with peers.
|
|
2412
|
+
*/
|
|
2413
|
+
async rotateKeys() {
|
|
2414
|
+
this.keyPair = await subtle().generateKey(
|
|
2415
|
+
{ name: "ECDH", namedCurve: "P-256" },
|
|
2416
|
+
false,
|
|
2417
|
+
["deriveKey"]
|
|
2418
|
+
);
|
|
2419
|
+
this.messageCount = 0;
|
|
2420
|
+
this.lastRotation = Date.now();
|
|
2421
|
+
this.sessionKeys.clear();
|
|
2422
|
+
return this.exportPublicKey();
|
|
2317
2423
|
}
|
|
2318
2424
|
};
|
|
2425
|
+
_E2EEncryption.KEY_ROTATION_THRESHOLD = 1e3;
|
|
2426
|
+
_E2EEncryption.KEY_ROTATION_INTERVAL_MS = 24 * 60 * 60 * 1e3;
|
|
2427
|
+
var E2EEncryption = _E2EEncryption;
|
|
2319
2428
|
function arrayBufferToBase64(buffer) {
|
|
2320
2429
|
if (typeof btoa !== "undefined") {
|
|
2321
2430
|
const bytes = new Uint8Array(buffer);
|
|
@@ -3364,11 +3473,11 @@ var EvolutionClient = class {
|
|
|
3364
3473
|
}
|
|
3365
3474
|
/** Delete a gene */
|
|
3366
3475
|
async deleteGene(geneId) {
|
|
3367
|
-
return this._r("DELETE", `/api/im/evolution/genes/${geneId}`);
|
|
3476
|
+
return this._r("DELETE", `/api/im/evolution/genes/${encodeURIComponent(geneId)}`);
|
|
3368
3477
|
}
|
|
3369
3478
|
/** Publish a gene. Pass skipCanary=true to bypass canary validation (MVP/admin). */
|
|
3370
3479
|
async publishGene(geneId, options) {
|
|
3371
|
-
return this._r("POST", `/api/im/evolution/genes/${geneId}/publish`, options?.skipCanary ? { skipCanary: true } : void 0);
|
|
3480
|
+
return this._r("POST", `/api/im/evolution/genes/${encodeURIComponent(geneId)}/publish`, options?.skipCanary ? { skipCanary: true } : void 0);
|
|
3372
3481
|
}
|
|
3373
3482
|
/** Import a published gene */
|
|
3374
3483
|
async importGene(geneId) {
|
|
@@ -3454,6 +3563,14 @@ var EvolutionClient = class {
|
|
|
3454
3563
|
async getSkillContent(slugOrId) {
|
|
3455
3564
|
return this._r("GET", `/api/im/skills/${encodeURIComponent(slugOrId)}/content`);
|
|
3456
3565
|
}
|
|
3566
|
+
/** Create/submit a community skill */
|
|
3567
|
+
async createSkill(input) {
|
|
3568
|
+
return this._r("POST", "/api/im/skills", input);
|
|
3569
|
+
}
|
|
3570
|
+
/** Star a skill (increment community rating) */
|
|
3571
|
+
async starSkill(skillId) {
|
|
3572
|
+
return this._r("POST", `/api/im/skills/${encodeURIComponent(skillId)}/star`);
|
|
3573
|
+
}
|
|
3457
3574
|
/**
|
|
3458
3575
|
* Install a skill and write SKILL.md to local filesystem.
|
|
3459
3576
|
* Combines cloud install + local file sync for Claude Code / OpenClaw / OpenCode.
|
|
@@ -3516,8 +3633,8 @@ var EvolutionClient = class {
|
|
|
3516
3633
|
async uninstallSkillLocal(slugOrId) {
|
|
3517
3634
|
const result = await this.uninstallSkill(slugOrId);
|
|
3518
3635
|
const removedPaths = [];
|
|
3519
|
-
const
|
|
3520
|
-
if (!
|
|
3636
|
+
const slug = safeSlug(slugOrId);
|
|
3637
|
+
if (!slug) return { ...result, data: { uninstalled: result.data?.uninstalled ?? false, removedPaths } };
|
|
3521
3638
|
try {
|
|
3522
3639
|
const fs = await import("fs");
|
|
3523
3640
|
const path = await import("path");
|
|
@@ -3525,10 +3642,10 @@ var EvolutionClient = class {
|
|
|
3525
3642
|
const home = os.homedir();
|
|
3526
3643
|
const pluginBase = process.env.PRISMER_PLUGIN_DIR || path.join(home, ".claude", "plugins", "prismer");
|
|
3527
3644
|
const dirs = [
|
|
3528
|
-
path.join(home, ".claude", "skills",
|
|
3529
|
-
path.join(home, ".openclaw", "skills",
|
|
3530
|
-
path.join(home, ".config", "opencode", "skills",
|
|
3531
|
-
path.join(pluginBase, "skills",
|
|
3645
|
+
path.join(home, ".claude", "skills", slug),
|
|
3646
|
+
path.join(home, ".openclaw", "skills", slug),
|
|
3647
|
+
path.join(home, ".config", "opencode", "skills", slug),
|
|
3648
|
+
path.join(pluginBase, "skills", slug)
|
|
3532
3649
|
];
|
|
3533
3650
|
for (const dir of dirs) {
|
|
3534
3651
|
try {
|
|
@@ -3638,6 +3755,9 @@ var EvolutionClient = class {
|
|
|
3638
3755
|
return this._r("POST", "/api/im/evolution/sync", body);
|
|
3639
3756
|
}
|
|
3640
3757
|
};
|
|
3758
|
+
function safeSlug(input) {
|
|
3759
|
+
return input.replace(/[\/\\]/g, "").replace(/\.\./g, "").replace(/\0/g, "");
|
|
3760
|
+
}
|
|
3641
3761
|
function guessMimeType(fileName) {
|
|
3642
3762
|
const ext = fileName.split(".").pop()?.toLowerCase() || "";
|
|
3643
3763
|
const map = {
|
|
@@ -4055,6 +4175,7 @@ function createClient(config) {
|
|
|
4055
4175
|
}
|
|
4056
4176
|
// Annotate the CommonJS export names for ESM import in node:
|
|
4057
4177
|
0 && (module.exports = {
|
|
4178
|
+
AIPIdentity,
|
|
4058
4179
|
AccountClient,
|
|
4059
4180
|
AttachmentQueue,
|
|
4060
4181
|
BindingsClient,
|
|
@@ -4094,5 +4215,7 @@ function createClient(config) {
|
|
|
4094
4215
|
encryptContext,
|
|
4095
4216
|
encryptFile,
|
|
4096
4217
|
encryptForSend,
|
|
4097
|
-
extractSignals
|
|
4218
|
+
extractSignals,
|
|
4219
|
+
guessMimeType,
|
|
4220
|
+
safeSlug
|
|
4098
4221
|
});
|