New:Socket for Asana Is Now Available.Learn more
Get Started

@mcoda/core

Package Overview
Dependencies
Maintainers
1
Versions
109
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mcoda/core - npm Package Compare versions

Comparing version
0.1.127
to
0.1.128
+23
dist/services/agents/RoutingApiClient.d.ts
import { Agent, RoutingDefaults, RoutingDefaultsUpdate, RoutingPreview } from "@mcoda/shared";
export interface RoutingPreviewRequest {
workspaceId: string;
commandName: string;
agentOverride?: string;
taskType?: string;
projectKey?: string;
requiredCapabilities?: string[];
}
export declare class RoutingApiClient {
private baseUrl;
constructor(baseUrl: string);
static create(): RoutingApiClient;
private fetchJson;
private putJson;
private postJson;
getWorkspaceDefaults(workspaceId: string): Promise<RoutingDefaults | undefined>;
updateWorkspaceDefaults(workspaceId: string, update: RoutingDefaultsUpdate): Promise<RoutingDefaults | undefined>;
preview(request: RoutingPreviewRequest): Promise<RoutingPreview | undefined>;
listAgents(): Promise<Agent[] | undefined>;
getAgent(idOrSlug: string): Promise<Agent | undefined>;
}
//# sourceMappingURL=RoutingApiClient.d.ts.map
{"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"}
const pickBaseUrl = () => {
return process.env.MCODA_ROUTING_API_URL ?? process.env.MCODA_API_BASE_URL;
};
export class RoutingApiClient {
constructor(baseUrl) {
this.baseUrl = baseUrl;
}
static create() {
const baseUrl = pickBaseUrl() ?? "http://localhost";
return new RoutingApiClient(baseUrl);
}
async fetchJson(path) {
const resp = await fetch(new URL(path, this.baseUrl), {
headers: { accept: "application/json" },
});
if (!resp.ok)
return undefined;
return (await resp.json());
}
async putJson(path, body) {
const resp = await fetch(new URL(path, this.baseUrl), {
method: "PUT",
headers: { "content-type": "application/json", accept: "application/json" },
body: JSON.stringify(body),
});
if (!resp.ok)
return undefined;
return (await resp.json());
}
async postJson(path, body) {
const resp = await fetch(new URL(path, this.baseUrl), {
method: "POST",
headers: { "content-type": "application/json", accept: "application/json" },
body: JSON.stringify(body),
});
if (!resp.ok)
return undefined;
return (await resp.json());
}
async getWorkspaceDefaults(workspaceId) {
return this.fetchJson(`/workspaces/${encodeURIComponent(workspaceId)}/defaults`);
}
async updateWorkspaceDefaults(workspaceId, update) {
return this.putJson(`/workspaces/${encodeURIComponent(workspaceId)}/defaults`, update);
}
async preview(request) {
return this.postJson("/routing/preview", {
workspaceId: request.workspaceId,
commandName: request.commandName,
agentOverride: request.agentOverride,
taskType: request.taskType,
projectKey: request.projectKey,
requiredCapabilities: request.requiredCapabilities,
});
}
async listAgents() {
return this.fetchJson("/agents");
}
async getAgent(idOrSlug) {
return this.fetchJson(`/agents/${encodeURIComponent(idOrSlug)}`);
}
}
+6
-6
{
"name": "@mcoda/core",
"version": "0.1.127",
"version": "0.1.128",
"description": "Core services and APIs for the mcoda CLI.",

@@ -35,7 +35,7 @@ "type": "module",

"yaml": "^2.4.2",
"@mcoda/agents": "0.1.127",
"@mcoda/db": "0.1.127",
"@mcoda/integrations": "0.1.127",
"@mcoda/generators": "0.1.127",
"@mcoda/shared": "0.1.127"
"@mcoda/agents": "0.1.128",
"@mcoda/db": "0.1.128",
"@mcoda/integrations": "0.1.128",
"@mcoda/generators": "0.1.128",
"@mcoda/shared": "0.1.128"
},

@@ -42,0 +42,0 @@ "scripts": {