@integrity-labs/agt-cli 0.28.1014 → 0.28.1015

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,12 +40,12 @@ import {
40
40
  success,
41
41
  table,
42
42
  warn
43
- } from "../chunk-7QXIJNLA.js";
43
+ } from "../chunk-GHHDFHKE.js";
44
44
  import {
45
45
  getProjectDir,
46
46
  isSessionResumeDisabled,
47
47
  readDirectChatSessionState
48
- } from "../chunk-QBQLG2PY.js";
48
+ } from "../chunk-MHDNKKEO.js";
49
49
  import {
50
50
  AnchorSessionClient,
51
51
  CHANNEL_REGISTRY,
@@ -79,7 +79,7 @@ import {
79
79
  serializeManifestForSlackCli,
80
80
  sessionFileExists,
81
81
  sessionTranscriptDir
82
- } from "../chunk-MLCGPEN6.js";
82
+ } from "../chunk-RJ3SI5JG.js";
83
83
  import "../chunk-DHWNVVX4.js";
84
84
  import "../chunk-XWVM4KPK.js";
85
85
  import "../chunk-EL5MWGGH.js";
@@ -5474,7 +5474,7 @@ import { execFileSync, execSync } from "child_process";
5474
5474
  import { existsSync as existsSync11, realpathSync as realpathSync2 } from "fs";
5475
5475
  import chalk18 from "chalk";
5476
5476
  import ora16 from "ora";
