@integrity-labs/agt-cli 0.28.318 → 0.28.320
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/bin/agt.js +96 -4
- package/dist/bin/agt.js.map +1 -1
- package/dist/{chunk-2DIWTRTU.js → chunk-CJSATK6B.js} +1024 -200
- package/dist/chunk-CJSATK6B.js.map +1 -0
- package/dist/{chunk-4DHYHNCV.js → chunk-NAS4DZNG.js} +184 -2
- package/dist/chunk-NAS4DZNG.js.map +1 -0
- package/dist/{claude-pair-runtime-PWVOBBX4.js → claude-pair-runtime-DO6OWWGD.js} +2 -2
- package/dist/lib/manager-worker.js +1505 -200
- package/dist/lib/manager-worker.js.map +1 -1
- package/dist/mcp/direct-chat-channel.js +1 -1
- package/dist/mcp/origami.js +6 -1
- package/dist/mcp/remote-oauth-proxy.js +36 -10
- package/dist/mcp/slack-channel.js +105 -58
- package/dist/mcp/teams-channel.js +21 -12
- package/dist/mcp/telegram-channel.js +18 -13
- package/dist/{persistent-session-VSSEZTY7.js → persistent-session-ZQSAZIVM.js} +2 -2
- package/dist/{responsiveness-probe-I6YFUKYD.js → responsiveness-probe-NARLJJGH.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-2DIWTRTU.js.map +0 -1
- package/dist/chunk-4DHYHNCV.js.map +0 -1
- /package/dist/{claude-pair-runtime-PWVOBBX4.js.map → claude-pair-runtime-DO6OWWGD.js.map} +0 -0
- /package/dist/{persistent-session-VSSEZTY7.js.map → persistent-session-ZQSAZIVM.js.map} +0 -0
- /package/dist/{responsiveness-probe-I6YFUKYD.js.map → responsiveness-probe-NARLJJGH.js.map} +0 -0
|
@@ -14768,7 +14768,7 @@ function isMaintenanceModeActive(opts) {
|
|
|
14768
14768
|
});
|
|
14769
14769
|
}
|
|
14770
14770
|
|
|
14771
|
-
//
|
|
14771
|
+
// ../core/dist/channels/governance/sender-policy-decline.js
|
|
14772
14772
|
function decideDeclineReply(input) {
|
|
14773
14773
|
const last = input.cache.get(input.key);
|
|
14774
14774
|
if (last !== void 0) {
|
package/dist/mcp/origami.js
CHANGED
|
@@ -38801,7 +38801,12 @@ var INTEGRATION_REGISTRY = [
|
|
|
38801
38801
|
},
|
|
38802
38802
|
// ENG-5857 mints the real session id; default empty so the header
|
|
38803
38803
|
// resolves cleanly (no profile bound → ephemeral session) until then.
|
|
38804
|
-
envDefaults: { ANCHOR_BROWSER_SESSION_ID: "" }
|
|
38804
|
+
envDefaults: { ANCHOR_BROWSER_SESSION_ID: "" },
|
|
38805
|
+
// ENG-7748: route through the stdio remote-MCP proxy so the api-key and
|
|
38806
|
+
// the minted anchor-session-id headers are read LIVE per request. A
|
|
38807
|
+
// re-minted session id then takes effect with no agent respawn (a direct-
|
|
38808
|
+
// HTTP header would be frozen at spawn).
|
|
38809
|
+
liveHeaderRefresh: true
|
|
38805
38810
|
}
|
|
38806
38811
|
},
|
|
38807
38812
|
{
|
|
@@ -12,6 +12,8 @@ var TOKEN_FILE_ENV = "AGT_REMOTE_MCP_TOKEN_FILE";
|
|
|
12
12
|
var TOKEN_VAR_ENV = "AGT_REMOTE_MCP_TOKEN_VAR";
|
|
13
13
|
var ALLOWLIST_ENV = "AGT_REMOTE_MCP_TOOL_ALLOWLIST";
|
|
14
14
|
var PREENABLE_ENV = "AGT_REMOTE_MCP_PREENABLE_TOOLSETS";
|
|
15
|
+
var AUTH_HEADER_ENV = "AGT_REMOTE_MCP_AUTH_HEADER";
|
|
16
|
+
var EXTRA_HEADERS_ENV = "AGT_REMOTE_MCP_EXTRA_HEADERS";
|
|
15
17
|
var REMOTE_FETCH_TIMEOUT_MS = 3e4;
|
|
16
18
|
var remoteUrl = process.env[URL_ENV] ?? "";
|
|
17
19
|
var tokenFile = process.env[TOKEN_FILE_ENV] ?? "";
|
|
@@ -19,6 +21,8 @@ var tokenVar = process.env[TOKEN_VAR_ENV] ?? "";
|
|
|
19
21
|
var label = process.env["AGT_REMOTE_MCP_LABEL"] || tokenVar || "remote-oauth";
|
|
20
22
|
var toolAllowlist = parseToolAllowlist(process.env[ALLOWLIST_ENV] ?? "");
|
|
21
23
|
var preEnableToolsets = parsePreEnableToolsets(process.env[PREENABLE_ENV] ?? "");
|
|
24
|
+
var authHeaderName = (process.env[AUTH_HEADER_ENV] ?? "").trim();
|
|
25
|
+
var extraHeaderSpecs = parseExtraHeaders(process.env[EXTRA_HEADERS_ENV] ?? "");
|
|
22
26
|
function logErr(msg) {
|
|
23
27
|
process.stderr.write(`[remote-oauth-proxy:${label}] ${msg}
|
|
24
28
|
`);
|
|
@@ -91,6 +95,19 @@ function parseToolAllowlist(raw) {
|
|
|
91
95
|
}
|
|
92
96
|
return out;
|
|
93
97
|
}
|
|
98
|
+
function parseExtraHeaders(raw) {
|
|
99
|
+
const out = [];
|
|
100
|
+
for (const part of (raw || "").split(",")) {
|
|
101
|
+
const trimmed = part.trim();
|
|
102
|
+
if (!trimmed) continue;
|
|
103
|
+
const colon = trimmed.indexOf(":");
|
|
104
|
+
if (colon <= 0) continue;
|
|
105
|
+
const header = trimmed.slice(0, colon).trim();
|
|
106
|
+
const varName = trimmed.slice(colon + 1).trim();
|
|
107
|
+
if (header && varName) out.push({ header, varName });
|
|
108
|
+
}
|
|
109
|
+
return out;
|
|
110
|
+
}
|
|
94
111
|
function filterToolsListMessage(message, allow) {
|
|
95
112
|
if (allow.size === 0) return { message, total: 0, kept: 0, advertised: [] };
|
|
96
113
|
let obj;
|
|
@@ -166,14 +183,25 @@ function extractJsonRpcMessages(contentType, body) {
|
|
|
166
183
|
}
|
|
167
184
|
return out;
|
|
168
185
|
}
|
|
186
|
+
function buildForwardHeaders(token, authHeader, extras, readVar) {
|
|
187
|
+
const headers = {
|
|
188
|
+
"Content-Type": "application/json",
|
|
189
|
+
Accept: "application/json, text/event-stream"
|
|
190
|
+
};
|
|
191
|
+
if (authHeader) headers[authHeader] = token;
|
|
192
|
+
else headers["Authorization"] = `Bearer ${token}`;
|
|
193
|
+
for (const { header, varName } of extras) {
|
|
194
|
+
headers[header] = readVar(varName) ?? "";
|
|
195
|
+
}
|
|
196
|
+
return headers;
|
|
197
|
+
}
|
|
198
|
+
function readTokenVar(varName) {
|
|
199
|
+
return readCurrentToken(tokenFile, varName);
|
|
200
|
+
}
|
|
169
201
|
async function postRpc(token, body) {
|
|
170
202
|
const res = await fetch(remoteUrl, {
|
|
171
203
|
method: "POST",
|
|
172
|
-
headers:
|
|
173
|
-
"Content-Type": "application/json",
|
|
174
|
-
Accept: "application/json, text/event-stream",
|
|
175
|
-
Authorization: `Bearer ${token}`
|
|
176
|
-
},
|
|
204
|
+
headers: buildForwardHeaders(token, authHeaderName, extraHeaderSpecs, readTokenVar),
|
|
177
205
|
body,
|
|
178
206
|
signal: AbortSignal.timeout(REMOTE_FETCH_TIMEOUT_MS)
|
|
179
207
|
});
|
|
@@ -250,11 +278,7 @@ async function forward(line, id, isNotification, method, params) {
|
|
|
250
278
|
try {
|
|
251
279
|
res = await fetch(remoteUrl, {
|
|
252
280
|
method: "POST",
|
|
253
|
-
headers:
|
|
254
|
-
"Content-Type": "application/json",
|
|
255
|
-
Accept: "application/json, text/event-stream",
|
|
256
|
-
Authorization: `Bearer ${token}`
|
|
257
|
-
},
|
|
281
|
+
headers: buildForwardHeaders(token, authHeaderName, extraHeaderSpecs, readTokenVar),
|
|
258
282
|
body: line,
|
|
259
283
|
signal: AbortSignal.timeout(REMOTE_FETCH_TIMEOUT_MS)
|
|
260
284
|
});
|
|
@@ -361,6 +385,7 @@ if (invokedDirectly) {
|
|
|
361
385
|
}
|
|
362
386
|
export {
|
|
363
387
|
buildEnableToolsetRequest,
|
|
388
|
+
buildForwardHeaders,
|
|
364
389
|
buildToolsListRequest,
|
|
365
390
|
extractJsonRpcMessages,
|
|
366
391
|
extractToolsArray,
|
|
@@ -368,6 +393,7 @@ export {
|
|
|
368
393
|
isToolCallBlocked,
|
|
369
394
|
main,
|
|
370
395
|
parseEnableToolsetResponse,
|
|
396
|
+
parseExtraHeaders,
|
|
371
397
|
parsePreEnableToolsets,
|
|
372
398
|
parseToolAllowlist,
|
|
373
399
|
readCurrentToken,
|
|
@@ -14233,7 +14233,7 @@ var Server = class extends Protocol {
|
|
|
14233
14233
|
}
|
|
14234
14234
|
};
|
|
14235
14235
|
|
|
14236
|
-
//
|
|
14236
|
+
// ../core/dist/channels/slack-rich-text.js
|
|
14237
14237
|
var MAX_DEPTH = 12;
|
|
14238
14238
|
function isRecord(v) {
|
|
14239
14239
|
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
@@ -14262,14 +14262,16 @@ function renderEmoji(el) {
|
|
|
14262
14262
|
return name ? `:${name}:` : "";
|
|
14263
14263
|
}
|
|
14264
14264
|
function renderLeaf(el) {
|
|
14265
|
-
if (!isRecord(el))
|
|
14265
|
+
if (!isRecord(el))
|
|
14266
|
+
return "";
|
|
14266
14267
|
switch (asString(el.type)) {
|
|
14267
14268
|
case "text":
|
|
14268
14269
|
return asString(el.text);
|
|
14269
14270
|
case "link": {
|
|
14270
14271
|
const label = asString(el.text);
|
|
14271
14272
|
const url = asString(el.url);
|
|
14272
|
-
if (label && url && label !== url)
|
|
14273
|
+
if (label && url && label !== url)
|
|
14274
|
+
return `${label} (${url})`;
|
|
14273
14275
|
return label || url;
|
|
14274
14276
|
}
|
|
14275
14277
|
case "emoji":
|
|
@@ -14285,7 +14287,8 @@ function renderLeaf(el) {
|
|
|
14285
14287
|
case "date":
|
|
14286
14288
|
return asString(el.fallback) || asString(el.timestamp);
|
|
14287
14289
|
default:
|
|
14288
|
-
if (Array.isArray(el.elements))
|
|
14290
|
+
if (Array.isArray(el.elements))
|
|
14291
|
+
return renderInline(el.elements);
|
|
14289
14292
|
return asString(el.text);
|
|
14290
14293
|
}
|
|
14291
14294
|
}
|
|
@@ -14293,20 +14296,27 @@ function renderInline(elements) {
|
|
|
14293
14296
|
return elements.map(renderLeaf).join("");
|
|
14294
14297
|
}
|
|
14295
14298
|
function deepText(node, depth) {
|
|
14296
|
-
if (depth > MAX_DEPTH)
|
|
14297
|
-
|
|
14298
|
-
if (
|
|
14299
|
-
|
|
14299
|
+
if (depth > MAX_DEPTH)
|
|
14300
|
+
return "";
|
|
14301
|
+
if (typeof node === "string")
|
|
14302
|
+
return node;
|
|
14303
|
+
if (Array.isArray(node))
|
|
14304
|
+
return node.map((n) => deepText(n, depth + 1)).join("");
|
|
14305
|
+
if (!isRecord(node))
|
|
14306
|
+
return "";
|
|
14300
14307
|
const type = asString(node.type);
|
|
14301
14308
|
if (type && type !== "rich_text" && !type.startsWith("rich_text_") && !type.includes("table")) {
|
|
14302
14309
|
return renderLeaf(node);
|
|
14303
14310
|
}
|
|
14304
|
-
if (Array.isArray(node.elements))
|
|
14305
|
-
|
|
14311
|
+
if (Array.isArray(node.elements))
|
|
14312
|
+
return node.elements.map((n) => deepText(n, depth + 1)).join("");
|
|
14313
|
+
if (Array.isArray(node.rows))
|
|
14314
|
+
return node.rows.map((n) => deepText(n, depth + 1)).join(" ");
|
|
14306
14315
|
return asString(node.text);
|
|
14307
14316
|
}
|
|
14308
14317
|
function renderCell(cell) {
|
|
14309
|
-
if (!isRecord(cell))
|
|
14318
|
+
if (!isRecord(cell))
|
|
14319
|
+
return deepText(cell, 0).replace(/\s*\n\s*/g, " ").trim();
|
|
14310
14320
|
const inner = Array.isArray(cell.elements) ? renderSection(cell, 0) : deepText(cell, 0);
|
|
14311
14321
|
return inner.replace(/\s*\n\s*/g, " ").trim();
|
|
14312
14322
|
}
|
|
@@ -14314,9 +14324,11 @@ function renderTable(el) {
|
|
|
14314
14324
|
const rawRows = asArray(el.elements).length ? asArray(el.elements) : asArray(el.rows);
|
|
14315
14325
|
const rows = [];
|
|
14316
14326
|
for (const row of rawRows) {
|
|
14317
|
-
if (!isRecord(row) && !Array.isArray(row))
|
|
14327
|
+
if (!isRecord(row) && !Array.isArray(row))
|
|
14328
|
+
continue;
|
|
14318
14329
|
const rawCells = Array.isArray(row) ? row : asArray(row.elements).length ? asArray(row.elements) : asArray(row.cells);
|
|
14319
|
-
if (rawCells.length === 0)
|
|
14330
|
+
if (rawCells.length === 0)
|
|
14331
|
+
continue;
|
|
14320
14332
|
rows.push(rawCells.map(renderCell));
|
|
14321
14333
|
}
|
|
14322
14334
|
if (rows.length === 0) {
|
|
@@ -14326,7 +14338,8 @@ function renderTable(el) {
|
|
|
14326
14338
|
const colCount = rows.reduce((max, r) => Math.max(max, r.length), 0);
|
|
14327
14339
|
const pad = (r) => {
|
|
14328
14340
|
const cells = r.slice();
|
|
14329
|
-
while (cells.length < colCount)
|
|
14341
|
+
while (cells.length < colCount)
|
|
14342
|
+
cells.push("");
|
|
14330
14343
|
return cells.map((c) => c.replace(/\|/g, "\\|"));
|
|
14331
14344
|
};
|
|
14332
14345
|
const lines = [];
|
|
@@ -14334,13 +14347,16 @@ function renderTable(el) {
|
|
|
14334
14347
|
const body = rows.slice(1);
|
|
14335
14348
|
lines.push(`| ${pad(header).join(" | ")} |`);
|
|
14336
14349
|
lines.push(`| ${Array.from({ length: colCount }, () => "---").join(" | ")} |`);
|
|
14337
|
-
for (const r of body)
|
|
14350
|
+
for (const r of body)
|
|
14351
|
+
lines.push(`| ${pad(r).join(" | ")} |`);
|
|
14338
14352
|
return lines.join("\n");
|
|
14339
14353
|
}
|
|
14340
14354
|
function renderSection(section, depth) {
|
|
14341
|
-
if (depth > MAX_DEPTH || !isRecord(section))
|
|
14355
|
+
if (depth > MAX_DEPTH || !isRecord(section))
|
|
14356
|
+
return "";
|
|
14342
14357
|
const type = asString(section.type);
|
|
14343
|
-
if (isTableElement(section))
|
|
14358
|
+
if (isTableElement(section))
|
|
14359
|
+
return renderTable(section);
|
|
14344
14360
|
switch (type) {
|
|
14345
14361
|
case "rich_text_section":
|
|
14346
14362
|
return renderInline(asArray(section.elements));
|
|
@@ -14364,7 +14380,8 @@ ${code}
|
|
|
14364
14380
|
return items.join("\n");
|
|
14365
14381
|
}
|
|
14366
14382
|
default:
|
|
14367
|
-
if (Array.isArray(section.elements))
|
|
14383
|
+
if (Array.isArray(section.elements))
|
|
14384
|
+
return renderInline(asArray(section.elements));
|
|
14368
14385
|
return deepText(section, depth + 1);
|
|
14369
14386
|
}
|
|
14370
14387
|
}
|
|
@@ -14373,18 +14390,23 @@ function renderSlackBlocks(blocks) {
|
|
|
14373
14390
|
const out = [];
|
|
14374
14391
|
try {
|
|
14375
14392
|
for (const block of asArray(blocks)) {
|
|
14376
|
-
if (!isRecord(block))
|
|
14393
|
+
if (!isRecord(block))
|
|
14394
|
+
continue;
|
|
14377
14395
|
if (isTableElement(block)) {
|
|
14378
14396
|
hadTable = true;
|
|
14379
14397
|
const rendered = renderTable(block);
|
|
14380
|
-
if (rendered.trim().length > 0)
|
|
14398
|
+
if (rendered.trim().length > 0)
|
|
14399
|
+
out.push(rendered);
|
|
14381
14400
|
continue;
|
|
14382
14401
|
}
|
|
14383
|
-
if (asString(block.type) !== "rich_text")
|
|
14402
|
+
if (asString(block.type) !== "rich_text")
|
|
14403
|
+
continue;
|
|
14384
14404
|
for (const section of asArray(block.elements)) {
|
|
14385
|
-
if (isTableElement(section))
|
|
14405
|
+
if (isTableElement(section))
|
|
14406
|
+
hadTable = true;
|
|
14386
14407
|
const rendered = renderSection(section, 0);
|
|
14387
|
-
if (rendered.trim().length > 0)
|
|
14408
|
+
if (rendered.trim().length > 0)
|
|
14409
|
+
out.push(rendered);
|
|
14388
14410
|
}
|
|
14389
14411
|
}
|
|
14390
14412
|
} catch {
|
|
@@ -14394,28 +14416,33 @@ function renderSlackBlocks(blocks) {
|
|
|
14394
14416
|
}
|
|
14395
14417
|
function mergeInboundText(text, blocks) {
|
|
14396
14418
|
const { text: rendered, hadTable } = renderSlackBlocks(blocks);
|
|
14397
|
-
if (!hadTable)
|
|
14419
|
+
if (!hadTable)
|
|
14420
|
+
return { content: text, recoveredTable: false };
|
|
14398
14421
|
const content = rendered.length > 0 ? rendered : text;
|
|
14399
14422
|
return { content, recoveredTable: rendered.length > 0 && content !== text };
|
|
14400
14423
|
}
|
|
14401
14424
|
|
|
14402
|
-
//
|
|
14425
|
+
// ../core/dist/channels/governance/slack-forwarded.js
|
|
14403
14426
|
function asTrimmed(v) {
|
|
14404
14427
|
return typeof v === "string" ? v.trim() : "";
|
|
14405
14428
|
}
|
|
14406
14429
|
function extractForwardedContent(attachments) {
|
|
14407
|
-
if (!Array.isArray(attachments))
|
|
14430
|
+
if (!Array.isArray(attachments))
|
|
14431
|
+
return { text: "", files: [] };
|
|
14408
14432
|
const parts = [];
|
|
14409
14433
|
const files = [];
|
|
14410
14434
|
for (const raw of attachments) {
|
|
14411
|
-
if (!raw || typeof raw !== "object")
|
|
14435
|
+
if (!raw || typeof raw !== "object")
|
|
14436
|
+
continue;
|
|
14412
14437
|
const att = raw;
|
|
14413
14438
|
const textBody = asTrimmed(att.text);
|
|
14414
14439
|
let body = textBody || asTrimmed(att.fallback);
|
|
14415
14440
|
const blockSources = [];
|
|
14416
|
-
if (Array.isArray(att.blocks))
|
|
14441
|
+
if (Array.isArray(att.blocks))
|
|
14442
|
+
blockSources.push(att.blocks);
|
|
14417
14443
|
if (Array.isArray(att.message_blocks)) {
|
|
14418
|
-
for (const mb of att.message_blocks)
|
|
14444
|
+
for (const mb of att.message_blocks)
|
|
14445
|
+
blockSources.push(mb?.message?.blocks);
|
|
14419
14446
|
}
|
|
14420
14447
|
for (const source of blockSources) {
|
|
14421
14448
|
const rendered = renderSlackBlocks(source);
|
|
@@ -14429,12 +14456,18 @@ function extractForwardedContent(attachments) {
|
|
|
14429
14456
|
const link = asTrimmed(att.title_link) || asTrimmed(att.from_url);
|
|
14430
14457
|
const imageUrl = asTrimmed(att.image_url) || asTrimmed(att.thumb_url);
|
|
14431
14458
|
const lines = [];
|
|
14432
|
-
if (body)
|
|
14433
|
-
|
|
14434
|
-
if (
|
|
14435
|
-
|
|
14436
|
-
if (
|
|
14437
|
-
|
|
14459
|
+
if (body)
|
|
14460
|
+
lines.push(body);
|
|
14461
|
+
if (title && title !== body)
|
|
14462
|
+
lines.push(title);
|
|
14463
|
+
if (link)
|
|
14464
|
+
lines.push(link);
|
|
14465
|
+
if (imageUrl)
|
|
14466
|
+
lines.push(`[image] ${imageUrl}`);
|
|
14467
|
+
if (lines.length)
|
|
14468
|
+
parts.push(lines.join("\n"));
|
|
14469
|
+
if (Array.isArray(att.files))
|
|
14470
|
+
files.push(...att.files);
|
|
14438
14471
|
}
|
|
14439
14472
|
return { text: parts.join("\n\n"), files };
|
|
14440
14473
|
}
|
|
@@ -14443,7 +14476,7 @@ function hasForwardedContent(attachments) {
|
|
|
14443
14476
|
return text.length > 0 || files.length > 0;
|
|
14444
14477
|
}
|
|
14445
14478
|
|
|
14446
|
-
//
|
|
14479
|
+
// ../core/dist/channels/governance/slack-inbound-filter.js
|
|
14447
14480
|
var ALLOWED_MESSAGE_SUBTYPES = /* @__PURE__ */ new Set([
|
|
14448
14481
|
void 0,
|
|
14449
14482
|
"file_share",
|
|
@@ -14469,9 +14502,12 @@ function decideSlackMessageForward(evt) {
|
|
|
14469
14502
|
return { forward: true };
|
|
14470
14503
|
}
|
|
14471
14504
|
function isAppMentionEcho(evt, botUserId2) {
|
|
14472
|
-
if (evt.type !== "message")
|
|
14473
|
-
|
|
14474
|
-
if (
|
|
14505
|
+
if (evt.type !== "message")
|
|
14506
|
+
return false;
|
|
14507
|
+
if (!botUserId2)
|
|
14508
|
+
return false;
|
|
14509
|
+
if (evt.channel?.startsWith("D"))
|
|
14510
|
+
return false;
|
|
14475
14511
|
return typeof evt.text === "string" && evt.text.includes(`<@${botUserId2}>`);
|
|
14476
14512
|
}
|
|
14477
14513
|
function decideSlackEngagement(input) {
|
|
@@ -14485,18 +14521,21 @@ function decideSlackAckReaction(input) {
|
|
|
14485
14521
|
return Boolean(input.channel && input.ts);
|
|
14486
14522
|
}
|
|
14487
14523
|
function isRestartSenderAllowed(allowedUsers, userId) {
|
|
14488
|
-
if (allowedUsers.size === 0)
|
|
14524
|
+
if (allowedUsers.size === 0)
|
|
14525
|
+
return true;
|
|
14489
14526
|
return userId != null && allowedUsers.has(userId);
|
|
14490
14527
|
}
|
|
14491
14528
|
function extractAugmentedSlackLabel(evt) {
|
|
14492
|
-
if (evt.metadata?.event_type !== "augmented_agent_message")
|
|
14529
|
+
if (evt.metadata?.event_type !== "augmented_agent_message")
|
|
14530
|
+
return null;
|
|
14493
14531
|
return {
|
|
14494
14532
|
teamId: evt.metadata.event_payload?.["augmented_team_id"],
|
|
14495
14533
|
agentId: evt.metadata.event_payload?.["augmented_agent_id"]
|
|
14496
14534
|
};
|
|
14497
14535
|
}
|
|
14498
14536
|
function decideModeForward(evt, policy) {
|
|
14499
|
-
if (policy.mode === "all")
|
|
14537
|
+
if (policy.mode === "all")
|
|
14538
|
+
return { forward: true };
|
|
14500
14539
|
if (policy.mode === "manager_only") {
|
|
14501
14540
|
if (policy.principalSlackUserId && evt.user === policy.principalSlackUserId) {
|
|
14502
14541
|
return { forward: true };
|
|
@@ -14508,7 +14547,8 @@ function decideModeForward(evt, policy) {
|
|
|
14508
14547
|
}
|
|
14509
14548
|
}
|
|
14510
14549
|
const label = extractAugmentedSlackLabel(evt);
|
|
14511
|
-
if (!label)
|
|
14550
|
+
if (!label)
|
|
14551
|
+
return { forward: false, reason: "sender_policy" };
|
|
14512
14552
|
if (policy.mode === "team_agents_only" || policy.mode === "manager_only" || policy.mode === "team_only") {
|
|
14513
14553
|
if (!policy.teamId || label.teamId !== policy.teamId) {
|
|
14514
14554
|
return { forward: false, reason: "sender_policy" };
|
|
@@ -14518,13 +14558,15 @@ function decideModeForward(evt, policy) {
|
|
|
14518
14558
|
}
|
|
14519
14559
|
function decideSenderPolicyForward(evt, policy) {
|
|
14520
14560
|
if (policy.internalOnly) {
|
|
14521
|
-
if (!policy.homeTeamId)
|
|
14522
|
-
|
|
14561
|
+
if (!policy.homeTeamId)
|
|
14562
|
+
return { forward: false, reason: "sender_policy" };
|
|
14563
|
+
if (evt.team !== policy.homeTeamId)
|
|
14564
|
+
return { forward: false, reason: "sender_policy" };
|
|
14523
14565
|
}
|
|
14524
14566
|
return decideModeForward(evt, policy);
|
|
14525
14567
|
}
|
|
14526
14568
|
|
|
14527
|
-
//
|
|
14569
|
+
// ../core/dist/channels/governance/sender-policy-decline.js
|
|
14528
14570
|
function classifySlackPolicyBlock(evt, policy) {
|
|
14529
14571
|
if (policy.internalOnly && (!policy.homeTeamId || evt.team !== policy.homeTeamId)) {
|
|
14530
14572
|
return "internal_only";
|
|
@@ -14572,13 +14614,15 @@ function declineCacheKey(channelId, senderId, reason) {
|
|
|
14572
14614
|
}
|
|
14573
14615
|
function readDeclineCooldownMs(envVarName, defaultSeconds = 1800) {
|
|
14574
14616
|
const raw = process.env[envVarName];
|
|
14575
|
-
if (!raw)
|
|
14617
|
+
if (!raw)
|
|
14618
|
+
return defaultSeconds * 1e3;
|
|
14576
14619
|
const parsed = Number(raw);
|
|
14577
|
-
if (!Number.isFinite(parsed) || parsed < 0)
|
|
14620
|
+
if (!Number.isFinite(parsed) || parsed < 0)
|
|
14621
|
+
return defaultSeconds * 1e3;
|
|
14578
14622
|
return parsed * 1e3;
|
|
14579
14623
|
}
|
|
14580
14624
|
|
|
14581
|
-
//
|
|
14625
|
+
// ../core/dist/channels/governance/inbound-access.js
|
|
14582
14626
|
function decideInboundAccess(input) {
|
|
14583
14627
|
if (!input.content.forward) {
|
|
14584
14628
|
return { kind: "drop", reason: `content:${input.content.reason}` };
|
|
@@ -17609,10 +17653,11 @@ function buildDmUserInfo(usersInfoRes) {
|
|
|
17609
17653
|
return out;
|
|
17610
17654
|
}
|
|
17611
17655
|
|
|
17612
|
-
//
|
|
17656
|
+
// ../core/dist/channels/governance/slack-peer-classifier.js
|
|
17613
17657
|
var CODE_NAME_RE = /^[a-z0-9]+(-[a-z0-9]+)*$/;
|
|
17614
17658
|
function classifyPeerMessage(msg, cfg, self) {
|
|
17615
|
-
if (!msg.bot_id)
|
|
17659
|
+
if (!msg.bot_id)
|
|
17660
|
+
return { kind: "human" };
|
|
17616
17661
|
if (self.bot_user_id !== null && msg.user === self.bot_user_id) {
|
|
17617
17662
|
return { kind: "self" };
|
|
17618
17663
|
}
|
|
@@ -17669,14 +17714,16 @@ function classifyAddressing(msg, ourBotUserId) {
|
|
|
17669
17714
|
return { addressed: false, viaReplyOnly: false };
|
|
17670
17715
|
}
|
|
17671
17716
|
function parsePeersEnv(raw, gateRaw) {
|
|
17672
|
-
if (!raw || raw.trim().length === 0)
|
|
17717
|
+
if (!raw || raw.trim().length === 0)
|
|
17718
|
+
return [];
|
|
17673
17719
|
let parsed;
|
|
17674
17720
|
try {
|
|
17675
17721
|
parsed = JSON.parse(raw);
|
|
17676
17722
|
} catch {
|
|
17677
17723
|
return [];
|
|
17678
17724
|
}
|
|
17679
|
-
if (!Array.isArray(parsed))
|
|
17725
|
+
if (!Array.isArray(parsed))
|
|
17726
|
+
return [];
|
|
17680
17727
|
const gateMap = /* @__PURE__ */ new Map();
|
|
17681
17728
|
let gateConfigInvalid = false;
|
|
17682
17729
|
if (gateRaw && gateRaw.trim().length > 0) {
|
|
@@ -17706,9 +17753,7 @@ function parsePeersEnv(raw, gateRaw) {
|
|
|
17706
17753
|
gateConfigInvalid = true;
|
|
17707
17754
|
}
|
|
17708
17755
|
if (gateConfigInvalid) {
|
|
17709
|
-
console.error(
|
|
17710
|
-
"[slack-peer-classifier] SLACK_PEERS_GATE is present but malformed; failing closed (every peer drops as cross_team_grant_missing)"
|
|
17711
|
-
);
|
|
17756
|
+
console.error("[slack-peer-classifier] SLACK_PEERS_GATE is present but malformed; failing closed (every peer drops as cross_team_grant_missing)");
|
|
17712
17757
|
}
|
|
17713
17758
|
}
|
|
17714
17759
|
const out = [];
|
|
@@ -17731,11 +17776,13 @@ function parsePeersEnv(raw, gateRaw) {
|
|
|
17731
17776
|
return out;
|
|
17732
17777
|
}
|
|
17733
17778
|
function parsePeerGroupIdsEnv(raw) {
|
|
17734
|
-
if (!raw)
|
|
17779
|
+
if (!raw)
|
|
17780
|
+
return [];
|
|
17735
17781
|
return raw.split(",").map((s) => s.trim()).filter(Boolean);
|
|
17736
17782
|
}
|
|
17737
17783
|
function parsePeerAgentModeEnv(raw) {
|
|
17738
|
-
if (raw === "listen" || raw === "respond")
|
|
17784
|
+
if (raw === "listen" || raw === "respond")
|
|
17785
|
+
return raw;
|
|
17739
17786
|
return "off";
|
|
17740
17787
|
}
|
|
17741
17788
|
|
|
@@ -14766,14 +14766,17 @@ function buildChannelInfoResult(input) {
|
|
|
14766
14766
|
};
|
|
14767
14767
|
}
|
|
14768
14768
|
|
|
14769
|
-
//
|
|
14769
|
+
// ../core/dist/channels/governance/teams-inbound-filter.js
|
|
14770
14770
|
function mentionsBot(text, activity, botObjectId) {
|
|
14771
|
-
if (!botObjectId)
|
|
14771
|
+
if (!botObjectId)
|
|
14772
|
+
return text.includes("<at>");
|
|
14772
14773
|
const mentionEntities = activity.entities?.filter((e) => e.type === "mention") ?? [];
|
|
14773
14774
|
for (const e of mentionEntities) {
|
|
14774
|
-
if (e.mentioned?.id === botObjectId)
|
|
14775
|
+
if (e.mentioned?.id === botObjectId)
|
|
14776
|
+
return true;
|
|
14775
14777
|
}
|
|
14776
|
-
if (mentionEntities.length === 0 && text.includes("<at>"))
|
|
14778
|
+
if (mentionEntities.length === 0 && text.includes("<at>"))
|
|
14779
|
+
return true;
|
|
14777
14780
|
return false;
|
|
14778
14781
|
}
|
|
14779
14782
|
function decideTeamsActivityForward(input) {
|
|
@@ -14813,11 +14816,13 @@ function decideTeamsActivityForward(input) {
|
|
|
14813
14816
|
}
|
|
14814
14817
|
function extractAugmentedTeamsLabel(activity) {
|
|
14815
14818
|
const entity = activity.entities?.find((e) => e.type === "augmented/agent");
|
|
14816
|
-
if (!entity)
|
|
14819
|
+
if (!entity)
|
|
14820
|
+
return null;
|
|
14817
14821
|
return { teamId: entity.teamId, agentId: entity.agentId };
|
|
14818
14822
|
}
|
|
14819
14823
|
function decideModeForwardTeams(activity, policy) {
|
|
14820
|
-
if (policy.mode === "all")
|
|
14824
|
+
if (policy.mode === "all")
|
|
14825
|
+
return { forward: true };
|
|
14821
14826
|
if (policy.mode === "manager_only") {
|
|
14822
14827
|
if (policy.principalAadObjectId && activity.from?.aadObjectId === policy.principalAadObjectId) {
|
|
14823
14828
|
return { forward: true };
|
|
@@ -14830,7 +14835,8 @@ function decideModeForwardTeams(activity, policy) {
|
|
|
14830
14835
|
}
|
|
14831
14836
|
}
|
|
14832
14837
|
const label = extractAugmentedTeamsLabel(activity);
|
|
14833
|
-
if (!label)
|
|
14838
|
+
if (!label)
|
|
14839
|
+
return { forward: false, reason: "sender_policy" };
|
|
14834
14840
|
if (policy.mode === "team_agents_only" || policy.mode === "manager_only" || policy.mode === "team_only") {
|
|
14835
14841
|
if (!policy.teamId || label.teamId !== policy.teamId) {
|
|
14836
14842
|
return { forward: false, reason: "sender_policy" };
|
|
@@ -14840,7 +14846,8 @@ function decideModeForwardTeams(activity, policy) {
|
|
|
14840
14846
|
}
|
|
14841
14847
|
function decideSenderPolicyForwardTeams(activity, policy) {
|
|
14842
14848
|
if (policy.internalOnly) {
|
|
14843
|
-
if (!policy.homeTenantId)
|
|
14849
|
+
if (!policy.homeTenantId)
|
|
14850
|
+
return { forward: false, reason: "sender_policy" };
|
|
14844
14851
|
const senderTenant = activity.channelData?.tenant?.id ?? activity.conversation?.tenantId;
|
|
14845
14852
|
if (senderTenant !== policy.homeTenantId) {
|
|
14846
14853
|
return { forward: false, reason: "sender_policy" };
|
|
@@ -14849,7 +14856,7 @@ function decideSenderPolicyForwardTeams(activity, policy) {
|
|
|
14849
14856
|
return decideModeForwardTeams(activity, policy);
|
|
14850
14857
|
}
|
|
14851
14858
|
|
|
14852
|
-
//
|
|
14859
|
+
// ../core/dist/channels/governance/sender-policy-decline.js
|
|
14853
14860
|
function classifyTeamsPolicyBlock(activity, policy) {
|
|
14854
14861
|
const senderTenantId = activity.channelData?.tenant?.id ?? activity.conversation?.tenantId;
|
|
14855
14862
|
if (policy.internalOnly && (!policy.homeTenantId || policy.homeTenantId === "common" || senderTenantId !== policy.homeTenantId)) {
|
|
@@ -14898,13 +14905,15 @@ function declineCacheKey(channelId, senderId, reason) {
|
|
|
14898
14905
|
}
|
|
14899
14906
|
function readDeclineCooldownMs(envVarName, defaultSeconds = 1800) {
|
|
14900
14907
|
const raw = process.env[envVarName];
|
|
14901
|
-
if (!raw)
|
|
14908
|
+
if (!raw)
|
|
14909
|
+
return defaultSeconds * 1e3;
|
|
14902
14910
|
const parsed = Number(raw);
|
|
14903
|
-
if (!Number.isFinite(parsed) || parsed < 0)
|
|
14911
|
+
if (!Number.isFinite(parsed) || parsed < 0)
|
|
14912
|
+
return defaultSeconds * 1e3;
|
|
14904
14913
|
return parsed * 1e3;
|
|
14905
14914
|
}
|
|
14906
14915
|
|
|
14907
|
-
//
|
|
14916
|
+
// ../core/dist/channels/governance/inbound-access.js
|
|
14908
14917
|
function decideInboundAccess(input) {
|
|
14909
14918
|
if (!input.content.forward) {
|
|
14910
14919
|
return { kind: "drop", reason: `content:${input.content.reason}` };
|
|
@@ -14836,9 +14836,10 @@ function configFromEnv(env = process.env) {
|
|
|
14836
14836
|
};
|
|
14837
14837
|
}
|
|
14838
14838
|
|
|
14839
|
-
//
|
|
14839
|
+
// ../core/dist/channels/governance/telegram-peer-classifier.js
|
|
14840
14840
|
function classifyPeerMessage(msg, cfg, self) {
|
|
14841
|
-
if (!msg.from?.is_bot)
|
|
14841
|
+
if (!msg.from?.is_bot)
|
|
14842
|
+
return { kind: "human" };
|
|
14842
14843
|
if (self.bot_id !== null && msg.from.id === self.bot_id) {
|
|
14843
14844
|
return { kind: "self" };
|
|
14844
14845
|
}
|
|
@@ -14901,20 +14902,24 @@ function classifyAddressing(msg, ourBotId, ourBotUsername) {
|
|
|
14901
14902
|
}
|
|
14902
14903
|
}
|
|
14903
14904
|
const viaReply = msg.reply_to_message?.from?.id === ourBotId;
|
|
14904
|
-
if (viaMentionOrCommand)
|
|
14905
|
-
|
|
14905
|
+
if (viaMentionOrCommand)
|
|
14906
|
+
return { addressed: true, viaReplyOnly: false };
|
|
14907
|
+
if (viaReply)
|
|
14908
|
+
return { addressed: true, viaReplyOnly: true };
|
|
14906
14909
|
return { addressed: false, viaReplyOnly: false };
|
|
14907
14910
|
}
|
|
14908
14911
|
var CODE_NAME_RE = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
14909
14912
|
function parsePeersEnv(raw, gateRaw) {
|
|
14910
|
-
if (!raw || raw.trim().length === 0)
|
|
14913
|
+
if (!raw || raw.trim().length === 0)
|
|
14914
|
+
return [];
|
|
14911
14915
|
let parsed;
|
|
14912
14916
|
try {
|
|
14913
14917
|
parsed = JSON.parse(raw);
|
|
14914
14918
|
} catch {
|
|
14915
14919
|
return [];
|
|
14916
14920
|
}
|
|
14917
|
-
if (!Array.isArray(parsed))
|
|
14921
|
+
if (!Array.isArray(parsed))
|
|
14922
|
+
return [];
|
|
14918
14923
|
const gateMap = /* @__PURE__ */ new Map();
|
|
14919
14924
|
let gateConfigInvalid = false;
|
|
14920
14925
|
if (gateRaw && gateRaw.trim().length > 0) {
|
|
@@ -14944,9 +14949,7 @@ function parsePeersEnv(raw, gateRaw) {
|
|
|
14944
14949
|
gateConfigInvalid = true;
|
|
14945
14950
|
}
|
|
14946
14951
|
if (gateConfigInvalid) {
|
|
14947
|
-
console.error(
|
|
14948
|
-
"[telegram-peer-classifier] TELEGRAM_PEERS_GATE is present but malformed; failing closed (every peer drops as cross_team_grant_missing)"
|
|
14949
|
-
);
|
|
14952
|
+
console.error("[telegram-peer-classifier] TELEGRAM_PEERS_GATE is present but malformed; failing closed (every peer drops as cross_team_grant_missing)");
|
|
14950
14953
|
}
|
|
14951
14954
|
}
|
|
14952
14955
|
const out = [];
|
|
@@ -14968,15 +14971,17 @@ function parsePeersEnv(raw, gateRaw) {
|
|
|
14968
14971
|
return out;
|
|
14969
14972
|
}
|
|
14970
14973
|
function parsePeerGroupIdsEnv(raw) {
|
|
14971
|
-
if (!raw)
|
|
14974
|
+
if (!raw)
|
|
14975
|
+
return [];
|
|
14972
14976
|
return raw.split(",").map((s) => s.trim()).filter(Boolean);
|
|
14973
14977
|
}
|
|
14974
14978
|
function parsePeerAgentModeEnv(raw) {
|
|
14975
|
-
if (raw === "listen" || raw === "respond")
|
|
14979
|
+
if (raw === "listen" || raw === "respond")
|
|
14980
|
+
return raw;
|
|
14976
14981
|
return "off";
|
|
14977
14982
|
}
|
|
14978
14983
|
|
|
14979
|
-
//
|
|
14984
|
+
// ../core/dist/channels/governance/sender-policy-decline.js
|
|
14980
14985
|
function politeDeclineCopy(reason) {
|
|
14981
14986
|
switch (reason) {
|
|
14982
14987
|
case "internal_only":
|
|
@@ -15003,7 +15008,7 @@ function decideDeclineReply(input) {
|
|
|
15003
15008
|
return { reply: true };
|
|
15004
15009
|
}
|
|
15005
15010
|
|
|
15006
|
-
//
|
|
15011
|
+
// ../core/dist/channels/governance/inbound-access.js
|
|
15007
15012
|
function decideInboundAccess(input) {
|
|
15008
15013
|
if (!input.content.forward) {
|
|
15009
15014
|
return { kind: "drop", reason: `content:${input.content.reason}` };
|
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
writeDirectChatSessionState,
|
|
37
37
|
writeEgressAllowlist,
|
|
38
38
|
writePersistentClaudeWrapper
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-NAS4DZNG.js";
|
|
40
40
|
import "./chunk-XWVM4KPK.js";
|
|
41
41
|
export {
|
|
42
42
|
EGRESS_BASELINE_DOMAINS,
|
|
@@ -77,4 +77,4 @@ export {
|
|
|
77
77
|
writeEgressAllowlist,
|
|
78
78
|
writePersistentClaudeWrapper
|
|
79
79
|
};
|
|
80
|
-
//# sourceMappingURL=persistent-session-
|
|
80
|
+
//# sourceMappingURL=persistent-session-ZQSAZIVM.js.map
|