@integrity-labs/agt-cli 0.28.222 → 0.28.224
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-B3E4B7JF.js → chunk-S43WVYAF.js} +16 -3
- package/dist/chunk-S43WVYAF.js.map +1 -0
- package/dist/{chunk-XNMPRL76.js → chunk-TPL4KIC5.js} +142 -3
- package/dist/chunk-TPL4KIC5.js.map +1 -0
- package/dist/{claude-pair-runtime-AEPVKQNP.js → claude-pair-runtime-JFP2N723.js} +2 -2
- package/dist/lib/manager-worker.js +29 -15
- package/dist/lib/manager-worker.js.map +1 -1
- package/dist/mcp/slack-channel.js +127 -0
- package/dist/mcp/teams-channel.js +105 -0
- package/dist/mcp/telegram-channel.js +113 -0
- package/dist/{persistent-session-M4ZTLCDP.js → persistent-session-I4CQEDME.js} +2 -2
- package/dist/{responsiveness-probe-E25HFGJL.js → responsiveness-probe-MIUMXKV4.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-B3E4B7JF.js.map +0 -1
- package/dist/chunk-XNMPRL76.js.map +0 -1
- /package/dist/{claude-pair-runtime-AEPVKQNP.js.map → claude-pair-runtime-JFP2N723.js.map} +0 -0
- /package/dist/{persistent-session-M4ZTLCDP.js.map → persistent-session-I4CQEDME.js.map} +0 -0
- /package/dist/{responsiveness-probe-E25HFGJL.js.map → responsiveness-probe-MIUMXKV4.js.map} +0 -0
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
resolveConnectivityProbe,
|
|
19
19
|
worseConnectivityOutcome,
|
|
20
20
|
wrapScheduledTaskPrompt
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-S43WVYAF.js";
|
|
22
22
|
import {
|
|
23
23
|
parsePsRows
|
|
24
24
|
} from "./chunk-XWVM4KPK.js";
|
|
@@ -3395,6 +3395,144 @@ function provisionOrientHook(codeName) {
|
|
|
3395
3395
|
settings["hooks"] = hooks;
|
|
3396
3396
|
writeFileSync3(settingsPath, JSON.stringify(settings, null, 2));
|
|
3397
3397
|
}
|
|
3398
|
+
function provisionPreCompactHook(codeName) {
|
|
3399
|
+
const projectDir = getProjectDir(codeName);
|
|
3400
|
+
const claudeDir = join2(projectDir, ".claude");
|
|
3401
|
+
mkdirSync2(claudeDir, { recursive: true });
|
|
3402
|
+
const homeDir = getHomeDir();
|
|
3403
|
+
const agentDir = join2(homeDir, ".augmented", codeName);
|
|
3404
|
+
const jqNormalizeContent = '(.message.content // .content // []) | if type == "string" then [{type: "text", text: .}] elif type == "array" then . else [] end';
|
|
3405
|
+
const hookScriptPath = join2(claudeDir, "agt-pre-compact-hook.sh");
|
|
3406
|
+
const hookScript = [
|
|
3407
|
+
"#!/bin/bash",
|
|
3408
|
+
"# Auto-generated by Augmented (ENG-7339) - PreCompact courtesy notice.",
|
|
3409
|
+
"# Fires just before the session compacts its context. If a channel",
|
|
3410
|
+
"# conversation is live, drops a notice into <channel>-notice-outbox so the",
|
|
3411
|
+
"# channel MCP server can tell the user the agent is briefly reorganizing",
|
|
3412
|
+
"# memory (the agent can't speak during compaction). Must never block",
|
|
3413
|
+
"# compaction: every failure path exits 0.",
|
|
3414
|
+
"set -uo pipefail",
|
|
3415
|
+
`trap 'ec=$?; echo "agt-pre-compact-hook failed (exit $ec) at line $LINENO: $BASH_COMMAND" >&2; exit 0' ERR`,
|
|
3416
|
+
"",
|
|
3417
|
+
`AGENT_DIR="${agentDir}"`,
|
|
3418
|
+
"INPUT=$(cat 2>/dev/null || true)",
|
|
3419
|
+
"",
|
|
3420
|
+
"# --- Gate: compaction-notice flag (env override > flags-cache > off) -----",
|
|
3421
|
+
'# Default OFF, so only an explicit "true" (env or cache) arms the notice.',
|
|
3422
|
+
"# Mirrors the orient hook's flag resolution; the cache lives one dir above",
|
|
3423
|
+
"# AGENT_DIR at ~/.augmented/flags-cache.json.",
|
|
3424
|
+
"NOTICE_ON=0",
|
|
3425
|
+
'case "${AGT_COMPACTION_NOTICE_ENABLED:-}" in',
|
|
3426
|
+
" true|1|yes|on) NOTICE_ON=1 ;;",
|
|
3427
|
+
" false|0|no|off) NOTICE_ON=0 ;;",
|
|
3428
|
+
" *)",
|
|
3429
|
+
' FLAGS_CACHE="$(dirname "$AGENT_DIR")/flags-cache.json"',
|
|
3430
|
+
` if [ -f "$FLAGS_CACHE" ] && [ "$(jq -r '.flags["compaction-notice"]' "$FLAGS_CACHE" 2>/dev/null || echo null)" = "true" ]; then`,
|
|
3431
|
+
" NOTICE_ON=1",
|
|
3432
|
+
" fi",
|
|
3433
|
+
" ;;",
|
|
3434
|
+
"esac",
|
|
3435
|
+
'if [ "$NOTICE_ON" != "1" ]; then exit 0; fi',
|
|
3436
|
+
"",
|
|
3437
|
+
"# --- Debounce: at most one notice per agent per 60s ----------------------",
|
|
3438
|
+
"# Auto-compaction is a whole-session event; a single window is enough and",
|
|
3439
|
+
"# guards against a manual+auto double-fire spamming the user.",
|
|
3440
|
+
'NOTICE_MARKER="${AGENT_DIR}/.compaction-notice-last"',
|
|
3441
|
+
'if [ -f "$NOTICE_MARKER" ]; then',
|
|
3442
|
+
' LAST=$(cat "$NOTICE_MARKER" 2>/dev/null || echo 0)',
|
|
3443
|
+
" NOW=$(date +%s 2>/dev/null || echo 0)",
|
|
3444
|
+
' if [ "${LAST:-0}" -gt 0 ] 2>/dev/null && [ $((NOW - LAST)) -lt 60 ] 2>/dev/null; then exit 0; fi',
|
|
3445
|
+
"fi",
|
|
3446
|
+
"",
|
|
3447
|
+
"# --- Find the live conversation (last <channel ...> tag) -----------------",
|
|
3448
|
+
`TRANSCRIPT_PATH=$(printf "%s" "$INPUT" | jq -r '.transcript_path // empty' 2>/dev/null || true)`,
|
|
3449
|
+
'if [ -z "$TRANSCRIPT_PATH" ] || [ ! -f "$TRANSCRIPT_PATH" ]; then exit 0; fi',
|
|
3450
|
+
"# Scan only the tail, skip assistant-authored records (an agent quoting a",
|
|
3451
|
+
"# <channel> tag in its own text must not become the target), flatten",
|
|
3452
|
+
"# newlines per text block so a multi-line thread_context preamble cannot",
|
|
3453
|
+
"# split the opening tag across lines (ENG-6467). Take the LAST tag = the",
|
|
3454
|
+
"# conversation the user is currently on.",
|
|
3455
|
+
`CHANNEL_TAG=$(tail -400 "$TRANSCRIPT_PATH" | jq -r 'select((.type // "") != "assistant" and (.role // "") != "assistant") | ${jqNormalizeContent} | map(select(type == "object" and .type == "text") | .text | gsub("[\\n\\r]+"; " ")) | join(" ")' 2>/dev/null | grep -oE '<channel [^>]+>' | tail -1 || true)`,
|
|
3456
|
+
'if [ -z "$CHANNEL_TAG" ]; then exit 0; fi',
|
|
3457
|
+
`TAG_SOURCE=$(printf "%s" "$CHANNEL_TAG" | grep -oE 'source="[^"]+"' | head -1 | sed 's/source="\\(.*\\)"/\\1/' || true)`,
|
|
3458
|
+
'if [ -z "$TAG_SOURCE" ]; then exit 0; fi',
|
|
3459
|
+
'extract_attr() { echo "$1" | grep -oE "$2=\\"[^\\"]+\\"" | head -1 | sed -E "s/$2=\\"(.*)\\"/\\\\1/"; }',
|
|
3460
|
+
"",
|
|
3461
|
+
"# The notice. No em-dash (house style); no \u{1F44B} wave (reserved for the",
|
|
3462
|
+
"# back-online greeting) and no \u{1F7E2}.",
|
|
3463
|
+
'NOTICE="Give me a moment while I reorganize my memory so I can keep our conversation going. I will pick this back up in a few seconds."',
|
|
3464
|
+
"",
|
|
3465
|
+
"# Atomic write: jq \u2192 tmp in the same dir, then rename. The channel-side",
|
|
3466
|
+
"# fs.watch only fires on rename, so the file is never observed mid-write.",
|
|
3467
|
+
"atomic_write_payload() {",
|
|
3468
|
+
' local out_dir="$1" final="$2" jq_expr="$3"; shift 3',
|
|
3469
|
+
' mkdir -p "$out_dir"',
|
|
3470
|
+
' local tmp="$out_dir/.${final##*/}.tmp"',
|
|
3471
|
+
' jq -n "$jq_expr" "$@" > "$tmp"',
|
|
3472
|
+
' chmod 600 "$tmp" 2>/dev/null || true',
|
|
3473
|
+
' mv -f "$tmp" "$out_dir/$final"',
|
|
3474
|
+
"}",
|
|
3475
|
+
"TS=$(date -u +%Y%m%dT%H%M%S%N)",
|
|
3476
|
+
"WROTE=0",
|
|
3477
|
+
'if [ "$TAG_SOURCE" = "slack" ]; then',
|
|
3478
|
+
' CHANNEL=$(extract_attr "$CHANNEL_TAG" "channel")',
|
|
3479
|
+
' THREAD_TS=$(extract_attr "$CHANNEL_TAG" "thread_ts")',
|
|
3480
|
+
' if [ -n "$CHANNEL" ]; then',
|
|
3481
|
+
' atomic_write_payload "${AGENT_DIR}/slack-notice-outbox" "${TS}.json" \\',
|
|
3482
|
+
` '{channel:$c, thread_ts:$th, text:$t, source:"compaction-notice"}' \\`,
|
|
3483
|
+
' --arg c "$CHANNEL" --arg th "$THREAD_TS" --arg t "$NOTICE"',
|
|
3484
|
+
" WROTE=1",
|
|
3485
|
+
" fi",
|
|
3486
|
+
'elif [ "$TAG_SOURCE" = "telegram" ]; then',
|
|
3487
|
+
' CHAT_ID=$(extract_attr "$CHANNEL_TAG" "chat_id")',
|
|
3488
|
+
' if [ -n "$CHAT_ID" ]; then',
|
|
3489
|
+
' atomic_write_payload "${AGENT_DIR}/telegram-notice-outbox" "${TS}.json" \\',
|
|
3490
|
+
` '{chat_id:$c, text:$t, source:"compaction-notice"}' \\`,
|
|
3491
|
+
' --arg c "$CHAT_ID" --arg t "$NOTICE"',
|
|
3492
|
+
" WROTE=1",
|
|
3493
|
+
" fi",
|
|
3494
|
+
'elif [ "$TAG_SOURCE" = "msteams" ]; then',
|
|
3495
|
+
' CONVERSATION_ID=$(extract_attr "$CHANNEL_TAG" "conversation_id")',
|
|
3496
|
+
' SERVICE_URL=$(extract_attr "$CHANNEL_TAG" "service_url")',
|
|
3497
|
+
' REPLY_TO_ID=$(extract_attr "$CHANNEL_TAG" "reply_to_id")',
|
|
3498
|
+
' if [ -n "$CONVERSATION_ID" ] && [ -n "$SERVICE_URL" ]; then',
|
|
3499
|
+
' atomic_write_payload "${AGENT_DIR}/msteams-notice-outbox" "${TS}.json" \\',
|
|
3500
|
+
` '{conversation_id:$c, service_url:$s, reply_to_id:$r, text:$t, source:"compaction-notice"}' \\`,
|
|
3501
|
+
' --arg c "$CONVERSATION_ID" --arg s "$SERVICE_URL" --arg r "$REPLY_TO_ID" --arg t "$NOTICE"',
|
|
3502
|
+
" WROTE=1",
|
|
3503
|
+
" fi",
|
|
3504
|
+
"fi",
|
|
3505
|
+
"# direct-chat and any other source: no notice-outbox consumer, stay silent.",
|
|
3506
|
+
'if [ "$WROTE" = "1" ]; then date +%s > "$NOTICE_MARKER" 2>/dev/null || true; fi',
|
|
3507
|
+
"exit 0"
|
|
3508
|
+
].join("\n") + "\n";
|
|
3509
|
+
writeFileSync3(hookScriptPath, hookScript, { mode: 493 });
|
|
3510
|
+
chmodSync3(hookScriptPath, 493);
|
|
3511
|
+
const settingsPath = join2(claudeDir, "settings.local.json");
|
|
3512
|
+
let settings = {};
|
|
3513
|
+
try {
|
|
3514
|
+
settings = JSON.parse(readFileSync3(settingsPath, "utf-8"));
|
|
3515
|
+
} catch {
|
|
3516
|
+
}
|
|
3517
|
+
const hooks = settings["hooks"] ?? {};
|
|
3518
|
+
const existingPreCompact = Array.isArray(hooks["PreCompact"]) ? [...hooks["PreCompact"]] : [];
|
|
3519
|
+
for (const matcher of ["auto", "manual"]) {
|
|
3520
|
+
const alreadyRegistered = existingPreCompact.some((entry) => {
|
|
3521
|
+
const entryMatcher = entry.matcher;
|
|
3522
|
+
const entryHooks = entry.hooks;
|
|
3523
|
+
return entryMatcher === matcher && Array.isArray(entryHooks) && entryHooks.some((h) => typeof h === "object" && h !== null && h.type === "command" && h.command === hookScriptPath);
|
|
3524
|
+
});
|
|
3525
|
+
if (!alreadyRegistered) {
|
|
3526
|
+
existingPreCompact.push({
|
|
3527
|
+
matcher,
|
|
3528
|
+
hooks: [{ type: "command", command: hookScriptPath }]
|
|
3529
|
+
});
|
|
3530
|
+
}
|
|
3531
|
+
}
|
|
3532
|
+
hooks["PreCompact"] = existingPreCompact;
|
|
3533
|
+
settings["hooks"] = hooks;
|
|
3534
|
+
writeFileSync3(settingsPath, JSON.stringify(settings, null, 2));
|
|
3535
|
+
}
|
|
3398
3536
|
function provisionSessionStateHook(codeName) {
|
|
3399
3537
|
const projectDir = getProjectDir(codeName);
|
|
3400
3538
|
const claudeDir = join2(projectDir, ".claude");
|
|
@@ -5529,7 +5667,7 @@ function requireHost() {
|
|
|
5529
5667
|
}
|
|
5530
5668
|
|
|
5531
5669
|
// src/lib/api-client.ts
|
|
5532
|
-
var agtCliVersion = true ? "0.28.
|
|
5670
|
+
var agtCliVersion = true ? "0.28.224" : "dev";
|
|
5533
5671
|
var lastConfigHash = null;
|
|
5534
5672
|
function setConfigHash(hash) {
|
|
5535
5673
|
lastConfigHash = hash && hash.length > 0 ? hash : null;
|
|
@@ -7529,6 +7667,7 @@ export {
|
|
|
7529
7667
|
provisionAutoKanbanProgressHook,
|
|
7530
7668
|
provisionChannelProgressHook,
|
|
7531
7669
|
provisionOrientHook,
|
|
7670
|
+
provisionPreCompactHook,
|
|
7532
7671
|
provisionSessionStateHook,
|
|
7533
7672
|
setJsonMode,
|
|
7534
7673
|
isJsonMode,
|
|
@@ -7581,4 +7720,4 @@ export {
|
|
|
7581
7720
|
managerInstallSystemUnitCommand,
|
|
7582
7721
|
managerUninstallSystemUnitCommand
|
|
7583
7722
|
};
|
|
7584
|
-
//# sourceMappingURL=chunk-
|
|
7723
|
+
//# sourceMappingURL=chunk-TPL4KIC5.js.map
|