@productbrain/mcp 0.0.1-beta.14895 → 0.0.1-beta.14908
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-B4FRHJNW.js → chunk-IFJHH4SQ.js} +44 -10
- package/dist/chunk-IFJHH4SQ.js.map +1 -0
- package/dist/{chunk-OAK72CUA.js → chunk-Z72YK5TB.js} +9 -4
- package/dist/chunk-Z72YK5TB.js.map +1 -0
- package/dist/cli/index.js +1 -1
- package/dist/http.js +2 -2
- package/dist/index.js +2 -2
- package/dist/{setup-MI275YU7.js → setup-HRXTTJ4U.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-B4FRHJNW.js.map +0 -1
- package/dist/chunk-OAK72CUA.js.map +0 -1
- /package/dist/{setup-MI275YU7.js.map → setup-HRXTTJ4U.js.map} +0 -0
|
@@ -218,7 +218,7 @@ function sanitizeRuleListField(value) {
|
|
|
218
218
|
return value.replace(RULE_LIST_CONTROL_CHARS_RE, "").replace(/\s+/g, " ").trim();
|
|
219
219
|
}
|
|
220
220
|
function formatRuleListRow(row) {
|
|
221
|
-
const entryId = sanitizeRuleListField(row.entryId);
|
|
221
|
+
const entryId = sanitizeRuleListField(row.entryId) + (row.change ? ` ${sanitizeRuleListField(row.change)}` : "");
|
|
222
222
|
const team = row.teamId ? ` (team ${sanitizeRuleListField(row.teamId)})` : "";
|
|
223
223
|
const servedAt = row.servedAt ? ` \u2014 served ${new Date(row.servedAt).toISOString()}` : "";
|
|
224
224
|
const name = row.name ? sanitizeRuleListField(row.name) : "";
|
|
@@ -401,7 +401,7 @@ function formatBriefingLines(view) {
|
|
|
401
401
|
var BRIEFING_UNAVAILABLE_LINE = "Purpose, vision, strategy and objective: unavailable \u2014 the briefing read failed; orient again to retry.";
|
|
402
402
|
var BRIEFING_CAPPED_LINE = "(A bounded read hit its cap: a fact above may be missing or not the current one.)";
|
|
403
403
|
function startRuleLine(row, clean = briefingLine, withWhy = false) {
|
|
404
|
-
const id = clean(row.entryId), title = clean(row.name ?? ""), why = withWhy && row.why ? clean(row.why) : "";
|
|
404
|
+
const id = clean(row.entryId) + (row.change ? ` ${clean(row.change)}` : ""), title = clean(row.name ?? ""), why = withWhy && row.why ? clean(row.why) : "";
|
|
405
405
|
return !title ? id : why ? `${id}: ${/[.!?]$/.test(title) ? title : `${title}.`} Why: ${why}` : `${id}: ${title}`;
|
|
406
406
|
}
|
|
407
407
|
function roleBodyLines(role, surface, clean) {
|
|
@@ -446,6 +446,37 @@ var AGENT_KEY_PREFIX = "pb_agent_";
|
|
|
446
446
|
var isApiKeyShaped = (token) => token.startsWith(API_KEY_PREFIX) || token.startsWith(AGENT_KEY_PREFIX);
|
|
447
447
|
var API_KEY_FORMAT_LINE = `A key starts with ${API_KEY_PREFIX} or ${AGENT_KEY_PREFIX}. Get one from Settings, API Keys.`;
|
|
448
448
|
|
|
449
|
+
// src/lib/replyLines.ts
|
|
450
|
+
import { AsyncLocalStorage as AsyncLocalStorage2 } from "async_hooks";
|
|
451
|
+
var STEP_CALLS = {
|
|
452
|
+
"entry.get": ({ id }) => id ? `context action=get entryId="${id}"` : void 0,
|
|
453
|
+
orient: () => "orient"
|
|
454
|
+
};
|
|
455
|
+
var collected = new AsyncLocalStorage2();
|
|
456
|
+
function formatReplyLine(line) {
|
|
457
|
+
const text = line.text.replace(/[\x00-\x08\x0b-\x1f\x7f-\x9f]/g, "").replace(/\s+/g, " ").trim();
|
|
458
|
+
const call = line.action ? STEP_CALLS[line.action.verb]?.(line.action.args ?? {}) : void 0;
|
|
459
|
+
return call ? `${text} \u2014 \`${call}\`` : text;
|
|
460
|
+
}
|
|
461
|
+
function replyLinesHeader() {
|
|
462
|
+
return collected.getStore() ? { "x-pb-lines": "1" } : {};
|
|
463
|
+
}
|
|
464
|
+
function keepReplyLines(meta) {
|
|
465
|
+
const store = collected.getStore();
|
|
466
|
+
const lines = meta?.lines;
|
|
467
|
+
if (!store || !Array.isArray(lines)) return;
|
|
468
|
+
for (const line of lines) {
|
|
469
|
+
if (!line || typeof line.text !== "string") continue;
|
|
470
|
+
const out = formatReplyLine(line);
|
|
471
|
+
if (!store.includes(out)) store.push(out);
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
async function runCollectingReplyLines(fn) {
|
|
475
|
+
const lines = [];
|
|
476
|
+
const result = await collected.run(lines, fn);
|
|
477
|
+
return { result, lines };
|
|
478
|
+
}
|
|
479
|
+
|
|
449
480
|
// src/generated/routeLatencyBudget.generated.ts
|
|
450
481
|
var ROUTE_LATENCY_BUDGET_MS = {
|
|
451
482
|
query: 1e4,
|
|
@@ -904,7 +935,7 @@ function recordGatewayCall(params) {
|
|
|
904
935
|
}
|
|
905
936
|
|
|
906
937
|
// src/client.ts
|
|
907
|
-
import { AsyncLocalStorage as
|
|
938
|
+
import { AsyncLocalStorage as AsyncLocalStorage4 } from "async_hooks";
|
|
908
939
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
909
940
|
|
|
910
941
|
// src/lib/spineRungs.ts
|
|
@@ -1212,8 +1243,8 @@ function retryIsFutile(code) {
|
|
|
1212
1243
|
|
|
1213
1244
|
// src/lib/commandId.ts
|
|
1214
1245
|
import { randomUUID } from "crypto";
|
|
1215
|
-
import { AsyncLocalStorage as
|
|
1216
|
-
var commandIdStore = new
|
|
1246
|
+
import { AsyncLocalStorage as AsyncLocalStorage3 } from "async_hooks";
|
|
1247
|
+
var commandIdStore = new AsyncLocalStorage3();
|
|
1217
1248
|
function runWithCommandId(fn) {
|
|
1218
1249
|
return commandIdStore.run(commandIdStore.getStore() ?? randomUUID(), fn);
|
|
1219
1250
|
}
|
|
@@ -1336,7 +1367,7 @@ function getConversationId() {
|
|
|
1336
1367
|
if (_conversationId === void 0) _conversationId = resolveConversationId() ?? `mcp:${randomUUID2()}`;
|
|
1337
1368
|
return _conversationId;
|
|
1338
1369
|
}
|
|
1339
|
-
var toolContextStore = new
|
|
1370
|
+
var toolContextStore = new AsyncLocalStorage4();
|
|
1340
1371
|
function runWithToolContext(ctx, fn) {
|
|
1341
1372
|
recordToolAction(ctx.tool, ctx.action);
|
|
1342
1373
|
return toolContextStore.run(ctx, () => runWithCommandId(fn));
|
|
@@ -1426,7 +1457,7 @@ function setSessionOriented(value) {
|
|
|
1426
1457
|
function getApiKeyScope() {
|
|
1427
1458
|
return state().apiKeyScope;
|
|
1428
1459
|
}
|
|
1429
|
-
var seatedSessionStore = new
|
|
1460
|
+
var seatedSessionStore = new AsyncLocalStorage4();
|
|
1430
1461
|
var getApiKeyId = () => state().apiKeyId;
|
|
1431
1462
|
var runWithSeatedSession = (lc, fn) => seatedSessionStore.run(lc, fn);
|
|
1432
1463
|
async function startAgentSession(role, team, clientName, preview = {}) {
|
|
@@ -1606,8 +1637,9 @@ async function callGateway(fn, args, recall = false) {
|
|
|
1606
1637
|
...commandHeader(),
|
|
1607
1638
|
// TASK-893: x-pb-command, the tool call this request serves
|
|
1608
1639
|
...touch.headers,
|
|
1609
|
-
...actingSessionHeader()
|
|
1610
|
-
|
|
1640
|
+
...actingSessionHeader(),
|
|
1641
|
+
...replyLinesHeader()
|
|
1642
|
+
// TASK-894: the heartbeat; TASK-1352: the session; TASK-1765: lines
|
|
1611
1643
|
},
|
|
1612
1644
|
body: JSON.stringify(recall ? { fn, args, recall } : { fn, args })
|
|
1613
1645
|
// TASK-911: a read-back
|
|
@@ -1646,6 +1678,7 @@ async function callGateway(fn, args, recall = false) {
|
|
|
1646
1678
|
}
|
|
1647
1679
|
audit(fn, "ok", Date.now() - start, void 0, { budgetMs });
|
|
1648
1680
|
const { data, summary, next, _meta } = json;
|
|
1681
|
+
keepReplyLines(_meta);
|
|
1649
1682
|
return {
|
|
1650
1683
|
data,
|
|
1651
1684
|
summary: summary || fn,
|
|
@@ -1805,6 +1838,7 @@ function apiKeysUrl() {
|
|
|
1805
1838
|
}
|
|
1806
1839
|
|
|
1807
1840
|
export {
|
|
1841
|
+
runCollectingReplyLines,
|
|
1808
1842
|
getAuditLog,
|
|
1809
1843
|
getMergedGatewaySeamCounters,
|
|
1810
1844
|
formatGatewaySeamSummary,
|
|
@@ -1879,4 +1913,4 @@ export {
|
|
|
1879
1913
|
appUrl,
|
|
1880
1914
|
apiKeysUrl
|
|
1881
1915
|
};
|
|
1882
|
-
//# sourceMappingURL=chunk-
|
|
1916
|
+
//# sourceMappingURL=chunk-IFJHH4SQ.js.map
|