@integrity-labs/agt-cli 0.28.345 → 0.28.347

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-GJ5TGARW.js";
43
+ } from "../chunk-CD3HY46A.js";
44
44
  import {
45
45
  AnchorSessionClient,
46
46
  CHANNEL_REGISTRY,
@@ -70,7 +70,7 @@ import {
70
70
  renderTemplate,
71
71
  resolveChannels,
72
72
  serializeManifestForSlackCli
73
- } from "../chunk-O5IINJDB.js";
73
+ } from "../chunk-ZGY4ADGS.js";
74
74
  import "../chunk-XWVM4KPK.js";
75
75
 
76
76
  // src/bin/agt.ts
@@ -4829,7 +4829,7 @@ import { execFileSync, execSync } from "child_process";
4829
4829
  import { existsSync as existsSync10, realpathSync as realpathSync2 } from "fs";
4830
4830
  import chalk18 from "chalk";
4831
4831
  import ora16 from "ora";
4832
- var cliVersion = true ? "0.28.345" : "dev";
4832
+ var cliVersion = true ? "0.28.347" : "dev";
4833
4833
  async function fetchLatestVersion() {
4834
4834
  const host2 = getHost();
4835
4835
  if (!host2) return null;
@@ -6001,7 +6001,7 @@ function handleError(err) {
6001
6001
  }
6002
6002
 
6003
6003
  // src/bin/agt.ts
6004
- var cliVersion2 = true ? "0.28.345" : "dev";
6004
+ var cliVersion2 = true ? "0.28.347" : "dev";
6005
6005
  var program = new Command();
6006
6006
  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");
6007
6007
  program.hook("preAction", async (thisCommand, actionCommand) => {
@@ -20,7 +20,7 @@ import {
20
20
  resolveConnectivityProbe,
21
21
  worseConnectivityOutcome,
22
22
  wrapScheduledTaskPrompt
23
- } from "./chunk-O5IINJDB.js";
23
+ } from "./chunk-ZGY4ADGS.js";
24
24
  import {
25
25
  parsePsRows
26
26
  } from "./chunk-XWVM4KPK.js";
@@ -1756,7 +1756,7 @@ function mergeEnvIntegrationsContent(existing, args) {
1756
1756
  }
1757
1757
 
1758
1758
  // ../../packages/core/dist/provisioning/frameworks/claudecode/index.js
1759
- import { readFileSync as readFileSync3, writeFileSync as writeFileSync3, mkdirSync as mkdirSync2, existsSync as existsSync3, chmodSync as chmodSync3, readdirSync, rmSync, copyFileSync } from "fs";
1759
+ 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";
1760
1760
  import { join as join2, relative, dirname as dirname2 } from "path";
1761
1761
  import { homedir as homedir2 } from "os";
1762
1762
  import { execFile } from "child_process";
@@ -2269,9 +2269,52 @@ function assertSafeRelativePath(relativePath) {
2269
2269
  function getHomeDir() {
2270
2270
  return process.env["HOME"] ?? process.env["USERPROFILE"] ?? homedir2();
2271
2271
  }
2272
+ var ID_KEYED_LAYOUT_ENABLED = false;
2273
+ 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}$/;
2274
+ function assertValidAgentId(agentId) {
2275
+ if (!VALID_AGENT_ID.test(agentId)) {
2276
+ throw new Error(`Invalid agent_id: "${agentId}". Must be a UUID.`);
2277
+ }
2278
+ }
2279
+ function resolveRealAgentPath(codeNamePath) {
2280
+ try {
2281
+ if (lstatSync(codeNamePath).isSymbolicLink()) {
2282
+ return realpathSync(codeNamePath);
2283
+ }
2284
+ } catch {
2285
+ }
2286
+ return codeNamePath;
2287
+ }
2288
+ function ensureIdKeyedLayout(codeName, agentId) {
2289
+ assertValidCodeName(codeName);
2290
+ assertValidAgentId(agentId);
2291
+ const home = getHomeDir();
2292
+ const codeNamePath = join2(home, ".augmented", codeName);
2293
+ const idPath = join2(home, ".augmented", agentId);
2294
+ let state;
2295
+ try {
2296
+ state = lstatSync(codeNamePath).isSymbolicLink() ? "symlink" : "realdir";
2297
+ } catch {
2298
+ state = "absent";
2299
+ }
2300
+ if (state === "realdir") {
2301
+ return codeNamePath;
2302
+ }
2303
+ if (state === "symlink") {
2304
+ const target = readlinkSync(codeNamePath);
2305
+ if (target !== agentId) {
2306
+ throw new Error(`Codename symlink ${codeNamePath} points at "${target}", expected "${agentId}"; refusing to provision over a mismatched id-keyed layout.`);
2307
+ }
2308
+ mkdirSync2(idPath, { recursive: true });
2309
+ return idPath;
2310
+ }
2311
+ mkdirSync2(idPath, { recursive: true });
2312
+ symlinkSync(agentId, codeNamePath);
2313
+ return idPath;
2314
+ }
2272
2315
  function getAgentDir(codeName) {
2273
2316
  assertValidCodeName(codeName);
2274
- return join2(getHomeDir(), ".augmented", codeName);
2317
+ return resolveRealAgentPath(join2(getHomeDir(), ".augmented", codeName));
2275
2318
  }
2276
2319
  var migratedCodeNames = /* @__PURE__ */ new Set();
2277
2320
  function migrateLegacyClaudecodeDir(codeName, log) {
@@ -2332,8 +2375,7 @@ function migrateLegacyClaudecodeDir(codeName, log) {
2332
2375
  }
2333
2376
  }
2334
2377
  function getProjectDir(codeName) {
2335
- assertValidCodeName(codeName);
2336
- return join2(getHomeDir(), ".augmented", codeName, "project");
2378
+ return join2(getAgentDir(codeName), "project");
2337
2379
  }
2338
2380
  function syncMcpToProject(codeName) {
2339
2381
  const agentDir2 = getAgentDir(codeName);
@@ -4872,34 +4914,47 @@ ${sections}`
4872
4914
  const augDir = join2(homeDir, ".augmented");
4873
4915
  const agents = /* @__PURE__ */ new Set();
4874
4916
  try {
4875
- const { readdirSync: readdirSync3, statSync: statSync2 } = await import("fs");
4876
- const entries = readdirSync3(augDir);
4917
+ const entries = readdirSync(augDir);
4877
4918
  for (const entry of entries) {
4878
4919
  if (entry.startsWith("_") || entry.startsWith("."))
4879
4920
  continue;
4880
4921
  const agentRoot = join2(augDir, entry);
4922
+ let st;
4881
4923
  try {
4882
- if (!statSync2(agentRoot).isDirectory())
4883
- continue;
4924
+ st = lstatSync(agentRoot);
4884
4925
  } catch {
4885
4926
  continue;
4886
4927
  }
4887
- if (existsSync3(join2(agentRoot, "registration.json"))) {
4888
- agents.add(entry);
4928
+ if (st.isSymbolicLink() || !st.isDirectory())
4929
+ continue;
4930
+ if (!existsSync3(join2(agentRoot, "registration.json")))
4931
+ continue;
4932
+ let codeName = entry;
4933
+ try {
4934
+ const reg = JSON.parse(readFileSync3(join2(agentRoot, "registration.json"), "utf8"));
4935
+ if (reg && typeof reg.code_name === "string" && reg.code_name) {
4936
+ codeName = reg.code_name;
4937
+ }
4938
+ } catch {
4889
4939
  }
4940
+ agents.add(codeName);
4890
4941
  }
4891
4942
  } catch {
4892
4943
  }
4893
4944
  return agents;
4894
4945
  },
4895
- async registerAgent(codeName, teamDir, _model) {
4946
+ async registerAgent(codeName, teamDir, _model, agentId) {
4896
4947
  try {
4948
+ if (ID_KEYED_LAYOUT_ENABLED && agentId) {
4949
+ ensureIdKeyedLayout(codeName, agentId);
4950
+ }
4897
4951
  const agentDir2 = getAgentDir(codeName);
4898
4952
  const projectDir2 = getProjectDir(codeName);
4899
4953
  mkdirSync2(agentDir2, { recursive: true });
4900
4954
  mkdirSync2(projectDir2, { recursive: true });
4901
4955
  writeFileSync3(join2(agentDir2, "registration.json"), JSON.stringify({
4902
4956
  code_name: codeName,
4957
+ agent_id: agentId ?? null,
4903
4958
  team_dir: teamDir,
4904
4959
  project_dir: projectDir2,
4905
4960
  framework: "claude-code",
@@ -7052,7 +7107,7 @@ function requireHost() {
7052
7107
  }
7053
7108
 
7054
7109
  // src/lib/api-client.ts
7055
- var agtCliVersion = true ? "0.28.345" : "dev";
7110
+ var agtCliVersion = true ? "0.28.347" : "dev";
7056
7111
  var lastConfigHash = null;
7057
7112
  function setConfigHash(hash) {
7058
7113
  lastConfigHash = hash && hash.length > 0 ? hash : null;
@@ -8732,7 +8787,7 @@ function decidePin(opts) {
8732
8787
 
8733
8788
  // src/commands/manager.ts
8734
8789
  import chalk3 from "chalk";
8735
- import { existsSync as existsSync9, realpathSync } from "fs";
8790
+ import { existsSync as existsSync9, realpathSync as realpathSync2 } from "fs";
8736
8791
  import { join as join9 } from "path";
8737
8792
  import { homedir as homedir5, userInfo } from "os";
8738
8793
  import { spawn as spawn3 } from "child_process";
@@ -9185,7 +9240,7 @@ function resolveStableAgtBin(rawPath) {
9185
9240
  for (const candidate of candidates) {
9186
9241
  if (!existsSync9(candidate)) continue;
9187
9242
  try {
9188
- realpathSync(candidate);
9243
+ realpathSync2(candidate);
9189
9244
  return candidate;
9190
9245
  } catch {
9191
9246
  }
@@ -9501,4 +9556,4 @@ export {
9501
9556
  managerInstallSystemUnitCommand,
9502
9557
  managerUninstallSystemUnitCommand
9503
9558
  };
9504
- //# sourceMappingURL=chunk-GJ5TGARW.js.map
9559
+ //# sourceMappingURL=chunk-CD3HY46A.js.map