@introspection-ai/recipes 0.42.0 → 0.44.0
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/dist/agents.d.ts.map +1 -1
- package/dist/agents.js +11 -4
- package/dist/agents.js.map +1 -1
- package/dist/api/session.d.ts +2 -1
- package/dist/api/session.d.ts.map +1 -1
- package/dist/artifact-review-tui.d.ts +33 -0
- package/dist/artifact-review-tui.d.ts.map +1 -0
- package/dist/artifact-review-tui.js +315 -0
- package/dist/artifact-review-tui.js.map +1 -0
- package/dist/artifact-review.d.ts +72 -0
- package/dist/artifact-review.d.ts.map +1 -0
- package/dist/artifact-review.js +335 -0
- package/dist/artifact-review.js.map +1 -0
- package/dist/artifact-viewer-tui.d.ts +10 -8
- package/dist/artifact-viewer-tui.d.ts.map +1 -1
- package/dist/artifact-viewer-tui.js +24 -15
- package/dist/artifact-viewer-tui.js.map +1 -1
- package/dist/artifact-viewer.d.ts +5 -68
- package/dist/artifact-viewer.d.ts.map +1 -1
- package/dist/artifact-viewer.js +98 -63
- package/dist/artifact-viewer.js.map +1 -1
- package/dist/ask-user-question.d.ts +0 -32
- package/dist/ask-user-question.d.ts.map +1 -1
- package/dist/ask-user-question.js +9 -5
- package/dist/ask-user-question.js.map +1 -1
- package/dist/channels/index.d.ts +1 -1
- package/dist/channels/index.d.ts.map +1 -1
- package/dist/channels/index.js +1 -1
- package/dist/channels/index.js.map +1 -1
- package/dist/channels/module.d.ts.map +1 -1
- package/dist/channels/module.js +15 -5
- package/dist/channels/module.js.map +1 -1
- package/dist/channels/refs.d.ts.map +1 -1
- package/dist/channels/refs.js +10 -2
- package/dist/channels/refs.js.map +1 -1
- package/dist/channels/tools.d.ts.map +1 -1
- package/dist/channels/tools.js +80 -36
- package/dist/channels/tools.js.map +1 -1
- package/dist/child/agent-completions.d.ts.map +1 -1
- package/dist/child/agent-completions.js +3 -1
- package/dist/child/agent-completions.js.map +1 -1
- package/dist/child/agent-store.d.ts +3 -2
- package/dist/child/agent-store.d.ts.map +1 -1
- package/dist/child/agent-store.js.map +1 -1
- package/dist/child/agent.d.ts.map +1 -1
- package/dist/child/agent.js +1 -3
- package/dist/child/agent.js.map +1 -1
- package/dist/child/session.d.ts +2 -2
- package/dist/child/session.d.ts.map +1 -1
- package/dist/child/session.js +1 -3
- package/dist/child/session.js.map +1 -1
- package/dist/connector-tools.d.ts +5 -4
- package/dist/connector-tools.d.ts.map +1 -1
- package/dist/connector-tools.js +19 -9
- package/dist/connector-tools.js.map +1 -1
- package/dist/documents/index.d.ts +3 -3
- package/dist/documents/index.d.ts.map +1 -1
- package/dist/documents/index.js +1 -1
- package/dist/documents/index.js.map +1 -1
- package/dist/documents/module.d.ts +0 -2
- package/dist/documents/module.d.ts.map +1 -1
- package/dist/documents/module.js +30 -11
- package/dist/documents/module.js.map +1 -1
- package/dist/documents/profile.d.ts.map +1 -1
- package/dist/documents/profile.js +10 -4
- package/dist/documents/profile.js.map +1 -1
- package/dist/documents/python.d.ts.map +1 -1
- package/dist/documents/python.js +12 -3
- package/dist/documents/python.js.map +1 -1
- package/dist/documents/tools.d.ts.map +1 -1
- package/dist/documents/tools.js +105 -29
- package/dist/documents/tools.js.map +1 -1
- package/dist/documents/types.d.ts.map +1 -1
- package/dist/extensions.d.ts.map +1 -1
- package/dist/extensions.js +6 -2
- package/dist/extensions.js.map +1 -1
- package/dist/genai-spans-file.d.ts +1 -14
- package/dist/genai-spans-file.d.ts.map +1 -1
- package/dist/genai-spans-file.js +5 -3
- package/dist/genai-spans-file.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/inspect.d.ts.map +1 -1
- package/dist/inspect.js +2 -3
- package/dist/inspect.js.map +1 -1
- package/dist/interaction-tui.d.ts +25 -0
- package/dist/interaction-tui.d.ts.map +1 -1
- package/dist/interaction-tui.js +45 -6
- package/dist/interaction-tui.js.map +1 -1
- package/dist/interactions.d.ts.map +1 -1
- package/dist/interactions.js +1 -3
- package/dist/interactions.js.map +1 -1
- package/dist/mcp/catalog.d.ts.map +1 -1
- package/dist/mcp/catalog.js.map +1 -1
- package/dist/mcp/cli/command-context.d.ts.map +1 -1
- package/dist/mcp/cli/command-context.js.map +1 -1
- package/dist/mcp/cli/core.d.ts +0 -41
- package/dist/mcp/cli/core.d.ts.map +1 -1
- package/dist/mcp/cli/core.js +79 -37
- package/dist/mcp/cli/core.js.map +1 -1
- package/dist/mcp/cli/help.js +3 -3
- package/dist/mcp/cli/help.js.map +1 -1
- package/dist/mcp/cli/index.js.map +1 -1
- package/dist/mcp/cli/policy.d.ts +2 -1
- package/dist/mcp/cli/policy.d.ts.map +1 -1
- package/dist/mcp/cli/policy.js +19 -11
- package/dist/mcp/cli/policy.js.map +1 -1
- package/dist/mcp/client-entry.js.map +1 -1
- package/dist/mcp/contract.d.ts.map +1 -1
- package/dist/mcp/contract.js +8 -3
- package/dist/mcp/contract.js.map +1 -1
- package/dist/mcp/daemon/client.d.ts +4 -0
- package/dist/mcp/daemon/client.d.ts.map +1 -1
- package/dist/mcp/daemon/client.js +4 -0
- package/dist/mcp/daemon/client.js.map +1 -1
- package/dist/mcp/daemon/index.js +9 -4
- package/dist/mcp/daemon/index.js.map +1 -1
- package/dist/mcp/daemon/protocol.d.ts +7 -6
- package/dist/mcp/daemon/protocol.d.ts.map +1 -1
- package/dist/mcp/index.d.ts +2 -6
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +36 -20
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/tools.d.ts +1 -14
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +9 -4
- package/dist/mcp/tools.js.map +1 -1
- package/dist/mcp-chunks/{chunk-EZKOZO3F.js → chunk-GODH4VLN.js} +179 -70
- package/dist/mcp-daemon.js +29 -19
- package/dist/mcp-run-worker.js +1 -1
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +1 -1
- package/dist/memory.js.map +1 -1
- package/dist/model-binding.d.ts +4 -5
- package/dist/model-binding.d.ts.map +1 -1
- package/dist/model-binding.js +5 -5
- package/dist/model-binding.js.map +1 -1
- package/dist/pi-extension.d.ts.map +1 -1
- package/dist/pi-extension.js +73 -34
- package/dist/pi-extension.js.map +1 -1
- package/dist/python.d.ts.map +1 -1
- package/dist/python.js +5 -1
- package/dist/python.js.map +1 -1
- package/dist/recipe/agent.d.ts +9 -6
- package/dist/recipe/agent.d.ts.map +1 -1
- package/dist/recipe/agent.js +23 -28
- package/dist/recipe/agent.js.map +1 -1
- package/dist/recipe/companions.d.ts +0 -15
- package/dist/recipe/companions.d.ts.map +1 -1
- package/dist/recipe/companions.js +29 -11
- package/dist/recipe/companions.js.map +1 -1
- package/dist/recipe/extensions.d.ts.map +1 -1
- package/dist/recipe/extensions.js +23 -6
- package/dist/recipe/extensions.js.map +1 -1
- package/dist/recipe/mcp-config.d.ts +0 -12
- package/dist/recipe/mcp-config.d.ts.map +1 -1
- package/dist/recipe/mcp-config.js +1 -70
- package/dist/recipe/mcp-config.js.map +1 -1
- package/dist/recipe/model.d.ts +8 -7
- package/dist/recipe/model.d.ts.map +1 -1
- package/dist/recipe/model.js +2 -6
- package/dist/recipe/model.js.map +1 -1
- package/dist/recipe/package.d.ts +3 -16
- package/dist/recipe/package.d.ts.map +1 -1
- package/dist/recipe/package.js +105 -40
- package/dist/recipe/package.js.map +1 -1
- package/dist/recipe/python.d.ts +0 -8
- package/dist/recipe/python.d.ts.map +1 -1
- package/dist/recipe/python.js +40 -13
- package/dist/recipe/python.js.map +1 -1
- package/dist/recipe/resolve.d.ts.map +1 -1
- package/dist/recipe/resolve.js +4 -9
- package/dist/recipe/resolve.js.map +1 -1
- package/dist/recipe/session.d.ts +3 -2
- package/dist/recipe/session.d.ts.map +1 -1
- package/dist/recipe/session.js +4 -3
- package/dist/recipe/session.js.map +1 -1
- package/dist/recipe/skills-prompt.d.ts.map +1 -1
- package/dist/recipe/skills-prompt.js +6 -1
- package/dist/recipe/skills-prompt.js.map +1 -1
- package/dist/recipe/skills.d.ts +1 -6
- package/dist/recipe/skills.d.ts.map +1 -1
- package/dist/recipe/skills.js +9 -6
- package/dist/recipe/skills.js.map +1 -1
- package/dist/recipe/suggestions.d.ts.map +1 -1
- package/dist/recipe/suggestions.js +21 -8
- package/dist/recipe/suggestions.js.map +1 -1
- package/dist/recipe-session-entry.d.ts +18 -0
- package/dist/recipe-session-entry.d.ts.map +1 -0
- package/dist/recipe-session-entry.js +27 -0
- package/dist/recipe-session-entry.js.map +1 -0
- package/dist/run-controller.d.ts +0 -2
- package/dist/run-controller.d.ts.map +1 -1
- package/dist/run-controller.js +4 -2
- package/dist/run-controller.js.map +1 -1
- package/dist/session.d.ts +10 -4
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +32 -28
- package/dist/session.js.map +1 -1
- package/dist/skill-progress.d.ts +117 -0
- package/dist/skill-progress.d.ts.map +1 -0
- package/dist/skill-progress.js +369 -0
- package/dist/skill-progress.js.map +1 -0
- package/dist/suggestion-picker.d.ts +0 -3
- package/dist/suggestion-picker.d.ts.map +1 -1
- package/dist/suggestion-picker.js +4 -2
- package/dist/suggestion-picker.js.map +1 -1
- package/dist/test-utils.d.ts.map +1 -1
- package/dist/test-utils.js.map +1 -1
- package/docs/agent-composition.md +1 -0
- package/docs/pi-extension.md +125 -12
- package/docs/recipe-format.md +122 -16
- package/package.json +18 -6
|
@@ -10178,7 +10178,15 @@ function mcpDaemonRequestContext(carrier, base = ROOT_CONTEXT) {
|
|
|
10178
10178
|
// src/mcp/cli/core.ts
|
|
10179
10179
|
import { createHash, randomUUID } from "node:crypto";
|
|
10180
10180
|
import { existsSync } from "node:fs";
|
|
10181
|
-
import {
|
|
10181
|
+
import {
|
|
10182
|
+
mkdir,
|
|
10183
|
+
open,
|
|
10184
|
+
readFile,
|
|
10185
|
+
rename,
|
|
10186
|
+
rm,
|
|
10187
|
+
stat,
|
|
10188
|
+
writeFile
|
|
10189
|
+
} from "node:fs/promises";
|
|
10182
10190
|
import { dirname as dirname2, join as join2 } from "node:path";
|
|
10183
10191
|
import { setTimeout as delay } from "node:timers/promises";
|
|
10184
10192
|
import { stdin as input, stderr, stdout } from "node:process";
|
|
@@ -10213,7 +10221,9 @@ function renderSchema(value) {
|
|
|
10213
10221
|
...branches.map((branch) => record(branch.properties) ?? {})
|
|
10214
10222
|
);
|
|
10215
10223
|
const required = new Set(
|
|
10216
|
-
Array.isArray(schema.required) ? schema.required.filter(
|
|
10224
|
+
Array.isArray(schema.required) ? schema.required.filter(
|
|
10225
|
+
(entry) => typeof entry === "string"
|
|
10226
|
+
) : []
|
|
10217
10227
|
);
|
|
10218
10228
|
for (const branch of branches) {
|
|
10219
10229
|
if (!Array.isArray(branch.required)) continue;
|
|
@@ -10244,7 +10254,8 @@ function constraintSuffix(schema) {
|
|
|
10244
10254
|
const maxItems = number(schema.maxItems);
|
|
10245
10255
|
if (minItems !== void 0) constraints.push(`minItems=${minItems}`);
|
|
10246
10256
|
if (maxItems !== void 0) constraints.push(`maxItems=${maxItems}`);
|
|
10247
|
-
if (schema.default !== void 0)
|
|
10257
|
+
if (schema.default !== void 0)
|
|
10258
|
+
constraints.push(`default=${quoted(schema.default)}`);
|
|
10248
10259
|
return constraints.length > 0 ? ` [${constraints.join(", ")}]` : "";
|
|
10249
10260
|
}
|
|
10250
10261
|
function compactSchemaType(value) {
|
|
@@ -10264,7 +10275,9 @@ function compactSchemaType(value) {
|
|
|
10264
10275
|
const properties = record(schema.properties);
|
|
10265
10276
|
if (!properties || Object.keys(properties).length === 0) return "object";
|
|
10266
10277
|
const required = new Set(
|
|
10267
|
-
Array.isArray(schema.required) ? schema.required.filter(
|
|
10278
|
+
Array.isArray(schema.required) ? schema.required.filter(
|
|
10279
|
+
(entry) => typeof entry === "string"
|
|
10280
|
+
) : []
|
|
10268
10281
|
);
|
|
10269
10282
|
const fields = Object.entries(properties).map(
|
|
10270
10283
|
([name, descriptor]) => `${name}${required.has(name) ? "" : "?"}: ${compactSchemaType(descriptor)}`
|
|
@@ -10297,7 +10310,9 @@ function schemaLines(value, indent, options = {}) {
|
|
|
10297
10310
|
const properties = record(schema.properties);
|
|
10298
10311
|
if (!properties) return [`${indent}${compactSchemaType(schema)}`];
|
|
10299
10312
|
const required = new Set(
|
|
10300
|
-
Array.isArray(schema.required) ? schema.required.filter(
|
|
10313
|
+
Array.isArray(schema.required) ? schema.required.filter(
|
|
10314
|
+
(entry) => typeof entry === "string"
|
|
10315
|
+
) : []
|
|
10301
10316
|
);
|
|
10302
10317
|
const lines = [];
|
|
10303
10318
|
for (const [name, descriptorValue] of Object.entries(properties)) {
|
|
@@ -10314,7 +10329,9 @@ function schemaLines(value, indent, options = {}) {
|
|
|
10314
10329
|
lines.push(...schemaLines(descriptor, `${indent} `, options));
|
|
10315
10330
|
lines.push(`${indent}}${description}`);
|
|
10316
10331
|
} else {
|
|
10317
|
-
lines.push(
|
|
10332
|
+
lines.push(
|
|
10333
|
+
`${indent}${name}${optional}: ${compactSchemaType(descriptor)}${description}`
|
|
10334
|
+
);
|
|
10318
10335
|
}
|
|
10319
10336
|
}
|
|
10320
10337
|
return lines.length > 0 ? lines : [`${indent}{}`];
|
|
@@ -10336,7 +10353,8 @@ function exampleValue(value, name) {
|
|
|
10336
10353
|
const union = Array.isArray(schema.anyOf) ? schema.anyOf : Array.isArray(schema.oneOf) ? schema.oneOf : void 0;
|
|
10337
10354
|
if (union?.length) return exampleValue(union[0], name);
|
|
10338
10355
|
if (schema.const !== void 0) return schema.const;
|
|
10339
|
-
if (Array.isArray(schema.enum) && schema.enum.length > 0)
|
|
10356
|
+
if (Array.isArray(schema.enum) && schema.enum.length > 0)
|
|
10357
|
+
return schema.enum[0];
|
|
10340
10358
|
if (schema.type === "boolean") return true;
|
|
10341
10359
|
if (schema.type === "number" || schema.type === "integer") {
|
|
10342
10360
|
return number(schema.minimum) ?? 1;
|
|
@@ -10346,11 +10364,16 @@ function exampleValue(value, name) {
|
|
|
10346
10364
|
MAX_EXAMPLE_ARRAY_ITEMS,
|
|
10347
10365
|
Math.max(1, number(schema.minItems) ?? 1)
|
|
10348
10366
|
);
|
|
10349
|
-
return Array.from(
|
|
10367
|
+
return Array.from(
|
|
10368
|
+
{ length: count },
|
|
10369
|
+
() => exampleValue(schema.items, "value")
|
|
10370
|
+
);
|
|
10350
10371
|
}
|
|
10351
10372
|
if (schema.type === "object" || record(schema.properties)) {
|
|
10352
10373
|
const properties = record(schema.properties) ?? {};
|
|
10353
|
-
const required = Array.isArray(schema.required) ? schema.required.filter(
|
|
10374
|
+
const required = Array.isArray(schema.required) ? schema.required.filter(
|
|
10375
|
+
(entry) => typeof entry === "string"
|
|
10376
|
+
) : [];
|
|
10354
10377
|
return Object.fromEntries(
|
|
10355
10378
|
required.map((field) => [field, exampleValue(properties[field], field)])
|
|
10356
10379
|
);
|
|
@@ -10364,14 +10387,18 @@ function callValue(value, name) {
|
|
|
10364
10387
|
function callExample(server, tool) {
|
|
10365
10388
|
const schema = renderSchema(tool.inputSchema);
|
|
10366
10389
|
const properties = record(schema?.properties) ?? {};
|
|
10367
|
-
const required = Array.isArray(schema?.required) ? schema.required.filter(
|
|
10390
|
+
const required = Array.isArray(schema?.required) ? schema.required.filter(
|
|
10391
|
+
(entry) => typeof entry === "string"
|
|
10392
|
+
) : [];
|
|
10368
10393
|
if (required.some(
|
|
10369
10394
|
(name) => !SAFE_CLI_KEY.test(name) || Boolean(
|
|
10370
10395
|
structuredBranch(properties[name], "object") ?? structuredBranch(properties[name], "array")
|
|
10371
10396
|
)
|
|
10372
10397
|
)) {
|
|
10373
10398
|
const json = JSON.stringify(
|
|
10374
|
-
Object.fromEntries(
|
|
10399
|
+
Object.fromEntries(
|
|
10400
|
+
required.map((name) => [name, exampleValue(properties[name], name)])
|
|
10401
|
+
)
|
|
10375
10402
|
);
|
|
10376
10403
|
return `mcp call ${toolSelector(server, tool.name)} --json ${shellQuote(json)}`;
|
|
10377
10404
|
}
|
|
@@ -10394,7 +10421,9 @@ function structuredCallExample(server, tool) {
|
|
|
10394
10421
|
const schema = renderSchema(tool.inputSchema);
|
|
10395
10422
|
const properties = record(schema?.properties) ?? {};
|
|
10396
10423
|
const required = new Set(
|
|
10397
|
-
Array.isArray(schema?.required) ? schema.required.filter(
|
|
10424
|
+
Array.isArray(schema?.required) ? schema.required.filter(
|
|
10425
|
+
(entry) => typeof entry === "string"
|
|
10426
|
+
) : []
|
|
10398
10427
|
);
|
|
10399
10428
|
const requiredValues = Object.fromEntries(
|
|
10400
10429
|
[...required].map((name) => [name, exampleValue(properties[name], name)])
|
|
@@ -10440,7 +10469,9 @@ function renderToolSignature(server, tool, options = {}) {
|
|
|
10440
10469
|
const schema = renderSchema(tool.inputSchema);
|
|
10441
10470
|
const properties = record(schema?.properties) ?? {};
|
|
10442
10471
|
const required = new Set(
|
|
10443
|
-
Array.isArray(schema?.required) ? schema.required.filter(
|
|
10472
|
+
Array.isArray(schema?.required) ? schema.required.filter(
|
|
10473
|
+
(entry) => typeof entry === "string"
|
|
10474
|
+
) : []
|
|
10444
10475
|
);
|
|
10445
10476
|
const entries = Object.entries(properties);
|
|
10446
10477
|
const included = new Set(
|
|
@@ -12469,7 +12500,9 @@ import { createRequire, findPackageJSON } from "node:module";
|
|
|
12469
12500
|
var require2 = createRequire(import.meta.url);
|
|
12470
12501
|
|
|
12471
12502
|
// src/recipe/companions.ts
|
|
12472
|
-
var recipesManifestPath = fileURLToPath(
|
|
12503
|
+
var recipesManifestPath = fileURLToPath(
|
|
12504
|
+
new URL("../../package.json", import.meta.url)
|
|
12505
|
+
);
|
|
12473
12506
|
|
|
12474
12507
|
// src/recipe/package.ts
|
|
12475
12508
|
var RESOURCE_KEYS = [
|
|
@@ -12616,7 +12649,10 @@ function closestName(input2, candidates) {
|
|
|
12616
12649
|
const normalize = (value) => value.replace(/[^a-z0-9]/gi, "").toLowerCase();
|
|
12617
12650
|
const source = normalize(input2);
|
|
12618
12651
|
const distance = (left, right) => {
|
|
12619
|
-
let previous = Array.from(
|
|
12652
|
+
let previous = Array.from(
|
|
12653
|
+
{ length: right.length + 1 },
|
|
12654
|
+
(_, index) => index
|
|
12655
|
+
);
|
|
12620
12656
|
for (let i = 1; i <= left.length; i += 1) {
|
|
12621
12657
|
const current = [i];
|
|
12622
12658
|
for (let j = 1; j <= right.length; j += 1) {
|
|
@@ -12659,12 +12695,19 @@ function validateExactTarget(policy, server, tool) {
|
|
|
12659
12695
|
}
|
|
12660
12696
|
function validateList(args, policy) {
|
|
12661
12697
|
const blocked = forbiddenFlag(args.slice(1));
|
|
12662
|
-
if (blocked)
|
|
12698
|
+
if (blocked)
|
|
12699
|
+
return {
|
|
12700
|
+
error: `mcp list option '${blocked}' is unavailable in recipe sessions.`
|
|
12701
|
+
};
|
|
12663
12702
|
const outputModeError = listOutputModeError(args.slice(1));
|
|
12664
12703
|
if (outputModeError) return { error: outputModeError };
|
|
12665
|
-
const adHocTarget = args.slice(1).find(
|
|
12704
|
+
const adHocTarget = args.slice(1).find(
|
|
12705
|
+
(arg) => !arg.startsWith("-") && /^(?:https?:\/\/|[^/]+\/)/i.test(arg)
|
|
12706
|
+
);
|
|
12666
12707
|
if (adHocTarget) {
|
|
12667
|
-
return {
|
|
12708
|
+
return {
|
|
12709
|
+
error: "mcp list accepts only servers materialized for this recipe session; URLs and ad-hoc servers are unavailable."
|
|
12710
|
+
};
|
|
12668
12711
|
}
|
|
12669
12712
|
const target = args[1] && !args[1].startsWith("-") ? args[1] : void 0;
|
|
12670
12713
|
if (target !== void 0) {
|
|
@@ -12679,11 +12722,7 @@ function validateList(args, policy) {
|
|
|
12679
12722
|
}
|
|
12680
12723
|
};
|
|
12681
12724
|
}
|
|
12682
|
-
var CALL_FLAGS_WITH_VALUE = /* @__PURE__ */ new Set([
|
|
12683
|
-
"--json",
|
|
12684
|
-
"--output",
|
|
12685
|
-
"--timeout"
|
|
12686
|
-
]);
|
|
12725
|
+
var CALL_FLAGS_WITH_VALUE = /* @__PURE__ */ new Set(["--json", "--output", "--timeout"]);
|
|
12687
12726
|
function callSyntaxError(args) {
|
|
12688
12727
|
for (let index = 0; index < args.length; index += 1) {
|
|
12689
12728
|
const arg = args[index];
|
|
@@ -12718,9 +12757,15 @@ function validateCall(args, policy) {
|
|
|
12718
12757
|
};
|
|
12719
12758
|
}
|
|
12720
12759
|
if (/^(?:https?:\/\/|[^/]+\/)/i.test(selector.server)) {
|
|
12721
|
-
return {
|
|
12760
|
+
return {
|
|
12761
|
+
error: "mcp call accepts only tools materialized for this recipe session; URLs and ad-hoc servers are unavailable."
|
|
12762
|
+
};
|
|
12722
12763
|
}
|
|
12723
|
-
const targetError = validateExactTarget(
|
|
12764
|
+
const targetError = validateExactTarget(
|
|
12765
|
+
policy,
|
|
12766
|
+
selector.server,
|
|
12767
|
+
selector.tool
|
|
12768
|
+
);
|
|
12724
12769
|
if (targetError) return { error: targetError };
|
|
12725
12770
|
const blocked = forbiddenFlag(args.slice(2));
|
|
12726
12771
|
if (blocked === "--args") {
|
|
@@ -12728,7 +12773,10 @@ function validateCall(args, policy) {
|
|
|
12728
12773
|
error: "mcp call option '--args' was removed; use --json <object|-> for structured tool arguments."
|
|
12729
12774
|
};
|
|
12730
12775
|
}
|
|
12731
|
-
if (blocked)
|
|
12776
|
+
if (blocked)
|
|
12777
|
+
return {
|
|
12778
|
+
error: `mcp call option '${blocked}' is unavailable in recipe sessions.`
|
|
12779
|
+
};
|
|
12732
12780
|
const syntaxError = callSyntaxError(args.slice(2));
|
|
12733
12781
|
if (syntaxError) return { error: syntaxError };
|
|
12734
12782
|
return {
|
|
@@ -12739,9 +12787,7 @@ function validateCall(args, policy) {
|
|
|
12739
12787
|
}
|
|
12740
12788
|
function createMcpCliSessionPolicy(session) {
|
|
12741
12789
|
return {
|
|
12742
|
-
servers: new Map(
|
|
12743
|
-
session.servers.map((server) => [server.id, server])
|
|
12744
|
-
)
|
|
12790
|
+
servers: new Map(session.servers.map((server) => [server.id, server]))
|
|
12745
12791
|
};
|
|
12746
12792
|
}
|
|
12747
12793
|
function validateDelegatedMcpCommand(args, policy) {
|
|
@@ -12842,7 +12888,10 @@ function checkedCallResult(callResult) {
|
|
|
12842
12888
|
if (asRecord(callResult.raw).isError === true) {
|
|
12843
12889
|
const parsed = callResult.json();
|
|
12844
12890
|
const parsedRecord = asRecord(parsed);
|
|
12845
|
-
const parsedError = Object.prototype.hasOwnProperty.call(
|
|
12891
|
+
const parsedError = Object.prototype.hasOwnProperty.call(
|
|
12892
|
+
parsedRecord,
|
|
12893
|
+
"error"
|
|
12894
|
+
) ? parsedRecord.error : parsedRecord;
|
|
12846
12895
|
const errorObject = asRecord(parsedError);
|
|
12847
12896
|
const message = typeof parsedError === "string" ? parsedError : typeof errorObject.message === "string" ? errorObject.message : callResult.text() ?? "MCP tool call failed.";
|
|
12848
12897
|
throw new McpRemoteToolResultError({ ...errorObject, message });
|
|
@@ -12877,7 +12926,9 @@ function decodeCallResult(callResult, format, ref) {
|
|
|
12877
12926
|
}
|
|
12878
12927
|
}
|
|
12879
12928
|
function validateRunToolArgs(server, tool, args) {
|
|
12880
|
-
const cliStyleKey = Object.keys(args).find(
|
|
12929
|
+
const cliStyleKey = Object.keys(args).find(
|
|
12930
|
+
(key) => key.includes(":=") || key.includes("=")
|
|
12931
|
+
);
|
|
12881
12932
|
if (!cliStyleKey) return;
|
|
12882
12933
|
const suggestedKey = cliStyleKey.split(/:=|=/, 1)[0];
|
|
12883
12934
|
throw new McpRunUsageError(
|
|
@@ -12898,7 +12949,9 @@ var ToolCallQueue = class {
|
|
|
12898
12949
|
this.active += 1;
|
|
12899
12950
|
return Promise.resolve(this.releaseHandle());
|
|
12900
12951
|
}
|
|
12901
|
-
return new Promise(
|
|
12952
|
+
return new Promise(
|
|
12953
|
+
(resolve2, reject) => this.waiting.push({ resolve: resolve2, reject })
|
|
12954
|
+
);
|
|
12902
12955
|
}
|
|
12903
12956
|
cancel(error) {
|
|
12904
12957
|
if (this.cancelled !== void 0) return;
|
|
@@ -13229,11 +13282,17 @@ function optionName(value) {
|
|
|
13229
13282
|
}
|
|
13230
13283
|
function parseSearchArgs(args) {
|
|
13231
13284
|
if (args.some((arg) => optionName(arg) === "--json")) {
|
|
13232
|
-
return {
|
|
13285
|
+
return {
|
|
13286
|
+
error: "mcp search metadata is compact text; JSON is reserved for tool results."
|
|
13287
|
+
};
|
|
13233
13288
|
}
|
|
13234
13289
|
let parsed;
|
|
13235
13290
|
try {
|
|
13236
|
-
parsed = parseArgs({
|
|
13291
|
+
parsed = parseArgs({
|
|
13292
|
+
args,
|
|
13293
|
+
options: SEARCH_OPTIONS,
|
|
13294
|
+
allowPositionals: true
|
|
13295
|
+
});
|
|
13237
13296
|
} catch (error) {
|
|
13238
13297
|
if (error.code === "ERR_PARSE_ARGS_INVALID_OPTION_VALUE") {
|
|
13239
13298
|
const index = args.findIndex((arg) => optionName(arg) === "--limit");
|
|
@@ -13251,7 +13310,9 @@ function parseSearchArgs(args) {
|
|
|
13251
13310
|
if (values.limit !== void 0) {
|
|
13252
13311
|
const value = Number(values.limit);
|
|
13253
13312
|
if (!Number.isInteger(value) || value <= 0) {
|
|
13254
|
-
return {
|
|
13313
|
+
return {
|
|
13314
|
+
error: `--limit expects a positive integer, got '${values.limit}'.`
|
|
13315
|
+
};
|
|
13255
13316
|
}
|
|
13256
13317
|
limit = value;
|
|
13257
13318
|
}
|
|
@@ -13262,7 +13323,8 @@ function renderSearchResults(matches, catalogs) {
|
|
|
13262
13323
|
let shortened = false;
|
|
13263
13324
|
const blocks = matches.map((match2, index) => {
|
|
13264
13325
|
const entry = catalogs.get(match2.server)?.find((tool2) => tool2.name === match2.tool);
|
|
13265
|
-
if (!entry)
|
|
13326
|
+
if (!entry)
|
|
13327
|
+
return `${match2.ref}${match2.description ? ` \u2014 ${match2.description}` : ""}
|
|
13266
13328
|
`;
|
|
13267
13329
|
const tool = {
|
|
13268
13330
|
name: entry.name,
|
|
@@ -13323,7 +13385,8 @@ async function searchCatalog(args) {
|
|
|
13323
13385
|
}
|
|
13324
13386
|
session.servers.forEach((server, index) => {
|
|
13325
13387
|
const result = results[index];
|
|
13326
|
-
if ("catalog" in result && result.catalog)
|
|
13388
|
+
if ("catalog" in result && result.catalog)
|
|
13389
|
+
catalogs.set(server.id, result.catalog);
|
|
13327
13390
|
});
|
|
13328
13391
|
matches = searchMcpTools(
|
|
13329
13392
|
{
|
|
@@ -13460,7 +13523,9 @@ function compactListArgumentError(args) {
|
|
|
13460
13523
|
}
|
|
13461
13524
|
async function compactList(args) {
|
|
13462
13525
|
if (args.includes("--json")) {
|
|
13463
|
-
stderr.write(
|
|
13526
|
+
stderr.write(
|
|
13527
|
+
"mcp list metadata is compact text; JSON is reserved for tool results.\n"
|
|
13528
|
+
);
|
|
13464
13529
|
return 2;
|
|
13465
13530
|
}
|
|
13466
13531
|
const argumentError = compactListArgumentError(args);
|
|
@@ -13482,7 +13547,9 @@ async function compactList(args) {
|
|
|
13482
13547
|
return 2;
|
|
13483
13548
|
}
|
|
13484
13549
|
if (schema && !target) {
|
|
13485
|
-
stderr.write(
|
|
13550
|
+
stderr.write(
|
|
13551
|
+
"mcp list --schema requires a server or one exact tool: mcp list <server>[.<tool>] --schema\n"
|
|
13552
|
+
);
|
|
13486
13553
|
return 2;
|
|
13487
13554
|
}
|
|
13488
13555
|
const session = await readSession();
|
|
@@ -13523,11 +13590,17 @@ async function compactList(args) {
|
|
|
13523
13590
|
try {
|
|
13524
13591
|
const sessionServer = session.servers.find((entry) => entry.id === server);
|
|
13525
13592
|
if (!sessionServer) {
|
|
13526
|
-
stderr.write(
|
|
13527
|
-
`
|
|
13593
|
+
stderr.write(
|
|
13594
|
+
`MCP server '${server}' is not available in this session.
|
|
13595
|
+
`
|
|
13596
|
+
);
|
|
13528
13597
|
return 1;
|
|
13529
13598
|
}
|
|
13530
|
-
const catalog = await discoverServerCatalog(
|
|
13599
|
+
const catalog = await discoverServerCatalog(
|
|
13600
|
+
runtime,
|
|
13601
|
+
sessionServer,
|
|
13602
|
+
timeout
|
|
13603
|
+
);
|
|
13531
13604
|
const tools = catalog.map((tool) => ({
|
|
13532
13605
|
name: tool.name,
|
|
13533
13606
|
description: tool.description,
|
|
@@ -13543,8 +13616,10 @@ async function compactList(args) {
|
|
|
13543
13616
|
}
|
|
13544
13617
|
const selected = exact ? tools.filter((tool) => tool.name === exact.tool) : tools;
|
|
13545
13618
|
if (exact && selected.length === 0) {
|
|
13546
|
-
stderr.write(
|
|
13547
|
-
`
|
|
13619
|
+
stderr.write(
|
|
13620
|
+
`Tool '${exact.tool}' is not available on server '${server}'.
|
|
13621
|
+
`
|
|
13622
|
+
);
|
|
13548
13623
|
return 1;
|
|
13549
13624
|
}
|
|
13550
13625
|
if (schema) {
|
|
@@ -13560,7 +13635,9 @@ async function compactList(args) {
|
|
|
13560
13635
|
server,
|
|
13561
13636
|
{
|
|
13562
13637
|
...tool,
|
|
13563
|
-
outputSchema: tool.outputSchema ?? catalogOutputSchema(
|
|
13638
|
+
outputSchema: tool.outputSchema ?? catalogOutputSchema(
|
|
13639
|
+
catalogTool(withCatalog, server, tool.name)
|
|
13640
|
+
)
|
|
13564
13641
|
},
|
|
13565
13642
|
{ verboseDescriptions: verbose }
|
|
13566
13643
|
)
|
|
@@ -13618,7 +13695,11 @@ function closestName2(input2, candidates) {
|
|
|
13618
13695
|
}
|
|
13619
13696
|
}
|
|
13620
13697
|
if (best === void 0) return void 0;
|
|
13621
|
-
const baseline = Math.max(
|
|
13698
|
+
const baseline = Math.max(
|
|
13699
|
+
normalizedInput.length,
|
|
13700
|
+
normalizeName(best).length,
|
|
13701
|
+
1
|
|
13702
|
+
);
|
|
13622
13703
|
return bestScore <= Math.max(2, Math.floor(baseline / 3)) ? best : void 0;
|
|
13623
13704
|
}
|
|
13624
13705
|
function describeUnknownRunServer(server, servers) {
|
|
@@ -13659,14 +13740,19 @@ function improveRunToolError(error, server, tool, knownTools) {
|
|
|
13659
13740
|
{ cause: error }
|
|
13660
13741
|
);
|
|
13661
13742
|
}
|
|
13662
|
-
if (!RUN_TOOL_REJECTED_PATTERNS.some((pattern) => pattern.test(message)))
|
|
13663
|
-
|
|
13743
|
+
if (!RUN_TOOL_REJECTED_PATTERNS.some((pattern) => pattern.test(message)))
|
|
13744
|
+
return error;
|
|
13745
|
+
return new Error(describeUnavailableRunTool(server, tool, knownTools), {
|
|
13746
|
+
cause: error
|
|
13747
|
+
});
|
|
13664
13748
|
}
|
|
13665
13749
|
var HANDSHAKE_RETRY_DELAYS_MS = [500, 1500];
|
|
13666
13750
|
function refusedHandshake(error) {
|
|
13667
13751
|
let current = error;
|
|
13668
13752
|
for (let depth = 0; current instanceof Error && depth < 5; depth += 1) {
|
|
13669
|
-
if (/Version negotiation failed: the server answered the probe with HTTP 5\d\d/.test(
|
|
13753
|
+
if (/Version negotiation failed: the server answered the probe with HTTP 5\d\d/.test(
|
|
13754
|
+
current.message
|
|
13755
|
+
)) {
|
|
13670
13756
|
return true;
|
|
13671
13757
|
}
|
|
13672
13758
|
current = current.cause;
|
|
@@ -13710,7 +13796,8 @@ async function createTools(opts) {
|
|
|
13710
13796
|
const server = serverPolicy.id;
|
|
13711
13797
|
toolsByServer[server] = new Proxy(/* @__PURE__ */ Object.create(null), {
|
|
13712
13798
|
get(_target, property) {
|
|
13713
|
-
if (typeof property !== "string" || PROXY_PROBE_PROPS.has(property))
|
|
13799
|
+
if (typeof property !== "string" || PROXY_PROBE_PROPS.has(property))
|
|
13800
|
+
return void 0;
|
|
13714
13801
|
const startCall = (args, format) => {
|
|
13715
13802
|
validateRunToolArgs(server, property, args);
|
|
13716
13803
|
const allowedToolNames = knownTools.get(server) ?? [];
|
|
@@ -13748,7 +13835,10 @@ async function createTools(opts) {
|
|
|
13748
13835
|
// A queued call must never outlive the workflow that owns
|
|
13749
13836
|
// it. mcporter forwards this timeout to the MCP SDK and
|
|
13750
13837
|
// resets the transport when it fires.
|
|
13751
|
-
timeoutMs: Math.min(
|
|
13838
|
+
timeoutMs: Math.min(
|
|
13839
|
+
opts.callTimeoutMs,
|
|
13840
|
+
opts.deadlineMs - Date.now()
|
|
13841
|
+
),
|
|
13752
13842
|
disableOAuth: true
|
|
13753
13843
|
}),
|
|
13754
13844
|
opts.deadlineMs
|
|
@@ -13825,7 +13915,8 @@ async function createTools(opts) {
|
|
|
13825
13915
|
}
|
|
13826
13916
|
const tools = new Proxy(toolsByServer, {
|
|
13827
13917
|
get(target, property) {
|
|
13828
|
-
if (typeof property !== "string" || PROXY_PROBE_PROPS.has(property))
|
|
13918
|
+
if (typeof property !== "string" || PROXY_PROBE_PROPS.has(property))
|
|
13919
|
+
return void 0;
|
|
13829
13920
|
if (property in target) return target[property];
|
|
13830
13921
|
throw new Error(
|
|
13831
13922
|
describeUnknownRunServer(
|
|
@@ -13844,16 +13935,20 @@ async function createTools(opts) {
|
|
|
13844
13935
|
};
|
|
13845
13936
|
}
|
|
13846
13937
|
function createVars(vars) {
|
|
13847
|
-
return new Proxy(
|
|
13848
|
-
|
|
13849
|
-
|
|
13850
|
-
|
|
13851
|
-
|
|
13852
|
-
|
|
13853
|
-
|
|
13854
|
-
|
|
13938
|
+
return new Proxy(
|
|
13939
|
+
{ ...vars },
|
|
13940
|
+
{
|
|
13941
|
+
get(target, property) {
|
|
13942
|
+
if (typeof property !== "string" || PROXY_PROBE_PROPS.has(property))
|
|
13943
|
+
return void 0;
|
|
13944
|
+
if (property in target) return target[property];
|
|
13945
|
+
const defined = Object.keys(target);
|
|
13946
|
+
throw new Error(
|
|
13947
|
+
`vars.${property} is not defined. Pass it with --var ${property}=value` + (defined.length > 0 ? ` (defined vars: ${defined.join(", ")}).` : " (no vars were passed).") + ` Use \`"${property}" in vars\` to test for optional vars.`
|
|
13948
|
+
);
|
|
13949
|
+
}
|
|
13855
13950
|
}
|
|
13856
|
-
|
|
13951
|
+
);
|
|
13857
13952
|
}
|
|
13858
13953
|
function createRunProcess() {
|
|
13859
13954
|
return new Proxy(globalThis.process, {
|
|
@@ -13885,7 +13980,9 @@ function concurrentOutcomeError(error, calls) {
|
|
|
13885
13980
|
function positiveInteger(value, label, fallback) {
|
|
13886
13981
|
const parsed = value === void 0 ? fallback : Number(value);
|
|
13887
13982
|
if (!Number.isSafeInteger(parsed) || parsed <= 0) {
|
|
13888
|
-
throw new McpRunUsageError(
|
|
13983
|
+
throw new McpRunUsageError(
|
|
13984
|
+
`${label} expects a positive integer, got '${value ?? ""}'.`
|
|
13985
|
+
);
|
|
13889
13986
|
}
|
|
13890
13987
|
return parsed;
|
|
13891
13988
|
}
|
|
@@ -13951,7 +14048,10 @@ async function runMcpJavaScript(code, opts = {}) {
|
|
|
13951
14048
|
(call) => !call.observed || call.outcome === "pending"
|
|
13952
14049
|
);
|
|
13953
14050
|
if (unsafeAtExit.length > 0) {
|
|
13954
|
-
const remainingSettleMs = Math.max(
|
|
14051
|
+
const remainingSettleMs = Math.max(
|
|
14052
|
+
0,
|
|
14053
|
+
Math.min(15e3, deadlineMs - Date.now())
|
|
14054
|
+
);
|
|
13955
14055
|
if (remainingSettleMs > 0) {
|
|
13956
14056
|
let settleTimer;
|
|
13957
14057
|
try {
|
|
@@ -14100,7 +14200,8 @@ function createDelegatedErrorFilter(write) {
|
|
|
14100
14200
|
let sawOAuthMetadataError = false;
|
|
14101
14201
|
const emit = (line) => {
|
|
14102
14202
|
if (/^\s+at\s\S/.test(line)) return;
|
|
14103
|
-
if (/trying to load OAuth metadata/.test(line))
|
|
14203
|
+
if (/trying to load OAuth metadata/.test(line))
|
|
14204
|
+
sawOAuthMetadataError = true;
|
|
14104
14205
|
const safe = line.replace(
|
|
14105
14206
|
/Tool '([^']+)' is not accessible on server '([^']+)' \(blocked by configuration\)/g,
|
|
14106
14207
|
"Tool '$1' is not enabled on server '$2' in this recipe session"
|
|
@@ -14267,7 +14368,9 @@ async function callWithSharedRuntime(runtime, args) {
|
|
|
14267
14368
|
if (configuredLimit !== void 0) {
|
|
14268
14369
|
const limit = Number(configuredLimit);
|
|
14269
14370
|
if (!Number.isSafeInteger(limit) || limit <= 0) {
|
|
14270
|
-
stderr.write(
|
|
14371
|
+
stderr.write(
|
|
14372
|
+
"PI_RECIPES_MCP_MAX_OUTPUT_BYTES must be a positive integer.\n"
|
|
14373
|
+
);
|
|
14271
14374
|
return 2;
|
|
14272
14375
|
}
|
|
14273
14376
|
const size = Buffer.byteLength(serialized, "utf8");
|
|
@@ -14465,8 +14568,10 @@ async function main(args = process.argv.slice(2)) {
|
|
|
14465
14568
|
try {
|
|
14466
14569
|
validated = validateDelegatedMcpCommand(args, await sessionCliPolicy());
|
|
14467
14570
|
} catch (error) {
|
|
14468
|
-
stderr.write(
|
|
14469
|
-
`)
|
|
14571
|
+
stderr.write(
|
|
14572
|
+
`mcp: failed to load the session MCP policy: ${error instanceof Error ? error.message : String(error)}
|
|
14573
|
+
`
|
|
14574
|
+
);
|
|
14470
14575
|
return 1;
|
|
14471
14576
|
}
|
|
14472
14577
|
if (validated.error) {
|
|
@@ -14484,7 +14589,9 @@ async function main(args = process.argv.slice(2)) {
|
|
|
14484
14589
|
);
|
|
14485
14590
|
if (duplicates.length > 0) {
|
|
14486
14591
|
stderr.write(
|
|
14487
|
-
`mcp call: argument${duplicates.length === 1 ? "" : "s"} ${duplicates.map((key) => `'${key}'`).join(
|
|
14592
|
+
`mcp call: argument${duplicates.length === 1 ? "" : "s"} ${duplicates.map((key) => `'${key}'`).join(
|
|
14593
|
+
", "
|
|
14594
|
+
)} ${duplicates.length === 1 ? "was" : "were"} passed more than once. Pass each argument exactly once.
|
|
14488
14595
|
`
|
|
14489
14596
|
);
|
|
14490
14597
|
return 2;
|
|
@@ -14495,8 +14602,10 @@ async function main(args = process.argv.slice(2)) {
|
|
|
14495
14602
|
if (delegatedArgs[0] === "call") {
|
|
14496
14603
|
return callWithMcporter(delegatedArgs.slice(1));
|
|
14497
14604
|
}
|
|
14498
|
-
stderr.write(
|
|
14499
|
-
`
|
|
14605
|
+
stderr.write(
|
|
14606
|
+
`mcp: command '${delegatedArgs[0]}' is unavailable in recipe sessions.
|
|
14607
|
+
`
|
|
14608
|
+
);
|
|
14500
14609
|
return 2;
|
|
14501
14610
|
}
|
|
14502
14611
|
async function executeMcpCommand(opts) {
|
package/dist/mcp-daemon.js
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
installMcpCommandIoRouting,
|
|
13
13
|
mcpDaemonRequestContext,
|
|
14
14
|
serializeMcpDaemonEnvelope
|
|
15
|
-
} from "./mcp-chunks/chunk-
|
|
15
|
+
} from "./mcp-chunks/chunk-GODH4VLN.js";
|
|
16
16
|
import "./mcp-chunks/chunk-S2F7DDP5.js";
|
|
17
17
|
import "./mcp-chunks/chunk-HNQSUT44.js";
|
|
18
18
|
import "./mcp-chunks/chunk-UFV6SVQG.js";
|
|
@@ -73,12 +73,12 @@ var active = /* @__PURE__ */ new Map();
|
|
|
73
73
|
var SHUTDOWN_GRACE_MS = 1e3;
|
|
74
74
|
var CATALOG_PRELOAD_BACKOFF_MS = [100, 250, 500, 1e3, 2e3];
|
|
75
75
|
function runtime() {
|
|
76
|
-
runtimePromise ??= createRuntime({
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
);
|
|
76
|
+
runtimePromise ??= createRuntime({
|
|
77
|
+
configPath: process.env.MCPORTER_CONFIG
|
|
78
|
+
}).catch((error) => {
|
|
79
|
+
runtimePromise = void 0;
|
|
80
|
+
throw error;
|
|
81
|
+
});
|
|
82
82
|
return runtimePromise;
|
|
83
83
|
}
|
|
84
84
|
function catalogHealthy(catalogs) {
|
|
@@ -177,16 +177,13 @@ function runWorkerPath() {
|
|
|
177
177
|
}
|
|
178
178
|
async function executeRun(request, socket, controller) {
|
|
179
179
|
const sharedRuntime = await runtime();
|
|
180
|
-
const worker = new Worker(
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
stdin: request.stdin,
|
|
186
|
-
servers: sharedRuntime.listServers()
|
|
187
|
-
}
|
|
180
|
+
const worker = new Worker(runWorkerPath(), {
|
|
181
|
+
workerData: {
|
|
182
|
+
args: request.args,
|
|
183
|
+
stdin: request.stdin,
|
|
184
|
+
servers: sharedRuntime.listServers()
|
|
188
185
|
}
|
|
189
|
-
);
|
|
186
|
+
});
|
|
190
187
|
const hardTimeout = setTimeout(
|
|
191
188
|
() => void worker.terminate(),
|
|
192
189
|
runTimeoutMs() + 2e3
|
|
@@ -211,8 +208,16 @@ async function executeRun(request, socket, controller) {
|
|
|
211
208
|
return;
|
|
212
209
|
}
|
|
213
210
|
if (message.type === "toolCall") {
|
|
214
|
-
void sharedRuntime.callTool(
|
|
215
|
-
(
|
|
211
|
+
void sharedRuntime.callTool(
|
|
212
|
+
String(message.server),
|
|
213
|
+
String(message.tool),
|
|
214
|
+
message.options
|
|
215
|
+
).then(
|
|
216
|
+
(result) => worker.postMessage({
|
|
217
|
+
type: "toolResult",
|
|
218
|
+
id: message.id,
|
|
219
|
+
result
|
|
220
|
+
}),
|
|
216
221
|
(error) => worker.postMessage({
|
|
217
222
|
type: "toolError",
|
|
218
223
|
id: message.id,
|
|
@@ -231,7 +236,12 @@ async function executeRun(request, socket, controller) {
|
|
|
231
236
|
worker.once("exit", (code) => {
|
|
232
237
|
if (settled) return;
|
|
233
238
|
if (controller.signal.aborted) finish(() => resolve(130));
|
|
234
|
-
else
|
|
239
|
+
else
|
|
240
|
+
finish(
|
|
241
|
+
() => reject(
|
|
242
|
+
new Error(`mcp run worker exited before completion (${code}).`)
|
|
243
|
+
)
|
|
244
|
+
);
|
|
235
245
|
});
|
|
236
246
|
});
|
|
237
247
|
} finally {
|
package/dist/mcp-run-worker.js
CHANGED
|
@@ -2,7 +2,7 @@ import { createRequire as __createRequire } from "node:module"; const require =
|
|
|
2
2
|
import {
|
|
3
3
|
executeMcpCommand,
|
|
4
4
|
installMcpCommandIoRouting
|
|
5
|
-
} from "./mcp-chunks/chunk-
|
|
5
|
+
} from "./mcp-chunks/chunk-GODH4VLN.js";
|
|
6
6
|
import "./mcp-chunks/chunk-S2F7DDP5.js";
|
|
7
7
|
import "./mcp-chunks/chunk-HNQSUT44.js";
|
|
8
8
|
import "./mcp-chunks/chunk-UFV6SVQG.js";
|
package/dist/memory.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../src/memory.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../src/memory.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,8BAA8B,MAAM,CAAC;AAClD,eAAO,MAAM,8BAA8B,QAAS,CAAC;AAErD,MAAM,WAAW,mBAAmB;IAClC,sEAAsE;IACtE,SAAS,EAAE,MAAM,CAAC;IAClB,8DAA8D;IAC9D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,uEAAuE;IACvE,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,WAAW,GAAG,IAAI,CAAC;IAC3B,WAAW,EAAE,gBAAgB,EAAE,CAAC;CACjC;AAED,MAAM,WAAW,sBAAuB,SAAQ,mBAAmB;IACjE,8DAA8D;IAC9D,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,MAAM,qBAAqB,GAAG,CAClC,IAAI,EAAE,qBAAqB,KACxB,qBAAqB,CAAC;AAE3B,qBAAa,wBAAyB,SAAQ,KAAK;IACjD,YAAY,OAAO,EAAE,MAAM,EAG1B;CACF;AA+DD,yEAAyE;AACzE,wBAAgB,eAAe,CAC7B,OAAO,EAAE,sBAAsB,GAC9B,qBAAqB,CA6CvB;AAyCD,kFAAkF;AAClF,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,GAAG,MAAM,CAoCxE"}
|
package/dist/memory.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { closeSync, openSync, readSync
|
|
1
|
+
import { closeSync, openSync, readSync } from "node:fs";
|
|
2
2
|
import { dirname, resolve } from "node:path";
|
|
3
3
|
import { StringDecoder } from "node:string_decoder";
|
|
4
4
|
export const DEFAULT_MEMORY_INDEX_MAX_LINES = 200;
|