@integrity-labs/agt-cli 0.28.1260 → 0.28.1262

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.
Files changed (36) hide show
  1. package/dist/{api-client-PXVHBJBB.js → api-client-DQ7YV5IG.js} +3 -3
  2. package/dist/bin/agt.js +7 -7
  3. package/dist/{chunk-UKZ3NXB7.js → chunk-5BXIXSSH.js} +2 -2
  4. package/dist/{chunk-7EEU3X3T.js → chunk-6YWVKLHF.js} +3 -3
  5. package/dist/{chunk-E7DKUEXC.js → chunk-CEJNJ6NF.js} +3 -3
  6. package/dist/{chunk-LLVL6LIB.js → chunk-HJWOXFJM.js} +2 -2
  7. package/dist/{chunk-UQLSI3C7.js → chunk-KJ5OCCSJ.js} +98 -6
  8. package/dist/chunk-KJ5OCCSJ.js.map +1 -0
  9. package/dist/{chunk-NABJJPLW.js → chunk-PIKXAEVA.js} +525 -254
  10. package/dist/chunk-PIKXAEVA.js.map +1 -0
  11. package/dist/{claude-code-updater-OXTQF5E5.js → claude-code-updater-JQLNRK25.js} +3 -3
  12. package/dist/{claude-pair-runtime-BBOAF76W.js → claude-pair-runtime-BJ3EAWEJ.js} +3 -3
  13. package/dist/lib/manager-worker.js +580 -427
  14. package/dist/lib/manager-worker.js.map +1 -1
  15. package/dist/mcp/direct-chat-channel.js +94 -2
  16. package/dist/mcp/index.js +94 -2
  17. package/dist/mcp/origami.js +94 -2
  18. package/dist/mcp/slack-channel.js +94 -2
  19. package/dist/mcp/teams-channel.js +218 -82
  20. package/dist/mcp/telegram-channel.js +252 -2
  21. package/dist/{persistent-session-XPDKIBEM.js → persistent-session-YNHYNCNA.js} +4 -4
  22. package/dist/{responsiveness-probe-4B6Y2446.js → responsiveness-probe-57RV3U2H.js} +4 -4
  23. package/dist/{session-auth-dead-4C7AK3A6.js → session-auth-dead-A3TO2N63.js} +3 -3
  24. package/package.json +1 -1
  25. package/dist/chunk-NABJJPLW.js.map +0 -1
  26. package/dist/chunk-UQLSI3C7.js.map +0 -1
  27. /package/dist/{api-client-PXVHBJBB.js.map → api-client-DQ7YV5IG.js.map} +0 -0
  28. /package/dist/{chunk-UKZ3NXB7.js.map → chunk-5BXIXSSH.js.map} +0 -0
  29. /package/dist/{chunk-7EEU3X3T.js.map → chunk-6YWVKLHF.js.map} +0 -0
  30. /package/dist/{chunk-E7DKUEXC.js.map → chunk-CEJNJ6NF.js.map} +0 -0
  31. /package/dist/{chunk-LLVL6LIB.js.map → chunk-HJWOXFJM.js.map} +0 -0
  32. /package/dist/{claude-code-updater-OXTQF5E5.js.map → claude-code-updater-JQLNRK25.js.map} +0 -0
  33. /package/dist/{claude-pair-runtime-BBOAF76W.js.map → claude-pair-runtime-BJ3EAWEJ.js.map} +0 -0
  34. /package/dist/{persistent-session-XPDKIBEM.js.map → persistent-session-YNHYNCNA.js.map} +0 -0
  35. /package/dist/{responsiveness-probe-4B6Y2446.js.map → responsiveness-probe-57RV3U2H.js.map} +0 -0
  36. /package/dist/{session-auth-dead-4C7AK3A6.js.map → session-auth-dead-A3TO2N63.js.map} +0 -0
@@ -44457,7 +44457,10 @@ var GITHUB_EVENT_RULES = {
44457
44457
  pull_request_review: { actions: ["submitted"] },
44458
44458
  check_suite: { actions: ["completed"] },
44459
44459
  issues: { actions: ["opened", "closed"] },
44460
- issue_comment: { actions: ["created"] }
44460
+ issue_comment: { actions: ["created"] },
44461
+ // ENG-12123 (CS-2564): a deployment's status changed. GitHub sends one
44462
+ // deployment_status event per state change, always with action `created`.
44463
+ deployment_status: { actions: ["created"] }
44461
44464
  };
44462
44465
  var GITHUB_WEBHOOK_EVENTS = Object.keys(GITHUB_EVENT_RULES);
44463
44466
  var REPO_FULL_NAME = /^[A-Za-z0-9](?:[A-Za-z0-9-]{0,38})\/[A-Za-z0-9._-]{1,100}$/;
@@ -44480,6 +44483,28 @@ var CHECK_CONCLUSIONS = /* @__PURE__ */ new Set([
44480
44483
  "startup_failure"
44481
44484
  ]);
44482
44485
  var ISSUE_STATE_REASONS = /* @__PURE__ */ new Set(["completed", "not_planned", "reopened", "duplicate"]);
