@integrity-labs/agt-cli 0.28.198 → 0.28.200
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 +4 -4
- package/dist/{chunk-75XCRB6E.js → chunk-5I4F3LNL.js} +3 -3
- package/dist/{chunk-CE6U2IAF.js → chunk-KOZN2FW2.js} +1 -1
- package/dist/chunk-KOZN2FW2.js.map +1 -0
- package/dist/{chunk-PCYEFPBE.js → chunk-MFHRREFW.js} +3 -2
- package/dist/chunk-MFHRREFW.js.map +1 -0
- package/dist/{claude-pair-runtime-RW4N6OQU.js → claude-pair-runtime-SUMWSIVF.js} +2 -2
- package/dist/lib/manager-worker.js +8 -8
- package/dist/mcp/index.js +84 -23
- package/dist/mcp/slack-channel.js +108 -45
- package/dist/mcp/telegram-channel.js +76 -16
- package/dist/{persistent-session-PG3OFGDB.js → persistent-session-ISR7OKYM.js} +3 -3
- package/dist/{responsiveness-probe-MMHGI5FC.js → responsiveness-probe-HFGI3KBX.js} +3 -3
- package/package.json +1 -1
- package/dist/chunk-CE6U2IAF.js.map +0 -1
- package/dist/chunk-PCYEFPBE.js.map +0 -1
- /package/dist/{chunk-75XCRB6E.js.map → chunk-5I4F3LNL.js.map} +0 -0
- /package/dist/{claude-pair-runtime-RW4N6OQU.js.map → claude-pair-runtime-SUMWSIVF.js.map} +0 -0
- /package/dist/{persistent-session-PG3OFGDB.js.map → persistent-session-ISR7OKYM.js.map} +0 -0
- /package/dist/{responsiveness-probe-MMHGI5FC.js.map → responsiveness-probe-HFGI3KBX.js.map} +0 -0
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
requireHost,
|
|
28
28
|
safeWriteJsonAtomic,
|
|
29
29
|
setConfigHash
|
|
30
|
-
} from "../chunk-
|
|
30
|
+
} from "../chunk-5I4F3LNL.js";
|
|
31
31
|
import {
|
|
32
32
|
getProjectDir as getProjectDir2,
|
|
33
33
|
getReadyTasks,
|
|
@@ -69,7 +69,7 @@ import {
|
|
|
69
69
|
takeZombieDetection,
|
|
70
70
|
transcriptActivityAgeSeconds,
|
|
71
71
|
writeEgressAllowlist
|
|
72
|
-
} from "../chunk-
|
|
72
|
+
} from "../chunk-MFHRREFW.js";
|
|
73
73
|
import {
|
|
74
74
|
CONVERSATION_FAILURE_CATEGORIES,
|
|
75
75
|
DEFAULT_FRAMEWORK,
|
|
@@ -113,7 +113,7 @@ import {
|
|
|
113
113
|
resolveChannels,
|
|
114
114
|
resolveDmTarget,
|
|
115
115
|
sumTranscriptUsageInWindow
|
|
116
|
-
} from "../chunk-
|
|
116
|
+
} from "../chunk-KOZN2FW2.js";
|
|
117
117
|
import {
|
|
118
118
|
parsePsRows,
|
|
119
119
|
reapOrphanChannelMcps
|
|
@@ -6681,7 +6681,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
|
|
|
6681
6681
|
var lastVersionCheckAt = 0;
|
|
6682
6682
|
var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
|
|
6683
6683
|
var lastResponsivenessProbeAt = 0;
|
|
6684
|
-
var agtCliVersion = true ? "0.28.
|
|
6684
|
+
var agtCliVersion = true ? "0.28.200" : "dev";
|
|
6685
6685
|
function resolveBrewPath(execFileSync4) {
|
|
6686
6686
|
try {
|
|
6687
6687
|
const out = execFileSync4("which", ["brew"], { timeout: 5e3 }).toString().trim();
|
|
@@ -7574,7 +7574,7 @@ async function pollCycle() {
|
|
|
7574
7574
|
}
|
|
7575
7575
|
try {
|
|
7576
7576
|
const { detectHostSecurity } = await import("../host-security-6PDFG7F5.js");
|
|
7577
|
-
const { collectDiagnostics } = await import("../persistent-session-
|
|
7577
|
+
const { collectDiagnostics } = await import("../persistent-session-ISR7OKYM.js");
|
|
7578
7578
|
const diagCodeNames = [...agentState.persistentSessionAgents];
|
|
7579
7579
|
const agentDiagnostics = diagCodeNames.length > 0 ? collectDiagnostics(diagCodeNames) : void 0;
|
|
7580
7580
|
let tailscaleHostname;
|
|
@@ -7722,7 +7722,7 @@ async function pollCycle() {
|
|
|
7722
7722
|
const {
|
|
7723
7723
|
collectResponsivenessProbes,
|
|
7724
7724
|
getResponsivenessIntervalMs
|
|
7725
|
-
} = await import("../responsiveness-probe-
|
|
7725
|
+
} = await import("../responsiveness-probe-HFGI3KBX.js");
|
|
7726
7726
|
const probeIntervalMs = getResponsivenessIntervalMs();
|
|
7727
7727
|
if (now - lastResponsivenessProbeAt > probeIntervalMs) {
|
|
7728
7728
|
const probeCodeNames = [...agentState.persistentSessionAgents];
|
|
@@ -7754,7 +7754,7 @@ async function pollCycle() {
|
|
|
7754
7754
|
collectResponsivenessProbes,
|
|
7755
7755
|
livePendingInboundOldestAgeSeconds,
|
|
7756
7756
|
parkPendingInbound
|
|
7757
|
-
} = await import("../responsiveness-probe-
|
|
7757
|
+
} = await import("../responsiveness-probe-HFGI3KBX.js");
|
|
7758
7758
|
const { getProjectDir: wedgeProjectDir } = await import("../claude-scheduler-FATCLHDM.js");
|
|
7759
7759
|
const wedgeNow = /* @__PURE__ */ new Date();
|
|
7760
7760
|
const liveAgents = agentState.persistentSessionAgents;
|
|
@@ -10754,7 +10754,7 @@ async function processClaudePairSessions(agents) {
|
|
|
10754
10754
|
killPairSession,
|
|
10755
10755
|
pairTmuxSession,
|
|
10756
10756
|
finalizeClaudePairOnboarding
|
|
10757
|
-
} = await import("../claude-pair-runtime-
|
|
10757
|
+
} = await import("../claude-pair-runtime-SUMWSIVF.js");
|
|
10758
10758
|
for (const pairId of pendingResp.cancelled_pair_ids ?? []) {
|
|
10759
10759
|
log(`[claude-pair] sweeping orphan tmux session for pair ${pairId.slice(0, 8)}`);
|
|
10760
10760
|
const killed = await killPairSession(pairTmuxSession(pairId));
|
package/dist/mcp/index.js
CHANGED
|
@@ -21174,6 +21174,12 @@ function captureSelfRestartConfirm(opts) {
|
|
|
21174
21174
|
return best.source;
|
|
21175
21175
|
}
|
|
21176
21176
|
|
|
21177
|
+
// src/in-container.ts
|
|
21178
|
+
function isInContainer(env = process.env) {
|
|
21179
|
+
const raw = (env.AGT_IN_CONTAINER ?? "").trim().toLowerCase();
|
|
21180
|
+
return raw === "true" || raw === "1";
|
|
21181
|
+
}
|
|
21182
|
+
|
|
21177
21183
|
// src/feature-request.ts
|
|
21178
21184
|
var FEATURE_REQUEST_TYPES = [
|
|
21179
21185
|
"integration",
|
|
@@ -21216,6 +21222,37 @@ function describeFormRequestResult(resp) {
|
|
|
21216
21222
|
};
|
|
21217
21223
|
}
|
|
21218
21224
|
|
|
21225
|
+
// src/buttons-request.ts
|
|
21226
|
+
function findDuplicateButtonOption(options) {
|
|
21227
|
+
const seenLabels = /* @__PURE__ */ new Set();
|
|
21228
|
+
const seenValues = /* @__PURE__ */ new Set();
|
|
21229
|
+
for (const opt of options) {
|
|
21230
|
+
if (seenLabels.has(opt.label)) {
|
|
21231
|
+
return `Duplicate button label "${opt.label}". Each button label must be unique so the tapped choice is unambiguous.`;
|
|
21232
|
+
}
|
|
21233
|
+
if (seenValues.has(opt.value)) {
|
|
21234
|
+
return `Duplicate button value "${opt.value}". Each button value must be unique so the tapped choice is unambiguous.`;
|
|
21235
|
+
}
|
|
21236
|
+
seenLabels.add(opt.label);
|
|
21237
|
+
seenValues.add(opt.value);
|
|
21238
|
+
}
|
|
21239
|
+
return null;
|
|
21240
|
+
}
|
|
21241
|
+
function describeButtonsRequestResult(resp, channelId, optionCount) {
|
|
21242
|
+
if (!resp.ok) {
|
|
21243
|
+
const detail = resp.error ? `: ${resp.error}` : resp.status ? ` (status ${resp.status})` : "";
|
|
21244
|
+
return {
|
|
21245
|
+
text: `Could not post the buttons${detail}. Fix the issue (often the channel id) and try again, or tell your operator.`,
|
|
21246
|
+
isError: true
|
|
21247
|
+
};
|
|
21248
|
+
}
|
|
21249
|
+
const rid = resp.request_id ?? resp.interaction_id ?? "(unknown)";
|
|
21250
|
+
return {
|
|
21251
|
+
text: `Posted ${optionCount} buttons to ${channelId} (request \`${rid}\`). END YOUR TURN now - the user's tap arrives later as a direct-chat message (payload.kind = "button_click", payload.value / payload.label) carrying source_channel so you reply in the original conversation. Do not wait or poll.`,
|
|
21252
|
+
isError: false
|
|
21253
|
+
};
|
|
21254
|
+
}
|
|
21255
|
+
|
|
21219
21256
|
// src/approval-tools.ts
|
|
21220
21257
|
function statusToOutcome(status) {
|
|
21221
21258
|
switch (status) {
|
|
@@ -22411,6 +22448,13 @@ server.tool(
|
|
|
22411
22448
|
isError: true
|
|
22412
22449
|
};
|
|
22413
22450
|
}
|
|
22451
|
+
const dupError = findDuplicateButtonOption(params.options);
|
|
22452
|
+
if (dupError) {
|
|
22453
|
+
return {
|
|
22454
|
+
content: [{ type: "text", text: `Buttons request rejected: ${dupError}` }],
|
|
22455
|
+
isError: true
|
|
22456
|
+
};
|
|
22457
|
+
}
|
|
22414
22458
|
let resp;
|
|
22415
22459
|
try {
|
|
22416
22460
|
resp = await apiPost("/host/request-buttons", {
|
|
@@ -22443,14 +22487,14 @@ server.tool(
|
|
|
22443
22487
|
isError: true
|
|
22444
22488
|
};
|
|
22445
22489
|
}
|
|
22446
|
-
const
|
|
22490
|
+
const { text, isError } = describeButtonsRequestResult(
|
|
22491
|
+
resp,
|
|
22492
|
+
params.channel_id,
|
|
22493
|
+
params.options.length
|
|
22494
|
+
);
|
|
22447
22495
|
return {
|
|
22448
|
-
content: [
|
|
22449
|
-
|
|
22450
|
-
type: "text",
|
|
22451
|
-
text: `Posted ${params.options.length} buttons to ${params.channel_id} (request \`${rid}\`). END YOUR TURN now \u2014 the user's tap arrives later as a direct-chat message (payload.kind = "button_click", payload.value / payload.label) carrying source_channel so you reply in the original conversation. Do not wait or poll.`
|
|
22452
|
-
}
|
|
22453
|
-
]
|
|
22496
|
+
content: [{ type: "text", text }],
|
|
22497
|
+
...isError ? { isError: true } : {}
|
|
22454
22498
|
};
|
|
22455
22499
|
}
|
|
22456
22500
|
);
|
|
@@ -23750,22 +23794,39 @@ if (isSelfRestartEnabled(process.env) && AGT_AGENT_CODE_NAME) {
|
|
|
23750
23794
|
};
|
|
23751
23795
|
}
|
|
23752
23796
|
if (resp.mode === "local") {
|
|
23753
|
-
|
|
23754
|
-
|
|
23755
|
-
|
|
23756
|
-
|
|
23757
|
-
|
|
23758
|
-
|
|
23759
|
-
|
|
23760
|
-
|
|
23761
|
-
|
|
23762
|
-
|
|
23763
|
-
|
|
23764
|
-
|
|
23765
|
-
|
|
23766
|
-
|
|
23767
|
-
|
|
23768
|
-
|
|
23797
|
+
const captureBackOnlineMarker = () => {
|
|
23798
|
+
try {
|
|
23799
|
+
captureSelfRestartConfirm({ agentDir: selfRestartAgentDir(codeName), nowMs: Date.now() });
|
|
23800
|
+
} catch {
|
|
23801
|
+
}
|
|
23802
|
+
};
|
|
23803
|
+
const queueFailed = (err) => ({
|
|
23804
|
+
content: [
|
|
23805
|
+
{
|
|
23806
|
+
type: "text",
|
|
23807
|
+
text: `Could not queue the restart: ${err.message}. Tell the operator you may be missing: ${params.reason}.`
|
|
23808
|
+
}
|
|
23809
|
+
],
|
|
23810
|
+
isError: true
|
|
23811
|
+
});
|
|
23812
|
+
if (isInContainer()) {
|
|
23813
|
+
try {
|
|
23814
|
+
await apiPost("/host/agents/restart-actuate", {
|
|
23815
|
+
agent_id: AGT_AGENT_ID,
|
|
23816
|
+
reason: params.reason,
|
|
23817
|
+
source: "agent"
|
|
23818
|
+
});
|
|
23819
|
+
} catch (err) {
|
|
23820
|
+
return queueFailed(err);
|
|
23821
|
+
}
|
|
23822
|
+
captureBackOnlineMarker();
|
|
23823
|
+
} else {
|
|
23824
|
+
captureBackOnlineMarker();
|
|
23825
|
+
try {
|
|
23826
|
+
writeAgentRestartFlag(codeName, params.reason, Date.now());
|
|
23827
|
+
} catch (err) {
|
|
23828
|
+
return queueFailed(err);
|
|
23829
|
+
}
|
|
23769
23830
|
}
|
|
23770
23831
|
return {
|
|
23771
23832
|
content: [
|
|
@@ -17362,6 +17362,39 @@ function createSlackBotUserIdClient(args) {
|
|
|
17362
17362
|
};
|
|
17363
17363
|
}
|
|
17364
17364
|
|
|
17365
|
+
// src/in-container.ts
|
|
17366
|
+
function isInContainer(env = process.env) {
|
|
17367
|
+
const raw = (env.AGT_IN_CONTAINER ?? "").trim().toLowerCase();
|
|
17368
|
+
return raw === "true" || raw === "1";
|
|
17369
|
+
}
|
|
17370
|
+
|
|
17371
|
+
// src/restart-actuate-client.ts
|
|
17372
|
+
async function actuateHostRestart(opts) {
|
|
17373
|
+
const { agtHost, agtApiKey, agentId, reason, source } = opts;
|
|
17374
|
+
if (!agtHost || !agtApiKey || !agentId) {
|
|
17375
|
+
return { ok: false, status: 0, error: "host API wiring missing" };
|
|
17376
|
+
}
|
|
17377
|
+
try {
|
|
17378
|
+
const { apiCall: apiCall2 } = await Promise.resolve().then(() => (init_ask_user_runtime(), ask_user_runtime_exports));
|
|
17379
|
+
const res = await apiCall2(
|
|
17380
|
+
{ apiHost: agtHost, apiKey: agtApiKey, agentId },
|
|
17381
|
+
"POST",
|
|
17382
|
+
"/host/agents/restart-actuate",
|
|
17383
|
+
{ agent_id: agentId, reason, source }
|
|
17384
|
+
);
|
|
17385
|
+
if (res.ok) return { ok: true, status: res.status };
|
|
17386
|
+
let error2;
|
|
17387
|
+
try {
|
|
17388
|
+
const data = await res.json();
|
|
17389
|
+
error2 = typeof data?.error === "string" ? data.error : void 0;
|
|
17390
|
+
} catch {
|
|
17391
|
+
}
|
|
17392
|
+
return { ok: false, status: res.status, error: error2 };
|
|
17393
|
+
} catch (err) {
|
|
17394
|
+
return { ok: false, status: 0, error: err instanceof Error ? err.message : String(err) };
|
|
17395
|
+
}
|
|
17396
|
+
}
|
|
17397
|
+
|
|
17365
17398
|
// src/mcp-spawn-lock.ts
|
|
17366
17399
|
import {
|
|
17367
17400
|
existsSync as existsSync7,
|
|
@@ -18701,6 +18734,15 @@ function noteThreadActivityByMessageTs(channel, messageTs) {
|
|
|
18701
18734
|
markSeenSlackPendingMarkerByMessageTs2(channel, messageTs);
|
|
18702
18735
|
}
|
|
18703
18736
|
var RESTART_FLAGS_DIR = join9(homedir4(), ".augmented", "restart-flags");
|
|
18737
|
+
function actuateHostRestartSlack() {
|
|
18738
|
+
return actuateHostRestart({
|
|
18739
|
+
agtHost: AGT_HOST,
|
|
18740
|
+
agtApiKey: AGT_API_KEY,
|
|
18741
|
+
agentId: AGT_AGENT_ID,
|
|
18742
|
+
reason: "/restart",
|
|
18743
|
+
source: "slack"
|
|
18744
|
+
});
|
|
18745
|
+
}
|
|
18704
18746
|
function buildAugmentedSlackMetadata() {
|
|
18705
18747
|
if (!AGT_TEAM_ID) return void 0;
|
|
18706
18748
|
return {
|
|
@@ -19218,29 +19260,38 @@ async function handleSlashCommandEnvelope(payload) {
|
|
|
19218
19260
|
return;
|
|
19219
19261
|
}
|
|
19220
19262
|
try {
|
|
19221
|
-
|
|
19222
|
-
|
|
19223
|
-
|
|
19224
|
-
const flagPath = join9(RESTART_FLAGS_DIR, `${codeName}.flag`);
|
|
19225
|
-
writeSlackRestartConfirm(
|
|
19226
|
-
{
|
|
19227
|
-
channel: payload.channel_id,
|
|
19228
|
-
...payload.thread_ts ? { thread_ts: payload.thread_ts } : {}
|
|
19229
|
-
},
|
|
19230
|
-
payload.user_name
|
|
19231
|
-
);
|
|
19232
|
-
const flag = {
|
|
19233
|
-
codeName,
|
|
19234
|
-
source: "slack",
|
|
19235
|
-
ts: Date.now(),
|
|
19236
|
-
reply: {
|
|
19237
|
-
channel: payload.channel_id,
|
|
19238
|
-
...payload.thread_ts ? { thread_ts: payload.thread_ts } : {}
|
|
19239
|
-
}
|
|
19263
|
+
const confirmReply = {
|
|
19264
|
+
channel: payload.channel_id,
|
|
19265
|
+
...payload.thread_ts ? { thread_ts: payload.thread_ts } : {}
|
|
19240
19266
|
};
|
|
19241
|
-
|
|
19242
|
-
|
|
19243
|
-
|
|
19267
|
+
if (isInContainer()) {
|
|
19268
|
+
const result = await actuateHostRestartSlack();
|
|
19269
|
+
if (!result.ok) {
|
|
19270
|
+
process.stderr.write(
|
|
19271
|
+
`slack-channel(${codeName}): /restart slash-command host-actuate failed (in-container) status=${result.status}
|
|
19272
|
+
`
|
|
19273
|
+
);
|
|
19274
|
+
const text = (result.status === 409 || result.status === 429) && result.error ? `:warning: ${result.error}` : `\u274C Failed to queue restart for \`${codeName}\`. Please try again in a few seconds.`;
|
|
19275
|
+
await postEphemeralViaResponseUrl(responseUrl, text, codeName);
|
|
19276
|
+
return;
|
|
19277
|
+
}
|
|
19278
|
+
writeSlackRestartConfirm(confirmReply, payload.user_name);
|
|
19279
|
+
} else {
|
|
19280
|
+
writeSlackRestartConfirm(confirmReply, payload.user_name);
|
|
19281
|
+
if (!existsSync8(RESTART_FLAGS_DIR)) {
|
|
19282
|
+
mkdirSync8(RESTART_FLAGS_DIR, { recursive: true });
|
|
19283
|
+
}
|
|
19284
|
+
const flagPath = join9(RESTART_FLAGS_DIR, `${codeName}.flag`);
|
|
19285
|
+
const flag = {
|
|
19286
|
+
codeName,
|
|
19287
|
+
source: "slack",
|
|
19288
|
+
ts: Date.now(),
|
|
19289
|
+
reply: confirmReply
|
|
19290
|
+
};
|
|
19291
|
+
const tmpPath = `${flagPath}.${process.pid}.${randomUUID2()}.tmp`;
|
|
19292
|
+
writeFileSync10(tmpPath, JSON.stringify(flag) + "\n", "utf8");
|
|
19293
|
+
renameSync4(tmpPath, flagPath);
|
|
19294
|
+
}
|
|
19244
19295
|
process.stderr.write(
|
|
19245
19296
|
`slack-channel(${codeName}): /restart slash-command queued from channel ${hashChannelId(payload.channel_id)}
|
|
19246
19297
|
`
|
|
@@ -19398,30 +19449,42 @@ async function handleHelpCommand(opts) {
|
|
|
19398
19449
|
async function handleRestartCommand(opts) {
|
|
19399
19450
|
const codeName = AGENT_CODE_NAME ?? "unknown";
|
|
19400
19451
|
try {
|
|
19401
|
-
|
|
19402
|
-
|
|
19403
|
-
|
|
19404
|
-
const flagPath = join9(RESTART_FLAGS_DIR, `${codeName}.flag`);
|
|
19405
|
-
writeSlackRestartConfirm(
|
|
19406
|
-
{
|
|
19407
|
-
channel: opts.channel,
|
|
19408
|
-
...opts.threadTs ? { thread_ts: opts.threadTs } : {}
|
|
19409
|
-
},
|
|
19410
|
-
opts.requesterName
|
|
19411
|
-
);
|
|
19412
|
-
const flag = {
|
|
19413
|
-
codeName,
|
|
19414
|
-
source: "slack",
|
|
19415
|
-
ts: Date.now(),
|
|
19416
|
-
reply: {
|
|
19417
|
-
channel: opts.channel,
|
|
19418
|
-
...opts.threadTs ? { thread_ts: opts.threadTs } : {},
|
|
19419
|
-
message_ts: opts.ts
|
|
19420
|
-
}
|
|
19452
|
+
const confirmReply = {
|
|
19453
|
+
channel: opts.channel,
|
|
19454
|
+
...opts.threadTs ? { thread_ts: opts.threadTs } : {}
|
|
19421
19455
|
};
|
|
19422
|
-
|
|
19423
|
-
|
|
19424
|
-
|
|
19456
|
+
if (isInContainer()) {
|
|
19457
|
+
const result = await actuateHostRestartSlack();
|
|
19458
|
+
if (!result.ok) {
|
|
19459
|
+
process.stderr.write(
|
|
19460
|
+
`slack-channel(${codeName}): /restart host-actuate failed (in-container) status=${result.status} from channel ${hashChannelId(opts.channel)}
|
|
19461
|
+
`
|
|
19462
|
+
);
|
|
19463
|
+
const text = (result.status === 409 || result.status === 429) && result.error ? `:warning: ${result.error}` : `\u274C Failed to queue restart for ${codeName}. Please try again in a few seconds.`;
|
|
19464
|
+
await postSlackMessage({
|
|
19465
|
+
channel: opts.channel,
|
|
19466
|
+
text,
|
|
19467
|
+
...opts.threadTs ? { thread_ts: opts.threadTs } : {}
|
|
19468
|
+
});
|
|
19469
|
+
return;
|
|
19470
|
+
}
|
|
19471
|
+
writeSlackRestartConfirm(confirmReply, opts.requesterName);
|
|
19472
|
+
} else {
|
|
19473
|
+
writeSlackRestartConfirm(confirmReply, opts.requesterName);
|
|
19474
|
+
if (!existsSync8(RESTART_FLAGS_DIR)) {
|
|
19475
|
+
mkdirSync8(RESTART_FLAGS_DIR, { recursive: true });
|
|
19476
|
+
}
|
|
19477
|
+
const flagPath = join9(RESTART_FLAGS_DIR, `${codeName}.flag`);
|
|
19478
|
+
const flag = {
|
|
19479
|
+
codeName,
|
|
19480
|
+
source: "slack",
|
|
19481
|
+
ts: Date.now(),
|
|
19482
|
+
reply: { ...confirmReply, message_ts: opts.ts }
|
|
19483
|
+
};
|
|
19484
|
+
const tmpPath = `${flagPath}.${process.pid}.${randomUUID2()}.tmp`;
|
|
19485
|
+
writeFileSync10(tmpPath, JSON.stringify(flag) + "\n", "utf8");
|
|
19486
|
+
renameSync4(tmpPath, flagPath);
|
|
19487
|
+
}
|
|
19425
19488
|
process.stderr.write(
|
|
19426
19489
|
`slack-channel(${codeName}): /restart queued from channel ${hashChannelId(opts.channel)}
|
|
19427
19490
|
`
|
|
@@ -17282,6 +17282,39 @@ function markInboundDelivered(channel, providerId, opts) {
|
|
|
17282
17282
|
return false;
|
|
17283
17283
|
}
|
|
17284
17284
|
|
|
17285
|
+
// src/in-container.ts
|
|
17286
|
+
function isInContainer(env = process.env) {
|
|
17287
|
+
const raw = (env.AGT_IN_CONTAINER ?? "").trim().toLowerCase();
|
|
17288
|
+
return raw === "true" || raw === "1";
|
|
17289
|
+
}
|
|
17290
|
+
|
|
17291
|
+
// src/restart-actuate-client.ts
|
|
17292
|
+
async function actuateHostRestart(opts) {
|
|
17293
|
+
const { agtHost, agtApiKey, agentId, reason, source } = opts;
|
|
17294
|
+
if (!agtHost || !agtApiKey || !agentId) {
|
|
17295
|
+
return { ok: false, status: 0, error: "host API wiring missing" };
|
|
17296
|
+
}
|
|
17297
|
+
try {
|
|
17298
|
+
const { apiCall: apiCall2 } = await Promise.resolve().then(() => (init_ask_user_runtime(), ask_user_runtime_exports));
|
|
17299
|
+
const res = await apiCall2(
|
|
17300
|
+
{ apiHost: agtHost, apiKey: agtApiKey, agentId },
|
|
17301
|
+
"POST",
|
|
17302
|
+
"/host/agents/restart-actuate",
|
|
17303
|
+
{ agent_id: agentId, reason, source }
|
|
17304
|
+
);
|
|
17305
|
+
if (res.ok) return { ok: true, status: res.status };
|
|
17306
|
+
let error2;
|
|
17307
|
+
try {
|
|
17308
|
+
const data = await res.json();
|
|
17309
|
+
error2 = typeof data?.error === "string" ? data.error : void 0;
|
|
17310
|
+
} catch {
|
|
17311
|
+
}
|
|
17312
|
+
return { ok: false, status: res.status, error: error2 };
|
|
17313
|
+
} catch (err) {
|
|
17314
|
+
return { ok: false, status: 0, error: err instanceof Error ? err.message : String(err) };
|
|
17315
|
+
}
|
|
17316
|
+
}
|
|
17317
|
+
|
|
17285
17318
|
// src/telegram-channel.ts
|
|
17286
17319
|
function redactId(id) {
|
|
17287
17320
|
return createHash("sha256").update(String(id)).digest("hex").slice(0, 8);
|
|
@@ -17664,6 +17697,15 @@ function __resetBusyAckNoticeThrottle() {
|
|
|
17664
17697
|
lastBusyAckNoticeAt.clear();
|
|
17665
17698
|
}
|
|
17666
17699
|
var RESTART_FLAGS_DIR = join9(homedir4(), ".augmented", "restart-flags");
|
|
17700
|
+
function actuateHostRestartTelegram() {
|
|
17701
|
+
return actuateHostRestart({
|
|
17702
|
+
agtHost: AGT_HOST,
|
|
17703
|
+
agtApiKey: AGT_API_KEY,
|
|
17704
|
+
agentId: AGT_AGENT_ID,
|
|
17705
|
+
reason: "/restart",
|
|
17706
|
+
source: "telegram"
|
|
17707
|
+
});
|
|
17708
|
+
}
|
|
17667
17709
|
function writeTelegramRestartConfirm(reply, requesterName) {
|
|
17668
17710
|
if (!RESTART_CONFIRM_FILE) return;
|
|
17669
17711
|
const marker = {
|
|
@@ -18015,23 +18057,41 @@ async function handleOnboardingCommand(opts) {
|
|
|
18015
18057
|
}
|
|
18016
18058
|
async function handleRestartCommand(opts) {
|
|
18017
18059
|
try {
|
|
18018
|
-
if (
|
|
18019
|
-
|
|
18060
|
+
if (isInContainer()) {
|
|
18061
|
+
const result = await actuateHostRestartTelegram();
|
|
18062
|
+
if (!result.ok) {
|
|
18063
|
+
process.stderr.write(
|
|
18064
|
+
`telegram-channel(${AGENT_CODE_NAME}): /restart host-actuate failed (in-container) status=${result.status} from chat ${redactId(opts.chatId)}
|
|
18065
|
+
`
|
|
18066
|
+
);
|
|
18067
|
+
const text = (result.status === 409 || result.status === 429) && result.error ? `\u26A0\uFE0F ${result.error}` : `\u274C Failed to queue restart for ${AGENT_CODE_NAME}. Please try again in a few seconds.`;
|
|
18068
|
+
try {
|
|
18069
|
+
await telegramApiCall(
|
|
18070
|
+
"sendMessage",
|
|
18071
|
+
{ chat_id: opts.chatId, text, reply_to_message_id: Number(opts.messageId) },
|
|
18072
|
+
1e4
|
|
18073
|
+
);
|
|
18074
|
+
} catch {
|
|
18075
|
+
}
|
|
18076
|
+
return;
|
|
18077
|
+
}
|
|
18078
|
+
writeTelegramRestartConfirm({ chat_id: opts.chatId, message_id: opts.messageId }, opts.requesterName);
|
|
18079
|
+
} else {
|
|
18080
|
+
writeTelegramRestartConfirm({ chat_id: opts.chatId, message_id: opts.messageId }, opts.requesterName);
|
|
18081
|
+
if (!existsSync7(RESTART_FLAGS_DIR)) {
|
|
18082
|
+
mkdirSync8(RESTART_FLAGS_DIR, { recursive: true });
|
|
18083
|
+
}
|
|
18084
|
+
const flagPath = join9(RESTART_FLAGS_DIR, `${AGENT_CODE_NAME}.flag`);
|
|
18085
|
+
const flag = {
|
|
18086
|
+
codeName: AGENT_CODE_NAME,
|
|
18087
|
+
source: "telegram",
|
|
18088
|
+
ts: Date.now(),
|
|
18089
|
+
reply: { chat_id: opts.chatId, message_id: opts.messageId }
|
|
18090
|
+
};
|
|
18091
|
+
const tmpPath = `${flagPath}.${process.pid}.${randomUUID3()}.tmp`;
|
|
18092
|
+
writeFileSync10(tmpPath, JSON.stringify(flag) + "\n", "utf8");
|
|
18093
|
+
renameSync6(tmpPath, flagPath);
|
|
18020
18094
|
}
|
|
18021
|
-
const flagPath = join9(RESTART_FLAGS_DIR, `${AGENT_CODE_NAME}.flag`);
|
|
18022
|
-
writeTelegramRestartConfirm(
|
|
18023
|
-
{ chat_id: opts.chatId, message_id: opts.messageId },
|
|
18024
|
-
opts.requesterName
|
|
18025
|
-
);
|
|
18026
|
-
const flag = {
|
|
18027
|
-
codeName: AGENT_CODE_NAME,
|
|
18028
|
-
source: "telegram",
|
|
18029
|
-
ts: Date.now(),
|
|
18030
|
-
reply: { chat_id: opts.chatId, message_id: opts.messageId }
|
|
18031
|
-
};
|
|
18032
|
-
const tmpPath = `${flagPath}.${process.pid}.${randomUUID3()}.tmp`;
|
|
18033
|
-
writeFileSync10(tmpPath, JSON.stringify(flag) + "\n", "utf8");
|
|
18034
|
-
renameSync6(tmpPath, flagPath);
|
|
18035
18095
|
process.stderr.write(
|
|
18036
18096
|
`telegram-channel(${AGENT_CODE_NAME}): /restart queued from chat ${redactId(opts.chatId)}
|
|
18037
18097
|
`
|
|
@@ -34,8 +34,8 @@ import {
|
|
|
34
34
|
writeDirectChatSessionState,
|
|
35
35
|
writeEgressAllowlist,
|
|
36
36
|
writePersistentClaudeWrapper
|
|
37
|
-
} from "./chunk-
|
|
38
|
-
import "./chunk-
|
|
37
|
+
} from "./chunk-MFHRREFW.js";
|
|
38
|
+
import "./chunk-KOZN2FW2.js";
|
|
39
39
|
import "./chunk-XWVM4KPK.js";
|
|
40
40
|
export {
|
|
41
41
|
EGRESS_BASELINE_DOMAINS,
|
|
@@ -74,4 +74,4 @@ export {
|
|
|
74
74
|
writeEgressAllowlist,
|
|
75
75
|
writePersistentClaudeWrapper
|
|
76
76
|
};
|
|
77
|
-
//# sourceMappingURL=persistent-session-
|
|
77
|
+
//# sourceMappingURL=persistent-session-ISR7OKYM.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
paneLogPath
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-MFHRREFW.js";
|
|
4
|
+
import "./chunk-KOZN2FW2.js";
|
|
5
5
|
import "./chunk-XWVM4KPK.js";
|
|
6
6
|
|
|
7
7
|
// src/lib/responsiveness-probe.ts
|
|
@@ -304,4 +304,4 @@ export {
|
|
|
304
304
|
readAndResetChannelDeflections,
|
|
305
305
|
readAndResetChannelLaneClassifications
|
|
306
306
|
};
|
|
307
|
-
//# sourceMappingURL=responsiveness-probe-
|
|
307
|
+
//# sourceMappingURL=responsiveness-probe-HFGI3KBX.js.map
|