@integrity-labs/agt-cli 0.28.302 → 0.28.303

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 CHANGED
@@ -38,7 +38,7 @@ import {
38
38
  success,
39
39
  table,
40
40
  warn
41
- } from "../chunk-D5BJLFH7.js";
41
+ } from "../chunk-7LFB5DAW.js";
42
42
  import {
43
43
  CHANNEL_REGISTRY,
44
44
  DEFAULT_FRAMEWORK,
@@ -4826,7 +4826,7 @@ import { execFileSync, execSync } from "child_process";
4826
4826
  import { existsSync as existsSync10, realpathSync as realpathSync2 } from "fs";
4827
4827
  import chalk18 from "chalk";
4828
4828
  import ora16 from "ora";
4829
- var cliVersion = true ? "0.28.302" : "dev";
4829
+ var cliVersion = true ? "0.28.303" : "dev";
4830
4830
  async function fetchLatestVersion() {
4831
4831
  const host2 = getHost();
4832
4832
  if (!host2) return null;
@@ -5843,7 +5843,7 @@ function handleError(err) {
5843
5843
  }
5844
5844
 
5845
5845
  // src/bin/agt.ts
5846
- var cliVersion2 = true ? "0.28.302" : "dev";
5846
+ var cliVersion2 = true ? "0.28.303" : "dev";
5847
5847
  var program = new Command();
5848
5848
  program.name("agt").description("Augmented CLI \u2014 agent provisioning and management").version(cliVersion2).option("--json", "Emit machine-readable JSON output (suppress spinners and colors)").option("--skip-update-check", "Skip the automatic update check on startup");
5849
5849
  program.hook("preAction", async (thisCommand, actionCommand) => {
@@ -5882,7 +5882,7 @@ function requireHost() {
5882
5882
  }
5883
5883
 
5884
5884
  // src/lib/api-client.ts
5885
- var agtCliVersion = true ? "0.28.302" : "dev";
5885
+ var agtCliVersion = true ? "0.28.303" : "dev";
5886
5886
  var lastConfigHash = null;
5887
5887
  function setConfigHash(hash) {
5888
5888
  lastConfigHash = hash && hash.length > 0 ? hash : null;
@@ -8181,4 +8181,4 @@ export {
8181
8181
  managerInstallSystemUnitCommand,
8182
8182
  managerUninstallSystemUnitCommand
8183
8183
  };
8184
- //# sourceMappingURL=chunk-D5BJLFH7.js.map
8184
+ //# sourceMappingURL=chunk-7LFB5DAW.js.map
@@ -39,7 +39,7 @@ import {
39
39
  requireHost,
40
40
  safeWriteJsonAtomic,
41
41
  setConfigHash
42
- } from "../chunk-D5BJLFH7.js";
42
+ } from "../chunk-7LFB5DAW.js";
43
43
  import {
44
44
  getProjectDir as getProjectDir2,
45
45
  getReadyTasks,
@@ -6989,7 +6989,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
6989
6989
  var lastVersionCheckAt = 0;
6990
6990
  var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
6991
6991
  var lastResponsivenessProbeAt = 0;
6992
- var agtCliVersion = true ? "0.28.302" : "dev";
6992
+ var agtCliVersion = true ? "0.28.303" : "dev";
6993
6993
  function resolveBrewPath(execFileSync2) {
6994
6994
  try {
6995
6995
  const out = execFileSync2("which", ["brew"], { timeout: 5e3 }).toString().trim();
@@ -15585,6 +15585,57 @@ async function fetchThreadTranscript(channel, threadTs, limit, deps) {
15585
15585
  return { ok: true, count: allMessages.length, formatted: formatThreadMessages(allMessages, nameById) };
15586
15586
  }
15587
15587
 
15588
+ // src/slack-channel-history.ts
15589
+ var SLACK_HISTORY_DEFAULT_LIMIT = 50;
15590
+ var SLACK_HISTORY_MAX_LIMIT = 200;
15591
+ async function fetchChannelHistory(channel, limit, deps, options = {}) {
15592
+ const { botToken, resolveUserName: resolveUserName2, fetchImpl = fetch } = deps;
15593
+ const cappedLimit = Math.min(Math.max(limit, 1), SLACK_HISTORY_MAX_LIMIT);
15594
+ const allMessages = [];
15595
+ let cursor;
15596
+ do {
15597
+ const remaining = cappedLimit - allMessages.length;
15598
+ if (remaining <= 0) break;
15599
+ const params = new URLSearchParams({
15600
+ channel,
15601
+ limit: String(Math.min(remaining, 100)),
15602
+ ...options.oldest ? { oldest: options.oldest } : {},
15603
+ ...options.latest ? { latest: options.latest } : {},
15604
+ ...cursor ? { cursor } : {}
15605
+ });
15606
+ let data;
15607
+ try {
15608
+ const res = await fetchImpl(`https://slack.com/api/conversations.history?${params}`, {
15609
+ headers: { Authorization: `Bearer ${botToken}` }
15610
+ });
15611
+ if (!res.ok) return { ok: false, error: `http_${res.status}` };
15612
+ data = await res.json();
15613
+ } catch (err) {
15614
+ return { ok: false, error: err instanceof Error ? err.message : "fetch_failed" };
15615
+ }
15616
+ if (!data.ok) return { ok: false, error: data.error ?? "unknown" };
15617
+ for (const msg of data.messages ?? []) {
15618
+ allMessages.push({
15619
+ user: msg.user ?? msg.bot_id ?? "unknown",
15620
+ text: msg.text ?? "",
15621
+ ts: msg.ts ?? ""
15622
+ });
15623
+ }
15624
+ cursor = data.response_metadata?.next_cursor || void 0;
15625
+ } while (cursor && allMessages.length < cappedLimit);
15626
+ allMessages.sort((a, b) => Number(a.ts) - Number(b.ts));
15627
+ const uniqueUserIds = [...new Set(allMessages.map((m) => m.user))];
15628
+ const resolved = await Promise.all(
15629
+ uniqueUserIds.map(async (id) => [id, await resolveUserName2(id)])
15630
+ );
15631
+ const nameById = new Map(resolved);
15632
+ return {
15633
+ ok: true,
15634
+ count: allMessages.length,
15635
+ formatted: formatThreadMessages(allMessages, nameById)
15636
+ };
15637
+ }
15638
+
15588
15639
  // src/impersonation.ts
15589
15640
  var ENV_VAR = "AGT_ACT_AS_AGENT_ID";
15590
15641
  var OVERRIDE_ENV_VAR = "ENABLE_IMPERSONATION_CHANNELS";
@@ -20523,6 +20574,32 @@ mcp.setRequestHandler(ListToolsRequestSchema, async () => ({
20523
20574
  required: ["channel", "thread_ts"]
20524
20575
  }
20525
20576
  },
20577
+ {
20578
+ name: "slack.read_history",
20579
+ description: `Read recent top-level messages in a Slack channel the bot is a member of (via conversations.history). Use this to catch up on what was said in a channel \u2014 e.g. an auto-followed channel you have not been @-mentioned in, or to gather context before posting. This reads CHANNEL history; for one thread's replies use slack.read_thread instead. Optional oldest/latest bound the time window (Slack ts values). Returns messages oldest\u2192newest. The bot only sees channels it has been invited to \u2014 a "not_in_channel" error means someone must /invite the bot first.`,
20580
+ inputSchema: {
20581
+ type: "object",
20582
+ properties: {
20583
+ channel: {
20584
+ type: "string",
20585
+ description: "Slack channel ID to read history from (the bot must be a member of it)"
20586
+ },
20587
+ limit: {
20588
+ type: "number",
20589
+ description: "Max messages to return (default 50, max 200)"
20590
+ },
20591
+ oldest: {
20592
+ type: "string",
20593
+ description: 'Optional lower time bound \u2014 only messages AFTER this Slack ts (exclusive), e.g. "1783900000.000000".'
20594
+ },
20595
+ latest: {
20596
+ type: "string",
20597
+ description: "Optional upper time bound \u2014 only messages up to and including this Slack ts."
20598
+ }
20599
+ },
20600
+ required: ["channel"]
20601
+ }
20602
+ },
20526
20603
  {
20527
20604
  name: "slack.download_attachment",
20528
20605
  description: "Download an inbound Slack attachment on demand. Use this for non-image files (PDFs, docx, csv, etc.) that arrived via a <channel> tag \u2014 look for `file_id` in the `files` meta. Requires the `channel` attribute from the same <channel> tag so the tool can verify the attachment was shared in the current conversation. Returns the local path where the file was written (inside ~/.augmented/<codeName>/slack-inbound/). Images are auto-downloaded on receipt and don't need this tool.",
@@ -21026,6 +21103,40 @@ ${result.formatted}` : "Thread is empty or not found."
21026
21103
  };
21027
21104
  }
21028
21105
  }
21106
+ if (name === "slack.read_history") {
21107
+ const { channel, limit: rawLimit, oldest, latest } = args;
21108
+ const limit = Math.min(
21109
+ Math.max(rawLimit ?? SLACK_HISTORY_DEFAULT_LIMIT, 1),
21110
+ SLACK_HISTORY_MAX_LIMIT
21111
+ );
21112
+ try {
21113
+ const result = await fetchChannelHistory(
21114
+ channel,
21115
+ limit,
21116
+ { botToken: BOT_TOKEN, resolveUserName },
21117
+ { oldest, latest }
21118
+ );
21119
+ if (!result.ok) {
21120
+ return {
21121
+ content: [{ type: "text", text: `Slack error: ${result.error}` }],
21122
+ isError: true
21123
+ };
21124
+ }
21125
+ return {
21126
+ content: [{
21127
+ type: "text",
21128
+ text: result.count > 0 ? `Channel history (${result.count} messages, oldest\u2192newest):
21129
+
21130
+ ${result.formatted}` : "No messages in range, or the bot is not a member of this channel."
21131
+ }]
21132
+ };
21133
+ } catch (err) {
21134
+ return {
21135
+ content: [{ type: "text", text: `Failed: ${err.message}` }],
21136
+ isError: true
21137
+ };
21138
+ }
21139
+ }
21029
21140
  if (name === "slack.upload_file") {
21030
21141
  const {
21031
21142
  path,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@integrity-labs/agt-cli",
3
- "version": "0.28.302",
3
+ "version": "0.28.303",
4
4
  "description": "Augmented Team CLI — agent provisioning and management",
5
5
  "type": "module",
6
6
  "engines": {