44486
+ var DEPLOYMENT_STATES = /* @__PURE__ */ new Set(["success", "failure", "error", "pending", "in_progress", "queued", "inactive"]);
44487
+ var ENVIRONMENT_TOKEN = /^[A-Za-z0-9][A-Za-z0-9._/:-]{0,63}$/;
44488
+ var ACTIONS_RUN_PATH = /^\/([^/]+)\/([^/]+)\/actions\/runs\/([1-9][0-9]{0,18})(?:\/job\/([1-9][0-9]{0,18}))?\/?$/;
44489
+ function githubActionsRunUrl(v, repo) {
44490
+ const s = str(v);
44491
+ if (s === null || s.length > 500)
44492
+ return null;
44493
+ let u;
44494
+ try {
44495
+ u = new URL(s);
44496
+ } catch {
44497
+ return null;
44498
+ }
44499
+ if (u.protocol !== "https:" || u.username || u.password || u.port || u.hostname !== "github.com")
44500
+ return null;
44501
+ const m = ACTIONS_RUN_PATH.exec(u.pathname);
44502
+ if (!m)
44503
+ return null;
44504
+ if (`${m[1]}/${m[2]}`.toLowerCase() !== repo.toLowerCase())
44505
+ return null;
44506
+ return `https://github.com/${repo}/actions/runs/${m[3]}${m[4] ? `/job/${m[4]}` : ""}`;
44507
+ }
44483
44508
  function asDict(v) {
44484
44509
  return v !== null && typeof v === "object" && !Array.isArray(v) ? v : null;
44485
44510
  }
@@ -44625,6 +44650,36 @@ function extractGithubFacts(event, payload) {
44625
44650
  summary: `Issue #${n2} ${action} in ${repo}`
44626
44651
  };
44627
44652
  }
44653
+ if (event === "deployment_status") {
44654
+ const status = asDict(root["deployment_status"]);
44655
+ const deployment = asDict(root["deployment"]);
44656
+ if (!status || !deployment)
44657
+ return null;
44658
+ const state = inSet(status["state"], DEPLOYMENT_STATES);
44659
+ const environment = shaped(status["environment"], ENVIRONMENT_TOKEN) ?? shaped(deployment["environment"], ENVIRONMENT_TOKEN);
44660
+ details.push(["Environment", environment ?? "(name withheld: not a plain token)"]);
44661
+ details.push(["State", state ?? "unknown"]);
44662
+ const deploymentId = posInt(deployment["id"]);
44663
+ if (deploymentId !== null)
44664
+ details.push(["Deployment id", String(deploymentId)]);
44665
+ const sha = shaped(str(deployment["sha"])?.toLowerCase(), SHA);
44666
+ if (sha)
44667
+ details.push(["Commit", sha]);
44668
+ const creator = shaped(asDict(status["creator"])?.["login"], LOGIN);
44669
+ if (creator)
44670
+ details.push(["Status set by", creator]);
44671
+ const link = githubActionsRunUrl(status["log_url"], repo) ?? githubActionsRunUrl(status["target_url"], repo);
44672
+ return {
44673
+ event,
44674
+ action,
44675
+ repo,
44676
+ subject: null,
44677
+ url: link ?? `${base}/deployments`,
44678
+ sender,
44679
+ details,
44680
+ summary: `Deployment to ${environment ?? "an environment"} ${state ?? "updated"} in ${repo}`
44681
+ };
44682
+ }
44628
44683
  const issue2 = asDict(root["issue"]);
44629
44684
  const n = issue2 ? posInt(issue2["number"]) : null;
44630
44685
  if (!issue2 || n === null)
@@ -44801,6 +44856,43 @@ var FLAG_REGISTRY = [
44801
44856
  flagType: "boolean",
44802
44857
  defaultValue: false
44803
44858
  },
