@flowcore/sdk 1.24.3 → 1.25.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.
Files changed (79) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/README.md +208 -0
  3. package/esm/commands/ai-agent-coordinator/context-add-item.command.d.ts +28 -0
  4. package/esm/commands/ai-agent-coordinator/context-add-item.command.d.ts.map +1 -0
  5. package/esm/commands/ai-agent-coordinator/context-add-item.command.js +34 -0
  6. package/esm/commands/ai-agent-coordinator/context-remove-item.command.d.ts +28 -0
  7. package/esm/commands/ai-agent-coordinator/context-remove-item.command.d.ts.map +1 -0
  8. package/esm/commands/ai-agent-coordinator/context-remove-item.command.js +32 -0
  9. package/esm/commands/ai-agent-coordinator/conversation-delete.command.d.ts +25 -0
  10. package/esm/commands/ai-agent-coordinator/conversation-delete.command.d.ts.map +1 -0
  11. package/esm/commands/ai-agent-coordinator/conversation-delete.command.js +30 -0
  12. package/esm/commands/ai-agent-coordinator/conversation-get.command.d.ts +27 -0
  13. package/esm/commands/ai-agent-coordinator/conversation-get.command.d.ts.map +1 -0
  14. package/esm/commands/ai-agent-coordinator/conversation-get.command.js +36 -0
  15. package/esm/commands/ai-agent-coordinator/conversation-list.command.d.ts +23 -0
  16. package/esm/commands/ai-agent-coordinator/conversation-list.command.d.ts.map +1 -0
  17. package/esm/commands/ai-agent-coordinator/conversation-list.command.js +29 -0
  18. package/esm/commands/ai-agent-coordinator/conversation-stream.command.d.ts +30 -0
  19. package/esm/commands/ai-agent-coordinator/conversation-stream.command.d.ts.map +1 -0
  20. package/esm/commands/ai-agent-coordinator/conversation-stream.command.js +36 -0
  21. package/esm/commands/ai-agent-coordinator/mod.d.ts +7 -0
  22. package/esm/commands/ai-agent-coordinator/mod.d.ts.map +1 -0
  23. package/esm/commands/ai-agent-coordinator/mod.js +6 -0
  24. package/esm/common/command.d.ts.map +1 -1
  25. package/esm/common/command.js +3 -4
  26. package/esm/common/websocket-client.d.ts +109 -0
  27. package/esm/common/websocket-client.d.ts.map +1 -0
  28. package/esm/common/websocket-client.js +391 -0
  29. package/esm/common/websocket-command.d.ts +54 -0
  30. package/esm/common/websocket-command.d.ts.map +1 -0
  31. package/esm/common/websocket-command.js +1 -0
  32. package/esm/contracts/ai-agent-coordinator-stream.d.ts +85 -0
  33. package/esm/contracts/ai-agent-coordinator-stream.d.ts.map +1 -0
  34. package/esm/contracts/ai-agent-coordinator-stream.js +1 -0
  35. package/esm/contracts/ai-agent-coordinator.d.ts +41 -0
  36. package/esm/contracts/ai-agent-coordinator.d.ts.map +1 -0
  37. package/esm/contracts/ai-agent-coordinator.js +1 -0
  38. package/esm/mod.d.ts +8 -2
  39. package/esm/mod.d.ts.map +1 -1
  40. package/esm/mod.js +8 -2
  41. package/package.json +1 -1
  42. package/script/commands/ai-agent-coordinator/context-add-item.command.d.ts +28 -0
  43. package/script/commands/ai-agent-coordinator/context-add-item.command.d.ts.map +1 -0
  44. package/script/commands/ai-agent-coordinator/context-add-item.command.js +38 -0
  45. package/script/commands/ai-agent-coordinator/context-remove-item.command.d.ts +28 -0
  46. package/script/commands/ai-agent-coordinator/context-remove-item.command.d.ts.map +1 -0
  47. package/script/commands/ai-agent-coordinator/context-remove-item.command.js +36 -0
  48. package/script/commands/ai-agent-coordinator/conversation-delete.command.d.ts +25 -0
  49. package/script/commands/ai-agent-coordinator/conversation-delete.command.d.ts.map +1 -0
  50. package/script/commands/ai-agent-coordinator/conversation-delete.command.js +34 -0
  51. package/script/commands/ai-agent-coordinator/conversation-get.command.d.ts +27 -0
  52. package/script/commands/ai-agent-coordinator/conversation-get.command.d.ts.map +1 -0
  53. package/script/commands/ai-agent-coordinator/conversation-get.command.js +40 -0
  54. package/script/commands/ai-agent-coordinator/conversation-list.command.d.ts +23 -0
  55. package/script/commands/ai-agent-coordinator/conversation-list.command.d.ts.map +1 -0
  56. package/script/commands/ai-agent-coordinator/conversation-list.command.js +33 -0
  57. package/script/commands/ai-agent-coordinator/conversation-stream.command.d.ts +30 -0
  58. package/script/commands/ai-agent-coordinator/conversation-stream.command.d.ts.map +1 -0
  59. package/script/commands/ai-agent-coordinator/conversation-stream.command.js +40 -0
  60. package/script/commands/ai-agent-coordinator/mod.d.ts +7 -0
  61. package/script/commands/ai-agent-coordinator/mod.d.ts.map +1 -0
  62. package/script/commands/ai-agent-coordinator/mod.js +22 -0
  63. package/script/common/command.d.ts.map +1 -1
  64. package/script/common/command.js +27 -5
  65. package/script/common/websocket-client.d.ts +109 -0
  66. package/script/common/websocket-client.d.ts.map +1 -0
  67. package/script/common/websocket-client.js +418 -0
  68. package/script/common/websocket-command.d.ts +54 -0
  69. package/script/common/websocket-command.d.ts.map +1 -0
  70. package/script/common/websocket-command.js +2 -0
  71. package/script/contracts/ai-agent-coordinator-stream.d.ts +85 -0
  72. package/script/contracts/ai-agent-coordinator-stream.d.ts.map +1 -0
  73. package/script/contracts/ai-agent-coordinator-stream.js +2 -0
  74. package/script/contracts/ai-agent-coordinator.d.ts +41 -0
  75. package/script/contracts/ai-agent-coordinator.d.ts.map +1 -0
  76. package/script/contracts/ai-agent-coordinator.js +2 -0
  77. package/script/mod.d.ts +8 -2
  78. package/script/mod.d.ts.map +1 -1
  79. package/script/mod.js +11 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.25.0](https://github.com/flowcore-io/flowcore-sdk/compare/v1.24.4...v1.25.0) (2025-04-10)
4
+
5
+
6
+ ### Features
7
+
8
+ * **ai-agent-coordinator:** :sparkles: add AI Agent Coordinator operations and conversation management commands ([fea2033](https://github.com/flowcore-io/flowcore-sdk/commit/fea203321efcd1a99191f93c987087484afae535))
9
+ * **ai-agent-coordinator:** :sparkles: add commands for managing conversation context and metadata ([68b003c](https://github.com/flowcore-io/flowcore-sdk/commit/68b003c651467b742e81a3106a3206bfd9b45e8e))
10
+ * **ai-agent-coordinator:** :sparkles: implement WebSocket client and conversation stream command ([63d9595](https://github.com/flowcore-io/flowcore-sdk/commit/63d95956622f30f36f731418c71384f9b2e00c9d))
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * **ai-agent-coordinator:** :art: clean up command class implementations and formatting ([875106a](https://github.com/flowcore-io/flowcore-sdk/commit/875106a38543dedc7ed6bd2c3dedc3a9b09dbe3a))
16
+ * **ai-agent-coordinator:** :art: enhance WebSocket command structure and improve error handling ([b7f9bff](https://github.com/flowcore-io/flowcore-sdk/commit/b7f9bffba95dc28f077d2565940b3f21b0ea4e55))
17
+ * **websocket-client:** :bug: simplify WebSocket open state handling ([6fe00ae](https://github.com/flowcore-io/flowcore-sdk/commit/6fe00ae5d07becc7d4d96cbc1fa5c02a0e76f06a))
18
+
19
+ ## [1.24.4](https://github.com/flowcore-io/flowcore-sdk/compare/v1.24.3...v1.24.4) (2025-04-02)
20
+
21
+
22
+ ### Bug Fixes
23
+
24
+ * **command:** :bug: remove debug logs for dedicated base URL retrieval ([bd81ec2](https://github.com/flowcore-io/flowcore-sdk/commit/bd81ec21528b22c33fb5b5ee996ec661eefec2db))
25
+
3
26
  ## [1.24.3](https://github.com/flowcore-io/flowcore-sdk/compare/v1.24.2...v1.24.3) (2025-04-02)
4
27
 
5
28
 
package/README.md CHANGED
@@ -613,6 +613,214 @@ const result = await client.execute(command)
613
613
  > **Note**: If `waitForDelete` or `waitForTruncate` is set to `true`, the command will wait up to 25 seconds for the operation to complete.
614
614
  > **Important**: Event Type deletion and truncation operations require bearer token authentication.
615
615
 
616
+ ### AI Agent Coordinator Operations
617
+
618
+ These commands allow interaction with the AI Agent Coordinator service for managing conversational AI agents.
619
+
620
+ > **Important**: AI Agent Coordinator operations require bearer token authentication (OAuth2) and cannot be performed using API key authentication.
621
+
622
+ #### List Conversations
623
+
624
+ Retrieves metadata for all conversations accessible by the user.
625
+
626
+ ```typescript
627
+ import { ConversationListCommand, FlowcoreClient } from "@flowcore/sdk"
628
+
629
+ const command = new ConversationListCommand()
630
+
631
+ const conversations = await client.execute(command)
632
+ // Returns an array of conversation metadata:
633
+ // {
634
+ // id: string;
635
+ // title: string;
636
+ // lastUpdated: string; // ISO Date string
637
+ // }[]
638
+ ```
639
+
640
+ #### Get a Specific Conversation
641
+
642
+ Retrieves the full details, including messages and context, for a specific conversation.
643
+
644
+ ```typescript
645
+ import { ConversationGetCommand, FlowcoreClient } from "@flowcore/sdk"
646
+
647
+ const command = new ConversationGetCommand({ conversationId: "your-conversation-id" })
648
+
649
+ try {
650
+ const conversation = await client.execute(command)
651
+ // Returns the full Conversation object:
652
+ // {
653
+ // id: string;
654
+ // title: string;
655
+ // lastUpdated: string;
656
+ // context: ContextItem[]; // Array of items in the conversation's context
657
+ // messages: Message[]; // Array of messages in the conversation
658
+ // }
659
+ } catch (error) {
660
+ if (error instanceof NotFoundException) {
661
+ console.error("Conversation not found:", error.details);
662
+ } else {
663
+ console.error("Failed to get conversation:", error);
664
+ }
665
+ }
666
+ ```
667
+
668
+ #### Delete a Conversation
669
+
670
+ Permanently deletes a specific conversation and its associated data.
671
+
672
+ ```typescript
673
+ import { ConversationDeleteCommand, FlowcoreClient } from "@flowcore/sdk"
674
+
675
+ const command = new ConversationDeleteCommand({ conversationId: "conversation-id-to-delete" })
676
+
677
+ try {
678
+ const result = await client.execute(command)
679
+ // Returns: { message: "Conversation deleted successfully." }
680
+ console.log(result.message);
681
+ } catch (error) {
682
+ console.error("Failed to delete conversation:", error);
683
+ }
684
+ ```
685
+
686
+ #### Add Items to Conversation Context
687
+
688
+ Adds one or more resources (like tenants, data cores) to the context of a specific conversation.
689
+
690
+ ```typescript
691
+ import { ContextAddItemCommand, FlowcoreClient } from "@flowcore/sdk"
692
+
693
+ const command = new ContextAddItemCommand({
694
+ conversationId: "your-conversation-id",
695
+ items: [
696
+ { type: "tenant", id: "tenant-id-to-add" },
697
+ { type: "dataCore", id: "data-core-id-to-add" }
698
+ ]
699
+ })
700
+
701
+ try {
702
+ const result = await client.execute(command)
703
+ // Returns the updated context array for the conversation:
704
+ // { context: ContextItem[] }
705
+ console.log("Updated context:", result.context);
706
+ } catch (error) {
707
+ console.error("Failed to add context items:", error);
708
+ }
709
+ ```
710
+
711
+ #### Remove Item from Conversation Context
712
+
713
+ Removes a specific item instance from the context of a conversation.
714
+
715
+ ```typescript
716
+ import { ContextRemoveItemCommand, FlowcoreClient } from "@flowcore/sdk"
717
+
718
+ const command = new ContextRemoveItemCommand({
719
+ conversationId: "your-conversation-id",
720
+ itemId: "context-item-id-to-remove" // The ID of the item in the context array
721
+ })
722
+
723
+ try {
724
+ const result = await client.execute(command)
725
+ // Returns the updated context array for the conversation:
726
+ // { context: ContextItem[] }
727
+ console.log("Updated context after removal:", result.context);
728
+ } catch (error) {
729
+ console.error("Failed to remove context item:", error);
730
+ }
731
+ ```
732
+
733
+ #### Stream Conversation Events
734
+
735
+ The `WebSocketClient` is used to establish a persistent connection for streaming conversation events (like AI responses, tool usage, etc.) for a specific conversation.
736
+
737
+ ```typescript
738
+ import {
739
+ WebSocketClient,
740
+ ConversationStreamCommand,
741
+ type ConversationStreamConfig,
742
+ type ConversationStreamSendPayload,
743
+ type StreamChunk
744
+ } from "@flowcore/sdk";
745
+ import { Subject } from "rxjs";
746
+
747
+ // 1. Authentication (using bearer token provider)
748
+ const authOptions = {
749
+ getBearerToken: async (): Promise<string | null> => {
750
+ // Replace with your actual token retrieval logic
751
+ return "your-bearer-token";
752
+ }
753
+ };
754
+
755
+ // 2. Create the WebSocket Client
756
+ const wsClient = new WebSocketClient(authOptions, {
757
+ // Optional configuration
758
+ reconnectInterval: 2000, // milliseconds
759
+ maxReconnects: 5
760
+ });
761
+
762
+ // 3. Define the command for the specific conversation stream
763
+ const conversationConfig: ConversationStreamConfig = {
764
+ conversationId: "your-conversation-id"
765
+ };
766
+ const streamCommand = new ConversationStreamCommand(conversationConfig);
767
+
768
+ // 4. Connect and handle the stream
769
+ async function startStreaming() {
770
+ try {
771
+ console.log(`Connecting to conversation stream: ${conversationConfig.conversationId}...`);
772
+ const activeStream = await wsClient.connect(streamCommand);
773
+ console.log("Stream connected!");
774
+
775
+ // Subscribe to incoming chunks
776
+ const subscription = activeStream.output$.subscribe({
777
+ next: (chunk: StreamChunk) => {
778
+ console.log("Received chunk:", chunk.type, chunk);
779
+ // Process different chunk types (markdown_delta, tool_start, etc.)
780
+ },
781
+ error: (error) => {
782
+ console.error("Stream error:", error);
783
+ // Handle stream errors (e.g., attempt reconnect or notify user)
784
+ },
785
+ complete: () => {
786
+ console.log("Stream completed.");
787
+ // Handle stream completion (e.g., connection closed by server or maxReconnects reached)
788
+ }
789
+ });
790
+
791
+ // Example: Sending a message to the conversation
792
+ const messageToSend: ConversationStreamSendPayload = { content: "Hello Agent!" };
793
+ const sent = activeStream.send(messageToSend);
794
+ if (sent) {
795
+ console.log("Sent message to agent.");
796
+ } else {
797
+ console.warn("Failed to send message (socket likely not open).");
798
+ }
799
+
800
+ // Keep the connection open until explicitly disconnected or an error occurs
801
+ // In a real application, you might have UI events trigger disconnect
802
+ // Example: Disconnect after 60 seconds
803
+ setTimeout(() => {
804
+ console.log("Disconnecting stream...");
805
+ activeStream.disconnect();
806
+ subscription.unsubscribe();
807
+ }, 60000);
808
+
809
+ } catch (error) {
810
+ console.error("Failed to connect to WebSocket stream:", error);
811
+ }
812
+ }
813
+
814
+ startStreaming();
815
+
816
+ // Remember to handle graceful shutdown by calling disconnect
817
+ // e.g., wsClient.disconnect() or activeStream.disconnect()
818
+ ```
819
+
820
+ **Stream Chunks (`StreamChunk`)**
821
+
822
+ The `output$` observable emits objects conforming to the `StreamChunk` type (or subtypes). Refer to the API specification or SDK types for details on the different chunk types like `markdown_delta`, `tool_start`, `context_add_item`, etc., and their specific properties.
823
+
616
824
  ### Notifications
617
825
 
618
826
  The NotificationClient allows you to receive real-time notifications when events are ingested into an event type. The notifications follow the hierarchical structure: Data Core → Flow Type → Event Type.
@@ -0,0 +1,28 @@
1
+ import type { Command } from "../../common/command.js";
2
+ import { Command as BaseCommandClass } from "../../common/command.js";
3
+ import type { AddContextItem, ContextUpdateResponse } from "../../contracts/ai-agent-coordinator.js";
4
+ /**
5
+ * Input for adding items to a conversation's context.
6
+ */
7
+ export type ContextAddItemCommandInput = {
8
+ /** The ID of the conversation to modify. */
9
+ conversationId: string;
10
+ /** An array of context items (type and ID) to add. */
11
+ items: AddContextItem[];
12
+ };
13
+ /**
14
+ * Output containing the updated context array after adding items.
15
+ */
16
+ export type ContextAddItemCommandOutput = ContextUpdateResponse;
17
+ /**
18
+ * Command to add one or more items to the context of a specific conversation.
19
+ */
20
+ export declare class ContextAddItemCommand extends BaseCommandClass<ContextAddItemCommandInput, ContextAddItemCommandOutput> implements Command<ContextAddItemCommandInput, ContextAddItemCommandOutput> {
21
+ constructor(input: ContextAddItemCommandInput);
22
+ protected getBaseUrl(): string;
23
+ protected getMethod(): string;
24
+ protected getPath(): string;
25
+ protected getBody(): Record<string, unknown>;
26
+ protected parseResponse(response: unknown): ContextAddItemCommandOutput;
27
+ }
28
+ //# sourceMappingURL=context-add-item.command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context-add-item.command.d.ts","sourceRoot":"","sources":["../../../src/commands/ai-agent-coordinator/context-add-item.command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AACtD,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AACrE,OAAO,KAAK,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAA;AAKpG;;GAEG;AACH,MAAM,MAAM,0BAA0B,GAAG;IACvC,4CAA4C;IAC5C,cAAc,EAAE,MAAM,CAAA;IACtB,sDAAsD;IACtD,KAAK,EAAE,cAAc,EAAE,CAAA;CACxB,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,2BAA2B,GAAG,qBAAqB,CAAA;AAE/D;;GAEG;AACH,qBAAa,qBAAsB,SAAQ,gBAAgB,CAAC,0BAA0B,EAAE,2BAA2B,CACjH,YAAW,OAAO,CAAC,0BAA0B,EAAE,2BAA2B,CAAC;gBAC/D,KAAK,EAAE,0BAA0B;cAI1B,UAAU,IAAI,MAAM;cAIpB,SAAS,IAAI,MAAM;cAInB,OAAO,IAAI,MAAM;cAIjB,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;cAMlC,aAAa,CAAC,QAAQ,EAAE,OAAO,GAAG,2BAA2B;CASjF"}
@@ -0,0 +1,34 @@
1
+ import { Command as BaseCommandClass } from "../../common/command.js";
2
+ const service = "ai-coordinator";
3
+ const baseUrl = `https://${service}.api.flowcore.io`;
4
+ /**
5
+ * Command to add one or more items to the context of a specific conversation.
6
+ */
7
+ export class ContextAddItemCommand extends BaseCommandClass {
8
+ constructor(input) {
9
+ super(input);
10
+ }
11
+ getBaseUrl() {
12
+ return baseUrl;
13
+ }
14
+ getMethod() {
15
+ return "POST";
16
+ }
17
+ getPath() {
18
+ return `/api/v1/conversations/${this.input.conversationId}/context/add`;
19
+ }
20
+ getBody() {
21
+ return { items: this.input.items };
22
+ }
23
+ // Headers will be handled by base class based on getBody()
24
+ parseResponse(response) {
25
+ const data = response;
26
+ // Add more robust checking if necessary
27
+ if (data && Array.isArray(data.context)) {
28
+ return data;
29
+ }
30
+ else {
31
+ throw new Error("Invalid response format for ContextAddItemCommand");
32
+ }
33
+ }
34
+ }
@@ -0,0 +1,28 @@
1
+ import type { Command } from "../../common/command.js";
2
+ import { Command as BaseCommandClass } from "../../common/command.js";
3
+ import type { ContextUpdateResponse } from "../../contracts/ai-agent-coordinator.js";
4
+ /**
5
+ * Input for removing an item from a conversation's context.
6
+ */
7
+ export type ContextRemoveItemCommandInput = {
8
+ /** The ID of the conversation to modify. */
9
+ conversationId: string;
10
+ /** The unique ID of the context item instance to remove. */
11
+ itemId: string;
12
+ };
13
+ /**
14
+ * Output containing the updated context array after removing the item.
15
+ */
16
+ export type ContextRemoveItemCommandOutput = ContextUpdateResponse;
17
+ /**
18
+ * Command to remove a specific item from the context of a conversation.
19
+ */
20
+ export declare class ContextRemoveItemCommand extends BaseCommandClass<ContextRemoveItemCommandInput, ContextRemoveItemCommandOutput> implements Command<ContextRemoveItemCommandInput, ContextRemoveItemCommandOutput> {
21
+ constructor(input: ContextRemoveItemCommandInput);
22
+ protected getBaseUrl(): string;
23
+ protected getMethod(): string;
24
+ protected getPath(): string;
25
+ protected getBody(): Record<string, unknown>;
26
+ protected parseResponse(response: unknown): ContextRemoveItemCommandOutput;
27
+ }
28
+ //# sourceMappingURL=context-remove-item.command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context-remove-item.command.d.ts","sourceRoot":"","sources":["../../../src/commands/ai-agent-coordinator/context-remove-item.command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AACtD,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AACrE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAA;AAKpF;;GAEG;AACH,MAAM,MAAM,6BAA6B,GAAG;IAC1C,4CAA4C;IAC5C,cAAc,EAAE,MAAM,CAAA;IACtB,4DAA4D;IAC5D,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,8BAA8B,GAAG,qBAAqB,CAAA;AAElE;;GAEG;AACH,qBAAa,wBACX,SAAQ,gBAAgB,CAAC,6BAA6B,EAAE,8BAA8B,CACtF,YAAW,OAAO,CAAC,6BAA6B,EAAE,8BAA8B,CAAC;gBACrE,KAAK,EAAE,6BAA6B;cAI7B,UAAU,IAAI,MAAM;cAIpB,SAAS,IAAI,MAAM;cAInB,OAAO,IAAI,MAAM;cAIjB,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;cAIlC,aAAa,CAAC,QAAQ,EAAE,OAAO,GAAG,8BAA8B;CAQpF"}
@@ -0,0 +1,32 @@
1
+ import { Command as BaseCommandClass } from "../../common/command.js";
2
+ const service = "ai-coordinator";
3
+ const baseUrl = `https://${service}.api.flowcore.io`;
4
+ /**
5
+ * Command to remove a specific item from the context of a conversation.
6
+ */
7
+ export class ContextRemoveItemCommand extends BaseCommandClass {
8
+ constructor(input) {
9
+ super(input);
10
+ }
11
+ getBaseUrl() {
12
+ return baseUrl;
13
+ }
14
+ getMethod() {
15
+ return "POST";
16
+ }
17
+ getPath() {
18
+ return `/api/v1/conversations/${this.input.conversationId}/context/remove`;
19
+ }
20
+ getBody() {
21
+ return { itemId: this.input.itemId };
22
+ }
23
+ parseResponse(response) {
24
+ const data = response;
25
+ if (data && Array.isArray(data.context)) {
26
+ return data;
27
+ }
28
+ else {
29
+ throw new Error("Invalid response format for ContextRemoveItemCommand");
30
+ }
31
+ }
32
+ }
@@ -0,0 +1,25 @@
1
+ import type { Command } from "../../common/command.js";
2
+ import { Command as BaseCommandClass } from "../../common/command.js";
3
+ import type { ConversationDeleteResponse } from "../../contracts/ai-agent-coordinator.js";
4
+ /**
5
+ * Input for deleting a specific conversation.
6
+ */
7
+ export type ConversationDeleteCommandInput = {
8
+ /** The unique ID of the conversation to delete. */
9
+ conversationId: string;
10
+ };
11
+ /**
12
+ * Output confirming the deletion of the conversation.
13
+ */
14
+ export type ConversationDeleteCommandOutput = ConversationDeleteResponse;
15
+ /**
16
+ * Command to delete a specific conversation by its ID.
17
+ */
18
+ export declare class ConversationDeleteCommand extends BaseCommandClass<ConversationDeleteCommandInput, ConversationDeleteCommandOutput> implements Command<ConversationDeleteCommandInput, ConversationDeleteCommandOutput> {
19
+ constructor(input: ConversationDeleteCommandInput);
20
+ protected getBaseUrl(): string;
21
+ protected getMethod(): string;
22
+ protected getPath(): string;
23
+ protected parseResponse(response: unknown): ConversationDeleteCommandOutput;
24
+ }
25
+ //# sourceMappingURL=conversation-delete.command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversation-delete.command.d.ts","sourceRoot":"","sources":["../../../src/commands/ai-agent-coordinator/conversation-delete.command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AACtD,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AACrE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,yCAAyC,CAAA;AAKzF;;GAEG;AACH,MAAM,MAAM,8BAA8B,GAAG;IAC3C,mDAAmD;IACnD,cAAc,EAAE,MAAM,CAAA;CACvB,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,+BAA+B,GAAG,0BAA0B,CAAA;AAExE;;GAEG;AACH,qBAAa,yBACX,SAAQ,gBAAgB,CAAC,8BAA8B,EAAE,+BAA+B,CACxF,YAAW,OAAO,CAAC,8BAA8B,EAAE,+BAA+B,CAAC;gBACvE,KAAK,EAAE,8BAA8B;cAI9B,UAAU,IAAI,MAAM;cAIpB,SAAS,IAAI,MAAM;cAInB,OAAO,IAAI,MAAM;cAMjB,aAAa,CAAC,QAAQ,EAAE,OAAO,GAAG,+BAA+B;CAUrF"}
@@ -0,0 +1,30 @@
1
+ import { Command as BaseCommandClass } from "../../common/command.js";
2
+ const service = "ai-coordinator";
3
+ const baseUrl = `https://${service}.api.flowcore.io`;
4
+ /**
5
+ * Command to delete a specific conversation by its ID.
6
+ */
7
+ export class ConversationDeleteCommand extends BaseCommandClass {
8
+ constructor(input) {
9
+ super(input);
10
+ }
11
+ getBaseUrl() {
12
+ return baseUrl;
13
+ }
14
+ getMethod() {
15
+ return "DELETE";
16
+ }
17
+ getPath() {
18
+ return `/api/v1/conversations/${this.input.conversationId}`;
19
+ }
20
+ // No need to override getBody or getHeaders for DELETE with no body
21
+ parseResponse(response) {
22
+ const data = response;
23
+ if (data && data.message) {
24
+ return data;
25
+ }
26
+ else {
27
+ throw new Error("Invalid response format for ConversationDeleteCommand");
28
+ }
29
+ }
30
+ }
@@ -0,0 +1,27 @@
1
+ import type { Command } from "../../common/command.js";
2
+ import { Command as BaseCommandClass } from "../../common/command.js";
3
+ import type { Conversation } from "../../contracts/ai-agent-coordinator.js";
4
+ import type { ClientError } from "../../exceptions/client-error.js";
5
+ /**
6
+ * Input for fetching a specific conversation.
7
+ */
8
+ export type ConversationGetCommandInput = {
9
+ /** The unique ID of the conversation to fetch. */
10
+ conversationId: string;
11
+ };
12
+ /**
13
+ * Output containing the full details of the fetched conversation.
14
+ */
15
+ export type ConversationGetCommandOutput = Conversation;
16
+ /**
17
+ * Command to fetch the details of a specific conversation by its ID.
18
+ */
19
+ export declare class ConversationGetCommand extends BaseCommandClass<ConversationGetCommandInput, ConversationGetCommandOutput> implements Command<ConversationGetCommandInput, ConversationGetCommandOutput> {
20
+ constructor(input: ConversationGetCommandInput);
21
+ protected getBaseUrl(): string;
22
+ protected getMethod(): string;
23
+ protected getPath(): string;
24
+ protected parseResponse(response: unknown): ConversationGetCommandOutput;
25
+ protected handleClientError(error: ClientError): void;
26
+ }
27
+ //# sourceMappingURL=conversation-get.command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversation-get.command.d.ts","sourceRoot":"","sources":["../../../src/commands/ai-agent-coordinator/conversation-get.command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AACtD,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AACrE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAA;AAC3E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAA;AAMnE;;GAEG;AACH,MAAM,MAAM,2BAA2B,GAAG;IACxC,kDAAkD;IAClD,cAAc,EAAE,MAAM,CAAA;CACvB,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,4BAA4B,GAAG,YAAY,CAAA;AAEvD;;GAEG;AACH,qBAAa,sBAAuB,SAAQ,gBAAgB,CAAC,2BAA2B,EAAE,4BAA4B,CACpH,YAAW,OAAO,CAAC,2BAA2B,EAAE,4BAA4B,CAAC;gBACjE,KAAK,EAAE,2BAA2B;cAI3B,UAAU,IAAI,MAAM;cAIpB,SAAS,IAAI,MAAM;cAInB,OAAO,IAAI,MAAM;cAIjB,aAAa,CAAC,QAAQ,EAAE,OAAO,GAAG,4BAA4B;cAS9D,iBAAiB,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI;CAS/D"}
@@ -0,0 +1,36 @@
1
+ import { Command as BaseCommandClass } from "../../common/command.js";
2
+ import { NotFoundException } from "../../exceptions/index.js";
3
+ const service = "ai-coordinator";
4
+ const baseUrl = `https://${service}.api.flowcore.io`;
5
+ /**
6
+ * Command to fetch the details of a specific conversation by its ID.
7
+ */
8
+ export class ConversationGetCommand extends BaseCommandClass {
9
+ constructor(input) {
10
+ super(input);
11
+ }
12
+ getBaseUrl() {
13
+ return baseUrl;
14
+ }
15
+ getMethod() {
16
+ return "GET";
17
+ }
18
+ getPath() {
19
+ return `/api/v1/conversations/${this.input.conversationId}`;
20
+ }
21
+ parseResponse(response) {
22
+ const data = response;
23
+ if (data && data.id) {
24
+ return data;
25
+ }
26
+ else {
27
+ throw new Error("Invalid response format for ConversationGetCommand");
28
+ }
29
+ }
30
+ handleClientError(error) {
31
+ if (error.status === 404) {
32
+ throw new NotFoundException("Conversation", { conversationId: this.input.conversationId });
33
+ }
34
+ throw error;
35
+ }
36
+ }
@@ -0,0 +1,23 @@
1
+ import type { Command } from "../../common/command.js";
2
+ import { Command as BaseCommandClass } from "../../common/command.js";
3
+ import type { ConversationMetadata } from "../../contracts/ai-agent-coordinator.js";
4
+ /**
5
+ * Input for listing conversations.
6
+ * Currently empty as no filters are supported.
7
+ */
8
+ export type ConversationListCommandInput = Record<string, never>;
9
+ /**
10
+ * Output containing a list of conversation metadata.
11
+ */
12
+ export type ConversationListCommandOutput = ConversationMetadata[];
13
+ /**
14
+ * Command to list all conversations accessible by the user.
15
+ */
16
+ export declare class ConversationListCommand extends BaseCommandClass<ConversationListCommandInput, ConversationListCommandOutput> implements Command<ConversationListCommandInput, ConversationListCommandOutput> {
17
+ constructor();
18
+ protected getBaseUrl(): string;
19
+ protected getMethod(): string;
20
+ protected getPath(): string;
21
+ protected parseResponse(response: unknown): ConversationListCommandOutput;
22
+ }
23
+ //# sourceMappingURL=conversation-list.command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversation-list.command.d.ts","sourceRoot":"","sources":["../../../src/commands/ai-agent-coordinator/conversation-list.command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AACtD,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AACrE,OAAO,KAAK,EAA4B,oBAAoB,EAAE,MAAM,yCAAyC,CAAA;AAK7G;;;GAGG;AACH,MAAM,MAAM,4BAA4B,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;AAEhE;;GAEG;AACH,MAAM,MAAM,6BAA6B,GAAG,oBAAoB,EAAE,CAAA;AAElE;;GAEG;AACH,qBAAa,uBACX,SAAQ,gBAAgB,CAAC,4BAA4B,EAAE,6BAA6B,CACpF,YAAW,OAAO,CAAC,4BAA4B,EAAE,6BAA6B,CAAC;;cAK5D,UAAU,IAAI,MAAM;cAIpB,SAAS,IAAI,MAAM;cAInB,OAAO,IAAI,MAAM;cAIjB,aAAa,CAAC,QAAQ,EAAE,OAAO,GAAG,6BAA6B;CAQnF"}
@@ -0,0 +1,29 @@
1
+ import { Command as BaseCommandClass } from "../../common/command.js";
2
+ const service = "ai-coordinator";
3
+ const baseUrl = `https://${service}.api.flowcore.io`;
4
+ /**
5
+ * Command to list all conversations accessible by the user.
6
+ */
7
+ export class ConversationListCommand extends BaseCommandClass {
8
+ constructor() {
9
+ super({});
10
+ }
11
+ getBaseUrl() {
12
+ return baseUrl;
13
+ }
14
+ getMethod() {
15
+ return "GET";
16
+ }
17
+ getPath() {
18
+ return `/api/v1/conversations`;
19
+ }
20
+ parseResponse(response) {
21
+ const data = response;
22
+ if (data && Array.isArray(data.conversations)) {
23
+ return data.conversations;
24
+ }
25
+ else {
26
+ throw new Error("Invalid response format for ConversationListCommand");
27
+ }
28
+ }
29
+ }
@@ -0,0 +1,30 @@
1
+ import type { WebSocketCommand } from "../../common/websocket-command.js";
2
+ /**
3
+ * Configuration for the Conversation Stream.
4
+ * Only requires the conversationId.
5
+ */
6
+ export interface ConversationStreamConfig {
7
+ conversationId: string;
8
+ }
9
+ /**
10
+ * Payload type for messages sent *to* the Conversation Stream.
11
+ */
12
+ export interface ConversationStreamSendPayload {
13
+ content: string;
14
+ }
15
+ /**
16
+ * Command to stream conversation events for a specific agent.
17
+ */
18
+ export declare class ConversationStreamCommand implements WebSocketCommand<ConversationStreamConfig, ConversationStreamSendPayload> {
19
+ private config;
20
+ constructor(config: ConversationStreamConfig);
21
+ /** Get the configuration object for the command. */
22
+ getConfig(): ConversationStreamConfig;
23
+ /** Get the base WebSocket URL. */
24
+ getWebSocketBaseUrl(): string;
25
+ /** Get the WebSocket path segment. */
26
+ getWebSocketPathSegment(config: ConversationStreamConfig): string;
27
+ /** Serializer function for outgoing payloads. */
28
+ serializeSendPayload(payload: ConversationStreamSendPayload): string;
29
+ }
30
+ //# sourceMappingURL=conversation-stream.command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversation-stream.command.d.ts","sourceRoot":"","sources":["../../../src/commands/ai-agent-coordinator/conversation-stream.command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAA;AAEzE;;;GAGG;AACH,MAAM,WAAW,wBAAwB;IACvC,cAAc,EAAE,MAAM,CAAA;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,6BAA6B;IAC5C,OAAO,EAAE,MAAM,CAAA;CAChB;AAED;;GAEG;AACH,qBAAa,yBACX,YAAW,gBAAgB,CAAC,wBAAwB,EAAE,6BAA6B,CAAC;IACpF,OAAO,CAAC,MAAM,CAA0B;gBAE5B,MAAM,EAAE,wBAAwB;IAO5C,oDAAoD;IACpD,SAAS,IAAI,wBAAwB;IAIrC,kCAAkC;IAClC,mBAAmB,IAAI,MAAM;IAK7B,sCAAsC;IACtC,uBAAuB,CAAC,MAAM,EAAE,wBAAwB,GAAG,MAAM;IAKjE,iDAAiD;IACjD,oBAAoB,CAAC,OAAO,EAAE,6BAA6B,GAAG,MAAM;CAIrE"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Command to stream conversation events for a specific agent.
3
+ */
4
+ export class ConversationStreamCommand {
5
+ constructor(config) {
6
+ Object.defineProperty(this, "config", {
7
+ enumerable: true,
8
+ configurable: true,
9
+ writable: true,
10
+ value: void 0
11
+ });
12
+ if (!config.conversationId) {
13
+ throw new Error("conversationId is required in the config for ConversationStreamCommand");
14
+ }
15
+ this.config = config;
16
+ }
17
+ /** Get the configuration object for the command. */
18
+ getConfig() {
19
+ return this.config;
20
+ }
21
+ /** Get the base WebSocket URL. */
22
+ getWebSocketBaseUrl() {
23
+ // Specific base URL for AI Coordinator streams
24
+ return "wss://ai-coordinator.api.flowcore.io";
25
+ }
26
+ /** Get the WebSocket path segment. */
27
+ getWebSocketPathSegment(config) {
28
+ // Updated path segment based on likely API structure
29
+ return `/api/v1/stream/conversations/${config.conversationId}`;
30
+ }
31
+ /** Serializer function for outgoing payloads. */
32
+ serializeSendPayload(payload) {
33
+ // Default JSON serialization
34
+ return JSON.stringify(payload);
35
+ }
36
+ }
@@ -0,0 +1,7 @@
1
+ export * from "./context-add-item.command.js";
2
+ export * from "./context-remove-item.command.js";
3
+ export * from "./conversation-delete.command.js";
4
+ export * from "./conversation-get.command.js";
5
+ export * from "./conversation-list.command.js";
6
+ export * from "./conversation-stream.command.js";
7
+ //# sourceMappingURL=mod.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../src/commands/ai-agent-coordinator/mod.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAA;AAC7C,cAAc,kCAAkC,CAAA;AAChD,cAAc,kCAAkC,CAAA;AAChD,cAAc,+BAA+B,CAAA;AAC7C,cAAc,gCAAgC,CAAA;AAC9C,cAAc,kCAAkC,CAAA"}
@@ -0,0 +1,6 @@
1
+ export * from "./context-add-item.command.js";
2
+ export * from "./context-remove-item.command.js";
3
+ export * from "./conversation-delete.command.js";
4
+ export * from "./conversation-get.command.js";
5
+ export * from "./conversation-list.command.js";
6
+ export * from "./conversation-stream.command.js";