@productbrain/mcp 0.0.1-beta.13248 → 0.0.1-beta.13276
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/{chunk-H25VJVJ4.js → chunk-DP5CIXMS.js} +77 -43
- package/dist/chunk-DP5CIXMS.js.map +1 -0
- package/dist/{chunk-PSUZNMLZ.js → chunk-FSA7LAHO.js} +8 -3
- package/dist/{chunk-PSUZNMLZ.js.map → chunk-FSA7LAHO.js.map} +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/http.js +2 -2
- package/dist/index.js +2 -2
- package/dist/{setup-NVMZYLH5.js → setup-XAILRVQL.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-H25VJVJ4.js.map +0 -1
- /package/dist/{setup-NVMZYLH5.js.map → setup-XAILRVQL.js.map} +0 -0
|
@@ -43,7 +43,7 @@ import {
|
|
|
43
43
|
setSessionOriented,
|
|
44
44
|
startAgentSession,
|
|
45
45
|
withAcceptPrompt
|
|
46
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-FSA7LAHO.js";
|
|
47
47
|
|
|
48
48
|
// src/server.ts
|
|
49
49
|
import { McpServer as McpServer2 } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
@@ -1571,12 +1571,12 @@ function nextLines(action, entryId, refusal) {
|
|
|
1571
1571
|
function coherencyRefusedResult(toolName, entryId, refusal) {
|
|
1572
1572
|
const action = toolName.endsWith("action=update") ? "update" : "accept";
|
|
1573
1573
|
const stays = action === "accept" ? LINK_REFUSAL_WORDS.notAccepted(entryId) : LINK_REFUSAL_WORDS.notChanged(entryId);
|
|
1574
|
-
const
|
|
1574
|
+
const reason2 = refusal.reason ?? LINK_REFUSAL_WORDS.unlinked;
|
|
1575
1575
|
const next = nextLines(action, entryId, refusal);
|
|
1576
1576
|
return failureResult(
|
|
1577
|
-
withAcceptPrompt([stays,
|
|
1577
|
+
withAcceptPrompt([stays, reason2, ...next].join("\n"), [refusal]),
|
|
1578
1578
|
"COHERENCY_REFUSED",
|
|
1579
|
-
`${stays} ${
|
|
1579
|
+
`${stays} ${reason2}`,
|
|
1580
1580
|
next.join("\n") || void 0,
|
|
1581
1581
|
void 0,
|
|
1582
1582
|
{ entryId, refusal }
|
|
@@ -1797,7 +1797,7 @@ ${mcp}`, "QUALITY_HELD", mcp.split("\n")[0] ?? mcp, mcp.split("\n")[1] ?? mcp, v
|
|
|
1797
1797
|
}, next)
|
|
1798
1798
|
};
|
|
1799
1799
|
}
|
|
1800
|
-
async function handleCommitEntry({ entryId, preview, steeringOverrideReason, qualityOverrideReason, coherencyAcknowledgement, replaces, reason }, toolName = "entries") {
|
|
1800
|
+
async function handleCommitEntry({ entryId, preview, steeringOverrideReason, qualityOverrideReason, coherencyAcknowledgement, replaces, reason: reason2 }, toolName = "entries") {
|
|
1801
1801
|
requireWriteAccess();
|
|
1802
1802
|
const entry = await kernelQuery("chain.getEntry", { entryId });
|
|
1803
1803
|
if (!entry) {
|
|
@@ -1816,15 +1816,15 @@ async function handleCommitEntry({ entryId, preview, steeringOverrideReason, qua
|
|
|
1816
1816
|
...qualityOverrideReason ? { qualityOverrideReason } : {},
|
|
1817
1817
|
// TASK-954
|
|
1818
1818
|
...coherencyAcknowledgement ? { coherencyAcknowledgement } : {},
|
|
1819
|
-
...replaces ? { replaces, ...
|
|
1819
|
+
...replaces ? { replaces, ...reason2 !== void 0 ? { replacesReason: reason2 } : {} } : {}
|
|
1820
1820
|
// TASK-1030; DEC-2006: the reason rides with it
|
|
1821
1821
|
}).catch((err) => {
|
|
1822
1822
|
const { code, details } = err;
|
|
1823
1823
|
const fix = code === "GROUNDING_GATE_BLOCKED" ? refusalFixOf(details) : null;
|
|
1824
1824
|
if (!fix) throw err;
|
|
1825
|
-
const
|
|
1825
|
+
const reason3 = err.message.replace(/^MCP call "[^"]+" failed \(\d+\): /s, "");
|
|
1826
1826
|
const acceptRefusal = details?.find((d) => typeof d === "object" && d !== null && "acceptRefusal" in d);
|
|
1827
|
-
return { status: "coherency_refused", refusal: { reason:
|
|
1827
|
+
return { status: "coherency_refused", refusal: { reason: reason3, fix, acceptRefusal: acceptRefusal?.acceptRefusal } };
|
|
1828
1828
|
});
|
|
1829
1829
|
if (result2?.status === "coherency_refused" && result2?.refusal) {
|
|
1830
1830
|
return coherencyRefusedResult(`${toolName} action=accept`, entryId, result2.refusal);
|
|
@@ -1847,7 +1847,7 @@ async function handleCommitEntry({ entryId, preview, steeringOverrideReason, qua
|
|
|
1847
1847
|
...typeof result2.conflictCheck === "string" ? { conflictCheck: result2.conflictCheck } : {}
|
|
1848
1848
|
// TASK-1040: as a real accept says it
|
|
1849
1849
|
},
|
|
1850
|
-
[{ tool: toolName, description: "Accept for real", parameters: { action: "accept", entryId, ...replaces ? { replaces, ...
|
|
1850
|
+
[{ tool: toolName, description: "Accept for real", parameters: { action: "accept", entryId, ...replaces ? { replaces, ...reason2 !== void 0 ? { reason: reason2 } : {} } : {} } }]
|
|
1851
1851
|
// TASK-1030
|
|
1852
1852
|
);
|
|
1853
1853
|
if (result2.contract) {
|
|
@@ -2229,14 +2229,14 @@ async function handleVerifyChain(server, { collection, mode: mode2 }) {
|
|
|
2229
2229
|
if (!cleaned) continue;
|
|
2230
2230
|
const kind = classifyRef(cleaned);
|
|
2231
2231
|
let result2;
|
|
2232
|
-
let
|
|
2232
|
+
let reason2;
|
|
2233
2233
|
if (kind === "file") {
|
|
2234
|
-
({ result: result2, reason } = checkFileRef(cleaned, projectRoot));
|
|
2234
|
+
({ result: result2, reason: reason2 } = checkFileRef(cleaned, projectRoot));
|
|
2235
2235
|
} else if (kind === "schema") {
|
|
2236
|
-
({ result: result2, reason } = checkSchemaRef(cleaned, schema));
|
|
2236
|
+
({ result: result2, reason: reason2 } = checkSchemaRef(cleaned, schema));
|
|
2237
2237
|
} else {
|
|
2238
2238
|
result2 = "unverifiable";
|
|
2239
|
-
|
|
2239
|
+
reason2 = "conceptual reference";
|
|
2240
2240
|
}
|
|
2241
2241
|
mappingChecks.push({
|
|
2242
2242
|
entryId: eid,
|
|
@@ -2244,7 +2244,7 @@ async function handleVerifyChain(server, { collection, mode: mode2 }) {
|
|
|
2244
2244
|
field: rawRef.trim(),
|
|
2245
2245
|
kind,
|
|
2246
2246
|
result: result2,
|
|
2247
|
-
reason,
|
|
2247
|
+
reason: reason2,
|
|
2248
2248
|
currentStatus: cm.status ?? "unknown"
|
|
2249
2249
|
});
|
|
2250
2250
|
}
|
|
@@ -2408,12 +2408,12 @@ var replaceEntrySchema = z10.object({
|
|
|
2408
2408
|
newEntryId: z10.string().max(200).describe("Human entry ID of the accepted entry of the same kind that replaces it."),
|
|
2409
2409
|
reason: z10.string().max(2e3).optional().describe("Why it is replaced, one line (required; the kernel refuses without one).")
|
|
2410
2410
|
});
|
|
2411
|
-
async function handleReplaceEntry({ entryId, newEntryId, reason }) {
|
|
2411
|
+
async function handleReplaceEntry({ entryId, newEntryId, reason: reason2 }) {
|
|
2412
2412
|
requireWriteAccess();
|
|
2413
2413
|
const agentSessionId = getAgentSessionId();
|
|
2414
2414
|
const result2 = await kernelMutation(
|
|
2415
2415
|
"chain.replaceEntry",
|
|
2416
|
-
{ oldEntryId: entryId, newEntryId, ...
|
|
2416
|
+
{ oldEntryId: entryId, newEntryId, ...reason2 !== void 0 ? { reason: reason2 } : {}, ...agentSessionId ? { sessionId: agentSessionId } : {} }
|
|
2417
2417
|
);
|
|
2418
2418
|
const message = [
|
|
2419
2419
|
`${sanitizeSingleLineField(result2.name)} (${sanitizeSingleLineField(result2.entryId)})`,
|
|
@@ -3821,8 +3821,8 @@ var LOOKUP_LINE = {
|
|
|
3821
3821
|
var INDENT = " ";
|
|
3822
3822
|
function siblingLine(kr, clean) {
|
|
3823
3823
|
const current = kr.readingUnresolved ? 'current unresolved, not "never read"' : kr.currentValue === null ? "no reading yet" : `current ${kr.currentValue}`;
|
|
3824
|
-
const
|
|
3825
|
-
return `${clean(kr.entryId)} \u2014 ${clean(kr.name)} (${current}${
|
|
3824
|
+
const target2 = kr.targetValue === null ? "" : `, target ${kr.targetValue}`;
|
|
3825
|
+
return `${clean(kr.entryId)} \u2014 ${clean(kr.name)} (${current}${target2})`;
|
|
3826
3826
|
}
|
|
3827
3827
|
function formatOutcomeObjectiveLines(view, clean) {
|
|
3828
3828
|
const o = view.objective;
|
|
@@ -6410,11 +6410,11 @@ async function runCoherenceCheck(projectRoot) {
|
|
|
6410
6410
|
});
|
|
6411
6411
|
return { status: "ok", report: result2.report, snapshot: result2.snapshot };
|
|
6412
6412
|
} catch (err) {
|
|
6413
|
-
const
|
|
6413
|
+
const reason2 = describeGatewayFailure(err);
|
|
6414
6414
|
if (process.env.DEBUG_COHERENCE) {
|
|
6415
|
-
console.debug("[coherence] chain.evaluateCoherence gateway call failed:",
|
|
6415
|
+
console.debug("[coherence] chain.evaluateCoherence gateway call failed:", reason2);
|
|
6416
6416
|
}
|
|
6417
|
-
return { status: "skipped", reason };
|
|
6417
|
+
return { status: "skipped", reason: reason2 };
|
|
6418
6418
|
}
|
|
6419
6419
|
}
|
|
6420
6420
|
function renderCoherenceLines(report) {
|
|
@@ -8865,8 +8865,8 @@ async function handleGetRun(runId, workflowId) {
|
|
|
8865
8865
|
});
|
|
8866
8866
|
}
|
|
8867
8867
|
if (!run) {
|
|
8868
|
-
const
|
|
8869
|
-
return validationResult(`No persisted run found for ${
|
|
8868
|
+
const target2 = runId ? `workflow run '${runId}'` : `workflow '${workflowId}' in the current session`;
|
|
8869
|
+
return validationResult(`No persisted run found for ${target2}.`);
|
|
8870
8870
|
}
|
|
8871
8871
|
if (workflowId && run.workflowId !== workflowId) {
|
|
8872
8872
|
return validationResult(
|
|
@@ -9382,8 +9382,8 @@ function readSpineVerdict(value) {
|
|
|
9382
9382
|
}
|
|
9383
9383
|
function describeSpineStaleness(changedMemberCount, membershipTruncated = false, relationsChanged = false) {
|
|
9384
9384
|
if (changedMemberCount > 0) {
|
|
9385
|
-
const
|
|
9386
|
-
return
|
|
9385
|
+
const reason2 = `${membershipTruncated ? "at least " : ""}${changedMemberCount} entr${changedMemberCount === 1 ? "y" : "ies"} changed, joined or left the direction since this was checked`;
|
|
9386
|
+
return reason2 + (membershipTruncated ? "; membership scan incomplete" : "");
|
|
9387
9387
|
}
|
|
9388
9388
|
if (relationsChanged) {
|
|
9389
9389
|
return "a part_of or validates link changed since this check ran" + (membershipTruncated ? "; membership scan incomplete" : "");
|
|
@@ -10284,7 +10284,7 @@ async function handleClose() {
|
|
|
10284
10284
|
const closed = await closeAgentSession();
|
|
10285
10285
|
clearSessionGaps();
|
|
10286
10286
|
if (!closed) throw new Error("No active agent session to close.");
|
|
10287
|
-
const { created, modified, relationsCreated: relations, capturesTruncated, modifiedTruncated, capLine } = closed;
|
|
10287
|
+
const { created, modified, relationsCreated: relations, capturesTruncated, modifiedTruncated, capLine, callLine } = closed;
|
|
10288
10288
|
const lines = [
|
|
10289
10289
|
`Session ${sessionId} closed.`,
|
|
10290
10290
|
""
|
|
@@ -10300,6 +10300,7 @@ async function handleClose() {
|
|
|
10300
10300
|
...session ? [`| Gate failures | ${gates} |`, `| Contradiction warnings | ${warnings} |`] : []
|
|
10301
10301
|
);
|
|
10302
10302
|
if (capLine) lines.push("", capLine);
|
|
10303
|
+
if (callLine) lines.push("", callLine);
|
|
10303
10304
|
let rituals = null;
|
|
10304
10305
|
try {
|
|
10305
10306
|
rituals = await kernelCall("chain.getRitualsSurface", {});
|
|
@@ -10319,6 +10320,7 @@ async function handleClose() {
|
|
|
10319
10320
|
capturesTruncated,
|
|
10320
10321
|
modifiedTruncated,
|
|
10321
10322
|
...capLine ? { capLine } : {},
|
|
10323
|
+
...callLine ? { callLine } : {},
|
|
10322
10324
|
gateFailures: gates,
|
|
10323
10325
|
contradictionWarnings: warnings,
|
|
10324
10326
|
wrapupNudge: wrapupNudge.length > 0,
|
|
@@ -11151,22 +11153,43 @@ function registerFeedbackTool(server) {
|
|
|
11151
11153
|
|
|
11152
11154
|
// src/tools/conflicts.ts
|
|
11153
11155
|
import { z as z33 } from "zod/v3";
|
|
11156
|
+
|
|
11157
|
+
// src/lib/conflictResolution.ts
|
|
11158
|
+
var CONFLICT_RESOLUTIONS = ["replaces", "refines", "unrelated"];
|
|
11159
|
+
var CONFLICT_RESOLUTION_REASON_MAX = 200;
|
|
11160
|
+
var signed = (line) => line;
|
|
11161
|
+
var RESOLUTION_WORDS = {
|
|
11162
|
+
choose: signed(`Choose ${CONFLICT_RESOLUTIONS.slice(0, -1).join(", ")} or ${CONFLICT_RESOLUTIONS[CONFLICT_RESOLUTIONS.length - 1]}.`),
|
|
11163
|
+
both: signed("Give either the answer (real or false alarm) or the choice, not both."),
|
|
11164
|
+
reasonTooLong: signed(`Keep the reason to one line of ${CONFLICT_RESOLUTION_REASON_MAX} characters or fewer.`),
|
|
11165
|
+
target: "replaces or refines: the entry it replaces or refines, one of the two",
|
|
11166
|
+
reason: `For unrelated: one line on why (${CONFLICT_RESOLUTION_REASON_MAX} characters at most); for an amendment: why the answer changes`,
|
|
11167
|
+
recorded: (choice2) => `Recorded: ${choice2}.`
|
|
11168
|
+
};
|
|
11169
|
+
|
|
11170
|
+
// src/tools/conflicts.ts
|
|
11154
11171
|
var ACTIONS = ["list", "resolve"];
|
|
11155
11172
|
var mode = z33.enum(["actionable", "all"]);
|
|
11156
11173
|
var verdict = z33.enum(["real", "noise"]);
|
|
11174
|
+
var choice = z33.enum(CONFLICT_RESOLUTIONS, { errorMap: () => ({ message: RESOLUTION_WORDS.choose }) });
|
|
11175
|
+
var target = z33.string().max(200).optional();
|
|
11176
|
+
var reason = z33.string().max(CONFLICT_RESOLUTION_REASON_MAX, RESOLUTION_WORDS.reasonTooLong).optional();
|
|
11157
11177
|
var conflictsSchema = z33.object({
|
|
11158
11178
|
action: z33.enum(ACTIONS),
|
|
11159
|
-
mode: mode.optional().describe("list: all adds judged
|
|
11160
|
-
issueId: z33.string().max(200).optional().describe("resolve:
|
|
11161
|
-
|
|
11179
|
+
mode: mode.optional().describe("list: all adds judged."),
|
|
11180
|
+
issueId: z33.string().max(200).optional().describe("resolve: id from list."),
|
|
11181
|
+
choice: choice.optional(),
|
|
11182
|
+
target,
|
|
11183
|
+
reason,
|
|
11184
|
+
verdict: verdict.optional()
|
|
11162
11185
|
});
|
|
11163
11186
|
var conflictsActionUnion = z33.discriminatedUnion("action", [
|
|
11164
11187
|
z33.object({ action: z33.literal("list"), mode: mode.optional() }),
|
|
11165
|
-
z33.object({ action: z33.literal("resolve"), issueId: z33.string().min(1).max(200), verdict })
|
|
11188
|
+
z33.object({ action: z33.literal("resolve"), issueId: z33.string().min(1).max(200), choice: choice.optional(), target, reason, verdict: verdict.optional() })
|
|
11166
11189
|
]);
|
|
11167
11190
|
var CONFLICTS_ACTION_SPECS = {
|
|
11168
|
-
list: { params: ["mode"], description: "mode
|
|
11169
|
-
resolve: { params: ["issueId", "verdict"], description: "issueId and
|
|
11191
|
+
list: { params: ["mode"], description: "mode: actionable by default." },
|
|
11192
|
+
resolve: { params: ["issueId", "choice", "target", "reason", "verdict"], description: "issueId and choice (or verdict)." }
|
|
11170
11193
|
};
|
|
11171
11194
|
async function handleConflictsList(listMode = "actionable") {
|
|
11172
11195
|
const rows = await kernelCall("conflicts.list", { mode: listMode });
|
|
@@ -11174,12 +11197,23 @@ async function handleConflictsList(listMode = "actionable") {
|
|
|
11174
11197
|
const lines = rows.map((r) => `${r.id} \xB7 ${side(r.entryAName, r.entryAId)} \u2194 ${side(r.entryBName, r.entryBId)} \xB7 ${r.conflictType} ${r.confidence.toFixed(2)}${r.rankLabel ? ` \xB7 ${sanitizeSingleLineField(r.rankLabel)}` : ""} \xB7 ${sanitizeSingleLineField(r.explanation)}` + (r.guidance ? ` \xB7 ${sanitizeSingleLineField(r.guidance)}` : ""));
|
|
11175
11198
|
const truncated = rows[0]?.listTruncated === true;
|
|
11176
11199
|
const count = `${rows.length}${truncated ? "+" : ""} contradiction${rows.length === 1 && !truncated ? "" : "s"}`;
|
|
11177
|
-
const summary = rows.length === 0 ? listMode === "all" ? "No open contradictions." : "No contradictions await your verdict. mode=all shows judged and snoozed rows." : listMode === "all" ? `${count} open, judged and snoozed included.` : `${count}. Resolve one: conflicts action=resolve issueId=<id>
|
|
11200
|
+
const summary = rows.length === 0 ? listMode === "all" ? "No open contradictions." : "No contradictions await your verdict. mode=all shows judged and snoozed rows." : listMode === "all" ? `${count} open, judged and snoozed included.` : `${count}. Resolve one: conflicts action=resolve issueId=<id> choice=${CONFLICT_RESOLUTIONS.join("|")}`;
|
|
11178
11201
|
const order = rows[0]?.rankOrderNote ? [sanitizeSingleLineField(rows[0].rankOrderNote)] : [];
|
|
11179
11202
|
return successResult([summary, ...order, ...lines].join("\n"), summary, { mode: listMode, rows });
|
|
11180
11203
|
}
|
|
11181
|
-
async function handleConflictsResolve(issueId, word) {
|
|
11204
|
+
async function handleConflictsResolve(issueId, { choice: pick, target: entry, reason: why, verdict: word }) {
|
|
11205
|
+
if (!pick === !word) return validationResult(pick ? RESOLUTION_WORDS.both : RESOLUTION_WORDS.choose);
|
|
11182
11206
|
requireWriteAccess();
|
|
11207
|
+
if (pick) {
|
|
11208
|
+
const result3 = await kernelCall("conflicts.resolve", {
|
|
11209
|
+
issueId,
|
|
11210
|
+
resolution: pick,
|
|
11211
|
+
...entry ? { resolutionTarget: entry } : {},
|
|
11212
|
+
...why ? { resolutionReason: why } : {}
|
|
11213
|
+
});
|
|
11214
|
+
const line = "line" in result3 && typeof result3.line === "string" ? sanitizeSingleLineField(result3.line) : RESOLUTION_WORDS.recorded(pick);
|
|
11215
|
+
return successResult(line, line, { issueId, choice: pick, result: result3 });
|
|
11216
|
+
}
|
|
11183
11217
|
const result2 = await kernelCall("conflicts.resolve", {
|
|
11184
11218
|
issueId,
|
|
11185
11219
|
verdict: word === "noise" ? "false_alarm" : "real"
|
|
@@ -11190,11 +11224,11 @@ async function handleConflictsResolve(issueId, word) {
|
|
|
11190
11224
|
function registerConflictsTool(server) {
|
|
11191
11225
|
const handlers = {
|
|
11192
11226
|
list: (data) => handleConflictsList(data.mode),
|
|
11193
|
-
resolve: (data) => handleConflictsResolve(data.issueId, data
|
|
11227
|
+
resolve: (data) => handleConflictsResolve(data.issueId, data)
|
|
11194
11228
|
};
|
|
11195
11229
|
server.registerTool("conflicts", {
|
|
11196
11230
|
title: "Conflicts",
|
|
11197
|
-
description: "Contradictions
|
|
11231
|
+
description: "Contradictions between entries: list or resolve them.",
|
|
11198
11232
|
inputSchema: conflictsSchema,
|
|
11199
11233
|
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false }
|
|
11200
11234
|
}, thinWrapper(async (args) => {
|
|
@@ -11311,15 +11345,15 @@ async function handleQuestionAnswer(entryId, text, answerEntryId) {
|
|
|
11311
11345
|
return questionErrorResult(err, "answer", { entryId, text, answerEntryId });
|
|
11312
11346
|
}
|
|
11313
11347
|
}
|
|
11314
|
-
async function handleQuestionForceClose(entryId,
|
|
11348
|
+
async function handleQuestionForceClose(entryId, reason2) {
|
|
11315
11349
|
requireWriteAccess();
|
|
11316
11350
|
try {
|
|
11317
11351
|
const resolvedEntryId = await resolveEntryRef(entryId, "Entry");
|
|
11318
|
-
const result2 = await kernelMutation("question.forceClose", { entryId: resolvedEntryId, reason, sessionId: getAgentSessionId() ?? void 0 });
|
|
11352
|
+
const result2 = await kernelMutation("question.forceClose", { entryId: resolvedEntryId, reason: reason2, sessionId: getAgentSessionId() ?? void 0 });
|
|
11319
11353
|
const message = result2.idempotent ? `${entryId} is already closed \u2014 no change.` : "Force-closed. Reason recorded.";
|
|
11320
11354
|
return successResult(message, message, result2);
|
|
11321
11355
|
} catch (err) {
|
|
11322
|
-
return questionErrorResult(err, "force-close", { entryId, reason });
|
|
11356
|
+
return questionErrorResult(err, "force-close", { entryId, reason: reason2 });
|
|
11323
11357
|
}
|
|
11324
11358
|
}
|
|
11325
11359
|
async function handleQuestionList(mine) {
|
|
@@ -11952,7 +11986,7 @@ async function validateOrRefuse(sessionId) {
|
|
|
11952
11986
|
} catch (err) {
|
|
11953
11987
|
const { code, message, recovery } = classifyError(err);
|
|
11954
11988
|
const firstLine = message.split("\n")[0].trim();
|
|
11955
|
-
const
|
|
11989
|
+
const reason2 = /^[A-Z]\w*Error\b|validator/i.test(firstLine) ? null : firstLine.replace(/\.?\s*$/, ".");
|
|
11956
11990
|
const ended = err instanceof KernelCallError && err.code !== void 0 && ENDED_SESSION_CODES.has(err.code);
|
|
11957
11991
|
const result2 = ended ? failureResult(
|
|
11958
11992
|
errorText({ message, recovery: PASS_SESSION_ID }),
|
|
@@ -11961,9 +11995,9 @@ async function validateOrRefuse(sessionId) {
|
|
|
11961
11995
|
PASS_SESSION_ID,
|
|
11962
11996
|
[{ tool: "session", description: "Start a session", parameters: { action: "start" } }]
|
|
11963
11997
|
) : err instanceof KernelCallError && err.status >= 400 && err.status < 500 && err.status !== 429 && err.code !== WORKSPACE_CLOSED ? failureResult(
|
|
11964
|
-
errorText({ message: `The sessionId you passed [${sessionId}] was refused${
|
|
11998
|
+
errorText({ message: `The sessionId you passed [${sessionId}] was refused${reason2 ? `: ${reason2}` : "."}`, recovery: PASS_SESSION_ID }),
|
|
11965
11999
|
"SESSION_INVALID",
|
|
11966
|
-
`sessionId refused${
|
|
12000
|
+
`sessionId refused${reason2 ? `: ${reason2}` : "."}`,
|
|
11967
12001
|
PASS_SESSION_ID,
|
|
11968
12002
|
[{ tool: "session", description: "Start a session", parameters: { action: "start" } }]
|
|
11969
12003
|
) : failureResult(errorText({ message, recovery }), code, message, recovery);
|
|
@@ -12002,4 +12036,4 @@ export {
|
|
|
12002
12036
|
SERVER_VERSION,
|
|
12003
12037
|
createProductBrainServer
|
|
12004
12038
|
};
|
|
12005
|
-
//# sourceMappingURL=chunk-
|
|
12039
|
+
//# sourceMappingURL=chunk-DP5CIXMS.js.map
|