@mcoda/mswarm 0.1.107 → 0.1.109
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 +17 -0
- package/dist/codali-executor.d.ts.map +1 -1
- package/dist/codali-executor.js +17 -3
- package/dist/codali-executor.js.map +1 -1
- package/dist/runtime.d.ts +16 -5
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +292 -36
- package/dist/runtime.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +4 -0
- package/dist/server.js.map +1 -1
- package/dist/vendor/codali/agents/AgentInventory.d.ts +56 -0
- package/dist/vendor/codali/agents/AgentInventory.d.ts.map +1 -0
- package/dist/vendor/codali/agents/AgentInventory.js +131 -0
- package/dist/vendor/codali/agents/RoleResolution.d.ts +49 -0
- package/dist/vendor/codali/agents/RoleResolution.d.ts.map +1 -0
- package/dist/vendor/codali/agents/RoleResolution.js +166 -0
- package/dist/vendor/codali/api/ChatCompletionsAdapter.d.ts +76 -0
- package/dist/vendor/codali/api/ChatCompletionsAdapter.d.ts.map +1 -0
- package/dist/vendor/codali/api/ChatCompletionsAdapter.js +54 -0
- package/dist/vendor/codali/api/CodaliApi.d.ts +78 -0
- package/dist/vendor/codali/api/CodaliApi.d.ts.map +1 -0
- package/dist/vendor/codali/api/CodaliApi.js +273 -0
- package/dist/vendor/codali/api/CodaliServer.d.ts +42 -0
- package/dist/vendor/codali/api/CodaliServer.d.ts.map +1 -0
- package/dist/vendor/codali/api/CodaliServer.js +118 -0
- package/dist/vendor/codali/cli/AskCommand.d.ts +66 -0
- package/dist/vendor/codali/cli/AskCommand.d.ts.map +1 -0
- package/dist/vendor/codali/cli/AskCommand.js +536 -0
- package/dist/vendor/codali/cli/AuthCommand.d.ts +19 -0
- package/dist/vendor/codali/cli/AuthCommand.d.ts.map +1 -0
- package/dist/vendor/codali/cli/AuthCommand.js +161 -0
- package/dist/vendor/codali/cli/ServeCommand.d.ts +5 -0
- package/dist/vendor/codali/cli/ServeCommand.d.ts.map +1 -0
- package/dist/vendor/codali/cli/ServeCommand.js +87 -0
- package/dist/vendor/codali/cli/ToolsCommand.d.ts +22 -0
- package/dist/vendor/codali/cli/ToolsCommand.d.ts.map +1 -0
- package/dist/vendor/codali/cli/ToolsCommand.js +208 -0
- package/dist/vendor/codali/cli.d.ts.map +1 -1
- package/dist/vendor/codali/cli.js +29 -1
- package/dist/vendor/codali/connectors/http/HttpToolDefinition.d.ts +74 -0
- package/dist/vendor/codali/connectors/http/HttpToolDefinition.d.ts.map +1 -0
- package/dist/vendor/codali/connectors/http/HttpToolDefinition.js +190 -0
- package/dist/vendor/codali/connectors/http/HttpToolSource.d.ts +18 -0
- package/dist/vendor/codali/connectors/http/HttpToolSource.d.ts.map +1 -0
- package/dist/vendor/codali/connectors/http/HttpToolSource.js +29 -0
- package/dist/vendor/codali/connectors/mcp/McpClient.d.ts +132 -0
- package/dist/vendor/codali/connectors/mcp/McpClient.d.ts.map +1 -0
- package/dist/vendor/codali/connectors/mcp/McpClient.js +215 -0
- package/dist/vendor/codali/connectors/mcp/McpServerRegistry.d.ts +75 -0
- package/dist/vendor/codali/connectors/mcp/McpServerRegistry.d.ts.map +1 -0
- package/dist/vendor/codali/connectors/mcp/McpServerRegistry.js +180 -0
- package/dist/vendor/codali/connectors/mcp/McpToolAdapter.d.ts +48 -0
- package/dist/vendor/codali/connectors/mcp/McpToolAdapter.d.ts.map +1 -0
- package/dist/vendor/codali/connectors/mcp/McpToolAdapter.js +101 -0
- package/dist/vendor/codali/connectors/mcp/McpToolSource.d.ts +27 -0
- package/dist/vendor/codali/connectors/mcp/McpToolSource.d.ts.map +1 -0
- package/dist/vendor/codali/connectors/mcp/McpToolSource.js +33 -0
- package/dist/vendor/codali/connectors/media/ImageGenerationTool.d.ts +43 -0
- package/dist/vendor/codali/connectors/media/ImageGenerationTool.d.ts.map +1 -0
- package/dist/vendor/codali/connectors/media/ImageGenerationTool.js +122 -0
- package/dist/vendor/codali/connectors/oauth/DeviceCodeAuth.d.ts +74 -0
- package/dist/vendor/codali/connectors/oauth/DeviceCodeAuth.d.ts.map +1 -0
- package/dist/vendor/codali/connectors/oauth/DeviceCodeAuth.js +153 -0
- package/dist/vendor/codali/docdex/DocdexClient.d.ts +2 -0
- package/dist/vendor/codali/docdex/DocdexClient.d.ts.map +1 -1
- package/dist/vendor/codali/docdex/DocdexClient.js +4 -0
- package/dist/vendor/codali/gateway/CodaliGateway.d.ts +51 -3
- package/dist/vendor/codali/gateway/CodaliGateway.d.ts.map +1 -1
- package/dist/vendor/codali/gateway/CodaliGateway.js +226 -2
- package/dist/vendor/codali/gateway/CodaliGatewayTypes.d.ts +34 -0
- package/dist/vendor/codali/gateway/CodaliGatewayTypes.d.ts.map +1 -1
- package/dist/vendor/codali/gateway/EvidenceNormalizer.d.ts.map +1 -1
- package/dist/vendor/codali/gateway/EvidenceNormalizer.js +90 -1
- package/dist/vendor/codali/gateway/Finalizer.d.ts +50 -0
- package/dist/vendor/codali/gateway/Finalizer.d.ts.map +1 -0
- package/dist/vendor/codali/gateway/Finalizer.js +79 -0
- package/dist/vendor/codali/gateway/GatewayPlanner.d.ts +13 -0
- package/dist/vendor/codali/gateway/GatewayPlanner.d.ts.map +1 -1
- package/dist/vendor/codali/gateway/GatewayPlanner.js +81 -16
- package/dist/vendor/codali/gateway/GatewayStateMachine.d.ts.map +1 -1
- package/dist/vendor/codali/gateway/GatewayStateMachine.js +6 -0
- package/dist/vendor/codali/gateway/GatewayTracer.d.ts +93 -0
- package/dist/vendor/codali/gateway/GatewayTracer.d.ts.map +1 -0
- package/dist/vendor/codali/gateway/GatewayTracer.js +214 -0
- package/dist/vendor/codali/gateway/LocalGatewayProvider.d.ts +46 -0
- package/dist/vendor/codali/gateway/LocalGatewayProvider.d.ts.map +1 -0
- package/dist/vendor/codali/gateway/LocalGatewayProvider.js +161 -0
- package/dist/vendor/codali/gateway/LocalGatewayTaskRunner.d.ts +79 -0
- package/dist/vendor/codali/gateway/LocalGatewayTaskRunner.d.ts.map +1 -0
- package/dist/vendor/codali/gateway/LocalGatewayTaskRunner.js +354 -0
- package/dist/vendor/codali/gateway/RelevanceJudge.d.ts +14 -0
- package/dist/vendor/codali/gateway/RelevanceJudge.d.ts.map +1 -0
- package/dist/vendor/codali/gateway/RelevanceJudge.js +87 -0
- package/dist/vendor/codali/gateway/ResponseSchema.d.ts +32 -0
- package/dist/vendor/codali/gateway/ResponseSchema.d.ts.map +1 -0
- package/dist/vendor/codali/gateway/ResponseSchema.js +120 -0
- package/dist/vendor/codali/gateway/TemporalContext.d.ts +36 -0
- package/dist/vendor/codali/gateway/TemporalContext.d.ts.map +1 -0
- package/dist/vendor/codali/gateway/TemporalContext.js +115 -0
- package/dist/vendor/codali/gateway/ToolCapabilityCompiler.d.ts +5 -0
- package/dist/vendor/codali/gateway/ToolCapabilityCompiler.d.ts.map +1 -1
- package/dist/vendor/codali/gateway/ToolCapabilityCompiler.js +27 -2
- package/dist/vendor/codali/gateway/ToolDescriptorSource.d.ts +6 -0
- package/dist/vendor/codali/gateway/ToolDescriptorSource.d.ts.map +1 -0
- package/dist/vendor/codali/gateway/ToolDescriptorSource.js +30 -0
- package/dist/vendor/codali/gateway/ToolExposure.d.ts +36 -0
- package/dist/vendor/codali/gateway/ToolExposure.d.ts.map +1 -0
- package/dist/vendor/codali/gateway/ToolExposure.js +154 -0
- package/dist/vendor/codali/index.d.ts +57 -0
- package/dist/vendor/codali/index.d.ts.map +1 -1
- package/dist/vendor/codali/index.js +45 -0
- package/dist/vendor/codali/providers/ClaudeCliProvider.d.ts +2 -0
- package/dist/vendor/codali/providers/ClaudeCliProvider.d.ts.map +1 -1
- package/dist/vendor/codali/providers/ClaudeCliProvider.js +2 -0
- package/dist/vendor/codali/providers/CodexCliProvider.d.ts +2 -0
- package/dist/vendor/codali/providers/CodexCliProvider.d.ts.map +1 -1
- package/dist/vendor/codali/providers/CodexCliProvider.js +2 -0
- package/dist/vendor/codali/providers/MswarmWorkerProvider.d.ts +2 -0
- package/dist/vendor/codali/providers/MswarmWorkerProvider.d.ts.map +1 -1
- package/dist/vendor/codali/providers/MswarmWorkerProvider.js +2 -0
- package/dist/vendor/codali/providers/OllamaRemoteProvider.d.ts +2 -0
- package/dist/vendor/codali/providers/OllamaRemoteProvider.d.ts.map +1 -1
- package/dist/vendor/codali/providers/OllamaRemoteProvider.js +2 -0
- package/dist/vendor/codali/providers/OpenAiCompatibleProvider.d.ts +2 -0
- package/dist/vendor/codali/providers/OpenAiCompatibleProvider.d.ts.map +1 -1
- package/dist/vendor/codali/providers/OpenAiCompatibleProvider.js +2 -0
- package/dist/vendor/codali/providers/ProviderTypes.d.ts +13 -0
- package/dist/vendor/codali/providers/ProviderTypes.d.ts.map +1 -1
- package/dist/vendor/codali/providers/ProviderTypes.js +1 -1
- package/dist/vendor/codali/runcontext/CredentialFile.d.ts +12 -0
- package/dist/vendor/codali/runcontext/CredentialFile.d.ts.map +1 -0
- package/dist/vendor/codali/runcontext/CredentialFile.js +81 -0
- package/dist/vendor/codali/runcontext/RunContextResolver.d.ts +126 -0
- package/dist/vendor/codali/runcontext/RunContextResolver.d.ts.map +1 -0
- package/dist/vendor/codali/runcontext/RunContextResolver.js +389 -0
- package/dist/vendor/codali/storage/CodaliDatasetPrivacyEngine.d.ts +1 -1
- package/dist/vendor/codali/storage/CodaliDatasetPrivacyEngine.d.ts.map +1 -1
- package/dist/vendor/codali/storage/CodaliDatasetPrivacyEngine.js +12 -0
- package/dist/vendor/codali/tools/ToolRegistry.d.ts +14 -1
- package/dist/vendor/codali/tools/ToolRegistry.d.ts.map +1 -1
- package/dist/vendor/codali/tools/ToolRegistry.js +38 -1
- package/dist/vendor/codali/tools/ToolTypes.d.ts +35 -0
- package/dist/vendor/codali/tools/ToolTypes.d.ts.map +1 -1
- package/dist/vendor/codali/tools/ToolTypes.js +21 -0
- package/dist/vendor/codali/tools/TruncateResult.d.ts +29 -0
- package/dist/vendor/codali/tools/TruncateResult.d.ts.map +1 -0
- package/dist/vendor/codali/tools/TruncateResult.js +91 -0
- package/dist/vendor/codali/tools/diff/DiffTool.d.ts.map +1 -1
- package/dist/vendor/codali/tools/diff/DiffTool.js +2 -0
- package/dist/vendor/codali/tools/docdex/DocdexTools.d.ts +21 -1
- package/dist/vendor/codali/tools/docdex/DocdexTools.d.ts.map +1 -1
- package/dist/vendor/codali/tools/docdex/DocdexTools.js +108 -16
- package/dist/vendor/codali/tools/filesystem/FileTools.d.ts.map +1 -1
- package/dist/vendor/codali/tools/filesystem/FileTools.js +8 -0
- package/dist/vendor/codali/tools/search/SearchTool.d.ts.map +1 -1
- package/dist/vendor/codali/tools/search/SearchTool.js +3 -1
- package/dist/vendor/codali/tools/shell/ShellTool.d.ts.map +1 -1
- package/dist/vendor/codali/tools/shell/ShellTool.js +2 -0
- package/package.json +3 -3
- package/scripts/stable-diffusion-cpp-auth-guard.py +475 -0
- package/scripts/stable-diffusion-cpp-openai-server.py +44 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type Server } from "node:http";
|
|
2
|
+
import { runCodali } from "./CodaliApi.js";
|
|
3
|
+
import type { RunContext, RunContextTenant } from "../runcontext/RunContextResolver.js";
|
|
4
|
+
/**
|
|
5
|
+
* Local HTTP surface for Codali.
|
|
6
|
+
*
|
|
7
|
+
* Exposes the same result contract the CLI produces, so a product integrating
|
|
8
|
+
* over HTTP and an engineer debugging on a terminal are exercising one
|
|
9
|
+
* implementation.
|
|
10
|
+
*
|
|
11
|
+
* ## Tenant identity
|
|
12
|
+
*
|
|
13
|
+
* Tenant is derived from the **authenticated caller**, never read from a
|
|
14
|
+
* request body or a client-supplied header. A tenant id in a body field is an
|
|
15
|
+
* assertion by an untrusted party; honouring it would let any caller read
|
|
16
|
+
* another tenant's tools and credentials by editing one JSON value.
|
|
17
|
+
*/
|
|
18
|
+
export interface CodaliServerPrincipal {
|
|
19
|
+
tenant: RunContextTenant;
|
|
20
|
+
/** Tools, credentials and limits this principal's tenant may use. */
|
|
21
|
+
runContext?: RunContext;
|
|
22
|
+
requesterId?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface CodaliServerOptions {
|
|
25
|
+
port?: number;
|
|
26
|
+
host?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Resolves an API key to a principal. Returning undefined rejects the
|
|
29
|
+
* request. There is no anonymous mode: an unauthenticated caller has no
|
|
30
|
+
* tenant, and a run without a tenant scope has no business reaching
|
|
31
|
+
* connectors.
|
|
32
|
+
*/
|
|
33
|
+
authenticate: (apiKey: string | undefined) => Promise<CodaliServerPrincipal | undefined>;
|
|
34
|
+
workspaceRoot?: string;
|
|
35
|
+
run?: typeof runCodali;
|
|
36
|
+
}
|
|
37
|
+
export declare const createCodaliServer: (options: CodaliServerOptions) => Server;
|
|
38
|
+
export declare const startCodaliServer: (options: CodaliServerOptions) => Promise<{
|
|
39
|
+
server: Server;
|
|
40
|
+
port: number;
|
|
41
|
+
}>;
|
|
42
|
+
//# sourceMappingURL=CodaliServer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CodaliServer.d.ts","sourceRoot":"","sources":["../../src/api/CodaliServer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsC,KAAK,MAAM,EAAuB,MAAM,WAAW,CAAC;AAEjG,OAAO,EAAE,SAAS,EAAsB,MAAM,gBAAgB,CAAC;AAC/D,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AAExF;;;;;;;;;;;;;GAaG;AAEH,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,gBAAgB,CAAC;IACzB,qEAAqE;IACrE,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,KAAK,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC,CAAC;IACzF,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,GAAG,CAAC,EAAE,OAAO,SAAS,CAAC;CACxB;AAuDD,eAAO,MAAM,kBAAkB,GAAI,SAAS,mBAAmB,KAAG,MAyEjE,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAC5B,SAAS,mBAAmB,KAC3B,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAW1C,CAAC"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { createServer } from "node:http";
|
|
2
|
+
import { handleChatCompletion } from "./ChatCompletionsAdapter.js";
|
|
3
|
+
import { runCodali } from "./CodaliApi.js";
|
|
4
|
+
const readBody = async (request) => {
|
|
5
|
+
const chunks = [];
|
|
6
|
+
for await (const chunk of request)
|
|
7
|
+
chunks.push(chunk);
|
|
8
|
+
if (chunks.length === 0)
|
|
9
|
+
return undefined;
|
|
10
|
+
try {
|
|
11
|
+
return JSON.parse(Buffer.concat(chunks).toString("utf8"));
|
|
12
|
+
}
|
|
13
|
+
catch {
|
|
14
|
+
return undefined;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
const send = (response, status, payload) => {
|
|
18
|
+
const body = JSON.stringify(payload);
|
|
19
|
+
response.writeHead(status, {
|
|
20
|
+
"Content-Type": "application/json",
|
|
21
|
+
"Content-Length": Buffer.byteLength(body),
|
|
22
|
+
});
|
|
23
|
+
response.end(body);
|
|
24
|
+
};
|
|
25
|
+
const readApiKey = (request) => {
|
|
26
|
+
const header = request.headers.authorization;
|
|
27
|
+
if (typeof header === "string" && header.toLowerCase().startsWith("bearer ")) {
|
|
28
|
+
return header.slice(7).trim();
|
|
29
|
+
}
|
|
30
|
+
const apiKey = request.headers["x-api-key"];
|
|
31
|
+
return typeof apiKey === "string" ? apiKey.trim() : undefined;
|
|
32
|
+
};
|
|
33
|
+
const isRecord = (value) => Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
34
|
+
/**
|
|
35
|
+
* Strips any caller-supplied tenant or run context and substitutes what the
|
|
36
|
+
* authenticated principal is actually entitled to. This is the single point
|
|
37
|
+
* where cross-tenant access is prevented, so it is deliberately unconditional
|
|
38
|
+
* rather than a validation the caller could satisfy.
|
|
39
|
+
*/
|
|
40
|
+
const applyPrincipalScope = (payload, principal) => ({
|
|
41
|
+
...payload,
|
|
42
|
+
runContext: {
|
|
43
|
+
...(principal.runContext ?? {}),
|
|
44
|
+
tenant: principal.tenant,
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
export const createCodaliServer = (options) => {
|
|
48
|
+
const run = options.run ?? runCodali;
|
|
49
|
+
return createServer(async (request, response) => {
|
|
50
|
+
const url = new URL(request.url ?? "/", "http://localhost");
|
|
51
|
+
if (request.method === "GET" && url.pathname === "/healthz") {
|
|
52
|
+
send(response, 200, { ok: true });
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
if (request.method !== "POST") {
|
|
56
|
+
send(response, 405, { error: { code: "method_not_allowed" } });
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
const principal = await options.authenticate(readApiKey(request));
|
|
60
|
+
if (!principal) {
|
|
61
|
+
send(response, 401, { error: { code: "unauthorized" } });
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
const body = await readBody(request);
|
|
65
|
+
if (!isRecord(body)) {
|
|
66
|
+
send(response, 400, { error: { code: "invalid_request_body" } });
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
try {
|
|
70
|
+
if (url.pathname === "/v1/chat/completions") {
|
|
71
|
+
const chatRequest = body;
|
|
72
|
+
const scoped = {
|
|
73
|
+
...chatRequest,
|
|
74
|
+
codali: {
|
|
75
|
+
...(chatRequest.codali ?? {}),
|
|
76
|
+
// Caller-supplied context is discarded, not merged.
|
|
77
|
+
runContext: {
|
|
78
|
+
...(principal.runContext ?? {}),
|
|
79
|
+
tenant: principal.tenant,
|
|
80
|
+
},
|
|
81
|
+
workspaceRoot: options.workspaceRoot ?? chatRequest.codali?.workspaceRoot,
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
send(response, 200, await handleChatCompletion(scoped, { run }));
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
if (url.pathname === "/v1/codali/run") {
|
|
88
|
+
const codaliRequest = applyPrincipalScope(body, principal);
|
|
89
|
+
send(response, 200, await run({
|
|
90
|
+
...codaliRequest,
|
|
91
|
+
workspaceRoot: options.workspaceRoot ?? codaliRequest.workspaceRoot,
|
|
92
|
+
}));
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
send(response, 404, { error: { code: "not_found" } });
|
|
96
|
+
}
|
|
97
|
+
catch (error) {
|
|
98
|
+
send(response, 500, {
|
|
99
|
+
error: {
|
|
100
|
+
code: "internal_error",
|
|
101
|
+
message: error instanceof Error ? error.message : String(error),
|
|
102
|
+
},
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
};
|
|
107
|
+
export const startCodaliServer = async (options) => {
|
|
108
|
+
const server = createCodaliServer(options);
|
|
109
|
+
const port = options.port ?? 8787;
|
|
110
|
+
await new Promise((resolve) => {
|
|
111
|
+
server.listen(port, options.host ?? "127.0.0.1", resolve);
|
|
112
|
+
});
|
|
113
|
+
const address = server.address();
|
|
114
|
+
return {
|
|
115
|
+
server,
|
|
116
|
+
port: typeof address === "object" && address ? address.port : port,
|
|
117
|
+
};
|
|
118
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { getAgentInventory } from "../agents/AgentInventory.js";
|
|
2
|
+
import { attachMcpTools } from "../connectors/mcp/McpToolSource.js";
|
|
3
|
+
import { createProviderForAssignment } from "../gateway/LocalGatewayProvider.js";
|
|
4
|
+
import { GatewayTracer } from "../gateway/GatewayTracer.js";
|
|
5
|
+
import { ToolRegistry } from "../tools/ToolRegistry.js";
|
|
6
|
+
import type { RunContext } from "../runcontext/RunContextResolver.js";
|
|
7
|
+
import type { CodaliGatewayMode, CodaliGatewayResult } from "../gateway/CodaliGatewayTypes.js";
|
|
8
|
+
import type { Provider } from "../providers/ProviderTypes.js";
|
|
9
|
+
/**
|
|
10
|
+
* `codali ask` — the terminal entry point to the orchestration gateway.
|
|
11
|
+
*
|
|
12
|
+
* Until this existed the gateway had exactly one caller (mswarm's cloud job
|
|
13
|
+
* path) and could not be exercised locally at all, which made every other
|
|
14
|
+
* improvement unverifiable.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Default budgets. Deliberately small: an orchestrator that can quietly spend
|
|
18
|
+
* fifty tool calls on one question is not one you can put in front of users.
|
|
19
|
+
*/
|
|
20
|
+
export declare const DEFAULT_MAX_ROUNDS = 3;
|
|
21
|
+
export declare const DEFAULT_MAX_TOOL_CALLS = 20;
|
|
22
|
+
export declare const DEFAULT_MAX_MODEL_CALLS = 12;
|
|
23
|
+
/**
|
|
24
|
+
* Wall-clock budget. Generous because CLI-backed agents (codex, claude,
|
|
25
|
+
* gemini) commonly take 30-90s per call, and several tasks run per question.
|
|
26
|
+
*/
|
|
27
|
+
export declare const DEFAULT_DEADLINE_MS = 600000;
|
|
28
|
+
/**
|
|
29
|
+
* Independent worker tasks executed concurrently. Bounded rather than
|
|
30
|
+
* unlimited: each task holds a model call, and a tenant's connectors have their
|
|
31
|
+
* own rate limits.
|
|
32
|
+
*/
|
|
33
|
+
export declare const DEFAULT_MAX_PARALLEL_WORKERS = 3;
|
|
34
|
+
export interface AskOptions {
|
|
35
|
+
query: string;
|
|
36
|
+
workspaceRoot: string;
|
|
37
|
+
mode: CodaliGatewayMode;
|
|
38
|
+
trace: boolean;
|
|
39
|
+
json: boolean;
|
|
40
|
+
maxRounds: number;
|
|
41
|
+
maxToolCalls: number;
|
|
42
|
+
deadlineMs: number;
|
|
43
|
+
docdexBaseUrl?: string;
|
|
44
|
+
responseSchemaPath?: string;
|
|
45
|
+
responseFormat?: "text" | "json";
|
|
46
|
+
noTools: boolean;
|
|
47
|
+
}
|
|
48
|
+
export declare const parseAskArgs: (argv: string[]) => AskOptions;
|
|
49
|
+
export interface AskDependencies {
|
|
50
|
+
loadInventory?: typeof getAgentInventory;
|
|
51
|
+
resolveRunContext?: (workspaceRoot: string) => Promise<RunContext>;
|
|
52
|
+
buildRegistry?: (options: AskOptions, context: RunContext) => ToolRegistry;
|
|
53
|
+
createProvider?: (assignment: Parameters<typeof createProviderForAssignment>[0]) => Provider;
|
|
54
|
+
attachMcp?: typeof attachMcpTools;
|
|
55
|
+
write?: (line: string) => void;
|
|
56
|
+
}
|
|
57
|
+
export interface AskOutcome {
|
|
58
|
+
result?: CodaliGatewayResult;
|
|
59
|
+
tracer: GatewayTracer;
|
|
60
|
+
exitCode: number;
|
|
61
|
+
}
|
|
62
|
+
export declare const runAsk: (argv: string[], deps?: AskDependencies) => Promise<AskOutcome>;
|
|
63
|
+
export declare const AskCommand: {
|
|
64
|
+
run(argv: string[]): Promise<void>;
|
|
65
|
+
};
|
|
66
|
+
//# sourceMappingURL=AskCommand.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AskCommand.d.ts","sourceRoot":"","sources":["../../src/cli/AskCommand.ts"],"names":[],"mappings":"AACA,OAAO,EAAyB,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAGvF,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAIpE,OAAO,EACL,2BAA2B,EAE5B,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE5D,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAGxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AACtE,OAAO,KAAK,EACV,iBAAiB,EAEjB,mBAAmB,EACpB,MAAM,kCAAkC,CAAC;AAE1C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAE9D;;;;;;GAMG;AAEH;;;GAGG;AACH,eAAO,MAAM,kBAAkB,IAAI,CAAC;AACpC,eAAO,MAAM,sBAAsB,KAAK,CAAC;AACzC,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAC1C;;;GAGG;AACH,eAAO,MAAM,mBAAmB,SAAU,CAAC;AAE3C;;;;GAIG;AACH,eAAO,MAAM,4BAA4B,IAAI,CAAC;AAe9C,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,iBAAiB,CAAC;IACxB,KAAK,EAAE,OAAO,CAAC;IACf,IAAI,EAAE,OAAO,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,cAAc,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACjC,OAAO,EAAE,OAAO,CAAC;CAClB;AA+BD,eAAO,MAAM,YAAY,GAAI,MAAM,MAAM,EAAE,KAAG,UAuE7C,CAAC;AAEF,MAAM,WAAW,eAAe;IAC9B,aAAa,CAAC,EAAE,OAAO,iBAAiB,CAAC;IACzC,iBAAiB,CAAC,EAAE,CAAC,aAAa,EAAE,MAAM,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;IACnE,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,KAAK,YAAY,CAAC;IAC3E,cAAc,CAAC,EAAE,CACf,UAAU,EAAE,UAAU,CAAC,OAAO,2BAA2B,CAAC,CAAC,CAAC,CAAC,KAC1D,QAAQ,CAAC;IACd,SAAS,CAAC,EAAE,OAAO,cAAc,CAAC;IAClC,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAChC;AA6BD,MAAM,WAAW,UAAU;IACzB,MAAM,CAAC,EAAE,mBAAmB,CAAC;IAC7B,MAAM,EAAE,aAAa,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,eAAO,MAAM,MAAM,GACjB,MAAM,MAAM,EAAE,EACd,OAAM,eAAoB,KACzB,OAAO,CAAC,UAAU,CAwXpB,CAAC;AAEF,eAAO,MAAM,UAAU;cACL,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAMzC,CAAC"}
|