@integrity-labs/agt-cli 0.28.1073 → 0.28.1075

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
@@ -40,12 +40,12 @@ import {
40
40
  success,
41
41
  table,
42
42
  warn
43
- } from "../chunk-IAHNUTZX.js";
43
+ } from "../chunk-X6L3BRJI.js";
44
44
  import {
45
45
  getProjectDir,
46
46
  isSessionResumeDisabled,
47
47
  readDirectChatSessionState
48
- } from "../chunk-NMPSEFF2.js";
48
+ } from "../chunk-XNIN4UH6.js";
49
49
  import {
50
50
  AnchorSessionClient,
51
51
  CHANNEL_REGISTRY,
@@ -79,7 +79,7 @@ import {
79
79
  serializeManifestForSlackCli,
80
80
  sessionFileExists,
81
81
  sessionTranscriptDir
82
- } from "../chunk-6RYGVXLR.js";
82
+ } from "../chunk-HE3ZAMGG.js";
83
83
  import "../chunk-OCMJ5E6J.js";
84
84
  import "../chunk-XWVM4KPK.js";
85
85
  import "../chunk-EL5MWGGH.js";
@@ -5474,7 +5474,7 @@ import { execFileSync, execSync } from "child_process";
5474
5474
  import { existsSync as existsSync11, realpathSync as realpathSync2 } from "fs";
5475
5475
  import chalk18 from "chalk";
5476
5476
  import ora16 from "ora";
