@flowcore/sdk 1.25.0 → 1.26.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.
- package/CHANGELOG.md +16 -0
- package/README.md +30 -0
- package/esm/commands/ai-agent-coordinator/artifact-get.command.d.ts +22 -0
- package/esm/commands/ai-agent-coordinator/artifact-get.command.d.ts.map +1 -0
- package/esm/commands/ai-agent-coordinator/artifact-get.command.js +52 -0
- package/esm/commands/ai-agent-coordinator/mod.d.ts +1 -0
- package/esm/commands/ai-agent-coordinator/mod.d.ts.map +1 -1
- package/esm/commands/ai-agent-coordinator/mod.js +1 -0
- package/package.json +1 -1
- package/script/commands/ai-agent-coordinator/artifact-get.command.d.ts +22 -0
- package/script/commands/ai-agent-coordinator/artifact-get.command.d.ts.map +1 -0
- package/script/commands/ai-agent-coordinator/artifact-get.command.js +56 -0
- package/script/commands/ai-agent-coordinator/mod.d.ts +1 -0
- package/script/commands/ai-agent-coordinator/mod.d.ts.map +1 -1
- package/script/commands/ai-agent-coordinator/mod.js +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.26.0](https://github.com/flowcore-io/flowcore-sdk/compare/v1.25.0...v1.26.0) (2025-04-10)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* **ai-agent-coordinator:** :sparkles: add ArtifactGetCommand for fetching artifacts by ID ([1955ed9](https://github.com/flowcore-io/flowcore-sdk/commit/1955ed97102c5f6cbdd7a551f8d18fb0cb706e2f))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **ai-agent-coordinator:** :art: clean up import formatting in conversation test ([cb8a258](https://github.com/flowcore-io/flowcore-sdk/commit/cb8a258027409baa501a77141aef6a51009db2ec))
|
|
14
|
+
* **ai-agent-coordinator:** :art: ensure artifactId is a string in ArtifactGetCommand ([4e88025](https://github.com/flowcore-io/flowcore-sdk/commit/4e880251dddbb9ee068a4cc195cfc7e71d371d03))
|
|
15
|
+
* **ai-agent-coordinator:** :art: reorder import statements in artifact-get command ([54e4b8d](https://github.com/flowcore-io/flowcore-sdk/commit/54e4b8ddf88af4a755a62036e938dbe86c91ac72))
|
|
16
|
+
* **ai-agent-coordinator:** :art: update artifact schema type and clean up imports ([c195c27](https://github.com/flowcore-io/flowcore-sdk/commit/c195c27ca5cde6d529cbc62492e0daa848837b8d))
|
|
17
|
+
* **readme:** :memo: add documentation for retrieving specific artifacts by ID ([26a49a3](https://github.com/flowcore-io/flowcore-sdk/commit/26a49a363a4c490dbbb5b02199ccfc2738ccedc7))
|
|
18
|
+
|
|
3
19
|
## [1.25.0](https://github.com/flowcore-io/flowcore-sdk/compare/v1.24.4...v1.25.0) (2025-04-10)
|
|
4
20
|
|
|
5
21
|
|
package/README.md
CHANGED
|
@@ -730,6 +730,36 @@ try {
|
|
|
730
730
|
}
|
|
731
731
|
```
|
|
732
732
|
|
|
733
|
+
#### Get a Specific Artifact
|
|
734
|
+
|
|
735
|
+
Retrieves the details (content, data, or url) for a specific artifact by its ID.
|
|
736
|
+
|
|
737
|
+
```typescript
|
|
738
|
+
import { ArtifactGetCommand, FlowcoreClient, NotFoundException } from "@flowcore/sdk"
|
|
739
|
+
|
|
740
|
+
const command = new ArtifactGetCommand({ artifactId: "your-artifact-id" });
|
|
741
|
+
|
|
742
|
+
try {
|
|
743
|
+
const artifact = await client.execute(command);
|
|
744
|
+
// Returns the Artifact object:
|
|
745
|
+
// {
|
|
746
|
+
// artifactId: string;
|
|
747
|
+
// artifactType: "code" | "markdown" | "table" | "visualization" | "html" | "mermaid";
|
|
748
|
+
// title: string;
|
|
749
|
+
// content?: string; // For text-based artifacts
|
|
750
|
+
// data?: unknown; // For JSON-based artifacts
|
|
751
|
+
// url?: string; // For URL-based artifacts
|
|
752
|
+
// }
|
|
753
|
+
console.log("Artifact details:", artifact);
|
|
754
|
+
} catch (error) {
|
|
755
|
+
if (error instanceof NotFoundException) {
|
|
756
|
+
console.error("Artifact not found:", error.details);
|
|
757
|
+
} else {
|
|
758
|
+
console.error("Failed to get artifact:", error);
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
```
|
|
762
|
+
|
|
733
763
|
#### Stream Conversation Events
|
|
734
764
|
|
|
735
765
|
The `WebSocketClient` is used to establish a persistent connection for streaming conversation events (like AI responses, tool usage, etc.) for a specific conversation.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type TObject } from "@sinclair/typebox";
|
|
2
|
+
import { Command } from "../../common/command.js";
|
|
3
|
+
import type { ClientError } from "../../exceptions/client-error.js";
|
|
4
|
+
export interface ArtifactGetCommandInput {
|
|
5
|
+
artifactId: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Represents the structure of the artifact returned by the API.
|
|
9
|
+
* Based on the Swagger spec example.
|
|
10
|
+
*/
|
|
11
|
+
declare const ArtifactSchema: TObject;
|
|
12
|
+
export type Artifact = typeof ArtifactSchema.static;
|
|
13
|
+
export declare class ArtifactGetCommand extends Command<ArtifactGetCommandInput, Artifact> {
|
|
14
|
+
protected getMethod(): string;
|
|
15
|
+
protected getBaseUrl(): string;
|
|
16
|
+
protected getPath(): string;
|
|
17
|
+
protected getHeaders(): Record<string, string>;
|
|
18
|
+
protected parseResponse(rawResponse: unknown): Artifact;
|
|
19
|
+
protected handleClientError(error: ClientError): void;
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=artifact-get.command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"artifact-get.command.d.ts","sourceRoot":"","sources":["../../../src/commands/ai-agent-coordinator/artifact-get.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAQ,MAAM,mBAAmB,CAAA;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAA;AAInE,MAAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,MAAM,CAAA;CACnB;AAED;;;GAGG;AACH,QAAA,MAAM,cAAc,EAAE,OAcpB,CAAA;AAEF,MAAM,MAAM,QAAQ,GAAG,OAAO,cAAc,CAAC,MAAM,CAAA;AAEnD,qBAAa,kBAAmB,SAAQ,OAAO,CAAC,uBAAuB,EAAE,QAAQ,CAAC;cAC7D,SAAS,IAAI,MAAM;cAInB,UAAU,IAAI,MAAM;cAKpB,OAAO,IAAI,MAAM;cAIjB,UAAU,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;cAQpC,aAAa,CAAC,WAAW,EAAE,OAAO,GAAG,QAAQ;cAK7C,iBAAiB,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI;CAM/D"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Type } from "@sinclair/typebox";
|
|
2
|
+
import { Command } from "../../common/command.js";
|
|
3
|
+
import { NotFoundException } from "../../exceptions/not-found.js";
|
|
4
|
+
import { parseResponseHelper } from "../../utils/parse-response-helper.js";
|
|
5
|
+
/**
|
|
6
|
+
* Represents the structure of the artifact returned by the API.
|
|
7
|
+
* Based on the Swagger spec example.
|
|
8
|
+
*/
|
|
9
|
+
const ArtifactSchema = Type.Object({
|
|
10
|
+
artifactId: Type.String({ example: "artifact_code_123" }),
|
|
11
|
+
artifactType: Type.Union([
|
|
12
|
+
Type.Literal("code"),
|
|
13
|
+
Type.Literal("markdown"),
|
|
14
|
+
Type.Literal("table"),
|
|
15
|
+
Type.Literal("visualization"),
|
|
16
|
+
Type.Literal("html"),
|
|
17
|
+
Type.Literal("mermaid"),
|
|
18
|
+
], { description: "Type of artifact" }),
|
|
19
|
+
title: Type.String({ example: "Example Code Snippet" }),
|
|
20
|
+
content: Type.Optional(Type.String({ description: "String content" })),
|
|
21
|
+
data: Type.Optional(Type.Unknown({ description: "JSON data" })),
|
|
22
|
+
url: Type.Optional(Type.String({ format: "uri", description: "URL content" })),
|
|
23
|
+
});
|
|
24
|
+
export class ArtifactGetCommand extends Command {
|
|
25
|
+
getMethod() {
|
|
26
|
+
return "GET";
|
|
27
|
+
}
|
|
28
|
+
getBaseUrl() {
|
|
29
|
+
// Assuming the coordinator uses this base URL, adjust if needed
|
|
30
|
+
return "https://ai-coordinator.api.flowcore.io";
|
|
31
|
+
}
|
|
32
|
+
getPath() {
|
|
33
|
+
return `/api/v1/artifacts/${this.input.artifactId}`;
|
|
34
|
+
}
|
|
35
|
+
getHeaders() {
|
|
36
|
+
// GET requests typically don't need Content-Type
|
|
37
|
+
// Authorization header is handled by the FlowcoreClient
|
|
38
|
+
return {
|
|
39
|
+
"Accept": "application/json",
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
parseResponse(rawResponse) {
|
|
43
|
+
const response = parseResponseHelper(ArtifactSchema, rawResponse);
|
|
44
|
+
return response;
|
|
45
|
+
}
|
|
46
|
+
handleClientError(error) {
|
|
47
|
+
if (error.status === 404) {
|
|
48
|
+
throw new NotFoundException("Artifact", { id: this.input.artifactId });
|
|
49
|
+
}
|
|
50
|
+
throw error;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -1 +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"}
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../src/commands/ai-agent-coordinator/mod.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAA;AACzC,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"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type TObject } from "@sinclair/typebox";
|
|
2
|
+
import { Command } from "../../common/command.js";
|
|
3
|
+
import type { ClientError } from "../../exceptions/client-error.js";
|
|
4
|
+
export interface ArtifactGetCommandInput {
|
|
5
|
+
artifactId: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Represents the structure of the artifact returned by the API.
|
|
9
|
+
* Based on the Swagger spec example.
|
|
10
|
+
*/
|
|
11
|
+
declare const ArtifactSchema: TObject;
|
|
12
|
+
export type Artifact = typeof ArtifactSchema.static;
|
|
13
|
+
export declare class ArtifactGetCommand extends Command<ArtifactGetCommandInput, Artifact> {
|
|
14
|
+
protected getMethod(): string;
|
|
15
|
+
protected getBaseUrl(): string;
|
|
16
|
+
protected getPath(): string;
|
|
17
|
+
protected getHeaders(): Record<string, string>;
|
|
18
|
+
protected parseResponse(rawResponse: unknown): Artifact;
|
|
19
|
+
protected handleClientError(error: ClientError): void;
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=artifact-get.command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"artifact-get.command.d.ts","sourceRoot":"","sources":["../../../src/commands/ai-agent-coordinator/artifact-get.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAQ,MAAM,mBAAmB,CAAA;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAA;AAInE,MAAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,MAAM,CAAA;CACnB;AAED;;;GAGG;AACH,QAAA,MAAM,cAAc,EAAE,OAcpB,CAAA;AAEF,MAAM,MAAM,QAAQ,GAAG,OAAO,cAAc,CAAC,MAAM,CAAA;AAEnD,qBAAa,kBAAmB,SAAQ,OAAO,CAAC,uBAAuB,EAAE,QAAQ,CAAC;cAC7D,SAAS,IAAI,MAAM;cAInB,UAAU,IAAI,MAAM;cAKpB,OAAO,IAAI,MAAM;cAIjB,UAAU,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;cAQpC,aAAa,CAAC,WAAW,EAAE,OAAO,GAAG,QAAQ;cAK7C,iBAAiB,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI;CAM/D"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ArtifactGetCommand = void 0;
|
|
4
|
+
const typebox_1 = require("@sinclair/typebox");
|
|
5
|
+
const command_js_1 = require("../../common/command.js");
|
|
6
|
+
const not_found_js_1 = require("../../exceptions/not-found.js");
|
|
7
|
+
const parse_response_helper_js_1 = require("../../utils/parse-response-helper.js");
|
|
8
|
+
/**
|
|
9
|
+
* Represents the structure of the artifact returned by the API.
|
|
10
|
+
* Based on the Swagger spec example.
|
|
11
|
+
*/
|
|
12
|
+
const ArtifactSchema = typebox_1.Type.Object({
|
|
13
|
+
artifactId: typebox_1.Type.String({ example: "artifact_code_123" }),
|
|
14
|
+
artifactType: typebox_1.Type.Union([
|
|
15
|
+
typebox_1.Type.Literal("code"),
|
|
16
|
+
typebox_1.Type.Literal("markdown"),
|
|
17
|
+
typebox_1.Type.Literal("table"),
|
|
18
|
+
typebox_1.Type.Literal("visualization"),
|
|
19
|
+
typebox_1.Type.Literal("html"),
|
|
20
|
+
typebox_1.Type.Literal("mermaid"),
|
|
21
|
+
], { description: "Type of artifact" }),
|
|
22
|
+
title: typebox_1.Type.String({ example: "Example Code Snippet" }),
|
|
23
|
+
content: typebox_1.Type.Optional(typebox_1.Type.String({ description: "String content" })),
|
|
24
|
+
data: typebox_1.Type.Optional(typebox_1.Type.Unknown({ description: "JSON data" })),
|
|
25
|
+
url: typebox_1.Type.Optional(typebox_1.Type.String({ format: "uri", description: "URL content" })),
|
|
26
|
+
});
|
|
27
|
+
class ArtifactGetCommand extends command_js_1.Command {
|
|
28
|
+
getMethod() {
|
|
29
|
+
return "GET";
|
|
30
|
+
}
|
|
31
|
+
getBaseUrl() {
|
|
32
|
+
// Assuming the coordinator uses this base URL, adjust if needed
|
|
33
|
+
return "https://ai-coordinator.api.flowcore.io";
|
|
34
|
+
}
|
|
35
|
+
getPath() {
|
|
36
|
+
return `/api/v1/artifacts/${this.input.artifactId}`;
|
|
37
|
+
}
|
|
38
|
+
getHeaders() {
|
|
39
|
+
// GET requests typically don't need Content-Type
|
|
40
|
+
// Authorization header is handled by the FlowcoreClient
|
|
41
|
+
return {
|
|
42
|
+
"Accept": "application/json",
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
parseResponse(rawResponse) {
|
|
46
|
+
const response = (0, parse_response_helper_js_1.parseResponseHelper)(ArtifactSchema, rawResponse);
|
|
47
|
+
return response;
|
|
48
|
+
}
|
|
49
|
+
handleClientError(error) {
|
|
50
|
+
if (error.status === 404) {
|
|
51
|
+
throw new not_found_js_1.NotFoundException("Artifact", { id: this.input.artifactId });
|
|
52
|
+
}
|
|
53
|
+
throw error;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.ArtifactGetCommand = ArtifactGetCommand;
|
|
@@ -1 +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"}
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../src/commands/ai-agent-coordinator/mod.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAA;AACzC,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"}
|
|
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./artifact-get.command.js"), exports);
|
|
17
18
|
__exportStar(require("./context-add-item.command.js"), exports);
|
|
18
19
|
__exportStar(require("./context-remove-item.command.js"), exports);
|
|
19
20
|
__exportStar(require("./conversation-delete.command.js"), exports);
|