@integrity-labs/agt-cli 0.28.492 → 0.28.493

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-KB5KVAWJ.js";
43
+ } from "../chunk-3XLUSG32.js";
44
44
  import {
45
45
  AnchorSessionClient,
46
46
  CHANNEL_REGISTRY,
@@ -71,7 +71,7 @@ import {
71
71
  requiredMcpWildcard,
72
72
  resolveChannels,
73
73
  serializeManifestForSlackCli
74
- } from "../chunk-34E3FHOS.js";
74
+ } from "../chunk-SRO2IQ4R.js";
75
75
  import "../chunk-XWVM4KPK.js";
76
76
 
77
77
  // src/bin/agt.ts
@@ -4830,7 +4830,7 @@ import { execFileSync, execSync } from "child_process";
4830
4830
  import { existsSync as existsSync10, realpathSync as realpathSync2 } from "fs";
4831
4831
  import chalk18 from "chalk";
4832
4832
  import ora16 from "ora";
4833
- var cliVersion = true ? "0.28.492" : "dev";
4833
+ var cliVersion = true ? "0.28.493" : "dev";
4834
4834
  async function fetchLatestVersion() {
4835
4835
  const host2 = getHost();
4836
4836
  if (!host2) return null;
@@ -6002,7 +6002,7 @@ function handleError(err) {
6002
6002
  }
6003
6003
 
6004
6004
  // src/bin/agt.ts
6005
- var cliVersion2 = true ? "0.28.492" : "dev";
6005
+ var cliVersion2 = true ? "0.28.493" : "dev";
6006
6006
  var program = new Command();
6007
6007
  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");
6008
6008
  program.hook("preAction", async (thisCommand, actionCommand) => {
@@ -30,7 +30,7 @@ import {
30
30
  resolveConnectivityProbe,
31
31
  worseConnectivityOutcome,
32
32
  wrapScheduledTaskPrompt
33
- } from "./chunk-34E3FHOS.js";
33
+ } from "./chunk-SRO2IQ4R.js";
34
34
  import {
35
35
  parsePsRows
36
36
  } from "./chunk-XWVM4KPK.js";
@@ -432,7 +432,7 @@ function mergeEnvIntegrationsContent(existing, args) {
432
432
  }
433
433
 
434
434
  // ../../packages/core/dist/provisioning/frameworks/claudecode/index.js
435
- import { readFileSync as readFileSync3, writeFileSync as writeFileSync3, mkdirSync as mkdirSync2, existsSync as existsSync3, chmodSync as chmodSync3, readdirSync, rmSync, copyFileSync, lstatSync, realpathSync, symlinkSync, readlinkSync } from "fs";
435
+ import { readFileSync as readFileSync3, writeFileSync as writeFileSync3, mkdirSync as mkdirSync2, existsSync as existsSync3, chmodSync as chmodSync3, readdirSync, rmSync, copyFileSync, lstatSync, realpathSync, symlinkSync, readlinkSync, renameSync as renameSync3 } from "fs";
436
436
  import { join as join2, relative, dirname as dirname2 } from "path";
437
437
  import { homedir as homedir2 } from "os";
438
438
  import { execFile } from "child_process";
@@ -801,6 +801,64 @@ function ensureIdKeyedLayout(codeName, agentId) {
801
801
  symlinkSync(agentId, codeNamePath);
802
802
  return idPath;
803
803
  }
804
+ function stagedMigrationLinkPath(home, codeName) {
805
+ return join2(home, ".augmented", `.${codeName}.migrating`);
806
+ }
807
+ function cleanupStaleStagedLink(staged) {
808
+ try {
809
+ if (lstatSync(staged).isSymbolicLink())
810
+ rmSync(staged, { force: true });
811
+ } catch {
812
+ }
813
+ }
814
+ function isSymlinkTo(path, target) {
815
+ try {
816
+ return lstatSync(path).isSymbolicLink() && readlinkSync(path) === target;
817
+ } catch {
818
+ return false;
819
+ }
820
+ }
821
+ function migrateAgentDirToIdKeyed(codeName, agentId, opts = {}) {
822
+ assertValidCodeName(codeName);
823
+ assertValidAgentId(agentId);
824
+ const home = opts.home ?? getHomeDir();
825
+ const codeNamePath = join2(home, ".augmented", codeName);
826
+ const idPath = join2(home, ".augmented", agentId);
827
+ const staged = stagedMigrationLinkPath(home, codeName);
828
+ let codeNameKind;
829
+ try {
830
+ codeNameKind = lstatSync(codeNamePath).isSymbolicLink() ? "symlink" : "realdir";
831
+ } catch {
832
+ codeNameKind = "absent";
833
+ }
834
+ const idExists = existsSync3(idPath);
835
+ if (codeNameKind === "symlink") {
836
+ const target = readlinkSync(codeNamePath);
837
+ if (target !== agentId) {
838
+ throw new Error(`Codename symlink ${codeNamePath} points at "${target}", expected "${agentId}"; refusing to migrate.`);
839
+ }
840
+ return "already-id-keyed";
841
+ }
842
+ if (codeNameKind === "absent" && idExists) {
843
+ if (isSymlinkTo(staged, agentId)) {
844
+ renameSync3(staged, codeNamePath);
845
+ } else {
846
+ cleanupStaleStagedLink(staged);
847
+ symlinkSync(agentId, codeNamePath);
848
+ }
849
+ return "recovered";
850
+ }
851
+ if (codeNameKind === "absent")
852
+ return "no-agent";
853
+ if (idExists) {
854
+ return "conflict";
855
+ }
856
+ cleanupStaleStagedLink(staged);
857
+ symlinkSync(agentId, staged);
858
+ renameSync3(codeNamePath, idPath);
859
+ renameSync3(staged, codeNamePath);
860
+ return "migrated";
861
+ }
804
862
  function getAgentDir(codeName) {
805
863
  assertValidCodeName(codeName);
806
864
  return resolveRealAgentPath(join2(getHomeDir(), ".augmented", codeName));
@@ -4964,7 +5022,7 @@ function exchangeFailureKind(err) {
4964
5022
  }
4965
5023
 
4966
5024
  // src/lib/api-client.ts
4967
- var agtCliVersion = true ? "0.28.492" : "dev";
5025
+ var agtCliVersion = true ? "0.28.493" : "dev";
4968
5026
  var lastConfigHash = null;
4969
5027
  function setConfigHash(hash) {
4970
5028
  lastConfigHash = hash && hash.length > 0 ? hash : null;
@@ -5197,7 +5255,7 @@ async function getHostId() {
5197
5255
  }
5198
5256
 
5199
5257
  // src/lib/atomic-write.ts
5200
- import { closeSync, fsyncSync, openSync, writeSync, renameSync as renameSync3, mkdirSync as mkdirSync4 } from "fs";
5258
+ import { closeSync, fsyncSync, openSync, writeSync, renameSync as renameSync4, mkdirSync as mkdirSync4 } from "fs";
5201
5259
  import { dirname as dirname3 } from "path";
5202
5260
  function atomicWriteFileSync(path, data) {
5203
5261
  const dirPath = dirname3(path);
@@ -5216,7 +5274,7 @@ function atomicWriteFileSync(path, data) {
5216
5274
  } finally {
5217
5275
  closeSync(fd);
5218
5276
  }
5219
- renameSync3(tmpPath, path);
5277
+ renameSync4(tmpPath, path);
5220
5278
  try {
5221
5279
  const dirFd = openSync(dirPath, "r");
5222
5280
  try {
@@ -5301,6 +5359,18 @@ var HostFlagStore = class {
5301
5359
  * heartbeat), not persisted to the flags cache, which is a host-wide map.
5302
5360
  */
5303
5361
  notifyDispatchByAgent = {};
5362
+ /**
5363
+ * ENG-7891 / ADR-0049 slice 3: per-agent boolean overrides from the heartbeat,
5364
+ * keyed `agent_id -> flag_key -> bool`. This is the generic per-agent seam
5365
+ * `getBooleanForAgent` reads so a boolean gate (today only
5366
+ * `id-keyed-layout-migration`) can be armed one agent at a time. Held in
5367
+ * memory only and re-sent every heartbeat - deliberately NOT persisted to the
5368
+ * flags cache (which is a host-wide map), so a restart cleanly falls back to
5369
+ * the host-wide value until the next heartbeat rather than pinning a stale
5370
+ * per-agent opt-in. Empty until the API sends `feature_flags_by_agent` (the
5371
+ * flag ships dark, so it stays empty and every agent resolves host-wide).
5372
+ */
5373
+ booleanFlagsByAgent = {};
5304
5374
  /**
5305
5375
  * The `flags_schema_version` from the most recent heartbeat, retained so a
5306
5376
  * per-agent-map write (which carries no schema version of its own) persists
@@ -5425,6 +5495,30 @@ var HostFlagStore = class {
5425
5495
  if (resolved && typeof resolved.value === "boolean") return resolved.value;
5426
5496
  return definition?.flagType === "boolean" ? definition.defaultValue : false;
5427
5497
  }
5498
+ /**
5499
+ * ENG-7891 / ADR-0049 slice 3: resolve a BOOLEAN flag FOR A SPECIFIC AGENT.
5500
+ * Precedence mirrors {@link getStringForAgent}:
5501
+ *
5502
+ * env override -> per-agent heartbeat value -> host-wide value (getBoolean)
5503
+ *
5504
+ * The env override (if the flag declares one) stays highest precedence and
5505
+ * host-wide; otherwise a per-agent heartbeat override beats the host-wide
5506
+ * value, and an agent with no per-agent entry inherits the host-wide value.
5507
+ * A non-boolean/unknown key delegates to getBoolean. This lets a one-way-door
5508
+ * gate be armed one agent at a time (id-keyed-layout-migration) without an
5509
+ * opt-in fanning out to every agent on the host.
5510
+ */
5511
+ getBooleanForAgent(key, agentId) {
5512
+ const definition = getFlagDefinition(key);
5513
+ if (!definition || definition.flagType !== "boolean") return this.getBoolean(key);
5514
+ const envValue = definition.envVar ? coerceEnvValue(definition, this.env[definition.envVar]) : void 0;
5515
+ if (typeof envValue === "boolean") return envValue;
5516
+ if (agentId) {
5517
+ const perAgent = this.booleanFlagsByAgent[agentId]?.[key];
5518
+ if (typeof perAgent === "boolean") return perAgent;
5519
+ }
5520
+ return this.getBoolean(key);
5521
+ }
5428
5522
  /**
5429
5523
  * Typed string accessor for enum flags. Falls back to the registry default
5430
5524
  * (and to `''` for an unknown/non-enum key).
@@ -5457,6 +5551,34 @@ var HostFlagStore = class {
5457
5551
  this.notifyDispatchByAgent = next;
5458
5552
  this.persistCache();
5459
5553
  }
5554
+ /**
5555
+ * ENG-7891 / ADR-0049 slice 3: merge the heartbeat's per-agent BOOLEAN
5556
+ * override map (`agent_id -> flag_key -> bool`), read by getBooleanForAgent.
5557
+ * A missing/non-object map REPLACES with an empty map so a cleared per-agent
5558
+ * override takes effect within one poll rather than pinning a stale opt-in.
5559
+ * Only registered boolean keys with an actual boolean value are kept (registry
5560
+ * skew / malformed payloads are dropped). In-memory only - deliberately not
5561
+ * persisted (unlike notify-dispatch), so a restart falls back to the host-wide
5562
+ * value until the next heartbeat rather than rehydrating a stale opt-in for a
5563
+ * one-way-door migration.
5564
+ */
5565
+ applyBooleanFlagsByAgent(map) {
5566
+ if (!map || typeof map !== "object") {
5567
+ this.booleanFlagsByAgent = {};
5568
+ return;
5569
+ }
5570
+ const next = {};
5571
+ for (const [agentId, perAgent] of Object.entries(map)) {
5572
+ if (!perAgent || typeof perAgent !== "object") continue;
5573
+ for (const [key, raw] of Object.entries(perAgent)) {
5574
+ const definition = getFlagDefinition(key);
5575
+ if (!definition || definition.flagType !== "boolean") continue;
5576
+ if (typeof raw !== "boolean") continue;
5577
+ (next[agentId] ??= {})[key] = raw;
5578
+ }
5579
+ }
5580
+ this.booleanFlagsByAgent = next;
5581
+ }
5460
5582
  /**
5461
5583
  * ENG-7682 follow-up: resolve an enum flag FOR A SPECIFIC AGENT. Precedence:
5462
5584
  *
@@ -7642,6 +7764,7 @@ export {
7642
7764
  safeWriteJsonAtomic,
7643
7765
  extractCommandNotFound,
7644
7766
  CHANNEL_SECRET_ENV_KEYS,
7767
+ migrateAgentDirToIdKeyed,
7645
7768
  provisionStopHook,
7646
7769
  provisionIsolationHook,
7647
7770
  provisionAutoKanbanProgressHook,
@@ -7712,4 +7835,4 @@ export {
7712
7835
  managerInstallSystemUnitCommand,
7713
7836
  managerUninstallSystemUnitCommand
7714
7837
  };
7715
- //# sourceMappingURL=chunk-KB5KVAWJ.js.map
7838
+ //# sourceMappingURL=chunk-3XLUSG32.js.map