@integrity-labs/agt-cli 0.28.1047 → 0.28.1049
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 +5 -5
- package/dist/{chunk-QGUJSDN3.js → chunk-MVBTIU7A.js} +2 -2
- package/dist/{chunk-2DUVDY2Y.js → chunk-PLCZUMFX.js} +9 -6
- package/dist/chunk-PLCZUMFX.js.map +1 -0
- package/dist/{chunk-5GCYYWKW.js → chunk-SFOIRACS.js} +171 -13
- package/dist/chunk-SFOIRACS.js.map +1 -0
- package/dist/{claude-pair-runtime-TOHT7XVN.js → claude-pair-runtime-XFVA6KHM.js} +2 -2
- package/dist/lib/manager-worker.js +503 -378
- package/dist/lib/manager-worker.js.map +1 -1
- package/dist/mcp/direct-chat-channel.js +10 -0
- package/dist/mcp/index.js +15 -1
- package/dist/mcp/origami.js +10 -0
- package/dist/mcp/slack-channel.js +10 -0
- package/dist/mcp/telegram-channel.js +10 -0
- package/dist/{persistent-session-X3C3R22F.js → persistent-session-FTAHFPQK.js} +3 -3
- package/dist/{responsiveness-probe-E23YHRUT.js → responsiveness-probe-QIBWAB4J.js} +3 -3
- package/dist/{session-auth-dead-WCUXKBHP.js → session-auth-dead-6LW2TJTG.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-2DUVDY2Y.js.map +0 -1
- package/dist/chunk-5GCYYWKW.js.map +0 -1
- /package/dist/{chunk-QGUJSDN3.js.map → chunk-MVBTIU7A.js.map} +0 -0
- /package/dist/{claude-pair-runtime-TOHT7XVN.js.map → claude-pair-runtime-XFVA6KHM.js.map} +0 -0
- /package/dist/{persistent-session-X3C3R22F.js.map → persistent-session-FTAHFPQK.js.map} +0 -0
- /package/dist/{responsiveness-probe-E23YHRUT.js.map → responsiveness-probe-QIBWAB4J.js.map} +0 -0
- /package/dist/{session-auth-dead-WCUXKBHP.js.map → session-auth-dead-6LW2TJTG.js.map} +0 -0
|
@@ -189,6 +189,27 @@ ${AGENT_RULES_SECTION_END}
|
|
|
189
189
|
`;
|
|
190
190
|
}
|
|
191
191
|
|
|
192
|
+
// ../../packages/core/dist/provisioning/frameworks/claudecode/agent-console-url.js
|
|
193
|
+
var DEFAULT_AGENT_CONSOLE_URL = "https://app.ninjafy.com";
|
|
194
|
+
function normalizeConsoleOrigin(value) {
|
|
195
|
+
if (typeof value !== "string")
|
|
196
|
+
return null;
|
|
197
|
+
const trimmed = value.trim();
|
|
198
|
+
if (!trimmed)
|
|
199
|
+
return null;
|
|
200
|
+
try {
|
|
201
|
+
const url = new URL(trimmed);
|
|
202
|
+
if (url.protocol !== "https:" && url.protocol !== "http:")
|
|
203
|
+
return null;
|
|
204
|
+
return url.origin;
|
|
205
|
+
} catch {
|
|
206
|
+
return null;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
function resolveAgentConsoleUrl(input, env2 = process.env) {
|
|
210
|
+
return normalizeConsoleOrigin(input.consoleUrl) ?? normalizeConsoleOrigin(env2["AGT_APP_URL"]) ?? normalizeConsoleOrigin(env2["NEXT_PUBLIC_APP_URL"]) ?? normalizeConsoleOrigin(env2["AGT_CONSOLE_URL"]) ?? DEFAULT_AGENT_CONSOLE_URL;
|
|
211
|
+
}
|
|
212
|
+
|
|
192
213
|
// ../../packages/core/dist/guardrails/calendar-policy.js
|
|
193
214
|
function parseCalendarGuardStage(raw) {
|
|
194
215
|
if (raw === "warn" || raw === "enforce")
|
|
@@ -1279,7 +1300,7 @@ function buildGuardrailsSection(guardrails) {
|
|
|
1279
1300
|
}
|
|
1280
1301
|
function generateClaudeMd(input) {
|
|
1281
1302
|
const { frontmatter, role, description, resolvedChannels, team, organization, integrations, timezone, reportsTo, personalitySeed, teamMembers, people, peerGates, guardrails, activeTasks } = input;
|
|
1282
|
-
const consoleUrl = input.consoleUrl ??
|
|
1303
|
+
const consoleUrl = input.consoleUrl ?? DEFAULT_AGENT_CONSOLE_URL;
|
|
1283
1304
|
const channelList = resolvedChannels?.length ? resolvedChannels.join(", ") : "none";
|
|
1284
1305
|
const roleDisplay = role ?? "Agent";
|
|
1285
1306
|
const desc = description?.trim();
|
|
@@ -3446,7 +3467,13 @@ var CONTROL_PLANE_ONLY_CONFIG_KEYS = /* @__PURE__ */ new Set([
|
|
|
3446
3467
|
"managed_state_token",
|
|
3447
3468
|
"managed_state_expires",
|
|
3448
3469
|
"managed_state_tokens",
|
|
3449
|
-
"pending_approval_at"
|
|
3470
|
+
"pending_approval_at",
|
|
3471
|
+
// ENG-11172 (Obi Wan on #6607): the connect reconciler's marker that it
|
|
3472
|
+
// already bound this account, read by the trailing /managed-callback. Pure
|
|
3473
|
+
// control-plane bookkeeping: published to .env.integrations it would appear
|
|
3474
|
+
// on a reconcile bind and vanish on the next callback - membership churn
|
|
3475
|
+
// that counts toward the restart breaker (ENG-6918 / ENG-8679).
|
|
3476
|
+
"reconciled_connected_account_id"
|
|
3450
3477
|
]);
|
|
3451
3478
|
var CONTROL_PLANE_CONFIG_KEY_SUFFIXES = ["_server_id"];
|
|
3452
3479
|
function isControlPlaneOnlyConfigKey(key) {
|
|
@@ -14425,11 +14452,11 @@ function sumTranscriptUsageInWindow(jsonl, startMs, endMs) {
|
|
|
14425
14452
|
const ts = record.timestamp;
|
|
14426
14453
|
if (typeof ts !== "string" || !ts)
|
|
14427
14454
|
continue;
|
|
14428
|
-
const
|
|
14429
|
-
if (!Number.isFinite(
|
|
14455
|
+
const tsMs2 = new Date(ts).getTime();
|
|
14456
|
+
if (!Number.isFinite(tsMs2))
|
|
14430
14457
|
continue;
|
|
14431
14458
|
const id = typeof msg.id === "string" && msg.id ? msg.id : `__noid_${syntheticCounter++}`;
|
|
14432
|
-
byId.set(id, { tsMs, contributions: usageContributions(msg, u) });
|
|
14459
|
+
byId.set(id, { tsMs: tsMs2, contributions: usageContributions(msg, u) });
|
|
14433
14460
|
}
|
|
14434
14461
|
const byModel = /* @__PURE__ */ new Map();
|
|
14435
14462
|
const totals = emptyTotals();
|
|
@@ -14641,13 +14668,13 @@ function classifyTranscriptLine(line, startMs, endMs, now) {
|
|
|
14641
14668
|
const ts = record.timestamp;
|
|
14642
14669
|
if (typeof ts !== "string" || !ts)
|
|
14643
14670
|
return null;
|
|
14644
|
-
const
|
|
14645
|
-
if (!Number.isFinite(
|
|
14671
|
+
const tsMs2 = new Date(ts).getTime();
|
|
14672
|
+
if (!Number.isFinite(tsMs2) || tsMs2 < startMs || tsMs2 > endMs)
|
|
14646
14673
|
return null;
|
|
14647
14674
|
if (record.error === "rate_limit" || record.apiErrorStatus === 429) {
|
|
14648
14675
|
const text = contentText(record);
|
|
14649
14676
|
const observation = text ? parseUsageBanner(text, now ?? new Date(endMs)) : null;
|
|
14650
|
-
return { verdict: "capped", atMs:
|
|
14677
|
+
return { verdict: "capped", atMs: tsMs2, resetsAt: observation?.weekResetsAt ?? null, text };
|
|
14651
14678
|
}
|
|
14652
14679
|
if (record.isApiErrorMessage === true)
|
|
14653
14680
|
return null;
|
|
@@ -14664,7 +14691,7 @@ function classifyTranscriptLine(line, startMs, endMs, now) {
|
|
|
14664
14691
|
const spent = Number(u.input_tokens ?? 0) + Number(u.output_tokens ?? 0) + Number(u.cache_creation_input_tokens ?? 0) + Number(u.cache_read_input_tokens ?? 0);
|
|
14665
14692
|
if (!Number.isFinite(spent) || spent <= 0)
|
|
14666
14693
|
return null;
|
|
14667
|
-
return { verdict: "serving", atMs:
|
|
14694
|
+
return { verdict: "serving", atMs: tsMs2, resetsAt: null, text: null };
|
|
14668
14695
|
}
|
|
14669
14696
|
function pickNewerClassification(current, next) {
|
|
14670
14697
|
if (next.verdict === "unknown")
|
|
@@ -14750,12 +14777,12 @@ function extractQualifyingTurns(jsonl, options = {}) {
|
|
|
14750
14777
|
const ts = record.timestamp;
|
|
14751
14778
|
if (typeof ts !== "string" || !ts)
|
|
14752
14779
|
continue;
|
|
14753
|
-
const
|
|
14754
|
-
if (!Number.isFinite(
|
|
14780
|
+
const tsMs2 = new Date(ts).getTime();
|
|
14781
|
+
if (!Number.isFinite(tsMs2))
|
|
14755
14782
|
continue;
|
|
14756
14783
|
const id = typeof msg.id === "string" && msg.id ? msg.id : `__noid_${syntheticCounter++}`;
|
|
14757
14784
|
byId.set(id, {
|
|
14758
|
-
tsMs,
|
|
14785
|
+
tsMs: tsMs2,
|
|
14759
14786
|
outputTokens: nonNegInt2(usage.output_tokens)
|
|
14760
14787
|
});
|
|
14761
14788
|
}
|
|
@@ -14875,6 +14902,132 @@ function isBucketInOpenCall(bucketStartMs, open) {
|
|
|
14875
14902
|
return false;
|
|
14876
14903
|
}
|
|
14877
14904
|
|
|
14905
|
+
// ../../packages/core/dist/claude-code-usage/failing-turn-run.js
|
|
14906
|
+
var FAILING_TURN_RUN_DEFAULT_THRESHOLD = 3;
|
|
14907
|
+
var FAILING_TURN_DEFAULT_MAX_TURN_MS = 5e3;
|
|
14908
|
+
var NO_FAILING_TURN_RUN = Object.freeze({
|
|
14909
|
+
newestTurn: "other",
|
|
14910
|
+
consecutive: 0,
|
|
14911
|
+
firstFailureAtMs: null,
|
|
14912
|
+
lastFailureAtMs: null,
|
|
14913
|
+
lastStatus: null,
|
|
14914
|
+
lastErrorCode: null
|
|
14915
|
+
});
|
|
14916
|
+
function tsMs(record) {
|
|
14917
|
+
const ts = record.timestamp;
|
|
14918
|
+
if (typeof ts !== "string" || !ts)
|
|
14919
|
+
return null;
|
|
14920
|
+
const ms = Date.parse(ts);
|
|
14921
|
+
return Number.isFinite(ms) ? ms : null;
|
|
14922
|
+
}
|
|
14923
|
+
function contentBlocks(record) {
|
|
14924
|
+
const msg = record.message;
|
|
14925
|
+
if (typeof msg !== "object" || msg === null)
|
|
14926
|
+
return null;
|
|
14927
|
+
const content = msg.content;
|
|
14928
|
+
if (typeof content === "string" || Array.isArray(content))
|
|
14929
|
+
return content;
|
|
14930
|
+
return null;
|
|
14931
|
+
}
|
|
14932
|
+
function isPrompt(record) {
|
|
14933
|
+
if (record.type !== "user")
|
|
14934
|
+
return false;
|
|
14935
|
+
if (record.isMeta === true)
|
|
14936
|
+
return false;
|
|
14937
|
+
const content = contentBlocks(record);
|
|
14938
|
+
if (typeof content === "string")
|
|
14939
|
+
return content.length > 0;
|
|
14940
|
+
if (!Array.isArray(content) || content.length === 0)
|
|
14941
|
+
return false;
|
|
14942
|
+
return !content.some((b) => typeof b === "object" && b !== null && b.type === "tool_result");
|
|
14943
|
+
}
|
|
14944
|
+
function isRateLimit(record) {
|
|
14945
|
+
return record.apiErrorStatus === 429 || record.error === "rate_limit";
|
|
14946
|
+
}
|
|
14947
|
+
function analyzeFailingTurnRun(jsonl, opts = {}) {
|
|
14948
|
+
const maxTurnMs = opts.maxTurnMs ?? FAILING_TURN_DEFAULT_MAX_TURN_MS;
|
|
14949
|
+
const turns = [];
|
|
14950
|
+
let current = null;
|
|
14951
|
+
for (const line of jsonl.split("\n")) {
|
|
14952
|
+
const trimmed = line.trim();
|
|
14953
|
+
if (!trimmed)
|
|
14954
|
+
continue;
|
|
14955
|
+
let obj;
|
|
14956
|
+
try {
|
|
14957
|
+
obj = JSON.parse(trimmed);
|
|
14958
|
+
} catch {
|
|
14959
|
+
continue;
|
|
14960
|
+
}
|
|
14961
|
+
if (typeof obj !== "object" || obj === null)
|
|
14962
|
+
continue;
|
|
14963
|
+
const record = obj;
|
|
14964
|
+
if (record.isSidechain === true)
|
|
14965
|
+
continue;
|
|
14966
|
+
if (isPrompt(record)) {
|
|
14967
|
+
current = {
|
|
14968
|
+
startMs: tsMs(record),
|
|
14969
|
+
endMs: null,
|
|
14970
|
+
hasAssistant: false,
|
|
14971
|
+
served: false,
|
|
14972
|
+
rateLimited: false,
|
|
14973
|
+
error: null
|
|
14974
|
+
};
|
|
14975
|
+
turns.push(current);
|
|
14976
|
+
continue;
|
|
14977
|
+
}
|
|
14978
|
+
if (record.type !== "assistant" || current === null)
|
|
14979
|
+
continue;
|
|
14980
|
+
current.hasAssistant = true;
|
|
14981
|
+
const at = tsMs(record);
|
|
14982
|
+
if (at !== null && (current.endMs === null || at > current.endMs))
|
|
14983
|
+
current.endMs = at;
|
|
14984
|
+
if (record.isApiErrorMessage === true) {
|
|
14985
|
+
current.error = {
|
|
14986
|
+
atMs: at,
|
|
14987
|
+
status: typeof record.apiErrorStatus === "number" ? record.apiErrorStatus : null,
|
|
14988
|
+
code: typeof record.error === "string" && record.error ? record.error : null
|
|
14989
|
+
};
|
|
14990
|
+
if (isRateLimit(record))
|
|
14991
|
+
current.rateLimited = true;
|
|
14992
|
+
} else {
|
|
14993
|
+
current.served = true;
|
|
14994
|
+
}
|
|
14995
|
+
}
|
|
14996
|
+
let consecutive = 0;
|
|
14997
|
+
let first = null;
|
|
14998
|
+
let newest = null;
|
|
14999
|
+
let newestTurn = null;
|
|
15000
|
+
for (let i = turns.length - 1; i >= 0; i--) {
|
|
15001
|
+
const turn = turns[i];
|
|
15002
|
+
if (!turn.hasAssistant) {
|
|
15003
|
+
if (i === turns.length - 1)
|
|
15004
|
+
continue;
|
|
15005
|
+
break;
|
|
15006
|
+
}
|
|
15007
|
+
const duration = turn.startMs !== null && turn.endMs !== null ? turn.endMs - turn.startMs : Number.POSITIVE_INFINITY;
|
|
15008
|
+
const failedFast = turn.error !== null && !turn.served && !turn.rateLimited && duration <= maxTurnMs;
|
|
15009
|
+
if (newestTurn === null)
|
|
15010
|
+
newestTurn = failedFast ? "failed" : turn.served ? "served" : "other";
|
|
15011
|
+
if (!failedFast)
|
|
15012
|
+
break;
|
|
15013
|
+
consecutive++;
|
|
15014
|
+
first = turn;
|
|
15015
|
+
if (newest === null)
|
|
15016
|
+
newest = turn;
|
|
15017
|
+
}
|
|
15018
|
+
if (consecutive === 0 || first === null || newest === null) {
|
|
15019
|
+
return newestTurn === "served" ? { ...NO_FAILING_TURN_RUN, newestTurn: "served" } : NO_FAILING_TURN_RUN;
|
|
15020
|
+
}
|
|
15021
|
+
return {
|
|
15022
|
+
newestTurn: "failed",
|
|
15023
|
+
consecutive,
|
|
15024
|
+
firstFailureAtMs: first.startMs,
|
|
15025
|
+
lastFailureAtMs: newest.error?.atMs ?? newest.endMs,
|
|
15026
|
+
lastStatus: newest.error?.status ?? null,
|
|
15027
|
+
lastErrorCode: newest.error?.code ?? null
|
|
15028
|
+
};
|
|
15029
|
+
}
|
|
15030
|
+
|
|
14878
15031
|
// ../../packages/core/dist/account-enforcement/marker.js
|
|
14879
15032
|
var ACCOUNT_ENFORCEMENT_MARKER_FILENAME = "account-enforcement.json";
|
|
14880
15033
|
var ACCOUNT_ENFORCEMENT_MARKER_VERSION = 1;
|
|
@@ -15543,6 +15696,7 @@ function readDailySessionPin(codeName) {
|
|
|
15543
15696
|
}
|
|
15544
15697
|
|
|
15545
15698
|
export {
|
|
15699
|
+
resolveAgentConsoleUrl,
|
|
15546
15700
|
normaliseSlackPeerAgentMode,
|
|
15547
15701
|
normaliseSlackPeerGroupIds,
|
|
15548
15702
|
buildSlackThirdPartyBotsEnvValue,
|
|
@@ -15689,6 +15843,10 @@ export {
|
|
|
15689
15843
|
pairToolCallBrackets,
|
|
15690
15844
|
isBucketInBracket,
|
|
15691
15845
|
isBucketInOpenCall,
|
|
15846
|
+
FAILING_TURN_RUN_DEFAULT_THRESHOLD,
|
|
15847
|
+
FAILING_TURN_DEFAULT_MAX_TURN_MS,
|
|
15848
|
+
NO_FAILING_TURN_RUN,
|
|
15849
|
+
analyzeFailingTurnRun,
|
|
15692
15850
|
ACCOUNT_ENFORCEMENT_MARKER_FILENAME,
|
|
15693
15851
|
serializeAccountEnforcementMarker,
|
|
15694
15852
|
KANBAN_CHECK_COMMAND,
|
|
@@ -15733,4 +15891,4 @@ export {
|
|
|
15733
15891
|
peekCurrentSession,
|
|
15734
15892
|
readDailySessionPin
|
|
15735
15893
|
};
|
|
15736
|
-
//# sourceMappingURL=chunk-
|
|
15894
|
+
//# sourceMappingURL=chunk-SFOIRACS.js.map
|