@integrity-labs/agt-cli 0.28.670 → 0.28.672
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 +6 -6
- package/dist/bin/agt.js.map +1 -1
- package/dist/{chunk-Z4O42VGJ.js → chunk-EX6INJDG.js} +20 -76
- package/dist/chunk-EX6INJDG.js.map +1 -0
- package/dist/{chunk-5GDKWIB3.js → chunk-YAVWYI5S.js} +126 -15
- package/dist/chunk-YAVWYI5S.js.map +1 -0
- package/dist/{chunk-HGVJVYKW.js → chunk-YOID6KOQ.js} +43 -1
- package/dist/chunk-YOID6KOQ.js.map +1 -0
- package/dist/{claude-pair-runtime-W6KBVHK4.js → claude-pair-runtime-UZ2JB2KY.js} +2 -2
- package/dist/lib/manager-worker.js +52 -20
- package/dist/lib/manager-worker.js.map +1 -1
- package/dist/mcp/direct-chat-channel.js +42 -0
- package/dist/mcp/index.js +42 -0
- package/dist/mcp/origami.js +42 -0
- package/dist/mcp/slack-channel.js +42 -0
- package/dist/mcp/telegram-channel.js +42 -0
- package/dist/{persistent-session-RZH67PNC.js → persistent-session-PYAJ4VJW.js} +3 -3
- package/dist/{responsiveness-probe-NPNMNOFF.js → responsiveness-probe-5I2LIVCA.js} +3 -3
- package/dist/{session-auth-dead-CFAYSZ43.js → session-auth-dead-NUX643UJ.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-5GDKWIB3.js.map +0 -1
- package/dist/chunk-HGVJVYKW.js.map +0 -1
- package/dist/chunk-Z4O42VGJ.js.map +0 -1
- /package/dist/{claude-pair-runtime-W6KBVHK4.js.map → claude-pair-runtime-UZ2JB2KY.js.map} +0 -0
- /package/dist/{persistent-session-RZH67PNC.js.map → persistent-session-PYAJ4VJW.js.map} +0 -0
- /package/dist/{responsiveness-probe-NPNMNOFF.js.map → responsiveness-probe-5I2LIVCA.js.map} +0 -0
- /package/dist/{session-auth-dead-CFAYSZ43.js.map → session-auth-dead-NUX643UJ.js.map} +0 -0
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
rotateDailySession,
|
|
17
17
|
sessionFileExists,
|
|
18
18
|
todayLocalIso
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-YOID6KOQ.js";
|
|
20
20
|
import {
|
|
21
21
|
reapOrphanChannelMcps
|
|
22
22
|
} from "./chunk-XWVM4KPK.js";
|
|
@@ -200,6 +200,70 @@ import { existsSync as existsSync2, mkdirSync, readFileSync as readFileSync3, wr
|
|
|
200
200
|
import { homedir as homedir2 } from "os";
|
|
201
201
|
import { join as join2 } from "path";
|
|
202
202
|
|
|
203
|
+
// ../../packages/core/dist/provisioning/env-integrations-file.js
|
|
204
|
+
function shellQuote(value) {
|
|
205
|
+
return `'${value.replace(/'/g, `'\\''`)}'`;
|
|
206
|
+
}
|
|
207
|
+
var CHANNEL_SECRET_ENV_KEYS = [
|
|
208
|
+
"SLACK_BOT_TOKEN",
|
|
209
|
+
"SLACK_APP_TOKEN",
|
|
210
|
+
"TELEGRAM_BOT_TOKEN",
|
|
211
|
+
"MSTEAMS_CLIENT_SECRET"
|
|
212
|
+
];
|
|
213
|
+
var MCP_SERVER_SECRET_ENV_KEYS = [
|
|
214
|
+
"COMPOSIO_API_KEY",
|
|
215
|
+
"PIPEDREAM_CLIENT_SECRET"
|
|
216
|
+
];
|
|
217
|
+
var PRESERVED_ENV_KEYS = [
|
|
218
|
+
...CHANNEL_SECRET_ENV_KEYS,
|
|
219
|
+
...MCP_SERVER_SECRET_ENV_KEYS
|
|
220
|
+
];
|
|
221
|
+
var HEADER = "# Augmented integrations \u2014 auto-generated, do not edit";
|
|
222
|
+
function parseEnvFileEntries(content) {
|
|
223
|
+
const out = /* @__PURE__ */ new Map();
|
|
224
|
+
for (const line2 of content.split("\n")) {
|
|
225
|
+
if (!line2 || line2.startsWith("#") || !line2.includes("="))
|
|
226
|
+
continue;
|
|
227
|
+
const eqIdx = line2.indexOf("=");
|
|
228
|
+
out.set(line2.slice(0, eqIdx), line2.slice(eqIdx + 1));
|
|
229
|
+
}
|
|
230
|
+
return out;
|
|
231
|
+
}
|
|
232
|
+
function renderEnvIntegrations(entries) {
|
|
233
|
+
const lines = [HEADER];
|
|
234
|
+
for (const [key, rendered] of entries)
|
|
235
|
+
lines.push(`${key}=${rendered}`);
|
|
236
|
+
return lines.join("\n") + "\n";
|
|
237
|
+
}
|
|
238
|
+
function mergeEnvIntegrationsContent(existing, args) {
|
|
239
|
+
const current = existing === null ? /* @__PURE__ */ new Map() : parseEnvFileEntries(existing);
|
|
240
|
+
let next;
|
|
241
|
+
if (args.mode === "upsert") {
|
|
242
|
+
next = new Map(current);
|
|
243
|
+
for (const [key, raw] of Object.entries(args.updates)) {
|
|
244
|
+
if (raw === null)
|
|
245
|
+
next.delete(key);
|
|
246
|
+
else
|
|
247
|
+
next.set(key, shellQuote(raw));
|
|
248
|
+
}
|
|
249
|
+
} else {
|
|
250
|
+
next = /* @__PURE__ */ new Map();
|
|
251
|
+
for (const [key, raw] of Object.entries(args.updates)) {
|
|
252
|
+
if (raw !== null)
|
|
253
|
+
next.set(key, shellQuote(raw));
|
|
254
|
+
}
|
|
255
|
+
const preserve = args.preserveKeys ?? PRESERVED_ENV_KEYS;
|
|
256
|
+
for (const key of preserve) {
|
|
257
|
+
if (key in args.updates)
|
|
258
|
+
continue;
|
|
259
|
+
if (!next.has(key) && current.has(key)) {
|
|
260
|
+
next.set(key, current.get(key));
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
return renderEnvIntegrations(next);
|
|
265
|
+
}
|
|
266
|
+
|
|
203
267
|
// ../../packages/core/dist/provisioning/channel-env.js
|
|
204
268
|
function buildChannelCredentialEnv(channelId, config) {
|
|
205
269
|
const env = {};
|
|
@@ -242,6 +306,21 @@ function buildChannelCredentialEnv(channelId, config) {
|
|
|
242
306
|
}
|
|
243
307
|
return { env, secrets };
|
|
244
308
|
}
|
|
309
|
+
function collectChannelSpawnSecrets(channelConfigs) {
|
|
310
|
+
const allowed = new Set(CHANNEL_SECRET_ENV_KEYS);
|
|
311
|
+
const out = {};
|
|
312
|
+
for (const [channelId, entry] of Object.entries(channelConfigs ?? {})) {
|
|
313
|
+
if (!entry || !(entry.status === "active" || entry.status === "pending") || !entry.config)
|
|
314
|
+
continue;
|
|
315
|
+
const config = entry.config;
|
|
316
|
+
const { secrets } = buildChannelCredentialEnv(channelId, config);
|
|
317
|
+
for (const [key, value] of Object.entries(secrets)) {
|
|
318
|
+
if (allowed.has(key))
|
|
319
|
+
out[key] = value;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
return out;
|
|
323
|
+
}
|
|
245
324
|
function peerModeEnv(prefix, config) {
|
|
246
325
|
const env = {};
|
|
247
326
|
const mode = config["peer_agent_mode"];
|
|
@@ -3018,7 +3097,7 @@ function restartEgressSidecar(codeName) {
|
|
|
3018
3097
|
}
|
|
3019
3098
|
}
|
|
3020
3099
|
function buildDockerRunCommand(args) {
|
|
3021
|
-
const { codeName, agentId, wrapperPath, projectDir, homeDir, runId, passApiKey, passOpenRouter, egress, forwardSlackReplyBinding, forwardBlockTurnEndAllMarkers, forwardKanbanWaiting, forwardNotifyDispatch, forwardTurnFailureNotice } = args;
|
|
3100
|
+
const { codeName, agentId, wrapperPath, projectDir, homeDir, runId, passApiKey, passOpenRouter, egress, forwardSlackReplyBinding, forwardBlockTurnEndAllMarkers, forwardKanbanWaiting, forwardNotifyDispatch, forwardTurnFailureNotice, forwardChannelSecrets } = args;
|
|
3022
3101
|
const q = (s) => `'${s.replace(/'/g, `'\\''`)}'`;
|
|
3023
3102
|
const agentDir2 = join6(homeDir, ".augmented", codeName);
|
|
3024
3103
|
const agentIdDir = join6(homeDir, ".augmented", agentId);
|
|
@@ -3057,6 +3136,9 @@ function buildDockerRunCommand(args) {
|
|
|
3057
3136
|
if (forwardKanbanWaiting) envArgs.push("-e AGT_KANBAN_WAITING_ENABLED");
|
|
3058
3137
|
if (forwardNotifyDispatch) envArgs.push("-e AGT_NOTIFY_DISPATCH");
|
|
3059
3138
|
if (forwardTurnFailureNotice) envArgs.push("-e AGT_WEDGE_TRANSIENT_NOTICE_ENABLED");
|
|
3139
|
+
for (const name of forwardChannelSecrets ?? []) {
|
|
3140
|
+
envArgs.push(`-e ${name}`);
|
|
3141
|
+
}
|
|
3060
3142
|
const egressImage = process.env.AGT_EGRESS_IMAGE || "agt-squid:latest";
|
|
3061
3143
|
const internalNet = `agt-net-${codeName}`;
|
|
3062
3144
|
const squidName = `agt-squid-${codeName}`;
|
|
@@ -3517,6 +3599,9 @@ function spawnSession(config, session) {
|
|
|
3517
3599
|
if (config.turnFailureNoticeEnabled && !process.env["AGT_WEDGE_TRANSIENT_NOTICE_ENABLED"]) {
|
|
3518
3600
|
tmuxSessionEnvArgs.push("-e", "AGT_WEDGE_TRANSIENT_NOTICE_ENABLED=true");
|
|
3519
3601
|
}
|
|
3602
|
+
for (const [key, value] of Object.entries(config.channelSpawnSecrets ?? {})) {
|
|
3603
|
+
tmuxSessionEnvArgs.push("-e", `${key}=${value}`);
|
|
3604
|
+
}
|
|
3520
3605
|
const sessionHomeDir = process.env.HOME?.trim() || homedir5();
|
|
3521
3606
|
let egress;
|
|
3522
3607
|
if (egressMode(codeName) === "allowlist") {
|
|
@@ -3556,7 +3641,14 @@ function spawnSession(config, session) {
|
|
|
3556
3641
|
// container boundary and the notice stays dark for exactly the isolated
|
|
3557
3642
|
// agents it was added for (CodeRabbit, PR #3907).
|
|
3558
3643
|
forwardTurnFailureNotice: !!process.env["AGT_WEDGE_TRANSIENT_NOTICE_ENABLED"] || // feature-gate-allow: registry-flag envVar operator-override precedence, not a new gate
|
|
3559
|
-
!!config.turnFailureNoticeEnabled
|
|
3644
|
+
!!config.turnFailureNoticeEnabled,
|
|
3645
|
+
// ENG-9350: name-forward this agent's channel bot-token vars into the
|
|
3646
|
+
// container (value from the session-shell env, same ps-hiding posture
|
|
3647
|
+
// as AGT_API_KEY). REQUIRED under isolation in spawn-env mode: the file
|
|
3648
|
+
// no longer carries them for the in-container wrapper to source, so
|
|
3649
|
+
// without the forward `${SLACK_BOT_TOKEN}` resolves empty and the
|
|
3650
|
+
// channel MCP dies. Empty/undef ⇒ no forwards (file-sourced as before).
|
|
3651
|
+
forwardChannelSecrets: config.channelSpawnSecrets ? Object.keys(config.channelSpawnSecrets) : void 0
|
|
3560
3652
|
}) : JSON.stringify(wrapperPath);
|
|
3561
3653
|
const tmuxEnv = buildSpawnEnv({
|
|
3562
3654
|
base: process.env,
|
|
@@ -3570,15 +3662,17 @@ function spawnSession(config, session) {
|
|
|
3570
3662
|
ANTHROPIC_MODEL: config.openRouter.model,
|
|
3571
3663
|
...config.openRouter.smallFastModel ? { ANTHROPIC_SMALL_FAST_MODEL: config.openRouter.smallFastModel } : {}
|
|
3572
3664
|
} : {};
|
|
3665
|
+
const channelSecretEnv = config.channelSpawnSecrets ?? {};
|
|
3573
3666
|
const probeBaseEnv = isolationMode(codeName) === "docker" ? {
|
|
3574
3667
|
HOME: tmuxEnv["HOME"],
|
|
3575
3668
|
...apiKeyEnv,
|
|
3576
3669
|
...openRouterEnv,
|
|
3670
|
+
...channelSecretEnv,
|
|
3577
3671
|
...config.runId ? { AGT_RUN_ID: config.runId } : {},
|
|
3578
3672
|
AGT_API_KEY: tmuxEnv["AGT_API_KEY"],
|
|
3579
3673
|
AGT_HOST: tmuxEnv["AGT_HOST"],
|
|
3580
3674
|
AGT_AGENT_ID: config.agentId
|
|
3581
|
-
} : { ...tmuxEnv, ...apiKeyEnv, ...openRouterEnv };
|
|
3675
|
+
} : { ...tmuxEnv, ...apiKeyEnv, ...openRouterEnv, ...channelSecretEnv };
|
|
3582
3676
|
for (const f of probeMcpEnvSubstitution({
|
|
3583
3677
|
mcpConfigPath,
|
|
3584
3678
|
envIntegrationsPath: join6(projectDir, ".env.integrations"),
|
|
@@ -3871,6 +3965,20 @@ var defaultHygieneKeySender = async (tmuxSession, keys, interKeyDelayMs) => {
|
|
|
3871
3965
|
}
|
|
3872
3966
|
};
|
|
3873
3967
|
var hygieneKeySender = defaultHygieneKeySender;
|
|
3968
|
+
var SESSION_CREATED_TIMEOUT_MS = 3e3;
|
|
3969
|
+
function defaultSessionCreatedProbe(tmuxSession) {
|
|
3970
|
+
try {
|
|
3971
|
+
const created = execFileSync3("tmux", ["display", "-p", "-t", tmuxSession, "#{session_created}"], {
|
|
3972
|
+
encoding: "utf-8",
|
|
3973
|
+
timeout: SESSION_CREATED_TIMEOUT_MS
|
|
3974
|
+
}).trim();
|
|
3975
|
+
const secs = Number(created);
|
|
3976
|
+
return Number.isFinite(secs) && secs > 0 ? secs * 1e3 : null;
|
|
3977
|
+
} catch {
|
|
3978
|
+
return null;
|
|
3979
|
+
}
|
|
3980
|
+
}
|
|
3981
|
+
var sessionCreatedProbe = defaultSessionCreatedProbe;
|
|
3874
3982
|
async function preSendPaneHygiene(tmuxSession, codeName, log2) {
|
|
3875
3983
|
try {
|
|
3876
3984
|
let screen = paneCapture(tmuxSession);
|
|
@@ -3939,6 +4047,13 @@ var _internals = {
|
|
|
3939
4047
|
__setHygieneKeySender(fn) {
|
|
3940
4048
|
hygieneKeySender = fn ?? defaultHygieneKeySender;
|
|
3941
4049
|
},
|
|
4050
|
+
// ENG-9321 test seam: swap the tmux `#{session_created}` probe so the
|
|
4051
|
+
// reattach-startedAt contract can be asserted exactly, without a real tmux
|
|
4052
|
+
// server whose latency under load would otherwise decide the result.
|
|
4053
|
+
// null restores the real probe.
|
|
4054
|
+
__setSessionCreatedProbe(fn) {
|
|
4055
|
+
sessionCreatedProbe = fn ?? defaultSessionCreatedProbe;
|
|
4056
|
+
},
|
|
3942
4057
|
// Test-only resets so each test starts from a clean slate.
|
|
3943
4058
|
__resetZombieState() {
|
|
3944
4059
|
zombieProbeCache.clear();
|
|
@@ -4044,16 +4159,7 @@ function isSessionHealthy(codeName) {
|
|
|
4044
4159
|
return false;
|
|
4045
4160
|
}
|
|
4046
4161
|
if (!sessions2.has(codeName)) {
|
|
4047
|
-
|
|
4048
|
-
try {
|
|
4049
|
-
const created = execFileSync3("tmux", ["display", "-p", "-t", tmuxSession, "#{session_created}"], {
|
|
4050
|
-
encoding: "utf-8",
|
|
4051
|
-
timeout: 3e3
|
|
4052
|
-
}).trim();
|
|
4053
|
-
const secs = Number(created);
|
|
4054
|
-
if (Number.isFinite(secs) && secs > 0) startedAt2 = secs * 1e3;
|
|
4055
|
-
} catch {
|
|
4056
|
-
}
|
|
4162
|
+
const startedAt2 = sessionCreatedProbe(tmuxSession) ?? Date.now();
|
|
4057
4163
|
sessions2.set(codeName, {
|
|
4058
4164
|
codeName,
|
|
4059
4165
|
startedAt: startedAt2,
|
|
@@ -4265,6 +4371,11 @@ export {
|
|
|
4265
4371
|
buildLiveHeaderRemoteMcpProxyEntry,
|
|
4266
4372
|
buildOAuthRemoteMcpProxyEntry,
|
|
4267
4373
|
buildNativeMcpEntry,
|
|
4374
|
+
shellQuote,
|
|
4375
|
+
CHANNEL_SECRET_ENV_KEYS,
|
|
4376
|
+
parseEnvFileEntries,
|
|
4377
|
+
mergeEnvIntegrationsContent,
|
|
4378
|
+
collectChannelSpawnSecrets,
|
|
4268
4379
|
toOpencodeModel,
|
|
4269
4380
|
mergeOpencodeConfigArtifact,
|
|
4270
4381
|
readChannelServerEnv,
|
|
@@ -4335,4 +4446,4 @@ export {
|
|
|
4335
4446
|
stopAllSessionsAndWait,
|
|
4336
4447
|
getProjectDir
|
|
4337
4448
|
};
|
|
4338
|
-
//# sourceMappingURL=chunk-
|
|
4449
|
+
//# sourceMappingURL=chunk-YAVWYI5S.js.map
|