5477
- var cliVersion = true ? "0.28.1014" : "dev";
5477
+ var cliVersion = true ? "0.28.1015" : "dev";
5478
5478
  async function fetchLatestVersion() {
5479
5479
  const host2 = getHost();
5480
5480
  if (!host2) return null;
@@ -6734,7 +6734,7 @@ function handleError(err) {
6734
6734
  }
6735
6735
 
6736
6736
  // src/bin/agt.ts
6737
- var cliVersion2 = true ? "0.28.1014" : "dev";
6737
+ var cliVersion2 = true ? "0.28.1015" : "dev";
6738
6738
  var program = new Command();
6739
6739
  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");
6740
6740
  program.hook("preAction", async (thisCommand, actionCommand) => {
@@ -15,7 +15,7 @@ import {
15
15
  parseEnvFileEntries,
16
16
  parseEnvIntegrations,
17
17
  shellQuote
18
- } from "./chunk-QBQLG2PY.js";
18
+ } from "./chunk-MHDNKKEO.js";
19
19
  import {
20
20
  BIND_FAILURE_QUARANTINE_THRESHOLD,
21
21
  INTEGRATIONS_SECTION_END,
@@ -77,7 +77,7 @@ import {
77
77
  sessionTranscriptDir,
78
78
  worseConnectivityOutcome,
79
79
  wrapScheduledTaskPrompt
80
- } from "./chunk-MLCGPEN6.js";
80
+ } from "./chunk-RJ3SI5JG.js";
81
81
  import {
82
82
  classifyUnanswerablePane,
83
83
  summarizeUnanswerablePane
@@ -1965,6 +1965,16 @@ function syncGitHubBrokerCredentialTooling(projectDir, enabled) {
1965
1965
  function getProjectDir2(codeName) {
1966
1966
  return join4(getAgentDir(codeName), "project");
1967
1967
  }
1968
+ function reapLegacyTokenFile(codeName, onWarn = void 0) {
1969
+ const tokenFilePath = join4(getAgentDir(codeName), ".tokens.json");
1970
+ try {
1971
+ rmSync2(tokenFilePath, { force: true });
1972
+ return true;
1973
+ } catch (err) {
1974
+ (onWarn ?? ((m) => console.warn(m)))(`[claudecode] ENG-10939: could not remove ${tokenFilePath} (${err.code ?? "unknown"}) \u2014 a plaintext OAuth token file remains on disk for '${codeName}' and needs manual removal`);
1975
+ return false;
1976
+ }
1977
+ }
1968
1978
  function getScratchDir(codeName) {
1969
1979
  return join4(getAgentDir(codeName), "scratch");
1970
1980
  }
@@ -6165,6 +6175,7 @@ ${sections}`
6165
6175
  };
6166
6176
  });
6167
6177
  writeIntegrationsSummaryForAgent(codeName, summariesForSidecar);
6178
+ reapLegacyTokenFile(codeName, options?.log);
6168
6179
  const decryptedIntegrations = integrations.map((integration) => ({
6169
6180
  ...integration,
6170
6181
  // atrest-reader-context-allow: host adapter — POST /host/agent-integrations decrypts server-side and returns PLAINTEXT creds (the host holds no AUTH_ENCRYPTION_KEY and ResolvedIntegration carries no org/rowId to build a ref). This decrypt is dead-defensive on plaintext; a v2 (enc:2) blob never reaches the host (ENG-9110 trace).
@@ -6176,30 +6187,27 @@ ${sections}`
6176
6187
  const unscopedPrefix = remoteMcpEnvPrefix(integration.definition_id, null);
6177
6188
  const creds = integration.credentials;
6178
6189
  const def = INTEGRATION_REGISTRY.find((d) => d.id === integration.definition_id);
6179
- if (integration.credentialDelivery === "broker")
6180
- continue;
6181
- let token;
6182
- if (integration.auth_type === "oauth2" || integration.auth_type === "github_app") {
6183
- token = creds.access_token;
6184
- if (token) {
6185
- envUpdates[`${prefix}_ACCESS_TOKEN`] = token;
6190
+ if (integration.credentialDelivery !== "broker") {
6191
+ let token;
6192
+ if (integration.auth_type === "oauth2" || integration.auth_type === "github_app") {
6193
+ token = creds.access_token;
6194
+ if (token) {
6195
+ envUpdates[`${prefix}_ACCESS_TOKEN`] = token;
6196
+ }
6197
+ } else if (integration.auth_type === "api_key") {
6198
+ token = creds.api_key;
6199
+ if (token) {
6200
+ envUpdates[`${prefix}_API_KEY`] = token;
6201
+ }
6186
6202
  }
6187
- } else if (integration.auth_type === "api_key") {
6188
- token = creds.api_key;
6189
- if (token) {
6190
- envUpdates[`${prefix}_API_KEY`] = token;
6203
+ if (def?.cli_tool?.env_key && token && !(def.cli_tool.env_key in envUpdates)) {
6204
+ envUpdates[def.cli_tool.env_key] = token;
6191
6205
  }
6192
6206
  }
6193
- if (def?.cli_tool) {
6194
- const { env_key, extra_env } = def.cli_tool;
6195
- if (env_key && token && !(env_key in envUpdates)) {
6196
- envUpdates[env_key] = token;
6197
- }
6198
- if (extra_env) {
6199
- for (const [k, v] of Object.entries(extra_env)) {
6200
- if (typeof v === "string" && v && !(k in envUpdates)) {
6201
- envUpdates[k] = v;
6202
- }
6207
+ if (def?.cli_tool?.extra_env) {
6208
+ for (const [k, v] of Object.entries(def.cli_tool.extra_env)) {
6209
+ if (typeof v === "string" && v && !(k in envUpdates)) {
6210
+ envUpdates[k] = v;
6203
6211
  }
6204
6212
  }
6205
6213
  }
@@ -6864,29 +6872,6 @@ ${sections}`
6864
6872
  child.on("error", () => {
6865
6873
  });
6866
6874
  });
6867
- },
6868
- writeTokenFile(codeName, integrations) {
6869
- const agentDir = getAgentDir(codeName);
6870
- mkdirSync3(agentDir, { recursive: true });
6871
- const tokens = {};
6872
- for (const integration of integrations) {
6873
- if (integration.auth_type !== "oauth2" && integration.auth_type !== "github_app")
6874
- continue;
6875
- const creds = decryptIntegrationCredentials(integration.credentials);
6876
- const accessToken = creds.access_token;
6877
- if (!accessToken)
6878
- continue;
6879
- tokens[integration.definition_id] = {
6880
- access_token: accessToken,
6881
- ...Object.keys(integration.config).length > 0 ? { config: integration.config } : {},
6882
- ...creds.token_expires_at ? { expires_at: creds.token_expires_at } : {}
6883
- };
6884
- }
6885
- if (Object.keys(tokens).length === 0)
6886
- return;
6887
- const tokenPath = join4(agentDir, ".tokens.json");
6888
- writeFileSync4(tokenPath, JSON.stringify(tokens, null, 2));
6889
- chmodSync4(tokenPath, SECRET_FILE_MODE);
6890
6875
  }
6891
6876
  };
6892
6877
  registerFramework(claudeCodeAdapter);
@@ -7008,7 +6993,7 @@ function exchangeFailureKind(err) {
7008
6993
  }
7009
6994
 
7010
6995
  // src/lib/api-client.ts
7011
- var agtCliVersion = true ? "0.28.1014" : "dev";
6996
+ var agtCliVersion = true ? "0.28.1015" : "dev";
7012
6997
  var lastConfigHash = null;
7013
6998
  function setConfigHash(hash) {
7014
6999
  lastConfigHash = hash && hash.length > 0 ? hash : null;
@@ -11700,6 +11685,7 @@ export {
11700
11685
  extractCommandNotFound,
11701
11686
  describeChannelWriteFailure,
11702
11687
  migrateAgentDirToIdKeyed,
11688
+ reapLegacyTokenFile,
11703
11689
  provisionStopHook,
11704
11690
  provisionIsolationHook,
11705
11691
  provisionAutoKanbanProgressHook,
@@ -11789,4 +11775,4 @@ export {
11789
11775
  managerInstallSystemUnitCommand,
11790
11776
  managerUninstallSystemUnitCommand
11791
11777
  };
11792
- //# sourceMappingURL=chunk-7QXIJNLA.js.map
11778
+ //# sourceMappingURL=chunk-GHHDFHKE.js.map