5477
- var cliVersion = true ? "0.28.1073" : "dev";
5477
+ var cliVersion = true ? "0.28.1075" : "dev";
5478
5478
  async function fetchLatestVersion() {
5479
5479
  const host2 = getHost();
5480
5480
  if (!host2) return null;
@@ -6734,7 +6734,7 @@ function handleError(err) {
6734
6734
  }
6735
6735
 
6736
6736
  // src/bin/agt.ts
6737
- var cliVersion2 = true ? "0.28.1073" : "dev";
6737
+ var cliVersion2 = true ? "0.28.1075" : "dev";
6738
6738
  var program = new Command();
6739
6739
  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");
6740
6740
  program.hook("preAction", async (thisCommand, actionCommand) => {
@@ -1189,11 +1189,67 @@ var ADVISORY_LEVEL_LINE = {
1189
1189
  warn: "Level: warn \u2014 proceed only if clearly justified; say so.",
1190
1190
  log: "Level: log \u2014 informational; proceed."
1191
1191
  };
1192
- function renderAdvisoryGuardrailBullet(g) {
1192
+ var REQUIRE_APPROVAL_FOR_ACTIONS_DEF = "require-approval-for-actions";
1193
+ var REQUIRE_APPROVAL_HOW = {
1194
+ enforce: [
1195
+ ` To get approval for one of these actions, call \`request_approval\` (it goes to your`,
1196
+ ` manager), tell the user you have asked, and end your turn. Later, call \`check_approval\``,
1197
+ ` with the request_id and act only once it is approved; if it is denied or expires, do`,
1198
+ ` not act, and tell the user. Never just say you are waiting for, or cannot reach, your`,
1199
+ ` manager without filing the request. If \`request_approval\` fails, say so and leave the`,
1200
+ ` action undone.`
1201
+ ],
1202
+ warn: [
1203
+ ` When one of these actions is not clearly justified, ask rather than decline: call`,
1204
+ ` \`request_approval\` (it goes to your manager), end your turn, and act only once`,
1205
+ ` \`check_approval\` says it is approved.`
1206
+ ]
1207
+ };
1208
+ var REQUIRE_APPROVAL_EMAIL_ACTION = "send_email";
1209
+ var EMAIL_REQUIRE_APPROVAL_DEF = "email.require_approval";
1210
+ function liveEmailHoldActions(guardrails) {
1211
+ const g = guardrails.find((x) => x.definitionId === EMAIL_REQUIRE_APPROVAL_DEF);
1212
+ if (!g || g.enforcement !== "enforce" || g.emailHold?.live !== true)
1213
+ return null;
1214
+ const raw = g.emailHold.coveredActions;
1215
+ const covered = Array.isArray(raw) ? raw.filter((a) => typeof a === "string" && a.trim() !== "") : [];
1216
+ return covered.length > 0 ? covered : null;
1217
+ }
1218
+ function requireApprovalEmailException(covered) {
1219
+ return [
1220
+ ` Except \`${REQUIRE_APPROVAL_EMAIL_ACTION}\` with ${covered.map((a) => `\`${a}\``).join(", ")}: your organization's`,
1221
+ ` email approval hold puts every such send in front of a human, so for those do not call`,
1222
+ ` \`request_approval\` and do not decline on this guardrail's basis. Attempt the send and let`,
1223
+ ` that hold decide; asking first would make your manager approve the same email twice. Any`,
1224
+ ` other way of sending email is not held: ask first with \`request_approval\`.`
1225
+ ];
1226
+ }
1227
+ function requireApprovalActions(config) {
1228
+ const raw = config?.["actions"];
1229
+ if (!Array.isArray(raw))
1230
+ return null;
1231
+ const actions = raw.filter((a) => typeof a === "string" && a.trim() !== "").map((a) => a.trim());
1232
+ return actions.length > 0 ? actions : null;
1233
+ }
1234
+ function requireApprovalHowLines(g, level, emailHold) {
1235
+ const actions = requireApprovalActions(g.config);
1236
+ const namesEmail = actions === null || actions.includes(REQUIRE_APPROVAL_EMAIL_ACTION);
1237
+ const namesOther = actions === null || actions.some((a) => a !== REQUIRE_APPROVAL_EMAIL_ACTION);
1238
+ const ask = namesOther || namesEmail && emailHold === null;
1239
+ return [
1240
+ ...ask ? REQUIRE_APPROVAL_HOW[level] : [],
1241
+ ...namesEmail && emailHold !== null ? requireApprovalEmailException(emailHold) : []
1242
+ ];
1243
+ }
1244
+ function renderAdvisoryGuardrailBullet(g, emailHold) {
1193
1245
  const [header, ...rest] = renderGuardrailBullet(g).split("\n");
1194
1246
  const level = g.enforcement === "warn" || g.enforcement === "log" ? g.enforcement : "enforce";
1195
- return [header, ` ${ADVISORY_LEVEL_LINE[level]}`, ...rest].join("\n");
1247
+ const isRequireApproval = g.definitionId === REQUIRE_APPROVAL_FOR_ACTIONS_DEF;
1248
+ const how = isRequireApproval && level !== "log" ? requireApprovalHowLines(g, level, emailHold) : [];
1249
+ const levelLine = isRequireApproval && level === "enforce" ? REQUIRE_APPROVAL_ENFORCE_LEVEL_LINE : ADVISORY_LEVEL_LINE[level];
1250
+ return [header, ` ${levelLine}`, ...how, ...rest].join("\n");
1196
1251
  }
1252
+ var REQUIRE_APPROVAL_ENFORCE_LEVEL_LINE = "Level: enforce \u2014 never take these actions without approval; get it as described below.";
1197
1253
  function renderOverriddenGuardrailBullet(g) {
1198
1254
  const reason = g.overrideReason?.trim() ?? "";
1199
1255
  const lines = [`- **${g.displayName}** (${g.category}, from ${g.source})`];
@@ -1291,7 +1347,8 @@ function buildGuardrailsSection(guardrails) {
1291
1347
  }
1292
1348
  if (advisory.length > 0) {
1293
1349
  blocks.push(``, `### Advisory (policy only \u2014 not enforced by the platform)`, ``, `Follow these as operator instructions, at the level each one states (it`, `replaces the refuse-by-default rule above). No platform control backs them, so`, `never say an action was blocked, held for approval, or audited on their`, `basis \u2014 if you decline, say so and why.`, ``);
1294
- blocks.push(advisory.map(renderAdvisoryGuardrailBullet).join("\n"));
1350
+ const emailHold = liveEmailHoldActions(active);
1351
+ blocks.push(advisory.map((g) => renderAdvisoryGuardrailBullet(g, emailHold)).join("\n"));
1295
1352
  }
1296
1353
  if (overridden.length > 0) {
1297
1354
  blocks.push(``, `### Approved exceptions (an operator override applies - follow the adjusted policy)`, ``);
@@ -16061,4 +16118,4 @@ export {
16061
16118
  peekCurrentSession,
16062
16119
  readDailySessionPin
16063
16120
  };
16064
- //# sourceMappingURL=chunk-6RYGVXLR.js.map
16121
+ //# sourceMappingURL=chunk-HE3ZAMGG.js.map