@integrity-labs/agt-cli 0.28.6 → 0.28.7
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-NS4G4HHD.js → chunk-CHUL4CPY.js} +11 -1
- package/dist/{chunk-NS4G4HHD.js.map → chunk-CHUL4CPY.js.map} +1 -1
- package/dist/{chunk-LIB6VTH3.js → chunk-QG553V7F.js} +2 -2
- package/dist/{chunk-BEHCN5RZ.js → chunk-QHW6NHCZ.js} +2 -2
- package/dist/{claude-pair-runtime-OACH27NE.js → claude-pair-runtime-KOXXDT6B.js} +2 -2
- package/dist/lib/manager-worker.js +153 -138
- package/dist/lib/manager-worker.js.map +1 -1
- package/dist/mcp/direct-chat-channel.js +141 -4
- package/dist/{persistent-session-DSG4HI4R.js → persistent-session-S6H3P6WD.js} +3 -3
- package/dist/{responsiveness-probe-53KDTOUT.js → responsiveness-probe-6BLLBJB4.js} +3 -3
- package/package.json +1 -1
- /package/dist/{chunk-LIB6VTH3.js.map → chunk-QG553V7F.js.map} +0 -0
- /package/dist/{chunk-BEHCN5RZ.js.map → chunk-QHW6NHCZ.js.map} +0 -0
- /package/dist/{claude-pair-runtime-OACH27NE.js.map → claude-pair-runtime-KOXXDT6B.js.map} +0 -0
- /package/dist/{persistent-session-DSG4HI4R.js.map → persistent-session-S6H3P6WD.js.map} +0 -0
- /package/dist/{responsiveness-probe-53KDTOUT.js.map → responsiveness-probe-6BLLBJB4.js.map} +0 -0
|
@@ -14044,12 +14044,52 @@ function readLockHolder(path) {
|
|
|
14044
14044
|
}
|
|
14045
14045
|
|
|
14046
14046
|
// src/direct-chat-channel.ts
|
|
14047
|
+
import { homedir as homedir2 } from "os";
|
|
14048
|
+
import { join as join3 } from "path";
|
|
14049
|
+
import { watch, mkdirSync as mkdirSync2 } from "fs";
|
|
14050
|
+
|
|
14051
|
+
// src/flags-cache-read.ts
|
|
14052
|
+
import { existsSync as existsSync2, readFileSync as readFileSync2 } from "fs";
|
|
14047
14053
|
import { homedir } from "os";
|
|
14048
14054
|
import { join as join2 } from "path";
|
|
14055
|
+
function defaultFlagsCachePath() {
|
|
14056
|
+
return join2(homedir(), ".augmented", "flags-cache.json");
|
|
14057
|
+
}
|
|
14058
|
+
function envBoolean(raw) {
|
|
14059
|
+
if (raw === void 0) return void 0;
|
|
14060
|
+
const v = raw.trim().toLowerCase();
|
|
14061
|
+
if (v === "") return void 0;
|
|
14062
|
+
if (v === "1" || v === "true" || v === "yes" || v === "on") return true;
|
|
14063
|
+
if (v === "0" || v === "false" || v === "no" || v === "off") return false;
|
|
14064
|
+
return void 0;
|
|
14065
|
+
}
|
|
14066
|
+
function cachedBoolean(key, path) {
|
|
14067
|
+
try {
|
|
14068
|
+
if (!existsSync2(path)) return void 0;
|
|
14069
|
+
const parsed = JSON.parse(readFileSync2(path, "utf8"));
|
|
14070
|
+
if (!parsed || typeof parsed !== "object") return void 0;
|
|
14071
|
+
const flags = parsed.flags;
|
|
14072
|
+
if (!flags || typeof flags !== "object") return void 0;
|
|
14073
|
+
const value = flags[key];
|
|
14074
|
+
return typeof value === "boolean" ? value : void 0;
|
|
14075
|
+
} catch {
|
|
14076
|
+
return void 0;
|
|
14077
|
+
}
|
|
14078
|
+
}
|
|
14079
|
+
function resolveHostBooleanFlag(opts) {
|
|
14080
|
+
const env = opts.env ?? process.env;
|
|
14081
|
+
const envValue = envBoolean(env[opts.envVar]);
|
|
14082
|
+
if (envValue !== void 0) return envValue;
|
|
14083
|
+
const cached2 = cachedBoolean(opts.key, opts.cachePath ?? defaultFlagsCachePath());
|
|
14084
|
+
if (cached2 !== void 0) return cached2;
|
|
14085
|
+
return opts.defaultValue;
|
|
14086
|
+
}
|
|
14087
|
+
|
|
14088
|
+
// src/direct-chat-channel.ts
|
|
14049
14089
|
var AGT_HOST = process.env.AGT_HOST;
|
|
14050
14090
|
var AGT_API_KEY = process.env.AGT_API_KEY;
|
|
14051
14091
|
var AGT_AGENT_ID = process.env.AGT_AGENT_ID;
|
|
14052
|
-
var DIRECT_CHAT_AGENT_DIR = AGT_AGENT_ID ?
|
|
14092
|
+
var DIRECT_CHAT_AGENT_DIR = AGT_AGENT_ID ? join3(homedir2(), ".augmented", AGT_AGENT_ID) : null;
|
|
14053
14093
|
var inboundContextClient = createInboundContextClient({
|
|
14054
14094
|
agtHost: AGT_HOST ?? null,
|
|
14055
14095
|
agtApiKey: AGT_API_KEY ?? null,
|
|
@@ -14230,6 +14270,48 @@ mcp.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
|
14230
14270
|
throw new Error(`Unknown tool: ${name}`);
|
|
14231
14271
|
});
|
|
14232
14272
|
await mcp.connect(new StdioServerTransport());
|
|
14273
|
+
var processedIds = /* @__PURE__ */ new Set();
|
|
14274
|
+
async function pollForMessages() {
|
|
14275
|
+
try {
|
|
14276
|
+
const res = await apiPost("/host/direct-chat/poll", {
|
|
14277
|
+
agent_id: AGT_AGENT_ID
|
|
14278
|
+
});
|
|
14279
|
+
if (!res.ok) return;
|
|
14280
|
+
const data = await res.json();
|
|
14281
|
+
for (const msg of data.messages ?? []) {
|
|
14282
|
+
if (processedIds.has(msg.id)) continue;
|
|
14283
|
+
processedIds.add(msg.id);
|
|
14284
|
+
if (processedIds.size > 500) {
|
|
14285
|
+
const ids = [...processedIds];
|
|
14286
|
+
for (let i = 0; i < 250; i++) processedIds.delete(ids[i]);
|
|
14287
|
+
}
|
|
14288
|
+
await mcp.notification({
|
|
14289
|
+
method: "notifications/claude/channel",
|
|
14290
|
+
params: {
|
|
14291
|
+
content: msg.content,
|
|
14292
|
+
meta: {
|
|
14293
|
+
session_id: msg.session_id,
|
|
14294
|
+
user: "webapp",
|
|
14295
|
+
source: "direct-chat"
|
|
14296
|
+
}
|
|
14297
|
+
}
|
|
14298
|
+
});
|
|
14299
|
+
inboundContextClient?.recordInbound({
|
|
14300
|
+
sourceIntegration: "direct-chat",
|
|
14301
|
+
sourceExternalId: msg.session_id
|
|
14302
|
+
});
|
|
14303
|
+
process.stderr.write(
|
|
14304
|
+
`direct-chat-channel: Injected message ${msg.id} (session=${msg.session_id})
|
|
14305
|
+
`
|
|
14306
|
+
);
|
|
14307
|
+
}
|
|
14308
|
+
} catch (err) {
|
|
14309
|
+
process.stderr.write(
|
|
14310
|
+
`direct-chat-channel: Poll error: ${err.message}
|
|
14311
|
+
`
|
|
14312
|
+
);
|
|
14313
|
+
}
|
|
14314
|
+
}
|
|
14233
14315
|
var acquiredLockPath = null;
|
|
14234
14316
|
{
|
|
14235
14317
|
const lockResult = acquireMcpSpawnLock({
|
|
@@ -14246,16 +14328,71 @@ var acquiredLockPath = null;
|
|
|
14246
14328
|
acquiredLockPath = lockResult.path;
|
|
14247
14329
|
}
|
|
14248
14330
|
}
|
|
14249
|
-
|
|
14250
|
-
|
|
14331
|
+
var DOORBELL_ENABLED = resolveHostBooleanFlag({
|
|
14332
|
+
key: "direct-chat-doorbell",
|
|
14333
|
+
envVar: "AGT_DIRECT_CHAT_DOORBELL_ENABLED",
|
|
14334
|
+
defaultValue: false
|
|
14335
|
+
});
|
|
14336
|
+
var DOORBELL_FILE = "direct-chat-doorbell";
|
|
14337
|
+
var SAFETY_NET_POLL_MS = 3e4;
|
|
14338
|
+
var pollInFlight = false;
|
|
14339
|
+
async function pollOnce() {
|
|
14340
|
+
if (pollInFlight) return;
|
|
14341
|
+
pollInFlight = true;
|
|
14342
|
+
try {
|
|
14343
|
+
await pollForMessages();
|
|
14344
|
+
} finally {
|
|
14345
|
+
pollInFlight = false;
|
|
14346
|
+
}
|
|
14347
|
+
}
|
|
14348
|
+
var doorbellWatcher = null;
|
|
14349
|
+
var safetyNetTimer = null;
|
|
14350
|
+
if (DOORBELL_ENABLED && DIRECT_CHAT_AGENT_DIR) {
|
|
14351
|
+
try {
|
|
14352
|
+
mkdirSync2(DIRECT_CHAT_AGENT_DIR, { recursive: true });
|
|
14353
|
+
} catch {
|
|
14354
|
+
}
|
|
14355
|
+
let debounce = null;
|
|
14356
|
+
try {
|
|
14357
|
+
doorbellWatcher = watch(DIRECT_CHAT_AGENT_DIR, (_event, filename) => {
|
|
14358
|
+
if (filename !== DOORBELL_FILE) return;
|
|
14359
|
+
if (debounce) clearTimeout(debounce);
|
|
14360
|
+
debounce = setTimeout(() => {
|
|
14361
|
+
void pollOnce();
|
|
14362
|
+
}, 50);
|
|
14363
|
+
});
|
|
14364
|
+
} catch (err) {
|
|
14365
|
+
process.stderr.write(
|
|
14366
|
+
`direct-chat-channel: doorbell watch failed (${err.message}) \u2014 relying on safety-net poll
|
|
14251
14367
|
`
|
|
14252
|
-
);
|
|
14368
|
+
);
|
|
14369
|
+
}
|
|
14370
|
+
safetyNetTimer = setInterval(() => {
|
|
14371
|
+
void pollOnce();
|
|
14372
|
+
}, SAFETY_NET_POLL_MS);
|
|
14373
|
+
safetyNetTimer.unref?.();
|
|
14374
|
+
void pollOnce();
|
|
14375
|
+
process.stderr.write(
|
|
14376
|
+
`direct-chat-channel: Started (agent=${AGT_AGENT_ID}, delivery=doorbell+pull \u2014 watching ${DOORBELL_FILE}, safety-net ${SAFETY_NET_POLL_MS}ms)
|
|
14377
|
+
`
|
|
14378
|
+
);
|
|
14379
|
+
} else {
|
|
14380
|
+
process.stderr.write(
|
|
14381
|
+
`direct-chat-channel: Started (agent=${AGT_AGENT_ID}, polling=disabled \u2014 using Realtime)
|
|
14382
|
+
`
|
|
14383
|
+
);
|
|
14384
|
+
}
|
|
14253
14385
|
var isShuttingDown = false;
|
|
14254
14386
|
function shutdown(reason) {
|
|
14255
14387
|
if (isShuttingDown) return;
|
|
14256
14388
|
isShuttingDown = true;
|
|
14257
14389
|
process.stderr.write(`direct-chat-channel: ${reason} \u2014 exiting
|
|
14258
14390
|
`);
|
|
14391
|
+
try {
|
|
14392
|
+
doorbellWatcher?.close();
|
|
14393
|
+
} catch {
|
|
14394
|
+
}
|
|
14395
|
+
if (safetyNetTimer) clearInterval(safetyNetTimer);
|
|
14259
14396
|
try {
|
|
14260
14397
|
releaseMcpSpawnLock(acquiredLockPath);
|
|
14261
14398
|
} catch {
|
|
@@ -23,8 +23,8 @@ import {
|
|
|
23
23
|
stopPersistentSession,
|
|
24
24
|
takeZombieDetection,
|
|
25
25
|
writePersistentClaudeWrapper
|
|
26
|
-
} from "./chunk-
|
|
27
|
-
import "./chunk-
|
|
26
|
+
} from "./chunk-QG553V7F.js";
|
|
27
|
+
import "./chunk-CHUL4CPY.js";
|
|
28
28
|
import "./chunk-XWVM4KPK.js";
|
|
29
29
|
export {
|
|
30
30
|
SEND_KEYS_ENTER_DELAY_MS,
|
|
@@ -52,4 +52,4 @@ export {
|
|
|
52
52
|
takeZombieDetection,
|
|
53
53
|
writePersistentClaudeWrapper
|
|
54
54
|
};
|
|
55
|
-
//# sourceMappingURL=persistent-session-
|
|
55
|
+
//# sourceMappingURL=persistent-session-S6H3P6WD.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
paneLogPath
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-QG553V7F.js";
|
|
4
|
+
import "./chunk-CHUL4CPY.js";
|
|
5
5
|
import "./chunk-XWVM4KPK.js";
|
|
6
6
|
|
|
7
7
|
// src/lib/responsiveness-probe.ts
|
|
@@ -248,4 +248,4 @@ export {
|
|
|
248
248
|
parkPendingInbound,
|
|
249
249
|
readAndResetChannelDeflections
|
|
250
250
|
};
|
|
251
|
-
//# sourceMappingURL=responsiveness-probe-
|
|
251
|
+
//# sourceMappingURL=responsiveness-probe-6BLLBJB4.js.map
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|