@prismer/sdk 1.3.0 → 1.3.2

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 CHANGED
@@ -721,11 +721,19 @@ const transactions = await client.im.credits.transactions({ limit: 20 });
721
721
 
722
722
  ```typescript
723
723
  // Initialize a 1:1 workspace (1 user + 1 agent)
724
- const ws = await client.im.workspace.init();
725
- // ws.data: { workspaceId, conversationId }
724
+ const ws = await client.im.workspace.init({
725
+ workspaceId: 'my-workspace',
726
+ userId: 'user-123',
727
+ userDisplayName: 'Alice',
728
+ });
729
+ // ws.data: { conversationId, user: { imUserId, token } }
726
730
 
727
731
  // Initialize a group workspace (multi-user + multi-agent)
728
- const groupWs = await client.im.workspace.initGroup();
732
+ const groupWs = await client.im.workspace.initGroup({
733
+ workspaceId: 'my-group-workspace',
734
+ title: 'Team Workspace',
735
+ users: [{ userId: 'user-123', displayName: 'Alice' }],
736
+ });
729
737
 
730
738
  // Add an agent to a workspace
731
739
  await client.im.workspace.addAgent('ws-123', 'agent-456');
@@ -734,7 +742,7 @@ await client.im.workspace.addAgent('ws-123', 'agent-456');
734
742
  const agents = await client.im.workspace.listAgents('ws-123');
735
743
 
736
744
  // @mention autocomplete
737
- const suggestions = await client.im.workspace.mentionAutocomplete('al');
745
+ const suggestions = await client.im.workspace.mentionAutocomplete('conv-123', 'al');
738
746
  // suggestions.data: [{ userId, username, displayName, role }, ...]
739
747
  ```
740
748
 
@@ -860,28 +868,70 @@ const health = await client.im.health();
860
868
 
861
869
  ## CLI
862
870
 
863
- The SDK includes a CLI for managing configuration and registering IM agents.
871
+ The SDK includes a CLI for managing configuration and registering IM agents. Configuration is stored in `~/.prismer/config.toml`.
872
+
873
+ ### `prismer init <api-key>`
874
+
875
+ Store your API key locally.
864
876
 
865
877
  ```bash
866
- # Store your API key
867
- npx prismer init <api-key>
878
+ npx prismer init sk-prismer-abc123
879
+ ```
880
+
881
+ ### `prismer register <username>`
868
882
 
869
- # Register an IM agent (stores JWT token automatically)
870
- npx prismer register <username>
883
+ Register an IM agent and store the JWT token locally.
884
+
885
+ ```bash
886
+ npx prismer register my-bot
871
887
  npx prismer register my-bot --display-name "My Bot" --agent-type assistant --capabilities "chat,search"
888
+ ```
889
+
890
+ Flags:
891
+
892
+ | Flag | Default | Description |
893
+ |------|---------|-------------|
894
+ | `--type <type>` | `agent` | Identity type: `agent` or `human` |
895
+ | `--display-name <name>` | username | Display name for the agent |
896
+ | `--agent-type <type>` | | `assistant`, `specialist`, `orchestrator`, `tool`, or `bot` |
897
+ | `--capabilities <caps>` | | Comma-separated list of capabilities |
898
+
899
+ ### `prismer status`
872
900
 
873
- # Show current config and token status
901
+ Show current configuration, token validity, and live account info (credits, messages, unread).
902
+
903
+ ```bash
874
904
  npx prismer status
905
+ ```
875
906
 
876
- # View config file
907
+ ### `prismer config show`
908
+
909
+ Print the contents of `~/.prismer/config.toml`.
910
+
911
+ ```bash
877
912
  npx prismer config show
913
+ ```
878
914
 
879
- # Set a config value
880
- npx prismer config set default.base_url https://custom.api.com
915
+ ### `prismer config set <key> <value>`
916
+
917
+ Set a configuration value using dot notation.
918
+
919
+ ```bash
881
920
  npx prismer config set default.api_key sk-prismer-new-key
921
+ npx prismer config set default.base_url https://custom.api.com
882
922
  ```
883
923
 
884
- Configuration is stored in `~/.prismer/config.toml`.
924
+ Valid keys:
925
+
926
+ | Key | Description |
927
+ |-----|-------------|
928
+ | `default.api_key` | API key |
929
+ | `default.environment` | Environment name |
930
+ | `default.base_url` | Custom base URL |
931
+ | `auth.im_token` | IM JWT token |
932
+ | `auth.im_user_id` | IM user ID |
933
+ | `auth.im_username` | IM username |
934
+ | `auth.im_token_expires` | Token expiration |
885
935
 
886
936
  ---
887
937
 
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
  }
@@ -959,22 +959,26 @@ program.command("status").description("Show current config and token status").ac
959
959
  const expires = config.auth?.im_token_expires;
960
960
  if (expires) {
961
961
  const expiresDate = new Date(expires);
962
- const now = /* @__PURE__ */ new Date();
963
- const isExpired = expiresDate <= now;
964
- const label = isExpired ? "EXPIRED" : "valid";
965
- console.log(`IM Token: ${label} (expires ${expiresDate.toISOString()})`);
962
+ if (!isNaN(expiresDate.getTime())) {
963
+ const now = /* @__PURE__ */ new Date();
964
+ const isExpired = expiresDate <= now;
965
+ const label = isExpired ? "EXPIRED" : "valid";
966
+ console.log(`IM Token: ${label} (expires ${expiresDate.toISOString()})`);
967
+ } else {
968
+ console.log(`IM Token: set (expires in ${expires})`);
969
+ }
966
970
  } else {
967
971
  console.log("IM Token: set (expiry unknown)");
968
972
  }
969
973
  } else {
970
974
  console.log("IM Token: (not registered)");
971
975
  }
972
- if (apiKey && token) {
976
+ if (token) {
973
977
  console.log("");
974
978
  console.log("--- Live Info ---");
975
979
  try {
976
980
  const client = new PrismerClient({
977
- apiKey,
981
+ apiKey: token,
978
982
  environment: config.default?.environment || "production",
979
983
  baseUrl: config.default?.base_url || void 0
980
984
  });
package/dist/index.d.mts CHANGED
@@ -499,8 +499,26 @@ interface IMConversation {
499
499
  updatedAt?: string;
500
500
  }
501
501
  interface IMWorkspaceData {
502
- workspaceId: string;
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: string;
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.0",
3
+ "version": "1.3.2",
4
4
  "description": "Official TypeScript SDK for Prismer Cloud API",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",