@taskmagic/apps-swarmnode 0.0.1
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 +7 -0
- package/package.json +47 -0
- package/src/index.d.ts +1 -0
- package/src/index.js +47 -0
- package/src/index.js.map +1 -0
- package/src/lib/actions/execute-agent.d.ts +4 -0
- package/src/lib/actions/execute-agent.js +62 -0
- package/src/lib/actions/execute-agent.js.map +1 -0
- package/src/lib/actions/get-execution.d.ts +3 -0
- package/src/lib/actions/get-execution.js +34 -0
- package/src/lib/actions/get-execution.js.map +1 -0
- package/src/lib/common/auth.d.ts +1 -0
- package/src/lib/common/auth.js +34 -0
- package/src/lib/common/auth.js.map +1 -0
- package/src/lib/common/constants.d.ts +1 -0
- package/src/lib/common/constants.js +5 -0
- package/src/lib/common/constants.js.map +1 -0
- package/src/lib/common/props.d.ts +1 -0
- package/src/lib/common/props.js +37 -0
- package/src/lib/common/props.js.map +1 -0
- package/src/lib/common/types.d.ts +16 -0
- package/src/lib/common/types.js +3 -0
- package/src/lib/common/types.js.map +1 -0
package/README.md
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@taskmagic/apps-swarmnode",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"dependencies": {
|
|
5
|
+
"@anthropic-ai/sdk": "0.33.1",
|
|
6
|
+
"@sinclair/typebox": "0.34.11",
|
|
7
|
+
"axios": "1.17.0",
|
|
8
|
+
"axios-retry": "4.4.1",
|
|
9
|
+
"deepmerge-ts": "7.1.0",
|
|
10
|
+
"mime-types": "2.1.35",
|
|
11
|
+
"nanoid": "3.3.8",
|
|
12
|
+
"openai": "4.67.1",
|
|
13
|
+
"replicate": "0.34.1",
|
|
14
|
+
"semver": "7.6.0",
|
|
15
|
+
"zod": "3.25.76",
|
|
16
|
+
"@taskmagic/pieces-common": "0.4.4",
|
|
17
|
+
"@taskmagic/pieces-framework": "0.7.46",
|
|
18
|
+
"@taskmagic/shared": "0.10.171",
|
|
19
|
+
"tslib": "1.14.1"
|
|
20
|
+
},
|
|
21
|
+
"overrides": {
|
|
22
|
+
"cross-spawn": "7.0.6",
|
|
23
|
+
"elliptic": "^6.6.1",
|
|
24
|
+
"fast-xml-parser": "^4.4.1",
|
|
25
|
+
"protobufjs": "^7.5.5",
|
|
26
|
+
"tmp": "^0.2.4",
|
|
27
|
+
"koa": "^2.16.4",
|
|
28
|
+
"picomatch": "^4.0.4",
|
|
29
|
+
"langsmith": "^0.6.0",
|
|
30
|
+
"serialize-javascript": "^6.0.2",
|
|
31
|
+
"elevenlabs": {
|
|
32
|
+
"form-data": "^4.0.4"
|
|
33
|
+
},
|
|
34
|
+
"@tryfabric/martian": {
|
|
35
|
+
"@notionhq/client": "$@notionhq/client"
|
|
36
|
+
},
|
|
37
|
+
"vite": {
|
|
38
|
+
"rollup": "npm:@rollup/wasm-node@^4.61.1"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"resolutions": {
|
|
42
|
+
"rollup": "npm:@rollup/wasm-node@^4.61.1"
|
|
43
|
+
},
|
|
44
|
+
"types": "./src/index.d.ts",
|
|
45
|
+
"main": "./src/index.js",
|
|
46
|
+
"type": "commonjs"
|
|
47
|
+
}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const swarmnode: import("@taskmagic/pieces-framework").Piece<import("@taskmagic/pieces-framework").SecretTextProperty<true>>;
|
package/src/index.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.swarmnode = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@taskmagic/pieces-framework");
|
|
6
|
+
const shared_1 = require("@taskmagic/shared");
|
|
7
|
+
const pieces_common_1 = require("@taskmagic/pieces-common");
|
|
8
|
+
const auth_1 = require("./lib/common/auth");
|
|
9
|
+
const constants_1 = require("./lib/common/constants");
|
|
10
|
+
const execute_agent_1 = require("./lib/actions/execute-agent");
|
|
11
|
+
const get_execution_1 = require("./lib/actions/get-execution");
|
|
12
|
+
exports.swarmnode = (0, pieces_framework_1.createPiece)({
|
|
13
|
+
displayName: 'SwarmNode',
|
|
14
|
+
description: 'Run SwarmNode AI agents and retrieve their execution results.',
|
|
15
|
+
auth: auth_1.swarmnodeAuth,
|
|
16
|
+
minimumSupportedRelease: '0.30.0',
|
|
17
|
+
logoUrl: 'https://cdn.activepieces.com/pieces/swarmnode.png',
|
|
18
|
+
categories: [shared_1.PieceCategory.ARTIFICIAL_INTELLIGENCE],
|
|
19
|
+
authors: ['kishanprmr'],
|
|
20
|
+
ai: {
|
|
21
|
+
description: 'Run SwarmNode AI agents: execute an existing agent with a JSON payload and wait for its result, or fetch the details of a past execution.',
|
|
22
|
+
keywords: [
|
|
23
|
+
'swarmnode',
|
|
24
|
+
'ai agent',
|
|
25
|
+
'run agent',
|
|
26
|
+
'execute agent',
|
|
27
|
+
'agent execution',
|
|
28
|
+
'llm agent',
|
|
29
|
+
'autonomous agent',
|
|
30
|
+
],
|
|
31
|
+
},
|
|
32
|
+
actions: [
|
|
33
|
+
execute_agent_1.executeAgentAction,
|
|
34
|
+
get_execution_1.getExecutionAction,
|
|
35
|
+
(0, pieces_common_1.createCustomApiCallAction)({
|
|
36
|
+
auth: auth_1.swarmnodeAuth,
|
|
37
|
+
baseUrl: () => constants_1.BASE_URL,
|
|
38
|
+
authMapping: (auth) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
39
|
+
return {
|
|
40
|
+
Authorization: `Bearer ${auth}`,
|
|
41
|
+
};
|
|
42
|
+
}),
|
|
43
|
+
}),
|
|
44
|
+
],
|
|
45
|
+
triggers: [],
|
|
46
|
+
});
|
|
47
|
+
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pieces/community/swarmnode/src/index.ts"],"names":[],"mappings":";;;;AAAA,kEAA0D;AAC1D,8CAAkD;AAClD,4DAAqE;AACrE,4CAAkD;AAClD,sDAAkD;AAClD,+DAAiE;AACjE,+DAAiE;AAEpD,QAAA,SAAS,GAAG,IAAA,8BAAW,EAAC;IACnC,WAAW,EAAE,WAAW;IACxB,WAAW,EACT,+DAA+D;IACjE,IAAI,EAAE,oBAAa;IACnB,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,mDAAmD;IAC5D,UAAU,EAAE,CAAC,sBAAa,CAAC,uBAAuB,CAAC;IACnD,OAAO,EAAE,CAAC,YAAY,CAAC;IACvB,EAAE,EAAE;QACF,WAAW,EACT,2IAA2I;QAC7I,QAAQ,EAAE;YACR,WAAW;YACX,UAAU;YACV,WAAW;YACX,eAAe;YACf,iBAAiB;YACjB,WAAW;YACX,kBAAkB;SACnB;KACF;IACD,OAAO,EAAE;QACP,kCAAkB;QAClB,kCAAkB;QAClB,IAAA,yCAAyB,EAAC;YACxB,IAAI,EAAE,oBAAa;YACnB,OAAO,EAAE,GAAG,EAAE,CAAC,oBAAQ;YACvB,WAAW,EAAE,CAAO,IAAI,EAAE,EAAE;gBAC1B,OAAO;oBACL,aAAa,EAAE,UAAU,IAAc,EAAE;iBAC1C,CAAC;YACJ,CAAC,CAAA;SACF,CAAC;KACH;IACD,QAAQ,EAAE,EAAE;CACb,CAAC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const executeAgentAction: import("@taskmagic/pieces-framework").IAction<import("@taskmagic/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
agentId: import("@taskmagic/pieces-framework").DropdownProperty<string, true>;
|
|
3
|
+
payload: import("@taskmagic/pieces-framework").JsonProperty<true>;
|
|
4
|
+
}>;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.executeAgentAction = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@taskmagic/pieces-framework");
|
|
6
|
+
const auth_1 = require("../common/auth");
|
|
7
|
+
const props_1 = require("../common/props");
|
|
8
|
+
const pieces_common_1 = require("@taskmagic/pieces-common");
|
|
9
|
+
const constants_1 = require("../common/constants");
|
|
10
|
+
exports.executeAgentAction = (0, pieces_framework_1.createAction)({
|
|
11
|
+
name: 'execute-agent',
|
|
12
|
+
auth: auth_1.swarmnodeAuth,
|
|
13
|
+
displayName: 'Execute Agent',
|
|
14
|
+
description: 'Executes an existing AI agent.',
|
|
15
|
+
props: {
|
|
16
|
+
agentId: props_1.agentIdDropdown,
|
|
17
|
+
payload: pieces_framework_1.Property.Json({
|
|
18
|
+
displayName: 'Agent Input Payload',
|
|
19
|
+
required: true,
|
|
20
|
+
}),
|
|
21
|
+
},
|
|
22
|
+
run(context) {
|
|
23
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
const { agentId, payload } = context.propsValue;
|
|
25
|
+
const createJobRsponse = yield pieces_common_1.httpClient.sendRequest({
|
|
26
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
27
|
+
url: constants_1.BASE_URL + '/agent-executor-jobs/create/',
|
|
28
|
+
authentication: {
|
|
29
|
+
type: pieces_common_1.AuthenticationType.BEARER_TOKEN,
|
|
30
|
+
token: context.auth,
|
|
31
|
+
},
|
|
32
|
+
body: {
|
|
33
|
+
agent_id: agentId,
|
|
34
|
+
payload,
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
const jobId = createJobRsponse.body.id;
|
|
38
|
+
let status = 'in_progress';
|
|
39
|
+
const timeoutAt = Date.now() + 5 * 60 * 1000;
|
|
40
|
+
while (status != 'success' && Date.now() < timeoutAt) {
|
|
41
|
+
yield new Promise((resolve) => setTimeout(resolve, 5000));
|
|
42
|
+
const pollResponse = yield pieces_common_1.httpClient.sendRequest({
|
|
43
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
44
|
+
url: constants_1.BASE_URL + '/executions/',
|
|
45
|
+
authentication: {
|
|
46
|
+
type: pieces_common_1.AuthenticationType.BEARER_TOKEN,
|
|
47
|
+
token: context.auth,
|
|
48
|
+
},
|
|
49
|
+
queryParams: {
|
|
50
|
+
agent_executor_job_id: jobId,
|
|
51
|
+
agent_id: agentId,
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
status = pollResponse.body.results[0].status;
|
|
55
|
+
if (status === 'success')
|
|
56
|
+
return pollResponse.body.results[0];
|
|
57
|
+
}
|
|
58
|
+
throw new Error('Execution Job timed out or failed.');
|
|
59
|
+
});
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
//# sourceMappingURL=execute-agent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execute-agent.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/swarmnode/src/lib/actions/execute-agent.ts"],"names":[],"mappings":";;;;AAAA,kEAAqE;AACrE,yCAA+C;AAC/C,2CAAkD;AAClD,4DAIkC;AAClC,mDAA+C;AAGlC,QAAA,kBAAkB,GAAG,IAAA,+BAAY,EAAC;IAC7C,IAAI,EAAE,eAAe;IACrB,IAAI,EAAE,oBAAa;IACnB,WAAW,EAAE,eAAe;IAC5B,WAAW,EAAE,gCAAgC;IAC7C,KAAK,EAAE;QACL,OAAO,EAAE,uBAAe;QACxB,OAAO,EAAE,2BAAQ,CAAC,IAAI,CAAC;YACrB,WAAW,EAAE,qBAAqB;YAClC,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAEhD,MAAM,gBAAgB,GAAG,MAAM,0BAAU,CAAC,WAAW,CAGlD;gBACD,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,GAAG,EAAE,oBAAQ,GAAG,8BAA8B;gBAC9C,cAAc,EAAE;oBACd,IAAI,EAAE,kCAAkB,CAAC,YAAY;oBACrC,KAAK,EAAE,OAAO,CAAC,IAAc;iBAC9B;gBACD,IAAI,EAAE;oBACJ,QAAQ,EAAE,OAAO;oBACjB,OAAO;iBACR;aACF,CAAC,CAAC;YAEH,MAAM,KAAK,GAAG,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;YACvC,IAAI,MAAM,GAAG,aAAa,CAAC;YAC3B,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;YAE7C,OAAO,MAAM,IAAI,SAAS,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,EAAE,CAAC;gBACrD,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;gBAE1D,MAAM,YAAY,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAwB;oBACvE,MAAM,EAAE,0BAAU,CAAC,GAAG;oBACtB,GAAG,EAAE,oBAAQ,GAAG,cAAc;oBAC9B,cAAc,EAAE;wBACd,IAAI,EAAE,kCAAkB,CAAC,YAAY;wBACrC,KAAK,EAAE,OAAO,CAAC,IAAc;qBAC9B;oBACD,WAAW,EAAE;wBACX,qBAAqB,EAAE,KAAK;wBAC5B,QAAQ,EAAE,OAAO;qBAClB;iBACF,CAAC,CAAC;gBAEH,MAAM,GAAG,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;gBAE7C,IAAI,MAAM,KAAK,SAAS;oBAAE,OAAO,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;YAChE,CAAC;YAED,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;QACxD,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getExecutionAction = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@taskmagic/pieces-framework");
|
|
6
|
+
const auth_1 = require("../common/auth");
|
|
7
|
+
const pieces_common_1 = require("@taskmagic/pieces-common");
|
|
8
|
+
const constants_1 = require("../common/constants");
|
|
9
|
+
exports.getExecutionAction = (0, pieces_framework_1.createAction)({
|
|
10
|
+
name: 'get-execution',
|
|
11
|
+
auth: auth_1.swarmnodeAuth,
|
|
12
|
+
displayName: 'Get Execution',
|
|
13
|
+
description: "Gets AI Agent's execution details.",
|
|
14
|
+
props: {
|
|
15
|
+
jobId: pieces_framework_1.Property.ShortText({
|
|
16
|
+
displayName: 'Agent Executor Job ID',
|
|
17
|
+
required: true,
|
|
18
|
+
}),
|
|
19
|
+
},
|
|
20
|
+
run(context) {
|
|
21
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
23
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
24
|
+
url: constants_1.BASE_URL + `/executions/${context.propsValue.jobId}/`,
|
|
25
|
+
authentication: {
|
|
26
|
+
type: pieces_common_1.AuthenticationType.BEARER_TOKEN,
|
|
27
|
+
token: context.auth,
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
return response.body;
|
|
31
|
+
});
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
//# sourceMappingURL=get-execution.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-execution.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/swarmnode/src/lib/actions/get-execution.ts"],"names":[],"mappings":";;;;AAAA,kEAAqE;AACrE,yCAA+C;AAC/C,4DAIkC;AAClC,mDAA+C;AAElC,QAAA,kBAAkB,GAAG,IAAA,+BAAY,EAAC;IAC7C,IAAI,EAAE,eAAe;IACrB,IAAI,EAAE,oBAAa;IACnB,WAAW,EAAE,eAAe;IAC5B,WAAW,EAAE,oCAAoC;IACjD,KAAK,EAAE;QACL,KAAK,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACxB,WAAW,EAAE,uBAAuB;YACpC,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAC5C,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,GAAG,EAAE,oBAAQ,GAAG,eAAe,OAAO,CAAC,UAAU,CAAC,KAAK,GAAG;gBAC1D,cAAc,EAAE;oBACd,IAAI,EAAE,kCAAkB,CAAC,YAAY;oBACrC,KAAK,EAAE,OAAO,CAAC,IAAc;iBAC9B;aACF,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const swarmnodeAuth: import("@taskmagic/pieces-framework").SecretTextProperty<true>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.swarmnodeAuth = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@taskmagic/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@taskmagic/pieces-common");
|
|
7
|
+
const constants_1 = require("./constants");
|
|
8
|
+
exports.swarmnodeAuth = pieces_framework_1.PieceAuth.SecretText({
|
|
9
|
+
displayName: 'API Key',
|
|
10
|
+
required: true,
|
|
11
|
+
description: `You can obtain your API key from [Settings](https://app.swarmnode.ai/settings/api-keys/).`,
|
|
12
|
+
validate: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
13
|
+
try {
|
|
14
|
+
yield pieces_common_1.httpClient.sendRequest({
|
|
15
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
16
|
+
url: constants_1.BASE_URL + '/agents/',
|
|
17
|
+
authentication: {
|
|
18
|
+
type: pieces_common_1.AuthenticationType.BEARER_TOKEN,
|
|
19
|
+
token: auth,
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
return {
|
|
23
|
+
valid: true,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
catch (_b) {
|
|
27
|
+
return {
|
|
28
|
+
valid: false,
|
|
29
|
+
error: 'Invalid API Key.',
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
}),
|
|
33
|
+
});
|
|
34
|
+
//# sourceMappingURL=auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/swarmnode/src/lib/common/auth.ts"],"names":[],"mappings":";;;;AAAA,kEAAwD;AACxD,4DAIkC;AAClC,2CAAuC;AAE1B,QAAA,aAAa,GAAG,4BAAS,CAAC,UAAU,CAAC;IAChD,WAAW,EAAE,SAAS;IACtB,QAAQ,EAAE,IAAI;IACd,WAAW,EAAE,2FAA2F;IACxG,QAAQ,EAAE,KAAiB,EAAE,oDAAZ,EAAE,IAAI,EAAE;QACvB,IAAI,CAAC;YACH,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAC3B,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,GAAG,EAAE,oBAAQ,GAAG,UAAU;gBAC1B,cAAc,EAAE;oBACd,IAAI,EAAE,kCAAkB,CAAC,YAAY;oBACrC,KAAK,EAAE,IAAc;iBACtB;aACF,CAAC,CAAC;YAEH,OAAO;gBACL,KAAK,EAAE,IAAI;aACZ,CAAC;QACJ,CAAC;QAAC,WAAM,CAAC;YACP,OAAO;gBACL,KAAK,EAAE,KAAK;gBACZ,KAAK,EAAE,kBAAkB;aAC1B,CAAC;QACJ,CAAC;IACH,CAAC,CAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const BASE_URL = "https://api.swarmnode.ai/v1";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/swarmnode/src/lib/common/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,QAAQ,GAAG,6BAA6B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const agentIdDropdown: import("@taskmagic/pieces-framework").DropdownProperty<string, true>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.agentIdDropdown = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@taskmagic/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@taskmagic/pieces-common");
|
|
7
|
+
const constants_1 = require("./constants");
|
|
8
|
+
exports.agentIdDropdown = pieces_framework_1.Property.Dropdown({
|
|
9
|
+
displayName: 'Agent',
|
|
10
|
+
refreshers: [],
|
|
11
|
+
required: true,
|
|
12
|
+
options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
13
|
+
if (!auth) {
|
|
14
|
+
return {
|
|
15
|
+
disabled: true,
|
|
16
|
+
options: [],
|
|
17
|
+
placeholder: 'Please authenticate first',
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
21
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
22
|
+
url: constants_1.BASE_URL + '/agents/',
|
|
23
|
+
authentication: {
|
|
24
|
+
type: pieces_common_1.AuthenticationType.BEARER_TOKEN,
|
|
25
|
+
token: auth,
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
return {
|
|
29
|
+
disabled: false,
|
|
30
|
+
options: response.body.results.map((agent) => ({
|
|
31
|
+
label: agent.name,
|
|
32
|
+
value: agent.id,
|
|
33
|
+
})),
|
|
34
|
+
};
|
|
35
|
+
}),
|
|
36
|
+
});
|
|
37
|
+
//# sourceMappingURL=props.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"props.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/swarmnode/src/lib/common/props.ts"],"names":[],"mappings":";;;;AAAA,kEAAuD;AACvD,4DAIkC;AAClC,2CAAuC;AAG1B,QAAA,eAAe,GAAG,2BAAQ,CAAC,QAAQ,CAAC;IAC/C,WAAW,EAAE,OAAO;IACpB,UAAU,EAAE,EAAE;IACd,QAAQ,EAAE,IAAI;IACd,OAAO,EAAE,KAAiB,EAAE,oDAAZ,EAAE,IAAI,EAAE;QACtB,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,OAAO;gBACL,QAAQ,EAAE,IAAI;gBACd,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE,2BAA2B;aACzC,CAAC;QACJ,CAAC;QAED,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAoB;YAC/D,MAAM,EAAE,0BAAU,CAAC,GAAG;YACtB,GAAG,EAAE,oBAAQ,GAAG,UAAU;YAC1B,cAAc,EAAE;gBACd,IAAI,EAAE,kCAAkB,CAAC,YAAY;gBACrC,KAAK,EAAE,IAAc;aACtB;SACF,CAAC,CAAC;QAEH,OAAO;YACL,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;gBAC7C,KAAK,EAAE,KAAK,CAAC,IAAI;gBACjB,KAAK,EAAE,KAAK,CAAC,EAAE;aAChB,CAAC,CAAC;SACJ,CAAC;IACJ,CAAC,CAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
type Agent = {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
};
|
|
5
|
+
export type ListAgentResponse = {
|
|
6
|
+
results: Array<Agent>;
|
|
7
|
+
};
|
|
8
|
+
export type Execution = {
|
|
9
|
+
id: string;
|
|
10
|
+
agent_id: string;
|
|
11
|
+
status: 'success' | 'in_progress' | 'failure' | 'termination';
|
|
12
|
+
};
|
|
13
|
+
export type ListExecutionResponse = {
|
|
14
|
+
results: Array<Execution>;
|
|
15
|
+
};
|
|
16
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/swarmnode/src/lib/common/types.ts"],"names":[],"mappings":""}
|