@integrity-labs/agt-cli 0.28.1250 → 0.28.1252
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/api-client-6A36YH3M.js +39 -0
- package/dist/bin/agt.js +17 -15
- package/dist/bin/agt.js.map +1 -1
- package/dist/{chunk-IUMFAYZO.js → chunk-3HRBU4H6.js} +3 -3
- package/dist/{chunk-SMD577FW.js → chunk-4VOQ6D7X.js} +2 -2
- package/dist/chunk-5ZNYCNMI.js +471 -0
- package/dist/chunk-5ZNYCNMI.js.map +1 -0
- package/dist/{chunk-DFJ5E5EW.js → chunk-RUKGOBVA.js} +214 -1
- package/dist/chunk-RUKGOBVA.js.map +1 -0
- package/dist/{chunk-5ALBA7KT.js → chunk-S3DUSCWR.js} +94 -552
- package/dist/chunk-S3DUSCWR.js.map +1 -0
- package/dist/{chunk-JOBL3ZF4.js → chunk-XTFVVZIR.js} +2 -2
- package/dist/{claude-code-updater-5MPOBIWN.js → claude-code-updater-WSQTK6TQ.js} +3 -3
- package/dist/{claude-pair-runtime-SNU3CU3K.js → claude-pair-runtime-WWF5BCK3.js} +3 -3
- package/dist/lib/manager-worker.js +172 -61
- package/dist/lib/manager-worker.js.map +1 -1
- package/dist/mcp/direct-chat-channel.js +92 -4
- package/dist/mcp/index.js +27 -0
- package/dist/mcp/origami.js +27 -0
- package/dist/mcp/slack-channel.js +27 -0
- package/dist/mcp/telegram-channel.js +389 -186
- package/dist/{persistent-session-SYCA6MW2.js → persistent-session-HS33PGZZ.js} +4 -4
- package/dist/persistent-session-HS33PGZZ.js.map +1 -0
- package/dist/{responsiveness-probe-BUXWVOSA.js → responsiveness-probe-32AWSVSL.js} +4 -4
- package/dist/{session-auth-dead-G5NHWSRP.js → session-auth-dead-2L2NLMMB.js} +3 -3
- package/package.json +1 -1
- package/dist/chunk-5ALBA7KT.js.map +0 -1
- package/dist/chunk-DFJ5E5EW.js.map +0 -1
- /package/dist/{claude-code-updater-5MPOBIWN.js.map → api-client-6A36YH3M.js.map} +0 -0
- /package/dist/{chunk-IUMFAYZO.js.map → chunk-3HRBU4H6.js.map} +0 -0
- /package/dist/{chunk-SMD577FW.js.map → chunk-4VOQ6D7X.js.map} +0 -0
- /package/dist/{chunk-JOBL3ZF4.js.map → chunk-XTFVVZIR.js.map} +0 -0
- /package/dist/{persistent-session-SYCA6MW2.js.map → claude-code-updater-WSQTK6TQ.js.map} +0 -0
- /package/dist/{claude-pair-runtime-SNU3CU3K.js.map → claude-pair-runtime-WWF5BCK3.js.map} +0 -0
- /package/dist/{responsiveness-probe-BUXWVOSA.js.map → responsiveness-probe-32AWSVSL.js.map} +0 -0
- /package/dist/{session-auth-dead-G5NHWSRP.js.map → session-auth-dead-2L2NLMMB.js.map} +0 -0
|
@@ -5167,6 +5167,191 @@ function decideInboundAccess(input) {
|
|
|
5167
5167
|
return { kind: "admit" };
|
|
5168
5168
|
}
|
|
5169
5169
|
|
|
5170
|
+
// ../../packages/core/dist/channels/telegram-group-link.js
|
|
5171
|
+
var GROUP_START_WITH_CODE_RE = /^\/start(?:@[A-Za-z0-9_]{1,64})?\s+(gk_[A-Za-z0-9_-]{22})$/;
|
|
5172
|
+
function isTelegramGroupChatType(chatType) {
|
|
5173
|
+
return chatType === "group" || chatType === "supergroup";
|
|
5174
|
+
}
|
|
5175
|
+
function parseTelegramGroupLinkStart(input) {
|
|
5176
|
+
if (!isTelegramGroupChatType(input.chatType))
|
|
5177
|
+
return null;
|
|
5178
|
+
if (input.isBot === true)
|
|
5179
|
+
return null;
|
|
5180
|
+
if (typeof input.text !== "string")
|
|
5181
|
+
return null;
|
|
5182
|
+
const match = GROUP_START_WITH_CODE_RE.exec(input.text.trim());
|
|
5183
|
+
return match ? match[1] : null;
|
|
5184
|
+
}
|
|
5185
|
+
function isTelegramGroupChatId(id) {
|
|
5186
|
+
return typeof id === "string" && /^-[1-9][0-9]{0,19}$/.test(id);
|
|
5187
|
+
}
|
|
5188
|
+
|
|
5189
|
+
// ../../packages/core/dist/channels/telegram-group-link-host.js
|
|
5190
|
+
var GROUP_LINK_TIMEOUT_MS = 5e3;
|
|
5191
|
+
async function postWithTimeout(post, path, body, timeoutMs) {
|
|
5192
|
+
let timer;
|
|
5193
|
+
const timeout = new Promise((resolve) => {
|
|
5194
|
+
timer = setTimeout(() => resolve(null), timeoutMs);
|
|
5195
|
+
});
|
|
5196
|
+
try {
|
|
5197
|
+
return await Promise.race([post(path, body), timeout]);
|
|
5198
|
+
} catch {
|
|
5199
|
+
return null;
|
|
5200
|
+
} finally {
|
|
5201
|
+
if (timer)
|
|
5202
|
+
clearTimeout(timer);
|
|
5203
|
+
}
|
|
5204
|
+
}
|
|
5205
|
+
async function claimTelegramGroupLinkCode(post, input, timeoutMs = GROUP_LINK_TIMEOUT_MS) {
|
|
5206
|
+
const res = await postWithTimeout(post, "/host/telegram-link/group-claim", {
|
|
5207
|
+
agent_id: input.agentId,
|
|
5208
|
+
code: input.code,
|
|
5209
|
+
chat_id: input.chatId,
|
|
5210
|
+
chat_type: input.chatType,
|
|
5211
|
+
...input.chatTitle ? { chat_title: input.chatTitle } : {},
|
|
5212
|
+
...input.fromId ? { from_id: input.fromId } : {},
|
|
5213
|
+
...input.firstName ? { first_name: input.firstName } : {},
|
|
5214
|
+
...input.lastName ? { last_name: input.lastName } : {}
|
|
5215
|
+
}, timeoutMs);
|
|
5216
|
+
if (!res || res.status < 200 || res.status >= 300)
|
|
5217
|
+
return false;
|
|
5218
|
+
return res.json?.ok === true;
|
|
5219
|
+
}
|
|
5220
|
+
async function reportTelegramGroupMigrationOutcome(post, input, timeoutMs = GROUP_LINK_TIMEOUT_MS) {
|
|
5221
|
+
const res = await postWithTimeout(post, "/host/telegram-link/group-migrate", { agent_id: input.agentId, from_chat_id: input.fromChatId, to_chat_id: input.toChatId }, timeoutMs);
|
|
5222
|
+
if (!res)
|
|
5223
|
+
return "retry";
|
|
5224
|
+
if (res.status === 400)
|
|
5225
|
+
return "drop";
|
|
5226
|
+
if (res.status < 200 || res.status >= 300)
|
|
5227
|
+
return "retry";
|
|
5228
|
+
return res.json?.ok === true ? "done" : "retry";
|
|
5229
|
+
}
|
|
5230
|
+
var GROUP_CLAIMED_REPLY = "Thanks for adding me. Go back to the setup screen to finish: I will answer here once it is confirmed.";
|
|
5231
|
+
function applyMigrationToAllowlist(allowed, fromChatId, toChatId) {
|
|
5232
|
+
if (!allowed.has(fromChatId) || allowed.has(toChatId))
|
|
5233
|
+
return false;
|
|
5234
|
+
allowed.add(toChatId);
|
|
5235
|
+
return true;
|
|
5236
|
+
}
|
|
5237
|
+
var MIGRATION_REPORT_BASE_DELAY_MS = 3e4;
|
|
5238
|
+
var MIGRATION_REPORT_MAX_DELAY_MS = 60 * 6e4;
|
|
5239
|
+
var MIGRATION_REPORT_MAX_AGE_MS = 7 * 24 * 60 * 6e4;
|
|
5240
|
+
var MIGRATION_REPORT_MAX_PENDING = 32;
|
|
5241
|
+
var MIGRATION_REPORT_MAX_PER_FLUSH = 4;
|
|
5242
|
+
function migrationReportRetryDelayMs(attempts) {
|
|
5243
|
+
const exp = Math.max(0, attempts - 1);
|
|
5244
|
+
return Math.min(MIGRATION_REPORT_MAX_DELAY_MS, MIGRATION_REPORT_BASE_DELAY_MS * 2 ** Math.min(exp, 20));
|
|
5245
|
+
}
|
|
5246
|
+
var MIGRATION_REPORT_CLOCK_SKEW_MS = 5 * 6e4;
|
|
5247
|
+
function isPendingMigrationReport(v) {
|
|
5248
|
+
if (typeof v !== "object" || v === null)
|
|
5249
|
+
return false;
|
|
5250
|
+
const r = v;
|
|
5251
|
+
return isTelegramGroupChatId(r["from_chat_id"]) && isTelegramGroupChatId(r["to_chat_id"]) && r["from_chat_id"] !== r["to_chat_id"] && typeof r["first_seen_at"] === "number" && Number.isFinite(r["first_seen_at"]) && typeof r["attempts"] === "number" && Number.isInteger(r["attempts"]) && r["attempts"] >= 0 && typeof r["next_attempt_at"] === "number" && Number.isFinite(r["next_attempt_at"]);
|
|
5252
|
+
}
|
|
5253
|
+
function parsePendingMigrationReports(raw, now = Date.now()) {
|
|
5254
|
+
if (!raw)
|
|
5255
|
+
return [];
|
|
5256
|
+
let parsed;
|
|
5257
|
+
try {
|
|
5258
|
+
parsed = JSON.parse(raw);
|
|
5259
|
+
} catch {
|
|
5260
|
+
return [];
|
|
5261
|
+
}
|
|
5262
|
+
const list = parsed?.pending;
|
|
5263
|
+
if (!Array.isArray(list))
|
|
5264
|
+
return [];
|
|
5265
|
+
return list.filter(isPendingMigrationReport).filter((r) => r.first_seen_at <= now + MIGRATION_REPORT_CLOCK_SKEW_MS && now - r.first_seen_at < MIGRATION_REPORT_MAX_AGE_MS).map((r) => r.next_attempt_at > now + MIGRATION_REPORT_MAX_DELAY_MS ? { ...r, next_attempt_at: now + MIGRATION_REPORT_MAX_DELAY_MS } : r).slice(-MIGRATION_REPORT_MAX_PENDING);
|
|
5266
|
+
}
|
|
5267
|
+
function serializePendingMigrationReports(list) {
|
|
5268
|
+
return JSON.stringify({ pending: list });
|
|
5269
|
+
}
|
|
5270
|
+
function enqueueMigrationReport(list, fromChatId, toChatId, now) {
|
|
5271
|
+
if (!isTelegramGroupChatId(fromChatId) || !isTelegramGroupChatId(toChatId) || fromChatId === toChatId) {
|
|
5272
|
+
return [...list];
|
|
5273
|
+
}
|
|
5274
|
+
if (list.some((r) => r.from_chat_id === fromChatId && r.to_chat_id === toChatId))
|
|
5275
|
+
return [...list];
|
|
5276
|
+
const next = [
|
|
5277
|
+
...list,
|
|
5278
|
+
{ from_chat_id: fromChatId, to_chat_id: toChatId, first_seen_at: now, attempts: 0, next_attempt_at: now }
|
|
5279
|
+
];
|
|
5280
|
+
return next.slice(-MIGRATION_REPORT_MAX_PENDING);
|
|
5281
|
+
}
|
|
5282
|
+
function settleMigrationReport(list, entry, outcome, now) {
|
|
5283
|
+
const same = (r) => r.from_chat_id === entry.from_chat_id && r.to_chat_id === entry.to_chat_id;
|
|
5284
|
+
if (outcome !== "retry" || now - entry.first_seen_at >= MIGRATION_REPORT_MAX_AGE_MS) {
|
|
5285
|
+
return list.filter((r) => !same(r));
|
|
5286
|
+
}
|
|
5287
|
+
return list.map((r) => {
|
|
5288
|
+
if (!same(r))
|
|
5289
|
+
return r;
|
|
5290
|
+
const attempts = r.attempts + 1;
|
|
5291
|
+
return { ...r, attempts, next_attempt_at: now + migrationReportRetryDelayMs(attempts) };
|
|
5292
|
+
});
|
|
5293
|
+
}
|
|
5294
|
+
function createMigrationReportQueue(deps) {
|
|
5295
|
+
const now = deps.now ?? Date.now;
|
|
5296
|
+
let list = parsePendingMigrationReports(safeLoad(deps.io), now());
|
|
5297
|
+
let inFlight = null;
|
|
5298
|
+
const persist = () => {
|
|
5299
|
+
try {
|
|
5300
|
+
deps.io.save(serializePendingMigrationReports(list));
|
|
5301
|
+
} catch (err) {
|
|
5302
|
+
deps.log(`migration-report persist failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
5303
|
+
}
|
|
5304
|
+
};
|
|
5305
|
+
const flush = async () => {
|
|
5306
|
+
const outcomes = /* @__PURE__ */ new Map();
|
|
5307
|
+
const t = now();
|
|
5308
|
+
const due = list.filter((r) => r.next_attempt_at <= t).sort((a, b) => a.attempts - b.attempts).slice(0, MIGRATION_REPORT_MAX_PER_FLUSH);
|
|
5309
|
+
for (const entry of due) {
|
|
5310
|
+
let outcome;
|
|
5311
|
+
try {
|
|
5312
|
+
outcome = await deps.report(entry.from_chat_id, entry.to_chat_id);
|
|
5313
|
+
} catch {
|
|
5314
|
+
outcome = "retry";
|
|
5315
|
+
}
|
|
5316
|
+
const before = list.length;
|
|
5317
|
+
list = settleMigrationReport(list, entry, outcome, now());
|
|
5318
|
+
outcomes.set(`${entry.from_chat_id}->${entry.to_chat_id}`, outcome);
|
|
5319
|
+
if (outcome === "retry" && list.length < before) {
|
|
5320
|
+
deps.log(`migration-report gave up after ${entry.attempts + 1} attempt(s) (aged out)`);
|
|
5321
|
+
}
|
|
5322
|
+
persist();
|
|
5323
|
+
}
|
|
5324
|
+
return outcomes;
|
|
5325
|
+
};
|
|
5326
|
+
return {
|
|
5327
|
+
pending: () => [...list],
|
|
5328
|
+
enqueue(fromChatId, toChatId) {
|
|
5329
|
+
const next = enqueueMigrationReport(list, fromChatId, toChatId, now());
|
|
5330
|
+
if (next.length === list.length && next.every((r, i) => r === list[i]))
|
|
5331
|
+
return;
|
|
5332
|
+
list = next;
|
|
5333
|
+
persist();
|
|
5334
|
+
},
|
|
5335
|
+
flushDue() {
|
|
5336
|
+
if (!list.some((r) => r.next_attempt_at <= now()))
|
|
5337
|
+
return Promise.resolve(/* @__PURE__ */ new Map());
|
|
5338
|
+
if (!inFlight) {
|
|
5339
|
+
inFlight = flush().finally(() => {
|
|
5340
|
+
inFlight = null;
|
|
5341
|
+
});
|
|
5342
|
+
}
|
|
5343
|
+
return inFlight;
|
|
5344
|
+
}
|
|
5345
|
+
};
|
|
5346
|
+
}
|
|
5347
|
+
function safeLoad(io) {
|
|
5348
|
+
try {
|
|
5349
|
+
return io.load();
|
|
5350
|
+
} catch {
|
|
5351
|
+
return null;
|
|
5352
|
+
}
|
|
5353
|
+
}
|
|
5354
|
+
|
|
5170
5355
|
// ../../packages/core/dist/parser/frontmatter.js
|
|
5171
5356
|
import { parse as parseYaml, parseDocument } from "yaml";
|
|
5172
5357
|
function extractFrontmatter(content) {
|
|
@@ -8028,6 +8213,28 @@ var FLAG_REGISTRY = [
|
|
|
8028
8213
|
// edec921a519f); THREATS_FOUND rows stay hidden either way.
|
|
8029
8214
|
defaultValue: false
|
|
8030
8215
|
},
|
|
8216
|
+
{
|
|
8217
|
+
key: "direct-chat-extracted-text",
|
|
8218
|
+
// ENG-11967 part 2b. Read stage-wide only (empty scope), like
|
|
8219
|
+
// direct-chat-malware-scan: a scoped override would do nothing.
|
|
8220
|
+
stageWideOnly: true,
|
|
8221
|
+
sensitive: true,
|
|
8222
|
+
description: `Serve a Direct Chat PDF or DOCX to the agent as its EXTRACTED TEXT instead of the raw file (ENG-11967 part 2b, Sherlock ruling (a)). off = today: the agent gets the raw file (scan-gated). hold-30s / hold-60s / hold-120s = armed, and the value is the HOLD CAP: the agent poll does not claim a message whose text is not ready yet for up to that long, and holds the rest of its session with it so order is kept. Holds chain: a message also waits for every document sent after it in the same session, so its delay is bounded by the cap measured from the LAST document in a run of sends, not from its own send. Ready text is delivered as <name>.txt. If extraction finished without text, or died, the message is released at once with "text extraction unavailable for <name> (couldn't read the file)" or "(timed out)"; at the cap it is released with "(timed out)" and the release is logged. Takes effect only while direct-chat-malware-scan is on, because extraction runs on GuardDuty's clean-scan event. ARM ONLY AFTER DIRECT_CHAT_TEXT_EXTRACTION=true has deployed the DirectChatTextExtract Lambda: armed without it, every PDF/DOCX waits out the cap and arrives as a timed-out notice. A flag-store read error counts as off on this read path. GLOBAL ONLY: evaluated with an empty context, so scoped overrides have no effect.`,
|
|
8223
|
+
flagType: "enum",
|
|
8224
|
+
allowedValues: ["off", "hold-30s", "hold-60s", "hold-120s"],
|
|
8225
|
+
// Off is the pre-2b behaviour: no hold, no .txt read, the raw file.
|
|
8226
|
+
defaultValue: "off",
|
|
8227
|
+
// The flag is evaluated server-side, but its notice entries need the host's
|
|
8228
|
+
// direct-chat MCP to render them: an older agt-cli shows a notice as
|
|
8229
|
+
// "download failed; ask the user to re-send", which sends users in circles
|
|
8230
|
+
// (Sherlock, 13 Nov). So the flip-reach modal must count hosts by the CLI
|
|
8231
|
+
// that renders notices. DELIBERATE UNREACHABLE PLACEHOLDER until this PR
|
|
8232
|
+
// merges and "Publish CLI on adapter changes (main)" publishes the first
|
|
8233
|
+
// agt-cli carrying the MCP change: replace it with that exact version in a
|
|
8234
|
+
// one-line follow-up, and arm only when the modal shows 0 stale and 0
|
|
8235
|
+
// unknown hosts. A placeholder over-reports stale hosts; it never hides one.
|
|
8236
|
+
since: "0.29.0"
|
|
8237
|
+
},
|
|
8031
8238
|
{
|
|
8032
8239
|
key: "platform-held-key-central-probe",
|
|
8033
8240
|
description: "Arm the scheduled CENTRAL connectivity probe lane for platform-held-key integrations (ENG-10086). These store no customer credential (auth_type none), so the host cannot probe them and reports unverified forever. When on, the hourly PlatformHeldKeyProbe cron runs each central probe that exists (today only ninjafy-notes: org entitlement + broker routing, never note contents) and writes the result through the monitor observation path, so consecutive_connectivity_failures / _ok_cycles move and integration_down alerts can open and close on it. Definitions with no central probe are skipped, never written as a failure. When off the cron reads nothing and writes nothing. Boolean gate; ships dark because a new writer of the escalation counters is a paging change. GLOBAL ONLY: the cron and the host connectivity route both evaluate this flag with an empty context, so an org-, team- or agent-scoped override is stored but has NO effect. Arm it by its global value, not as a staged per-org rollout (Obi Wan 63053d02035e).",
|
|
@@ -18347,6 +18554,12 @@ export {
|
|
|
18347
18554
|
classifySlackPolicyBlock,
|
|
18348
18555
|
classifyTelegramPolicyBlock,
|
|
18349
18556
|
decideInboundAccess,
|
|
18557
|
+
parseTelegramGroupLinkStart,
|
|
18558
|
+
claimTelegramGroupLinkCode,
|
|
18559
|
+
reportTelegramGroupMigrationOutcome,
|
|
18560
|
+
GROUP_CLAIMED_REPLY,
|
|
18561
|
+
applyMigrationToAllowlist,
|
|
18562
|
+
createMigrationReportQueue,
|
|
18350
18563
|
extractFrontmatter,
|
|
18351
18564
|
generateCharterMd,
|
|
18352
18565
|
generateToolsMd,
|
|
@@ -18465,4 +18678,4 @@ export {
|
|
|
18465
18678
|
HOST_ROTATE_KEY_CONFLICT,
|
|
18466
18679
|
shouldMintReplacementKey
|
|
18467
18680
|
};
|
|
18468
|
-
//# sourceMappingURL=chunk-
|
|
18681
|
+
//# sourceMappingURL=chunk-RUKGOBVA.js.map
|