44859
+ {
44860
+ key: "scratch-sweep-held",
44861
+ description: "ENG-11877: stops ALL scratch sweeping for an agent, including the existing tree rule, for files someone has asked to keep. Resolved per agent by the manager. Sticky on the host: once seen it is written to a marker outside scratch, which keeps the agent held until heartbeats that evaluated it find the flag off for 10 minutes, so a restart or a failed flag read cannot let a sweep through. A host only honours it once its CLI has the reader: check reach before relying on it. Off is the safe default for everyone else.",
44862
+ sensitive: true,
44863
+ flagType: "boolean",
44864
+ defaultValue: false,
44865
+ // No published agt-cli has this reader yet, and a guessed floor would report reach
44866
+ // on hosts that can't act on it. So this reads as "no host yet" on purpose, the
44867
+ // safe direction. ENG-11877 re-pins it from the published dist after merge.
44868
+ since: "0.28.999999"
44869
+ },
44870
+ {
44871
+ key: "scratch-sweep-per-file",
44872
+ description: "ENG-11877: also expire old files inside scratch folders still in use, instead of keeping a whole folder while anything in it is fresh. IRREVERSIBLE on its first pass: every file unchanged for 7 days goes, customer documents included, so arm it per agent and read scratch-sweep-dry-run first. Off = the tree rule only.",
44873
+ sensitive: true,
44874
+ // CodeRabbit on #7378: `sensitive` only forces a confirmation; it does not say
44875
+ // WHO. Its first pass irreversibly deletes old customer files, and arming it is
44876
+ // Brad's rollout decision (ENG-11877), so an org owner/admin must not be able to
44877
+ // switch it on for their own agents. Only the cross-org admin route can write it.
44878
+ platformAdminOnly: true,
44879
+ flagType: "boolean",
44880
+ defaultValue: false,
44881
+ // No published agt-cli has this reader yet, and a guessed floor would report reach
44882
+ // on hosts that can't act on it. So this reads as "no host yet" on purpose, the
44883
+ // safe direction. ENG-11877 re-pins it from the published dist after merge.
44884
+ since: "0.28.999999"
44885
+ },
44886
+ {
44887
+ key: "scratch-sweep-dry-run",
44888
+ description: "ENG-11877: count what scratch-sweep-per-file would remove and log it to manager.log every 6 hours ([scratch] [sweep-dry-run]). Metadata only: never opens a file, never logs a name, removes nothing extra.",
44889
+ flagType: "boolean",
44890
+ defaultValue: false,
44891
+ // No published agt-cli has this reader yet, and a guessed floor would report reach
44892
+ // on hosts that can't act on it. So this reads as "no host yet" on purpose, the
44893
+ // safe direction. ENG-11877 re-pins it from the published dist after merge.
44894
+ since: "0.28.999999"
44895
+ },
44804
44896
  {
44805
44897
  key: "broker-read-jobs",
44806
44898
  description: `Slow broker READ tools finish in a background job (ENG-11476, ADR-0129). When on for an org, an opted-in read tool (Pronto Xi first) that misses an 18s grace window answers "still running, call again with the same arguments" and finishes in the broker-read-job worker instead of timing out. Off = today's synchronous call, so false is the safe value. Evaluated in the API per org, team and agent.`,
@@ -45185,7 +45277,7 @@ var FLAG_REGISTRY = [
45185
45277
  },
45186
45278
  {
45187
45279
  key: "ghost-reply-narration-guard",
45188
- description: "Model-free guard on the SLACK ghost-reply RECOVERY path (CS-1821, CS-1429, ENG-7780); Telegram and Teams recovery do not run it. Recovered end-of-turn text with no second person, question, link or mention, that uses stand-down wording or names the person being answered in the third person, is not published. enforce = keep the marker so the inbound is re-delivered and the agent can answer properly. When re-deliveries run out, stand-down wording closes unposted and a name-only match publishes; with no reply owed, either closes. shadow = log only. off = never runs. A false match usually costs a re-ask; a real reply using stand-down wording every time is lost.",
45280
+ description: "Model-free guard on the ghost-reply RECOVERY path of Slack, Telegram and Teams (CS-1821, CS-1429, ENG-7780, ENG-11890). Teams has no re-delivery, so there it only closes stand-down wording. Recovered end-of-turn text with no second person, question, link or mention, that uses stand-down wording or names the person being answered in the third person, is not published. enforce = keep the marker so the inbound is re-delivered and the agent can answer properly. When re-deliveries run out, stand-down wording closes unposted and a name-only match publishes; with no reply owed, either closes. shadow = log only. off = never runs. A false match usually costs a re-ask; a real reply using stand-down wording every time is lost.",
45189
45281
  flagType: "enum",
45190
45282
  allowedValues: ["off", "shadow", "enforce"],
45191
45283
  // Ships in SHADOW: a free local log line, like every enum flag here, enforce is a
package/dist/mcp/index.js CHANGED
@@ -30139,7 +30139,10 @@ var GITHUB_EVENT_RULES = {
30139
30139
  pull_request_review: { actions: ["submitted"] },
30140
30140
  check_suite: { actions: ["completed"] },
30141
30141
  issues: { actions: ["opened", "closed"] },
30142
- issue_comment: { actions: ["created"] }
30142
+ issue_comment: { actions: ["created"] },
30143
+ // ENG-12123 (CS-2564): a deployment's status changed. GitHub sends one
30144
+ // deployment_status event per state change, always with action `created`.
30145
+ deployment_status: { actions: ["created"] }
30143
30146
  };
30144
30147
  var GITHUB_WEBHOOK_EVENTS = Object.keys(GITHUB_EVENT_RULES);
30145
30148
  var REPO_FULL_NAME = /^[A-Za-z0-9](?:[A-Za-z0-9-]{0,38})\/[A-Za-z0-9._-]{1,100}$/;
@@ -30162,6 +30165,28 @@ var CHECK_CONCLUSIONS = /* @__PURE__ */ new Set([
30162
30165
  "startup_failure"
30163
30166
  ]);
30164
30167
  var ISSUE_STATE_REASONS = /* @__PURE__ */ new Set(["completed", "not_planned", "reopened", "duplicate"]);
30168
+ var DEPLOYMENT_STATES = /* @__PURE__ */ new Set(["success", "failure", "error", "pending", "in_progress", "queued", "inactive"]);
30169
+ var ENVIRONMENT_TOKEN = /^[A-Za-z0-9][A-Za-z0-9._/:-]{0,63}$/;
30170
+ var ACTIONS_RUN_PATH = /^\/([^/]+)\/([^/]+)\/actions\/runs\/([1-9][0-9]{0,18})(?:\/job\/([1-9][0-9]{0,18}))?\/?$/;
30171
+ function githubActionsRunUrl(v, repo) {
30172
+ const s = str(v);
30173
+ if (s === null || s.length > 500)
30174
+ return null;
30175
+ let u;
30176
+ try {
30177
+ u = new URL(s);
30178
+ } catch {
30179
+ return null;
30180
+ }
30181
+ if (u.protocol !== "https:" || u.username || u.password || u.port || u.hostname !== "github.com")
30182
+ return null;
30183
+ const m = ACTIONS_RUN_PATH.exec(u.pathname);
30184
+ if (!m)
30185
+ return null;
30186
+ if (`${m[1]}/${m[2]}`.toLowerCase() !== repo.toLowerCase())
30187
+ return null;
30188
+ return `https://github.com/${repo}/actions/runs/${m[3]}${m[4] ? `/job/${m[4]}` : ""}`;
30189
+ }
30165
30190
  function asDict(v) {
30166
30191
  return v !== null && typeof v === "object" && !Array.isArray(v) ? v : null;
30167
30192
  }
@@ -30307,6 +30332,36 @@ function extractGithubFacts(event, payload) {
30307
30332
  summary: `Issue #${n2} ${action} in ${repo}`
30308
30333
  };
30309
30334
  }
30335
+ if (event === "deployment_status") {
30336
+ const status = asDict(root["deployment_status"]);
30337
+ const deployment = asDict(root["deployment"]);
30338
+ if (!status || !deployment)
30339
+ return null;
30340
+ const state = inSet(status["state"], DEPLOYMENT_STATES);
30341
+ const environment = shaped(status["environment"], ENVIRONMENT_TOKEN) ?? shaped(deployment["environment"], ENVIRONMENT_TOKEN);
30342
+ details.push(["Environment", environment ?? "(name withheld: not a plain token)"]);
30343
+ details.push(["State", state ?? "unknown"]);
30344
+ const deploymentId = posInt(deployment["id"]);
30345
+ if (deploymentId !== null)
30346
+ details.push(["Deployment id", String(deploymentId)]);
30347
+ const sha = shaped(str(deployment["sha"])?.toLowerCase(), SHA);
30348
+ if (sha)
30349
+ details.push(["Commit", sha]);
30350
+ const creator = shaped(asDict(status["creator"])?.["login"], LOGIN);
30351
+ if (creator)
30352
+ details.push(["Status set by", creator]);
30353
+ const link = githubActionsRunUrl(status["log_url"], repo) ?? githubActionsRunUrl(status["target_url"], repo);
30354
+ return {
30355
+ event,
30356
+ action,
30357
+ repo,
30358
+ subject: null,
30359
+ url: link ?? `${base}/deployments`,
30360
+ sender,
30361
+ details,
30362
+ summary: `Deployment to ${environment ?? "an environment"} ${state ?? "updated"} in ${repo}`
30363
+ };
30364
+ }
30310
30365
  const issue2 = asDict(root["issue"]);
30311
30366
  const n = issue2 ? posInt(issue2["number"]) : null;
30312
30367
  if (!issue2 || n === null)
@@ -30483,6 +30538,43 @@ var FLAG_REGISTRY = [
30483
30538
  flagType: "boolean",
30484
30539
  defaultValue: false
30485
30540
  },
30541
+ {
30542
+ key: "scratch-sweep-held",
30543
+ description: "ENG-11877: stops ALL scratch sweeping for an agent, including the existing tree rule, for files someone has asked to keep. Resolved per agent by the manager. Sticky on the host: once seen it is written to a marker outside scratch, which keeps the agent held until heartbeats that evaluated it find the flag off for 10 minutes, so a restart or a failed flag read cannot let a sweep through. A host only honours it once its CLI has the reader: check reach before relying on it. Off is the safe default for everyone else.",
30544
+ sensitive: true,
30545
+ flagType: "boolean",
30546
+ defaultValue: false,
30547
+ // No published agt-cli has this reader yet, and a guessed floor would report reach
30548
+ // on hosts that can't act on it. So this reads as "no host yet" on purpose, the
30549
+ // safe direction. ENG-11877 re-pins it from the published dist after merge.
30550
+ since: "0.28.999999"
30551
+ },
30552
+ {
30553
+ key: "scratch-sweep-per-file",
30554
+ description: "ENG-11877: also expire old files inside scratch folders still in use, instead of keeping a whole folder while anything in it is fresh. IRREVERSIBLE on its first pass: every file unchanged for 7 days goes, customer documents included, so arm it per agent and read scratch-sweep-dry-run first. Off = the tree rule only.",
30555
+ sensitive: true,
30556
+ // CodeRabbit on #7378: `sensitive` only forces a confirmation; it does not say
30557
+ // WHO. Its first pass irreversibly deletes old customer files, and arming it is
30558
+ // Brad's rollout decision (ENG-11877), so an org owner/admin must not be able to
30559
+ // switch it on for their own agents. Only the cross-org admin route can write it.
30560
+ platformAdminOnly: true,
30561
+ flagType: "boolean",
30562
+ defaultValue: false,
30563
+ // No published agt-cli has this reader yet, and a guessed floor would report reach
30564
+ // on hosts that can't act on it. So this reads as "no host yet" on purpose, the
30565
+ // safe direction. ENG-11877 re-pins it from the published dist after merge.
30566
+ since: "0.28.999999"
30567
+ },
30568
+ {
30569
+ key: "scratch-sweep-dry-run",
30570
+ description: "ENG-11877: count what scratch-sweep-per-file would remove and log it to manager.log every 6 hours ([scratch] [sweep-dry-run]). Metadata only: never opens a file, never logs a name, removes nothing extra.",
30571
+ flagType: "boolean",
30572
+ defaultValue: false,
30573
+ // No published agt-cli has this reader yet, and a guessed floor would report reach
30574
+ // on hosts that can't act on it. So this reads as "no host yet" on purpose, the
30575
+ // safe direction. ENG-11877 re-pins it from the published dist after merge.
30576
+ since: "0.28.999999"
30577
+ },
30486
30578
  {
30487
30579
  key: "broker-read-jobs",
30488
30580
  description: `Slow broker READ tools finish in a background job (ENG-11476, ADR-0129). When on for an org, an opted-in read tool (Pronto Xi first) that misses an 18s grace window answers "still running, call again with the same arguments" and finishes in the broker-read-job worker instead of timing out. Off = today's synchronous call, so false is the safe value. Evaluated in the API per org, team and agent.`,
@@ -30867,7 +30959,7 @@ var FLAG_REGISTRY = [
30867
30959
  },
30868
30960
  {
30869
30961
  key: "ghost-reply-narration-guard",
30870
- description: "Model-free guard on the SLACK ghost-reply RECOVERY path (CS-1821, CS-1429, ENG-7780); Telegram and Teams recovery do not run it. Recovered end-of-turn text with no second person, question, link or mention, that uses stand-down wording or names the person being answered in the third person, is not published. enforce = keep the marker so the inbound is re-delivered and the agent can answer properly. When re-deliveries run out, stand-down wording closes unposted and a name-only match publishes; with no reply owed, either closes. shadow = log only. off = never runs. A false match usually costs a re-ask; a real reply using stand-down wording every time is lost.",
30962
+ description: "Model-free guard on the ghost-reply RECOVERY path of Slack, Telegram and Teams (CS-1821, CS-1429, ENG-7780, ENG-11890). Teams has no re-delivery, so there it only closes stand-down wording. Recovered end-of-turn text with no second person, question, link or mention, that uses stand-down wording or names the person being answered in the third person, is not published. enforce = keep the marker so the inbound is re-delivered and the agent can answer properly. When re-deliveries run out, stand-down wording closes unposted and a name-only match publishes; with no reply owed, either closes. shadow = log only. off = never runs. A false match usually costs a re-ask; a real reply using stand-down wording every time is lost.",
30871
30963
  flagType: "enum",
30872
30964
  allowedValues: ["off", "shadow", "enforce"],
30873
30965
  // Ships in SHADOW: a free local log line, like every enum flag here, enforce is a
@@ -43941,7 +43941,10 @@ var GITHUB_EVENT_RULES = {
43941
43941
  pull_request_review: { actions: ["submitted"] },
43942
43942
  check_suite: { actions: ["completed"] },
43943
43943
  issues: { actions: ["opened", "closed"] },
43944
- issue_comment: { actions: ["created"] }
43944
+ issue_comment: { actions: ["created"] },
43945
+ // ENG-12123 (CS-2564): a deployment's status changed. GitHub sends one
43946
+ // deployment_status event per state change, always with action `created`.
43947
+ deployment_status: { actions: ["created"] }
43945
43948
  };
43946
43949
  var GITHUB_WEBHOOK_EVENTS = Object.keys(GITHUB_EVENT_RULES);
43947
43950
  var REPO_FULL_NAME = /^[A-Za-z0-9](?:[A-Za-z0-9-]{0,38})\/[A-Za-z0-9._-]{1,100}$/;
@@ -43964,6 +43967,28 @@ var CHECK_CONCLUSIONS = /* @__PURE__ */ new Set([
43964
43967
  "startup_failure"
43965
43968
  ]);
43966
43969
  var ISSUE_STATE_REASONS = /* @__PURE__ */ new Set(["completed", "not_planned", "reopened", "duplicate"]);
43970
+ var DEPLOYMENT_STATES = /* @__PURE__ */ new Set(["success", "failure", "error", "pending", "in_progress", "queued", "inactive"]);
43971
+ var ENVIRONMENT_TOKEN = /^[A-Za-z0-9][A-Za-z0-9._/:-]{0,63}$/;
43972
+ var ACTIONS_RUN_PATH = /^\/([^/]+)\/([^/]+)\/actions\/runs\/([1-9][0-9]{0,18})(?:\/job\/([1-9][0-9]{0,18}))?\/?$/;
43973
+ function githubActionsRunUrl(v, repo) {
43974
+ const s = str(v);
43975
+ if (s === null || s.length > 500)
43976
+ return null;
43977
+ let u;
43978
+ try {
43979
+ u = new URL(s);
43980
+ } catch {
43981
+ return null;
43982
+ }
43983
+ if (u.protocol !== "https:" || u.username || u.password || u.port || u.hostname !== "github.com")
43984
+ return null;
43985
+ const m = ACTIONS_RUN_PATH.exec(u.pathname);
43986
+ if (!m)
43987
+ return null;
43988
+ if (`${m[1]}/${m[2]}`.toLowerCase() !== repo.toLowerCase())
43989
+ return null;
43990
+ return `https://github.com/${repo}/actions/runs/${m[3]}${m[4] ? `/job/${m[4]}` : ""}`;
43991
+ }
43967
43992
  function asDict(v) {
43968
43993
  return v !== null && typeof v === "object" && !Array.isArray(v) ? v : null;
43969
43994
  }
@@ -44109,6 +44134,36 @@ function extractGithubFacts(event, payload) {
44109
44134
  summary: `Issue #${n2} ${action} in ${repo}`
44110
44135
  };
44111
44136
  }
44137
+ if (event === "deployment_status") {
44138
+ const status = asDict(root["deployment_status"]);
44139
+ const deployment = asDict(root["deployment"]);
44140
+ if (!status || !deployment)
44141
+ return null;
44142
+ const state = inSet(status["state"], DEPLOYMENT_STATES);
44143
+ const environment = shaped(status["environment"], ENVIRONMENT_TOKEN) ?? shaped(deployment["environment"], ENVIRONMENT_TOKEN);
44144
+ details.push(["Environment", environment ?? "(name withheld: not a plain token)"]);
44145
+ details.push(["State", state ?? "unknown"]);
44146
+ const deploymentId = posInt(deployment["id"]);
44147
+ if (deploymentId !== null)
44148
+ details.push(["Deployment id", String(deploymentId)]);
44149
+ const sha = shaped(str(deployment["sha"])?.toLowerCase(), SHA);
44150
+ if (sha)
44151
+ details.push(["Commit", sha]);
44152
+ const creator = shaped(asDict(status["creator"])?.["login"], LOGIN);
44153
+ if (creator)
44154
+ details.push(["Status set by", creator]);
44155
+ const link = githubActionsRunUrl(status["log_url"], repo) ?? githubActionsRunUrl(status["target_url"], repo);
44156
+ return {
44157
+ event,
44158
+ action,
44159
+ repo,
44160
+ subject: null,
44161
+ url: link ?? `${base}/deployments`,
44162
+ sender,
44163
+ details,
44164
+ summary: `Deployment to ${environment ?? "an environment"} ${state ?? "updated"} in ${repo}`
44165
+ };
44166
+ }
44112
44167
  const issue2 = asDict(root["issue"]);
44113
44168
  const n = issue2 ? posInt(issue2["number"]) : null;
44114
44169
  if (!issue2 || n === null)
@@ -44285,6 +44340,43 @@ var FLAG_REGISTRY = [
44285
44340
  flagType: "boolean",
44286
44341
  defaultValue: false
44287
44342
  },
44343
+ {
44344
+ key: "scratch-sweep-held",
44345
+ description: "ENG-11877: stops ALL scratch sweeping for an agent, including the existing tree rule, for files someone has asked to keep. Resolved per agent by the manager. Sticky on the host: once seen it is written to a marker outside scratch, which keeps the agent held until heartbeats that evaluated it find the flag off for 10 minutes, so a restart or a failed flag read cannot let a sweep through. A host only honours it once its CLI has the reader: check reach before relying on it. Off is the safe default for everyone else.",
44346
+ sensitive: true,
44347
+ flagType: "boolean",
44348
+ defaultValue: false,
44349
+ // No published agt-cli has this reader yet, and a guessed floor would report reach
44350
+ // on hosts that can't act on it. So this reads as "no host yet" on purpose, the
44351
+ // safe direction. ENG-11877 re-pins it from the published dist after merge.
44352
+ since: "0.28.999999"
44353
+ },
44354
+ {
44355
+ key: "scratch-sweep-per-file",
44356
+ description: "ENG-11877: also expire old files inside scratch folders still in use, instead of keeping a whole folder while anything in it is fresh. IRREVERSIBLE on its first pass: every file unchanged for 7 days goes, customer documents included, so arm it per agent and read scratch-sweep-dry-run first. Off = the tree rule only.",
44357
+ sensitive: true,
44358
+ // CodeRabbit on #7378: `sensitive` only forces a confirmation; it does not say
44359
+ // WHO. Its first pass irreversibly deletes old customer files, and arming it is
44360
+ // Brad's rollout decision (ENG-11877), so an org owner/admin must not be able to
44361
+ // switch it on for their own agents. Only the cross-org admin route can write it.
44362
+ platformAdminOnly: true,
44363
+ flagType: "boolean",
44364
+ defaultValue: false,
44365
+ // No published agt-cli has this reader yet, and a guessed floor would report reach
44366
+ // on hosts that can't act on it. So this reads as "no host yet" on purpose, the
44367
+ // safe direction. ENG-11877 re-pins it from the published dist after merge.
44368
+ since: "0.28.999999"
44369
+ },
44370
+ {
44371
+ key: "scratch-sweep-dry-run",
44372
+ description: "ENG-11877: count what scratch-sweep-per-file would remove and log it to manager.log every 6 hours ([scratch] [sweep-dry-run]). Metadata only: never opens a file, never logs a name, removes nothing extra.",
44373
+ flagType: "boolean",
44374
+ defaultValue: false,
44375
+ // No published agt-cli has this reader yet, and a guessed floor would report reach
44376
+ // on hosts that can't act on it. So this reads as "no host yet" on purpose, the
44377
+ // safe direction. ENG-11877 re-pins it from the published dist after merge.
44378
+ since: "0.28.999999"
44379
+ },
44288
44380
  {
44289
44381
  key: "broker-read-jobs",
44290
44382
  description: `Slow broker READ tools finish in a background job (ENG-11476, ADR-0129). When on for an org, an opted-in read tool (Pronto Xi first) that misses an 18s grace window answers "still running, call again with the same arguments" and finishes in the broker-read-job worker instead of timing out. Off = today's synchronous call, so false is the safe value. Evaluated in the API per org, team and agent.`,
@@ -44669,7 +44761,7 @@ var FLAG_REGISTRY = [
44669
44761
  },
44670
44762
  {
44671
44763
  key: "ghost-reply-narration-guard",
44672
- description: "Model-free guard on the SLACK ghost-reply RECOVERY path (CS-1821, CS-1429, ENG-7780); Telegram and Teams recovery do not run it. Recovered end-of-turn text with no second person, question, link or mention, that uses stand-down wording or names the person being answered in the third person, is not published. enforce = keep the marker so the inbound is re-delivered and the agent can answer properly. When re-deliveries run out, stand-down wording closes unposted and a name-only match publishes; with no reply owed, either closes. shadow = log only. off = never runs. A false match usually costs a re-ask; a real reply using stand-down wording every time is lost.",
44764
+ description: "Model-free guard on the ghost-reply RECOVERY path of Slack, Telegram and Teams (CS-1821, CS-1429, ENG-7780, ENG-11890). Teams has no re-delivery, so there it only closes stand-down wording. Recovered end-of-turn text with no second person, question, link or mention, that uses stand-down wording or names the person being answered in the third person, is not published. enforce = keep the marker so the inbound is re-delivered and the agent can answer properly. When re-deliveries run out, stand-down wording closes unposted and a name-only match publishes; with no reply owed, either closes. shadow = log only. off = never runs. A false match usually costs a re-ask; a real reply using stand-down wording every time is lost.",
44673
44765
  flagType: "enum",
44674
44766
  allowedValues: ["off", "shadow", "enforce"],
44675
44767
  // Ships in SHADOW: a free local log line, like every enum flag here, enforce is a
@@ -38796,7 +38796,10 @@ var GITHUB_EVENT_RULES = {
38796
38796
  pull_request_review: { actions: ["submitted"] },
38797
38797
  check_suite: { actions: ["completed"] },
38798
38798
  issues: { actions: ["opened", "closed"] },
38799
- issue_comment: { actions: ["created"] }
38799
+ issue_comment: { actions: ["created"] },
38800
+ // ENG-12123 (CS-2564): a deployment's status changed. GitHub sends one
38801
+ // deployment_status event per state change, always with action `created`.
38802
+ deployment_status: { actions: ["created"] }
38800
38803
  };
38801
38804
  var GITHUB_WEBHOOK_EVENTS = Object.keys(GITHUB_EVENT_RULES);
38802
38805
  var REPO_FULL_NAME = /^[A-Za-z0-9](?:[A-Za-z0-9-]{0,38})\/[A-Za-z0-9._-]{1,100}$/;
@@ -38819,6 +38822,28 @@ var CHECK_CONCLUSIONS = /* @__PURE__ */ new Set([
38819
38822
  "startup_failure"
38820
38823
  ]);
38821
38824
  var ISSUE_STATE_REASONS = /* @__PURE__ */ new Set(["completed", "not_planned", "reopened", "duplicate"]);
38825
+ var DEPLOYMENT_STATES = /* @__PURE__ */ new Set(["success", "failure", "error", "pending", "in_progress", "queued", "inactive"]);
38826
+ var ENVIRONMENT_TOKEN = /^[A-Za-z0-9][A-Za-z0-9._/:-]{0,63}$/;
38827
+ var ACTIONS_RUN_PATH = /^\/([^/]+)\/([^/]+)\/actions\/runs\/([1-9][0-9]{0,18})(?:\/job\/([1-9][0-9]{0,18}))?\/?$/;
38828
+ function githubActionsRunUrl(v, repo) {
38829
+ const s = str(v);
38830
+ if (s === null || s.length > 500)
38831
+ return null;
38832
+ let u;
38833
+ try {
38834
+ u = new URL(s);
38835
+ } catch {
38836
+ return null;
38837
+ }
38838
+ if (u.protocol !== "https:" || u.username || u.password || u.port || u.hostname !== "github.com")
38839
+ return null;
38840
+ const m = ACTIONS_RUN_PATH.exec(u.pathname);
38841
+ if (!m)
38842
+ return null;
38843
+ if (`${m[1]}/${m[2]}`.toLowerCase() !== repo.toLowerCase())
38844
+ return null;
38845
+ return `https://github.com/${repo}/actions/runs/${m[3]}${m[4] ? `/job/${m[4]}` : ""}`;
38846
+ }
38822
38847
  function asDict(v) {
38823
38848
  return v !== null && typeof v === "object" && !Array.isArray(v) ? v : null;
38824
38849
  }
@@ -38964,6 +38989,36 @@ function extractGithubFacts(event, payload) {
38964
38989
  summary: `Issue #${n2} ${action} in ${repo}`
38965
38990
  };
38966
38991
  }
38992
+ if (event === "deployment_status") {
38993
+ const status = asDict(root["deployment_status"]);
38994
+ const deployment = asDict(root["deployment"]);
38995
+ if (!status || !deployment)
38996
+ return null;
38997
+ const state = inSet(status["state"], DEPLOYMENT_STATES);
38998
+ const environment = shaped(status["environment"], ENVIRONMENT_TOKEN) ?? shaped(deployment["environment"], ENVIRONMENT_TOKEN);
38999
+ details.push(["Environment", environment ?? "(name withheld: not a plain token)"]);
39000
+ details.push(["State", state ?? "unknown"]);
39001
+ const deploymentId = posInt(deployment["id"]);
39002
+ if (deploymentId !== null)
39003
+ details.push(["Deployment id", String(deploymentId)]);
39004
+ const sha = shaped(str(deployment["sha"])?.toLowerCase(), SHA);
39005
+ if (sha)
39006
+ details.push(["Commit", sha]);
39007
+ const creator = shaped(asDict(status["creator"])?.["login"], LOGIN);
39008
+ if (creator)
39009
+ details.push(["Status set by", creator]);
39010
+ const link = githubActionsRunUrl(status["log_url"], repo) ?? githubActionsRunUrl(status["target_url"], repo);
39011
+ return {
39012
+ event,
39013
+ action,
39014
+ repo,
39015
+ subject: null,
39016
+ url: link ?? `${base}/deployments`,
39017
+ sender,
39018
+ details,
39019
+ summary: `Deployment to ${environment ?? "an environment"} ${state ?? "updated"} in ${repo}`
39020
+ };
39021
+ }
38967
39022
  const issue2 = asDict(root["issue"]);
38968
39023
  const n = issue2 ? posInt(issue2["number"]) : null;
38969
39024
  if (!issue2 || n === null)
@@ -39140,6 +39195,43 @@ var FLAG_REGISTRY = [
39140
39195
  flagType: "boolean",
39141
39196
  defaultValue: false
39142
39197
  },
39198
+ {
39199
+ key: "scratch-sweep-held",
39200
+ description: "ENG-11877: stops ALL scratch sweeping for an agent, including the existing tree rule, for files someone has asked to keep. Resolved per agent by the manager. Sticky on the host: once seen it is written to a marker outside scratch, which keeps the agent held until heartbeats that evaluated it find the flag off for 10 minutes, so a restart or a failed flag read cannot let a sweep through. A host only honours it once its CLI has the reader: check reach before relying on it. Off is the safe default for everyone else.",
39201
+ sensitive: true,
39202
+ flagType: "boolean",
39203
+ defaultValue: false,
39204
+ // No published agt-cli has this reader yet, and a guessed floor would report reach
39205
+ // on hosts that can't act on it. So this reads as "no host yet" on purpose, the
39206
+ // safe direction. ENG-11877 re-pins it from the published dist after merge.
39207
+ since: "0.28.999999"
39208
+ },
39209
+ {
39210
+ key: "scratch-sweep-per-file",
39211
+ description: "ENG-11877: also expire old files inside scratch folders still in use, instead of keeping a whole folder while anything in it is fresh. IRREVERSIBLE on its first pass: every file unchanged for 7 days goes, customer documents included, so arm it per agent and read scratch-sweep-dry-run first. Off = the tree rule only.",
39212
+ sensitive: true,
39213
+ // CodeRabbit on #7378: `sensitive` only forces a confirmation; it does not say
39214
+ // WHO. Its first pass irreversibly deletes old customer files, and arming it is
39215
+ // Brad's rollout decision (ENG-11877), so an org owner/admin must not be able to
39216
+ // switch it on for their own agents. Only the cross-org admin route can write it.
39217
+ platformAdminOnly: true,
39218
+ flagType: "boolean",
39219
+ defaultValue: false,
39220
+ // No published agt-cli has this reader yet, and a guessed floor would report reach
39221
+ // on hosts that can't act on it. So this reads as "no host yet" on purpose, the
39222
+ // safe direction. ENG-11877 re-pins it from the published dist after merge.
39223
+ since: "0.28.999999"
39224
+ },
39225
+ {
39226
+ key: "scratch-sweep-dry-run",
39227
+ description: "ENG-11877: count what scratch-sweep-per-file would remove and log it to manager.log every 6 hours ([scratch] [sweep-dry-run]). Metadata only: never opens a file, never logs a name, removes nothing extra.",
39228
+ flagType: "boolean",
39229
+ defaultValue: false,
39230
+ // No published agt-cli has this reader yet, and a guessed floor would report reach
39231
+ // on hosts that can't act on it. So this reads as "no host yet" on purpose, the
39232
+ // safe direction. ENG-11877 re-pins it from the published dist after merge.
39233
+ since: "0.28.999999"
39234
+ },
39143
39235
  {
39144
39236
  key: "broker-read-jobs",
39145
39237
  description: `Slow broker READ tools finish in a background job (ENG-11476, ADR-0129). When on for an org, an opted-in read tool (Pronto Xi first) that misses an 18s grace window answers "still running, call again with the same arguments" and finishes in the broker-read-job worker instead of timing out. Off = today's synchronous call, so false is the safe value. Evaluated in the API per org, team and agent.`,
@@ -39524,7 +39616,7 @@ var FLAG_REGISTRY = [
39524
39616
  },
39525
39617
  {
39526
39618
  key: "ghost-reply-narration-guard",
39527
- description: "Model-free guard on the SLACK ghost-reply RECOVERY path (CS-1821, CS-1429, ENG-7780); Telegram and Teams recovery do not run it. Recovered end-of-turn text with no second person, question, link or mention, that uses stand-down wording or names the person being answered in the third person, is not published. enforce = keep the marker so the inbound is re-delivered and the agent can answer properly. When re-deliveries run out, stand-down wording closes unposted and a name-only match publishes; with no reply owed, either closes. shadow = log only. off = never runs. A false match usually costs a re-ask; a real reply using stand-down wording every time is lost.",
39619
+ description: "Model-free guard on the ghost-reply RECOVERY path of Slack, Telegram and Teams (CS-1821, CS-1429, ENG-7780, ENG-11890). Teams has no re-delivery, so there it only closes stand-down wording. Recovered end-of-turn text with no second person, question, link or mention, that uses stand-down wording or names the person being answered in the third person, is not published. enforce = keep the marker so the inbound is re-delivered and the agent can answer properly. When re-deliveries run out, stand-down wording closes unposted and a name-only match publishes; with no reply owed, either closes. shadow = log only. off = never runs. A false match usually costs a re-ask; a real reply using stand-down wording every time is lost.",
39528
39620
  flagType: "enum",
39529
39621
  allowedValues: ["off", "shadow", "enforce"],
39530
39622
  // Ships in SHADOW: a free local log line, like every enum flag here, enforce is a