@integrity-labs/agt-cli 0.19.18 → 0.19.19

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.
@@ -22,7 +22,7 @@ import {
22
22
  resolveChannels,
23
23
  resolveDmTarget,
24
24
  wrapScheduledTaskPrompt
25
- } from "../chunk-WTFROCJ3.js";
25
+ } from "../chunk-WQJL6EGC.js";
26
26
  import {
27
27
  findTaskByTemplate,
28
28
  getProjectDir,
@@ -1811,6 +1811,24 @@ var config = null;
1811
1811
  var running = false;
1812
1812
  var pollTimer = null;
1813
1813
  var PANE_TAIL_PREVIEW_LINES = 5;
1814
+ function extractCharterTelegramPeers(rawContent) {
1815
+ if (!rawContent || rawContent.length === 0) return [];
1816
+ try {
1817
+ const parsed = extractFrontmatter(rawContent);
1818
+ const frontmatter = parsed.frontmatter;
1819
+ const peers = frontmatter?.multi_agent?.telegram_peers;
1820
+ if (!peers || !Array.isArray(peers)) return [];
1821
+ const out = [];
1822
+ for (const p of peers) {
1823
+ if (p && typeof p === "object" && typeof p.code_name === "string" && typeof p.bot_id === "number" && Number.isInteger(p.bot_id) && p.bot_id > 0) {
1824
+ out.push({ code_name: p.code_name, bot_id: p.bot_id, agent_id: "" });
1825
+ }
1826
+ }
1827
+ return out;
1828
+ } catch {
1829
+ return [];
1830
+ }
1831
+ }
1814
1832
  function truncateForLog(s) {
1815
1833
  const lines = s.split("\n").filter((l) => l.length > 0);
1816
1834
  return lines.slice(-PANE_TAIL_PREVIEW_LINES).map((l) => ` | ${l}`).join("\n");
@@ -1950,7 +1968,7 @@ function clearAgentCaches(agentId, codeName) {
1950
1968
  var cachedFrameworkVersion = null;
1951
1969
  var lastVersionCheckAt = 0;
1952
1970
  var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
1953
- var agtCliVersion = true ? "0.19.18" : "dev";
1971
+ var agtCliVersion = true ? "0.19.19" : "dev";
1954
1972
  function resolveBrewPath(execFileSync3) {
1955
1973
  try {
1956
1974
  const out = execFileSync3("which", ["brew"], { timeout: 5e3 }).toString().trim();
@@ -3429,7 +3447,13 @@ async function processAgent(agent, agentStates) {
3429
3447
  activeChannels.set(channelId, /* @__PURE__ */ new Set());
3430
3448
  }
3431
3449
  activeChannels.get(channelId).add(agent.code_name);
3432
- const configHash = createHash2("sha256").update(canonicalJson(entry.config)).digest("hex");
3450
+ const teamSettingsForHash = channelId === "telegram" ? {
3451
+ telegram_peer_disabled: Boolean(
3452
+ refreshData.team?.settings?.["telegram_peer_disabled"] ?? false
3453
+ )
3454
+ } : null;
3455
+ const peersForHash = channelId === "telegram" ? extractCharterTelegramPeers(refreshData.charter?.raw_content ?? "") : null;
3456
+ const configHash = createHash2("sha256").update(canonicalJson({ config: entry.config, team: teamSettingsForHash, peers: peersForHash })).digest("hex");
3433
3457
  const cacheKey = `${agent.agent_id}:${channelId}`;
3434
3458
  let onDiskPresent = true;
3435
3459
  try {
@@ -3449,7 +3473,16 @@ async function processAgent(agent, agentStates) {
3449
3473
  }
3450
3474
  try {
3451
3475
  const sessionMode2 = refreshData.agent.session_mode;
3452
- frameworkAdapter.writeChannelCredentials(agent.code_name, channelId, entry.config, { sessionMode: sessionMode2, agentId: agent.agent_id });
3476
+ const telegramPeerDisabled = channelId === "telegram" ? Boolean(
3477
+ refreshData.team?.settings?.["telegram_peer_disabled"] ?? false
3478
+ ) : void 0;
3479
+ const telegramPeers = channelId === "telegram" ? extractCharterTelegramPeers(refreshData.charter?.raw_content ?? "") : void 0;
3480
+ frameworkAdapter.writeChannelCredentials(
3481
+ agent.code_name,
3482
+ channelId,
3483
+ entry.config,
3484
+ { sessionMode: sessionMode2, agentId: agent.agent_id, telegramPeerDisabled, telegramPeers }
3485
+ );
3453
3486
  knownChannelConfigHashes.set(cacheKey, configHash);
3454
3487
  saveChannelHashCache2();
3455
3488
  log(`Channel credentials written for '${agent.code_name}/${channelId}' (reason=${reason}, hash=${configHash.slice(0, 8)}${prevHash ? `, prev=${prevHash.slice(0, 8)}` : ""})`);
@@ -3600,7 +3633,7 @@ async function processAgent(agent, agentStates) {
3600
3633
  preWriteEnv = void 0;
3601
3634
  }
3602
3635
  if (frameworkAdapter.writeIntegrations) {
3603
- frameworkAdapter.writeIntegrations(agent.code_name, integrations);
3636
+ frameworkAdapter.writeIntegrations(agent.code_name, integrations, agent.agent_id);
3604
3637
  }
3605
3638
  log(`Integrations provisioned for '${agent.code_name}' (${integrations.length} integration(s))`);
3606
3639
  const fw = agentFrameworkCache.get(agent.code_name) ?? "openclaw";