@integrity-labs/agt-cli 0.27.134 → 0.27.136

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/mcp/index.js CHANGED
@@ -21052,6 +21052,32 @@ function selectIntegrationsToRefresh(input) {
21052
21052
  });
21053
21053
  }
21054
21054
 
21055
+ // src/self-restart.ts
21056
+ import { existsSync, mkdirSync, renameSync, writeFileSync } from "fs";
21057
+ import { homedir } from "os";
21058
+ import { join } from "path";
21059
+ import { randomUUID } from "crypto";
21060
+ function restartFlagsDir() {
21061
+ return join(homedir(), ".augmented", "restart-flags");
21062
+ }
21063
+ function isSelfRestartEnabled(env) {
21064
+ const raw = (env.AGT_AGENT_SELF_RESTART_ENABLED ?? "").trim().toLowerCase();
21065
+ return raw === "true" || raw === "1";
21066
+ }
21067
+ function buildAgentRestartFlag(codeName, reason, nowMs) {
21068
+ return { codeName, source: "agent", ts: nowMs, reason };
21069
+ }
21070
+ function writeAgentRestartFlag(codeName, reason, nowMs) {
21071
+ const dir = restartFlagsDir();
21072
+ if (!existsSync(dir)) mkdirSync(dir, { recursive: true });
21073
+ const path = join(dir, `${codeName}.flag`);
21074
+ const flag = buildAgentRestartFlag(codeName, reason, nowMs);
21075
+ const tmpPath = `${path}.${process.pid}.${randomUUID()}.tmp`;
21076
+ writeFileSync(tmpPath, JSON.stringify(flag) + "\n", "utf8");
21077
+ renameSync(tmpPath, path);
21078
+ return path;
21079
+ }
21080
+
21055
21081
  // src/index.ts
21056
21082
  import { spawn } from "child_process";
21057
21083
  var DeliveryTargetSchema = external_exports.union([
@@ -22387,7 +22413,12 @@ var LOCAL_TOOL_NAMES = /* @__PURE__ */ new Set([
22387
22413
  // ADR-0017 Projects container (the reclaimed projects_* namespace — read-only
22388
22414
  // in v1; no projects_get_source_chunk, a project is a container not a document).
22389
22415
  "projects_list",
22390
- "projects_get"
22416
+ "projects_get",
22417
+ // ENG-6229: self-restart. Conditionally registered (dark unless
22418
+ // AGT_AGENT_SELF_RESTART_ENABLED), but the lockstep guard parses the
22419
+ // server.tool('request_restart', …) call statically, so it lives here too.
22420
+ // No API tool shares this name, so the forwarding-skip effect is a no-op.
22421
+ "request_restart"
22391
22422
  ]);
22392
22423
  async function registerForwardedApiTools() {
22393
22424
  const apiTools = await discoverApiTools();
@@ -22551,6 +22582,41 @@ server.tool(
22551
22582
  content: [{ type: "text", text: await getProjectText(params.project_id) }]
22552
22583
  })
22553
22584
  );
22585
+ if (isSelfRestartEnabled(process.env) && AGT_AGENT_CODE_NAME) {
22586
+ const codeName = AGT_AGENT_CODE_NAME;
22587
+ server.tool(
22588
+ "request_restart",
22589
+ `Request a restart of YOUR OWN session to reload a change you can see is missing but can't pick up live \u2014 e.g. a tool that should be in your registry isn't, or an integration/model was just changed. PREREQUISITE \u2014 you MUST first confirm with the human using your ask_user / channel_request_input tool (e.g. "I think I need to restart to load <reason> \u2014 restart now?") and only call request_restart after they approve. Do NOT call this unprompted or on a hunch: a restart ENDS your current session (you lose in-memory context for this conversation) and a fresh session starts in ~30s. If a restart will not plausibly fix what you observe (a structural/upstream fault), do NOT call this \u2014 tell the operator what you are missing instead. Repeated requests are circuit-broken and will pause you for an operator to clear.`,
22590
+ {
22591
+ reason: external_exports.string().min(1).max(280).describe(
22592
+ `Short description of the change you need to reload (e.g. "the Xero tools the user just added aren't in my registry"). Surfaced in the manager log; keep it specific.`
22593
+ )
22594
+ },
22595
+ async (params) => {
22596
+ try {
22597
+ writeAgentRestartFlag(codeName, params.reason, Date.now());
22598
+ } catch (err) {
22599
+ return {
22600
+ content: [
22601
+ {
22602
+ type: "text",
22603
+ text: `Could not queue the restart: ${err.message}. Tell the operator you may be missing: ${params.reason}.`
22604
+ }
22605
+ ],
22606
+ isError: true
22607
+ };
22608
+ }
22609
+ return {
22610
+ content: [
22611
+ {
22612
+ type: "text",
22613
+ text: `Restart queued \u2014 your manager will recreate this session shortly to reload: ${params.reason}. You'll come back as a fresh session in ~30s, so finish your current turn (you already told the human you're reloading). If you do NOT come back able to do the thing, the fault is structural \u2014 tell the operator rather than requesting another restart.`
22614
+ }
22615
+ ]
22616
+ };
22617
+ }
22618
+ );
22619
+ }
22554
22620
  async function main() {
22555
22621
  try {
22556
22622
  const result = await registerForwardedApiTools();
@@ -25,8 +25,8 @@ import {
25
25
  takeAcpxExecFailureCount,
26
26
  takeZombieDetection,
27
27
  writePersistentClaudeWrapper
28
- } from "./chunk-2MXDQBEH.js";
29
- import "./chunk-4I2QOVP5.js";
28
+ } from "./chunk-75QM5THV.js";
29
+ import "./chunk-HDWKI7W3.js";
30
30
  import "./chunk-XWVM4KPK.js";
31
31
  export {
32
32
  SEND_KEYS_ENTER_DELAY_MS,
@@ -56,4 +56,4 @@ export {
56
56
  takeZombieDetection,
57
57
  writePersistentClaudeWrapper
58
58
  };
59
- //# sourceMappingURL=persistent-session-AH4WU2GE.js.map
59
+ //# sourceMappingURL=persistent-session-5N5NFU27.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  paneLogPath
3
- } from "./chunk-2MXDQBEH.js";
4
- import "./chunk-4I2QOVP5.js";
3
+ } from "./chunk-75QM5THV.js";
4
+ import "./chunk-HDWKI7W3.js";
5
5
  import "./chunk-XWVM4KPK.js";
6
6
 
7
7
  // src/lib/responsiveness-probe.ts
@@ -154,4 +154,4 @@ export {
154
154
  livePendingInboundOldestAgeSeconds,
155
155
  oldestLivePendingInboundMtimeMs
156
156
  };
157
- //# sourceMappingURL=responsiveness-probe-WDXDQ5EZ.js.map
157
+ //# sourceMappingURL=responsiveness-probe-6L6WKHK5.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@integrity-labs/agt-cli",
3
- "version": "0.27.134",
3
+ "version": "0.27.136",
4
4
  "description": "Augmented Team CLI — agent provisioning and management",
5
5
  "type": "module",
6
6
  "engines": {