@integrity-labs/agt-cli 0.28.748 → 0.28.749

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
@@ -41,7 +41,7 @@ import {
41
41
  success,
42
42
  table,
43
43
  warn
44
- } from "../chunk-G7GWXCPV.js";
44
+ } from "../chunk-WTBSFYTA.js";
45
45
  import {
46
46
  getProjectDir,
47
47
  isSessionResumeDisabled,
@@ -5467,7 +5467,7 @@ import { execFileSync, execSync } from "child_process";
5467
5467
  import { existsSync as existsSync11, realpathSync as realpathSync2 } from "fs";
5468
5468
  import chalk18 from "chalk";
5469
5469
  import ora16 from "ora";
5470
- var cliVersion = true ? "0.28.748" : "dev";
5470
+ var cliVersion = true ? "0.28.749" : "dev";
5471
5471
  async function fetchLatestVersion() {
5472
5472
  const host2 = getHost();
5473
5473
  if (!host2) return null;
@@ -6654,7 +6654,7 @@ function handleError(err) {
6654
6654
  }
6655
6655
 
6656
6656
  // src/bin/agt.ts
6657
- var cliVersion2 = true ? "0.28.748" : "dev";
6657
+ var cliVersion2 = true ? "0.28.749" : "dev";
6658
6658
  var program = new Command();
6659
6659
  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");
6660
6660
  program.hook("preAction", async (thisCommand, actionCommand) => {
@@ -6430,7 +6430,7 @@ function exchangeFailureKind(err) {
6430
6430
  }
6431
6431
 
6432
6432
  // src/lib/api-client.ts
6433
- var agtCliVersion = true ? "0.28.748" : "dev";
6433
+ var agtCliVersion = true ? "0.28.749" : "dev";
6434
6434
  var lastConfigHash = null;
6435
6435
  function setConfigHash(hash) {
6436
6436
  lastConfigHash = hash && hash.length > 0 ? hash : null;
@@ -10476,4 +10476,4 @@ export {
10476
10476
  managerInstallSystemUnitCommand,
10477
10477
  managerUninstallSystemUnitCommand
10478
10478
  };
10479
- //# sourceMappingURL=chunk-G7GWXCPV.js.map
10479
+ //# sourceMappingURL=chunk-WTBSFYTA.js.map
@@ -57,7 +57,7 @@ import {
57
57
  safeWriteJsonAtomic,
58
58
  setConfigHash,
59
59
  tripClass
60
- } from "../chunk-G7GWXCPV.js";
60
+ } from "../chunk-WTBSFYTA.js";
61
61
  import {
62
62
  getProjectDir as getProjectDir2,
63
63
  getReadyTasks,
@@ -4010,6 +4010,39 @@ function detectMissedIdentifiers(turns, candidates) {
4010
4010
  }
4011
4011
  return out;
4012
4012
  }
4013
+ async function salvageIdentifiers(args) {
4014
+ const forced = detectMissedIdentifiers(args.turns, []);
4015
+ if (forced.length === 0) return 0;
4016
+ const scrubbed = forced.map((c) => ({
4017
+ ...c,
4018
+ content: scrubSensitive(c.content),
4019
+ rationale: scrubSensitive(c.rationale)
4020
+ }));
4021
+ try {
4022
+ const res = await args.api.post(
4023
+ "/host/memories/identifiers",
4024
+ {
4025
+ agent_id: args.agentId,
4026
+ conversation_id: args.conversationId,
4027
+ candidates: scrubbed
4028
+ }
4029
+ );
4030
+ if (!res?.ok) return 0;
4031
+ return res.promoted ?? 0;
4032
+ } catch {
4033
+ return 0;
4034
+ }
4035
+ }
4036
+ async function salvageOnce(st, conversationId, fn) {
4037
+ if (st.salvaged.has(conversationId)) return 0;
4038
+ st.salvaged.add(conversationId);
4039
+ return fn();
4040
+ }
4041
+ function pruneSalvaged(st, stillPending) {
4042
+ for (const id of st.salvaged) {
4043
+ if (!stillPending.has(id)) st.salvaged.delete(id);
4044
+ }
4045
+ }
4013
4046
  async function maybeExtractMemories(args) {
4014
4047
  const { api: api2, backend, codeName, agentId, log: log2 } = args;
4015
4048
  const now = args.now ?? /* @__PURE__ */ new Date();
@@ -4018,7 +4051,8 @@ async function maybeExtractMemories(args) {
4018
4051
  if (existing && nowMs - existing.lastCheckedAt < MIN_CHECK_INTERVAL_MS5) {
4019
4052
  return;
4020
4053
  }
4021
- state5.set(codeName, { lastCheckedAt: nowMs });
4054
+ const st = { lastCheckedAt: nowMs, salvaged: existing?.salvaged ?? /* @__PURE__ */ new Set() };
4055
+ state5.set(codeName, st);
4022
4056
  let pending2;
4023
4057
  try {
4024
4058
  const resp = await api2.get(
@@ -4029,6 +4063,7 @@ async function maybeExtractMemories(args) {
4029
4063
  log2(`[memory-extract] ${codeName}: pending fetch failed: ${err.message}`);
4030
4064
  return;
4031
4065
  }
4066
+ pruneSalvaged(st, new Set(pending2.map((p) => p.conversation_id)));
4032
4067
  if (pending2.length === 0) return;
4033
4068
  const dir = args.transcriptDir ?? sessionTranscriptDir(getProjectDir(codeName));
4034
4069
  const allTurns = readRecentTurns(dir, nowMs);
@@ -4038,6 +4073,7 @@ async function maybeExtractMemories(args) {
4038
4073
  }
4039
4074
  return;
4040
4075
  }
4076
+ let salvaged = 0;
4041
4077
  for (const conv of pending2) {
4042
4078
  const windowStart = Date.parse(conv.started_at) - WINDOW_PAD_MS2;
4043
4079
  const windowEnd = Date.parse(conv.last_message_at) + WINDOW_PAD_MS2;
@@ -4058,10 +4094,20 @@ async function maybeExtractMemories(args) {
4058
4094
  } catch (err) {
4059
4095
  log2(`[memory-extract] ${codeName}: extraction failed: ${err.message}`);
4060
4096
  args.onModelCallError?.(err);
4097
+ salvaged += await salvageOnce(
4098
+ st,
4099
+ conv.conversation_id,
4100
+ () => salvageIdentifiers({ api: api2, agentId, conversationId: conv.conversation_id, turns, log: log2, codeName })
4101
+ );
4061
4102
  continue;
4062
4103
  }
4063
4104
  if (candidates === null) {
4064
4105
  log2(`[memory-extract] ${codeName}: unparseable output for ${conv.conversation_id.slice(0, 8)} \u2014 will retry`);
4106
+ salvaged += await salvageOnce(
4107
+ st,
4108
+ conv.conversation_id,
4109
+ () => salvageIdentifiers({ api: api2, agentId, conversationId: conv.conversation_id, turns, log: log2, codeName })
4110
+ );
4065
4111
  continue;
4066
4112
  }
4067
4113
  const forced = detectMissedIdentifiers(turns, candidates);
@@ -4098,6 +4144,9 @@ async function maybeExtractMemories(args) {
4098
4144
  onModelCallError: args.onModelCallError
4099
4145
  });
4100
4146
  }
4147
+ if (salvaged > 0) {
4148
+ log2(`[memory-extract] ${codeName}: identifiers_salvaged=${salvaged} (model call failed)`);
4149
+ }
4101
4150
  }
4102
4151
  async function reportSkip2(api2, agentId, conversationId, log2, codeName) {
4103
4152
  try {
@@ -13321,7 +13370,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
13321
13370
  var lastVersionCheckAt = 0;
13322
13371
  var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
13323
13372
  var lastResponsivenessProbeAt = 0;
13324
- var agtCliVersion = true ? "0.28.748" : "dev";
13373
+ var agtCliVersion = true ? "0.28.749" : "dev";
13325
13374
  function resolveBrewPath(execFileSync3) {
13326
13375
  try {
13327
13376
  const out = execFileSync3("which", ["brew"], { timeout: 5e3 }).toString().trim();