@integrity-labs/agt-cli 0.28.1243 → 0.28.1245

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 (30) hide show
  1. package/dist/bin/agt.js +6 -6
  2. package/dist/{chunk-6YZZ2WN2.js → chunk-22GBHBJZ.js} +2 -2
  3. package/dist/{chunk-4D5PTVNR.js → chunk-EGMQVUAO.js} +3 -3
  4. package/dist/{chunk-UAAR6VJI.js → chunk-OSXVD3YF.js} +37 -1
  5. package/dist/{chunk-UAAR6VJI.js.map → chunk-OSXVD3YF.js.map} +1 -1
  6. package/dist/{chunk-ZOFEQZJM.js → chunk-RVZDFWIX.js} +5 -5
  7. package/dist/{chunk-AB47AXD6.js → chunk-V47ZQJ3Y.js} +2 -2
  8. package/dist/{claude-code-updater-2QU66VPT.js → claude-code-updater-6QVV5JHB.js} +3 -3
  9. package/dist/{claude-pair-runtime-DR7HRJNI.js → claude-pair-runtime-EBDJ7JJV.js} +3 -3
  10. package/dist/lib/manager-worker.js +19 -19
  11. package/dist/mcp/direct-chat-channel.js +113 -62
  12. package/dist/mcp/index.js +35 -3
  13. package/dist/mcp/origami.js +32 -0
  14. package/dist/mcp/slack-channel.js +38 -3
  15. package/dist/mcp/teams-channel.js +6 -3
  16. package/dist/mcp/telegram-channel.js +38 -3
  17. package/dist/mcp/whatsapp-channel.js +6 -3
  18. package/dist/{persistent-session-YJSZWSLQ.js → persistent-session-4HI235XH.js} +4 -4
  19. package/dist/{responsiveness-probe-SPEEY2LI.js → responsiveness-probe-AD6WIPDA.js} +4 -4
  20. package/dist/{session-auth-dead-TODAGWTJ.js → session-auth-dead-6FSKTBLA.js} +3 -3
  21. package/package.json +1 -1
  22. /package/dist/{chunk-6YZZ2WN2.js.map → chunk-22GBHBJZ.js.map} +0 -0
  23. /package/dist/{chunk-4D5PTVNR.js.map → chunk-EGMQVUAO.js.map} +0 -0
  24. /package/dist/{chunk-ZOFEQZJM.js.map → chunk-RVZDFWIX.js.map} +0 -0
  25. /package/dist/{chunk-AB47AXD6.js.map → chunk-V47ZQJ3Y.js.map} +0 -0
  26. /package/dist/{claude-code-updater-2QU66VPT.js.map → claude-code-updater-6QVV5JHB.js.map} +0 -0
  27. /package/dist/{claude-pair-runtime-DR7HRJNI.js.map → claude-pair-runtime-EBDJ7JJV.js.map} +0 -0
  28. /package/dist/{persistent-session-YJSZWSLQ.js.map → persistent-session-4HI235XH.js.map} +0 -0
  29. /package/dist/{responsiveness-probe-SPEEY2LI.js.map → responsiveness-probe-AD6WIPDA.js.map} +0 -0
  30. /package/dist/{session-auth-dead-TODAGWTJ.js.map → session-auth-dead-6FSKTBLA.js.map} +0 -0
@@ -18,11 +18,11 @@ import {
18
18
  requiresRemoteMcpToolGate,
19
19
  shellQuote,
20
20
  withheldRemoteMcpMessage
21
- } from "./chunk-4D5PTVNR.js";
21
+ } from "./chunk-EGMQVUAO.js";
22
22
  import {
23
23
  readDailySessionPin,
24
24
  sessionTranscriptDir
25
- } from "./chunk-AB47AXD6.js";
25
+ } from "./chunk-V47ZQJ3Y.js";
26
26
  import {
27
27
  classifyUnanswerablePane,
28
28
  isConsumerTermsDialogVisible,
@@ -95,7 +95,7 @@ import {
95
95
  scanConfigForLiteralSecrets,
96
96
  worseConnectivityOutcome,
97
97
  wrapScheduledTaskPrompt
98
- } from "./chunk-UAAR6VJI.js";
98
+ } from "./chunk-OSXVD3YF.js";
99
99
  import {
100
100
  claudeJsonPathFor,
101
101
  effectiveClaudeJsonPath,
@@ -8095,7 +8095,7 @@ function exchangeFailureKind(err) {
8095
8095
  }
8096
8096
 
8097
8097
  // src/lib/api-client.ts
8098
- var agtCliVersion = true ? "0.28.1243" : "dev";
8098
+ var agtCliVersion = true ? "0.28.1245" : "dev";
8099
8099
  var lastConfigHash = null;
8100
8100
  function setConfigHash(hash) {
8101
8101
  lastConfigHash = hash && hash.length > 0 ? hash : null;
@@ -13750,4 +13750,4 @@ export {
13750
13750
  managerInstallSystemUnitCommand,
13751
13751
  managerUninstallSystemUnitCommand
13752
13752
  };
13753
- //# sourceMappingURL=chunk-ZOFEQZJM.js.map
13753
+ //# sourceMappingURL=chunk-RVZDFWIX.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  encodeClaudeProjectPath
3
- } from "./chunk-UAAR6VJI.js";
3
+ } from "./chunk-OSXVD3YF.js";
4
4
 
