indusagi 0.13.6 → 0.13.8
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/LICENSE +661 -0
- package/README.md +7 -1
- package/dist/cli.js +114 -14
- package/dist/index.js +1618 -51
- package/dist/llmgateway.js +114 -14
- package/dist/mcp.js +812 -3
- package/dist/runtime.js +114 -14
- package/dist/sarvam-mcp.js +960 -0
- package/dist/shell-app.js +116 -14
- package/dist/smithy.js +114 -14
- package/dist/swarm.js +114 -14
- package/dist/tracing.js +37 -0
- package/dist/types/connectors-sarvam/connect.d.ts +14 -0
- package/dist/types/connectors-sarvam/connectors-sarvam.test.d.ts +14 -0
- package/dist/types/connectors-sarvam/index.d.ts +14 -0
- package/dist/types/connectors-sarvam/toolbox.d.ts +19 -0
- package/dist/types/connectors-sarvam/types.d.ts +49 -0
- package/dist/types/connectors-zoho/connect.d.ts +22 -0
- package/dist/types/connectors-zoho/connectors-zoho.test.d.ts +10 -0
- package/dist/types/connectors-zoho/index.d.ts +13 -0
- package/dist/types/connectors-zoho/toolbox.d.ts +19 -0
- package/dist/types/connectors-zoho/types.d.ts +56 -0
- package/dist/types/facade/mcp-core/client.d.ts +32 -0
- package/dist/types/facade/mcp-core/index.d.ts +4 -0
- package/dist/types/facade/mcp-core/oauth/flow.d.ts +72 -0
- package/dist/types/facade/mcp-core/oauth/index.d.ts +18 -0
- package/dist/types/facade/mcp-core/oauth/oauth.test.d.ts +8 -0
- package/dist/types/facade/mcp-core/oauth/provider.d.ts +51 -0
- package/dist/types/facade/mcp-core/oauth/token-store.d.ts +31 -0
- package/dist/types/facade/mcp-core/oauth/types.d.ts +96 -0
- package/dist/types/facade/mcp-core/toolbox-bridge.d.ts +46 -0
- package/dist/types/facade/mcp-core/toolbox-bridge.test.d.ts +8 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/llmgateway/contract/model-card.d.ts +1 -1
- package/dist/types/llmgateway/credentials/secrets.d.ts +2 -0
- package/dist/zoho.js +1451 -0
- package/package.json +11 -4
- package/dist/knowledge/guides/authoring-an-agent.md +0 -53
- package/dist/knowledge/guides/choosing-tools.md +0 -49
- package/dist/knowledge/guides/model-selection.md +0 -51
- package/dist/knowledge/guides/writing-system-prompts.md +0 -53
- package/dist/knowledge/index.ts +0 -19
- package/dist/knowledge/loader.ts +0 -200
- package/dist/knowledge/manifest.json +0 -29
package/dist/llmgateway.js
CHANGED
|
@@ -237,6 +237,85 @@ var MODEL_CARDS = [
|
|
|
237
237
|
cacheReadPerMTok: 0.15
|
|
238
238
|
}
|
|
239
239
|
},
|
|
240
|
+
// ── MiniMax (Anthropic-compatible Messages API) ─────────────────────────
|
|
241
|
+
// Wire: same dialect as Claude (`anthropic-messages`) at api.minimax.io.
|
|
242
|
+
// Auth: MINIMAX_API_KEY. Ids match facade/models.generated.ts.
|
|
243
|
+
{
|
|
244
|
+
id: "MiniMax-M2",
|
|
245
|
+
provider: "minimax",
|
|
246
|
+
api: "anthropic-messages",
|
|
247
|
+
displayName: "MiniMax M2",
|
|
248
|
+
baseUrl: "https://api.minimax.io/anthropic",
|
|
249
|
+
contextWindow: 204800,
|
|
250
|
+
maxOutputTokens: 131072,
|
|
251
|
+
modalities: ["text"],
|
|
252
|
+
reasoning: true,
|
|
253
|
+
cost: {
|
|
254
|
+
inputPerMTok: 0.3,
|
|
255
|
+
outputPerMTok: 1.2
|
|
256
|
+
}
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
id: "MiniMax-M2.1",
|
|
260
|
+
provider: "minimax",
|
|
261
|
+
api: "anthropic-messages",
|
|
262
|
+
displayName: "MiniMax M2.1",
|
|
263
|
+
baseUrl: "https://api.minimax.io/anthropic",
|
|
264
|
+
contextWindow: 204800,
|
|
265
|
+
maxOutputTokens: 131072,
|
|
266
|
+
modalities: ["text"],
|
|
267
|
+
reasoning: true,
|
|
268
|
+
cost: {
|
|
269
|
+
inputPerMTok: 0.3,
|
|
270
|
+
outputPerMTok: 1.2
|
|
271
|
+
}
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
id: "MiniMax-M2.5",
|
|
275
|
+
provider: "minimax",
|
|
276
|
+
api: "anthropic-messages",
|
|
277
|
+
displayName: "MiniMax M2.5",
|
|
278
|
+
baseUrl: "https://api.minimax.io/anthropic",
|
|
279
|
+
contextWindow: 204800,
|
|
280
|
+
maxOutputTokens: 131072,
|
|
281
|
+
modalities: ["text"],
|
|
282
|
+
reasoning: true,
|
|
283
|
+
cost: {
|
|
284
|
+
inputPerMTok: 0.3,
|
|
285
|
+
outputPerMTok: 1.2
|
|
286
|
+
}
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
id: "MiniMax-M2.7",
|
|
290
|
+
provider: "minimax",
|
|
291
|
+
api: "anthropic-messages",
|
|
292
|
+
displayName: "MiniMax M2.7",
|
|
293
|
+
baseUrl: "https://api.minimax.io/anthropic",
|
|
294
|
+
contextWindow: 204800,
|
|
295
|
+
maxOutputTokens: 131072,
|
|
296
|
+
modalities: ["text"],
|
|
297
|
+
reasoning: true,
|
|
298
|
+
cost: {
|
|
299
|
+
inputPerMTok: 0.3,
|
|
300
|
+
outputPerMTok: 1.2
|
|
301
|
+
}
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
id: "MiniMax-M3",
|
|
305
|
+
provider: "minimax",
|
|
306
|
+
api: "anthropic-messages",
|
|
307
|
+
displayName: "MiniMax M3",
|
|
308
|
+
baseUrl: "https://api.minimax.io/anthropic",
|
|
309
|
+
contextWindow: 1048576,
|
|
310
|
+
maxOutputTokens: 512e3,
|
|
311
|
+
modalities: ["text", "image"],
|
|
312
|
+
reasoning: true,
|
|
313
|
+
cost: {
|
|
314
|
+
inputPerMTok: 0.6,
|
|
315
|
+
outputPerMTok: 2.4,
|
|
316
|
+
cacheReadPerMTok: 0.12
|
|
317
|
+
}
|
|
318
|
+
},
|
|
240
319
|
// ── Ollama (local; pricing is zero — your own hardware) ─────────────────
|
|
241
320
|
{
|
|
242
321
|
id: "llama3.1:8b",
|
|
@@ -399,6 +478,19 @@ var SECRET_TABLE = {
|
|
|
399
478
|
envVars: ["MOONSHOT_API_KEY", "KIMI_API_KEY"],
|
|
400
479
|
hint: "Moonshot AI (Kimi) API key."
|
|
401
480
|
},
|
|
481
|
+
minimax: {
|
|
482
|
+
provider: "minimax",
|
|
483
|
+
scheme: "api-key",
|
|
484
|
+
envVars: ["MINIMAX_API_KEY"],
|
|
485
|
+
hint: "MiniMax global API key (api.minimax.io Anthropic-compatible)."
|
|
486
|
+
},
|
|
487
|
+
"minimax-cn": {
|
|
488
|
+
provider: "minimax-cn",
|
|
489
|
+
scheme: "api-key",
|
|
490
|
+
// Same key often works for both; CN-specific override first when set.
|
|
491
|
+
envVars: ["MINIMAX_CN_API_KEY", "MINIMAX_API_KEY"],
|
|
492
|
+
hint: "MiniMax China API key (api.minimaxi.com Anthropic-compatible)."
|
|
493
|
+
},
|
|
402
494
|
ollama: {
|
|
403
495
|
provider: "ollama",
|
|
404
496
|
scheme: "none",
|
|
@@ -1239,7 +1331,7 @@ function endpointFor(model) {
|
|
|
1239
1331
|
const base = (model.baseUrl ?? DEFAULT_BASE_URL).replace(/\/+$/, "");
|
|
1240
1332
|
return `${base}/v1/messages`;
|
|
1241
1333
|
}
|
|
1242
|
-
async function postMessages(url, apiKey, body, signal) {
|
|
1334
|
+
async function postMessages(url, apiKey, body, signal, provider = "anthropic") {
|
|
1243
1335
|
let response;
|
|
1244
1336
|
try {
|
|
1245
1337
|
response = await fetch(url, {
|
|
@@ -1254,24 +1346,24 @@ async function postMessages(url, apiKey, body, signal) {
|
|
|
1254
1346
|
});
|
|
1255
1347
|
} catch (cause) {
|
|
1256
1348
|
if (signal?.aborted) {
|
|
1257
|
-
throw gatewayError("aborted",
|
|
1258
|
-
provider
|
|
1349
|
+
throw gatewayError("aborted", `request canceled before ${provider} responded`, {
|
|
1350
|
+
provider,
|
|
1259
1351
|
cause
|
|
1260
1352
|
});
|
|
1261
1353
|
}
|
|
1262
|
-
throw gatewayError("transport",
|
|
1354
|
+
throw gatewayError("transport", `network call to ${provider} failed`, { provider, cause });
|
|
1263
1355
|
}
|
|
1264
1356
|
if (!response.ok) {
|
|
1265
1357
|
const detail = await readErrorBody(response);
|
|
1266
1358
|
const kind = response.status === 401 || response.status === 403 ? "auth" : response.status === 429 ? "rate_limit" : "http";
|
|
1267
|
-
throw gatewayError(kind,
|
|
1268
|
-
provider
|
|
1359
|
+
throw gatewayError(kind, `${provider} returned HTTP ${response.status}${detail}`, {
|
|
1360
|
+
provider,
|
|
1269
1361
|
status: response.status
|
|
1270
1362
|
});
|
|
1271
1363
|
}
|
|
1272
1364
|
if (response.body === null) {
|
|
1273
|
-
throw gatewayError("transport",
|
|
1274
|
-
provider
|
|
1365
|
+
throw gatewayError("transport", `${provider} response arrived with no body`, {
|
|
1366
|
+
provider,
|
|
1275
1367
|
status: response.status
|
|
1276
1368
|
});
|
|
1277
1369
|
}
|
|
@@ -1293,11 +1385,13 @@ function asGatewayError(cause) {
|
|
|
1293
1385
|
}
|
|
1294
1386
|
function createanthropicConnector(deps2) {
|
|
1295
1387
|
const api = "anthropic-messages";
|
|
1296
|
-
async function requireKey(options) {
|
|
1297
|
-
const
|
|
1388
|
+
async function requireKey(model, options) {
|
|
1389
|
+
const provider = model.provider;
|
|
1390
|
+
const key = await deps2.resolveSecret(provider, options.apiKey);
|
|
1298
1391
|
if (key === void 0 || key === "") {
|
|
1299
|
-
|
|
1300
|
-
|
|
1392
|
+
const hint = provider === "minimax" || provider === "minimax-cn" ? "set MINIMAX_API_KEY (or MINIMAX_CN_API_KEY for CN) or pass options.apiKey" : "set ANTHROPIC_API_KEY or pass options.apiKey";
|
|
1393
|
+
throw gatewayError("auth", `no API key found for provider "${provider}" (${hint})`, {
|
|
1394
|
+
provider
|
|
1301
1395
|
});
|
|
1302
1396
|
}
|
|
1303
1397
|
return key;
|
|
@@ -1306,10 +1400,16 @@ function createanthropicConnector(deps2) {
|
|
|
1306
1400
|
return channelOf(async function* run() {
|
|
1307
1401
|
const collected = [];
|
|
1308
1402
|
try {
|
|
1309
|
-
const apiKey = await requireKey(options);
|
|
1403
|
+
const apiKey = await requireKey(model, options);
|
|
1310
1404
|
const body = toAnthropicRequest(conversation, model, options);
|
|
1311
1405
|
body.stream = true;
|
|
1312
|
-
const response = await postMessages(
|
|
1406
|
+
const response = await postMessages(
|
|
1407
|
+
endpointFor(model),
|
|
1408
|
+
apiKey,
|
|
1409
|
+
body,
|
|
1410
|
+
options.signal,
|
|
1411
|
+
model.provider
|
|
1412
|
+
);
|
|
1313
1413
|
const wire = response.body;
|
|
1314
1414
|
const state = { toolIds: /* @__PURE__ */ new Map(), usage: { inputTokens: 0, outputTokens: 0 } };
|
|
1315
1415
|
for await (const event of sseEvents(wire, options.signal)) {
|