@integrity-labs/agt-cli 0.28.606 → 0.28.608
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-
|
|
43
|
+
} from "../chunk-6DELDLX4.js";
|
|
44
44
|
import {
|
|
45
45
|
readDirectChatSessionState
|
|
46
46
|
} from "../chunk-DESCRVVM.js";
|
|
@@ -4909,7 +4909,7 @@ import { execFileSync, execSync } from "child_process";
|
|
|
4909
4909
|
import { existsSync as existsSync10, realpathSync as realpathSync2 } from "fs";
|
|
4910
4910
|
import chalk18 from "chalk";
|
|
4911
4911
|
import ora16 from "ora";
|
|
4912
|
-
var cliVersion = true ? "0.28.
|
|
4912
|
+
var cliVersion = true ? "0.28.608" : "dev";
|
|
4913
4913
|
async function fetchLatestVersion() {
|
|
4914
4914
|
const host2 = getHost();
|
|
4915
4915
|
if (!host2) return null;
|
|
@@ -6089,7 +6089,7 @@ function handleError(err) {
|
|
|
6089
6089
|
}
|
|
6090
6090
|
|
|
6091
6091
|
// src/bin/agt.ts
|
|
6092
|
-
var cliVersion2 = true ? "0.28.
|
|
6092
|
+
var cliVersion2 = true ? "0.28.608" : "dev";
|
|
6093
6093
|
var program = new Command();
|
|
6094
6094
|
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");
|
|
6095
6095
|
program.hook("preAction", async (thisCommand, actionCommand) => {
|
|
@@ -6030,7 +6030,7 @@ function exchangeFailureKind(err) {
|
|
|
6030
6030
|
}
|
|
6031
6031
|
|
|
6032
6032
|
// src/lib/api-client.ts
|
|
6033
|
-
var agtCliVersion = true ? "0.28.
|
|
6033
|
+
var agtCliVersion = true ? "0.28.608" : "dev";
|
|
6034
6034
|
var lastConfigHash = null;
|
|
6035
6035
|
function setConfigHash(hash) {
|
|
6036
6036
|
lastConfigHash = hash && hash.length > 0 ? hash : null;
|
|
@@ -9505,4 +9505,4 @@ export {
|
|
|
9505
9505
|
managerInstallSystemUnitCommand,
|
|
9506
9506
|
managerUninstallSystemUnitCommand
|
|
9507
9507
|
};
|
|
9508
|
-
//# sourceMappingURL=chunk-
|
|
9508
|
+
//# sourceMappingURL=chunk-6DELDLX4.js.map
|
|
@@ -53,7 +53,7 @@ import {
|
|
|
53
53
|
safeWriteJsonAtomic,
|
|
54
54
|
setConfigHash,
|
|
55
55
|
tripClass
|
|
56
|
-
} from "../chunk-
|
|
56
|
+
} from "../chunk-6DELDLX4.js";
|
|
57
57
|
import {
|
|
58
58
|
getProjectDir as getProjectDir2,
|
|
59
59
|
getReadyTasks,
|
|
@@ -7334,6 +7334,9 @@ async function syncAndCheckClaudeScheduler(agent, tasks, boardItems, refreshData
|
|
|
7334
7334
|
// src/lib/occupancy-gate.ts
|
|
7335
7335
|
import { closeSync as closeSync2, openSync as openSync2, readdirSync as readdirSync6, readSync as readSync2, statSync as statSync6 } from "fs";
|
|
7336
7336
|
import { join as join30 } from "path";
|
|
7337
|
+
function rostersMeasuredZero(mode, attested, runtimeRunning) {
|
|
7338
|
+
return mode === "enforce" && attested && runtimeRunning;
|
|
7339
|
+
}
|
|
7337
7340
|
var TAIL_BYTES = 256 * 1024;
|
|
7338
7341
|
var MAX_RECORD_ALIGN_BYTES = 8 * 1024 * 1024;
|
|
7339
7342
|
var GATE_MAX_BUCKET_AGE_MS = 30 * 6e4;
|
|
@@ -7531,6 +7534,13 @@ var SAMPLE_INTERVAL_MS = 1e4;
|
|
|
7531
7534
|
var IDLE_GAP_MS = 12e4;
|
|
7532
7535
|
var POST_IDLE_CREDIT_MS = 6e4;
|
|
7533
7536
|
var lastMtimeMs = /* @__PURE__ */ new Map();
|
|
7537
|
+
var lastObservedAtMs = /* @__PURE__ */ new Map();
|
|
7538
|
+
var OBSERVATION_FRESH_MS = SAMPLE_INTERVAL_MS * 6;
|
|
7539
|
+
function hasFreshPaneObservation(codeName, nowMs, maxAgeMs = OBSERVATION_FRESH_MS) {
|
|
7540
|
+
const at = lastObservedAtMs.get(codeName);
|
|
7541
|
+
if (at == null) return false;
|
|
7542
|
+
return nowMs - at <= maxAgeMs;
|
|
7543
|
+
}
|
|
7534
7544
|
function paneMtimeMs(codeName) {
|
|
7535
7545
|
try {
|
|
7536
7546
|
return statSync7(paneLogPath(codeName)).mtimeMs;
|
|
@@ -7541,11 +7551,13 @@ function paneMtimeMs(codeName) {
|
|
|
7541
7551
|
function samplePaneOccupancyOnce(codeNames, opts = {}) {
|
|
7542
7552
|
const ledger = opts.ledger ?? sharedBusyBuckets;
|
|
7543
7553
|
const readMtime = opts.readMtime ?? paneMtimeMs;
|
|
7554
|
+
const nowMs = opts.nowMs ?? Date.now();
|
|
7544
7555
|
const seen = /* @__PURE__ */ new Set();
|
|
7545
7556
|
for (const codeName of codeNames) {
|
|
7546
7557
|
seen.add(codeName);
|
|
7547
7558
|
const mtime = readMtime(codeName);
|
|
7548
7559
|
if (mtime == null) continue;
|
|
7560
|
+
lastObservedAtMs.set(codeName, nowMs);
|
|
7549
7561
|
const prev = lastMtimeMs.get(codeName);
|
|
7550
7562
|
lastMtimeMs.set(codeName, mtime);
|
|
7551
7563
|
if (prev == null) continue;
|
|
@@ -7560,6 +7572,9 @@ function samplePaneOccupancyOnce(codeNames, opts = {}) {
|
|
|
7560
7572
|
for (const codeName of [...lastMtimeMs.keys()]) {
|
|
7561
7573
|
if (!seen.has(codeName)) lastMtimeMs.delete(codeName);
|
|
7562
7574
|
}
|
|
7575
|
+
for (const codeName of [...lastObservedAtMs.keys()]) {
|
|
7576
|
+
if (!seen.has(codeName)) lastObservedAtMs.delete(codeName);
|
|
7577
|
+
}
|
|
7563
7578
|
}
|
|
7564
7579
|
var timer = null;
|
|
7565
7580
|
function startPaneOccupancySampler(liveAgents) {
|
|
@@ -10814,6 +10829,7 @@ var dependencyRecoveryLedger = new DependencyRecoveryLedger();
|
|
|
10814
10829
|
var unstableLatchUnreported = /* @__PURE__ */ new Set();
|
|
10815
10830
|
var unstableLatchReportInFlight = /* @__PURE__ */ new Set();
|
|
10816
10831
|
var killPausedCodeNames = /* @__PURE__ */ new Set();
|
|
10832
|
+
var notRunningCodeNames = /* @__PURE__ */ new Set();
|
|
10817
10833
|
var BACK_ONLINE_GREETING_GUIDANCE = " When you reconnect, if you tell anyone you are back, start that message with a \u{1F44B} wave emoji and do not use a \u{1F7E2} green-light emoji.";
|
|
10818
10834
|
function maybeAutoResume(agent) {
|
|
10819
10835
|
const codeName = agent.code_name;
|
|
@@ -11880,7 +11896,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
|
|
|
11880
11896
|
var lastVersionCheckAt = 0;
|
|
11881
11897
|
var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
|
|
11882
11898
|
var lastResponsivenessProbeAt = 0;
|
|
11883
|
-
var agtCliVersion = true ? "0.28.
|
|
11899
|
+
var agtCliVersion = true ? "0.28.608" : "dev";
|
|
11884
11900
|
function resolveBrewPath(execFileSync3) {
|
|
11885
11901
|
try {
|
|
11886
11902
|
const out = execFileSync3("which", ["brew"], { timeout: 5e3 }).toString().trim();
|
|
@@ -13434,12 +13450,22 @@ async function pollCycle() {
|
|
|
13434
13450
|
const drainedBuckets = /* @__PURE__ */ new Map();
|
|
13435
13451
|
const drainedCodeNames = /* @__PURE__ */ new Set();
|
|
13436
13452
|
const qualifierMode = occupancyQualifierMode();
|
|
13453
|
+
const measuredCodeNames = /* @__PURE__ */ new Set();
|
|
13437
13454
|
const takeBuckets = (codeName) => {
|
|
13438
13455
|
if (drainedCodeNames.has(codeName)) return { buckets: [], classifications: null };
|
|
13439
13456
|
drainedCodeNames.add(codeName);
|
|
13440
13457
|
const nowMs = Date.now();
|
|
13441
13458
|
const raw = sharedBusyBuckets.drainClosed(codeName, nowMs);
|
|
13442
|
-
if (raw.length === 0)
|
|
13459
|
+
if (raw.length === 0) {
|
|
13460
|
+
if (rostersMeasuredZero(
|
|
13461
|
+
qualifierMode,
|
|
13462
|
+
hasFreshPaneObservation(codeName, nowMs),
|
|
13463
|
+
!notRunningCodeNames.has(codeName)
|
|
13464
|
+
)) {
|
|
13465
|
+
measuredCodeNames.add(codeName);
|
|
13466
|
+
}
|
|
13467
|
+
return { buckets: [], classifications: null };
|
|
13468
|
+
}
|
|
13443
13469
|
let q;
|
|
13444
13470
|
try {
|
|
13445
13471
|
q = qualifyBuckets(raw, collectQualifyingTurns(codeName, nowMs), qualifierMode, nowMs);
|
|
@@ -13483,8 +13509,13 @@ async function pollCycle() {
|
|
|
13483
13509
|
});
|
|
13484
13510
|
}
|
|
13485
13511
|
}
|
|
13486
|
-
|
|
13487
|
-
|
|
13512
|
+
const occupancyMeasuredCodeNames = [...measuredCodeNames];
|
|
13513
|
+
if (probes.length > 0 || occupancyMeasuredCodeNames.length > 0) {
|
|
13514
|
+
void api.post("/host/responsiveness-probe", {
|
|
13515
|
+
host_id: hostId,
|
|
13516
|
+
probes,
|
|
13517
|
+
...occupancyMeasuredCodeNames.length > 0 ? { occupancy_measured_code_names: occupancyMeasuredCodeNames } : {}
|
|
13518
|
+
}).catch((err) => {
|
|
13488
13519
|
for (const [codeName, count] of drainedGiveUps) {
|
|
13489
13520
|
creditWatchdogGiveUpCount(codeName, count);
|
|
13490
13521
|
}
|
|
@@ -13823,6 +13854,7 @@ async function pollCycle() {
|
|
|
13823
13854
|
const agentStates = [];
|
|
13824
13855
|
const fastRespawn = hostFlagStore().getBoolean("fast-mcp-restart-respawn");
|
|
13825
13856
|
const processOrder = fastRespawn ? reorderRestartedFirst(agents, new Set(restartAcks.keys())) : agents;
|
|
13857
|
+
const managedToolkits = createManagedToolkitReader(agents.map((a) => a.agent_id));
|
|
13826
13858
|
for (const agent of processOrder) {
|
|
13827
13859
|
if (restartInFlight.has(agent.agent_id)) {
|
|
13828
13860
|
const existing = state7.agents.find((a) => a.agentId === agent.agent_id);
|
|
@@ -13832,7 +13864,7 @@ async function pollCycle() {
|
|
|
13832
13864
|
}
|
|
13833
13865
|
}
|
|
13834
13866
|
try {
|
|
13835
|
-
await processAgent(agent, agentStates);
|
|
13867
|
+
await processAgent(agent, agentStates, managedToolkits);
|
|
13836
13868
|
} catch (err) {
|
|
13837
13869
|
log(`Error processing agent '${agent.code_name}': ${err.message}`);
|
|
13838
13870
|
const existing = state7.agents.find((a) => a.agentId === agent.agent_id);
|
|
@@ -14069,7 +14101,45 @@ async function getOrCacheRegisteredAgents(adapter, profile) {
|
|
|
14069
14101
|
}
|
|
14070
14102
|
return cached;
|
|
14071
14103
|
}
|
|
14072
|
-
async function
|
|
14104
|
+
async function fetchManagedToolkits(agentIds) {
|
|
14105
|
+
const data = await api.post(
|
|
14106
|
+
"/host/managed-toolkits",
|
|
14107
|
+
{ agent_ids: [...agentIds] }
|
|
14108
|
+
);
|
|
14109
|
+
return data.toolkits ?? [];
|
|
14110
|
+
}
|
|
14111
|
+
function createManagedToolkitReader(agentIds, fetchToolkits = fetchManagedToolkits) {
|
|
14112
|
+
const requested = [...new Set(agentIds)];
|
|
14113
|
+
let batch = null;
|
|
14114
|
+
const loadBatch = () => {
|
|
14115
|
+
batch ??= (async () => {
|
|
14116
|
+
if (requested.length === 0) return /* @__PURE__ */ new Map();
|
|
14117
|
+
try {
|
|
14118
|
+
const toolkits = await fetchToolkits(requested);
|
|
14119
|
+
const byAgent = new Map(
|
|
14120
|
+
requested.map((id) => [id, []])
|
|
14121
|
+
);
|
|
14122
|
+
for (const tk of toolkits) byAgent.get(tk.agent_id)?.push(tk);
|
|
14123
|
+
return byAgent;
|
|
14124
|
+
} catch (err) {
|
|
14125
|
+
log(
|
|
14126
|
+
`[managed-toolkit] batch fetch for ${requested.length} agent(s) failed: ${err.message} \u2014 falling back to per-agent fetches this cycle (ENG-9057)`
|
|
14127
|
+
);
|
|
14128
|
+
return null;
|
|
14129
|
+
}
|
|
14130
|
+
})();
|
|
14131
|
+
return batch;
|
|
14132
|
+
};
|
|
14133
|
+
return {
|
|
14134
|
+
async forAgent(agentId) {
|
|
14135
|
+
const byAgent = await loadBatch();
|
|
14136
|
+
const fromBatch = byAgent?.get(agentId);
|
|
14137
|
+
if (fromBatch) return fromBatch;
|
|
14138
|
+
return (await fetchToolkits([agentId])).filter((tk) => tk.agent_id === agentId);
|
|
14139
|
+
}
|
|
14140
|
+
};
|
|
14141
|
+
}
|
|
14142
|
+
async function processAgent(agent, agentStates, managedToolkits) {
|
|
14073
14143
|
if (!config) return;
|
|
14074
14144
|
const renderIntegrationsSection = shouldRenderIntegrationsSection();
|
|
14075
14145
|
syncAccountEnforcementMarker(
|
|
@@ -14079,6 +14149,8 @@ async function processAgent(agent, agentStates) {
|
|
|
14079
14149
|
agent.enforcement_text ?? null
|
|
14080
14150
|
);
|
|
14081
14151
|
const previousKnownStatus = agentState.knownStatuses.get(agent.agent_id);
|
|
14152
|
+
if (agent.status === "active") notRunningCodeNames.delete(agent.code_name);
|
|
14153
|
+
else notRunningCodeNames.add(agent.code_name);
|
|
14082
14154
|
agentState.agentDisplayNames.set(agent.code_name, agent.display_name);
|
|
14083
14155
|
agentState.codeNameToAgentId.set(agent.code_name, agent.agent_id);
|
|
14084
14156
|
maybeClearStaleTrip(agent);
|
|
@@ -15353,8 +15425,7 @@ async function processAgent(agent, agentStates) {
|
|
|
15353
15425
|
const fwForMcp = agentFrameworkCache.get(agent.code_name) ?? DEFAULT_FRAMEWORK;
|
|
15354
15426
|
if (frameworkAdapter.writeMcpServer) {
|
|
15355
15427
|
try {
|
|
15356
|
-
const
|
|
15357
|
-
const agentToolkits = (toolkitData.toolkits ?? []).filter((tk) => tk.agent_id === agent.agent_id);
|
|
15428
|
+
const agentToolkits = await managedToolkits.forAgent(agent.agent_id);
|
|
15358
15429
|
const expectedServerIds = /* @__PURE__ */ new Set();
|
|
15359
15430
|
const desiredEntries = [];
|
|
15360
15431
|
for (const tk of agentToolkits) {
|
|
@@ -18679,6 +18750,7 @@ export {
|
|
|
18679
18750
|
claudeCodeUpgradeMarkerPath,
|
|
18680
18751
|
claudeCodeUpgradeThrottled,
|
|
18681
18752
|
claudeManagedSettingsPath,
|
|
18753
|
+
createManagedToolkitReader,
|
|
18682
18754
|
dashboardRestartBreakerReason,
|
|
18683
18755
|
decideDayRolloverAction,
|
|
18684
18756
|
ensureClaudeManagedSettings,
|