@integrity-labs/agt-cli 0.27.71 → 0.27.73

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
@@ -28,7 +28,7 @@ import {
28
28
  success,
29
29
  table,
30
30
  warn
31
- } from "../chunk-EWWJUVDY.js";
31
+ } from "../chunk-WBT4UEOY.js";
32
32
  import {
33
33
  CHANNEL_REGISTRY,
34
34
  DEPLOYMENT_TEMPLATES,
@@ -54,7 +54,7 @@ import {
54
54
  renderTemplate,
55
55
  resolveChannels,
56
56
  serializeManifestForSlackCli
57
- } from "../chunk-KPD5KJY7.js";
57
+ } from "../chunk-5SWHKUL3.js";
58
58
 
59
59
  // src/bin/agt.ts
60
60
  import { join as join20 } from "path";
@@ -4930,7 +4930,7 @@ import { execFileSync, execSync } from "child_process";
4930
4930
  import { existsSync as existsSync10, realpathSync as realpathSync2 } from "fs";
4931
4931
  import chalk18 from "chalk";
4932
4932
  import ora16 from "ora";
4933
- var cliVersion = true ? "0.27.71" : "dev";
4933
+ var cliVersion = true ? "0.27.73" : "dev";
4934
4934
  async function fetchLatestVersion() {
4935
4935
  const host2 = getHost();
4936
4936
  if (!host2) return null;
@@ -5853,7 +5853,7 @@ function handleError(err) {
5853
5853
  }
5854
5854
 
5855
5855
  // src/bin/agt.ts
5856
- var cliVersion2 = true ? "0.27.71" : "dev";
5856
+ var cliVersion2 = true ? "0.27.73" : "dev";
5857
5857
  var program = new Command();
5858
5858
  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");
5859
5859
  program.hook("preAction", async (thisCommand, actionCommand) => {
@@ -4035,6 +4035,122 @@ var firecrawlTriggerAdapter = {
4035
4035
  };
4036
4036
  registerTriggerSource(firecrawlTriggerAdapter);
4037
4037
 
4038
+ // ../../packages/core/dist/triggers/adapters/gdrive-comments.js
4039
+ function containsMention(text, mentions) {
4040
+ if (!text)
4041
+ return false;
4042
+ const lower = text.toLowerCase();
4043
+ return mentions.some((m) => m.length > 0 && lower.includes(m.toLowerCase()));
4044
+ }
4045
+ function classifyMentions(comments, watermark, mentions) {
4046
+ const watermarkMs = watermark ? Date.parse(watermark) : Number.NEGATIVE_INFINITY;
4047
+ const out = [];
4048
+ for (const comment of comments) {
4049
+ if (!comment.id || comment.deleted)
4050
+ continue;
4051
+ if (comment.resolved)
4052
+ continue;
4053
+ const createdMs = comment.createdTime ? Date.parse(comment.createdTime) : Number.NaN;
4054
+ if (Number.isFinite(createdMs) && createdMs >= watermarkMs) {
4055
+ if (containsMention(comment.content, mentions)) {
4056
+ out.push({ kind: "NEW_COMMENT", comment });
4057
+ }
4058
+ }
4059
+ for (const reply of comment.replies ?? []) {
4060
+ if (!reply.id || reply.deleted)
4061
+ continue;
4062
+ if (reply.action)
4063
+ continue;
4064
+ const replyCreatedMs = reply.createdTime ? Date.parse(reply.createdTime) : Number.NaN;
4065
+ if (!Number.isFinite(replyCreatedMs) || replyCreatedMs < watermarkMs)
4066
+ continue;
4067
+ if (!containsMention(reply.content, mentions))
4068
+ continue;
4069
+ out.push({ kind: "NEW_REPLY", comment, reply });
4070
+ }
4071
+ }
4072
+ return out;
4073
+ }
4074
+ function nextWatermark(comments, current) {
4075
+ let max = current;
4076
+ for (const c of comments) {
4077
+ if (c.modifiedTime && (!max || c.modifiedTime > max))
4078
+ max = c.modifiedTime;
4079
+ }
4080
+ return max;
4081
+ }
4082
+ function renderMentionBody(m, fileId) {
4083
+ const docUrl = `https://docs.google.com/document/d/${fileId}/edit`;
4084
+ const quoted = m.comment.quotedFileContent?.value ? `
4085
+ > ${m.comment.quotedFileContent.value}` : "";
4086
+ if (m.kind === "NEW_REPLY" && m.reply) {
4087
+ return `${m.reply.author?.displayName ?? "Someone"} replied in a comment thread on a Google Doc you watch and mentioned you:
4088
+
4089
+ ${m.reply.content ?? ""}
4090
+
4091
+ Thread opener (${m.comment.author?.displayName ?? "unknown"}): ${m.comment.content ?? ""}${quoted}
4092
+
4093
+ Doc: ${docUrl} (comment id ${m.comment.id})`;
4094
+ }
4095
+ return `${m.comment.author?.displayName ?? "Someone"} mentioned you in a new comment on a Google Doc you watch:
4096
+
4097
+ ${m.comment.content ?? ""}${quoted}
4098
+
4099
+ Doc: ${docUrl} (comment id ${m.comment.id})`;
4100
+ }
4101
+ var gdriveCommentsTriggerAdapter = {
4102
+ provider: "gdrive_comments",
4103
+ kind: "poll",
4104
+ async poll(ctx, trigger) {
4105
+ const config = trigger.config;
4106
+ const fileId = typeof config.fileId === "string" ? config.fileId : void 0;
4107
+ const mentions = Array.isArray(config.mention) ? config.mention.filter((m) => typeof m === "string" && m.length > 0) : [];
4108
+ if (!fileId || mentions.length === 0) {
4109
+ throw new Error("gdrive_comments: trigger config requires fileId and mention[]");
4110
+ }
4111
+ const fetcher = ctx.credentials;
4112
+ if (!fetcher || typeof fetcher.listComments !== "function") {
4113
+ throw new Error("gdrive_comments: executor must inject a DriveCommentsFetcher");
4114
+ }
4115
+ const cursor = ctx.cursor ?? {};
4116
+ const watermark = typeof cursor.modifiedTime === "string" ? cursor.modifiedTime : void 0;
4117
+ const threads = [];
4118
+ let pageToken;
4119
+ do {
4120
+ const page = await fetcher.listComments({
4121
+ fileId,
4122
+ ...watermark ? { startModifiedTime: watermark } : {},
4123
+ ...pageToken ? { pageToken } : {}
4124
+ });
4125
+ for (const c of page.comments ?? []) {
4126
+ if (watermark && c.modifiedTime && c.modifiedTime < watermark)
4127
+ continue;
4128
+ threads.push(c);
4129
+ }
4130
+ pageToken = page.nextPageToken;
4131
+ } while (pageToken);
4132
+ const events = classifyMentions(threads, watermark, mentions).map((m) => {
4133
+ const sourceId = m.kind === "NEW_REPLY" && m.reply ? `${m.comment.id}:${m.reply.id}:${m.reply.createdTime ?? ""}` : `${m.comment.id}:${m.comment.createdTime ?? ""}`;
4134
+ return {
4135
+ provider: "gdrive_comments",
4136
+ occurredAt: (m.kind === "NEW_REPLY" ? m.reply?.createdTime : m.comment.createdTime) ?? (/* @__PURE__ */ new Date()).toISOString(),
4137
+ // Keyed on the IMMUTABLE creation identity of the mention (not the
4138
+ // thread's rolling modifiedTime), so an unrelated later edit to the
4139
+ // same thread can never re-deliver the mention (AC2) and overlapping
4140
+ // polls / restarts collapse onto one row (AC3).
4141
+ dedupKey: `gdc:${sourceId}`,
4142
+ sourceTrust: "untrusted",
4143
+ title: m.kind === "NEW_COMMENT" ? "New comment mention" : "New reply mention",
4144
+ body: renderMentionBody(m, fileId),
4145
+ raw: m.kind === "NEW_REPLY" ? { comment: m.comment, reply: m.reply } : { comment: m.comment },
4146
+ meaningful: true
4147
+ };
4148
+ });
4149
+ return { events, cursor: { modifiedTime: nextWatermark(threads, watermark) } };
4150
+ }
4151
+ };
4152
+ registerTriggerSource(gdriveCommentsTriggerAdapter);
4153
+
4038
4154
  export {
4039
4155
  wrapScheduledTaskPrompt,
4040
4156
  parseDeliveryTarget,
@@ -4085,4 +4201,4 @@ export {
4085
4201
  attributeTranscriptUsageByRun,
4086
4202
  KANBAN_CHECK_COMMAND
4087
4203
  };
4088
- //# sourceMappingURL=chunk-KPD5KJY7.js.map
4204
+ //# sourceMappingURL=chunk-5SWHKUL3.js.map