@integrity-labs/agt-cli 0.14.1 → 0.14.3
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
|
@@ -3717,7 +3717,7 @@ import { execFileSync, execSync } from "child_process";
|
|
|
3717
3717
|
import { existsSync as existsSync5, realpathSync } from "fs";
|
|
3718
3718
|
import chalk20 from "chalk";
|
|
3719
3719
|
import ora15 from "ora";
|
|
3720
|
-
var cliVersion = true ? "0.14.
|
|
3720
|
+
var cliVersion = true ? "0.14.3" : "dev";
|
|
3721
3721
|
async function fetchLatestVersion() {
|
|
3722
3722
|
const host2 = getHost();
|
|
3723
3723
|
if (!host2) return null;
|
|
@@ -4166,7 +4166,7 @@ function handleError(err) {
|
|
|
4166
4166
|
}
|
|
4167
4167
|
|
|
4168
4168
|
// src/bin/agt.ts
|
|
4169
|
-
var cliVersion2 = true ? "0.14.
|
|
4169
|
+
var cliVersion2 = true ? "0.14.3" : "dev";
|
|
4170
4170
|
var program = new Command();
|
|
4171
4171
|
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");
|
|
4172
4172
|
program.hook("preAction", (thisCommand) => {
|
|
@@ -452,6 +452,21 @@ function parseExpiresAt(raw) {
|
|
|
452
452
|
return null;
|
|
453
453
|
}
|
|
454
454
|
|
|
455
|
+
// src/lib/canonical-json.ts
|
|
456
|
+
function canonicalJson(value) {
|
|
457
|
+
return JSON.stringify(normalize(value));
|
|
458
|
+
}
|
|
459
|
+
function normalize(value) {
|
|
460
|
+
if (value === null || typeof value !== "object") return value;
|
|
461
|
+
if (Array.isArray(value)) return value.map(normalize);
|
|
462
|
+
const sorted = {};
|
|
463
|
+
const keys = Object.keys(value).sort();
|
|
464
|
+
for (const k of keys) {
|
|
465
|
+
sorted[k] = normalize(value[k]);
|
|
466
|
+
}
|
|
467
|
+
return sorted;
|
|
468
|
+
}
|
|
469
|
+
|
|
455
470
|
// src/lib/channel-sweep.ts
|
|
456
471
|
import { execFileSync } from "child_process";
|
|
457
472
|
var CHANNEL_BASENAMES = [
|
|
@@ -2240,7 +2255,7 @@ async function processAgent(agent, agentStates) {
|
|
|
2240
2255
|
activeChannels.set(channelId, /* @__PURE__ */ new Set());
|
|
2241
2256
|
}
|
|
2242
2257
|
activeChannels.get(channelId).add(agent.code_name);
|
|
2243
|
-
const configHash = createHash("sha256").update(
|
|
2258
|
+
const configHash = createHash("sha256").update(canonicalJson(entry.config)).digest("hex");
|
|
2244
2259
|
const cacheKey = `${agent.agent_id}:${channelId}`;
|
|
2245
2260
|
let onDiskPresent = true;
|
|
2246
2261
|
try {
|
|
@@ -2252,7 +2267,9 @@ async function processAgent(agent, agentStates) {
|
|
|
2252
2267
|
if (knownChannelConfigHashes.get(cacheKey) === configHash && onDiskPresent) {
|
|
2253
2268
|
continue;
|
|
2254
2269
|
}
|
|
2255
|
-
|
|
2270
|
+
const prevHash = knownChannelConfigHashes.get(cacheKey);
|
|
2271
|
+
const reason = !prevHash ? "first-write" : !onDiskPresent ? "on-disk-missing" : "content-changed";
|
|
2272
|
+
if (!onDiskPresent && prevHash) {
|
|
2256
2273
|
log(`Cached hash for '${agent.code_name}/${channelId}' but on-disk entry missing \u2014 re-writing credentials`);
|
|
2257
2274
|
knownChannelConfigHashes.delete(cacheKey);
|
|
2258
2275
|
}
|
|
@@ -2260,7 +2277,7 @@ async function processAgent(agent, agentStates) {
|
|
|
2260
2277
|
const sessionMode2 = refreshData.agent.session_mode;
|
|
2261
2278
|
frameworkAdapter.writeChannelCredentials(agent.code_name, channelId, entry.config, { sessionMode: sessionMode2 });
|
|
2262
2279
|
knownChannelConfigHashes.set(cacheKey, configHash);
|
|
2263
|
-
log(`Channel credentials written for '${agent.code_name}/${channelId}'`);
|
|
2280
|
+
log(`Channel credentials written for '${agent.code_name}/${channelId}' (reason=${reason}, hash=${configHash.slice(0, 8)}${prevHash ? `, prev=${prevHash.slice(0, 8)}` : ""})`);
|
|
2264
2281
|
} catch (err) {
|
|
2265
2282
|
log(`Failed to write channel credentials for '${agent.code_name}/${channelId}': ${err.message}`);
|
|
2266
2283
|
}
|