@integrity-labs/agt-cli 0.28.1164 → 0.28.1166
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-WPNCOXIB.js → chunk-6KJFIVYJ.js} +2 -2
- package/dist/{chunk-DR7PAO2Y.js → chunk-I5NQ762W.js} +187 -1
- package/dist/chunk-I5NQ762W.js.map +1 -0
- package/dist/{chunk-CHTG2VLG.js → chunk-NOCTCO7G.js} +3 -3
- package/dist/{chunk-6SIOI32E.js → chunk-UX3TDTVM.js} +5 -5
- package/dist/{chunk-J3LCXQGY.js → chunk-ZSCZDOHR.js} +2 -2
- package/dist/{claude-code-updater-L7C3DZJ3.js → claude-code-updater-VRZ7MMKO.js} +3 -3
- package/dist/{claude-pair-runtime-EQVMQMTF.js → claude-pair-runtime-HOIYDAGM.js} +3 -3
- package/dist/lib/manager-worker.js +19 -19
- package/dist/mcp/direct-chat-channel.js +188 -2
- package/dist/mcp/index.js +190 -4
- package/dist/mcp/origami.js +188 -2
- package/dist/mcp/slack-channel.js +188 -2
- package/dist/mcp/telegram-channel.js +188 -2
- package/dist/{persistent-session-BP3EXMFT.js → persistent-session-YQLP5NPI.js} +4 -4
- package/dist/{responsiveness-probe-ASP2NY2K.js → responsiveness-probe-6K6SVHRK.js} +4 -4
- package/dist/{session-auth-dead-KR2CABKC.js → session-auth-dead-M4KYOBXK.js} +3 -3
- package/package.json +1 -1
- package/dist/chunk-DR7PAO2Y.js.map +0 -1
- /package/dist/{chunk-WPNCOXIB.js.map → chunk-6KJFIVYJ.js.map} +0 -0
- /package/dist/{chunk-CHTG2VLG.js.map → chunk-NOCTCO7G.js.map} +0 -0
- /package/dist/{chunk-6SIOI32E.js.map → chunk-UX3TDTVM.js.map} +0 -0
- /package/dist/{chunk-J3LCXQGY.js.map → chunk-ZSCZDOHR.js.map} +0 -0
- /package/dist/{claude-code-updater-L7C3DZJ3.js.map → claude-code-updater-VRZ7MMKO.js.map} +0 -0
- /package/dist/{claude-pair-runtime-EQVMQMTF.js.map → claude-pair-runtime-HOIYDAGM.js.map} +0 -0
- /package/dist/{persistent-session-BP3EXMFT.js.map → persistent-session-YQLP5NPI.js.map} +0 -0
- /package/dist/{responsiveness-probe-ASP2NY2K.js.map → responsiveness-probe-6K6SVHRK.js.map} +0 -0
- /package/dist/{session-auth-dead-KR2CABKC.js.map → session-auth-dead-M4KYOBXK.js.map} +0 -0
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
rotateDailySession,
|
|
5
5
|
sessionFileExists,
|
|
6
6
|
todayLocalIso
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-ZSCZDOHR.js";
|
|
8
8
|
import {
|
|
9
9
|
classifyUnanswerablePane,
|
|
10
10
|
findUsageLimitResetHint,
|
|
@@ -47,7 +47,7 @@ import {
|
|
|
47
47
|
remoteMcpConnectionEnvInfix,
|
|
48
48
|
remoteMcpConnectionLabel,
|
|
49
49
|
remoteMcpConnectionScopedEnvVar
|
|
50
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-I5NQ762W.js";
|
|
51
51
|
import {
|
|
52
52
|
CLAUDE_CONFIG_DIR_ENV,
|
|
53
53
|
archiveLegacyClaudeJson,
|
|
@@ -6130,4 +6130,4 @@ export {
|
|
|
6130
6130
|
stopAllSessionsAndWait,
|
|
6131
6131
|
getProjectDir
|
|
6132
6132
|
};
|
|
6133
|
-
//# sourceMappingURL=chunk-
|
|
6133
|
+
//# sourceMappingURL=chunk-NOCTCO7G.js.map
|
|
@@ -16,11 +16,11 @@ import {
|
|
|
16
16
|
parseEnvFileEntries,
|
|
17
17
|
parseEnvIntegrations,
|
|
18
18
|
shellQuote
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-NOCTCO7G.js";
|
|
20
20
|
import {
|
|
21
21
|
readDailySessionPin,
|
|
22
22
|
sessionTranscriptDir
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-ZSCZDOHR.js";
|
|
24
24
|
import {
|
|
25
25
|
classifyUnanswerablePane,
|
|
26
26
|
isConsumerTermsDialogVisible,
|
|
@@ -90,7 +90,7 @@ import {
|
|
|
90
90
|
scanConfigForLiteralSecrets,
|
|
91
91
|
worseConnectivityOutcome,
|
|
92
92
|
wrapScheduledTaskPrompt
|
|
93
|
-
} from "./chunk-
|
|
93
|
+
} from "./chunk-I5NQ762W.js";
|
|
94
94
|
import {
|
|
95
95
|
claudeJsonPathFor,
|
|
96
96
|
effectiveClaudeJsonPath,
|
|
@@ -8078,7 +8078,7 @@ function exchangeFailureKind(err) {
|
|
|
8078
8078
|
}
|
|
8079
8079
|
|
|
8080
8080
|
// src/lib/api-client.ts
|
|
8081
|
-
var agtCliVersion = true ? "0.28.
|
|
8081
|
+
var agtCliVersion = true ? "0.28.1166" : "dev";
|
|
8082
8082
|
var lastConfigHash = null;
|
|
8083
8083
|
function setConfigHash(hash) {
|
|
8084
8084
|
lastConfigHash = hash && hash.length > 0 ? hash : null;
|
|
@@ -13235,4 +13235,4 @@ export {
|
|
|
13235
13235
|
managerInstallSystemUnitCommand,
|
|
13236
13236
|
managerUninstallSystemUnitCommand
|
|
13237
13237
|
};
|
|
13238
|
-
//# sourceMappingURL=chunk-
|
|
13238
|
+
//# sourceMappingURL=chunk-UX3TDTVM.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
encodeClaudeProjectPath
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-I5NQ762W.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-ZSCZDOHR.js.map
|
|
@@ -12,9 +12,9 @@ import {
|
|
|
12
12
|
probeClaudeInstalls,
|
|
13
13
|
readsAsNativeInstall,
|
|
14
14
|
shouldRunClaudeCodeUpdater
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-6KJFIVYJ.js";
|
|
16
16
|
import "./chunk-XWVM4KPK.js";
|
|
17
|
-
import "./chunk-
|
|
17
|
+
import "./chunk-I5NQ762W.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-VRZ7MMKO.js.map
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
import {
|
|
9
9
|
redactPaneFrame,
|
|
10
10
|
sanitizeTerminalFrame
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-I5NQ762W.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-YQLP5NPI.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-HOIYDAGM.js.map
|
|
@@ -77,7 +77,7 @@ import {
|
|
|
77
77
|
setConfigHash,
|
|
78
78
|
shellGuard,
|
|
79
79
|
tripClass
|
|
80
|
-
} from "../chunk-
|
|
80
|
+
} from "../chunk-UX3TDTVM.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-6KJFIVYJ.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-NOCTCO7G.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-ZSCZDOHR.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-I5NQ762W.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-6K6SVHRK.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.1166" : "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-YQLP5NPI.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-YQLP5NPI.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-VRZ7MMKO.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-6K6SVHRK.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-6K6SVHRK.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-6K6SVHRK.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-YQLP5NPI.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-M4KYOBXK.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-6K6SVHRK.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-YQLP5NPI.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-YQLP5NPI.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-HOIYDAGM.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();
|
|
@@ -40540,6 +40540,15 @@ var INTEGRATION_REGISTRY = [
|
|
|
40540
40540
|
// successor at the same cost to us); Sunburst is seeded at 4x.
|
|
40541
40541
|
{ event_type: "gpt_image_2_5_flare", unit: "image" },
|
|
40542
40542
|
{ event_type: "gpt_image_2_5_sunburst", unit: "image" },
|
|
40543
|
+
// CS-2360: quality medium/high price on their own rows (more image-output
|
|
40544
|
+
// tokens at the same per-token rate). `low` stays on the two meters above.
|
|
40545
|
+
// The handler refuses a medium/high render until its meter has a rate
|
|
40546
|
+
// card row in BOTH USD and AUD. Size does not change the meter: the rate
|
|
40547
|
+
// is set on the worst case (landscape/portrait).
|
|
40548
|
+
{ event_type: "gpt_image_2_5_flare_medium", unit: "image", label: "Flare, medium quality" },
|
|
40549
|
+
{ event_type: "gpt_image_2_5_flare_high", unit: "image", label: "Flare, high quality" },
|
|
40550
|
+
{ event_type: "gpt_image_2_5_sunburst_medium", unit: "image", label: "Sunburst, medium quality" },
|
|
40551
|
+
{ event_type: "gpt_image_2_5_sunburst_high", unit: "image", label: "Sunburst, high quality" },
|
|
40543
40552
|
// CS-1940: an edit also records one of these with units = the number of
|
|
40544
40553
|
// reference images. Declared here (obi-wan 3a515eaf41b0) because the admin
|
|
40545
40554
|
// pricing route only accepts a price for a declared meter, and the org
|
|
@@ -43719,6 +43728,183 @@ var videoRenderTriggerAdapter = {
|
|
|
43719
43728
|
};
|
|
43720
43729
|
registerTriggerSource(videoRenderTriggerAdapter);
|
|
43721
43730
|
|
|
43731
|
+
// ../core/dist/triggers/adapters/webhook.js
|
|
43732
|
+
var WEBHOOK_TRIGGER_PROVIDER = "webhook";
|
|
43733
|
+
var WEBHOOK_MAX_BODY_BYTES = 1280 * 1024;
|
|
43734
|
+
var WEBHOOK_PROMPT_MAX_CHARS = 8e3;
|
|
43735
|
+
var WEBHOOK_RAW_MAX_CHARS = 64 * 1024;
|
|
43736
|
+
var WEBHOOK_INSTRUCTION_MAX_CHARS = 2e3;
|
|
43737
|
+
var WEBHOOK_NAME_MAX_CHARS = 80;
|
|
43738
|
+
var WEBHOOK_DEFAULT_RATE_CAP = 60;
|
|
43739
|
+
var WEBHOOK_MAX_RATE_CAP = 1e3;
|
|
43740
|
+
var WEBHOOK_PRESETS = {
|
|
43741
|
+
// https://docs.aws.amazon.com/eventbridge/latest/ref/overiew-event-structure.html
|
|
43742
|
+
eventbridge: {
|
|
43743
|
+
dedupPath: "id",
|
|
43744
|
+
eventTypePaths: ["source", "detail-type"],
|
|
43745
|
+
payloadPath: "detail",
|
|
43746
|
+
timePath: "time"
|
|
43747
|
+
},
|
|
43748
|
+
// Raw-body hash dedup, whole body as payload. Set dedup_path when the
|
|
43749
|
+
// sender has a stable id, or two identical bodies collapse into one.
|
|
43750
|
+
generic: {}
|
|
43751
|
+
};
|
|
43752
|
+
var PATH_RE = /^[A-Za-z0-9_$-]+(\.[A-Za-z0-9_$-]+){0,9}$/;
|
|
43753
|
+
function readPath(value, path) {
|
|
43754
|
+
let cur = value;
|
|
43755
|
+
for (const key of path.split(".")) {
|
|
43756
|
+
if (cur === null || typeof cur !== "object" || Array.isArray(cur))
|
|
43757
|
+
return void 0;
|
|
43758
|
+
if (!Object.prototype.hasOwnProperty.call(cur, key))
|
|
43759
|
+
return void 0;
|
|
43760
|
+
cur = cur[key];
|
|
43761
|
+
}
|
|
43762
|
+
return cur;
|
|
43763
|
+
}
|
|
43764
|
+
function scalarString(v) {
|
|
43765
|
+
if (typeof v === "string")
|
|
43766
|
+
return v.length > 0 ? v : null;
|
|
43767
|
+
if (typeof v === "number" && Number.isFinite(v))
|
|
43768
|
+
return String(v);
|
|
43769
|
+
return null;
|
|
43770
|
+
}
|
|
43771
|
+
function truncate(text, max) {
|
|
43772
|
+
if (text.length <= max)
|
|
43773
|
+
return text;
|
|
43774
|
+
return `${text.slice(0, max)}
|
|
43775
|
+
... [truncated ${text.length - max} more characters]`;
|
|
43776
|
+
}
|
|
43777
|
+
function resolvePreset(config2) {
|
|
43778
|
+
const name = config2["preset"];
|
|
43779
|
+
const base = typeof name === "string" && Object.prototype.hasOwnProperty.call(WEBHOOK_PRESETS, name) ? WEBHOOK_PRESETS[name] : WEBHOOK_PRESETS.generic;
|
|
43780
|
+
const dedup = config2["dedup_path"];
|
|
43781
|
+
const type = config2["event_type_path"];
|
|
43782
|
+
const payload = config2["payload_path"];
|
|
43783
|
+
return {
|
|
43784
|
+
...base,
|
|
43785
|
+
...typeof dedup === "string" && dedup ? { dedupPath: dedup } : {},
|
|
43786
|
+
...typeof type === "string" && type ? { eventTypePaths: [type] } : {},
|
|
43787
|
+
...typeof payload === "string" && payload ? { payloadPath: payload } : {}
|
|
43788
|
+
};
|
|
43789
|
+
}
|
|
43790
|
+
function validateWebhookConfig(input) {
|
|
43791
|
+
const out = {};
|
|
43792
|
+
const name = input["name"];
|
|
43793
|
+
if (name !== void 0) {
|
|
43794
|
+
if (typeof name !== "string")
|
|
43795
|
+
return { ok: false, error: "name must be a string" };
|
|
43796
|
+
const trimmed = name.trim();
|
|
43797
|
+
if (trimmed.length > WEBHOOK_NAME_MAX_CHARS) {
|
|
43798
|
+
return { ok: false, error: `name must be at most ${WEBHOOK_NAME_MAX_CHARS} characters` };
|
|
43799
|
+
}
|
|
43800
|
+
if (trimmed)
|
|
43801
|
+
out["name"] = trimmed;
|
|
43802
|
+
}
|
|
43803
|
+
const instruction = input["instruction"];
|
|
43804
|
+
if (typeof instruction !== "string" || !instruction.trim()) {
|
|
43805
|
+
return {
|
|
43806
|
+
ok: false,
|
|
43807
|
+
error: "instruction is required: tell the agent what to do when an event arrives"
|
|
43808
|
+
};
|
|
43809
|
+
}
|
|
43810
|
+
if (instruction.trim().length > WEBHOOK_INSTRUCTION_MAX_CHARS) {
|
|
43811
|
+
return {
|
|
43812
|
+
ok: false,
|
|
43813
|
+
error: `instruction must be at most ${WEBHOOK_INSTRUCTION_MAX_CHARS} characters`
|
|
43814
|
+
};
|
|
43815
|
+
}
|
|
43816
|
+
out["instruction"] = instruction.trim();
|
|
43817
|
+
const preset = input["preset"] ?? "generic";
|
|
43818
|
+
if (typeof preset !== "string" || !Object.prototype.hasOwnProperty.call(WEBHOOK_PRESETS, preset)) {
|
|
43819
|
+
return {
|
|
43820
|
+
ok: false,
|
|
43821
|
+
error: `preset must be one of: ${Object.keys(WEBHOOK_PRESETS).join(", ")}`
|
|
43822
|
+
};
|
|
43823
|
+
}
|
|
43824
|
+
out["preset"] = preset;
|
|
43825
|
+
for (const key of ["dedup_path", "event_type_path", "payload_path"]) {
|
|
43826
|
+
const v = input[key];
|
|
43827
|
+
if (v === void 0 || v === null || v === "")
|
|
43828
|
+
continue;
|
|
43829
|
+
if (typeof v !== "string" || !PATH_RE.test(v)) {
|
|
43830
|
+
return { ok: false, error: `${key} must be a dot path like "detail.id"` };
|
|
43831
|
+
}
|
|
43832
|
+
out[key] = v;
|
|
43833
|
+
}
|
|
43834
|
+
const cap = input["max_events_per_hour"];
|
|
43835
|
+
if (cap !== void 0 && cap !== null) {
|
|
43836
|
+
if (typeof cap !== "number" || !Number.isInteger(cap) || cap < 1 || cap > WEBHOOK_MAX_RATE_CAP) {
|
|
43837
|
+
return {
|
|
43838
|
+
ok: false,
|
|
43839
|
+
error: `max_events_per_hour must be an integer from 1 to ${WEBHOOK_MAX_RATE_CAP}`
|
|
43840
|
+
};
|
|
43841
|
+
}
|
|
43842
|
+
out["max_events_per_hour"] = cap;
|
|
43843
|
+
} else {
|
|
43844
|
+
out["max_events_per_hour"] = WEBHOOK_DEFAULT_RATE_CAP;
|
|
43845
|
+
}
|
|
43846
|
+
return { ok: true, config: out };
|
|
43847
|
+
}
|
|
43848
|
+
function webhookRateCap(trigger) {
|
|
43849
|
+
const cap = trigger.config["max_events_per_hour"];
|
|
43850
|
+
if (typeof cap === "number" && Number.isInteger(cap) && cap >= 1) {
|
|
43851
|
+
return Math.min(cap, WEBHOOK_MAX_RATE_CAP);
|
|
43852
|
+
}
|
|
43853
|
+
return WEBHOOK_DEFAULT_RATE_CAP;
|
|
43854
|
+
}
|
|
43855
|
+
function buildWebhookEvent(req, config2, now = /* @__PURE__ */ new Date()) {
|
|
43856
|
+
const preset = resolvePreset(config2);
|
|
43857
|
+
const body = req.body;
|
|
43858
|
+
const raw = req.rawBody ?? JSON.stringify(body ?? null);
|
|
43859
|
+
const idValue = preset.dedupPath ? scalarString(readPath(body, preset.dedupPath)) : null;
|
|
43860
|
+
const dedupKey = idValue ? `wh:id:${stableHash(idValue)}` : `wh:raw:${stableHash(raw)}`;
|
|
43861
|
+
const typeParts = (preset.eventTypePaths ?? []).map((p2) => scalarString(readPath(body, p2))).filter((v) => v !== null).map((v) => v.slice(0, 200));
|
|
43862
|
+
const eventType = typeParts.length > 0 ? typeParts.join(" / ") : "webhook event";
|
|
43863
|
+
const timeValue = preset.timePath ? scalarString(readPath(body, preset.timePath)) : null;
|
|
43864
|
+
const timeMs = timeValue ? Date.parse(timeValue) : NaN;
|
|
43865
|
+
const occurredAt = Number.isFinite(timeMs) ? new Date(timeMs).toISOString() : now.toISOString();
|
|
43866
|
+
let payload = body;
|
|
43867
|
+
if (preset.payloadPath) {
|
|
43868
|
+
const sub = readPath(body, preset.payloadPath);
|
|
43869
|
+
if (sub !== void 0)
|
|
43870
|
+
payload = sub;
|
|
43871
|
+
}
|
|
43872
|
+
const rendered = typeof payload === "string" ? payload : JSON.stringify(payload, null, 2) ?? "null";
|
|
43873
|
+
const lines = [`Event: ${eventType}`];
|
|
43874
|
+
if (idValue)
|
|
43875
|
+
lines.push(`Event id: ${idValue.slice(0, 200)}`);
|
|
43876
|
+
lines.push("", truncate(rendered, WEBHOOK_PROMPT_MAX_CHARS));
|
|
43877
|
+
return {
|
|
43878
|
+
provider: WEBHOOK_TRIGGER_PROVIDER,
|
|
43879
|
+
occurredAt,
|
|
43880
|
+
dedupKey,
|
|
43881
|
+
sourceTrust: "untrusted",
|
|
43882
|
+
title: eventType,
|
|
43883
|
+
body: lines.join("\n"),
|
|
43884
|
+
// Keep the ledger row bounded: the full body when small, else a marker
|
|
43885
|
+
// with the head of it. Never headers (the bearer token rides there).
|
|
43886
|
+
raw: raw.length <= WEBHOOK_RAW_MAX_CHARS ? body : { truncated: true, bytes: raw.length, head: raw.slice(0, WEBHOOK_RAW_MAX_CHARS) },
|
|
43887
|
+
meaningful: true
|
|
43888
|
+
};
|
|
43889
|
+
}
|
|
43890
|
+
var webhookTriggerAdapter = {
|
|
43891
|
+
provider: WEBHOOK_TRIGGER_PROVIDER,
|
|
43892
|
+
kind: "webhook",
|
|
43893
|
+
webhookAuth: "bearer",
|
|
43894
|
+
webhookEvents: [],
|
|
43895
|
+
multiInstance: true,
|
|
43896
|
+
maxBodyBytes: WEBHOOK_MAX_BODY_BYTES,
|
|
43897
|
+
validateConfig: validateWebhookConfig,
|
|
43898
|
+
rateCapPerHour: (trigger) => webhookRateCap(trigger),
|
|
43899
|
+
// Webhook-kind triggers are minted only on POST /agents/:id/triggers
|
|
43900
|
+
// (agent.edit); /host/triggers refuses non-poll providers.
|
|
43901
|
+
operatorInstruction: true,
|
|
43902
|
+
ingest(req, trigger) {
|
|
43903
|
+
return [buildWebhookEvent(req, trigger.config)];
|
|
43904
|
+
}
|
|
43905
|
+
};
|
|
43906
|
+
registerTriggerSource(webhookTriggerAdapter);
|
|
43907
|
+
|
|
43722
43908
|
// ../core/dist/feature-flags/registry.js
|
|
43723
43909
|
var FLAG_REGISTRY = [
|
|
43724
43910
|
{
|