@integrity-labs/agt-cli 0.28.913 → 0.28.915

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-7ERR62SH.js";
43
+ } from "../chunk-5BM2FB2R.js";
44
44
  import {
45
45
  getProjectDir,
46
46
  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.913" : "dev";
5470
+ var cliVersion = true ? "0.28.915" : "dev";
5471
5471
  async function fetchLatestVersion() {
5472
5472
  const host2 = getHost();
5473
5473
  if (!host2) return null;
@@ -6682,7 +6682,7 @@ function handleError(err) {
6682
6682
  }
6683
6683
 
6684
6684
  // src/bin/agt.ts
6685
- var cliVersion2 = true ? "0.28.913" : "dev";
6685
+ var cliVersion2 = true ? "0.28.915" : "dev";
6686
6686
  var program = new Command();
6687
6687
  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");
6688
6688
  program.hook("preAction", async (thisCommand, actionCommand) => {
@@ -6841,7 +6841,7 @@ function exchangeFailureKind(err) {
6841
6841
  }
6842
6842
 
6843
6843
  // src/lib/api-client.ts
6844
- var agtCliVersion = true ? "0.28.913" : "dev";
6844
+ var agtCliVersion = true ? "0.28.915" : "dev";
6845
6845
  var lastConfigHash = null;
6846
6846
  function setConfigHash(hash) {
6847
6847
  lastConfigHash = hash && hash.length > 0 ? hash : null;
@@ -11451,4 +11451,4 @@ export {
11451
11451
  managerInstallSystemUnitCommand,
11452
11452
  managerUninstallSystemUnitCommand
11453
11453
  };
11454
- //# sourceMappingURL=chunk-7ERR62SH.js.map
11454
+ //# sourceMappingURL=chunk-5BM2FB2R.js.map
@@ -63,7 +63,7 @@ import {
63
63
  safeWriteJsonAtomic,
64
64
  setConfigHash,
65
65
  tripClass
66
- } from "../chunk-7ERR62SH.js";
66
+ } from "../chunk-5BM2FB2R.js";
67
67
  import {
68
68
  getProjectDir as getProjectDir2,
69
69
  getReadyTasks,
@@ -13818,7 +13818,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
13818
13818
  var lastVersionCheckAt = 0;
13819
13819
  var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
13820
13820
  var lastResponsivenessProbeAt = 0;
13821
- var agtCliVersion = true ? "0.28.913" : "dev";
13821
+ var agtCliVersion = true ? "0.28.915" : "dev";
13822
13822
  function resolveBrewPath(execFileSync2) {
13823
13823
  try {
13824
13824
  const out = execFileSync2("which", ["brew"], { timeout: 5e3 }).toString().trim();
@@ -88,6 +88,68 @@ function logErr(msg) {
88
88
  process.stderr.write(`[remote-oauth-proxy:${label}] ${msg}
89
89
  `);
90
90
  }
91
+ function describeWriteError(err) {
92
+ const code = err?.code;
93
+ const msg = err instanceof Error ? err.message : String(err);
94
+ return typeof code === "string" ? `${code}: ${msg}` : msg;
95
+ }
96
+ var stdoutWriteFailures = 0;
97
+ function writeFailureCount() {
98
+ return stdoutWriteFailures;
99
+ }
100
+ function handleStdoutWriteFailure(err) {
101
+ stdoutWriteFailures += 1;
102
+ logErr(`stdout write FAILED (${describeWriteError(err)}); reply dropped, proxy continuing`);
103
+ if (err?.code === "EPIPE") {
104
+ logErr("stdout is closed (EPIPE) - the transport peer is gone; exiting rather than running silent");
105
+ process.exit(1);
106
+ }
107
+ }
108
+ function createReplyWriter(write, onFailure, waitForDrain = () => Promise.resolve()) {
109
+ const report = (err) => {
110
+ try {
111
+ onFailure(err);
112
+ } catch {
113
+ }
114
+ };
115
+ let writeLock = Promise.resolve();
116
+ return (replies) => {
117
+ writeLock = writeLock.then(async () => {
118
+ for (const reply of replies) {
119
+ try {
120
+ if (write(reply + "\n") === false) await waitForDrain();
121
+ } catch (err) {
122
+ report(err);
123
+ }
124
+ }
125
+ }).catch((err) => {
126
+ report(err);
127
+ });
128
+ return writeLock;
129
+ };
130
+ }
131
+ function awaitDrain(out) {
132
+ if (out.destroyed) return Promise.resolve();
133
+ return new Promise((resolve) => {
134
+ const done = () => {
135
+ out.off("drain", done);
136
+ out.off("error", done);
137
+ out.off("close", done);
138
+ resolve();
139
+ };
140
+ out.on("drain", done);
141
+ out.on("error", done);
142
+ out.on("close", done);
143
+ });
144
+ }
145
+ function createStdoutReplyWriter(out = process.stdout) {
146
+ out.on("error", handleStdoutWriteFailure);
147
+ return createReplyWriter(
148
+ (chunk) => out.write(chunk),
149
+ handleStdoutWriteFailure,
150
+ () => awaitDrain(out)
151
+ );
152
+ }
91
153
  function parsePreEnableToolsets(raw) {
92
154
  const seen = /* @__PURE__ */ new Set();
93
155
  const out = [];
@@ -500,13 +562,7 @@ async function main() {
500
562
  process.exit(1);
501
563
  }
502
564
  const rl = createInterface({ input: process.stdin, crlfDelay: Infinity });
503
- let writeLock = Promise.resolve();
504
- const writeReplies = (replies) => {
505
- writeLock = writeLock.then(() => {
506
- for (const reply of replies) process.stdout.write(reply + "\n");
507
- });
508
- return writeLock;
509
- };
565
+ const writeReplies = createStdoutReplyWriter();
510
566
  const inflight = /* @__PURE__ */ new Set();
511
567
  rl.on("line", (line) => {
512
568
  const text = line.trim();
@@ -539,7 +595,7 @@ async function main() {
539
595
  });
540
596
  await new Promise((resolve) => rl.on("close", () => resolve()));
541
597
  await Promise.all([...inflight]);
542
- await writeLock;
598
+ await writeReplies([]);
543
599
  }
544
600
  var invokedDirectly = (() => {
545
601
  try {
@@ -556,15 +612,20 @@ if (invokedDirectly) {
556
612
  export {
557
613
  ACTIVATION_TOOL,
558
614
  activationRefusalMessage,
615
+ awaitDrain,
559
616
  buildEnableToolsetRequest,
560
617
  buildForwardHeaders,
561
618
  buildToolsListRequest,
562
619
  callRefusal,
563
620
  claimGroupTools,
621
+ createReplyWriter,
622
+ createStdoutReplyWriter,
623
+ describeWriteError,
564
624
  extractJsonRpcMessages,
565
625
  extractToolsArray,
566
626
  filterToolsListMessage,
567
627
  forward,
628
+ handleStdoutWriteFailure,
568
629
  isManagedActivationCall,
569
630
  isToolArgRejected,
570
631
  isToolCallBlocked,
@@ -576,5 +637,6 @@ export {
576
637
  parseToolAllowlist,
577
638
  readCurrentToken,
578
639
  stripActivationTool,
579
- toolName
640
+ toolName,
641
+ writeFailureCount
580
642
  };
@@ -43658,6 +43658,7 @@ function createReconcileIdentityClient(args) {
43658
43658
  signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS5)
43659
43659
  });
43660
43660
  }
43661
+ const RETRYABLE_OUTCOMES = /* @__PURE__ */ new Set(["ambiguous", "no_row"]);
43661
43662
  async function emit(args2) {
43662
43663
  const body = {
43663
43664
  agent_id: agentId,
@@ -43675,9 +43676,17 @@ function createReconcileIdentityClient(args) {
43675
43676
  if (!resp.ok) {
43676
43677
  const text = await resp.text().catch(() => "");
43677
43678
  log(`reconcile-identity: POST failed (${resp.status}) platform=${args2.platform}: ${text.slice(0, 200)}`);
43679
+ args2.onRetryable?.();
43680
+ return;
43681
+ }
43682
+ const outcome = await resp.json().then((d) => d.outcome).catch(() => void 0);
43683
+ if (typeof outcome === "string" && RETRYABLE_OUTCOMES.has(outcome)) {
43684
+ log(`reconcile-identity: outcome=${outcome} sender=${args2.senderId} \u2014 will retry on a later message`);
43685
+ args2.onRetryable?.();
43678
43686
  }
43679
43687
  } catch (err) {
43680
43688
  log(`reconcile-identity: emit threw platform=${args2.platform}: ${err.message}`);
43689
+ args2.onRetryable?.();
43681
43690
  }
43682
43691
  }
43683
43692
  return {
@@ -49318,7 +49327,12 @@ async function connectSocketMode() {
49318
49327
  reconciledSlackSenders.add(senderId);
49319
49328
  void resolveUserEmail(senderId).then((email2) => {
49320
49329
  if (email2) {
49321
- reconcileIdentityClient.reconcile({ platform: "slack", senderId, email: email2 });
49330
+ reconcileIdentityClient.reconcile({
49331
+ platform: "slack",
49332
+ senderId,
49333
+ email: email2,
49334
+ onRetryable: () => reconciledSlackSenders.delete(senderId)
49335
+ });
49322
49336
  } else {
49323
49337
  reconciledSlackSenders.delete(senderId);
49324
49338
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@integrity-labs/agt-cli",
3
- "version": "0.28.913",
3
+ "version": "0.28.915",
4
4
  "description": "Augmented Team CLI — agent provisioning and management",
5
5
  "type": "module",
6
6
  "engines": {