@integrity-labs/agt-cli 0.28.523 → 0.28.524
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-QYQR4BWM.js";
|
|
44
44
|
import {
|
|
45
45
|
AnchorSessionClient,
|
|
46
46
|
CHANNEL_REGISTRY,
|
|
@@ -4834,7 +4834,7 @@ import { execFileSync, execSync } from "child_process";
|
|
|
4834
4834
|
import { existsSync as existsSync10, realpathSync as realpathSync2 } from "fs";
|
|
4835
4835
|
import chalk18 from "chalk";
|
|
4836
4836
|
import ora16 from "ora";
|
|
4837
|
-
var cliVersion = true ? "0.28.
|
|
4837
|
+
var cliVersion = true ? "0.28.524" : "dev";
|
|
4838
4838
|
async function fetchLatestVersion() {
|
|
4839
4839
|
const host2 = getHost();
|
|
4840
4840
|
if (!host2) return null;
|
|
@@ -6006,7 +6006,7 @@ function handleError(err) {
|
|
|
6006
6006
|
}
|
|
6007
6007
|
|
|
6008
6008
|
// src/bin/agt.ts
|
|
6009
|
-
var cliVersion2 = true ? "0.28.
|
|
6009
|
+
var cliVersion2 = true ? "0.28.524" : "dev";
|
|
6010
6010
|
var program = new Command();
|
|
6011
6011
|
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");
|
|
6012
6012
|
program.hook("preAction", async (thisCommand, actionCommand) => {
|
|
@@ -5317,7 +5317,7 @@ function exchangeFailureKind(err) {
|
|
|
5317
5317
|
}
|
|
5318
5318
|
|
|
5319
5319
|
// src/lib/api-client.ts
|
|
5320
|
-
var agtCliVersion = true ? "0.28.
|
|
5320
|
+
var agtCliVersion = true ? "0.28.524" : "dev";
|
|
5321
5321
|
var lastConfigHash = null;
|
|
5322
5322
|
function setConfigHash(hash) {
|
|
5323
5323
|
lastConfigHash = hash && hash.length > 0 ? hash : null;
|
|
@@ -8629,4 +8629,4 @@ export {
|
|
|
8629
8629
|
managerInstallSystemUnitCommand,
|
|
8630
8630
|
managerUninstallSystemUnitCommand
|
|
8631
8631
|
};
|
|
8632
|
-
//# sourceMappingURL=chunk-
|
|
8632
|
+
//# sourceMappingURL=chunk-QYQR4BWM.js.map
|
|
@@ -53,7 +53,7 @@ import {
|
|
|
53
53
|
safeWriteJsonAtomic,
|
|
54
54
|
setConfigHash,
|
|
55
55
|
tripClass
|
|
56
|
-
} from "../chunk-
|
|
56
|
+
} from "../chunk-QYQR4BWM.js";
|
|
57
57
|
import {
|
|
58
58
|
getProjectDir as getProjectDir2,
|
|
59
59
|
getReadyTasks,
|
|
@@ -9567,6 +9567,7 @@ var RESTART_DEFER_RECHECK_MS = 6e4;
|
|
|
9567
9567
|
var DEFER_LOG_THROTTLE_MS = 6e5;
|
|
9568
9568
|
var deferLogThrottle = /* @__PURE__ */ new Map();
|
|
9569
9569
|
var lastInboundMs = /* @__PURE__ */ new Map();
|
|
9570
|
+
var pendingDayRolloverReset = /* @__PURE__ */ new Set();
|
|
9570
9571
|
var consecutiveWedgeCycles = /* @__PURE__ */ new Map();
|
|
9571
9572
|
var wedgeExemptionLogged = /* @__PURE__ */ new Set();
|
|
9572
9573
|
var wedgeRestartsByCard = /* @__PURE__ */ new Map();
|
|
@@ -9578,6 +9579,66 @@ function inboundAgeSecondsFor(codeName) {
|
|
|
9578
9579
|
if (ts === void 0) return null;
|
|
9579
9580
|
return Math.max(0, Math.floor((Date.now() - ts) / 1e3));
|
|
9580
9581
|
}
|
|
9582
|
+
function decideDayRolloverAction(i) {
|
|
9583
|
+
if (!i.staleForToday || !i.sessionHealthy || !i.hasCurrent) return "none";
|
|
9584
|
+
if (i.idle) return "defer-idle";
|
|
9585
|
+
return i.overdueMin >= i.graceMin ? "force-reset" : "busy-wait";
|
|
9586
|
+
}
|
|
9587
|
+
function classifyLazyDayRolloverReset(i) {
|
|
9588
|
+
if (!i.flagged) return "skip";
|
|
9589
|
+
if (!i.sessionHealthy) return "clear-stale";
|
|
9590
|
+
if (!i.staleForToday) return "clear-stale";
|
|
9591
|
+
if (!i.hasCurrent) return "skip";
|
|
9592
|
+
return i.idle ? "reset" : "skip";
|
|
9593
|
+
}
|
|
9594
|
+
function resolveEffectiveAgentTimezone(inputs) {
|
|
9595
|
+
const orgTierTz = cachedMaintenanceWindow?.timezone ?? null;
|
|
9596
|
+
const ownTzEffective = isAgentTimezoneOverrideExpired(inputs.agentTimezoneExpiresAt) ? null : inputs.agentTimezone;
|
|
9597
|
+
if (isUnsetTimezone(ownTzEffective) && isUnsetTimezone(inputs.teamTimezone) && isUnsetTimezone(orgTierTz)) {
|
|
9598
|
+
return void 0;
|
|
9599
|
+
}
|
|
9600
|
+
return resolveAgentTimezone(
|
|
9601
|
+
ownTzEffective,
|
|
9602
|
+
inputs.teamTimezone,
|
|
9603
|
+
orgTierTz,
|
|
9604
|
+
inputs.agentTimezoneExpiresAt
|
|
9605
|
+
);
|
|
9606
|
+
}
|
|
9607
|
+
function cachedAgentTimezoneFor(codeName) {
|
|
9608
|
+
const inputs = agentRestartTimezoneInputs.get(codeName);
|
|
9609
|
+
if (!inputs) return void 0;
|
|
9610
|
+
return resolveEffectiveAgentTimezone({
|
|
9611
|
+
agentTimezone: inputs.agentTimezone,
|
|
9612
|
+
teamTimezone: inputs.teamTimezone,
|
|
9613
|
+
agentTimezoneExpiresAt: inputs.agentTimezoneExpiresAt
|
|
9614
|
+
});
|
|
9615
|
+
}
|
|
9616
|
+
function performLazyDayRolloverReset(codeName, agentTimezone) {
|
|
9617
|
+
const flagged = pendingDayRolloverReset.has(codeName);
|
|
9618
|
+
const sessionHealthy = flagged && isSessionHealthy(codeName);
|
|
9619
|
+
const staleForToday = flagged ? isStaleForToday(codeName, /* @__PURE__ */ new Date(), agentTimezone ?? void 0) : false;
|
|
9620
|
+
const current = flagged && sessionHealthy && staleForToday ? peekCurrentSession(codeName) : null;
|
|
9621
|
+
const outcome = classifyLazyDayRolloverReset({
|
|
9622
|
+
flagged,
|
|
9623
|
+
staleForToday,
|
|
9624
|
+
sessionHealthy,
|
|
9625
|
+
hasCurrent: current !== null,
|
|
9626
|
+
idle: current ? isAgentIdle(getProjectDir(codeName), current.sessionId) : false
|
|
9627
|
+
});
|
|
9628
|
+
if (outcome === "clear-stale") {
|
|
9629
|
+
pendingDayRolloverReset.delete(codeName);
|
|
9630
|
+
return false;
|
|
9631
|
+
}
|
|
9632
|
+
if (outcome === "skip" || !current) return false;
|
|
9633
|
+
log(
|
|
9634
|
+
`[persistent-session] Day rollover for '${codeName}' (yesterday=${current.date}) \u2014 first real trigger after an idle rollover; minting a fresh session now (deferred boot, paid alongside real work) [ENG-8461]`
|
|
9635
|
+
);
|
|
9636
|
+
stopPersistentSessionAndForgetMcpBaseline(codeName, "day-rollover");
|
|
9637
|
+
agentState.persistentSessionAgents.delete(codeName);
|
|
9638
|
+
rotatePaneLogForDayRollover(codeName, log, agentTimezone);
|
|
9639
|
+
pendingDayRolloverReset.delete(codeName);
|
|
9640
|
+
return true;
|
|
9641
|
+
}
|
|
9581
9642
|
function paneLogAgeSecondsFor(codeName) {
|
|
9582
9643
|
try {
|
|
9583
9644
|
const mtimeMs = statSync6(paneLogPath(codeName)).mtimeMs;
|
|
@@ -10106,7 +10167,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
|
|
|
10106
10167
|
var lastVersionCheckAt = 0;
|
|
10107
10168
|
var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
|
|
10108
10169
|
var lastResponsivenessProbeAt = 0;
|
|
10109
|
-
var agtCliVersion = true ? "0.28.
|
|
10170
|
+
var agtCliVersion = true ? "0.28.524" : "dev";
|
|
10110
10171
|
function resolveBrewPath(execFileSync2) {
|
|
10111
10172
|
try {
|
|
10112
10173
|
const out = execFileSync2("which", ["brew"], { timeout: 5e3 }).toString().trim();
|
|
@@ -14505,14 +14566,13 @@ async function ensurePersistentSession(agent, tasks, boardItems, refreshData) {
|
|
|
14505
14566
|
const ownTz = typeof ownTzRaw === "string" && ownTzRaw.trim() !== "" ? ownTzRaw.trim() : null;
|
|
14506
14567
|
const tz = teamSettingsForTz?.["timezone"];
|
|
14507
14568
|
const teamTz = typeof tz === "string" && tz.trim() !== "" ? tz.trim() : null;
|
|
14508
|
-
const orgTierTz = cachedMaintenanceWindow?.timezone ?? null;
|
|
14509
14569
|
const ownTzExpiresAtRaw = refreshData.agent?.timezone_expires_at;
|
|
14510
14570
|
const ownTzExpiresAt = typeof ownTzExpiresAtRaw === "string" && ownTzExpiresAtRaw.trim() !== "" ? ownTzExpiresAtRaw : null;
|
|
14511
|
-
|
|
14512
|
-
|
|
14513
|
-
|
|
14514
|
-
|
|
14515
|
-
|
|
14571
|
+
return resolveEffectiveAgentTimezone({
|
|
14572
|
+
agentTimezone: ownTz,
|
|
14573
|
+
teamTimezone: teamTz,
|
|
14574
|
+
agentTimezoneExpiresAt: ownTzExpiresAt
|
|
14575
|
+
});
|
|
14516
14576
|
})();
|
|
14517
14577
|
const frameworkId = agentFrameworkCache.get(codeName) ?? DEFAULT_FRAMEWORK;
|
|
14518
14578
|
if (frameworkId === "opencode") {
|
|
@@ -14649,35 +14709,40 @@ async function ensurePersistentSession(agent, tasks, boardItems, refreshData) {
|
|
|
14649
14709
|
agentState.persistentSessionAgents.delete(codeName);
|
|
14650
14710
|
restartTrigger = "auth-tuple";
|
|
14651
14711
|
}
|
|
14652
|
-
|
|
14653
|
-
|
|
14654
|
-
|
|
14655
|
-
|
|
14656
|
-
|
|
14657
|
-
|
|
14658
|
-
|
|
14659
|
-
|
|
14660
|
-
|
|
14661
|
-
|
|
14662
|
-
|
|
14663
|
-
|
|
14664
|
-
|
|
14665
|
-
|
|
14666
|
-
|
|
14667
|
-
|
|
14668
|
-
|
|
14669
|
-
|
|
14670
|
-
|
|
14671
|
-
restartTrigger = "day-rollover";
|
|
14672
|
-
dayRolloverForced = true;
|
|
14673
|
-
} else {
|
|
14674
|
-
log(
|
|
14675
|
-
`[persistent-session] Day rollover for '${codeName}' deferred \u2014 agent still active on session ${current.sessionId} (${overdueMin}m past boundary, will force at ${DAY_ROLLOVER_FORCE_GRACE_MIN}m)`
|
|
14676
|
-
);
|
|
14677
|
-
dayRolloverDeferred = true;
|
|
14678
|
-
}
|
|
14679
|
-
}
|
|
14712
|
+
const staleForToday = isStaleForToday(codeName, /* @__PURE__ */ new Date(), agentTimezone);
|
|
14713
|
+
if (!staleForToday) pendingDayRolloverReset.delete(codeName);
|
|
14714
|
+
const rolloverSessionHealthy = isSessionHealthy(codeName);
|
|
14715
|
+
const rolloverCurrent = staleForToday && rolloverSessionHealthy ? peekCurrentSession(codeName) : null;
|
|
14716
|
+
const overdueMin = rolloverCurrent ? minutesSinceLocalMidnight(/* @__PURE__ */ new Date(), agentTimezone) : 0;
|
|
14717
|
+
const rolloverDecision = decideDayRolloverAction({
|
|
14718
|
+
staleForToday,
|
|
14719
|
+
sessionHealthy: rolloverSessionHealthy,
|
|
14720
|
+
hasCurrent: rolloverCurrent !== null,
|
|
14721
|
+
idle: rolloverCurrent ? isAgentIdle(projectDir, rolloverCurrent.sessionId) : false,
|
|
14722
|
+
overdueMin,
|
|
14723
|
+
graceMin: DAY_ROLLOVER_FORCE_GRACE_MIN
|
|
14724
|
+
});
|
|
14725
|
+
if (rolloverDecision === "defer-idle" && rolloverCurrent) {
|
|
14726
|
+
if (!pendingDayRolloverReset.has(codeName)) {
|
|
14727
|
+
pendingDayRolloverReset.add(codeName);
|
|
14728
|
+
log(
|
|
14729
|
+
`[persistent-session] Day rollover for '${codeName}' (yesterday=${rolloverCurrent.date}) \u2014 agent idle; keeping the warm session and deferring the fresh-session mint to the first real trigger (no boot booked as utilization) [ENG-8461]`
|
|
14730
|
+
);
|
|
14680
14731
|
}
|
|
14732
|
+
} else if (rolloverDecision === "force-reset" && rolloverCurrent) {
|
|
14733
|
+
log(
|
|
14734
|
+
`[persistent-session] Day rollover FORCED for '${codeName}' (yesterday=${rolloverCurrent.date}) \u2014 agent busy-blocked ${overdueMin}m past the day boundary (grace ${DAY_ROLLOVER_FORCE_GRACE_MIN}m), restarting anyway to reset context`
|
|
14735
|
+
);
|
|
14736
|
+
stopPersistentSessionAndForgetMcpBaseline(codeName, "day-rollover");
|
|
14737
|
+
agentState.persistentSessionAgents.delete(codeName);
|
|
14738
|
+
pendingDayRolloverReset.delete(codeName);
|
|
14739
|
+
restartTrigger = "day-rollover";
|
|
14740
|
+
dayRolloverForced = true;
|
|
14741
|
+
} else if (rolloverDecision === "busy-wait" && rolloverCurrent) {
|
|
14742
|
+
log(
|
|
14743
|
+
`[persistent-session] Day rollover for '${codeName}' deferred \u2014 agent still active on session ${rolloverCurrent.sessionId} (${overdueMin}m past boundary, will force at ${DAY_ROLLOVER_FORCE_GRACE_MIN}m)`
|
|
14744
|
+
);
|
|
14745
|
+
dayRolloverDeferred = true;
|
|
14681
14746
|
}
|
|
14682
14747
|
if (restartTrigger === "day-rollover") {
|
|
14683
14748
|
rotatePaneLogForDayRollover(codeName, log, agentTimezone);
|
|
@@ -14897,7 +14962,15 @@ ${truncateForLog(ctx.tail)}` : `; pane_tail_hash=sha256:${createHash16("sha256")
|
|
|
14897
14962
|
deferReadyForUsageCap = true;
|
|
14898
14963
|
}
|
|
14899
14964
|
}
|
|
14900
|
-
|
|
14965
|
+
let deferReadyForRollover = false;
|
|
14966
|
+
if (!deferReadyForUsageCap && ready.length > 0 && performLazyDayRolloverReset(codeName, agentTimezone)) {
|
|
14967
|
+
restartTrigger = "day-rollover";
|
|
14968
|
+
deferReadyForRollover = true;
|
|
14969
|
+
log(
|
|
14970
|
+
`[persistent-session] Deferring ${ready.length} ready task(s) for '${codeName}' \u2014 minting a fresh session after an idle day-rollover; schedule NOT advanced, task fires on the fresh session next tick [ENG-8461]`
|
|
14971
|
+
);
|
|
14972
|
+
}
|
|
14973
|
+
for (const task of deferReadyForUsageCap || deferReadyForRollover ? [] : ready) {
|
|
14901
14974
|
if (KANBAN_WORK_TEMPLATES.has(task.templateId)) {
|
|
14902
14975
|
const updated = markTaskFired(codeName, task.taskId, "ok");
|
|
14903
14976
|
claudeSchedulerStates.set(codeName, updated);
|
|
@@ -15485,6 +15558,12 @@ async function processDirectChatMessage(agent, msg) {
|
|
|
15485
15558
|
await processDirectChatMessageOpencode(agent, msg);
|
|
15486
15559
|
return;
|
|
15487
15560
|
}
|
|
15561
|
+
if (performLazyDayRolloverReset(agent.codeName, cachedAgentTimezoneFor(agent.codeName))) {
|
|
15562
|
+
log(
|
|
15563
|
+
`[direct-chat] Reset '${agent.codeName}' to a fresh session on first inbound after an idle day-rollover (msg=${msg.id}) \u2014 leaving pending for durable replay on the fresh session [ENG-8461]`
|
|
15564
|
+
);
|
|
15565
|
+
return;
|
|
15566
|
+
}
|
|
15488
15567
|
if (isSessionHealthy(agent.codeName)) {
|
|
15489
15568
|
const useDoorbell = hostFlagStore().getBoolean("direct-chat-doorbell") || isolationMode(agent.codeName) === "docker";
|
|
15490
15569
|
if (useDoorbell) {
|
|
@@ -16599,10 +16678,12 @@ export {
|
|
|
16599
16678
|
DAY_ROLLOVER_FORCE_GRACE_MIN,
|
|
16600
16679
|
applyRestartAcks,
|
|
16601
16680
|
cancelKanbanNoticeOnDrain,
|
|
16681
|
+
classifyLazyDayRolloverReset,
|
|
16602
16682
|
claudeCodeUpgradeMarkerPath,
|
|
16603
16683
|
claudeCodeUpgradeThrottled,
|
|
16604
16684
|
claudeManagedSettingsPath,
|
|
16605
16685
|
dashboardRestartBreakerReason,
|
|
16686
|
+
decideDayRolloverAction,
|
|
16606
16687
|
ensureClaudeManagedSettings,
|
|
16607
16688
|
extractCharterSlackPeers,
|
|
16608
16689
|
extractCharterTelegramPeers,
|