@integrity-labs/agt-cli 0.28.813 → 0.28.814

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,7 +40,7 @@ import {
40
40
  success,
41
41
  table,
42
42
  warn
43
- } from "../chunk-YCE5BY6D.js";
43
+ } from "../chunk-ZBKYMWD4.js";
44
44
  import {
45
45
  getProjectDir,
46
46
  isSessionResumeDisabled,
@@ -5467,7 +5467,7 @@ import { execFileSync, execSync } from "child_process";
5467
5467
  import { existsSync as existsSync11, realpathSync as realpathSync2 } from "fs";
5468
5468
  import chalk18 from "chalk";
5469
5469
  import ora16 from "ora";
5470
- var cliVersion = true ? "0.28.813" : "dev";
5470
+ var cliVersion = true ? "0.28.814" : "dev";
5471
5471
  async function fetchLatestVersion() {
5472
5472
  const host2 = getHost();
5473
5473
  if (!host2) return null;
@@ -6658,7 +6658,7 @@ function handleError(err) {
6658
6658
  }
6659
6659
 
6660
6660
  // src/bin/agt.ts
6661
- var cliVersion2 = true ? "0.28.813" : "dev";
6661
+ var cliVersion2 = true ? "0.28.814" : "dev";
6662
6662
  var program = new Command();
6663
6663
  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");
6664
6664
  program.hook("preAction", async (thisCommand, actionCommand) => {
@@ -6523,7 +6523,7 @@ function exchangeFailureKind(err) {
6523
6523
  }
6524
6524
 
6525
6525
  // src/lib/api-client.ts
6526
- var agtCliVersion = true ? "0.28.813" : "dev";
6526
+ var agtCliVersion = true ? "0.28.814" : "dev";
6527
6527
  var lastConfigHash = null;
6528
6528
  function setConfigHash(hash) {
6529
6529
  lastConfigHash = hash && hash.length > 0 ? hash : null;
@@ -10818,4 +10818,4 @@ export {
10818
10818
  managerInstallSystemUnitCommand,
10819
10819
  managerUninstallSystemUnitCommand
10820
10820
  };
10821
- //# sourceMappingURL=chunk-YCE5BY6D.js.map
10821
+ //# sourceMappingURL=chunk-ZBKYMWD4.js.map
@@ -58,7 +58,7 @@ import {
58
58
  safeWriteJsonAtomic,
59
59
  setConfigHash,
60
60
  tripClass
61
- } from "../chunk-YCE5BY6D.js";
61
+ } from "../chunk-ZBKYMWD4.js";
62
62
  import {
63
63
  getProjectDir as getProjectDir2,
64
64
  getReadyTasks,
@@ -13542,6 +13542,8 @@ function clearAgentCaches(agentId, codeName) {
13542
13542
  boardTokenCache.forget(agentId);
13543
13543
  refreshFetchGate.forget(agentId);
13544
13544
  memoriesFetchGate.forget(agentId);
13545
+ secretsFetchGate.forget(agentId);
13546
+ defaultSchedulesFetchGate.forget(agentId);
13545
13547
  forgetRealtimeRebindState(agentId);
13546
13548
  forgetChannelSyncState(agentId);
13547
13549
  sharedBusyBuckets.reset(codeName);
@@ -13578,7 +13580,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
13578
13580
  var lastVersionCheckAt = 0;
13579
13581
  var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
13580
13582
  var lastResponsivenessProbeAt = 0;
13581
- var agtCliVersion = true ? "0.28.813" : "dev";
13583
+ var agtCliVersion = true ? "0.28.814" : "dev";
13582
13584
  function resolveBrewPath(execFileSync2) {
13583
13585
  try {
13584
13586
  const out = execFileSync2("which", ["brew"], { timeout: 5e3 }).toString().trim();
@@ -15100,6 +15102,8 @@ var DESIRED_STATE_FETCH_TTL_MS = 6e4;
15100
15102
  var refreshFetchGate = createFetchGate(DESIRED_STATE_FETCH_TTL_MS);
15101
15103
  var lastRefreshPayload = /* @__PURE__ */ new Map();
15102
15104
  var memoriesFetchGate = createFetchGate(DESIRED_STATE_FETCH_TTL_MS);
15105
+ var secretsFetchGate = createFetchGate(DESIRED_STATE_FETCH_TTL_MS);
15106
+ var defaultSchedulesFetchGate = createFetchGate(DESIRED_STATE_FETCH_TTL_MS);
15103
15107
  var pollCycleFetches = 0;
15104
15108
  var pollCycleFetchSkips = 0;
15105
15109
  var pollCycleMemoriesUnchanged = 0;
@@ -15107,6 +15111,8 @@ var pollCycleMemoriesFull = 0;
15107
15111
  function forceRefreshFetch() {
15108
15112
  refreshFetchGate.forceAll();
15109
15113
  memoriesFetchGate.forceAll();
15114
+ secretsFetchGate.forceAll();
15115
+ defaultSchedulesFetchGate.forceAll();
15110
15116
  }
15111
15117
  var consecutivePollFailures = 0;
15112
15118
  function reorderRestartedFirst(agents, restartedIds) {
@@ -17526,24 +17532,28 @@ async function processAgent(agent, agentStates, managedToolkits) {
17526
17532
  }
17527
17533
  let lastSecretsProvisionAt = state8.agents.find((a) => a.agentId === agent.agent_id)?.lastSecretsProvisionAt ?? null;
17528
17534
  let secretsHash = agentState.knownSecretsHashes.get(agent.agent_id) ?? null;
17529
- try {
17530
- const secretsData = await api.post("/host/secrets", { agent_id: agent.agent_id });
17531
- const newHash = secretsData.secrets_hash;
17532
- const hashChanged = newHash !== secretsHash;
17533
- if (hashChanged && secretsData.profiles.length > 0) {
17534
- frameworkAdapter.writeAuthProfiles(agent.code_name, secretsData.profiles);
17535
- lastSecretsProvisionAt = (/* @__PURE__ */ new Date()).toISOString();
17536
- log(`Secrets updated for '${agent.code_name}'`);
17537
- }
17538
- if (newHash) {
17539
- agentState.knownSecretsHashes.set(agent.agent_id, newHash);
17540
- secretsHash = newHash;
17541
- } else {
17542
- agentState.knownSecretsHashes.delete(agent.agent_id);
17543
- secretsHash = null;
17535
+ const secretsToken = secretsFetchGate.beginFetch(agent.agent_id);
17536
+ if (secretsFetchGate.shouldFetch(agent.agent_id)) {
17537
+ try {
17538
+ const secretsData = await api.post("/host/secrets", { agent_id: agent.agent_id });
17539
+ const newHash = secretsData.secrets_hash;
17540
+ const hashChanged = newHash !== secretsHash;
17541
+ if (hashChanged && secretsData.profiles.length > 0) {
17542
+ frameworkAdapter.writeAuthProfiles(agent.code_name, secretsData.profiles);
17543
+ lastSecretsProvisionAt = (/* @__PURE__ */ new Date()).toISOString();
17544
+ log(`Secrets updated for '${agent.code_name}'`);
17545
+ }
17546
+ if (newHash) {
17547
+ agentState.knownSecretsHashes.set(agent.agent_id, newHash);
17548
+ secretsHash = newHash;
17549
+ } else {
17550
+ agentState.knownSecretsHashes.delete(agent.agent_id);
17551
+ secretsHash = null;
17552
+ }
17553
+ secretsFetchGate.markFetched(agent.agent_id, secretsToken);
17554
+ } catch (err) {
17555
+ log(`Secrets fetch failed for '${agent.code_name}': ${err.message}`);
17544
17556
  }
17545
- } catch (err) {
17546
- log(`Secrets fetch failed for '${agent.code_name}': ${err.message}`);
17547
17557
  }
17548
17558
  try {
17549
17559
  const integrationsData = await api.post("/host/agent-integrations", { agent_id: agent.agent_id });
@@ -17953,35 +17963,39 @@ async function processAgent(agent, agentStates, managedToolkits) {
17953
17963
  let tasks = refreshData.scheduled_tasks ?? [];
17954
17964
  const existingTemplateIds = new Set(tasks.map((t) => t.template_id));
17955
17965
  const kanbanWorkRetired = (agentFrameworkCache.get(agent.code_name) ?? DEFAULT_FRAMEWORK) === "claude-code" && agentSessionMode === "persistent";
17956
- try {
17957
- const defaultsData = await api.post("/host/resolve-default-schedules", { agent_id: agent.agent_id });
17958
- const allSchedules = (defaultsData.schedules ?? []).filter(
17959
- (s) => !(kanbanWorkRetired && s.template_id === "kanban-work")
17960
- );
17961
- const missing = allSchedules.filter(
17962
- (s) => !existingTemplateIds.has(s.template_id)
17963
- );
17964
- if (allSchedules.length > 0) {
17965
- await api.post("/host/ensure-default-schedules", {
17966
- agent_id: agent.agent_id,
17967
- team_id: defaultsData.team_id,
17968
- timezone: defaultsData.timezone,
17969
- schedules: allSchedules
17970
- });
17971
- if (missing.length > 0) {
17972
- log(`Auto-provisioned ${missing.length} default schedule(s) for '${agent.code_name}': ${missing.map((s) => s.template_id).join(", ")}`);
17966
+ const defaultSchedulesToken = defaultSchedulesFetchGate.beginFetch(agent.agent_id);
17967
+ if (defaultSchedulesFetchGate.shouldFetch(agent.agent_id)) {
17968
+ try {
17969
+ const defaultsData = await api.post("/host/resolve-default-schedules", { agent_id: agent.agent_id });
17970
+ const allSchedules = (defaultsData.schedules ?? []).filter(
17971
+ (s) => !(kanbanWorkRetired && s.template_id === "kanban-work")
17972
+ );
17973
+ const missing = allSchedules.filter(
17974
+ (s) => !existingTemplateIds.has(s.template_id)
17975
+ );
17976
+ if (allSchedules.length > 0) {
17977
+ await api.post("/host/ensure-default-schedules", {
17978
+ agent_id: agent.agent_id,
17979
+ team_id: defaultsData.team_id,
17980
+ timezone: defaultsData.timezone,
17981
+ schedules: allSchedules
17982
+ });
17983
+ if (missing.length > 0) {
17984
+ log(`Auto-provisioned ${missing.length} default schedule(s) for '${agent.code_name}': ${missing.map((s) => s.template_id).join(", ")}`);
17985
+ }
17986
+ const freshData = await api.post("/host/refresh", {
17987
+ agent_id: agent.agent_id,
17988
+ // Only `scheduled_tasks` is read here, so ask for the manifest shape on
17989
+ // every lane — nothing in this branch consumes a skill body, and the
17990
+ // skill lanes are the largest part of the payload being discarded.
17991
+ ...REFRESH_MANIFEST_FLAGS
17992
+ });
17993
+ tasks = freshData.scheduled_tasks ?? tasks;
17973
17994
  }
17974
- const freshData = await api.post("/host/refresh", {
17975
- agent_id: agent.agent_id,
17976
- // Only `scheduled_tasks` is read here, so ask for the manifest shape on
17977
- // every lane — nothing in this branch consumes a skill body, and the
17978
- // skill lanes are the largest part of the payload being discarded.
17979
- ...REFRESH_MANIFEST_FLAGS
17980
- });
17981
- tasks = freshData.scheduled_tasks ?? tasks;
17995
+ defaultSchedulesFetchGate.markFetched(agent.agent_id, defaultSchedulesToken);
17996
+ } catch (err) {
17997
+ log(`Default schedule provisioning failed for '${agent.code_name}': ${err.message}`);
17982
17998
  }
17983
- } catch (err) {
17984
- log(`Default schedule provisioning failed for '${agent.code_name}': ${err.message}`);
17985
17999
  }
17986
18000
  if (kanbanWorkRetired) {
17987
18001
  tasks = tasks.filter((t) => t.template_id !== "kanban-work");