@integrity-labs/agt-cli 0.28.1164 → 0.28.1165
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/{chunk-CHTG2VLG.js → chunk-FGPPJKJ5.js} +3 -3
- package/dist/{chunk-6SIOI32E.js → chunk-MBNPMML4.js} +5 -5
- package/dist/{chunk-WPNCOXIB.js → chunk-T7NKHOJF.js} +2 -2
- package/dist/{chunk-DR7PAO2Y.js → chunk-TNPLCJIG.js} +178 -1
- package/dist/chunk-TNPLCJIG.js.map +1 -0
- package/dist/{chunk-J3LCXQGY.js → chunk-ZDHCIJL6.js} +2 -2
- package/dist/{claude-code-updater-L7C3DZJ3.js → claude-code-updater-EM3AY2PR.js} +3 -3
- package/dist/{claude-pair-runtime-EQVMQMTF.js → claude-pair-runtime-P45H3GNC.js} +3 -3
- package/dist/lib/manager-worker.js +19 -19
- package/dist/mcp/direct-chat-channel.js +179 -2
- package/dist/mcp/index.js +181 -4
- package/dist/mcp/origami.js +179 -2
- package/dist/mcp/slack-channel.js +179 -2
- package/dist/mcp/telegram-channel.js +179 -2
- package/dist/{persistent-session-BP3EXMFT.js → persistent-session-KSV7RIQQ.js} +4 -4
- package/dist/{responsiveness-probe-ASP2NY2K.js → responsiveness-probe-XVYYSQQN.js} +4 -4
- package/dist/{session-auth-dead-KR2CABKC.js → session-auth-dead-KMMDVC5E.js} +3 -3
- package/package.json +1 -1
- package/dist/chunk-DR7PAO2Y.js.map +0 -1
- /package/dist/{chunk-CHTG2VLG.js.map → chunk-FGPPJKJ5.js.map} +0 -0
- /package/dist/{chunk-6SIOI32E.js.map → chunk-MBNPMML4.js.map} +0 -0
- /package/dist/{chunk-WPNCOXIB.js.map → chunk-T7NKHOJF.js.map} +0 -0
- /package/dist/{chunk-J3LCXQGY.js.map → chunk-ZDHCIJL6.js.map} +0 -0
- /package/dist/{claude-code-updater-L7C3DZJ3.js.map → claude-code-updater-EM3AY2PR.js.map} +0 -0
- /package/dist/{claude-pair-runtime-EQVMQMTF.js.map → claude-pair-runtime-P45H3GNC.js.map} +0 -0
- /package/dist/{persistent-session-BP3EXMFT.js.map → persistent-session-KSV7RIQQ.js.map} +0 -0
- /package/dist/{responsiveness-probe-ASP2NY2K.js.map → responsiveness-probe-XVYYSQQN.js.map} +0 -0
- /package/dist/{session-auth-dead-KR2CABKC.js.map → session-auth-dead-KMMDVC5E.js.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
encodeClaudeProjectPath
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-TNPLCJIG.js";
|
|
4
4
|
|
|
5
5
|
// src/lib/daily-session.ts
|
|
6
6
|
import { randomUUID } from "crypto";
|
|
@@ -235,4 +235,4 @@ export {
|
|
|
235
235
|
peekCurrentSession,
|
|
236
236
|
readDailySessionPin
|
|
237
237
|
};
|
|
238
|
-
//# sourceMappingURL=chunk-
|
|
238
|
+
//# sourceMappingURL=chunk-ZDHCIJL6.js.map
|
|
@@ -12,9 +12,9 @@ import {
|
|
|
12
12
|
probeClaudeInstalls,
|
|
13
13
|
readsAsNativeInstall,
|
|
14
14
|
shouldRunClaudeCodeUpdater
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-T7NKHOJF.js";
|
|
16
16
|
import "./chunk-XWVM4KPK.js";
|
|
17
|
-
import "./chunk-
|
|
17
|
+
import "./chunk-TNPLCJIG.js";
|
|
18
18
|
import "./chunk-EL5MWGGH.js";
|
|
19
19
|
import "./chunk-DGUM43GV.js";
|
|
20
20
|
export {
|
|
@@ -32,4 +32,4 @@ export {
|
|
|
32
32
|
readsAsNativeInstall,
|
|
33
33
|
shouldRunClaudeCodeUpdater
|
|
34
34
|
};
|
|
35
|
-
//# sourceMappingURL=claude-code-updater-
|
|
35
|
+
//# sourceMappingURL=claude-code-updater-EM3AY2PR.js.map
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
import {
|
|
9
9
|
redactPaneFrame,
|
|
10
10
|
sanitizeTerminalFrame
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-TNPLCJIG.js";
|
|
12
12
|
import {
|
|
13
13
|
CLAUDE_CONFIG_DIR_ENV,
|
|
14
14
|
claudeConfigDirFor,
|
|
@@ -321,7 +321,7 @@ async function spawnPairSession(session) {
|
|
|
321
321
|
return { ok: true };
|
|
322
322
|
} catch {
|
|
323
323
|
}
|
|
324
|
-
const { resolveClaudeBinary } = await import("./persistent-session-
|
|
324
|
+
const { resolveClaudeBinary } = await import("./persistent-session-KSV7RIQQ.js");
|
|
325
325
|
const claudeBin = resolveClaudeBinary();
|
|
326
326
|
const pairEnv = {
|
|
327
327
|
...process.env,
|
|
@@ -836,4 +836,4 @@ export {
|
|
|
836
836
|
startClaudePair,
|
|
837
837
|
submitClaudePairCode
|
|
838
838
|
};
|
|
839
|
-
//# sourceMappingURL=claude-pair-runtime-
|
|
839
|
+
//# sourceMappingURL=claude-pair-runtime-P45H3GNC.js.map
|
|
@@ -77,7 +77,7 @@ import {
|
|
|
77
77
|
setConfigHash,
|
|
78
78
|
shellGuard,
|
|
79
79
|
tripClass
|
|
80
|
-
} from "../chunk-
|
|
80
|
+
} from "../chunk-MBNPMML4.js";
|
|
81
81
|
import {
|
|
82
82
|
CLAUDE_CODE_SECURITY_FLOOR,
|
|
83
83
|
SELF_UPDATE_TIMEOUTS,
|
|
@@ -90,7 +90,7 @@ import {
|
|
|
90
90
|
runSafeCleanup,
|
|
91
91
|
tightestDiskStat,
|
|
92
92
|
withPackageCacheLock
|
|
93
|
-
} from "../chunk-
|
|
93
|
+
} from "../chunk-T7NKHOJF.js";
|
|
94
94
|
import {
|
|
95
95
|
getProjectDir as getProjectDir2,
|
|
96
96
|
getReadyTasks,
|
|
@@ -177,7 +177,7 @@ import {
|
|
|
177
177
|
webFetchBaselineValue,
|
|
178
178
|
webFetchRestartNeeded,
|
|
179
179
|
writeEgressAllowlist
|
|
180
|
-
} from "../chunk-
|
|
180
|
+
} from "../chunk-FGPPJKJ5.js";
|
|
181
181
|
import {
|
|
182
182
|
isAgentIdle,
|
|
183
183
|
isStaleForToday,
|
|
@@ -186,7 +186,7 @@ import {
|
|
|
186
186
|
sessionTranscriptDir,
|
|
187
187
|
subagentActivityAgeSeconds,
|
|
188
188
|
transcriptActivityAgeSeconds
|
|
189
|
-
} from "../chunk-
|
|
189
|
+
} from "../chunk-ZDHCIJL6.js";
|
|
190
190
|
import {
|
|
191
191
|
classifyUnanswerablePane,
|
|
192
192
|
focusedConfirmDialogBlock,
|
|
@@ -304,7 +304,7 @@ import {
|
|
|
304
304
|
serializeAccountEnforcementMarker,
|
|
305
305
|
stabiliseResetInstant,
|
|
306
306
|
sumTranscriptUsageInWindow
|
|
307
|
-
} from "../chunk-
|
|
307
|
+
} from "../chunk-TNPLCJIG.js";
|
|
308
308
|
import {
|
|
309
309
|
CLAUDE_CONFIG_DIR_ENV,
|
|
310
310
|
claudeConfigDirFor,
|
|
@@ -15082,7 +15082,7 @@ var pendingDayRolloverReset = /* @__PURE__ */ new Set();
|
|
|
15082
15082
|
var dayRolloverInboundHold = /* @__PURE__ */ new Map();
|
|
15083
15083
|
var INBOUND_HOLD_EPISODE_GAP_MS = 12e4;
|
|
15084
15084
|
async function channelInboundActivityAgeSecondsFor(codeName) {
|
|
15085
|
-
const { newestPendingInboundActivityMtimeMs } = await import("../responsiveness-probe-
|
|
15085
|
+
const { newestPendingInboundActivityMtimeMs } = await import("../responsiveness-probe-XVYYSQQN.js");
|
|
15086
15086
|
const newest = newestPendingInboundActivityMtimeMs(dirname11(paneLogPath(codeName)));
|
|
15087
15087
|
if (newest === null) return null;
|
|
15088
15088
|
return Math.max(0, Math.floor((Date.now() - newest) / 1e3));
|
|
@@ -15874,7 +15874,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
|
|
|
15874
15874
|
var lastVersionCheckAt = 0;
|
|
15875
15875
|
var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
|
|
15876
15876
|
var lastResponsivenessProbeAt = 0;
|
|
15877
|
-
var agtCliVersion = true ? "0.28.
|
|
15877
|
+
var agtCliVersion = true ? "0.28.1165" : "dev";
|
|
15878
15878
|
function resolveBrewPath(execFileSync3) {
|
|
15879
15879
|
try {
|
|
15880
15880
|
const out = execFileSync3("which", ["brew"], { timeout: 5e3 }).toString().trim();
|
|
@@ -17674,7 +17674,7 @@ function flushRestartedAgentDiagnostics(hostId, codeNames) {
|
|
|
17674
17674
|
if (codeNames.length === 0) return;
|
|
17675
17675
|
void (async () => {
|
|
17676
17676
|
try {
|
|
17677
|
-
const { collectDiagnostics } = await import("../persistent-session-
|
|
17677
|
+
const { collectDiagnostics } = await import("../persistent-session-KSV7RIQQ.js");
|
|
17678
17678
|
await api.post("/host/heartbeat", {
|
|
17679
17679
|
host_id: hostId,
|
|
17680
17680
|
agent_diagnostics: collectDiagnostics(codeNames, quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor, runtimeVersionFor)
|
|
@@ -17817,7 +17817,7 @@ async function pollCycleInner() {
|
|
|
17817
17817
|
}
|
|
17818
17818
|
try {
|
|
17819
17819
|
const { detectHostSecurity } = await import("../host-security-KQYYZZVW.js");
|
|
17820
|
-
const { collectDiagnostics } = await import("../persistent-session-
|
|
17820
|
+
const { collectDiagnostics } = await import("../persistent-session-KSV7RIQQ.js");
|
|
17821
17821
|
const diagCodeNames = [...agentState.persistentSessionAgents];
|
|
17822
17822
|
const agentDiagnostics = diagCodeNames.length > 0 ? collectDiagnostics(diagCodeNames, quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor, runtimeVersionFor) : void 0;
|
|
17823
17823
|
let tailscaleHostname;
|
|
@@ -18017,7 +18017,7 @@ async function pollCycleInner() {
|
|
|
18017
18017
|
setConfigHash(hbResp?.config_hash ?? null);
|
|
18018
18018
|
try {
|
|
18019
18019
|
const desiredClaudeCodeVersion = hbResp?.desired_claude_code_version?.trim();
|
|
18020
|
-
const { maybeUpdateClaudeCode, shouldRunClaudeCodeUpdater } = await import("../claude-code-updater-
|
|
18020
|
+
const { maybeUpdateClaudeCode, shouldRunClaudeCodeUpdater } = await import("../claude-code-updater-EM3AY2PR.js");
|
|
18021
18021
|
claudeUpdaterInFlight = true;
|
|
18022
18022
|
if (desiredClaudeCodeVersion && (claudePairLoop.busy || claudePairingInProgress())) {
|
|
18023
18023
|
log(
|
|
@@ -18049,7 +18049,7 @@ async function pollCycleInner() {
|
|
|
18049
18049
|
collectPanelessActivityProbes,
|
|
18050
18050
|
getResponsivenessIntervalMs,
|
|
18051
18051
|
occupancyQualificationClassifications
|
|
18052
|
-
} = await import("../responsiveness-probe-
|
|
18052
|
+
} = await import("../responsiveness-probe-XVYYSQQN.js");
|
|
18053
18053
|
const probeIntervalMs = getResponsivenessIntervalMs();
|
|
18054
18054
|
if (now - lastResponsivenessProbeAt > probeIntervalMs) {
|
|
18055
18055
|
const probeCodeNames = [...agentState.persistentSessionAgents];
|
|
@@ -18166,7 +18166,7 @@ async function pollCycleInner() {
|
|
|
18166
18166
|
collectResponsivenessProbes,
|
|
18167
18167
|
livePendingInboundOldestAgeSeconds,
|
|
18168
18168
|
parkPendingInbound
|
|
18169
|
-
} = await import("../responsiveness-probe-
|
|
18169
|
+
} = await import("../responsiveness-probe-XVYYSQQN.js");
|
|
18170
18170
|
const { getProjectDir: wedgeProjectDir } = await import("../scheduler-engine-M6AFZWNU.js");
|
|
18171
18171
|
const wedgeNow = /* @__PURE__ */ new Date();
|
|
18172
18172
|
const liveAgents = agentState.persistentSessionAgents;
|
|
@@ -18452,7 +18452,7 @@ async function pollCycleInner() {
|
|
|
18452
18452
|
}
|
|
18453
18453
|
}
|
|
18454
18454
|
);
|
|
18455
|
-
const { parkPendingInbound } = await import("../responsiveness-probe-
|
|
18455
|
+
const { parkPendingInbound } = await import("../responsiveness-probe-XVYYSQQN.js");
|
|
18456
18456
|
const { parked, deadLettered } = parkPendingInbound(codeName, new Date(fatalNowMs));
|
|
18457
18457
|
paneFatalStreak.delete(codeName);
|
|
18458
18458
|
paneFatalRestarts.set(codeName, [...history, fatalNowMs]);
|
|
@@ -18483,7 +18483,7 @@ async function pollCycleInner() {
|
|
|
18483
18483
|
TRANSCRIPT_MOUNT_ESCALATION_REFRESH_MS,
|
|
18484
18484
|
bindSourceEscalations
|
|
18485
18485
|
} = await import("../transcript-mount-health-OHE6IVJV.js");
|
|
18486
|
-
const { transcriptBindSourcesFor, ensureTranscriptBindSources } = await import("../persistent-session-
|
|
18486
|
+
const { transcriptBindSourcesFor, ensureTranscriptBindSources } = await import("../persistent-session-KSV7RIQQ.js");
|
|
18487
18487
|
const mountConfig = resolveTranscriptMountConfig();
|
|
18488
18488
|
const liveAgents = agentState.persistentSessionAgents;
|
|
18489
18489
|
for (const tracked of [
|
|
@@ -18648,7 +18648,7 @@ async function pollCycleInner() {
|
|
|
18648
18648
|
}
|
|
18649
18649
|
try {
|
|
18650
18650
|
const { scrapeMcpFailedBannerCount } = await import("../pane-mcp-banner-scraper-VR5QGP3J.js");
|
|
18651
|
-
const { probeSessionAuth } = await import("../session-auth-dead-
|
|
18651
|
+
const { probeSessionAuth } = await import("../session-auth-dead-KMMDVC5E.js");
|
|
18652
18652
|
const observations = [];
|
|
18653
18653
|
const pendingCacheCommits = [];
|
|
18654
18654
|
const modelApiErrorReportingOn = hostFlagStore().getBoolean("model-api-error-reporting");
|
|
@@ -23316,7 +23316,7 @@ async function handleRestartDoorbell(agentId, requestedAt, restartReason) {
|
|
|
23316
23316
|
try {
|
|
23317
23317
|
const freshId = rotateSessionForWedge(codeName);
|
|
23318
23318
|
consecutiveWedgeCycles.delete(codeName);
|
|
23319
|
-
const { parkPendingInbound: parkForRestart } = await import("../responsiveness-probe-
|
|
23319
|
+
const { parkPendingInbound: parkForRestart } = await import("../responsiveness-probe-XVYYSQQN.js");
|
|
23320
23320
|
const { parked, deadLettered } = parkForRestart(codeName, /* @__PURE__ */ new Date());
|
|
23321
23321
|
const parkNote = parked > 0 ? `, ${parked} inbound parked` : "";
|
|
23322
23322
|
const deadNote = deadLettered > 0 ? `, ${deadLettered} undeliverable dead-lettered` : "";
|
|
@@ -23359,7 +23359,7 @@ async function handleRestartDoorbell(agentId, requestedAt, restartReason) {
|
|
|
23359
23359
|
void api.post("/host/restart-ack", { host_id: hostId, agent_id: agentId, restart_requested_at: requestedAt }).catch((err) => log(`[restart-lane] ack failed for '${codeName}': ${err.message}`));
|
|
23360
23360
|
void (async () => {
|
|
23361
23361
|
try {
|
|
23362
|
-
const { collectDiagnostics } = await import("../persistent-session-
|
|
23362
|
+
const { collectDiagnostics } = await import("../persistent-session-KSV7RIQQ.js");
|
|
23363
23363
|
await api.post("/host/heartbeat", {
|
|
23364
23364
|
host_id: hostId,
|
|
23365
23365
|
agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor, runtimeVersionFor)
|
|
@@ -23410,7 +23410,7 @@ async function respawnAgentAfterMcpStop(codeName, reason) {
|
|
|
23410
23410
|
}
|
|
23411
23411
|
try {
|
|
23412
23412
|
const hostId = await getHostId();
|
|
23413
|
-
const { collectDiagnostics } = await import("../persistent-session-
|
|
23413
|
+
const { collectDiagnostics } = await import("../persistent-session-KSV7RIQQ.js");
|
|
23414
23414
|
await api.post("/host/heartbeat", {
|
|
23415
23415
|
host_id: hostId,
|
|
23416
23416
|
agent_diagnostics: collectDiagnostics([codeName], quarantineEntriesFor, claudeMdSizeFor, spawnOutcomeForDiagnostics, pidPressureFor, forwardedToolsFor, runtimeVersionFor)
|
|
@@ -24104,7 +24104,7 @@ async function processClaudePairSessions(agents) {
|
|
|
24104
24104
|
snapshotPairConfig,
|
|
24105
24105
|
// ENG-11659: result -> report body + the manager.log line that records it.
|
|
24106
24106
|
planPairStartReport
|
|
24107
|
-
} = await import("../claude-pair-runtime-
|
|
24107
|
+
} = await import("../claude-pair-runtime-P45H3GNC.js");
|
|
24108
24108
|
const { resetClaudeSignin, describeSigninResetForLog, describeSigninResetFailure } = await import("../claude-signin-reset-EF3UO5IK.js");
|
|
24109
24109
|
for (const pairId of pendingResp.cancelled_pair_ids ?? []) {
|
|
24110
24110
|
log(`[claude-pair] sweeping orphan tmux session for pair ${pairId.slice(0, 8)}`);
|
|
@@ -19117,7 +19117,7 @@ var require_filters = __commonJS({
|
|
|
19117
19117
|
return r.copySafeness(str, str.replace(/^\s*|\s*$/g, ""));
|
|
19118
19118
|
}
|
|
19119
19119
|
_exports.trim = trim;
|
|
19120
|
-
function
|
|
19120
|
+
function truncate2(input, length, killwords, end) {
|
|
19121
19121
|
var orig = input;
|
|
19122
19122
|
input = normalize(input, "");
|
|
19123
19123
|
length = length || 255;
|
|
@@ -19136,7 +19136,7 @@ var require_filters = __commonJS({
|
|
|
19136
19136
|
input += end !== void 0 && end !== null ? end : "...";
|
|
19137
19137
|
return r.copySafeness(orig, input);
|
|
19138
19138
|
}
|
|
19139
|
-
_exports.truncate =
|
|
19139
|
+
_exports.truncate = truncate2;
|
|
19140
19140
|
function upper(str) {
|
|
19141
19141
|
str = normalize(str, "");
|
|
19142
19142
|
return str.toUpperCase();
|
|
@@ -43719,6 +43719,183 @@ var videoRenderTriggerAdapter = {
|
|
|
43719
43719
|
};
|
|
43720
43720
|
registerTriggerSource(videoRenderTriggerAdapter);
|
|
43721
43721
|
|
|
43722
|
+
// ../core/dist/triggers/adapters/webhook.js
|
|
43723
|
+
var WEBHOOK_TRIGGER_PROVIDER = "webhook";
|
|
43724
|
+
var WEBHOOK_MAX_BODY_BYTES = 1280 * 1024;
|
|
43725
|
+
var WEBHOOK_PROMPT_MAX_CHARS = 8e3;
|
|
43726
|
+
var WEBHOOK_RAW_MAX_CHARS = 64 * 1024;
|
|
43727
|
+
var WEBHOOK_INSTRUCTION_MAX_CHARS = 2e3;
|
|
43728
|
+
var WEBHOOK_NAME_MAX_CHARS = 80;
|
|
43729
|
+
var WEBHOOK_DEFAULT_RATE_CAP = 60;
|
|
43730
|
+
var WEBHOOK_MAX_RATE_CAP = 1e3;
|
|
43731
|
+
var WEBHOOK_PRESETS = {
|
|
43732
|
+
// https://docs.aws.amazon.com/eventbridge/latest/ref/overiew-event-structure.html
|
|
43733
|
+
eventbridge: {
|
|
43734
|
+
dedupPath: "id",
|
|
43735
|
+
eventTypePaths: ["source", "detail-type"],
|
|
43736
|
+
payloadPath: "detail",
|
|
43737
|
+
timePath: "time"
|
|
43738
|
+
},
|
|
43739
|
+
// Raw-body hash dedup, whole body as payload. Set dedup_path when the
|
|
43740
|
+
// sender has a stable id, or two identical bodies collapse into one.
|
|
43741
|
+
generic: {}
|
|
43742
|
+
};
|
|
43743
|
+
var PATH_RE = /^[A-Za-z0-9_$-]+(\.[A-Za-z0-9_$-]+){0,9}$/;
|
|
43744
|
+
function readPath(value, path) {
|
|
43745
|
+
let cur = value;
|
|
43746
|
+
for (const key of path.split(".")) {
|
|
43747
|
+
if (cur === null || typeof cur !== "object" || Array.isArray(cur))
|
|
43748
|
+
return void 0;
|
|
43749
|
+
if (!Object.prototype.hasOwnProperty.call(cur, key))
|
|
43750
|
+
return void 0;
|
|
43751
|
+
cur = cur[key];
|
|
43752
|
+
}
|
|
43753
|
+
return cur;
|
|
43754
|
+
}
|
|
43755
|
+
function scalarString(v) {
|
|
43756
|
+
if (typeof v === "string")
|
|
43757
|
+
return v.length > 0 ? v : null;
|
|
43758
|
+
if (typeof v === "number" && Number.isFinite(v))
|
|
43759
|
+
return String(v);
|
|
43760
|
+
return null;
|
|
43761
|
+
}
|
|
43762
|
+
function truncate(text, max) {
|
|
43763
|
+
if (text.length <= max)
|
|
43764
|
+
return text;
|
|
43765
|
+
return `${text.slice(0, max)}
|
|
43766
|
+
... [truncated ${text.length - max} more characters]`;
|
|
43767
|
+
}
|
|
43768
|
+
function resolvePreset(config2) {
|
|
43769
|
+
const name = config2["preset"];
|
|
43770
|
+
const base = typeof name === "string" && name in WEBHOOK_PRESETS ? WEBHOOK_PRESETS[name] : WEBHOOK_PRESETS.generic;
|
|
43771
|
+
const dedup = config2["dedup_path"];
|
|
43772
|
+
const type = config2["event_type_path"];
|
|
43773
|
+
const payload = config2["payload_path"];
|
|
43774
|
+
return {
|
|
43775
|
+
...base,
|
|
43776
|
+
...typeof dedup === "string" && dedup ? { dedupPath: dedup } : {},
|
|
43777
|
+
...typeof type === "string" && type ? { eventTypePaths: [type] } : {},
|
|
43778
|
+
...typeof payload === "string" && payload ? { payloadPath: payload } : {}
|
|
43779
|
+
};
|
|
43780
|
+
}
|
|
43781
|
+
function validateWebhookConfig(input) {
|
|
43782
|
+
const out = {};
|
|
43783
|
+
const name = input["name"];
|
|
43784
|
+
if (name !== void 0) {
|
|
43785
|
+
if (typeof name !== "string")
|
|
43786
|
+
return { ok: false, error: "name must be a string" };
|
|
43787
|
+
const trimmed = name.trim();
|
|
43788
|
+
if (trimmed.length > WEBHOOK_NAME_MAX_CHARS) {
|
|
43789
|
+
return { ok: false, error: `name must be at most ${WEBHOOK_NAME_MAX_CHARS} characters` };
|
|
43790
|
+
}
|
|
43791
|
+
if (trimmed)
|
|
43792
|
+
out["name"] = trimmed;
|
|
43793
|
+
}
|
|
43794
|
+
const instruction = input["instruction"];
|
|
43795
|
+
if (typeof instruction !== "string" || !instruction.trim()) {
|
|
43796
|
+
return {
|
|
43797
|
+
ok: false,
|
|
43798
|
+
error: "instruction is required: tell the agent what to do when an event arrives"
|
|
43799
|
+
};
|
|
43800
|
+
}
|
|
43801
|
+
if (instruction.trim().length > WEBHOOK_INSTRUCTION_MAX_CHARS) {
|
|
43802
|
+
return {
|
|
43803
|
+
ok: false,
|
|
43804
|
+
error: `instruction must be at most ${WEBHOOK_INSTRUCTION_MAX_CHARS} characters`
|
|
43805
|
+
};
|
|
43806
|
+
}
|
|
43807
|
+
out["instruction"] = instruction.trim();
|
|
43808
|
+
const preset = input["preset"] ?? "generic";
|
|
43809
|
+
if (typeof preset !== "string" || !(preset in WEBHOOK_PRESETS)) {
|
|
43810
|
+
return {
|
|
43811
|
+
ok: false,
|
|
43812
|
+
error: `preset must be one of: ${Object.keys(WEBHOOK_PRESETS).join(", ")}`
|
|
43813
|
+
};
|
|
43814
|
+
}
|
|
43815
|
+
out["preset"] = preset;
|
|
43816
|
+
for (const key of ["dedup_path", "event_type_path", "payload_path"]) {
|
|
43817
|
+
const v = input[key];
|
|
43818
|
+
if (v === void 0 || v === null || v === "")
|
|
43819
|
+
continue;
|
|
43820
|
+
if (typeof v !== "string" || !PATH_RE.test(v)) {
|
|
43821
|
+
return { ok: false, error: `${key} must be a dot path like "detail.id"` };
|
|
43822
|
+
}
|
|
43823
|
+
out[key] = v;
|
|
43824
|
+
}
|
|
43825
|
+
const cap = input["max_events_per_hour"];
|
|
43826
|
+
if (cap !== void 0 && cap !== null) {
|
|
43827
|
+
if (typeof cap !== "number" || !Number.isInteger(cap) || cap < 1 || cap > WEBHOOK_MAX_RATE_CAP) {
|
|
43828
|
+
return {
|
|
43829
|
+
ok: false,
|
|
43830
|
+
error: `max_events_per_hour must be an integer from 1 to ${WEBHOOK_MAX_RATE_CAP}`
|
|
43831
|
+
};
|
|
43832
|
+
}
|
|
43833
|
+
out["max_events_per_hour"] = cap;
|
|
43834
|
+
} else {
|
|
43835
|
+
out["max_events_per_hour"] = WEBHOOK_DEFAULT_RATE_CAP;
|
|
43836
|
+
}
|
|
43837
|
+
return { ok: true, config: out };
|
|
43838
|
+
}
|
|
43839
|
+
function webhookRateCap(trigger) {
|
|
43840
|
+
const cap = trigger.config["max_events_per_hour"];
|
|
43841
|
+
if (typeof cap === "number" && Number.isInteger(cap) && cap >= 1) {
|
|
43842
|
+
return Math.min(cap, WEBHOOK_MAX_RATE_CAP);
|
|
43843
|
+
}
|
|
43844
|
+
return WEBHOOK_DEFAULT_RATE_CAP;
|
|
43845
|
+
}
|
|
43846
|
+
function buildWebhookEvent(req, config2, now = /* @__PURE__ */ new Date()) {
|
|
43847
|
+
const preset = resolvePreset(config2);
|
|
43848
|
+
const body = req.body;
|
|
43849
|
+
const raw = req.rawBody ?? JSON.stringify(body ?? null);
|
|
43850
|
+
const idValue = preset.dedupPath ? scalarString(readPath(body, preset.dedupPath)) : null;
|
|
43851
|
+
const dedupKey = idValue ? `wh:id:${stableHash(idValue)}` : `wh:raw:${stableHash(raw)}`;
|
|
43852
|
+
const typeParts = (preset.eventTypePaths ?? []).map((p2) => scalarString(readPath(body, p2))).filter((v) => v !== null).map((v) => v.slice(0, 200));
|
|
43853
|
+
const eventType = typeParts.length > 0 ? typeParts.join(" / ") : "webhook event";
|
|
43854
|
+
const timeValue = preset.timePath ? scalarString(readPath(body, preset.timePath)) : null;
|
|
43855
|
+
const timeMs = timeValue ? Date.parse(timeValue) : NaN;
|
|
43856
|
+
const occurredAt = Number.isFinite(timeMs) ? new Date(timeMs).toISOString() : now.toISOString();
|
|
43857
|
+
let payload = body;
|
|
43858
|
+
if (preset.payloadPath) {
|
|
43859
|
+
const sub = readPath(body, preset.payloadPath);
|
|
43860
|
+
if (sub !== void 0)
|
|
43861
|
+
payload = sub;
|
|
43862
|
+
}
|
|
43863
|
+
const rendered = typeof payload === "string" ? payload : JSON.stringify(payload, null, 2) ?? "null";
|
|
43864
|
+
const lines = [`Event: ${eventType}`];
|
|
43865
|
+
if (idValue)
|
|
43866
|
+
lines.push(`Event id: ${idValue.slice(0, 200)}`);
|
|
43867
|
+
lines.push("", truncate(rendered, WEBHOOK_PROMPT_MAX_CHARS));
|
|
43868
|
+
return {
|
|
43869
|
+
provider: WEBHOOK_TRIGGER_PROVIDER,
|
|
43870
|
+
occurredAt,
|
|
43871
|
+
dedupKey,
|
|
43872
|
+
sourceTrust: "untrusted",
|
|
43873
|
+
title: eventType,
|
|
43874
|
+
body: lines.join("\n"),
|
|
43875
|
+
// Keep the ledger row bounded: the full body when small, else a marker
|
|
43876
|
+
// with the head of it. Never headers (the bearer token rides there).
|
|
43877
|
+
raw: raw.length <= WEBHOOK_RAW_MAX_CHARS ? body : { truncated: true, bytes: raw.length, head: raw.slice(0, WEBHOOK_RAW_MAX_CHARS) },
|
|
43878
|
+
meaningful: true
|
|
43879
|
+
};
|
|
43880
|
+
}
|
|
43881
|
+
var webhookTriggerAdapter = {
|
|
43882
|
+
provider: WEBHOOK_TRIGGER_PROVIDER,
|
|
43883
|
+
kind: "webhook",
|
|
43884
|
+
webhookAuth: "bearer",
|
|
43885
|
+
webhookEvents: [],
|
|
43886
|
+
multiInstance: true,
|
|
43887
|
+
maxBodyBytes: WEBHOOK_MAX_BODY_BYTES,
|
|
43888
|
+
validateConfig: validateWebhookConfig,
|
|
43889
|
+
rateCapPerHour: (trigger) => webhookRateCap(trigger),
|
|
43890
|
+
// Webhook-kind triggers are minted only on POST /agents/:id/triggers
|
|
43891
|
+
// (agent.edit); /host/triggers refuses non-poll providers.
|
|
43892
|
+
operatorInstruction: true,
|
|
43893
|
+
ingest(req, trigger) {
|
|
43894
|
+
return [buildWebhookEvent(req, trigger.config)];
|
|
43895
|
+
}
|
|
43896
|
+
};
|
|
43897
|
+
registerTriggerSource(webhookTriggerAdapter);
|
|
43898
|
+
|
|
43722
43899
|
// ../core/dist/feature-flags/registry.js
|
|
43723
43900
|
var FLAG_REGISTRY = [
|
|
43724
43901
|
{
|
package/dist/mcp/index.js
CHANGED
|
@@ -19117,7 +19117,7 @@ var require_filters = __commonJS({
|
|
|
19117
19117
|
return r.copySafeness(str, str.replace(/^\s*|\s*$/g, ""));
|
|
19118
19118
|
}
|
|
19119
19119
|
_exports.trim = trim;
|
|
19120
|
-
function
|
|
19120
|
+
function truncate3(input, length, killwords, end) {
|
|
19121
19121
|
var orig = input;
|
|
19122
19122
|
input = normalize(input, "");
|
|
19123
19123
|
length = length || 255;
|
|
@@ -19136,7 +19136,7 @@ var require_filters = __commonJS({
|
|
|
19136
19136
|
input += end !== void 0 && end !== null ? end : "...";
|
|
19137
19137
|
return r.copySafeness(orig, input);
|
|
19138
19138
|
}
|
|
19139
|
-
_exports.truncate =
|
|
19139
|
+
_exports.truncate = truncate3;
|
|
19140
19140
|
function upper(str) {
|
|
19141
19141
|
str = normalize(str, "");
|
|
19142
19142
|
return str.toUpperCase();
|
|
@@ -29316,6 +29316,183 @@ var videoRenderTriggerAdapter = {
|
|
|
29316
29316
|
};
|
|
29317
29317
|
registerTriggerSource(videoRenderTriggerAdapter);
|
|
29318
29318
|
|
|
29319
|
+
// ../core/dist/triggers/adapters/webhook.js
|
|
29320
|
+
var WEBHOOK_TRIGGER_PROVIDER = "webhook";
|
|
29321
|
+
var WEBHOOK_MAX_BODY_BYTES = 1280 * 1024;
|
|
29322
|
+
var WEBHOOK_PROMPT_MAX_CHARS = 8e3;
|
|
29323
|
+
var WEBHOOK_RAW_MAX_CHARS = 64 * 1024;
|
|
29324
|
+
var WEBHOOK_INSTRUCTION_MAX_CHARS = 2e3;
|
|
29325
|
+
var WEBHOOK_NAME_MAX_CHARS = 80;
|
|
29326
|
+
var WEBHOOK_DEFAULT_RATE_CAP = 60;
|
|
29327
|
+
var WEBHOOK_MAX_RATE_CAP = 1e3;
|
|
29328
|
+
var WEBHOOK_PRESETS = {
|
|
29329
|
+
// https://docs.aws.amazon.com/eventbridge/latest/ref/overiew-event-structure.html
|
|
29330
|
+
eventbridge: {
|
|
29331
|
+
dedupPath: "id",
|
|
29332
|
+
eventTypePaths: ["source", "detail-type"],
|
|
29333
|
+
payloadPath: "detail",
|
|
29334
|
+
timePath: "time"
|
|
29335
|
+
},
|
|
29336
|
+
// Raw-body hash dedup, whole body as payload. Set dedup_path when the
|
|
29337
|
+
// sender has a stable id, or two identical bodies collapse into one.
|
|
29338
|
+
generic: {}
|
|
29339
|
+
};
|
|
29340
|
+
var PATH_RE = /^[A-Za-z0-9_$-]+(\.[A-Za-z0-9_$-]+){0,9}$/;
|
|
29341
|
+
function readPath(value, path) {
|
|
29342
|
+
let cur = value;
|
|
29343
|
+
for (const key of path.split(".")) {
|
|
29344
|
+
if (cur === null || typeof cur !== "object" || Array.isArray(cur))
|
|
29345
|
+
return void 0;
|
|
29346
|
+
if (!Object.prototype.hasOwnProperty.call(cur, key))
|
|
29347
|
+
return void 0;
|
|
29348
|
+
cur = cur[key];
|
|
29349
|
+
}
|
|
29350
|
+
return cur;
|
|
29351
|
+
}
|
|
29352
|
+
function scalarString(v) {
|
|
29353
|
+
if (typeof v === "string")
|
|
29354
|
+
return v.length > 0 ? v : null;
|
|
29355
|
+
if (typeof v === "number" && Number.isFinite(v))
|
|
29356
|
+
return String(v);
|
|
29357
|
+
return null;
|
|
29358
|
+
}
|
|
29359
|
+
function truncate(text, max) {
|
|
29360
|
+
if (text.length <= max)
|
|
29361
|
+
return text;
|
|
29362
|
+
return `${text.slice(0, max)}
|
|
29363
|
+
... [truncated ${text.length - max} more characters]`;
|
|
29364
|
+
}
|
|
29365
|
+
function resolvePreset(config2) {
|
|
29366
|
+
const name = config2["preset"];
|
|
29367
|
+
const base = typeof name === "string" && name in WEBHOOK_PRESETS ? WEBHOOK_PRESETS[name] : WEBHOOK_PRESETS.generic;
|
|
29368
|
+
const dedup = config2["dedup_path"];
|
|
29369
|
+
const type = config2["event_type_path"];
|
|
29370
|
+
const payload = config2["payload_path"];
|
|
29371
|
+
return {
|
|
29372
|
+
...base,
|
|
29373
|
+
...typeof dedup === "string" && dedup ? { dedupPath: dedup } : {},
|
|
29374
|
+
...typeof type === "string" && type ? { eventTypePaths: [type] } : {},
|
|
29375
|
+
...typeof payload === "string" && payload ? { payloadPath: payload } : {}
|
|
29376
|
+
};
|
|
29377
|
+
}
|
|
29378
|
+
function validateWebhookConfig(input) {
|
|
29379
|
+
const out = {};
|
|
29380
|
+
const name = input["name"];
|
|
29381
|
+
if (name !== void 0) {
|
|
29382
|
+
if (typeof name !== "string")
|
|
29383
|
+
return { ok: false, error: "name must be a string" };
|
|
29384
|
+
const trimmed = name.trim();
|
|
29385
|
+
if (trimmed.length > WEBHOOK_NAME_MAX_CHARS) {
|
|
29386
|
+
return { ok: false, error: `name must be at most ${WEBHOOK_NAME_MAX_CHARS} characters` };
|
|
29387
|
+
}
|
|
29388
|
+
if (trimmed)
|
|
29389
|
+
out["name"] = trimmed;
|
|
29390
|
+
}
|
|
29391
|
+
const instruction = input["instruction"];
|
|
29392
|
+
if (typeof instruction !== "string" || !instruction.trim()) {
|
|
29393
|
+
return {
|
|
29394
|
+
ok: false,
|
|
29395
|
+
error: "instruction is required: tell the agent what to do when an event arrives"
|
|
29396
|
+
};
|
|
29397
|
+
}
|
|
29398
|
+
if (instruction.trim().length > WEBHOOK_INSTRUCTION_MAX_CHARS) {
|
|
29399
|
+
return {
|
|
29400
|
+
ok: false,
|
|
29401
|
+
error: `instruction must be at most ${WEBHOOK_INSTRUCTION_MAX_CHARS} characters`
|
|
29402
|
+
};
|
|
29403
|
+
}
|
|
29404
|
+
out["instruction"] = instruction.trim();
|
|
29405
|
+
const preset = input["preset"] ?? "generic";
|
|
29406
|
+
if (typeof preset !== "string" || !(preset in WEBHOOK_PRESETS)) {
|
|
29407
|
+
return {
|
|
29408
|
+
ok: false,
|
|
29409
|
+
error: `preset must be one of: ${Object.keys(WEBHOOK_PRESETS).join(", ")}`
|
|
29410
|
+
};
|
|
29411
|
+
}
|
|
29412
|
+
out["preset"] = preset;
|
|
29413
|
+
for (const key of ["dedup_path", "event_type_path", "payload_path"]) {
|
|
29414
|
+
const v = input[key];
|
|
29415
|
+
if (v === void 0 || v === null || v === "")
|
|
29416
|
+
continue;
|
|
29417
|
+
if (typeof v !== "string" || !PATH_RE.test(v)) {
|
|
29418
|
+
return { ok: false, error: `${key} must be a dot path like "detail.id"` };
|
|
29419
|
+
}
|
|
29420
|
+
out[key] = v;
|
|
29421
|
+
}
|
|
29422
|
+
const cap = input["max_events_per_hour"];
|
|
29423
|
+
if (cap !== void 0 && cap !== null) {
|
|
29424
|
+
if (typeof cap !== "number" || !Number.isInteger(cap) || cap < 1 || cap > WEBHOOK_MAX_RATE_CAP) {
|
|
29425
|
+
return {
|
|
29426
|
+
ok: false,
|
|
29427
|
+
error: `max_events_per_hour must be an integer from 1 to ${WEBHOOK_MAX_RATE_CAP}`
|
|
29428
|
+
};
|
|
29429
|
+
}
|
|
29430
|
+
out["max_events_per_hour"] = cap;
|
|
29431
|
+
} else {
|
|
29432
|
+
out["max_events_per_hour"] = WEBHOOK_DEFAULT_RATE_CAP;
|
|
29433
|
+
}
|
|
29434
|
+
return { ok: true, config: out };
|
|
29435
|
+
}
|
|
29436
|
+
function webhookRateCap(trigger) {
|
|
29437
|
+
const cap = trigger.config["max_events_per_hour"];
|
|
29438
|
+
if (typeof cap === "number" && Number.isInteger(cap) && cap >= 1) {
|
|
29439
|
+
return Math.min(cap, WEBHOOK_MAX_RATE_CAP);
|
|
29440
|
+
}
|
|
29441
|
+
return WEBHOOK_DEFAULT_RATE_CAP;
|
|
29442
|
+
}
|
|
29443
|
+
function buildWebhookEvent(req, config2, now = /* @__PURE__ */ new Date()) {
|
|
29444
|
+
const preset = resolvePreset(config2);
|
|
29445
|
+
const body = req.body;
|
|
29446
|
+
const raw = req.rawBody ?? JSON.stringify(body ?? null);
|
|
29447
|
+
const idValue = preset.dedupPath ? scalarString(readPath(body, preset.dedupPath)) : null;
|
|
29448
|
+
const dedupKey = idValue ? `wh:id:${stableHash(idValue)}` : `wh:raw:${stableHash(raw)}`;
|
|
29449
|
+
const typeParts = (preset.eventTypePaths ?? []).map((p2) => scalarString(readPath(body, p2))).filter((v) => v !== null).map((v) => v.slice(0, 200));
|
|
29450
|
+
const eventType = typeParts.length > 0 ? typeParts.join(" / ") : "webhook event";
|
|
29451
|
+
const timeValue = preset.timePath ? scalarString(readPath(body, preset.timePath)) : null;
|
|
29452
|
+
const timeMs = timeValue ? Date.parse(timeValue) : NaN;
|
|
29453
|
+
const occurredAt = Number.isFinite(timeMs) ? new Date(timeMs).toISOString() : now.toISOString();
|
|
29454
|
+
let payload = body;
|
|
29455
|
+
if (preset.payloadPath) {
|
|
29456
|
+
const sub = readPath(body, preset.payloadPath);
|
|
29457
|
+
if (sub !== void 0)
|
|
29458
|
+
payload = sub;
|
|
29459
|
+
}
|
|
29460
|
+
const rendered = typeof payload === "string" ? payload : JSON.stringify(payload, null, 2) ?? "null";
|
|
29461
|
+
const lines = [`Event: ${eventType}`];
|
|
29462
|
+
if (idValue)
|
|
29463
|
+
lines.push(`Event id: ${idValue.slice(0, 200)}`);
|
|
29464
|
+
lines.push("", truncate(rendered, WEBHOOK_PROMPT_MAX_CHARS));
|
|
29465
|
+
return {
|
|
29466
|
+
provider: WEBHOOK_TRIGGER_PROVIDER,
|
|
29467
|
+
occurredAt,
|
|
29468
|
+
dedupKey,
|
|
29469
|
+
sourceTrust: "untrusted",
|
|
29470
|
+
title: eventType,
|
|
29471
|
+
body: lines.join("\n"),
|
|
29472
|
+
// Keep the ledger row bounded: the full body when small, else a marker
|
|
29473
|
+
// with the head of it. Never headers (the bearer token rides there).
|
|
29474
|
+
raw: raw.length <= WEBHOOK_RAW_MAX_CHARS ? body : { truncated: true, bytes: raw.length, head: raw.slice(0, WEBHOOK_RAW_MAX_CHARS) },
|
|
29475
|
+
meaningful: true
|
|
29476
|
+
};
|
|
29477
|
+
}
|
|
29478
|
+
var webhookTriggerAdapter = {
|
|
29479
|
+
provider: WEBHOOK_TRIGGER_PROVIDER,
|
|
29480
|
+
kind: "webhook",
|
|
29481
|
+
webhookAuth: "bearer",
|
|
29482
|
+
webhookEvents: [],
|
|
29483
|
+
multiInstance: true,
|
|
29484
|
+
maxBodyBytes: WEBHOOK_MAX_BODY_BYTES,
|
|
29485
|
+
validateConfig: validateWebhookConfig,
|
|
29486
|
+
rateCapPerHour: (trigger) => webhookRateCap(trigger),
|
|
29487
|
+
// Webhook-kind triggers are minted only on POST /agents/:id/triggers
|
|
29488
|
+
// (agent.edit); /host/triggers refuses non-poll providers.
|
|
29489
|
+
operatorInstruction: true,
|
|
29490
|
+
ingest(req, trigger) {
|
|
29491
|
+
return [buildWebhookEvent(req, trigger.config)];
|
|
29492
|
+
}
|
|
29493
|
+
};
|
|
29494
|
+
registerTriggerSource(webhookTriggerAdapter);
|
|
29495
|
+
|
|
29319
29496
|
// ../core/dist/feature-flags/registry.js
|
|
29320
29497
|
var FLAG_REGISTRY = [
|
|
29321
29498
|
{
|
|
@@ -47113,7 +47290,7 @@ function mayMutate(toolName) {
|
|
|
47113
47290
|
function describeToolCallFailure(params) {
|
|
47114
47291
|
const { path, toolName, readOnly, state, status, body, aborted: aborted2, timeoutMs } = params;
|
|
47115
47292
|
const what = aborted2 ? `API ${path} did not respond within ${timeoutMs}ms` : `API ${path} returned ${status}`;
|
|
47116
|
-
const detail = body ? `: ${
|
|
47293
|
+
const detail = body ? `: ${truncate2(body, 400)}` : "";
|
|
47117
47294
|
if (state === "not_committed") {
|
|
47118
47295
|
return `${what}${detail} \u2014 the request was rejected before it took effect, so nothing changed. Safe to retry once the cause is fixed.`;
|
|
47119
47296
|
}
|
|
@@ -47126,7 +47303,7 @@ function describeToolCallFailure(params) {
|
|
|
47126
47303
|
}
|
|
47127
47304
|
return `${what}${detail} \u2014 INDETERMINATE: the server may have completed this operation before the failure. ${tool} is read-only, so retrying is safe.`;
|
|
47128
47305
|
}
|
|
47129
|
-
function
|
|
47306
|
+
function truncate2(text, max) {
|
|
47130
47307
|
return text.length > max ? `${text.slice(0, max)}\u2026` : text;
|
|
47131
47308
|
}
|
|
47132
47309
|
|