5
5
  // src/lib/daily-session.ts
6
6
  import { randomUUID } from "crypto";
@@ -244,4 +244,4 @@ export {
244
244
  peekPreviousSession,
245
245
  readDailySessionPin
246
246
  };
247
- //# sourceMappingURL=chunk-AB47AXD6.js.map
247
+ //# sourceMappingURL=chunk-V47ZQJ3Y.js.map
@@ -13,9 +13,9 @@ import {
13
13
  probeClaudeInstalls,
14
14
  readsAsNativeInstall,
15
15
  shouldRunClaudeCodeUpdater
16
- } from "./chunk-6YZZ2WN2.js";
16
+ } from "./chunk-22GBHBJZ.js";
17
17
  import "./chunk-XWVM4KPK.js";
18
- import "./chunk-UAAR6VJI.js";
18
+ import "./chunk-OSXVD3YF.js";
19
19
  import "./chunk-AIUIMEUS.js";
20
20
  import "./chunk-DGUM43GV.js";
21
21
  export {
@@ -34,4 +34,4 @@ export {
34
34
  readsAsNativeInstall,
35
35
  shouldRunClaudeCodeUpdater
36
36
  };
37
- //# sourceMappingURL=claude-code-updater-2QU66VPT.js.map
37
+ //# sourceMappingURL=claude-code-updater-6QVV5JHB.js.map
@@ -8,7 +8,7 @@ import {
8
8
  import {
9
9
  redactPaneFrame,
10
10
  sanitizeTerminalFrame
11
- } from "./chunk-UAAR6VJI.js";
11
+ } from "./chunk-OSXVD3YF.js";
12
12
  import {
13
13
  CLAUDE_CONFIG_DIR_ENV,
14
14
  claudeConfigDirFor,
@@ -321,7 +321,7 @@ async function spawnPairSession(session) {
321
321
  return { ok: true };
322
322
  } catch {
323
323
  }
324
- const { resolveClaudeBinary } = await import("./persistent-session-YJSZWSLQ.js");
324
+ const { resolveClaudeBinary } = await import("./persistent-session-4HI235XH.js");
325
325
  const claudeBin = resolveClaudeBinary();
326
326
  const pairEnv = {
327
327
  ...process.env,
@@ -836,4 +836,4 @@ export {
836
836
  startClaudePair,
837
837
  submitClaudePairCode
838
838
  };
839
- //# sourceMappingURL=claude-pair-runtime-DR7HRJNI.js.map
839
+ //# sourceMappingURL=claude-pair-runtime-EBDJ7JJV.js.map
@@ -85,7 +85,7 @@ import {
85
85
  tripClass,
86
86
  writeEtcEnvironment,
87
87
  writeProfileDScript
88
- } from "../chunk-ZOFEQZJM.js";
88
+ } from "../chunk-RVZDFWIX.js";
89
89
  import {
90
90
  CLAUDE_CODE_SECURITY_FLOOR,
91
91
  SELF_UPDATE_TIMEOUTS,
@@ -99,7 +99,7 @@ import {
99
99
  runSafeCleanup,
100
100
  tightestDiskStat,
101
101
  withPackageCacheLock
102
- } from "../chunk-6YZZ2WN2.js";
102
+ } from "../chunk-22GBHBJZ.js";
103
103
  import {
104
104
  rewriteSupervisorApiKey,
105
105
  supervisorChannelsRefusing
@@ -195,7 +195,7 @@ import {
195
195
  webFetchBaselineValue,
196
196
  webFetchRestartNeeded,
197
197
  writeEgressAllowlist
198
- } from "../chunk-4D5PTVNR.js";
198
+ } from "../chunk-EGMQVUAO.js";
199
199
  import {
200
200
  isAgentIdle,
201
201
  isStaleForToday,
@@ -206,7 +206,7 @@ import {
206
206
  subagentActivityAgeSeconds,
207
207
  subagentTranscriptDir,
208
208
  transcriptActivityAgeSeconds
209
- } from "../chunk-AB47AXD6.js";
209
+ } from "../chunk-V47ZQJ3Y.js";
210
210
  import {
211
211
  classifyUnanswerablePane,
212
212
  focusedConfirmDialogBlock,
@@ -337,7 +337,7 @@ import {
337
337
  stabiliseResetInstant,
338
338
  sumTranscriptUsageInWindow,
339
339
  summarizeTranscriptActivity
340
- } from "../chunk-UAAR6VJI.js";
340
+ } from "../chunk-OSXVD3YF.js";
341
341
  import {
342
342
  CLAUDE_CONFIG_DIR_ENV,
343
343
  claudeConfigDirFor,
@@ -15871,7 +15871,7 @@ var pendingDayRolloverReset = /* @__PURE__ */ new Set();
15871
15871
  var dayRolloverInboundHold = /* @__PURE__ */ new Map();
15872
15872
  var INBOUND_HOLD_EPISODE_GAP_MS = 12e4;
15873
15873
  async function channelInboundActivityAgeSecondsFor(codeName) {
15874
- const { newestPendingInboundActivityMtimeMs } = await import("../responsiveness-probe-SPEEY2LI.js");
15874
+ const { newestPendingInboundActivityMtimeMs } = await import("../responsiveness-probe-AD6WIPDA.js");
15875
15875
  const newest = newestPendingInboundActivityMtimeMs(dirname11(paneLogPath(codeName)));
15876
15876
  if (newest === null) return null;
15877
15877
  return Math.max(0, Math.floor((Date.now() - newest) / 1e3));
@@ -16686,7 +16686,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
16686
16686
  var lastVersionCheckAt = 0;
16687
16687
  var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
16688
16688
  var lastResponsivenessProbeAt = 0;
16689
- var agtCliVersion = true ? "0.28.1243" : "dev";
16689
+ var agtCliVersion = true ? "0.28.1245" : "dev";
16690
16690
  function resolveBrewPath(execFileSync3) {
16691
16691
  try {
16692
16692
  const out = execFileSync3("which", ["brew"], { timeout: 5e3 }).toString().trim();
@@ -18683,7 +18683,7 @@ function flushRestartedAgentDiagnostics(hostId, codeNames) {
18683
18683
  if (codeNames.length === 0) return;
18684
18684
  void (async () => {
18685
18685
  try {
18686
- const { collectDiagnostics } = await import("../persistent-session-YJSZWSLQ.js");
18686
+ const { collectDiagnostics } = await import("../persistent-session-4HI235XH.js");
18687
18687
  await api.post("/host/heartbeat", {
18688
18688
  host_id: hostId,
18689
18689
  agent_diagnostics: collectDiagnostics(codeNames, quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor, runtimeVersionFor, sessionActivityFor)
@@ -18826,7 +18826,7 @@ async function pollCycleInner() {
18826
18826
  }
18827
18827
  try {
18828
18828
  const { detectHostSecurity } = await import("../host-security-KQYYZZVW.js");
18829
- const { collectDiagnostics } = await import("../persistent-session-YJSZWSLQ.js");
18829
+ const { collectDiagnostics } = await import("../persistent-session-4HI235XH.js");
18830
18830
  const diagCodeNames = [...agentState.persistentSessionAgents];
18831
18831
  const agentDiagnostics = diagCodeNames.length > 0 ? collectDiagnostics(diagCodeNames, quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor, runtimeVersionFor, sessionActivityFor) : void 0;
18832
18832
  let tailscaleHostname;
@@ -19091,7 +19091,7 @@ async function pollCycleInner() {
19091
19091
  }
19092
19092
  try {
19093
19093
  const desiredClaudeCodeVersion = hbResp?.desired_claude_code_version?.trim();
19094
- const { maybeUpdateClaudeCode, shouldRunClaudeCodeUpdater } = await import("../claude-code-updater-2QU66VPT.js");
19094
+ const { maybeUpdateClaudeCode, shouldRunClaudeCodeUpdater } = await import("../claude-code-updater-6QVV5JHB.js");
19095
19095
  const securityFloor = currentSecurityFloor();
19096
19096
  claudeUpdaterInFlight = true;
19097
19097
  if (desiredClaudeCodeVersion && (claudePairLoop.busy || claudePairingInProgress())) {
@@ -19126,7 +19126,7 @@ async function pollCycleInner() {
19126
19126
  collectPanelessActivityProbes,
19127
19127
  getResponsivenessIntervalMs,
19128
19128
  occupancyQualificationClassifications
19129
- } = await import("../responsiveness-probe-SPEEY2LI.js");
19129
+ } = await import("../responsiveness-probe-AD6WIPDA.js");
19130
19130
  const probeIntervalMs = getResponsivenessIntervalMs();
19131
19131
  if (now - lastResponsivenessProbeAt > probeIntervalMs) {
19132
19132
  const probeCodeNames = [...agentState.persistentSessionAgents];
@@ -19243,7 +19243,7 @@ async function pollCycleInner() {
19243
19243
  collectResponsivenessProbes,
19244
19244
  livePendingInboundOldestAgeSeconds,
19245
19245
  parkPendingInbound
19246
- } = await import("../responsiveness-probe-SPEEY2LI.js");
19246
+ } = await import("../responsiveness-probe-AD6WIPDA.js");
19247
19247
  const { getProjectDir: wedgeProjectDir } = await import("../scheduler-engine-5PCBGRNY.js");
19248
19248
  const wedgeNow = /* @__PURE__ */ new Date();
19249
19249
  const liveAgents = agentState.persistentSessionAgents;
@@ -19529,7 +19529,7 @@ async function pollCycleInner() {
19529
19529
  }
19530
19530
  }
19531
19531
  );
19532
- const { parkPendingInbound } = await import("../responsiveness-probe-SPEEY2LI.js");
19532
+ const { parkPendingInbound } = await import("../responsiveness-probe-AD6WIPDA.js");
19533
19533
  const { parked, deadLettered } = parkPendingInbound(codeName, new Date(fatalNowMs));
19534
19534
  paneFatalStreak.delete(codeName);
19535
19535
  paneFatalRestarts.set(codeName, [...history, fatalNowMs]);
@@ -19560,7 +19560,7 @@ async function pollCycleInner() {
19560
19560
  TRANSCRIPT_MOUNT_ESCALATION_REFRESH_MS,
19561
19561
  bindSourceEscalations
19562
19562
  } = await import("../transcript-mount-health-OHE6IVJV.js");
19563
- const { transcriptBindSourcesFor, ensureTranscriptBindSources } = await import("../persistent-session-YJSZWSLQ.js");
19563
+ const { transcriptBindSourcesFor, ensureTranscriptBindSources } = await import("../persistent-session-4HI235XH.js");
19564
19564
  const mountConfig = resolveTranscriptMountConfig();
19565
19565
  const liveAgents = agentState.persistentSessionAgents;
19566
19566
  for (const tracked of [
@@ -19725,7 +19725,7 @@ async function pollCycleInner() {
19725
19725
  }
19726
19726
  try {
19727
19727
  const { scrapeMcpFailedBannerCount } = await import("../pane-mcp-banner-scraper-VR5QGP3J.js");
19728
- const { probeSessionAuth } = await import("../session-auth-dead-TODAGWTJ.js");
19728
+ const { probeSessionAuth } = await import("../session-auth-dead-6FSKTBLA.js");
19729
19729
  const observations = [];
19730
19730
  const pendingCacheCommits = [];
19731
19731
  const modelApiErrorReportingOn = hostFlagStore().getBoolean("model-api-error-reporting");
@@ -24479,7 +24479,7 @@ async function handleRestartDoorbell(agentId, requestedAt, restartReason) {
24479
24479
  try {
24480
24480
  const freshId = rotateSessionForWedge(codeName);
24481
24481
  consecutiveWedgeCycles.delete(codeName);
24482
- const { parkPendingInbound: parkForRestart } = await import("../responsiveness-probe-SPEEY2LI.js");
24482
+ const { parkPendingInbound: parkForRestart } = await import("../responsiveness-probe-AD6WIPDA.js");
24483
24483
  const { parked, deadLettered } = parkForRestart(codeName, /* @__PURE__ */ new Date());
24484
24484
  const parkNote = parked > 0 ? `, ${parked} inbound parked` : "";
24485
24485
  const deadNote = deadLettered > 0 ? `, ${deadLettered} undeliverable dead-lettered` : "";
@@ -24522,7 +24522,7 @@ async function handleRestartDoorbell(agentId, requestedAt, restartReason) {
24522
24522
  void api.post("/host/restart-ack", { host_id: hostId, agent_id: agentId, restart_requested_at: requestedAt }).catch((err) => log(`[restart-lane] ack failed for '${codeName}': ${err.message}`));
24523
24523
  void (async () => {
24524
24524
  try {
24525
- const { collectDiagnostics } = await import("../persistent-session-YJSZWSLQ.js");
24525
+ const { collectDiagnostics } = await import("../persistent-session-4HI235XH.js");
24526
24526
  await api.post("/host/heartbeat", {
24527
24527
  host_id: hostId,
24528
24528
  agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor, runtimeVersionFor, sessionActivityFor)
@@ -24573,7 +24573,7 @@ async function respawnAgentAfterMcpStop(codeName, reason) {
24573
24573
  }
24574
24574
  try {
24575
24575
  const hostId = await getHostId();
24576
- const { collectDiagnostics } = await import("../persistent-session-YJSZWSLQ.js");
24576
+ const { collectDiagnostics } = await import("../persistent-session-4HI235XH.js");
24577
24577
  await api.post("/host/heartbeat", {
24578
24578
  host_id: hostId,
24579
24579
  agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor, runtimeVersionFor, sessionActivityFor)
@@ -25275,7 +25275,7 @@ async function processClaudePairSessions(agents) {
25275
25275
  snapshotPairConfig,
25276
25276
  // ENG-11659: result -> report body + the manager.log line that records it.
25277
25277
  planPairStartReport
25278
- } = await import("../claude-pair-runtime-DR7HRJNI.js");
25278
+ } = await import("../claude-pair-runtime-EBDJ7JJV.js");
25279
25279
  const { resetClaudeSignin, describeSigninResetForLog, describeSigninResetFailure } = await import("../claude-signin-reset-6IJMMVYG.js");
25280
25280
  for (const pairId of pendingResp.cancelled_pair_ids ?? []) {
25281
25281
  log(`[claude-pair] sweeping orphan tmux session for pair ${pairId.slice(0, 8)}`);
@@ -37436,6 +37436,38 @@ var integration_metadata_v1_default = {
37436
37436
  type: "string",
37437
37437
  enum: ["required", "optional"],
37438
37438
  description: "ADR 0010 \u2014 per-tool credential expectation. `required` (default) makes the broker fail closed when no install credential is attached; `optional` lets the broker call the vendor without an `Authorization` header (used by keyless integrations such as Augmented Live)."
37439
+ },
37440
+ approval_snapshot: {
37441
+ type: "object",
37442
+ additionalProperties: false,
37443
+ required: ["http", "resource_label"],
37444
+ description: "CS-2460: for a held tool, the GET that reads the resource it acts on. Read when the approval is requested (and shown on the card), and again before the approved call runs; a difference, or a failed read, refuses the call. `http` is templated with the tool's own args.",
37445
+ properties: {
37446
+ http: {
37447
+ type: "object",
37448
+ additionalProperties: false,
37449
+ required: ["method", "path_template"],
37450
+ properties: {
37451
+ method: { const: "GET" },
37452
+ path_template: { type: "string", minLength: 1 },
37453
+ headers_template: {
37454
+ type: "object",
37455
+ propertyNames: { pattern: "^[A-Za-z0-9!#$%&'*+.^_`|~-]+$" },
37456
+ additionalProperties: { type: "string" }
37457
+ }
37458
+ }
37459
+ },
37460
+ resource_label: {
37461
+ type: "string",
37462
+ minLength: 1,
37463
+ description: "What the resource is called to a person (e.g. `campaign`), for the card and the refusal message."
37464
+ },
37465
+ ignore_keys: {
37466
+ type: "array",
37467
+ items: { type: "string", minLength: 1 },
37468
+ description: "Keys removed from the snapshot before hashing, matched by name at any depth (timestamps, statistics)."
37469
+ }
37470
+ }
37439
37471
  }
37440
37472
  }
37441
37473
  }
@@ -47586,14 +47618,58 @@ function buildDirectChatChannelMeta(input) {
47586
47618
  };
47587
47619
  }
47588
47620
 
47621
+ // src/turn-context.ts
47622
+ import { mkdirSync as mkdirSync3, readFileSync as readFileSync5 } from "fs";
47623
+ import { homedir } from "os";
47624
+ import { dirname as dirname3, join as join6 } from "path";
47625
+
47626
+ // ../core/dist/provisioning/frameworks/claudecode/agent-dir-alias.js
47627
+ import { isAbsolute, join as join3, relative, sep } from "path";
47628
+ var VALID_CODE_NAME = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
47629
+ var VALID_AGENT_ID = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/;
47630
+ var INITIATOR_BASENAME = ".current-turn-initiator.json";
47631
+ function isSafeAgentSegment(segment) {
47632
+ return VALID_CODE_NAME.test(segment) || VALID_AGENT_ID.test(segment);
47633
+ }
47634
+ function initiatorDirSegment(initiatorFile, homeDir) {
47635
+ const rel = relative(join3(homeDir, ".augmented"), initiatorFile);
47636
+ if (!rel || isAbsolute(rel))
47637
+ return null;
47638
+ const parts = rel.split(sep);
47639
+ if (parts.length !== 2 || parts[1] !== INITIATOR_BASENAME)
47640
+ return null;
47641
+ const segment = parts[0];
47642
+ if (segment === void 0)
47643
+ return null;
47644
+ return isSafeAgentSegment(segment) ? segment : null;
47645
+ }
47646
+ function resolveAgentDirAlias(input) {
47647
+ const { codeName, turnInitiatorFile, agentId, homeDir } = input;
47648
+ const codeNameTrimmed = typeof codeName === "string" ? codeName.trim() : "";
47649
+ if (codeNameTrimmed && VALID_CODE_NAME.test(codeNameTrimmed)) {
47650
+ return join3(homeDir, ".augmented", codeNameTrimmed);
47651
+ }
47652
+ const initiator = typeof turnInitiatorFile === "string" ? turnInitiatorFile.trim() : "";
47653
+ if (initiator) {
47654
+ const segment = initiatorDirSegment(initiator, homeDir);
47655
+ if (segment)
47656
+ return join3(homeDir, ".augmented", segment);
47657
+ }
47658
+ const agentIdTrimmed = typeof agentId === "string" ? agentId.trim() : "";
47659
+ if (agentIdTrimmed && VALID_AGENT_ID.test(agentIdTrimmed)) {
47660
+ return join3(homeDir, ".augmented", agentIdTrimmed);
47661
+ }
47662
+ return null;
47663
+ }
47664
+
47589
47665
  // src/turn-initiator-marker.ts
47590
47666
  import { writeFileSync as writeFileSync2, readFileSync as readFileSync3, mkdirSync as mkdirSync2, renameSync as renameSync2 } from "fs";
47591
- import { dirname as dirname2, join as join3 } from "path";
47667
+ import { dirname as dirname2, join as join4 } from "path";
47592
47668
  var TURN_INITIATOR_MAX_AGE_MS = 5 * 60 * 1e3;
47593
47669
  var TURN_INITIATOR_LEDGER_MAX_ENTRIES = 20;
47594
47670
  var TURN_INITIATOR_LEDGER_FILENAME = ".turn-initiator-ledger.json";
47595
47671
  function turnInitiatorLedgerPath(singleSlotFile) {
47596
- return join3(dirname2(singleSlotFile), TURN_INITIATOR_LEDGER_FILENAME);
47672
+ return join4(dirname2(singleSlotFile), TURN_INITIATOR_LEDGER_FILENAME);
47597
47673
  }
47598
47674
  function foldTurnInitiatorLedger(existing, marker, maxAgeMs = TURN_INITIATOR_MAX_AGE_MS, maxEntries = TURN_INITIATOR_LEDGER_MAX_ENTRIES) {
47599
47675
  const now = marker.ts;
@@ -47612,6 +47688,7 @@ function foldTurnInitiatorLedger(existing, marker, maxAgeMs = TURN_INITIATOR_MAX
47612
47688
  ...marker.chat_kind ? { chat_kind: marker.chat_kind } : {},
47613
47689
  ...marker.chat_id ? { chat_id: marker.chat_id } : {},
47614
47690
  ...marker.unattributed ? { unattributed: true } : {},
47691
+ ...marker.notice ? { notice: true } : {},
47615
47692
  ...marker.loop_tick ? { loop_tick: true } : {},
47616
47693
  ts: marker.ts
47617
47694
  });
@@ -47648,50 +47725,6 @@ function writeTurnInitiatorMarker(input) {
47648
47725
  }
47649
47726
  }
47650
47727
 
47651
- // src/turn-context.ts
47652
- import { mkdirSync as mkdirSync3, readFileSync as readFileSync5 } from "fs";
47653
- import { homedir } from "os";
47654
- import { dirname as dirname3, join as join6 } from "path";
47655
-
47656
- // ../core/dist/provisioning/frameworks/claudecode/agent-dir-alias.js
47657
- import { isAbsolute, join as join4, relative, sep } from "path";
47658
- var VALID_CODE_NAME = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
47659
- var VALID_AGENT_ID = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/;
47660
- var INITIATOR_BASENAME = ".current-turn-initiator.json";
47661
- function isSafeAgentSegment(segment) {
47662
- return VALID_CODE_NAME.test(segment) || VALID_AGENT_ID.test(segment);
47663
- }
47664
- function initiatorDirSegment(initiatorFile, homeDir) {
47665
- const rel = relative(join4(homeDir, ".augmented"), initiatorFile);
47666
- if (!rel || isAbsolute(rel))
47667
- return null;
47668
- const parts = rel.split(sep);
47669
- if (parts.length !== 2 || parts[1] !== INITIATOR_BASENAME)
47670
- return null;
47671
- const segment = parts[0];
47672
- if (segment === void 0)
47673
- return null;
47674
- return isSafeAgentSegment(segment) ? segment : null;
47675
- }
47676
- function resolveAgentDirAlias(input) {
47677
- const { codeName, turnInitiatorFile, agentId, homeDir } = input;
47678
- const codeNameTrimmed = typeof codeName === "string" ? codeName.trim() : "";
47679
- if (codeNameTrimmed && VALID_CODE_NAME.test(codeNameTrimmed)) {
47680
- return join4(homeDir, ".augmented", codeNameTrimmed);
47681
- }
47682
- const initiator = typeof turnInitiatorFile === "string" ? turnInitiatorFile.trim() : "";
47683
- if (initiator) {
47684
- const segment = initiatorDirSegment(initiator, homeDir);
47685
- if (segment)
47686
- return join4(homeDir, ".augmented", segment);
47687
- }
47688
- const agentIdTrimmed = typeof agentId === "string" ? agentId.trim() : "";
47689
- if (agentIdTrimmed && VALID_AGENT_ID.test(agentIdTrimmed)) {
47690
- return join4(homeDir, ".augmented", agentIdTrimmed);
47691
- }
47692
- return null;
47693
- }
47694
-
47695
47728
  // src/scheduled-turn-marker.ts
47696
47729
  import { readFileSync as readFileSync4, unlinkSync } from "fs";
47697
47730
  import { join as join5 } from "path";
@@ -47715,11 +47748,13 @@ function writeUnattributedTurnMarker(channel, opts = {}) {
47715
47748
  updateTurnInitiatorLedger(file, {
47716
47749
  channel,
47717
47750
  sender_id: "",
47718
- // ENG-11979: its own ledger key. The ledger keeps one entry per (channel, ref),
47719
- // so a tick sharing a key would overwrite a stricter unattributed notice.
47720
- channel_ref: opts.loopTick ? "loop-tick" : "unattributed",
47751
+ // ENG-11979 / ENG-11553: each kind gets its own ledger key. The ledger keeps one
47752
+ // entry per (channel, ref), so a tick or a notice sharing the plain key would
47753
+ // overwrite a stricter unattributed entry that blocks regardless of order.
47754
+ channel_ref: opts.loopTick ? "loop-tick" : opts.notice ? "unattributed-notice" : "unattributed",
47721
47755
  unattributed: true,
47722
47756
  ...opts.loopTick ? { loop_tick: true } : {},
47757
+ ...opts.notice ? { notice: true } : {},
47723
47758
  ts: opts.now ?? Date.now()
47724
47759
  });
47725
47760
  } catch {
@@ -47737,6 +47772,34 @@ function resolveTurnInitiatorFile(env2 = process.env, home = homedir()) {
47737
47772
  return dir ? join6(dir, TURN_INITIATOR_MARKER_FILENAME) : null;
47738
47773
  }
47739
47774
 
47775
+ // src/direct-chat-turn-marker.ts
47776
+ var FYI_NOTICE_PAYLOAD_KINDS = /* @__PURE__ */ new Set([]);
47777
+ function classifyDirectChatNotice(payload, fyiKinds = FYI_NOTICE_PAYLOAD_KINDS) {
47778
+ if (isKanbanCheckPayload(payload)) return "loop_tick";
47779
+ const kind = typeof payload === "object" && payload !== null ? payload.kind : void 0;
47780
+ return typeof kind === "string" && fyiKinds.has(kind) ? "fyi" : "blocking";
47781
+ }
47782
+ function writeDirectChatTurnMarker(msg) {
47783
+ const isNotice = msg.kind === "notice";
47784
+ if (!isNotice && msg.sender_id) {
47785
+ writeTurnInitiatorMarker({
47786
+ channel: "direct-chat",
47787
+ sender_id: msg.sender_id,
47788
+ channel_ref: msg.session_id,
47789
+ // ENG-11348: one sender per session from this side. Whether the TRANSCRIPT is
47790
+ // private (only for a manager-only agent) is decided server-side, so 'direct'
47791
+ // here is not the last word.
47792
+ chat_kind: "direct"
47793
+ });
47794
+ } else {
47795
+ const kind = isNotice ? classifyDirectChatNotice(msg.payload) : "blocking";
47796
+ writeUnattributedTurnMarker(
47797
+ "direct-chat",
47798
+ kind === "loop_tick" ? { loopTick: true } : { notice: kind === "fyi" }
47799
+ );
47800
+ }
47801
+ }
47802
+
47740
47803
  // src/direct-chat-pending-inbound.ts
47741
47804
  import {
47742
47805
  existsSync as existsSync2,
@@ -56487,19 +56550,7 @@ async function pollForMessages(sinceMs) {
56487
56550
  );
56488
56551
  scheduleDirectChatBusyAck(msg.session_id, msg.id, arrivedWhileBusy);
56489
56552
  }
56490
- if (!isNotice && msg.sender_id) {
56491
- writeTurnInitiatorMarker({
56492
- channel: "direct-chat",
56493
- sender_id: msg.sender_id,
56494
- channel_ref: msg.session_id,
56495
- // ENG-11348: one sender per session from this side. Whether the
56496
- // TRANSCRIPT is private (only for a manager-only agent) is decided
56497
- // server-side, so 'direct' here is not the last word.
56498
- chat_kind: "direct"
56499
- });
56500
- } else {
56501
- writeUnattributedTurnMarker("direct-chat", { loopTick: isNotice && isKanbanCheckPayload(msg.payload) });
56502
- }
56553
+ writeDirectChatTurnMarker(msg);
56503
56554
  if (isNotice) {
56504
56555
  try {
56505
56556
  const res2 = await apiPost("/host/direct-chat/consume", {
package/dist/mcp/index.js CHANGED
@@ -23494,6 +23494,38 @@ var integration_metadata_v1_default = {
23494
23494
  type: "string",
23495
23495
  enum: ["required", "optional"],
23496
23496
  description: "ADR 0010 \u2014 per-tool credential expectation. `required` (default) makes the broker fail closed when no install credential is attached; `optional` lets the broker call the vendor without an `Authorization` header (used by keyless integrations such as Augmented Live)."
23497
+ },
23498
+ approval_snapshot: {
23499
+ type: "object",
23500
+ additionalProperties: false,
23501
+ required: ["http", "resource_label"],
23502
+ description: "CS-2460: for a held tool, the GET that reads the resource it acts on. Read when the approval is requested (and shown on the card), and again before the approved call runs; a difference, or a failed read, refuses the call. `http` is templated with the tool's own args.",
23503
+ properties: {
23504
+ http: {
23505
+ type: "object",
23506
+ additionalProperties: false,
23507
+ required: ["method", "path_template"],
23508
+ properties: {
23509
+ method: { const: "GET" },
23510
+ path_template: { type: "string", minLength: 1 },
23511
+ headers_template: {
23512
+ type: "object",
23513
+ propertyNames: { pattern: "^[A-Za-z0-9!#$%&'*+.^_`|~-]+$" },
23514
+ additionalProperties: { type: "string" }
23515
+ }
23516
+ }
23517
+ },
23518
+ resource_label: {
23519
+ type: "string",
23520
+ minLength: 1,
23521
+ description: "What the resource is called to a person (e.g. `campaign`), for the card and the refusal message."
23522
+ },
23523
+ ignore_keys: {
23524
+ type: "array",
23525
+ items: { type: "string", minLength: 1 },
23526
+ description: "Keys removed from the snapshot before hashing, matched by name at any depth (timestamps, statistics)."
23527
+ }
23528
+ }
23497
23529
  }
23498
23530
  }
23499
23531
  }
@@ -37680,7 +37712,8 @@ function freshUnattributed(ledger, now, maxAgeMs, newestSenderTs) {
37680
37712
  if (!ledger || !Array.isArray(ledger.entries)) return false;
37681
37713
  return ledger.entries.some((e) => {
37682
37714
  const r = e;
37683
- if (r?.loop_tick === true && typeof r.ts === "number" && r.ts < newestSenderTs) return false;
37715
+ const olderPass = r?.loop_tick === true || r?.notice === true;
37716
+ if (olderPass && typeof r.ts === "number" && r.ts < newestSenderTs) return false;
37684
37717
  return r?.unattributed === true && typeof r.ts === "number" && Number.isFinite(r.ts) && now - r.ts >= 0 && now - r.ts <= maxAgeMs;
37685
37718
  });
37686
37719
  }
@@ -37722,9 +37755,8 @@ function readTurnContextUnguarded(opts) {
37722
37755
  now
37723
37756
  );
37724
37757
  if (senders.length === 0) return { v: 1, kind: "none" };
37725
- const newestSenderTs = Math.max(...senders.map((s) => s.ts));
37726
- if (scheduled || freshUnattributed(ledger, now, maxAgeMs, newestSenderTs)) return { v: 1, kind: "ambiguous" };
37727
37758
  const latest = [...senders].sort((a, b) => b.ts - a.ts)[0];
37759
+ if (scheduled || freshUnattributed(ledger, now, maxAgeMs, latest.ts)) return { v: 1, kind: "ambiguous" };
37728
37760
  const same = senders.every(
37729
37761
  (s) => s.channel === latest.channel && s.sender_id === latest.sender_id && s.chat_kind === latest.chat_kind && s.chat_id === latest.chat_id
37730
37762
  );
@@ -37359,6 +37359,38 @@ var integration_metadata_v1_default = {
37359
37359
  type: "string",
37360
37360
  enum: ["required", "optional"],
37361
37361
  description: "ADR 0010 \u2014 per-tool credential expectation. `required` (default) makes the broker fail closed when no install credential is attached; `optional` lets the broker call the vendor without an `Authorization` header (used by keyless integrations such as Augmented Live)."
37362
+ },
37363
+ approval_snapshot: {
37364
+ type: "object",
37365
+ additionalProperties: false,
37366
+ required: ["http", "resource_label"],
37367
+ description: "CS-2460: for a held tool, the GET that reads the resource it acts on. Read when the approval is requested (and shown on the card), and again before the approved call runs; a difference, or a failed read, refuses the call. `http` is templated with the tool's own args.",
37368
+ properties: {
37369
+ http: {
37370
+ type: "object",
37371
+ additionalProperties: false,
37372
+ required: ["method", "path_template"],
37373
+ properties: {
37374
+ method: { const: "GET" },
37375
+ path_template: { type: "string", minLength: 1 },
37376
+ headers_template: {
37377
+ type: "object",
37378
+ propertyNames: { pattern: "^[A-Za-z0-9!#$%&'*+.^_`|~-]+$" },
37379
+ additionalProperties: { type: "string" }
37380
+ }
37381
+ }
37382
+ },
37383
+ resource_label: {
37384
+ type: "string",
37385
+ minLength: 1,
37386
+ description: "What the resource is called to a person (e.g. `campaign`), for the card and the refusal message."
37387
+ },
37388
+ ignore_keys: {
37389
+ type: "array",
37390
+ items: { type: "string", minLength: 1 },
37391
+ description: "Keys removed from the snapshot before hashing, matched by name at any depth (timestamps, statistics)."
37392
+ }
37393
+ }
37362
37394
  }
37363
37395
  }
37364
37396
  }
@@ -32055,6 +32055,38 @@ var integration_metadata_v1_default = {
32055
32055
  type: "string",
32056
32056
  enum: ["required", "optional"],
32057
32057
  description: "ADR 0010 \u2014 per-tool credential expectation. `required` (default) makes the broker fail closed when no install credential is attached; `optional` lets the broker call the vendor without an `Authorization` header (used by keyless integrations such as Augmented Live)."
32058
+ },
32059
+ approval_snapshot: {
32060
+ type: "object",
32061
+ additionalProperties: false,
32062
+ required: ["http", "resource_label"],
32063
+ description: "CS-2460: for a held tool, the GET that reads the resource it acts on. Read when the approval is requested (and shown on the card), and again before the approved call runs; a difference, or a failed read, refuses the call. `http` is templated with the tool's own args.",
32064
+ properties: {
32065
+ http: {
32066
+ type: "object",
32067
+ additionalProperties: false,
32068
+ required: ["method", "path_template"],
32069
+ properties: {
32070
+ method: { const: "GET" },
32071
+ path_template: { type: "string", minLength: 1 },
32072
+ headers_template: {
32073
+ type: "object",
32074
+ propertyNames: { pattern: "^[A-Za-z0-9!#$%&'*+.^_`|~-]+$" },
32075
+ additionalProperties: { type: "string" }
32076
+ }
32077
+ }
32078
+ },
32079
+ resource_label: {
32080
+ type: "string",
32081
+ minLength: 1,
32082
+ description: "What the resource is called to a person (e.g. `campaign`), for the card and the refusal message."
32083
+ },
32084
+ ignore_keys: {
32085
+ type: "array",
32086
+ items: { type: "string", minLength: 1 },
32087
+ description: "Keys removed from the snapshot before hashing, matched by name at any depth (timestamps, statistics)."
32088
+ }
32089
+ }
32058
32090
  }
32059
32091
  }
32060
32092
  }
@@ -45322,6 +45354,7 @@ function foldTurnInitiatorLedger(existing, marker, maxAgeMs = TURN_INITIATOR_MAX
45322
45354
  ...marker.chat_kind ? { chat_kind: marker.chat_kind } : {},
45323
45355
  ...marker.chat_id ? { chat_id: marker.chat_id } : {},
45324
45356
  ...marker.unattributed ? { unattributed: true } : {},
45357
+ ...marker.notice ? { notice: true } : {},
45325
45358
  ...marker.loop_tick ? { loop_tick: true } : {},
45326
45359
  ts: marker.ts
45327
45360
  });
@@ -45467,11 +45500,13 @@ function writeUnattributedTurnMarker(channel, opts = {}) {
45467
45500
  updateTurnInitiatorLedger(file, {
45468
45501
  channel,
45469
45502
  sender_id: "",
45470
- // ENG-11979: its own ledger key. The ledger keeps one entry per (channel, ref),
45471
- // so a tick sharing a key would overwrite a stricter unattributed notice.
45472
- channel_ref: opts.loopTick ? "loop-tick" : "unattributed",
45503
+ // ENG-11979 / ENG-11553: each kind gets its own ledger key. The ledger keeps one
45504
+ // entry per (channel, ref), so a tick or a notice sharing the plain key would
45505
+ // overwrite a stricter unattributed entry that blocks regardless of order.
45506
+ channel_ref: opts.loopTick ? "loop-tick" : opts.notice ? "unattributed-notice" : "unattributed",
45473
45507
  unattributed: true,
45474
45508
  ...opts.loopTick ? { loop_tick: true } : {},
45509
+ ...opts.notice ? { notice: true } : {},
45475
45510
  ts: opts.now ?? Date.now()
45476
45511
  });
45477
45512
  } catch {