@mcoda/core 0.1.4 → 0.1.7
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
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mcoda/core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"description": "Core services and APIs for the mcoda CLI.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -13,11 +13,6 @@
|
|
|
13
13
|
"CHANGELOG.md",
|
|
14
14
|
"LICENSE"
|
|
15
15
|
],
|
|
16
|
-
"scripts": {
|
|
17
|
-
"build": "tsc -p tsconfig.json",
|
|
18
|
-
"lint": "echo \"lint not configured\"",
|
|
19
|
-
"test": "pnpm run build && node ../../scripts/run-node-tests.js dist"
|
|
20
|
-
},
|
|
21
16
|
"engines": {
|
|
22
17
|
"node": ">=20"
|
|
23
18
|
},
|
|
@@ -36,10 +31,15 @@
|
|
|
36
31
|
},
|
|
37
32
|
"dependencies": {
|
|
38
33
|
"@apidevtools/swagger-parser": "^10.1.0",
|
|
39
|
-
"
|
|
40
|
-
"@mcoda/
|
|
41
|
-
"@mcoda/
|
|
42
|
-
"@mcoda/
|
|
43
|
-
"
|
|
34
|
+
"yaml": "^2.4.2",
|
|
35
|
+
"@mcoda/shared": "0.1.7",
|
|
36
|
+
"@mcoda/db": "0.1.7",
|
|
37
|
+
"@mcoda/agents": "0.1.7",
|
|
38
|
+
"@mcoda/integrations": "0.1.7"
|
|
39
|
+
},
|
|
40
|
+
"scripts": {
|
|
41
|
+
"build": "tsc -p tsconfig.json",
|
|
42
|
+
"lint": "echo \"lint not configured\"",
|
|
43
|
+
"test": "pnpm run build && node ../../scripts/run-node-tests.js dist"
|
|
44
44
|
}
|
|
45
|
-
}
|
|
45
|
+
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { Agent, RoutingDefaults, RoutingDefaultsUpdate, RoutingPreview } from "@mcoda/shared";
|
|
2
|
-
export interface RoutingPreviewRequest {
|
|
3
|
-
workspaceId: string;
|
|
4
|
-
commandName: string;
|
|
5
|
-
agentOverride?: string;
|
|
6
|
-
taskType?: string;
|
|
7
|
-
projectKey?: string;
|
|
8
|
-
requiredCapabilities?: string[];
|
|
9
|
-
}
|
|
10
|
-
export declare class RoutingApiClient {
|
|
11
|
-
private baseUrl;
|
|
12
|
-
constructor(baseUrl: string);
|
|
13
|
-
static create(): RoutingApiClient;
|
|
14
|
-
private fetchJson;
|
|
15
|
-
private putJson;
|
|
16
|
-
private postJson;
|
|
17
|
-
getWorkspaceDefaults(workspaceId: string): Promise<RoutingDefaults | undefined>;
|
|
18
|
-
updateWorkspaceDefaults(workspaceId: string, update: RoutingDefaultsUpdate): Promise<RoutingDefaults | undefined>;
|
|
19
|
-
preview(request: RoutingPreviewRequest): Promise<RoutingPreview | undefined>;
|
|
20
|
-
listAgents(): Promise<Agent[] | undefined>;
|
|
21
|
-
getAgent(idOrSlug: string): Promise<Agent | undefined>;
|
|
22
|
-
}
|
|
23
|
-
//# sourceMappingURL=RoutingApiClient.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RoutingApiClient.d.ts","sourceRoot":"","sources":["../../../src/services/agents/RoutingApiClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAM9F,MAAM,WAAW,qBAAqB;IACpC,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;CACjC;AAED,qBAAa,gBAAgB;IACf,OAAO,CAAC,OAAO;gBAAP,OAAO,EAAE,MAAM;IAEnC,MAAM,CAAC,MAAM,IAAI,gBAAgB;YAKnB,SAAS;YAQT,OAAO;YAUP,QAAQ;IAUhB,oBAAoB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,GAAG,SAAS,CAAC;IAI/E,uBAAuB,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAAC,eAAe,GAAG,SAAS,CAAC;IAIjH,OAAO,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC;IAW5E,UAAU,IAAI,OAAO,CAAC,KAAK,EAAE,GAAG,SAAS,CAAC;IAI1C,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,GAAG,SAAS,CAAC;CAG7D"}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
const pickBaseUrl = () => {
|
|
2
|
-
return process.env.MCODA_ROUTING_API_URL ?? process.env.MCODA_API_BASE_URL;
|
|
3
|
-
};
|
|
4
|
-
export class RoutingApiClient {
|
|
5
|
-
constructor(baseUrl) {
|
|
6
|
-
this.baseUrl = baseUrl;
|
|
7
|
-
}
|
|
8
|
-
static create() {
|
|
9
|
-
const baseUrl = pickBaseUrl() ?? "http://localhost";
|
|
10
|
-
return new RoutingApiClient(baseUrl);
|
|
11
|
-
}
|
|
12
|
-
async fetchJson(path) {
|
|
13
|
-
const resp = await fetch(new URL(path, this.baseUrl), {
|
|
14
|
-
headers: { accept: "application/json" },
|
|
15
|
-
});
|
|
16
|
-
if (!resp.ok)
|
|
17
|
-
return undefined;
|
|
18
|
-
return (await resp.json());
|
|
19
|
-
}
|
|
20
|
-
async putJson(path, body) {
|
|
21
|
-
const resp = await fetch(new URL(path, this.baseUrl), {
|
|
22
|
-
method: "PUT",
|
|
23
|
-
headers: { "content-type": "application/json", accept: "application/json" },
|
|
24
|
-
body: JSON.stringify(body),
|
|
25
|
-
});
|
|
26
|
-
if (!resp.ok)
|
|
27
|
-
return undefined;
|
|
28
|
-
return (await resp.json());
|
|
29
|
-
}
|
|
30
|
-
async postJson(path, body) {
|
|
31
|
-
const resp = await fetch(new URL(path, this.baseUrl), {
|
|
32
|
-
method: "POST",
|
|
33
|
-
headers: { "content-type": "application/json", accept: "application/json" },
|
|
34
|
-
body: JSON.stringify(body),
|
|
35
|
-
});
|
|
36
|
-
if (!resp.ok)
|
|
37
|
-
return undefined;
|
|
38
|
-
return (await resp.json());
|
|
39
|
-
}
|
|
40
|
-
async getWorkspaceDefaults(workspaceId) {
|
|
41
|
-
return this.fetchJson(`/workspaces/${encodeURIComponent(workspaceId)}/defaults`);
|
|
42
|
-
}
|
|
43
|
-
async updateWorkspaceDefaults(workspaceId, update) {
|
|
44
|
-
return this.putJson(`/workspaces/${encodeURIComponent(workspaceId)}/defaults`, update);
|
|
45
|
-
}
|
|
46
|
-
async preview(request) {
|
|
47
|
-
return this.postJson("/routing/preview", {
|
|
48
|
-
workspaceId: request.workspaceId,
|
|
49
|
-
commandName: request.commandName,
|
|
50
|
-
agentOverride: request.agentOverride,
|
|
51
|
-
taskType: request.taskType,
|
|
52
|
-
projectKey: request.projectKey,
|
|
53
|
-
requiredCapabilities: request.requiredCapabilities,
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
async listAgents() {
|
|
57
|
-
return this.fetchJson("/agents");
|
|
58
|
-
}
|
|
59
|
-
async getAgent(idOrSlug) {
|
|
60
|
-
return this.fetchJson(`/agents/${encodeURIComponent(idOrSlug)}`);
|
|
61
|
-
}
|
|
62
|
-
}
|