@prismer/sdk 1.3.1 → 1.3.3
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 +29 -4
- package/dist/cli.js +6 -6
- package/dist/index.d.mts +23 -5
- package/dist/index.d.ts +23 -5
- package/dist/index.js +6 -6
- package/dist/index.mjs +6 -6
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -39,6 +39,8 @@ Prismer Cloud provides AI agents with fast, cached access to web content, docume
|
|
|
39
39
|
|
|
40
40
|
## Installation
|
|
41
41
|
|
|
42
|
+
### As a library
|
|
43
|
+
|
|
42
44
|
```bash
|
|
43
45
|
npm install @prismer/sdk
|
|
44
46
|
# or
|
|
@@ -47,6 +49,21 @@ pnpm add @prismer/sdk
|
|
|
47
49
|
yarn add @prismer/sdk
|
|
48
50
|
```
|
|
49
51
|
|
|
52
|
+
### As a CLI tool
|
|
53
|
+
|
|
54
|
+
Install globally to use the `prismer` command:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
npm install -g @prismer/sdk
|
|
58
|
+
prismer --help
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Or run without global install:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
npx @prismer/sdk --help
|
|
65
|
+
```
|
|
66
|
+
|
|
50
67
|
Requires Node.js >= 18.
|
|
51
68
|
|
|
52
69
|
---
|
|
@@ -721,11 +738,19 @@ const transactions = await client.im.credits.transactions({ limit: 20 });
|
|
|
721
738
|
|
|
722
739
|
```typescript
|
|
723
740
|
// Initialize a 1:1 workspace (1 user + 1 agent)
|
|
724
|
-
const ws = await client.im.workspace.init(
|
|
725
|
-
|
|
741
|
+
const ws = await client.im.workspace.init({
|
|
742
|
+
workspaceId: 'my-workspace',
|
|
743
|
+
userId: 'user-123',
|
|
744
|
+
userDisplayName: 'Alice',
|
|
745
|
+
});
|
|
746
|
+
// ws.data: { conversationId, user: { imUserId, token } }
|
|
726
747
|
|
|
727
748
|
// Initialize a group workspace (multi-user + multi-agent)
|
|
728
|
-
const groupWs = await client.im.workspace.initGroup(
|
|
749
|
+
const groupWs = await client.im.workspace.initGroup({
|
|
750
|
+
workspaceId: 'my-group-workspace',
|
|
751
|
+
title: 'Team Workspace',
|
|
752
|
+
users: [{ userId: 'user-123', displayName: 'Alice' }],
|
|
753
|
+
});
|
|
729
754
|
|
|
730
755
|
// Add an agent to a workspace
|
|
731
756
|
await client.im.workspace.addAgent('ws-123', 'agent-456');
|
|
@@ -734,7 +759,7 @@ await client.im.workspace.addAgent('ws-123', 'agent-456');
|
|
|
734
759
|
const agents = await client.im.workspace.listAgents('ws-123');
|
|
735
760
|
|
|
736
761
|
// @mention autocomplete
|
|
737
|
-
const suggestions = await client.im.workspace.mentionAutocomplete('al');
|
|
762
|
+
const suggestions = await client.im.workspace.mentionAutocomplete('conv-123', 'al');
|
|
738
763
|
// suggestions.data: [{ userId, username, displayName, role }, ...]
|
|
739
764
|
```
|
|
740
765
|
|
package/dist/cli.js
CHANGED
|
@@ -653,12 +653,12 @@ var WorkspaceClient = class {
|
|
|
653
653
|
this._r = _r;
|
|
654
654
|
}
|
|
655
655
|
/** Initialize a 1:1 workspace (1 user + 1 agent) */
|
|
656
|
-
async init() {
|
|
657
|
-
return this._r("POST", "/api/im/workspace/init");
|
|
656
|
+
async init(options) {
|
|
657
|
+
return this._r("POST", "/api/im/workspace/init", options);
|
|
658
658
|
}
|
|
659
659
|
/** Initialize a group workspace (multi-user + multi-agent) */
|
|
660
|
-
async initGroup() {
|
|
661
|
-
return this._r("POST", "/api/im/workspace/init-group");
|
|
660
|
+
async initGroup(options) {
|
|
661
|
+
return this._r("POST", "/api/im/workspace/init-group", options);
|
|
662
662
|
}
|
|
663
663
|
/** Add an agent to a workspace */
|
|
664
664
|
async addAgent(workspaceId, agentId) {
|
|
@@ -669,8 +669,8 @@ var WorkspaceClient = class {
|
|
|
669
669
|
return this._r("GET", `/api/im/workspace/${workspaceId}/agents`);
|
|
670
670
|
}
|
|
671
671
|
/** @mention autocomplete */
|
|
672
|
-
async mentionAutocomplete(query) {
|
|
673
|
-
const q = {};
|
|
672
|
+
async mentionAutocomplete(conversationId, query) {
|
|
673
|
+
const q = { conversationId };
|
|
674
674
|
if (query) q.q = query;
|
|
675
675
|
return this._r("GET", "/api/im/workspace/mentions/autocomplete", void 0, q);
|
|
676
676
|
}
|
package/dist/index.d.mts
CHANGED
|
@@ -499,8 +499,26 @@ interface IMConversation {
|
|
|
499
499
|
updatedAt?: string;
|
|
500
500
|
}
|
|
501
501
|
interface IMWorkspaceData {
|
|
502
|
-
workspaceId
|
|
502
|
+
workspaceId?: string;
|
|
503
503
|
conversationId: string;
|
|
504
|
+
user?: {
|
|
505
|
+
imUserId: string;
|
|
506
|
+
token: string;
|
|
507
|
+
};
|
|
508
|
+
agent?: any;
|
|
509
|
+
}
|
|
510
|
+
interface IMWorkspaceInitOptions {
|
|
511
|
+
workspaceId: string;
|
|
512
|
+
userId: string;
|
|
513
|
+
userDisplayName: string;
|
|
514
|
+
}
|
|
515
|
+
interface IMWorkspaceInitGroupOptions {
|
|
516
|
+
workspaceId: string;
|
|
517
|
+
title: string;
|
|
518
|
+
users: Array<{
|
|
519
|
+
userId: string;
|
|
520
|
+
displayName: string;
|
|
521
|
+
}>;
|
|
504
522
|
}
|
|
505
523
|
interface IMAutocompleteResult {
|
|
506
524
|
userId: string;
|
|
@@ -677,15 +695,15 @@ declare class WorkspaceClient {
|
|
|
677
695
|
private _r;
|
|
678
696
|
constructor(_r: RequestFn);
|
|
679
697
|
/** Initialize a 1:1 workspace (1 user + 1 agent) */
|
|
680
|
-
init(): Promise<IMResult<IMWorkspaceData>>;
|
|
698
|
+
init(options: IMWorkspaceInitOptions): Promise<IMResult<IMWorkspaceData>>;
|
|
681
699
|
/** Initialize a group workspace (multi-user + multi-agent) */
|
|
682
|
-
initGroup(): Promise<IMResult<IMWorkspaceData>>;
|
|
700
|
+
initGroup(options: IMWorkspaceInitGroupOptions): Promise<IMResult<IMWorkspaceData>>;
|
|
683
701
|
/** Add an agent to a workspace */
|
|
684
702
|
addAgent(workspaceId: string, agentId: string): Promise<IMResult<void>>;
|
|
685
703
|
/** List agents in a workspace */
|
|
686
704
|
listAgents(workspaceId: string): Promise<IMResult<any[]>>;
|
|
687
705
|
/** @mention autocomplete */
|
|
688
|
-
mentionAutocomplete(query?: string): Promise<IMResult<IMAutocompleteResult[]>>;
|
|
706
|
+
mentionAutocomplete(conversationId: string, query?: string): Promise<IMResult<IMAutocompleteResult[]>>;
|
|
689
707
|
}
|
|
690
708
|
/** Real-time connection factory (WebSocket & SSE) */
|
|
691
709
|
declare class IMRealtimeClient {
|
|
@@ -755,4 +773,4 @@ declare class PrismerClient {
|
|
|
755
773
|
|
|
756
774
|
declare function createClient(config: PrismerConfig): PrismerClient;
|
|
757
775
|
|
|
758
|
-
export { AccountClient, type AuthenticatedPayload, type BatchSummary, type BatchUrlCost, BindingsClient, ContactsClient, ConversationsClient, CreditsClient, DirectClient, type DisconnectedPayload, ENVIRONMENTS, type Environment, type ErrorPayload, GroupsClient, type IMAgentCard, type IMAutocompleteResult, type IMBinding, type IMBindingData, IMClient, type IMContact, type IMConversation, type IMConversationsOptions, type IMCreateBindingOptions, type IMCreateGroupOptions, type IMCreditsData, type IMDiscoverAgent, type IMDiscoverOptions, type IMGroupData, type IMGroupMember, type IMMeData, type IMMessage, type IMMessageData, type IMPaginationOptions, IMRealtimeClient, type IMRegisterData, type IMRegisterOptions, type IMResult, type IMRouting, type IMSendOptions, type IMTokenData, type IMTransaction, type IMUser, type IMWorkspaceData, type LoadOptions, type LoadResult, type LoadResultItem, type MessageNewPayload, MessagesClient, 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 RankingFactors, type RealtimeCommand, type RealtimeConfig, type RealtimeEventMap, type RealtimeEventType, RealtimeSSEClient, type RealtimeState, RealtimeWSClient, type ReconnectingPayload, type RequestFn, type SaveBatchOptions, type SaveOptions, type SaveResult, type SingleUrlCost, type TypingIndicatorPayload, WorkspaceClient, createClient, PrismerClient as default };
|
|
776
|
+
export { AccountClient, type AuthenticatedPayload, type BatchSummary, type BatchUrlCost, BindingsClient, ContactsClient, ConversationsClient, CreditsClient, DirectClient, type DisconnectedPayload, ENVIRONMENTS, type Environment, type ErrorPayload, GroupsClient, type IMAgentCard, type IMAutocompleteResult, type IMBinding, type IMBindingData, IMClient, type IMContact, type IMConversation, type IMConversationsOptions, type IMCreateBindingOptions, type IMCreateGroupOptions, type IMCreditsData, type IMDiscoverAgent, type IMDiscoverOptions, type IMGroupData, type IMGroupMember, type IMMeData, type IMMessage, type IMMessageData, type IMPaginationOptions, IMRealtimeClient, type IMRegisterData, type IMRegisterOptions, type IMResult, type IMRouting, type IMSendOptions, type IMTokenData, type IMTransaction, type IMUser, type IMWorkspaceData, type IMWorkspaceInitGroupOptions, type IMWorkspaceInitOptions, type LoadOptions, type LoadResult, type LoadResultItem, type MessageNewPayload, MessagesClient, 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 RankingFactors, type RealtimeCommand, type RealtimeConfig, type RealtimeEventMap, type RealtimeEventType, RealtimeSSEClient, type RealtimeState, RealtimeWSClient, type ReconnectingPayload, type RequestFn, type SaveBatchOptions, type SaveOptions, type SaveResult, type SingleUrlCost, type TypingIndicatorPayload, WorkspaceClient, createClient, PrismerClient as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -499,8 +499,26 @@ interface IMConversation {
|
|
|
499
499
|
updatedAt?: string;
|
|
500
500
|
}
|
|
501
501
|
interface IMWorkspaceData {
|
|
502
|
-
workspaceId
|
|
502
|
+
workspaceId?: string;
|
|
503
503
|
conversationId: string;
|
|
504
|
+
user?: {
|
|
505
|
+
imUserId: string;
|
|
506
|
+
token: string;
|
|
507
|
+
};
|
|
508
|
+
agent?: any;
|
|
509
|
+
}
|
|
510
|
+
interface IMWorkspaceInitOptions {
|
|
511
|
+
workspaceId: string;
|
|
512
|
+
userId: string;
|
|
513
|
+
userDisplayName: string;
|
|
514
|
+
}
|
|
515
|
+
interface IMWorkspaceInitGroupOptions {
|
|
516
|
+
workspaceId: string;
|
|
517
|
+
title: string;
|
|
518
|
+
users: Array<{
|
|
519
|
+
userId: string;
|
|
520
|
+
displayName: string;
|
|
521
|
+
}>;
|
|
504
522
|
}
|
|
505
523
|
interface IMAutocompleteResult {
|
|
506
524
|
userId: string;
|
|
@@ -677,15 +695,15 @@ declare class WorkspaceClient {
|
|
|
677
695
|
private _r;
|
|
678
696
|
constructor(_r: RequestFn);
|
|
679
697
|
/** Initialize a 1:1 workspace (1 user + 1 agent) */
|
|
680
|
-
init(): Promise<IMResult<IMWorkspaceData>>;
|
|
698
|
+
init(options: IMWorkspaceInitOptions): Promise<IMResult<IMWorkspaceData>>;
|
|
681
699
|
/** Initialize a group workspace (multi-user + multi-agent) */
|
|
682
|
-
initGroup(): Promise<IMResult<IMWorkspaceData>>;
|
|
700
|
+
initGroup(options: IMWorkspaceInitGroupOptions): Promise<IMResult<IMWorkspaceData>>;
|
|
683
701
|
/** Add an agent to a workspace */
|
|
684
702
|
addAgent(workspaceId: string, agentId: string): Promise<IMResult<void>>;
|
|
685
703
|
/** List agents in a workspace */
|
|
686
704
|
listAgents(workspaceId: string): Promise<IMResult<any[]>>;
|
|
687
705
|
/** @mention autocomplete */
|
|
688
|
-
mentionAutocomplete(query?: string): Promise<IMResult<IMAutocompleteResult[]>>;
|
|
706
|
+
mentionAutocomplete(conversationId: string, query?: string): Promise<IMResult<IMAutocompleteResult[]>>;
|
|
689
707
|
}
|
|
690
708
|
/** Real-time connection factory (WebSocket & SSE) */
|
|
691
709
|
declare class IMRealtimeClient {
|
|
@@ -755,4 +773,4 @@ declare class PrismerClient {
|
|
|
755
773
|
|
|
756
774
|
declare function createClient(config: PrismerConfig): PrismerClient;
|
|
757
775
|
|
|
758
|
-
export { AccountClient, type AuthenticatedPayload, type BatchSummary, type BatchUrlCost, BindingsClient, ContactsClient, ConversationsClient, CreditsClient, DirectClient, type DisconnectedPayload, ENVIRONMENTS, type Environment, type ErrorPayload, GroupsClient, type IMAgentCard, type IMAutocompleteResult, type IMBinding, type IMBindingData, IMClient, type IMContact, type IMConversation, type IMConversationsOptions, type IMCreateBindingOptions, type IMCreateGroupOptions, type IMCreditsData, type IMDiscoverAgent, type IMDiscoverOptions, type IMGroupData, type IMGroupMember, type IMMeData, type IMMessage, type IMMessageData, type IMPaginationOptions, IMRealtimeClient, type IMRegisterData, type IMRegisterOptions, type IMResult, type IMRouting, type IMSendOptions, type IMTokenData, type IMTransaction, type IMUser, type IMWorkspaceData, type LoadOptions, type LoadResult, type LoadResultItem, type MessageNewPayload, MessagesClient, 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 RankingFactors, type RealtimeCommand, type RealtimeConfig, type RealtimeEventMap, type RealtimeEventType, RealtimeSSEClient, type RealtimeState, RealtimeWSClient, type ReconnectingPayload, type RequestFn, type SaveBatchOptions, type SaveOptions, type SaveResult, type SingleUrlCost, type TypingIndicatorPayload, WorkspaceClient, createClient, PrismerClient as default };
|
|
776
|
+
export { AccountClient, type AuthenticatedPayload, type BatchSummary, type BatchUrlCost, BindingsClient, ContactsClient, ConversationsClient, CreditsClient, DirectClient, type DisconnectedPayload, ENVIRONMENTS, type Environment, type ErrorPayload, GroupsClient, type IMAgentCard, type IMAutocompleteResult, type IMBinding, type IMBindingData, IMClient, type IMContact, type IMConversation, type IMConversationsOptions, type IMCreateBindingOptions, type IMCreateGroupOptions, type IMCreditsData, type IMDiscoverAgent, type IMDiscoverOptions, type IMGroupData, type IMGroupMember, type IMMeData, type IMMessage, type IMMessageData, type IMPaginationOptions, IMRealtimeClient, type IMRegisterData, type IMRegisterOptions, type IMResult, type IMRouting, type IMSendOptions, type IMTokenData, type IMTransaction, type IMUser, type IMWorkspaceData, type IMWorkspaceInitGroupOptions, type IMWorkspaceInitOptions, type LoadOptions, type LoadResult, type LoadResultItem, type MessageNewPayload, MessagesClient, 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 RankingFactors, type RealtimeCommand, type RealtimeConfig, type RealtimeEventMap, type RealtimeEventType, RealtimeSSEClient, type RealtimeState, RealtimeWSClient, type ReconnectingPayload, type RequestFn, type SaveBatchOptions, type SaveOptions, type SaveResult, type SingleUrlCost, type TypingIndicatorPayload, WorkspaceClient, createClient, PrismerClient as default };
|
package/dist/index.js
CHANGED
|
@@ -663,12 +663,12 @@ var WorkspaceClient = class {
|
|
|
663
663
|
this._r = _r;
|
|
664
664
|
}
|
|
665
665
|
/** Initialize a 1:1 workspace (1 user + 1 agent) */
|
|
666
|
-
async init() {
|
|
667
|
-
return this._r("POST", "/api/im/workspace/init");
|
|
666
|
+
async init(options) {
|
|
667
|
+
return this._r("POST", "/api/im/workspace/init", options);
|
|
668
668
|
}
|
|
669
669
|
/** Initialize a group workspace (multi-user + multi-agent) */
|
|
670
|
-
async initGroup() {
|
|
671
|
-
return this._r("POST", "/api/im/workspace/init-group");
|
|
670
|
+
async initGroup(options) {
|
|
671
|
+
return this._r("POST", "/api/im/workspace/init-group", options);
|
|
672
672
|
}
|
|
673
673
|
/** Add an agent to a workspace */
|
|
674
674
|
async addAgent(workspaceId, agentId) {
|
|
@@ -679,8 +679,8 @@ var WorkspaceClient = class {
|
|
|
679
679
|
return this._r("GET", `/api/im/workspace/${workspaceId}/agents`);
|
|
680
680
|
}
|
|
681
681
|
/** @mention autocomplete */
|
|
682
|
-
async mentionAutocomplete(query) {
|
|
683
|
-
const q = {};
|
|
682
|
+
async mentionAutocomplete(conversationId, query) {
|
|
683
|
+
const q = { conversationId };
|
|
684
684
|
if (query) q.q = query;
|
|
685
685
|
return this._r("GET", "/api/im/workspace/mentions/autocomplete", void 0, q);
|
|
686
686
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -621,12 +621,12 @@ var WorkspaceClient = class {
|
|
|
621
621
|
this._r = _r;
|
|
622
622
|
}
|
|
623
623
|
/** Initialize a 1:1 workspace (1 user + 1 agent) */
|
|
624
|
-
async init() {
|
|
625
|
-
return this._r("POST", "/api/im/workspace/init");
|
|
624
|
+
async init(options) {
|
|
625
|
+
return this._r("POST", "/api/im/workspace/init", options);
|
|
626
626
|
}
|
|
627
627
|
/** Initialize a group workspace (multi-user + multi-agent) */
|
|
628
|
-
async initGroup() {
|
|
629
|
-
return this._r("POST", "/api/im/workspace/init-group");
|
|
628
|
+
async initGroup(options) {
|
|
629
|
+
return this._r("POST", "/api/im/workspace/init-group", options);
|
|
630
630
|
}
|
|
631
631
|
/** Add an agent to a workspace */
|
|
632
632
|
async addAgent(workspaceId, agentId) {
|
|
@@ -637,8 +637,8 @@ var WorkspaceClient = class {
|
|
|
637
637
|
return this._r("GET", `/api/im/workspace/${workspaceId}/agents`);
|
|
638
638
|
}
|
|
639
639
|
/** @mention autocomplete */
|
|
640
|
-
async mentionAutocomplete(query) {
|
|
641
|
-
const q = {};
|
|
640
|
+
async mentionAutocomplete(conversationId, query) {
|
|
641
|
+
const q = { conversationId };
|
|
642
642
|
if (query) q.q = query;
|
|
643
643
|
return this._r("GET", "/api/im/workspace/mentions/autocomplete", void 0, q);
|
|
644
644
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prismer/sdk",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.3",
|
|
4
4
|
"description": "Official TypeScript SDK for Prismer Cloud API",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -29,7 +29,8 @@
|
|
|
29
29
|
"license": "MIT",
|
|
30
30
|
"repository": {
|
|
31
31
|
"type": "git",
|
|
32
|
-
"url": "https://github.com/
|
|
32
|
+
"url": "https://github.com/Prismer-AI/Prismer",
|
|
33
|
+
"directory": "sdk/typescript"
|
|
33
34
|
},
|
|
34
35
|
"dependencies": {
|
|
35
36
|
"@iarna/toml": "^2.2.5",
|